mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-27 19:38:32 +03:00
2 lines
No EOL
199 KiB
JavaScript
2 lines
No EOL
199 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{142:function(e){e.exports=JSON.parse('{"a":"/shlink-web-client/dependabot/npm_and_yarn/ws-6.2.2"}')},148:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(46),a=function(e){var t=e.color,r=void 0===t?c.c:t,a=e.className;return Object(n.jsx)("svg",{className:a,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:Object(n.jsxs)("g",{fill:r,children:[Object(n.jsx)("path",{d:" M 23.71 85.08 C 17.22 49.81 49.44 14.86 85.08 18.12 C 118.83 19.21 145.72 53.33 139.45 86.37 C 155.64 102.30 171.32 118.83 187.87 134.36 C 198.32 111.73 208.84 89.12 219.57 66.62 C 226.05 53.84 243.47 48.74 255.73 56.27 C 263.76 62.10 270.34 69.69 277.25 76.75 C 286.28 86.61 285.72 102.89 276.31 112.31 C 223.38 165.37 170.38 218.37 117.35 271.34 C 107.72 280.99 91.01 281.25 81.11 271.86 C 74.39 264.94 66.82 258.69 61.24 250.77 C 53.72 238.52 58.85 221.07 71.64 214.62 C 94.11 203.87 116.72 193.38 139.33 182.91 C 123.81 166.36 107.30 150.68 91.37 134.49 C 60.20 140.28 27.37 116.78 23.71 85.08 Z"}),Object(n.jsx)("path",{d:" M 205.21 201.23 C 225.32 181.36 260.88 181.11 281.14 200.86 C 299.25 218.75 317.37 236.65 335.10 254.93 C 356.73 278.01 352.01 318.70 326.03 336.56 C 320.07 330.47 313.73 324.65 308.12 318.28 C 323.86 309.39 328.76 286.18 316.63 272.39 C 301.73 256.95 286.30 242.03 271.24 226.75 C 264.49 219.65 256.80 212.00 246.37 211.52 C 224.65 208.64 205.52 233.36 214.49 253.58 C 221.09 266.81 234.22 275.12 243.62 286.24 C 240.43 295.96 238.09 306.13 238.29 316.46 C 225.55 304.29 213.16 291.73 200.89 279.09 C 180.97 257.57 183.10 220.45 205.21 201.23 Z"}),Object(n.jsx)("path",{d:" M 273.90 352.07 C 252.28 328.99 256.98 288.31 282.96 270.46 C 288.93 276.54 295.26 282.36 300.88 288.72 C 285.14 297.62 280.23 320.82 292.38 334.61 C 307.27 350.05 322.70 364.96 337.75 380.25 C 344.51 387.35 352.20 395.00 362.64 395.48 C 384.35 398.37 403.49 373.64 394.51 353.42 C 387.92 340.18 374.78 331.88 365.38 320.76 C 368.56 311.04 370.91 300.86 370.71 290.54 C 383.45 302.70 395.84 315.27 408.11 327.91 C 428.03 349.43 425.90 386.55 403.78 405.77 C 383.68 425.64 348.13 425.89 327.86 406.14 C 309.75 388.25 291.60 370.37 273.90 352.07 Z"}),Object(n.jsx)("path",{d:" M 422.11 403.83 C 431.96 394.07 441.60 384.06 451.66 374.51 C 460.90 383.74 471.89 392.70 474.89 406.11 C 480.16 429.97 484.08 454.13 488.76 478.12 C 490.00 483.41 484.47 488.29 479.35 486.63 C 454.66 481.52 429.55 478.12 405.14 471.84 C 393.17 467.97 385.20 457.75 376.55 449.27 C 386.39 439.49 396.13 429.60 406.06 419.91 C 416.37 433.45 435.74 414.00 422.11 403.83 Z"})]})})}},149:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(3),c=r(0),a=r(1),s=r(28),i=r(53),o=r(30),l=r(60);function u(e,t){return function(r){var u=Object(s.h)(),d=r.selectServer,j=r.selectedServer;return Object(a.useEffect)((function(){u.serverId&&d(u.serverId)}),[u.serverId]),j?Object(o.c)(j)?Object(c.jsx)(t,{}):Object(c.jsx)(e,Object(n.a)({},r)):Object(c.jsx)(l.a,{children:Object(c.jsx)(i.a,{loading:!0})})}}},152:function(e,t,r){"use strict";var n=r(0),c=r(21),a=r(33);t.a=function(e){var t=e.to,r=void 0===t?"/":t,s=e.children,i=void 0===s?"Home":s;return Object(n.jsx)("div",{className:"home",children:Object(n.jsxs)(a.a,{className:"p-4",children:[Object(n.jsx)("h2",{children:"Oops! We could not find requested route."}),Object(n.jsx)("p",{children:"Use your browser's back button to navigate to the page you have previously come from, or just press this button."}),Object(n.jsx)("br",{}),Object(n.jsx)(c.b,{to:r,className:"btn btn-outline-primary btn-lg",children:i})]})})}},164:function(e,t,r){"use strict";var n=r(0),c=r(553),a=r(554),s=r(21),i=r(8),o=r.n(i),l=r(11),u=r(12),d=function(e){var t=e.id,r=e.name;return Object(n.jsxs)(c.a,{tag:s.b,to:"/server/".concat(t),className:"servers-list__server-item",children:[r,Object(n.jsx)(l.a,{icon:u.j,className:"servers-list__server-item-icon"})]})};t.a=function(e){var t=e.servers,r=e.children,c=e.embedded,s=void 0!==c&&c;return Object(n.jsxs)(n.Fragment,{children:[r&&Object(n.jsx)("h5",{className:"mb-md-3",children:r}),t.length>0&&Object(n.jsx)(a.a,{className:o()("servers-list__list-group",{"servers-list__list-group--embedded":s}),children:t.map((function(e){var t=e.id,r=e.name;return Object(n.jsx)(d,{id:t,name:r},t)}))})]})}},19:function(e,t,r){"use strict";r.d(t,"d",(function(){return o})),r.d(t,"f",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"c",(function(){return d})),r.d(t,"a",(function(){return j})),r.d(t,"b",(function(){return b}));var n=r(7),c=r(1),a=r(275),s=r(28),i=r(50),o=function(e,t){return function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,s=Object(c.useState)(r),i=Object(n.a)(s,2),o=i[0],l=i[1],u=Object(c.useRef)(void 0),d=function(){l(!r),u.current&&t(u.current),u.current=e((function(){return l(r)}),a)};return[o,d]}},l=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Object(c.useState)(e),r=Object(n.a)(t,2),a=r[0],s=r[1];return[a,function(){return s(!a)},function(){return s(!0)},function(){return s(!1)}]},u=function(e,t){var r=function(e){return function(t){t.event.composedPath().some((function(e){var t=e.classList;return null===t||void 0===t?void 0:t.contains("visits-table")}))||document.querySelector(".modal")||e()}};return Object(a.useSwipeable)({delta:40,onSwipedLeft:r(t),onSwipedRight:r(e)})},d=function(e,t){var r=Object(c.useState)(t),a=Object(n.a)(r,2),s=a[0],o=a[1];return[s,function(t){var r=window,n=r.location,c=r.history,a=Object(i.a)(n.search);a[e]=t,c.pushState(null,"","".concat(n.pathname,"?").concat(Object(i.b)(a))),o(t)}]},j=function(e,t){var r=Object(c.useRef)(!0);Object(c.useEffect)((function(){!r.current&&e(),r.current=!1}),t)},b=function(){var e=Object(s.g)();return function(){return e(-1)}}},272:function(e,t,r){"use strict";(function(e){var n=r(273),c=r.n(n),a=r(274),s=r(306),i=r(307),o=r(308),l=r(309),u=r(276),d=r(304),j=r(98),b=r(278);t.a=function(t,r){t.constant("window",e.window),t.constant("console",e.console),t.constant("axios",c.a),t.service("ImageDownloader",b.a,"axios","window"),t.serviceFactory("ScrollToTop",a.a),t.serviceFactory("MainHeader",s.a,"ServersDropdown"),t.serviceFactory("Home",(function(){return i.a})),t.decorator("Home",j.a),t.decorator("Home",r(["servers"],["resetSelectedServer"])),t.serviceFactory("MenuLayout",o.a,"TagsList","ShortUrlsList","AsideMenu","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","NonOrphanVisits","ServerError","Overview","EditShortUrl","ManageDomains"),t.decorator("MenuLayout",r(["selectedServer"],["selectServer"])),t.serviceFactory("AsideMenu",l.a,"DeleteServerButton"),t.serviceFactory("ShlinkVersionsContainer",(function(){return d.a})),t.decorator("ShlinkVersionsContainer",r(["selectedServer"])),t.serviceFactory("ErrorHandler",u.a,"window","console")}}).call(this,r(52))},274:function(e,t,r){"use strict";var n=r(0),c=r(1),a=r(28);t.a=function(){return function(e){var t=e.children,r=Object(a.f)();return Object(c.useEffect)((function(){scrollTo(0,0)}),[r]),Object(n.jsx)(n.Fragment,{children:t})}}},276:function(e,t,r){"use strict";var n=r(22),c=r(27),a=r(39),s=r(38),i=r(0),o=r(1),l=r(213),u=r(33);t.a=function(e,t){var r=e.location,d=t.error;return function(e){Object(a.a)(o,e);var t=Object(s.a)(o);function o(e){var r;return Object(n.a)(this,o),(r=t.call(this,e)).state={hasError:!1},r}return Object(c.a)(o,[{key:"componentDidCatch",value:function(e){d(e)}},{key:"render",value:function(){return this.state.hasError?Object(i.jsx)("div",{className:"home",children:Object(i.jsxs)(u.a,{className:"p-4",children:[Object(i.jsx)("h1",{children:"Oops! This is awkward :S"}),Object(i.jsx)("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),Object(i.jsx)("br",{}),Object(i.jsx)(l.a,{outline:!0,color:"primary",onClick:function(){return r.reload()},children:"Take me back"})]})}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),o}(o.Component)}},278:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(6),c=r.n(n),a=r(14),s=r(22),i=r(27),o=r(99),l=function(){function e(t,r){Object(s.a)(this,e),this.axios=t,this.window=r}return Object(i.a)(e,[{key:"saveImage",value:function(){var e=Object(a.a)(c.a.mark((function e(t,r){var n,a,s;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.axios.get(t,{responseType:"blob"});case 2:n=e.sent,a=n.data,s=URL.createObjectURL(a),Object(o.b)(this.window,s,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}()}]),e}()},294:function(e,t,r){"use strict";(function(e){var n=r(19),c=r(295),a=r(296);t.a=function(t){t.constant("localStorage",e.localStorage),t.service("Storage",c.a,"localStorage"),t.service("ColorGenerator",a.a,"Storage"),t.constant("setTimeout",e.setTimeout),t.constant("clearTimeout",e.clearTimeout),t.serviceFactory("useStateFlagTimeout",n.d,"setTimeout","clearTimeout")}}).call(this,r(52))},295:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(22),c=function(e){return"".concat("shlink",".").concat(e)},a=function e(t){var r=this;Object(n.a)(this,e),this.localStorage=t,this.get=function(e){var t=r.localStorage.getItem(c(e));return t?JSON.parse(t):void 0},this.set=function(e,t){return r.localStorage.setItem(c(e),JSON.stringify(t))}}},296:function(e,t,r){"use strict";r.d(t,"a",(function(){return h}));var n=r(26),c=r(22),a=r(167),s=r(32),i="0123456789ABCDEF",o=Math.floor,l=Math.random,u=Math.sqrt,d=Math.round,j=function(e){return e.toLowerCase().trim()},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return d(u(.299*Math.pow(e,2)+.587*Math.pow(t,2)+.114*Math.pow(r,2)))},h=function e(t){var r,u=this;Object(c.a)(this,e),this.storage=t,this.colors=void 0,this.lights=void 0,this.getColorForKey=function(e){var t=j(e),r=u.colors[t];return r||u.setColorForKey(t,"#".concat(Object(s.e)(6,(function(){return i[o(l()*i.length)]})).join("")))},this.setColorForKey=function(e,t){var r=j(e);return u.colors[r]=t,u.storage.set("colors",u.colors),t},this.isColorLightForKey=function(e){var t=u.getColorForKey(e).substring(1);if(Object(a.a)(u.lights[t])){var r=function(e){var t;return(null!==(t=e.match(/../g))&&void 0!==t?t:[]).map((function(e){return parseInt(e,16)||0}))}(t);u.lights[t]=b.apply(void 0,Object(n.a)(r))>=128}return u.lights[t]},this.colors=null!==(r=this.storage.get("colors"))&&void 0!==r?r:{},this.lights={}}},30:function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"e",(function(){return a})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return o})),r.d(t,"f",(function(){return l}));var n=r(536),c=function(e){return!(null===e||void 0===e||!e.url)&&!(null===e||void 0===e||!e.apiKey)},a=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("id"))},s=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("version"))},i=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("serverNotFound"))},o=function(e){return a(e)?e.id:""},l=function(e){return Object(n.a)(["id","autoConnect"],e)}},304:function(e,t,r){"use strict";var n=r(0),c=r(8),a=r.n(c),s=r(30),i=r(541),o=r(45),l=r(70),u=Object(i.a)(Object(l.c)(),l.b),d=function(e){var t=e.project,r=e.version;return Object(n.jsx)(o.a,{href:"https://github.com/shlinkio/".concat(t,"/releases/").concat(r),className:"text-muted",children:Object(n.jsx)("b",{children:r})})},j=function(e){var t=e.selectedServer,r=e.clientVersion,c=u(void 0===r?"%_VERSION_%":r);return Object(n.jsxs)("small",{className:"text-muted",children:[Object(s.d)(t)&&Object(n.jsxs)(n.Fragment,{children:["Server: ",Object(n.jsx)(d,{project:"shlink",version:t.printableVersion})," - "]}),"Client: ",Object(n.jsx)(d,{project:"shlink-web-client",version:c})]})};t.a=function(e){var t=e.selectedServer,r=a()("text-center",{"shlink-versions-container--with-server":Object(s.d)(t)});return Object(n.jsx)("div",{className:r,children:Object(n.jsx)(j,{selectedServer:t})})}},306:function(e,t,r){"use strict";var n=r(7),c=r(0),a=r(12),s=r(11),i=r(1),o=r(28),l=r(21),u=r(546),d=r(547),j=r(548),b=r(549),h=r(550),O=r(551),v=r(552),f=r(8),m=r.n(f),g=r(19),x=r(148);t.a=function(e){return function(){var t=Object(g.f)(),r=Object(n.a)(t,4),f=r[0],p=r[1],S=r[3],y=Object(o.f)(),C=y.pathname;Object(i.useEffect)(S,[y]);var N="/settings",k=m()("main-header__toggle-icon",{"main-header__toggle-icon--opened":f});return Object(c.jsxs)(u.a,{color:"primary",dark:!0,fixed:"top",className:"main-header",expand:"md",children:[Object(c.jsxs)(d.a,{tag:l.b,to:"/",children:[Object(c.jsx)(x.a,{className:"main-header__brand-logo",color:"white"})," Shlink"]}),Object(c.jsx)(j.a,{onClick:p,children:Object(c.jsx)(s.a,{icon:a.i,className:k})}),Object(c.jsx)(b.a,{navbar:!0,isOpen:f,children:Object(c.jsxs)(h.a,{navbar:!0,className:"ml-auto",children:[Object(c.jsx)(O.a,{children:Object(c.jsxs)(v.a,{tag:l.b,to:N,active:C===N,children:[Object(c.jsx)(s.a,{icon:a.l}),"\xa0 Settings"]})}),Object(c.jsx)(e,{})]})})]})}}},307:function(e,t,r){"use strict";var n=r(0),c=r(1),a=r(555),s=r(313),i=r(28),o=r(21),l=r(311),u=r(537),d=r(45),j=r(11),b=r(12),h=r(164),O=r(148);t.a=function(e){var t=e.servers,r=Object(i.g)(),v=Object(a.a)(t),f=!Object(s.a)(v);return Object(c.useEffect)((function(){var e=v.find((function(e){return e.autoConnect}));e&&r("/server/".concat(e.id))}),[]),Object(n.jsx)("div",{className:"home",children:Object(n.jsx)(l.a,{className:"home__main-card",children:Object(n.jsxs)(u.a,{noGutters:!0,children:[Object(n.jsx)("div",{className:"col-md-5 d-none d-md-block",children:Object(n.jsx)("div",{className:"home__logo-wrapper",children:Object(n.jsx)("div",{className:"home__logo",children:Object(n.jsx)(O.a,{})})})}),Object(n.jsxs)("div",{className:"col-md-7 home__servers-container",children:[Object(n.jsx)("div",{className:"home__title-wrapper",children:Object(n.jsx)("h1",{className:"home__title",children:"Welcome!"})}),Object(n.jsx)(h.a,{embedded:!0,servers:v,children:!f&&Object(n.jsxs)("div",{className:"p-4 text-center",children:[Object(n.jsx)("p",{className:"mb-5",children:"This application will help you manage your Shlink servers."}),Object(n.jsx)("p",{children:Object(n.jsxs)(o.b,{to:"/server/create",className:"btn btn-outline-primary btn-lg mr-2",children:[Object(n.jsx)(j.a,{icon:b.F})," ",Object(n.jsx)("span",{className:"ml-1",children:"Add a server"})]})}),Object(n.jsx)("p",{className:"mb-0 mt-5",children:Object(n.jsx)(d.a,{href:"https://shlink.io/documentation",children:Object(n.jsxs)("small",{children:[Object(n.jsx)("span",{className:"mr-1",children:"Learn more about Shlink"})," ",Object(n.jsx)(j.a,{icon:b.p})]})})})]})})]})]})})})}},308:function(e,t,r){"use strict";var n=r(3),c=r(7),a=r(0),s=r(1),i=r(28),o=r(12),l=r(11),u=r(8),d=r.n(u),j=r(149),b=r(19),h=r(40),O=r(30),v=r(152);t.a=function(e,t,r,u,f,m,g,x,p,S,y,C){return Object(j.a)((function(j){var N=j.selectedServer,k=Object(i.f)(),_=Object(b.f)(),w=Object(c.a)(_,4),U=w[0],T=w[1],R=w[2],E=w[3];if(Object(s.useEffect)((function(){return E()}),[k]),!Object(O.d)(N))return Object(a.jsx)(p,{});var D=Object(h.g)(N),L=Object(h.f)(N),V=Object(h.d)(N),I=d()("menu-layout__burger-icon",{"menu-layout__burger-icon--active":U}),F=Object(b.e)(R,E);return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(l.a,{icon:o.c,className:I,onClick:T}),Object(a.jsx)("div",Object(n.a)(Object(n.a)({},F),{},{className:"menu-layout__swipeable",children:Object(a.jsxs)("div",{className:"menu-layout__swipeable-inner",children:[Object(a.jsx)(r,{selectedServer:N,showOnMobile:U}),Object(a.jsx)("div",{className:"menu-layout__container",onClick:function(){return E()},children:Object(a.jsx)("div",{className:"container-xl",children:Object(a.jsxs)(i.d,{children:[Object(a.jsx)(i.b,{index:!0,element:Object(a.jsx)(i.a,{replace:!0,to:"overview"})}),Object(a.jsx)(i.b,{path:"/overview",element:Object(a.jsx)(S,{})}),Object(a.jsx)(i.b,{path:"/list-short-urls/:page",element:Object(a.jsx)(t,{})}),Object(a.jsx)(i.b,{path:"/create-short-url",element:Object(a.jsx)(u,{})}),Object(a.jsx)(i.b,{path:"/short-code/:shortCode/visits/*",element:Object(a.jsx)(f,{})}),Object(a.jsx)(i.b,{path:"/short-code/:shortCode/edit",element:Object(a.jsx)(y,{})}),Object(a.jsx)(i.b,{path:"/tag/:tag/visits/*",element:Object(a.jsx)(m,{})}),D&&Object(a.jsx)(i.b,{path:"/orphan-visits/*",element:Object(a.jsx)(g,{})}),L&&Object(a.jsx)(i.b,{path:"/non-orphan-visits/*",element:Object(a.jsx)(x,{})}),Object(a.jsx)(i.b,{path:"/manage-tags",element:Object(a.jsx)(e,{})}),V&&Object(a.jsx)(i.b,{path:"/manage-domains",element:Object(a.jsx)(C,{})}),Object(a.jsx)(i.b,{path:"*",element:Object(a.jsx)(v.a,{to:"/server/".concat(N.id,"/list-short-urls/1"),children:"List short URLs"})})]})})})]})}))]})}),p)}},309:function(e,t,r){"use strict";var n=r(3),c=r(35),a=r(0),s=r(12),i=r(11),o=r(21),l=r(28),u=r(8),d=r.n(u),j=r(30),b=r(40),h=function(e){var t=e.children,r=e.to,s=e.className,i=Object(c.a)(e,["children","to","className"]);return Object(a.jsx)(o.c,Object(n.a)(Object(n.a)({className:function(e){var t=e.isActive;return d()("aside-menu__item",s,{"aside-menu__item--selected":t})},to:r},i),{},{children:t}))};t.a=function(e){return function(t){var r=t.selectedServer,n=t.showOnMobile,c=void 0!==n&&n,o=Object(j.e)(r),u=o?r.id:"",O=Object(l.f)().pathname,v=Object(b.d)(r),f=d()("aside-menu",{"aside-menu--hidden":!c}),m=function(e){return"/server/".concat(u).concat(e)};return Object(a.jsx)("aside",{className:f,children:Object(a.jsxs)("nav",{className:"nav flex-column aside-menu__nav",children:[Object(a.jsxs)(h,{to:m("/overview"),children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.u}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Overview"})]}),Object(a.jsxs)(h,{to:m("/list-short-urls/1"),className:d()({"aside-menu__item--selected":null!==O.match("/list-short-urls")}),children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.x}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"List short URLs"})]}),Object(a.jsxs)(h,{to:m("/create-short-url"),children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.w,flip:"horizontal"}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Create short URL"})]}),Object(a.jsxs)(h,{to:m("/manage-tags"),children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.O}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Manage tags"})]}),v&&Object(a.jsxs)(h,{to:m("/manage-domains"),children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.t}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Manage domains"})]}),Object(a.jsxs)(h,{to:m("/edit"),className:"aside-menu__item--push",children:[Object(a.jsx)(i.a,{fixedWidth:!0,icon:s.C}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Edit this server"})]}),o&&Object(a.jsx)(e,{className:"aside-menu__item aside-menu__item--danger",textClassName:"aside-menu__item-text",server:r})]})})}}},314:function(e,t,r){e.exports=r(532)},32:function(e,t,r){"use strict";r.d(t,"e",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return d}));var n=r(542),c=r(167),a=r(313),s=r(541),i=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Object(n.a)(r,e+1).map(t)},o=function(e){return!Object(c.a)(e)&&!Object(a.a)(e)},l=function(e){return Object(s.a)((function(e){return e.preventDefault()}),e)},u=function(e){return Object(a.a)(e)?null:e},d=function(e){return"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1))}},33:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(3),c=r(35),a=r(0),s=r(311),i=r(539),o=r(540),l=function(e){var t=e.title,r=e.children,l=e.bodyClassName,u=Object(c.a)(e,["title","children","bodyClassName"]);return Object(a.jsxs)(s.a,Object(n.a)(Object(n.a)({},u),{},{children:[t&&Object(a.jsx)(i.a,{children:t}),Object(a.jsx)(o.a,{className:l,children:r})]}))}},40:function(e,t,r){"use strict";r.d(t,"i",(function(){return s})),r.d(t,"k",(function(){return i})),r.d(t,"g",(function(){return o})),r.d(t,"h",(function(){return l})),r.d(t,"l",(function(){return u})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return j})),r.d(t,"j",(function(){return b})),r.d(t,"d",(function(){return h})),r.d(t,"e",(function(){return O})),r.d(t,"c",(function(){return v})),r.d(t,"f",(function(){return f}));var n=r(30),c=r(70),a=function(e){return function(t){return Object(n.d)(t)&&Object(c.a)(t.version,e)}},s=a({minVersion:"2.5.0"}),i=a({minVersion:"2.6.0"}),o=i,l=i,u=i,d=a({minVersion:"2.7.0"}),j=d,b=a({minVersion:"2.8.0"}),h=b,O=a({minVersion:"2.9.0"}),v=a({minVersion:"2.10.0"}),f=a({minVersion:"3.0.0"})},401:function(e,t){},403:function(e,t){},46:function(e,t,r){"use strict";r.d(t,"c",(function(){return n})),r.d(t,"d",(function(){return c})),r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s})),r.d(t,"f",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"g",(function(){return l})),r.d(t,"h",(function(){return u}));var n="#4696e5",c="rgba(70, 150, 229, 0.4)",a="#f77f28",s="rgba(247, 127, 40, 0.4)",i="white",o="#161b22",l=function(e){var t,r=document.getElementsByTagName("html");null===r||void 0===r||null===(t=r[0])||void 0===t||t.setAttribute("data-theme",e)},u=function(){var e,t=document.getElementsByTagName("html");return"dark"===(null===t||void 0===t||null===(e=t[0])||void 0===e?void 0:e.getAttribute("data-theme"))}},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s}));var n=r(212),c=r.n(n),a=function(e){return c.a.parse(e,{ignoreQueryPrefix:!0})},s=function(e){return c.a.stringify(e,{arrayFormat:"brackets"})}},53:function(e,t,r){"use strict";var n=r(0),c=r(537),a=r(311),s=r(8),i=r.n(s),o=r(12),l=r(11),u=function(e){return{error:"border-danger",default:""}[e]},d=function(e){return{error:"text-danger",default:"text-muted"}[e]};t.a=function(e){var t=e.className,r=e.children,s=e.loading,j=void 0!==s&&s,b=e.type,h=void 0===b?"default":b,O=e.fullWidth,v=void 0!==O&&O,f=i()({"col-md-12":v,"col-md-10 offset-md-1":!v});return Object(n.jsx)(c.a,{noGutters:!0,className:t,children:Object(n.jsx)("div",{className:f,children:Object(n.jsx)(a.a,{className:u(h),body:!0,children:Object(n.jsxs)("h3",{className:i()("text-center mb-0",d(h)),children:[j&&Object(n.jsx)(l.a,{icon:o.k,spin:!0}),j&&Object(n.jsx)("span",{className:"ml-2",children:null!==r&&void 0!==r?r:"Loading..."}),!j&&r]})})})})}},532:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"processStatsFromVisits",(function(){return qa})),r.d(n,"normalizeVisits",(function(){return za}));var c,a=r(0),s=r(48),i=r(162),o=r(21),l=r(142),u=r(10),d=r(3),j=r(271),b=r(602),h=r(608),O=r(30),v=r(6),f=r.n(v),m=r(14),g=r(22),x=r(35),p=r(305),S=r(167),y=r(313),C=r(50),N=r(7),k=function(e,t,r){return e!==t?"ASC":r?{ASC:"DESC",DESC:void 0}[r]:"ASC"},_=function(e,t){var r=t.field,n=t.dir;return r&&n?e.sort((function(e,t){var c="ASC"===n?1:-1,a="ASC"===n?-1:1;return e[r]>t[r]?c:a})):e},w=function(e){return e.dir?"".concat(e.field,"-").concat(e.dir):void 0},U=function(e){var t=e.split("-"),r=Object(N.a)(t,2);return{field:r[0],dir:r[1]}},T=function(e){return e?"".concat(e,"/rest/v2"):""},R=Object(p.a)(S.a),E=function(e){var t=e.orderBy,r=void 0===t?{}:t,n=Object(x.a)(e,["orderBy"]);return Object(d.a)(Object(d.a)({},n),{},{orderBy:w(r)})},D=function e(t,r,n){var c=this;Object(g.a)(this,e),this.axios=t,this.baseUrl=r,this.apiKey=n,this.listShortUrls=Object(m.a)(f.a.mark((function e(){var t,r=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},e.abrupt("return",c.performRequest("/short-urls","GET",E(t)).then((function(e){return e.data.shortUrls})));case 2:case"end":return e.stop()}}),e)}))),this.createShortUrl=function(){var e=Object(m.a)(f.a.mark((function e(t){var r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(p.a)((function(e){return Object(y.a)(e)||Object(S.a)(e)}),t),e.abrupt("return",c.performRequest("/short-urls","POST",{},r).then((function(e){return e.data})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getShortUrlVisits=function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t,"/visits"),"GET",r).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.getTagVisits=function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags/".concat(t,"/visits"),"GET",r).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.getOrphanVisits=function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits/orphan","GET",t).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getNonOrphanVisits=function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits/non-orphan","GET",t).then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getVisitsOverview=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/visits","GET").then((function(e){return e.data.visits})));case 1:case"end":return e.stop()}}),e)}))),this.getShortUrl=function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"GET",{domain:r}).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.deleteShortUrl=function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"DELETE",{domain:r}).then((function(){})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.updateShortUrlTags=function(){var e=Object(m.a)(f.a.mark((function e(t,r,n){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t,"/tags"),"PUT",{domain:r},{tags:n}).then((function(e){return e.data.tags})));case 1:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),this.updateShortUrl=function(){var e=Object(m.a)(f.a.mark((function e(t,r,n){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/short-urls/".concat(t),"PATCH",{domain:r},n).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),this.listTags=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","GET",{withStats:"true"}).then((function(e){return e.data.tags})).then((function(e){return{tags:e.data,stats:e.stats}})));case 1:case"end":return e.stop()}}),e)}))),this.deleteTags=function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","DELETE",{tags:t}).then((function(){return{tags:t}})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.editTag=function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/tags","PUT",{},{oldName:t,newName:r}).then((function(){return{oldName:t,newName:r}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),this.health=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/health","GET").then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)}))),this.mercureInfo=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/mercure-info","GET").then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)}))),this.listDomains=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/domains","GET").then((function(e){return e.data.domains})));case 1:case"end":return e.stop()}}),e)}))),this.editDomainRedirects=function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.performRequest("/domains/redirects","PATCH",{},t).then((function(e){return e.data})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.performRequest=function(){var e=Object(m.a)(f.a.mark((function e(t){var r,n,a,s=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:"GET",n=s.length>2&&void 0!==s[2]?s[2]:{},a=s.length>3&&void 0!==s[3]?s[3]:{},e.abrupt("return",c.axios({method:r,url:"".concat(T(c.baseUrl)).concat(t),headers:{"X-Api-Key":c.apiKey},params:R(n),data:a,paramsSerializer:C.b}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},L={},V=function(e){return function(t){var r,n=function(e){return"function"===typeof e}(t)?(r=t,Object(h.a)("selectedServer",r())):t;if(!Object(O.b)(n))throw new Error("There's no selected server or it is not found");var c=n.url,a=n.apiKey,s="".concat(c,"_").concat(a);return L[s]||(L[s]=new D(e,c,a)),L[s]}},I=function(e){e.serviceFactory("buildShlinkApiClient",V,"axios")},F=r(272),A=r(12),M=r(11),G=r(541),P=r(357),B=r(1),H=r(8),W=r.n(H),q=function(e){var t=e.onChange,r=e.className,n=e.large,s=void 0===n||n,i=e.noBorder,o=void 0!==i&&i,l=e.initialValue,u=void 0===l?"":l,d=Object(B.useState)(u),j=Object(N.a)(d,2),b=j[0],h=j[1],O=function(){c&&clearTimeout(c),c=null},v=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;h(e),O(),c=setTimeout((function(){t(e),O()}),r)};return Object(a.jsxs)("div",{className:W()("search-field",r),children:[Object(a.jsx)("input",{type:"text",className:W()("form-control search-field__input",{"form-control-lg":s,"search-field__input--no-border":o}),placeholder:"Search...",value:b,onChange:function(e){return v(e.target.value)}}),Object(a.jsx)(M.a,{icon:A.I,className:"search-field__icon"}),Object(a.jsx)("div",{className:"close search-field__close",hidden:""===b,id:"search-field__close",onClick:function(){return v("",0)},children:"\xd7"})]})},z=function(e){var t=e.text,r=e.children,n=e.clearable,c=e.className,s=void 0===c?"":c,i=e.colorGenerator,o=e.onClick,l=e.onClose;return Object(a.jsxs)("span",{className:W()("badge tag",s,{"tag--light-bg":i.isColorLightForKey(t)}),style:{backgroundColor:i.getColorForKey(t),cursor:n||!o?"auto":"pointer"},onClick:o,children:[null!==r&&void 0!==r?r:t,n&&Object(a.jsx)("span",{className:"close tag__close-selected-tag",onClick:l,children:"\xd7"})]})},K=r(561),Q=r(125),J=r(556),Z=r(557),Y=r(19),X=function(e){var t=e.text,r=e.disabled,n=void 0!==r&&r,c=e.className,s=void 0===c?"":c,i=e.children,o=e.dropdownClassName,l=e.right,u=void 0!==l&&l,d=e.minWidth,j=Object(Y.f)(),b=Object(N.a)(j,2),h=b[0],O=b[1],v="dropdown-btn__toggle btn-block ".concat(s),f={minWidth:d&&"".concat(d,"px")};return Object(a.jsxs)(Q.a,{isOpen:h,toggle:O,disabled:n,className:o,children:[Object(a.jsx)(J.a,{caret:!0,className:v,color:"primary",children:t}),Object(a.jsx)(Z.a,{className:"w-100",right:u,style:f,children:i})]})},$=r(89),ee=r(361),te=r(199),re=r(303),ne=r(559),ce=r(560),ae=r(534),se=r(558),ie=(r(533),r(358)),oe=r(359),le=r(360),ue=function(e){return"string"!==typeof e},de=function(e,t){return e&&ue(e)?t?Object(ae.default)(e,t):Object(se.a)(e):e},je=function(e){return de(e,void 0)},be=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return function(t){return de(t,e)}}(),he=function(e){return ue(e)?e:Object(P.default)(e)},Oe=function(e,t,r){try{return Object(ie.default)(he(e),{start:he(null!==t&&void 0!==t?t:e),end:he(null!==r&&void 0!==r?r:e)})}catch(n){return!1}},ve=function(e,t){return Object(oe.default)(e,t)||Object(le.default)(e,t)},fe=function(e){return void 0===e||Object(y.a)(Object(re.a)(Boolean,e))},me=function(e){return"string"===typeof e},ge={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180Days:"Last 180 days",last365Days:"Last 365 days",all:void 0},xe=Object.keys(ge).filter((function(e){return"all"!==e})),pe=function(e){if(e&&"all"!==e)return me(e)?ge[e]:function(e){if(e&&!fe(e))return e.startDate&&!e.endDate?"Since ".concat(be(e.startDate)):!e.startDate&&e.endDate?"Until ".concat(be(e.endDate)):"".concat(be(e.startDate)," - ").concat(be(e.endDate))}(e)},Se=function(e){return Object($.default)(Object(ee.default)(new Date,e))},ye=function(e){return{startDate:e,endDate:Object(te.default)(new Date)}},Ce=function(e){if(!e||"all"===e)return{};switch(e){case"today":return ye(Object($.default)(new Date));case"yesterday":return{startDate:Se(1),endDate:Object(te.default)(Object(ee.default)(new Date,1))};case"last7Days":return ye(Se(7));case"last30Days":return ye(Se(30));case"last90Days":return ye(Se(90));case"last180Days":return ye(Se(180));case"last365Days":return ye(Se(365))}return{}},Ne=function(e){var t=he(e);return Object(ne.a)([[function(){return ve(Object($.default)(new Date),t)},function(){return"today"}],[function(){return ve(Se(1),t)},function(){return"yesterday"}],[function(){return ve(Se(7),t)},function(){return"last7Days"}],[function(){return ve(Se(30),t)},function(){return"last30Days"}],[function(){return ve(Se(90),t)},function(){return"last90Days"}],[function(){return ve(Se(180),t)},function(){return"last180Days"}],[function(){return ve(Se(365),t)},function(){return"last365Days"}],[ce.a,function(){return"all"}]])()},ke=r(281),_e=r.n(ke),we=r(69),Ue=function(e){var t=e.className,r=e.isClearable,n=e.selected,c=!r||Object(S.a)(n),s=Object(B.useRef)();return Object(a.jsxs)("div",{className:"date-input-container",children:[Object(a.jsx)(_e.a,Object(d.a)(Object(d.a)({},e),{},{dateFormat:"yyyy-MM-dd",className:W()("date-input-container__input form-control",t),ref:s})),c&&Object(a.jsx)(M.a,{icon:we.b,className:"date-input-container__icon",onClick:function(){var e;return null===(e=s.current)||void 0===e?void 0:e.input.focus()}})]})},Te=function(e){var t=e.startDate,r=void 0===t?null:t,n=e.endDate,c=void 0===n?null:n,s=e.disabled,i=void 0!==s&&s,o=e.onStartDateChange,l=e.onEndDateChange;return Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(Ue,{selected:r,placeholderText:"Since...",isClearable:!0,maxDate:null!==c&&void 0!==c?c:void 0,disabled:i,onChange:o})}),Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(Ue,{className:"mt-2 mt-md-0",selected:c,placeholderText:"Until...",isClearable:!0,minDate:null!==r&&void 0!==r?r:void 0,disabled:i,onChange:l})})]})},Re=function(e){var t=e.active,r=e.allText,n=e.onChange;return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(K.a,{active:"all"===t,onClick:function(){return n("all")},children:r}),Object(a.jsx)(K.a,{divider:!0}),xe.map((function(e){return Object(a.jsx)(K.a,{active:t===e,onClick:function(){return n(e)},children:pe(e)},e)}))]})},Ee=function(e){var t,r=e.onDatesChange,n=e.initialDateRange,c=e.defaultText,s=e.disabled,i=e.updatable,o=void 0!==i&&i,l=me(n),u=Object(B.useState)(l?n:void 0),j=Object(N.a)(u,2),b=j[0],h=j[1],O=Object(B.useState)(l?void 0:n),v=Object(N.a)(O,2),f=v[0],m=v[1],g=function(e){h(fe(e)?"all":void 0),m(e),r(e)},x=function(e){h(e),m(void 0),r(Ce(e))};return o&&Object(Y.a)((function(){var e=me(n);e&&x(n),n&&!e&&g(n)}),[n]),Object(a.jsxs)(X,{disabled:s,text:null!==(t=pe(null!==b&&void 0!==b?b:f))&&void 0!==t?t:c,children:[Object(a.jsx)(Re,{allText:c,active:b,onChange:x}),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsx)(K.a,{header:!0,children:"Custom:"}),Object(a.jsx)(K.a,{text:!0,children:Object(a.jsx)(Te,Object(d.a)(Object(d.a)({},f),{},{onStartDateChange:function(e){return g(Object(d.a)(Object(d.a)({},f),{},{startDate:e}))},onEndDateChange:function(e){return g(Object(d.a)(Object(d.a)({},f),{},{endDate:e}))}}))})]})},De=r(28),Le=function(){var e=Object(De.g)(),t=Object(De.f)(),r=Object(De.h)(),n=Object(B.useMemo)(Object(G.a)((function(){return Object(C.a)(t.search)}),(function(e){var t=e.orderBy,r=Object(x.a)(e,["orderBy"]);return t?Object(d.a)(Object(d.a)({},r),{},{orderBy:U(t)}):r})),[t.search]);return[n,function(t){var c=Object(d.a)(Object(d.a)({},n),t),a=c.orderBy,s=Object(x.a)(c,["orderBy"]),i=Object(d.a)(Object(d.a)({},s),{},{orderBy:a&&w(a)}),o=Object(C.b)(i),l=Object(y.a)(o)?"":"?".concat(o);e("/server/".concat(r.serverId,"/list-short-urls/1").concat(l))}]},Ve=function(e){return e?Object(P.default)(e):null},Ie=function(e){return function(){var t,r=Le(),n=Object(N.a)(r,2),c=n[0],s=c.search,i=c.tags,o=c.startDate,l=c.endDate,u=n[1],d=null!==(t=null===i||void 0===i?void 0:i.split(","))&&void 0!==t?t:[],j=Object(G.a)((function(e){var t,r,n=e.startDate,c=e.endDate;return{startDate:null!==(t=je(n))&&void 0!==t?t:void 0,endDate:null!==(r=je(c))&&void 0!==r?r:void 0}}),u),b=Object(G.a)((function(e){return Object(y.a)(e)?void 0:e}),(function(e){return u({search:e})})),h=Object(G.a)((function(e){return d.filter((function(t){return t!==e}))}),(function(e){return 0===e.length?void 0:e.join(",")}),(function(e){return u({tags:e})}));return Object(a.jsxs)("div",{className:"short-urls-filtering-bar-container",children:[Object(a.jsx)(q,{initialValue:s,onChange:b}),Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsx)("div",{className:"row",children:Object(a.jsx)("div",{className:"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6",children:Object(a.jsx)(Ee,{defaultText:"All short URLs",initialDateRange:{startDate:Ve(o),endDate:Ve(l)},onDatesChange:j})})})}),d.length>0&&Object(a.jsxs)("h4",{className:"short-urls-filtering-bar__selected-tag mt-3",children:[Object(a.jsx)(M.a,{icon:A.O,className:"short-urls-filtering-bar__tags-icon"}),"\xa0",d.map((function(t){return Object(a.jsx)(z,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return h(t)}},t)}))]})]})}},Fe=r(26),Ae=r(311),Me=r(562),Ge=r(563);function Pe(e){var t,r=e.items,n=e.order,c=e.onChange,s=e.isButton,i=void 0===s||s,o=e.right,l=void 0!==o&&o,u=function(e){return function(){var t=k(e,n.field,n.dir);c(t?e:void 0,t)}};return Object(a.jsxs)(Me.a,{children:[Object(a.jsxs)(J.a,{caret:!0,color:i?"primary":"link",className:W()({"dropdown-btn__toggle btn-block":i,"btn-sm p-0":!i}),children:[!i&&Object(a.jsx)(a.Fragment,{children:"Order by"}),i&&!n.field&&Object(a.jsx)(a.Fragment,{children:"Order by..."}),i&&n.field&&'Order by: "'.concat(r[n.field],'" - "').concat(null!==(t=n.dir)&&void 0!==t?t:"DESC",'"')]}),Object(a.jsxs)(Z.a,{right:l,className:W()("w-100",{"ordering-dropdown__menu--link":!i}),children:[Object(Ge.a)(r).map((function(e){var t=Object(N.a)(e,2),r=t[0],c=t[1];return Object(a.jsxs)(K.a,{active:n.field===r,onClick:u(r),children:[c,n.field===r&&Object(a.jsx)(M.a,{icon:"ASC"===n.dir?A.L:A.K,className:"ordering-dropdown__sort-icon"})]},r)})),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsx)(K.a,{disabled:!n.field,onClick:function(){return c()},children:Object(a.jsx)("i",{children:"Clear selection"})})]})]})}var Be=r(282);function He(e,t){var r=new Set;return function(n){var c=n.createNewVisits,s=n.loadMercureInfo,i=n.mercureInfo,o=i.interval,l=Object(De.h)();return Object(B.useEffect)((function(){var e=t(n,l),a=function(e,t,r,n){var c=e.mercureHubUrl,a=e.token,s=e.loading,i=e.error;if(!s&&!i&&c){var o=function(e){var t=e.data;return r(JSON.parse(t))},l=function(e){return 401===e.status&&n()},u=t.map((function(e){var t=new URL(c);t.searchParams.append("topic",e);var r=new Be.EventSourcePolyfill(t,{headers:{Authorization:"Bearer ".concat(a)}});return r.onmessage=o,r.onerror=l,r}));return function(){return u.forEach((function(e){return e.close()}))}}}(i,e,(function(e){return o?r.add(e):c([e])}),s);if(!o)return a;var u=setInterval((function(){c(Object(Fe.a)(r)),r.clear()}),1e3*o*60);return Object(G.a)((function(){return clearInterval(u)}),(function(){return null===a||void 0===a?void 0:a()}))}),[i]),Object(a.jsx)(e,Object(d.a)({},n))}}var We=function e(){Object(g.a)(this,e)};function qe(e){var t=e.currentOrder,r=e.field,n=e.className,c=void 0===n?"ml-1":n;return t.dir&&t.field===r?Object(a.jsx)(M.a,{icon:"ASC"===t.dir?A.f:A.e,className:c}):null}We.visits="https://shlink.io/new-visit",We.orphanVisits="https://shlink.io/new-orphan-visit",We.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var ze,Ke,Qe,Je,Ze,Ye,Xe,$e,et,tt,rt,nt,ct,at,st,it,ot,lt,ut,dt=r(609),jt=r(564),bt=function(e,t){return function(r,n){var c=n.type,a=e[c],s=null!==r&&void 0!==r?r:t;return a?a(s,n):s}},ht=function(e){return function(){return{type:e}}},Ot="shlink/realTimeUpdates/SET_SETTINGS",vt={field:"dateCreated",dir:"DESC"},ft={realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:vt}},mt=bt(Object(u.a)({},Ot,(function(e,t){return Object(dt.a)(e,Object(jt.a)("type",t))})),ft),gt=function(e){return{type:Ot,realTimeUpdates:{enabled:e}}},xt=function(e){return{type:Ot,realTimeUpdates:{interval:e}}},pt=function(e){return{type:Ot,shortUrlCreation:e}},St=function(e){return{type:Ot,shortUrlsList:e}},yt=function(e){return{type:Ot,ui:e}},Ct=function(e){return{type:Ot,visits:e}},Nt=function(e){return{type:Ot,tags:e}},kt=r(566),_t=r(567),wt=r(568),Ut=r(542),Tt=r(280),Rt=r(565),Et=Math.ceil,Dt=new Intl.NumberFormat("en-US"),Lt=function(e){return Dt.format(Number(e))},Vt="...",It=function(e,t){var r=Object(Ut.a)(Object(Tt.a)(2,e-2),Object(Rt.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Vt),e+2<t-1&&r.push(Vt),r.unshift(1),r.push(t),r},Ft=function(e){return e===Vt},At=function(e){return Ft(e)?e:Lt(e)},Mt=function(e,t){return Ft(e)?"".concat(e,"_").concat(t):"".concat(e)},Gt=function(e){var t=e.paginator,r=e.serverId,n=e.currentQueryString,c=void 0===n?"":n,s=null!==t&&void 0!==t?t:{},i=s.currentPage,l=void 0===i?0:i,u=s.pagesCount,d=void 0===u?0:u,j=function(e){return"/server/".concat(r,"/list-short-urls/").concat(e).concat(c)};if(d<=1)return null;return Object(a.jsxs)(wt.a,{className:"sticky-card-paginator",listClassName:"flex-wrap justify-content-center mb-0",children:[Object(a.jsx)(kt.a,{disabled:1===l,children:Object(a.jsx)(_t.a,{previous:!0,tag:o.b,to:j(l-1)})}),It(l,d).map((function(e,t){return Object(a.jsx)(kt.a,{disabled:Ft(e),active:l===e,children:Object(a.jsx)(_t.a,{tag:o.b,to:j(e),children:At(e)})},Mt(e,t))})),Object(a.jsx)(kt.a,{disabled:l>=d,children:Object(a.jsx)(_t.a,{next:!0,tag:o.b,to:j(l+1)})})]})},Pt={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Bt=function(e,t){return He((function(r){var n,c,s,i=r.listShortUrls,o=r.shortUrlsList,l=r.selectedServer,u=r.settings,d=Object(O.a)(l),j=Object(De.h)().page,b=Object(De.f)(),h=Le(),v=Object(N.a)(h,2),f=v[0],m=f.tags,g=f.search,x=f.startDate,p=f.endDate,S=f.orderBy,y=v[1],C=Object(B.useState)(null!==(n=null!==S&&void 0!==S?S:null===(c=u.shortUrlsList)||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:vt),_=Object(N.a)(C,2),w=_[0],U=_[1],T=Object(B.useMemo)((function(){var e;return null!==(e=null===m||void 0===m?void 0:m.split(","))&&void 0!==e?e:[]}),[m]),R=(null!==(s=null===o||void 0===o?void 0:o.shortUrls)&&void 0!==s?s:{}).pagination,E=function(e,t){y({orderBy:{field:e,dir:t}}),U({field:e,dir:t})},D=Object(G.a)((function(e){return Object(Fe.a)(new Set([].concat(Object(Fe.a)(T),[e]))).join(",")}),(function(e){return y({tags:e})}));return Object(B.useEffect)((function(){i({page:j,searchTerm:g,tags:T,startDate:x,endDate:p,orderBy:w})}),[j,g,T,x,p,w]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{className:"mb-3",children:Object(a.jsx)(t,{})}),Object(a.jsx)("div",{className:"d-block d-lg-none mb-3",children:Object(a.jsx)(Pe,{items:Pt,order:w,onChange:E})}),Object(a.jsxs)(Ae.a,{body:!0,className:"pb-1",children:[Object(a.jsx)(e,{selectedServer:l,shortUrlsList:o,orderByColumn:function(e){return function(){return E(e,k(e,w.field,w.dir))}},renderOrderIcon:function(e){return Object(a.jsx)(qe,{currentOrder:w,field:e})},onTagClick:D}),Object(a.jsx)(Gt,{paginator:R,serverId:d,currentQueryString:b.search})]})]})}),(function(){return[We.visits]}))},Ht=r(45),Wt=r(159),qt=r.n(Wt),zt=function(e){var t=e.text,r=e.onCopy;return Object(a.jsx)(qt.a,{text:t,onCopy:r,children:Object(a.jsx)(M.a,{icon:we.d,className:"ml-2 copy-to-clipboard-icon"})})},Kt=r(569),Qt=r(610),Jt=function(e){var t=e.date,r=e.format,n=void 0===r?"yyyy-MM-dd HH:mm":r,c=e.relative,s=void 0!==c&&c,i=ue(t)?t:Object(P.default)(t);return Object(a.jsx)("time",{dateTime:"".concat(Object(Kt.a)(i),"000"),children:s?"".concat(Object(Qt.a)(new Date,i)," ago"):Object(ae.default)(i,n)})},Zt=r(570),Yt=function(e,t,r){var n=e.id,c=t.shortCode,a=t.domain,s=a?"?domain=".concat(a):"";return"/server/".concat(n,"/short-code/").concat(c,"/").concat(r).concat(s)},Xt=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,s=Object(x.a)(e,["selectedServer","shortUrl","suffix","children"]);return t&&Object(O.e)(t)&&r?Object(a.jsx)(o.b,Object(d.a)(Object(d.a)({to:Yt(t,r,n)},s),{},{children:c})):Object(a.jsx)("span",Object(d.a)(Object(d.a)({},s),{},{children:c}))},$t=function(e){var t,r=e.visitsCount,n=e.shortUrl,c=e.selectedServer,s=e.active,i=void 0!==s&&s,o=null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.maxVisits,l=Object(a.jsx)(Xt,{selectedServer:c,shortUrl:n,suffix:"visits",children:Object(a.jsx)("strong",{className:W()("short-url-visits-count__amount",{"short-url-visits-count__amount--big":i}),children:Lt(r)})});if(!o)return l;var u=Lt(o),d=Object(B.useRef)();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)("span",{className:"indivisible",children:[l,Object(a.jsxs)("small",{className:"short-urls-visits-count__max-visits-control",ref:function(e){d.current=e},children:[" ","/ ",u," ",Object(a.jsx)("sup",{children:Object(a.jsx)(M.a,{icon:A.v})})]})]}),Object(a.jsxs)(Zt.a,{target:function(){return d.current},placement:"bottom",children:["This short URL will not accept more than ",Object(a.jsx)("b",{children:u})," visits."]})]})},er=function(e,t,r){return function(n){var c,s,i=n.shortUrl,o=n.selectedServer,l=n.onTagClick,u=r(),d=Object(N.a)(u,2),j=d[0],b=d[1],h=r(!1,500),O=Object(N.a)(h,2),v=O[0],f=O[1],m=Object(B.useRef)(!0);return Object(B.useEffect)((function(){m.current?m.current=!1:f()}),[i.visitsCount]),Object(a.jsxs)("tr",{className:"responsive-table__row",children:[Object(a.jsx)("td",{className:"indivisible short-urls-row__cell responsive-table__cell","data-th":"Created at",children:Object(a.jsx)(Jt,{date:i.dateCreated})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Short URL",children:Object(a.jsxs)("span",{className:"indivisible short-urls-row__cell--relative",children:[Object(a.jsx)(Ht.a,{href:i.shortUrl}),Object(a.jsx)(zt,{text:i.shortUrl,onCopy:b}),Object(a.jsx)("span",{className:"badge badge-warning short-urls-row__copy-hint",hidden:!j,children:"Copied short URL!"})]})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell short-urls-row__cell--break","data-th":"".concat(i.title?"Title":"Long URL"),children:Object(a.jsx)(Ht.a,{href:i.longUrl,children:null!==(c=i.title)&&void 0!==c?c:i.longUrl})}),i.title&&Object(a.jsx)("td",{className:"short-urls-row__cell responsive-table__cell short-urls-row__cell--break d-lg-none","data-th":"Long URL",children:Object(a.jsx)(Ht.a,{href:i.longUrl})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Tags",children:(s=i.tags,Object(y.a)(s)?Object(a.jsx)("i",{className:"indivisible",children:Object(a.jsx)("small",{children:"No tags"})}):s.map((function(e){return Object(a.jsx)(z,{colorGenerator:t,text:e,onClick:function(){return null===l||void 0===l?void 0:l(e)}},e)})))}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell text-lg-right","data-th":"Visits",children:Object(a.jsx)($t,{visitsCount:i.visitsCount,shortUrl:i,selectedServer:o,active:v})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell",children:Object(a.jsx)(e,{selectedServer:o,shortUrl:i})})]})}},tr=r(571),rr=function(e){var t=e.isOpen,r=e.toggle,n=e.children,c=e.right,s=void 0===c||c;return Object(a.jsxs)(tr.a,{toggle:r,isOpen:t,children:[Object(a.jsxs)(J.a,{size:"sm",caret:!0,outline:!0,className:"dropdown-btn-menu__dropdown-toggle",children:["\xa0",Object(a.jsx)(M.a,{icon:A.o}),"\xa0"]}),Object(a.jsx)(Z.a,{right:s,children:n})]})},nr=function(e,t){return function(r){var n=r.shortUrl,c=r.selectedServer,s=Object(Y.f)(),i=Object(N.a)(s,2),o=i[0],l=i[1],u=Object(Y.f)(),d=Object(N.a)(u,2),j=d[0],b=d[1],h=Object(Y.f)(),O=Object(N.a)(h,2),v=O[0],f=O[1];return Object(a.jsxs)(rr,{toggle:l,isOpen:o,children:[Object(a.jsxs)(K.a,{tag:Xt,selectedServer:c,shortUrl:n,suffix:"visits",children:[Object(a.jsx)(M.a,{icon:A.g,fixedWidth:!0})," Visit stats"]}),Object(a.jsxs)(K.a,{tag:Xt,selectedServer:c,shortUrl:n,suffix:"edit",children:[Object(a.jsx)(M.a,{icon:A.n,fixedWidth:!0})," Edit short URL"]}),Object(a.jsxs)(K.a,{onClick:b,children:[Object(a.jsx)(M.a,{icon:A.G,fixedWidth:!0})," QR code"]}),Object(a.jsx)(t,{shortUrl:n,isOpen:j,toggle:b}),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsxs)(K.a,{className:"dropdown-item--danger",onClick:f,children:[Object(a.jsx)(M.a,{icon:A.z,fixedWidth:!0})," Delete short URL"]}),Object(a.jsx)(e,{shortUrl:n,isOpen:v,toggle:f})]})}},cr=function(e,t){return function(r){var n=r.createShortUrl,c=r.shortUrlCreationResult,s=r.resetCreateShortUrl,i=r.selectedServer,o=r.basicMode,l=void 0!==o&&o,u=r.settings.shortUrlCreation,j=Object(B.useMemo)((function(){return function(e){var t,r;return{longUrl:"",tags:[],customSlug:"",title:void 0,shortCodeLength:void 0,domain:"",validSince:void 0,validUntil:void 0,maxVisits:void 0,findIfExists:!1,validateUrl:null!==(t=null===e||void 0===e?void 0:e.validateUrls)&&void 0!==t&&t,forwardQuery:null===(r=null===e||void 0===e?void 0:e.forwardQuery)||void 0===r||r}}(u)}),[u]);return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(e,{initialState:j,saving:c.saving,selectedServer:i,mode:l?"create-basic":"create",onSave:function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(),e.abrupt("return",n(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),Object(a.jsx)(t,Object(d.a)(Object(d.a)({},c),{},{resetCreateShortUrl:s,canBeClosed:l}))]})}},ar=r(612),sr=r(572),ir=r(573),or=r(574),lr=r(543),ur=r(32),dr=r(537),jr=r(33),br=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,s=void 0!==c&&c;return Object(a.jsx)(dr.a,{className:n,children:Object(a.jsx)("div",{className:W()({"col-md-10 offset-md-1":!s,"col-12":s}),children:Object(a.jsx)(jr.a,{className:W()("text-center",{"bg-main":"success"===r,"bg-danger":"error"===r,"bg-warning":"warning"===r,"text-white":"warning"!==r}),bodyClassName:W()({"p-2":s}),children:t})})})},hr=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},Or=function(e){return"INVALID_SHORTCODE_DELETION"===(null===e||void 0===e?void 0:e.type)||"INVALID_SHORT_URL_DELETION"===(null===e||void 0===e?void 0:e.type)},vr=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(a.jsxs)(a.Fragment,{children:[null!==(t=null===n||void 0===n?void 0:n.detail)&&void 0!==t?t:c,(r=n,"INVALID_ARGUMENT"===(null===r||void 0===r?void 0:r.type)&&Object(a.jsxs)("p",{className:"mb-0",children:["Invalid elements: [",n.invalidElements.join(", "),"]"]}))]})},fr=function(e){var t=e.shortUrl,r=e.toggle,n=e.isOpen,c=e.shortUrlDeletion,s=e.resetDeleteShortUrl,i=e.deleteShortUrl,o=Object(B.useState)(""),l=Object(N.a)(o,2),u=l[0],d=l[1];Object(B.useEffect)((function(){return s}),[]);var j=c.error,b=c.errorData,h=Object(G.a)(s,r),O=Object(ur.b)((function(){var e=t.shortCode,n=t.domain;i(e,n).then(r).catch(lr.a)}));return Object(a.jsx)(ar.a,{isOpen:n,toggle:h,centered:!0,children:Object(a.jsxs)("form",{onSubmit:O,children:[Object(a.jsx)(sr.a,{toggle:h,children:Object(a.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)("p",{children:[Object(a.jsx)("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),Object(a.jsx)("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),Object(a.jsxs)("p",{children:["Write ",Object(a.jsx)("b",{children:t.shortCode})," to confirm deletion."]}),Object(a.jsx)("input",{type:"text",className:"form-control",placeholder:"Insert the short code (".concat(t.shortCode,")"),value:u,onChange:function(e){return d(e.target.value)}}),j&&Object(a.jsx)(br,{type:Or(b)?"warning":"error",small:!0,className:"mt-2",children:Object(a.jsx)(vr,{errorData:b,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)("button",{type:"button",className:"btn btn-link",onClick:h,children:"Cancel"}),Object(a.jsx)("button",{type:"submit",className:"btn btn-danger",disabled:u!==t.shortCode||c.loading,children:c.loading?"Deleting...":"Delete"})]})]})})},mr=r(216),gr=function(e){return function(t){var r=t.error,n=t.errorData,c=t.result,s=t.resetCreateShortUrl,i=t.canBeClosed,o=void 0!==i&&i,l=e(),u=Object(N.a)(l,2),d=u[0],j=u[1];if(Object(B.useEffect)((function(){s()}),[]),r)return Object(a.jsxs)(br,{type:"error",className:"mt-3",children:[o&&Object(a.jsx)(M.a,{icon:A.Q,className:"float-right pointer",onClick:s}),Object(a.jsx)(vr,{errorData:n,fallbackMessage:"An error occurred while creating the URL :("})]});if(Object(S.a)(c))return null;var b=c.shortUrl;return Object(a.jsxs)(br,{type:"success",className:"mt-3",children:[o&&Object(a.jsx)(M.a,{icon:A.Q,className:"float-right pointer",onClick:s}),Object(a.jsx)("b",{children:"Great!"})," The short URL is ",Object(a.jsx)("b",{children:b}),Object(a.jsx)(qt.a,{text:b,onCopy:j,children:Object(a.jsxs)("button",{className:"btn btn-light btn-sm create-short-url-result__copy-btn",id:"copyBtn",type:"button",children:[Object(a.jsx)(M.a,{icon:we.d})," Copy"]})}),Object(a.jsx)(mr.a,{placement:"left",isOpen:d,target:"copyBtn",children:"Copied!"})]})}},xr=r(575),pr=r(576),Sr=r(283),yr=function(e,t,r){return Object(S.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},Cr="shlink/visitCreation/CREATE_VISITS",Nr=function(e){return{type:Cr,createdVisits:e}},kr="shlink/deleteShortUrl/DELETE_SHORT_URL_START",_r="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",wr="shlink/deleteShortUrl/SHORT_URL_DELETED",Ur="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",Tr={shortCode:"",loading:!1,error:!1},Rr=bt((ze={},Object(u.a)(ze,kr,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(ze,_r,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(u.a)(ze,wr,(function(e,t){var r=t.shortCode;return Object(d.a)(Object(d.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(u.a)(ze,Ur,(function(){return Tr})),ze),Tr),Er=function(e){return function(t,r){return function(){var n=Object(m.a)(f.a.mark((function n(c,a){var s,i;return f.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:kr}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:wr,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:_r,errorData:hr(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},Dr=ht(Ur),Lr="shlink/createShortUrl/CREATE_SHORT_URL_START",Vr="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",Ir="shlink/createShortUrl/CREATE_SHORT_URL",Fr="shlink/createShortUrl/RESET_CREATE_SHORT_URL",Ar={result:null,saving:!1,error:!1},Mr=bt((Ke={},Object(u.a)(Ke,Lr,(function(e){return Object(d.a)(Object(d.a)({},e),{},{saving:!0,error:!1})})),Object(u.a)(Ke,Vr,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(u.a)(Ke,Ir,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(u.a)(Ke,Fr,(function(){return Ar})),Ke),Ar),Gr=function(e){return function(t){return function(){var r=Object(m.a)(f.a.mark((function r(n,c){var a,s,i;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Lr}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Ir,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:Vr,errorData:hr(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},Pr=ht(Fr),Br=r(40),Hr="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Wr="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",qr="shlink/shortUrlEdition/SHORT_URL_EDITED",zr=bt((Qe={},Object(u.a)(Qe,Hr,(function(e){return Object(d.a)(Object(d.a)({},e),{},{saving:!0,error:!1})})),Object(u.a)(Qe,Wr,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(u.a)(Qe,qr,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),Qe),{saving:!1,error:!1}),Kr=function(e){return function(t,r,n){return function(){var c=Object(m.a)(f.a.mark((function c(a,s){var i,o,l,u,d,j,b,h,O;return f.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return a({type:Hr}),i=s(),o=i.selectedServer,l=!Object(Br.l)(o),u=e(s),d=u.updateShortUrl,j=u.updateShortUrlTags,c.prev=4,c.next=7,Promise.all([d(t,r,n),l&&n.tags?j(t,r,n.tags):void 0]);case 7:b=c.sent,h=Object(N.a)(b,1),O=h[0],a({shortUrl:O,type:qr}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Wr,errorData:hr(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Qr="shlink/shortUrlsList/LIST_SHORT_URLS_START",Jr="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",Zr="shlink/shortUrlsList/LIST_SHORT_URLS",Yr=bt((Je={},Object(u.a)(Je,Qr,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(Je,Jr,(function(){return{loading:!1,error:!0}})),Object(u.a)(Je,Zr,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(u.a)(Je,wr,Object(G.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(xr.a)(["shortUrls","data"],Object(p.a)((function(e){return yr(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(xr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(u.a)(Je,Cr,(function(e,t){var r,n,c=t.createdVisits;return Object(xr.a)(["shortUrls","data"],null===(r=e.shortUrls)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.map((function(e){var t=Object(pr.a)(c.filter((function(t){var r=t.shortUrl;return r&&yr(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(Sr.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(u.a)(Je,Ir,Object(G.a)((function(e,t){var r=t.result;return e.shortUrls?Object(xr.a)(["shortUrls","data"],[r].concat(Object(Fe.a)(e.shortUrls.data.slice(0,4))),e):e}),(function(e){return e.shortUrls?Object(xr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(u.a)(Je,qr,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(xr.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return yr(e,t,n)?r:e})),e):e})),Je),{loading:!0,error:!1}),Xr=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var r=Object(m.a)(f.a.mark((function r(n,c){var a,s,i;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Qr}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Zr,shortUrls:i}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:Jr});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},$r=function(e){return function(t){var r=t.orderByColumn,n=t.renderOrderIcon,c=t.shortUrlsList,s=t.onTagClick,i=t.selectedServer,o=t.className,l=c.error,u=c.loading,d=c.shortUrls,j=W()({"short-urls-table__header-cell--with-action":!!r}),b=W()("short-urls-table__header-cell",j),h=W()("table table-hover",o),O=Object(Br.k)(i);return Object(a.jsxs)("table",{className:h,children:[Object(a.jsx)("thead",{className:"responsive-table__header short-urls-table__header",children:Object(a.jsxs)("tr",{children:[Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("dateCreated"),children:["Created at ",null===n||void 0===n?void 0:n("dateCreated")]}),Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("shortCode"),children:["Short URL ",null===n||void 0===n?void 0:n("shortCode")]}),!O&&Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("longUrl"),children:["Long URL ",null===n||void 0===n?void 0:n("longUrl")]})||Object(a.jsxs)("th",{className:"short-urls-table__header-cell",children:[Object(a.jsxs)("span",{className:j,onClick:null===r||void 0===r?void 0:r("title"),children:["Title ",null===n||void 0===n?void 0:n("title")]}),"\xa0\xa0/\xa0\xa0",Object(a.jsxs)("span",{className:j,onClick:null===r||void 0===r?void 0:r("longUrl"),children:[Object(a.jsx)("span",{className:"indivisible",children:"Long URL"})," ",null===n||void 0===n?void 0:n("longUrl")]})]}),Object(a.jsx)("th",{className:"short-urls-table__header-cell",children:"Tags"}),Object(a.jsx)("th",{className:b,onClick:null===r||void 0===r?void 0:r("visits"),children:Object(a.jsxs)("span",{className:"indivisible",children:["Visits ",null===n||void 0===n?void 0:n("visits")]})}),Object(a.jsx)("th",{className:"short-urls-table__header-cell",children:"\xa0"})]})}),Object(a.jsx)("tbody",{children:l?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center table-danger text-dark",children:"Something went wrong while loading short URLs :("})}):u?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center",children:"Loading..."})}):!u&&Object(y.a)(null===d||void 0===d?void 0:d.data)?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center",children:"No results found"})}):null===d||void 0===d?void 0:d.data.map((function(t){return Object(a.jsx)(e,{shortUrl:t,selectedServer:i,onTagClick:s},t.shortUrl)}))})]})}},en=r(577),tn=r(213),rn=function(e){var t=e.format,r=e.setFormat;return Object(a.jsxs)(X,{text:"Format (".concat(t,")"),children:[Object(a.jsx)(K.a,{active:"png"===t,onClick:function(){return r("png")},children:"PNG"}),Object(a.jsx)(K.a,{active:"svg"===t,onClick:function(){return r("svg")},children:"SVG"})]})},nn=function(e){var t=e.errorCorrection,r=e.setErrorCorrection;return Object(a.jsxs)(X,{text:"Error correction (".concat(t,")"),children:[Object(a.jsxs)(K.a,{active:"L"===t,onClick:function(){return r("L")},children:[Object(a.jsx)("b",{children:"L"}),"ow"]}),Object(a.jsxs)(K.a,{active:"M"===t,onClick:function(){return r("M")},children:[Object(a.jsx)("b",{children:"M"}),"edium"]}),Object(a.jsxs)(K.a,{active:"Q"===t,onClick:function(){return r("Q")},children:[Object(a.jsx)("b",{children:"Q"}),"uartile"]}),Object(a.jsxs)(K.a,{active:"H"===t,onClick:function(){return r("H")},children:[Object(a.jsx)("b",{children:"H"}),"igh"]})]})},cn=function(e,t){return function(r){var n=r.shortUrl,c=n.shortUrl,s=n.shortCode,i=r.toggle,o=r.isOpen,l=r.selectedServer,u=Object(B.useState)(300),d=Object(N.a)(u,2),j=d[0],b=d[1],h=Object(B.useState)(0),O=Object(N.a)(h,2),v=O[0],g=O[1],x=Object(B.useState)("png"),p=Object(N.a)(x,2),S=p[0],k=p[1],_=Object(B.useState)("L"),w=Object(N.a)(_,2),U=w[0],T=w[1],R=Object(B.useMemo)((function(){return{useSizeInPath:!Object(Br.i)(l),marginIsSupported:Object(Br.h)(l),errorCorrectionIsSupported:Object(Br.j)(l)}}),[l]),E=R.marginIsSupported!==R.errorCorrectionIsSupported,D=Object(B.useMemo)((function(){return function(e,t,r){var n=t.size,c=t.format,a=t.margin,s=t.errorCorrection,i=r.useSizeInPath,o=r.marginIsSupported,l=r.errorCorrectionIsSupported,u="".concat(e,"/qr-code").concat(i?"/".concat(n):""),d=Object(C.b)({size:i?void 0:n,format:c,margin:o&&a>0?a:void 0,errorCorrection:l?s:void 0});return"".concat(u).concat(Object(y.a)(d)?"":"?".concat(d))}(c,{size:j,format:S,margin:v,errorCorrection:U},R)}),[c,j,S,v,U,R]),L=Object(B.useMemo)((function(){return j+v}),[j,v]),V=Object(B.useMemo)((function(){if(!(L<500))return L<800?"lg":"xl"}),[L]);return Object(a.jsxs)(ar.a,{isOpen:o,toggle:i,centered:!0,size:V,children:[Object(a.jsxs)(sr.a,{toggle:i,children:["QR code for ",Object(a.jsx)(Ht.a,{href:c,children:c})]}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)(dr.a,{children:[Object(a.jsxs)(en.a,{className:W()({"col-md-4":E,"col-md-6":!E}),children:[Object(a.jsxs)("label",{className:"mb-0",children:["Size: ",j,"px"]}),Object(a.jsx)("input",{type:"range",className:"form-control-range",value:j,step:10,min:50,max:1e3,onChange:function(e){return b(Number(e.target.value))}})]}),R.marginIsSupported&&Object(a.jsxs)(en.a,{className:E?"col-md-4":"col-md-6",children:[Object(a.jsxs)("label",{className:"mb-0",children:["Margin: ",v,"px"]}),Object(a.jsx)("input",{type:"range",className:"form-control-range",value:v,step:1,min:0,max:100,onChange:function(e){return g(Number(e.target.value))}})]}),Object(a.jsx)(en.a,{className:E?"col-md-4":"col-md-6",children:Object(a.jsx)(rn,{format:S,setFormat:k})}),R.errorCorrectionIsSupported&&Object(a.jsx)(en.a,{className:"col-md-6",children:Object(a.jsx)(nn,{errorCorrection:U,setErrorCorrection:T})})]}),Object(a.jsxs)("div",{className:"text-center",children:[Object(a.jsxs)("div",{className:"mb-3",children:[Object(a.jsx)(Ht.a,{href:D}),Object(a.jsx)(zt,{text:D})]}),Object(a.jsx)("img",{src:D,className:"qr-code-modal__img",alt:"QR code"}),Object(a.jsx)(t,{minVersion:"2.9.0",children:Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsxs)(tn.a,{block:!0,color:"primary",onClick:Object(m.a)(f.a.mark((function t(){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.saveImage(D,"".concat(s,"-qr-code.").concat(S)));case 1:case"end":return t.stop()}}),t)}))),children:["Download ",Object(a.jsx)(M.a,{icon:A.r,className:"ml-1"})]})})})]})]})]})}},an=r(580),sn=r(578),on=r(579),ln=r(607),un=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?lr.a:n,s=e.className,i=e.children,o=e.type,l=e.inline,u=void 0!==l&&l,d=Object(B.useRef)(Object(ln.a)()).current,j={"custom-switch":"switch"===o,"custom-checkbox":"checkbox"===o},b=u?{display:"inline-block"}:{};return Object(a.jsxs)("span",{className:W()("custom-control",j,s),style:b,children:[Object(a.jsx)("input",{type:"checkbox",className:"custom-control-input",id:d,checked:r,onChange:function(e){return c(e.target.checked,e)}}),Object(a.jsx)("label",{className:"custom-control-label",htmlFor:d,children:i})]})},dn=function(e){return Object(a.jsx)(un,Object(d.a)({type:"checkbox"},e))},jn=function(e){var t=e.isOpen,r=e.toggle;return Object(a.jsxs)(ar.a,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(a.jsx)(sr.a,{toggle:r,children:"Info"}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)("p",{children:["When the\xa0",Object(a.jsx)("b",{children:Object(a.jsx)("i",{children:'"Use existing URL if found"'})}),"\xa0checkbox is checked, the server will return an existing short URL if it matches provided params."]}),Object(a.jsx)("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:"When only the long URL is provided: The most recent match will be returned, or a new short URL will be created if none is found."}),Object(a.jsxs)("li",{children:["When long URL and custom slug and/or domain are provided: Same as in previous case, but it will try to match the short URL using both the long URL and the slug, the long URL and the domain, or the three of them.",Object(a.jsx)("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),Object(a.jsx)("li",{children:"When other params are provided: Same as in previous cases, but it will try to match existing short URLs with all provided data. If any of them does not match, a new short URL will be created"})]})]})]})},bn=function(){var e=Object(Y.f)(),t=Object(N.a)(e,2),r=t[0],n=t[1];return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("span",{title:"What does this mean?",children:Object(a.jsx)(M.a,{icon:A.v,style:{cursor:"pointer"},onClick:n})}),Object(a.jsx)(jn,{isOpen:r,toggle:n})]})},hn=function(e){var t=e.className,r=void 0===t?"":t,n=e.placement,c=e.children,s=Object(B.useRef)();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("span",{className:r,ref:function(e){s.current=e},children:Object(a.jsx)(M.a,{icon:A.v})}),Object(a.jsx)(Zt.a,{target:function(){return s.current},placement:n,children:c})]})},On=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(a.jsxs)("p",{children:[Object(a.jsx)(dn,{inline:!0,checked:n,className:r?"mr-2":"",onChange:c,children:t}),r&&Object(a.jsx)(hn,{placement:"right",children:r})]})},vn=Object(G.a)(sn.a,Object(on.a)(/ /g,"-")),fn=function(e){return"string"===typeof e?Object(P.default)(e):e},mn=function(e){return{"col-sm-6":e,"col-sm-12":!e}},gn=function(e,t){return function(r){var n,c=r.mode,s=r.saving,i=r.onSave,o=r.initialState,l=r.selectedServer,j=Object(B.useState)(o),b=Object(N.a)(j,2),h=b[0],O=b[1],v="edit"===c,g="create-basic"===c,x=Object(ur.c)(o.title),p=function(){var e=Object(ur.c)(h.title);return Object(ne.a)([[function(){return!e&&!x},function(){}],[function(){return!e&&x},function(){return null}],[ce.a,function(){return h.title}]])()},S=Object(ur.b)(Object(m.a)(f.a.mark((function e(){var t,r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(d.a)(Object(d.a)({},h),{},{validSince:null!==(t=je(h.validSince))&&void 0!==t?t:null,validUntil:null!==(r=je(h.validUntil))&&void 0!==r?r:null,maxVisits:Object(ur.c)(h.maxVisits)?Number(h.maxVisits):null,title:p()})).then((function(){return!v&&O(o)})).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));Object(B.useEffect)((function(){O(o)}),[o]);var C=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"text",c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Object(a.jsx)(en.a,Object(d.a)(Object(d.a)({},s),{},{children:Object(a.jsx)(an.a,Object(d.a)({id:e,type:n,placeholder:t,value:null!==(r=h[e])&&void 0!==r?r:"",onChange:function(t){return O(Object(d.a)(Object(d.a)({},h),{},Object(u.a)({},e,t.target.value)))}},c))}))},k=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object(a.jsx)("div",{className:"form-group",children:Object(a.jsx)(Ue,Object(d.a)({selected:h[e]?fn(h[e]):null,placeholderText:t,isClearable:!0,onChange:function(t){return O(Object(d.a)(Object(d.a)({},h),{},Object(u.a)({},e,t)))}},r))})},_=Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(en.a,{children:Object(a.jsx)(an.a,{bsSize:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:h.longUrl,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{longUrl:e.target.value}))}})}),Object(a.jsxs)(dr.a,{children:[g&&C("customSlug","Custom slug","text",{bsSize:"lg"},{className:"col-lg-6"}),Object(a.jsx)(en.a,{className:g?"col-lg-6":"col-12 mb-0",children:Object(a.jsx)(e,{selectedTags:null!==(n=h.tags)&&void 0!==n?n:[],onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{tags:e.map(vn)}))}})})]})]}),w=Object(Br.k)(l),U=w||!v,T=W()("mb-3",mn(U)),R=Object(Br.b)(l),E=Object(Br.e)(l),D=R||E,L=W()("mb-3",mn(D));return Object(a.jsxs)("form",{className:"short-url-form",onSubmit:S,children:[g&&_,!g&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(jr.a,{title:"Basic options",className:"mb-3",children:_}),Object(a.jsxs)(dr.a,{children:[U&&Object(a.jsx)("div",{className:"col-sm-6 mb-3",children:Object(a.jsxs)(jr.a,{title:"Customize the short URL",children:[w&&C("title","Title"),!v&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)(dr.a,{children:[Object(a.jsx)("div",{className:"col-lg-6",children:C("customSlug","Custom slug","text",{disabled:Object(ur.c)(h.shortCodeLength)})}),Object(a.jsx)("div",{className:"col-lg-6",children:C("shortCodeLength","Short code length","number",{min:4,disabled:Object(ur.c)(h.customSlug)})})]}),Object(a.jsx)(en.a,{children:Object(a.jsx)(t,{value:h.domain,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{domain:e}))}})})]})]})}),Object(a.jsx)("div",{className:T,children:Object(a.jsxs)(jr.a,{title:"Limit access to the short URL",children:[C("maxVisits","Maximum number of visits allowed","number",{min:1}),k("validSince","Enabled since...",{maxDate:h.validUntil?fn(h.validUntil):void 0}),k("validUntil","Enabled until...",{minDate:h.validSince?fn(h.validSince):void 0})]})})]}),Object(a.jsxs)(dr.a,{children:[Object(a.jsx)("div",{className:L,children:Object(a.jsxs)(jr.a,{title:"Extra checks",children:[Object(a.jsx)(On,{infoTooltip:"If checked, Shlink will try to reach the long URL, failing in case it's not publicly accessible.",checked:h.validateUrl,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{validateUrl:e}))},children:"Validate URL"}),!v&&Object(a.jsxs)("p",{children:[Object(a.jsx)(dn,{inline:!0,className:"mr-2",checked:h.findIfExists,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{findIfExists:e}))},children:"Use existing URL if found"}),Object(a.jsx)(bn,{})]})]})}),D&&Object(a.jsx)("div",{className:"col-sm-6 mb-3",children:Object(a.jsxs)(jr.a,{title:"Configure behavior",children:[R&&Object(a.jsx)(On,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:h.crawlable,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{crawlable:e}))},children:"Make it crawlable"}),E&&Object(a.jsx)(On,{infoTooltip:"When this short URL is visited, any query params appended to it will be forwarded to the long URL.",checked:h.forwardQuery,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{forwardQuery:e}))},children:"Forward query params on redirect"})]})})]})]}),Object(a.jsx)("div",{className:"text-center",children:Object(a.jsx)(tn.a,{outline:!0,color:"primary",disabled:s||Object(y.a)(h.longUrl),className:"btn-xs-block",children:s?"Saving...":"Save"})})]})}},xn=r(53),pn=function(e){return function(t){var r,n=t.settings.shortUrlCreation,c=t.selectedServer,s=t.shortUrlDetail,i=t.getShortUrlDetail,o=t.shortUrlEdition,l=t.editShortUrl,u=Object(De.f)().search,d=Object(De.h)(),j=Object(Y.b)(),b=s.loading,h=s.error,O=s.errorData,v=s.shortUrl,g=o.saving,x=o.error,p=o.errorData,S=Object(C.a)(u).domain,y=Object(B.useMemo)((function(){return function(e,t){var r,n,c,a,s,i,o=null!==(r=null===t||void 0===t?void 0:t.validateUrls)&&void 0!==r&&r;return e?{longUrl:e.longUrl,tags:e.tags,title:null!==(n=e.title)&&void 0!==n?n:void 0,domain:null!==(c=e.domain)&&void 0!==c?c:void 0,validSince:null!==(a=e.meta.validSince)&&void 0!==a?a:void 0,validUntil:null!==(s=e.meta.validUntil)&&void 0!==s?s:void 0,maxVisits:null!==(i=e.meta.maxVisits)&&void 0!==i?i:void 0,crawlable:e.crawlable,forwardQuery:e.forwardQuery,validateUrl:o}:{longUrl:"",validateUrl:o}}(v,n)}),[v,n]),k=Object(Y.f)(),_=Object(N.a)(k,4),w=_[0],U=_[2],T=_[3];return Object(B.useEffect)((function(){d.shortCode&&i(d.shortCode,S)}),[]),b?Object(a.jsx)(xn.a,{loading:!0}):h?Object(a.jsx)(br,{type:"error",children:Object(a.jsx)(vr,{errorData:O,fallbackMessage:"An error occurred while loading short URL detail :("})}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("header",{className:"mb-3",children:Object(a.jsx)(Ae.a,{body:!0,children:Object(a.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(a.jsx)(tn.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:j,children:Object(a.jsx)(M.a,{icon:A.a})}),Object(a.jsx)("span",{className:"text-center",children:Object(a.jsxs)("small",{children:["Edit ",Object(a.jsx)(Ht.a,{href:null!==(r=null===v||void 0===v?void 0:v.shortUrl)&&void 0!==r?r:""})]})}),Object(a.jsx)("span",{})]})})}),Object(a.jsx)(e,{initialState:y,saving:g,selectedServer:c,mode:"edit",onSave:function(){var e=Object(m.a)(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v){e.next=2;break}return e.abrupt("return");case 2:T(),l(v.shortCode,v.domain,t).then(U).catch(T);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),x&&Object(a.jsx)(br,{type:"error",className:"mt-3",children:Object(a.jsx)(vr,{errorData:p,fallbackMessage:"An error occurred while updating short URL :("})}),w&&Object(a.jsx)(br,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},Sn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",yn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",Cn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",Nn={loading:!1,error:!1},kn=bt((Ze={},Object(u.a)(Ze,Sn,(function(){return{loading:!0,error:!1}})),Object(u.a)(Ze,yn,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(u.a)(Ze,Cn,(function(e,t){var r=t.shortUrl;return Object(d.a)({shortUrl:r},Nn)})),Ze),Nn),_n=function(e){return function(t,r){return function(){var n=Object(m.a)(f.a.mark((function n(c,a){var s,i,o,l,u;return f.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c({type:Sn}),n.prev=1,o=a(),l=o.shortUrlsList,null===(s=null===l||void 0===l||null===(i=l.shortUrls)||void 0===i?void 0:i.data.find((function(e){return yr(e,t,r)})))||void 0===s){n.next=7;break}n.t0=s,n.next=10;break;case 7:return n.next=9,e(a).getShortUrl(t,r);case 9:n.t0=n.sent;case 10:u=n.t0,c({shortUrl:u,type:Cn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:yn,errorData:hr(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},wn=function(e,t){e.serviceFactory("ShortUrlsList",Bt,"ShortUrlsTable","ShortUrlsFilteringBar"),e.decorator("ShortUrlsList",t(["selectedServer","mercureInfo","shortUrlsList","settings"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",$r,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",er,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",nr,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",gr,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",gn,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",cr,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",pn,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return fr})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",cn,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("ShortUrlsFilteringBar",Ie,"ColorGenerator"),e.serviceFactory("listShortUrls",Xr,"buildShlinkApiClient"),e.serviceFactory("createShortUrl",Gr,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return Pr})),e.serviceFactory("deleteShortUrl",Er,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return Dr})),e.serviceFactory("getShortUrlDetail",_n,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Kr,"buildShlinkApiClient")},Un=r(284),Tn=r.n(Un),Rn=r(60),En=function(e){var t=e.children,r=e.value,n=e.onChange,c=e.id,s=e.type,i=e.required,o=e.placeholder,l=e.className,u=e.labelClassName,d=Object(B.useRef)(null!==c&&void 0!==c?c:Object(ln.a)());return Object(a.jsxs)(en.a,{className:null!==l&&void 0!==l?l:"",children:[Object(a.jsxs)("label",{htmlFor:d.current,className:null!==u&&void 0!==u?u:"",children:[t,":"]}),Object(a.jsx)("input",{className:"form-control",type:null!==s&&void 0!==s?s:"text",id:d.current,value:r,required:null===i||void 0===i||i,placeholder:o,onChange:function(e){return n(e.target.value)}})]})},Dn=function(e){return Object(a.jsx)(En,Object(d.a)(Object(d.a)({},e),{},{labelClassName:"server-form__label"}))},Ln=function(e){var t=e.onSubmit,r=e.initialValues,n=e.children,c=e.title,s=Object(B.useState)(""),i=Object(N.a)(s,2),o=i[0],l=i[1],u=Object(B.useState)(""),d=Object(N.a)(u,2),j=d[0],b=d[1],h=Object(B.useState)(""),O=Object(N.a)(h,2),v=O[0],f=O[1],m=Object(ur.b)((function(){return t({name:o,url:j,apiKey:v})}));return Object(B.useEffect)((function(){r&&l(r.name),r&&b(r.url),r&&f(r.apiKey)}),[r]),Object(a.jsxs)("form",{className:"server-form",onSubmit:m,children:[Object(a.jsxs)(jr.a,{className:"mb-3",title:c,children:[Object(a.jsx)(Dn,{value:o,onChange:l,children:"Name"}),Object(a.jsx)(Dn,{type:"url",value:j,onChange:b,children:"URL"}),Object(a.jsx)(Dn,{value:v,onChange:f,children:"API key"})]}),Object(a.jsx)("div",{className:"text-right",children:n})]})},Vn=function(e){var t=e.isOpen,r=e.duplicatedServers,n=e.onDiscard,c=e.onSave,s=r.length>1;return Object(a.jsxs)(ar.a,{centered:!0,isOpen:t,children:[Object(a.jsxs)(sr.a,{children:["Duplicated server",s&&"s"]}),Object(a.jsxs)(ir.a,{children:[Object(a.jsx)("p",{children:s?"The next servers already exist:":"There is already a server with:"}),Object(a.jsx)("ul",{children:r.map((function(e,t){var r=e.url,n=e.apiKey;return s?Object(a.jsxs)("li",{children:[Object(a.jsx)("b",{children:r})," - ",Object(a.jsx)("b",{children:n})]},t):Object(a.jsxs)(B.Fragment,{children:[Object(a.jsxs)("li",{children:["URL: ",Object(a.jsx)("b",{children:r})]}),Object(a.jsxs)("li",{children:["API key: ",Object(a.jsx)("b",{children:n})]})]},t)}))}),Object(a.jsxs)("span",{children:[s?"Do you want to ignore duplicated servers":"Do you want to save this server anyway","?"]})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)(tn.a,{color:"link",onClick:n,children:s?"Ignore duplicated":"Discard"}),Object(a.jsx)(tn.a,{color:"primary",onClick:c,children:"Save anyway"})]})]})},In=function(e){var t=e.type;return Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsxs)(br,{type:t,children:["success"===t&&"Servers properly imported. You can now select one from the list :)","error"===t&&"The servers could not be imported. Make sure the format is correct."]})})},Fn=function(e,t){return function(r){var n=r.servers,c=r.createServer,s=Object(De.g)(),i=Object(Y.b)(),o=!!Object.keys(n).length,l=t(!1,4e3),u=Object(N.a)(l,2),j=u[0],b=u[1],h=t(!1,4e3),O=Object(N.a)(h,2),v=O[0],f=O[1],m=Object(Y.f)(),g=Object(N.a)(m,2),x=g[0],p=g[1],S=Object(B.useState)(),y=Object(N.a)(S,2),C=y[0],k=y[1],_=function(){if(C){var e=Object(ln.a)();c(Object(d.a)(Object(d.a)({},C),{},{id:e})),s("/server/".concat(e))}};return Object(B.useEffect)((function(){Object.values(n).some((function(e){var t=e.url,r=e.apiKey;return(null===C||void 0===C?void 0:C.url)===t&&(null===C||void 0===C?void 0:C.apiKey)===r}))?p():_()}),[C]),Object(a.jsxs)(Rn.a,{children:[Object(a.jsxs)(Ln,{title:Object(a.jsx)("h5",{className:"mb-0",children:"Add new server"}),onSubmit:k,children:[!o&&Object(a.jsx)(e,{tooltipPlacement:"top",onImport:b,onImportError:f}),o&&Object(a.jsx)(tn.a,{outline:!0,onClick:i,children:"Cancel"}),Object(a.jsx)(tn.a,{outline:!0,color:"primary",className:"ml-2",children:"Create server"})]}),j&&Object(a.jsx)(In,{type:"success"}),v&&Object(a.jsx)(In,{type:"error"}),Object(a.jsx)(Vn,{isOpen:x,duplicatedServers:C?[C]:[],onDiscard:i,onSave:_})]})}},An=r(555),Mn=function(e){var t=e.servers,r=e.selectedServer,n=Object(An.a)(t);return Object(a.jsxs)(Me.a,{nav:!0,inNavbar:!0,children:[Object(a.jsxs)(J.a,{nav:!0,caret:!0,children:[Object(a.jsx)(M.a,{icon:A.J})," ",Object(a.jsx)("span",{className:"ml-1",children:"Servers"})]}),Object(a.jsx)(Z.a,{right:!0,children:Object(y.a)(n)?Object(a.jsxs)(K.a,{tag:o.b,to:"/server/create",children:[Object(a.jsx)(M.a,{icon:A.F})," ",Object(a.jsx)("span",{className:"ml-1",children:"Add a server"})]}):Object(a.jsxs)(a.Fragment,{children:[n.map((function(e){var t=e.name,n=e.id;return Object(a.jsx)(K.a,{tag:o.b,to:"/server/".concat(n),active:Object(O.a)(r)===n,children:t},n)})),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsxs)(K.a,{tag:o.b,to:"/manage-servers",children:[Object(a.jsx)(M.a,{icon:A.J})," ",Object(a.jsx)("span",{className:"ml-1",children:"Manage servers"})]})]})})]})},Gn=function(e){var t=e.server,r=e.toggle,n=e.isOpen,c=e.deleteServer,s=e.redirectHome,i=void 0===s||s,o=Object(De.g)();return Object(a.jsxs)(ar.a,{isOpen:n,toggle:r,centered:!0,children:[Object(a.jsx)(sr.a,{toggle:r,children:Object(a.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)("p",{children:["Are you sure you want to remove ",Object(a.jsx)("b",{children:t?t.name:""}),"?"]}),Object(a.jsx)("p",{children:Object(a.jsx)("i",{children:"No data will be deleted, only the access to this server will be removed from this device. You can create it again at any moment."})})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(a.jsx)("button",{className:"btn btn-danger",onClick:function(){return c(t),r(),void(i&&o("/"))},children:"Delete"})]})]})},Pn=function(e){return function(t){var r=t.server,n=t.className,c=t.children,s=t.textClassName,i=Object(Y.f)(),o=Object(N.a)(i,4),l=o[0],u=o[2],d=o[3];return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)("span",{className:n,onClick:u,children:[!c&&Object(a.jsx)(M.a,{fixedWidth:!0,icon:A.z}),Object(a.jsx)("span",{className:s,children:null!==c&&void 0!==c?c:"Remove this server"})]}),Object(a.jsx)(e,{server:r,isOpen:l,toggle:d})]})}},Bn=r(149),Hn=function(e){return Object(Bn.a)((function(e){var t=e.editServer,r=e.selectedServer,n=Object(Y.b)();if(!Object(O.e)(r))return null;return Object(a.jsx)(Rn.a,{children:Object(a.jsxs)(Ln,{title:Object(a.jsxs)("h5",{className:"mb-0",children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:function(e){t(r.id,e),n()},children:[Object(a.jsx)(tn.a,{outline:!0,className:"mr-2",onClick:n,children:"Cancel"}),Object(a.jsx)(tn.a,{outline:!0,color:"primary",children:"Save"})]})})}),e)},Wn=r(606),qn=function(e){return function(t){var r=t.url,n=t.apiKey;return e.some((function(e){return e.url===r&&e.apiKey===n}))}},zn=function(e){var t=e.importServersFromFile;return function(e){var r=e.createServers,n=e.servers,c=e.fileRef,s=e.children,i=e.onImport,o=void 0===i?function(){}:i,l=e.onImportError,u=void 0===l?function(){}:l,d=e.tooltipPlacement,j=void 0===d?"bottom":d,b=e.className,h=void 0===b?"":b,O=null!==c&&void 0!==c?c:Object(B.useRef)(),v=Object(B.useState)(),g=Object(N.a)(v,2),x=g[0],p=g[1],S=Object(B.useState)([]),y=Object(N.a)(S,2),C=y[0],k=y[1],_=Object(Y.f)(),w=Object(N.a)(_,4),U=w[0],T=w[2],R=w[3],E=Object(G.a)(r,o),D=Object(G.a)((function(){return E(null!==x&&void 0!==x?x:[])}),R),L=Object(G.a)((function(){return E((null!==x&&void 0!==x?x:[]).filter(Object(Wn.a)(qn(C))))}),R),V=function(){var e=Object(m.a)(f.a.mark((function e(r){var n,c;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=r.target,e.abrupt("return",t(null===(n=c.files)||void 0===n?void 0:n[0]).then(p).then((function(){c.value=null})).catch(u));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(B.useEffect)((function(){if(x){var e=Object.values(n),t=x.filter(qn(e)),r=!!t.length;r?k(t):E(x),r&&T()}}),[x]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)(tn.a,{outline:!0,id:"importBtn",className:h,onClick:function(){var e;return null===(e=O.current)||void 0===e?void 0:e.click()},children:[Object(a.jsx)(M.a,{icon:A.s,fixedWidth:!0})," ",null!==s&&void 0!==s?s:"Import from file"]}),Object(a.jsxs)(Zt.a,{placement:j,target:"importBtn",children:["You can create servers by importing a CSV file with columns ",Object(a.jsx)("b",{children:"name"}),", ",Object(a.jsx)("b",{children:"apiKey"})," and ",Object(a.jsx)("b",{children:"url"}),"."]}),Object(a.jsx)("input",{type:"file",accept:"text/csv",className:"import-servers-btn__csv-select",ref:O,onChange:V}),Object(a.jsx)(Vn,{isOpen:U,duplicatedServers:C,onDiscard:L,onSave:D})]})}},Kn=r(538),Qn=r(70),Jn="shlink/selectedServer/SELECT_SERVER",Zn="shlink/selectedServer/RESET_SELECTED_SERVER",Yn=Object(G.a)((function(e){return"latest"===e?"999.999.999":e}),Object(Qn.c)("1.0.0")),Xn=Object(Kn.a)(lr.a,function(){var e=Object(m.a)(f.a.mark((function e(t,r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r().then((function(e){var t=e.version;return{version:Yn(t),printableVersion:Object(Qn.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),$n=bt((Ye={},Object(u.a)(Ye,Zn,(function(){return null})),Object(u.a)(Ye,Jn,(function(e,t){return t.selectedServer})),Ye),null),ec=ht(Zn),tc=function(e,t){return function(r){return function(){var n=Object(m.a)(f.a.mark((function n(c,a){var s,i,o,l,u,j,b,h;return f.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c(ec()),s=a(),i=s.servers,o=i[r]){n.next=6;break}return c({type:Jn,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 6:return n.prev=6,l=e(o),u=l.health,n.next=10,Xn(r,u);case 10:j=n.sent,b=j.version,h=j.printableVersion,c({type:Jn,selectedServer:Object(d.a)(Object(d.a)({},o),{},{version:b,printableVersion:h})}),c(t()),n.next=20;break;case 17:n.prev=17,n.t0=n.catch(6),c({type:Jn,selectedServer:Object(d.a)(Object(d.a)({},o),{},{serverNotReachable:!0})});case 20:case"end":return n.stop()}}),n,null,[[6,17]])})));return function(e,t){return n.apply(this,arguments)}}()}},rc=r(581),nc=r(150),cc=r(109),ac="shlink/servers/EDIT_SERVER",sc="shlink/servers/DELETE_SERVER",ic="shlink/servers/CREATE_SERVERS",oc="shlink/servers/SET_AUTO_CONNECT",lc=bt((Xe={},Object(u.a)(Xe,ic,(function(e,t){var r=t.newServers;return Object(d.a)(Object(d.a)({},e),r)})),Object(u.a)(Xe,sc,(function(e,t){var r=t.serverId;return Object(jt.a)(r,e)})),Object(u.a)(Xe,ac,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(Sr.a)(r,Object(d.a)(Object(d.a)({},e[r]),n),e):e})),Object(u.a)(Xe,oc,(function(e,t){var r=t.serverId,n=t.autoConnect;return e[r]?n?Object(rc.a)(Object(Ge.a)(e).map((function(e){var t=Object(N.a)(e,2),n=t[0],c=t[1];return[n,Object(d.a)(Object(d.a)({},c),{},{autoConnect:n===r})]}))):Object(Sr.a)(r,Object(d.a)(Object(d.a)({},e[r]),{},{autoConnect:n}),e):e})),Xe),{}),uc=Object(nc.a)((function(e,t){return Object(Sr.a)(t.id,t,e)}),{}),dc=Object(G.a)(Object(cc.a)((function(e){return e.id?e:Object(Sr.a)("id",Object(ln.a)(),e)})),uc,(function(e){return{type:ic,newServers:e}})),jc=function(e){return dc([e])},bc=function(e,t){return{type:ac,serverId:e,serverData:t}},hc=function(e){var t=e.id;return{type:sc,serverId:t}},Oc=function(e,t){var r=e.id;return{type:oc,serverId:r,autoConnect:t}},vc=Object(G.a)(Object(h.a)("data"),(function(e){return Array.isArray(e)?e.filter(O.b):[]})),fc=function(e){var t=e.get;return function(){return function(){var e=Object(m.a)(f.a.mark((function e(r){var n,c;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t("".concat(l.a,"/servers.json"));case 2:n=e.sent,c=vc(n),r(dc(c));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},mc=function(e){var t=e.minVersion,r=e.maxVersion,n=e.selectedServer,c=e.children;if(!Object(O.d)(n))return null;var s=n.version;return Object(Qn.a)(s,{maxVersion:r,minVersion:t})?Object(a.jsx)(a.Fragment,{children:c}):null},gc=r(164),xc=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(a.jsx)(Rn.a,{children:Object(a.jsxs)("div",{className:"server-error__container flex-column",children:[Object(a.jsxs)(xn.a,{className:"w-100 mb-3 mb-md-5",type:"error",fullWidth:!0,children:[!Object(O.e)(n)&&"Could not find this Shlink server.",Object(O.e)(n)&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("p",{children:"Oops! Could not connect to this Shlink server."}),"Make sure you have internet connection, and the server is properly configured and on-line."]})]}),Object(a.jsxs)(gc.a,{servers:Object.values(r),children:["These are the Shlink servers currently configured. Choose one of them or ",Object(a.jsx)(o.b,{to:"/server/create",children:"add a new one"}),"."]}),Object(O.e)(n)&&Object(a.jsx)("div",{className:"container mt-3 mt-md-5",children:Object(a.jsxs)("h5",{children:["Alternatively, if you think you may have miss-configured this server, you can ",Object(a.jsx)(e,{server:n,className:"server-error__delete-btn",children:"remove it"})," or\xa0",Object(a.jsx)(o.b,{to:"/server/".concat(n.id,"/edit"),children:"edit it"}),"."]})})]})})}},pc=r(98),Sc=r(539),yc=r(540),Cc=r(582),Nc=r(583),kc=function(e){var t=e.children,r=e.title,n=e.link;return Object(a.jsxs)(Ae.a,Object(d.a)(Object(d.a)({className:"highlight-card",body:!0},function(e){return e?{tag:o.b,to:e}:{}}(n)),{},{children:[n&&Object(a.jsx)(M.a,{size:"3x",className:"highlight-card__link-icon",icon:we.a}),Object(a.jsx)(Cc.a,{tag:"h5",className:"highlight-card__title",children:r}),Object(a.jsx)(Nc.a,{tag:"h2",children:t})]}))},_c=function(e,t,r){return He((function(n){var c,s=n.shortUrlsList,i=n.listShortUrls,l=n.listTags,u=n.tagsList,d=n.selectedServer,j=n.loadVisitsOverview,b=n.visitsOverview,h=s.loading,v=s.shortUrls,f=u.loading,m=b.loading,g=b.visitsCount,x=b.orphanVisitsCount,p=Object(O.a)(d),S=Object(Br.g)(d),y=Object(Br.f)(d),C=Object(De.g)();return Object(B.useEffect)((function(){i({itemsPerPage:5,orderBy:{field:"dateCreated",dir:"DESC"}}),l(),j()}),[]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)(dr.a,{children:[Object(a.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(a.jsx)(kc,{title:"Visits",link:y&&"/server/".concat(p,"/non-orphan-visits"),children:m?"Loading...":Lt(g)})}),Object(a.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(a.jsxs)(kc,{title:"Orphan visits",link:S&&"/server/".concat(p,"/orphan-visits"),children:[Object(a.jsx)(r,{minVersion:"2.6.0",children:m?"Loading...":Lt(null!==x&&void 0!==x?x:0)}),Object(a.jsx)(r,{maxVersion:"2.5.*",children:Object(a.jsx)("small",{className:"text-muted",children:Object(a.jsx)("i",{children:"Shlink 2.6 is needed"})})})]})}),Object(a.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(a.jsx)(kc,{title:"Short URLs",link:"/server/".concat(p,"/list-short-urls/1"),children:h?"Loading...":Lt(null!==(c=null===v||void 0===v?void 0:v.pagination.totalItems)&&void 0!==c?c:0)})}),Object(a.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(a.jsx)(kc,{title:"Tags",link:"/server/".concat(p,"/manage-tags"),children:f?"Loading...":Lt(u.tags.length)})})]}),Object(a.jsxs)(Ae.a,{className:"mb-3",children:[Object(a.jsxs)(Sc.a,{children:[Object(a.jsx)("span",{className:"d-sm-none",children:"Create a short URL"}),Object(a.jsx)("h5",{className:"d-none d-sm-inline",children:"Create a short URL"}),Object(a.jsx)(o.b,{className:"float-right",to:"/server/".concat(p,"/create-short-url"),children:"Advanced options \xbb"})]}),Object(a.jsx)(yc.a,{children:Object(a.jsx)(t,{basicMode:!0})})]}),Object(a.jsxs)(Ae.a,{children:[Object(a.jsxs)(Sc.a,{children:[Object(a.jsx)("span",{className:"d-sm-none",children:"Recently created URLs"}),Object(a.jsx)("h5",{className:"d-none d-sm-inline",children:"Recently created URLs"}),Object(a.jsx)(o.b,{className:"float-right",to:"/server/".concat(p,"/list-short-urls/1"),children:"See all \xbb"})]}),Object(a.jsx)(yc.a,{children:Object(a.jsx)(e,{shortUrlsList:s,selectedServer:d,className:"mb-0",onTagClick:function(e){return C("/server/".concat(p,"/list-short-urls/1?tags=").concat(encodeURIComponent(e)))}})})]})]})}),(function(){return[We.visits,We.orphanVisits]}))},wc=function(e,t,r,n){return function(c){var s=c.servers,i=Object.values(s),l=Object(B.useState)(i),u=Object(N.a)(l,2),d=u[0],j=u[1],b=d.some((function(e){return!!e.autoConnect})),h=r(!1,4e3),O=Object(N.a)(h,2),v=O[0],g=O[1];return Object(B.useEffect)((function(){j(Object.values(s))}),[s]),Object(a.jsxs)(Rn.a,{children:[Object(a.jsx)(q,{className:"mb-3",onChange:function(e){return j(i.filter((function(t){var r=t.name,n=t.url;return"".concat(r," ").concat(n).match(e)})))}}),Object(a.jsxs)(dr.a,{className:"mb-3",children:[Object(a.jsxs)("div",{className:"col-md-6 d-flex d-md-block mb-2 mb-md-0",children:[Object(a.jsx)(t,{className:"flex-fill",onImportError:g,children:"Import servers"}),i.length>0&&Object(a.jsxs)(tn.a,{outline:!0,className:"ml-2 flex-fill",onClick:Object(m.a)(f.a.mark((function t(){return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.exportServers());case 1:case"end":return t.stop()}}),t)}))),children:[Object(a.jsx)(M.a,{icon:A.r,fixedWidth:!0})," Export servers"]})]}),Object(a.jsx)("div",{className:"col-md-6 text-md-right d-flex d-md-block",children:Object(a.jsxs)(tn.a,{outline:!0,color:"primary",className:"flex-fill",tag:o.b,to:"/server/create",children:[Object(a.jsx)(M.a,{icon:A.F,fixedWidth:!0})," Add a server"]})})]}),Object(a.jsx)(jr.a,{children:Object(a.jsxs)("table",{className:"table table-hover mb-0",children:[Object(a.jsx)("thead",{className:"responsive-table__header",children:Object(a.jsxs)("tr",{children:[b&&Object(a.jsx)("th",{style:{width:"50px"}}),Object(a.jsx)("th",{children:"Name"}),Object(a.jsx)("th",{children:"Base URL"}),Object(a.jsx)("th",{})]})}),Object(a.jsxs)("tbody",{children:[!d.length&&Object(a.jsx)("tr",{className:"text-center",children:Object(a.jsx)("td",{colSpan:4,children:"No servers found."})}),d.map((function(e){return Object(a.jsx)(n,{server:e,hasAutoConnect:b},e.id)}))]})]})}),v&&Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsx)(br,{type:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})}},Uc=function(e){return function(t){var r=t.server,n=t.hasAutoConnect;return Object(a.jsxs)("tr",{className:"responsive-table__row",children:[n&&Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Auto-connect",children:r.autoConnect&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(M.a,{icon:A.h,className:"text-primary",id:"autoConnectIcon"}),Object(a.jsx)(Zt.a,{target:"autoConnectIcon",placement:"right",children:"Auto-connect to this server"})]})}),Object(a.jsx)("th",{className:"responsive-table__cell","data-th":"Name",children:Object(a.jsx)(o.b,{to:"/server/".concat(r.id),children:r.name})}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Base URL",children:r.url}),Object(a.jsx)("td",{className:"responsive-table__cell text-right",children:Object(a.jsx)(e,{server:r})})]})}},Tc=function(e){return function(t){var r=t.server,n=t.setAutoConnect,c=Object(Y.f)(),s=Object(N.a)(c,2),i=s[0],l=s[1],u=Object(Y.f)(),d=Object(N.a)(u,4),j=d[0],b=d[2],h=d[3],O="/server/".concat(r.id),v=r.autoConnect,f=v?A.b:we.c;return Object(a.jsxs)(rr,{isOpen:i,toggle:l,children:[Object(a.jsxs)(K.a,{tag:o.b,to:O,children:[Object(a.jsx)(M.a,{icon:A.E,fixedWidth:!0})," Connect"]}),Object(a.jsxs)(K.a,{tag:o.b,to:"".concat(O,"/edit"),children:[Object(a.jsx)(M.a,{icon:A.n,fixedWidth:!0})," Edit server"]}),Object(a.jsxs)(K.a,{onClick:function(){return n(r,!r.autoConnect)},children:[Object(a.jsx)(M.a,{icon:f,fixedWidth:!0})," ",v?"Do not a":"A","uto-connect"]}),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsxs)(K.a,{className:"dropdown-item--danger",onClick:b,children:[Object(a.jsx)(M.a,{icon:A.z,fixedWidth:!0})," Remove server"]}),Object(a.jsx)(e,{redirectHome:!1,server:r,isOpen:j,toggle:h})]})}},Rc=function(e){return"string"===typeof e.url&&"string"===typeof e.apiKey&&"string"===typeof e.name},Ec=function(e){return Array.isArray(e)&&e.every(Rc)},Dc=function e(t,r){var n=this;Object(g.a)(this,e),this.csvJson=t,this.fileReaderFactory=r,this.importServersFromFile=function(){var e=Object(m.a)(f.a.mark((function e(t){var r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new Error("No file provided");case 2:return r=n.fileReaderFactory(),e.abrupt("return",new Promise((function(e,c){r.addEventListener("loadend",(function(t){try{var r,a,s,i=null!==(r=null===(a=t.target)||void 0===a||null===(s=a.result)||void 0===s?void 0:s.toString())&&void 0!==r?r:"",o=n.csvJson.toObject(i);if(!Ec(o))throw new Error("Provided file does not have the right format.");e(o)}catch(t){c(t)}})),r.readAsText(t)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},Lc=r(99),Vc=function e(t,r,n){var c=this;Object(g.a)(this,e),this.storage=t,this.window=r,this.csvjson=n,this.exportServers=Object(m.a)(f.a.mark((function e(){var t,r,n;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object(An.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(O.f);try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(Lc.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))},Ic=function(e,t){e.serviceFactory("ManageServers",wc,"ServersExporter","ImportServersBtn","useStateFlagTimeout","ManageServersRow"),e.decorator("ManageServers",t(["servers"])),e.serviceFactory("ManageServersRow",Uc,"ManageServersRowDropdown"),e.serviceFactory("ManageServersRowDropdown",Tc,"DeleteServerModal"),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.serviceFactory("CreateServer",Fn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",pc.a),e.decorator("CreateServer",t(["selectedServer","servers"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",Hn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",(function(){return Mn})),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return Gn})),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",Pn,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",zn,"ServersImporter"),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.serviceFactory("ForServerVersion",(function(){return mc})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",xc,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",_c,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",Tn.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",Dc,"csvjson","fileReaderFactory"),e.service("ServersExporter",Vc,"Storage","window","csvjson"),e.serviceFactory("selectServer",tc,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return jc})),e.serviceFactory("createServers",(function(){return dc})),e.serviceFactory("deleteServer",(function(){return hc})),e.serviceFactory("editServer",(function(){return bc})),e.serviceFactory("setAutoConnect",(function(){return Oc})),e.serviceFactory("fetchServers",fc,"axios"),e.serviceFactory("resetSelectedServer",(function(){return ec}))},Fc=r(613),Ac=r(584),Mc=r(585),Gc=r(586),Pc=function(){return Object(a.jsx)(Fc.a,{attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},Bc=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(h.a)("latLong"))}:{zoom:10,center:Object(N.a)(e,1)[0].latLong}},Hc=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,s=void 0===c?[]:c;return Object(a.jsx)(ar.a,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(a.jsxs)(ir.a,{className:"map-modal__modal-body",children:[Object(a.jsxs)("h3",{className:"map-modal__modal-title",children:[n,Object(a.jsx)("button",{type:"button",className:"close",onClick:t,children:"\xd7"})]}),Object(a.jsxs)(Ac.a,Object(d.a)(Object(d.a)({},Bc(s)),{},{children:[Object(a.jsx)(Pc,{}),s.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(a.jsx)(Mc.a,{position:n,children:Object(a.jsxs)(Gc.a,{children:[Object(a.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(a.jsx)("b",{children:r})]})},t)}))]}))]})})},Wc=function(e){var t=e.visits,r=e.goBack,n=e.shortUrl,c=e.children,s=e.title;return Object(a.jsx)("header",{children:Object(a.jsxs)(Ae.a,{body:!0,children:[Object(a.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(a.jsx)(tn.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:r,children:Object(a.jsx)(M.a,{icon:A.a})}),Object(a.jsx)("span",{className:"text-center d-none d-sm-block",children:Object(a.jsx)("small",{children:s})}),Object(a.jsxs)("span",{className:"badge badge-main ml-3",children:["Visits:"," ",Object(a.jsx)($t,{visitsCount:t.length,shortUrl:n})]})]}),Object(a.jsx)("h3",{className:"text-center d-block d-sm-none mb-0 mt-3",children:Object(a.jsx)("small",{children:s})}),c&&Object(a.jsx)("div",{className:"mt-md-2",children:c})]})})},qc=function(e){var t,r,n=e.shortUrlDetail,c=e.shortUrlVisits,s=e.goBack,i=n.shortUrl,o=n.loading,l=c.visits,u=null!==(t=null===i||void 0===i?void 0:i.shortUrl)&&void 0!==t?t:"",d=null!==(r=null===i||void 0===i?void 0:i.longUrl)&&void 0!==r?r:"",j=null===i||void 0===i?void 0:i.title,b=Object(a.jsxs)(a.Fragment,{children:["Visits for ",Object(a.jsx)(Ht.a,{href:u})]});return Object(a.jsxs)(Wc,{title:b,goBack:s,visits:l,shortUrl:i,children:[Object(a.jsx)("hr",{}),Object(a.jsxs)("div",{children:["Created: ",i?Object(a.jsxs)("span",{children:[Object(a.jsx)("b",{id:"created",className:"short-url-visits-header__created-at",children:Object(a.jsx)(Jt,{date:i.dateCreated,relative:!0})}),Object(a.jsx)(Zt.a,{placement:"bottom",target:"created",children:Object(a.jsx)(Jt,{date:i.dateCreated})})]}):Object(a.jsx)("small",{children:"Loading..."})]}),Object(a.jsxs)("div",{children:["".concat(j?"Title":"Long URL",": "),o&&Object(a.jsx)("small",{children:"Loading..."}),!o&&Object(a.jsx)(Ht.a,{href:d,children:null!==j&&void 0!==j?j:d})]})]})},zc=r(599),Kc=r(552),Qc=r(600),Jc=r(550),Zc=r(108),Yc=r(591),Xc=r(592),$c=r(594),ea=r(588),ta=r(288),ra=r(589),na=r(310),ca=r(91),aa=r(590),sa=r(593),ia=r(287),oa=r.n(ia),la=r(587),ua="Others",da=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],ja=function(e){var t,r;return Object(ur.c)(e)?null!==(t=null===(r=e.split("/")[e.includes("://")?2:0])||void 0===r?void 0:r.split(":")[0])&&void 0!==t?t:"":"Direct"},ba=function(e,t){return Object.values(Object(d.a)(Object(d.a)({},Object(la.a)(t,t.map((function(){return 0})))),e))},ha=function(e){return Object(a.jsx)(un,Object(d.a)({type:"switch"},e))},Oa=function(e,t){var r=e.native,n=Object(N.a)(t,1)[0];null!==r&&void 0!==r&&r.target&&(r.target.style.cursor=n?"pointer":"default")},va=function(e){var t=e.dataset,r=e.formattedValue;return"".concat(t.label,": ").concat(Lt(r))},fa=function(e){var t=e.label,r=e.formattedValue;return"".concat(t,": ").concat(Lt(r))},ma=r(46),ga={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},xa={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},pa={hourly:ea.a,daily:ta.a,weekly:ra.a,monthly:na.a},Sa={hourly:function(e){return Object(ae.default)(e,"yyyy-MM-dd HH:00")},daily:function(e){return Object(ae.default)(e,"yyyy-MM-dd")},weekly:function(e){var t=Object(ae.default)(Object(ca.a)(e),"yyyy-MM-dd"),r=Object(ae.default)(Object(aa.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(ae.default)(e,"yyyy-MM")}},ya=function(e,t){return Object(Xc.a)((function(t){return Sa[e](Object(P.default)(t.date))}),t)},Ca=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=pa[e],n=Sa[e],c=Object(P.default)(t[0].date),a=Object(P.default)(t[t.length-1].date),s=r(c,a),i=xa[e];return[n(a)].concat(Object(Fe.a)(Object(ur.e)(s,(function(e){return n(Object(sa.a)(a,i(e)))}))))}(r,e);return[c,ba(t,c)]},Na=function(e,t,r){return{label:t,data:e,fill:!1,tension:.2,borderColor:r,backgroundColor:r}},ka=null,_a=function(e,t,r){return function(n){var c=Object(N.a)(n,1)[0];if(r&&c){var a,s=c.index;if(ka===e[s])r([]),ka=null;else r(e[s]&&t[e[s]]||[]),ka=null!==(a=e[s])&&void 0!==a?a:null}}},wa=function(e){var t=e.title,r=e.visits,n=e.highlightedVisits,c=e.highlightedLabel,s=void 0===c?"Selected":c,i=e.setSelectedVisits,o=Object(B.useState)(r.length>0?function(e){var t,r=new Date,n=Object(P.default)(e);return null!==(t=Object(ne.a)([[function(){return Object(ta.a)(r,n)<=2},Object(Yc.a)("hourly")],[function(){return Object(na.a)(r,n)<=1},Object(Yc.a)("daily")],[function(){return Object(na.a)(r,n)<=6},Object(Yc.a)("weekly")]])())&&void 0!==t?t:"monthly"}(r[r.length-1].date):"monthly"),l=Object(N.a)(o,2),u=l[0],d=l[1],j=Object(Y.f)(!0),b=Object(N.a)(j,2),h=b[0],O=b[1],v=Object(B.useMemo)((function(){return function(e,t){return t.reduce((function(t,r){var n,c=Sa[e](Object(P.default)(r.date));return t[c]=null!==(n=t[c])&&void 0!==n?n:[],t[c].push(r),t}),{})}(u,r)}),[u,r]),f=Object(B.useMemo)((function(){return ya(u,Object($c.a)(r))}),[u,r]),m=Object(B.useMemo)((function(){return Ca(r,f,u,h)}),[r,u,h]),g=Object(N.a)(m,2),x=g[0],p=g[1],S=Object(B.useMemo)((function(){return ba(ya(u,Object($c.a)(n)),x)}),[n,u,x]),y=function(){var e=Na(p,"Visits",ma.c);return 0===n.length?[e]:[e,Na(S,s,ma.a)]},C={maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{intersect:!1,axis:"x",callbacks:{label:va}}},scales:{y:{beginAtZero:!0,ticks:{precision:0,callback:Lt}},x:{title:{display:!0,text:ga[u]}}},onHover:Oa},k=function(){return Object(a.jsx)(Zc.c,{data:{labels:x,datasets:y()},options:C,getElementAtEvent:_a(x,v,i)})};return Object(a.jsxs)(Ae.a,{children:[Object(a.jsxs)(Sc.a,{children:[t,Object(a.jsx)("div",{className:"float-right",children:Object(a.jsxs)(Me.a,{children:[Object(a.jsx)(J.a,{caret:!0,color:"link",className:"btn-sm p-0",children:"Group by"}),Object(a.jsx)(Z.a,{right:!0,children:Object.entries(ga).map((function(e){var t=Object(N.a)(e,2),r=t[0],n=t[1];return Object(a.jsx)(K.a,{active:u===r,onClick:function(){return d(r)},children:n},r)}))})]})}),Object(a.jsx)("div",{className:"float-right mr-2",children:Object(a.jsx)(ha,{checked:h,onChange:O,children:Object(a.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(a.jsxs)(yc.a,{className:"line-chart-card__body",children:[n.length>0&&k(),0===n.length&&k()]})]})},Ua=r(595),Ta=function(e){var t=e.pagesCount,r=e.currentPage,n=e.setCurrentPage,c=e.centered,s=void 0===c||c;if(t<2)return null;var i=function(e){return function(){return!Ft(e)&&n(e)}};return Object(a.jsxs)(wt.a,{listClassName:W()("flex-wrap mb-0 simple-paginator",{"justify-content-center":s}),children:[Object(a.jsx)(kt.a,{disabled:r<=1,children:Object(a.jsx)(_t.a,{previous:!0,tag:"span",onClick:i(r-1)})}),It(r,t).map((function(e,t){return Object(a.jsx)(kt.a,{disabled:Ft(e),active:r===e,children:Object(a.jsx)(_t.a,{tag:"span",onClick:i(e),children:At(e)})},Mt(e,t))})),Object(a.jsx)(kt.a,{disabled:r>=t,children:Object(a.jsx)(_t.a,{next:!0,tag:"span",onClick:i(r+1)})})]})},Ra=function(e,t){return t.filter((function(t){return function(e,t){var r=e.browser,n=e.os,c=e.referer,a=e.country,s=e.city,i=Object(x.a)(e,["browser","os","referer","country","city"]);return"".concat(r," ").concat(n," ").concat(c," ").concat(a," ").concat(s," ").concat(i.visitedUrl).toLowerCase().includes(t.toLowerCase())}(t,e)}))},Ea=function(e,t,r){var n=function(e,t){return _(t,e)}(r,t?Ra(t,e):Object(Fe.a)(e)),c=n.length;return{visitsGroups:Object(Ua.a)(20,n),total:c}},Da=function(e){var t,r,n=e.visits,c=e.selectedVisits,s=void 0===c?[]:c,i=e.setSelectedVisits,o=e.selectedServer,l=e.matchMedia,u=void 0===l?window.matchMedia:l,d=e.isOrphanVisits,j=void 0!==d&&d,b="visits-table__header-cell visits-table__sticky",h=function(){return u("(max-width: 767px)").matches},O=Object(B.useState)(h()),v=Object(N.a)(O,2),f=v[0],m=v[1],g=Object(B.useState)(void 0),x=Object(N.a)(g,2),p=x[0],S=x[1],y=Object(B.useState)({}),C=Object(N.a)(y,2),_=C[0],w=C[1],U=Object(B.useMemo)((function(){return Ea(n,p,_)}),[p,_]),T=Object(B.useRef)(!0),R=Object(B.useState)(1),E=Object(N.a)(R,2),D=E[0],L=E[1],V=20*D,I=V-20,F=Object(Br.a)(o),G=7+Number(F)+Number(j),P=function(e){return function(){return w({field:e,dir:k(e,_.field,_.dir)})}},H=function(e){return Object(a.jsx)(qe,{currentOrder:_,field:e,className:"visits-table__header-icon"})};return Object(B.useEffect)((function(){var e=function(){return m(h())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),Object(B.useEffect)((function(){L(1),!T.current&&i([]),T.current=!1}),[p]),Object(a.jsxs)("table",{className:"table table-bordered table-hover table-sm table-responsive-sm visits-table",children:[Object(a.jsxs)("thead",{className:"visits-table__header",children:[Object(a.jsxs)("tr",{children:[Object(a.jsx)("th",{className:"".concat(b," text-center"),onClick:function(){return i(s.length<U.total?U.visitsGroups.flat():[])},children:Object(a.jsx)(M.a,{icon:A.h,className:W()({"text-primary":s.length>0})})}),F&&Object(a.jsxs)("th",{className:"".concat(b," text-center"),onClick:P("potentialBot"),children:[Object(a.jsx)(M.a,{icon:A.H}),H("potentialBot")]}),Object(a.jsxs)("th",{className:b,onClick:P("date"),children:["Date",H("date")]}),Object(a.jsxs)("th",{className:b,onClick:P("country"),children:["Country",H("country")]}),Object(a.jsxs)("th",{className:b,onClick:P("city"),children:["City",H("city")]}),Object(a.jsxs)("th",{className:b,onClick:P("browser"),children:["Browser",H("browser")]}),Object(a.jsxs)("th",{className:b,onClick:P("os"),children:["OS",H("os")]}),Object(a.jsxs)("th",{className:b,onClick:P("referer"),children:["Referrer",H("referer")]}),j&&Object(a.jsxs)("th",{className:b,onClick:P("visitedUrl"),children:["Visited URL",H("visitedUrl")]})]}),Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"p-0",children:Object(a.jsx)(q,{noBorder:!0,large:!1,onChange:S})})})]}),Object(a.jsxs)("tbody",{children:[!(null!==(t=U.visitsGroups[D-1])&&void 0!==t&&t.length)&&Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"text-center",children:"No visits found with current filtering"})}),null===(r=U.visitsGroups[D-1])||void 0===r?void 0:r.map((function(e,t){var r=s.includes(e);return Object(a.jsxs)("tr",{style:{cursor:"pointer"},className:W()({"table-active":r}),onClick:function(){return i(r?s.filter((function(t){return t!==e})):[].concat(Object(Fe.a)(s),[e]))},children:[Object(a.jsx)("td",{className:"text-center",children:r&&Object(a.jsx)(M.a,{icon:A.h,className:"text-primary"})}),F&&Object(a.jsx)("td",{className:"text-center",children:e.potentialBot&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(M.a,{icon:A.H,id:"botIcon".concat(t)}),Object(a.jsx)(Zt.a,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(a.jsx)("td",{children:Object(a.jsx)(Jt,{date:e.date})}),Object(a.jsx)("td",{children:e.country}),Object(a.jsx)("td",{children:e.city}),Object(a.jsx)("td",{children:e.browser}),Object(a.jsx)("td",{children:e.os}),Object(a.jsx)("td",{children:e.referer}),j&&Object(a.jsx)("td",{children:e.visitedUrl})]},t)}))]}),U.total>20&&Object(a.jsx)("tfoot",{children:Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"visits-table__footer-cell visits-table__sticky",children:Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(Ta,{pagesCount:Math.ceil(U.total/20),currentPage:D,setCurrentPage:L,centered:f})}),Object(a.jsx)("div",{className:W()("col-md-6",{"d-flex align-items-center flex-row-reverse":!f,"text-center mt-3":f}),children:Object(a.jsxs)("div",{children:["Visits ",Object(a.jsx)("b",{children:Lt(I+1)})," to"," ",Object(a.jsx)("b",{children:Lt(Object(Rt.a)(V,U.total))})," of"," ",Object(a.jsx)("b",{children:Lt(U.total)})]})})]})})})})]})},La=function(e){var t=e.modalTitle,r=e.activeCities,n=e.locations,c=void 0===n?[]:n,s=Object(Y.f)(),i=Object(N.a)(s,4),o=i[0],l=i[2],u=i[3],d=Object(Y.f)(),j=Object(N.a)(d,3),b=j[0],h=j[1],O=j[2],v=Object(B.useState)([]),f=Object(N.a)(v,2),m=f[0],g=f[1],x=Object(B.useRef)(),p=function(e){return function(){g(e?c.filter((function(e){var t=e.cityName;return r.includes(t)})):c),l()}};return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("button",{className:"btn btn-link open-map-modal-btn__btn",ref:x,onClick:function(){if(!r)return g(c),void l();O()},children:Object(a.jsx)(M.a,{icon:A.y})}),Object(a.jsx)(Zt.a,{placement:"left",target:function(){return x.current},children:"Show in map"}),Object(a.jsx)(Q.a,{isOpen:b,toggle:h,inNavbar:!0,children:Object(a.jsxs)(Z.a,{right:!0,children:[Object(a.jsx)(K.a,{onClick:p(!1),children:"Show all locations"}),Object(a.jsx)(K.a,{onClick:p(!0),children:"Show locations in current page"})]})}),Object(a.jsx)(Hc,{toggle:u,isOpen:o,title:t,locations:m})]})},Va=r(596),Ia=function(e){return e.hasOwnProperty("visitedUrl")},Fa=Object(G.a)(Object(Va.a)((function(e){return Ia(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(d.a)({orphanVisits:[],regularVisits:[]},e)})),Aa=function(e,t){return Object(Xc.a)(Object(h.a)(t),e)},Ma=function(e){var t,r,n=e.page,c=e.itemsPerPage,a=e.filter,s=e.dateRange;return{page:n,itemsPerPage:c,startDate:null!==(t=(null===s||void 0===s?void 0:s.startDate)&&je(null===s||void 0===s?void 0:s.startDate))&&void 0!==t?t:void 0,endDate:null!==(r=(null===s||void 0===s?void 0:s.endDate)&&je(null===s||void 0===s?void 0:s.endDate))&&void 0!==r?r:void 0,excludeBots:(null===a||void 0===a?void 0:a.excludeBots)||void 0}},Ga=function(e,t){return!Object(S.a)(e)&&Object(ur.c)(e[t])},Pa=function(e){return"number"===typeof e?e:e?parseFloat(e):0},Ba=function(e){return function(t,r){var n=Ga(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},Ha=Ba("country"),Wa=Ba("city"),qa=function(e){return e.reduce((function(e,t){return function(e,t){var r=t.os;e[r]=(e[r]||0)+1}(e.os,t),function(e,t){var r=t.browser;e[r]=(e[r]||0)+1}(e.browsers,t),function(e,t){var r=t.referer;e[r]=(e[r]||0)+1}(e.referrers,t),Ha(e.countries,t),Wa(e.cities,t),function(e,t){if(Ga(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[Pa(n),Pa(c)]};a.count++,e[r]=a}}(e.citiesForMap,t),function(e,t){if(function(e){return e.hasOwnProperty("visitedUrl")}(t)){var r=t.visitedUrl;e[r]=(e[r]||0)+1}}(e.visitedUrls,t),e}),{os:{},browsers:{},referrers:{},countries:{},cities:{},citiesForMap:{},visitedUrls:{}})},za=Object(cc.a)((function(e){var t=e.userAgent,r=e.date,n=e.referer,c=e.visitLocation,a=e.potentialBot,s=void 0!==a&&a,i=Object(d.a)(Object(d.a)({date:r,potentialBot:s},function(e){if(!Object(ur.c)(e))return{browser:ua,os:ua};var t=oa.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:ua,browser:r&&da.includes(r)?r:ua}}(t)),{},{referer:ja(n),country:(null===c||void 0===c?void 0:c.countryName)||"Unknown",city:(null===c||void 0===c?void 0:c.cityName)||"Unknown",latitude:null===c||void 0===c?void 0:c.latitude,longitude:null===c||void 0===c?void 0:c.longitude});return Ia(e)?Object(d.a)(Object(d.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Ka=function(e){var t=e.onChange,r=e.selected,n=void 0===r?{}:r,c=e.className,s=e.isOrphanVisits,i=e.botsSupported;if(!i&&!s)return null;var o=n.orphanVisitsType,l=n.excludeBots,u=void 0!==l&&l,j=function(e){return{active:o===e,onClick:function(){return t(Object(d.a)(Object(d.a)({},n),{},{orphanVisitsType:e===(null===n||void 0===n?void 0:n.orphanVisitsType)?void 0:e}))}}};return Object(a.jsxs)(X,{text:"Filters",dropdownClassName:c,className:"mr-3",right:!0,minWidth:250,children:[i&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(K.a,{header:!0,children:"Bots:"}),Object(a.jsx)(K.a,{active:u,onClick:function(){return t(Object(d.a)(Object(d.a)({},n),{},{excludeBots:!(null!==n&&void 0!==n&&n.excludeBots)}))},children:"Exclude potential bots"})]}),i&&s&&Object(a.jsx)(K.a,{divider:!0}),s&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(K.a,{header:!0,children:"Orphan visits type:"}),Object(a.jsx)(K.a,Object(d.a)(Object(d.a)({},j("base_url")),{},{children:"Base URL"})),Object(a.jsx)(K.a,Object(d.a)(Object(d.a)({},j("invalid_short_url")),{},{children:"Invalid short URL"})),Object(a.jsx)(K.a,Object(d.a)(Object(d.a)({},j("regular_404")),{},{children:"Regular 404"}))]}),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsx)(K.a,{disabled:!Object(ur.c)(n),onClick:function(){return t({})},children:Object(a.jsx)("i",{children:"Clear filters"})})]})},Qa=r(61),Ja=function(e){var t,r,n=e.chart.config,c=null!==(t=n.data)&&void 0!==t?t:{},s=c.labels,i=void 0===s?[]:s,o=c.datasets,l=void 0===o?[]:o,u=Object(N.a)(l,1)[0].backgroundColor,d=(null!==(r=n.options)&&void 0!==r?r:{}).defaultColor;return Object(a.jsx)("ul",{className:"doughnut-chart-legend",children:i.map((function(e,t){var r;return Object(a.jsxs)("li",{className:"doughnut-chart-legend__item d-flex",children:[Object(a.jsx)("div",{className:"doughnut-chart-legend__item-color",style:{backgroundColor:null!==(r=u[t])&&void 0!==r?r:d}}),Object(a.jsx)("small",{className:"doughnut-chart-legend__item-text flex-fill",children:e})]},e)}))})},Za=function(e){return[{data:e,backgroundColor:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:Object(ma.h)()?ma.e:ma.f,borderWidth:2}]},Ya=Object(B.memo)((function(e){var t=e.stats,r=Object(B.useState)(),n=Object(N.a)(r,2),c=n[0],s=n[1],i=Object(Qa.a)(t),o=Object(An.a)(t),l={plugins:{legend:{display:!1},tooltip:{intersect:!0,callbacks:{label:fa}}}},u=function(e,t){return{labels:e,datasets:Za(t)}}(i,o);return Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:"col-sm-12 col-md-7",children:Object(a.jsx)(Zc.b,{height:300,data:u,options:l,ref:function(e){s(null!==e&&void 0!==e?e:void 0)}})}),Object(a.jsx)("div",{className:"col-sm-12 col-md-5",children:c&&Object(a.jsx)(Ja,{chart:c})})]})})),Xa=r(597),$a=function(e){var t=e.title,r=e.footer,n=e.children;return Object(a.jsxs)(Ae.a,{children:[Object(a.jsx)(Sc.a,{className:"chart-card__header",children:"function"===typeof t?t():t}),Object(a.jsx)(yc.a,{children:n}),r&&Object(a.jsx)(Xa.a,{className:"chart-card__footer--sticky",children:r})]})},es=function(e){var t=e.title,r=e.stats;return Object(a.jsx)($a,{title:t,children:Object(a.jsx)(Ya,{stats:r})})},ts=r(123),rs=r(605),ns=r(598),cs=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(a.jsxs)(Me.a,{children:[Object(a.jsx)(J.a,{caret:!0,color:"link",className:t,children:"Paginate"}),Object(a.jsxs)(Z.a,{right:!0,children:[r.map((function(e){return Object(a.jsxs)(K.a,{active:e===n,onClick:function(){return c(e)},children:[Object(a.jsx)("b",{children:e})," items per page"]},e)})),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsx)(K.a,{disabled:n===1/0,onClick:function(){return c(1/0)},children:Object(a.jsx)("i",{children:"Clear pagination"})})]})]})},as=function(e){return e.startsWith("hidden")?"":e},ss=function(e,t,r){var n={data:e,label:r?"Non-selected":"Visits",backgroundColor:ma.d,borderColor:ma.c,borderWidth:2};return t.every((function(e){return 0===e}))?[n]:[n,{label:null!==r&&void 0!==r?r:"Selected",data:t,backgroundColor:ma.b,borderColor:ma.a,borderWidth:2}]},is=function(e,t){return function(r){var n=Object(N.a)(r,1)[0];t&&n&&t(e[n.index])}},os=function(e){var t=e.stats,r=e.highlightedStats,n=e.highlightedLabel,c=e.onClick,s=e.max,i=Object(Qa.a)(t).map(as),o=Object(An.a)(function(e){return!!e&&Object.keys(e).length>0}(r)?Object(Qa.a)(r).reduce((function(e,t){return e[t]&&(e[t]-=r[t]),e}),Object(d.a)({},t)):t),l=ba(null!==r&&void 0!==r?r:{},i),u={plugins:{legend:{display:!1},tooltip:{mode:"y",filter:function(e){return""!==e.label},callbacks:{label:va}}},scales:{x:{beginAtZero:!0,stacked:!0,max:s,ticks:{precision:0,callback:Lt}},y:{stacked:!0}},onHover:Oa,indexAxis:"y"},j=function(e,t,r,n){return{labels:e,datasets:ss(t,r,n)}}(i,o,l,n),b=function(e){return e.length>20?10*e.length:void 0}(i),h=function(e){return Object(a.jsx)(Zc.a,{data:j,options:u,height:b,getElementAtEvent:is(i,c)},"".concat(b,"_").concat(e))};return Object(a.jsxs)(a.Fragment,{children:[void 0!==r&&h("with_stats"),void 0===r&&h("without_stats")]})},ls=function(e){return"String"===Object(ts.a)(e)?Object(rs.a)(e):e},us=function(e){return Object(N.a)(e,1)[0]},ds=function(e){return Object(N.a)(e,2)[1]},js=function(e){var t=e.stats,r=e.highlightedStats,n=e.title,c=e.sortingItems,s=e.extraHeaderContent,i=e.withPagination,o=void 0===i||i,l=Object(x.a)(e,["stats","highlightedStats","title","sortingItems","extraHeaderContent","withPagination"]),u=Object(B.useState)({}),j=Object(N.a)(u,2),b=j[0],h=j[1],O=Object(B.useState)(1),v=Object(N.a)(O,2),f=v[0],m=v[1],g=Object(B.useState)(50),p=Object(N.a)(g,2),S=p[0],y=p[1],C=function(e){var t=e[f-1];if(f<e.length)return t;var r=e[0].length;return[].concat(Object(Fe.a)(t),Object(Fe.a)(Object(ur.e)(r-t.length,(function(e){return["hidden_".concat(e),0]}))))},k=function(e,t,r){var n=function(e,t){var r=Object(Ge.a)(e),n=b.field?Object(ns.a)(Object(G.a)(b.field===Object.keys(t)[0]?us:ds,ls),r):r;return b.dir&&"ASC"!==b.dir?Object($c.a)(n):n}(e,r),c=n.map(us),s=t&&Object(Ge.a)(Object(d.a)(Object(d.a)({},Object(la.a)(c,c.map((function(){return 0})))),t));if(n.length<=S)return{currentPageStats:Object(rc.a)(n),currentPageHighlightedStats:s&&Object(rc.a)(s)};var i,o,l=Object(Ua.a)(S,n),u=s&&Object(Ua.a)(S,s);return{currentPageStats:Object(rc.a)(C(l)),currentPageHighlightedStats:u&&Object(rc.a)(C(u)),pagination:(o=l.length,Object(a.jsx)(Ta,{currentPage:f,pagesCount:o,setCurrentPage:m})),max:(i=Math.max.apply(Math,Object(Fe.a)(n.map(ds))),10*Et(i/10))}}(t,r&&Object.keys(r).length>0?r:void 0,c),_=k.currentPageStats,w=k.currentPageHighlightedStats,U=k.pagination,T=k.max,R=Object.keys(_);return Object(a.jsx)($a,{title:function(){return Object(a.jsxs)(a.Fragment,{children:[n,Object(a.jsx)("div",{className:"float-right",children:Object(a.jsx)(Pe,{isButton:!1,right:!0,items:c,order:b,onChange:function(e,t){h({field:e,dir:t}),m(1)}})}),o&&Object.keys(t).length>50&&Object(a.jsx)("div",{className:"float-right",children:Object(a.jsx)(cs,{toggleClassName:"btn-sm p-0 mr-3",ranges:[50,100,200,500],value:S,setValue:function(e){y(e),m(1)}})}),s&&Object(a.jsx)("div",{className:"float-right",children:s(U?R:void 0)})]})},footer:U,children:Object(a.jsx)(os,Object(d.a)({stats:_,highlightedStats:w,max:T},l))})},bs={byTime:{title:"By time",subPath:"by-time",icon:A.d},byContext:{title:"By context",subPath:"by-context",icon:A.g},byLocation:{title:"By location",subPath:"by-location",icon:A.y},list:{title:"List",subPath:"list",icon:A.x}},hs=function(e){var t=e.subPath,r=e.title,n=e.icon,c=e.to;return Object(a.jsxs)(Kc.a,{tag:o.c,className:"visits-stats__nav-link",to:c,isActive:function(e,r){return r.pathname.endsWith("visits".concat(t))},replace:!0,children:[Object(a.jsx)(M.a,{icon:n}),Object(a.jsx)("span",{className:"ml-2 d-none d-sm-inline",children:r})]})},Os=function(e){var t,r,n=e.children,c=e.visitsInfo,s=e.getVisits,i=e.cancelGetVisits,o=e.domain,l=e.settings,u=e.exportCsv,j=e.selectedServer,b=e.isOrphanVisits,h=void 0!==b&&b,O=c.visits,v=c.loading,f=c.loadingLarge,m=c.error,g=c.errorData,x=c.progress,p=c.fallbackInterval,S=Object(B.useState)(null!==(t=null!==p&&void 0!==p?p:null===(r=l.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days"),C=Object(N.a)(S,2),k=C[0],_=C[1],w=Object(B.useState)(Ce(k)),U=Object(N.a)(w,2),T=U[0],R=U[1],E=Object(B.useState)([]),D=Object(N.a)(E,2),L=D[0],V=D[1],I=Object(B.useState)(),F=Object(N.a)(I,2),G=F[0],P=F[1],H=Object(B.useState)({}),q=Object(N.a)(H,2),z=q[0],K=q[1],Q=Object(Br.a)(j),J=Object(B.useRef)(!0),Z=function(e){var t=o?"?domain=".concat(o):"";return e?"".concat(e).concat(t):"".concat(t)},Y=Object(B.useMemo)((function(){return za(O)}),[O]),X=Object(B.useMemo)((function(){return qa(Y)}),[Y]),$=X.os,ee=X.browsers,te=X.referrers,re=X.countries,ne=X.cities,ce=X.citiesForMap,ae=X.visitedUrls,se=Object(An.a)(ce),ie=function(e){$e=void 0,V(e)},oe=function(e){return function(t){var r="".concat(e,"_").concat(t);$e===r?(V([]),P(void 0),$e=void 0):(V(Y.filter(Object(zc.a)(e,t))),P(t),$e=r)}};Object(B.useEffect)((function(){return i}),[]),Object(B.useEffect)((function(){s({dateRange:T,filter:z},J.current),J.current=!1}),[T,z]),Object(B.useEffect)((function(){p&&_(p)}),[p]);return Object(a.jsxs)(a.Fragment,{children:[n,Object(a.jsx)("section",{className:"mt-3",children:Object(a.jsxs)("div",{className:"row flex-md-row-reverse",children:[Object(a.jsx)("div",{className:"col-lg-7 col-xl-6",children:Object(a.jsxs)("div",{className:"d-md-flex",children:[Object(a.jsx)("div",{className:"flex-fill",children:Object(a.jsx)(Ee,{updatable:!0,disabled:v,initialDateRange:k,defaultText:"All visits",onDatesChange:R})}),Object(a.jsx)(Ka,{className:"ml-0 ml-md-2 mt-3 mt-md-0",isOrphanVisits:h,botsSupported:Q,selected:z,onChange:K})]})}),O.length>0&&Object(a.jsx)("div",{className:"col-lg-5 col-xl-6 mt-3 mt-lg-0",children:Object(a.jsxs)("div",{className:"d-flex",children:[Object(a.jsxs)(tn.a,{outline:!0,disabled:0===L.length,className:"btn-md-block mr-2",onClick:function(){return ie([])},children:["Clear selection ",L.length>0&&Object(a.jsxs)(a.Fragment,{children:["(",Lt(L.length),")"]})]}),Object(a.jsxs)(tn.a,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return u(Y)},children:[Object(a.jsx)(M.a,{icon:A.r})," Export (",Lt(Y.length),")"]})]})})]})}),Object(a.jsx)("section",{className:"mt-3",children:f?Object(a.jsxs)(xn.a,{loading:!0,children:["This is going to take a while... :S",Object(a.jsx)(Qc.a,{value:x,striped:100===x,className:"mt-3"})]}):v?Object(a.jsx)(xn.a,{loading:!0}):m?Object(a.jsx)(br,{type:"error",children:Object(a.jsx)(vr,{errorData:g,fallbackMessage:"An error occurred while loading visits :("})}):Object(y.a)(O)?Object(a.jsx)(xn.a,{children:"There are no visits matching current filter :("}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Ae.a,{className:"visits-stats__nav p-0 overflow-hidden",body:!0,children:Object(a.jsx)(Jc.a,{pills:!0,fill:!0,children:Object.entries(bs).map((function(e){var t=Object(N.a)(e,2),r=t[0],n=t[1];return Object(a.jsx)(hs,Object(d.a)(Object(d.a)({},n),{},{to:Z(n.subPath)}),r)}))})}),Object(a.jsx)(dr.a,{children:Object(a.jsxs)(De.d,{children:[Object(a.jsx)(De.b,{path:bs.byTime.subPath,element:Object(a.jsx)("div",{className:"col-12 mt-3",children:Object(a.jsx)(wa,{title:"Visits during time",visits:Y,highlightedVisits:L,highlightedLabel:G,setSelectedVisits:ie})})}),Object(a.jsx)(De.b,{path:bs.byContext.subPath,element:Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{className:W()("mt-3 col-lg-6",{"col-xl-4":!h}),children:Object(a.jsx)(es,{title:"Operating systems",stats:$})}),Object(a.jsx)("div",{className:W()("mt-3 col-lg-6",{"col-xl-4":!h}),children:Object(a.jsx)(es,{title:"Browsers",stats:ee})}),Object(a.jsx)("div",{className:W()("mt-3",{"col-xl-4":!h,"col-lg-6":h}),children:Object(a.jsx)(js,{title:"Referrers",stats:te,withPagination:!1,highlightedStats:Aa(L,"referer"),highlightedLabel:G,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:oe("referer")})}),h&&Object(a.jsx)("div",{className:"mt-3 col-lg-6",children:Object(a.jsx)(js,{title:"Visited URLs",stats:ae,highlightedLabel:G,highlightedStats:Aa(L,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:oe("visitedUrl")})})]})}),Object(a.jsx)(De.b,{path:bs.byLocation.subPath,element:Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{className:"col-lg-6 mt-3",children:Object(a.jsx)(js,{title:"Countries",stats:re,highlightedStats:Aa(L,"country"),highlightedLabel:G,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:oe("country")})}),Object(a.jsx)("div",{className:"col-lg-6 mt-3",children:Object(a.jsx)(js,{title:"Cities",stats:ne,highlightedStats:Aa(L,"city"),highlightedLabel:G,extraHeaderContent:function(e){return se.length>0&&Object(a.jsx)(La,{modalTitle:"Cities",locations:se,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:oe("city")})})]})}),Object(a.jsx)(De.b,{path:bs.list.subPath,element:Object(a.jsx)("div",{className:"col-12",children:Object(a.jsx)(Da,{visits:Y,selectedVisits:L,setSelectedVisits:ie,isOrphanVisits:h,selectedServer:j})})}),Object(a.jsx)(De.b,{path:"*",element:Object(a.jsx)(De.a,{replace:!0,to:Z(bs.byTime.subPath)})})]})})]})})]})},vs=function(e){var t=e.exportVisits;return He((function(e){var r=e.shortUrlVisits,n=e.shortUrlDetail,c=e.getShortUrlVisits,s=e.getShortUrlDetail,i=e.cancelGetShortUrlVisits,o=e.settings,l=e.selectedServer,u=Object(De.h)().shortCode,j=void 0===u?"":u,b=Object(De.f)().search,h=Object(Y.b)(),O=Object(C.a)(b).domain;return Object(B.useEffect)((function(){s(j,O)}),[]),Object(a.jsx)(Os,{getVisits:function(e,t){return c(j,Object(d.a)(Object(d.a)({},Ma(e)),{},{domain:O}),t)},cancelGetVisits:i,visitsInfo:r,domain:O,settings:o,exportCsv:function(e){var r;return t("short-url_".concat(null===(r=n.shortUrl)||void 0===r?void 0:r.shortUrl.replace(/https?:\/\//g,""),"_visits.csv"),e)},selectedServer:l,children:Object(a.jsx)(qc,{shortUrlDetail:n,shortUrlVisits:r,goBack:h})})}),(function(e,t){return[We.shortUrlVisits(t.shortCode)]}))},fs=function(e){var t=e.tagVisits,r=e.goBack,n=e.colorGenerator,c=t.visits,s=t.tag,i=Object(a.jsxs)("span",{className:"d-flex align-items-center justify-content-center",children:[Object(a.jsx)("span",{className:"mr-2",children:"Visits for"}),Object(a.jsx)(z,{text:s,colorGenerator:n})]});return Object(a.jsx)(Wc,{title:i,goBack:r,visits:c})},ms=function(e,t){var r=t.exportVisits;return He((function(t){var n=t.getTagVisits,c=t.tagVisits,s=t.cancelGetTagVisits,i=t.settings,o=t.selectedServer,l=Object(Y.b)(),u=Object(De.h)().tag,d=void 0===u?"":u;return Object(a.jsx)(Os,{getVisits:function(e,t){return n(d,Ma(e),t)},cancelGetVisits:s,visitsInfo:c,settings:i,exportCsv:function(e){return r("tag_".concat(d,"_visits.csv"),e)},selectedServer:o,children:Object(a.jsx)(fs,{tagVisits:c,goBack:l,colorGenerator:e})})}),(function(){return[We.visits]}))},gs=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(a.jsx)(Wc,{title:"Orphan visits",goBack:r,visits:n})},xs=function(e){var t=e.exportVisits;return He((function(e){var r=e.getOrphanVisits,n=e.orphanVisits,c=e.cancelGetOrphanVisits,s=e.settings,i=e.selectedServer,o=Object(Y.b)();return Object(a.jsx)(Os,{getVisits:function(e,t){var n;return r(Ma(e),null===(n=e.filter)||void 0===n?void 0:n.orphanVisitsType,t)},cancelGetVisits:c,visitsInfo:n,settings:s,exportCsv:function(e){return t("orphan_visits.csv",e)},selectedServer:i,isOrphanVisits:!0,children:Object(a.jsx)(gs,{orphanVisits:n,goBack:o})})}),(function(){return[We.orphanVisits]}))},ps=function(e){var t=e.nonOrphanVisits,r=e.goBack,n=t.visits;return Object(a.jsx)(Wc,{title:"Non-orphan visits",goBack:r,visits:n})},Ss=function(e){var t=e.exportVisits;return He((function(e){var r=e.getNonOrphanVisits,n=e.nonOrphanVisits,c=e.cancelGetNonOrphanVisits,s=e.settings,i=e.selectedServer,o=Object(Y.b)();return Object(a.jsx)(Os,{getVisits:function(e,t){return r(Ma(e),t)},cancelGetVisits:c,visitsInfo:n,settings:s,exportCsv:function(e){return t("non_orphan_visits.csv",e)},selectedServer:i,children:Object(a.jsx)(ps,{nonOrphanVisits:n,goBack:o})})}),(function(){return[We.visits]}))},ys=r(611),Cs=5e3,Ns=function(e){return e.currentPage>=e.pagesCount},ks=function(e,t){return 100*t/e},_s=function(){var e=Object(m.a)(f.a.mark((function e(t,r,n,c,a,s){var i,o,l,u,j,b,O;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a({type:c.start}),i=function(){var e=Object(m.a)(f.a.mark((function e(r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(r.map(function(){var e=Object(m.a)(f.a.mark((function e(r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(r,Cs).then(Object(h.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(ys.a));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=function(){var e=Object(m.a)(f.a.mark((function e(t){var r,n,l=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:0,!s()){e.next=3;break}return e.abrupt("return",[]);case 3:return e.next=5,i(t[r]);case 5:if(n=e.sent,a({type:c.progress,progress:ks(t.length,r+2)}),!(r<t.length-1)){e.next=13;break}return e.t0=n,e.next=11,o(t,r+1);case 11:return e.t1=e.sent,e.abrupt("return",e.t0.concat.call(e.t0,e.t1));case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),l=function(){var e=Object(m.a)(f.a.mark((function e(){var r,n,s,i,l,u,d=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>0&&void 0!==d[0]?d[0]:1,e.next=3,t(r,Cs);case 3:if(n=e.sent,s=n.pagination,i=n.data,s&&!Ns(s)){e.next=8;break}return e.abrupt("return",i);case 8:return l=Object(Ut.a)(2,s.pagesCount+1),u=Object(Ua.a)(4,l),s.pagesCount-1>4&&a({type:c.large}),e.t0=i,e.next=14,o(u);case 14:return e.t1=e.sent,e.abrupt("return",e.t0.concat.call(e.t0,e.t1));case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=4,e.next=7,Promise.all([l(),r()]);case 7:u=e.sent,j=Object(N.a)(u,2),b=j[0],O=j[1],a(!b.length&&O?{type:c.fallbackToInterval,fallbackInterval:Ne(O.date)}:Object(d.a)(Object(d.a)({},n),{},{visits:b,type:c.finish})),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),a({type:c.error,errorData:hr(e.t0)});case 17:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t,r,n,c,a,s){return e.apply(this,arguments)}}(),ws=function(e,t){return e?Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t({page:1,itemsPerPage:1}).then((function(e){return e.data[0]})));case 1:case"end":return e.stop()}}),e)}))):Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.resolve(void 0));case 1:case"end":return e.stop()}}),e)})))},Us="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",Ts="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",Rs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",Es="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",Ds="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",Ls="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",Vs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL",Is={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Fs=bt((et={},Object(u.a)(et,Us,(function(){return Object(d.a)(Object(d.a)({},Is),{},{loading:!0})})),Object(u.a)(et,Ts,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},Is),{},{error:!0,errorData:r})})),Object(u.a)(et,Rs,(function(e,t){var r=t.visits,n=t.query,c=t.shortCode,a=t.domain;return Object(d.a)(Object(d.a)({},e),{},{visits:r,shortCode:c,domain:a,query:n,loading:!1,error:!1})})),Object(u.a)(et,Es,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(et,Ds,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(et,Ls,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(et,Vs,(function(e,t){var r=t.fallbackInterval;return Object(d.a)(Object(d.a)({},e),{},{fallbackInterval:r})})),Object(u.a)(et,Cr,(function(e,t){var r=t.createdVisits,n=e.shortCode,c=e.domain,a=e.visits,s=e.query,i=void 0===s?{}:s,o=i.startDate,l=i.endDate,u=r.filter((function(e){var t=e.shortUrl,r=e.visit;return t&&yr(t,n,c)&&Oe(r.date,o,l)})).map((function(e){return e.visit}));return 0===u.length?e:Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Fe.a)(u),Object(Fe.a)(a))})})),et),Is),As=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(m.a)(f.a.mark((function c(a,s){var i,o,l,u,j,b,h;return f.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getShortUrlVisits,l=function(){var e=Object(m.a)(f.a.mark((function e(n,c){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(d.a)(Object(d.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),u=ws(n,function(){var e=Object(m.a)(f.a.mark((function e(n){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(d.a)(Object(d.a)({},n),{},{domain:r.domain})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),j=function(){return s().shortUrlVisits.cancelLoad},b={shortCode:t,query:r,domain:r.domain},h={start:Us,large:Es,finish:Rs,error:Ts,progress:Ls,fallbackToInterval:Vs},c.abrupt("return",_s(l,u,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ms=ht(Ds),Gs="shlink/tagVisits/GET_TAG_VISITS_START",Ps="shlink/tagVisits/GET_TAG_VISITS_ERROR",Bs="shlink/tagVisits/GET_TAG_VISITS",Hs="shlink/tagVisits/GET_TAG_VISITS_LARGE",Ws="shlink/tagVisits/GET_TAG_VISITS_CANCEL",qs="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",zs="shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL",Ks={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Qs=bt((tt={},Object(u.a)(tt,Gs,(function(){return Object(d.a)(Object(d.a)({},Ks),{},{loading:!0})})),Object(u.a)(tt,Ps,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},Ks),{},{error:!0,errorData:r})})),Object(u.a)(tt,Bs,(function(e,t){var r=t.visits,n=t.tag,c=t.query;return Object(d.a)(Object(d.a)({},e),{},{visits:r,tag:n,query:c,loading:!1,error:!1})})),Object(u.a)(tt,Hs,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(tt,Ws,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(tt,qs,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(tt,zs,(function(e,t){var r=t.fallbackInterval;return Object(d.a)(Object(d.a)({},e),{},{fallbackInterval:r})})),Object(u.a)(tt,Cr,(function(e,t){var r=t.createdVisits,n=e.tag,c=e.visits,a=e.query,s=void 0===a?{}:a,i=s.startDate,o=s.endDate,l=r.filter((function(e){var t=e.shortUrl,r=e.visit;return(null===t||void 0===t?void 0:t.tags.includes(n))&&Oe(r.date,i,o)})).map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Fe.a)(l),Object(Fe.a)(c))})})),tt),Ks),Js=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(m.a)(f.a.mark((function c(a,s){var i,o,l,u,j,b,h;return f.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getTagVisits,l=function(){var e=Object(m.a)(f.a.mark((function e(n,c){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(d.a)(Object(d.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),u=ws(n,function(){var e=Object(m.a)(f.a.mark((function e(r){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,r));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),j=function(){return s().tagVisits.cancelLoad},b={tag:t,query:r},h={start:Gs,large:Hs,finish:Bs,error:Ps,progress:qs,fallbackToInterval:zs},c.abrupt("return",_s(l,u,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Zs=ht(Ws),Ys="shlink/orphanVisits/GET_ORPHAN_VISITS_START",Xs="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",$s="shlink/orphanVisits/GET_ORPHAN_VISITS",ei="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",ti="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",ri="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",ni="shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",ci={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},ai=bt((rt={},Object(u.a)(rt,Ys,(function(){return Object(d.a)(Object(d.a)({},ci),{},{loading:!0})})),Object(u.a)(rt,Xs,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},ci),{},{error:!0,errorData:r})})),Object(u.a)(rt,$s,(function(e,t){var r=t.visits,n=t.query;return Object(d.a)(Object(d.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(u.a)(rt,ei,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(rt,ti,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(rt,ri,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(rt,ni,(function(e,t){var r=t.fallbackInterval;return Object(d.a)(Object(d.a)({},e),{},{fallbackInterval:r})})),Object(u.a)(rt,Cr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return!e.shortUrl&&Oe(t.date,s,i)})).map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Fe.a)(o),Object(Fe.a)(n))})})),rt),ci),si=function(e,t){return!t||t===e.type},ii=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){var c=Object(m.a)(f.a.mark((function c(a,s){var i,o,l,u,j,b,h;return f.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getOrphanVisits,l=function(){var e=Object(m.a)(f.a.mark((function e(n,c){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(Object(d.a)(Object(d.a)({},t),{},{page:n,itemsPerPage:c})).then((function(e){var t=e.data.filter((function(e){return Ia(e)&&si(e,r)}));return Object(d.a)(Object(d.a)({},e),{},{data:t})})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),u=ws(n,o),j=function(){return s().orphanVisits.cancelLoad},b={query:t},h={start:Ys,large:ei,finish:$s,error:Xs,progress:ri,fallbackToInterval:ni},c.abrupt("return",_s(l,u,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},oi=ht(ti),li="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START",ui="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR",di="shlink/orphanVisits/GET_NON_ORPHAN_VISITS",ji="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE",bi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL",hi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED",Oi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",vi={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},fi=bt((nt={},Object(u.a)(nt,li,(function(){return Object(d.a)(Object(d.a)({},vi),{},{loading:!0})})),Object(u.a)(nt,ui,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},vi),{},{error:!0,errorData:r})})),Object(u.a)(nt,di,(function(e,t){var r=t.visits,n=t.query;return Object(d.a)(Object(d.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(u.a)(nt,ji,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(nt,bi,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(nt,hi,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(nt,Oi,(function(e,t){var r=t.fallbackInterval;return Object(d.a)(Object(d.a)({},e),{},{fallbackInterval:r})})),Object(u.a)(nt,Cr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return Oe(t.date,s,i)})).map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Fe.a)(o),Object(Fe.a)(n))})})),nt),vi),mi=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(){var n=Object(m.a)(f.a.mark((function n(c,a){var s,i,o,l,u,j,b;return f.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getNonOrphanVisits,o=function(){var e=Object(m.a)(f.a.mark((function e(r,n){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(d.a)(Object(d.a)({},t),{},{page:r,itemsPerPage:n})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=ws(r,i),u=function(){return a().orphanVisits.cancelLoad},j={query:t},b={start:li,large:ji,finish:di,error:ui,progress:hi,fallbackToInterval:Oi},n.abrupt("return",_s(o,l,j,b,c,u));case 7:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},gi=ht(bi),xi="shlink/visitsOverview/GET_OVERVIEW_START",pi="shlink/visitsOverview/GET_OVERVIEW_ERROR",Si="shlink/visitsOverview/GET_OVERVIEW",yi={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},Ci=bt((ct={},Object(u.a)(ct,xi,(function(){return Object(d.a)(Object(d.a)({},yi),{},{loading:!0})})),Object(u.a)(ct,pi,(function(){return Object(d.a)(Object(d.a)({},yi),{},{error:!0})})),Object(u.a)(ct,Si,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(d.a)(Object(d.a)({},yi),{},{visitsCount:r,orphanVisitsCount:n})})),Object(u.a)(ct,Cr,(function(e,t){var r=e.visitsCount,n=e.orphanVisitsCount,c=void 0===n?0:n,a=Object(x.a)(e,["visitsCount","orphanVisitsCount"]),s=t.createdVisits,i=Fa(s),o=i.regularVisits,l=i.orphanVisits;return Object(d.a)(Object(d.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),ct),yi),Ni=function(e){return function(){return function(){var t=Object(m.a)(f.a.mark((function t(r,n){var c,a,s;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:xi}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(d.a)({type:Si},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:pi});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},ki=function e(t,r){var n=this;Object(g.a)(this,e),this.window=t,this.csvjson=r,this.exportVisits=function(e,t){if(t.length){var r=n.csvjson.toCSV(t,{headers:"key"});Object(Lc.a)(n.window,r,e)}}},_i=function(e,t){e.serviceFactory("MapModal",(function(){return Hc})),e.serviceFactory("ShortUrlVisits",vs,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",ms,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",xs,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("NonOrphanVisits",Ss,"VisitsExporter"),e.decorator("NonOrphanVisits",t(["nonOrphanVisits","mercureInfo","settings","selectedServer"],["getNonOrphanVisits","cancelGetNonOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",ki,"window","csvjson"),e.serviceFactory("getShortUrlVisits",As,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return Ms})),e.serviceFactory("getTagVisits",Js,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return Zs})),e.serviceFactory("getOrphanVisits",ii,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return oi})),e.serviceFactory("getNonOrphanVisits",mi,"buildShlinkApiClient"),e.serviceFactory("cancelGetNonOrphanVisits",(function(){return gi})),e.serviceFactory("createNewVisits",(function(){return Nr})),e.serviceFactory("loadVisitsOverview",Ni,"buildShlinkApiClient")},wi=r(289),Ui=r.n(wi),Ti=function(e){var t=e.tag,r=e.colorGenerator;return Object(a.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},Ri=function(e){return{id:e,name:e}},Ei=function(e){return function(t){var r,n,c=t.selectedTags,s=t.onChange,i=t.placeholder,o=t.listTags,l=t.tagsList,u=t.settings;Object(B.useEffect)((function(){o()}),[]);var d=null!==(r=null===(n=u.shortUrlCreation)||void 0===n?void 0:n.tagFilteringMode)&&void 0!==r?r:"startsWith";return Object(a.jsx)(Ui.a,{tags:c.map(Ri),tagComponent:function(t){var r=t.tag,n=t.onDelete;return Object(a.jsx)(z,{colorGenerator:e,text:r.name,clearable:!0,className:"react-tags__tag",onClose:n})},suggestions:l.tags.filter((function(e){return!c.includes(e)})).map(Ri),suggestionComponent:function(t){var r=t.item;return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Ti,{tag:"".concat(r.name),colorGenerator:e}),r.name]})},allowNew:!0,addOnBlur:!0,placeholderText:null!==i&&void 0!==i?i:"Add tags to the URL",minQueryLength:1,delimiters:["Enter","Tab",","],suggestionsTransform:"includes"===d?function(e,t){return t.filter((function(t){return t.name.includes(e)}))}:void 0,onDelete:function(e){var t=Object(Fe.a)(c);t.splice(e,1),s(t)},onAddition:function(e){var t=e.name;return s(Object(Fe.a)(new Set([].concat(Object(Fe.a)(c),Object(Fe.a)(t.toLowerCase().split(","))))))}})}},Di=r(549),Li=function(e,t,r){return function(n){var c=n.tag,s=n.selectedServer,i=n.displayed,l=n.toggle,u=Object(Y.f)(),d=Object(N.a)(u,2),j=d[0],b=d[1],h=Object(Y.f)(),v=Object(N.a)(h,2),f=v[0],m=v[1],g=Object(Y.f)(),x=Object(N.a)(g,3),p=x[0],S=x[2],y=Object(B.useRef)(),C=Object(O.a)(s);return Object(B.useEffect)((function(){var e;(e=y.current)&&e.scrollWidth>e.clientWidth&&S()}),[y.current]),Object(a.jsxs)(Ae.a,{className:"tag-card",children:[Object(a.jsxs)(Sc.a,{className:"tag-card__header",children:[Object(a.jsx)(tn.a,{color:"link",size:"sm",className:"tag-card__btn tag-card__btn--last",onClick:b,children:Object(a.jsx)(M.a,{icon:A.R})}),Object(a.jsx)(tn.a,{color:"link",size:"sm",className:"tag-card__btn",onClick:m,children:Object(a.jsx)(M.a,{icon:A.D})}),Object(a.jsxs)("h5",{className:"tag-card__tag-title text-ellipsis",title:p?c.tag:void 0,ref:function(e){y.current=null!==e&&void 0!==e?e:void 0},children:[Object(a.jsx)(Ti,{tag:c.tag,colorGenerator:r}),Object(a.jsx)("span",{className:"tag-card__tag-name",onClick:l,children:c.tag})]})]}),Object(a.jsx)(Di.a,{isOpen:i,children:Object(a.jsxs)(yc.a,{className:"tag-card__body",children:[Object(a.jsxs)(o.b,{to:"/server/".concat(C,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center mb-1",children:[Object(a.jsxs)("span",{className:"text-ellipsis",children:[Object(a.jsx)(M.a,{icon:A.w,className:"mr-2"}),"Short URLs"]}),Object(a.jsx)("b",{children:Lt(c.shortUrls)})]}),Object(a.jsxs)(o.b,{to:"/server/".concat(C,"/tag/").concat(c.tag,"/visits"),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center",children:[Object(a.jsxs)("span",{className:"text-ellipsis",children:[Object(a.jsx)(M.a,{icon:A.q,className:"mr-2"}),"Visits"]}),Object(a.jsx)("b",{children:Lt(c.visits)})]})]})}),Object(a.jsx)(e,{tag:c.tag,toggle:b,isOpen:j}),Object(a.jsx)(t,{tag:c.tag,toggle:m,isOpen:f})]})}},Vi=function(e){var t=e.tag,r=e.toggle,n=e.isOpen,c=e.deleteTag,s=e.tagDelete,i=e.tagDeleted,o=s.deleting,l=s.error,u=s.errorData,d=function(){var e=Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(t);case 2:i(t),r();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(a.jsxs)(ar.a,{toggle:r,isOpen:n,centered:!0,children:[Object(a.jsx)(sr.a,{toggle:r,children:Object(a.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(a.jsxs)(ir.a,{children:["Are you sure you want to delete tag ",Object(a.jsx)("b",{children:t}),"?",l&&Object(a.jsx)(br,{type:"error",small:!0,className:"mt-2",children:Object(a.jsx)(vr,{errorData:u,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(a.jsx)("button",{className:"btn btn-danger",disabled:o,onClick:d,children:o?"Deleting tag...":"Delete tag"})]})]})},Ii=r(601),Fi=r(302),Ai=function(e){var t=e.getColorForKey;return function(e){var r=e.tag,n=e.editTag,c=e.toggle,s=e.tagEdited,i=e.isOpen,o=e.tagEdit,l=Object(B.useState)(r),u=Object(N.a)(l,2),d=u[0],j=u[1],b=Object(B.useState)(t(r)),h=Object(N.a)(b,2),O=h[0],v=h[1],g=Object(Y.f)(),x=Object(N.a)(g,4),p=x[0],S=x[1],y=x[3],C=o.editing,k=o.error,_=o.errorData,w=Object(ur.b)(Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n(r,d,O).then((function(){return s(r,d,O)})).then(c).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));return Object(a.jsx)(ar.a,{isOpen:i,toggle:c,centered:!0,onClosed:y,children:Object(a.jsxs)("form",{onSubmit:w,children:[Object(a.jsx)(sr.a,{toggle:c,children:"Edit tag"}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)("div",{className:"input-group",children:[Object(a.jsx)("div",{className:"input-group-prepend",id:"colorPickerBtn",onClick:S,children:Object(a.jsx)("div",{className:"input-group-text edit-tag-modal__color-picker-toggle",style:{backgroundColor:O,borderColor:O},children:Object(a.jsx)(M.a,{icon:A.B,className:"edit-tag-modal__color-icon"})})}),Object(a.jsx)(Ii.a,{isOpen:p,toggle:S,target:"colorPickerBtn",placement:"right",children:Object(a.jsx)(Fi.a,{color:O,disableAlpha:!0,onChange:function(e){var t=e.hex;return v(t)}})}),Object(a.jsx)(an.a,{value:d,placeholder:"Tag",required:!0,onChange:function(e){var t=e.target;return j(t.value)}})]}),k&&Object(a.jsx)(br,{type:"error",small:!0,className:"mt-2",children:Object(a.jsx)(vr,{errorData:_,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)(tn.a,{type:"button",color:"link",onClick:c,children:"Cancel"}),Object(a.jsx)(tn.a,{color:"primary",disabled:C,children:C?"Saving...":"Save"})]})]})})}},Mi={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},Gi=function(e){var t,r=e.mode,n=e.onChange,c=e.renderTitle;return Object(a.jsxs)(X,{text:null!==(t=null===c||void 0===c?void 0:c(r))&&void 0!==t?t:"Display mode: ".concat(r),children:[Object(a.jsxs)(K.a,{active:"cards"===r,onClick:function(){return n("cards")},children:[Object(a.jsx)(M.a,{icon:A.P,fixedWidth:!0,className:"mr-1"})," Cards"]}),Object(a.jsxs)(K.a,{active:"list"===r,onClick:function(){return n("list")},children:[Object(a.jsx)(M.a,{icon:A.c,fixedWidth:!0,className:"mr-1"})," List"]})]})},Pi=function(e,t){return He((function(r){var n,c,s,i,o=r.filterTags,l=r.forceListTags,u=r.tagsList,d=r.selectedServer,j=r.settings,b=Object(B.useState)(null!==(n=null===(c=j.tags)||void 0===c?void 0:c.defaultMode)&&void 0!==n?n:"cards"),h=Object(N.a)(b,2),O=h[0],v=h[1],f=Object(B.useState)(null!==(s=null===(i=j.tags)||void 0===i?void 0:i.defaultOrdering)&&void 0!==s?s:{}),m=Object(N.a)(f,2),g=m[0],x=m[1],p=Object(G.a)((function(){return u.filteredTags.map((function(e){var t,r,n,c;return{tag:e,shortUrls:null!==(t=null===(r=u.stats[e])||void 0===r?void 0:r.shortUrlsCount)&&void 0!==t?t:0,visits:null!==(n=null===(c=u.stats[e])||void 0===c?void 0:c.visitsCount)&&void 0!==n?n:0}}))}),(function(e){return _(e,g)}));if(Object(B.useEffect)((function(){l()}),[]),u.loading)return Object(a.jsx)(xn.a,{loading:!0});if(u.error)return Object(a.jsx)(br,{type:"error",children:Object(a.jsx)(vr,{errorData:u.errorData,fallbackMessage:"Error loading tags :("})});var S=function(e){return function(){var t=k(e,g.field,g.dir);x({field:t?e:void 0,dir:t})}};return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(q,{className:"mb-3",onChange:o}),Object(a.jsxs)(dr.a,{className:"mb-3",children:[Object(a.jsx)("div",{className:"col-lg-6",children:Object(a.jsx)(Gi,{mode:O,onChange:v})}),Object(a.jsx)("div",{className:"col-lg-6 mt-3 mt-lg-0",children:Object(a.jsx)(Pe,{items:Mi,order:g,onChange:function(e,t){return x({field:e,dir:t})}})})]}),function(){if(u.filteredTags.length<1)return Object(a.jsx)(xn.a,{children:"No tags found"});var r=p();return"cards"===O?Object(a.jsx)(e,{sortedTags:r,selectedServer:d}):Object(a.jsx)(t,{sortedTags:r,selectedServer:d,currentOrder:g,orderByColumn:S})}()]})}),(function(){return[We.visits]}))},Bi="shlink/deleteTag/DELETE_TAG_START",Hi="shlink/deleteTag/DELETE_TAG_ERROR",Wi="shlink/deleteTag/DELETE_TAG",qi="shlink/deleteTag/TAG_DELETED",zi=bt((at={},Object(u.a)(at,Bi,(function(){return{deleting:!0,error:!1}})),Object(u.a)(at,Hi,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(u.a)(at,Wi,(function(){return{deleting:!1,error:!1}})),at),{deleting:!1,error:!1}),Ki=function(e){return function(t){return function(){var r=Object(m.a)(f.a.mark((function r(n,c){var a,s;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Bi}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:Wi}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:Hi,errorData:hr(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},Qi=function(e){return{type:qi,tag:e}},Ji="shlink/editTag/EDIT_TAG_START",Zi="shlink/editTag/EDIT_TAG_ERROR",Yi="shlink/editTag/EDIT_TAG",Xi="shlink/editTag/TAG_EDITED",$i=bt((st={},Object(u.a)(st,Ji,(function(e){return Object(d.a)(Object(d.a)({},e),{},{editing:!0,error:!1})})),Object(u.a)(st,Zi,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(u.a)(st,Yi,(function(e,t){return Object(d.a)(Object(d.a)({},Object(b.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),st),{oldName:"",newName:"",editing:!1,error:!1}),eo=function(e,t){return function(r,n,c){return function(){var a=Object(m.a)(f.a.mark((function a(s,i){var o,l;return f.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s({type:Ji}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:Yi,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:Zi,errorData:hr(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},to=function(e,t,r){return{type:Xi,oldName:e,newName:t,color:r}},ro="shlink/tagsList/LIST_TAGS_START",no="shlink/tagsList/LIST_TAGS_ERROR",co="shlink/tagsList/LIST_TAGS",ao="shlink/tagsList/FILTER_TAGS",so={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},io=function(e,t){return function(r){return r===e?t:r}},oo=function(e,t){return Object(p.a)((function(e){return e===t}),e)},lo=function(e){return Object.entries(e.reduce((function(e,t){var r=t.shortUrl;return null===r||void 0===r||r.tags.forEach((function(t){e[t]=(e[t]||0)+1})),e}),{}))},uo=bt((it={},Object(u.a)(it,ro,(function(){return Object(d.a)(Object(d.a)({},so),{},{loading:!0})})),Object(u.a)(it,no,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},so),{},{error:!0,errorData:r})})),Object(u.a)(it,co,(function(e,t){var r=t.tags,n=t.stats;return Object(d.a)(Object(d.a)({},so),{},{stats:n,tags:r,filteredTags:r})})),Object(u.a)(it,qi,(function(e,t){var r=t.tag;return Object(d.a)(Object(d.a)({},e),{},{tags:oo(e.tags,r),filteredTags:oo(e.filteredTags,r)})})),Object(u.a)(it,Xi,(function(e,t){var r=t.oldName,n=t.newName;return Object(d.a)(Object(d.a)({},e),{},{tags:e.tags.map(io(r,n)).sort(),filteredTags:e.filteredTags.map(io(r,n)).sort()})})),Object(u.a)(it,ao,(function(e,t){var r=t.searchTerm;return Object(d.a)(Object(d.a)({},e),{},{filteredTags:e.tags.filter((function(e){return e.toLowerCase().match(r)}))})})),Object(u.a)(it,Cr,(function(e,t){var r,n,c=t.createdVisits;return Object(d.a)(Object(d.a)({},e),{},{stats:(r=lo(c),n=e.stats,r.reduce((function(e,t){var r=Object(N.a)(t,2),n=r[0],c=r[1];if(!e[n])return e;var a=e[n];return a.visitsCount=a.visitsCount+c,e[n]=a,e}),Object(d.a)({},n)))})})),Object(u.a)(it,Ir,(function(e,t){var r=e.tags,n=Object(x.a)(e,["tags"]),c=t.result;return Object(d.a)(Object(d.a)({},n),{},{tags:r.concat(c.tags.filter((function(e){return!r.includes(e)})))})})),it),so),jo=function(e){return{type:ao,searchTerm:e}},bo=Math.ceil,ho=function(e){return function(t){var r=t.sortedTags,n=t.selectedServer,c=Object(B.useState)(),s=Object(N.a)(c,2),i=s[0],o=s[1],l=r.length,u=Object(Ua.a)(bo(l/4),r);return Object(a.jsx)(dr.a,{children:u.map((function(t,r){return Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:t.map((function(t){return Object(a.jsx)(e,{tag:t,selectedServer:n,displayed:i===t.tag,toggle:function(){return o(i!==t.tag?t.tag:void 0)}},t.tag)}))},r)}))})}},Oo=function(e){return function(t){var r,n=t.sortedTags,c=t.selectedServer,s=t.orderByColumn,i=t.currentOrder,o=Object(B.useRef)(!0),l=Object(De.f)().search,u=Object(C.a)(l).page,d=void 0===u?1:u,j=Object(Y.c)("page",Number(d)),b=Object(N.a)(j,2),h=b[0],O=b[1],v=Object(Ua.a)(20,n),f=v.length>1,m=null!==(r=v[h-1])&&void 0!==r?r:[];return Object(B.useEffect)((function(){!o.current&&O(1),o.current=!1}),[n]),Object(B.useEffect)((function(){scrollTo(0,0)}),[h]),Object(a.jsxs)(jr.a,{bodyClassName:f?"pb-1":"",children:[Object(a.jsxs)("table",{className:"table table-hover mb-0",children:[Object(a.jsxs)("thead",{className:"responsive-table__header",children:[Object(a.jsxs)("tr",{children:[Object(a.jsxs)("th",{className:"tags-table__header-cell",onClick:s("tag"),children:["Tag ",Object(a.jsx)(qe,{currentOrder:i,field:"tag"})]}),Object(a.jsxs)("th",{className:"tags-table__header-cell text-lg-right",onClick:s("shortUrls"),children:["Short URLs ",Object(a.jsx)(qe,{currentOrder:i,field:"shortUrls"})]}),Object(a.jsxs)("th",{className:"tags-table__header-cell text-lg-right",onClick:s("visits"),children:["Visits ",Object(a.jsx)(qe,{currentOrder:i,field:"visits"})]}),Object(a.jsx)("th",{className:"tags-table__header-cell"})]}),Object(a.jsx)("tr",{children:Object(a.jsx)("th",{colSpan:4,className:"p-0 border-top-0"})})]}),Object(a.jsxs)("tbody",{children:[0===m.length&&Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:4,className:"text-center",children:"No results found"})}),m.map((function(t){return Object(a.jsx)(e,{tag:t,selectedServer:c},t.tag)}))]})]}),f&&Object(a.jsx)("div",{className:"sticky-card-paginator",children:Object(a.jsx)(Ta,{pagesCount:v.length,currentPage:h,setCurrentPage:O})})]},h)}},vo=function(e,t,r){return function(n){var c=n.tag,s=n.selectedServer,i=Object(Y.f)(),l=Object(N.a)(i,2),u=l[0],d=l[1],j=Object(Y.f)(),b=Object(N.a)(j,2),h=b[0],v=b[1],f=Object(Y.f)(),m=Object(N.a)(f,2),g=m[0],x=m[1],p=Object(O.a)(s);return Object(a.jsxs)("tr",{className:"responsive-table__row",children:[Object(a.jsxs)("th",{className:"responsive-table__cell","data-th":"Tag",children:[Object(a.jsx)(Ti,{tag:c.tag,colorGenerator:r})," ",c.tag]}),Object(a.jsx)("td",{className:"responsive-table__cell text-lg-right","data-th":"Short URLs",children:Object(a.jsx)(o.b,{to:"/server/".concat(p,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),children:Lt(c.shortUrls)})}),Object(a.jsx)("td",{className:"responsive-table__cell text-lg-right","data-th":"Visits",children:Object(a.jsx)(o.b,{to:"/server/".concat(p,"/tag/").concat(c.tag,"/visits"),children:Lt(c.visits)})}),Object(a.jsx)("td",{className:"responsive-table__cell text-lg-right",children:Object(a.jsxs)(rr,{toggle:x,isOpen:g,children:[Object(a.jsxs)(K.a,{onClick:v,children:[Object(a.jsx)(M.a,{icon:A.D,fixedWidth:!0,className:"mr-1"})," Edit"]}),Object(a.jsxs)(K.a,{onClick:d,children:[Object(a.jsx)(M.a,{icon:A.R,fixedWidth:!0,className:"mr-1"})," Delete"]})]})}),Object(a.jsx)(t,{tag:c.tag,toggle:v,isOpen:h}),Object(a.jsx)(e,{tag:c.tag,toggle:d,isOpen:u})]})}},fo=function(e,t){e.serviceFactory("TagsSelector",Ei,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",Li,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return Vi})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",Ai,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsCards",ho,"TagCard"),e.serviceFactory("TagsTableRow",vo,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("TagsTable",Oo,"TagsTableRow"),e.serviceFactory("TagsList",Pi,"TagsCards","TagsTable"),e.decorator("TagsList",t(["tagsList","selectedServer","mercureInfo","settings"],["forceListTags","filterTags","createNewVisits","loadMercureInfo"]));var r=function(e){return function(t){return function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function(){return function(){var r=Object(m.a)(f.a.mark((function r(n,c){var a,s,i,o,l,u,d,j;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.tagsList,t||!s.loading&&Object(y.a)(s.tags)){r.next=3;break}return r.abrupt("return");case 3:return n({type:ro}),r.prev=4,i=e(c),o=i.listTags,r.next=8,o();case 8:l=r.sent,u=l.tags,d=l.stats,j=(void 0===d?[]:d).reduce((function(e,t){var r=t.tag,n=t.shortUrlsCount,c=t.visitsCount;return e[r]={shortUrlsCount:n,visitsCount:c},e}),{}),n({tags:u,stats:j,type:co}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:no,errorData:hr(r.t0)});case 19:case"end":return r.stop()}}),r,null,[[4,16]])})));return function(e,t){return r.apply(this,arguments)}}()}}(t.buildShlinkApiClient,e)}};e.factory("listTags",r(!1)),e.factory("forceListTags",r(!0)),e.serviceFactory("filterTags",(function(){return jo})),e.serviceFactory("tagDeleted",(function(){return Qi})),e.serviceFactory("tagEdited",(function(){return to})),e.serviceFactory("deleteTag",Ki,"buildShlinkApiClient"),e.serviceFactory("editTag",eo,"buildShlinkApiClient","ColorGenerator")},mo=r(294),go="shlink/mercure/GET_MERCURE_INFO_START",xo="shlink/mercure/GET_MERCURE_INFO_ERROR",po="shlink/mercure/GET_MERCURE_INFO",So=bt((ot={},Object(u.a)(ot,go,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(ot,xo,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!1,error:!0})})),Object(u.a)(ot,po,(function(e,t){return Object(d.a)(Object(d.a)({},t),{},{loading:!1,error:!1})})),ot),{loading:!0,error:!1}),yo=function(e){return function(){return function(){var t=Object(m.a)(f.a.mark((function t(r,n){var c,a,s,i,o;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r({type:go}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:xo}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(d.a)({type:po,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:xo});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},Co=function(e){e.serviceFactory("loadMercureInfo",yo,"buildShlinkApiClient")},No=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(a.jsxs)(jr.a,{title:"Real-time updates",className:"h-100",children:[Object(a.jsx)(en.a,{children:Object(a.jsxs)(ha,{checked:r.enabled,onChange:n,children:["Enable or disable real-time updates.",Object(a.jsxs)("small",{className:"form-text text-muted",children:["Real-time updates are currently being ",Object(a.jsx)("b",{children:r.enabled?"processed":"ignored"}),"."]})]})}),Object(a.jsxs)(en.a,{className:"mb-0",children:[Object(a.jsx)("label",{className:W()({"text-muted":!r.enabled}),children:"Real-time updates frequency (in minutes):"}),Object(a.jsx)(an.a,{type:"number",min:0,placeholder:"Immediate",disabled:!r.enabled,value:(t=r.interval,t?"".concat(t):""),onChange:function(e){var t=e.target;return c(Number(t.value))}}),r.enabled&&Object(a.jsxs)("small",{className:"form-text text-muted",children:[void 0!==r.interval&&r.interval>0&&Object(a.jsxs)("span",{children:["Updates will be reflected in the UI every ",Object(a.jsx)("b",{children:r.interval})," minute",r.interval>1&&"s","."]}),!r.interval&&"Updates will be reflected in the UI as soon as they happen."]})]})]})},ko=function(e){var t=e.items;return Object(a.jsx)(a.Fragment,{children:t.map((function(e,t){return Object(a.jsx)(dr.a,{children:e.map((function(t,r){return Object(a.jsx)("div",{className:"col-lg-".concat(12/e.length," mb-3"),children:t},r)}))},t)}))})},_o=function(e,t,r,n,c,s){return function(){return Object(a.jsx)(Rn.a,{children:Object(a.jsx)(ko,{items:[[Object(a.jsx)(n,{}),Object(a.jsx)(c,{})],[Object(a.jsx)(t,{}),Object(a.jsx)(r,{})],[Object(a.jsx)(s,{}),Object(a.jsx)(e,{})]]})})}},wo=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},Uo=function(e){var t,r,n,c,s,i=e.settings,o=e.setShortUrlCreationSettings,l=null!==(t=i.shortUrlCreation)&&void 0!==t?t:{validateUrls:!1},u=function(e){return function(){return o(Object(d.a)(Object(d.a)({},null!==l&&void 0!==l?l:{validateUrls:!1}),{},{tagFilteringMode:e}))}};return Object(a.jsxs)(jr.a,{title:"Short URLs form",className:"h-100",children:[Object(a.jsx)(en.a,{children:Object(a.jsxs)(ha,{checked:null!==(r=l.validateUrls)&&void 0!==r&&r,onChange:function(e){return o(Object(d.a)(Object(d.a)({},l),{},{validateUrls:e}))},children:["Request validation on long URLs when creating new short URLs.",Object(a.jsxs)("small",{className:"form-text text-muted",children:["The initial state of the ",Object(a.jsx)("b",{children:"Validate URL"})," checkbox will be ",Object(a.jsx)("b",{children:l.validateUrls?"checked":"unchecked"}),"."]})]})}),Object(a.jsx)(en.a,{children:Object(a.jsxs)(ha,{checked:null===(n=l.forwardQuery)||void 0===n||n,onChange:function(e){return o(Object(d.a)(Object(d.a)({},l),{},{forwardQuery:e}))},children:["Make all new short URLs forward their query params to the long URL.",Object(a.jsxs)("small",{className:"form-text text-muted",children:["The initial state of the ",Object(a.jsx)("b",{children:"Forward query params on redirect"})," checkbox will be ",Object(a.jsx)("b",{children:null===(c=l.forwardQuery)||void 0===c||c?"checked":"unchecked"}),"."]})]})}),Object(a.jsxs)(en.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Tag suggestions search mode:"}),Object(a.jsxs)(X,{text:wo(l.tagFilteringMode),children:[Object(a.jsx)(K.a,{active:!l.tagFilteringMode||"startsWith"===l.tagFilteringMode,onClick:u("startsWith"),children:wo("startsWith")}),Object(a.jsx)(K.a,{active:"includes"===l.tagFilteringMode,onClick:u("includes"),children:wo("includes")})]}),Object(a.jsx)("small",{className:"form-text text-muted",children:(s=l.tagFilteringMode,"includes"===s?Object(a.jsxs)(a.Fragment,{children:["The list of suggested tags will contain those ",Object(a.jsx)("b",{children:"including"})," provided input."]}):Object(a.jsxs)(a.Fragment,{children:["The list of suggested tags will contain those ",Object(a.jsx)("b",{children:"starting with"})," provided input."]}))})]})]})},To=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(a.jsx)(jr.a,{title:"User interface",className:"h-100",children:Object(a.jsxs)(en.a,{children:[Object(a.jsx)(M.a,{icon:"dark"===(null===t||void 0===t?void 0:t.theme)?A.A:A.M,className:"user-interface__theme-icon"}),Object(a.jsx)(ha,{checked:"dark"===(null===t||void 0===t?void 0:t.theme),onChange:function(e){var n=e?"dark":"light";r(Object(d.a)(Object(d.a)({},t),{},{theme:n})),Object(ma.g)(n)},children:"Use dark theme."})]})})},Ro=function(e){var t,r=e.onChange,n=e.active,c=e.allText;return Object(a.jsx)(X,{text:null!==(t=pe(n))&&void 0!==t?t:c,children:Object(a.jsx)(Re,{allText:c,active:n,onChange:r})})},Eo=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(a.jsx)(jr.a,{title:"Visits",className:"h-100",children:Object(a.jsxs)(en.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Default interval to load on visits sections:"}),Object(a.jsx)(Ro,{allText:"All visits",active:null!==(t=null===(r=n.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days",onChange:function(e){return c({defaultInterval:e})}})]})})},Do=function(e){var t,r,n,c=e.settings.tags,s=e.setTagsSettings;return Object(a.jsxs)(jr.a,{title:"Tags",className:"h-100",children:[Object(a.jsxs)(en.a,{children:[Object(a.jsx)("label",{children:"Default display mode when managing tags:"}),Object(a.jsx)(Gi,{mode:null!==(t=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==t?t:"cards",renderTitle:function(e){return Object(ur.a)(e)},onChange:function(e){return s(Object(d.a)(Object(d.a)({},c),{},{defaultMode:e}))}}),Object(a.jsxs)("small",{className:"form-text text-muted",children:["Tags will be displayed as ",Object(a.jsx)("b",{children:null!==(r=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==r?r:"cards"}),"."]})]}),Object(a.jsxs)(en.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Default ordering for tags list:"}),Object(a.jsx)(Pe,{items:Mi,order:null!==(n=null===c||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:{},onChange:function(e,t){return s(Object(d.a)(Object(d.a)({},c),{},{defaultOrdering:{field:e,dir:t}}))}})]})]})},Lo=function(e){var t,r=e.settings.shortUrlsList,n=e.setShortUrlsListSettings;return Object(a.jsx)(jr.a,{title:"Short URLs list",className:"h-100",children:Object(a.jsxs)(en.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Default ordering for short URLs list:"}),Object(a.jsx)(Pe,{items:Pt,order:null!==(t=null===r||void 0===r?void 0:r.defaultOrdering)&&void 0!==t?t:vt,onChange:function(e,t){return n({defaultOrdering:{field:e,dir:t}})}})]})})},Vo=function(e,t){e.serviceFactory("Settings",_o,"RealTimeUpdatesSettings","ShortUrlCreationSettings","ShortUrlsListSettings","UserInterfaceSettings","VisitsSettings","TagsSettings"),e.decorator("Settings",pc.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdatesSettings",(function(){return No})),e.decorator("RealTimeUpdatesSettings",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreationSettings",(function(){return Uo})),e.decorator("ShortUrlCreationSettings",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterfaceSettings",(function(){return To})),e.decorator("UserInterfaceSettings",t(["settings"],["setUiSettings"])),e.serviceFactory("VisitsSettings",(function(){return Eo})),e.decorator("VisitsSettings",t(["settings"],["setVisitsSettings"])),e.serviceFactory("TagsSettings",(function(){return Do})),e.decorator("TagsSettings",t(["settings"],["setTagsSettings"])),e.serviceFactory("ShortUrlsListSettings",(function(){return Lo})),e.decorator("ShortUrlsListSettings",t(["settings"],["setShortUrlsListSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return gt})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return xt})),e.serviceFactory("setShortUrlCreationSettings",(function(){return pt})),e.serviceFactory("setShortUrlsListSettings",(function(){return St})),e.serviceFactory("setUiSettings",(function(){return yt})),e.serviceFactory("setVisitsSettings",(function(){return Ct})),e.serviceFactory("setTagsSettings",(function(){return Nt}))},Io=r(297),Fo=function(e,t){var r=e.split("://"),n=Object(N.a)(r,2),c=n[0],a=n[1].split("/"),s=Object(Io.a)(a).slice(1),i=s.length?"/".concat(s.join("/")):"";return"".concat(c,"://").concat(t).concat(i)},Ao="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",Mo=function(e){return function(t,r){return function(){var n=Object(m.a)(f.a.mark((function n(c,a){var s,i,o;return f.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_START"}),s=e(a),i=s.editDomainRedirects,n.prev=2,n.next=5,i(Object(d.a)({domain:t},r));case 5:o=n.sent,c({type:Ao,domain:t,redirects:o}),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_ERROR",errorData:hr(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},Go="shlink/domainsList/LIST_DOMAINS_START",Po="shlink/domainsList/LIST_DOMAINS_ERROR",Bo="shlink/domainsList/LIST_DOMAINS",Ho="shlink/domainsList/FILTER_DOMAINS",Wo="shlink/domainsList/VALIDATE_DOMAIN",qo={domains:[],filteredDomains:[],loading:!1,error:!1},zo=function(e,t){return function(r){return r.domain!==e?r:Object(d.a)(Object(d.a)({},r),{},{redirects:t})}},Ko=function(e,t){return function(r){return r.domain!==e?r:Object(d.a)(Object(d.a)({},r),{},{status:t})}},Qo=bt((lt={},Object(u.a)(lt,Go,(function(){return Object(d.a)(Object(d.a)({},qo),{},{loading:!0})})),Object(u.a)(lt,Po,(function(e){var t=e.errorData;return Object(d.a)(Object(d.a)({},qo),{},{error:!0,errorData:t})})),Object(u.a)(lt,Bo,(function(e,t){var r=t.domains,n=t.defaultRedirects;return Object(d.a)(Object(d.a)({},qo),{},{domains:r,filteredDomains:r,defaultRedirects:n})})),Object(u.a)(lt,Ho,(function(e,t){var r=t.searchTerm;return Object(d.a)(Object(d.a)({},e),{},{filteredDomains:e.domains.filter((function(e){return e.domain.toLowerCase().match(r)}))})})),Object(u.a)(lt,Ao,(function(e,t){var r=t.domain,n=t.redirects;return Object(d.a)(Object(d.a)({},e),{},{domains:e.domains.map(zo(r,n)),filteredDomains:e.filteredDomains.map(zo(r,n))})})),Object(u.a)(lt,Wo,(function(e,t){var r=t.domain,n=t.status;return Object(d.a)(Object(d.a)({},e),{},{domains:e.domains.map(Ko(r,n)),filteredDomains:e.filteredDomains.map(Ko(r,n))})})),lt),qo),Jo=function(e){return function(){return function(){var t=Object(m.a)(f.a.mark((function t(r,n){var c,a,s,i,o;return f.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:Go}),c=e(n),a=c.listDomains,t.prev=2,t.next=5,a().then((function(e){var t=e.data,r=e.defaultRedirects;return{domains:t.map((function(e){return Object(d.a)(Object(d.a)({},e),{},{status:"validating"})})),defaultRedirects:r}}));case 5:s=t.sent,i=s.domains,o=s.defaultRedirects,r({type:Bo,domains:i,defaultRedirects:o}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(2),r({type:Po,errorData:hr(t.t0)});case 14:case"end":return t.stop()}}),t,null,[[2,11]])})));return function(e,r){return t.apply(this,arguments)}}()}},Zo=function(e){return{type:Ho,searchTerm:e}},Yo=function(e){return function(t){return function(){var r=Object(m.a)(f.a.mark((function r(n,c){var a,s,i,o,l,u,j,b;return f.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.selectedServer,Object(O.b)(s)){r.next=4;break}return n({type:Wo,domain:t,status:"invalid"}),r.abrupt("return");case 4:return r.prev=4,i=s.url,o=Object(x.a)(s,["url"]),l=e(Object(d.a)(Object(d.a)({},o),{},{url:Fo(i,t)})),u=l.health,r.next=9,u();case 9:j=r.sent,b=j.status,n({type:Wo,domain:t,status:"pass"===b?"valid":"invalid"}),r.next=17;break;case 14:r.prev=14,r.t0=r.catch(4),n({type:Wo,domain:t,status:"invalid"});case 17:case"end":return r.stop()}}),r,null,[[4,14]])})));return function(e,t){return r.apply(this,arguments)}}()}},Xo=r(603),$o=r(614),el=function(e){var t=e.listDomains,r=e.value,n=e.domainsList,c=e.onChange,s=Object(Y.f)(),i=Object(N.a)(s,4),o=i[0],l=i[2],u=i[3],d=n.domains,j=Object(y.a)(r),b=function(){return c("")};return Object(B.useEffect)((function(){t()}),[]),o?Object(a.jsxs)(Xo.a,{children:[Object(a.jsx)(an.a,{value:r,placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(a.jsxs)($o.a,{addonType:"append",children:[Object(a.jsx)(tn.a,{id:"backToDropdown",outline:!0,type:"button",className:"domains-dropdown__back-btn",onClick:Object(G.a)(b,u),children:Object(a.jsx)(M.a,{icon:A.S})}),Object(a.jsx)(Zt.a,{target:"backToDropdown",placement:"left",trigger:"hover",children:"Existing domains"})]})]}):Object(a.jsxs)(X,{text:j?"Domain":"Domain: ".concat(r),className:j?"domains-dropdown__toggle-btn":"domains-dropdown__toggle-btn--active",children:[d.map((function(e){var t=e.domain,n=e.isDefault;return Object(a.jsxs)(K.a,{active:r===t||n&&j,onClick:function(){return c(t)},children:[t,n&&Object(a.jsx)("span",{className:"float-right text-muted",children:"default"})]},t)})),Object(a.jsx)(K.a,{divider:!0}),Object(a.jsx)(K.a,{onClick:Object(G.a)(b,l),children:Object(a.jsx)("i",{children:"New domain"})})]})},tl=function(e){var t=e.isLast,r=Object(x.a)(e,["isLast"]);return Object(a.jsx)(En,Object(d.a)(Object(d.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},rl=function(e){var t,r,n,c,s,i,o=e.isOpen,l=e.toggle,u=e.domain,d=e.editDomainRedirects,j=Object(B.useState)(null!==(t=null===(r=u.redirects)||void 0===r?void 0:r.baseUrlRedirect)&&void 0!==t?t:""),b=Object(N.a)(j,2),h=b[0],O=b[1],v=Object(B.useState)(null!==(n=null===(c=u.redirects)||void 0===c?void 0:c.regular404Redirect)&&void 0!==n?n:""),g=Object(N.a)(v,2),x=g[0],p=g[1],S=Object(B.useState)(null!==(s=null===(i=u.redirects)||void 0===i?void 0:i.invalidShortUrlRedirect)&&void 0!==s?s:""),y=Object(N.a)(S,2),C=y[0],k=y[1],_=Object(ur.b)(Object(m.a)(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",d(u.domain,{baseUrlRedirect:Object(ur.d)(h),regular404Redirect:Object(ur.d)(x),invalidShortUrlRedirect:Object(ur.d)(C)}).then(l));case 1:case"end":return e.stop()}}),e)}))));return Object(a.jsx)(ar.a,{isOpen:o,toggle:l,centered:!0,children:Object(a.jsxs)("form",{onSubmit:_,children:[Object(a.jsxs)(sr.a,{toggle:l,children:["Edit redirects for ",Object(a.jsx)("b",{children:u.domain})]}),Object(a.jsxs)(ir.a,{children:[Object(a.jsxs)(tl,{value:h,onChange:O,children:[Object(a.jsxs)(hn,{className:"mr-2",placement:"bottom",children:["Visitors accessing the base url, as in ",Object(a.jsxs)("b",{children:["https://",u.domain,"/"]}),", will be redirected to this URL."]}),"Base URL"]}),Object(a.jsxs)(tl,{value:x,onChange:p,children:[Object(a.jsxs)(hn,{className:"mr-2",placement:"bottom",children:["Visitors accessing a url not matching a short URL pattern, as in ",Object(a.jsxs)("b",{children:["https://",u.domain,"/???/[...]"]}),", will be redirected to this URL."]}),"Regular 404"]}),Object(a.jsxs)(tl,{value:C,isLast:!0,onChange:k,children:[Object(a.jsx)(hn,{className:"mr-2",placement:"bottom",children:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL."}),"Invalid short URL"]})]}),Object(a.jsxs)(or.a,{children:[Object(a.jsx)(tn.a,{color:"link",type:"button",onClick:l,children:"Cancel"}),Object(a.jsx)(tn.a,{color:"primary",children:"Save"})]})]})})},nl=function(e){var t=e.status,r=e.matchMedia,n=void 0===r?window.matchMedia:r,c=Object(B.useRef)(),s=function(){return n("(max-width: 991px)").matches},i=Object(B.useState)(s()),o=Object(N.a)(i,2),l=o[0],u=o[1];return Object(B.useEffect)((function(){var e=function(){return u(s())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),"validating"===t?Object(a.jsx)(M.a,{fixedWidth:!0,icon:A.k,spin:!0}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("span",{ref:function(e){c.current=e},children:"valid"===t?Object(a.jsx)(M.a,{fixedWidth:!0,icon:A.h,className:"text-muted"}):Object(a.jsx)(M.a,{fixedWidth:!0,icon:A.Q,className:"text-danger"})}),Object(a.jsx)(Zt.a,{target:function(){return c.current},placement:l?"top-start":"left",autohide:"valid"===t,children:"valid"===t?"Congratulations! This domain is properly configured.":Object(a.jsxs)("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",Object(a.jsx)("br",{}),"Check the ",Object(a.jsx)(Ht.a,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},cl=function(e){var t=e.fallback;return Object(a.jsxs)("span",{className:"text-muted",children:[!t&&Object(a.jsx)("small",{children:"No redirect"}),t&&Object(a.jsxs)(a.Fragment,{children:[t," ",Object(a.jsx)("small",{children:"(as fallback)"})]})]})},al=function(){return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(M.a,{fixedWidth:!0,icon:A.m,className:"text-primary",id:"defaultDomainIcon"}),Object(a.jsx)(Zt.a,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},sl=function(e){var t,r,n,c=e.domain,s=e.editDomainRedirects,i=e.checkDomainHealth,o=e.defaultRedirects,l=e.selectedServer,u=Object(Y.f)(),d=Object(N.a)(u,2),j=d[0],b=d[1],h=c.domain,O=c.isDefault,v=c.redirects,f=c.status,m=!O||Object(Br.c)(l);return Object(B.useEffect)((function(){i(c.domain)}),[]),Object(a.jsxs)("tr",{className:"responsive-table__row",children:[Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Is default domain",children:O&&Object(a.jsx)(al,{})}),Object(a.jsx)("th",{className:"responsive-table__cell","data-th":"Domain",children:h}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Base path redirect",children:null!==(t=null===v||void 0===v?void 0:v.baseUrlRedirect)&&void 0!==t?t:Object(a.jsx)(cl,{fallback:null===o||void 0===o?void 0:o.baseUrlRedirect})}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Regular 404 redirect",children:null!==(r=null===v||void 0===v?void 0:v.regular404Redirect)&&void 0!==r?r:Object(a.jsx)(cl,{fallback:null===o||void 0===o?void 0:o.regular404Redirect})}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Invalid short URL redirect",children:null!==(n=null===v||void 0===v?void 0:v.invalidShortUrlRedirect)&&void 0!==n?n:Object(a.jsx)(cl,{fallback:null===o||void 0===o?void 0:o.invalidShortUrlRedirect})}),Object(a.jsx)("td",{className:"responsive-table__cell text-lg-center","data-th":"Status",children:Object(a.jsx)(nl,{status:f})}),Object(a.jsxs)("td",{className:"responsive-table__cell text-right",children:[Object(a.jsx)("span",{id:m?void 0:"defaultDomainBtn",children:Object(a.jsx)(tn.a,{outline:!0,size:"sm",disabled:!m,onClick:m?b:void 0,children:Object(a.jsx)(M.a,{fixedWidth:!0,icon:m?A.n:A.b})})}),!m&&Object(a.jsxs)(Zt.a,{target:"defaultDomainBtn",placement:"left",children:["Redirects for default domain cannot be edited here.",Object(a.jsx)("br",{}),"Use config options or env vars directly on the server."]})]}),Object(a.jsx)(rl,{domain:c,isOpen:j,toggle:b,editDomainRedirects:s})]})},il=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect","",""],ol=function(e){var t,r=e.listDomains,n=e.domainsList,c=e.filterDomains,s=e.editDomainRedirects,i=e.checkDomainHealth,o=e.selectedServer,l=n.filteredDomains,u=n.defaultRedirects,d=n.loading,j=n.error,b=n.errorData,h=null!==u&&void 0!==u?u:null===(t=l.find((function(e){return e.isDefault})))||void 0===t?void 0:t.redirects;if(Object(B.useEffect)((function(){r()}),[]),d)return Object(a.jsx)(xn.a,{loading:!0});return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(q,{className:"mb-3",onChange:c}),j?Object(a.jsx)(br,{type:"error",children:Object(a.jsx)(vr,{errorData:b,fallbackMessage:"Error loading domains :("})}):Object(a.jsx)(jr.a,{children:Object(a.jsxs)("table",{className:"table table-hover mb-0",children:[Object(a.jsx)("thead",{className:"responsive-table__header",children:Object(a.jsx)("tr",{children:il.map((function(e,t){return Object(a.jsx)("th",{children:e},t)}))})}),Object(a.jsxs)("tbody",{children:[l.length<1&&Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:il.length,className:"text-center",children:"No results found"})}),l.map((function(e){return Object(a.jsx)(sl,{domain:e,editDomainRedirects:s,checkDomainHealth:i,defaultRedirects:h,selectedServer:o},e.domain)}))]})]})})]})},ll=function(e,t){e.serviceFactory("DomainSelector",(function(){return el})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return ol})),e.decorator("ManageDomains",t(["domainsList","selectedServer"],["listDomains","filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("listDomains",Jo,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Zo})),e.serviceFactory("editDomainRedirects",Mo,"buildShlinkApiClient"),e.serviceFactory("checkDomainHealth",Yo,"buildShlinkApiClient")},ul="shlink/appUpdates/APP_UPDATE_AVAILABLE",dl="shlink/appUpdates/RESET_APP_UPDATE",jl=bt((ut={},Object(u.a)(ut,ul,(function(){return!0})),Object(u.a)(ut,dl,(function(){return!1})),ut),!1),bl=ht(ul),hl=ht(dl),Ol=r(152),vl=r(604),fl=function(e){var t=e.isOpen,r=e.toggle,n=e.forceUpdate,c=Object(Y.f)(),s=Object(N.a)(c,3),i=s[0],o=s[2];return Object(a.jsxs)(vl.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:jr.a,color:"secondary",children:[Object(a.jsx)("h4",{className:"mb-4",children:"This app has just been updated!"}),Object(a.jsxs)("p",{className:"mb-0",children:["Restart it to enjoy the new features.",Object(a.jsxs)(tn.a,{disabled:i,className:"ml-2",color:"secondary",size:"sm",onClick:function(){o(),n()},children:[!i&&Object(a.jsxs)(a.Fragment,{children:["Restart now ",Object(a.jsx)(M.a,{icon:A.N,className:"ml-1"})]}),i&&Object(a.jsx)(a.Fragment,{children:"Restarting..."})]})]})]})},ml=r(34),gl=function(){var e=Object(m.a)(f.a.mark((function e(){var t,r,n,c,a,s,i;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=navigator.serviceWorker)||void 0===r?void 0:r.getRegistrations();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:n=e.t2,c=Object(ml.a)(n);try{for(c.s();!(a=c.n()).done;)s=a.value,null===(i=s.waiting)||void 0===i||i.addEventListener("statechange",(function(e){var t;"activated"===(null===(t=e.target)||void 0===t?void 0:t.state)&&window.location.reload()})),null===i||void 0===i||i.postMessage({type:"SKIP_WAITING"})}catch(o){c.e(o)}finally{c.f()}case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xl=function(e,t,r,n,c,s,i,o){return function(l){var u=l.fetchServers,d=l.servers,j=l.settings,b=l.appUpdated,h=l.resetAppUpdate,O="/"===Object(De.f)().pathname;return Object(B.useEffect)((function(){var e,t;0===Object.keys(d).length&&u(),Object(ma.g)(null!==(e=null===(t=j.ui)||void 0===t?void 0:t.theme)&&void 0!==e?e:"light")}),[]),Object(a.jsxs)("div",{className:"container-fluid app-container",children:[Object(a.jsx)(e,{}),Object(a.jsxs)("div",{className:"app",children:[Object(a.jsx)("div",{className:W()("shlink-wrapper",{"d-flex d-md-block align-items-center":O}),children:Object(a.jsxs)(De.d,{children:[Object(a.jsx)(De.b,{index:!0,element:Object(a.jsx)(t,{})}),Object(a.jsx)(De.b,{path:"/settings",element:Object(a.jsx)(s,{})}),Object(a.jsx)(De.b,{path:"/manage-servers",element:Object(a.jsx)(i,{})}),Object(a.jsx)(De.b,{path:"/server/create",element:Object(a.jsx)(n,{})}),Object(a.jsx)(De.b,{path:"/server/:serverId/edit",element:Object(a.jsx)(c,{})}),Object(a.jsx)(De.b,{path:"/server/:serverId/*",element:Object(a.jsx)(r,{})}),Object(a.jsx)(De.b,{path:"*",element:Object(a.jsx)(Ol.a,{})})]})}),Object(a.jsx)("div",{className:"shlink-footer",children:Object(a.jsx)(o,{})})]}),Object(a.jsx)(fl,{isOpen:b,toggle:h,forceUpdate:gl})]})}},pl=function(e,t){e.serviceFactory("App",xl,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ManageServers","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return bl})),e.serviceFactory("resetAppUpdate",(function(){return hl}))},Sl=new j.a,yl=Sl.container,Cl=function(e,t){return Object(d.a)(Object(d.a)({},e),{},Object(u.a)({},t,function(e,t){return function(){return e[t].apply(e,arguments)}}(yl,t)))},Nl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Object(i.b)(e?Object(b.a)(e):null,t.reduce(Cl,{}))};pl(Sl,Nl),Object(F.a)(Sl,Nl),I(Sl),wn(Sl,Nl),Ic(Sl,Nl),fo(Sl,Nl),_i(Sl,Nl),Object(mo.a)(Sl),Co(Sl),Vo(Sl,Nl),ll(Sl,Nl);var kl=r(298),_l=r(78),wl=r(219),Ul=Object(_l.c)({servers:lc,selectedServer:$n,shortUrlsList:Yr,shortUrlCreationResult:Mr,shortUrlDeletion:Rr,shortUrlEdition:zr,shortUrlVisits:Fs,tagVisits:Qs,orphanVisits:ai,nonOrphanVisits:fi,shortUrlDetail:kn,tagsList:uo,tagDelete:zi,tagEdit:$i,mercureInfo:So,settings:mt,domainsList:Qo,visitsOverview:Ci,appUpdated:jl}),Tl=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||_l.d,Rl={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},El=function(e){var t,r,n,c;return e.settings?("last180days"===(null===(t=e.settings.visits)||void 0===t?void 0:t.defaultInterval)&&e.settings.visits&&(e.settings.visits.defaultInterval="last180Days"),e.settings.tags=Object(d.a)(Object(d.a)({},e.settings.tags),{},{defaultMode:null!==(r=null===(n=e.settings.tags)||void 0===n?void 0:n.defaultMode)&&void 0!==r?r:null===(c=e.settings.ui)||void 0===c?void 0:c.tagsMode}),e.settings.ui&&delete e.settings.ui.tagsMode,e):e}(Object(wl.load)(Rl)),Dl=Object(_l.e)(Ul,El,Tl(Object(_l.a)(Object(wl.save)(Rl),kl.a))),Ll=r(63),Vl=r.n(Ll),Il=r(299),Fl=r(300),Al=r(301),Ml=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function Gl(e,t){navigator.serviceWorker.register(e).then((function(e){e.onupdatefound=function(){var r=e.installing;null!=r&&(r.onstatechange=function(){"installed"===r.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See https://cra.link/PWA."),t&&t.onUpdate&&t.onUpdate(e)):(console.log("Content is cached for offline use."),t&&t.onSuccess&&t.onSuccess(e)))})}})).catch((function(e){console.error("Error during service worker registration:",e)}))}r(530),r(531);delete Vl.a.Icon.Default.prototype._getIconUrl,Vl.a.Icon.Default.mergeOptions({iconRetinaUrl:Il.a,iconUrl:Fl.a,shadowUrl:Al.a});var Pl=yl.App,Bl=yl.ScrollToTop,Hl=yl.ErrorHandler,Wl=yl.appUpdateAvailable;Object(s.render)(Object(a.jsx)(i.a,{store:Dl,children:Object(a.jsx)(o.a,{basename:l.a,children:Object(a.jsx)(Hl,{children:Object(a.jsx)(Bl,{children:Object(a.jsx)(Pl,{})})})})}),document.getElementById("root")),function(e){if("serviceWorker"in navigator){var t;if(new URL(null!==(t="/shlink-web-client/dependabot/npm_and_yarn/ws-6.2.2")?t:"",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var t="".concat("/shlink-web-client/dependabot/npm_and_yarn/ws-6.2.2","/service-worker.js");Ml?(!function(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then((function(r){var n=r.headers.get("content-type");404===r.status||null!=n&&-1===n.indexOf("javascript")?navigator.serviceWorker.ready.then((function(e){e.unregister().then((function(){window.location.reload()}))})):Gl(e,t)})).catch((function(){console.log("No internet connection found. App is running in offline mode.")}))}(t,e),navigator.serviceWorker.ready.then((function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://cra.link/PWA")}))):Gl(t,e)}))}}({onUpdate:function(){Dl.dispatch(Wl())}})},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),c=function(e){var t=e.children;return Object(n.jsx)("div",{className:"no-menu-wrapper container-xl",children:t})}},70:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(168),c=r(538),a=r(543),s=r(32),i=function(e,t){var r=t.maxVersion,c=t.minVersion;if(!Object(s.c)(e))return!1;var a=!c||Object(n.compare)(e,c,">=");return(!r||Object(n.compare)(e,r,"<="))&&a},o=Object(c.a)(a.a,(function(e){try{return Object(n.compare)(e,e,"=")}catch(t){return!1}})),l=function(e){return o(e)?"v".concat(e):e},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"latest";return function(t){return o(t)?t:e}}},98:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(0),a=r(1);function s(e){return function(t){return Object(a.useEffect)((function(){t.resetSelectedServer()}),[]),Object(c.jsx)(e,Object(n.a)({},t))}}},99:function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return c}));var n=function(e,t,r){var n=e.document,c=n.createElement("a");c.setAttribute("href",t),c.setAttribute("download",r),c.style.visibility="hidden",n.body.appendChild(c),c.click(),n.body.removeChild(c)},c=function(e,t,r){var c=new Blob([t],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(c);n(e,a,r)}}},[[314,1,2]]]);
|
|
//# sourceMappingURL=main.1e59b24f.chunk.js.map
|