mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-27 19:38:32 +03:00
2 lines
No EOL
200 KiB
JavaScript
2 lines
No EOL
200 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{131:function(e){e.exports=JSON.parse('{"a":"/shlink-web-client/dependabot/npm_and_yarn/urijs-1.19.9"}')},137:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(44),c=r(0),a=function(e){var t=e.color,r=void 0===t?n.c:t,a=e.className;return Object(c.jsx)("svg",{className:a,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:Object(c.jsxs)("g",{fill:r,children:[Object(c.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(c.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(c.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(c.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"})]})})}},138:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(3),c=r(1),a=r(27),s=r(50),i=r(29),o=r(57),l=r(0);function u(e,t){return function(r){var u=Object(a.h)(),d=r.selectServer,j=r.selectedServer;return Object(c.useEffect)((function(){u.serverId&&d(u.serverId)}),[u.serverId]),j?Object(i.c)(j)?Object(l.jsx)(t,{}):Object(l.jsx)(e,Object(n.a)({},r)):Object(l.jsx)(o.a,{children:Object(l.jsx)(s.a,{loading:!0})})}}},141:function(e,t,r){"use strict";var n=r(19),c=r(32),a=r(0);t.a=function(e){var t=e.to,r=void 0===t?"/":t,s=e.children,i=void 0===s?"Home":s;return Object(a.jsx)("div",{className:"home",children:Object(a.jsxs)(c.a,{className:"p-4",children:[Object(a.jsx)("h2",{children:"Oops! We could not find requested route."}),Object(a.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(a.jsx)("br",{}),Object(a.jsx)(n.b,{to:r,className:"btn btn-outline-primary btn-lg",children:i})]})})}},152:function(e,t,r){"use strict";var n=r(510),c=r(511),a=r(19),s=r(8),i=r.n(s),o=r(11),l=r(12),u=r(0),d=function(e){var t=e.id,r=e.name;return Object(u.jsxs)(n.a,{tag:a.b,to:"/server/".concat(t),className:"servers-list__server-item",children:[r,Object(u.jsx)(o.a,{icon:l.j,className:"servers-list__server-item-icon"})]})};t.a=function(e){var t=e.servers,r=e.children,n=e.embedded,a=void 0!==n&&n;return Object(u.jsxs)(u.Fragment,{children:[r&&Object(u.jsx)("h5",{className:"mb-md-3",children:r}),t.length>0&&Object(u.jsx)(c.a,{className:i()("servers-list__list-group",{"servers-list__list-group--embedded":a}),children:t.map((function(e){var t=e.id,r=e.name;return Object(u.jsx)(d,{id:t,name:r},t)}))})]})}},18: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(249),s=r(27),i=r(48),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)}}},246:function(e,t,r){"use strict";(function(e){var n=r(247),c=r.n(n),a=r(248),s=r(276),i=r(277),o=r(278),l=r(279),u=r(250),d=r(274),j=r(93),b=r(252);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(51))},248:function(e,t,r){"use strict";var n=r(1),c=r(27),a=r(0);t.a=function(){return function(e){var t=e.children,r=Object(c.f)();return Object(n.useEffect)((function(){scrollTo(0,0)}),[r]),Object(a.jsx)(a.Fragment,{children:t})}}},250:function(e,t,r){"use strict";var n=r(21),c=r(26),a=r(39),s=r(38),i=r(1),o=r(196),l=r(32),u=r(0);t.a=function(e,t){var r=e.location,d=t.error;return function(e){Object(a.a)(i,e);var t=Object(s.a)(i);function i(e){var r;return Object(n.a)(this,i),(r=t.call(this,e)).state={hasError:!1},r}return Object(c.a)(i,[{key:"componentDidCatch",value:function(e){d(e)}},{key:"render",value:function(){return this.state.hasError?Object(u.jsx)("div",{className:"home",children:Object(u.jsxs)(l.a,{className:"p-4",children:[Object(u.jsx)("h1",{children:"Oops! This is awkward :S"}),Object(u.jsx)("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),Object(u.jsx)("br",{}),Object(u.jsx)(o.a,{outline:!0,color:"primary",onClick:function(){return r.reload()},children:"Take me back"})]})}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),i}(i.Component)}},252: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(21),i=r(26),o=r(94),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}()},265:function(e,t,r){"use strict";(function(e){var n=r(18),c=r(266),a=r(267);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(51))},266:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(21),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))}}},267:function(e,t,r){"use strict";r.d(t,"a",(function(){return h}));var n=r(25),c=r(21),a=r(155),s=r(31),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={}}},274:function(e,t,r){"use strict";var n=r(8),c=r.n(n),a=r(29),s=r(499),i=r(43),o=r(65),l=r(0),u=Object(s.a)(Object(o.c)(),o.b),d=function(e){var t=e.project,r=e.version;return Object(l.jsx)(i.a,{href:"https://github.com/shlinkio/".concat(t,"/releases/").concat(r),className:"text-muted",children:Object(l.jsx)("b",{children:r})})},j=function(e){var t=e.selectedServer,r=e.clientVersion,n=u(void 0===r?"%_VERSION_%":r);return Object(l.jsxs)("small",{className:"text-muted",children:[Object(a.d)(t)&&Object(l.jsxs)(l.Fragment,{children:["Server: ",Object(l.jsx)(d,{project:"shlink",version:t.printableVersion})," - "]}),"Client: ",Object(l.jsx)(d,{project:"shlink-web-client",version:n})]})};t.a=function(e){var t=e.selectedServer,r=c()("text-center",{"shlink-versions-container--with-server":Object(a.d)(t)});return Object(l.jsx)("div",{className:r,children:Object(l.jsx)(j,{selectedServer:t})})}},276:function(e,t,r){"use strict";var n=r(7),c=r(12),a=r(11),s=r(1),i=r(27),o=r(19),l=r(503),u=r(504),d=r(505),j=r(506),b=r(507),h=r(508),O=r(509),v=r(8),f=r.n(v),m=r(18),g=r(137),x=r(0);t.a=function(e){return function(){var t=Object(m.f)(),r=Object(n.a)(t,4),v=r[0],p=r[1],S=r[3],y=Object(i.f)(),C=y.pathname;Object(s.useEffect)(S,[y]);var N="/settings",k=f()("main-header__toggle-icon",{"main-header__toggle-icon--opened":v});return Object(x.jsxs)(l.a,{color:"primary",dark:!0,fixed:"top",className:"main-header",expand:"md",children:[Object(x.jsxs)(u.a,{tag:o.b,to:"/",children:[Object(x.jsx)(g.a,{className:"main-header__brand-logo",color:"white"})," Shlink"]}),Object(x.jsx)(d.a,{onClick:p,children:Object(x.jsx)(a.a,{icon:c.i,className:k})}),Object(x.jsx)(j.a,{navbar:!0,isOpen:v,children:Object(x.jsxs)(b.a,{navbar:!0,className:"ml-auto",children:[Object(x.jsx)(h.a,{children:Object(x.jsxs)(O.a,{tag:o.b,to:N,active:C.startsWith(N),children:[Object(x.jsx)(a.a,{icon:c.l}),"\xa0 Settings"]})}),Object(x.jsx)(e,{})]})})]})}}},277:function(e,t,r){"use strict";var n=r(1),c=r(512),a=r(283),s=r(27),i=r(19),o=r(281),l=r(495),u=r(43),d=r(11),j=r(12),b=r(152),h=r(137),O=r(0);t.a=function(e){var t=e.servers,r=Object(s.g)(),v=Object(c.a)(t),f=!Object(a.a)(v);return Object(n.useEffect)((function(){var e=v.find((function(e){return e.autoConnect}));e&&r("/server/".concat(e.id))}),[]),Object(O.jsx)("div",{className:"home",children:Object(O.jsx)(o.a,{className:"home__main-card",children:Object(O.jsxs)(l.a,{noGutters:!0,children:[Object(O.jsx)("div",{className:"col-md-5 d-none d-md-block",children:Object(O.jsx)("div",{className:"home__logo-wrapper",children:Object(O.jsx)("div",{className:"home__logo",children:Object(O.jsx)(h.a,{})})})}),Object(O.jsxs)("div",{className:"col-md-7 home__servers-container",children:[Object(O.jsx)("div",{className:"home__title-wrapper",children:Object(O.jsx)("h1",{className:"home__title",children:"Welcome!"})}),Object(O.jsx)(b.a,{embedded:!0,servers:v,children:!f&&Object(O.jsxs)("div",{className:"p-4 text-center",children:[Object(O.jsx)("p",{className:"mb-5",children:"This application will help you manage your Shlink servers."}),Object(O.jsx)("p",{children:Object(O.jsxs)(i.b,{to:"/server/create",className:"btn btn-outline-primary btn-lg mr-2",children:[Object(O.jsx)(d.a,{icon:j.F})," ",Object(O.jsx)("span",{className:"ml-1",children:"Add a server"})]})}),Object(O.jsx)("p",{className:"mb-0 mt-5",children:Object(O.jsx)(u.a,{href:"https://shlink.io/documentation",children:Object(O.jsxs)("small",{children:[Object(O.jsx)("span",{className:"mr-1",children:"Learn more about Shlink"})," ",Object(O.jsx)(d.a,{icon:j.p})]})})})]})})]})]})})})}},278:function(e,t,r){"use strict";var n=r(3),c=r(7),a=r(1),s=r(27),i=r(12),o=r(11),l=r(8),u=r.n(l),d=r(138),j=r(18),b=r(35),h=r(29),O=r(141),v=r(0);t.a=function(e,t,r,l,f,m,g,x,p,S,y,C){return Object(d.a)((function(d){var N=d.selectedServer,k=Object(s.f)(),_=Object(j.f)(),w=Object(c.a)(_,4),U=w[0],T=w[1],R=w[2],E=w[3];if(Object(a.useEffect)((function(){return E()}),[k]),!Object(h.d)(N))return Object(v.jsx)(p,{});var D=Object(b.h)(N),L=Object(b.g)(N),V=Object(b.e)(N),I=u()("menu-layout__burger-icon",{"menu-layout__burger-icon--active":U}),F=Object(j.e)(R,E);return Object(v.jsxs)(v.Fragment,{children:[Object(v.jsx)(o.a,{icon:i.c,className:I,onClick:T}),Object(v.jsx)("div",Object(n.a)(Object(n.a)({},F),{},{className:"menu-layout__swipeable",children:Object(v.jsxs)("div",{className:"menu-layout__swipeable-inner",children:[Object(v.jsx)(r,{selectedServer:N,showOnMobile:U}),Object(v.jsx)("div",{className:"menu-layout__container",onClick:function(){return E()},children:Object(v.jsx)("div",{className:"container-xl",children:Object(v.jsxs)(s.d,{children:[Object(v.jsx)(s.b,{index:!0,element:Object(v.jsx)(s.a,{replace:!0,to:"overview"})}),Object(v.jsx)(s.b,{path:"/overview",element:Object(v.jsx)(S,{})}),Object(v.jsx)(s.b,{path:"/list-short-urls/:page",element:Object(v.jsx)(t,{})}),Object(v.jsx)(s.b,{path:"/create-short-url",element:Object(v.jsx)(l,{})}),Object(v.jsx)(s.b,{path:"/short-code/:shortCode/visits/*",element:Object(v.jsx)(f,{})}),Object(v.jsx)(s.b,{path:"/short-code/:shortCode/edit",element:Object(v.jsx)(y,{})}),Object(v.jsx)(s.b,{path:"/tag/:tag/visits/*",element:Object(v.jsx)(m,{})}),D&&Object(v.jsx)(s.b,{path:"/orphan-visits/*",element:Object(v.jsx)(g,{})}),L&&Object(v.jsx)(s.b,{path:"/non-orphan-visits/*",element:Object(v.jsx)(x,{})}),Object(v.jsx)(s.b,{path:"/manage-tags",element:Object(v.jsx)(e,{})}),V&&Object(v.jsx)(s.b,{path:"/manage-domains",element:Object(v.jsx)(C,{})}),Object(v.jsx)(s.b,{path:"*",element:Object(v.jsx)(O.a,{to:"/server/".concat(N.id,"/list-short-urls/1"),children:"List short URLs"})})]})})})]})}))]})}),p)}},279:function(e,t,r){"use strict";var n=r(3),c=r(33),a=r(12),s=r(11),i=r(19),o=r(27),l=r(8),u=r.n(l),d=r(29),j=r(35),b=r(0),h=function(e){var t=e.children,r=e.to,a=e.className,s=Object(c.a)(e,["children","to","className"]);return Object(b.jsx)(i.c,Object(n.a)(Object(n.a)({className:function(e){var t=e.isActive;return u()("aside-menu__item",a,{"aside-menu__item--selected":t})},to:r},s),{},{children:t}))};t.a=function(e){return function(t){var r=t.selectedServer,n=t.showOnMobile,c=void 0!==n&&n,i=Object(d.e)(r),l=i?r.id:"",O=Object(o.f)().pathname,v=Object(j.e)(r),f=u()("aside-menu",{"aside-menu--hidden":!c}),m=function(e){return"/server/".concat(l).concat(e)};return Object(b.jsx)("aside",{className:f,children:Object(b.jsxs)("nav",{className:"nav flex-column aside-menu__nav",children:[Object(b.jsxs)(h,{to:m("/overview"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.u}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Overview"})]}),Object(b.jsxs)(h,{to:m("/list-short-urls/1"),className:u()({"aside-menu__item--selected":null!==O.match("/list-short-urls")}),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.x}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"List short URLs"})]}),Object(b.jsxs)(h,{to:m("/create-short-url"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.w,flip:"horizontal"}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Create short URL"})]}),Object(b.jsxs)(h,{to:m("/manage-tags"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.O}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Manage tags"})]}),v&&Object(b.jsxs)(h,{to:m("/manage-domains"),children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.t}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Manage domains"})]}),Object(b.jsxs)(h,{to:m("/edit"),className:"aside-menu__item--push",children:[Object(b.jsx)(s.a,{fixedWidth:!0,icon:a.C}),Object(b.jsx)("span",{className:"aside-menu__item-text",children:"Edit this server"})]}),i&&Object(b.jsx)(e,{className:"aside-menu__item aside-menu__item--danger",textClassName:"aside-menu__item-text",server:r})]})})}}},284:function(e,t,r){e.exports=r(490)},29: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(494),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)}},31: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(500),c=r(155),a=r(283),s=r(499),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))}},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(3),c=r(33),a=r(281),s=r(497),i=r(498),o=r(0),l=function(e){var t=e.title,r=e.children,l=e.bodyClassName,u=Object(c.a)(e,["title","children","bodyClassName"]);return Object(o.jsxs)(a.a,Object(n.a)(Object(n.a)({},u),{},{children:[t&&Object(o.jsx)(s.a,{children:t}),Object(o.jsx)(i.a,{className:l,children:r})]}))}},35:function(e,t,r){"use strict";r.d(t,"j",(function(){return s})),r.d(t,"l",(function(){return i})),r.d(t,"h",(function(){return o})),r.d(t,"i",(function(){return l})),r.d(t,"m",(function(){return u})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return j})),r.d(t,"k",(function(){return b})),r.d(t,"e",(function(){return h})),r.d(t,"f",(function(){return O})),r.d(t,"d",(function(){return v})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return m}));var n=r(29),c=r(65),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"}),m=f},372:function(e,t){},374:function(e,t){},44: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"))}},48:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s}));var n=r(195),c=r.n(n),a=function(e){return c.a.parse(e,{ignoreQueryPrefix:!0})},s=function(e){return c.a.stringify(e,{arrayFormat:"brackets"})}},490: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 Ja}));var c,a=r(46),s=r(150),i=r(19),o=r(131),l=r(10),u=r(3),d=r(245),j=r(559),b=r(565),h=r(29),O=r(6),v=r.n(O),f=r(14),m=r(21),g=r(33),x=r(275),p=r(155),S=r(283),y=r(48),C=r(7),N=function(e,t,r){return e!==t?"ASC":r?{ASC:"DESC",DESC:void 0}[r]:"ASC"},k=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},_=function(e){return e.dir?"".concat(e.field,"-").concat(e.dir):void 0},w=function(e){var t=e.split("-"),r=Object(C.a)(t,2);return{field:r[0],dir:r[1]}},U=function(e){return e?"".concat(e,"/rest/v2"):""},T=Object(x.a)(p.a),R=function(e){var t=e.orderBy,r=void 0===t?{}:t,n=Object(g.a)(e,["orderBy"]);return Object(u.a)(Object(u.a)({},n),{},{orderBy:_(r)})},E=function e(t,r,n){var c=this;Object(m.a)(this,e),this.axios=t,this.baseUrl=r,this.apiKey=n,this.listShortUrls=Object(f.a)(v.a.mark((function e(){var t,r=arguments;return v.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",R(t)).then((function(e){return e.data.shortUrls})));case 2:case"end":return e.stop()}}),e)}))),this.createShortUrl=function(){var e=Object(f.a)(v.a.mark((function e(t){var r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(x.a)((function(e){return Object(S.a)(e)||Object(p.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(f.a)(v.a.mark((function e(t,r){return v.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(f.a)(v.a.mark((function e(t,r){return v.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(f.a)(v.a.mark((function e(t){return v.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(f.a)(v.a.mark((function e(t){return v.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(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(t,r){return v.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(f.a)(v.a.mark((function e(t,r){return v.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(f.a)(v.a.mark((function e(t,r,n){return v.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(f.a)(v.a.mark((function e(t,r,n){return v.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(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(t){return v.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(f.a)(v.a.mark((function e(t,r){return v.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(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(t){return v.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(f.a)(v.a.mark((function e(t){var r,n,a,s=arguments;return v.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(U(c.baseUrl)).concat(t),headers:{"X-Api-Key":c.apiKey},params:T(n),data:a,paramsSerializer:y.b}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},D={},L=function(e){return function(t){var r,n=function(e){return"function"===typeof e}(t)?(r=t,Object(b.a)("selectedServer",r())):t;if(!Object(h.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 D[s]||(D[s]=new E(e,c,a)),D[s]}},V=function(e){e.serviceFactory("buildShlinkApiClient",L,"axios")},I=r(246),F=r(12),A=r(11),M=r(499),G=r(328),P=r(1),B=r(8),H=r.n(B),W=r(0),q=function(e){var t=e.onChange,r=e.className,n=e.large,a=void 0===n||n,s=e.noBorder,i=void 0!==s&&s,o=e.initialValue,l=void 0===o?"":o,u=Object(P.useState)(l),d=Object(C.a)(u,2),j=d[0],b=d[1],h=function(){c&&clearTimeout(c),c=null},O=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;b(e),h(),c=setTimeout((function(){t(e),h()}),r)};return Object(W.jsxs)("div",{className:H()("search-field",r),children:[Object(W.jsx)("input",{type:"text",className:H()("form-control search-field__input",{"form-control-lg":a,"search-field__input--no-border":i}),placeholder:"Search...",value:j,onChange:function(e){return O(e.target.value)}}),Object(W.jsx)(A.a,{icon:F.I,className:"search-field__icon"}),Object(W.jsx)("div",{className:"close search-field__close",hidden:""===j,id:"search-field__close",onClick:function(){return O("",0)},children:"\xd7"})]})},z=function(e){var t=e.text,r=e.children,n=e.clearable,c=e.className,a=void 0===c?"":c,s=e.colorGenerator,i=e.onClick,o=e.onClose;return Object(W.jsxs)("span",{className:H()("badge tag",a,{"tag--light-bg":s.isColorLightForKey(t)}),style:{backgroundColor:s.getColorForKey(t),cursor:n||!i?"auto":"pointer"},onClick:i,children:[null!==r&&void 0!==r?r:t,n&&Object(W.jsx)("span",{className:"close tag__close-selected-tag",onClick:o,children:"\xd7"})]})},K=r(518),Q=r(118),J=r(513),Z=r(514),Y=r(18),X=function(e){var t=e.text,r=e.disabled,n=void 0!==r&&r,c=e.className,a=void 0===c?"":c,s=e.children,i=e.dropdownClassName,o=e.right,l=void 0!==o&&o,u=e.minWidth,d=Object(Y.f)(),j=Object(C.a)(d,2),b=j[0],h=j[1],O="dropdown-btn__toggle btn-block ".concat(a),v={minWidth:u&&"".concat(u,"px")};return Object(W.jsxs)(Q.a,{isOpen:b,toggle:h,disabled:n,className:i,children:[Object(W.jsx)(J.a,{caret:!0,className:O,color:"primary",children:t}),Object(W.jsx)(Z.a,{className:"w-100",right:l,style:v,children:s})]})},$=r(84),ee=r(332),te=r(182),re=r(273),ne=r(516),ce=r(517),ae=r(492),se=r(515),ie=(r(491),r(329)),oe=r(330),le=r(331),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(G.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(S.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(255),_e=r.n(ke),we=r(64),Ue=function(e){var t=e.className,r=e.isClearable,n=e.selected,c=!r||Object(p.a)(n),a=Object(P.useRef)();return Object(W.jsxs)("div",{className:"date-input-container",children:[Object(W.jsx)(_e.a,Object(u.a)(Object(u.a)({},e),{},{dateFormat:"yyyy-MM-dd",className:H()("date-input-container__input form-control",t),ref:a})),c&&Object(W.jsx)(A.a,{icon:we.b,className:"date-input-container__icon",onClick:function(){var e;return null===(e=a.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,a=e.disabled,s=void 0!==a&&a,i=e.onStartDateChange,o=e.onEndDateChange;return Object(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(Ue,{selected:r,placeholderText:"Since...",isClearable:!0,maxDate:null!==c&&void 0!==c?c:void 0,disabled:s,onChange:i})}),Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(Ue,{className:"mt-2 mt-md-0",selected:c,placeholderText:"Until...",isClearable:!0,minDate:null!==r&&void 0!==r?r:void 0,disabled:s,onChange:o})})]})},Re=function(e){var t=e.active,r=e.allText,n=e.onChange;return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.a,{active:"all"===t,onClick:function(){return n("all")},children:r}),Object(W.jsx)(K.a,{divider:!0}),xe.map((function(e){return Object(W.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,a=e.disabled,s=e.updatable,i=void 0!==s&&s,o=me(n),l=Object(P.useState)(o?n:void 0),d=Object(C.a)(l,2),j=d[0],b=d[1],h=Object(P.useState)(o?void 0:n),O=Object(C.a)(h,2),v=O[0],f=O[1],m=function(e){b(fe(e)?"all":void 0),f(e),r(e)},g=function(e){b(e),f(void 0),r(Ce(e))};return i&&Object(Y.a)((function(){var e=me(n);e&&g(n),n&&!e&&m(n)}),[n]),Object(W.jsxs)(X,{disabled:a,text:null!==(t=pe(null!==j&&void 0!==j?j:v))&&void 0!==t?t:c,children:[Object(W.jsx)(Re,{allText:c,active:j,onChange:g}),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsx)(K.a,{header:!0,children:"Custom:"}),Object(W.jsx)(K.a,{text:!0,children:Object(W.jsx)(Te,Object(u.a)(Object(u.a)({},v),{},{onStartDateChange:function(e){return m(Object(u.a)(Object(u.a)({},v),{},{startDate:e}))},onEndDateChange:function(e){return m(Object(u.a)(Object(u.a)({},v),{},{endDate:e}))}}))})]})},De=r(35),Le=r(519),Ve=r(564),Ie=r(501),Fe=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?Ie.a:n,a=e.className,s=e.children,i=e.type,o=e.inline,l=void 0!==o&&o,u=Object(P.useRef)(Object(Ve.a)()).current,d={"custom-switch":"switch"===i,"custom-checkbox":"checkbox"===i},j=l?{display:"inline-block"}:{};return Object(W.jsxs)("span",{className:H()("custom-control",d,a),style:j,children:[Object(W.jsx)("input",{type:"checkbox",className:"custom-control-input",id:u,checked:r,onChange:function(e){return c(e.target.checked,e)}}),Object(W.jsx)("label",{className:"custom-control-label",htmlFor:u,children:s})]})},Ae=function(e){return Object(W.jsx)(Fe,Object(u.a)({type:"switch"},e))},Me=function(e){var t=e.children,r=e.tooltip,n=void 0===r?{}:r,c=Object(g.a)(e,["children","tooltip"]),a=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{ref:function(e){a.current=null!==e&&void 0!==e?e:void 0},children:Object(W.jsx)(Ae,Object(u.a)({},c))}),Object(W.jsx)(Le.a,Object(u.a)(Object(u.a)({target:function(){return a.current}},n),{},{children:t}))]})},Ge=r(27),Pe=function(){var e=Object(Ge.g)(),t=Object(Ge.f)(),r=Object(Ge.h)(),n=Object(P.useMemo)(Object(M.a)((function(){return Object(y.a)(t.search)}),(function(e){var t=e.orderBy,r=Object(g.a)(e,["orderBy"]);return t?Object(u.a)(Object(u.a)({},r),{},{orderBy:w(t)}):r})),[t.search]);return[n,function(t){var c=Object(u.a)(Object(u.a)({},n),t),a=c.orderBy,s=Object(g.a)(c,["orderBy"]),i=Object(u.a)(Object(u.a)({},s),{},{orderBy:a&&_(a)}),o=Object(y.b)(i),l=Object(S.a)(o)?"":"?".concat(o);e("/server/".concat(r.serverId,"/list-short-urls/1").concat(l))}]},Be=function(e){return e?Object(G.default)(e):null},He=function(e){return function(t){var r,n=t.selectedServer,c=Pe(),a=Object(C.a)(c,2),s=a[0],i=s.search,o=s.tags,l=s.startDate,u=s.endDate,d=s.tagsMode,j=void 0===d?"any":d,b=a[1],h=null!==(r=null===o||void 0===o?void 0:o.split(","))&&void 0!==r?r:[],O=Object(M.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}}),b),v=Object(M.a)((function(e){return Object(S.a)(e)?void 0:e}),(function(e){return b({search:e})})),f=Object(M.a)((function(e){return h.filter((function(t){return t!==e}))}),(function(e){return 0===e.length?void 0:e.join(",")}),(function(e){return b({tags:e})})),m=Object(De.a)(n),g=Object(M.a)((function(){return"any"===j?"all":"any"}),(function(e){return b({tagsMode:e})}));return Object(W.jsxs)("div",{className:"short-urls-filtering-bar-container",children:[Object(W.jsx)(q,{initialValue:i,onChange:v}),Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsx)("div",{className:"row",children:Object(W.jsx)("div",{className:"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6",children:Object(W.jsx)(Ee,{defaultText:"All short URLs",initialDateRange:{startDate:Be(l),endDate:Be(u)},onDatesChange:O})})})}),h.length>0&&Object(W.jsxs)("h4",{className:"mt-3",children:[m&&h.length>1&&Object(W.jsx)("div",{className:"float-right ml-2 mt-1",children:Object(W.jsx)(Me,{checked:"all"===j,tooltip:{placement:"left"},onChange:g,children:"all"===j?"Short URLs including all tags.":"Short URLs including any tag."})}),Object(W.jsx)(A.a,{icon:F.O,className:"short-urls-filtering-bar__tags-icon mr-1"}),h.map((function(t){return Object(W.jsx)(z,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return f(t)}},t)}))]})]})}},We=r(25),qe=r(281),ze=r(520),Ke=r(521);function Qe(e){var t,r=e.items,n=e.order,c=e.onChange,a=e.isButton,s=void 0===a||a,i=e.right,o=void 0!==i&&i,l=function(e){return function(){var t=N(e,n.field,n.dir);c(t?e:void 0,t)}};return Object(W.jsxs)(ze.a,{children:[Object(W.jsxs)(J.a,{caret:!0,color:s?"primary":"link",className:H()({"dropdown-btn__toggle btn-block":s,"btn-sm p-0":!s}),children:[!s&&Object(W.jsx)(W.Fragment,{children:"Order by"}),s&&!n.field&&Object(W.jsx)(W.Fragment,{children:"Order by..."}),s&&n.field&&'Order by: "'.concat(r[n.field],'" - "').concat(null!==(t=n.dir)&&void 0!==t?t:"DESC",'"')]}),Object(W.jsxs)(Z.a,{right:o,className:H()("w-100",{"ordering-dropdown__menu--link":!s}),children:[Object(Ke.a)(r).map((function(e){var t=Object(C.a)(e,2),r=t[0],c=t[1];return Object(W.jsxs)(K.a,{active:n.field===r,onClick:l(r),children:[c,n.field===r&&Object(W.jsx)(A.a,{icon:"ASC"===n.dir?F.L:F.K,className:"ordering-dropdown__sort-icon"})]},r)})),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsx)(K.a,{disabled:!n.field,onClick:function(){return c()},children:Object(W.jsx)("i",{children:"Clear selection"})})]})]})}var Je=r(256);function Ze(e,t){var r=new Set;return function(n){var c=n.createNewVisits,a=n.loadMercureInfo,s=n.mercureInfo,i=s.interval,o=Object(Ge.h)();return Object(P.useEffect)((function(){var e=t(n,o),l=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 Je.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()}))}}}(s,e,(function(e){return i?r.add(e):c([e])}),a);if(!i)return l;var u=setInterval((function(){c(Object(We.a)(r)),r.clear()}),1e3*i*60);return Object(M.a)((function(){return clearInterval(u)}),(function(){return null===l||void 0===l?void 0:l()}))}),[s]),Object(W.jsx)(e,Object(u.a)({},n))}}var Ye=function e(){Object(m.a)(this,e)};function Xe(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(W.jsx)(A.a,{icon:"ASC"===t.dir?F.f:F.e,className:c}):null}Ye.visits="https://shlink.io/new-visit",Ye.orphanVisits="https://shlink.io/new-orphan-visit",Ye.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var $e,et,tt,rt,nt,ct,at,st,it,ot,lt,ut,dt,jt,bt,ht,Ot,vt,ft,mt=r(566),gt=r(522),xt=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}},pt=function(e){return function(){return{type:e}}},St="shlink/realTimeUpdates/SET_SETTINGS",yt={field:"dateCreated",dir:"DESC"},Ct={realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:yt}},Nt=xt(Object(l.a)({},St,(function(e,t){return Object(mt.a)(e,Object(gt.a)("type",t))})),Ct),kt=function(e){return{type:St,realTimeUpdates:{enabled:e}}},_t=function(e){return{type:St,realTimeUpdates:{interval:e}}},wt=function(e){return{type:St,shortUrlCreation:e}},Ut=function(e){return{type:St,shortUrlsList:e}},Tt=function(e){return{type:St,ui:e}},Rt=function(e){return{type:St,visits:e}},Et=function(e){return{type:St,tags:e}},Dt=r(524),Lt=r(525),Vt=r(526),It=r(500),Ft=r(254),At=r(523),Mt=Math.ceil,Gt=new Intl.NumberFormat("en-US"),Pt=function(e){return Gt.format(Number(e))},Bt="...",Ht=function(e,t){var r=Object(It.a)(Object(Ft.a)(2,e-2),Object(At.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Bt),e+2<t-1&&r.push(Bt),r.unshift(1),r.push(t),r},Wt=function(e){return e===Bt},qt=function(e){return Wt(e)?e:Pt(e)},zt=function(e,t){return Wt(e)?"".concat(e,"_").concat(t):"".concat(e)},Kt=function(e){var t=e.paginator,r=e.serverId,n=e.currentQueryString,c=void 0===n?"":n,a=null!==t&&void 0!==t?t:{},s=a.currentPage,o=void 0===s?0:s,l=a.pagesCount,u=void 0===l?0:l,d=function(e){return"/server/".concat(r,"/list-short-urls/").concat(e).concat(c)};if(u<=1)return null;return Object(W.jsxs)(Vt.a,{className:"sticky-card-paginator",listClassName:"flex-wrap justify-content-center mb-0",children:[Object(W.jsx)(Dt.a,{disabled:1===o,children:Object(W.jsx)(Lt.a,{previous:!0,tag:i.b,to:d(o-1)})}),Ht(o,u).map((function(e,t){return Object(W.jsx)(Dt.a,{disabled:Wt(e),active:o===e,children:Object(W.jsx)(Lt.a,{tag:i.b,to:d(e),children:qt(e)})},zt(e,t))})),Object(W.jsx)(Dt.a,{disabled:o>=u,children:Object(W.jsx)(Lt.a,{next:!0,tag:i.b,to:d(o+1)})})]})},Qt={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Jt=function(e,t){return Ze((function(r){var n,c,a,s=r.listShortUrls,i=r.shortUrlsList,o=r.selectedServer,l=r.settings,u=Object(h.a)(o),d=Object(Ge.h)().page,j=Object(Ge.f)(),b=Pe(),O=Object(C.a)(b,2),v=O[0],f=v.tags,m=v.search,g=v.startDate,x=v.endDate,p=v.orderBy,S=v.tagsMode,y=O[1],k=Object(P.useState)(null!==(n=null!==p&&void 0!==p?p:null===(c=l.shortUrlsList)||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:yt),_=Object(C.a)(k,2),w=_[0],U=_[1],T=Object(P.useMemo)((function(){var e;return null!==(e=null===f||void 0===f?void 0:f.split(","))&&void 0!==e?e:[]}),[f]),R=(null!==(a=null===i||void 0===i?void 0:i.shortUrls)&&void 0!==a?a:{}).pagination,E=function(e,t){y({orderBy:{field:e,dir:t}}),U({field:e,dir:t})},D=Object(M.a)((function(e){return Object(We.a)(new Set([].concat(Object(We.a)(T),[e]))).join(",")}),(function(e){return y({tags:e})}));return Object(P.useEffect)((function(){s({page:d,searchTerm:m,tags:T,startDate:g,endDate:x,orderBy:w,tagsMode:S})}),[d,m,T,g,x,w,S]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:"mb-3",children:Object(W.jsx)(t,{})}),Object(W.jsx)("div",{className:"d-block d-lg-none mb-3",children:Object(W.jsx)(Qe,{items:Qt,order:w,onChange:E})}),Object(W.jsxs)(qe.a,{body:!0,className:"pb-1",children:[Object(W.jsx)(e,{selectedServer:o,shortUrlsList:i,orderByColumn:function(e){return function(){return E(e,N(e,w.field,w.dir))}},renderOrderIcon:function(e){return Object(W.jsx)(Xe,{currentOrder:w,field:e})},onTagClick:D}),Object(W.jsx)(Kt,{paginator:R,serverId:u,currentQueryString:j.search})]})]})}),(function(){return[Ye.visits]}))},Zt=r(43),Yt=r(148),Xt=r.n(Yt),$t=function(e){var t=e.text,r=e.onCopy;return Object(W.jsx)(Xt.a,{text:t,onCopy:r,children:Object(W.jsx)(A.a,{icon:we.d,className:"ml-2 copy-to-clipboard-icon"})})},er=r(527),tr=r(567),rr=function(e){var t=e.date,r=e.format,n=void 0===r?"yyyy-MM-dd HH:mm":r,c=e.relative,a=void 0!==c&&c,s=ue(t)?t:Object(G.default)(t);return Object(W.jsx)("time",{dateTime:"".concat(Object(er.a)(s),"000"),children:a?"".concat(Object(tr.a)(new Date,s)," ago"):Object(ae.default)(s,n)})},nr=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)},cr=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,a=Object(g.a)(e,["selectedServer","shortUrl","suffix","children"]);return t&&Object(h.e)(t)&&r?Object(W.jsx)(i.b,Object(u.a)(Object(u.a)({to:nr(t,r,n)},a),{},{children:c})):Object(W.jsx)("span",Object(u.a)(Object(u.a)({},a),{},{children:c}))},ar=function(e){var t,r=e.visitsCount,n=e.shortUrl,c=e.selectedServer,a=e.active,s=void 0!==a&&a,i=null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.maxVisits,o=Object(W.jsx)(cr,{selectedServer:c,shortUrl:n,suffix:"visits",children:Object(W.jsx)("strong",{className:H()("short-url-visits-count__amount",{"short-url-visits-count__amount--big":s}),children:Pt(r)})});if(!i)return o;var l=Pt(i),u=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)("span",{className:"indivisible",children:[o,Object(W.jsxs)("small",{className:"short-urls-visits-count__max-visits-control",ref:function(e){u.current=e},children:[" ","/ ",l," ",Object(W.jsx)("sup",{children:Object(W.jsx)(A.a,{icon:F.v})})]})]}),Object(W.jsxs)(Le.a,{target:function(){return u.current},placement:"bottom",children:["This short URL will not accept more than ",Object(W.jsx)("b",{children:l})," visits."]})]})},sr=function(e,t,r){return function(n){var c,a,s=n.shortUrl,i=n.selectedServer,o=n.onTagClick,l=r(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=r(!1,500),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(P.useRef)(!0);return Object(P.useEffect)((function(){f.current?f.current=!1:v()}),[s.visitsCount]),Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsx)("td",{className:"indivisible short-urls-row__cell responsive-table__cell","data-th":"Created at",children:Object(W.jsx)(rr,{date:s.dateCreated})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Short URL",children:Object(W.jsxs)("span",{className:"indivisible short-urls-row__cell--relative",children:[Object(W.jsx)(Zt.a,{href:s.shortUrl}),Object(W.jsx)($t,{text:s.shortUrl,onCopy:j}),Object(W.jsx)("span",{className:"badge badge-warning short-urls-row__copy-hint",hidden:!d,children:"Copied short URL!"})]})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell short-urls-row__cell--break","data-th":"".concat(s.title?"Title":"Long URL"),children:Object(W.jsx)(Zt.a,{href:s.longUrl,children:null!==(c=s.title)&&void 0!==c?c:s.longUrl})}),s.title&&Object(W.jsx)("td",{className:"short-urls-row__cell responsive-table__cell short-urls-row__cell--break d-lg-none","data-th":"Long URL",children:Object(W.jsx)(Zt.a,{href:s.longUrl})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Tags",children:(a=s.tags,Object(S.a)(a)?Object(W.jsx)("i",{className:"indivisible",children:Object(W.jsx)("small",{children:"No tags"})}):a.map((function(e){return Object(W.jsx)(z,{colorGenerator:t,text:e,onClick:function(){return null===o||void 0===o?void 0:o(e)}},e)})))}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell text-lg-right","data-th":"Visits",children:Object(W.jsx)(ar,{visitsCount:s.visitsCount,shortUrl:s,selectedServer:i,active:O})}),Object(W.jsx)("td",{className:"responsive-table__cell short-urls-row__cell",children:Object(W.jsx)(e,{selectedServer:i,shortUrl:s})})]})}},ir=r(528),or=function(e){var t=e.isOpen,r=e.toggle,n=e.children,c=e.right,a=void 0===c||c;return Object(W.jsxs)(ir.a,{toggle:r,isOpen:t,children:[Object(W.jsxs)(J.a,{size:"sm",caret:!0,outline:!0,className:"dropdown-btn-menu__dropdown-toggle",children:["\xa0",Object(W.jsx)(A.a,{icon:F.o}),"\xa0"]}),Object(W.jsx)(Z.a,{right:a,children:n})]})},lr=function(e,t){return function(r){var n=r.shortUrl,c=r.selectedServer,a=Object(Y.f)(),s=Object(C.a)(a,2),i=s[0],o=s[1],l=Object(Y.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(Y.f)(),h=Object(C.a)(b,2),O=h[0],v=h[1];return Object(W.jsxs)(or,{toggle:o,isOpen:i,children:[Object(W.jsxs)(K.a,{tag:cr,selectedServer:c,shortUrl:n,suffix:"visits",children:[Object(W.jsx)(A.a,{icon:F.g,fixedWidth:!0})," Visit stats"]}),Object(W.jsxs)(K.a,{tag:cr,selectedServer:c,shortUrl:n,suffix:"edit",children:[Object(W.jsx)(A.a,{icon:F.n,fixedWidth:!0})," Edit short URL"]}),Object(W.jsxs)(K.a,{onClick:j,children:[Object(W.jsx)(A.a,{icon:F.G,fixedWidth:!0})," QR code"]}),Object(W.jsx)(t,{shortUrl:n,isOpen:d,toggle:j}),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsxs)(K.a,{className:"dropdown-item--danger",onClick:v,children:[Object(W.jsx)(A.a,{icon:F.z,fixedWidth:!0})," Delete short URL"]}),Object(W.jsx)(e,{shortUrl:n,isOpen:O,toggle:v})]})}},ur=function(e,t){return function(r){var n=r.createShortUrl,c=r.shortUrlCreationResult,a=r.resetCreateShortUrl,s=r.selectedServer,i=r.basicMode,o=void 0!==i&&i,l=r.settings.shortUrlCreation,d=Object(P.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}}(l)}),[l]);return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(e,{initialState:d,saving:c.saving,selectedServer:s,mode:o?"create-basic":"create",onSave:function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(),e.abrupt("return",n(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),Object(W.jsx)(t,Object(u.a)(Object(u.a)({},c),{},{resetCreateShortUrl:a,canBeClosed:o}))]})}},dr=r(569),jr=r(529),br=r(530),hr=r(531),Or=r(31),vr=r(495),fr=r(32),mr=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,a=void 0!==c&&c;return Object(W.jsx)(vr.a,{className:n,children:Object(W.jsx)("div",{className:H()({"col-md-10 offset-md-1":!a,"col-12":a}),children:Object(W.jsx)(fr.a,{className:H()("text-center",{"bg-main":"success"===r,"bg-danger":"error"===r,"bg-warning":"warning"===r,"text-white":"warning"!==r}),bodyClassName:H()({"p-2":a}),children:t})})})},gr=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},xr=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)},pr=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(W.jsxs)(W.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(W.jsxs)("p",{className:"mb-0",children:["Invalid elements: [",n.invalidElements.join(", "),"]"]}))]})},Sr=function(e){var t=e.shortUrl,r=e.toggle,n=e.isOpen,c=e.shortUrlDeletion,a=e.resetDeleteShortUrl,s=e.deleteShortUrl,i=Object(P.useState)(""),o=Object(C.a)(i,2),l=o[0],u=o[1];Object(P.useEffect)((function(){return a}),[]);var d=c.error,j=c.errorData,b=Object(M.a)(a,r),h=Object(Or.b)((function(){var e=t.shortCode,n=t.domain;s(e,n).then(r).catch(Ie.a)}));return Object(W.jsx)(dr.a,{isOpen:n,toggle:b,centered:!0,children:Object(W.jsxs)("form",{onSubmit:h,children:[Object(W.jsx)(jr.a,{toggle:b,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)("p",{children:[Object(W.jsx)("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),Object(W.jsx)("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),Object(W.jsxs)("p",{children:["Write ",Object(W.jsx)("b",{children:t.shortCode})," to confirm deletion."]}),Object(W.jsx)("input",{type:"text",className:"form-control",placeholder:"Insert the short code (".concat(t.shortCode,")"),value:l,onChange:function(e){return u(e.target.value)}}),d&&Object(W.jsx)(mr,{type:xr(j)?"warning":"error",small:!0,className:"mt-2",children:Object(W.jsx)(pr,{errorData:j,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(W.jsxs)(hr.a,{children:[Object(W.jsx)("button",{type:"button",className:"btn btn-link",onClick:b,children:"Cancel"}),Object(W.jsx)("button",{type:"submit",className:"btn btn-danger",disabled:l!==t.shortCode||c.loading,children:c.loading?"Deleting...":"Delete"})]})]})})},yr=r(199),Cr=function(e){return function(t){var r=t.error,n=t.errorData,c=t.result,a=t.resetCreateShortUrl,s=t.canBeClosed,i=void 0!==s&&s,o=e(),l=Object(C.a)(o,2),u=l[0],d=l[1];if(Object(P.useEffect)((function(){a()}),[]),r)return Object(W.jsxs)(mr,{type:"error",className:"mt-3",children:[i&&Object(W.jsx)(A.a,{icon:F.Q,className:"float-right pointer",onClick:a}),Object(W.jsx)(pr,{errorData:n,fallbackMessage:"An error occurred while creating the URL :("})]});if(Object(p.a)(c))return null;var j=c.shortUrl;return Object(W.jsxs)(mr,{type:"success",className:"mt-3",children:[i&&Object(W.jsx)(A.a,{icon:F.Q,className:"float-right pointer",onClick:a}),Object(W.jsx)("b",{children:"Great!"})," The short URL is ",Object(W.jsx)("b",{children:j}),Object(W.jsx)(Xt.a,{text:j,onCopy:d,children:Object(W.jsxs)("button",{className:"btn btn-light btn-sm create-short-url-result__copy-btn",id:"copyBtn",type:"button",children:[Object(W.jsx)(A.a,{icon:we.d})," Copy"]})}),Object(W.jsx)(yr.a,{placement:"left",isOpen:u,target:"copyBtn",children:"Copied!"})]})}},Nr=r(532),kr=r(533),_r=r(257),wr=function(e,t,r){return Object(p.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},Ur="shlink/visitCreation/CREATE_VISITS",Tr=function(e){return{type:Ur,createdVisits:e}},Rr="shlink/deleteShortUrl/DELETE_SHORT_URL_START",Er="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",Dr="shlink/deleteShortUrl/SHORT_URL_DELETED",Lr="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",Vr={shortCode:"",loading:!1,error:!1},Ir=xt(($e={},Object(l.a)($e,Rr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)($e,Er,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(l.a)($e,Dr,(function(e,t){var r=t.shortCode;return Object(u.a)(Object(u.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(l.a)($e,Lr,(function(){return Vr})),$e),Vr),Fr=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:Rr}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:Dr,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:Er,errorData:gr(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},Ar=pt(Lr),Mr="shlink/createShortUrl/CREATE_SHORT_URL_START",Gr="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",Pr="shlink/createShortUrl/CREATE_SHORT_URL",Br="shlink/createShortUrl/RESET_CREATE_SHORT_URL",Hr={result:null,saving:!1,error:!1},Wr=xt((et={},Object(l.a)(et,Mr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(et,Gr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(et,Pr,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(l.a)(et,Br,(function(){return Hr})),et),Hr),qr=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Mr}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Pr,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:Gr,errorData:gr(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},zr=pt(Br),Kr="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Qr="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",Jr="shlink/shortUrlEdition/SHORT_URL_EDITED",Zr=xt((tt={},Object(l.a)(tt,Kr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(tt,Qr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(tt,Jr,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),tt),{saving:!1,error:!1}),Yr=function(e){return function(t,r,n){return function(){var c=Object(f.a)(v.a.mark((function c(a,s){var i,o,l,u,d,j,b,h,O;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return a({type:Kr}),i=s(),o=i.selectedServer,l=!Object(De.m)(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(C.a)(b,1),O=h[0],a({shortUrl:O,type:Jr}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Qr,errorData:gr(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Xr="shlink/shortUrlsList/LIST_SHORT_URLS_START",$r="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",en="shlink/shortUrlsList/LIST_SHORT_URLS",tn=xt((rt={},Object(l.a)(rt,Xr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(rt,$r,(function(){return{loading:!1,error:!0}})),Object(l.a)(rt,en,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(l.a)(rt,Dr,Object(M.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(Nr.a)(["shortUrls","data"],Object(x.a)((function(e){return wr(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(Nr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(l.a)(rt,Ur,(function(e,t){var r,n,c=t.createdVisits;return Object(Nr.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(kr.a)(c.filter((function(t){var r=t.shortUrl;return r&&wr(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(_r.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(l.a)(rt,Pr,Object(M.a)((function(e,t){var r=t.result;return e.shortUrls?Object(Nr.a)(["shortUrls","data"],[r].concat(Object(We.a)(e.shortUrls.data.slice(0,4))),e):e}),(function(e){return e.shortUrls?Object(Nr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(l.a)(rt,Jr,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(Nr.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return wr(e,t,n)?r:e})),e):e})),rt),{loading:!0,error:!1}),rn=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Xr}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:en,shortUrls:i}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:$r});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},nn=function(e){return function(t){var r=t.orderByColumn,n=t.renderOrderIcon,c=t.shortUrlsList,a=t.onTagClick,s=t.selectedServer,i=t.className,o=c.error,l=c.loading,u=c.shortUrls,d=H()({"short-urls-table__header-cell--with-action":!!r}),j=H()("short-urls-table__header-cell",d),b=H()("table table-hover",i),h=Object(De.l)(s);return Object(W.jsxs)("table",{className:b,children:[Object(W.jsx)("thead",{className:"responsive-table__header short-urls-table__header",children:Object(W.jsxs)("tr",{children:[Object(W.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("dateCreated"),children:["Created at ",null===n||void 0===n?void 0:n("dateCreated")]}),Object(W.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("shortCode"),children:["Short URL ",null===n||void 0===n?void 0:n("shortCode")]}),!h&&Object(W.jsxs)("th",{className:j,onClick:null===r||void 0===r?void 0:r("longUrl"),children:["Long URL ",null===n||void 0===n?void 0:n("longUrl")]})||Object(W.jsxs)("th",{className:"short-urls-table__header-cell",children:[Object(W.jsxs)("span",{className:d,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(W.jsxs)("span",{className:d,onClick:null===r||void 0===r?void 0:r("longUrl"),children:[Object(W.jsx)("span",{className:"indivisible",children:"Long URL"})," ",null===n||void 0===n?void 0:n("longUrl")]})]}),Object(W.jsx)("th",{className:"short-urls-table__header-cell",children:"Tags"}),Object(W.jsx)("th",{className:j,onClick:null===r||void 0===r?void 0:r("visits"),children:Object(W.jsxs)("span",{className:"indivisible",children:["Visits ",null===n||void 0===n?void 0:n("visits")]})}),Object(W.jsx)("th",{className:"short-urls-table__header-cell",children:"\xa0"})]})}),Object(W.jsx)("tbody",{children:o?Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:6,className:"text-center table-danger text-dark",children:"Something went wrong while loading short URLs :("})}):l?Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:6,className:"text-center",children:"Loading..."})}):!l&&Object(S.a)(null===u||void 0===u?void 0:u.data)?Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:6,className:"text-center",children:"No results found"})}):null===u||void 0===u?void 0:u.data.map((function(t){return Object(W.jsx)(e,{shortUrl:t,selectedServer:s,onTagClick:a},t.shortUrl)}))})]})}},cn=r(534),an=r(196),sn=function(e){var t=e.format,r=e.setFormat;return Object(W.jsxs)(X,{text:"Format (".concat(t,")"),children:[Object(W.jsx)(K.a,{active:"png"===t,onClick:function(){return r("png")},children:"PNG"}),Object(W.jsx)(K.a,{active:"svg"===t,onClick:function(){return r("svg")},children:"SVG"})]})},on=function(e){var t=e.errorCorrection,r=e.setErrorCorrection;return Object(W.jsxs)(X,{text:"Error correction (".concat(t,")"),children:[Object(W.jsxs)(K.a,{active:"L"===t,onClick:function(){return r("L")},children:[Object(W.jsx)("b",{children:"L"}),"ow"]}),Object(W.jsxs)(K.a,{active:"M"===t,onClick:function(){return r("M")},children:[Object(W.jsx)("b",{children:"M"}),"edium"]}),Object(W.jsxs)(K.a,{active:"Q"===t,onClick:function(){return r("Q")},children:[Object(W.jsx)("b",{children:"Q"}),"uartile"]}),Object(W.jsxs)(K.a,{active:"H"===t,onClick:function(){return r("H")},children:[Object(W.jsx)("b",{children:"H"}),"igh"]})]})},ln=function(e,t){return function(r){var n=r.shortUrl,c=n.shortUrl,a=n.shortCode,s=r.toggle,i=r.isOpen,o=r.selectedServer,l=Object(P.useState)(300),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(P.useState)(0),h=Object(C.a)(b,2),O=h[0],m=h[1],g=Object(P.useState)("png"),x=Object(C.a)(g,2),p=x[0],N=x[1],k=Object(P.useState)("L"),_=Object(C.a)(k,2),w=_[0],U=_[1],T=Object(P.useMemo)((function(){return{useSizeInPath:!Object(De.j)(o),marginIsSupported:Object(De.i)(o),errorCorrectionIsSupported:Object(De.k)(o)}}),[o]),R=T.marginIsSupported!==T.errorCorrectionIsSupported,E=Object(P.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(y.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(S.a)(d)?"":"?".concat(d))}(c,{size:d,format:p,margin:O,errorCorrection:w},T)}),[c,d,p,O,w,T]),D=Object(P.useMemo)((function(){return d+O}),[d,O]),L=Object(P.useMemo)((function(){if(!(D<500))return D<800?"lg":"xl"}),[D]);return Object(W.jsxs)(dr.a,{isOpen:i,toggle:s,centered:!0,size:L,children:[Object(W.jsxs)(jr.a,{toggle:s,children:["QR code for ",Object(W.jsx)(Zt.a,{href:c,children:c})]}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)(vr.a,{children:[Object(W.jsxs)(cn.a,{className:H()({"col-md-4":R,"col-md-6":!R}),children:[Object(W.jsxs)("label",{className:"mb-0",children:["Size: ",d,"px"]}),Object(W.jsx)("input",{type:"range",className:"form-control-range",value:d,step:10,min:50,max:1e3,onChange:function(e){return j(Number(e.target.value))}})]}),T.marginIsSupported&&Object(W.jsxs)(cn.a,{className:R?"col-md-4":"col-md-6",children:[Object(W.jsxs)("label",{className:"mb-0",children:["Margin: ",O,"px"]}),Object(W.jsx)("input",{type:"range",className:"form-control-range",value:O,step:1,min:0,max:100,onChange:function(e){return m(Number(e.target.value))}})]}),Object(W.jsx)(cn.a,{className:R?"col-md-4":"col-md-6",children:Object(W.jsx)(sn,{format:p,setFormat:N})}),T.errorCorrectionIsSupported&&Object(W.jsx)(cn.a,{className:"col-md-6",children:Object(W.jsx)(on,{errorCorrection:w,setErrorCorrection:U})})]}),Object(W.jsxs)("div",{className:"text-center",children:[Object(W.jsxs)("div",{className:"mb-3",children:[Object(W.jsx)(Zt.a,{href:E}),Object(W.jsx)($t,{text:E})]}),Object(W.jsx)("img",{src:E,className:"qr-code-modal__img",alt:"QR code"}),Object(W.jsx)(t,{minVersion:"2.9.0",children:Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsxs)(an.a,{block:!0,color:"primary",onClick:Object(f.a)(v.a.mark((function t(){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.saveImage(E,"".concat(a,"-qr-code.").concat(p)));case 1:case"end":return t.stop()}}),t)}))),children:["Download ",Object(W.jsx)(A.a,{icon:F.r,className:"ml-1"})]})})})]})]})]})}},un=r(537),dn=r(535),jn=r(536),bn=function(e){return Object(W.jsx)(Fe,Object(u.a)({type:"checkbox"},e))},hn=function(e){var t=e.isOpen,r=e.toggle;return Object(W.jsxs)(dr.a,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(W.jsx)(jr.a,{toggle:r,children:"Info"}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)("p",{children:["When the\xa0",Object(W.jsx)("b",{children:Object(W.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(W.jsx)("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),Object(W.jsxs)("ul",{children:[Object(W.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(W.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(W.jsx)("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),Object(W.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"})]})]})]})},On=function(){var e=Object(Y.f)(),t=Object(C.a)(e,2),r=t[0],n=t[1];return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{title:"What does this mean?",children:Object(W.jsx)(A.a,{icon:F.v,style:{cursor:"pointer"},onClick:n})}),Object(W.jsx)(hn,{isOpen:r,toggle:n})]})},vn=function(e){var t=e.className,r=void 0===t?"":t,n=e.placement,c=e.children,a=Object(P.useRef)();return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{className:r,ref:function(e){a.current=e},children:Object(W.jsx)(A.a,{icon:F.v})}),Object(W.jsx)(Le.a,{target:function(){return a.current},placement:n,children:c})]})},fn=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(W.jsxs)("p",{children:[Object(W.jsx)(bn,{inline:!0,checked:n,className:r?"mr-2":"",onChange:c,children:t}),r&&Object(W.jsx)(vn,{placement:"right",children:r})]})},mn=Object(M.a)(dn.a,Object(jn.a)(/ /g,"-")),gn=function(e){return"string"===typeof e?Object(G.default)(e):e},xn=function(e){return{"col-sm-6":e,"col-sm-12":!e}},pn=function(e,t){return function(r){var n,c=r.mode,a=r.saving,s=r.onSave,i=r.initialState,o=r.selectedServer,d=Object(P.useState)(i),j=Object(C.a)(d,2),b=j[0],h=j[1],O="edit"===c,m="create-basic"===c,g=Object(Or.c)(i.title),x=function(){var e=Object(Or.c)(b.title);return Object(ne.a)([[function(){return!e&&!g},function(){}],[function(){return!e&&g},function(){return null}],[ce.a,function(){return b.title}]])()},p=Object(Or.b)(Object(f.a)(v.a.mark((function e(){var t,r;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s(Object(u.a)(Object(u.a)({},b),{},{validSince:null!==(t=je(b.validSince))&&void 0!==t?t:null,validUntil:null!==(r=je(b.validUntil))&&void 0!==r?r:null,maxVisits:Object(Or.c)(b.maxVisits)?Number(b.maxVisits):null,title:x()})).then((function(){return!O&&h(i)})).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));Object(P.useEffect)((function(){h(i)}),[i]);var y=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]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Object(W.jsx)(cn.a,Object(u.a)(Object(u.a)({},a),{},{children:Object(W.jsx)(un.a,Object(u.a)({id:e,type:n,placeholder:t,value:null!==(r=b[e])&&void 0!==r?r:"",onChange:function(t){return h(Object(u.a)(Object(u.a)({},b),{},Object(l.a)({},e,t.target.value)))}},c))}))},N=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object(W.jsx)("div",{className:"form-group",children:Object(W.jsx)(Ue,Object(u.a)({selected:b[e]?gn(b[e]):null,placeholderText:t,isClearable:!0,onChange:function(t){return h(Object(u.a)(Object(u.a)({},b),{},Object(l.a)({},e,t)))}},r))})},k=Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(cn.a,{children:Object(W.jsx)(un.a,{bsSize:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:b.longUrl,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{longUrl:e.target.value}))}})}),Object(W.jsxs)(vr.a,{children:[m&&y("customSlug","Custom slug","text",{bsSize:"lg"},{className:"col-lg-6"}),Object(W.jsx)(cn.a,{className:m?"col-lg-6":"col-12 mb-0",children:Object(W.jsx)(e,{selectedTags:null!==(n=b.tags)&&void 0!==n?n:[],onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{tags:e.map(mn)}))}})})]})]}),_=Object(De.l)(o),w=_||!O,U=H()("mb-3",xn(w)),T=Object(De.c)(o),R=Object(De.f)(o),E=T||R,D=H()("mb-3",xn(E));return Object(W.jsxs)("form",{className:"short-url-form",onSubmit:p,children:[m&&k,!m&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(fr.a,{title:"Basic options",className:"mb-3",children:k}),Object(W.jsxs)(vr.a,{children:[w&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(fr.a,{title:"Customize the short URL",children:[_&&y("title","Title"),!O&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(vr.a,{children:[Object(W.jsx)("div",{className:"col-lg-6",children:y("customSlug","Custom slug","text",{disabled:Object(Or.c)(b.shortCodeLength)})}),Object(W.jsx)("div",{className:"col-lg-6",children:y("shortCodeLength","Short code length","number",{min:4,disabled:Object(Or.c)(b.customSlug)})})]}),Object(W.jsx)(cn.a,{children:Object(W.jsx)(t,{value:b.domain,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{domain:e}))}})})]})]})}),Object(W.jsx)("div",{className:U,children:Object(W.jsxs)(fr.a,{title:"Limit access to the short URL",children:[y("maxVisits","Maximum number of visits allowed","number",{min:1}),N("validSince","Enabled since...",{maxDate:b.validUntil?gn(b.validUntil):void 0}),N("validUntil","Enabled until...",{minDate:b.validSince?gn(b.validSince):void 0})]})})]}),Object(W.jsxs)(vr.a,{children:[Object(W.jsx)("div",{className:D,children:Object(W.jsxs)(fr.a,{title:"Extra checks",children:[Object(W.jsx)(fn,{infoTooltip:"If checked, Shlink will try to reach the long URL, failing in case it's not publicly accessible.",checked:b.validateUrl,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{validateUrl:e}))},children:"Validate URL"}),!O&&Object(W.jsxs)("p",{children:[Object(W.jsx)(bn,{inline:!0,className:"mr-2",checked:b.findIfExists,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{findIfExists:e}))},children:"Use existing URL if found"}),Object(W.jsx)(On,{})]})]})}),E&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(fr.a,{title:"Configure behavior",children:[T&&Object(W.jsx)(fn,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:b.crawlable,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{crawlable:e}))},children:"Make it crawlable"}),R&&Object(W.jsx)(fn,{infoTooltip:"When this short URL is visited, any query params appended to it will be forwarded to the long URL.",checked:b.forwardQuery,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{forwardQuery:e}))},children:"Forward query params on redirect"})]})})]})]}),Object(W.jsx)("div",{className:"text-center",children:Object(W.jsx)(an.a,{outline:!0,color:"primary",disabled:a||Object(S.a)(b.longUrl),className:"btn-xs-block",children:a?"Saving...":"Save"})})]})}},Sn=r(50),yn=function(e){return function(t){var r,n=t.settings.shortUrlCreation,c=t.selectedServer,a=t.shortUrlDetail,s=t.getShortUrlDetail,i=t.shortUrlEdition,o=t.editShortUrl,l=Object(Ge.f)().search,u=Object(Ge.h)(),d=Object(Y.b)(),j=a.loading,b=a.error,h=a.errorData,O=a.shortUrl,m=i.saving,g=i.error,x=i.errorData,p=Object(y.a)(l).domain,S=Object(P.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}}(O,n)}),[O,n]),N=Object(Y.f)(),k=Object(C.a)(N,4),_=k[0],w=k[2],U=k[3];return Object(P.useEffect)((function(){u.shortCode&&s(u.shortCode,p)}),[]),j?Object(W.jsx)(Sn.a,{loading:!0}):b?Object(W.jsx)(mr,{type:"error",children:Object(W.jsx)(pr,{errorData:h,fallbackMessage:"An error occurred while loading short URL detail :("})}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("header",{className:"mb-3",children:Object(W.jsx)(qe.a,{body:!0,children:Object(W.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(an.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:d,children:Object(W.jsx)(A.a,{icon:F.a})}),Object(W.jsx)("span",{className:"text-center",children:Object(W.jsxs)("small",{children:["Edit ",Object(W.jsx)(Zt.a,{href:null!==(r=null===O||void 0===O?void 0:O.shortUrl)&&void 0!==r?r:""})]})}),Object(W.jsx)("span",{})]})})}),Object(W.jsx)(e,{initialState:S,saving:m,selectedServer:c,mode:"edit",onSave:function(){var e=Object(f.a)(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O){e.next=2;break}return e.abrupt("return");case 2:U(),o(O.shortCode,O.domain,t).then(w).catch(U);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),g&&Object(W.jsx)(mr,{type:"error",className:"mt-3",children:Object(W.jsx)(pr,{errorData:x,fallbackMessage:"An error occurred while updating short URL :("})}),_&&Object(W.jsx)(mr,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},Cn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",Nn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",kn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",_n={loading:!1,error:!1},wn=xt((nt={},Object(l.a)(nt,Cn,(function(){return{loading:!0,error:!1}})),Object(l.a)(nt,Nn,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(l.a)(nt,kn,(function(e,t){var r=t.shortUrl;return Object(u.a)({shortUrl:r},_n)})),nt),_n),Un=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o,l,u;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c({type:Cn}),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 wr(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:kn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:Nn,errorData:gr(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},Tn=function(e,t){e.serviceFactory("ShortUrlsList",Jt,"ShortUrlsTable","ShortUrlsFilteringBar"),e.decorator("ShortUrlsList",t(["selectedServer","mercureInfo","shortUrlsList","settings"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",nn,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",sr,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",lr,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",Cr,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",pn,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",ur,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",yn,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return Sr})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",ln,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("ShortUrlsFilteringBar",He,"ColorGenerator"),e.decorator("ShortUrlsFilteringBar",t(["selectedServer"])),e.serviceFactory("listShortUrls",rn,"buildShlinkApiClient"),e.serviceFactory("createShortUrl",qr,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return zr})),e.serviceFactory("deleteShortUrl",Fr,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return Ar})),e.serviceFactory("getShortUrlDetail",Un,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Yr,"buildShlinkApiClient")},Rn=r(258),En=r.n(Rn),Dn=r(57),Ln=function(e){var t=e.children,r=e.value,n=e.onChange,c=e.id,a=e.type,s=e.required,i=e.placeholder,o=e.className,l=e.labelClassName,u=Object(P.useRef)(null!==c&&void 0!==c?c:Object(Ve.a)());return Object(W.jsxs)(cn.a,{className:null!==o&&void 0!==o?o:"",children:[Object(W.jsxs)("label",{htmlFor:u.current,className:null!==l&&void 0!==l?l:"",children:[t,":"]}),Object(W.jsx)("input",{className:"form-control",type:null!==a&&void 0!==a?a:"text",id:u.current,value:r,required:null===s||void 0===s||s,placeholder:i,onChange:function(e){return n(e.target.value)}})]})},Vn=function(e){return Object(W.jsx)(Ln,Object(u.a)(Object(u.a)({},e),{},{labelClassName:"server-form__label"}))},In=function(e){var t=e.onSubmit,r=e.initialValues,n=e.children,c=e.title,a=Object(P.useState)(""),s=Object(C.a)(a,2),i=s[0],o=s[1],l=Object(P.useState)(""),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(P.useState)(""),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(Or.b)((function(){return t({name:i,url:d,apiKey:O})}));return Object(P.useEffect)((function(){r&&o(r.name),r&&j(r.url),r&&v(r.apiKey)}),[r]),Object(W.jsxs)("form",{className:"server-form",onSubmit:f,children:[Object(W.jsxs)(fr.a,{className:"mb-3",title:c,children:[Object(W.jsx)(Vn,{value:i,onChange:o,children:"Name"}),Object(W.jsx)(Vn,{type:"url",value:d,onChange:j,children:"URL"}),Object(W.jsx)(Vn,{value:O,onChange:v,children:"API key"})]}),Object(W.jsx)("div",{className:"text-right",children:n})]})},Fn=function(e){var t=e.isOpen,r=e.duplicatedServers,n=e.onDiscard,c=e.onSave,a=r.length>1;return Object(W.jsxs)(dr.a,{centered:!0,isOpen:t,children:[Object(W.jsxs)(jr.a,{children:["Duplicated server",a&&"s"]}),Object(W.jsxs)(br.a,{children:[Object(W.jsx)("p",{children:a?"The next servers already exist:":"There is already a server with:"}),Object(W.jsx)("ul",{children:r.map((function(e,t){var r=e.url,n=e.apiKey;return a?Object(W.jsxs)("li",{children:[Object(W.jsx)("b",{children:r})," - ",Object(W.jsx)("b",{children:n})]},t):Object(W.jsxs)(P.Fragment,{children:[Object(W.jsxs)("li",{children:["URL: ",Object(W.jsx)("b",{children:r})]}),Object(W.jsxs)("li",{children:["API key: ",Object(W.jsx)("b",{children:n})]})]},t)}))}),Object(W.jsxs)("span",{children:[a?"Do you want to ignore duplicated servers":"Do you want to save this server anyway","?"]})]}),Object(W.jsxs)(hr.a,{children:[Object(W.jsx)(an.a,{color:"link",onClick:n,children:a?"Ignore duplicated":"Discard"}),Object(W.jsx)(an.a,{color:"primary",onClick:c,children:"Save anyway"})]})]})},An=function(e){var t=e.type;return Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsxs)(mr,{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."]})})},Mn=function(e,t){return function(r){var n=r.servers,c=r.createServer,a=Object(Ge.g)(),s=Object(Y.b)(),i=!!Object.keys(n).length,o=t(!1,4e3),l=Object(C.a)(o,2),d=l[0],j=l[1],b=t(!1,4e3),h=Object(C.a)(b,2),O=h[0],v=h[1],f=Object(Y.f)(),m=Object(C.a)(f,2),g=m[0],x=m[1],p=Object(P.useState)(),S=Object(C.a)(p,2),y=S[0],N=S[1],k=function(){if(y){var e=Object(Ve.a)();c(Object(u.a)(Object(u.a)({},y),{},{id:e})),a("/server/".concat(e))}};return Object(P.useEffect)((function(){Object.values(n).some((function(e){var t=e.url,r=e.apiKey;return(null===y||void 0===y?void 0:y.url)===t&&(null===y||void 0===y?void 0:y.apiKey)===r}))?x():k()}),[y]),Object(W.jsxs)(Dn.a,{children:[Object(W.jsxs)(In,{title:Object(W.jsx)("h5",{className:"mb-0",children:"Add new server"}),onSubmit:N,children:[!i&&Object(W.jsx)(e,{tooltipPlacement:"top",onImport:j,onImportError:v}),i&&Object(W.jsx)(an.a,{outline:!0,onClick:s,children:"Cancel"}),Object(W.jsx)(an.a,{outline:!0,color:"primary",className:"ml-2",children:"Create server"})]}),d&&Object(W.jsx)(An,{type:"success"}),O&&Object(W.jsx)(An,{type:"error"}),Object(W.jsx)(Fn,{isOpen:g,duplicatedServers:y?[y]:[],onDiscard:s,onSave:k})]})}},Gn=r(512),Pn=function(e){var t=e.servers,r=e.selectedServer,n=Object(Gn.a)(t);return Object(W.jsxs)(ze.a,{nav:!0,inNavbar:!0,children:[Object(W.jsxs)(J.a,{nav:!0,caret:!0,children:[Object(W.jsx)(A.a,{icon:F.J})," ",Object(W.jsx)("span",{className:"ml-1",children:"Servers"})]}),Object(W.jsx)(Z.a,{right:!0,children:Object(S.a)(n)?Object(W.jsxs)(K.a,{tag:i.b,to:"/server/create",children:[Object(W.jsx)(A.a,{icon:F.F})," ",Object(W.jsx)("span",{className:"ml-1",children:"Add a server"})]}):Object(W.jsxs)(W.Fragment,{children:[n.map((function(e){var t=e.name,n=e.id;return Object(W.jsx)(K.a,{tag:i.b,to:"/server/".concat(n),active:Object(h.a)(r)===n,children:t},n)})),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsxs)(K.a,{tag:i.b,to:"/manage-servers",children:[Object(W.jsx)(A.a,{icon:F.J})," ",Object(W.jsx)("span",{className:"ml-1",children:"Manage servers"})]})]})})]})},Bn=function(e){var t=e.server,r=e.toggle,n=e.isOpen,c=e.deleteServer,a=e.redirectHome,s=void 0===a||a,i=Object(Ge.g)();return Object(W.jsxs)(dr.a,{isOpen:n,toggle:r,centered:!0,children:[Object(W.jsx)(jr.a,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)("p",{children:["Are you sure you want to remove ",Object(W.jsx)("b",{children:t?t.name:""}),"?"]}),Object(W.jsx)("p",{children:Object(W.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(W.jsxs)(hr.a,{children:[Object(W.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(W.jsx)("button",{className:"btn btn-danger",onClick:function(){return c(t),r(),void(s&&i("/"))},children:"Delete"})]})]})},Hn=function(e){return function(t){var r=t.server,n=t.className,c=t.children,a=t.textClassName,s=Object(Y.f)(),i=Object(C.a)(s,4),o=i[0],l=i[2],u=i[3];return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)("span",{className:n,onClick:l,children:[!c&&Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.z}),Object(W.jsx)("span",{className:a,children:null!==c&&void 0!==c?c:"Remove this server"})]}),Object(W.jsx)(e,{server:r,isOpen:o,toggle:u})]})}},Wn=r(138),qn=function(e){return Object(Wn.a)((function(e){var t=e.editServer,r=e.selectedServer,n=Object(Y.b)();if(!Object(h.e)(r))return null;return Object(W.jsx)(Dn.a,{children:Object(W.jsxs)(In,{title:Object(W.jsxs)("h5",{className:"mb-0",children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:function(e){t(r.id,e),n()},children:[Object(W.jsx)(an.a,{outline:!0,className:"mr-2",onClick:n,children:"Cancel"}),Object(W.jsx)(an.a,{outline:!0,color:"primary",children:"Save"})]})})}),e)},zn=r(563),Kn=function(e){return function(t){var r=t.url,n=t.apiKey;return e.some((function(e){return e.url===r&&e.apiKey===n}))}},Qn=function(e){var t=e.importServersFromFile;return function(e){var r=e.createServers,n=e.servers,c=e.fileRef,a=e.children,s=e.onImport,i=void 0===s?function(){}:s,o=e.onImportError,l=void 0===o?function(){}:o,u=e.tooltipPlacement,d=void 0===u?"bottom":u,j=e.className,b=void 0===j?"":j,h=null!==c&&void 0!==c?c:Object(P.useRef)(),O=Object(P.useState)(),m=Object(C.a)(O,2),g=m[0],x=m[1],p=Object(P.useState)([]),S=Object(C.a)(p,2),y=S[0],N=S[1],k=Object(Y.f)(),_=Object(C.a)(k,4),w=_[0],U=_[2],T=_[3],R=Object(M.a)(r,i),E=Object(M.a)((function(){return R(null!==g&&void 0!==g?g:[])}),T),D=Object(M.a)((function(){return R((null!==g&&void 0!==g?g:[]).filter(Object(zn.a)(Kn(y))))}),T),L=function(){var e=Object(f.a)(v.a.mark((function e(r){var n,c;return v.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(x).then((function(){c.value=null})).catch(l));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(P.useEffect)((function(){if(g){var e=Object.values(n),t=g.filter(Kn(e)),r=!!t.length;r?N(t):R(g),r&&U()}}),[g]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(an.a,{outline:!0,id:"importBtn",className:b,onClick:function(){var e;return null===(e=h.current)||void 0===e?void 0:e.click()},children:[Object(W.jsx)(A.a,{icon:F.s,fixedWidth:!0})," ",null!==a&&void 0!==a?a:"Import from file"]}),Object(W.jsxs)(Le.a,{placement:d,target:"importBtn",children:["You can create servers by importing a CSV file with columns ",Object(W.jsx)("b",{children:"name"}),", ",Object(W.jsx)("b",{children:"apiKey"})," and ",Object(W.jsx)("b",{children:"url"}),"."]}),Object(W.jsx)("input",{type:"file",accept:"text/csv",className:"import-servers-btn__csv-select",ref:h,onChange:L}),Object(W.jsx)(Fn,{isOpen:w,duplicatedServers:y,onDiscard:D,onSave:E})]})}},Jn=r(496),Zn=r(65),Yn="shlink/selectedServer/SELECT_SERVER",Xn="shlink/selectedServer/RESET_SELECTED_SERVER",$n=Object(M.a)((function(e){return"latest"===e?"999.999.999":e}),Object(Zn.c)("1.0.0")),ec=Object(Jn.a)(Ie.a,function(){var e=Object(f.a)(v.a.mark((function e(t,r){return v.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:$n(t),printableVersion:Object(Zn.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),tc=xt((ct={},Object(l.a)(ct,Xn,(function(){return null})),Object(l.a)(ct,Yn,(function(e,t){return t.selectedServer})),ct),null),rc=pt(Xn),nc=function(e,t){return function(r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o,l,d,j,b,h;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c(rc()),s=a(),i=s.servers,o=i[r]){n.next=6;break}return c({type:Yn,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 6:return n.prev=6,l=e(o),d=l.health,n.next=10,ec(r,d);case 10:j=n.sent,b=j.version,h=j.printableVersion,c({type:Yn,selectedServer:Object(u.a)(Object(u.a)({},o),{},{version:b,printableVersion:h})}),c(t()),n.next=20;break;case 17:n.prev=17,n.t0=n.catch(6),c({type:Yn,selectedServer:Object(u.a)(Object(u.a)({},o),{},{serverNotReachable:!0})});case 20:case"end":return n.stop()}}),n,null,[[6,17]])})));return function(e,t){return n.apply(this,arguments)}}()}},cc=r(538),ac=r(139),sc=r(104),ic="shlink/servers/EDIT_SERVER",oc="shlink/servers/DELETE_SERVER",lc="shlink/servers/CREATE_SERVERS",uc="shlink/servers/SET_AUTO_CONNECT",dc=xt((at={},Object(l.a)(at,lc,(function(e,t){var r=t.newServers;return Object(u.a)(Object(u.a)({},e),r)})),Object(l.a)(at,oc,(function(e,t){var r=t.serverId;return Object(gt.a)(r,e)})),Object(l.a)(at,ic,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(_r.a)(r,Object(u.a)(Object(u.a)({},e[r]),n),e):e})),Object(l.a)(at,uc,(function(e,t){var r=t.serverId,n=t.autoConnect;return e[r]?n?Object(cc.a)(Object(Ke.a)(e).map((function(e){var t=Object(C.a)(e,2),n=t[0],c=t[1];return[n,Object(u.a)(Object(u.a)({},c),{},{autoConnect:n===r})]}))):Object(_r.a)(r,Object(u.a)(Object(u.a)({},e[r]),{},{autoConnect:n}),e):e})),at),{}),jc=Object(ac.a)((function(e,t){return Object(_r.a)(t.id,t,e)}),{}),bc=Object(M.a)(Object(sc.a)((function(e){return e.id?e:Object(_r.a)("id",Object(Ve.a)(),e)})),jc,(function(e){return{type:lc,newServers:e}})),hc=function(e){return bc([e])},Oc=function(e,t){return{type:ic,serverId:e,serverData:t}},vc=function(e){var t=e.id;return{type:oc,serverId:t}},fc=function(e,t){var r=e.id;return{type:uc,serverId:r,autoConnect:t}},mc=Object(M.a)(Object(b.a)("data"),(function(e){return Array.isArray(e)?e.filter(h.b):[]})),gc=function(e){var t=e.get;return function(){return function(){var e=Object(f.a)(v.a.mark((function e(r){var n,c;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t("".concat(o.a,"/servers.json"));case 2:n=e.sent,c=mc(n),r(bc(c));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},xc=function(e){var t=e.minVersion,r=e.maxVersion,n=e.selectedServer,c=e.children;if(!Object(h.d)(n))return null;var a=n.version;return Object(Zn.a)(a,{maxVersion:r,minVersion:t})?Object(W.jsx)(W.Fragment,{children:c}):null},pc=r(152),Sc=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(W.jsx)(Dn.a,{children:Object(W.jsxs)("div",{className:"server-error__container flex-column",children:[Object(W.jsxs)(Sn.a,{className:"w-100 mb-3 mb-md-5",type:"error",fullWidth:!0,children:[!Object(h.e)(n)&&"Could not find this Shlink server.",Object(h.e)(n)&&Object(W.jsxs)(W.Fragment,{children:[Object(W.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(W.jsxs)(pc.a,{servers:Object.values(r),children:["These are the Shlink servers currently configured. Choose one of them or ",Object(W.jsx)(i.b,{to:"/server/create",children:"add a new one"}),"."]}),Object(h.e)(n)&&Object(W.jsx)("div",{className:"container mt-3 mt-md-5",children:Object(W.jsxs)("h5",{children:["Alternatively, if you think you may have miss-configured this server, you can ",Object(W.jsx)(e,{server:n,className:"server-error__delete-btn",children:"remove it"})," or\xa0",Object(W.jsx)(i.b,{to:"/server/".concat(n.id,"/edit"),children:"edit it"}),"."]})})]})})}},yc=r(93),Cc=r(497),Nc=r(498),kc=r(539),_c=r(540),wc=function(e){var t=e.children,r=e.title,n=e.link;return Object(W.jsxs)(qe.a,Object(u.a)(Object(u.a)({className:"highlight-card",body:!0},function(e){return e?{tag:i.b,to:e}:{}}(n)),{},{children:[n&&Object(W.jsx)(A.a,{size:"3x",className:"highlight-card__link-icon",icon:we.a}),Object(W.jsx)(kc.a,{tag:"h5",className:"highlight-card__title",children:r}),Object(W.jsx)(_c.a,{tag:"h2",children:t})]}))},Uc=function(e,t,r){return Ze((function(n){var c,a=n.shortUrlsList,s=n.listShortUrls,o=n.listTags,l=n.tagsList,u=n.selectedServer,d=n.loadVisitsOverview,j=n.visitsOverview,b=a.loading,O=a.shortUrls,v=l.loading,f=j.loading,m=j.visitsCount,g=j.orphanVisitsCount,x=Object(h.a)(u),p=Object(De.h)(u),S=Object(De.g)(u),y=Object(Ge.g)();return Object(P.useEffect)((function(){s({itemsPerPage:5,orderBy:{field:"dateCreated",dir:"DESC"}}),o(),d()}),[]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(vr.a,{children:[Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(wc,{title:"Visits",link:S&&"/server/".concat(x,"/non-orphan-visits"),children:f?"Loading...":Pt(m)})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsxs)(wc,{title:"Orphan visits",link:p&&"/server/".concat(x,"/orphan-visits"),children:[Object(W.jsx)(r,{minVersion:"2.6.0",children:f?"Loading...":Pt(null!==g&&void 0!==g?g:0)}),Object(W.jsx)(r,{maxVersion:"2.5.*",children:Object(W.jsx)("small",{className:"text-muted",children:Object(W.jsx)("i",{children:"Shlink 2.6 is needed"})})})]})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(wc,{title:"Short URLs",link:"/server/".concat(x,"/list-short-urls/1"),children:b?"Loading...":Pt(null!==(c=null===O||void 0===O?void 0:O.pagination.totalItems)&&void 0!==c?c:0)})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(wc,{title:"Tags",link:"/server/".concat(x,"/manage-tags"),children:v?"Loading...":Pt(l.tags.length)})})]}),Object(W.jsxs)(qe.a,{className:"mb-3",children:[Object(W.jsxs)(Cc.a,{children:[Object(W.jsx)("span",{className:"d-sm-none",children:"Create a short URL"}),Object(W.jsx)("h5",{className:"d-none d-sm-inline",children:"Create a short URL"}),Object(W.jsx)(i.b,{className:"float-right",to:"/server/".concat(x,"/create-short-url"),children:"Advanced options \xbb"})]}),Object(W.jsx)(Nc.a,{children:Object(W.jsx)(t,{basicMode:!0})})]}),Object(W.jsxs)(qe.a,{children:[Object(W.jsxs)(Cc.a,{children:[Object(W.jsx)("span",{className:"d-sm-none",children:"Recently created URLs"}),Object(W.jsx)("h5",{className:"d-none d-sm-inline",children:"Recently created URLs"}),Object(W.jsx)(i.b,{className:"float-right",to:"/server/".concat(x,"/list-short-urls/1"),children:"See all \xbb"})]}),Object(W.jsx)(Nc.a,{children:Object(W.jsx)(e,{shortUrlsList:a,selectedServer:u,className:"mb-0",onTagClick:function(e){return y("/server/".concat(x,"/list-short-urls/1?tags=").concat(encodeURIComponent(e)))}})})]})]})}),(function(){return[Ye.visits,Ye.orphanVisits]}))},Tc=function(e,t,r,n){return function(c){var a=c.servers,s=Object.values(a),o=Object(P.useState)(s),l=Object(C.a)(o,2),u=l[0],d=l[1],j=u.some((function(e){return!!e.autoConnect})),b=r(!1,4e3),h=Object(C.a)(b,2),O=h[0],m=h[1];return Object(P.useEffect)((function(){d(Object.values(a))}),[a]),Object(W.jsxs)(Dn.a,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:function(e){return d(s.filter((function(t){var r=t.name,n=t.url;return"".concat(r," ").concat(n).match(e)})))}}),Object(W.jsxs)(vr.a,{className:"mb-3",children:[Object(W.jsxs)("div",{className:"col-md-6 d-flex d-md-block mb-2 mb-md-0",children:[Object(W.jsx)(t,{className:"flex-fill",onImportError:m,children:"Import servers"}),s.length>0&&Object(W.jsxs)(an.a,{outline:!0,className:"ml-2 flex-fill",onClick:Object(f.a)(v.a.mark((function t(){return v.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(W.jsx)(A.a,{icon:F.r,fixedWidth:!0})," Export servers"]})]}),Object(W.jsx)("div",{className:"col-md-6 text-md-right d-flex d-md-block",children:Object(W.jsxs)(an.a,{outline:!0,color:"primary",className:"flex-fill",tag:i.b,to:"/server/create",children:[Object(W.jsx)(A.a,{icon:F.F,fixedWidth:!0})," Add a server"]})})]}),Object(W.jsx)(fr.a,{children:Object(W.jsxs)("table",{className:"table table-hover mb-0",children:[Object(W.jsx)("thead",{className:"responsive-table__header",children:Object(W.jsxs)("tr",{children:[j&&Object(W.jsx)("th",{style:{width:"50px"}}),Object(W.jsx)("th",{children:"Name"}),Object(W.jsx)("th",{children:"Base URL"}),Object(W.jsx)("th",{})]})}),Object(W.jsxs)("tbody",{children:[!u.length&&Object(W.jsx)("tr",{className:"text-center",children:Object(W.jsx)("td",{colSpan:4,children:"No servers found."})}),u.map((function(e){return Object(W.jsx)(n,{server:e,hasAutoConnect:j},e.id)}))]})]})}),O&&Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsx)(mr,{type:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})}},Rc=function(e){return function(t){var r=t.server,n=t.hasAutoConnect;return Object(W.jsxs)("tr",{className:"responsive-table__row",children:[n&&Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Auto-connect",children:r.autoConnect&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{icon:F.h,className:"text-primary",id:"autoConnectIcon"}),Object(W.jsx)(Le.a,{target:"autoConnectIcon",placement:"right",children:"Auto-connect to this server"})]})}),Object(W.jsx)("th",{className:"responsive-table__cell","data-th":"Name",children:Object(W.jsx)(i.b,{to:"/server/".concat(r.id),children:r.name})}),Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Base URL",children:r.url}),Object(W.jsx)("td",{className:"responsive-table__cell text-right",children:Object(W.jsx)(e,{server:r})})]})}},Ec=function(e){return function(t){var r=t.server,n=t.setAutoConnect,c=Object(Y.f)(),a=Object(C.a)(c,2),s=a[0],o=a[1],l=Object(Y.f)(),u=Object(C.a)(l,4),d=u[0],j=u[2],b=u[3],h="/server/".concat(r.id),O=r.autoConnect,v=O?F.b:we.c;return Object(W.jsxs)(or,{isOpen:s,toggle:o,children:[Object(W.jsxs)(K.a,{tag:i.b,to:h,children:[Object(W.jsx)(A.a,{icon:F.E,fixedWidth:!0})," Connect"]}),Object(W.jsxs)(K.a,{tag:i.b,to:"".concat(h,"/edit"),children:[Object(W.jsx)(A.a,{icon:F.n,fixedWidth:!0})," Edit server"]}),Object(W.jsxs)(K.a,{onClick:function(){return n(r,!r.autoConnect)},children:[Object(W.jsx)(A.a,{icon:v,fixedWidth:!0})," ",O?"Do not a":"A","uto-connect"]}),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsxs)(K.a,{className:"dropdown-item--danger",onClick:j,children:[Object(W.jsx)(A.a,{icon:F.z,fixedWidth:!0})," Remove server"]}),Object(W.jsx)(e,{redirectHome:!1,server:r,isOpen:d,toggle:b})]})}},Dc=function(e){return"string"===typeof e.url&&"string"===typeof e.apiKey&&"string"===typeof e.name},Lc=function(e){return Array.isArray(e)&&e.every(Dc)},Vc=function e(t,r){var n=this;Object(m.a)(this,e),this.csvJson=t,this.fileReaderFactory=r,this.importServersFromFile=function(){var e=Object(f.a)(v.a.mark((function e(t){var r;return v.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(!Lc(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)}}()},Ic=r(94),Fc=function e(t,r,n){var c=this;Object(m.a)(this,e),this.storage=t,this.window=r,this.csvjson=n,this.exportServers=Object(f.a)(v.a.mark((function e(){var t,r,n;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object(Gn.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(h.f);try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(Ic.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))},Ac=function(e,t){e.serviceFactory("ManageServers",Tc,"ServersExporter","ImportServersBtn","useStateFlagTimeout","ManageServersRow"),e.decorator("ManageServers",t(["servers"])),e.serviceFactory("ManageServersRow",Rc,"ManageServersRowDropdown"),e.serviceFactory("ManageServersRowDropdown",Ec,"DeleteServerModal"),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.serviceFactory("CreateServer",Mn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",yc.a),e.decorator("CreateServer",t(["selectedServer","servers"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",qn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",(function(){return Pn})),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return Bn})),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",Hn,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",Qn,"ServersImporter"),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.serviceFactory("ForServerVersion",(function(){return xc})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",Sc,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",Uc,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",En.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",Vc,"csvjson","fileReaderFactory"),e.service("ServersExporter",Fc,"Storage","window","csvjson"),e.serviceFactory("selectServer",nc,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return hc})),e.serviceFactory("createServers",(function(){return bc})),e.serviceFactory("deleteServer",(function(){return vc})),e.serviceFactory("editServer",(function(){return Oc})),e.serviceFactory("setAutoConnect",(function(){return fc})),e.serviceFactory("fetchServers",gc,"axios"),e.serviceFactory("resetSelectedServer",(function(){return rc}))},Mc=r(570),Gc=r(541),Pc=r(542),Bc=r(543),Hc=function(){return Object(W.jsx)(Mc.a,{attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},Wc=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(b.a)("latLong"))}:{zoom:10,center:Object(C.a)(e,1)[0].latLong}},qc=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,a=void 0===c?[]:c;return Object(W.jsx)(dr.a,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(W.jsxs)(br.a,{className:"map-modal__modal-body",children:[Object(W.jsxs)("h3",{className:"map-modal__modal-title",children:[n,Object(W.jsx)("button",{type:"button",className:"close",onClick:t,children:"\xd7"})]}),Object(W.jsxs)(Gc.a,Object(u.a)(Object(u.a)({},Wc(a)),{},{children:[Object(W.jsx)(Hc,{}),a.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(W.jsx)(Pc.a,{position:n,children:Object(W.jsxs)(Bc.a,{children:[Object(W.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(W.jsx)("b",{children:r})]})},t)}))]}))]})})},zc=function(e){var t=e.visits,r=e.goBack,n=e.shortUrl,c=e.children,a=e.title;return Object(W.jsx)("header",{children:Object(W.jsxs)(qe.a,{body:!0,children:[Object(W.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(an.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:r,children:Object(W.jsx)(A.a,{icon:F.a})}),Object(W.jsx)("span",{className:"text-center d-none d-sm-block",children:Object(W.jsx)("small",{children:a})}),Object(W.jsxs)("span",{className:"badge badge-main ml-3",children:["Visits:"," ",Object(W.jsx)(ar,{visitsCount:t.length,shortUrl:n})]})]}),Object(W.jsx)("h3",{className:"text-center d-block d-sm-none mb-0 mt-3",children:Object(W.jsx)("small",{children:a})}),c&&Object(W.jsx)("div",{className:"mt-md-2",children:c})]})})},Kc=function(e){var t,r,n=e.shortUrlDetail,c=e.shortUrlVisits,a=e.goBack,s=n.shortUrl,i=n.loading,o=c.visits,l=null!==(t=null===s||void 0===s?void 0:s.shortUrl)&&void 0!==t?t:"",u=null!==(r=null===s||void 0===s?void 0:s.longUrl)&&void 0!==r?r:"",d=null===s||void 0===s?void 0:s.title,j=Object(W.jsxs)(W.Fragment,{children:["Visits for ",Object(W.jsx)(Zt.a,{href:l})]});return Object(W.jsxs)(zc,{title:j,goBack:a,visits:o,shortUrl:s,children:[Object(W.jsx)("hr",{}),Object(W.jsxs)("div",{children:["Created: ",s?Object(W.jsxs)("span",{children:[Object(W.jsx)("b",{id:"created",className:"short-url-visits-header__created-at",children:Object(W.jsx)(rr,{date:s.dateCreated,relative:!0})}),Object(W.jsx)(Le.a,{placement:"bottom",target:"created",children:Object(W.jsx)(rr,{date:s.dateCreated})})]}):Object(W.jsx)("small",{children:"Loading..."})]}),Object(W.jsxs)("div",{children:["".concat(d?"Title":"Long URL",": "),i&&Object(W.jsx)("small",{children:"Loading..."}),!i&&Object(W.jsx)(Zt.a,{href:u,children:null!==d&&void 0!==d?d:u})]})]})},Qc=r(556),Jc=r(557),Zc=r(509),Yc=r(507),Xc=function(e){var t=e.children,r=Object(g.a)(e,["children"]);return Object(W.jsx)(Zc.a,Object(u.a)(Object(u.a)({className:"nav-pills__nav-link",tag:i.c},r),{},{children:t}))},$c=function(e){var t=e.children,r=e.fill,n=void 0!==r&&r;return Object(W.jsx)(qe.a,{className:"nav-pills__nav p-0 overflow-hidden mb-3",body:!0,children:Object(W.jsx)(Yc.a,{pills:!0,fill:n,children:P.Children.map(t,(function(e){if(!Object(P.isValidElement)(e)||e.type!==Xc)throw new Error("Only NavPillItem children are allowed inside NavPills.");return e}))})})},ea=r(103),ta=r(548),ra=r(549),na=r(551),ca=r(545),aa=r(262),sa=r(546),ia=r(280),oa=r(86),la=r(547),ua=r(550),da=r(261),ja=r.n(da),ba=r(544),ha="Others",Oa=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],va=function(e){var t,r;return Object(Or.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"},fa=function(e,t){return Object.values(Object(u.a)(Object(u.a)({},Object(ba.a)(t,t.map((function(){return 0})))),e))},ma=function(e,t){var r=e.native,n=Object(C.a)(t,1)[0];null!==r&&void 0!==r&&r.target&&(r.target.style.cursor=n?"pointer":"default")},ga=function(e){var t=e.dataset,r=e.formattedValue;return"".concat(t.label,": ").concat(Pt(r))},xa=function(e){var t=e.label,r=e.formattedValue;return"".concat(t,": ").concat(Pt(r))},pa=r(44),Sa={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},ya={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},Ca={hourly:ca.a,daily:aa.a,weekly:sa.a,monthly:ia.a},Na={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(oa.a)(e),"yyyy-MM-dd"),r=Object(ae.default)(Object(la.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(ae.default)(e,"yyyy-MM")}},ka=function(e,t){return Object(ra.a)((function(t){return Na[e](Object(G.default)(t.date))}),t)},_a=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=Ca[e],n=Na[e],c=Object(G.default)(t[0].date),a=Object(G.default)(t[t.length-1].date),s=r(c,a),i=ya[e];return[n(a)].concat(Object(We.a)(Object(Or.e)(s,(function(e){return n(Object(ua.a)(a,i(e)))}))))}(r,e);return[c,fa(t,c)]},wa=function(e,t,r){return{label:t,data:e,fill:!1,tension:.2,borderColor:r,backgroundColor:r}},Ua=null,Ta=function(e,t,r){return function(n){var c=Object(C.a)(n,1)[0];if(r&&c){var a,s=c.index;if(Ua===e[s])r([]),Ua=null;else r(e[s]&&t[e[s]]||[]),Ua=null!==(a=e[s])&&void 0!==a?a:null}}},Ra=function(e){var t=e.title,r=e.visits,n=e.highlightedVisits,c=e.highlightedLabel,a=void 0===c?"Selected":c,s=e.setSelectedVisits,i=Object(P.useState)(r.length>0?function(e){var t,r=new Date,n=Object(G.default)(e);return null!==(t=Object(ne.a)([[function(){return Object(aa.a)(r,n)<=2},Object(ta.a)("hourly")],[function(){return Object(ia.a)(r,n)<=1},Object(ta.a)("daily")],[function(){return Object(ia.a)(r,n)<=6},Object(ta.a)("weekly")]])())&&void 0!==t?t:"monthly"}(r[r.length-1].date):"monthly"),o=Object(C.a)(i,2),l=o[0],u=o[1],d=Object(Y.f)(!0),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(P.useMemo)((function(){return function(e,t){return t.reduce((function(t,r){var n,c=Na[e](Object(G.default)(r.date));return t[c]=null!==(n=t[c])&&void 0!==n?n:[],t[c].push(r),t}),{})}(l,r)}),[l,r]),v=Object(P.useMemo)((function(){return ka(l,Object(na.a)(r))}),[l,r]),f=Object(P.useMemo)((function(){return _a(r,v,l,b)}),[r,l,b]),m=Object(C.a)(f,2),g=m[0],x=m[1],p=Object(P.useMemo)((function(){return fa(ka(l,Object(na.a)(n)),g)}),[n,l,g]),S=function(){var e=wa(x,"Visits",pa.c);return 0===n.length?[e]:[e,wa(p,a,pa.a)]},y={maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{intersect:!1,axis:"x",callbacks:{label:ga}}},scales:{y:{beginAtZero:!0,ticks:{precision:0,callback:Pt}},x:{title:{display:!0,text:Sa[l]}}},onHover:ma},N=function(){return Object(W.jsx)(ea.c,{data:{labels:g,datasets:S()},options:y,getElementAtEvent:Ta(g,O,s)})};return Object(W.jsxs)(qe.a,{children:[Object(W.jsxs)(Cc.a,{children:[t,Object(W.jsx)("div",{className:"float-right",children:Object(W.jsxs)(ze.a,{children:[Object(W.jsx)(J.a,{caret:!0,color:"link",className:"btn-sm p-0",children:"Group by"}),Object(W.jsx)(Z.a,{right:!0,children:Object.entries(Sa).map((function(e){var t=Object(C.a)(e,2),r=t[0],n=t[1];return Object(W.jsx)(K.a,{active:l===r,onClick:function(){return u(r)},children:n},r)}))})]})}),Object(W.jsx)("div",{className:"float-right mr-2",children:Object(W.jsx)(Ae,{checked:b,onChange:h,children:Object(W.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(W.jsxs)(Nc.a,{className:"line-chart-card__body",children:[n.length>0&&N(),0===n.length&&N()]})]})},Ea=r(552),Da=function(e){var t=e.pagesCount,r=e.currentPage,n=e.setCurrentPage,c=e.centered,a=void 0===c||c;if(t<2)return null;var s=function(e){return function(){return!Wt(e)&&n(e)}};return Object(W.jsxs)(Vt.a,{listClassName:H()("flex-wrap mb-0 simple-paginator",{"justify-content-center":a}),children:[Object(W.jsx)(Dt.a,{disabled:r<=1,children:Object(W.jsx)(Lt.a,{previous:!0,tag:"span",onClick:s(r-1)})}),Ht(r,t).map((function(e,t){return Object(W.jsx)(Dt.a,{disabled:Wt(e),active:r===e,children:Object(W.jsx)(Lt.a,{tag:"span",onClick:s(e),children:qt(e)})},zt(e,t))})),Object(W.jsx)(Dt.a,{disabled:r>=t,children:Object(W.jsx)(Lt.a,{next:!0,tag:"span",onClick:s(r+1)})})]})},La=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(g.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)}))},Va=function(e,t,r){var n=function(e,t){return k(t,e)}(r,t?La(t,e):Object(We.a)(e)),c=n.length;return{visitsGroups:Object(Ea.a)(20,n),total:c}},Ia=function(e){var t,r,n=e.visits,c=e.selectedVisits,a=void 0===c?[]:c,s=e.setSelectedVisits,i=e.selectedServer,o=e.matchMedia,l=void 0===o?window.matchMedia:o,u=e.isOrphanVisits,d=void 0!==u&&u,j="visits-table__header-cell visits-table__sticky",b=function(){return l("(max-width: 767px)").matches},h=Object(P.useState)(b()),O=Object(C.a)(h,2),v=O[0],f=O[1],m=Object(P.useState)(void 0),g=Object(C.a)(m,2),x=g[0],p=g[1],S=Object(P.useState)({}),y=Object(C.a)(S,2),k=y[0],_=y[1],w=Object(P.useMemo)((function(){return Va(n,x,k)}),[x,k]),U=Object(P.useRef)(!0),T=Object(P.useState)(1),R=Object(C.a)(T,2),E=R[0],D=R[1],L=20*E,V=L-20,I=Object(De.b)(i),M=7+Number(I)+Number(d),G=function(e){return function(){return _({field:e,dir:N(e,k.field,k.dir)})}},B=function(e){return Object(W.jsx)(Xe,{currentOrder:k,field:e,className:"visits-table__header-icon"})};return Object(P.useEffect)((function(){var e=function(){return f(b())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),Object(P.useEffect)((function(){D(1),!U.current&&s([]),U.current=!1}),[x]),Object(W.jsxs)("table",{className:"table table-bordered table-hover table-sm table-responsive-sm visits-table",children:[Object(W.jsxs)("thead",{className:"visits-table__header",children:[Object(W.jsxs)("tr",{children:[Object(W.jsx)("th",{className:"".concat(j," text-center"),onClick:function(){return s(a.length<w.total?w.visitsGroups.flat():[])},children:Object(W.jsx)(A.a,{icon:F.h,className:H()({"text-primary":a.length>0})})}),I&&Object(W.jsxs)("th",{className:"".concat(j," text-center"),onClick:G("potentialBot"),children:[Object(W.jsx)(A.a,{icon:F.H}),B("potentialBot")]}),Object(W.jsxs)("th",{className:j,onClick:G("date"),children:["Date",B("date")]}),Object(W.jsxs)("th",{className:j,onClick:G("country"),children:["Country",B("country")]}),Object(W.jsxs)("th",{className:j,onClick:G("city"),children:["City",B("city")]}),Object(W.jsxs)("th",{className:j,onClick:G("browser"),children:["Browser",B("browser")]}),Object(W.jsxs)("th",{className:j,onClick:G("os"),children:["OS",B("os")]}),Object(W.jsxs)("th",{className:j,onClick:G("referer"),children:["Referrer",B("referer")]}),d&&Object(W.jsxs)("th",{className:j,onClick:G("visitedUrl"),children:["Visited URL",B("visitedUrl")]})]}),Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,className:"p-0",children:Object(W.jsx)(q,{noBorder:!0,large:!1,onChange:p})})})]}),Object(W.jsxs)("tbody",{children:[!(null!==(t=w.visitsGroups[E-1])&&void 0!==t&&t.length)&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,className:"text-center",children:"No visits found with current filtering"})}),null===(r=w.visitsGroups[E-1])||void 0===r?void 0:r.map((function(e,t){var r=a.includes(e);return Object(W.jsxs)("tr",{style:{cursor:"pointer"},className:H()({"table-active":r}),onClick:function(){return s(r?a.filter((function(t){return t!==e})):[].concat(Object(We.a)(a),[e]))},children:[Object(W.jsx)("td",{className:"text-center",children:r&&Object(W.jsx)(A.a,{icon:F.h,className:"text-primary"})}),I&&Object(W.jsx)("td",{className:"text-center",children:e.potentialBot&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{icon:F.H,id:"botIcon".concat(t)}),Object(W.jsx)(Le.a,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(W.jsx)("td",{children:Object(W.jsx)(rr,{date:e.date})}),Object(W.jsx)("td",{children:e.country}),Object(W.jsx)("td",{children:e.city}),Object(W.jsx)("td",{children:e.browser}),Object(W.jsx)("td",{children:e.os}),Object(W.jsx)("td",{children:e.referer}),d&&Object(W.jsx)("td",{children:e.visitedUrl})]},t)}))]}),w.total>20&&Object(W.jsx)("tfoot",{children:Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:M,className:"visits-table__footer-cell visits-table__sticky",children:Object(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-md-6",children:Object(W.jsx)(Da,{pagesCount:Math.ceil(w.total/20),currentPage:E,setCurrentPage:D,centered:v})}),Object(W.jsx)("div",{className:H()("col-md-6",{"d-flex align-items-center flex-row-reverse":!v,"text-center mt-3":v}),children:Object(W.jsxs)("div",{children:["Visits ",Object(W.jsx)("b",{children:Pt(V+1)})," to"," ",Object(W.jsx)("b",{children:Pt(Object(At.a)(L,w.total))})," of"," ",Object(W.jsx)("b",{children:Pt(w.total)})]})})]})})})})]})},Fa=function(e){var t=e.modalTitle,r=e.activeCities,n=e.locations,c=void 0===n?[]:n,a=Object(Y.f)(),s=Object(C.a)(a,4),i=s[0],o=s[2],l=s[3],u=Object(Y.f)(),d=Object(C.a)(u,3),j=d[0],b=d[1],h=d[2],O=Object(P.useState)([]),v=Object(C.a)(O,2),f=v[0],m=v[1],g=Object(P.useRef)(),x=function(e){return function(){m(e?c.filter((function(e){var t=e.cityName;return r.includes(t)})):c),o()}};return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("button",{className:"btn btn-link open-map-modal-btn__btn",ref:g,onClick:function(){if(!r)return m(c),void o();h()},children:Object(W.jsx)(A.a,{icon:F.y})}),Object(W.jsx)(Le.a,{placement:"left",target:function(){return g.current},children:"Show in map"}),Object(W.jsx)(Q.a,{isOpen:j,toggle:b,inNavbar:!0,children:Object(W.jsxs)(Z.a,{right:!0,children:[Object(W.jsx)(K.a,{onClick:x(!1),children:"Show all locations"}),Object(W.jsx)(K.a,{onClick:x(!0),children:"Show locations in current page"})]})}),Object(W.jsx)(qc,{toggle:l,isOpen:i,title:t,locations:f})]})},Aa=r(553),Ma=function(e){return e.hasOwnProperty("visitedUrl")},Ga=Object(M.a)(Object(Aa.a)((function(e){return Ma(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(u.a)({orphanVisits:[],regularVisits:[]},e)})),Pa=function(e,t){return Object(ra.a)(Object(b.a)(t),e)},Ba=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}},Ha=function(e,t){return!Object(p.a)(e)&&Object(Or.c)(e[t])},Wa=function(e){return"number"===typeof e?e:e?parseFloat(e):0},qa=function(e){return function(t,r){var n=Ha(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},za=qa("country"),Ka=qa("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),za(e.countries,t),Ka(e.cities,t),function(e,t){if(Ha(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[Wa(n),Wa(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:{}})},Ja=Object(sc.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(u.a)(Object(u.a)({date:r,potentialBot:s},function(e){if(!Object(Or.c)(e))return{browser:ha,os:ha};var t=ja.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:ha,browser:r&&Oa.includes(r)?r:ha}}(t)),{},{referer:va(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 Ma(e)?Object(u.a)(Object(u.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Za=function(e){var t=e.onChange,r=e.selected,n=void 0===r?{}:r,c=e.className,a=e.isOrphanVisits,s=e.botsSupported;if(!s&&!a)return null;var i=n.orphanVisitsType,o=n.excludeBots,l=void 0!==o&&o,d=function(e){return{active:i===e,onClick:function(){return t(Object(u.a)(Object(u.a)({},n),{},{orphanVisitsType:e===(null===n||void 0===n?void 0:n.orphanVisitsType)?void 0:e}))}}};return Object(W.jsxs)(X,{text:"Filters",dropdownClassName:c,className:"mr-3",right:!0,minWidth:250,children:[s&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.a,{header:!0,children:"Bots:"}),Object(W.jsx)(K.a,{active:l,onClick:function(){return t(Object(u.a)(Object(u.a)({},n),{},{excludeBots:!(null!==n&&void 0!==n&&n.excludeBots)}))},children:"Exclude potential bots"})]}),s&&a&&Object(W.jsx)(K.a,{divider:!0}),a&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(K.a,{header:!0,children:"Orphan visits type:"}),Object(W.jsx)(K.a,Object(u.a)(Object(u.a)({},d("base_url")),{},{children:"Base URL"})),Object(W.jsx)(K.a,Object(u.a)(Object(u.a)({},d("invalid_short_url")),{},{children:"Invalid short URL"})),Object(W.jsx)(K.a,Object(u.a)(Object(u.a)({},d("regular_404")),{},{children:"Regular 404"}))]}),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsx)(K.a,{disabled:!Object(Or.c)(n),onClick:function(){return t({})},children:Object(W.jsx)("i",{children:"Clear filters"})})]})},Ya=r(58),Xa=function(e){var t,r,n=e.chart.config,c=null!==(t=n.data)&&void 0!==t?t:{},a=c.labels,s=void 0===a?[]:a,i=c.datasets,o=void 0===i?[]:i,l=Object(C.a)(o,1)[0].backgroundColor,u=(null!==(r=n.options)&&void 0!==r?r:{}).defaultColor;return Object(W.jsx)("ul",{className:"doughnut-chart-legend",children:s.map((function(e,t){var r;return Object(W.jsxs)("li",{className:"doughnut-chart-legend__item d-flex",children:[Object(W.jsx)("div",{className:"doughnut-chart-legend__item-color",style:{backgroundColor:null!==(r=l[t])&&void 0!==r?r:u}}),Object(W.jsx)("small",{className:"doughnut-chart-legend__item-text flex-fill",children:e})]},e)}))})},$a=function(e){return[{data:e,backgroundColor:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:Object(pa.h)()?pa.e:pa.f,borderWidth:2}]},es=Object(P.memo)((function(e){var t=e.stats,r=Object(P.useState)(),n=Object(C.a)(r,2),c=n[0],a=n[1],s=Object(Ya.a)(t),i=Object(Gn.a)(t),o={plugins:{legend:{display:!1},tooltip:{intersect:!0,callbacks:{label:xa}}}},l=function(e,t){return{labels:e,datasets:$a(t)}}(s,i);return Object(W.jsxs)("div",{className:"row",children:[Object(W.jsx)("div",{className:"col-sm-12 col-md-7",children:Object(W.jsx)(ea.b,{height:300,data:l,options:o,ref:function(e){a(null!==e&&void 0!==e?e:void 0)}})}),Object(W.jsx)("div",{className:"col-sm-12 col-md-5",children:c&&Object(W.jsx)(Xa,{chart:c})})]})})),ts=r(554),rs=function(e){var t=e.title,r=e.footer,n=e.children;return Object(W.jsxs)(qe.a,{children:[Object(W.jsx)(Cc.a,{className:"chart-card__header",children:"function"===typeof t?t():t}),Object(W.jsx)(Nc.a,{children:n}),r&&Object(W.jsx)(ts.a,{className:"chart-card__footer--sticky",children:r})]})},ns=function(e){var t=e.title,r=e.stats;return Object(W.jsx)(rs,{title:t,children:Object(W.jsx)(es,{stats:r})})},cs=r(116),as=r(562),ss=r(555),is=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(W.jsxs)(ze.a,{children:[Object(W.jsx)(J.a,{caret:!0,color:"link",className:t,children:"Paginate"}),Object(W.jsxs)(Z.a,{right:!0,children:[r.map((function(e){return Object(W.jsxs)(K.a,{active:e===n,onClick:function(){return c(e)},children:[Object(W.jsx)("b",{children:e})," items per page"]},e)})),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsx)(K.a,{disabled:n===1/0,onClick:function(){return c(1/0)},children:Object(W.jsx)("i",{children:"Clear pagination"})})]})]})},os=function(e){return e.startsWith("hidden")?"":e},ls=function(e,t,r){var n={data:e,label:r?"Non-selected":"Visits",backgroundColor:pa.d,borderColor:pa.c,borderWidth:2};return t.every((function(e){return 0===e}))?[n]:[n,{label:null!==r&&void 0!==r?r:"Selected",data:t,backgroundColor:pa.b,borderColor:pa.a,borderWidth:2}]},us=function(e,t){return function(r){var n=Object(C.a)(r,1)[0];t&&n&&t(e[n.index])}},ds=function(e){var t=e.stats,r=e.highlightedStats,n=e.highlightedLabel,c=e.onClick,a=e.max,s=Object(Ya.a)(t).map(os),i=Object(Gn.a)(function(e){return!!e&&Object.keys(e).length>0}(r)?Object(Ya.a)(r).reduce((function(e,t){return e[t]&&(e[t]-=r[t]),e}),Object(u.a)({},t)):t),o=fa(null!==r&&void 0!==r?r:{},s),l={plugins:{legend:{display:!1},tooltip:{mode:"y",filter:function(e){return""!==e.label},callbacks:{label:ga}}},scales:{x:{beginAtZero:!0,stacked:!0,max:a,ticks:{precision:0,callback:Pt}},y:{stacked:!0}},onHover:ma,indexAxis:"y"},d=function(e,t,r,n){return{labels:e,datasets:ls(t,r,n)}}(s,i,o,n),j=function(e){return e.length>20?10*e.length:void 0}(s),b=function(e){return Object(W.jsx)(ea.a,{data:d,options:l,height:j,getElementAtEvent:us(s,c)},"".concat(j,"_").concat(e))};return Object(W.jsxs)(W.Fragment,{children:[void 0!==r&&b("with_stats"),void 0===r&&b("without_stats")]})},js=function(e){return"String"===Object(cs.a)(e)?Object(as.a)(e):e},bs=function(e){return Object(C.a)(e,1)[0]},hs=function(e){return Object(C.a)(e,2)[1]},Os=function(e){var t=e.stats,r=e.highlightedStats,n=e.title,c=e.sortingItems,a=e.extraHeaderContent,s=e.withPagination,i=void 0===s||s,o=Object(g.a)(e,["stats","highlightedStats","title","sortingItems","extraHeaderContent","withPagination"]),l=Object(P.useState)({}),d=Object(C.a)(l,2),j=d[0],b=d[1],h=Object(P.useState)(1),O=Object(C.a)(h,2),v=O[0],f=O[1],m=Object(P.useState)(50),x=Object(C.a)(m,2),p=x[0],S=x[1],y=function(e){var t=e[v-1];if(v<e.length)return t;var r=e[0].length;return[].concat(Object(We.a)(t),Object(We.a)(Object(Or.e)(r-t.length,(function(e){return["hidden_".concat(e),0]}))))},N=function(e,t,r){var n=function(e,t){var r=Object(Ke.a)(e),n=j.field?Object(ss.a)(Object(M.a)(j.field===Object.keys(t)[0]?bs:hs,js),r):r;return j.dir&&"ASC"!==j.dir?Object(na.a)(n):n}(e,r),c=n.map(bs),a=t&&Object(Ke.a)(Object(u.a)(Object(u.a)({},Object(ba.a)(c,c.map((function(){return 0})))),t));if(n.length<=p)return{currentPageStats:Object(cc.a)(n),currentPageHighlightedStats:a&&Object(cc.a)(a)};var s,i,o=Object(Ea.a)(p,n),l=a&&Object(Ea.a)(p,a);return{currentPageStats:Object(cc.a)(y(o)),currentPageHighlightedStats:l&&Object(cc.a)(y(l)),pagination:(i=o.length,Object(W.jsx)(Da,{currentPage:v,pagesCount:i,setCurrentPage:f})),max:(s=Math.max.apply(Math,Object(We.a)(n.map(hs))),10*Mt(s/10))}}(t,r&&Object.keys(r).length>0?r:void 0,c),k=N.currentPageStats,_=N.currentPageHighlightedStats,w=N.pagination,U=N.max,T=Object.keys(k);return Object(W.jsx)(rs,{title:function(){return Object(W.jsxs)(W.Fragment,{children:[n,Object(W.jsx)("div",{className:"float-right",children:Object(W.jsx)(Qe,{isButton:!1,right:!0,items:c,order:j,onChange:function(e,t){b({field:e,dir:t}),f(1)}})}),i&&Object.keys(t).length>50&&Object(W.jsx)("div",{className:"float-right",children:Object(W.jsx)(is,{toggleClassName:"btn-sm p-0 mr-3",ranges:[50,100,200,500],value:p,setValue:function(e){S(e),f(1)}})}),a&&Object(W.jsx)("div",{className:"float-right",children:a(w?T:void 0)})]})},footer:w,children:Object(W.jsx)(ds,Object(u.a)({stats:k,highlightedStats:_,max:U},o))})},vs={byTime:{title:"By time",subPath:"by-time",icon:F.d},byContext:{title:"By context",subPath:"by-context",icon:F.g},byLocation:{title:"By location",subPath:"by-location",icon:F.y},list:{title:"List",subPath:"list",icon:F.x}},fs=function(e){var t,r,n=e.children,c=e.visitsInfo,a=e.getVisits,s=e.cancelGetVisits,i=e.domain,o=e.settings,l=e.exportCsv,u=e.selectedServer,d=e.isOrphanVisits,j=void 0!==d&&d,b=c.visits,h=c.loading,O=c.loadingLarge,v=c.error,f=c.errorData,m=c.progress,g=c.fallbackInterval,x=Object(P.useState)(null!==(t=null!==g&&void 0!==g?g:null===(r=o.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days"),p=Object(C.a)(x,2),y=p[0],N=p[1],k=Object(P.useState)(Ce(y)),_=Object(C.a)(k,2),w=_[0],U=_[1],T=Object(P.useState)([]),R=Object(C.a)(T,2),E=R[0],D=R[1],L=Object(P.useState)(),V=Object(C.a)(L,2),I=V[0],M=V[1],G=Object(P.useState)({}),B=Object(C.a)(G,2),q=B[0],z=B[1],K=Object(De.b)(u),Q=Object(P.useRef)(!0),J=function(e){var t=i?"?domain=".concat(i):"";return e?"".concat(e).concat(t):"".concat(t)},Z=Object(P.useMemo)((function(){return Ja(b)}),[b]),Y=Object(P.useMemo)((function(){return Qa(Z)}),[Z]),X=Y.os,$=Y.browsers,ee=Y.referrers,te=Y.countries,re=Y.cities,ne=Y.citiesForMap,ce=Y.visitedUrls,ae=Object(Gn.a)(ne),se=function(e){st=void 0,D(e)},ie=function(e){return function(t){var r="".concat(e,"_").concat(t);st===r?(D([]),M(void 0),st=void 0):(D(Z.filter(Object(Qc.a)(e,t))),M(t),st=r)}};Object(P.useEffect)((function(){return s}),[]),Object(P.useEffect)((function(){a({dateRange:w,filter:q},Q.current),Q.current=!1}),[w,q]),Object(P.useEffect)((function(){g&&N(g)}),[g]);return Object(W.jsxs)(W.Fragment,{children:[n,Object(W.jsx)("section",{className:"mt-3",children:Object(W.jsxs)("div",{className:"row flex-md-row-reverse",children:[Object(W.jsx)("div",{className:"col-lg-7 col-xl-6",children:Object(W.jsxs)("div",{className:"d-md-flex",children:[Object(W.jsx)("div",{className:"flex-fill",children:Object(W.jsx)(Ee,{updatable:!0,disabled:h,initialDateRange:y,defaultText:"All visits",onDatesChange:U})}),Object(W.jsx)(Za,{className:"ml-0 ml-md-2 mt-3 mt-md-0",isOrphanVisits:j,botsSupported:K,selected:q,onChange:z})]})}),b.length>0&&Object(W.jsx)("div",{className:"col-lg-5 col-xl-6 mt-3 mt-lg-0",children:Object(W.jsxs)("div",{className:"d-flex",children:[Object(W.jsxs)(an.a,{outline:!0,disabled:0===E.length,className:"btn-md-block mr-2",onClick:function(){return se([])},children:["Clear selection ",E.length>0&&Object(W.jsxs)(W.Fragment,{children:["(",Pt(E.length),")"]})]}),Object(W.jsxs)(an.a,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return l(Z)},children:[Object(W.jsx)(A.a,{icon:F.r})," Export (",Pt(Z.length),")"]})]})})]})}),Object(W.jsx)("section",{className:"mt-3",children:O?Object(W.jsxs)(Sn.a,{loading:!0,children:["This is going to take a while... :S",Object(W.jsx)(Jc.a,{value:m,striped:100===m,className:"mt-3"})]}):h?Object(W.jsx)(Sn.a,{loading:!0}):v?Object(W.jsx)(mr,{type:"error",children:Object(W.jsx)(pr,{errorData:f,fallbackMessage:"An error occurred while loading visits :("})}):Object(S.a)(b)?Object(W.jsx)(Sn.a,{children:"There are no visits matching current filter :("}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)($c,{fill:!0,children:Object.values(vs).map((function(e,t){var r=e.title,n=e.icon,c=e.subPath;return Object(W.jsxs)(Xc,{to:J(c),replace:!0,children:[Object(W.jsx)(A.a,{icon:n}),Object(W.jsx)("span",{className:"ml-2 d-none d-sm-inline",children:r})]},t)}))}),Object(W.jsx)(vr.a,{children:Object(W.jsxs)(Ge.d,{children:[Object(W.jsx)(Ge.b,{path:vs.byTime.subPath,element:Object(W.jsx)("div",{className:"col-12 mt-3",children:Object(W.jsx)(Ra,{title:"Visits during time",visits:Z,highlightedVisits:E,highlightedLabel:I,setSelectedVisits:se})})}),Object(W.jsx)(Ge.b,{path:vs.byContext.subPath,element:Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:H()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(W.jsx)(ns,{title:"Operating systems",stats:X})}),Object(W.jsx)("div",{className:H()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(W.jsx)(ns,{title:"Browsers",stats:$})}),Object(W.jsx)("div",{className:H()("mt-3",{"col-xl-4":!j,"col-lg-6":j}),children:Object(W.jsx)(Os,{title:"Referrers",stats:ee,withPagination:!1,highlightedStats:Pa(E,"referer"),highlightedLabel:I,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:ie("referer")})}),j&&Object(W.jsx)("div",{className:"mt-3 col-lg-6",children:Object(W.jsx)(Os,{title:"Visited URLs",stats:ce,highlightedLabel:I,highlightedStats:Pa(E,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:ie("visitedUrl")})})]})}),Object(W.jsx)(Ge.b,{path:vs.byLocation.subPath,element:Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:"col-lg-6 mt-3",children:Object(W.jsx)(Os,{title:"Countries",stats:te,highlightedStats:Pa(E,"country"),highlightedLabel:I,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:ie("country")})}),Object(W.jsx)("div",{className:"col-lg-6 mt-3",children:Object(W.jsx)(Os,{title:"Cities",stats:re,highlightedStats:Pa(E,"city"),highlightedLabel:I,extraHeaderContent:function(e){return ae.length>0&&Object(W.jsx)(Fa,{modalTitle:"Cities",locations:ae,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:ie("city")})})]})}),Object(W.jsx)(Ge.b,{path:vs.list.subPath,element:Object(W.jsx)("div",{className:"col-12",children:Object(W.jsx)(Ia,{visits:Z,selectedVisits:E,setSelectedVisits:se,isOrphanVisits:j,selectedServer:u})})}),Object(W.jsx)(Ge.b,{path:"*",element:Object(W.jsx)(Ge.a,{replace:!0,to:J(vs.byTime.subPath)})})]})})]})})]})},ms=function(e){var t=e.exportVisits;return Ze((function(e){var r=e.shortUrlVisits,n=e.shortUrlDetail,c=e.getShortUrlVisits,a=e.getShortUrlDetail,s=e.cancelGetShortUrlVisits,i=e.settings,o=e.selectedServer,l=Object(Ge.h)().shortCode,d=void 0===l?"":l,j=Object(Ge.f)().search,b=Object(Y.b)(),h=Object(y.a)(j).domain;return Object(P.useEffect)((function(){a(d,h)}),[]),Object(W.jsx)(fs,{getVisits:function(e,t){return c(d,Object(u.a)(Object(u.a)({},Ba(e)),{},{domain:h}),t)},cancelGetVisits:s,visitsInfo:r,domain:h,settings:i,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:o,children:Object(W.jsx)(Kc,{shortUrlDetail:n,shortUrlVisits:r,goBack:b})})}),(function(e,t){return[Ye.shortUrlVisits(t.shortCode)]}))},gs=function(e){var t=e.tagVisits,r=e.goBack,n=e.colorGenerator,c=t.visits,a=t.tag,s=Object(W.jsxs)("span",{className:"d-flex align-items-center justify-content-center",children:[Object(W.jsx)("span",{className:"mr-2",children:"Visits for"}),Object(W.jsx)(z,{text:a,colorGenerator:n})]});return Object(W.jsx)(zc,{title:s,goBack:r,visits:c})},xs=function(e,t){var r=t.exportVisits;return Ze((function(t){var n=t.getTagVisits,c=t.tagVisits,a=t.cancelGetTagVisits,s=t.settings,i=t.selectedServer,o=Object(Y.b)(),l=Object(Ge.h)().tag,u=void 0===l?"":l;return Object(W.jsx)(fs,{getVisits:function(e,t){return n(u,Ba(e),t)},cancelGetVisits:a,visitsInfo:c,settings:s,exportCsv:function(e){return r("tag_".concat(u,"_visits.csv"),e)},selectedServer:i,children:Object(W.jsx)(gs,{tagVisits:c,goBack:o,colorGenerator:e})})}),(function(){return[Ye.visits]}))},ps=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(zc,{title:"Orphan visits",goBack:r,visits:n})},Ss=function(e){var t=e.exportVisits;return Ze((function(e){var r=e.getOrphanVisits,n=e.orphanVisits,c=e.cancelGetOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Y.b)();return Object(W.jsx)(fs,{getVisits:function(e,t){var n;return r(Ba(e),null===(n=e.filter)||void 0===n?void 0:n.orphanVisitsType,t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("orphan_visits.csv",e)},selectedServer:s,isOrphanVisits:!0,children:Object(W.jsx)(ps,{orphanVisits:n,goBack:i})})}),(function(){return[Ye.orphanVisits]}))},ys=function(e){var t=e.nonOrphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(zc,{title:"Non-orphan visits",goBack:r,visits:n})},Cs=function(e){var t=e.exportVisits;return Ze((function(e){var r=e.getNonOrphanVisits,n=e.nonOrphanVisits,c=e.cancelGetNonOrphanVisits,a=e.settings,s=e.selectedServer,i=Object(Y.b)();return Object(W.jsx)(fs,{getVisits:function(e,t){return r(Ba(e),t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("non_orphan_visits.csv",e)},selectedServer:s,children:Object(W.jsx)(ys,{nonOrphanVisits:n,goBack:i})})}),(function(){return[Ye.visits]}))},Ns=r(568),ks=5e3,_s=function(e){return e.currentPage>=e.pagesCount},ws=function(e,t){return 100*t/e},Us=function(){var e=Object(f.a)(v.a.mark((function e(t,r,n,c,a,s){var i,o,l,d,j,h,O;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a({type:c.start}),i=function(){var e=Object(f.a)(v.a.mark((function e(r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(r.map(function(){var e=Object(f.a)(v.a.mark((function e(r){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(r,ks).then(Object(b.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(Ns.a));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=function(){var e=Object(f.a)(v.a.mark((function e(t){var r,n,l=arguments;return v.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:ws(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(f.a)(v.a.mark((function e(){var r,n,s,i,l,u,d=arguments;return v.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,ks);case 3:if(n=e.sent,s=n.pagination,i=n.data,s&&!_s(s)){e.next=8;break}return e.abrupt("return",i);case 8:return l=Object(It.a)(2,s.pagesCount+1),u=Object(Ea.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:d=e.sent,j=Object(C.a)(d,2),h=j[0],O=j[1],a(!h.length&&O?{type:c.fallbackToInterval,fallbackInterval:Ne(O.date)}:Object(u.a)(Object(u.a)({},n),{},{visits:h,type:c.finish})),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),a({type:c.error,errorData:gr(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)}}(),Ts=function(e,t){return e?Object(f.a)(v.a.mark((function e(){return v.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(f.a)(v.a.mark((function e(){return v.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)})))},Rs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",Es="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",Ds="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",Ls="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",Vs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",Is="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",Fs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL",As={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Ms=xt((it={},Object(l.a)(it,Rs,(function(){return Object(u.a)(Object(u.a)({},As),{},{loading:!0})})),Object(l.a)(it,Es,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},As),{},{error:!0,errorData:r})})),Object(l.a)(it,Ds,(function(e,t){var r=t.visits,n=t.query,c=t.shortCode,a=t.domain;return Object(u.a)(Object(u.a)({},e),{},{visits:r,shortCode:c,domain:a,query:n,loading:!1,error:!1})})),Object(l.a)(it,Ls,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(it,Vs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(it,Is,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(it,Fs,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(it,Ur,(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,d=r.filter((function(e){var t=e.shortUrl,r=e.visit;return t&&wr(t,n,c)&&Oe(r.date,o,l)})).map((function(e){return e.visit}));return 0===d.length?e:Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(We.a)(d),Object(We.a)(a))})})),it),As),Gs=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(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getShortUrlVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=Ts(n,function(){var e=Object(f.a)(v.a.mark((function e(n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.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:Rs,large:Ls,finish:Ds,error:Es,progress:Is,fallbackToInterval:Fs},c.abrupt("return",Us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ps=pt(Vs),Bs="shlink/tagVisits/GET_TAG_VISITS_START",Hs="shlink/tagVisits/GET_TAG_VISITS_ERROR",Ws="shlink/tagVisits/GET_TAG_VISITS",qs="shlink/tagVisits/GET_TAG_VISITS_LARGE",zs="shlink/tagVisits/GET_TAG_VISITS_CANCEL",Ks="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",Qs="shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL",Js={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Zs=xt((ot={},Object(l.a)(ot,Bs,(function(){return Object(u.a)(Object(u.a)({},Js),{},{loading:!0})})),Object(l.a)(ot,Hs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Js),{},{error:!0,errorData:r})})),Object(l.a)(ot,Ws,(function(e,t){var r=t.visits,n=t.tag,c=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,tag:n,query:c,loading:!1,error:!1})})),Object(l.a)(ot,qs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(ot,zs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(ot,Ks,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(ot,Qs,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(ot,Ur,(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(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(We.a)(l),Object(We.a)(c))})})),ot),Js),Ys=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(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getTagVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(t,Object(u.a)(Object(u.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=Ts(n,function(){var e=Object(f.a)(v.a.mark((function e(r){return v.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:Bs,large:qs,finish:Ws,error:Hs,progress:Ks,fallbackToInterval:Qs},c.abrupt("return",Us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Xs=pt(zs),$s="shlink/orphanVisits/GET_ORPHAN_VISITS_START",ei="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",ti="shlink/orphanVisits/GET_ORPHAN_VISITS",ri="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",ni="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",ci="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",ai="shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",si={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},ii=xt((lt={},Object(l.a)(lt,$s,(function(){return Object(u.a)(Object(u.a)({},si),{},{loading:!0})})),Object(l.a)(lt,ei,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},si),{},{error:!0,errorData:r})})),Object(l.a)(lt,ti,(function(e,t){var r=t.visits,n=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(l.a)(lt,ri,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(lt,ni,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(lt,ci,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(lt,ai,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(lt,Ur,(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(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(We.a)(o),Object(We.a)(n))})})),lt),si),oi=function(e,t){return!t||t===e.type},li=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(f.a)(v.a.mark((function c(a,s){var i,o,l,d,j,b,h;return v.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=e(s),o=i.getOrphanVisits,l=function(){var e=Object(f.a)(v.a.mark((function e(n,c){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o(Object(u.a)(Object(u.a)({},t),{},{page:n,itemsPerPage:c})).then((function(e){var t=e.data.filter((function(e){return Ma(e)&&oi(e,r)}));return Object(u.a)(Object(u.a)({},e),{},{data:t})})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),d=Ts(n,o),j=function(){return s().orphanVisits.cancelLoad},b={query:t},h={start:$s,large:ri,finish:ti,error:ei,progress:ci,fallbackToInterval:ai},c.abrupt("return",Us(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},ui=pt(ni),di="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START",ji="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR",bi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS",hi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE",Oi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL",vi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED",fi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",mi={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},gi=xt((ut={},Object(l.a)(ut,di,(function(){return Object(u.a)(Object(u.a)({},mi),{},{loading:!0})})),Object(l.a)(ut,ji,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},mi),{},{error:!0,errorData:r})})),Object(l.a)(ut,bi,(function(e,t){var r=t.visits,n=t.query;return Object(u.a)(Object(u.a)({},e),{},{visits:r,query:n,loading:!1,error:!1})})),Object(l.a)(ut,hi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(ut,Oi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(ut,vi,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(ut,fi,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(ut,Ur,(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(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(We.a)(o),Object(We.a)(n))})})),ut),mi),xi=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(f.a)(v.a.mark((function n(c,a){var s,i,o,l,d,j,b;return v.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getNonOrphanVisits,o=function(){var e=Object(f.a)(v.a.mark((function e(r,n){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(u.a)(Object(u.a)({},t),{},{page:r,itemsPerPage:n})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=Ts(r,i),d=function(){return a().orphanVisits.cancelLoad},j={query:t},b={start:di,large:hi,finish:bi,error:ji,progress:vi,fallbackToInterval:fi},n.abrupt("return",Us(o,l,j,b,c,d));case 7:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},pi=pt(Oi),Si="shlink/visitsOverview/GET_OVERVIEW_START",yi="shlink/visitsOverview/GET_OVERVIEW_ERROR",Ci="shlink/visitsOverview/GET_OVERVIEW",Ni={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},ki=xt((dt={},Object(l.a)(dt,Si,(function(){return Object(u.a)(Object(u.a)({},Ni),{},{loading:!0})})),Object(l.a)(dt,yi,(function(){return Object(u.a)(Object(u.a)({},Ni),{},{error:!0})})),Object(l.a)(dt,Ci,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(u.a)(Object(u.a)({},Ni),{},{visitsCount:r,orphanVisitsCount:n})})),Object(l.a)(dt,Ur,(function(e,t){var r=e.visitsCount,n=e.orphanVisitsCount,c=void 0===n?0:n,a=Object(g.a)(e,["visitsCount","orphanVisitsCount"]),s=t.createdVisits,i=Ga(s),o=i.regularVisits,l=i.orphanVisits;return Object(u.a)(Object(u.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),dt),Ni),_i=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:Si}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(u.a)({type:Ci},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:yi});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},wi=function e(t,r){var n=this;Object(m.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(Ic.a)(n.window,r,e)}}},Ui=function(e,t){e.serviceFactory("MapModal",(function(){return qc})),e.serviceFactory("ShortUrlVisits",ms,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",xs,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",Ss,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("NonOrphanVisits",Cs,"VisitsExporter"),e.decorator("NonOrphanVisits",t(["nonOrphanVisits","mercureInfo","settings","selectedServer"],["getNonOrphanVisits","cancelGetNonOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",wi,"window","csvjson"),e.serviceFactory("getShortUrlVisits",Gs,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return Ps})),e.serviceFactory("getTagVisits",Ys,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return Xs})),e.serviceFactory("getOrphanVisits",li,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return ui})),e.serviceFactory("getNonOrphanVisits",xi,"buildShlinkApiClient"),e.serviceFactory("cancelGetNonOrphanVisits",(function(){return pi})),e.serviceFactory("createNewVisits",(function(){return Tr})),e.serviceFactory("loadVisitsOverview",_i,"buildShlinkApiClient")},Ti=r(263),Ri=r.n(Ti),Ei=function(e){var t=e.tag,r=e.colorGenerator;return Object(W.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},Di=function(e){return{id:e,name:e}},Li=function(e){return function(t){var r,n,c=t.selectedTags,a=t.onChange,s=t.placeholder,i=t.listTags,o=t.tagsList,l=t.settings;Object(P.useEffect)((function(){i()}),[]);var u=null!==(r=null===(n=l.shortUrlCreation)||void 0===n?void 0:n.tagFilteringMode)&&void 0!==r?r:"startsWith";return Object(W.jsx)(Ri.a,{tags:c.map(Di),tagComponent:function(t){var r=t.tag,n=t.onDelete;return Object(W.jsx)(z,{colorGenerator:e,text:r.name,clearable:!0,className:"react-tags__tag",onClose:n})},suggestions:o.tags.filter((function(e){return!c.includes(e)})).map(Di),suggestionComponent:function(t){var r=t.item;return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(Ei,{tag:"".concat(r.name),colorGenerator:e}),r.name]})},allowNew:!0,addOnBlur:!0,placeholderText:null!==s&&void 0!==s?s:"Add tags to the URL",minQueryLength:1,delimiters:["Enter","Tab",","],suggestionsTransform:"includes"===u?function(e,t){return t.filter((function(t){return t.name.includes(e)}))}:void 0,onDelete:function(e){var t=Object(We.a)(c);t.splice(e,1),a(t)},onAddition:function(e){var t=e.name;return a(Object(We.a)(new Set([].concat(Object(We.a)(c),Object(We.a)(t.toLowerCase().split(","))))))}})}},Vi=r(506),Ii=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=n.displayed,o=n.toggle,l=Object(Y.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=Object(Y.f)(),O=Object(C.a)(b,2),v=O[0],f=O[1],m=Object(Y.f)(),g=Object(C.a)(m,3),x=g[0],p=g[2],S=Object(P.useRef)(),y=Object(h.a)(a);return Object(P.useEffect)((function(){var e;(e=S.current)&&e.scrollWidth>e.clientWidth&&p()}),[S.current]),Object(W.jsxs)(qe.a,{className:"tag-card",children:[Object(W.jsxs)(Cc.a,{className:"tag-card__header",children:[Object(W.jsx)(an.a,{color:"link",size:"sm",className:"tag-card__btn tag-card__btn--last",onClick:j,children:Object(W.jsx)(A.a,{icon:F.R})}),Object(W.jsx)(an.a,{color:"link",size:"sm",className:"tag-card__btn",onClick:f,children:Object(W.jsx)(A.a,{icon:F.D})}),Object(W.jsxs)("h5",{className:"tag-card__tag-title text-ellipsis",title:x?c.tag:void 0,ref:function(e){S.current=null!==e&&void 0!==e?e:void 0},children:[Object(W.jsx)(Ei,{tag:c.tag,colorGenerator:r}),Object(W.jsx)("span",{className:"tag-card__tag-name",onClick:o,children:c.tag})]})]}),Object(W.jsx)(Vi.a,{isOpen:s,children:Object(W.jsxs)(Nc.a,{className:"tag-card__body",children:[Object(W.jsxs)(i.b,{to:"/server/".concat(y,"/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(W.jsxs)("span",{className:"text-ellipsis",children:[Object(W.jsx)(A.a,{icon:F.w,className:"mr-2"}),"Short URLs"]}),Object(W.jsx)("b",{children:Pt(c.shortUrls)})]}),Object(W.jsxs)(i.b,{to:"/server/".concat(y,"/tag/").concat(c.tag,"/visits"),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center",children:[Object(W.jsxs)("span",{className:"text-ellipsis",children:[Object(W.jsx)(A.a,{icon:F.q,className:"mr-2"}),"Visits"]}),Object(W.jsx)("b",{children:Pt(c.visits)})]})]})}),Object(W.jsx)(e,{tag:c.tag,toggle:j,isOpen:d}),Object(W.jsx)(t,{tag:c.tag,toggle:f,isOpen:v})]})}},Fi=function(e){var t=e.tag,r=e.toggle,n=e.isOpen,c=e.deleteTag,a=e.tagDelete,s=e.tagDeleted,i=a.deleting,o=a.error,l=a.errorData,u=function(){var e=Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(t);case 2:s(t),r();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(W.jsxs)(dr.a,{toggle:r,isOpen:n,centered:!0,children:[Object(W.jsx)(jr.a,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(W.jsxs)(br.a,{children:["Are you sure you want to delete tag ",Object(W.jsx)("b",{children:t}),"?",o&&Object(W.jsx)(mr,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(pr,{errorData:l,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(W.jsxs)(hr.a,{children:[Object(W.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(W.jsx)("button",{className:"btn btn-danger",disabled:i,onClick:u,children:i?"Deleting tag...":"Delete tag"})]})]})},Ai=r(558),Mi=r(264),Gi=function(e){var t=e.getColorForKey;return function(e){var r=e.tag,n=e.editTag,c=e.toggle,a=e.tagEdited,s=e.isOpen,i=e.tagEdit,o=Object(P.useState)(r),l=Object(C.a)(o,2),u=l[0],d=l[1],j=Object(P.useState)(t(r)),b=Object(C.a)(j,2),h=b[0],O=b[1],m=Object(Y.f)(),g=Object(C.a)(m,4),x=g[0],p=g[1],S=g[3],y=i.editing,N=i.error,k=i.errorData,_=Object(Or.b)(Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n(r,u,h).then((function(){return a(r,u,h)})).then(c).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));return Object(W.jsx)(dr.a,{isOpen:s,toggle:c,centered:!0,onClosed:S,children:Object(W.jsxs)("form",{onSubmit:_,children:[Object(W.jsx)(jr.a,{toggle:c,children:"Edit tag"}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)("div",{className:"input-group",children:[Object(W.jsx)("div",{className:"input-group-prepend",id:"colorPickerBtn",onClick:p,children:Object(W.jsx)("div",{className:"input-group-text edit-tag-modal__color-picker-toggle",style:{backgroundColor:h,borderColor:h},children:Object(W.jsx)(A.a,{icon:F.B,className:"edit-tag-modal__color-icon"})})}),Object(W.jsx)(Ai.a,{isOpen:x,toggle:p,target:"colorPickerBtn",placement:"right",hideArrow:!0,popperClassName:"edit-tag-modal__popover",children:Object(W.jsx)(Mi.a,{color:h,onChange:O})}),Object(W.jsx)(un.a,{value:u,placeholder:"Tag",required:!0,onChange:function(e){var t=e.target;return d(t.value)}})]}),N&&Object(W.jsx)(mr,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(pr,{errorData:k,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(W.jsxs)(hr.a,{children:[Object(W.jsx)(an.a,{type:"button",color:"link",onClick:c,children:"Cancel"}),Object(W.jsx)(an.a,{color:"primary",disabled:y,children:y?"Saving...":"Save"})]})]})})}},Pi={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},Bi=function(e){var t,r=e.mode,n=e.onChange,c=e.renderTitle;return Object(W.jsxs)(X,{text:null!==(t=null===c||void 0===c?void 0:c(r))&&void 0!==t?t:"Display mode: ".concat(r),children:[Object(W.jsxs)(K.a,{active:"cards"===r,onClick:function(){return n("cards")},children:[Object(W.jsx)(A.a,{icon:F.P,fixedWidth:!0,className:"mr-1"})," Cards"]}),Object(W.jsxs)(K.a,{active:"list"===r,onClick:function(){return n("list")},children:[Object(W.jsx)(A.a,{icon:F.c,fixedWidth:!0,className:"mr-1"})," List"]})]})},Hi=function(e,t){return Ze((function(r){var n,c,a,s,i=r.filterTags,o=r.forceListTags,l=r.tagsList,u=r.selectedServer,d=r.settings,j=Object(P.useState)(null!==(n=null===(c=d.tags)||void 0===c?void 0:c.defaultMode)&&void 0!==n?n:"cards"),b=Object(C.a)(j,2),h=b[0],O=b[1],v=Object(P.useState)(null!==(a=null===(s=d.tags)||void 0===s?void 0:s.defaultOrdering)&&void 0!==a?a:{}),f=Object(C.a)(v,2),m=f[0],g=f[1],x=Object(M.a)((function(){return l.filteredTags.map((function(e){var t,r,n,c;return{tag:e,shortUrls:null!==(t=null===(r=l.stats[e])||void 0===r?void 0:r.shortUrlsCount)&&void 0!==t?t:0,visits:null!==(n=null===(c=l.stats[e])||void 0===c?void 0:c.visitsCount)&&void 0!==n?n:0}}))}),(function(e){return k(e,m)}));if(Object(P.useEffect)((function(){o()}),[]),l.loading)return Object(W.jsx)(Sn.a,{loading:!0});if(l.error)return Object(W.jsx)(mr,{type:"error",children:Object(W.jsx)(pr,{errorData:l.errorData,fallbackMessage:"Error loading tags :("})});var p=function(e){return function(){var t=N(e,m.field,m.dir);g({field:t?e:void 0,dir:t})}};return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:i}),Object(W.jsxs)(vr.a,{className:"mb-3",children:[Object(W.jsx)("div",{className:"col-lg-6",children:Object(W.jsx)(Bi,{mode:h,onChange:O})}),Object(W.jsx)("div",{className:"col-lg-6 mt-3 mt-lg-0",children:Object(W.jsx)(Qe,{items:Pi,order:m,onChange:function(e,t){return g({field:e,dir:t})}})})]}),function(){if(l.filteredTags.length<1)return Object(W.jsx)(Sn.a,{children:"No tags found"});var r=x();return"cards"===h?Object(W.jsx)(e,{sortedTags:r,selectedServer:u}):Object(W.jsx)(t,{sortedTags:r,selectedServer:u,currentOrder:m,orderByColumn:p})}()]})}),(function(){return[Ye.visits]}))},Wi="shlink/deleteTag/DELETE_TAG_START",qi="shlink/deleteTag/DELETE_TAG_ERROR",zi="shlink/deleteTag/DELETE_TAG",Ki="shlink/deleteTag/TAG_DELETED",Qi=xt((jt={},Object(l.a)(jt,Wi,(function(){return{deleting:!0,error:!1}})),Object(l.a)(jt,qi,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(l.a)(jt,zi,(function(){return{deleting:!1,error:!1}})),jt),{deleting:!1,error:!1}),Ji=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Wi}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:zi}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:qi,errorData:gr(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},Zi=function(e){return{type:Ki,tag:e}},Yi="shlink/editTag/EDIT_TAG_START",Xi="shlink/editTag/EDIT_TAG_ERROR",$i="shlink/editTag/EDIT_TAG",eo="shlink/editTag/TAG_EDITED",to=xt((bt={},Object(l.a)(bt,Yi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{editing:!0,error:!1})})),Object(l.a)(bt,Xi,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(l.a)(bt,$i,(function(e,t){return Object(u.a)(Object(u.a)({},Object(j.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),bt),{oldName:"",newName:"",editing:!1,error:!1}),ro=function(e,t){return function(r,n,c){return function(){var a=Object(f.a)(v.a.mark((function a(s,i){var o,l;return v.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s({type:Yi}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:$i,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:Xi,errorData:gr(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},no=function(e,t,r){return{type:eo,oldName:e,newName:t,color:r}},co="shlink/tagsList/LIST_TAGS_START",ao="shlink/tagsList/LIST_TAGS_ERROR",so="shlink/tagsList/LIST_TAGS",io="shlink/tagsList/FILTER_TAGS",oo={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},lo=function(e,t){return function(r){return r===e?t:r}},uo=function(e,t){return Object(x.a)((function(e){return e===t}),e)},jo=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}),{}))},bo=xt((ht={},Object(l.a)(ht,co,(function(){return Object(u.a)(Object(u.a)({},oo),{},{loading:!0})})),Object(l.a)(ht,ao,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},oo),{},{error:!0,errorData:r})})),Object(l.a)(ht,so,(function(e,t){var r=t.tags,n=t.stats;return Object(u.a)(Object(u.a)({},oo),{},{stats:n,tags:r,filteredTags:r})})),Object(l.a)(ht,Ki,(function(e,t){var r=t.tag;return Object(u.a)(Object(u.a)({},e),{},{tags:uo(e.tags,r),filteredTags:uo(e.filteredTags,r)})})),Object(l.a)(ht,eo,(function(e,t){var r=t.oldName,n=t.newName;return Object(u.a)(Object(u.a)({},e),{},{tags:e.tags.map(lo(r,n)).sort(),filteredTags:e.filteredTags.map(lo(r,n)).sort()})})),Object(l.a)(ht,io,(function(e,t){var r=t.searchTerm;return Object(u.a)(Object(u.a)({},e),{},{filteredTags:e.tags.filter((function(e){return e.toLowerCase().match(r)}))})})),Object(l.a)(ht,Ur,(function(e,t){var r,n,c=t.createdVisits;return Object(u.a)(Object(u.a)({},e),{},{stats:(r=jo(c),n=e.stats,r.reduce((function(e,t){var r=Object(C.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(u.a)({},n)))})})),Object(l.a)(ht,Pr,(function(e,t){var r=e.tags,n=Object(g.a)(e,["tags"]),c=t.result;return Object(u.a)(Object(u.a)({},n),{},{tags:r.concat(c.tags.filter((function(e){return!r.includes(e)})))})})),ht),oo),ho=function(e){return{type:io,searchTerm:e}},Oo=Math.ceil,vo=function(e){return function(t){var r=t.sortedTags,n=t.selectedServer,c=Object(P.useState)(),a=Object(C.a)(c,2),s=a[0],i=a[1],o=r.length,l=Object(Ea.a)(Oo(o/4),r);return Object(W.jsx)(vr.a,{children:l.map((function(t,r){return Object(W.jsx)("div",{className:"col-md-6 col-xl-3",children:t.map((function(t){return Object(W.jsx)(e,{tag:t,selectedServer:n,displayed:s===t.tag,toggle:function(){return i(s!==t.tag?t.tag:void 0)}},t.tag)}))},r)}))})}},fo=function(e){return function(t){var r,n=t.sortedTags,c=t.selectedServer,a=t.orderByColumn,s=t.currentOrder,i=Object(P.useRef)(!0),o=Object(Ge.f)().search,l=Object(y.a)(o).page,u=void 0===l?1:l,d=Object(Y.c)("page",Number(u)),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(Ea.a)(20,n),v=O.length>1,f=null!==(r=O[b-1])&&void 0!==r?r:[];return Object(P.useEffect)((function(){!i.current&&h(1),i.current=!1}),[n]),Object(P.useEffect)((function(){scrollTo(0,0)}),[b]),Object(W.jsxs)(fr.a,{bodyClassName:v?"pb-1":"",children:[Object(W.jsxs)("table",{className:"table table-hover mb-0",children:[Object(W.jsxs)("thead",{className:"responsive-table__header",children:[Object(W.jsxs)("tr",{children:[Object(W.jsxs)("th",{className:"tags-table__header-cell",onClick:a("tag"),children:["Tag ",Object(W.jsx)(Xe,{currentOrder:s,field:"tag"})]}),Object(W.jsxs)("th",{className:"tags-table__header-cell text-lg-right",onClick:a("shortUrls"),children:["Short URLs ",Object(W.jsx)(Xe,{currentOrder:s,field:"shortUrls"})]}),Object(W.jsxs)("th",{className:"tags-table__header-cell text-lg-right",onClick:a("visits"),children:["Visits ",Object(W.jsx)(Xe,{currentOrder:s,field:"visits"})]}),Object(W.jsx)("th",{className:"tags-table__header-cell"})]}),Object(W.jsx)("tr",{children:Object(W.jsx)("th",{colSpan:4,className:"p-0 border-top-0"})})]}),Object(W.jsxs)("tbody",{children:[0===f.length&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:4,className:"text-center",children:"No results found"})}),f.map((function(t){return Object(W.jsx)(e,{tag:t,selectedServer:c},t.tag)}))]})]}),v&&Object(W.jsx)("div",{className:"sticky-card-paginator",children:Object(W.jsx)(Da,{pagesCount:O.length,currentPage:b,setCurrentPage:h})})]},b)}},mo=function(e,t,r){return function(n){var c=n.tag,a=n.selectedServer,s=Object(Y.f)(),o=Object(C.a)(s,2),l=o[0],u=o[1],d=Object(Y.f)(),j=Object(C.a)(d,2),b=j[0],O=j[1],v=Object(Y.f)(),f=Object(C.a)(v,2),m=f[0],g=f[1],x=Object(h.a)(a);return Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsxs)("th",{className:"responsive-table__cell","data-th":"Tag",children:[Object(W.jsx)(Ei,{tag:c.tag,colorGenerator:r})," ",c.tag]}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-right","data-th":"Short URLs",children:Object(W.jsx)(i.b,{to:"/server/".concat(x,"/list-short-urls/1?tags=").concat(encodeURIComponent(c.tag)),children:Pt(c.shortUrls)})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-right","data-th":"Visits",children:Object(W.jsx)(i.b,{to:"/server/".concat(x,"/tag/").concat(c.tag,"/visits"),children:Pt(c.visits)})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-right",children:Object(W.jsxs)(or,{toggle:g,isOpen:m,children:[Object(W.jsxs)(K.a,{onClick:O,children:[Object(W.jsx)(A.a,{icon:F.D,fixedWidth:!0,className:"mr-1"})," Edit"]}),Object(W.jsxs)(K.a,{onClick:u,children:[Object(W.jsx)(A.a,{icon:F.R,fixedWidth:!0,className:"mr-1"})," Delete"]})]})}),Object(W.jsx)(t,{tag:c.tag,toggle:O,isOpen:b}),Object(W.jsx)(e,{tag:c.tag,toggle:u,isOpen:l})]})}},go=function(e,t){e.serviceFactory("TagsSelector",Li,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",Ii,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return Fi})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",Gi,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsCards",vo,"TagCard"),e.serviceFactory("TagsTableRow",mo,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("TagsTable",fo,"TagsTableRow"),e.serviceFactory("TagsList",Hi,"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(f.a)(v.a.mark((function r(n,c){var a,s,i,o,l,u,d,j;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.tagsList,t||!s.loading&&Object(S.a)(s.tags)){r.next=3;break}return r.abrupt("return");case 3:return n({type:co}),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:so}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:ao,errorData:gr(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 ho})),e.serviceFactory("tagDeleted",(function(){return Zi})),e.serviceFactory("tagEdited",(function(){return no})),e.serviceFactory("deleteTag",Ji,"buildShlinkApiClient"),e.serviceFactory("editTag",ro,"buildShlinkApiClient","ColorGenerator")},xo=r(265),po="shlink/mercure/GET_MERCURE_INFO_START",So="shlink/mercure/GET_MERCURE_INFO_ERROR",yo="shlink/mercure/GET_MERCURE_INFO",Co=xt((Ot={},Object(l.a)(Ot,po,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(Ot,So,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!1,error:!0})})),Object(l.a)(Ot,yo,(function(e,t){return Object(u.a)(Object(u.a)({},t),{},{loading:!1,error:!1})})),Ot),{loading:!0,error:!1}),No=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s,i,o;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r({type:po}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:So}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(u.a)({type:yo,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:So});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},ko=function(e){e.serviceFactory("loadMercureInfo",No,"buildShlinkApiClient")},_o=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(W.jsxs)(fr.a,{title:"Real-time updates",className:"h-100",children:[Object(W.jsx)(cn.a,{children:Object(W.jsxs)(Ae,{checked:r.enabled,onChange:n,children:["Enable or disable real-time updates.",Object(W.jsxs)("small",{className:"form-text text-muted",children:["Real-time updates are currently being ",Object(W.jsx)("b",{children:r.enabled?"processed":"ignored"}),"."]})]})}),Object(W.jsxs)(cn.a,{className:"mb-0",children:[Object(W.jsx)("label",{className:H()({"text-muted":!r.enabled}),children:"Real-time updates frequency (in minutes):"}),Object(W.jsx)(un.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(W.jsxs)("small",{className:"form-text text-muted",children:[void 0!==r.interval&&r.interval>0&&Object(W.jsxs)("span",{children:["Updates will be reflected in the UI every ",Object(W.jsx)("b",{children:r.interval})," minute",r.interval>1&&"s","."]}),!r.interval&&"Updates will be reflected in the UI as soon as they happen."]})]})]})},wo=function(e){var t=e.items;return Object(W.jsx)(W.Fragment,{children:t.map((function(e,t){return Object(W.jsx)("div",{className:"mb-3",children:e},t)}))})},Uo=function(e,t,r,n,c,a){return function(){return Object(W.jsxs)(Dn.a,{children:[Object(W.jsxs)($c,{children:[Object(W.jsx)(Xc,{to:"general",children:"General"}),Object(W.jsx)(Xc,{to:"short-urls",children:"Short URLs"}),Object(W.jsx)(Xc,{to:"secondary-items",children:"Secondary items"})]}),Object(W.jsxs)(Ge.d,{children:[Object(W.jsx)(Ge.b,{path:"general",element:Object(W.jsx)(wo,{items:[Object(W.jsx)(n,{},"one"),Object(W.jsx)(e,{},"two")]})}),Object(W.jsx)(Ge.b,{path:"short-urls",element:Object(W.jsx)(wo,{items:[Object(W.jsx)(t,{},"one"),Object(W.jsx)(r,{},"two")]})}),Object(W.jsx)(Ge.b,{path:"secondary-items",element:Object(W.jsx)(wo,{items:[Object(W.jsx)(a,{},"one"),Object(W.jsx)(c,{},"two")]})}),Object(W.jsx)(Ge.b,{path:"*",element:Object(W.jsx)(Ge.a,{replace:!0,to:"general"})})]})]})}},To=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},Ro=function(e){var t,r,n,c,a,s=e.settings,i=e.setShortUrlCreationSettings,o=null!==(t=s.shortUrlCreation)&&void 0!==t?t:{validateUrls:!1},l=function(e){return function(){return i(Object(u.a)(Object(u.a)({},null!==o&&void 0!==o?o:{validateUrls:!1}),{},{tagFilteringMode:e}))}};return Object(W.jsxs)(fr.a,{title:"Short URLs form",className:"h-100",children:[Object(W.jsx)(cn.a,{children:Object(W.jsxs)(Ae,{checked:null!==(r=o.validateUrls)&&void 0!==r&&r,onChange:function(e){return i(Object(u.a)(Object(u.a)({},o),{},{validateUrls:e}))},children:["Request validation on long URLs when creating new short URLs.",Object(W.jsxs)("small",{className:"form-text text-muted",children:["The initial state of the ",Object(W.jsx)("b",{children:"Validate URL"})," checkbox will be ",Object(W.jsx)("b",{children:o.validateUrls?"checked":"unchecked"}),"."]})]})}),Object(W.jsx)(cn.a,{children:Object(W.jsxs)(Ae,{checked:null===(n=o.forwardQuery)||void 0===n||n,onChange:function(e){return i(Object(u.a)(Object(u.a)({},o),{},{forwardQuery:e}))},children:["Make all new short URLs forward their query params to the long URL.",Object(W.jsxs)("small",{className:"form-text text-muted",children:["The initial state of the ",Object(W.jsx)("b",{children:"Forward query params on redirect"})," checkbox will be ",Object(W.jsx)("b",{children:null===(c=o.forwardQuery)||void 0===c||c?"checked":"unchecked"}),"."]})]})}),Object(W.jsxs)(cn.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Tag suggestions search mode:"}),Object(W.jsxs)(X,{text:To(o.tagFilteringMode),children:[Object(W.jsx)(K.a,{active:!o.tagFilteringMode||"startsWith"===o.tagFilteringMode,onClick:l("startsWith"),children:To("startsWith")}),Object(W.jsx)(K.a,{active:"includes"===o.tagFilteringMode,onClick:l("includes"),children:To("includes")})]}),Object(W.jsx)("small",{className:"form-text text-muted",children:(a=o.tagFilteringMode,"includes"===a?Object(W.jsxs)(W.Fragment,{children:["The list of suggested tags will contain those ",Object(W.jsx)("b",{children:"including"})," provided input."]}):Object(W.jsxs)(W.Fragment,{children:["The list of suggested tags will contain those ",Object(W.jsx)("b",{children:"starting with"})," provided input."]}))})]})]})},Eo=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(W.jsxs)(fr.a,{title:"User interface",className:"h-100",children:[Object(W.jsx)(A.a,{icon:"dark"===(null===t||void 0===t?void 0:t.theme)?F.A:F.M,className:"user-interface__theme-icon"}),Object(W.jsx)(Ae,{checked:"dark"===(null===t||void 0===t?void 0:t.theme),onChange:function(e){var n=e?"dark":"light";r(Object(u.a)(Object(u.a)({},t),{},{theme:n})),Object(pa.g)(n)},children:"Use dark theme."})]})},Do=function(e){var t,r=e.onChange,n=e.active,c=e.allText;return Object(W.jsx)(X,{text:null!==(t=pe(n))&&void 0!==t?t:c,children:Object(W.jsx)(Re,{allText:c,active:n,onChange:r})})},Lo=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(W.jsx)(fr.a,{title:"Visits",className:"h-100",children:Object(W.jsxs)(cn.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default interval to load on visits sections:"}),Object(W.jsx)(Do,{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})}})]})})},Vo=function(e){var t,r,n,c=e.settings.tags,a=e.setTagsSettings;return Object(W.jsxs)(fr.a,{title:"Tags",className:"h-100",children:[Object(W.jsxs)(cn.a,{children:[Object(W.jsx)("label",{children:"Default display mode when managing tags:"}),Object(W.jsx)(Bi,{mode:null!==(t=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==t?t:"cards",renderTitle:function(e){return Object(Or.a)(e)},onChange:function(e){return a(Object(u.a)(Object(u.a)({},c),{},{defaultMode:e}))}}),Object(W.jsxs)("small",{className:"form-text text-muted",children:["Tags will be displayed as ",Object(W.jsx)("b",{children:null!==(r=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==r?r:"cards"}),"."]})]}),Object(W.jsxs)(cn.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default ordering for tags list:"}),Object(W.jsx)(Qe,{items:Pi,order:null!==(n=null===c||void 0===c?void 0:c.defaultOrdering)&&void 0!==n?n:{},onChange:function(e,t){return a(Object(u.a)(Object(u.a)({},c),{},{defaultOrdering:{field:e,dir:t}}))}})]})]})},Io=function(e){var t,r=e.settings.shortUrlsList,n=e.setShortUrlsListSettings;return Object(W.jsx)(fr.a,{title:"Short URLs list",className:"h-100",children:Object(W.jsxs)(cn.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default ordering for short URLs list:"}),Object(W.jsx)(Qe,{items:Qt,order:null!==(t=null===r||void 0===r?void 0:r.defaultOrdering)&&void 0!==t?t:yt,onChange:function(e,t){return n({defaultOrdering:{field:e,dir:t}})}})]})})},Fo=function(e,t){e.serviceFactory("Settings",Uo,"RealTimeUpdatesSettings","ShortUrlCreationSettings","ShortUrlsListSettings","UserInterfaceSettings","VisitsSettings","TagsSettings"),e.decorator("Settings",yc.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdatesSettings",(function(){return _o})),e.decorator("RealTimeUpdatesSettings",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreationSettings",(function(){return Ro})),e.decorator("ShortUrlCreationSettings",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterfaceSettings",(function(){return Eo})),e.decorator("UserInterfaceSettings",t(["settings"],["setUiSettings"])),e.serviceFactory("VisitsSettings",(function(){return Lo})),e.decorator("VisitsSettings",t(["settings"],["setVisitsSettings"])),e.serviceFactory("TagsSettings",(function(){return Vo})),e.decorator("TagsSettings",t(["settings"],["setTagsSettings"])),e.serviceFactory("ShortUrlsListSettings",(function(){return Io})),e.decorator("ShortUrlsListSettings",t(["settings"],["setShortUrlsListSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return kt})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return _t})),e.serviceFactory("setShortUrlCreationSettings",(function(){return wt})),e.serviceFactory("setShortUrlsListSettings",(function(){return Ut})),e.serviceFactory("setUiSettings",(function(){return Tt})),e.serviceFactory("setVisitsSettings",(function(){return Rt})),e.serviceFactory("setTagsSettings",(function(){return Et}))},Ao=r(268),Mo=function(e,t){var r=e.split("://"),n=Object(C.a)(r,2),c=n[0],a=n[1].split("/"),s=Object(Ao.a)(a).slice(1),i=s.length?"/".concat(s.join("/")):"";return"".concat(c,"://").concat(t).concat(i)},Go="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",Po=function(e){return function(t,r){return function(){var n=Object(f.a)(v.a.mark((function n(c,a){var s,i,o;return v.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(u.a)({domain:t},r));case 5:o=n.sent,c({type:Go,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:gr(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},Bo="shlink/domainsList/LIST_DOMAINS_START",Ho="shlink/domainsList/LIST_DOMAINS_ERROR",Wo="shlink/domainsList/LIST_DOMAINS",qo="shlink/domainsList/FILTER_DOMAINS",zo="shlink/domainsList/VALIDATE_DOMAIN",Ko={domains:[],filteredDomains:[],loading:!1,error:!1},Qo=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{redirects:t})}},Jo=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{status:t})}},Zo=xt((vt={},Object(l.a)(vt,Bo,(function(){return Object(u.a)(Object(u.a)({},Ko),{},{loading:!0})})),Object(l.a)(vt,Ho,(function(e){var t=e.errorData;return Object(u.a)(Object(u.a)({},Ko),{},{error:!0,errorData:t})})),Object(l.a)(vt,Wo,(function(e,t){var r=t.domains,n=t.defaultRedirects;return Object(u.a)(Object(u.a)({},Ko),{},{domains:r,filteredDomains:r,defaultRedirects:n})})),Object(l.a)(vt,qo,(function(e,t){var r=t.searchTerm;return Object(u.a)(Object(u.a)({},e),{},{filteredDomains:e.domains.filter((function(e){return e.domain.toLowerCase().match(r)}))})})),Object(l.a)(vt,Go,(function(e,t){var r=t.domain,n=t.redirects;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Qo(r,n)),filteredDomains:e.filteredDomains.map(Qo(r,n))})})),Object(l.a)(vt,zo,(function(e,t){var r=t.domain,n=t.status;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Jo(r,n)),filteredDomains:e.filteredDomains.map(Jo(r,n))})})),vt),Ko),Yo=function(e){return function(){return function(){var t=Object(f.a)(v.a.mark((function t(r,n){var c,a,s,i,o;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:Bo}),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(u.a)(Object(u.a)({},e),{},{status:"validating"})})),defaultRedirects:r}}));case 5:s=t.sent,i=s.domains,o=s.defaultRedirects,r({type:Wo,domains:i,defaultRedirects:o}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(2),r({type:Ho,errorData:gr(t.t0)});case 14:case"end":return t.stop()}}),t,null,[[2,11]])})));return function(e,r){return t.apply(this,arguments)}}()}},Xo=function(e){return{type:qo,searchTerm:e}},$o=function(e){return function(t){return function(){var r=Object(f.a)(v.a.mark((function r(n,c){var a,s,i,o,l,d,j,b;return v.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.selectedServer,Object(h.b)(s)){r.next=4;break}return n({type:zo,domain:t,status:"invalid"}),r.abrupt("return");case 4:return r.prev=4,i=s.url,o=Object(g.a)(s,["url"]),l=e(Object(u.a)(Object(u.a)({},o),{},{url:Mo(i,t)})),d=l.health,r.next=9,d();case 9:j=r.sent,b=j.status,n({type:zo,domain:t,status:"pass"===b?"valid":"invalid"}),r.next=17;break;case 14:r.prev=14,r.t0=r.catch(4),n({type:zo,domain:t,status:"invalid"});case 17:case"end":return r.stop()}}),r,null,[[4,14]])})));return function(e,t){return r.apply(this,arguments)}}()}},el=r(560),tl=r(571),rl=function(e){var t=e.listDomains,r=e.value,n=e.domainsList,c=e.onChange,a=Object(Y.f)(),s=Object(C.a)(a,4),i=s[0],o=s[2],l=s[3],u=n.domains,d=Object(S.a)(r),j=function(){return c("")};return Object(P.useEffect)((function(){t()}),[]),i?Object(W.jsxs)(el.a,{children:[Object(W.jsx)(un.a,{value:r,placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(W.jsxs)(tl.a,{addonType:"append",children:[Object(W.jsx)(an.a,{id:"backToDropdown",outline:!0,type:"button",className:"domains-dropdown__back-btn",onClick:Object(M.a)(j,l),children:Object(W.jsx)(A.a,{icon:F.S})}),Object(W.jsx)(Le.a,{target:"backToDropdown",placement:"left",trigger:"hover",children:"Existing domains"})]})]}):Object(W.jsxs)(X,{text:d?"Domain":"Domain: ".concat(r),className:d?"domains-dropdown__toggle-btn":"domains-dropdown__toggle-btn--active",children:[u.map((function(e){var t=e.domain,n=e.isDefault;return Object(W.jsxs)(K.a,{active:r===t||n&&d,onClick:function(){return c(t)},children:[t,n&&Object(W.jsx)("span",{className:"float-right text-muted",children:"default"})]},t)})),Object(W.jsx)(K.a,{divider:!0}),Object(W.jsx)(K.a,{onClick:Object(M.a)(j,o),children:Object(W.jsx)("i",{children:"New domain"})})]})},nl=function(e){var t=e.isLast,r=Object(g.a)(e,["isLast"]);return Object(W.jsx)(Ln,Object(u.a)(Object(u.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},cl=function(e){var t,r,n,c,a,s,i=e.isOpen,o=e.toggle,l=e.domain,u=e.editDomainRedirects,d=Object(P.useState)(null!==(t=null===(r=l.redirects)||void 0===r?void 0:r.baseUrlRedirect)&&void 0!==t?t:""),j=Object(C.a)(d,2),b=j[0],h=j[1],O=Object(P.useState)(null!==(n=null===(c=l.redirects)||void 0===c?void 0:c.regular404Redirect)&&void 0!==n?n:""),m=Object(C.a)(O,2),g=m[0],x=m[1],p=Object(P.useState)(null!==(a=null===(s=l.redirects)||void 0===s?void 0:s.invalidShortUrlRedirect)&&void 0!==a?a:""),S=Object(C.a)(p,2),y=S[0],N=S[1],k=Object(Or.b)(Object(f.a)(v.a.mark((function e(){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",u(l.domain,{baseUrlRedirect:Object(Or.d)(b),regular404Redirect:Object(Or.d)(g),invalidShortUrlRedirect:Object(Or.d)(y)}).then(o));case 1:case"end":return e.stop()}}),e)}))));return Object(W.jsx)(dr.a,{isOpen:i,toggle:o,centered:!0,children:Object(W.jsxs)("form",{onSubmit:k,children:[Object(W.jsxs)(jr.a,{toggle:o,children:["Edit redirects for ",Object(W.jsx)("b",{children:l.domain})]}),Object(W.jsxs)(br.a,{children:[Object(W.jsxs)(nl,{value:b,onChange:h,children:[Object(W.jsxs)(vn,{className:"mr-2",placement:"bottom",children:["Visitors accessing the base url, as in ",Object(W.jsxs)("b",{children:["https://",l.domain,"/"]}),", will be redirected to this URL."]}),"Base URL"]}),Object(W.jsxs)(nl,{value:g,onChange:x,children:[Object(W.jsxs)(vn,{className:"mr-2",placement:"bottom",children:["Visitors accessing a url not matching a short URL pattern, as in ",Object(W.jsxs)("b",{children:["https://",l.domain,"/???/[...]"]}),", will be redirected to this URL."]}),"Regular 404"]}),Object(W.jsxs)(nl,{value:y,isLast:!0,onChange:N,children:[Object(W.jsx)(vn,{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(W.jsxs)(hr.a,{children:[Object(W.jsx)(an.a,{color:"link",type:"button",onClick:o,children:"Cancel"}),Object(W.jsx)(an.a,{color:"primary",children:"Save"})]})]})})},al=function(e){var t=e.status,r=e.matchMedia,n=void 0===r?window.matchMedia:r,c=Object(P.useRef)(),a=function(){return n("(max-width: 991px)").matches},s=Object(P.useState)(a()),i=Object(C.a)(s,2),o=i[0],l=i[1];return Object(P.useEffect)((function(){var e=function(){return l(a())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),"validating"===t?Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.k,spin:!0}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("span",{ref:function(e){c.current=e},children:"valid"===t?Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.h,className:"text-muted"}):Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.Q,className:"text-danger"})}),Object(W.jsx)(Le.a,{target:function(){return c.current},placement:o?"top-start":"left",autohide:"valid"===t,children:"valid"===t?"Congratulations! This domain is properly configured.":Object(W.jsxs)("span",{children:["Oops! There is some missing configuration, and short URLs shared with this domain will not work.",Object(W.jsx)("br",{}),"Check the ",Object(W.jsx)(Zt.a,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},sl=function(e){var t=e.fallback;return Object(W.jsxs)("span",{className:"text-muted",children:[!t&&Object(W.jsx)("small",{children:"No redirect"}),t&&Object(W.jsxs)(W.Fragment,{children:[t," ",Object(W.jsx)("small",{children:"(as fallback)"})]})]})},il=function(){return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(A.a,{fixedWidth:!0,icon:F.m,className:"text-primary",id:"defaultDomainIcon"}),Object(W.jsx)(Le.a,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},ol=function(e){var t,r,n,c=e.domain,a=e.editDomainRedirects,s=e.checkDomainHealth,i=e.defaultRedirects,o=e.selectedServer,l=Object(Y.f)(),u=Object(C.a)(l,2),d=u[0],j=u[1],b=c.domain,h=c.isDefault,O=c.redirects,v=c.status,f=!h||Object(De.d)(o);return Object(P.useEffect)((function(){s(c.domain)}),[]),Object(W.jsxs)("tr",{className:"responsive-table__row",children:[Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Is default domain",children:h&&Object(W.jsx)(il,{})}),Object(W.jsx)("th",{className:"responsive-table__cell","data-th":"Domain",children:b}),Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Base path redirect",children:null!==(t=null===O||void 0===O?void 0:O.baseUrlRedirect)&&void 0!==t?t:Object(W.jsx)(sl,{fallback:null===i||void 0===i?void 0:i.baseUrlRedirect})}),Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Regular 404 redirect",children:null!==(r=null===O||void 0===O?void 0:O.regular404Redirect)&&void 0!==r?r:Object(W.jsx)(sl,{fallback:null===i||void 0===i?void 0:i.regular404Redirect})}),Object(W.jsx)("td",{className:"responsive-table__cell","data-th":"Invalid short URL redirect",children:null!==(n=null===O||void 0===O?void 0:O.invalidShortUrlRedirect)&&void 0!==n?n:Object(W.jsx)(sl,{fallback:null===i||void 0===i?void 0:i.invalidShortUrlRedirect})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-center","data-th":"Status",children:Object(W.jsx)(al,{status:v})}),Object(W.jsxs)("td",{className:"responsive-table__cell text-right",children:[Object(W.jsx)("span",{id:f?void 0:"defaultDomainBtn",children:Object(W.jsx)(an.a,{outline:!0,size:"sm",disabled:!f,onClick:f?j:void 0,children:Object(W.jsx)(A.a,{fixedWidth:!0,icon:f?F.n:F.b})})}),!f&&Object(W.jsxs)(Le.a,{target:"defaultDomainBtn",placement:"left",children:["Redirects for default domain cannot be edited here.",Object(W.jsx)("br",{}),"Use config options or env vars directly on the server."]})]}),Object(W.jsx)(cl,{domain:c,isOpen:d,toggle:j,editDomainRedirects:a})]})},ll=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect","",""],ul=function(e){var t,r=e.listDomains,n=e.domainsList,c=e.filterDomains,a=e.editDomainRedirects,s=e.checkDomainHealth,i=e.selectedServer,o=n.filteredDomains,l=n.defaultRedirects,u=n.loading,d=n.error,j=n.errorData,b=null!==l&&void 0!==l?l:null===(t=o.find((function(e){return e.isDefault})))||void 0===t?void 0:t.redirects;if(Object(P.useEffect)((function(){r()}),[]),u)return Object(W.jsx)(Sn.a,{loading:!0});return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:c}),d?Object(W.jsx)(mr,{type:"error",children:Object(W.jsx)(pr,{errorData:j,fallbackMessage:"Error loading domains :("})}):Object(W.jsx)(fr.a,{children:Object(W.jsxs)("table",{className:"table table-hover mb-0",children:[Object(W.jsx)("thead",{className:"responsive-table__header",children:Object(W.jsx)("tr",{children:ll.map((function(e,t){return Object(W.jsx)("th",{children:e},t)}))})}),Object(W.jsxs)("tbody",{children:[o.length<1&&Object(W.jsx)("tr",{children:Object(W.jsx)("td",{colSpan:ll.length,className:"text-center",children:"No results found"})}),o.map((function(e){return Object(W.jsx)(ol,{domain:e,editDomainRedirects:a,checkDomainHealth:s,defaultRedirects:b,selectedServer:i},e.domain)}))]})]})})]})},dl=function(e,t){e.serviceFactory("DomainSelector",(function(){return rl})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return ul})),e.decorator("ManageDomains",t(["domainsList","selectedServer"],["listDomains","filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("listDomains",Yo,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Xo})),e.serviceFactory("editDomainRedirects",Po,"buildShlinkApiClient"),e.serviceFactory("checkDomainHealth",$o,"buildShlinkApiClient")},jl="shlink/appUpdates/APP_UPDATE_AVAILABLE",bl="shlink/appUpdates/RESET_APP_UPDATE",hl=xt((ft={},Object(l.a)(ft,jl,(function(){return!0})),Object(l.a)(ft,bl,(function(){return!1})),ft),!1),Ol=pt(jl),vl=pt(bl),fl=r(141),ml=r(561),gl=function(e){var t=e.isOpen,r=e.toggle,n=e.forceUpdate,c=Object(Y.f)(),a=Object(C.a)(c,3),s=a[0],i=a[2];return Object(W.jsxs)(ml.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:fr.a,color:"secondary",children:[Object(W.jsx)("h4",{className:"mb-4",children:"This app has just been updated!"}),Object(W.jsxs)("p",{className:"mb-0",children:["Restart it to enjoy the new features.",Object(W.jsxs)(an.a,{disabled:s,className:"ml-2",color:"secondary",size:"sm",onClick:function(){i(),n()},children:[!s&&Object(W.jsxs)(W.Fragment,{children:["Restart now ",Object(W.jsx)(A.a,{icon:F.N,className:"ml-1"})]}),s&&Object(W.jsx)(W.Fragment,{children:"Restarting..."})]})]})]})},xl=r(34),pl=function(){var e=Object(f.a)(v.a.mark((function e(){var t,r,n,c,a,s,i;return v.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(xl.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)}}(),Sl=function(e,t,r,n,c,a,s,i){return function(o){var l=o.fetchServers,u=o.servers,d=o.settings,j=o.appUpdated,b=o.resetAppUpdate,h="/"===Object(Ge.f)().pathname;return Object(P.useEffect)((function(){var e,t;0===Object.keys(u).length&&l(),Object(pa.g)(null!==(e=null===(t=d.ui)||void 0===t?void 0:t.theme)&&void 0!==e?e:"light")}),[]),Object(W.jsxs)("div",{className:"container-fluid app-container",children:[Object(W.jsx)(e,{}),Object(W.jsxs)("div",{className:"app",children:[Object(W.jsx)("div",{className:H()("shlink-wrapper",{"d-flex d-md-block align-items-center":h}),children:Object(W.jsxs)(Ge.d,{children:[Object(W.jsx)(Ge.b,{index:!0,element:Object(W.jsx)(t,{})}),Object(W.jsx)(Ge.b,{path:"/settings/*",element:Object(W.jsx)(a,{})}),Object(W.jsx)(Ge.b,{path:"/manage-servers",element:Object(W.jsx)(s,{})}),Object(W.jsx)(Ge.b,{path:"/server/create",element:Object(W.jsx)(n,{})}),Object(W.jsx)(Ge.b,{path:"/server/:serverId/edit",element:Object(W.jsx)(c,{})}),Object(W.jsx)(Ge.b,{path:"/server/:serverId/*",element:Object(W.jsx)(r,{})}),Object(W.jsx)(Ge.b,{path:"*",element:Object(W.jsx)(fl.a,{})})]})}),Object(W.jsx)("div",{className:"shlink-footer",children:Object(W.jsx)(i,{})})]}),Object(W.jsx)(gl,{isOpen:j,toggle:b,forceUpdate:pl})]})}},yl=function(e,t){e.serviceFactory("App",Sl,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ManageServers","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return Ol})),e.serviceFactory("resetAppUpdate",(function(){return vl}))},Cl=new d.a,Nl=Cl.container,kl=function(e,t){return Object(u.a)(Object(u.a)({},e),{},Object(l.a)({},t,function(e,t){return function(){return e[t].apply(e,arguments)}}(Nl,t)))},_l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Object(s.b)(e?Object(j.a)(e):null,t.reduce(kl,{}))};yl(Cl,_l),Object(I.a)(Cl,_l),V(Cl),Tn(Cl,_l),Ac(Cl,_l),go(Cl,_l),Ui(Cl,_l),Object(xo.a)(Cl),ko(Cl),Fo(Cl,_l),dl(Cl,_l);var wl=r(269),Ul=r(74),Tl=r(201),Rl=Object(Ul.c)({servers:dc,selectedServer:tc,shortUrlsList:tn,shortUrlCreationResult:Wr,shortUrlDeletion:Ir,shortUrlEdition:Zr,shortUrlVisits:Ms,tagVisits:Zs,orphanVisits:ii,nonOrphanVisits:gi,shortUrlDetail:wn,tagsList:bo,tagDelete:Qi,tagEdit:to,mercureInfo:Co,settings:Nt,domainsList:Zo,visitsOverview:ki,appUpdated:hl}),El=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||Ul.d,Dl={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},Ll=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(u.a)(Object(u.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(Tl.load)(Dl)),Vl=Object(Ul.e)(Rl,Ll,El(Object(Ul.a)(Object(Tl.save)(Dl),wl.a))),Il=r(60),Fl=r.n(Il),Al=r(270),Ml=r(271),Gl=r(272),Pl=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 Bl(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(488),r(489);delete Fl.a.Icon.Default.prototype._getIconUrl,Fl.a.Icon.Default.mergeOptions({iconRetinaUrl:Al.a,iconUrl:Ml.a,shadowUrl:Gl.a});var Hl=Nl.App,Wl=Nl.ScrollToTop,ql=Nl.ErrorHandler,zl=Nl.appUpdateAvailable;Object(a.render)(Object(W.jsx)(s.a,{store:Vl,children:Object(W.jsx)(i.a,{basename:o.a,children:Object(W.jsx)(ql,{children:Object(W.jsx)(Wl,{children:Object(W.jsx)(Hl,{})})})})}),document.getElementById("root")),function(e){if("serviceWorker"in navigator){var t;if(new URL(null!==(t="/shlink-web-client/dependabot/npm_and_yarn/urijs-1.19.9")?t:"",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var t="".concat("/shlink-web-client/dependabot/npm_and_yarn/urijs-1.19.9","/service-worker.js");Pl?(!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()}))})):Bl(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")}))):Bl(t,e)}))}}({onUpdate:function(){Vl.dispatch(zl())}})},50:function(e,t,r){"use strict";var n=r(495),c=r(281),a=r(8),s=r.n(a),i=r(12),o=r(11),l=r(0),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,a=e.loading,j=void 0!==a&&a,b=e.type,h=void 0===b?"default":b,O=e.fullWidth,v=void 0!==O&&O,f=s()({"col-md-12":v,"col-md-10 offset-md-1":!v});return Object(l.jsx)(n.a,{noGutters:!0,className:t,children:Object(l.jsx)("div",{className:f,children:Object(l.jsx)(c.a,{className:u(h),body:!0,children:Object(l.jsxs)("h3",{className:s()("text-center mb-0",d(h)),children:[j&&Object(l.jsx)(o.a,{icon:i.k,spin:!0}),j&&Object(l.jsx)("span",{className:"ml-2",children:null!==r&&void 0!==r?r:"Loading..."}),!j&&r]})})})})}},57: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})}},65: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(156),c=r(496),a=r(501),s=r(31),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}}},93:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(1),a=r(0);function s(e){return function(t){return Object(c.useEffect)((function(){t.resetSelectedServer()}),[]),Object(a.jsx)(e,Object(n.a)({},t))}}},94: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)}}},[[284,1,2]]]);
|
|
//# sourceMappingURL=main.e1d840bc.chunk.js.map
|