mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 01:48:18 +03:00
2 lines
No EOL
171 KiB
JavaScript
2 lines
No EOL
171 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{146:function(e){e.exports=JSON.parse('{"a":"/shlink-web-client/"}')},149:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(44),a=function(e){var t=e.color,r=void 0===t?c.c:t,a=e.className;return Object(n.jsx)("svg",{className:a,viewBox:"0 0 512 512",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:Object(n.jsxs)("g",{fill:r,children:[Object(n.jsx)("path",{d:" M 23.71 85.08 C 17.22 49.81 49.44 14.86 85.08 18.12 C 118.83 19.21 145.72 53.33 139.45 86.37 C 155.64 102.30 171.32 118.83 187.87 134.36 C 198.32 111.73 208.84 89.12 219.57 66.62 C 226.05 53.84 243.47 48.74 255.73 56.27 C 263.76 62.10 270.34 69.69 277.25 76.75 C 286.28 86.61 285.72 102.89 276.31 112.31 C 223.38 165.37 170.38 218.37 117.35 271.34 C 107.72 280.99 91.01 281.25 81.11 271.86 C 74.39 264.94 66.82 258.69 61.24 250.77 C 53.72 238.52 58.85 221.07 71.64 214.62 C 94.11 203.87 116.72 193.38 139.33 182.91 C 123.81 166.36 107.30 150.68 91.37 134.49 C 60.20 140.28 27.37 116.78 23.71 85.08 Z"}),Object(n.jsx)("path",{d:" M 205.21 201.23 C 225.32 181.36 260.88 181.11 281.14 200.86 C 299.25 218.75 317.37 236.65 335.10 254.93 C 356.73 278.01 352.01 318.70 326.03 336.56 C 320.07 330.47 313.73 324.65 308.12 318.28 C 323.86 309.39 328.76 286.18 316.63 272.39 C 301.73 256.95 286.30 242.03 271.24 226.75 C 264.49 219.65 256.80 212.00 246.37 211.52 C 224.65 208.64 205.52 233.36 214.49 253.58 C 221.09 266.81 234.22 275.12 243.62 286.24 C 240.43 295.96 238.09 306.13 238.29 316.46 C 225.55 304.29 213.16 291.73 200.89 279.09 C 180.97 257.57 183.10 220.45 205.21 201.23 Z"}),Object(n.jsx)("path",{d:" M 273.90 352.07 C 252.28 328.99 256.98 288.31 282.96 270.46 C 288.93 276.54 295.26 282.36 300.88 288.72 C 285.14 297.62 280.23 320.82 292.38 334.61 C 307.27 350.05 322.70 364.96 337.75 380.25 C 344.51 387.35 352.20 395.00 362.64 395.48 C 384.35 398.37 403.49 373.64 394.51 353.42 C 387.92 340.18 374.78 331.88 365.38 320.76 C 368.56 311.04 370.91 300.86 370.71 290.54 C 383.45 302.70 395.84 315.27 408.11 327.91 C 428.03 349.43 425.90 386.55 403.78 405.77 C 383.68 425.64 348.13 425.89 327.86 406.14 C 309.75 388.25 291.60 370.37 273.90 352.07 Z"}),Object(n.jsx)("path",{d:" M 422.11 403.83 C 431.96 394.07 441.60 384.06 451.66 374.51 C 460.90 383.74 471.89 392.70 474.89 406.11 C 480.16 429.97 484.08 454.13 488.76 478.12 C 490.00 483.41 484.47 488.29 479.35 486.63 C 454.66 481.52 429.55 478.12 405.14 471.84 C 393.17 467.97 385.20 457.75 376.55 449.27 C 386.39 439.49 396.13 429.60 406.06 419.91 C 416.37 433.45 435.74 414.00 422.11 403.83 Z"})]})})}},150:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(3),c=r(0),a=r(1),s=r(48),i=r(28),o=r(61);function l(e,t){return function(r){var l=r.selectServer,u=r.selectedServer,d=r.match;return Object(a.useEffect)((function(){l(d.params.serverId)}),[d.params.serverId]),u?Object(i.b)(u)?Object(c.jsx)(t,{}):Object(c.jsx)(e,Object(n.a)({},r)):Object(c.jsx)(o.a,{children:Object(c.jsx)(s.a,{loading:!0})})}}},152:function(e,t,r){"use strict";var n=r(0),c=r(24),a=r(32);t.a=function(e){var t=e.to,r=void 0===t?"/":t,s=e.children,i=void 0===s?"Home":s;return Object(n.jsx)("div",{className:"home",children:Object(n.jsxs)(a.a,{className:"p-4",children:[Object(n.jsx)("h2",{children:"Oops! We could not find requested route."}),Object(n.jsx)("p",{children:"Use your browser's back button to navigate to the page you have previously come from, or just press this button."}),Object(n.jsx)("br",{}),Object(n.jsx)(c.b,{to:r,className:"btn btn-outline-primary btn-lg",children:i})]})})}},165:function(e,t,r){"use strict";var n=r(0),c=r(653),a=r(654),s=r(24),i=r(7),o=r.n(i),l=r(15),u=r(14),d=function(e){var t=e.id,r=e.name;return Object(n.jsxs)(c.a,{tag:s.b,to:"/server/".concat(t),className:"servers-list__server-item",children:[r,Object(n.jsx)(l.a,{icon:u.j,className:"servers-list__server-item-icon"})]})};t.a=function(e){var t=e.servers,r=e.children,c=e.embedded,s=void 0!==c&&c;return Object(n.jsxs)(n.Fragment,{children:[r&&Object(n.jsx)("h5",{className:"mb-md-3",children:r}),t.length>0&&Object(n.jsx)(a.a,{className:o()("servers-list__list-group",{"servers-list__list-group--embedded":s}),children:t.map((function(e){var t=e.id,r=e.name;return Object(n.jsx)(d,{id:t,name:r},t)}))})]})}},26:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"c",(function(){return l})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return d}));var n=r(642),c=r(216),a=r(334),s=r(641),i=function(e,t,r){return e!==t?"ASC":r?{ASC:"DESC",DESC:void 0}[r]:"ASC"},o=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Object(n.a)(r,e+1).map(t)},l=function(e){return!Object(c.a)(e)&&!Object(a.a)(e)},u=function(e){return Object(s.a)((function(e){return e.preventDefault()}),e)},d=function(e){return Object(a.a)(e)?null:e}},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return o}));var n=r(9),c=r(1),a=r(295),s=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]}},i=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)}]},o=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)})}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return a})),r.d(t,"b",(function(){return s}));var n=function(e){return!(null===e||void 0===e||!e.url)&&!(null===e||void 0===e||!e.apiKey)},c=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("id"))},a=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("version"))},s=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("serverNotFound"))}},292:function(e,t,r){"use strict";(function(e){var n=r(293),c=r.n(n),a=r(294),s=r(325),i=r(326),o=r(327),l=r(328),u=r(296),d=r(323),j=r(97),b=r(298);t.a=function(t,r,n){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.decorator("ScrollToTop",n),t.serviceFactory("MainHeader",s.a,"ServersDropdown"),t.decorator("MainHeader",n),t.serviceFactory("Home",(function(){return i.a})),t.decorator("Home",j.a),t.decorator("Home",r(["servers"],["resetSelectedServer"])),t.serviceFactory("MenuLayout",o.a,"TagsList","ShortUrls","AsideMenu","CreateShortUrl","ShortUrlVisits","TagVisits","OrphanVisits","ServerError","Overview","EditShortUrl","ManageDomains"),t.decorator("MenuLayout",r(["selectedServer","shortUrlsListParams"],["selectServer"])),t.decorator("MenuLayout",n),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(42))},294:function(e,t,r){"use strict";var n=r(0),c=r(1);t.a=function(){return function(e){var t=e.location,r=e.children;return Object(c.useEffect)((function(){scrollTo(0,0)}),[t]),Object(n.jsx)(n.Fragment,{children:r})}}},296:function(e,t,r){"use strict";var n=r(40),c=r(153),a=r(330),s=r(321),i=r(0),o=r(1),l=r(220),u=r(32);t.a=function(e,t){var r=e.location,d=t.error;return function(e){Object(a.a)(o,e);var t=Object(s.a)(o);function o(e){var r;return Object(n.a)(this,o),(r=t.call(this,e)).state={hasError:!1},r}return Object(c.a)(o,[{key:"componentDidCatch",value:function(e){d(e)}},{key:"render",value:function(){return this.state.hasError?Object(i.jsx)("div",{className:"home",children:Object(i.jsxs)(u.a,{className:"p-4",children:[Object(i.jsx)("h1",{children:"Oops! This is awkward :S"}),Object(i.jsx)("p",{children:"It seems that something went wrong. Try refreshing the page or just click this button."}),Object(i.jsx)("br",{}),Object(i.jsx)(l.a,{outline:!0,color:"primary",onClick:function(){return r.reload()},children:"Take me back"})]})}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),o}(o.Component)}},298:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(6),c=r.n(n),a=r(13),s=r(40),i=r(153),o=r(98),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}()},312:function(e,t,r){"use strict";(function(e){var n=r(27),c=r(313),a=r(314);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.a,"setTimeout","clearTimeout")}}).call(this,r(42))},313:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(40),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))}}},314:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(40),c=r(26),a=Math.floor,s=Math.random,i="0123456789ABCDEF",o=function(e){return e.toLowerCase().trim()},l=function e(t){var r,l=this;Object(n.a)(this,e),this.storage=t,this.colors=void 0,this.getColorForKey=function(e){var t=o(e),r=l.colors[t];return r||l.setColorForKey(t,"#".concat(Object(c.e)(6,(function(){return i[a(s()*i.length)]})).join("")))},this.setColorForKey=function(e,t){var r=o(e);return l.colors[r]=t,l.storage.set("colors",l.colors),t},this.colors=null!==(r=this.storage.get("colors"))&&void 0!==r?r:{}}},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(3),c=r(35),a=r(0),s=r(332),i=r(639),o=r(640),l=function(e){var t=e.title,r=e.children,l=e.bodyClassName,u=Object(c.a)(e,["title","children","bodyClassName"]);return Object(a.jsxs)(s.a,Object(n.a)(Object(n.a)({},u),{},{children:[t&&Object(a.jsx)(i.a,{children:t}),Object(a.jsx)(o.a,{className:l,children:r})]}))}},323:function(e,t,r){"use strict";var n=r(0),c=r(7),a=r.n(c),s=r(28),i=r(641),o=r(46),l=r(62),u=Object(i.a)(Object(l.c)(),l.b),d=function(e){var t=e.project,r=e.version;return Object(n.jsx)(o.a,{href:"https://github.com/shlinkio/".concat(t,"/releases/").concat(r),className:"text-muted",children:Object(n.jsx)("b",{children:r})})},j=function(e){var t=e.selectedServer,r=e.clientVersion,c=u(void 0===r?"%_VERSION_%":r);return Object(n.jsxs)("small",{className:"text-muted",children:[Object(s.c)(t)&&Object(n.jsxs)(n.Fragment,{children:["Server: ",Object(n.jsx)(d,{project:"shlink",version:t.printableVersion})," - "]}),"Client: ",Object(n.jsx)(d,{project:"shlink-web-client",version:c})]})};t.a=function(e){var t=e.selectedServer,r=a()("text-center",{"shlink-versions-container--with-server":Object(s.c)(t)});return Object(n.jsx)("div",{className:r,children:Object(n.jsx)(j,{selectedServer:t})})}},325:function(e,t,r){"use strict";var n=r(9),c=r(0),a=r(14),s=r(15),i=r(1),o=r(24),l=r(646),u=r(647),d=r(648),j=r(649),b=r(650),h=r(651),O=r(652),v=r(7),f=r.n(v),m=r(27),p=r(149);t.a=function(e){return function(t){var r=t.location,v=Object(m.c)(),x=Object(n.a)(v,4),g=x[0],S=x[1],y=x[3],C=r.pathname;Object(i.useEffect)(y,[r]);var N=f()("main-header__toggle-icon",{"main-header__toggle-icon--opened":g});return Object(c.jsxs)(l.a,{color:"primary",dark:!0,fixed:"top",className:"main-header",expand:"md",children:[Object(c.jsxs)(u.a,{tag:o.b,to:"/",children:[Object(c.jsx)(p.a,{className:"main-header__brand-logo",color:"white"})," Shlink"]}),Object(c.jsx)(d.a,{onClick:S,children:Object(c.jsx)(s.a,{icon:a.i,className:N})}),Object(c.jsx)(j.a,{navbar:!0,isOpen:g,children:Object(c.jsxs)(b.a,{navbar:!0,className:"ml-auto",children:[Object(c.jsx)(h.a,{children:Object(c.jsxs)(O.a,{tag:o.b,to:"/settings",active:"/settings"===C,children:[Object(c.jsx)(s.a,{icon:a.l}),"\xa0 Settings"]})}),Object(c.jsx)(e,{})]})})]})}}},326:function(e,t,r){"use strict";var n=r(0),c=r(655),a=r(334),s=r(24),i=r(332),o=r(637),l=r(46),u=r(15),d=r(14),j=r(165),b=r(149);t.a=function(e){var t=e.servers,r=Object(c.a)(t),h=!Object(a.a)(r);return Object(n.jsx)("div",{className:"home",children:Object(n.jsx)(i.a,{className:"home__main-card",children:Object(n.jsxs)(o.a,{noGutters:!0,children:[Object(n.jsx)("div",{className:"col-md-5 d-none d-md-block",children:Object(n.jsx)("div",{className:"p-4",children:Object(n.jsx)(b.a,{})})}),Object(n.jsxs)("div",{className:"col-md-7 home__servers-container",children:[Object(n.jsx)("div",{className:"p-4",children:Object(n.jsx)("h1",{className:"home__title",children:"Welcome testing deploy-preview-action!"})}),Object(n.jsx)(j.a,{embedded:!0,servers:r,children:!h&&Object(n.jsxs)("div",{className:"p-4 text-center",children:[Object(n.jsx)("p",{className:"mb-5",children:"This application will help you manage your Shlink servers."}),Object(n.jsx)("p",{children:Object(n.jsxs)(s.b,{to:"/server/create",className:"btn btn-outline-primary btn-lg mr-2",children:[Object(n.jsx)(u.a,{icon:d.C})," ",Object(n.jsx)("span",{className:"ml-1",children:"Add a server"})]})}),Object(n.jsx)("p",{className:"mb-0 mt-5",children:Object(n.jsx)(l.a,{href:"https://shlink.io/documentation",children:Object(n.jsxs)("small",{children:[Object(n.jsx)("span",{className:"mr-1",children:"Learn more about Shlink"})," ",Object(n.jsx)(u.a,{icon:d.o})]})})})]})})]})]})})})}},327:function(e,t,r){"use strict";var n=r(3),c=r(9),a=r(0),s=r(1),i=r(38),o=r(14),l=r(15),u=r(7),d=r.n(u),j=r(150),b=r(27),h=r(33),O=r(28),v=r(152);t.a=function(e,t,r,u,f,m,p,x,g,S,y){return Object(j.a)((function(j){var C=j.location,N=j.selectedServer,k=Object(b.c)(),w=Object(c.a)(k,4),_=w[0],U=w[1],T=w[2],R=w[3];if(Object(s.useEffect)((function(){return R()}),[C]),!Object(O.c)(N))return Object(a.jsx)(x,{});var D=Object(h.l)(N),E=Object(h.e)(N),L=Object(h.c)(N),V=d()("menu-layout__burger-icon",{"menu-layout__burger-icon--active":_}),I=Object(b.b)(T,R);return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(l.a,{icon:o.c,className:V,onClick:U}),Object(a.jsx)("div",Object(n.a)(Object(n.a)({},I),{},{className:"menu-layout__swipeable",children:Object(a.jsxs)("div",{className:"menu-layout__swipeable-inner",children:[Object(a.jsx)(r,{selectedServer:N,showOnMobile:_}),Object(a.jsx)("div",{className:"menu-layout__container",onClick:function(){return R()},children:Object(a.jsx)("div",{className:"container-xl",children:Object(a.jsxs)(i.d,{children:[Object(a.jsx)(i.a,{exact:!0,from:"/server/:serverId",to:"/server/:serverId/overview"}),Object(a.jsx)(i.b,{exact:!0,path:"/server/:serverId/overview",component:g}),Object(a.jsx)(i.b,{exact:!0,path:"/server/:serverId/list-short-urls/:page",component:t}),Object(a.jsx)(i.b,{exact:!0,path:"/server/:serverId/create-short-url",component:u}),Object(a.jsx)(i.b,{path:"/server/:serverId/short-code/:shortCode/visits",component:f}),Object(a.jsx)(i.b,{path:"/server/:serverId/short-code/:shortCode/edit",component:S}),D&&Object(a.jsx)(i.b,{path:"/server/:serverId/tag/:tag/visits",component:m}),E&&Object(a.jsx)(i.b,{path:"/server/:serverId/orphan-visits",component:p}),Object(a.jsx)(i.b,{exact:!0,path:"/server/:serverId/manage-tags",component:e}),L&&Object(a.jsx)(i.b,{exact:!0,path:"/server/:serverId/manage-domains",component:y}),Object(a.jsx)(i.b,{render:function(){return Object(a.jsx)(v.a,{to:"/server/".concat(N.id,"/list-short-urls/1"),children:"List short URLs"})}})]})})})]})}))]})}),x)}},328:function(e,t,r){"use strict";var n=r(3),c=r(35),a=r(0),s=r(14),i=r(15),o=r(24),l=r(7),u=r.n(l),d=r(28),j=r(33),b=function(e){var t=e.children,r=e.to,s=e.className,i=Object(c.a)(e,["children","to","className"]);return Object(a.jsx)(o.c,Object(n.a)(Object(n.a)({className:u()("aside-menu__item",s),activeClassName:"aside-menu__item--selected",to:r},i),{},{children:t}))};t.a=function(e){return function(t){var r=t.selectedServer,n=t.showOnMobile,c=void 0!==n&&n,o=Object(d.d)(r)?r.id:"",l=Object(j.c)(r),h=u()("aside-menu",{"aside-menu--hidden":!c}),O=function(e){return"/server/".concat(o).concat(e)};return Object(a.jsx)("aside",{className:h,children:Object(a.jsxs)("nav",{className:"nav flex-column aside-menu__nav",children:[Object(a.jsxs)(b,{to:O("/overview"),children:[Object(a.jsx)(i.a,{icon:s.s}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Overview"})]}),Object(a.jsxs)(b,{to:O("/list-short-urls/1"),isActive:function(e,t){return null!==t.pathname.match("/list-short-urls")},children:[Object(a.jsx)(i.a,{icon:s.v}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"List short URLs"})]}),Object(a.jsxs)(b,{to:O("/create-short-url"),children:[Object(a.jsx)(i.a,{icon:s.u,flip:"horizontal"}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Create short URL"})]}),Object(a.jsxs)(b,{to:O("/manage-tags"),children:[Object(a.jsx)(i.a,{icon:s.L}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Manage tags"})]}),l&&Object(a.jsxs)(b,{to:O("/manage-domains"),children:[Object(a.jsx)(i.a,{icon:s.r}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Manage domains"})]}),Object(a.jsxs)(b,{to:O("/edit"),className:"aside-menu__item--push",children:[Object(a.jsx)(i.a,{icon:s.A}),Object(a.jsx)("span",{className:"aside-menu__item-text",children:"Edit this server"})]}),Object(d.d)(r)&&Object(a.jsx)(e,{className:"aside-menu__item aside-menu__item--danger",textClassName:"aside-menu__item-text",server:r})]})})}}},33:function(e,t,r){"use strict";r.d(t,"j",(function(){return s})),r.d(t,"l",(function(){return i})),r.d(t,"d",(function(){return o})),r.d(t,"h",(function(){return l})),r.d(t,"n",(function(){return u})),r.d(t,"g",(function(){return d})),r.d(t,"k",(function(){return j})),r.d(t,"e",(function(){return b})),r.d(t,"f",(function(){return h})),r.d(t,"m",(function(){return O})),r.d(t,"a",(function(){return v})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return m})),r.d(t,"c",(function(){return p}));var n=r(28),c=r(62),a=function(e){return function(t){return Object(n.c)(t)&&Object(c.a)(t.version,e)}},s=a({minVersion:"2.1.0"}),i=a({minVersion:"2.2.0"}),o=a({minVersion:"2.4.0"}),l=o,u=o,d=a({minVersion:"2.5.0"}),j=a({minVersion:"2.6.0"}),b=j,h=j,O=j,v=a({minVersion:"2.7.0"}),f=v,m=a({minVersion:"2.8.0"}),p=m},335:function(e,t,r){e.exports=r(633)},420:function(e,t){},422:function(e,t){},44:function(e,t,r){"use strict";r.d(t,"c",(function(){return n})),r.d(t,"d",(function(){return c})),r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s})),r.d(t,"f",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"g",(function(){return l})),r.d(t,"h",(function(){return u}));var n="#4696e5",c="rgba(70, 150, 229, 0.4)",a="#f77f28",s="rgba(247, 127, 40, 0.4)",i="white",o="#161b22",l=function(e){var t,r=document.getElementsByTagName("html");null===r||void 0===r||null===(t=r[0])||void 0===t||t.setAttribute("data-theme",e)},u=function(){var e,t=document.getElementsByTagName("html");return"dark"===(null===t||void 0===t||null===(e=t[0])||void 0===e?void 0:e.getAttribute("data-theme"))}},48:function(e,t,r){"use strict";var n=r(0),c=r(637),a=r(332),s=r(7),i=r.n(s),o=r(14),l=r(15),u=function(e){return{error:"border-danger",default:""}[e]},d=function(e){return{error:"text-danger",default:"text-muted"}[e]};t.a=function(e){var t=e.className,r=e.children,s=e.loading,j=void 0!==s&&s,b=e.type,h=void 0===b?"default":b,O=e.fullWidth,v=void 0!==O&&O,f=i()({"col-md-12":v,"col-md-10 offset-md-1":!v});return Object(n.jsx)(c.a,{noGutters:!0,className:t,children:Object(n.jsx)("div",{className:f,children:Object(n.jsx)(a.a,{className:u(h),body:!0,children:Object(n.jsxs)("h3",{className:i()("text-center mb-0",d(h)),children:[j&&Object(n.jsx)(l.a,{icon:o.k,spin:!0}),j&&Object(n.jsx)("span",{className:"ml-2",children:null!==r&&void 0!==r?r:"Loading..."}),!j&&r]})})})})}},61:function(e,t,r){"use strict";var n=r(0);t.a=function(e){var t=e.children;return Object(n.jsx)("div",{className:"no-menu-wrapper container-xl",children:t})}},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(168),c=r(638),a=r(643),s=r(26),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}}},633:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"processStatsFromVisits",(function(){return Ra})),r.d(n,"normalizeVisits",(function(){return Da}));var c,a=r(0),s=r(43),i=r(163),o=r(24),l=r(146),u=r(10),d=r(3),j=r(291),b=r(38),h=r(703),O=r(708),v=r(28),f=r(6),m=r.n(f),p=r(13),x=r(40),g=r(121),S=r.n(g),y=r(324),C=r(216),N=r(334),k=function(e,t){return e?"".concat(e,"/rest/v").concat(t):""},w=Object(y.a)(C.a),_=function e(t,r,n){var c=this;Object(x.a)(this,e),this.axios=t,this.baseUrl=r,this.apiKey=n,this.apiVersion=void 0,this.listShortUrls=Object(p.a)(m.a.mark((function e(){var t,r=arguments;return m.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",t).then((function(e){return e.data.shortUrls})));case 2:case"end":return e.stop()}}),e)}))),this.createShortUrl=function(){var e=Object(p.a)(m.a.mark((function e(t){var r;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.a)((function(e){return Object(N.a)(e)||Object(C.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(p.a)(m.a.mark((function e(t,r){return m.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(p.a)(m.a.mark((function e(t,r){return m.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(p.a)(m.a.mark((function e(t){return m.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.getVisitsOverview=Object(p.a)(m.a.mark((function e(){return m.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(p.a)(m.a.mark((function e(t,r){return m.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(p.a)(m.a.mark((function e(t,r){return m.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(p.a)(m.a.mark((function e(t,r,n){return m.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(p.a)(m.a.mark((function e(t,r,n){return m.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(p.a)(m.a.mark((function e(){return m.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(p.a)(m.a.mark((function e(t){return m.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(p.a)(m.a.mark((function e(t,r){return m.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(p.a)(m.a.mark((function e(){return m.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(p.a)(m.a.mark((function e(){return m.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(p.a)(m.a.mark((function e(){return m.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.data})));case 1:case"end":return e.stop()}}),e)}))),this.editDomainRedirects=function(){var e=Object(p.a)(m.a.mark((function e(t){return m.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(p.a)(m.a.mark((function e(t){var r,n,a,s,i=arguments;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:"GET",n=i.length>2&&void 0!==i[2]?i[2]:{},a=i.length>3&&void 0!==i[3]?i[3]:{},e.prev=3,e.next=6,c.axios({method:r,url:"".concat(k(c.baseUrl,c.apiVersion)).concat(t),headers:{"X-Api-Key":c.apiKey},params:w(n),data:a,paramsSerializer:function(e){return S.a.stringify(e,{arrayFormat:"brackets"})}});case 6:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),s=e.t0.response,!s&&2!==c.apiVersion){e.next=15;break}throw e.t0;case 15:return c.apiVersion=c.apiVersion-1,e.next=18,c.performRequest(t,r,n,a);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}(),this.apiVersion=2},U={},T=function(e){return function(t){var r,n=function(e){return"function"===typeof e}(t)?(r=t,Object(O.a)("selectedServer",r())):t;if(!Object(v.a)(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 U[s]||(U[s]=new _(e,c,a)),U[s]}},R=function(e){e.serviceFactory("buildShlinkApiClient",T,"axios")},D=r(292),E=r(9),L=r(1),V=function(e,t){return function(r){var n,c=r.match,s=null!==(n=null===c||void 0===c?void 0:c.params)&&void 0!==n?n:{},i=s.page,o=void 0===i?"1":i,l=s.serverId,u=void 0===l?"":l,j=Object(L.useState)("".concat(u,"_").concat(o)),b=Object(E.a)(j,2),h=b[0],O=b[1];return Object(L.useEffect)((function(){O("".concat(u,"_").concat(o))}),[u,o]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{className:"form-group",children:Object(a.jsx)(e,{})}),Object(L.createElement)(t,Object(d.a)(Object(d.a)({},r),{},{key:h}))]})}},I=r(14),F=r(15),A=r(641),M=r(410),G=r(7),P=r.n(G),B=function(e){var t=e.onChange,r=e.className,n=e.large,s=void 0===n||n,i=e.noBorder,o=void 0!==i&&i,l=Object(L.useState)(""),u=Object(E.a)(l,2),d=u[0],j=u[1],b=function(){c&&clearTimeout(c),c=null},h=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;j(e),b(),c=setTimeout((function(){t(e),b()}),r)};return Object(a.jsxs)("div",{className:P()("search-field",r),children:[Object(a.jsx)("input",{type:"text",className:P()("form-control search-field__input",{"form-control-lg":s,"search-field__input--no-border":o}),placeholder:"Search...",value:d,onChange:function(e){return h(e.target.value)}}),Object(a.jsx)(F.a,{icon:I.F,className:"search-field__icon"}),Object(a.jsx)("div",{className:"close search-field__close",hidden:""===d,id:"search-field__close",onClick:function(){return h("",0)},children:"\xd7"})]})},H=function(e){var t=e.text,r=e.children,n=e.clearable,c=e.className,s=void 0===c?"":c,i=e.colorGenerator,o=e.onClick,l=e.onClose;return Object(a.jsxs)("span",{className:"badge tag ".concat(s),style:{backgroundColor:i.getColorForKey(t),cursor:n||!o?"auto":"pointer"},onClick:o,children:[null!==r&&void 0!==r?r:t,n&&Object(a.jsx)("span",{className:"close tag__close-selected-tag",onClick:l,children:"\xd7"})]})},W=r(659),q=r(125),z=r(656),K=r(657),Q=r(27),J=function(e){var t=e.text,r=e.disabled,n=void 0!==r&&r,c=e.className,s=void 0===c?"":c,i=e.children,o=e.dropdownClassName,l=e.right,u=void 0!==l&&l,d=e.minWidth,j=Object(Q.c)(),b=Object(E.a)(j,2),h=b[0],O=b[1],v="dropdown-btn__toggle btn-block ".concat(s),f={minWidth:d&&"".concat(d,"px")};return Object(a.jsxs)(q.a,{isOpen:h,toggle:O,disabled:n,className:o,children:[Object(a.jsx)(z.a,{caret:!0,className:v,color:"primary",children:t}),Object(a.jsx)(K.a,{className:"w-100",right:u,style:f,children:i})]})},Z=r(84),Y=r(376),X=r(204),$=r(322),ee=r(635),te=r(658),re=(r(634),function(e){return"string"!==typeof e}),ne=function(e,t){return e&&re(e)?t?Object(ee.default)(e,t):Object(te.a)(e):e},ce=function(e){return ne(e,void 0)},ae=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return function(t){return ne(t,e)}}(),se=function(e){return void 0===e||Object(N.a)(Object($.a)(Boolean,e))},ie=function(e){return"string"===typeof e},oe={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",last180days:"Last 180 days",last365Days:"Last 365 days"},le=Object.keys(oe),ue=function(e){if(e)return ie(e)?oe[e]:function(e){if(e&&!se(e))return e.startDate&&!e.endDate?"Since ".concat(ae(e.startDate)):!e.startDate&&e.endDate?"Until ".concat(ae(e.endDate)):"".concat(ae(e.startDate)," - ").concat(ae(e.endDate))}(e)},de=function(e){return Object(Z.default)(Object(Y.default)(new Date,e))},je=function(e){if(!e)return{};switch(e){case"today":return{startDate:Object(Z.default)(new Date),endDate:new Date};case"yesterday":return{startDate:de(1),endDate:Object(X.default)(Object(Y.default)(new Date,1))};case"last7Days":return{startDate:de(7),endDate:new Date};case"last30Days":return{startDate:de(30),endDate:new Date};case"last90Days":return{startDate:de(90),endDate:new Date};case"last180days":return{startDate:de(180),endDate:new Date};case"last365Days":return{startDate:de(365),endDate:new Date}}return{}},be=r(300),he=r.n(be),Oe=r(103),ve=function(e){var t=e.className,r=e.isClearable,n=e.selected,c=!r||Object(C.a)(n),s=Object(L.useRef)();return Object(a.jsxs)("div",{className:"date-input-container",children:[Object(a.jsx)(he.a,Object(d.a)(Object(d.a)({},e),{},{dateFormat:"yyyy-MM-dd",className:P()("date-input-container__input form-control",t),ref:s})),c&&Object(a.jsx)(F.a,{icon:Oe.a,className:"date-input-container__icon",onClick:function(){var e;return null===(e=s.current)||void 0===e?void 0:e.input.focus()}})]})},fe=function(e){var t=e.startDate,r=void 0===t?null:t,n=e.endDate,c=void 0===n?null:n,s=e.disabled,i=void 0!==s&&s,o=e.onStartDateChange,l=e.onEndDateChange;return Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(ve,{selected:r,placeholderText:"Since...",isClearable:!0,maxDate:null!==c&&void 0!==c?c:void 0,disabled:i,onChange:o})}),Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(ve,{className:"mt-2 mt-md-0",selected:c,placeholderText:"Until...",isClearable:!0,minDate:null!==r&&void 0!==r?r:void 0,disabled:i,onChange:l})})]})},me=function(e){var t=e.active,r=e.onChange;return Object(a.jsx)(a.Fragment,{children:le.map((function(e){return Object(a.jsx)(W.a,{active:t===e,onClick:function(){return r(e)},children:ue(e)},e)}))})},pe=function(e){var t,r=e.onDatesChange,n=e.initialDateRange,c=e.defaultText,s=e.disabled,i=Object(L.useState)(ie(n)?n:void 0),o=Object(E.a)(i,2),l=o[0],u=o[1],j=Object(L.useState)(ie(n)?void 0:n),b=Object(E.a)(j,2),h=b[0],O=b[1],v=function(e){u(void 0),O(e),r(e)},f=function(e){return function(){u(e),O(void 0),r(je(e))}};return Object(a.jsxs)(J,{disabled:s,text:null!==(t=ue(null!==l&&void 0!==l?l:h))&&void 0!==t?t:c,children:[Object(a.jsx)(W.a,{active:void 0===l&&se(h),onClick:f(void 0),children:c}),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(me,{active:l,onChange:function(e){return f(e)()}}),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(W.a,{header:!0,children:"Custom:"}),Object(a.jsx)(W.a,{text:!0,children:Object(a.jsx)(fe,Object(d.a)(Object(d.a)({},h),{},{onStartDateChange:function(e){return v(Object(d.a)(Object(d.a)({},h),{},{startDate:e}))},onEndDateChange:function(e){return v(Object(d.a)(Object(d.a)({},h),{},{endDate:e}))}}))})]})},xe=function(e){return e?Object(M.default)(e):null},ge=function(e){return function(t){var r,n=t.listShortUrls,c=t.shortUrlsListParams,s=null!==(r=c.tags)&&void 0!==r?r:[],i=Object(A.a)((function(e){var t,r,n=e.startDate,c=e.endDate;return{startDate:null!==(t=ce(n))&&void 0!==t?t:void 0,endDate:null!==(r=ce(c))&&void 0!==r?r:void 0}}),(function(e){return n(Object(d.a)(Object(d.a)({},c),e))}));return Object(a.jsxs)("div",{className:"search-bar-container",children:[Object(a.jsx)(B,{onChange:function(e){return n(Object(d.a)(Object(d.a)({},c),{},{searchTerm:e}))}}),Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsx)("div",{className:"row",children:Object(a.jsx)("div",{className:"col-lg-8 offset-lg-4 col-xl-6 offset-xl-6",children:Object(a.jsx)(pe,{defaultText:"All short URLs",initialDateRange:{startDate:xe(c.startDate),endDate:xe(c.endDate)},onDatesChange:i})})})}),!Object(N.a)(s)&&Object(a.jsxs)("h4",{className:"search-bar__selected-tag mt-3",children:[Object(a.jsx)(F.a,{icon:I.L,className:"search-bar__tags-icon"}),"\xa0",s.map((function(t){return Object(a.jsx)(H,{colorGenerator:e,text:t,clearable:!0,onClose:function(){return n(Object(d.a)(Object(d.a)({},c),{},{tags:s.filter((function(e){return e!==t}))}))}},t)}))]})]})}},Se=r(29),ye=r(669),Ce=r(53),Ne=r(655),ke=r(332),we=r(660),_e=r(661),Ue=r(26);function Te(e){var t=e.items,r=e.orderField,n=e.orderDir,c=e.onChange,s=e.isButton,i=void 0===s||s,o=e.right,l=void 0!==o&&o,u=function(e){return function(){var t=Object(Ue.a)(e,r,n);c(t?e:void 0,t)}};return Object(a.jsxs)(we.a,{children:[Object(a.jsxs)(z.a,{caret:!0,color:i?"primary":"link",className:P()({"dropdown-btn__toggle btn-block":i,"btn-sm p-0":!i}),children:[!i&&Object(a.jsx)(a.Fragment,{children:"Order by"}),i&&!r&&Object(a.jsx)(a.Fragment,{children:"Order by..."}),i&&r&&'Order by: "'.concat(t[r],'" - "').concat(null!==n&&void 0!==n?n:"DESC",'"')]}),Object(a.jsxs)(K.a,{right:l,className:P()("w-100",{"sorting-dropdown__menu--link":!i}),children:[Object(_e.a)(t).map((function(e){var t=Object(E.a)(e,2),c=t[0],s=t[1];return Object(a.jsxs)(W.a,{active:r===c,onClick:u(c),children:[s,r===c&&Object(a.jsx)(F.a,{icon:"ASC"===n?I.I:I.H,className:"sorting-dropdown__sort-icon"})]},c)})),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(W.a,{disabled:!r,onClick:function(){return c()},children:Object(a.jsx)("i",{children:"Clear selection"})})]})]})}var Re=r(301);function De(e,t){var r=new Set;return function(n){var c=n.createNewVisits,s=n.loadMercureInfo,i=n.mercureInfo,o=i.interval;return Object(L.useEffect)((function(){var e=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 Re.EventSourcePolyfill(t,{headers:{Authorization:"Bearer ".concat(a)}});return r.onmessage=o,r.onerror=l,r}));return function(){return u.forEach((function(e){return e.close()}))}}}(i,t(n),(function(e){return o?r.add(e):c([e])}),s);if(!o)return e;var a=setInterval((function(){c(Object(Se.a)(r)),r.clear()}),1e3*o*60);return Object(A.a)((function(){return clearInterval(a)}),(function(){return null===e||void 0===e?void 0:e()}))}),[i]),Object(a.jsx)(e,Object(d.a)({},n))}}var Ee=function(e){return S.a.parse(e,{ignoreQueryPrefix:!0})},Le=function e(){Object(x.a)(this,e)};Le.visits="https://shlink.io/new-visit",Le.orphanVisits="https://shlink.io/new-orphan-visit",Le.shortUrlVisits=function(e){return"https://shlink.io/new-visit/".concat(e)};var Ve,Ie,Fe,Ae,Me,Ge,Pe,Be,He,We,qe,ze,Ke,Qe,Je,Ze,Ye,Xe,$e,et=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}},tt=function(e){return function(){return{type:e}}},rt=r(662),nt=r(663),ct=r(302),at=r(664),st=function(e,t,r){return Object(C.a)(r)?e.shortCode===t&&!e.domain:e.shortCode===t&&e.domain===r},it="shlink/visitCreation/CREATE_VISITS",ot=function(e){return{type:it,createdVisits:e}},lt=function(e){var t;return null===(t=e.response)||void 0===t?void 0:t.data},ut=function(e){return"INVALID_SHORTCODE_DELETION"===(null===e||void 0===e?void 0:e.type)},dt="shlink/deleteShortUrl/DELETE_SHORT_URL_START",jt="shlink/deleteShortUrl/DELETE_SHORT_URL_ERROR",bt="shlink/deleteShortUrl/SHORT_URL_DELETED",ht="shlink/deleteShortUrl/RESET_DELETE_SHORT_URL",Ot={shortCode:"",loading:!1,error:!1},vt=et((Ve={},Object(u.a)(Ve,dt,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(Ve,jt,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{errorData:r,loading:!1,error:!0})})),Object(u.a)(Ve,bt,(function(e,t){var r=t.shortCode;return Object(d.a)(Object(d.a)({},e),{},{shortCode:r,loading:!1,error:!1})})),Object(u.a)(Ve,ht,(function(){return Ot})),Ve),Ot),ft=function(e){return function(t,r){return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:dt}),s=e(a),i=s.deleteShortUrl,n.prev=2,n.next=5,i(t,r);case 5:c({type:bt,shortCode:t,domain:r}),n.next=12;break;case 8:throw n.prev=8,n.t0=n.catch(2),c({type:jt,errorData:lt(n.t0)}),n.t0;case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e,t){return n.apply(this,arguments)}}()}},mt=tt(ht),pt="shlink/createShortUrl/CREATE_SHORT_URL_START",xt="shlink/createShortUrl/CREATE_SHORT_URL_ERROR",gt="shlink/createShortUrl/CREATE_SHORT_URL",St="shlink/createShortUrl/RESET_CREATE_SHORT_URL",yt={result:null,saving:!1,error:!1},Ct=et((Ie={},Object(u.a)(Ie,pt,(function(e){return Object(d.a)(Object(d.a)({},e),{},{saving:!0,error:!1})})),Object(u.a)(Ie,xt,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(u.a)(Ie,gt,(function(e,t){return{result:t.result,saving:!1,error:!1}})),Object(u.a)(Ie,St,(function(){return yt})),Ie),yt),Nt=function(e){return function(t){return function(){var r=Object(p.a)(m.a.mark((function r(n,c){var a,s,i;return m.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:pt}),a=e(c),s=a.createShortUrl,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:gt,result:i}),r.next=13;break;case 9:throw r.prev=9,r.t0=r.catch(2),n({type:xt,errorData:lt(r.t0)}),r.t0;case 13:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},kt=tt(St),wt=r(33),_t="shlink/shortUrlEdition/EDIT_SHORT_URL_START",Ut="shlink/shortUrlEdition/EDIT_SHORT_URL_ERROR",Tt="shlink/shortUrlEdition/SHORT_URL_EDITED",Rt=et((Fe={},Object(u.a)(Fe,_t,(function(e){return Object(d.a)(Object(d.a)({},e),{},{saving:!0,error:!1})})),Object(u.a)(Fe,Ut,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{saving:!1,error:!0,errorData:r})})),Object(u.a)(Fe,Tt,(function(e,t){return{shortUrl:t.shortUrl,saving:!1,error:!1}})),Fe),{saving:!1,error:!1}),Dt=function(e){return function(t,r,n){return function(){var c=Object(p.a)(m.a.mark((function c(a,s){var i,o,l,u,d,j,b,h,O;return m.a.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return a({type:_t}),i=s(),o=i.selectedServer,l=!Object(wt.m)(o),u=e(s),d=u.updateShortUrl,j=u.updateShortUrlTags,c.prev=4,c.next=7,Promise.all([d(t,r,n),l&&n.tags?j(t,r,n.tags):void 0]);case 7:b=c.sent,h=Object(E.a)(b,1),O=h[0],a({shortUrl:O,type:Tt}),c.next=17;break;case 13:throw c.prev=13,c.t0=c.catch(4),a({type:Ut,errorData:lt(c.t0)}),c.t0;case 17:case"end":return c.stop()}}),c,null,[[4,13]])})));return function(e,t){return c.apply(this,arguments)}}()}},Et="shlink/shortUrlsList/LIST_SHORT_URLS_START",Lt="shlink/shortUrlsList/LIST_SHORT_URLS_ERROR",Vt="shlink/shortUrlsList/LIST_SHORT_URLS",It=et((Ae={},Object(u.a)(Ae,Et,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(Ae,Lt,(function(){return{loading:!1,error:!0}})),Object(u.a)(Ae,Vt,(function(e,t){return{loading:!1,error:!1,shortUrls:t.shortUrls}})),Object(u.a)(Ae,bt,Object(A.a)((function(e,t){var r=t.shortCode,n=t.domain;return e.shortUrls?Object(rt.a)(["shortUrls","data"],Object(y.a)((function(e){return st(e,r,n)}),e.shortUrls.data),e):e}),(function(e){return e.shortUrls?Object(rt.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems-1,e):e}))),Object(u.a)(Ae,it,(function(e,t){var r,n,c=t.createdVisits;return Object(rt.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(nt.a)(c.filter((function(t){var r=t.shortUrl;return r&&st(e,r.shortCode,r.domain)})));return null!==t&&void 0!==t&&t.shortUrl?Object(ct.a)("visitsCount",t.shortUrl.visitsCount,e):e})),e)})),Object(u.a)(Ae,gt,Object(A.a)((function(e,t){var r=t.result;return e.shortUrls?Object(rt.a)(["shortUrls","data"],[r].concat(Object(Se.a)(Object(at.a)(e.shortUrls.data))),e):e}),(function(e){return e.shortUrls?Object(rt.a)(["shortUrls","pagination","totalItems"],e.shortUrls.pagination.totalItems+1,e):e}))),Object(u.a)(Ae,Tt,(function(e,t){var r=t.shortUrl;return e.shortUrls?Object(rt.a)(["shortUrls","data"],e.shortUrls.data.map((function(e){var t=r.shortCode,n=r.domain;return st(e,t,n)?r:e})),e):e})),Ae),{loading:!0,error:!1}),Ft=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var r=Object(p.a)(m.a.mark((function r(n,c){var a,s,i;return m.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:Et}),a=e(c),s=a.listShortUrls,r.prev=2,r.next=5,s(t);case 5:i=r.sent,n({type:Vt,shortUrls:i,params:t}),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),n({type:Lt,params:t});case 12:case"end":return r.stop()}}),r,null,[[2,9]])})));return function(e,t){return r.apply(this,arguments)}}()}},At="shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS",Mt={dateCreated:"Created at",shortCode:"Short URL",longUrl:"Long URL",title:"Title",visits:"Visits"},Gt={page:"1",orderBy:{dateCreated:"DESC"}},Pt=et((Me={},Object(u.a)(Me,Vt,(function(e,t){var r=t.params;return Object(d.a)(Object(d.a)({},e),r)})),Object(u.a)(Me,At,(function(){return Gt})),Me),Gt),Bt=tt(At),Ht=r(666),Wt=r(667),qt=r(668),zt=r(642),Kt=r(303),Qt=r(665),Jt=Math.ceil,Zt=new Intl.NumberFormat("en-US"),Yt=function(e){return Zt.format(e)},Xt="...",$t=function(e,t){var r=Object(zt.a)(Object(Kt.a)(2,e-2),Object(Qt.a)(t-1,e+2)+1);return e-2>2&&r.unshift(Xt),e+2<t-1&&r.push(Xt),r.unshift(1),r.push(t),r},er=function(e){return e===Xt},tr=function(e){return er(e)?e:Yt(e)},rr=function(e,t){return er(e)?"".concat(e,"_").concat(t):"".concat(e)},nr=function(e){var t=e.paginator,r=e.serverId,n=null!==t&&void 0!==t?t:{},c=n.currentPage,s=void 0===c?0:c,i=n.pagesCount,l=void 0===i?0:i;if(l<=1)return null;return Object(a.jsxs)(qt.a,{className:"short-urls-paginator",listClassName:"flex-wrap justify-content-center mb-0",children:[Object(a.jsx)(Ht.a,{disabled:1===s,children:Object(a.jsx)(Wt.a,{previous:!0,tag:o.b,to:"/server/".concat(r,"/list-short-urls/").concat(s-1)})}),$t(s,l).map((function(e,t){return Object(a.jsx)(Ht.a,{disabled:er(e),active:s===e,children:Object(a.jsx)(Wt.a,{tag:o.b,to:"/server/".concat(r,"/list-short-urls/").concat(e),children:tr(e)})},rr(e,t))})),Object(a.jsx)(Ht.a,{disabled:s>=l,children:Object(a.jsx)(Wt.a,{next:!0,tag:o.b,to:"/server/".concat(r,"/list-short-urls/").concat(s+1)})})]})},cr=function(e){return De((function(t){var r,n=t.listShortUrls,c=t.resetShortUrlParams,s=t.shortUrlsListParams,i=t.match,o=t.location,l=t.shortUrlsList,j=t.selectedServer,b=s.orderBy,h=Object(L.useState)({orderField:b&&Object(ye.a)(Object(Ce.a)(b)),orderDir:b&&Object(ye.a)(Object(Ne.a)(b))}),O=Object(E.a)(h,2),f=O[0],m=O[1],p=(null!==(r=null===l||void 0===l?void 0:l.shortUrls)&&void 0!==r?r:{}).pagination,x=function(e){return n(Object(d.a)(Object(d.a)({},s),e))},g=function(e,t){m({orderField:e,orderDir:t}),x({orderBy:e?Object(u.a)({},e,t):void 0})};return Object(L.useEffect)((function(){var e=Ee(o.search).tag,t=e?[e]:s.tags;return x({page:i.params.page,tags:t,itemsPerPage:void 0}),c}),[]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{className:"d-block d-lg-none mb-3",children:Object(a.jsx)(Te,{items:Mt,orderField:f.orderField,orderDir:f.orderDir,onChange:g})}),Object(a.jsxs)(ke.a,{body:!0,className:"pb-1",children:[Object(a.jsx)(e,{orderByColumn:function(e){return function(){return g(e,Object(Ue.a)(e,f.orderField,f.orderDir))}},renderOrderIcon:function(e){return f.orderField!==e?null:f.orderDir?Object(a.jsx)(F.a,{icon:"ASC"===f.orderDir?I.f:I.e,className:"short-urls-list__header-icon"}):null},selectedServer:j,shortUrlsList:l,onTagClick:function(e){var t;return x({tags:[].concat(Object(Se.a)(null!==(t=s.tags)&&void 0!==t?t:[]),[e])})}}),Object(a.jsx)(nr,{paginator:p,serverId:Object(v.c)(j)?j.id:""})]})]})}),(function(){return[Le.visits]}))},ar=r(46),sr=r(159),ir=r.n(sr),or=function(e){var t=e.text,r=e.onCopy;return Object(a.jsx)(ir.a,{text:t,onCopy:r,children:Object(a.jsx)(F.a,{icon:Oe.b,className:"ml-2 copy-to-clipboard-icon"})})},lr=r(670),ur=r(710),dr=function(e){var t=e.date,r=e.format,n=void 0===r?"yyyy-MM-dd HH:mm":r,c=e.relative,s=void 0!==c&&c,i=re(t)?t:Object(M.default)(t);return Object(a.jsx)("time",{dateTime:"".concat(Object(lr.a)(i),"000"),children:s?"".concat(Object(ur.a)(new Date,i)," ago"):Object(ee.default)(i,n)})},jr=r(671),br=r(35),hr=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)},Or=function(e){var t=e.selectedServer,r=e.shortUrl,n=e.suffix,c=e.children,s=Object(br.a)(e,["selectedServer","shortUrl","suffix","children"]);return t&&Object(v.d)(t)&&r?Object(a.jsx)(o.b,Object(d.a)(Object(d.a)({to:hr(t,r,n)},s),{},{children:c})):Object(a.jsx)("span",Object(d.a)(Object(d.a)({},s),{},{children:c}))},vr=function(e){var t,r=e.visitsCount,n=e.shortUrl,c=e.selectedServer,s=e.active,i=void 0!==s&&s,o=null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.maxVisits,l=Object(a.jsx)(Or,{selectedServer:c,shortUrl:n,suffix:"visits",children:Object(a.jsx)("strong",{className:P()("short-url-visits-count__amount",{"short-url-visits-count__amount--big":i}),children:Yt(r)})});if(!o)return l;var u=Yt(o),d=Object(L.useRef)();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)("span",{className:"indivisible",children:[l,Object(a.jsxs)("small",{className:"short-urls-visits-count__max-visits-control",ref:function(e){d.current=e},children:[" ","/ ",u," ",Object(a.jsx)("sup",{children:Object(a.jsx)(F.a,{icon:I.t})})]})]}),Object(a.jsxs)(jr.a,{target:function(){return d.current},placement:"bottom",children:["This short URL will not accept more than ",Object(a.jsx)("b",{children:u})," visits."]})]})},fr=function(e,t,r){return function(n){var c,s,i=n.shortUrl,o=n.selectedServer,l=n.onTagClick,u=r(),d=Object(E.a)(u,2),j=d[0],b=d[1],h=r(!1,500),O=Object(E.a)(h,2),v=O[0],f=O[1],m=Object(L.useRef)(!0);return Object(L.useEffect)((function(){m.current?m.current=!1:f()}),[i.visitsCount]),Object(a.jsxs)("tr",{className:"responsive-table__row",children:[Object(a.jsx)("td",{className:"indivisible short-urls-row__cell responsive-table__cell","data-th":"Created at",children:Object(a.jsx)(dr,{date:i.dateCreated})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Short URL",children:Object(a.jsxs)("span",{className:"indivisible short-urls-row__cell--relative",children:[Object(a.jsx)(ar.a,{href:i.shortUrl}),Object(a.jsx)(or,{text:i.shortUrl,onCopy:b}),Object(a.jsx)("span",{className:"badge badge-warning short-urls-row__copy-hint",hidden:!j,children:"Copied short URL!"})]})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell short-urls-row__cell--break","data-th":"".concat(i.title?"Title":"Long URL"),children:Object(a.jsx)(ar.a,{href:i.longUrl,children:null!==(c=i.title)&&void 0!==c?c:i.longUrl})}),i.title&&Object(a.jsx)("td",{className:"short-urls-row__cell responsive-table__cell short-urls-row__cell--break d-lg-none","data-th":"Long URL",children:Object(a.jsx)(ar.a,{href:i.longUrl})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell","data-th":"Tags",children:(s=i.tags,Object(N.a)(s)?Object(a.jsx)("i",{className:"indivisible",children:Object(a.jsx)("small",{children:"No tags"})}):s.map((function(e){return Object(a.jsx)(H,{colorGenerator:t,text:e,onClick:function(){return null===l||void 0===l?void 0:l(e)}},e)})))}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell text-lg-right","data-th":"Visits",children:Object(a.jsx)(vr,{visitsCount:i.visitsCount,shortUrl:i,selectedServer:o,active:v})}),Object(a.jsx)("td",{className:"responsive-table__cell short-urls-row__cell",children:Object(a.jsx)(e,{selectedServer:o,shortUrl:i})})]})}},mr=r(672),pr=function(e,t){return function(r){var n=r.shortUrl,c=r.selectedServer,s=Object(Q.c)(),i=Object(E.a)(s,2),o=i[0],l=i[1],u=Object(Q.c)(),d=Object(E.a)(u,2),j=d[0],b=d[1],h=Object(Q.c)(),O=Object(E.a)(h,2),v=O[0],f=O[1];return Object(a.jsxs)(mr.a,{toggle:l,isOpen:o,children:[Object(a.jsxs)(z.a,{size:"sm",caret:!0,outline:!0,className:"short-urls-row-menu__dropdown-toggle",children:["\xa0",Object(a.jsx)(F.a,{icon:I.n}),"\xa0"]}),Object(a.jsxs)(K.a,{right:!0,children:[Object(a.jsxs)(W.a,{tag:Or,selectedServer:c,shortUrl:n,suffix:"visits",children:[Object(a.jsx)(F.a,{icon:I.g,fixedWidth:!0})," Visit stats"]}),Object(a.jsxs)(W.a,{tag:Or,selectedServer:c,shortUrl:n,suffix:"edit",children:[Object(a.jsx)(F.a,{icon:I.m,fixedWidth:!0})," Edit short URL"]}),Object(a.jsxs)(W.a,{onClick:b,children:[Object(a.jsx)(F.a,{icon:I.D,fixedWidth:!0})," QR code"]}),Object(a.jsx)(t,{shortUrl:n,isOpen:j,toggle:b}),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsxs)(W.a,{className:"short-urls-row-menu__dropdown-item--danger",onClick:f,children:[Object(a.jsx)(F.a,{icon:I.x,fixedWidth:!0})," Delete short URL"]}),Object(a.jsx)(e,{shortUrl:n,isOpen:v,toggle:f})]})]})}},xr=function(e,t){return function(r){var n=r.createShortUrl,c=r.shortUrlCreationResult,s=r.resetCreateShortUrl,i=r.selectedServer,o=r.basicMode,l=void 0!==o&&o,u=r.settings.shortUrlCreation,j=Object(L.useMemo)((function(){return function(e){var t;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}}(u)}),[u]);return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(e,{initialState:j,saving:c.saving,selectedServer:i,mode:l?"create-basic":"create",onSave:function(){var e=Object(p.a)(m.a.mark((function e(t){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(),e.abrupt("return",n(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),Object(a.jsx)(t,Object(d.a)(Object(d.a)({},c),{},{resetCreateShortUrl:s,canBeClosed:l}))]})}},gr=r(712),Sr=r(673),yr=r(674),Cr=r(675),Nr=r(643),kr=r(637),wr=r(32),_r=function(e){var t=e.children,r=e.type,n=e.className,c=e.small,s=void 0!==c&&c;return Object(a.jsx)(kr.a,{className:n,children:Object(a.jsx)("div",{className:P()({"col-md-10 offset-md-1":!s,"col-12":s}),children:Object(a.jsx)(wr.a,{className:P()("text-center",{"bg-main":"success"===r,"bg-danger":"error"===r,"bg-warning":"warning"===r,"text-white":"warning"!==r}),bodyClassName:P()({"p-2":s}),children:t})})})},Ur=function(e){var t,r,n=e.errorData,c=e.fallbackMessage;return Object(a.jsxs)(a.Fragment,{children:[null!==(t=null===n||void 0===n?void 0:n.detail)&&void 0!==t?t:c,(r=n,"INVALID_ARGUMENT"===(null===r||void 0===r?void 0:r.type)&&Object(a.jsxs)("p",{className:"mb-0",children:["Invalid elements: [",n.invalidElements.join(", "),"]"]}))]})},Tr=function(e){var t=e.shortUrl,r=e.toggle,n=e.isOpen,c=e.shortUrlDeletion,s=e.resetDeleteShortUrl,i=e.deleteShortUrl,o=Object(L.useState)(""),l=Object(E.a)(o,2),u=l[0],d=l[1];Object(L.useEffect)((function(){return s}),[]);var j=c.error,b=c.errorData,h=Object(A.a)(s,r),O=Object(Ue.b)((function(){var e=t.shortCode,n=t.domain;i(e,n).then(r).catch(Nr.a)}));return Object(a.jsx)(gr.a,{isOpen:n,toggle:h,centered:!0,children:Object(a.jsxs)("form",{onSubmit:O,children:[Object(a.jsx)(Sr.a,{toggle:h,children:Object(a.jsx)("span",{className:"text-danger",children:"Delete short URL"})}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)("p",{children:[Object(a.jsx)("b",{className:"text-danger",children:"Caution!"})," You are about to delete a short URL."]}),Object(a.jsx)("p",{children:"This action cannot be undone. Once you have deleted it, all the visits stats will be lost."}),Object(a.jsxs)("p",{children:["Write ",Object(a.jsx)("b",{children:t.shortCode})," to confirm deletion."]}),Object(a.jsx)("input",{type:"text",className:"form-control",placeholder:"Insert the short code (".concat(t.shortCode,")"),value:u,onChange:function(e){return d(e.target.value)}}),j&&Object(a.jsx)(_r,{type:ut(b)?"warning":"error",small:!0,className:"mt-2",children:Object(a.jsx)(Ur,{errorData:b,fallbackMessage:"Something went wrong while deleting the URL :("})})]}),Object(a.jsxs)(Cr.a,{children:[Object(a.jsx)("button",{type:"button",className:"btn btn-link",onClick:h,children:"Cancel"}),Object(a.jsx)("button",{type:"submit",className:"btn btn-danger",disabled:u!==t.shortCode||c.loading,children:c.loading?"Deleting...":"Delete"})]})]})})},Rr=r(223),Dr=function(e){return function(t){var r=t.error,n=t.errorData,c=t.result,s=t.resetCreateShortUrl,i=t.canBeClosed,o=void 0!==i&&i,l=e(),u=Object(E.a)(l,2),d=u[0],j=u[1];if(Object(L.useEffect)((function(){s()}),[]),r)return Object(a.jsxs)(_r,{type:"error",className:"mt-3",children:[o&&Object(a.jsx)(F.a,{icon:I.M,className:"float-right pointer",onClick:s}),Object(a.jsx)(Ur,{errorData:n,fallbackMessage:"An error occurred while creating the URL :("})]});if(Object(C.a)(c))return null;var b=c.shortUrl;return Object(a.jsxs)(_r,{type:"success",className:"mt-3",children:[o&&Object(a.jsx)(F.a,{icon:I.M,className:"float-right pointer",onClick:s}),Object(a.jsx)("b",{children:"Great!"})," The short URL is ",Object(a.jsx)("b",{children:b}),Object(a.jsx)(ir.a,{text:b,onCopy:j,children:Object(a.jsxs)("button",{className:"btn btn-light btn-sm create-short-url-result__copy-btn",id:"copyBtn",type:"button",children:[Object(a.jsx)(F.a,{icon:Oe.b})," Copy"]})}),Object(a.jsx)(Rr.a,{placement:"left",isOpen:d,target:"copyBtn",children:"Copied!"})]})}},Er=function(e){return function(t){var r=t.orderByColumn,n=t.renderOrderIcon,c=t.shortUrlsList,s=t.onTagClick,i=t.selectedServer,o=t.className,l=c.error,u=c.loading,d=c.shortUrls,j=P()({"short-urls-table__header-cell--with-action":!!r}),b=P()("short-urls-table__header-cell",j),h=P()("table table-hover",o),O=Object(wt.k)(i);return Object(a.jsxs)("table",{className:h,children:[Object(a.jsx)("thead",{className:"responsive-table__header short-urls-table__header",children:Object(a.jsxs)("tr",{children:[Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("dateCreated"),children:["Created at",null===n||void 0===n?void 0:n("dateCreated")]}),Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("shortCode"),children:["Short URL",null===n||void 0===n?void 0:n("shortCode")]}),!O&&Object(a.jsxs)("th",{className:b,onClick:null===r||void 0===r?void 0:r("longUrl"),children:["Long URL",null===n||void 0===n?void 0:n("longUrl")]})||Object(a.jsxs)("th",{className:"short-urls-table__header-cell",children:[Object(a.jsxs)("span",{className:j,onClick:null===r||void 0===r?void 0:r("title"),children:["Title",null===n||void 0===n?void 0:n("title")]}),"\xa0\xa0/\xa0\xa0",Object(a.jsxs)("span",{className:j,onClick:null===r||void 0===r?void 0:r("longUrl"),children:[Object(a.jsx)("span",{className:"indivisible",children:"Long URL"}),null===n||void 0===n?void 0:n("longUrl")]})]}),Object(a.jsx)("th",{className:"short-urls-table__header-cell",children:"Tags"}),Object(a.jsx)("th",{className:b,onClick:null===r||void 0===r?void 0:r("visits"),children:Object(a.jsxs)("span",{className:"indivisible",children:["Visits",null===n||void 0===n?void 0:n("visits")]})}),Object(a.jsx)("th",{className:"short-urls-table__header-cell",children:"\xa0"})]})}),Object(a.jsx)("tbody",{children:l?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center table-danger",children:"Something went wrong while loading short URLs :("})}):u?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center",children:"Loading..."})}):!u&&Object(N.a)(null===d||void 0===d?void 0:d.data)?Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:6,className:"text-center",children:"No results found"})}):null===d||void 0===d?void 0:d.data.map((function(t){return Object(a.jsx)(e,{shortUrl:t,selectedServer:i,onTagClick:s},t.shortUrl)}))})]})}},Lr=r(676),Vr=r(220),Ir=function(e,t,r){var n=t.size,c=t.format,a=t.margin,s=t.errorCorrection,i=r.useSizeInPath,o=r.svgIsSupported,l=r.marginIsSupported,u=r.errorCorrectionIsSupported,d="".concat(e,"/qr-code").concat(i?"/".concat(n):""),j=function(e){return S.a.stringify(e,{arrayFormat:"brackets"})}({size:i?void 0:n,format:o?c:void 0,margin:l&&a>0?a:void 0,errorCorrection:u?s:void 0});return"".concat(d).concat(Object(N.a)(j)?"":"?".concat(j))},Fr=function(e){var t=e.format,r=e.setFormat;return Object(a.jsxs)(J,{text:"Format (".concat(t,")"),children:[Object(a.jsx)(W.a,{active:"png"===t,onClick:function(){return r("png")},children:"PNG"}),Object(a.jsx)(W.a,{active:"svg"===t,onClick:function(){return r("svg")},children:"SVG"})]})},Ar=function(e){var t=e.errorCorrection,r=e.setErrorCorrection;return Object(a.jsxs)(J,{text:"Error correction (".concat(t,")"),children:[Object(a.jsxs)(W.a,{active:"L"===t,onClick:function(){return r("L")},children:[Object(a.jsx)("b",{children:"L"}),"ow"]}),Object(a.jsxs)(W.a,{active:"M"===t,onClick:function(){return r("M")},children:[Object(a.jsx)("b",{children:"M"}),"edium"]}),Object(a.jsxs)(W.a,{active:"Q"===t,onClick:function(){return r("Q")},children:[Object(a.jsx)("b",{children:"Q"}),"uartile"]}),Object(a.jsxs)(W.a,{active:"H"===t,onClick:function(){return r("H")},children:[Object(a.jsx)("b",{children:"H"}),"igh"]})]})},Mr=function(e,t){return function(r){var n=r.shortUrl,c=n.shortUrl,s=n.shortCode,i=r.toggle,o=r.isOpen,l=r.selectedServer,u=Object(L.useState)(300),d=Object(E.a)(u,2),j=d[0],b=d[1],h=Object(L.useState)(0),O=Object(E.a)(h,2),v=O[0],f=O[1],x=Object(L.useState)("png"),g=Object(E.a)(x,2),S=g[0],y=g[1],C=Object(L.useState)("L"),N=Object(E.a)(C,2),k=N[0],w=N[1],_=Object(L.useMemo)((function(){return{useSizeInPath:!Object(wt.g)(l),svgIsSupported:Object(wt.h)(l),marginIsSupported:Object(wt.f)(l),errorCorrectionIsSupported:Object(wt.i)(l)}}),[l]),U=Object(L.useMemo)((function(){return Ir(c,{size:j,format:S,margin:v,errorCorrection:k},_)}),[c,j,S,v,k,_]),T=Object(L.useMemo)((function(){return j+v}),[j,v]),R=Object(L.useMemo)((function(){if(!(T<500))return T<800?"lg":"xl"}),[T]);return Object(a.jsxs)(gr.a,{isOpen:o,toggle:i,centered:!0,size:R,children:[Object(a.jsxs)(Sr.a,{toggle:i,children:["QR code for ",Object(a.jsx)(ar.a,{href:c,children:c})]}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)(kr.a,{children:[Object(a.jsxs)(Lr.a,{className:P()({"col-md-4":_.marginIsSupported&&_.svgIsSupported&&!_.errorCorrectionIsSupported,"col-md-6":_.errorCorrectionIsSupported||!_.marginIsSupported&&_.svgIsSupported||_.marginIsSupported&&!_.svgIsSupported,"col-12":!_.marginIsSupported&&!_.svgIsSupported&&!_.errorCorrectionIsSupported}),children:[Object(a.jsxs)("label",{className:"mb-0",children:["Size: ",j,"px"]}),Object(a.jsx)("input",{type:"range",className:"form-control-range",value:j,step:10,min:50,max:1e3,onChange:function(e){return b(Number(e.target.value))}})]}),_.marginIsSupported&&Object(a.jsxs)(Lr.a,{className:_.svgIsSupported&&!_.errorCorrectionIsSupported?"col-md-4":"col-md-6",children:[Object(a.jsxs)("label",{className:"mb-0",children:["Margin: ",v,"px"]}),Object(a.jsx)("input",{type:"range",className:"form-control-range",value:v,step:1,min:0,max:100,onChange:function(e){return f(Number(e.target.value))}})]}),_.svgIsSupported&&Object(a.jsx)(Lr.a,{className:_.marginIsSupported&&!_.errorCorrectionIsSupported?"col-md-4":"col-md-6",children:Object(a.jsx)(Fr,{format:S,setFormat:y})}),_.errorCorrectionIsSupported&&Object(a.jsx)(Lr.a,{className:"col-md-6",children:Object(a.jsx)(Ar,{errorCorrection:k,setErrorCorrection:w})})]}),Object(a.jsxs)("div",{className:"text-center",children:[Object(a.jsxs)("div",{className:"mb-3",children:[Object(a.jsx)(ar.a,{href:U}),Object(a.jsx)(or,{text:U})]}),Object(a.jsx)("img",{src:U,className:"qr-code-modal__img",alt:"QR code"}),Object(a.jsx)(t,{minVersion:"2.9.0",children:Object(a.jsx)("div",{className:"mt-3",children:Object(a.jsxs)(Vr.a,{block:!0,color:"primary",onClick:Object(p.a)(m.a.mark((function t(){return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.saveImage(U,"".concat(s,"-qr-code.").concat(S)));case 1:case"end":return t.stop()}}),t)}))),children:["Download ",Object(a.jsx)(F.a,{icon:I.q,className:"ml-1"})]})})})]})]})]})}},Gr=r(679),Pr=r(677),Br=r(678),Hr=r(707),Wr=function(e){var t=e.checked,r=void 0!==t&&t,n=e.onChange,c=void 0===n?Nr.a:n,s=e.className,i=e.children,o=e.type,l=e.inline,u=void 0!==l&&l,d=Object(L.useRef)(Object(Hr.a)()).current,j={"custom-switch":"switch"===o,"custom-checkbox":"checkbox"===o},b=u?{display:"inline-block"}:{};return Object(a.jsxs)("span",{className:P()("custom-control",j,s),style:b,children:[Object(a.jsx)("input",{type:"checkbox",className:"custom-control-input",id:d,checked:r,onChange:function(e){return c(e.target.checked,e)}}),Object(a.jsx)("label",{className:"custom-control-label",htmlFor:d,children:i})]})},qr=function(e){return Object(a.jsx)(Wr,Object(d.a)({type:"checkbox"},e))},zr=function(e){var t=e.isOpen,r=e.toggle;return Object(a.jsxs)(gr.a,{isOpen:t,toggle:r,centered:!0,size:"lg",children:[Object(a.jsx)(Sr.a,{toggle:r,children:"Info"}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)("p",{children:["When the\xa0",Object(a.jsx)("b",{children:Object(a.jsx)("i",{children:'"Use existing URL if found"'})}),"\xa0checkbox is checked, the server will return an existing short URL if it matches provided params."]}),Object(a.jsx)("p",{children:"These are the checks performed by Shlink in order to determine if an existing short URL should be returned:"}),Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:"When only the long URL is provided: The most recent match will be returned, or a new short URL will be created if none is found."}),Object(a.jsxs)("li",{children:["When long URL and custom slug and/or domain are provided: Same as in previous case, but it will try to match the short URL using both the long URL and the slug, the long URL and the domain, or the three of them.",Object(a.jsx)("br",{}),"If the slug is being used by another long URL, an error will be returned."]}),Object(a.jsx)("li",{children:"When other params are provided: Same as in previous cases, but it will try to match existing short URLs with all provided data. If any of them does not match, a new short URL will be created"})]})]})]})},Kr=function(){var e=Object(Q.c)(),t=Object(E.a)(e,2),r=t[0],n=t[1];return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("span",{title:"What does this mean?",children:Object(a.jsx)(F.a,{icon:I.t,style:{cursor:"pointer"},onClick:n})}),Object(a.jsx)(zr,{isOpen:r,toggle:n})]})},Qr=function(e){var t=e.className,r=void 0===t?"":t,n=e.placement,c=e.children,s=Object(L.useRef)();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("span",{className:r,ref:function(e){s.current=e},children:Object(a.jsx)(F.a,{icon:I.t})}),Object(a.jsx)(jr.a,{target:function(){return s.current},placement:n,children:c})]})},Jr=function(e){var t=e.children,r=e.infoTooltip,n=e.checked,c=e.onChange;return Object(a.jsxs)("p",{children:[Object(a.jsx)(qr,{inline:!0,checked:n,className:r?"mr-2":"",onChange:c,children:t}),r&&Object(a.jsx)(Qr,{placement:"right",children:r})]})},Zr=Object(A.a)(Pr.a,Object(Br.a)(/ /g,"-")),Yr=function(e){return"string"===typeof e?Object(M.default)(e):e},Xr=function(e,t){return function(r){var n,c=r.mode,s=r.saving,i=r.onSave,o=r.initialState,l=r.selectedServer,j=Object(L.useState)(o),b=Object(E.a)(j,2),h=b[0],O=b[1],v="edit"===c,f=Object(Ue.b)(Object(p.a)(m.a.mark((function e(){var t,r;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(d.a)(Object(d.a)({},h),{},{validSince:null!==(t=ce(h.validSince))&&void 0!==t?t:null,validUntil:null!==(r=ce(h.validUntil))&&void 0!==r?r:null,maxVisits:Object(Ue.c)(h.maxVisits)?Number(h.maxVisits):null,title:Object(Ue.c)(h.title)?h.title:void 0})).then((function(){return!v&&O(o)})).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));Object(L.useEffect)((function(){O(o)}),[o]);var x=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]:{};return Object(a.jsx)(Lr.a,{children:Object(a.jsx)(Gr.a,Object(d.a)({id:e,type:n,placeholder:t,value:null!==(r=h[e])&&void 0!==r?r:"",onChange:function(t){return O(Object(d.a)(Object(d.a)({},h),{},Object(u.a)({},e,t.target.value)))}},c))})},g=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object(a.jsx)("div",{className:"form-group",children:Object(a.jsx)(ve,Object(d.a)({selected:h[e]?Yr(h[e]):null,placeholderText:t,isClearable:!0,onChange:function(t){return O(Object(d.a)(Object(d.a)({},h),{},Object(u.a)({},e,t)))}},r))})},S=Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Lr.a,{children:Object(a.jsx)(Gr.a,{bsSize:"lg",type:"url",placeholder:"URL to be shortened",required:!0,value:h.longUrl,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{longUrl:e.target.value}))}})}),Object(a.jsx)(Lr.a,{children:Object(a.jsx)(e,{selectedTags:null!==(n=h.tags)&&void 0!==n?n:[],onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{tags:e.map(Zr)}))}})})]}),y=Object(wt.d)(l),C=!Object(wt.j)(l),k=Object(wt.k)(l),w=k||!v,_=P()("mb-3",{"col-sm-6":w,"col-sm-12":!w}),U=Object(wt.n)(l),T=Object(wt.b)(l),R=U||T||!v;return Object(a.jsxs)("form",{className:"short-url-form",onSubmit:f,children:["create-basic"===c&&S,"create-basic"!==c&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(wr.a,{title:"Basic options",className:"mb-3",children:S}),Object(a.jsxs)(kr.a,{children:[w&&Object(a.jsx)("div",{className:"col-sm-6 mb-3",children:Object(a.jsxs)(wr.a,{title:"Customize the short URL",children:[k&&x("title","Title"),!v&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)(kr.a,{children:[Object(a.jsx)("div",{className:"col-lg-6",children:x("customSlug","Custom slug","text",{disabled:Object(Ue.c)(h.shortCodeLength)})}),Object(a.jsx)("div",{className:"col-lg-6",children:x("shortCodeLength","Short code length","number",Object(d.a)({min:4,disabled:C||Object(Ue.c)(h.customSlug)},C&&{title:"Shlink 2.1.0 or higher is required to be able to provide the short code length"}))})]}),!y&&x("domain","Domain","text"),y&&Object(a.jsx)(Lr.a,{children:Object(a.jsx)(t,{value:h.domain,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{domain:e}))}})})]})]})}),Object(a.jsx)("div",{className:_,children:Object(a.jsxs)(wr.a,{title:"Limit access to the short URL",children:[x("maxVisits","Maximum number of visits allowed","number",{min:1}),g("validSince","Enabled since...",{maxDate:h.validUntil?Yr(h.validUntil):void 0}),g("validUntil","Enabled until...",{minDate:h.validSince?Yr(h.validSince):void 0})]})})]}),R&&Object(a.jsxs)(wr.a,{title:"Extra checks",className:"mb-3",children:[U&&Object(a.jsx)(Jr,{infoTooltip:"If checked, Shlink will try to reach the long URL, failing in case it's not publicly accessible.",checked:h.validateUrl,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{validateUrl:e}))},children:"Validate URL"}),T&&Object(a.jsx)(Jr,{infoTooltip:"This short URL will be included in the robots.txt for your Shlink instance, allowing web crawlers (like Google) to index it.",checked:h.crawlable,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{crawlable:e}))},children:"Make it crawlable"}),!v&&Object(a.jsxs)("p",{children:[Object(a.jsx)(qr,{inline:!0,className:"mr-2",checked:h.findIfExists,onChange:function(e){return O(Object(d.a)(Object(d.a)({},h),{},{findIfExists:e}))},children:"Use existing URL if found"}),Object(a.jsx)(Kr,{})]})]})]}),Object(a.jsx)("div",{className:"text-center",children:Object(a.jsx)(Vr.a,{outline:!0,color:"primary",disabled:s||Object(N.a)(h.longUrl),className:"btn-xs-block",children:s?"Saving...":"Save"})})]})}},$r=r(48),en=function(e){return function(t){var r,n=t.history.goBack,c=t.match.params,s=t.location.search,i=t.settings.shortUrlCreation,o=t.selectedServer,l=t.shortUrlDetail,u=t.getShortUrlDetail,d=t.shortUrlEdition,j=t.editShortUrl,b=l.loading,h=l.error,O=l.errorData,v=l.shortUrl,f=d.saving,x=d.error,g=d.errorData,S=Ee(s).domain,y=Object(L.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,validateUrl:o}:{longUrl:"",validateUrl:o}}(v,i)}),[v,i]),C=Object(Q.c)(),N=Object(E.a)(C,4),k=N[0],w=N[2],_=N[3];return Object(L.useEffect)((function(){u(c.shortCode,S)}),[]),b?Object(a.jsx)($r.a,{loading:!0}):h?Object(a.jsx)(_r,{type:"error",children:Object(a.jsx)(Ur,{errorData:O,fallbackMessage:"An error occurred while loading short URL detail :("})}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("header",{className:"mb-3",children:Object(a.jsx)(ke.a,{body:!0,children:Object(a.jsxs)("h2",{className:"d-sm-flex justify-content-between align-items-center mb-0",children:[Object(a.jsx)(Vr.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:n,children:Object(a.jsx)(F.a,{icon:I.a})}),Object(a.jsx)("span",{className:"text-center",children:Object(a.jsxs)("small",{children:["Edit ",Object(a.jsx)(ar.a,{href:null!==(r=null===v||void 0===v?void 0:v.shortUrl)&&void 0!==r?r:""})]})}),Object(a.jsx)("span",{})]})})}),Object(a.jsx)(e,{initialState:y,saving:f,selectedServer:o,mode:"edit",onSave:function(){var e=Object(p.a)(m.a.mark((function e(t){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v){e.next=2;break}return e.abrupt("return");case 2:_(),j(v.shortCode,v.domain,t).then(w).catch(_);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),x&&Object(a.jsx)(_r,{type:"error",className:"mt-3",children:Object(a.jsx)(Ur,{errorData:g,fallbackMessage:"An error occurred while updating short URL :("})}),k&&Object(a.jsx)(_r,{type:"success",className:"mt-3",children:"Short URL properly edited."})]})}},tn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_START",rn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL_ERROR",nn="shlink/shortUrlDetail/GET_SHORT_URL_DETAIL",cn={loading:!1,error:!1},an=et((Ge={},Object(u.a)(Ge,tn,(function(){return{loading:!0,error:!1}})),Object(u.a)(Ge,rn,(function(e,t){return{loading:!1,error:!0,errorData:t.errorData}})),Object(u.a)(Ge,nn,(function(e,t){var r=t.shortUrl;return Object(d.a)({shortUrl:r},cn)})),Ge),cn),sn=function(e){return function(t,r){return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o,l,u;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c({type:tn}),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 st(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:nn}),n.next=17;break;case 14:n.prev=14,n.t1=n.catch(1),c({type:rn,errorData:lt(n.t1)});case 17:case"end":return n.stop()}}),n,null,[[1,14]])})));return function(e,t){return n.apply(this,arguments)}}()}},on=function(e,t){e.serviceFactory("ShortUrls",V,"SearchBar","ShortUrlsList"),e.decorator("ShortUrls",t(["shortUrlsList"])),e.serviceFactory("ShortUrlsList",cr,"ShortUrlsTable"),e.decorator("ShortUrlsList",t(["selectedServer","shortUrlsListParams","mercureInfo"],["listShortUrls","resetShortUrlParams","createNewVisits","loadMercureInfo"])),e.serviceFactory("ShortUrlsTable",Er,"ShortUrlsRow"),e.serviceFactory("ShortUrlsRow",fr,"ShortUrlsRowMenu","ColorGenerator","useStateFlagTimeout"),e.serviceFactory("ShortUrlsRowMenu",pr,"DeleteShortUrlModal","QrCodeModal"),e.serviceFactory("CreateShortUrlResult",Dr,"useStateFlagTimeout"),e.serviceFactory("ShortUrlForm",Xr,"TagsSelector","DomainSelector"),e.serviceFactory("CreateShortUrl",xr,"ShortUrlForm","CreateShortUrlResult"),e.decorator("CreateShortUrl",t(["shortUrlCreationResult","selectedServer","settings"],["createShortUrl","resetCreateShortUrl"])),e.serviceFactory("EditShortUrl",en,"ShortUrlForm"),e.decorator("EditShortUrl",t(["shortUrlDetail","shortUrlEdition","selectedServer","settings"],["getShortUrlDetail","editShortUrl"])),e.serviceFactory("DeleteShortUrlModal",(function(){return Tr})),e.decorator("DeleteShortUrlModal",t(["shortUrlDeletion"],["deleteShortUrl","resetDeleteShortUrl"])),e.serviceFactory("QrCodeModal",Mr,"ImageDownloader","ForServerVersion"),e.decorator("QrCodeModal",t(["selectedServer"])),e.serviceFactory("SearchBar",ge,"ColorGenerator"),e.decorator("SearchBar",t(["shortUrlsListParams"],["listShortUrls"])),e.serviceFactory("listShortUrls",Ft,"buildShlinkApiClient"),e.serviceFactory("resetShortUrlParams",(function(){return Bt})),e.serviceFactory("createShortUrl",Nt,"buildShlinkApiClient"),e.serviceFactory("resetCreateShortUrl",(function(){return kt})),e.serviceFactory("deleteShortUrl",ft,"buildShlinkApiClient"),e.serviceFactory("resetDeleteShortUrl",(function(){return mt})),e.serviceFactory("getShortUrlDetail",sn,"buildShlinkApiClient"),e.serviceFactory("editShortUrl",Dt,"buildShlinkApiClient")},ln=r(304),un=r.n(ln),dn=r(61),jn=function(e){var t=e.children,r=e.value,n=e.onChange,c=e.id,s=e.type,i=e.required,o=e.placeholder,l=e.className,u=e.labelClassName,d=Object(L.useRef)(null!==c&&void 0!==c?c:Object(Hr.a)());return Object(a.jsxs)("div",{className:"form-group ".concat(null!==l&&void 0!==l?l:""),children:[Object(a.jsxs)("label",{htmlFor:d.current,className:null!==u&&void 0!==u?u:"",children:[t,":"]}),Object(a.jsx)("input",{className:"form-control",type:null!==s&&void 0!==s?s:"text",id:d.current,value:r,required:null===i||void 0===i||i,placeholder:o,onChange:function(e){return n(e.target.value)}})]})},bn=function(e){return Object(a.jsx)(jn,Object(d.a)(Object(d.a)({},e),{},{labelClassName:"create-server__label"}))},hn=function(e){var t=e.onSubmit,r=e.initialValues,n=e.children,c=e.title,s=Object(L.useState)(""),i=Object(E.a)(s,2),o=i[0],l=i[1],u=Object(L.useState)(""),d=Object(E.a)(u,2),j=d[0],b=d[1],h=Object(L.useState)(""),O=Object(E.a)(h,2),v=O[0],f=O[1],m=Object(Ue.b)((function(){return t({name:o,url:j,apiKey:v})}));return Object(L.useEffect)((function(){r&&l(r.name),r&&b(r.url),r&&f(r.apiKey)}),[r]),Object(a.jsxs)("form",{className:"server-form",onSubmit:m,children:[Object(a.jsxs)(wr.a,{className:"mb-3",title:c,children:[Object(a.jsx)(bn,{value:o,onChange:l,children:"Name"}),Object(a.jsx)(bn,{type:"url",value:j,onChange:b,children:"URL"}),Object(a.jsx)(bn,{value:v,onChange:f,children:"APIkey"})]}),Object(a.jsx)("div",{className:"text-right",children:n})]})},On=function(e){var t=e.type;return Object(a.jsxs)(_r,{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."]})},vn=function(e,t){return function(r){var n=r.createServer,c=r.history.push,s=t(!1,4e3),i=Object(E.a)(s,2),o=i[0],l=i[1],u=t(!1,4e3),j=Object(E.a)(u,2),b=j[0],h=j[1];return Object(a.jsxs)(dn.a,{children:[Object(a.jsxs)(hn,{title:Object(a.jsx)("h5",{className:"mb-0",children:"Add new server"}),onSubmit:function(e){var t=Object(Hr.a)();n(Object(d.a)(Object(d.a)({},e),{},{id:t})),c("/server/".concat(t))},children:[Object(a.jsx)(e,{onImport:l,onImportError:h}),Object(a.jsx)("button",{className:"btn btn-outline-primary",children:"Create server"})]}),(o||b)&&Object(a.jsxs)("div",{className:"mt-3",children:[o&&Object(a.jsx)(On,{type:"success"}),b&&Object(a.jsx)(On,{type:"error"})]})]})}},fn=function(e){return function(t){var r=t.servers,n=t.selectedServer,c=Object(Ne.a)(r),s=Object(a.jsxs)(W.a,{tag:o.b,to:"/server/create",children:[Object(a.jsx)(F.a,{icon:I.C})," ",Object(a.jsx)("span",{className:"ml-1",children:"Add a server"})]});return Object(a.jsxs)(we.a,{nav:!0,inNavbar:!0,children:[Object(a.jsxs)(z.a,{nav:!0,caret:!0,children:[Object(a.jsx)(F.a,{icon:I.G})," ",Object(a.jsx)("span",{className:"ml-1",children:"Servers"})]}),Object(a.jsx)(K.a,{right:!0,children:Object(N.a)(c)?s:Object(a.jsxs)(a.Fragment,{children:[c.map((function(e){var t=e.name,r=e.id;return Object(a.jsx)(W.a,{tag:o.b,to:"/server/".concat(r),active:Object(v.d)(n)&&n.id===r,children:t},r)})),Object(a.jsx)(W.a,{divider:!0}),s,Object(a.jsxs)(W.a,{className:"servers-dropdown__export-item",onClick:Object(p.a)(m.a.mark((function t(){return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.exportServers());case 1:case"end":return t.stop()}}),t)}))),children:[Object(a.jsx)(F.a,{icon:I.q})," ",Object(a.jsx)("span",{className:"ml-1",children:"Export servers"})]})]})})]})}},mn=function(e){var t=e.server,r=e.toggle,n=e.isOpen,c=e.deleteServer,s=e.history;return Object(a.jsxs)(gr.a,{isOpen:n,toggle:r,centered:!0,children:[Object(a.jsx)(Sr.a,{toggle:r,children:Object(a.jsx)("span",{className:"text-danger",children:"Remove server"})}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)("p",{children:["Are you sure you want to remove ",Object(a.jsx)("b",{children:t?t.name:""}),"?"]}),Object(a.jsx)("p",{children:Object(a.jsx)("i",{children:"No data will be deleted, only the access to this server will be removed from this device. You can create it again at any moment."})})]}),Object(a.jsxs)(Cr.a,{children:[Object(a.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(a.jsx)("button",{className:"btn btn-danger",onClick:function(){return c(t),r(),void s.push("/")},children:"Delete"})]})]})},pn=function(e){return function(t){var r=t.server,n=t.className,c=t.children,s=t.textClassName,i=Object(Q.c)(),o=Object(E.a)(i,4),l=o[0],u=o[2],d=o[3];return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)("span",{className:n,onClick:u,children:[!c&&Object(a.jsx)(F.a,{icon:I.x}),Object(a.jsx)("span",{className:s,children:null!==c&&void 0!==c?c:"Remove this server"})]}),Object(a.jsx)(e,{server:r,isOpen:l,toggle:d})]})}},xn=r(150),gn=function(e){return Object(xn.a)((function(e){var t=e.editServer,r=e.selectedServer,n=e.history,c=n.push,s=n.goBack;if(!Object(v.d)(r))return null;return Object(a.jsx)(dn.a,{children:Object(a.jsxs)(hn,{title:Object(a.jsxs)("h5",{className:"mb-0",children:['Edit "',r.name,'"']}),initialValues:r,onSubmit:function(e){t(r.id,e),c("/server/".concat(r.id))},children:[Object(a.jsx)(Vr.a,{outline:!0,className:"mr-2",onClick:s,children:"Cancel"}),Object(a.jsx)(Vr.a,{outline:!0,color:"primary",children:"Save"})]})})}),e)},Sn=function(e){var t=e.importServersFromFile;return function(e){var r=e.createServers,n=e.fileRef,c=e.onImport,s=void 0===c?function(){}:c,i=e.onImportError,o=void 0===i?function(){}:i,l=null!==n&&void 0!==n?n:Object(L.useRef)(),u=function(){var e=Object(p.a)(m.a.mark((function e(n){var c,a;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.target,e.abrupt("return",t(null===(c=a.files)||void 0===c?void 0:c[0]).then(r).then(s).then((function(){a.value=null})).catch(o));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("button",{type:"button",className:"btn btn-outline-secondary mr-2",id:"importBtn",onClick:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.click()},children:"Import from file"}),Object(a.jsxs)(jr.a,{placement:"top",target:"importBtn",children:["You can create servers by importing a CSV file with columns ",Object(a.jsx)("b",{children:"name"}),", ",Object(a.jsx)("b",{children:"apiKey"})," and ",Object(a.jsx)("b",{children:"url"}),"."]}),Object(a.jsx)("input",{type:"file",accept:"text/csv",className:"create-server__csv-select",ref:l,onChange:u})]})}},yn=r(638),Cn=r(62),Nn="shlink/selectedServer/SELECT_SERVER",kn="shlink/selectedServer/RESET_SELECTED_SERVER",wn=Object(A.a)((function(e){return"latest"===e?"999.999.999":e}),Object(Cn.c)("1.0.0")),_n=Object(yn.a)(Nr.a,function(){var e=Object(p.a)(m.a.mark((function e(t,r){return m.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:wn(t),printableVersion:Object(Cn.b)(t)}})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),Un=et((Pe={},Object(u.a)(Pe,kn,(function(){return null})),Object(u.a)(Pe,Nn,(function(e,t){return t.selectedServer})),Pe),null),Tn=tt(kn),Rn=function(e,t){return function(r){return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o,l,u,j,b,h;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c(Tn()),c(Bt()),s=a(),i=s.servers,o=i[r]){n.next=7;break}return c({type:Nn,selectedServer:{serverNotFound:!0}}),n.abrupt("return");case 7:return n.prev=7,l=e(o),u=l.health,n.next=11,_n(r,u);case 11:j=n.sent,b=j.version,h=j.printableVersion,c({type:Nn,selectedServer:Object(d.a)(Object(d.a)({},o),{},{version:b,printableVersion:h})}),c(t()),n.next=21;break;case 18:n.prev=18,n.t0=n.catch(7),c({type:Nn,selectedServer:Object(d.a)(Object(d.a)({},o),{},{serverNotReachable:!0})});case 21:case"end":return n.stop()}}),n,null,[[7,18]])})));return function(e,t){return n.apply(this,arguments)}}()}},Dn=r(680),En=r(151),Ln=r(329),Vn="shlink/servers/EDIT_SERVER",In="shlink/servers/DELETE_SERVER",Fn="shlink/servers/CREATE_SERVERS",An=et((Be={},Object(u.a)(Be,Fn,(function(e,t){var r=t.newServers;return Object(d.a)(Object(d.a)({},e),r)})),Object(u.a)(Be,In,(function(e,t){var r=t.serverId;return Object(Dn.a)(r,e)})),Object(u.a)(Be,Vn,(function(e,t){var r=t.serverId,n=t.serverData;return e[r]?Object(ct.a)(r,Object(d.a)(Object(d.a)({},e[r]),n),e):e})),Be),{}),Mn=Object(En.a)((function(e,t){return Object(ct.a)(t.id,t,e)}),{}),Gn=Object(A.a)(Object(Ln.a)((function(e){return e.id?e:Object(ct.a)("id",Object(Hr.a)(),e)})),Mn,(function(e){return{type:Fn,newServers:e}})),Pn=function(e){return Gn([e])},Bn=function(e,t){return{type:Vn,serverId:e,serverData:t}},Hn=function(e){var t=e.id;return{type:In,serverId:t}},Wn=Object(A.a)(Object(O.a)("data"),(function(e){if(!Array.isArray(e))throw new Error("Value is not an array");return e})),qn=function(e){var t=e.get;return function(){return function(){var e=Object(p.a)(m.a.mark((function e(r){var n;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t("".concat(l.a,"/servers.json")).then(Wn).catch((function(){return[]}));case 2:n=e.sent,r(Gn(n));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}},zn=function(e){var t=e.minVersion,r=e.maxVersion,n=e.selectedServer,c=e.children;if(!Object(v.c)(n))return null;var s=n.version;return Object(Cn.a)(s,{maxVersion:r,minVersion:t})?Object(a.jsx)(a.Fragment,{children:c}):null},Kn=r(165),Qn=function(e){return function(t){var r=t.servers,n=t.selectedServer;return Object(a.jsx)(dn.a,{children:Object(a.jsxs)("div",{className:"server-error__container flex-column",children:[Object(a.jsxs)($r.a,{className:"w-100 mb-3 mb-md-5",type:"error",fullWidth:!0,children:[!Object(v.d)(n)&&"Could not find this Shlink server.",Object(v.d)(n)&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("p",{children:"Oops! Could not connect to this Shlink server."}),"Make sure you have internet connection, and the server is properly configured and on-line."]})]}),Object(a.jsxs)(Kn.a,{servers:Object.values(r),children:["These are the Shlink servers currently configured. Choose one of them or ",Object(a.jsx)(o.b,{to:"/server/create",children:"add a new one"}),"."]}),Object(v.d)(n)&&Object(a.jsx)("div",{className:"container mt-3 mt-md-5",children:Object(a.jsxs)("h5",{children:["Alternatively, if you think you may have miss-configured this server, you can ",Object(a.jsx)(e,{server:n,className:"server-error__delete-btn",children:"remove it"})," or\xa0",Object(a.jsx)(o.b,{to:"/server/".concat(n.id,"/edit"),children:"edit it"}),"."]})})]})})}},Jn=r(97),Zn=r(681),Yn=r(682),Xn=r(639),$n=r(640),ec=function(e,t,r){return De((function(n){var c,s=n.shortUrlsList,i=n.listShortUrls,l=n.listTags,u=n.tagsList,d=n.selectedServer,j=n.loadVisitsOverview,h=n.visitsOverview,O=s.loading,f=s.shortUrls,m=u.loading,p=h.loading,x=h.visitsCount,g=h.orphanVisitsCount,S=Object(v.d)(d)?d.id:"",y=Object(b.g)();return Object(L.useEffect)((function(){i({itemsPerPage:5,orderBy:{dateCreated:"DESC"}}),l(),j()}),[]),Object(a.jsxs)(a.Fragment,{children:[Object(a.jsxs)(kr.a,{children:[Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:Object(a.jsxs)(ke.a,{className:"overview__card mb-3",body:!0,children:[Object(a.jsx)(Zn.a,{tag:"h5",className:"overview__card-title",children:"Visits"}),Object(a.jsxs)(Yn.a,{tag:"h2",children:[Object(a.jsx)(r,{minVersion:"2.2.0",children:p?"Loading...":Yt(x)}),Object(a.jsx)(r,{maxVersion:"2.1.*",children:Object(a.jsx)("small",{className:"text-muted",children:Object(a.jsx)("i",{children:"Shlink 2.2 is needed"})})})]})]})}),Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:Object(a.jsxs)(ke.a,{className:"overview__card mb-3",body:!0,tag:o.b,to:"/server/".concat(S,"/orphan-visits"),children:[Object(a.jsx)(Zn.a,{tag:"h5",className:"overview__card-title",children:"Orphan visits"}),Object(a.jsxs)(Yn.a,{tag:"h2",children:[Object(a.jsx)(r,{minVersion:"2.6.0",children:p?"Loading...":Yt(null!==g&&void 0!==g?g:0)}),Object(a.jsx)(r,{maxVersion:"2.5.*",children:Object(a.jsx)("small",{className:"text-muted",children:Object(a.jsx)("i",{children:"Shlink 2.6 is needed"})})})]})]})}),Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:Object(a.jsxs)(ke.a,{className:"overview__card mb-3",body:!0,tag:o.b,to:"/server/".concat(S,"/list-short-urls/1"),children:[Object(a.jsx)(Zn.a,{tag:"h5",className:"overview__card-title",children:"Short URLs"}),Object(a.jsx)(Yn.a,{tag:"h2",children:O?"Loading...":Yt(null!==(c=null===f||void 0===f?void 0:f.pagination.totalItems)&&void 0!==c?c:0)})]})}),Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:Object(a.jsxs)(ke.a,{className:"overview__card mb-3",body:!0,tag:o.b,to:"/server/".concat(S,"/manage-tags"),children:[Object(a.jsx)(Zn.a,{tag:"h5",className:"overview__card-title",children:"Tags"}),Object(a.jsx)(Yn.a,{tag:"h2",children:m?"Loading...":Yt(u.tags.length)})]})})]}),Object(a.jsxs)(ke.a,{className:"mb-3",children:[Object(a.jsxs)(Xn.a,{children:[Object(a.jsx)("span",{className:"d-sm-none",children:"Create a short URL"}),Object(a.jsx)("h5",{className:"d-none d-sm-inline",children:"Create a short URL"}),Object(a.jsx)(o.b,{className:"float-right",to:"/server/".concat(S,"/create-short-url"),children:"Advanced options \xbb"})]}),Object(a.jsx)($n.a,{children:Object(a.jsx)(t,{basicMode:!0})})]}),Object(a.jsxs)(ke.a,{children:[Object(a.jsxs)(Xn.a,{children:[Object(a.jsx)("span",{className:"d-sm-none",children:"Recently created URLs"}),Object(a.jsx)("h5",{className:"d-none d-sm-inline",children:"Recently created URLs"}),Object(a.jsx)(o.b,{className:"float-right",to:"/server/".concat(S,"/list-short-urls/1"),children:"See all \xbb"})]}),Object(a.jsx)($n.a,{children:Object(a.jsx)(e,{shortUrlsList:s,selectedServer:d,className:"mb-0",onTagClick:function(e){return y.push("/server/".concat(S,"/list-short-urls/1?tag=").concat(e))}})})]})]})}),(function(){return[Le.visits,Le.orphanVisits]}))},tc=["text/csv","text/comma-separated-values","application/csv"],rc=function(e){return!!e&&tc.includes(e.type)},nc=function e(t,r){var n=this;Object(x.a)(this,e),this.csvjson=t,this.fileReaderFactory=r,this.importServersFromFile=function(){var e=Object(p.a)(m.a.mark((function e(t){var r;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rc(t)){e.next=2;break}throw new Error("No file provided or file is not a CSV");case 2:return r=n.fileReaderFactory(),e.abrupt("return",new Promise((function(e){r.addEventListener("loadend",(function(t){var r,c,a,s=null!==(r=null===(c=t.target)||void 0===c||null===(a=c.result)||void 0===a?void 0:a.toString())&&void 0!==r?r:"",i=n.csvjson.toObject(s);e(i)})),r.readAsText(t)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},cc=r(98),ac=function e(t,r,n){var c=this;Object(x.a)(this,e),this.storage=t,this.window=r,this.csvjson=n,this.exportServers=Object(p.a)(m.a.mark((function e(){var t,r,n;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Object(Ne.a)(null!==(t=c.storage.get("servers"))&&void 0!==t?t:{}).map(Object(Dn.a)("id"));try{n=c.csvjson.toCSV(r,{headers:"key"}),Object(cc.a)(c.window,n,"shlink-servers.csv")}catch(a){console.error(a)}case 2:case"end":return e.stop()}}),e)})))},sc=function(e,t,r){e.serviceFactory("CreateServer",vn,"ImportServersBtn","useStateFlagTimeout"),e.decorator("CreateServer",Jn.a),e.decorator("CreateServer",t(["selectedServer"],["createServer","resetSelectedServer"])),e.serviceFactory("EditServer",gn,"ServerError"),e.decorator("EditServer",t(["selectedServer"],["editServer","selectServer"])),e.serviceFactory("ServersDropdown",fn,"ServersExporter"),e.decorator("ServersDropdown",t(["servers","selectedServer"])),e.serviceFactory("DeleteServerModal",(function(){return mn})),e.decorator("DeleteServerModal",r),e.decorator("DeleteServerModal",t(null,["deleteServer"])),e.serviceFactory("DeleteServerButton",pn,"DeleteServerModal"),e.serviceFactory("ImportServersBtn",Sn,"ServersImporter"),e.decorator("ImportServersBtn",t(null,["createServers"])),e.serviceFactory("ForServerVersion",(function(){return zn})),e.decorator("ForServerVersion",t(["selectedServer"])),e.serviceFactory("ServerError",Qn,"DeleteServerButton"),e.decorator("ServerError",t(["servers","selectedServer"])),e.serviceFactory("Overview",ec,"ShortUrlsTable","CreateShortUrl","ForServerVersion"),e.decorator("Overview",t(["shortUrlsList","tagsList","selectedServer","mercureInfo","visitsOverview"],["listShortUrls","listTags","createNewVisits","loadMercureInfo","loadVisitsOverview"])),e.constant("csvjson",un.a),e.constant("fileReaderFactory",(function(){return new FileReader})),e.service("ServersImporter",nc,"csvjson","fileReaderFactory"),e.service("ServersExporter",ac,"Storage","window","csvjson"),e.serviceFactory("selectServer",Rn,"buildShlinkApiClient","loadMercureInfo"),e.serviceFactory("createServer",(function(){return Pn})),e.serviceFactory("createServers",(function(){return Gn})),e.serviceFactory("deleteServer",(function(){return Hn})),e.serviceFactory("editServer",(function(){return Bn})),e.serviceFactory("fetchServers",qn,"axios"),e.serviceFactory("resetSelectedServer",(function(){return Tn}))},ic=function(e){var t=e.visits,r=e.goBack,n=e.shortUrl,c=e.children,s=e.title;return Object(a.jsx)("header",{children:Object(a.jsxs)(ke.a,{body:!0,children:[Object(a.jsxs)("h2",{className:"d-flex justify-content-between align-items-center mb-0",children:[Object(a.jsx)(Vr.a,{color:"link",size:"lg",className:"p-0 mr-3",onClick:r,children:Object(a.jsx)(F.a,{icon:I.a})}),Object(a.jsx)("span",{className:"text-center d-none d-sm-block",children:Object(a.jsx)("small",{children:s})}),Object(a.jsxs)("span",{className:"badge badge-main ml-3",children:["Visits:"," ",Object(a.jsx)(vr,{visitsCount:t.length,shortUrl:n})]})]}),Object(a.jsx)("h3",{className:"text-center d-block d-sm-none mb-0 mt-3",children:Object(a.jsx)("small",{children:s})}),c&&Object(a.jsx)("div",{className:"mt-md-2",children:c})]})})},oc=function(e){var t,r,n=e.shortUrlDetail,c=e.shortUrlVisits,s=e.goBack,i=n.shortUrl,o=n.loading,l=c.visits,u=null!==(t=null===i||void 0===i?void 0:i.shortUrl)&&void 0!==t?t:"",d=null!==(r=null===i||void 0===i?void 0:i.longUrl)&&void 0!==r?r:"",j=null===i||void 0===i?void 0:i.title,b=Object(a.jsxs)(a.Fragment,{children:["Visits for ",Object(a.jsx)(ar.a,{href:u})]});return Object(a.jsxs)(ic,{title:b,goBack:s,visits:l,shortUrl:i,children:[Object(a.jsx)("hr",{}),Object(a.jsxs)("div",{children:["Created: ",i?Object(a.jsxs)("span",{children:[Object(a.jsx)("b",{id:"created",className:"short-url-visits-header__created-at",children:Object(a.jsx)(dr,{date:i.dateCreated,relative:!0})}),Object(a.jsx)(jr.a,{placement:"bottom",target:"created",children:Object(a.jsx)(dr,{date:i.dateCreated})})]}):Object(a.jsx)("small",{children:"Loading..."})]}),Object(a.jsxs)("div",{children:["".concat(j?"Title":"Long URL",": "),o&&Object(a.jsx)("small",{children:"Loading..."}),!o&&Object(a.jsx)(ar.a,{href:d,children:null!==j&&void 0!==j?j:d})]})]})},lc=r(700),uc=r(652),dc=r(701),jc=r(650),bc=r(122),hc=r(706),Oc=r(685),vc=r(686),fc=r(683),mc=r(687),pc=r(688),xc=function(e){var t=e.toggleClassName,r=e.ranges,n=e.value,c=e.setValue;return Object(a.jsxs)(we.a,{children:[Object(a.jsx)(z.a,{caret:!0,color:"link",className:t,children:"Paginate"}),Object(a.jsxs)(K.a,{right:!0,children:[r.map((function(e){return Object(a.jsxs)(W.a,{active:e===n,onClick:function(){return c(e)},children:[Object(a.jsx)("b",{children:e})," items per page"]},e)})),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(W.a,{disabled:n===1/0,onClick:function(){return c(1/0)},children:Object(a.jsx)("i",{children:"Clear pagination"})})]})]})},gc=function(e){var t=e.pagesCount,r=e.currentPage,n=e.setCurrentPage,c=e.centered,s=void 0===c||c;if(t<2)return null;var i=function(e){return function(){return!er(e)&&n(e)}};return Object(a.jsxs)(qt.a,{listClassName:P()("flex-wrap mb-0 simple-paginator",{"justify-content-center":s}),children:[Object(a.jsx)(Ht.a,{disabled:r<=1,children:Object(a.jsx)(Wt.a,{previous:!0,tag:"span",onClick:i(r-1)})}),$t(r,t).map((function(e,t){return Object(a.jsx)(Ht.a,{disabled:er(e),active:r===e,children:Object(a.jsx)(Wt.a,{tag:"span",onClick:i(e),children:tr(e)})},rr(e,t))})),Object(a.jsx)(Ht.a,{disabled:r>=t,children:Object(a.jsx)(Wt.a,{next:!0,tag:"span",onClick:i(r+1)})})]})},Sc=r(684),yc=r(126),Cc=r(305),Nc=r.n(Cc),kc="Others",wc=["Android Browser","Chrome","Chromium","Firefox","Internet Explorer","Microsoft Edge","Opera","Safari","Samsung Internet for Android","Vivaldi","WeChat"],_c=function(e){var t,r;return Object(Ue.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"},Uc=function(e,t){return Object.values(Object(d.a)(Object(d.a)({},Object(fc.a)(t,t.map((function(){return 0})))),e))},Tc=function(e,t){e.target.style.cursor=t[0]?"pointer":"default"},Rc=function(e){return function(t,r){var n,c=r.datasets,a=t.datasetIndex,s=t[e],i=void 0!==a&&(null===c||void 0===c||null===(n=c[a])||void 0===n?void 0:n.label)||"";return"".concat(i,": ").concat(Yt(Number(s)))}},Dc=function(e,t){var r,n,c=e.datasetIndex,a=e.index,s=t.labels,i=t.datasets,o=void 0!==a&&(null===s||void 0===s?void 0:s[a])||"",l=void 0!==c&&void 0!==a&&(null===i||void 0===i||null===(r=i[c])||void 0===r||null===(n=r.data)||void 0===n?void 0:n[a])||"";return"".concat(o,": ").concat(Yt(Number(l)))},Ec=r(44),Lc=function(e){return e.startsWith("hidden")?"":e},Vc=function(e){var t,r,n=e.config,c=null!==(t=n.data)&&void 0!==t?t:{},s=c.labels,i=void 0===s?[]:s,o=c.datasets,l=void 0===o?[]:o,u=(null!==(r=n.options)&&void 0!==r?r:{}).defaultColor,d=Object(E.a)(l,1)[0].backgroundColor;return Object(a.jsx)("ul",{className:"default-chart__pie-chart-legend",children:i.map((function(e,t){return Object(a.jsxs)("li",{className:"default-chart__pie-chart-legend-item d-flex",children:[Object(a.jsx)("div",{className:"default-chart__pie-chart-legend-item-color",style:{backgroundColor:d[t]||u}}),Object(a.jsx)("small",{className:"default-chart__pie-chart-legend-item-text flex-fill",children:e})]},e)}))})},Ic=function(e){return function(t){var r=Object(E.a)(t,1)[0];if(e&&r){var n=r._index,c=r._chart.data.labels;e(null===c||void 0===c?void 0:c[n])}}},Fc=function(e){return!!e&&Object.keys(e).length>0},Ac=function(e){var t=e.title,r=e.isBarChart,n=void 0!==r&&r,c=e.stats,s=e.max,i=e.highlightedStats,o=e.highlightedLabel,l=e.onClick,u=n?yc.HorizontalBar:yc.Doughnut,j=Object(Ce.a)(c).map(Lc),b=Object(Ne.a)(Fc(i)?Object(Ce.a)(i).reduce((function(e,t){return e[t]&&(e[t]-=i[t]),e}),Object(d.a)({},c)):c),h=Fc(i)?Uc(i,j):void 0,O=Object(L.useState)(),v=Object(E.a)(O,2),f=v[0],m=v[1],p={legend:{display:!1},legendCallback:!n&&Vc,scales:n?{xAxes:[{ticks:{beginAtZero:!0,precision:0,callback:Yt,max:s},stacked:!0}],yAxes:[{stacked:!0}]}:void 0,tooltips:{intersect:!n,filter:function(e){var t=e.yLabel;return!n||""!==t},callbacks:{label:n?Rc("xLabel"):Dc}},onHover:n?Tc:void 0},x=function(e,t,r,n,c,a){return{labels:r,datasets:[{title:e,label:c?"Non-selected":"Visits",data:n,backgroundColor:t?Ec.d:["#97BBCD","#F7464A","#46BFBD","#FDB45C","#949FB1","#57A773","#414066","#08B2E3","#B6C454","#DCDCDC","#463730"],borderColor:t?Ec.c:Object(Ec.h)()?Ec.e:Ec.f,borderWidth:2},c&&{title:e,label:null!==a&&void 0!==a?a:"Selected",data:c,backgroundColor:Ec.b,borderColor:Ec.a,borderWidth:2}].filter(Boolean)}}(t,n,j,b,h,o),g=function(e,t){return e?e&&t.length>20?8*t.length:void 0:300}(n,j);return Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:P()("col-sm-12",{"col-md-7":!n}),children:Object(a.jsx)(u,{ref:function(e){return m(null!==e&&void 0!==e?e:void 0)},data:x,options:p,height:g,getElementAtEvent:Ic(l)},g)}),!n&&Object(a.jsx)("div",{className:"col-sm-12 col-md-5",children:null===f||void 0===f?void 0:f.chartInstance.generateLegend()})]})},Mc=function(e){var t=e.title,r=e.footer,n=Object(br.a)(e,["title","footer"]);return Object(a.jsxs)(ke.a,{children:[Object(a.jsx)(Xn.a,{className:"graph-card__header",children:"function"===typeof t?t():t}),Object(a.jsx)($n.a,{children:Object(a.jsx)(Ac,Object(d.a)({title:t},n))}),r&&Object(a.jsx)(Sc.a,{className:"graph-card__footer--sticky",children:r})]})},Gc=function(e){return"String"===Object(bc.a)(e)?Object(hc.a)(e):e},Pc=function(e){return Object(E.a)(e,1)[0]},Bc=function(e){return Object(E.a)(e,2)[1]},Hc=function(e){var t=e.stats,r=e.highlightedStats,n=e.title,c=e.sortingItems,s=e.extraHeaderContent,i=e.withPagination,o=void 0===i||i,l=Object(br.a)(e,["stats","highlightedStats","title","sortingItems","extraHeaderContent","withPagination"]),u=Object(L.useState)({orderField:void 0,orderDir:void 0}),j=Object(E.a)(u,2),b=j[0],h=j[1],O=Object(L.useState)(1),v=Object(E.a)(O,2),f=v[0],m=v[1],p=Object(L.useState)(50),x=Object(E.a)(p,2),g=x[0],S=x[1],y=function(e){var t=e[f-1];if(f<e.length)return t;var r=e[0].length;return[].concat(Object(Se.a)(t),Object(Se.a)(Object(Ue.e)(r-t.length,(function(e){return["hidden_".concat(e),0]}))))},C=function(e,t,r){var n=function(e,t){var r=Object(_e.a)(e),n=b.orderField?Object(Oc.a)(Object(A.a)(b.orderField===Object.keys(t)[0]?Pc:Bc,Gc),r):r;return b.orderDir&&"ASC"!==b.orderDir?Object(vc.a)(n):n}(e,r),c=n.map(Pc),s=t&&Object(_e.a)(Object(d.a)(Object(d.a)({},Object(fc.a)(c,c.map((function(){return 0})))),t));if(n.length<=g)return{currentPageStats:Object(mc.a)(n),currentPageHighlightedStats:s&&Object(mc.a)(s)};var i,o,l=Object(pc.a)(g,n),u=s&&Object(pc.a)(g,s);return{currentPageStats:Object(mc.a)(y(l)),currentPageHighlightedStats:u&&Object(mc.a)(y(u)),pagination:(o=l.length,Object(a.jsx)(gc,{currentPage:f,pagesCount:o,setCurrentPage:m})),max:(i=Math.max.apply(Math,Object(Se.a)(n.map(Bc))),10*Jt(i/10))}}(t,r&&Object.keys(r).length>0?r:void 0,c),N=C.currentPageStats,k=C.currentPageHighlightedStats,w=C.pagination,_=C.max,U=Object.keys(N);return Object(a.jsx)(Mc,Object(d.a)({isBarChart:!0,title:function(){return Object(a.jsxs)(a.Fragment,{children:[n,Object(a.jsx)("div",{className:"float-right",children:Object(a.jsx)(Te,{isButton:!1,right:!0,items:c,orderField:b.orderField,orderDir:b.orderDir,onChange:function(e,t){h({orderField:e,orderDir:t}),m(1)}})}),o&&Object.keys(t).length>50&&Object(a.jsx)("div",{className:"float-right",children:Object(a.jsx)(xc,{toggleClassName:"btn-sm p-0 mr-3",ranges:[50,100,200,500],value:g,setValue:function(e){S(e),m(1)}})}),s&&Object(a.jsx)("div",{className:"float-right",children:s(w?U:void 0)})]})},stats:N,highlightedStats:k,footer:w,max:_},l))},Wc=r(692),qc=r(693),zc=r(694),Kc=r(689),Qc=r(306),Jc=r(690),Zc=r(331),Yc=r(85),Xc=r(691),$c=r(695),ea=function(e){return Object(a.jsx)(Wr,Object(d.a)({type:"switch"},e))},ta={monthly:"Month",weekly:"Week",daily:"Day",hourly:"Hour"},ra={hourly:function(e){return{hours:e}},daily:function(e){return{days:e}},weekly:function(e){return{weeks:e}},monthly:function(e){return{months:e}}},na={hourly:Kc.a,daily:Qc.a,weekly:Jc.a,monthly:Zc.a},ca={hourly:function(e){return Object(ee.default)(e,"yyyy-MM-dd HH:00")},daily:function(e){return Object(ee.default)(e,"yyyy-MM-dd")},weekly:function(e){var t=Object(ee.default)(Object(Yc.a)(e),"yyyy-MM-dd"),r=Object(ee.default)(Object(Xc.a)(e),"yyyy-MM-dd");return"".concat(t," - ").concat(r)},monthly:function(e){return Object(ee.default)(e,"yyyy-MM")}},aa=function(e,t){return Object(zc.a)((function(t){return ca[e](Object(M.default)(t.date))}),t)},sa=function(e,t,r,n){if(n)return[Object.keys(t),Object.values(t)];var c=function(e,t){var r=na[e],n=ca[e],c=Object(M.default)(t[0].date),a=Object(M.default)(t[t.length-1].date),s=r(c,a),i=ra[e];return[n(a)].concat(Object(Se.a)(Object(Ue.e)(s,(function(e){return n(Object($c.a)(a,i(e)))}))))}(r,e);return[c,Uc(t,c)]},ia=function(e,t,r){return{label:t,data:e,fill:!1,lineTension:.2,borderColor:r,backgroundColor:r}},oa=null,la=function(e,t){return function(r){var n=Object(E.a)(r,1)[0];if(t&&n){var c,a=n._index,s=n._chart.data.labels;if(oa===s[a])t([]),oa=null;else t(s[a]&&e[s[a]]||[]),oa=null!==(c=s[a])&&void 0!==c?c:null}}},ua=function(e){var t=e.title,r=e.visits,n=e.highlightedVisits,c=e.highlightedLabel,s=void 0===c?"Selected":c,i=e.setSelectedVisits,o=Object(L.useState)(r.length>0?function(e){var t,r=new Date,n=Object(M.default)(e);return null!==(t=Object(Wc.a)([[function(){return Object(Qc.a)(r,n)<=2},Object(qc.a)("hourly")],[function(){return Object(Zc.a)(r,n)<=1},Object(qc.a)("daily")],[function(){return Object(Zc.a)(r,n)<=6},Object(qc.a)("weekly")]])())&&void 0!==t?t:"monthly"}(r[r.length-1].date):"monthly"),l=Object(E.a)(o,2),u=l[0],d=l[1],j=Object(Q.c)(!0),b=Object(E.a)(j,2),h=b[0],O=b[1],v=Object(L.useMemo)((function(){return function(e,t){return t.reduce((function(t,r){var n,c=ca[e](Object(M.default)(r.date));return t[c]=null!==(n=t[c])&&void 0!==n?n:[],t[c].push(r),t}),{})}(u,r)}),[u,r]),f=Object(L.useMemo)((function(){return aa(u,Object(vc.a)(r))}),[u,r]),m=Object(L.useMemo)((function(){return sa(r,f,u,h)}),[r,u,h]),p=Object(E.a)(m,2),x=p[0],g=p[1],S=Object(L.useMemo)((function(){return Uc(aa(u,Object(vc.a)(n)),x)}),[n,u,x]),y={labels:x,datasets:[ia(g,"Visits",Ec.c),n.length>0&&ia(S,s,Ec.a)].filter(Boolean)},C={maintainAspectRatio:!1,legend:{display:!1},scales:{yAxes:[{ticks:{beginAtZero:!0,precision:0,callback:Yt}}],xAxes:[{scaleLabel:{display:!0,labelString:ta[u]}}]},tooltips:{intersect:!1,axis:"x",callbacks:{label:Rc("yLabel")}},onHover:Tc};return Object(a.jsxs)(ke.a,{children:[Object(a.jsxs)(Xn.a,{children:[t,Object(a.jsx)("div",{className:"float-right",children:Object(a.jsxs)(we.a,{children:[Object(a.jsx)(z.a,{caret:!0,color:"link",className:"btn-sm p-0",children:"Group by"}),Object(a.jsx)(K.a,{right:!0,children:Object.entries(ta).map((function(e){var t=Object(E.a)(e,2),r=t[0],n=t[1];return Object(a.jsx)(W.a,{active:u===r,onClick:function(){return d(r)},children:n},r)}))})]})}),Object(a.jsx)("div",{className:"float-right mr-2",children:Object(a.jsx)(ea,{checked:h,onChange:O,children:Object(a.jsx)("small",{children:"Skip dates with no visits"})})})]}),Object(a.jsx)($n.a,{className:"line-chart-card__body",children:Object(a.jsx)(yc.Line,{data:y,options:C,getElementAtEvent:la(v,i)})})]})},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(br.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)}))},ja=function(e){var t,r,n=e.visits,c=e.selectedVisits,s=void 0===c?[]:c,i=e.setSelectedVisits,o=e.selectedServer,l=e.matchMedia,u=void 0===l?window.matchMedia:l,d=e.isOrphanVisits,j=void 0!==d&&d,b="visits-table__header-cell visits-table__sticky",h=function(){return u("(max-width: 767px)").matches},O=Object(L.useState)(h()),v=Object(E.a)(O,2),f=v[0],m=v[1],p=Object(L.useState)(void 0),x=Object(E.a)(p,2),g=x[0],S=x[1],y=Object(L.useState)({field:void 0,dir:void 0}),C=Object(E.a)(y,2),N=C[0],k=C[1],w=Object(L.useMemo)((function(){return function(e,t,r){var n=function(e,t){var r=e.field,n=e.dir;return r&&n?t.sort((function(e,t){var c="ASC"===n?1:-1,a="ASC"===n?-1:1;return e[r]>t[r]?c:a})):t}(r,t?da(t,e):Object(Se.a)(e)),c=n.length;return{visitsGroups:Object(pc.a)(20,n),total:c}}(n,g,N)}),[g,N]),_=Object(L.useRef)(!0),U=Object(L.useState)(1),T=Object(E.a)(U,2),R=T[0],D=T[1],V=20*R,A=V-20,M=Object(wt.a)(o),G=7+Number(M)+Number(j),H=function(e){return function(){return k({field:e,dir:Object(Ue.a)(e,N.field,N.dir)})}},W=function(e){return N.dir&&N.field===e&&Object(a.jsx)(F.a,{icon:"ASC"===N.dir?I.f:I.e,className:"visits-table__header-icon"})};return Object(L.useEffect)((function(){var e=function(){return m(h())};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),Object(L.useEffect)((function(){D(1),!_.current&&i([]),_.current=!1}),[g]),Object(a.jsxs)("table",{className:"table table-bordered table-hover table-sm table-responsive-sm visits-table",children:[Object(a.jsxs)("thead",{className:"visits-table__header",children:[Object(a.jsxs)("tr",{children:[Object(a.jsx)("th",{className:"".concat(b," text-center"),onClick:function(){return i(s.length<w.total?w.visitsGroups.flat():[])},children:Object(a.jsx)(F.a,{icon:I.h,className:P()({"text-primary":s.length>0})})}),M&&Object(a.jsxs)("th",{className:"".concat(b," text-center"),onClick:H("potentialBot"),children:[Object(a.jsx)(F.a,{icon:I.E}),W("potentialBot")]}),Object(a.jsxs)("th",{className:b,onClick:H("date"),children:["Date",W("date")]}),Object(a.jsxs)("th",{className:b,onClick:H("country"),children:["Country",W("country")]}),Object(a.jsxs)("th",{className:b,onClick:H("city"),children:["City",W("city")]}),Object(a.jsxs)("th",{className:b,onClick:H("browser"),children:["Browser",W("browser")]}),Object(a.jsxs)("th",{className:b,onClick:H("os"),children:["OS",W("os")]}),Object(a.jsxs)("th",{className:b,onClick:H("referer"),children:["Referrer",W("referer")]}),j&&Object(a.jsxs)("th",{className:b,onClick:H("visitedUrl"),children:["Visited URL",W("visitedUrl")]})]}),Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"p-0",children:Object(a.jsx)(B,{noBorder:!0,large:!1,onChange:S})})})]}),Object(a.jsxs)("tbody",{children:[!(null!==(t=w.visitsGroups[R-1])&&void 0!==t&&t.length)&&Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"text-center",children:"No visits found with current filtering"})}),null===(r=w.visitsGroups[R-1])||void 0===r?void 0:r.map((function(e,t){var r=s.includes(e);return Object(a.jsxs)("tr",{style:{cursor:"pointer"},className:P()({"table-active":r}),onClick:function(){return i(r?s.filter((function(t){return t!==e})):[].concat(Object(Se.a)(s),[e]))},children:[Object(a.jsx)("td",{className:"text-center",children:r&&Object(a.jsx)(F.a,{icon:I.h,className:"text-primary"})}),M&&Object(a.jsx)("td",{className:"text-center",children:e.potentialBot&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(F.a,{icon:I.E,id:"botIcon".concat(t)}),Object(a.jsx)(jr.a,{placement:"right",target:"botIcon".concat(t),children:"Potentially a visit from a bot or crawler"})]})}),Object(a.jsx)("td",{children:Object(a.jsx)(dr,{date:e.date})}),Object(a.jsx)("td",{children:e.country}),Object(a.jsx)("td",{children:e.city}),Object(a.jsx)("td",{children:e.browser}),Object(a.jsx)("td",{children:e.os}),Object(a.jsx)("td",{children:e.referer}),j&&Object(a.jsx)("td",{children:e.visitedUrl})]},t)}))]}),w.total>20&&Object(a.jsx)("tfoot",{children:Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:G,className:"visits-table__footer-cell visits-table__sticky",children:Object(a.jsxs)("div",{className:"row",children:[Object(a.jsx)("div",{className:"col-md-6",children:Object(a.jsx)(gc,{pagesCount:Math.ceil(w.total/20),currentPage:R,setCurrentPage:D,centered:f})}),Object(a.jsx)("div",{className:P()("col-md-6",{"d-flex align-items-center flex-row-reverse":!f,"text-center mt-3":f}),children:Object(a.jsxs)("div",{children:["Visits ",Object(a.jsx)("b",{children:Yt(A+1)})," to"," ",Object(a.jsx)("b",{children:Yt(Object(Qt.a)(V,w.total))})," of"," ",Object(a.jsx)("b",{children:Yt(w.total)})]})})]})})})})]})},ba=r(713),ha=r(696),Oa=r(697),va=r(698),fa=function(){return Object(a.jsx)(ba.a,{attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"})},ma=function(e){return 0===e.length?{}:e.length>1?{bounds:e.map(Object(O.a)("latLong"))}:{zoom:10,center:Object(E.a)(e,1)[0].latLong}},pa=function(e){var t=e.toggle,r=e.isOpen,n=e.title,c=e.locations,s=void 0===c?[]:c;return Object(a.jsx)(gr.a,{toggle:t,isOpen:r,className:"map-modal__modal",contentClassName:"map-modal__modal-content",children:Object(a.jsxs)(yr.a,{className:"map-modal__modal-body",children:[Object(a.jsxs)("h3",{className:"map-modal__modal-title",children:[n,Object(a.jsx)("button",{type:"button",className:"close",onClick:t,children:"\xd7"})]}),Object(a.jsxs)(ha.a,Object(d.a)(Object(d.a)({},ma(s)),{},{children:[Object(a.jsx)(fa,{}),s.map((function(e,t){var r=e.cityName,n=e.latLong,c=e.count;return Object(a.jsx)(Oa.a,{position:n,children:Object(a.jsxs)(va.a,{children:[Object(a.jsx)("b",{children:c})," visit",c>1?"s":""," from ",Object(a.jsx)("b",{children:r})]})},t)}))]}))]})})},xa=function(e){var t=e.modalTitle,r=e.activeCities,n=e.locations,c=void 0===n?[]:n,s=Object(Q.c)(),i=Object(E.a)(s,4),o=i[0],l=i[2],u=i[3],d=Object(Q.c)(),j=Object(E.a)(d,3),b=j[0],h=j[1],O=j[2],v=Object(L.useState)([]),f=Object(E.a)(v,2),m=f[0],p=f[1],x=Object(L.useRef)(),g=function(e){return function(){p(e?c.filter((function(e){var t=e.cityName;return r.includes(t)})):c),l()}};return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("button",{className:"btn btn-link open-map-modal-btn__btn",ref:x,onClick:function(){if(!r)return p(c),void l();O()},children:Object(a.jsx)(F.a,{icon:I.w})}),Object(a.jsx)(jr.a,{placement:"left",target:function(){return x.current},children:"Show in map"}),Object(a.jsx)(q.a,{isOpen:b,toggle:h,inNavbar:!0,children:Object(a.jsxs)(K.a,{right:!0,children:[Object(a.jsx)(W.a,{onClick:g(!1),children:"Show all locations"}),Object(a.jsx)(W.a,{onClick:g(!0),children:"Show locations in current page"})]})}),Object(a.jsx)(pa,{toggle:u,isOpen:o,title:t,locations:m})]})},ga=r(699),Sa=function(e){return e.hasOwnProperty("visitedUrl")},ya=Object(A.a)(Object(ga.a)((function(e){return Sa(e.visit)?"orphanVisits":"regularVisits"})),(function(e){return Object(d.a)({orphanVisits:[],regularVisits:[]},e)})),Ca=function(e,t){return Object(zc.a)(Object(O.a)(t),e)},Na=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)&&ce(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)&&ce(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}},ka=function(e,t){return!Object(C.a)(e)&&Object(Ue.c)(e[t])},wa=function(e){return"number"===typeof e?e:e?parseFloat(e):0},_a=function(e){return function(t,r){var n=ka(r,e)?r[e]:"Unknown";t[n]=(t[n]||0)+1}},Ua=_a("country"),Ta=_a("city"),Ra=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),Ua(e.countries,t),Ta(e.cities,t),function(e,t){if(ka(t,"city")&&"Unknown"!==t.city){var r=t.city,n=t.latitude,c=t.longitude,a=e[r]||{cityName:r,count:0,latLong:[wa(n),wa(c)]};a.count++,e[r]=a}}(e.citiesForMap,t),function(e,t){if(function(e){return e.hasOwnProperty("visitedUrl")}(t)){var r=t.visitedUrl;e[r]=(e[r]||0)+1}}(e.visitedUrls,t),e}),{os:{},browsers:{},referrers:{},countries:{},cities:{},citiesForMap:{},visitedUrls:{}})},Da=Object(Ln.a)((function(e){var t=e.userAgent,r=e.date,n=e.referer,c=e.visitLocation,a=e.potentialBot,s=void 0!==a&&a,i=Object(d.a)(Object(d.a)({date:r,potentialBot:s},function(e){if(!Object(Ue.c)(e))return{browser:kc,os:kc};var t=Nc.a.parse(e),r=t.browser.name,n=t.os.name;return{os:null!==n&&void 0!==n?n:kc,browser:r&&wc.includes(r)?r:kc}}(t)),{},{referer:_c(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 Sa(e)?Object(d.a)(Object(d.a)({},i),{},{type:e.type,visitedUrl:e.visitedUrl}):i})),Ea=function(e){var t=e.onChange,r=e.selected,n=void 0===r?{}:r,c=e.className,s=e.isOrphanVisits,i=e.botsSupported;if(!i&&!s)return null;var o=n.orphanVisitsType,l=n.excludeBots,u=void 0!==l&&l,j=function(e){return{active:o===e,onClick:function(){return t(Object(d.a)(Object(d.a)({},n),{},{orphanVisitsType:e===(null===n||void 0===n?void 0:n.orphanVisitsType)?void 0:e}))}}};return Object(a.jsxs)(J,{text:"Filters",dropdownClassName:c,className:"mr-3",right:!0,minWidth:250,children:[i&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(W.a,{header:!0,children:"Bots:"}),Object(a.jsx)(W.a,{active:u,onClick:function(){return t(Object(d.a)(Object(d.a)({},n),{},{excludeBots:!(null!==n&&void 0!==n&&n.excludeBots)}))},children:"Exclude potential bots"})]}),i&&s&&Object(a.jsx)(W.a,{divider:!0}),s&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(W.a,{header:!0,children:"Orphan visits type:"}),Object(a.jsx)(W.a,Object(d.a)(Object(d.a)({},j("base_url")),{},{children:"Base URL"})),Object(a.jsx)(W.a,Object(d.a)(Object(d.a)({},j("invalid_short_url")),{},{children:"Invalid short URL"})),Object(a.jsx)(W.a,Object(d.a)(Object(d.a)({},j("regular_404")),{},{children:"Regular 404"}))]}),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(W.a,{disabled:!Object(Ue.c)(n),onClick:function(){return t({})},children:Object(a.jsx)("i",{children:"Clear filters"})})]})},La={byTime:{title:"By time",subPath:"",icon:I.d},byContext:{title:"By context",subPath:"/by-context",icon:I.g},byLocation:{title:"By location",subPath:"/by-location",icon:I.w},list:{title:"List",subPath:"/list",icon:I.v}},Va=function(e){var t=e.subPath,r=e.title,n=e.icon,c=e.to;return Object(a.jsxs)(uc.a,{tag:o.c,className:"visits-stats__nav-link",to:c,isActive:function(e,r){return r.pathname.endsWith("visits".concat(t))},replace:!0,children:[Object(a.jsx)(F.a,{icon:n}),Object(a.jsx)("span",{className:"ml-2 d-none d-sm-inline",children:r})]})},Ia=function(e){var t,r,n=e.children,c=e.visitsInfo,s=e.getVisits,i=e.cancelGetVisits,o=e.baseUrl,l=e.domain,u=e.settings,j=e.exportCsv,h=e.selectedServer,O=e.isOrphanVisits,v=void 0!==O&&O,f=null!==(t=null===(r=u.visits)||void 0===r?void 0:r.defaultInterval)&&void 0!==t?t:"last30Days",m=Object(L.useState)(je(f)),p=Object(E.a)(m,2),x=p[0],g=p[1],S=Object(L.useState)([]),y=Object(E.a)(S,2),C=y[0],k=y[1],w=Object(L.useState)(),_=Object(E.a)(w,2),U=_[0],T=_[1],R=Object(L.useState)({}),D=Object(E.a)(R,2),V=D[0],A=D[1],M=Object(wt.a)(h),G=function(e){var t=l?"?domain=".concat(l):"";return e?"".concat(o).concat(e).concat(t):"".concat(o).concat(t)},B=c.visits,H=c.loading,W=c.loadingLarge,q=c.error,z=c.errorData,K=c.progress,Q=Object(L.useMemo)((function(){return Da(B)}),[B]),J=Object(L.useMemo)((function(){return Ra(Q)}),[Q]),Z=J.os,Y=J.browsers,X=J.referrers,$=J.countries,ee=J.cities,te=J.citiesForMap,re=J.visitedUrls,ne=Object(Ne.a)(te),ce=function(e){He=void 0,k(e)},ae=function(e){return function(t){var r="".concat(e,"_").concat(t);He===r?(k([]),T(void 0),He=void 0):(k(Q.filter(Object(lc.a)(e,t))),T(t),He=r)}};Object(L.useEffect)((function(){return i}),[]),Object(L.useEffect)((function(){s({dateRange:x,filter:V})}),[x,V]);return Object(a.jsxs)(a.Fragment,{children:[n,Object(a.jsx)("section",{className:"mt-3",children:Object(a.jsxs)("div",{className:"row flex-md-row-reverse",children:[Object(a.jsx)("div",{className:"col-lg-7 col-xl-6",children:Object(a.jsxs)("div",{className:"d-md-flex",children:[Object(a.jsx)("div",{className:"flex-fill",children:Object(a.jsx)(pe,{disabled:H,initialDateRange:f,defaultText:"All visits",onDatesChange:g})}),Object(a.jsx)(Ea,{className:"ml-0 ml-md-2 mt-3 mt-md-0",isOrphanVisits:v,botsSupported:M,selected:V,onChange:A})]})}),B.length>0&&Object(a.jsx)("div",{className:"col-lg-5 col-xl-6 mt-3 mt-lg-0",children:Object(a.jsxs)("div",{className:"d-flex",children:[Object(a.jsxs)(Vr.a,{outline:!0,disabled:0===C.length,className:"btn-md-block mr-2",onClick:function(){return ce([])},children:["Clear selection ",C.length>0&&Object(a.jsxs)(a.Fragment,{children:["(",C.length,")"]})]}),Object(a.jsxs)(Vr.a,{outline:!0,color:"primary",className:"btn-md-block",onClick:function(){return j(Q)},children:[Object(a.jsx)(F.a,{icon:I.q})," Export (",Q.length,")"]})]})})]})}),Object(a.jsx)("section",{className:"mt-3",children:W?Object(a.jsxs)($r.a,{loading:!0,children:["This is going to take a while... :S",Object(a.jsx)(dc.a,{value:K,striped:100===K,className:"mt-3"})]}):H?Object(a.jsx)($r.a,{loading:!0}):q?Object(a.jsx)(_r,{type:"error",children:Object(a.jsx)(Ur,{errorData:z,fallbackMessage:"An error occurred while loading visits :("})}):Object(N.a)(B)?Object(a.jsx)($r.a,{children:"There are no visits matching current filter :("}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(ke.a,{className:"visits-stats__nav p-0 overflow-hidden",body:!0,children:Object(a.jsx)(jc.a,{pills:!0,fill:!0,children:Object.entries(La).map((function(e){var t=Object(E.a)(e,2),r=t[0],n=t[1];return Object(a.jsx)(Va,Object(d.a)(Object(d.a)({},n),{},{to:G(n.subPath)}),r)}))})}),Object(a.jsx)(kr.a,{children:Object(a.jsxs)(b.d,{children:[Object(a.jsx)(b.b,{exact:!0,path:o,children:Object(a.jsx)("div",{className:"col-12 mt-3",children:Object(a.jsx)(ua,{title:"Visits during time",visits:Q,highlightedVisits:C,highlightedLabel:U,setSelectedVisits:ce})})}),Object(a.jsxs)(b.b,{exact:!0,path:"".concat(o).concat(La.byContext.subPath),children:[Object(a.jsx)("div",{className:P()("mt-3 col-lg-6",{"col-xl-4":!v}),children:Object(a.jsx)(Mc,{title:"Operating systems",stats:Z})}),Object(a.jsx)("div",{className:P()("mt-3 col-lg-6",{"col-xl-4":!v}),children:Object(a.jsx)(Mc,{title:"Browsers",stats:Y})}),Object(a.jsx)("div",{className:P()("mt-3",{"col-xl-4":!v,"col-lg-6":v}),children:Object(a.jsx)(Hc,{title:"Referrers",stats:X,withPagination:!1,highlightedStats:Ca(C,"referer"),highlightedLabel:U,sortingItems:{name:"Referrer name",amount:"Visits amount"},onClick:ae("referer")})}),v&&Object(a.jsx)("div",{className:"mt-3 col-lg-6",children:Object(a.jsx)(Hc,{title:"Visited URLs",stats:re,highlightedLabel:U,highlightedStats:Ca(C,"visitedUrl"),sortingItems:{visitedUrl:"Visited URL",amount:"Visits amount"},onClick:ae("visitedUrl")})})]}),Object(a.jsxs)(b.b,{exact:!0,path:"".concat(o).concat(La.byLocation.subPath),children:[Object(a.jsx)("div",{className:"col-lg-6 mt-3",children:Object(a.jsx)(Hc,{title:"Countries",stats:$,highlightedStats:Ca(C,"country"),highlightedLabel:U,sortingItems:{name:"Country name",amount:"Visits amount"},onClick:ae("country")})}),Object(a.jsx)("div",{className:"col-lg-6 mt-3",children:Object(a.jsx)(Hc,{title:"Cities",stats:ee,highlightedStats:Ca(C,"city"),highlightedLabel:U,extraHeaderContent:function(e){return ne.length>0&&Object(a.jsx)(xa,{modalTitle:"Cities",locations:ne,activeCities:e})},sortingItems:{name:"City name",amount:"Visits amount"},onClick:ae("city")})})]}),Object(a.jsx)(b.b,{exact:!0,path:"".concat(o).concat(La.list.subPath),children:Object(a.jsx)("div",{className:"col-12",children:Object(a.jsx)(ja,{visits:Q,selectedVisits:C,setSelectedVisits:ce,isOrphanVisits:v,selectedServer:h})})}),Object(a.jsx)(b.a,{to:o})]})})]})})]})},Fa=function(e){var t=e.exportVisits;return De((function(e){var r=e.history.goBack,n=e.match,c=n.params,s=n.url,i=e.location.search,o=e.shortUrlVisits,l=e.shortUrlDetail,u=e.getShortUrlVisits,j=e.getShortUrlDetail,b=e.cancelGetShortUrlVisits,h=e.settings,O=e.selectedServer,v=c.shortCode,f=Ee(i).domain;return Object(L.useEffect)((function(){j(v,f)}),[]),Object(a.jsx)(Ia,{getVisits:function(e){return u(v,Object(d.a)(Object(d.a)({},Na(e)),{},{domain:f}))},cancelGetVisits:b,visitsInfo:o,baseUrl:s,domain:f,settings:h,exportCsv:function(e){var r;return t("short-url_".concat(null===(r=l.shortUrl)||void 0===r?void 0:r.shortUrl.replace(/https?:\/\//g,""),"_visits.csv"),e)},selectedServer:O,children:Object(a.jsx)(oc,{shortUrlDetail:l,shortUrlVisits:o,goBack:r})})}),(function(e){var t=e.match;return[Le.shortUrlVisits(t.params.shortCode)]}))},Aa=r(711),Ma=5e3,Ga=function(e){return e.currentPage>=e.pagesCount},Pa=function(e,t){return 100*t/e},Ba=function(){var e=Object(p.a)(m.a.mark((function e(t,r,n,c,a){var s,i,o,l;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c({type:n.start}),s=function(){var e=Object(p.a)(m.a.mark((function e(r){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(r.map(function(){var e=Object(p.a)(m.a.mark((function e(r){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(r,Ma).then(Object(O.a)("data")));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then(Aa.a));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i=function(){var e=Object(p.a)(m.a.mark((function e(t){var r,o,l=arguments;return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:0,!a()){e.next=3;break}return e.abrupt("return",[]);case 3:return e.next=5,s(t[r]);case 5:if(o=e.sent,c({type:n.progress,progress:Pa(t.length,r+2)}),!(r<t.length-1)){e.next=13;break}return e.t0=o,e.next=11,i(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",o);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=function(){var e=Object(p.a)(m.a.mark((function e(){var r,a,s,o,l,u,d=arguments;return m.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,Ma);case 3:if(a=e.sent,s=a.pagination,o=a.data,s&&!Ga(s)){e.next=8;break}return e.abrupt("return",o);case 8:return l=Object(zt.a)(2,s.pagesCount+1),u=Object(pc.a)(4,l),s.pagesCount-1>4&&c({type:n.large}),e.t0=o,e.next=14,i(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,o();case 7:l=e.sent,c(Object(d.a)(Object(d.a)({},r),{},{visits:l,type:n.finish})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),c({type:n.error,errorData:lt(e.t0)});case 14:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(t,r,n,c,a){return e.apply(this,arguments)}}(),Ha="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_START",Wa="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_ERROR",qa="shlink/shortUrlVisits/GET_SHORT_URL_VISITS",za="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_LARGE",Ka="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_CANCEL",Qa="shlink/shortUrlVisits/GET_SHORT_URL_VISITS_PROGRESS_CHANGED",Ja={visits:[],shortCode:"",domain:void 0,loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},Za=et((We={},Object(u.a)(We,Ha,(function(){return Object(d.a)(Object(d.a)({},Ja),{},{loading:!0})})),Object(u.a)(We,Wa,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},Ja),{},{error:!0,errorData:r})})),Object(u.a)(We,qa,(function(e,t){var r=t.visits,n=t.shortCode,c=t.domain;return Object(d.a)(Object(d.a)({},Ja),{},{visits:r,shortCode:n,domain:c})})),Object(u.a)(We,za,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(We,Ka,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(We,Qa,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(We,it,(function(e,t){var r=t.createdVisits,n=e.shortCode,c=e.domain,a=e.visits,s=r.filter((function(e){var t=e.shortUrl;return t&&st(t,n,c)})).map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Se.a)(s),Object(Se.a)(a))})})),We),Ja),Ya=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o,l,u,j;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getShortUrlVisits,o=function(){var e=Object(p.a)(m.a.mark((function e(n,c){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(t,Object(d.a)(Object(d.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=function(){return a().shortUrlVisits.cancelLoad},u={shortCode:t,domain:r.domain},j={start:Ha,large:za,finish:qa,error:Wa,progress:Qa},n.abrupt("return",Ba(o,u,j,c,l));case 6:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},Xa=tt(Ka),$a=function(e){var t=e.tagVisits,r=e.goBack,n=e.colorGenerator,c=t.visits,s=t.tag,i=Object(a.jsxs)("span",{className:"d-flex align-items-center justify-content-center",children:[Object(a.jsx)("span",{className:"mr-2",children:"Visits for"}),Object(a.jsx)(H,{text:s,colorGenerator:n})]});return Object(a.jsx)(ic,{title:i,goBack:r,visits:c})},es=function(e,t){var r=t.exportVisits;return De((function(t){var n=t.history.goBack,c=t.match,s=c.params,i=c.url,o=t.getTagVisits,l=t.tagVisits,u=t.cancelGetTagVisits,d=t.settings,j=t.selectedServer,b=s.tag;return Object(a.jsx)(Ia,{getVisits:function(e){return o(b,Na(e))},cancelGetVisits:u,visitsInfo:l,baseUrl:i,settings:d,exportCsv:function(e){return r("tag_".concat(b,"_visits.csv"),e)},selectedServer:j,children:Object(a.jsx)($a,{tagVisits:l,goBack:n,colorGenerator:e})})}),(function(){return[Le.visits]}))},ts="shlink/tagVisits/GET_TAG_VISITS_START",rs="shlink/tagVisits/GET_TAG_VISITS_ERROR",ns="shlink/tagVisits/GET_TAG_VISITS",cs="shlink/tagVisits/GET_TAG_VISITS_LARGE",as="shlink/tagVisits/GET_TAG_VISITS_CANCEL",ss="shlink/tagVisits/GET_TAG_VISITS_PROGRESS_CHANGED",is={visits:[],tag:"",loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},os=et((qe={},Object(u.a)(qe,ts,(function(){return Object(d.a)(Object(d.a)({},is),{},{loading:!0})})),Object(u.a)(qe,rs,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},is),{},{error:!0,errorData:r})})),Object(u.a)(qe,ns,(function(e,t){var r=t.visits,n=t.tag;return Object(d.a)(Object(d.a)({},is),{},{visits:r,tag:n})})),Object(u.a)(qe,cs,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(qe,as,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(qe,ss,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(qe,it,(function(e,t){var r=t.createdVisits,n=e.tag,c=e.visits,a=r.filter((function(e){var t=e.shortUrl;return null===t||void 0===t?void 0:t.tags.includes(n)})).map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Se.a)(a),Object(Se.a)(c))})})),qe),is),ls=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o,l,u,j;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getTagVisits,o=function(){var e=Object(p.a)(m.a.mark((function e(n,c){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(t,Object(d.a)(Object(d.a)({},r),{},{page:n,itemsPerPage:c})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=function(){return a().tagVisits.cancelLoad},u={tag:t},j={start:ts,large:cs,finish:ns,error:rs,progress:ss},n.abrupt("return",Ba(o,u,j,c,l));case 6:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},us=tt(as),ds=function(e){var t=e.orphanVisits,r=e.goBack,n=t.visits;return Object(a.jsx)(ic,{title:"Orphan visits",goBack:r,visits:n})},js=function(e){var t=e.exportVisits;return De((function(e){var r=e.history.goBack,n=e.match.url,c=e.getOrphanVisits,s=e.orphanVisits,i=e.cancelGetOrphanVisits,o=e.settings,l=e.selectedServer;return Object(a.jsx)(Ia,{getVisits:function(e){var t;return c(Na(e),null===(t=e.filter)||void 0===t?void 0:t.orphanVisitsType)},cancelGetVisits:i,visitsInfo:s,baseUrl:n,settings:o,exportCsv:function(e){return t("orphan_visits.csv",e)},selectedServer:l,isOrphanVisits:!0,children:Object(a.jsx)(ds,{orphanVisits:s,goBack:r})})}),(function(){return[Le.orphanVisits]}))},bs="shlink/orphanVisits/GET_ORPHAN_VISITS_START",hs="shlink/orphanVisits/GET_ORPHAN_VISITS_ERROR",Os="shlink/orphanVisits/GET_ORPHAN_VISITS",vs="shlink/orphanVisits/GET_ORPHAN_VISITS_LARGE",fs="shlink/orphanVisits/GET_ORPHAN_VISITS_CANCEL",ms="shlink/orphanVisits/GET_ORPHAN_VISITS_PROGRESS_CHANGED",ps={visits:[],loading:!1,loadingLarge:!1,error:!1,cancelLoad:!1,progress:0},xs=et((ze={},Object(u.a)(ze,bs,(function(){return Object(d.a)(Object(d.a)({},ps),{},{loading:!0})})),Object(u.a)(ze,hs,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},ps),{},{error:!0,errorData:r})})),Object(u.a)(ze,Os,(function(e,t){var r=t.visits;return Object(d.a)(Object(d.a)({},ps),{},{visits:r})})),Object(u.a)(ze,vs,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loadingLarge:!0})})),Object(u.a)(ze,fs,(function(e){return Object(d.a)(Object(d.a)({},e),{},{cancelLoad:!0})})),Object(u.a)(ze,ms,(function(e,t){var r=t.progress;return Object(d.a)(Object(d.a)({},e),{},{progress:r})})),Object(u.a)(ze,it,(function(e,t){var r=t.createdVisits,n=e.visits,c=r.map((function(e){return e.visit}));return Object(d.a)(Object(d.a)({},e),{},{visits:[].concat(Object(Se.a)(c),Object(Se.a)(n))})})),ze),ps),gs=function(e,t){return!t||t===e.type},Ss=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o,l,u;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=e(a),i=s.getOrphanVisits,o=function(){var e=Object(p.a)(m.a.mark((function e(n,c){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i(Object(d.a)(Object(d.a)({},t),{},{page:n,itemsPerPage:c})).then((function(e){var t=e.data.filter((function(e){return Sa(e)&&gs(e,r)}));return Object(d.a)(Object(d.a)({},e),{},{data:t})})));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),l=function(){return a().orphanVisits.cancelLoad},u={start:bs,large:vs,finish:Os,error:hs,progress:ms},n.abrupt("return",Ba(o,{},u,c,l));case 5:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}()}},ys=tt(fs),Cs="shlink/visitsOverview/GET_OVERVIEW_START",Ns="shlink/visitsOverview/GET_OVERVIEW_ERROR",ks="shlink/visitsOverview/GET_OVERVIEW",ws={visitsCount:0,orphanVisitsCount:0,loading:!1,error:!1},_s=et((Ke={},Object(u.a)(Ke,Cs,(function(){return Object(d.a)(Object(d.a)({},ws),{},{loading:!0})})),Object(u.a)(Ke,Ns,(function(){return Object(d.a)(Object(d.a)({},ws),{},{error:!0})})),Object(u.a)(Ke,ks,(function(e,t){var r=t.visitsCount,n=t.orphanVisitsCount;return Object(d.a)(Object(d.a)({},ws),{},{visitsCount:r,orphanVisitsCount:n})})),Object(u.a)(Ke,it,(function(e,t){var r=e.visitsCount,n=e.orphanVisitsCount,c=void 0===n?0:n,a=Object(br.a)(e,["visitsCount","orphanVisitsCount"]),s=t.createdVisits,i=ya(s),o=i.regularVisits,l=i.orphanVisits;return Object(d.a)(Object(d.a)({},a),{},{visitsCount:r+o.length,orphanVisitsCount:c+l.length})})),Ke),ws),Us=function(e){return function(){return function(){var t=Object(p.a)(m.a.mark((function t(r,n){var c,a,s;return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:Cs}),t.prev=1,c=e(n),a=c.getVisitsOverview,t.next=5,a();case 5:s=t.sent,r(Object(d.a)({type:ks},s)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),r({type:Ns});case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},Ts=function e(t,r){var n=this;Object(x.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(cc.a)(n.window,r,e)}}},Rs=function(e,t){e.serviceFactory("MapModal",(function(){return pa})),e.serviceFactory("ShortUrlVisits",Fa,"VisitsExporter"),e.decorator("ShortUrlVisits",t(["shortUrlVisits","shortUrlDetail","mercureInfo","settings","selectedServer"],["getShortUrlVisits","getShortUrlDetail","cancelGetShortUrlVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("TagVisits",es,"ColorGenerator","VisitsExporter"),e.decorator("TagVisits",t(["tagVisits","mercureInfo","settings","selectedServer"],["getTagVisits","cancelGetTagVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("OrphanVisits",js,"VisitsExporter"),e.decorator("OrphanVisits",t(["orphanVisits","mercureInfo","settings","selectedServer"],["getOrphanVisits","cancelGetOrphanVisits","createNewVisits","loadMercureInfo"])),e.serviceFactory("VisitsParser",(function(){return n})),e.service("VisitsExporter",Ts,"window","csvjson"),e.serviceFactory("getShortUrlVisits",Ya,"buildShlinkApiClient"),e.serviceFactory("cancelGetShortUrlVisits",(function(){return Xa})),e.serviceFactory("getTagVisits",ls,"buildShlinkApiClient"),e.serviceFactory("cancelGetTagVisits",(function(){return us})),e.serviceFactory("getOrphanVisits",Ss,"buildShlinkApiClient"),e.serviceFactory("cancelGetOrphanVisits",(function(){return ys})),e.serviceFactory("createNewVisits",(function(){return ot})),e.serviceFactory("loadVisitsOverview",Us,"buildShlinkApiClient")},Ds=r(307),Es=r.n(Ds),Ls=function(e){var t=e.tag,r=e.colorGenerator;return Object(a.jsx)("div",{style:{backgroundColor:r.getColorForKey(t)},className:"tag-bullet"})},Vs=function(e){return{id:e,name:e}},Is=function(e){return function(t){var r,n,c=t.selectedTags,s=t.onChange,i=t.placeholder,o=t.listTags,l=t.tagsList,u=t.settings;Object(L.useEffect)((function(){o()}),[]);var d=null!==(r=null===(n=u.shortUrlCreation)||void 0===n?void 0:n.tagFilteringMode)&&void 0!==r?r:"startsWith";return Object(a.jsx)(Es.a,{tags:c.map(Vs),tagComponent:function(t){var r=t.tag,n=t.onDelete;return Object(a.jsx)(H,{colorGenerator:e,text:r.name,clearable:!0,className:"react-tags__tag",onClose:n})},suggestions:l.tags.filter((function(e){return!c.includes(e)})).map(Vs),suggestionComponent:function(t){var r=t.item;return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Ls,{tag:"".concat(r.name),colorGenerator:e}),r.name]})},allowNew:!0,addOnBlur:!0,placeholderText:null!==i&&void 0!==i?i:"Add tags to the URL",minQueryLength:1,delimiters:["Enter","Tab",","],suggestionsTransform:"includes"===d?function(e,t){return t.filter((function(t){return t.name.includes(e)}))}:void 0,onDelete:function(e){var t=Object(Se.a)(c);t.splice(e,1),s(t)},onAddition:function(e){var t=e.name;return s(Object(Se.a)(new Set([].concat(Object(Se.a)(c),Object(Se.a)(t.toLowerCase().split(","))))))}})}},Fs=r(649),As=function(e,t,r,n){return function(c){var s=c.tag,i=c.tagStats,l=c.selectedServer,u=c.displayed,d=c.toggle,j=Object(Q.c)(),b=Object(E.a)(j,2),h=b[0],O=b[1],f=Object(Q.c)(),m=Object(E.a)(f,2),p=m[0],x=m[1],g=Object(Q.c)(),S=Object(E.a)(g,3),y=S[0],C=S[2],N=Object(L.useRef)(),k=Object(v.d)(l)?l.id:"",w="/server/".concat(k,"/list-short-urls/1?tag=").concat(s);return Object(L.useEffect)((function(){var e;(e=N.current)&&e.scrollWidth>e.clientWidth&&C()}),[N.current]),Object(a.jsxs)(ke.a,{className:"tag-card",children:[Object(a.jsxs)(Xn.a,{className:"tag-card__header",children:[Object(a.jsx)(Vr.a,{color:"link",size:"sm",className:"tag-card__btn tag-card__btn--last",onClick:O,children:Object(a.jsx)(F.a,{icon:I.N})}),Object(a.jsx)(Vr.a,{color:"link",size:"sm",className:"tag-card__btn",onClick:x,children:Object(a.jsx)(F.a,{icon:I.B})}),Object(a.jsxs)("h5",{className:"tag-card__tag-title text-ellipsis",title:y?s:void 0,ref:function(e){N.current=null!==e&&void 0!==e?e:void 0},children:[Object(a.jsx)(Ls,{tag:s,colorGenerator:n}),Object(a.jsx)(r,{minVersion:"2.2.0",children:Object(a.jsx)("span",{className:"tag-card__tag-name",onClick:d,children:s})}),Object(a.jsx)(r,{maxVersion:"2.1.*",children:Object(a.jsx)(o.b,{to:w,children:s})})]})]}),i&&Object(a.jsx)(Fs.a,{isOpen:u,children:Object(a.jsxs)($n.a,{className:"tag-card__body",children:[Object(a.jsxs)(o.b,{to:w,className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center mb-1",children:[Object(a.jsxs)("span",{className:"text-ellipsis",children:[Object(a.jsx)(F.a,{icon:I.u,className:"mr-2"}),"Short URLs"]}),Object(a.jsx)("b",{children:Yt(i.shortUrlsCount)})]}),Object(a.jsxs)(o.b,{to:"/server/".concat(k,"/tag/").concat(s,"/visits"),className:"btn btn-outline-secondary btn-block d-flex justify-content-between align-items-center",children:[Object(a.jsxs)("span",{className:"text-ellipsis",children:[Object(a.jsx)(F.a,{icon:I.p,className:"mr-2"}),"Visits"]}),Object(a.jsx)("b",{children:Yt(i.visitsCount)})]})]})}),Object(a.jsx)(e,{tag:s,toggle:O,isOpen:h}),Object(a.jsx)(t,{tag:s,toggle:x,isOpen:p})]})}},Ms=function(e){var t=e.tag,r=e.toggle,n=e.isOpen,c=e.deleteTag,s=e.tagDelete,i=e.tagDeleted,o=s.deleting,l=s.error,u=s.errorData,d=function(){var e=Object(p.a)(m.a.mark((function e(){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(t);case 2:i(t),r();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(a.jsxs)(gr.a,{toggle:r,isOpen:n,centered:!0,children:[Object(a.jsx)(Sr.a,{toggle:r,children:Object(a.jsx)("span",{className:"text-danger",children:"Delete tag"})}),Object(a.jsxs)(yr.a,{children:["Are you sure you want to delete tag ",Object(a.jsx)("b",{children:t}),"?",l&&Object(a.jsx)(_r,{type:"error",small:!0,className:"mt-2",children:Object(a.jsx)(Ur,{errorData:u,fallbackMessage:"Something went wrong while deleting the tag :("})})]}),Object(a.jsxs)(Cr.a,{children:[Object(a.jsx)("button",{className:"btn btn-link",onClick:r,children:"Cancel"}),Object(a.jsx)("button",{className:"btn btn-danger",disabled:o,onClick:d,children:o?"Deleting tag...":"Delete tag"})]})]})},Gs=r(702),Ps=r(320),Bs=function(e){var t=e.getColorForKey;return function(e){var r=e.tag,n=e.editTag,c=e.toggle,s=e.tagEdited,i=e.isOpen,o=e.tagEdit,l=Object(L.useState)(r),u=Object(E.a)(l,2),d=u[0],j=u[1],b=Object(L.useState)(t(r)),h=Object(E.a)(b,2),O=h[0],v=h[1],f=Object(Q.c)(),x=Object(E.a)(f,4),g=x[0],S=x[1],y=x[3],C=o.editing,N=o.error,k=o.errorData,w=Object(Ue.b)(Object(p.a)(m.a.mark((function e(){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n(r,d,O).then((function(){return s(r,d,O)})).then(c).catch((function(){})));case 1:case"end":return e.stop()}}),e)}))));return Object(a.jsx)(gr.a,{isOpen:i,toggle:c,centered:!0,onClosed:y,children:Object(a.jsxs)("form",{onSubmit:w,children:[Object(a.jsx)(Sr.a,{toggle:c,children:"Edit tag"}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)("div",{className:"input-group",children:[Object(a.jsx)("div",{className:"input-group-prepend",id:"colorPickerBtn",onClick:S,children:Object(a.jsx)("div",{className:"input-group-text edit-tag-modal__color-picker-toggle",style:{backgroundColor:O,borderColor:O},children:Object(a.jsx)(F.a,{icon:I.z,className:"edit-tag-modal__color-icon"})})}),Object(a.jsx)(Gs.a,{isOpen:g,toggle:S,target:"colorPickerBtn",placement:"right",children:Object(a.jsx)(Ps.a,{color:O,disableAlpha:!0,onChange:function(e){var t=e.hex;return v(t)}})}),Object(a.jsx)("input",{type:"text",value:d,placeholder:"Tag",required:!0,className:"form-control",onChange:function(e){return j(e.target.value)}})]}),N&&Object(a.jsx)(_r,{type:"error",small:!0,className:"mt-2",children:Object(a.jsx)(Ur,{errorData:k,fallbackMessage:"Something went wrong while editing the tag :("})})]}),Object(a.jsxs)(Cr.a,{children:[Object(a.jsx)("button",{type:"button",className:"btn btn-link",onClick:c,children:"Cancel"}),Object(a.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:C,children:C?"Saving...":"Save"})]})]})})}},Hs=Math.ceil,Ws=function(e){return De((function(t){var r=t.filterTags,n=t.forceListTags,c=t.tagsList,s=t.selectedServer,i=Object(L.useState)(),o=Object(E.a)(i,2),l=o[0],u=o[1];if(Object(L.useEffect)((function(){n()}),[]),c.loading)return Object(a.jsx)($r.a,{loading:!0});return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(B,{className:"mb-3",onChange:r}),function(){if(c.error)return Object(a.jsx)(_r,{type:"error",children:Object(a.jsx)(Ur,{errorData:c.errorData,fallbackMessage:"Error loading tags :("})});var t=c.filteredTags.length;if(t<1)return Object(a.jsx)($r.a,{children:"No tags found"});var r=Object(pc.a)(Hs(t/4),c.filteredTags);return Object(a.jsx)(kr.a,{children:r.map((function(t,r){return Object(a.jsx)("div",{className:"col-md-6 col-xl-3",children:t.map((function(t){return Object(a.jsx)(e,{tag:t,tagStats:c.stats[t],selectedServer:s,displayed:l===t,toggle:function(){return u(l!==t?t:void 0)}},t)}))},r)}))})}()]})}),(function(){return[Le.visits]}))},qs="shlink/deleteTag/DELETE_TAG_START",zs="shlink/deleteTag/DELETE_TAG_ERROR",Ks="shlink/deleteTag/DELETE_TAG",Qs="shlink/deleteTag/TAG_DELETED",Js=et((Qe={},Object(u.a)(Qe,qs,(function(){return{deleting:!0,error:!1}})),Object(u.a)(Qe,zs,(function(e,t){return{deleting:!1,error:!0,errorData:t.errorData}})),Object(u.a)(Qe,Ks,(function(){return{deleting:!1,error:!1}})),Qe),{deleting:!1,error:!1}),Zs=function(e){return function(t){return function(){var r=Object(p.a)(m.a.mark((function r(n,c){var a,s;return m.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n({type:qs}),a=e(c),s=a.deleteTags,r.prev=2,r.next=5,s([t]);case 5:n({type:Ks}),r.next=12;break;case 8:throw r.prev=8,r.t0=r.catch(2),n({type:zs,errorData:lt(r.t0)}),r.t0;case 12:case"end":return r.stop()}}),r,null,[[2,8]])})));return function(e,t){return r.apply(this,arguments)}}()}},Ys=function(e){return{type:Qs,tag:e}},Xs="shlink/editTag/EDIT_TAG_START",$s="shlink/editTag/EDIT_TAG_ERROR",ei="shlink/editTag/EDIT_TAG",ti="shlink/editTag/TAG_EDITED",ri=et((Je={},Object(u.a)(Je,Xs,(function(e){return Object(d.a)(Object(d.a)({},e),{},{editing:!0,error:!1})})),Object(u.a)(Je,$s,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},e),{},{editing:!1,error:!0,errorData:r})})),Object(u.a)(Je,ei,(function(e,t){return Object(d.a)(Object(d.a)({},Object(h.a)(["oldName","newName"],t)),{},{editing:!1,error:!1})})),Je),{oldName:"",newName:"",editing:!1,error:!1}),ni=function(e,t){return function(r,n,c){return function(){var a=Object(p.a)(m.a.mark((function a(s,i){var o,l;return m.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s({type:Xs}),o=e(i),l=o.editTag,a.prev=2,a.next=5,l(r,n);case 5:t.setColorForKey(n,c),s({type:ei,oldName:r,newName:n}),a.next=13;break;case 9:throw a.prev=9,a.t0=a.catch(2),s({type:$s,errorData:lt(a.t0)}),a.t0;case 13:case"end":return a.stop()}}),a,null,[[2,9]])})));return function(e,t){return a.apply(this,arguments)}}()}},ci=function(e,t,r){return{type:ti,oldName:e,newName:t,color:r}},ai="shlink/tagsList/LIST_TAGS_START",si="shlink/tagsList/LIST_TAGS_ERROR",ii="shlink/tagsList/LIST_TAGS",oi="shlink/tagsList/FILTER_TAGS",li={tags:[],filteredTags:[],stats:{},loading:!1,error:!1},ui=function(e,t){return function(r){return r===e?t:r}},di=function(e,t){return Object(y.a)((function(e){return e===t}),e)},ji=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}),{}))},bi=et((Ze={},Object(u.a)(Ze,ai,(function(){return Object(d.a)(Object(d.a)({},li),{},{loading:!0})})),Object(u.a)(Ze,si,(function(e,t){var r=t.errorData;return Object(d.a)(Object(d.a)({},li),{},{error:!0,errorData:r})})),Object(u.a)(Ze,ii,(function(e,t){var r=t.tags,n=t.stats;return Object(d.a)(Object(d.a)({},li),{},{stats:n,tags:r,filteredTags:r})})),Object(u.a)(Ze,Qs,(function(e,t){var r=t.tag;return Object(d.a)(Object(d.a)({},e),{},{tags:di(e.tags,r),filteredTags:di(e.filteredTags,r)})})),Object(u.a)(Ze,ti,(function(e,t){var r=t.oldName,n=t.newName;return Object(d.a)(Object(d.a)({},e),{},{tags:e.tags.map(ui(r,n)).sort(),filteredTags:e.filteredTags.map(ui(r,n)).sort()})})),Object(u.a)(Ze,oi,(function(e,t){var r=t.searchTerm;return Object(d.a)(Object(d.a)({},e),{},{filteredTags:e.tags.filter((function(e){return e.toLowerCase().match(r)}))})})),Object(u.a)(Ze,it,(function(e,t){var r,n,c=t.createdVisits;return Object(d.a)(Object(d.a)({},e),{},{stats:(r=ji(c),n=e.stats,r.reduce((function(e,t){var r=Object(E.a)(t,2),n=r[0],c=r[1];if(!e[n])return e;var a=e[n];return a.visitsCount=a.visitsCount+c,e[n]=a,e}),Object(d.a)({},n)))})})),Ze),li),hi=function(e){return{type:oi,searchTerm:e}},Oi=function(e,t){e.serviceFactory("TagsSelector",Is,"ColorGenerator"),e.decorator("TagsSelector",t(["tagsList","settings"],["listTags"])),e.serviceFactory("TagCard",As,"DeleteTagConfirmModal","EditTagModal","ForServerVersion","ColorGenerator"),e.serviceFactory("DeleteTagConfirmModal",(function(){return Ms})),e.decorator("DeleteTagConfirmModal",t(["tagDelete"],["deleteTag","tagDeleted"])),e.serviceFactory("EditTagModal",Bs,"ColorGenerator"),e.decorator("EditTagModal",t(["tagEdit"],["editTag","tagEdited"])),e.serviceFactory("TagsList",Ws,"TagCard"),e.decorator("TagsList",t(["tagsList","selectedServer","mercureInfo"],["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(p.a)(m.a.mark((function r(n,c){var a,s,i,o,l,u,d,j;return m.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=c(),s=a.tagsList,t||!s.loading&&Object(N.a)(s.tags)){r.next=3;break}return r.abrupt("return");case 3:return n({type:ai}),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:ii}),r.next=19;break;case 16:r.prev=16,r.t0=r.catch(4),n({type:si,errorData:lt(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 hi})),e.serviceFactory("tagDeleted",(function(){return Ys})),e.serviceFactory("tagEdited",(function(){return ci})),e.serviceFactory("deleteTag",Zs,"buildShlinkApiClient"),e.serviceFactory("editTag",ni,"buildShlinkApiClient","ColorGenerator")},vi=r(312),fi="shlink/mercure/GET_MERCURE_INFO_START",mi="shlink/mercure/GET_MERCURE_INFO_ERROR",pi="shlink/mercure/GET_MERCURE_INFO",xi=et((Ye={},Object(u.a)(Ye,fi,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!0,error:!1})})),Object(u.a)(Ye,mi,(function(e){return Object(d.a)(Object(d.a)({},e),{},{loading:!1,error:!0})})),Object(u.a)(Ye,pi,(function(e,t){return Object(d.a)(Object(d.a)({},t),{},{loading:!1,error:!1})})),Ye),{loading:!0,error:!1}),gi=function(e){return function(){return function(){var t=Object(p.a)(m.a.mark((function t(r,n){var c,a,s,i,o;return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r({type:fi}),c=n(),a=c.settings,s=e(n),i=s.mercureInfo,a.realTimeUpdates.enabled){t.next=6;break}return r({type:mi}),t.abrupt("return");case 6:return t.prev=6,t.next=9,i();case 9:o=t.sent,r(Object(d.a)({type:pi,interval:a.realTimeUpdates.interval},o)),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),r({type:mi});case 16:case"end":return t.stop()}}),t,null,[[6,13]])})));return function(e,r){return t.apply(this,arguments)}}()}},Si=function(e){e.serviceFactory("loadMercureInfo",gi,"buildShlinkApiClient")},yi=function(e){var t,r=e.settings.realTimeUpdates,n=e.toggleRealTimeUpdates,c=e.setRealTimeUpdatesInterval;return Object(a.jsxs)(wr.a,{title:"Real-time updates",className:"h-100",children:[Object(a.jsx)(Lr.a,{children:Object(a.jsxs)(ea,{checked:r.enabled,onChange:n,children:["Enable or disable real-time updates, when using Shlink v2.2.0 or newer.",Object(a.jsxs)("small",{className:"form-text text-muted",children:["Real-time updates are currently being ",Object(a.jsx)("b",{children:r.enabled?"processed":"ignored"}),"."]})]})}),Object(a.jsxs)(Lr.a,{className:"mb-0",children:[Object(a.jsx)("label",{className:P()({"text-muted":!r.enabled}),children:"Real-time updates frequency (in minutes):"}),Object(a.jsx)(Gr.a,{type:"number",min:0,placeholder:"Immediate",disabled:!r.enabled,value:(t=r.interval,t?"".concat(t):""),onChange:function(e){return c(Number(e.target.value))}}),r.enabled&&Object(a.jsxs)("small",{className:"form-text text-muted",children:[void 0!==r.interval&&r.interval>0&&Object(a.jsxs)("span",{children:["Updates will be reflected in the UI every ",Object(a.jsx)("b",{children:r.interval})," minute",r.interval>1&&"s","."]}),!r.interval&&"Updates will be reflected in the UI as soon as they happen."]})]})]})},Ci=function(e){var t=e.items;return Object(a.jsx)(a.Fragment,{children:t.map((function(e,t){return Object(a.jsx)(kr.a,{children:e.map((function(e,t){return Object(a.jsx)("div",{className:"col-lg-6 mb-3",children:e},t)}))},t)}))})},Ni=function(e,t,r,n){return function(){return Object(a.jsx)(dn.a,{children:Object(a.jsx)(Ci,{items:[[Object(a.jsx)(r,{}),Object(a.jsx)(n,{})],[Object(a.jsx)(t,{}),Object(a.jsx)(e,{})]]})})}},ki=r(709),wi="shlink/realTimeUpdates/SET_SETTINGS",_i=et(Object(u.a)({},wi,(function(e,t){return Object(ki.a)(e,Object(Dn.a)("type",t))})),{realTimeUpdates:{enabled:!0},shortUrlCreation:{validateUrls:!1},ui:{theme:"light"},visits:{defaultInterval:"last30Days"}}),Ui=function(e){return{type:wi,realTimeUpdates:{enabled:e}}},Ti=function(e){return{type:wi,realTimeUpdates:{interval:e}}},Ri=function(e){return{type:wi,shortUrlCreation:e}},Di=function(e){return{type:wi,ui:e}},Ei=function(e){return{type:wi,visits:e}},Li=function(e){return"includes"===e?"Suggest tags including input":"Suggest tags starting with input"},Vi=function(e){var t,r,n,c=e.settings,s=e.setShortUrlCreationSettings,i=null!==(t=c.shortUrlCreation)&&void 0!==t?t:{validateUrls:!1},o=function(e){return function(){return s(Object(d.a)(Object(d.a)({},null!==i&&void 0!==i?i:{validateUrls:!1}),{},{tagFilteringMode:e}))}};return Object(a.jsxs)(wr.a,{title:"Short URLs creation",className:"h-100",children:[Object(a.jsx)(Lr.a,{children:Object(a.jsxs)(ea,{checked:null!==(r=i.validateUrls)&&void 0!==r&&r,onChange:function(e){return s(Object(d.a)(Object(d.a)({},i),{},{validateUrls:e}))},children:["By default, request validation on long URLs when creating new short URLs.",Object(a.jsxs)("small",{className:"form-text text-muted",children:["The initial state of the ",Object(a.jsx)("b",{children:"Validate URL"})," checkbox will be ",Object(a.jsx)("b",{children:i.validateUrls?"checked":"unchecked"}),"."]})]})}),Object(a.jsxs)(Lr.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Tag suggestions search mode:"}),Object(a.jsxs)(J,{text:Li(i.tagFilteringMode),children:[Object(a.jsx)(W.a,{active:!i.tagFilteringMode||"startsWith"===i.tagFilteringMode,onClick:o("startsWith"),children:Li("startsWith")}),Object(a.jsx)(W.a,{active:"includes"===i.tagFilteringMode,onClick:o("includes"),children:Li("includes")})]}),Object(a.jsx)("small",{className:"form-text text-muted",children:(n=i.tagFilteringMode,"includes"===n?Object(a.jsxs)(a.Fragment,{children:["The list of suggested tags will contain existing ones ",Object(a.jsx)("b",{children:"including"})," provided input."]}):Object(a.jsxs)(a.Fragment,{children:["The list of suggested tags will contain existing ones ",Object(a.jsx)("b",{children:"starting with"})," provided input."]}))})]})]})},Ii=function(e){var t=e.settings.ui,r=e.setUiSettings;return Object(a.jsxs)(wr.a,{title:"User interface",className:"h-100",children:[Object(a.jsx)(F.a,{icon:"dark"===(null===t||void 0===t?void 0:t.theme)?I.y:I.J,className:"user-interface__theme-icon"}),Object(a.jsx)(ea,{checked:"dark"===(null===t||void 0===t?void 0:t.theme),onChange:function(e){var t=e?"dark":"light";r({theme:t}),Object(Ec.g)(t)},children:"Use dark theme."})]})},Fi=function(e){var t,r=e.onChange,n=e.active;return Object(a.jsx)(J,{text:null!==(t=ue(n))&&void 0!==t?t:"",children:Object(a.jsx)(me,{active:n,onChange:r})})},Ai=function(e){var t,r,n=e.settings,c=e.setVisitsSettings;return Object(a.jsx)(wr.a,{title:"Visits",className:"h-100",children:Object(a.jsxs)(Lr.a,{className:"mb-0",children:[Object(a.jsx)("label",{children:"Default interval to load on visits sections:"}),Object(a.jsx)(Fi,{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})}})]})})},Mi=function(e,t){e.serviceFactory("Settings",Ni,"RealTimeUpdates","ShortUrlCreation","UserInterface","Visits"),e.decorator("Settings",Jn.a),e.decorator("Settings",t(null,["resetSelectedServer"])),e.serviceFactory("RealTimeUpdates",(function(){return yi})),e.decorator("RealTimeUpdates",t(["settings"],["toggleRealTimeUpdates","setRealTimeUpdatesInterval"])),e.serviceFactory("ShortUrlCreation",(function(){return Vi})),e.decorator("ShortUrlCreation",t(["settings"],["setShortUrlCreationSettings"])),e.serviceFactory("UserInterface",(function(){return Ii})),e.decorator("UserInterface",t(["settings"],["setUiSettings"])),e.serviceFactory("Visits",(function(){return Ai})),e.decorator("Visits",t(["settings"],["setVisitsSettings"])),e.serviceFactory("toggleRealTimeUpdates",(function(){return Ui})),e.serviceFactory("setRealTimeUpdatesInterval",(function(){return Ti})),e.serviceFactory("setShortUrlCreationSettings",(function(){return Ri})),e.serviceFactory("setUiSettings",(function(){return Di})),e.serviceFactory("setVisitsSettings",(function(){return Ei}))},Gi="shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS",Pi=function(e){return function(t,r){return function(){var n=Object(p.a)(m.a.mark((function n(c,a){var s,i,o;return m.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c({type:"shlink/domainRedirects/EDIT_DOMAIN_REDIRECTS_START"}),s=e(a),i=s.editDomainRedirects,n.prev=2,n.next=5,i(Object(d.a)({domain:t},r));case 5:o=n.sent,c({type:Gi,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:lt(n.t0)});case 12:case"end":return n.stop()}}),n,null,[[2,9]])})));return function(e,t){return n.apply(this,arguments)}}()}},Bi="shlink/domainsList/LIST_DOMAINS_START",Hi="shlink/domainsList/LIST_DOMAINS_ERROR",Wi="shlink/domainsList/LIST_DOMAINS",qi="shlink/domainsList/FILTER_DOMAINS",zi={domains:[],filteredDomains:[],loading:!1,error:!1},Ki=function(e,t){return function(r){return r.domain!==e?r:Object(d.a)(Object(d.a)({},r),{},{redirects:t})}},Qi=et((Xe={},Object(u.a)(Xe,Bi,(function(){return Object(d.a)(Object(d.a)({},zi),{},{loading:!0})})),Object(u.a)(Xe,Hi,(function(e){var t=e.errorData;return Object(d.a)(Object(d.a)({},zi),{},{error:!0,errorData:t})})),Object(u.a)(Xe,Wi,(function(e,t){var r=t.domains;return Object(d.a)(Object(d.a)({},zi),{},{domains:r,filteredDomains:r})})),Object(u.a)(Xe,qi,(function(e,t){var r=t.searchTerm;return Object(d.a)(Object(d.a)({},e),{},{filteredDomains:e.domains.filter((function(e){return e.domain.toLowerCase().match(r)}))})})),Object(u.a)(Xe,Gi,(function(e,t){var r=t.domain,n=t.redirects;return Object(d.a)(Object(d.a)({},e),{},{domains:e.domains.map(Ki(r,n)),filteredDomains:e.filteredDomains.map(Ki(r,n))})})),Xe),zi),Ji=function(e){return function(){return function(){var t=Object(p.a)(m.a.mark((function t(r,n){var c,a,s;return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r({type:Bi}),c=e(n),a=c.listDomains,t.prev=2,t.next=5,a();case 5:s=t.sent,r({type:Wi,domains:s}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),r({type:Hi,errorData:lt(t.t0)});case 12:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e,r){return t.apply(this,arguments)}}()}},Zi=function(e){return{type:qi,searchTerm:e}},Yi=r(704),Xi=r(714),$i=function(e){var t=e.listDomains,r=e.value,n=e.domainsList,c=e.onChange,s=Object(Q.c)(),i=Object(E.a)(s,4),o=i[0],l=i[2],u=i[3],d=n.domains,j=Object(N.a)(r),b=function(){return c("")};return Object(L.useEffect)((function(){t()}),[]),o?Object(a.jsxs)(Yi.a,{children:[Object(a.jsx)(Gr.a,{value:r,placeholder:"Domain",onChange:function(e){return c(e.target.value)}}),Object(a.jsxs)(Xi.a,{addonType:"append",children:[Object(a.jsx)(Vr.a,{id:"backToDropdown",outline:!0,type:"button",className:"domains-dropdown__back-btn",onClick:Object(A.a)(b,u),children:Object(a.jsx)(F.a,{icon:I.O})}),Object(a.jsx)(jr.a,{target:"backToDropdown",placement:"left",trigger:"hover",children:"Existing domains"})]})]}):Object(a.jsxs)(J,{text:j?"Domain":"Domain: ".concat(r),className:j?"domains-dropdown__toggle-btn":"domains-dropdown__toggle-btn--active",children:[d.map((function(e){var t=e.domain,n=e.isDefault;return Object(a.jsxs)(W.a,{active:r===t||n&&j,onClick:function(){return c(t)},children:[t,n&&Object(a.jsx)("span",{className:"float-right text-muted",children:"default"})]},t)})),Object(a.jsx)(W.a,{divider:!0}),Object(a.jsx)(W.a,{onClick:Object(A.a)(b,l),children:Object(a.jsx)("i",{children:"New domain"})})]})},eo=function(e){var t=e.isLast,r=Object(br.a)(e,["isLast"]);return Object(a.jsx)(jn,Object(d.a)(Object(d.a)({},r),{},{required:!1,type:"url",placeholder:"No redirect",className:t?"mb-0":""}))},to=function(e){var t,r,n,c,s,i,o=e.isOpen,l=e.toggle,u=e.domain,d=e.editDomainRedirects,j=Object(L.useState)(null!==(t=null===(r=u.redirects)||void 0===r?void 0:r.baseUrlRedirect)&&void 0!==t?t:""),b=Object(E.a)(j,2),h=b[0],O=b[1],v=Object(L.useState)(null!==(n=null===(c=u.redirects)||void 0===c?void 0:c.regular404Redirect)&&void 0!==n?n:""),f=Object(E.a)(v,2),x=f[0],g=f[1],S=Object(L.useState)(null!==(s=null===(i=u.redirects)||void 0===i?void 0:i.invalidShortUrlRedirect)&&void 0!==s?s:""),y=Object(E.a)(S,2),C=y[0],N=y[1],k=Object(Ue.b)(Object(p.a)(m.a.mark((function e(){return m.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",d(u.domain,{baseUrlRedirect:Object(Ue.d)(h),regular404Redirect:Object(Ue.d)(x),invalidShortUrlRedirect:Object(Ue.d)(C)}).then(l));case 1:case"end":return e.stop()}}),e)}))));return Object(a.jsx)(gr.a,{isOpen:o,toggle:l,centered:!0,children:Object(a.jsxs)("form",{onSubmit:k,children:[Object(a.jsxs)(Sr.a,{toggle:l,children:["Edit redirects for ",Object(a.jsx)("b",{children:u.domain})]}),Object(a.jsxs)(yr.a,{children:[Object(a.jsxs)(eo,{value:h,onChange:O,children:[Object(a.jsxs)(Qr,{className:"mr-2",placement:"bottom",children:["Visitors accessing the base url, as in ",Object(a.jsxs)("b",{children:["https://",u.domain,"/"]}),", will be redirected to this URL."]}),"Base URL"]}),Object(a.jsxs)(eo,{value:x,onChange:g,children:[Object(a.jsxs)(Qr,{className:"mr-2",placement:"bottom",children:["Visitors accessing a url not matching a short URL pattern, as in ",Object(a.jsxs)("b",{children:["https://",u.domain,"/???/[...]"]}),", will be redirected to this URL."]}),"Regular 404"]}),Object(a.jsxs)(eo,{value:C,isLast:!0,onChange:N,children:[Object(a.jsx)(Qr,{className:"mr-2",placement:"bottom",children:"Visitors accessing a url matching a short URL pattern, but not matching an existing short code, will be redirected to this URL."}),"Invalid short URL"]})]}),Object(a.jsxs)(Cr.a,{children:[Object(a.jsx)(Vr.a,{color:"link",type:"button",onClick:l,children:"Cancel"}),Object(a.jsx)(Vr.a,{color:"primary",children:"Save"})]})]})})},ro=function(e){var t=e.fallback;return Object(a.jsxs)("span",{className:"text-muted",children:[!t&&Object(a.jsx)("small",{children:"No redirect"}),t&&Object(a.jsxs)(a.Fragment,{children:[t," ",Object(a.jsx)("small",{children:"(as fallback)"})]})]})},no=function(){return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(F.a,{icon:I.h,className:"text-primary",id:"defaultDomainIcon"}),Object(a.jsx)(jr.a,{target:"defaultDomainIcon",placement:"right",children:"Default domain"})]})},co=function(e){var t,r,n,c=e.domain,s=e.editDomainRedirects,i=e.defaultRedirects,o=Object(Q.c)(),l=Object(E.a)(o,2),u=l[0],d=l[1],j=c.domain,b=c.isDefault,h=c.redirects,O="domainEdit".concat(j.replace(".",""));return Object(a.jsxs)("tr",{className:"responsive-table__row",children:[Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Is default domain",children:b?Object(a.jsx)(no,{}):""}),Object(a.jsx)("th",{className:"responsive-table__cell","data-th":"Domain",children:j}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Base path redirect",children:null!==(t=null===h||void 0===h?void 0:h.baseUrlRedirect)&&void 0!==t?t:Object(a.jsx)(ro,{fallback:null===i||void 0===i?void 0:i.baseUrlRedirect})}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Regular 404 redirect",children:null!==(r=null===h||void 0===h?void 0:h.regular404Redirect)&&void 0!==r?r:Object(a.jsx)(ro,{fallback:null===i||void 0===i?void 0:i.regular404Redirect})}),Object(a.jsx)("td",{className:"responsive-table__cell","data-th":"Invalid short URL redirect",children:null!==(n=null===h||void 0===h?void 0:h.invalidShortUrlRedirect)&&void 0!==n?n:Object(a.jsx)(ro,{fallback:null===i||void 0===i?void 0:i.invalidShortUrlRedirect})}),Object(a.jsxs)("td",{className:"responsive-table__cell text-right",children:[Object(a.jsx)("span",{id:O,children:Object(a.jsx)(Vr.a,{outline:!0,size:"sm",disabled:b,onClick:b?void 0:d,children:Object(a.jsx)(F.a,{icon:b?I.b:I.m})})}),b&&Object(a.jsxs)(jr.a,{target:O,placement:"left",children:["Redirects for default domain cannot be edited here.",Object(a.jsx)("br",{}),"Use config options or env vars directly on the server."]})]}),Object(a.jsx)(to,{domain:c,isOpen:u,toggle:d,editDomainRedirects:s})]})},ao=["","Domain","Base path redirect","Regular 404 redirect","Invalid short URL redirect",""],so=function(e){var t,r=e.listDomains,n=e.domainsList,c=e.filterDomains,s=e.editDomainRedirects,i=n.filteredDomains,o=n.loading,l=n.error,u=n.errorData,d=null===(t=i.find((function(e){return e.isDefault})))||void 0===t?void 0:t.redirects;if(Object(L.useEffect)((function(){r()}),[]),o)return Object(a.jsx)($r.a,{loading:!0});return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(B,{className:"mb-3",onChange:c}),l?Object(a.jsx)(_r,{type:"error",children:Object(a.jsx)(Ur,{errorData:u,fallbackMessage:"Error loading domains :("})}):Object(a.jsx)(wr.a,{children:Object(a.jsxs)("table",{className:"table table-hover mb-0",children:[Object(a.jsx)("thead",{className:"responsive-table__header",children:Object(a.jsx)("tr",{children:ao.map((function(e,t){return Object(a.jsx)("th",{children:e},t)}))})}),Object(a.jsxs)("tbody",{children:[i.length<1&&Object(a.jsx)("tr",{children:Object(a.jsx)("td",{colSpan:ao.length,className:"text-center",children:"No results found"})}),i.map((function(e){return Object(a.jsx)(co,{domain:e,editDomainRedirects:s,defaultRedirects:d},e.domain)}))]})]})})]})},io=function(e,t){e.serviceFactory("DomainSelector",(function(){return $i})),e.decorator("DomainSelector",t(["domainsList"],["listDomains"])),e.serviceFactory("ManageDomains",(function(){return so})),e.decorator("ManageDomains",t(["domainsList"],["listDomains","filterDomains","editDomainRedirects"])),e.serviceFactory("listDomains",Ji,"buildShlinkApiClient"),e.serviceFactory("filterDomains",(function(){return Zi})),e.serviceFactory("editDomainRedirects",Pi,"buildShlinkApiClient")},oo="shlink/appUpdates/APP_UPDATE_AVAILABLE",lo="shlink/appUpdates/RESET_APP_UPDATE",uo=et(($e={},Object(u.a)($e,oo,(function(){return!0})),Object(u.a)($e,lo,(function(){return!1})),$e),!1),jo=tt(oo),bo=tt(lo),ho=r(152),Oo=r(705),vo=function(e){var t=e.isOpen,r=e.toggle,n=e.forceUpdate,c=Object(Q.c)(),s=Object(E.a)(c,3),i=s[0],o=s[2];return Object(a.jsxs)(Oo.a,{className:"app-update-banner",isOpen:t,toggle:r,tag:wr.a,color:"secondary",children:[Object(a.jsx)("h4",{className:"mb-4",children:"This app has just been updated!"}),Object(a.jsxs)("p",{className:"mb-0",children:["Restart it to enjoy the new features.",Object(a.jsxs)(Vr.a,{disabled:i,className:"ml-2",color:"secondary",size:"sm",onClick:function(){o(),n()},children:[!i&&Object(a.jsxs)(a.Fragment,{children:["Restart now ",Object(a.jsx)(F.a,{icon:I.K,className:"ml-1"})]}),i&&Object(a.jsx)(a.Fragment,{children:"Restarting..."})]})]})]})},fo=r(315),mo=function(){var e=Object(p.a)(m.a.mark((function e(){var t,r,n,c,a,s,i;return m.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(fo.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)}}(),po=function(e,t,r,n,c,s,i){return function(o){var l=o.fetchServers,u=o.servers,d=o.settings,j=o.appUpdated,h=o.resetAppUpdate;return Object(L.useEffect)((function(){var e,t;0===Object.keys(u).length&&l(),Object(Ec.g)(null!==(e=null===(t=d.ui)||void 0===t?void 0:t.theme)&&void 0!==e?e:"light")}),[]),Object(a.jsxs)("div",{className:"container-fluid app-container",children:[Object(a.jsx)(e,{}),Object(a.jsxs)("div",{className:"app",children:[Object(a.jsx)("div",{className:"shlink-wrapper",children:Object(a.jsxs)(b.d,{children:[Object(a.jsx)(b.b,{exact:!0,path:"/",component:t}),Object(a.jsx)(b.b,{exact:!0,path:"/settings",component:s}),Object(a.jsx)(b.b,{exact:!0,path:"/server/create",component:n}),Object(a.jsx)(b.b,{exact:!0,path:"/server/:serverId/edit",component:c}),Object(a.jsx)(b.b,{path:"/server/:serverId",component:r}),Object(a.jsx)(b.b,{component:ho.a})]})}),Object(a.jsx)("div",{className:"shlink-footer",children:Object(a.jsx)(i,{})})]}),Object(a.jsx)(vo,{isOpen:j,toggle:h,forceUpdate:mo})]})}},xo=function(e,t){e.serviceFactory("App",po,"MainHeader","Home","MenuLayout","CreateServer","EditServer","Settings","ShlinkVersionsContainer"),e.decorator("App",t(["servers","settings","appUpdated"],["fetchServers","resetAppUpdate"])),e.serviceFactory("appUpdateAvailable",(function(){return jo})),e.serviceFactory("resetAppUpdate",(function(){return bo}))},go=new j.a,So=go.container,yo=function(e,t){return Object(d.a)(Object(d.a)({},e),{},Object(u.a)({},t,function(e,t){return function(){return e[t].apply(e,arguments)}}(So,t)))},Co=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Object(i.b)(e?Object(h.a)(e):null,t.reduce(yo,{}))};xo(go,Co),Object(D.a)(go,Co,b.h),R(go),on(go,Co),sc(go,Co,b.h),Oi(go,Co),Rs(go,Co),Object(vi.a)(go),Si(go),Mi(go,Co),io(go,Co);var No=So,ko=r(316),wo=r(73),_o=r(225),Uo=Object(wo.c)({servers:An,selectedServer:Un,shortUrlsList:It,shortUrlsListParams:Pt,shortUrlCreationResult:Ct,shortUrlDeletion:vt,shortUrlEdition:Rt,shortUrlVisits:Za,tagVisits:os,orphanVisits:xs,shortUrlDetail:an,tagsList:bi,tagDelete:Js,tagEdit:ri,mercureInfo:xi,settings:_i,domainsList:Qi,visitsOverview:_s,appUpdated:uo}),To=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||wo.d,Ro={states:["settings","servers"],namespace:"shlink",namespaceSeparator:".",debounce:300},Do=Object(wo.e)(Uo,Object(_o.load)(Ro),To(Object(wo.a)(Object(_o.save)(Ro),ko.a))),Eo=r(57),Lo=r.n(Eo),Vo=r(317),Io=r(318),Fo=r(319),Ao=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 Mo(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(631),r(632);delete Lo.a.Icon.Default.prototype._getIconUrl,Lo.a.Icon.Default.mergeOptions({iconRetinaUrl:Vo.a,iconUrl:Io.a,shadowUrl:Fo.a});var Go=No.App,Po=No.ScrollToTop,Bo=No.ErrorHandler,Ho=No.appUpdateAvailable;Object(s.render)(Object(a.jsx)(i.a,{store:Do,children:Object(a.jsx)(o.a,{basename:l.a,children:Object(a.jsx)(Bo,{children:Object(a.jsx)(Po,{children:Object(a.jsx)(Go,{})})})})}),document.getElementById("root")),function(e){if("serviceWorker"in navigator){var t;if(new URL(null!==(t="/shlink-web-client")?t:"",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var t="".concat("/shlink-web-client","/service-worker.js");Ao?(!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()}))})):Mo(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")}))):Mo(t,e)}))}}({onUpdate:function(){Do.dispatch(Ho())}})},97:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(0),a=r(1);function s(e){return function(t){return Object(a.useEffect)((function(){t.resetSelectedServer()}),[]),Object(c.jsx)(e,Object(n.a)({},t))}}},98: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)}}},[[335,1,2]]]);
|
|
//# sourceMappingURL=main.f279ce4b.chunk.js.map
|