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.8"}')},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(38),s=r(37),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(39),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.g)(N),L=Object(b.f)(N),V=Object(b.d)(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(34),a=r(12),s=r(11),i=r(19),o=r(27),l=r(8),u=r.n(l),d=r(29),j=r(39),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.d)(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(34),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})]}))}},372:function(e,t){},374:function(e,t){},39:function(e,t,r){"use strict";r.d(t,"i",(function(){return s})),r.d(t,"k",(function(){return i})),r.d(t,"g",(function(){return o})),r.d(t,"h",(function(){return l})),r.d(t,"l",(function(){return u})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return j})),r.d(t,"j",(function(){return b})),r.d(t,"d",(function(){return h})),r.d(t,"e",(function(){return O})),r.d(t,"c",(function(){return v})),r.d(t,"f",(function(){return f}));var n=r(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"})},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 Ka})),r.d(n,"normalizeVisits",(function(){return Qa}));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(34),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(27),Le=function(){var e=Object(De.g)(),t=Object(De.f)(),r=Object(De.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))}]},Ve=function(e){return e?Object(G.default)(e):null},Ie=function(e){return function(){var t,r=Le(),n=Object(C.a)(r,2),c=n[0],a=c.search,s=c.tags,i=c.startDate,o=c.endDate,l=n[1],u=null!==(t=null===s||void 0===s?void 0:s.split(","))&&void 0!==t?t:[],d=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}}),l),j=Object(M.a)((function(e){return Object(S.a)(e)?void 0:e}),(function(e){return l({search:e})})),b=Object(M.a)((function(e){return u.filter((function(t){return t!==e}))}),(function(e){return 0===e.length?void 0:e.join(",")}),(function(e){return l({tags:e})}));return Object(W.jsxs)("div",{className:"short-urls-filtering-bar-container",children:[Object(W.jsx)(q,{initialValue:a,onChange:j}),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:Ve(i),endDate:Ve(o)},onDatesChange:d})})})}),u.length>0&&Object(W.jsxs)("h4",{className:"short-urls-filtering-bar__selected-tag mt-3",children:[Object(W.jsx)(A.a,{icon:F.O,className:"short-urls-filtering-bar__tags-icon"}),"\xa0",u.map((function(t){return Object(W.jsx)(z,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return b(t)}},t)}))]})]})}},Fe=r(25),Ae=r(281),Me=r(519),Ge=r(520);function Pe(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)(Me.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(Ge.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 Be=r(256);function He(e,t){var r=new Set;return function(n){var c=n.createNewVisits,a=n.loadMercureInfo,s=n.mercureInfo,i=s.interval,o=Object(De.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 Be.EventSourcePolyfill(t,{headers:{Authorization:"Bearer ".concat(a)}});return r.onmessage=o,r.onerror=l,r}));return function(){return u.forEach((function(e){return e.close()}))}}}(s,e,(function(e){return i?r.add(e):c([e])}),a);if(!i)return l;var u=setInterval((function(){c(Object(Fe.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 We=function e(){Object(m.a)(this,e)};function qe(e){var t=e.currentOrder,r=e.field,n=e.className,c=void 0===n?"ml-1":n;return t.dir&&t.field===r?Object(W.jsx)(A.a,{icon:"ASC"===t.dir?F.f:F.e,className:c}):null}We.visits="https://shlink.io/new-visit",We.orphanVisits="https://shlink.io/new-orphan-visit",We.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var ze,Ke,Qe,Je,Ze,Ye,Xe,$e,et,tt,rt,nt,ct,at,st,it,ot,lt,ut,dt=r(566),jt=r(521),bt=function(e,t){return function(r,n){var c=n.type,a=e[c],s=null!==r&&void 0!==r?r:t;return a?a(s,n):s}},ht=function(e){return function(){return{type:e}}},Ot="shlink/realTimeUpdates/SET_SETTINGS",vt={field:"dateCreated",dir:"DESC"},ft={realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"},shortUrlsList:{defaultOrdering:vt}},mt=bt(Object(l.a)({},Ot,(function(e,t){return Object(dt.a)(e,Object(jt.a)("type",t))})),ft),gt=function(e){return{type:Ot,realTimeUpdates:{enabled:e}}},xt=function(e){return{type:Ot,realTimeUpdates:{interval:e}}},pt=function(e){return{type:Ot,shortUrlCreation:e}},St=function(e){return{type:Ot,shortUrlsList:e}},yt=function(e){return{type:Ot,ui:e}},Ct=function(e){return{type:Ot,visits:e}},Nt=function(e){return{type:Ot,tags:e}},kt=r(523),_t=r(524),wt=r(525),Ut=r(500),Tt=r(254),Rt=r(522),Et=Math.ceil,Dt=new Intl.NumberFormat("en-US"),Lt=function(e){return Dt.format(Number(e))},Vt="...",It=function(e,t){var r=Object(Ut.a)(Object(Tt.a)(2,e-2),Object(Rt.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Vt),e+2<t-1&&r.push(Vt),r.unshift(1),r.push(t),r},Ft=function(e){return e===Vt},At=function(e){return Ft(e)?e:Lt(e)},Mt=function(e,t){return Ft(e)?"".concat(e,"_").concat(t):"".concat(e)},Gt=function(e){var t=e.paginator,r=e.serverId,n=e.currentQueryString,c=void 0===n?"":n,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)(wt.a,{className:"sticky-card-paginator",listClassName:"flex-wrap justify-content-center mb-0",children:[Object(W.jsx)(kt.a,{disabled:1===o,children:Object(W.jsx)(_t.a,{previous:!0,tag:i.b,to:d(o-1)})}),It(o,u).map((function(e,t){return Object(W.jsx)(kt.a,{disabled:Ft(e),active:o===e,children:Object(W.jsx)(_t.a,{tag:i.b,to:d(e),children:At(e)})},Mt(e,t))})),Object(W.jsx)(kt.a,{disabled:o>=u,children:Object(W.jsx)(_t.a,{next:!0,tag:i.b,to:d(o+1)})})]})},Pt={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Bt=function(e,t){return He((function(r){var n,c,a,s=r.listShortUrls,i=r.shortUrlsList,o=r.selectedServer,l=r.settings,u=Object(h.a)(o),d=Object(De.h)().page,j=Object(De.f)(),b=Le(),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=O[1],y=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:vt),k=Object(C.a)(y,2),_=k[0],w=k[1],U=Object(P.useMemo)((function(){var e;return null!==(e=null===f||void 0===f?void 0:f.split(","))&&void 0!==e?e:[]}),[f]),T=(null!==(a=null===i||void 0===i?void 0:i.shortUrls)&&void 0!==a?a:{}).pagination,R=function(e,t){S({orderBy:{field:e,dir:t}}),w({field:e,dir:t})},E=Object(M.a)((function(e){return Object(Fe.a)(new Set([].concat(Object(Fe.a)(U),[e]))).join(",")}),(function(e){return S({tags:e})}));return Object(P.useEffect)((function(){s({page:d,searchTerm:m,tags:U,startDate:g,endDate:x,orderBy:_})}),[d,m,U,g,x,_]),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)(Pe,{items:Pt,order:_,onChange:R})}),Object(W.jsxs)(Ae.a,{body:!0,className:"pb-1",children:[Object(W.jsx)(e,{selectedServer:o,shortUrlsList:i,orderByColumn:function(e){return function(){return R(e,N(e,_.field,_.dir))}},renderOrderIcon:function(e){return Object(W.jsx)(qe,{currentOrder:_,field:e})},onTagClick:E}),Object(W.jsx)(Gt,{paginator:T,serverId:u,currentQueryString:j.search})]})]})}),(function(){return[We.visits]}))},Ht=r(43),Wt=r(148),qt=r.n(Wt),zt=function(e){var t=e.text,r=e.onCopy;return Object(W.jsx)(qt.a,{text:t,onCopy:r,children:Object(W.jsx)(A.a,{icon:we.d,className:"ml-2 copy-to-clipboard-icon"})})},Kt=r(526),Qt=r(567),Jt=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(Kt.a)(s),"000"),children:a?"".concat(Object(Qt.a)(new Date,s)," ago"):Object(ae.default)(s,n)})},Zt=r(527),Yt=function(e,t,r){var n=e.id,c=t.shortCode,a=t.domain,s=a?"?domain=".concat(a):"";return"/server/".concat(n,"/short-code/").concat(c,"/").concat(r).concat(s)},Xt=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,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:Yt(t,r,n)},a),{},{children:c})):Object(W.jsx)("span",Object(u.a)(Object(u.a)({},a),{},{children:c}))},$t=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)(Xt,{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:Lt(r)})});if(!i)return o;var l=Lt(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)(Zt.a,{target:function(){return u.current},placement:"bottom",children:["This short URL will not accept more than ",Object(W.jsx)("b",{children:l})," visits."]})]})},er=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)(Jt,{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)(Ht.a,{href:s.shortUrl}),Object(W.jsx)(zt,{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)(Ht.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)(Ht.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)($t,{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})})]})}},tr=r(528),rr=function(e){var t=e.isOpen,r=e.toggle,n=e.children,c=e.right,a=void 0===c||c;return Object(W.jsxs)(tr.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})]})},nr=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)(rr,{toggle:o,isOpen:i,children:[Object(W.jsxs)(K.a,{tag:Xt,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:Xt,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})]})}},cr=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}))]})}},ar=r(569),sr=r(529),ir=r(530),or=r(531),lr=r(501),ur=r(31),dr=r(495),jr=r(32),br=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,a=void 0!==c&&c;return Object(W.jsx)(dr.a,{className:n,children:Object(W.jsx)("div",{className:H()({"col-md-10 offset-md-1":!a,"col-12":a}),children:Object(W.jsx)(jr.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})})})},hr=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},Or=function(e){return"INVALID_SHORTCODE_DELETION"===(null===e||void 0===e?void 0:e.type)||"INVALID_SHORT_URL_DELETION"===(null===e||void 0===e?void 0:e.type)},vr=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(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(", "),"]"]}))]})},fr=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(ur.b)((function(){var e=t.shortCode,n=t.domain;s(e,n).then(r).catch(lr.a)}));return Object(W.jsx)(ar.a,{isOpen:n,toggle:b,centered:!0,children:Object(W.jsxs)("form",{onSubmit:h,children:[Object(W.jsx)(sr.a,{toggle:b,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(W.jsxs)(ir.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)(br,{type:Or(j)?"warning":"error",small:!0,className:"mt-2",children:Object(W.jsx)(vr,{errorData:j,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(W.jsxs)(or.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"})]})]})})},mr=r(199),gr=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)(br,{type:"error",className:"mt-3",children:[i&&Object(W.jsx)(A.a,{icon:F.Q,className:"float-right pointer",onClick:a}),Object(W.jsx)(vr,{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)(br,{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)(qt.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)(mr.a,{placement:"left",isOpen:u,target:"copyBtn",children:"Copied!"})]})}},xr=r(532),pr=r(533),Sr=r(257),yr=function(e,t,r){return Object(p.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},Cr="shlink/visitCreation/CREATE_VISITS",Nr=function(e){return{type:Cr,createdVisits:e}},kr="shlink/deleteShortUrl/DELETE_SHORT_URL_START",_r="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",wr="shlink/deleteShortUrl/SHORT_URL_DELETED",Ur="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",Tr={shortCode:"",loading:!1,error:!1},Rr=bt((ze={},Object(l.a)(ze,kr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(ze,_r,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(l.a)(ze,wr,(function(e,t){var r=t.shortCode;return Object(u.a)(Object(u.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(l.a)(ze,Ur,(function(){return Tr})),ze),Tr),Er=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:kr}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:wr,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:_r,errorData:hr(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},Dr=ht(Ur),Lr="shlink/createShortUrl/CREATE_SHORT_URL_START",Vr="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",Ir="shlink/createShortUrl/CREATE_SHORT_URL",Fr="shlink/createShortUrl/RESET_CREATE_SHORT_URL",Ar={result:null,saving:!1,error:!1},Mr=bt((Ke={},Object(l.a)(Ke,Lr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(Ke,Vr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(Ke,Ir,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(l.a)(Ke,Fr,(function(){return Ar})),Ke),Ar),Gr=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:Lr}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Ir,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:Vr,errorData:hr(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},Pr=ht(Fr),Br=r(39),Hr="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Wr="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",qr="shlink/shortUrlEdition/SHORT_URL_EDITED",zr=bt((Qe={},Object(l.a)(Qe,Hr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{saving:!0,error:!1})})),Object(l.a)(Qe,Wr,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(l.a)(Qe,qr,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),Qe),{saving:!1,error:!1}),Kr=function(e){return function(t,r,n){return function(){var c=Object(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:Hr}),i=s(),o=i.selectedServer,l=!Object(Br.l)(o),u=e(s),d=u.updateShortUrl,j=u.updateShortUrlTags,c.prev=4,c.next=7,Promise.all([d(t,r,n),l&&n.tags?j(t,r,n.tags):void 0]);case 7:b=c.sent,h=Object(C.a)(b,1),O=h[0],a({shortUrl:O,type:qr}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Wr,errorData:hr(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Qr="shlink/shortUrlsList/LIST_SHORT_URLS_START",Jr="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",Zr="shlink/shortUrlsList/LIST_SHORT_URLS",Yr=bt((Je={},Object(l.a)(Je,Qr,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(Je,Jr,(function(){return{loading:!1,error:!0}})),Object(l.a)(Je,Zr,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(l.a)(Je,wr,Object(M.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(xr.a)(["shortUrls","data"],Object(x.a)((function(e){return yr(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(xr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(l.a)(Je,Cr,(function(e,t){var r,n,c=t.createdVisits;return Object(xr.a)(["shortUrls","data"],null===(r=e.shortUrls)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.map((function(e){var t=Object(pr.a)(c.filter((function(t){var r=t.shortUrl;return r&&yr(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(Sr.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(l.a)(Je,Ir,Object(M.a)((function(e,t){var r=t.result;return e.shortUrls?Object(xr.a)(["shortUrls","data"],[r].concat(Object(Fe.a)(e.shortUrls.data.slice(0,4))),e):e}),(function(e){return e.shortUrls?Object(xr.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(l.a)(Je,qr,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(xr.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return yr(e,t,n)?r:e})),e):e})),Je),{loading:!0,error:!1}),Xr=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var r=Object(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:Qr}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Zr,shortUrls:i}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:Jr});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},$r=function(e){return function(t){var r=t.orderByColumn,n=t.renderOrderIcon,c=t.shortUrlsList,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(Br.k)(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)}))})]})}},en=r(534),tn=r(196),rn=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"})]})},nn=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"]})]})},cn=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(Br.i)(o),marginIsSupported:Object(Br.h)(o),errorCorrectionIsSupported:Object(Br.j)(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)(ar.a,{isOpen:i,toggle:s,centered:!0,size:L,children:[Object(W.jsxs)(sr.a,{toggle:s,children:["QR code for ",Object(W.jsx)(Ht.a,{href:c,children:c})]}),Object(W.jsxs)(ir.a,{children:[Object(W.jsxs)(dr.a,{children:[Object(W.jsxs)(en.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)(en.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)(en.a,{className:R?"col-md-4":"col-md-6",children:Object(W.jsx)(rn,{format:p,setFormat:N})}),T.errorCorrectionIsSupported&&Object(W.jsx)(en.a,{className:"col-md-6",children:Object(W.jsx)(nn,{errorCorrection:w,setErrorCorrection:U})})]}),Object(W.jsxs)("div",{className:"text-center",children:[Object(W.jsxs)("div",{className:"mb-3",children:[Object(W.jsx)(Ht.a,{href:E}),Object(W.jsx)(zt,{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)(tn.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"})]})})})]})]})]})}},an=r(537),sn=r(535),on=r(536),ln=r(564),un=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?lr.a:n,a=e.className,s=e.children,i=e.type,o=e.inline,l=void 0!==o&&o,u=Object(P.useRef)(Object(ln.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})]})},dn=function(e){return Object(W.jsx)(un,Object(u.a)({type:"checkbox"},e))},jn=function(e){var t=e.isOpen,r=e.toggle;return Object(W.jsxs)(ar.a,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(W.jsx)(sr.a,{toggle:r,children:"Info"}),Object(W.jsxs)(ir.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"})]})]})]})},bn=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)(jn,{isOpen:r,toggle:n})]})},hn=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)(Zt.a,{target:function(){return a.current},placement:n,children:c})]})},On=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(W.jsxs)("p",{children:[Object(W.jsx)(dn,{inline:!0,checked:n,className:r?"mr-2":"",onChange:c,children:t}),r&&Object(W.jsx)(hn,{placement:"right",children:r})]})},vn=Object(M.a)(sn.a,Object(on.a)(/ /g,"-")),fn=function(e){return"string"===typeof e?Object(G.default)(e):e},mn=function(e){return{"col-sm-6":e,"col-sm-12":!e}},gn=function(e,t){return function(r){var n,c=r.mode,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(ur.c)(i.title),x=function(){var e=Object(ur.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(ur.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(ur.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)(en.a,Object(u.a)(Object(u.a)({},a),{},{children:Object(W.jsx)(an.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]?fn(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)(en.a,{children:Object(W.jsx)(an.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)(dr.a,{children:[m&&y("customSlug","Custom slug","text",{bsSize:"lg"},{className:"col-lg-6"}),Object(W.jsx)(en.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(vn)}))}})})]})]}),_=Object(Br.k)(o),w=_||!O,U=H()("mb-3",mn(w)),T=Object(Br.b)(o),R=Object(Br.e)(o),E=T||R,D=H()("mb-3",mn(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)(jr.a,{title:"Basic options",className:"mb-3",children:k}),Object(W.jsxs)(dr.a,{children:[w&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(jr.a,{title:"Customize the short URL",children:[_&&y("title","Title"),!O&&Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(dr.a,{children:[Object(W.jsx)("div",{className:"col-lg-6",children:y("customSlug","Custom slug","text",{disabled:Object(ur.c)(b.shortCodeLength)})}),Object(W.jsx)("div",{className:"col-lg-6",children:y("shortCodeLength","Short code length","number",{min:4,disabled:Object(ur.c)(b.customSlug)})})]}),Object(W.jsx)(en.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)(jr.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?fn(b.validUntil):void 0}),N("validUntil","Enabled until...",{minDate:b.validSince?fn(b.validSince):void 0})]})})]}),Object(W.jsxs)(dr.a,{children:[Object(W.jsx)("div",{className:D,children:Object(W.jsxs)(jr.a,{title:"Extra checks",children:[Object(W.jsx)(On,{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)(dn,{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)(bn,{})]})]})}),E&&Object(W.jsx)("div",{className:"col-sm-6 mb-3",children:Object(W.jsxs)(jr.a,{title:"Configure behavior",children:[T&&Object(W.jsx)(On,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:b.crawlable,onChange:function(e){return h(Object(u.a)(Object(u.a)({},b),{},{crawlable:e}))},children:"Make it crawlable"}),R&&Object(W.jsx)(On,{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)(tn.a,{outline:!0,color:"primary",disabled:a||Object(S.a)(b.longUrl),className:"btn-xs-block",children:a?"Saving...":"Save"})})]})}},xn=r(50),pn=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(De.f)().search,u=Object(De.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)(xn.a,{loading:!0}):b?Object(W.jsx)(br,{type:"error",children:Object(W.jsx)(vr,{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)(Ae.a,{body:!0,children:Object(W.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(tn.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)(Ht.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)(br,{type:"error",className:"mt-3",children:Object(W.jsx)(vr,{errorData:x,fallbackMessage:"An error occurred while updating short URL :("})}),_&&Object(W.jsx)(br,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},Sn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",yn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",Cn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",Nn={loading:!1,error:!1},kn=bt((Ze={},Object(l.a)(Ze,Sn,(function(){return{loading:!0,error:!1}})),Object(l.a)(Ze,yn,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(l.a)(Ze,Cn,(function(e,t){var r=t.shortUrl;return Object(u.a)({shortUrl:r},Nn)})),Ze),Nn),_n=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:Sn}),n.prev=1,o=a(),l=o.shortUrlsList,null===(s=null===l||void 0===l||null===(i=l.shortUrls)||void 0===i?void 0:i.data.find((function(e){return yr(e,t,r)})))||void 0===s){n.next=7;break}n.t0=s,n.next=10;break;case 7:return n.next=9,e(a).getShortUrl(t,r);case 9:n.t0=n.sent;case 10:u=n.t0,c({shortUrl:u,type:Cn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:yn,errorData:hr(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},wn=function(e,t){e.serviceFactory("ShortUrlsList",Bt,"ShortUrlsTable","ShortUrlsFilteringBar"),e.decorator("ShortUrlsList",t(["selectedServer","mercureInfo","shortUrlsList","settings"],["listShortUrls","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",$r,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",er,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",nr,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",gr,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",gn,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",cr,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",pn,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return fr})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",cn,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("ShortUrlsFilteringBar",Ie,"ColorGenerator"),e.serviceFactory("listShortUrls",Xr,"buildShlinkApiClient"),e.serviceFactory("createShortUrl",Gr,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return Pr})),e.serviceFactory("deleteShortUrl",Er,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return Dr})),e.serviceFactory("getShortUrlDetail",_n,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Kr,"buildShlinkApiClient")},Un=r(258),Tn=r.n(Un),Rn=r(57),En=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(ln.a)());return Object(W.jsxs)(en.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)}})]})},Dn=function(e){return Object(W.jsx)(En,Object(u.a)(Object(u.a)({},e),{},{labelClassName:"server-form__label"}))},Ln=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(ur.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)(jr.a,{className:"mb-3",title:c,children:[Object(W.jsx)(Dn,{value:i,onChange:o,children:"Name"}),Object(W.jsx)(Dn,{type:"url",value:d,onChange:j,children:"URL"}),Object(W.jsx)(Dn,{value:O,onChange:v,children:"API key"})]}),Object(W.jsx)("div",{className:"text-right",children:n})]})},Vn=function(e){var t=e.isOpen,r=e.duplicatedServers,n=e.onDiscard,c=e.onSave,a=r.length>1;return Object(W.jsxs)(ar.a,{centered:!0,isOpen:t,children:[Object(W.jsxs)(sr.a,{children:["Duplicated server",a&&"s"]}),Object(W.jsxs)(ir.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)(or.a,{children:[Object(W.jsx)(tn.a,{color:"link",onClick:n,children:a?"Ignore duplicated":"Discard"}),Object(W.jsx)(tn.a,{color:"primary",onClick:c,children:"Save anyway"})]})]})},In=function(e){var t=e.type;return Object(W.jsx)("div",{className:"mt-3",children:Object(W.jsxs)(br,{type:t,children:["success"===t&&"Servers properly imported. You can now select one from the list :)","error"===t&&"The servers could not be imported. Make sure the format is correct."]})})},Fn=function(e,t){return function(r){var n=r.servers,c=r.createServer,a=Object(De.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(ln.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)(Rn.a,{children:[Object(W.jsxs)(Ln,{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)(tn.a,{outline:!0,onClick:s,children:"Cancel"}),Object(W.jsx)(tn.a,{outline:!0,color:"primary",className:"ml-2",children:"Create server"})]}),d&&Object(W.jsx)(In,{type:"success"}),O&&Object(W.jsx)(In,{type:"error"}),Object(W.jsx)(Vn,{isOpen:g,duplicatedServers:y?[y]:[],onDiscard:s,onSave:k})]})}},An=r(512),Mn=function(e){var t=e.servers,r=e.selectedServer,n=Object(An.a)(t);return Object(W.jsxs)(Me.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"})]})]})})]})},Gn=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(De.g)();return Object(W.jsxs)(ar.a,{isOpen:n,toggle:r,centered:!0,children:[Object(W.jsx)(sr.a,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(W.jsxs)(ir.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)(or.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"})]})]})},Pn=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})]})}},Bn=r(138),Hn=function(e){return Object(Bn.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)(Rn.a,{children:Object(W.jsxs)(Ln,{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)(tn.a,{outline:!0,className:"mr-2",onClick:n,children:"Cancel"}),Object(W.jsx)(tn.a,{outline:!0,color:"primary",children:"Save"})]})})}),e)},Wn=r(563),qn=function(e){return function(t){var r=t.url,n=t.apiKey;return e.some((function(e){return e.url===r&&e.apiKey===n}))}},zn=function(e){var t=e.importServersFromFile;return function(e){var r=e.createServers,n=e.servers,c=e.fileRef,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(Wn.a)(qn(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(qn(e)),r=!!t.length;r?N(t):R(g),r&&U()}}),[g]),Object(W.jsxs)(W.Fragment,{children:[Object(W.jsxs)(tn.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)(Zt.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)(Vn,{isOpen:w,duplicatedServers:y,onDiscard:D,onSave:E})]})}},Kn=r(496),Qn=r(65),Jn="shlink/selectedServer/SELECT_SERVER",Zn="shlink/selectedServer/RESET_SELECTED_SERVER",Yn=Object(M.a)((function(e){return"latest"===e?"999.999.999":e}),Object(Qn.c)("1.0.0")),Xn=Object(Kn.a)(lr.a,function(){var e=Object(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:Yn(t),printableVersion:Object(Qn.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),$n=bt((Ye={},Object(l.a)(Ye,Zn,(function(){return null})),Object(l.a)(Ye,Jn,(function(e,t){return t.selectedServer})),Ye),null),ec=ht(Zn),tc=function(e,t){return function(r){return function(){var n=Object(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(ec()),s=a(),i=s.servers,o=i[r]){n.next=6;break}return c({type:Jn,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 6:return n.prev=6,l=e(o),d=l.health,n.next=10,Xn(r,d);case 10:j=n.sent,b=j.version,h=j.printableVersion,c({type:Jn,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:Jn,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)}}()}},rc=r(538),nc=r(139),cc=r(104),ac="shlink/servers/EDIT_SERVER",sc="shlink/servers/DELETE_SERVER",ic="shlink/servers/CREATE_SERVERS",oc="shlink/servers/SET_AUTO_CONNECT",lc=bt((Xe={},Object(l.a)(Xe,ic,(function(e,t){var r=t.newServers;return Object(u.a)(Object(u.a)({},e),r)})),Object(l.a)(Xe,sc,(function(e,t){var r=t.serverId;return Object(jt.a)(r,e)})),Object(l.a)(Xe,ac,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(Sr.a)(r,Object(u.a)(Object(u.a)({},e[r]),n),e):e})),Object(l.a)(Xe,oc,(function(e,t){var r=t.serverId,n=t.autoConnect;return e[r]?n?Object(rc.a)(Object(Ge.a)(e).map((function(e){var t=Object(C.a)(e,2),n=t[0],c=t[1];return[n,Object(u.a)(Object(u.a)({},c),{},{autoConnect:n===r})]}))):Object(Sr.a)(r,Object(u.a)(Object(u.a)({},e[r]),{},{autoConnect:n}),e):e})),Xe),{}),uc=Object(nc.a)((function(e,t){return Object(Sr.a)(t.id,t,e)}),{}),dc=Object(M.a)(Object(cc.a)((function(e){return e.id?e:Object(Sr.a)("id",Object(ln.a)(),e)})),uc,(function(e){return{type:ic,newServers:e}})),jc=function(e){return dc([e])},bc=function(e,t){return{type:ac,serverId:e,serverData:t}},hc=function(e){var t=e.id;return{type:sc,serverId:t}},Oc=function(e,t){var r=e.id;return{type:oc,serverId:r,autoConnect:t}},vc=Object(M.a)(Object(b.a)("data"),(function(e){return Array.isArray(e)?e.filter(h.b):[]})),fc=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=vc(n),r(dc(c));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},mc=function(e){var t=e.minVersion,r=e.maxVersion,n=e.selectedServer,c=e.children;if(!Object(h.d)(n))return null;var a=n.version;return Object(Qn.a)(a,{maxVersion:r,minVersion:t})?Object(W.jsx)(W.Fragment,{children:c}):null},gc=r(152),xc=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(W.jsx)(Rn.a,{children:Object(W.jsxs)("div",{className:"server-error__container flex-column",children:[Object(W.jsxs)(xn.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)(gc.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"}),"."]})})]})})}},pc=r(93),Sc=r(497),yc=r(498),Cc=r(539),Nc=r(540),kc=function(e){var t=e.children,r=e.title,n=e.link;return Object(W.jsxs)(Ae.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)(Cc.a,{tag:"h5",className:"highlight-card__title",children:r}),Object(W.jsx)(Nc.a,{tag:"h2",children:t})]}))},_c=function(e,t,r){return He((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(Br.g)(u),S=Object(Br.f)(u),y=Object(De.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)(dr.a,{children:[Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsx)(kc,{title:"Visits",link:S&&"/server/".concat(x,"/non-orphan-visits"),children:f?"Loading...":Lt(m)})}),Object(W.jsx)("div",{className:"col-lg-6 col-xl-3 mb-3",children:Object(W.jsxs)(kc,{title:"Orphan visits",link:p&&"/server/".concat(x,"/orphan-visits"),children:[Object(W.jsx)(r,{minVersion:"2.6.0",children:f?"Loading...":Lt(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)(kc,{title:"Short URLs",link:"/server/".concat(x,"/list-short-urls/1"),children:b?"Loading...":Lt(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)(kc,{title:"Tags",link:"/server/".concat(x,"/manage-tags"),children:v?"Loading...":Lt(l.tags.length)})})]}),Object(W.jsxs)(Ae.a,{className:"mb-3",children:[Object(W.jsxs)(Sc.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)(yc.a,{children:Object(W.jsx)(t,{basicMode:!0})})]}),Object(W.jsxs)(Ae.a,{children:[Object(W.jsxs)(Sc.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)(yc.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[We.visits,We.orphanVisits]}))},wc=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)(Rn.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)(dr.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)(tn.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)(tn.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)(jr.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)(br,{type:"error",children:"The servers could not be imported. Make sure the format is correct."})})]})}},Uc=function(e){return function(t){var r=t.server,n=t.hasAutoConnect;return Object(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)(Zt.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})})]})}},Tc=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)(rr,{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})]})}},Rc=function(e){return"string"===typeof e.url&&"string"===typeof e.apiKey&&"string"===typeof e.name},Ec=function(e){return Array.isArray(e)&&e.every(Rc)},Dc=function e(t,r){var n=this;Object(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(!Ec(o))throw new Error("Provided file does not have the right format.");e(o)}catch(t){c(t)}})),r.readAsText(t)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},Lc=r(94),Vc=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(An.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(h.f);try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(Lc.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))},Ic=function(e,t){e.serviceFactory("ManageServers",wc,"ServersExporter","ImportServersBtn","useStateFlagTimeout","ManageServersRow"),e.decorator("ManageServers",t(["servers"])),e.serviceFactory("ManageServersRow",Uc,"ManageServersRowDropdown"),e.serviceFactory("ManageServersRowDropdown",Tc,"DeleteServerModal"),e.decorator("ManageServersRowDropdown",t(null,["setAutoConnect"])),e.serviceFactory("CreateServer",Fn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",pc.a),e.decorator("CreateServer",t(["selectedServer","servers"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",Hn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",(function(){return Mn})),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return Gn})),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",Pn,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",zn,"ServersImporter"),e.decorator("ImportServersBtn",t(["servers"],["createServers"])),e.serviceFactory("ForServerVersion",(function(){return mc})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",xc,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",_c,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",Tn.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",Dc,"csvjson","fileReaderFactory"),e.service("ServersExporter",Vc,"Storage","window","csvjson"),e.serviceFactory("selectServer",tc,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return jc})),e.serviceFactory("createServers",(function(){return dc})),e.serviceFactory("deleteServer",(function(){return hc})),e.serviceFactory("editServer",(function(){return bc})),e.serviceFactory("setAutoConnect",(function(){return Oc})),e.serviceFactory("fetchServers",fc,"axios"),e.serviceFactory("resetSelectedServer",(function(){return ec}))},Fc=r(570),Ac=r(541),Mc=r(542),Gc=r(543),Pc=function(){return Object(W.jsx)(Fc.a,{attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},Bc=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(b.a)("latLong"))}:{zoom:10,center:Object(C.a)(e,1)[0].latLong}},Hc=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,a=void 0===c?[]:c;return Object(W.jsx)(ar.a,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(W.jsxs)(ir.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)(Ac.a,Object(u.a)(Object(u.a)({},Bc(a)),{},{children:[Object(W.jsx)(Pc,{}),a.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(W.jsx)(Mc.a,{position:n,children:Object(W.jsxs)(Gc.a,{children:[Object(W.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(W.jsx)("b",{children:r})]})},t)}))]}))]})})},Wc=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)(Ae.a,{body:!0,children:[Object(W.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(W.jsx)(tn.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)($t,{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})]})})},qc=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)(Ht.a,{href:l})]});return Object(W.jsxs)(Wc,{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)(Jt,{date:s.dateCreated,relative:!0})}),Object(W.jsx)(Zt.a,{placement:"bottom",target:"created",children:Object(W.jsx)(Jt,{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)(Ht.a,{href:u,children:null!==d&&void 0!==d?d:u})]})]})},zc=r(556),Kc=r(557),Qc=r(509),Jc=r(507),Zc=function(e){var t=e.children,r=Object(g.a)(e,["children"]);return Object(W.jsx)(Qc.a,Object(u.a)(Object(u.a)({className:"nav-pills__nav-link",tag:i.c},r),{},{children:t}))},Yc=function(e){var t=e.children,r=e.fill,n=void 0!==r&&r;return Object(W.jsx)(Ae.a,{className:"nav-pills__nav p-0 overflow-hidden mb-3",body:!0,children:Object(W.jsx)(Jc.a,{pills:!0,fill:n,children:P.Children.map(t,(function(e){if(!Object(P.isValidElement)(e)||e.type!==Zc)throw new Error("Only NavPillItem children are allowed inside NavPills.");return e}))})})},Xc=r(103),$c=r(548),ea=r(549),ta=r(551),ra=r(545),na=r(262),ca=r(546),aa=r(280),sa=r(86),ia=r(547),oa=r(550),la=r(261),ua=r.n(la),da=r(544),ja="Others",ba=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],ha=function(e){var t,r;return Object(ur.c)(e)?null!==(t=null===(r=e.split("/")[e.includes("://")?2:0])||void 0===r?void 0:r.split(":")[0])&&void 0!==t?t:"":"Direct"},Oa=function(e,t){return Object.values(Object(u.a)(Object(u.a)({},Object(da.a)(t,t.map((function(){return 0})))),e))},va=function(e){return Object(W.jsx)(un,Object(u.a)({type:"switch"},e))},fa=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")},ma=function(e){var t=e.dataset,r=e.formattedValue;return"".concat(t.label,": ").concat(Lt(r))},ga=function(e){var t=e.label,r=e.formattedValue;return"".concat(t,": ").concat(Lt(r))},xa=r(44),pa={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},Sa={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},ya={hourly:ra.a,daily:na.a,weekly:ca.a,monthly:aa.a},Ca={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(sa.a)(e),"yyyy-MM-dd"),r=Object(ae.default)(Object(ia.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(ae.default)(e,"yyyy-MM")}},Na=function(e,t){return Object(ea.a)((function(t){return Ca[e](Object(G.default)(t.date))}),t)},ka=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=ya[e],n=Ca[e],c=Object(G.default)(t[0].date),a=Object(G.default)(t[t.length-1].date),s=r(c,a),i=Sa[e];return[n(a)].concat(Object(Fe.a)(Object(ur.e)(s,(function(e){return n(Object(oa.a)(a,i(e)))}))))}(r,e);return[c,Oa(t,c)]},_a=function(e,t,r){return{label:t,data:e,fill:!1,tension:.2,borderColor:r,backgroundColor:r}},wa=null,Ua=function(e,t,r){return function(n){var c=Object(C.a)(n,1)[0];if(r&&c){var a,s=c.index;if(wa===e[s])r([]),wa=null;else r(e[s]&&t[e[s]]||[]),wa=null!==(a=e[s])&&void 0!==a?a:null}}},Ta=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(na.a)(r,n)<=2},Object($c.a)("hourly")],[function(){return Object(aa.a)(r,n)<=1},Object($c.a)("daily")],[function(){return Object(aa.a)(r,n)<=6},Object($c.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=Ca[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 Na(l,Object(ta.a)(r))}),[l,r]),f=Object(P.useMemo)((function(){return ka(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 Oa(Na(l,Object(ta.a)(n)),g)}),[n,l,g]),S=function(){var e=_a(x,"Visits",xa.c);return 0===n.length?[e]:[e,_a(p,a,xa.a)]},y={maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{intersect:!1,axis:"x",callbacks:{label:ma}}},scales:{y:{beginAtZero:!0,ticks:{precision:0,callback:Lt}},x:{title:{display:!0,text:pa[l]}}},onHover:fa},N=function(){return Object(W.jsx)(Xc.c,{data:{labels:g,datasets:S()},options:y,getElementAtEvent:Ua(g,O,s)})};return Object(W.jsxs)(Ae.a,{children:[Object(W.jsxs)(Sc.a,{children:[t,Object(W.jsx)("div",{className:"float-right",children:Object(W.jsxs)(Me.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(pa).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)(va,{checked:b,onChange:h,children:Object(W.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(W.jsxs)(yc.a,{className:"line-chart-card__body",children:[n.length>0&&N(),0===n.length&&N()]})]})},Ra=r(552),Ea=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!Ft(e)&&n(e)}};return Object(W.jsxs)(wt.a,{listClassName:H()("flex-wrap mb-0 simple-paginator",{"justify-content-center":a}),children:[Object(W.jsx)(kt.a,{disabled:r<=1,children:Object(W.jsx)(_t.a,{previous:!0,tag:"span",onClick:s(r-1)})}),It(r,t).map((function(e,t){return Object(W.jsx)(kt.a,{disabled:Ft(e),active:r===e,children:Object(W.jsx)(_t.a,{tag:"span",onClick:s(e),children:At(e)})},Mt(e,t))})),Object(W.jsx)(kt.a,{disabled:r>=t,children:Object(W.jsx)(_t.a,{next:!0,tag:"span",onClick:s(r+1)})})]})},Da=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)}))},La=function(e,t,r){var n=function(e,t){return k(t,e)}(r,t?Da(t,e):Object(Fe.a)(e)),c=n.length;return{visitsGroups:Object(Ra.a)(20,n),total:c}},Va=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 La(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(Br.a)(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)(qe,{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(Fe.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)(Zt.a,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(W.jsx)("td",{children:Object(W.jsx)(Jt,{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)(Ea,{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:Lt(V+1)})," to"," ",Object(W.jsx)("b",{children:Lt(Object(Rt.a)(L,w.total))})," of"," ",Object(W.jsx)("b",{children:Lt(w.total)})]})})]})})})})]})},Ia=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)(Zt.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)(Hc,{toggle:l,isOpen:i,title:t,locations:f})]})},Fa=r(553),Aa=function(e){return e.hasOwnProperty("visitedUrl")},Ma=Object(M.a)(Object(Fa.a)((function(e){return Aa(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(u.a)({orphanVisits:[],regularVisits:[]},e)})),Ga=function(e,t){return Object(ea.a)(Object(b.a)(t),e)},Pa=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}},Ba=function(e,t){return!Object(p.a)(e)&&Object(ur.c)(e[t])},Ha=function(e){return"number"===typeof e?e:e?parseFloat(e):0},Wa=function(e){return function(t,r){var n=Ba(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},qa=Wa("country"),za=Wa("city"),Ka=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),qa(e.countries,t),za(e.cities,t),function(e,t){if(Ba(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[Ha(n),Ha(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:{}})},Qa=Object(cc.a)((function(e){var t=e.userAgent,r=e.date,n=e.referer,c=e.visitLocation,a=e.potentialBot,s=void 0!==a&&a,i=Object(u.a)(Object(u.a)({date:r,potentialBot:s},function(e){if(!Object(ur.c)(e))return{browser:ja,os:ja};var t=ua.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:ja,browser:r&&ba.includes(r)?r:ja}}(t)),{},{referer:ha(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 Aa(e)?Object(u.a)(Object(u.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Ja=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(ur.c)(n),onClick:function(){return t({})},children:Object(W.jsx)("i",{children:"Clear filters"})})]})},Za=r(58),Ya=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)}))})},Xa=function(e){return[{data:e,backgroundColor:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:Object(xa.h)()?xa.e:xa.f,borderWidth:2}]},$a=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(Za.a)(t),i=Object(An.a)(t),o={plugins:{legend:{display:!1},tooltip:{intersect:!0,callbacks:{label:ga}}}},l=function(e,t){return{labels:e,datasets:Xa(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)(Xc.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)(Ya,{chart:c})})]})})),es=r(554),ts=function(e){var t=e.title,r=e.footer,n=e.children;return Object(W.jsxs)(Ae.a,{children:[Object(W.jsx)(Sc.a,{className:"chart-card__header",children:"function"===typeof t?t():t}),Object(W.jsx)(yc.a,{children:n}),r&&Object(W.jsx)(es.a,{className:"chart-card__footer--sticky",children:r})]})},rs=function(e){var t=e.title,r=e.stats;return Object(W.jsx)(ts,{title:t,children:Object(W.jsx)($a,{stats:r})})},ns=r(116),cs=r(562),as=r(555),ss=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(W.jsxs)(Me.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"})})]})]})},is=function(e){return e.startsWith("hidden")?"":e},os=function(e,t,r){var n={data:e,label:r?"Non-selected":"Visits",backgroundColor:xa.d,borderColor:xa.c,borderWidth:2};return t.every((function(e){return 0===e}))?[n]:[n,{label:null!==r&&void 0!==r?r:"Selected",data:t,backgroundColor:xa.b,borderColor:xa.a,borderWidth:2}]},ls=function(e,t){return function(r){var n=Object(C.a)(r,1)[0];t&&n&&t(e[n.index])}},us=function(e){var t=e.stats,r=e.highlightedStats,n=e.highlightedLabel,c=e.onClick,a=e.max,s=Object(Za.a)(t).map(is),i=Object(An.a)(function(e){return!!e&&Object.keys(e).length>0}(r)?Object(Za.a)(r).reduce((function(e,t){return e[t]&&(e[t]-=r[t]),e}),Object(u.a)({},t)):t),o=Oa(null!==r&&void 0!==r?r:{},s),l={plugins:{legend:{display:!1},tooltip:{mode:"y",filter:function(e){return""!==e.label},callbacks:{label:ma}}},scales:{x:{beginAtZero:!0,stacked:!0,max:a,ticks:{precision:0,callback:Lt}},y:{stacked:!0}},onHover:fa,indexAxis:"y"},d=function(e,t,r,n){return{labels:e,datasets:os(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)(Xc.a,{data:d,options:l,height:j,getElementAtEvent:ls(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")]})},ds=function(e){return"String"===Object(ns.a)(e)?Object(cs.a)(e):e},js=function(e){return Object(C.a)(e,1)[0]},bs=function(e){return Object(C.a)(e,2)[1]},hs=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(Fe.a)(t),Object(Fe.a)(Object(ur.e)(r-t.length,(function(e){return["hidden_".concat(e),0]}))))},N=function(e,t,r){var n=function(e,t){var r=Object(Ge.a)(e),n=j.field?Object(as.a)(Object(M.a)(j.field===Object.keys(t)[0]?js:bs,ds),r):r;return j.dir&&"ASC"!==j.dir?Object(ta.a)(n):n}(e,r),c=n.map(js),a=t&&Object(Ge.a)(Object(u.a)(Object(u.a)({},Object(da.a)(c,c.map((function(){return 0})))),t));if(n.length<=p)return{currentPageStats:Object(rc.a)(n),currentPageHighlightedStats:a&&Object(rc.a)(a)};var s,i,o=Object(Ra.a)(p,n),l=a&&Object(Ra.a)(p,a);return{currentPageStats:Object(rc.a)(y(o)),currentPageHighlightedStats:l&&Object(rc.a)(y(l)),pagination:(i=o.length,Object(W.jsx)(Ea,{currentPage:v,pagesCount:i,setCurrentPage:f})),max:(s=Math.max.apply(Math,Object(Fe.a)(n.map(bs))),10*Et(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)(ts,{title:function(){return Object(W.jsxs)(W.Fragment,{children:[n,Object(W.jsx)("div",{className:"float-right",children:Object(W.jsx)(Pe,{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)(ss,{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)(us,Object(u.a)({stats:k,highlightedStats:_,max:U},o))})},Os={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}},vs=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(Br.a)(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 Qa(b)}),[b]),Y=Object(P.useMemo)((function(){return Ka(Z)}),[Z]),X=Y.os,$=Y.browsers,ee=Y.referrers,te=Y.countries,re=Y.cities,ne=Y.citiesForMap,ce=Y.visitedUrls,ae=Object(An.a)(ne),se=function(e){$e=void 0,D(e)},ie=function(e){return function(t){var r="".concat(e,"_").concat(t);$e===r?(D([]),M(void 0),$e=void 0):(D(Z.filter(Object(zc.a)(e,t))),M(t),$e=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)(Ja,{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)(tn.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:["(",Lt(E.length),")"]})]}),Object(W.jsxs)(tn.a,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return l(Z)},children:[Object(W.jsx)(A.a,{icon:F.r})," Export (",Lt(Z.length),")"]})]})})]})}),Object(W.jsx)("section",{className:"mt-3",children:O?Object(W.jsxs)(xn.a,{loading:!0,children:["This is going to take a while... :S",Object(W.jsx)(Kc.a,{value:m,striped:100===m,className:"mt-3"})]}):h?Object(W.jsx)(xn.a,{loading:!0}):v?Object(W.jsx)(br,{type:"error",children:Object(W.jsx)(vr,{errorData:f,fallbackMessage:"An error occurred while loading visits :("})}):Object(S.a)(b)?Object(W.jsx)(xn.a,{children:"There are no visits matching current filter :("}):Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(Yc,{fill:!0,children:Object.values(Os).map((function(e,t){var r=e.title,n=e.icon,c=e.subPath;return Object(W.jsxs)(Zc,{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)(dr.a,{children:Object(W.jsxs)(De.d,{children:[Object(W.jsx)(De.b,{path:Os.byTime.subPath,element:Object(W.jsx)("div",{className:"col-12 mt-3",children:Object(W.jsx)(Ta,{title:"Visits during time",visits:Z,highlightedVisits:E,highlightedLabel:I,setSelectedVisits:se})})}),Object(W.jsx)(De.b,{path:Os.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)(rs,{title:"Operating systems",stats:X})}),Object(W.jsx)("div",{className:H()("mt-3 col-lg-6",{"col-xl-4":!j}),children:Object(W.jsx)(rs,{title:"Browsers",stats:$})}),Object(W.jsx)("div",{className:H()("mt-3",{"col-xl-4":!j,"col-lg-6":j}),children:Object(W.jsx)(hs,{title:"Referrers",stats:ee,withPagination:!1,highlightedStats:Ga(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)(hs,{title:"Visited URLs",stats:ce,highlightedLabel:I,highlightedStats:Ga(E,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:ie("visitedUrl")})})]})}),Object(W.jsx)(De.b,{path:Os.byLocation.subPath,element:Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)("div",{className:"col-lg-6 mt-3",children:Object(W.jsx)(hs,{title:"Countries",stats:te,highlightedStats:Ga(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)(hs,{title:"Cities",stats:re,highlightedStats:Ga(E,"city"),highlightedLabel:I,extraHeaderContent:function(e){return ae.length>0&&Object(W.jsx)(Ia,{modalTitle:"Cities",locations:ae,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:ie("city")})})]})}),Object(W.jsx)(De.b,{path:Os.list.subPath,element:Object(W.jsx)("div",{className:"col-12",children:Object(W.jsx)(Va,{visits:Z,selectedVisits:E,setSelectedVisits:se,isOrphanVisits:j,selectedServer:u})})}),Object(W.jsx)(De.b,{path:"*",element:Object(W.jsx)(De.a,{replace:!0,to:J(Os.byTime.subPath)})})]})})]})})]})},fs=function(e){var t=e.exportVisits;return He((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(De.h)().shortCode,d=void 0===l?"":l,j=Object(De.f)().search,b=Object(Y.b)(),h=Object(y.a)(j).domain;return Object(P.useEffect)((function(){a(d,h)}),[]),Object(W.jsx)(vs,{getVisits:function(e,t){return c(d,Object(u.a)(Object(u.a)({},Pa(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)(qc,{shortUrlDetail:n,shortUrlVisits:r,goBack:b})})}),(function(e,t){return[We.shortUrlVisits(t.shortCode)]}))},ms=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)(Wc,{title:s,goBack:r,visits:c})},gs=function(e,t){var r=t.exportVisits;return He((function(t){var n=t.getTagVisits,c=t.tagVisits,a=t.cancelGetTagVisits,s=t.settings,i=t.selectedServer,o=Object(Y.b)(),l=Object(De.h)().tag,u=void 0===l?"":l;return Object(W.jsx)(vs,{getVisits:function(e,t){return n(u,Pa(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)(ms,{tagVisits:c,goBack:o,colorGenerator:e})})}),(function(){return[We.visits]}))},xs=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(Wc,{title:"Orphan visits",goBack:r,visits:n})},ps=function(e){var t=e.exportVisits;return He((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)(vs,{getVisits:function(e,t){var n;return r(Pa(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)(xs,{orphanVisits:n,goBack:i})})}),(function(){return[We.orphanVisits]}))},Ss=function(e){var t=e.nonOrphanVisits,r=e.goBack,n=t.visits;return Object(W.jsx)(Wc,{title:"Non-orphan visits",goBack:r,visits:n})},ys=function(e){var t=e.exportVisits;return He((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)(vs,{getVisits:function(e,t){return r(Pa(e),t)},cancelGetVisits:c,visitsInfo:n,settings:a,exportCsv:function(e){return t("non_orphan_visits.csv",e)},selectedServer:s,children:Object(W.jsx)(Ss,{nonOrphanVisits:n,goBack:i})})}),(function(){return[We.visits]}))},Cs=r(568),Ns=5e3,ks=function(e){return e.currentPage>=e.pagesCount},_s=function(e,t){return 100*t/e},ws=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,Ns).then(Object(b.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(Cs.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:_s(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,Ns);case 3:if(n=e.sent,s=n.pagination,i=n.data,s&&!ks(s)){e.next=8;break}return e.abrupt("return",i);case 8:return l=Object(Ut.a)(2,s.pagesCount+1),u=Object(Ra.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:hr(e.t0)});case 17:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t,r,n,c,a,s){return e.apply(this,arguments)}}(),Us=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)})))},Ts="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",Rs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",Es="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",Ds="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",Ls="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",Vs="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",Is="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_FALLBACK_TO_INTERVAL",Fs={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},As=bt((et={},Object(l.a)(et,Ts,(function(){return Object(u.a)(Object(u.a)({},Fs),{},{loading:!0})})),Object(l.a)(et,Rs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Fs),{},{error:!0,errorData:r})})),Object(l.a)(et,Es,(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)(et,Ds,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(et,Ls,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(et,Vs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(et,Is,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(et,Cr,(function(e,t){var r=t.createdVisits,n=e.shortCode,c=e.domain,a=e.visits,s=e.query,i=void 0===s?{}:s,o=i.startDate,l=i.endDate,d=r.filter((function(e){var t=e.shortUrl,r=e.visit;return t&&yr(t,n,c)&&Oe(r.date,o,l)})).map((function(e){return e.visit}));return 0===d.length?e:Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Fe.a)(d),Object(Fe.a)(a))})})),et),Fs),Ms=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=Us(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:Ts,large:Ds,finish:Es,error:Rs,progress:Vs,fallbackToInterval:Is},c.abrupt("return",ws(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Gs=ht(Ls),Ps="shlink/tagVisits/GET_TAG_VISITS_START",Bs="shlink/tagVisits/GET_TAG_VISITS_ERROR",Hs="shlink/tagVisits/GET_TAG_VISITS",Ws="shlink/tagVisits/GET_TAG_VISITS_LARGE",qs="shlink/tagVisits/GET_TAG_VISITS_CANCEL",zs="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",Ks="shlink/tagVisits/GET_TAG_VISITS_FALLBACK_TO_INTERVAL",Qs={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Js=bt((tt={},Object(l.a)(tt,Ps,(function(){return Object(u.a)(Object(u.a)({},Qs),{},{loading:!0})})),Object(l.a)(tt,Bs,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},Qs),{},{error:!0,errorData:r})})),Object(l.a)(tt,Hs,(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)(tt,Ws,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(tt,qs,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(tt,zs,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(tt,Ks,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(tt,Cr,(function(e,t){var r=t.createdVisits,n=e.tag,c=e.visits,a=e.query,s=void 0===a?{}:a,i=s.startDate,o=s.endDate,l=r.filter((function(e){var t=e.shortUrl,r=e.visit;return(null===t||void 0===t?void 0:t.tags.includes(n))&&Oe(r.date,i,o)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Fe.a)(l),Object(Fe.a)(c))})})),tt),Qs),Zs=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=Us(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:Ps,large:Ws,finish:Hs,error:Bs,progress:zs,fallbackToInterval:Ks},c.abrupt("return",ws(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},Ys=ht(qs),Xs="shlink/orphanVisits/GET_ORPHAN_VISITS_START",$s="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",ei="shlink/orphanVisits/GET_ORPHAN_VISITS",ti="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",ri="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",ni="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",ci="shlink/orphanVisits/GET_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",ai={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},si=bt((rt={},Object(l.a)(rt,Xs,(function(){return Object(u.a)(Object(u.a)({},ai),{},{loading:!0})})),Object(l.a)(rt,$s,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},ai),{},{error:!0,errorData:r})})),Object(l.a)(rt,ei,(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)(rt,ti,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(rt,ri,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(rt,ni,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(rt,ci,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(rt,Cr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return!e.shortUrl&&Oe(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Fe.a)(o),Object(Fe.a)(n))})})),rt),ai),ii=function(e,t){return!t||t===e.type},oi=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 Aa(e)&&ii(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=Us(n,o),j=function(){return s().orphanVisits.cancelLoad},b={query:t},h={start:Xs,large:ti,finish:ei,error:$s,progress:ni,fallbackToInterval:ci},c.abrupt("return",ws(l,d,b,h,a,j));case 7:case"end":return c.stop()}}),c)})));return function(e,t){return c.apply(this,arguments)}}()}},li=ht(ri),ui="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_START",di="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_ERROR",ji="shlink/orphanVisits/GET_NON_ORPHAN_VISITS",bi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_LARGE",hi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_CANCEL",Oi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_PROGRESS_CHANGED",vi="shlink/orphanVisits/GET_NON_ORPHAN_VISITS_FALLBACK_TO_INTERVAL",fi={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},mi=bt((nt={},Object(l.a)(nt,ui,(function(){return Object(u.a)(Object(u.a)({},fi),{},{loading:!0})})),Object(l.a)(nt,di,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},fi),{},{error:!0,errorData:r})})),Object(l.a)(nt,ji,(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)(nt,bi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loadingLarge:!0})})),Object(l.a)(nt,hi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{cancelLoad:!0})})),Object(l.a)(nt,Oi,(function(e,t){var r=t.progress;return Object(u.a)(Object(u.a)({},e),{},{progress:r})})),Object(l.a)(nt,vi,(function(e,t){var r=t.fallbackInterval;return Object(u.a)(Object(u.a)({},e),{},{fallbackInterval:r})})),Object(l.a)(nt,Cr,(function(e,t){var r=t.createdVisits,n=e.visits,c=e.query,a=void 0===c?{}:c,s=a.startDate,i=a.endDate,o=r.filter((function(e){var t=e.visit;return Oe(t.date,s,i)})).map((function(e){return e.visit}));return Object(u.a)(Object(u.a)({},e),{},{visits:[].concat(Object(Fe.a)(o),Object(Fe.a)(n))})})),nt),fi),gi=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=Us(r,i),d=function(){return a().orphanVisits.cancelLoad},j={query:t},b={start:ui,large:bi,finish:ji,error:di,progress:Oi,fallbackToInterval:vi},n.abrupt("return",ws(o,l,j,b,c,d));case 7:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},xi=ht(hi),pi="shlink/visitsOverview/GET_OVERVIEW_START",Si="shlink/visitsOverview/GET_OVERVIEW_ERROR",yi="shlink/visitsOverview/GET_OVERVIEW",Ci={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},Ni=bt((ct={},Object(l.a)(ct,pi,(function(){return Object(u.a)(Object(u.a)({},Ci),{},{loading:!0})})),Object(l.a)(ct,Si,(function(){return Object(u.a)(Object(u.a)({},Ci),{},{error:!0})})),Object(l.a)(ct,yi,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(u.a)(Object(u.a)({},Ci),{},{visitsCount:r,orphanVisitsCount:n})})),Object(l.a)(ct,Cr,(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=Ma(s),o=i.regularVisits,l=i.orphanVisits;return Object(u.a)(Object(u.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),ct),Ci),ki=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:pi}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(u.a)({type:yi},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:Si});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},_i=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(Lc.a)(n.window,r,e)}}},wi=function(e,t){e.serviceFactory("MapModal",(function(){return Hc})),e.serviceFactory("ShortUrlVisits",fs,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",gs,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",ps,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("NonOrphanVisits",ys,"VisitsExporter"),e.decorator("NonOrphanVisits",t(["nonOrphanVisits","mercureInfo","settings","selectedServer"],["getNonOrphanVisits","cancelGetNonOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",_i,"window","csvjson"),e.serviceFactory("getShortUrlVisits",Ms,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return Gs})),e.serviceFactory("getTagVisits",Zs,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return Ys})),e.serviceFactory("getOrphanVisits",oi,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return li})),e.serviceFactory("getNonOrphanVisits",gi,"buildShlinkApiClient"),e.serviceFactory("cancelGetNonOrphanVisits",(function(){return xi})),e.serviceFactory("createNewVisits",(function(){return Nr})),e.serviceFactory("loadVisitsOverview",ki,"buildShlinkApiClient")},Ui=r(263),Ti=r.n(Ui),Ri=function(e){var t=e.tag,r=e.colorGenerator;return Object(W.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},Ei=function(e){return{id:e,name:e}},Di=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)(Ti.a,{tags:c.map(Ei),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(Ei),suggestionComponent:function(t){var r=t.item;return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(Ri,{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(Fe.a)(c);t.splice(e,1),a(t)},onAddition:function(e){var t=e.name;return a(Object(Fe.a)(new Set([].concat(Object(Fe.a)(c),Object(Fe.a)(t.toLowerCase().split(","))))))}})}},Li=r(506),Vi=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)(Ae.a,{className:"tag-card",children:[Object(W.jsxs)(Sc.a,{className:"tag-card__header",children:[Object(W.jsx)(tn.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)(tn.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)(Ri,{tag:c.tag,colorGenerator:r}),Object(W.jsx)("span",{className:"tag-card__tag-name",onClick:o,children:c.tag})]})]}),Object(W.jsx)(Li.a,{isOpen:s,children:Object(W.jsxs)(yc.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:Lt(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:Lt(c.visits)})]})]})}),Object(W.jsx)(e,{tag:c.tag,toggle:j,isOpen:d}),Object(W.jsx)(t,{tag:c.tag,toggle:f,isOpen:v})]})}},Ii=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)(ar.a,{toggle:r,isOpen:n,centered:!0,children:[Object(W.jsx)(sr.a,{toggle:r,children:Object(W.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(W.jsxs)(ir.a,{children:["Are you sure you want to delete tag ",Object(W.jsx)("b",{children:t}),"?",o&&Object(W.jsx)(br,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(vr,{errorData:l,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(W.jsxs)(or.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"})]})]})},Fi=r(558),Ai=r(264),Mi=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(ur.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)(ar.a,{isOpen:s,toggle:c,centered:!0,onClosed:S,children:Object(W.jsxs)("form",{onSubmit:_,children:[Object(W.jsx)(sr.a,{toggle:c,children:"Edit tag"}),Object(W.jsxs)(ir.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)(Fi.a,{isOpen:x,toggle:p,target:"colorPickerBtn",placement:"right",hideArrow:!0,popperClassName:"edit-tag-modal__popover",children:Object(W.jsx)(Ai.a,{color:h,onChange:O})}),Object(W.jsx)(an.a,{value:u,placeholder:"Tag",required:!0,onChange:function(e){var t=e.target;return d(t.value)}})]}),N&&Object(W.jsx)(br,{type:"error",small:!0,className:"mt-2",children:Object(W.jsx)(vr,{errorData:k,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(W.jsxs)(or.a,{children:[Object(W.jsx)(tn.a,{type:"button",color:"link",onClick:c,children:"Cancel"}),Object(W.jsx)(tn.a,{color:"primary",disabled:y,children:y?"Saving...":"Save"})]})]})})}},Gi={tag:"Tag",shortUrls:"Short URLs",visits:"Visits"},Pi=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"]})]})},Bi=function(e,t){return He((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)(xn.a,{loading:!0});if(l.error)return Object(W.jsx)(br,{type:"error",children:Object(W.jsx)(vr,{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)(dr.a,{className:"mb-3",children:[Object(W.jsx)("div",{className:"col-lg-6",children:Object(W.jsx)(Pi,{mode:h,onChange:O})}),Object(W.jsx)("div",{className:"col-lg-6 mt-3 mt-lg-0",children:Object(W.jsx)(Pe,{items:Gi,order:m,onChange:function(e,t){return g({field:e,dir:t})}})})]}),function(){if(l.filteredTags.length<1)return Object(W.jsx)(xn.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[We.visits]}))},Hi="shlink/deleteTag/DELETE_TAG_START",Wi="shlink/deleteTag/DELETE_TAG_ERROR",qi="shlink/deleteTag/DELETE_TAG",zi="shlink/deleteTag/TAG_DELETED",Ki=bt((at={},Object(l.a)(at,Hi,(function(){return{deleting:!0,error:!1}})),Object(l.a)(at,Wi,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(l.a)(at,qi,(function(){return{deleting:!1,error:!1}})),at),{deleting:!1,error:!1}),Qi=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:Hi}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:qi}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:Wi,errorData:hr(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},Ji=function(e){return{type:zi,tag:e}},Zi="shlink/editTag/EDIT_TAG_START",Yi="shlink/editTag/EDIT_TAG_ERROR",Xi="shlink/editTag/EDIT_TAG",$i="shlink/editTag/TAG_EDITED",eo=bt((st={},Object(l.a)(st,Zi,(function(e){return Object(u.a)(Object(u.a)({},e),{},{editing:!0,error:!1})})),Object(l.a)(st,Yi,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(l.a)(st,Xi,(function(e,t){return Object(u.a)(Object(u.a)({},Object(j.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),st),{oldName:"",newName:"",editing:!1,error:!1}),to=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:Zi}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:Xi,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:Yi,errorData:hr(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},ro=function(e,t,r){return{type:$i,oldName:e,newName:t,color:r}},no="shlink/tagsList/LIST_TAGS_START",co="shlink/tagsList/LIST_TAGS_ERROR",ao="shlink/tagsList/LIST_TAGS",so="shlink/tagsList/FILTER_TAGS",io={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},oo=function(e,t){return function(r){return r===e?t:r}},lo=function(e,t){return Object(x.a)((function(e){return e===t}),e)},uo=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}),{}))},jo=bt((it={},Object(l.a)(it,no,(function(){return Object(u.a)(Object(u.a)({},io),{},{loading:!0})})),Object(l.a)(it,co,(function(e,t){var r=t.errorData;return Object(u.a)(Object(u.a)({},io),{},{error:!0,errorData:r})})),Object(l.a)(it,ao,(function(e,t){var r=t.tags,n=t.stats;return Object(u.a)(Object(u.a)({},io),{},{stats:n,tags:r,filteredTags:r})})),Object(l.a)(it,zi,(function(e,t){var r=t.tag;return Object(u.a)(Object(u.a)({},e),{},{tags:lo(e.tags,r),filteredTags:lo(e.filteredTags,r)})})),Object(l.a)(it,$i,(function(e,t){var r=t.oldName,n=t.newName;return Object(u.a)(Object(u.a)({},e),{},{tags:e.tags.map(oo(r,n)).sort(),filteredTags:e.filteredTags.map(oo(r,n)).sort()})})),Object(l.a)(it,so,(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)(it,Cr,(function(e,t){var r,n,c=t.createdVisits;return Object(u.a)(Object(u.a)({},e),{},{stats:(r=uo(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)(it,Ir,(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)})))})})),it),io),bo=function(e){return{type:so,searchTerm:e}},ho=Math.ceil,Oo=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(Ra.a)(ho(o/4),r);return Object(W.jsx)(dr.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)}))})}},vo=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(De.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(Ra.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)(jr.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)(qe,{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)(qe,{currentOrder:s,field:"shortUrls"})]}),Object(W.jsxs)("th",{className:"tags-table__header-cell text-lg-right",onClick:a("visits"),children:["Visits ",Object(W.jsx)(qe,{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)(Ea,{pagesCount:O.length,currentPage:b,setCurrentPage:h})})]},b)}},fo=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)(Ri,{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:Lt(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:Lt(c.visits)})}),Object(W.jsx)("td",{className:"responsive-table__cell text-lg-right",children:Object(W.jsxs)(rr,{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})]})}},mo=function(e,t){e.serviceFactory("TagsSelector",Di,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",Vi,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return Ii})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",Mi,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsCards",Oo,"TagCard"),e.serviceFactory("TagsTableRow",fo,"DeleteTagConfirmModal","EditTagModal","ColorGenerator"),e.serviceFactory("TagsTable",vo,"TagsTableRow"),e.serviceFactory("TagsList",Bi,"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:no}),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:ao}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:co,errorData:hr(r.t0)});case 19:case"end":return r.stop()}}),r,null,[[4,16]])})));return function(e,t){return r.apply(this,arguments)}}()}}(t.buildShlinkApiClient,e)}};e.factory("listTags",r(!1)),e.factory("forceListTags",r(!0)),e.serviceFactory("filterTags",(function(){return bo})),e.serviceFactory("tagDeleted",(function(){return Ji})),e.serviceFactory("tagEdited",(function(){return ro})),e.serviceFactory("deleteTag",Qi,"buildShlinkApiClient"),e.serviceFactory("editTag",to,"buildShlinkApiClient","ColorGenerator")},go=r(265),xo="shlink/mercure/GET_MERCURE_INFO_START",po="shlink/mercure/GET_MERCURE_INFO_ERROR",So="shlink/mercure/GET_MERCURE_INFO",yo=bt((ot={},Object(l.a)(ot,xo,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!0,error:!1})})),Object(l.a)(ot,po,(function(e){return Object(u.a)(Object(u.a)({},e),{},{loading:!1,error:!0})})),Object(l.a)(ot,So,(function(e,t){return Object(u.a)(Object(u.a)({},t),{},{loading:!1,error:!1})})),ot),{loading:!0,error:!1}),Co=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:xo}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:po}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(u.a)({type:So,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:po});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},No=function(e){e.serviceFactory("loadMercureInfo",Co,"buildShlinkApiClient")},ko=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(W.jsxs)(jr.a,{title:"Real-time updates",className:"h-100",children:[Object(W.jsx)(en.a,{children:Object(W.jsxs)(va,{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)(en.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)(an.a,{type:"number",min:0,placeholder:"Immediate",disabled:!r.enabled,value:(t=r.interval,t?"".concat(t):""),onChange:function(e){var t=e.target;return c(Number(t.value))}}),r.enabled&&Object(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."]})]})]})},_o=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)}))})},wo=function(e,t,r,n,c,a){return function(){return Object(W.jsxs)(Rn.a,{children:[Object(W.jsxs)(Yc,{children:[Object(W.jsx)(Zc,{to:"general",children:"General"}),Object(W.jsx)(Zc,{to:"short-urls",children:"Short URLs"}),Object(W.jsx)(Zc,{to:"secondary-items",children:"Secondary items"})]}),Object(W.jsxs)(De.d,{children:[Object(W.jsx)(De.b,{path:"general",element:Object(W.jsx)(_o,{items:[Object(W.jsx)(n,{},"one"),Object(W.jsx)(e,{},"two")]})}),Object(W.jsx)(De.b,{path:"short-urls",element:Object(W.jsx)(_o,{items:[Object(W.jsx)(t,{},"one"),Object(W.jsx)(r,{},"two")]})}),Object(W.jsx)(De.b,{path:"secondary-items",element:Object(W.jsx)(_o,{items:[Object(W.jsx)(a,{},"one"),Object(W.jsx)(c,{},"two")]})}),Object(W.jsx)(De.b,{path:"*",element:Object(W.jsx)(De.a,{replace:!0,to:"general"})})]})]})}},Uo=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},To=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)(jr.a,{title:"Short URLs form",className:"h-100",children:[Object(W.jsx)(en.a,{children:Object(W.jsxs)(va,{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)(en.a,{children:Object(W.jsxs)(va,{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)(en.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Tag suggestions search mode:"}),Object(W.jsxs)(X,{text:Uo(o.tagFilteringMode),children:[Object(W.jsx)(K.a,{active:!o.tagFilteringMode||"startsWith"===o.tagFilteringMode,onClick:l("startsWith"),children:Uo("startsWith")}),Object(W.jsx)(K.a,{active:"includes"===o.tagFilteringMode,onClick:l("includes"),children:Uo("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."]}))})]})]})},Ro=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(W.jsxs)(jr.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)(va,{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(xa.g)(n)},children:"Use dark theme."})]})},Eo=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})})},Do=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(W.jsx)(jr.a,{title:"Visits",className:"h-100",children:Object(W.jsxs)(en.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default interval to load on visits sections:"}),Object(W.jsx)(Eo,{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})}})]})})},Lo=function(e){var t,r,n,c=e.settings.tags,a=e.setTagsSettings;return Object(W.jsxs)(jr.a,{title:"Tags",className:"h-100",children:[Object(W.jsxs)(en.a,{children:[Object(W.jsx)("label",{children:"Default display mode when managing tags:"}),Object(W.jsx)(Pi,{mode:null!==(t=null===c||void 0===c?void 0:c.defaultMode)&&void 0!==t?t:"cards",renderTitle:function(e){return Object(ur.a)(e)},onChange:function(e){return 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)(en.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default ordering for tags list:"}),Object(W.jsx)(Pe,{items:Gi,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}}))}})]})]})},Vo=function(e){var t,r=e.settings.shortUrlsList,n=e.setShortUrlsListSettings;return Object(W.jsx)(jr.a,{title:"Short URLs list",className:"h-100",children:Object(W.jsxs)(en.a,{className:"mb-0",children:[Object(W.jsx)("label",{children:"Default ordering for short URLs list:"}),Object(W.jsx)(Pe,{items:Pt,order:null!==(t=null===r||void 0===r?void 0:r.defaultOrdering)&&void 0!==t?t:vt,onChange:function(e,t){return n({defaultOrdering:{field:e,dir:t}})}})]})})},Io=function(e,t){e.serviceFactory("Settings",wo,"RealTimeUpdatesSettings","ShortUrlCreationSettings","ShortUrlsListSettings","UserInterfaceSettings","VisitsSettings","TagsSettings"),e.decorator("Settings",pc.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdatesSettings",(function(){return ko})),e.decorator("RealTimeUpdatesSettings",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreationSettings",(function(){return To})),e.decorator("ShortUrlCreationSettings",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterfaceSettings",(function(){return Ro})),e.decorator("UserInterfaceSettings",t(["settings"],["setUiSettings"])),e.serviceFactory("VisitsSettings",(function(){return Do})),e.decorator("VisitsSettings",t(["settings"],["setVisitsSettings"])),e.serviceFactory("TagsSettings",(function(){return Lo})),e.decorator("TagsSettings",t(["settings"],["setTagsSettings"])),e.serviceFactory("ShortUrlsListSettings",(function(){return Vo})),e.decorator("ShortUrlsListSettings",t(["settings"],["setShortUrlsListSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return gt})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return xt})),e.serviceFactory("setShortUrlCreationSettings",(function(){return pt})),e.serviceFactory("setShortUrlsListSettings",(function(){return St})),e.serviceFactory("setUiSettings",(function(){return yt})),e.serviceFactory("setVisitsSettings",(function(){return Ct})),e.serviceFactory("setTagsSettings",(function(){return Nt}))},Fo=r(268),Ao=function(e,t){var r=e.split("://"),n=Object(C.a)(r,2),c=n[0],a=n[1].split("/"),s=Object(Fo.a)(a).slice(1),i=s.length?"/".concat(s.join("/")):"";return"".concat(c,"://").concat(t).concat(i)},Mo="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",Go=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:Mo,domain:t,redirects:o}),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_ERROR",errorData:hr(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},Po="shlink/domainsList/LIST_DOMAINS_START",Bo="shlink/domainsList/LIST_DOMAINS_ERROR",Ho="shlink/domainsList/LIST_DOMAINS",Wo="shlink/domainsList/FILTER_DOMAINS",qo="shlink/domainsList/VALIDATE_DOMAIN",zo={domains:[],filteredDomains:[],loading:!1,error:!1},Ko=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{redirects:t})}},Qo=function(e,t){return function(r){return r.domain!==e?r:Object(u.a)(Object(u.a)({},r),{},{status:t})}},Jo=bt((lt={},Object(l.a)(lt,Po,(function(){return Object(u.a)(Object(u.a)({},zo),{},{loading:!0})})),Object(l.a)(lt,Bo,(function(e){var t=e.errorData;return Object(u.a)(Object(u.a)({},zo),{},{error:!0,errorData:t})})),Object(l.a)(lt,Ho,(function(e,t){var r=t.domains,n=t.defaultRedirects;return Object(u.a)(Object(u.a)({},zo),{},{domains:r,filteredDomains:r,defaultRedirects:n})})),Object(l.a)(lt,Wo,(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)(lt,Mo,(function(e,t){var r=t.domain,n=t.redirects;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Ko(r,n)),filteredDomains:e.filteredDomains.map(Ko(r,n))})})),Object(l.a)(lt,qo,(function(e,t){var r=t.domain,n=t.status;return Object(u.a)(Object(u.a)({},e),{},{domains:e.domains.map(Qo(r,n)),filteredDomains:e.filteredDomains.map(Qo(r,n))})})),lt),zo),Zo=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:Po}),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:Ho,domains:i,defaultRedirects:o}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(2),r({type:Bo,errorData:hr(t.t0)});case 14:case"end":return t.stop()}}),t,null,[[2,11]])})));return function(e,r){return t.apply(this,arguments)}}()}},Yo=function(e){return{type:Wo,searchTerm:e}},Xo=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:qo,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:Ao(i,t)})),d=l.health,r.next=9,d();case 9:j=r.sent,b=j.status,n({type:qo,domain:t,status:"pass"===b?"valid":"invalid"}),r.next=17;break;case 14:r.prev=14,r.t0=r.catch(4),n({type:qo,domain:t,status:"invalid"});case 17:case"end":return r.stop()}}),r,null,[[4,14]])})));return function(e,t){return r.apply(this,arguments)}}()}},$o=r(560),el=r(571),tl=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)($o.a,{children:[Object(W.jsx)(an.a,{value:r,placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(W.jsxs)(el.a,{addonType:"append",children:[Object(W.jsx)(tn.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)(Zt.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"})})]})},rl=function(e){var t=e.isLast,r=Object(g.a)(e,["isLast"]);return Object(W.jsx)(En,Object(u.a)(Object(u.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},nl=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(ur.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(ur.d)(b),regular404Redirect:Object(ur.d)(g),invalidShortUrlRedirect:Object(ur.d)(y)}).then(o));case 1:case"end":return e.stop()}}),e)}))));return Object(W.jsx)(ar.a,{isOpen:i,toggle:o,centered:!0,children:Object(W.jsxs)("form",{onSubmit:k,children:[Object(W.jsxs)(sr.a,{toggle:o,children:["Edit redirects for ",Object(W.jsx)("b",{children:l.domain})]}),Object(W.jsxs)(ir.a,{children:[Object(W.jsxs)(rl,{value:b,onChange:h,children:[Object(W.jsxs)(hn,{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)(rl,{value:g,onChange:x,children:[Object(W.jsxs)(hn,{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)(rl,{value:y,isLast:!0,onChange:N,children:[Object(W.jsx)(hn,{className:"mr-2",placement:"bottom",children:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL."}),"Invalid short URL"]})]}),Object(W.jsxs)(or.a,{children:[Object(W.jsx)(tn.a,{color:"link",type:"button",onClick:o,children:"Cancel"}),Object(W.jsx)(tn.a,{color:"primary",children:"Save"})]})]})})},cl=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)(Zt.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)(Ht.a,{href:"https://slnk.to/multi-domain-docs",children:"documentation"})," in order to find out what is missing."]})})]})},al=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)"})]})]})},sl=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)(Zt.a,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},il=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(Br.c)(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)(sl,{})}),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)(al,{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)(al,{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)(al,{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)(cl,{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)(tn.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)(Zt.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)(nl,{domain:c,isOpen:d,toggle:j,editDomainRedirects:a})]})},ol=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect","",""],ll=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)(xn.a,{loading:!0});return Object(W.jsxs)(W.Fragment,{children:[Object(W.jsx)(q,{className:"mb-3",onChange:c}),d?Object(W.jsx)(br,{type:"error",children:Object(W.jsx)(vr,{errorData:j,fallbackMessage:"Error loading domains :("})}):Object(W.jsx)(jr.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:ol.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:ol.length,className:"text-center",children:"No results found"})}),o.map((function(e){return Object(W.jsx)(il,{domain:e,editDomainRedirects:a,checkDomainHealth:s,defaultRedirects:b,selectedServer:i},e.domain)}))]})]})})]})},ul=function(e,t){e.serviceFactory("DomainSelector",(function(){return tl})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return ll})),e.decorator("ManageDomains",t(["domainsList","selectedServer"],["listDomains","filterDomains","editDomainRedirects","checkDomainHealth"])),e.serviceFactory("listDomains",Zo,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Yo})),e.serviceFactory("editDomainRedirects",Go,"buildShlinkApiClient"),e.serviceFactory("checkDomainHealth",Xo,"buildShlinkApiClient")},dl="shlink/appUpdates/APP_UPDATE_AVAILABLE",jl="shlink/appUpdates/RESET_APP_UPDATE",bl=bt((ut={},Object(l.a)(ut,dl,(function(){return!0})),Object(l.a)(ut,jl,(function(){return!1})),ut),!1),hl=ht(dl),Ol=ht(jl),vl=r(141),fl=r(561),ml=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)(fl.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:jr.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)(tn.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..."})]})]})]})},gl=r(33),xl=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(gl.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)}}(),pl=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(De.f)().pathname;return Object(P.useEffect)((function(){var e,t;0===Object.keys(u).length&&l(),Object(xa.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)(De.d,{children:[Object(W.jsx)(De.b,{index:!0,element:Object(W.jsx)(t,{})}),Object(W.jsx)(De.b,{path:"/settings/*",element:Object(W.jsx)(a,{})}),Object(W.jsx)(De.b,{path:"/manage-servers",element:Object(W.jsx)(s,{})}),Object(W.jsx)(De.b,{path:"/server/create",element:Object(W.jsx)(n,{})}),Object(W.jsx)(De.b,{path:"/server/:serverId/edit",element:Object(W.jsx)(c,{})}),Object(W.jsx)(De.b,{path:"/server/:serverId/*",element:Object(W.jsx)(r,{})}),Object(W.jsx)(De.b,{path:"*",element:Object(W.jsx)(vl.a,{})})]})}),Object(W.jsx)("div",{className:"shlink-footer",children:Object(W.jsx)(i,{})})]}),Object(W.jsx)(ml,{isOpen:j,toggle:b,forceUpdate:xl})]})}},Sl=function(e,t){e.serviceFactory("App",pl,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ManageServers","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return hl})),e.serviceFactory("resetAppUpdate",(function(){return Ol}))},yl=new d.a,Cl=yl.container,Nl=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)}}(Cl,t)))},kl=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(Nl,{}))};Sl(yl,kl),Object(I.a)(yl,kl),V(yl),wn(yl,kl),Ic(yl,kl),mo(yl,kl),wi(yl,kl),Object(go.a)(yl),No(yl),Io(yl,kl),ul(yl,kl);var _l=r(269),wl=r(74),Ul=r(201),Tl=Object(wl.c)({servers:lc,selectedServer:$n,shortUrlsList:Yr,shortUrlCreationResult:Mr,shortUrlDeletion:Rr,shortUrlEdition:zr,shortUrlVisits:As,tagVisits:Js,orphanVisits:si,nonOrphanVisits:mi,shortUrlDetail:kn,tagsList:jo,tagDelete:Ki,tagEdit:eo,mercureInfo:yo,settings:mt,domainsList:Jo,visitsOverview:Ni,appUpdated:bl}),Rl=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||wl.d,El={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},Dl=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(Ul.load)(El)),Ll=Object(wl.e)(Tl,Dl,Rl(Object(wl.a)(Object(Ul.save)(El),_l.a))),Vl=r(60),Il=r.n(Vl),Fl=r(270),Al=r(271),Ml=r(272),Gl=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 Pl(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 Il.a.Icon.Default.prototype._getIconUrl,Il.a.Icon.Default.mergeOptions({iconRetinaUrl:Fl.a,iconUrl:Al.a,shadowUrl:Ml.a});var Bl=Cl.App,Hl=Cl.ScrollToTop,Wl=Cl.ErrorHandler,ql=Cl.appUpdateAvailable;Object(a.render)(Object(W.jsx)(s.a,{store:Ll,children:Object(W.jsx)(i.a,{basename:o.a,children:Object(W.jsx)(Wl,{children:Object(W.jsx)(Hl,{children:Object(W.jsx)(Bl,{})})})})}),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.8")?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.8","/service-worker.js");Gl?(!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()}))})):Pl(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")}))):Pl(t,e)}))}}({onUpdate:function(){Ll.dispatch(ql())}})},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.cb5cadd3.chunk.js.map
|