| Server IP : 216.238.66.20 / Your IP : 216.73.216.199 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/plugins/redirection/build/ |
Upload File : |
/*! Redirection v5.9.0 - please refer to license.txt for license information */
(()=>{var e={872(e,t,r){"use strict";const n=window.ReactDOM,i=window.wp.i18n;var o=r(609),s=r.t(o,2),a=r.n(o);const l=window.ReactJSXRuntime;var c=o.createContext(void 0),u=e=>{const t=o.useContext(c);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},d=({client:e,children:t})=>(o.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,l.jsx)(c.Provider,{value:e,children:t}));function p(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=p(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}const h=function(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=p(e))&&(n&&(n+=" "),n+=t);return n};function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(null,arguments)}function m(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}var g=o.useLayoutEffect,_=function(e,t){"function"!=typeof e?e.current=t:e(t)},y={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},v=function(e){Object.keys(y).forEach(function(t){e.style.setProperty(t,y[t],"important")})},b=null,x=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-t.paddingSize},w=function(){},j=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],S=!!document.documentElement.currentStyle;function k(e,t,r){var n,i,s=(n=r,i=a().useRef(n),g(function(){i.current=n}),i);o.useLayoutEffect(function(){var r=function(e){return s.current(e)};if(e)return e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}},[])}var C=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],T=function(e,t){var r,n=e.cacheMeasurements,i=e.maxRows,s=e.minRows,l=e.onChange,c=void 0===l?w:l,u=e.onHeightChange,d=void 0===u?w:u,p=m(e,C),h=void 0!==p.value,g=o.useRef(null),y=function(e,t){var r=a().useRef();return a().useCallback(function(n){e.current=n,r.current&&_(r.current,null),r.current=t,t&&_(t,n)},[t])}(g,t),T=o.useRef(0),E=o.useRef(),R=function(){var e=g.current,t=n&&E.current?E.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r,n=(r=t,j.reduce(function(e,t){return e[t]=r[t],e},{})),i=n.boxSizing;return""===i?null:(S&&"border-box"===i&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px"),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})}(e);if(t){E.current=t;var r=function(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=1/0),b||((b=document.createElement("textarea")).setAttribute("tabindex","-1"),b.setAttribute("aria-hidden","true"),v(b)),null===b.parentNode&&document.body.appendChild(b);var i=e.paddingSize,o=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(e){var t=e;b.style[t]=s[t]}),v(b),b.value=t;var l=x(b,e);b.value=t,l=x(b,e),b.value="x";var c=b.scrollHeight-i,u=c*r;"border-box"===a&&(u=u+i+o),l=Math.max(u,l);var d=c*n;return"border-box"===a&&(d=d+i+o),[l=Math.min(d,l),c]}(t,e.value||e.placeholder||"x",s,i),o=r[0],a=r[1];T.current!==o&&(T.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:a}))}};return o.useLayoutEffect(R),function(e,t){k(document.body,"reset",function(r){e.current.form===r.target&&t()})}(g,function(){if(!h){var e=g.current.value;requestAnimationFrame(function(){var t=g.current;t&&e!==t.value&&R()})}}),k(window,"resize",R),r=R,k(document.fonts,"loadingdone",r),o.createElement("textarea",f({},p,{onChange:function(e){h||R(),c(e)},ref:y}))},E=o.forwardRef(T);const R=function(e){const{error:t,mini:r,context:n,renderDebug:s,versions:a,noParse:c=!1,details:u=[],locale:d}=e,[p,h]=(0,o.useState)(!r);if(!p)return(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button button-secondary",type:"button",onClick:()=>h(!0),children:(0,i.__)("Show debug",d)})});const f=c?[t]:function(e,t,r){const n=t?[t]:[],{request:i=!1,data:o}=e;n.push("");const{apiFetch:s}=i||{};s&&s.status&&s.statusText&&(n.push("Action: "+s.action),s.body&&"{}"!==s.body&&n.push("Params: "+s.body),n.push("Code: "+s.status+" "+s.statusText),n.push(""));const a=function(e){if("string"==typeof e)return e;const t=e;return 0===t.code?t.message:t.data&&t.data.wpdb?`${t.message} (${t.code}): ${t.data.wpdb}`:t.code?`${t.message} (${t.code})`:t.message}(e);return"string"==typeof a&&a.length>0&&n.push("Error: "+a),o&&n.push("Raw: "+o),r&&(n.push(""),n.push("Context:"),n.push(r)),n}(t,a,n);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Debug Information",d)}),s&&s(u.concat(f).join("\n")),(0,l.jsx)("p",{children:(0,l.jsx)(E,{readOnly:!0,cols:120,value:u.concat(f).join("\n"),maxRows:40,spellCheck:!1})})]})},P=function(e){const{locale:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("You are using an old or cached session",t)}),(0,l.jsx)("p",{children:(0,i.__)("This is usually fixed by doing one of the following:",t)}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:(0,i.__)("Reload the page - your current session is old.",t)}),(0,l.jsx)("li",{children:(0,i.__)("Log out, clear your browser cache, and log in again - your browser has cached an old session.",t)}),(0,l.jsx)("li",{children:(0,i.__)("Your admin pages are being cached. Clear this cache and try again. There may be multiple caches involved.",t)})]}),(0,l.jsx)(R,{...e,error:e.error||{},mini:!0})]})},N=({url:e,children:t,title:r,className:n})=>(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:r,className:n,children:t});function O(e){return 404===e?.request?.apiFetch?.status}function A(e){const t=e.code;return"disabled"===t||"rest_disabled"===t}function I(e){return"rest_api_redirected"===e?.code}function F(e){const t=e;return 0===t.code?t.message:t.data&&t.data.wpdb?(0,l.jsxs)("span",{children:[`${t.message} (${t.code})`,": ",(0,l.jsx)("code",{children:t.data.wpdb})]}):t.code?(0,l.jsxs)(l.Fragment,{children:[t.message," (",(0,l.jsx)("code",{children:t.code}),")"]}):t.message}const D=window.wp.element;function L(e,t){try{return(0,D.createInterpolateElement)(e.replace(/\{\{/g,"<").replace(/\}\}/g,">"),t)}catch(t){return e}}const z=({error:e,links:t,locale:r})=>{if("string"==typeof e)return(0,l.jsx)("p",{children:e});if(function(e){return void 0!==e.code&&0===e.code}(e))return(0,l.jsx)("p",{children:(0,i.__)("WordPress did not return a response. This could mean an error occurred or that the request was blocked. Please check your server error_log.",r)});if(function(e){const t=e,{request:r,code:n}=t;return!!(r&&r.status&&n)&&(-1!==[400,401,403,405].indexOf(r.status)||"rest_no_route"===n)&&0===parseInt(String(n),10)}(e))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("Your REST API is probably being blocked by a security plugin. Please disable this, or configure it to allow REST API requests.",r)}),(0,l.jsx)("p",{children:(0,l.jsx)(N,{url:t.api,children:(0,i.__)("Read this REST API guide for more information.",r)})})]});if(O(e))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("Your WordPress REST API is returning a 404 page. This is almost certainly an external plugin or server configuration issue.",r)}),(0,l.jsx)("p",{className:"wpl-error__highlight",children:(0,l.jsx)("strong",{children:(0,i.__)("You will will need to fix this on your site. Redirection is not causing the error.",r)})}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:L((0,i.__)("Can you access your {{api}}REST API{{/api}} without it redirecting?",r),{api:(0,l.jsx)(N,{url:t.rootUrl,children:t.rootUrl})})}),(0,l.jsx)("li",{children:L((0,i.__)("Check your {{link}}Site Health{{/link}} and fix any issues.",r),{link:(0,l.jsx)(N,{url:t.siteHealth,children:t.siteHealth})})}),(0,l.jsx)("li",{children:(0,i.__)("Your server configuration is blocking access to the REST API.",r)}),(0,l.jsx)("li",{children:(0,i.__)("A security plugin or firewall is blocking access. You will need to whitelist the REST API.",r)})]}),(0,l.jsx)("p",{children:(0,l.jsx)(N,{url:t.api,children:(0,i.__)("Read this REST API guide for more information.",r)})})]});if(I(e))return(0,l.jsx)("p",{children:(0,i.__)("Your REST API is being redirected. Please remove the redirection for the API.",r)});if(function(e){return"rest_api_cors_mismatch"===e?.code}(e)){const t=e?.request?.origins?.current,n=e?.request?.origins?.test;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("This admin page is loaded from a different origin than the REST API URL that WordPress is advertising. The browser will block the request until both use the same protocol, host, and port.",r)}),t&&n&&(0,l.jsxs)("ul",{children:[(0,l.jsxs)("li",{children:[(0,i.__)("Current admin page origin:",r)," ",(0,l.jsx)("code",{children:t})]}),(0,l.jsxs)("li",{children:[(0,i.__)("REST API origin:",r)," ",(0,l.jsx)("code",{children:n})]})]}),(0,l.jsx)("p",{children:(0,i.__)("Check your WordPress URL and Site URL settings, and make sure any local proxy or port-forwarded admin URL matches the REST API URL.",r)})]})}if(function(e){return 413===e?.request?.apiFetch?.status}(e))return(0,l.jsx)("p",{children:(0,i.__)("Your server has rejected the request for being too big. You will need to reconfigure it to continue.",r)});if(function(e){return void 0===e.message}(e))return(0,l.jsx)("p",{children:(0,i.__)("An unknown error occurred.",r)});if(function(e){const t=e.data;return"string"==typeof t&&-1!==t.indexOf("<b>Deprecated</b>: Directive")}(e))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("Your REST API is showing a deprecated PHP error. Please fix this error.",r)})]});if(function(e){return-1!==[500,502,503].indexOf(e?.request?.apiFetch?.status??0)}(e))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("This could be a security plugin, or your server is out of memory or has an external error. Please check your server error log",r)}),(0,l.jsx)("p",{children:(0,l.jsx)(N,{url:t.http,children:(0,i.__)("Read this REST API guide for more information.",r)})})]});if(A(e))return(0,l.jsx)("p",{children:(0,i.__)("Your WordPress REST API has been disabled. You will need to enable it to continue.",r)});if(function(e){return"SyntaxError"===e.code}(e)){const t=function(e){const t=e.lastIndexOf("}");if(t!==e.length)return e.substring(t+1).trim();const r=e.split("<br />").filter(e=>e);return r.slice(0,r.length-1).join(" ").trim()}(e?.request?.apiFetch?.body||"");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("WordPress returned an unexpected message. This could be a PHP error from another plugin, or data inserted by your theme.",r)}),t.length>1&&(0,l.jsxs)("p",{children:[(0,l.jsxs)("strong",{children:[(0,i.__)("Possible cause",r),":"]})," ",(0,l.jsx)("code",{children:t.slice(0,1e3)})]})]})}return function(e){const t=e?.message?.toString().toLowerCase();return!!t&&("failed to fetch"===t||"not allowed to request resource"===t||-1!==t.indexOf("networkerror"))}(e)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("Unable to make request due to browser security. This is typically because your WordPress and Site URL settings are inconsistent, or the request was blocked by your site CORS policy.",r)}),(0,l.jsx)("p",{children:(0,l.jsx)(N,{url:t.url,children:(0,i.__)("Read this REST API guide for more information.",r)})})]}):function(e){const{headers:t}=e.request??{};if(t&&Symbol.iterator in Object(t))for(const[e]of t)if(-1!==e.toLowerCase().indexOf("cf-"))return!0;return!1}(e)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:F(e)}),(0,l.jsx)("p",{children:(0,i.__)("Your REST API appears to be cached and this will cause problems. Please exclude your REST API from your caching system.",r)})]}):(0,l.jsx)("p",{children:F(e)})};function M(e,t,r){return O(e)?(0,i.__)("REST API 404"):t||(0,i.__)("Something went wrong 🙁",r)}const $=function(e){const{title:t,children:r,error:n,links:i,locale:o}=e,s=function(e){return!O(e)&&!I(e)&&!A(e)}(n),a=function(e){return!!O(e)||!!I(e)||!!A(e)}(n),c=!O(n);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:M(n,t,o)}),(0,l.jsx)("div",{className:"wpl-error__title",children:(0,l.jsx)(z,{error:n,links:i,locale:o})}),s&&r,(0,l.jsx)(R,{error:n,locale:o,...a?{mini:!0}:{},...!c&&e.renderDebug?{renderDebug:e.renderDebug}:{},...e.details?{details:e.details}:{},...e.versions?{versions:e.versions}:{},...e.context?{context:e.context}:{}})]})},U=function(e){const{title:t,children:r,error:n,links:o,locale:s}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:t||(0,i.__)("Something went wrong 🙁",s)}),(0,l.jsx)("div",{className:"wpl-error__detail",children:(0,l.jsx)(z,{error:n,links:o,locale:s})}),r,(0,l.jsx)(R,{...e})]})},B=function(e){const{title:t,children:r,error:n,links:o,locale:s}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:t||(0,i.__)("Something went wrong 🙁",s)}),(0,l.jsx)("div",{className:"wpl-error__detail",children:(0,l.jsx)(z,{error:n,links:o,locale:s})}),r,(0,l.jsx)(R,{...e})]})},q=function(e){const{locale:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("Bad data",t)}),(0,l.jsx)("p",{children:(0,i.__)("There was a problem making a request to your site. This could indicate you provided data that did not match requirements, or that the plugin sent a bad request.",t)}),(0,l.jsx)("p",{children:(0,i.__)("Please review your data and try again.",t)}),(0,l.jsx)(R,{...e,error:e.error||{},mini:!0})]})};function H({current:e,change:t,total:r}){return(0,l.jsxs)("div",{className:"wpl-error__page",children:[e>0&&(0,l.jsx)("span",{onClick:()=>t(e-1),onKeyDown:r=>{"Enter"!==r.key&&" "!==r.key||(r.preventDefault(),t(e-1))},role:"button",tabIndex:0,children:"←"}),`${e+1}/${r}`,e+1<r&&(0,l.jsx)("span",{onClick:()=>t(e+1),onKeyDown:r=>{"Enter"!==r.key&&" "!==r.key||(r.preventDefault(),t(e+1))},role:"button",tabIndex:0,children:"→"})]})}const W=function(e){const{onClear:t,mini:r=!1,type:n=""}=e,i=(0,o.useMemo)(()=>Array.isArray(e.errors)?e.errors:[e.errors],[e.errors]),[s,a]=(0,o.useState)(0);(0,o.useEffect)(()=>{!r&&i.length>0&&window.scrollTo(0,0)},[i,r]);const c=e=>{"click"!==e.type&&("keydown"!==e.type||"Enter"!==e.key&&" "!==e.key)||("keydown"===e.type&&e.preventDefault(),t&&t())};if(0===i.length)return null;const u=function(e,t){const r=e[0];return"rest_cookie_invalid_nonce"===r?.code?P:400===r?.jsonData?.status?q:"error"===t?U:"fixed"===t?B:$}(i,n);return(0,l.jsxs)("div",{className:h("wpl-error",{"wpl-error__mini":r}),children:[t&&(0,l.jsx)("div",{className:"closer",onClick:c,onKeyDown:c,role:"button",tabIndex:0,children:(0,l.jsx)("span",{className:"dashicons dashicons-no-alt"})}),i.length>1&&(0,l.jsx)(H,{current:s,change:a,total:i.length}),(0,l.jsx)(u,{error:i[s],...e})]})};class G extends o.Component{constructor(e){super(e),this.state={error:!1,stack:null,errorInfo:null}}static getDerivedStateFromError(e){return{error:!0,stack:e}}componentDidCatch(e,t){this.setState({error:!0,stack:e,errorInfo:t}),console.error(e,t)}render(){const{error:e,stack:t,errorInfo:r}=this.state,{renderCrash:n,children:i,extra:o}=this.props;return e?n(t,r,o):i}}const V=G;function Z(){return{url:"https://redirection.me/support/problems/rest-api/#url",http:"https://redirection.me/support/problems/rest-api/#http",api:"https://redirection.me/support/problems/rest-api/",rootUrl:Redirectioni10n.api.WP_API_root,siteHealth:Redirectioni10n.api.site_health}}function Q(){return Redirectioni10n.versions.split("\n").concat(["Query: "+document.location.search])}const K=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>s,subscribe:e=>(r.add(e),()=>r.delete(e))},s=t=e(n,i,o);return o},J=e=>e,Y=e=>{const t=(e=>e?K(e):K)(e),r=e=>function(e,t=J){const r=o.useSyncExternalStore(e.subscribe,o.useCallback(()=>t(e.getState()),[e,t]),o.useCallback(()=>t(e.getInitialState()),[e,t]));return o.useDebugValue(r),r}(t,e);return Object.assign(r,t),r},X=e=>e?Y(e):Y,ee=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,te=new Map,re=e=>{const t=te.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},ne=/.+ (.+) .+/,ie=/^([^@]+)@/;function oe(e){var t,r,n;if(!e)return;const i=e.split("\n"),o=i.findIndex(e=>e.includes("api.setState"));if(o<0)return;const s=(null==(t=i[o+1])?void 0:t.trim())||"";return(null==(r=ne.exec(s))?void 0:r[1])||(null==(n=ie.exec(s))?void 0:n[1])}const se=(e,t={})=>(r,n,i)=>{const{enabled:o,anonymousActionType:s,store:a,...l}=t;let c;try{c=(null==o||o)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!c)return e(r,n,i);const{connection:u,...d}=((e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const n=te.get(r.name);if(n)return{type:"tracked",store:e,...n};const i={connection:t.connect(r),stores:{}};return te.set(r.name,i),{type:"tracked",store:e,...i}})(a,c,l);let p=!0;i.setState=(e,t,o)=>{const c=r(e,t);if(!p)return c;const d=void 0===o?{type:s||oe((new Error).stack)||"anonymous"}:"string"==typeof o?{type:o}:o;return void 0===a?(null==u||u.send(d,n()),c):(null==u||u.send({...d,type:`${a}/${d.type}`},{...re(l.name),[a]:i.getState()}),c)},i.devtools={cleanup:()=>{u&&"function"==typeof u.unsubscribe&&u.unsubscribe(),((e,t)=>{if(void 0===t)return;const r=te.get(e);r&&(delete r.stores[t],0===Object.keys(r.stores).length&&te.delete(e))})(l.name,a)}};const h=(...e)=>{const t=p;p=!1,r(...e),p=t},f=e(i.setState,n,i);if("untracked"===d.type?null==u||u.init(f):(d.stores[d.store]=i,null==u||u.init(Object.fromEntries(Object.entries(d.stores).map(([e,t])=>[e,e===d.store?f:t.getState()])))),ee(i)){let e=!1;const t=i.dispatch;i.dispatch=(...r)=>{"__setState"!==r[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...r)}}return u.subscribe(e=>{var t;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):ae(e.payload,e=>{if("__setState"===e.type){if(void 0===a)return void h(e.state);1!==Object.keys(e.state).length&&console.error('\n [zustand devtools middleware] Unsupported __setState action format.\n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n ');const t=e.state[a];if(null==t)return;return void(JSON.stringify(i.getState())!==JSON.stringify(t)&&h(t))}ee(i)&&i.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return h(f),void 0===a?null==u?void 0:u.init(i.getState()):null==u?void 0:u.init(re(l.name));case"COMMIT":return void 0===a?void(null==u||u.init(i.getState())):null==u?void 0:u.init(re(l.name));case"ROLLBACK":return ae(e.state,e=>{if(void 0===a)return h(e),void(null==u||u.init(i.getState()));h(e[a]),null==u||u.init(re(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ae(e.state,e=>{void 0!==a?JSON.stringify(i.getState())!==JSON.stringify(e[a])&&h(e[a]):h(e)});case"IMPORT_STATE":{const{nextLiftedState:r}=e.payload,n=null==(t=r.computedStates.slice(-1)[0])?void 0:t.state;if(!n)return;return h(void 0===a?n:n[a]),void(null==u||u.send(null,r))}case"PAUSE_RECORDING":return p=!p}return}}),f},ae=(e,t)=>{let r;try{r=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&t(r)};function le(e,t){let r;try{r=e()}catch(e){return}const n={getItem:e=>{var n;const i=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(i):i(o)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)};return n}const ce=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then:e=>ce(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>ce(t)(e)}}},ue={values:null,loadStatus:"idle",saveStatus:!1,error:!1,database:{current:"",next:"",debug:[],reason:"",inProgress:!1,result:"ok",status:"ok",complete:0},showDatabase:!1,api:{routes:{},current:""},apiTest:{},pluginStatus:{status:[],debug:!1}};if("undefined"!=typeof window)try{window.localStorage.removeItem("redirection-settings")}catch(e){}const de=X()(se(e=>({...ue,setValues:t=>e({values:t}),updateValues:t=>e(e=>({values:e.values?{...e.values,...t}:null})),setLoadStatus:t=>e({loadStatus:t}),setSaveStatus:t=>e({saveStatus:t}),setError:t=>e({error:t}),setDatabase:t=>e(e=>({database:{...e.database,...t}})),setShowDatabase:t=>e({showDatabase:t}),setApi:t=>e(e=>({api:{...e.api,...t}})),setApiTest:t=>e(e=>{const r={...e.apiTest};return Object.keys(t).forEach(e=>{t[e]&&(r[e]=t[e])}),{apiTest:r}}),clearApiTest:()=>e({apiTest:{}}),setPluginStatus:t=>e(e=>({pluginStatus:{...e.pluginStatus,...t}})),reset:()=>e(ue)}),{name:"SettingsStore"})),pe=function(e){const t="mailto:john@redirection.me?subject=Redirection%20Error&body="+encodeURIComponent(e),r="https://github.com/johngodley/redirection/issues/new?title=Redirection%20Error&body="+encodeURIComponent("```\n"+e.trim()+"\n```\n\n");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"wpl-error__highlight",children:L((0,i.__)("Please check the {{link}}support site{{/link}} before proceeding further.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/"})})}),(0,l.jsx)("p",{children:L((0,i.__)("If that did not help then {{strong}}create an issue{{/strong}} or send it in an {{strong}}email{{/strong}}.","redirection"),{strong:(0,l.jsx)("strong",{})})}),(0,l.jsxs)("p",{children:[(0,l.jsx)("a",{href:r,className:"button-primary",children:(0,i.__)("Create An Issue","redirection")})," ",(0,l.jsx)("a",{href:t,className:"button-secondary",children:(0,i.__)("Email","redirection")})]}),(0,l.jsx)("p",{children:(0,i.__)("Include these details in your report along with a description of what you were doing and a screenshot.","redirection")})]})};function he({setStep:e,setOptions:t}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("Welcome to Redirection 🚀🎉","redirection")}),(0,l.jsx)("p",{children:(0,i.sprintf)(
// translators: %(version)s is the plugin version number
// translators: %(version)s is the plugin version number
(0,i.__)("Thank you for installing and using Redirection v%(version)s. This plugin will allow you to manage 301 redirections, keep track of 404 errors, and improve your site, with no knowledge of Apache or Nginx needed.","redirection"),{version:window.Redirectioni10n.version})}),(0,l.jsx)("p",{children:(0,i.__)("Redirection is designed to be used on sites with a few redirects to sites with thousands of redirects.","redirection")}),(0,l.jsx)("h3",{children:(0,i.__)("How do I use this plugin?","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("A simple redirect involves setting a {{strong}}source URL{{/strong}} (the old URL) and a {{strong}}target URL{{/strong}} (the new URL). Here's an example:","redirection"),{strong:(0,l.jsx)("strong",{})})}),(0,l.jsx)("table",{className:"redirect-edit",children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{children:[(0,i.__)("Source URL","redirection"),":"]}),(0,l.jsx)("td",{children:(0,l.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,i.__)("(Example) The source URL is your old or original URL","redirection")})})]}),(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{children:[(0,i.__)("Target URL","redirection"),":"]}),(0,l.jsx)("td",{children:(0,l.jsx)("input",{type:"text",className:"regular-text",readOnly:!0,value:(0,i.__)("(Example) The target URL is the new URL","redirection")})})]})]})}),(0,l.jsx)("p",{children:(0,i.__)("That's all there is to it - you are now redirecting! Note that the above is just an example.","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("Full documentation can be found on the {{link}}Redirection website.{{/link}}","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/"})})}),(0,l.jsxs)("h3",{children:[(0,i.__)("Some features you may find useful are","redirection"),":"]}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:L((0,i.__)("{{link}}Monitor 404 errors{{/link}}, get detailed information about the visitor, and fix any problems","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/tracking-404-errors/"})})}),(0,l.jsx)("li",{children:L((0,i.__)("{{link}}Import{{/link}} from .htaccess, CSV, and a variety of other plugins","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/import-export-redirects/"})})}),(0,l.jsx)("li",{children:L((0,i.__)("More powerful URL matching, including {{regular}}regular expressions{{/regular}}, and {{other}}other conditions{{/other}}","redirection"),{regular:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/"}),other:(0,l.jsx)(N,{url:"https://redirection.me/support/matching-redirects/"})})}),(0,l.jsx)("li",{children:(0,i.__)("Check a URL is being redirected","redirection")})]}),(0,l.jsx)("h3",{children:(0,i.__)("What's next?","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("First you will be asked a few questions, and then Redirection will set up your database.","redirection")}),(0,l.jsxs)("div",{className:"wizard-buttons",children:[(0,l.jsx)("button",{className:"button-primary button",onClick:function(){t({manual:!1}),e(1)},children:(0,i.__)("Start Setup","redirection")})," ",(0,l.jsx)("button",{className:"button-secondary button",onClick:function(){t({manual:!0}),e(4)},children:(0,i.__)("Manual Setup","redirection")})]})]})}var fe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},me=new class extends fe{#e;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},ge={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_e=new class{#n=ge;#i=!1;setTimeoutProvider(e){this.#n=e}setTimeout(e,t){return this.#n.setTimeout(e,t)}clearTimeout(e){this.#n.clearTimeout(e)}setInterval(e,t){return this.#n.setInterval(e,t)}clearInterval(e){this.#n.clearInterval(e)}},ye="undefined"==typeof window||"Deno"in globalThis;function ve(){}function be(e){return"number"==typeof e&&e>=0&&e!==1/0}function xe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function we(e,t){return"function"==typeof e?e(t):e}function je(e,t){return"function"==typeof e?e(t):e}function Se(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(n){if(t.queryHash!==Ce(s,t.options))return!1}else if(!Ee(t.queryKey,s))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function ke(e,t){const{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Te(t.options.mutationKey)!==Te(o))return!1}else if(!Ee(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Ce(e,t){return(t?.queryKeyHashFn||Te)(e)}function Te(e){return JSON.stringify(e,(e,t)=>Ae(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function Ee(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>Ee(e[r],t[r]))}var Re=Object.prototype.hasOwnProperty;function Pe(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Oe(e)&&Oe(t);if(!(n||Ae(e)&&Ae(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),s=o.length,a=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const s=n?c:o[c],u=e[s],d=t[s];if(u===d){a[s]=u,(n?c<i:Re.call(e,s))&&l++;continue}if(null===u||null===d||"object"!=typeof u||"object"!=typeof d){a[s]=d;continue}const p=Pe(u,d,r+1);a[s]=p,p===u&&l++}return i===s&&l===i?e:a}function Ne(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ae(e){if(!Ie(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!Ie(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function Ie(e){return"[object Object]"===Object.prototype.toString.call(e)}function Fe(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?Pe(e,t):t}function De(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Le(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var ze=Symbol();function Me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==ze?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function $e(e,t){return"function"==typeof e?e(...t):!!e}var Ue=(()=>{let e=()=>ye;return{isServer:()=>e(),setIsServer(t){e=t}}})(),Be=function(e){setTimeout(e,0)},qe=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=Be;const o=n=>{t?e.push(n):i(()=>{r(n)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}(),He=new class extends fe{#o=!0;#t;#r;constructor(){super(),this.#r=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function We(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function Ge(e){return Math.min(1e3*2**e,3e4)}function Ve(e){return"online"!==(e??"online")||He.isOnline()}var Ze=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Qe(e){let t,r=!1,n=0;const i=We(),o=()=>"pending"!==i.status,s=()=>me.isFocused()&&("always"===e.networkMode||He.isOnline())&&e.canRun(),a=()=>Ve(e.networkMode)&&e.canRun(),l=e=>{o()||(t?.(),i.resolve(e))},c=e=>{o()||(t?.(),i.reject(e))},u=()=>new Promise(r=>{t=e=>{(o()||s())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,o()||e.onContinue?.()}),d=()=>{if(o())return;let t;const i=0===n?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(o())return;const i=e.retry??(Ue.isServer()?0:3),a=e.retryDelay??Ge,l="function"==typeof a?a(n,t):a,p=!0===i||"number"==typeof i&&n<i||"function"==typeof i&&i(n,t);var h;!r&&p?(n++,e.onFail?.(n,t),(h=l,new Promise(e=>{_e.setTimeout(e,h)})).then(()=>s()?void 0:u()).then(()=>{r?c(t):d()})):c(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!o()){const r=new Ze(t);c(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?d():u().then(d),i)}}var Ke=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),be(this.gcTime)&&(this.#s=_e.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ue.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#s&&(_e.clearTimeout(this.#s),this.#s=void 0)}};function Je(e){return{onFetch:(t,r)=>{const n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let r=!1;const c=e=>{!function(e,r,n){let i,o=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,o||(o=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)})}(e,0,()=>r=!0)},u=Me(t.options,t.fetchOptions),d=async(e,n,i)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?Le:De;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,n,a)}};if(i&&o.length){const e="backward"===i,t={pages:o,pageParams:s},r=(e?Xe:Ye)(n,t);a=await d(t,r,e)}else{const t=e??o.length;do{const e=0===l?s[0]??n.initialPageParam:Ye(n,a);if(l>0&&null==e)break;a=await d(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function Ye(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Xe(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var et=class extends Ke{#a;#l;#c;#u;#d;#p;#h;#f;constructor(e){super(),this.#f=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#d=e.client,this.#u=this.#d.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#l=nt(this.options),this.state=e.state??this.#l,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#a}get promise(){return this.#p?.promise}setOptions(e){if(this.options={...this.#h,...e},e?._type&&(this.#a=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=nt(this.options);void 0!==e.data&&(this.setState(rt(e.data,e.dataUpdatedAt)),this.#l=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=Fe(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#m({type:"setState",state:e})}cancel(e){const t=this.#p?.promise;return this.#p?.cancel(e),t?t.then(ve).catch(ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#l}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>!1!==je(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ze||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===we(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!xe(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#p?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#p?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#p&&(this.#f||this.#g()?this.#p.cancel({revert:!0}):this.#p.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#g(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#p?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#p)return this.#p.continueRetry(),this.#p.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},i=()=>{const e=Me(this.options,t),r=(()=>{const e={client:this.#d,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,r,this):e(r)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#d,state:this.state,fetchFn:i};return n(e),e})(),s="infinite"===this.#a?Je(this.options.pages):this.options.behavior;s?.onFetch(o,this),this.#c=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#m({type:"fetch",meta:o.fetchOptions?.meta}),this.#p=Qe({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof Ze&&e.revert&&this.setState({...this.#c,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await this.#p.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ze){if(e.silent)return this.#p.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#m({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...tt(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...rt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#c=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),qe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function tt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ve(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function rt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function nt(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var it=class extends fe{constructor(e,t){super(),this.options=t,this.#d=e,this.#_=null,this.#y=We(),this.bindMethods(),this.setOptions(t)}#d;#v=void 0;#b=void 0;#x=void 0;#w;#j;#y;#_;#S;#k;#C;#T;#E;#R;#P=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#v.addObserver(this),ot(this.#v,this.options)?this.#N():this.updateResult(),this.#O())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return st(this.#v,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return st(this.#v,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#A(),this.#I(),this.#v.removeObserver(this)}setOptions(e){const t=this.options,r=this.#v;if(this.options=this.#d.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof je(this.options.enabled,this.#v))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#F(),this.#v.setOptions(this.options),t._defaulted&&!Ne(this.options,t)&&this.#d.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#v,observer:this});const n=this.hasListeners();n&&at(this.#v,r,this.options,t)&&this.#N(),this.updateResult(),!n||this.#v===r&&je(this.options.enabled,this.#v)===je(t.enabled,this.#v)&&we(this.options.staleTime,this.#v)===we(t.staleTime,this.#v)||this.#D();const i=this.#L();!n||this.#v===r&&je(this.options.enabled,this.#v)===je(t.enabled,this.#v)&&i===this.#R||this.#z(i)}getOptimisticResult(e){const t=this.#d.getQueryCache().build(this.#d,e),r=this.createResult(t,e);return n=r,!Ne(this.getCurrentResult(),n)&&(this.#x=r,this.#j=this.options,this.#w=this.#v.state),r;var n}getCurrentResult(){return this.#x}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#y.status||this.#y.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#P.add(e)}getCurrentQuery(){return this.#v}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#d.defaultQueryOptions(e),r=this.#d.getQueryCache().build(this.#d,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#N({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#x))}#N(e){this.#F();let t=this.#v.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ve)),t}#D(){this.#A();const e=we(this.options.staleTime,this.#v);if(Ue.isServer()||this.#x.isStale||!be(e))return;const t=xe(this.#x.dataUpdatedAt,e)+1;this.#T=_e.setTimeout(()=>{this.#x.isStale||this.updateResult()},t)}#L(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#v):this.options.refetchInterval)??!1}#z(e){this.#I(),this.#R=e,!Ue.isServer()&&!1!==je(this.options.enabled,this.#v)&&be(this.#R)&&0!==this.#R&&(this.#E=_e.setInterval(()=>{(this.options.refetchIntervalInBackground||me.isFocused())&&this.#N()},this.#R))}#O(){this.#D(),this.#z(this.#L())}#A(){void 0!==this.#T&&(_e.clearTimeout(this.#T),this.#T=void 0)}#I(){void 0!==this.#E&&(_e.clearInterval(this.#E),this.#E=void 0)}createResult(e,t){const r=this.#v,n=this.options,i=this.#x,o=this.#w,s=this.#j,a=e!==r?e.state:this.#b,{state:l}=e;let c,u={...l},d=!1;if(t._optimisticResults){const i=this.hasListeners(),o=!i&&ot(e,t),s=i&&at(e,r,t,n);(o||s)&&(u={...u,...tt(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:h,status:f}=u;c=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===f){let e;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#C?.state.data,this.#C):t.placeholderData,void 0!==e&&(f="success",c=Fe(i?.data,e,t),d=!0)}if(t.select&&void 0!==c&&!m)if(i&&c===o?.data&&t.select===this.#S)c=this.#k;else try{this.#S=t.select,c=t.select(c),c=Fe(i?.data,c,t),this.#k=c,this.#_=null}catch(e){this.#_=e}this.#_&&(p=this.#_,c=this.#k,h=Date.now(),f="error");const g="fetching"===u.fetchStatus,_="pending"===f,y="error"===f,v=_&&g,b=void 0!==c,x={status:f,fetchStatus:u.fetchStatus,isPending:_,isSuccess:"success"===f,isError:y,isInitialLoading:v,isLoading:v,data:c,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>a.dataUpdateCount||u.errorUpdateCount>a.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:y&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:y&&b,isStale:lt(e,t),refetch:this.refetch,promise:this.#y,isEnabled:!1!==je(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==x.data,n="error"===x.status&&!t,i=e=>{n?e.reject(x.error):t&&e.resolve(x.data)},o=()=>{const e=this.#y=x.promise=We();i(e)},s=this.#y;switch(s.status){case"pending":e.queryHash===r.queryHash&&i(s);break;case"fulfilled":(n||x.data!==s.value)&&o();break;case"rejected":n&&x.error===s.reason||o()}}return x}updateResult(){const e=this.#x,t=this.createResult(this.#v,this.options);this.#w=this.#v.state,this.#j=this.options,void 0!==this.#w.data&&(this.#C=this.#v),Ne(t,e)||(this.#x=t,this.#M({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#P.size)return!0;const n=new Set(r??this.#P);return this.options.throwOnError&&n.add("error"),Object.keys(this.#x).some(t=>{const r=t;return this.#x[r]!==e[r]&&n.has(r)})})()}))}#F(){const e=this.#d.getQueryCache().build(this.#d,this.options);if(e===this.#v)return;const t=this.#v;this.#v=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#O()}#M(e){qe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#x)}),this.#d.getQueryCache().notify({query:this.#v,type:"observerResultsUpdated"})})}};function ot(e,t){return function(e,t){return!1!==je(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===je(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&st(e,t,t.refetchOnMount)}function st(e,t,r){if(!1!==je(t.enabled,e)&&"static"!==we(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&<(e,t)}return!1}function at(e,t,r,n){return(e!==t||!1===je(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&<(e,r)}function lt(e,t){return!1!==je(t.enabled,e)&&e.isStaleByTime(we(t.staleTime,e))}var ct=o.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ut=o.createContext(!1),dt=(ut.Provider,(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()}));function pt(e,t){return function(e,t,r){const n=o.useContext(ut),i=o.useContext(ct),s=u(r),a=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const l=s.getQueryCache().get(a.queryHash),c=!1!==e.subscribed;a._optimisticResults=n?"isRestoring":c?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(a),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?$e(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))})(a,i,l),(e=>{o.useEffect(()=>{e.clearReset()},[e])})(i);const d=!s.getQueryCache().get(a.queryHash),[p]=o.useState(()=>new t(s,a)),h=p.getOptimisticResult(a),f=!n&&c;if(o.useSyncExternalStore(o.useCallback(e=>{const t=f?p.subscribe(qe.batchCalls(e)):ve;return p.updateResult(),t},[p,f]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),o.useEffect(()=>{p.setOptions(a)},[a,p]),((e,t)=>e?.suspense&&t.isPending)(a,h))throw dt(a,p,i);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||$e(r,[e.error,n])))({result:h,errorResetBoundary:i,throwOnError:a.throwOnError,query:l,suspense:a.suspense}))throw h.error;if(s.getDefaultOptions().queries?._experimental_afterQuery?.(a,h),a.experimental_prefetchInRender&&!Ue.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(h,n)){const e=d?dt(a,p,i):l?.promise;e?.catch(ve).finally(()=>{p.updateResult()})}return a.notifyOnChangeProps?h:p.trackResult(h)}(e,it,t)}var ht=class extends Ke{#d;#$;#U;#p;constructor(e){super(),this.#d=e.client,this.mutationId=e.mutationId,this.#U=e.mutationCache,this.#$=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#$.includes(e)||(this.#$.push(e),this.clearGcTimeout(),this.#U.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#$=this.#$.filter(t=>t!==e),this.scheduleGc(),this.#U.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#$.length||("pending"===this.state.status?this.scheduleGc():this.#U.remove(this))}continue(){return this.#p?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#m({type:"continue"})},r={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#p=Qe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#U.canRun(this)});const n="pending"===this.state.status,i=!this.#p.canStart();try{if(n)t();else{this.#m({type:"pending",variables:e,isPaused:i}),this.#U.config.onMutate&&await this.#U.config.onMutate(e,this,r);const t=await(this.options.onMutate?.(e,r));t!==this.state.context&&this.#m({type:"pending",context:t,variables:e,isPaused:i})}const o=await this.#p.start();return await(this.#U.config.onSuccess?.(o,e,this.state.context,this,r)),await(this.options.onSuccess?.(o,e,this.state.context,r)),await(this.#U.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r)),await(this.options.onSettled?.(o,null,e,this.state.context,r)),this.#m({type:"success",data:o}),o}catch(t){try{await(this.#U.config.onError?.(t,e,this.state.context,this,r))}catch(e){Promise.reject(e)}try{await(this.options.onError?.(t,e,this.state.context,r))}catch(e){Promise.reject(e)}try{await(this.#U.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r))}catch(e){Promise.reject(e)}try{await(this.options.onSettled?.(void 0,t,e,this.state.context,r))}catch(e){Promise.reject(e)}throw this.#m({type:"error",error:t}),t}finally{this.#U.runNext(this)}}#m(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),qe.batch(()=>{this.#$.forEach(t=>{t.onMutationUpdate(e)}),this.#U.notify({mutation:this,type:"updated",action:e})})}},ft=class extends fe{#d;#x=void 0;#B;#q;constructor(e,t){super(),this.#d=e,this.setOptions(t),this.bindMethods(),this.#H()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#d.defaultMutationOptions(e),Ne(this.options,t)||this.#d.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#B,observer:this}),t?.mutationKey&&this.options.mutationKey&&Te(t.mutationKey)!==Te(this.options.mutationKey)?this.reset():"pending"===this.#B?.state.status&&this.#B.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#B?.removeObserver(this)}onMutationUpdate(e){this.#H(),this.#M(e)}getCurrentResult(){return this.#x}reset(){this.#B?.removeObserver(this),this.#B=void 0,this.#H(),this.#M()}mutate(e,t){return this.#q=t,this.#B?.removeObserver(this),this.#B=this.#d.getMutationCache().build(this.#d,this.options),this.#B.addObserver(this),this.#B.execute(e)}#H(){const e=this.#B?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#x={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#M(e){qe.batch(()=>{if(this.#q&&this.hasListeners()){const t=this.#x.variables,r=this.#x.context,n={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#q.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if("error"===e?.type){try{this.#q.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#x)})})}};function mt(e,t){const r=u(t),[n]=o.useState(()=>new ft(r,e));o.useEffect(()=>{n.setOptions(e)},[n,e]);const i=o.useSyncExternalStore(o.useCallback(e=>n.subscribe(qe.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),s=o.useCallback((e,t)=>{n.mutate(e,t).catch(ve)},[n]);if(i.error&&$e(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const gt=e=>"object"==typeof e&&null!==e,_t=e=>0===e?"Admin AJAX returned 0":"string"==typeof e?e:gt(e)&&e.message?e.message:(console.error(e),"Unknown error "+(gt(e)?Object.keys(e):e));let yt=[];function vt(e,t,r){return{code:(n=e,"number"==typeof n?`${n}`:gt(n)&&n.error_code?n.error_code:gt(n)&&n.code?n.code:gt(n)&&n.name?n.name:gt(n)&&n.data?.error_code?n.data.error_code:String(n)),message:_t(t),request:r,data:r.apiFetch?.data?r.apiFetch?.data:null,jsonData:e&&e.data?e.data:null};var n}const bt=e=>{if(e.status>=200&&e.status<300)return e;throw e};function xt(e){return e.headers.get("x-wp-nonce")&&jt.nonceMiddleware&&(jt.nonceMiddleware.nonce=e.headers.get("x-wp-nonce")??jt.nonceMiddleware.nonce),e}const wt=e=>e.text(),jt=e=>{const t=[...yt,e=>(e=>fetch(e.url,e).then(xt).then(t=>((e,t)=>(t.apiFetch={action:t.url.replace(/[\?&]_wpnonce=[a-f0-9]*/,"")+" "+t.method.toUpperCase(),body:"object"==typeof t.body?JSON.stringify(t.body):t.body},t.headers=e.headers,e.status&&void 0!==e.statusText&&(t.apiFetch.status=e.status,t.apiFetch.statusText=e.statusText),e))(t,e)).then(wt).then(t=>((e,t)=>(t.apiFetch&&(t.apiFetch.data=e),e))(t,e)).then(t=>((e,t)=>{const r=t.apiFetch?.status;if(""===e&&void 0!==r&&(r<200||r>300))return e;try{const r=JSON.parse(e.replace(/\ufeff/,""));if(0===r)throw vt("json-zero","Failed to get data",t);return r}catch(e){throw vt(e,e?.message,t)}})(t,e)).then(t=>((e,t)=>{if(e?.error||e?.error_code)throw vt(e,e.message,t);if(t.apiFetch){const{status:r,statusText:n}=t.apiFetch;if(e?.code&&e?.message)throw vt(e,e,t);if(void 0!==r&&(r<200||r>=300))throw vt(r,n,t)}return e})(t,e)))(e)],r=e=>n=>{const i=t[e];return i?i(n,e===t.length-1?()=>Promise.resolve():r(e+1)):Promise.reject(new Error("Middleware step is undefined"))};return new Promise((t,n)=>{r(0)(e).then(e=>t(e)).catch(r=>"rest_cookie_invalid_nonce"!==r.code?n(r):e.apiFetch?.nonceRefreshed?n(vt("rest_cookie_invalid_nonce","REST API nonce refresh was rejected after retry.",e)):void window.fetch("admin-ajax.php?action=rest-nonce").then(bt).then(wt).then(r=>{if(!r)throw vt("rest_cookie_invalid_nonce","REST API nonce refresh failed.",e);jt.nonceMiddleware.nonce=r,e.apiFetch={...e.apiFetch||{},nonceRefreshed:!0},jt(e).then(t).catch(n)}).catch(n))})};jt.getUrl=e=>jt.rootURLMiddleware({url:e},e=>jt.nonceMiddleware(e,e=>e.url)),jt.use=function(e){yt.unshift(e)},jt.createNonceMiddleware=e=>{const t=(e=>{const t=(e,r)=>{const{headers:n={}}=e;for(const i in n)if("x-wp-nonce"===i.toLowerCase()&&n[i]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t})(e);return jt.nonceMiddleware=t,t},jt.createRootURLMiddleware=e=>{const t=function(e){const t=(t,r)=>{return t.url.startsWith("http")?r(t):r({...t,url:(n=e,i=t.url,function(e){return e.replace("wp-json/wp-json","wp-json").replace("=/wp-json","=")}((o=function(e){return e.replace(/\/$/,"")}(n),s=function(e,t){return-1!==e.indexOf("?")?t.replace("?","&"):t}(n,function(e){return e.replace(/^\//,"")}(i)),o+"/"+s)))});var n,i,o,s};return t.rootURL=e,t}(e);return jt.rootURLMiddleware=t,t},jt.resetMiddlewares=()=>{yt=[]},jt.replaceRootURLMiddleware=e=>{for(let t=0;t<yt.length;t++)yt[t]===jt.rootURLMiddleware&&(yt[t]=jt.createRootURLMiddleware(e))};const St=jt,kt=(e,t={})=>{const r=e+"/";if(Object.keys(t).length>0){const e=function(e){const t=new URLSearchParams;function r(e,n){for(const i in n){const o=n[i];if(null!=o)if(Array.isArray(o))for(const r of o)null!=r&&t.append(`${e}[${i}][]`,String(r));else"object"==typeof o?r(`${e}[${i}]`,o):t.append(`${e}[${i}]`,String(o))}}for(const n in e){const i=e[n];if(null!=i)if(Array.isArray(i))for(const e of i)null!=e&&t.append(`${n}[]`,String(e));else"object"==typeof i?r(n,i):t.append(n,String(i))}return t.toString()}(t);if(e.length>0)return r+(-1===r.indexOf("?")?"?":"&")+e}return r},Ct=(e,t={})=>({headers:{Accept:"application/json, */*;q=0.1"},url:kt(e,t),credentials:"include",method:"get",redirect:"error"}),Tt=(e,t={},r={})=>{const n={headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json, */*;q=0.1"},url:kt(e,r),credentials:"include",method:"post",body:"{}"};return Object.keys(t).length>0&&(n.body=JSON.stringify(t)),n},Et=(e,t={},r={})=>Tt(e,t,r),Rt=()=>Ct("redirection/v1/setting"),Pt=e=>Tt("redirection/v1/setting",e),Nt=e=>Ct("redirection/v1/redirect",e),Ot=(e,t)=>Tt("redirection/v1/redirect/"+e,t),At=(e,t)=>Tt("redirection/v1/redirect",e,t),It=e=>Ct("redirection/v1/redirect/post",{text:e}),Ft=e=>Ct("redirection/v1/group",e),Dt=(e,t)=>Tt("redirection/v1/group/"+e,t),Lt=(e,t)=>Tt("redirection/v1/group",e,t),zt=e=>Ct("redirection/v1/log",e),Mt=e=>Ct("redirection/v1/404",e),$t=(e,t,r={})=>((e,t,r)=>{const n=Tt(e,t);delete n.headers["Content-Type"];const i=new FormData;function o(e,t){if(null!=t)if(Array.isArray(t))for(const r of t)o(`${e}[]`,r);else if("object"!=typeof t)i.append(e,String(t));else for(const r in t)o(`${e}[${r}]`,t[r])}i.append("file",r);for(const e in t)o(e,t[e]);return n.body=i,n})("redirection/v1/import/file/"+e,r,t),Ut=()=>Ct("redirection/v1/import/plugin"),Bt=e=>Tt("redirection/v1/import/plugin",e),qt=(e,t)=>Ct("redirection/v1/import/plugin/"+encodeURIComponent(e)+"/preview",t),Ht=e=>Ct("redirection/v1/export/redirect",e),Wt=e=>Ct("redirection/v1/export/redirect/preview",e),Gt=e=>Ct("redirection/v1/export/bundle",e),Vt=e=>Ct("redirection/v1/export/bundle/preview",e),Zt=(e,t={})=>Ct("redirection/v1/export/group/"+e,t),Qt=(e,t={})=>Ct("redirection/v1/export/log/"+e,t),Kt=(e={})=>Ct("redirection/v1/export/log/preview",e),Jt=(e,t={})=>Ct("redirection/v1/export/404/"+e,t),Yt=(e={})=>Ct("redirection/v1/export/404/preview",e),Xt=()=>Ct("redirection/v1/plugin"),er=()=>Et("redirection/v1/plugin/delete"),tr=e=>Tt("redirection/v1/plugin/data",e?{upgrade:e}:{}),rr=()=>Tt("redirection/v1/plugin/finish",{}),nr=(e,t)=>Tt("redirection/v1/plugin/fix",{reason:e,current:t}),ir=(e,t,r)=>Tt("redirection/v1/bulk/redirect/"+e,t,r),or=(e,t,r)=>Tt("redirection/v1/bulk/group/"+e,t,r),sr=(e,t,r)=>Tt("redirection/v1/bulk/log/"+e,t,r),ar=(e,t,r)=>Tt("redirection/v1/bulk/404/"+e,t,r),lr=(e,t=1)=>`https://api.redirect.li/v${t}/`+e,cr=e=>({url:lr("useragent/"+encodeURIComponent(e)),method:"get"}),ur=e=>({url:lr("http?url="+encodeURIComponent(e),2),method:"get"});function dr(e){return"json"===e?"application/json;charset=utf-8":"csv"===e?"text/csv;charset=utf-8":"text/plain;charset=utf-8"}var pr;function hr(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:s,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=i[t].bind(r))}}const i=r?.Parent??Object;class o extends i{}function s(e){var t;const i=r?.Parent?new o:this;n(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Symbol("zod_brand");class fr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(pr=globalThis).__zod_globalConfig??(pr.__zod_globalConfig={});const gr=globalThis.__zod_globalConfig;function _r(e){return e&&Object.assign(gr,e),gr}function yr(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function vr(e,t){return"bigint"==typeof t?t.toString():t}function br(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xr(e){return null==e}function wr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const jr=Symbol("evaluating");function Sr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jr)return void 0===n&&(n=jr,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function kr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Cr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Tr(e){return JSON.stringify(e)}const Er="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Rr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Pr=br(()=>{if(gr.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Nr(e){if(!1===Rr(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==Rr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Or(e){return Nr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ar=new Set(["string","number","symbol"]);function Ir(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Dr(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Lr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Mr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!1===e.issues[r]?.continue)return!0;return!1}function $r(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ur(e){return"string"==typeof e?e:e?.message}function Br(e,t,r){const n=e.message?e.message:Ur(e.inst?._zod.def?.error?.(e))??Ur(t?.error?.(e))??Ur(r.customError?.(e))??Ur(r.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=s),a}function qr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Hr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Wr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gr=hr("$ZodError",Wr),Vr=hr("$ZodError",Wr,{Parent:Error}),Zr=(e,t)=>{Gr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>n({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)n({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)n({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)r._errors.push(t(o));else{let n=r,i=0;for(;i<e.length;){const r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(o))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vr,2)}},isEmpty:{get:()=>0===e.issues.length}})},Qr=hr("ZodError",Zr),Kr=hr("ZodError",Zr,{Parent:Error});class Jr extends Error{constructor(e,t){const r=e.issues,n=r.map(e=>{const t=e.path.join(".");return`${t?`${t}: `:""}${e.message}`}).join("\n");super(r.length>0?`API response validation failed:\n${n}`:"API response validation failed"),this.zodError=e,this.response=t,this.name="ApiValidationError"}getErrors(){return this.zodError.format()}getFirstError(){const e=this.zodError.issues;return e.length>0&&e[0]?e[0].message:"Validation error"}}function Yr(e){if(e instanceof Qr)return console.error("API Validation Error:",e.format()),new Jr(e);if(e instanceof Error)return e;if("object"==typeof e&&null!==e&&"message"in e){const t=e,r=new Error(t.message||"Unknown error");return void 0!==t.code&&(r.code=t.code),void 0!==t.data&&(r.data=t.data),void 0!==t.jsonData&&(r.jsonData=t.jsonData),void 0!==t.request&&(r.request=t.request),"string"==typeof t.code&&t.code.length>0&&(r.name=t.code),r}return new Error("Unknown error occurred")}const Xr={redirects:{all:["redirects"],lists:()=>[...Xr.redirects.all,"list"],list:e=>[...Xr.redirects.lists(),e],detail:e=>[...Xr.redirects.all,"detail",e]},groups:{all:["groups"],lists:()=>[...Xr.groups.all,"list"],list:e=>[...Xr.groups.lists(),e],detail:e=>[...Xr.groups.all,"detail",e]},logs:{all:["logs"],lists:()=>[...Xr.logs.all,"list"],list:e=>[...Xr.logs.lists(),e]},errors:{all:["errors"],lists:()=>[...Xr.errors.all,"list"],list:e=>[...Xr.errors.lists(),e]},settings:{all:["settings"],get:()=>[...Xr.settings.all,"get"],status:()=>[...Xr.settings.all,"status"]},pluginInfo:{all:["pluginInfo"],get:()=>[...Xr.pluginInfo.all,"get"]},io:{all:["io"],importers:()=>[...Xr.io.all,"importers"]},info:{all:["info"],ip:e=>[...Xr.info.all,"ip",e],agent:e=>[...Xr.info.all,"agent",e],http:e=>[...Xr.info.all,"http",e]}},en={errors:[],notices:[],inProgress:0},tn=X()(se(e=>({...en,addError:t=>e(e=>({errors:[...e.errors,"string"==typeof t?{message:t,type:"error"}:t]})),addNotice:t=>e(e=>({notices:[...e.notices,"string"==typeof t?{message:t,type:"notice"}:t]})),clearErrors:()=>e({errors:[]}),clearNotices:()=>e({notices:[]}),incrementProgress:()=>e(e=>({inProgress:e.inProgress+1})),decrementProgress:()=>e(e=>({inProgress:Math.max(0,e.inProgress-1)})),reset:()=>e(en)}),{name:"MessageStore"}));function rn(e){return!(!e||0===e.length)&&(e.length>1||"group"===e[0]||"setting"===e[0])}function nn(e,t,r){return"group"===e?r:"module"===e?t:"all"}function on(e){return pt({queryKey:Xr.io.importers(),queryFn:async()=>{const e=await St(Ut());return e?.importers||[]},...e})}function sn(e){const t=u(),{addNotice:r,incrementProgress:n,decrementProgress:i}=tn();return mt({mutationFn:async e=>{if("file"===e.sourceType){n();try{return await St($t(String(e.groupId),e.file,{dry_run:"preview"===e.mode?1:0,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0,import_sections:e.importSections||[]}))}catch(e){throw Yr(e)}}if("preview"===e.mode){if(Array.isArray(e.pluginId))throw new Error("Plugin preview only supports a single importer");return await St(qt(e.pluginId,{group_id:e.groupId,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0}))}return await St(Bt({plugin:Array.isArray(e.pluginId)?e.pluginId:[e.pluginId],group_id:e.groupId,duplicate_mode:e.duplicateMode,delete_source:e.deleteSource?1:0}))},onSuccess:(e,n)=>{"file"===n.sourceType&&i(),"preview"===n.mode?r("Preview completed"):(r(`Imported ${e?.created||0} new redirects, updated ${e?.updated||0} existing redirects, ignored ${e?.ignored||0} redirects, ${e?.groups_created||0} groups created, ${e?.groups_updated||0} groups updated, ${e?.groups_ignored||0} groups ignored, ${e?.logs_imported||0} logs imported, ${e?.errors_imported||0} 404 logs imported, ${e?.settings_imported||0} settings imported`),t.invalidateQueries({queryKey:Xr.redirects.lists()}),t.invalidateQueries({queryKey:Xr.groups.all}),t.invalidateQueries({queryKey:Xr.logs.all}),t.invalidateQueries({queryKey:Xr.errors.all}),t.invalidateQueries({queryKey:Xr.settings.all}))},onError:(e,t)=>{"file"===t.sourceType&&i()},...e})}function an(e){const{addNotice:t,incrementProgress:r,decrementProgress:n}=tn();return mt({mutationFn:async e=>{r();try{const t=await St(function(e){if(rn(e.exportTypes)){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Gt({types:e.exportTypes,scope_type:t,scope_value:nn(t,r,n),format:e.format})}if("redirect"===e.exportType){if(e.params)return Ht({...e.params,format:e.format});const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Ht({scope_type:t,scope_value:nn(t,r,n),format:e.format})}return"group"===e.exportType?Zt(e.format,e.params||{}):"log"===e.exportType?Qt(e.format,e.params||{}):Jt(e.format,e.params||{})}(e));return e.download&&e.filename&&function(e,t,r){const n=new Blob([t],{type:dr(r)}),i=window.URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=e,document.body.appendChild(o),o.click(),o.remove(),window.URL.revokeObjectURL(i)}(e.filename,t.data,e.format),e.copy&&await async function(e){if(navigator.clipboard?.writeText)return void await navigator.clipboard.writeText(e);const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();const r=document.execCommand("copy");if(t.remove(),!r)throw new Error("Unable to copy export data")}(t.data),t}catch(e){throw Yr(e)}},onSuccess:(e,r)=>{n(),!1!==r.completionNotice&&t(r.completionNotice||function(e){return e.copy?"Export copied":e.download?"Export downloaded":"Export viewed"}(r))},onError:()=>{n()},...e})}function ln({setStep:e,step:t,options:r,setOptions:n}){const{log:o=!1,ip:s=!1,monitor:a=!1}=r?.settings??{},{data:c=[]}=on(),u=0===c.length?t+2:t+1;function d(e){n({settings:{...r.settings,[e.target.name]:e.target.checked}})}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("Basic Setup","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("These are some options you may want to enable now. They can be changed at any time.","redirection")}),(0,l.jsxs)("div",{className:"wizard-option",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"wizard-monitor",name:"monitor",type:"checkbox",checked:a,onChange:d}),(0,l.jsxs)("label",{htmlFor:"wizard-monitor",children:[(0,i.__)("Monitor permalink changes in WordPress posts and pages","redirection"),"."]})]}),(0,l.jsxs)("p",{children:[(0,i.__)("If you change the permalink in a post or page then Redirection can automatically create a redirect for you.","redirection")," ",L((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/options/#monitor"})})]})]}),(0,l.jsxs)("div",{className:"wizard-option",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"wizard-log",name:"log",type:"checkbox",checked:o,onChange:function(e){n({settings:{...r.settings,[e.target.name]:e.target.checked,ip:!!e.target.checked&&s}})}}),(0,l.jsx)("label",{htmlFor:"wizard-log",children:(0,i.__)("Keep a log of all redirects and 404 errors.","redirection")})]}),(0,l.jsxs)("p",{children:[(0,i.__)("Storing logs for redirects and 404s will allow you to see what is happening on your site. This will increase your database storage requirements.","redirection")," ",L((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/logs/"})})]})]}),(0,l.jsxs)("div",{className:o?"wizard-option":"wizard-option wizard-option_disabled",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"wizard-ip",name:"ip",type:"checkbox",disabled:!o,checked:s,onChange:d}),(0,l.jsx)("label",{htmlFor:"wizard-ip",children:(0,i.__)("Store IP information for redirects and 404 errors.","redirection")})]}),(0,l.jsxs)("p",{children:[(0,i.__)("Storing the IP address allows you to perform additional log actions. Note that you will need to adhere to local laws regarding the collection of data (for example GDPR).","redirection")," ",L((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/privacy-gdpr/"})})]})]}),(0,l.jsxs)("div",{className:"wizard-buttons",children:[(0,l.jsx)("button",{className:"button-primary button",onClick:()=>e(u),children:(0,i.__)("Continue","redirection")})," ",(0,l.jsx)("button",{className:"button",onClick:()=>e(t-1),children:(0,i.__)("Go back","redirection")})]})]})}const cn=function({error:e}){const{request:t}=e,r=function(e){return!!(e&&e.raw&&e.raw.length>500)}(t),[n,s]=(0,o.useState)(r);return t&&t.raw?(0,l.jsxs)(l.Fragment,{children:[r&&n&&(0,l.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),s(!1)},children:(0,i.__)("Show Full","redirection")}),r&&!n&&(0,l.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),s(!0)},children:(0,i.__)("Hide","redirection")}),(0,l.jsx)("pre",{children:n?t.raw.substring(0,500)+" ...":t.raw})]}):null},un=(e,t)=>{const r=e.data?.status;return"number"==typeof r&&r>0?`${t} ${r}`:`${t} ${"rest_api_cors_mismatch"===e.code?"blocked":"failed"}`},dn=({error:e,methods:t})=>{const r=(e=>e.code?e.code:e.name?e.name:null)(e);return(0,l.jsxs)("div",{className:"api-result-log_details",children:[(0,l.jsx)("p",{children:(0,l.jsx)("span",{className:"dashicons dashicons-no"})}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("p",{children:[t.map((t,r)=>(0,l.jsx)("span",{className:"api-result-method_fail",children:un(e,t)},r)),r&&(0,l.jsxs)("strong",{children:[r,": "]}),e.message]}),(0,l.jsx)(z,{error:e,links:Z(),locale:"redirection"}),(0,l.jsx)(cn,{error:e})]})]},t.join(""))},pn=({methods:e})=>(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"dashicons dashicons-yes"}),e.map((e,t)=>(0,l.jsx)("span",{className:"api-result-method_pass",children:e},t)),(0,i.__)("Working!","redirection")]},e.join("")),hn=e=>e.code?e.code:0,fn=({result:e})=>{const t=[],{GET:r,POST:n}=e;return r.status===n.status&&hn(r)===hn(n)?("fail"===r.status&&r.error?t.push((0,l.jsx)(dn,{error:r.error,methods:["GET","POST"]},"get-post")):t.push((0,l.jsx)(pn,{methods:["GET","POST"]},"get-post")),t):("fail"===r.status&&r.error?t.push((0,l.jsx)(dn,{error:r.error,methods:["GET"]},"get")):t.push((0,l.jsx)(pn,{methods:["GET"]},"get")),"fail"===n.status&&n.error?t.push((0,l.jsx)(dn,{error:n.error,methods:["POST"]},"post")):t.push((0,l.jsx)(pn,{methods:["POST"]},"post")),t)},mn=({item:e,result:t,routes:r,isCurrent:n,allowChange:o})=>(e=>0===Object.keys(e).length||"loading"===e.GET.status||"loading"===e.POST.status)(t)?null:(0,l.jsxs)("div",{className:"api-result-log",children:[(0,l.jsxs)("form",{className:"api-result-select",action:window.Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[o&&!n&&(0,l.jsx)("input",{type:"submit",className:"button button-secondary",value:(0,i.__)("Switch to this API","redirection")}),o&&n&&(0,l.jsx)("span",{children:(0,i.__)("Current API","redirection")}),(0,l.jsx)("input",{type:"hidden",name:"rest_api",value:e.value}),(0,l.jsx)("input",{type:"hidden",name:"_wpnonce",value:St.nonceMiddleware.nonce}),(0,l.jsx)("input",{type:"hidden",name:"action",value:"rest_api"})]}),(0,l.jsx)("h4",{children:e.text}),(0,l.jsxs)("p",{children:["URL:"," ",(0,l.jsx)("code",{children:(0,l.jsx)(N,{url:r[e.value]||"",children:r[e.value]||""})})]}),(0,l.jsx)(fn,{result:t})]}),gn=({size:e=""})=>{const t=h("wpl-spinner__container",e&&" spinner-"+e);return(0,l.jsx)("div",{className:t,children:(0,l.jsx)("span",{className:"wpl-spinner__item"})})},yn=e=>{const{title:t,url:r=!1,children:n}=e;return(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{children:[!r&&t,r&&(0,l.jsx)("a",{href:r,target:"_blank",rel:"noreferrer",children:t})]}),(0,l.jsx)("td",{children:n})]})},vn=e=>(0,l.jsx)("table",{className:"form-table",children:(0,l.jsx)("tbody",{children:e.children})}),bn=({value:e,label:t,disabled:r=!1})=>Array.isArray(e)?(0,l.jsx)("optgroup",{label:String(t),disabled:r,children:e.map((e,t)=>(0,l.jsx)(bn,{label:e.label,value:e.value,disabled:e.disabled||!1},t))}):(0,l.jsx)("option",{value:e,disabled:r,children:t}),xn=bn,wn=({items:e,value:t,name:r,onChange:n,disabled:i=!1,className:o})=>(0,l.jsx)("select",{name:r,value:t,onChange:n,disabled:i,className:o,children:e.map((e,t)=>(0,l.jsx)(xn,{value:e.value,label:e.label,disabled:e.disabled||!1},t))}),jn=()=>[{value:0,label:(0,i.__)("Default REST API","redirection")},{value:1,label:(0,i.__)("Raw REST API","redirection")},{value:3,label:(0,i.__)("Relative REST API","redirection")}],Sn=function(e){const{settings:t,onChange:r,getLink:n,installed:o,warning:s}=e,{location:a,token:c,rest_api:u,plugin_update:d}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("tr",{className:"redirect-option__row",children:(0,l.jsx)("th",{colSpan:2,children:(0,l.jsx)("h2",{className:"title",children:(0,i.__)("Advanced","redirection")})})}),(0,l.jsxs)(yn,{title:(0,i.__)("RSS Token","redirection")+":",url:n("options","rsstoken"),children:[(0,l.jsx)("input",{className:"regular-text",type:"text",value:c,name:"token",onChange:r}),(0,l.jsx)("br",{}),(0,l.jsx)("span",{className:"sub",children:(0,i.__)("A unique token allowing feed readers access to Redirection log RSS (leave blank to auto-generate)","redirection")})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Apache .htaccess","redirection"),url:n("options","apache"),children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("label",{className:"screen-reader-text",htmlFor:"apache-htaccess-location",children:(0,i.__)("Apache .htaccess location","redirection")}),(0,l.jsx)("input",{id:"apache-htaccess-location",type:"text",className:"regular-text",name:"location",value:a,onChange:r})]}),(0,l.jsx)("p",{className:"sub",children:L((0,i.sprintf)(
// translators: %(installed)s is the path where WordPress is installed
// translators: %(installed)s is the path where WordPress is installed
(0,i.__)("Redirects added to an Apache group can be saved to an {{code}}.htaccess{{/code}} file by adding the full path here. For reference, your WordPress is installed to {{code}}%(installed)s{{/code}}.","redirection"),{installed:o}),{code:(0,l.jsx)("code",{})})}),s&&(0,l.jsxs)("p",{className:"inline-notice",children:[(0,i.__)("Unable to save .htaccess file","redirection")," ",(0,l.jsx)("code",{children:s})]})]}),(0,l.jsxs)(yn,{title:(0,i.__)("REST API","redirection"),url:n("options","restapi"),children:[(0,l.jsx)(wn,{items:jn(),name:"rest_api",value:String(u),onChange:r})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)("How Redirection uses the REST API - don't change unless necessary","redirection")})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Data Upgrade","redirection"),children:[(0,l.jsx)(wn,{items:[{value:"prompt",
// translators: Upgrade manually when prompted
label:(0,i.__)("Upgrade manually when prompted","redirection")},{value:"admin",
// translators: Automatically upgrade on admin pages
label:(0,i.__)("Automatically upgrade on admin pages","redirection")}],name:"plugin_update",value:d,onChange:r})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)("Decide how Redirection updates itself, if needed.","redirection")})]})]})},kn=/^[cC][0-9a-z]{6,}$/,Cn=/^[0-9a-z]+$/,Tn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,En=/^[0-9a-vA-V]{20}$/,Rn=/^[A-Za-z0-9]{27}$/,Pn=/^[a-zA-Z0-9_-]{21}$/,Nn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,On=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,An=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,In=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Fn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ln=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$n=/^[A-Za-z0-9_-]*$/,Un=/^https?$/,Bn=/^\+[1-9]\d{6,14}$/,qn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Hn=new RegExp(`^${qn}$`);function Wn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Gn=/^-?\d+$/,Vn=/^-?\d+(?:\.\d+)?$/,Zn=/^(?:true|false)$/i,Qn=/^[^A-Z]*$/,Kn=/^[^a-z]*$/,Jn=hr("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Yn={number:"number",bigint:"bigint",object:"date"},Xn=hr("$ZodCheckLessThan",(e,t)=>{Jn.init(e,t);const r=Yn[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ei=hr("$ZodCheckGreaterThan",(e,t)=>{Jn.init(e,t);const r=Yn[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ti=hr("$ZodCheckMultipleOf",(e,t)=>{Jn.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ri=hr("$ZodCheckNumberFormat",(e,t)=>{Jn.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Lr[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=o,r&&(n.pattern=Gn)}),e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a))return void s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ni=hr("$ZodCheckMaxLength",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const i=qr(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ii=hr("$ZodCheckMinLength",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const i=qr(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),oi=hr("$ZodCheckLengthEquals",(e,t)=>{var r;Jn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!xr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,i=n.length;if(i===t.length)return;const o=qr(n),s=i>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),si=hr("$ZodCheckStringFormat",(e,t)=>{var r,n;Jn.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ai=hr("$ZodCheckRegex",(e,t)=>{si.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),li=hr("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qn),si.init(e,t)}),ci=hr("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Kn),si.init(e,t)}),ui=hr("$ZodCheckIncludes",(e,t)=>{Jn.init(e,t);const r=Ir(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),di=hr("$ZodCheckStartsWith",(e,t)=>{Jn.init(e,t);const r=new RegExp(`^${Ir(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),pi=hr("$ZodCheckEndsWith",(e,t)=>{Jn.init(e,t);const r=new RegExp(`.*${Ir(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),hi=hr("$ZodCheckOverwrite",(e,t)=>{Jn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class fi{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args,r=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,r.join("\n"))}}const mi=e=>(t,r,n,i)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fr;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Br(e,o,_r())));throw Er(t,i?.callee),t}return s.value},gi=e=>async(t,r,n,i)=>{const o=n?{...n,async:!0}:{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Br(e,o,_r())));throw Er(t,i?.callee),t}return s.value},_i=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new fr;return o.issues.length?{success:!1,error:new(e??Gr)(o.issues.map(e=>Br(e,i,_r())))}:{success:!0,data:o.value}},yi=_i(Vr),vi=e=>async(t,r,n)=>{const i=n?{...n,async:!0}:{async:!0};let o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Br(e,i,_r())))}:{success:!0,data:o.value}},bi=vi(Vr),xi=e=>(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return mi(e)(t,r,i)},wi=e=>(t,r,n)=>mi(e)(t,r,n),ji=e=>async(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return gi(e)(t,r,i)},Si=e=>async(t,r,n)=>gi(e)(t,r,n),ki=e=>(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return _i(e)(t,r,i)},Ci=e=>(t,r,n)=>_i(e)(t,r,n),Ti=e=>async(t,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return vi(e)(t,r,i)},Ei=e=>async(t,r,n)=>vi(e)(t,r,n),Ri={major:4,minor:4,patch:3},Pi=hr("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ri;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,i=zr(e);for(const o of t){if(o._zod.def.when){if(Mr(e))continue;if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new fr;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||(i=zr(e,t)))});else{if(e.issues.length===t)continue;i||(i=zr(e,t))}}return n?n.then(()=>e):e},r=(r,i,o)=>{if(zr(r))return r.aborted=!0,r;const s=t(i,n,o);if(s instanceof Promise){if(!1===o.async)throw new fr;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,o)):r(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new fr;return s.then(e=>t(e,n,o))}return t(s,n,o)}}Sr(e,"~standard",()=>({validate:t=>{try{const r=yi(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return bi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ni=hr("$ZodString",(e,t)=>{var r;Pi.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Oi=hr("$ZodStringFormat",(e,t)=>{si.init(e,t),Ni.init(e,t)}),Ai=hr("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=On),Oi.init(e,t)}),Ii=hr("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=An(e))}else t.pattern??(t.pattern=An());Oi.init(e,t)}),Fi=hr("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=In),Oi.init(e,t)}),Di=hr("$ZodURL",(e,t)=>{Oi.init(e,t),e._zod.check=r=>{try{const n=r.value.trim();if(!t.normalize&&t.protocol?.source===Un.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});const i=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=i.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Li=hr("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Oi.init(e,t)}),zi=hr("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Pn),Oi.init(e,t)}),Mi=hr("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kn),Oi.init(e,t)}),$i=hr("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Cn),Oi.init(e,t)}),Ui=hr("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Tn),Oi.init(e,t)}),Bi=hr("$ZodXID",(e,t)=>{t.pattern??(t.pattern=En),Oi.init(e,t)}),qi=hr("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Rn),Oi.init(e,t)}),Hi=hr("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Wn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${qn}T(?:${n})$`)}(t)),Oi.init(e,t)}),Wi=hr("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hn),Oi.init(e,t)}),Gi=hr("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Wn(t)}$`)),Oi.init(e,t)}),Vi=hr("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Nn),Oi.init(e,t)}),Zi=hr("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fn),Oi.init(e,t),e._zod.bag.format="ipv4"}),Qi=hr("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Dn),Oi.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ki=hr("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ln),Oi.init(e,t)}),Ji=hr("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zn),Oi.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Yi(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xi=hr("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Mn),Oi.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Yi(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),eo=hr("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),Oi.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!$n.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Yi(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),to=hr("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bn),Oi.init(e,t)}),ro=hr("$ZodJWT",(e,t)=>{Oi.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),no=hr("$ZodNumber",(e,t)=>{Pi.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}const i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),io=hr("$ZodNumberFormat",(e,t)=>{ri.init(e,t),no.init(e,t)}),oo=hr("$ZodBoolean",(e,t)=>{Pi.init(e,t),e._zod.pattern=Zn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}const i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),so=hr("$ZodUnknown",(e,t)=>{Pi.init(e,t),e._zod.parse=e=>e}),ao=hr("$ZodNever",(e,t)=>{Pi.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function lo(e,t,r){e.issues.length&&t.issues.push(...$r(r,e.issues)),t.value[r]=e.value}const co=hr("$ZodArray",(e,t)=>{Pi.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},n);a instanceof Promise?o.push(a.then(t=>lo(t,r,e))):lo(a,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function uo(e,t,r,n,i,o){const s=r in n;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...$r(r,e.issues))}s||i?void 0===e.value?s&&(t.value[r]=void 0):t.value[r]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]})}function po(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ho(e,t,r,n,i,o){const s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(const i in t){if("__proto__"===i)continue;if(a.has(i))continue;if("never"===c){s.push(i);continue}const o=l.run({value:t[i],issues:[]},n);o instanceof Promise?e.push(o.then(e=>uo(e,r,i,t,u,d))):uo(o,r,i,t,u,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const fo=hr("$ZodObject",(e,t)=>{Pi.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=br(()=>po(t));Sr(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const i=Rr,o=t.catchall;let s;e._zod.parse=(t,r)=>{s??(s=n.value);const a=t.value;if(!i(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=s.shape;for(const e of s.keys){const n=c[e],i="optional"===n._zod.optin,o="optional"===n._zod.optout,s=n._zod.run({value:a[e],issues:[]},r);s instanceof Promise?l.push(s.then(r=>uo(r,t,e,a,i,o))):uo(s,t,e,a,i,o)}return o?ho(l,a,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),mo=hr("$ZodObjectJIT",(e,t)=>{fo.init(e,t);const r=e._zod.parse,n=br(()=>po(t));let i;const o=Rr,s=!gr.jitless,a=s&&Pr.value,l=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=n.value);const p=u.value;return o(p)?s&&a&&!1===d?.async&&!0!==d.jitless?(i||(i=(e=>{const t=new fi(["shape","payload","ctx"]),r=n.value,i=e=>{const t=Tr(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of r.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],s=Tr(n),a=e[n],l="optional"===a?._zod?.optin,c="optional"===a?._zod?.optout;t.write(`const ${r} = ${i(n)};`),l&&c?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):l?t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n const ${r}_present = ${s} in input;\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${r}_present && !${r}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${r}_present) {\n if (${r}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${r}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,r)=>a(e,t,r)})(t.shape)),u=i(u,d),l?ho([],p,u,d,c,e):u):r(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u)}});function go(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const i=e.filter(e=>!zr(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>Br(e,n,_r())))}),t)}const _o=hr("$ZodUnion",(e,t)=>{Pi.init(e,t),Sr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Sr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Sr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Sr(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>wr(e.source)).join("|")})$`)}});const r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>go(t,n,e,i)):go(s,n,e,i)}}),yo=hr("$ZodIntersection",(e,t)=>{Pi.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,i=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,r])=>bo(e,t,r)):bo(e,i,o)}});function vo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Nr(e)&&Nr(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),i={...e,...t};for(const r of n){const n=vo(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};i[r]=n.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const i=vo(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bo(e,t,r){const n=new Map;let i;for(const r of t.issues)if("unrecognized_keys"===r.code){i??(i=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),zr(e))return e;const s=vo(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const xo=hr("$ZodRecord",(e,t)=>{Pi.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Nr(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const o=[],s=t.keyType._zod.values;if(s){r.value={};const a=new Set;for(const l of s)if("string"==typeof l||"number"==typeof l||"symbol"==typeof l){a.add("number"==typeof l?l.toString():l);const s=t.keyType._zod.run({value:l,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>Br(e,n,_r())),input:l,path:[l],inst:e});continue}const c=s.value,u=t.valueType._zod.run({value:i[l],issues:[]},n);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...$r(l,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...$r(l,u.issues)),r.value[c]=u.value)}let l;for(const e in i)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{r.value={};for(const s of Reflect.ownKeys(i)){if("__proto__"===s)continue;if(!Object.prototype.propertyIsEnumerable.call(i,s))continue;let a=t.keyType._zod.run({value:s,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&Vn.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},n);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Br(e,n,_r())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:i[s],issues:[]},n);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&r.issues.push(...$r(s,e.issues)),r.value[a.value]=e.value})):(l.issues.length&&r.issues.push(...$r(s,l.issues)),r.value[a.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),wo=hr("$ZodEnum",(e,t)=>{Pi.init(e,t);const r=yr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Ar.has(typeof e)).map(e=>"string"==typeof e?Ir(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),jo=hr("$ZodTransform",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new mr(e.constructor.name);const i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new fr;return r.value=i,r.fallback=!0,r}});function So(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ko=hr("$ZodOptional",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Sr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Sr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${wr(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>So(e,n)):So(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Co=hr("$ZodExactOptional",(e,t)=>{ko.init(e,t),Sr(e._zod,"values",()=>t.innerType._zod.values),Sr(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),To=hr("$ZodNullable",(e,t)=>{Pi.init(e,t),Sr(e._zod,"optin",()=>t.innerType._zod.optin),Sr(e._zod,"optout",()=>t.innerType._zod.optout),Sr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${wr(e.source)}|null)$`):void 0}),Sr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Eo=hr("$ZodDefault",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ro(e,t)):Ro(n,t)}});function Ro(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Po=hr("$ZodPrefault",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),No=hr("$ZodNonOptional",(e,t)=>{Pi.init(e,t),Sr(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>Oo(t,e)):Oo(i,e)}});function Oo(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ao=hr("$ZodCatch",(e,t)=>{Pi.init(e,t),e._zod.optin="optional",Sr(e._zod,"optout",()=>t.innerType._zod.optout),Sr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Br(e,r,_r()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Br(e,r,_r()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Io=hr("$ZodPipe",(e,t)=>{Pi.init(e,t),Sr(e._zod,"values",()=>t.in._zod.values),Sr(e._zod,"optin",()=>t.in._zod.optin),Sr(e._zod,"optout",()=>t.out._zod.optout),Sr(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Fo(e,t.in,r)):Fo(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Fo(e,t.out,r)):Fo(n,t.out,r)}});function Fo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const Do=hr("$ZodReadonly",(e,t)=>{Pi.init(e,t),Sr(e._zod,"propValues",()=>t.innerType._zod.propValues),Sr(e._zod,"values",()=>t.innerType._zod.values),Sr(e._zod,"optin",()=>t.innerType?._zod?.optin),Sr(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Lo):Lo(n)}});function Lo(e){return e.value=Object.freeze(e.value),e}const zo=hr("$ZodCustom",(e,t)=>{Jn.init(e,t),Pi.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>Mo(t,r,n,e));Mo(i,r,n,e)}});function Mo(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Hr(e))}}var $o;Symbol("ZodOutput"),Symbol("ZodInput");($o=globalThis).__zod_globalRegistry??($o.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const Uo=globalThis.__zod_globalRegistry;function Bo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Dr(t)})}function qo(e,t){return new Xn({check:"less_than",...Dr(t),value:e,inclusive:!1})}function Ho(e,t){return new Xn({check:"less_than",...Dr(t),value:e,inclusive:!0})}function Wo(e,t){return new ei({check:"greater_than",...Dr(t),value:e,inclusive:!1})}function Go(e,t){return new ei({check:"greater_than",...Dr(t),value:e,inclusive:!0})}function Vo(e,t){return new ti({check:"multiple_of",...Dr(t),value:e})}function Zo(e,t){return new ni({check:"max_length",...Dr(t),maximum:e})}function Qo(e,t){return new ii({check:"min_length",...Dr(t),minimum:e})}function Ko(e,t){return new oi({check:"length_equals",...Dr(t),length:e})}function Jo(e){return new hi({check:"overwrite",tx:e})}function Yo(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Uo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xo(e,t,r={path:[],schemaPath:[]}){var n;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,n);else{const r=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),Xo(o,t,n),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&rs(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function es(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:i,defId:o}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const i=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);n.def={...n.schema},o&&(n.defId=o);const s=n.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){i(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}const o=e.metadataRegistry.get(r[0])?.id;(o||n.cycle||n.count>1&&"ref"===e.reused)&&i(r)}}function ts(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const i=r.def??r.schema,o={...i},s=r.ref;if(r.ref=null,s){n(s);const r=e.seen.get(s),a=r.schema;if(!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&r.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){n(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ns(t,"input",e.processors),output:ns(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function rs(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return rs(n.element,r);if("set"===n.type)return rs(n.valueType,r);if("lazy"===n.type)return rs(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return rs(n.innerType,r);if("intersection"===n.type)return rs(n.left,r)||rs(n.right,r);if("record"===n.type||"map"===n.type)return rs(n.keyType,r)||rs(n.valueType,r);if("pipe"===n.type)return!!e._zod.traits.has("$ZodCodec")||rs(n.in,r)||rs(n.out,r);if("object"===n.type){for(const e in n.shape)if(rs(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(rs(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(rs(e,r))return!0;return!(!n.rest||!rs(n.rest,r))}return!1}const ns=(e,t,r={})=>n=>{const{libraryOptions:i,target:o}=n??{},s=Yo({...i??{},target:o,io:t,processors:r});return Xo(e,s),es(s,e),ts(s,e)},is={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},os=(e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType},ss=hr("ZodISODateTime",(e,t)=>{Hi.init(e,t),Es.init(e,t)});const as=hr("ZodISODate",(e,t)=>{Wi.init(e,t),Es.init(e,t)});const ls=hr("ZodISOTime",(e,t)=>{Gi.init(e,t),Es.init(e,t)});const cs=hr("ZodISODuration",(e,t)=>{Vi.init(e,t),Es.init(e,t)});const us=mi(Kr),ds=gi(Kr),ps=_i(Kr),hs=vi(Kr),fs=xi(Kr),ms=wi(Kr),gs=ji(Kr),_s=Si(Kr),ys=ki(Kr),vs=Ci(Kr),bs=Ti(Kr),xs=Ei(Kr),ws=new WeakMap;function js(e,t,r){const n=Object.getPrototypeOf(e);let i=ws.get(n);if(i||(i=new Set,ws.set(n,i)),!i.has(t)){i.add(t);for(const e in r){const t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){const r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Ss=hr("ZodType",(e,t)=>(Pi.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ns(e,"input"),output:ns(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Yo({...r,processors:t});return Xo(e,n),es(n,e),ts(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>us(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>ps(e,t,r),e.parseAsync=async(t,r)=>ds(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>hs(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>fs(e,t,r),e.decode=(t,r)=>ms(e,t,r),e.encodeAsync=async(t,r)=>gs(e,t,r),e.decodeAsync=async(t,r)=>_s(e,t,r),e.safeEncode=(t,r)=>ys(e,t,r),e.safeDecode=(t,r)=>vs(e,t,r),e.safeEncodeAsync=async(t,r)=>bs(e,t,r),e.safeDecodeAsync=async(t,r)=>xs(e,t,r),js(e,"ZodType",{check(...e){const t=this.def;return this.clone(Cr(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Fr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Dr(r)})}(Ta,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const r=function(e,t){const r=new Jn({check:"custom",...Dr(t)});return r._zod.check=e,r}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(Hr(e,t.value,r._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),t.issues.push(Hr(n))}},e(t.value,t)),t);return r}(e,t)}(e,t))},overwrite(e){return this.check(Jo(e))},optional(){return ga(this)},exactOptional(){return new _a({type:"optional",innerType:this})},nullable(){return va(this)},nullish(){return ga(va(this))},nonoptional(e){return function(e,t){return new wa({type:"nonoptional",innerType:e,...Dr(t)})}(this,e)},array(){return ia(this)},or(e){return la([this,e])},and(e){return new ca({type:"intersection",left:this,right:e})},transform(e){return ka(this,new fa({type:"transform",transform:e}))},default(e){return t=e,new ba({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():Or(t)}});var t},prefault(e){return t=e,new xa({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():Or(t)}});var t},catch(e){return new ja({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return ka(this,e)},readonly(){return new Ca({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Uo.add(t,{description:e}),t},meta(...e){if(0===e.length)return Uo.get(this);const t=this.clone();return Uo.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>Uo.get(e)?.description,configurable:!0}),e)),ks=hr("_ZodString",(e,t)=>{Ni.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(n.minLength=i),"number"==typeof o&&(n.maxLength=o),s&&(n.format=is[s]??s,""===n.format&&delete n.format,"time"===s&&delete n.format),l&&(n.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,js(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new ai({check:"string_format",format:"regex",...Dr(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ui({check:"string_format",format:"includes",...Dr(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new di({check:"string_format",format:"starts_with",...Dr(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new pi({check:"string_format",format:"ends_with",...Dr(t),suffix:e})}(...e))},min(...e){return this.check(Qo(...e))},max(...e){return this.check(Zo(...e))},length(...e){return this.check(Ko(...e))},nonempty(...e){return this.check(Qo(1,...e))},lowercase(e){return this.check(function(e){return new li({check:"string_format",format:"lowercase",...Dr(e)})}(e))},uppercase(e){return this.check(function(e){return new ci({check:"string_format",format:"uppercase",...Dr(e)})}(e))},trim(){return this.check(Jo(e=>e.trim()))},normalize(...e){return this.check(function(e){return Jo(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(Jo(e=>e.toLowerCase()))},toUpperCase(){return this.check(Jo(e=>e.toUpperCase()))},slugify(){return this.check(Jo(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),Cs=hr("ZodString",(e,t)=>{Ni.init(e,t),ks.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Dr(t)})}(Rs,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Dr(t)})}(Os,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Dr(t)})}(Vs,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Dr(t)})}(As,t)),e.guid=t=>e.check(Bo(Ps,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Dr(t)})}(Ns,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Dr(t)})}(Ns,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Dr(t)})}(Ns,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Dr(t)})}(Ns,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Dr(t)})}(Is,t)),e.guid=t=>e.check(Bo(Ps,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Dr(t)})}(Fs,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Dr(t)})}(Ds,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Dr(t)})}(Ls,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Dr(t)})}(Hs,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Dr(t)})}(Ws,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Dr(t)})}(zs,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Dr(t)})}(Ms,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Dr(t)})}($s,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Dr(t)})}(Us,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Dr(t)})}(Bs,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Dr(t)})}(qs,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Dr(t)})}(Gs,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Dr(t)})}(ss,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Dr(t)})}(as,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Dr(t)})}(ls,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Dr(t)})}(cs,e)}(t))});function Ts(e){return function(e,t){return new e({type:"string",...Dr(t)})}(Cs,e)}const Es=hr("ZodStringFormat",(e,t)=>{Oi.init(e,t),ks.init(e,t)}),Rs=hr("ZodEmail",(e,t)=>{Fi.init(e,t),Es.init(e,t)}),Ps=hr("ZodGUID",(e,t)=>{Ai.init(e,t),Es.init(e,t)}),Ns=hr("ZodUUID",(e,t)=>{Ii.init(e,t),Es.init(e,t)}),Os=hr("ZodURL",(e,t)=>{Di.init(e,t),Es.init(e,t)}),As=hr("ZodEmoji",(e,t)=>{Li.init(e,t),Es.init(e,t)}),Is=hr("ZodNanoID",(e,t)=>{zi.init(e,t),Es.init(e,t)}),Fs=hr("ZodCUID",(e,t)=>{Mi.init(e,t),Es.init(e,t)}),Ds=hr("ZodCUID2",(e,t)=>{$i.init(e,t),Es.init(e,t)}),Ls=hr("ZodULID",(e,t)=>{Ui.init(e,t),Es.init(e,t)}),zs=hr("ZodXID",(e,t)=>{Bi.init(e,t),Es.init(e,t)}),Ms=hr("ZodKSUID",(e,t)=>{qi.init(e,t),Es.init(e,t)}),$s=hr("ZodIPv4",(e,t)=>{Zi.init(e,t),Es.init(e,t)}),Us=hr("ZodIPv6",(e,t)=>{Qi.init(e,t),Es.init(e,t)}),Bs=hr("ZodCIDRv4",(e,t)=>{Ki.init(e,t),Es.init(e,t)}),qs=hr("ZodCIDRv6",(e,t)=>{Ji.init(e,t),Es.init(e,t)}),Hs=hr("ZodBase64",(e,t)=>{Xi.init(e,t),Es.init(e,t)}),Ws=hr("ZodBase64URL",(e,t)=>{eo.init(e,t),Es.init(e,t)}),Gs=hr("ZodE164",(e,t)=>{to.init(e,t),Es.init(e,t)}),Vs=hr("ZodJWT",(e,t)=>{ro.init(e,t),Es.init(e,t)}),Zs=hr("ZodNumber",(e,t)=>{no.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?n.type="integer":n.type="number";const u="number"==typeof c&&c>=(i??Number.NEGATIVE_INFINITY),d="number"==typeof l&&l<=(o??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;u?p?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:"number"==typeof i&&(n.minimum=i),d?p?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:"number"==typeof o&&(n.maximum=o),"number"==typeof a&&(n.multipleOf=a)})(e,t,r),js(e,"ZodNumber",{gt(e,t){return this.check(Wo(e,t))},gte(e,t){return this.check(Go(e,t))},min(e,t){return this.check(Go(e,t))},lt(e,t){return this.check(qo(e,t))},lte(e,t){return this.check(Ho(e,t))},max(e,t){return this.check(Ho(e,t))},int(e){return this.check(Js(e))},safe(e){return this.check(Js(e))},positive(e){return this.check(Wo(0,e))},nonnegative(e){return this.check(Go(0,e))},negative(e){return this.check(qo(0,e))},nonpositive(e){return this.check(Ho(0,e))},multipleOf(e,t){return this.check(Vo(e,t))},step(e,t){return this.check(Vo(e,t))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Qs(e){return function(e,t){return new e({type:"number",checks:[],...Dr(t)})}(Zs,e)}const Ks=hr("ZodNumberFormat",(e,t)=>{io.init(e,t),Zs.init(e,t)});function Js(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Dr(t)})}(Ks,e)}const Ys=hr("ZodBoolean",(e,t)=>{oo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.type="boolean"})(0,0,t)});function Xs(e){return function(e,t){return new e({type:"boolean",...Dr(t)})}(Ys,e)}const ea=hr("ZodUnknown",(e,t)=>{so.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function ta(){return new ea({type:"unknown"})}const ra=hr("ZodNever",(e,t)=>{ao.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});const na=hr("ZodArray",(e,t)=>{co.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=Xo(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,js(e,"ZodArray",{min(e,t){return this.check(Qo(e,t))},nonempty(e){return this.check(Qo(1,e))},max(e,t){return this.check(Zo(e,t))},length(e,t){return this.check(Ko(e,t))},unwrap(){return this.element}})});function ia(e,t){return function(e,t,r){return new e({type:"array",element:t,...Dr(r)})}(na,e,t)}const oa=hr("ZodObject",(e,t)=>{mo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const e in s)i.properties[e]=Xo(s[e],t,{...n,path:[...n.path,"properties",e]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Xo(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,r,n),Sr(e,"shape",()=>t.shape),js(e,"ZodObject",{keyof(){return ha(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ta()})},loose(){return this.clone({...this._zod.def,catchall:ta()})},strict(){return this.clone({...this._zod.def,catchall:function(e,t){return new e({type:"never",...Dr(t)})}(ra,e)});var e},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!Nr(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return kr(this,"shape",r),r}});return Fr(e,n)}(this,e)},safeExtend(e){return function(e,t){if(!Nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return kr(this,"shape",r),r}});return Fr(e,r)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return kr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fr(e,r)}(this,e)},pick(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Fr(e,Cr(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return kr(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Cr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return kr(this,"shape",n),n},checks:[]});return Fr(e,i)}(this,e)},partial(...e){return function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return kr(this,"shape",i),i},checks:[]});return Fr(t,i)}(ma,this,e[0])},required(...e){return function(e,t,r){const n=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const t in r){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return kr(this,"shape",i),i}});return Fr(t,n)}(wa,this,e[0])}})});function sa(e,t){const r={type:"object",shape:e??{},...Dr(t)};return new oa(r)}const aa=hr("ZodUnion",(e,t)=>{_o.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,r)=>Xo(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=s:r.anyOf=s})(e,t,r,n),e.options=t.options});function la(e,t){return new aa({type:"union",options:e,...Dr(t)})}const ca=hr("ZodIntersection",(e,t)=>{yo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Xo(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=Xo(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=l})(e,t,r,n)}),ua=hr("ZodRecord",(e,t)=>{xo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=r,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag,l=a?.patterns;if("loose"===o.mode&&l&&l.size>0){const e=Xo(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(const t of l)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=Xo(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Xo(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(i.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function da(e,t,r){return t&&t._zod?new ua({type:"record",keyType:e,valueType:t,...Dr(r)}):new ua({type:"record",keyType:Ts(),valueType:e,...Dr(t)})}const pa=hr("ZodEnum",(e,t)=>{wo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=yr(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const i={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);i[n]=t.entries[n]}return new pa({...t,checks:[],...Dr(n),entries:i})},e.exclude=(e,n)=>{const i={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new pa({...t,checks:[],...Dr(n),entries:i})}});function ha(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new pa({type:"enum",entries:r,...Dr(t)})}const fa=hr("ZodTransform",(e,t)=>{jo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new mr(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Hr(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Hr(t))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});const ma=hr("ZodOptional",(e,t)=>{ko.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>os(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new ma({type:"optional",innerType:e})}const _a=hr("ZodExactOptional",(e,t)=>{Co.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>os(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),ya=hr("ZodNullable",(e,t)=>{To.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=Xo(i.innerType,t,n),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function va(e){return new ya({type:"nullable",innerType:e})}const ba=hr("ZodDefault",(e,t)=>{Eo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),xa=hr("ZodPrefault",(e,t)=>{Po.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),wa=hr("ZodNonOptional",(e,t)=>{No.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType}),ja=hr("ZodCatch",(e,t)=>{Ao.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;let o;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),Sa=hr("ZodPipe",(e,t)=>{Io.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;Xo(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function ka(e,t){return new Sa({type:"pipe",in:e,out:t})}const Ca=hr("ZodReadonly",(e,t)=>{Do.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const i=e._zod.def;Xo(i.innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),Ta=hr("ZodCustom",(e,t)=>{zo.init(e,t),Ss.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}),Ea=sa({support:Xs().optional(),token:Ts().optional(),ip_logging:Qs().int().optional(),expire_redirect:Qs().int().optional(),expire_404:Qs().int().optional(),auto_target:Ts().optional(),location:Ts().optional(),monitor_post:Qs().int().optional(),monitor_types:ia(Ts()).optional(),associated_redirect:Ts().optional(),redirect_cache:Qs().int().optional(),rest_api:Qs().int().optional(),https:Xs().optional(),headers:ia(ta()).optional(),flag_regex:Xs().optional(),flag_query:Ts().optional(),flag_trailing:Xs().optional(),flag_case:Xs().optional(),postTypes:da(Ts(),Ts()).optional(),installed:Ts().optional(),warning:Ts().optional(),plugin_update:Ts().optional()}).passthrough(),Ra=sa({status:ha(["ok","need-update","error"]),version:Ts().optional(),required:Ts().optional(),reason:Ts().optional()});function Pa(e){return pt({queryKey:Xr.settings.get(),queryFn:async()=>{de.getState().setLoadStatus("loading"),de.getState().setError(!1);try{const e=await St(Rt()),t=e?.settings||e,r={...t,postTypes:e?.post_types||t.postTypes,installed:e?.installed||t.installed,warning:e?.warning||t.warning};try{const e=Ea.parse(r);return de.getState().setValues(e),de.getState().setLoadStatus("success"),e}catch(e){if(e instanceof Qr)return de.getState().setValues(r),de.getState().setLoadStatus("success"),tn.getState().addError("Settings validation failed, using unvalidated data."),r;throw e}}catch(e){const t=Yr(e);throw de.getState().setLoadStatus("error"),de.getState().setError(t.message||"Failed to load settings"),tn.getState().addError(t.message||"Failed to load settings"),t}},...e})}function Na(e){const t=u(),{updateValues:r,setSaveStatus:n}=de(),{incrementProgress:i,decrementProgress:o,addNotice:s,addError:a}=tn();return mt({mutationFn:async e=>{i(),n(!0);try{const t=await St(Pt(e)),r=t?.settings||t;return Ea.parse(r)}catch(e){throw o(),n(!1),Yr(e)}},onSuccess:e=>{o(),n(!1),r(e),s("Settings saved"),t.invalidateQueries({queryKey:Xr.settings.all})},onError:e=>{a(e.message||"Failed to save settings")},...e})}function Oa(e){const{setDatabase:t}=de(),{incrementProgress:r,decrementProgress:n,addError:i}=tn();return mt({mutationFn:async e=>{r(),t({inProgress:!0});try{return await St(tr("skip"===e||"stop"===e?{upgrade:e}:void 0))}catch(e){throw n(),t({inProgress:!1,result:"failed"}),Yr(e)}},onSuccess:e=>{n(),t({inProgress:!1,...e})},onError:e=>{i(e.message||"Database upgrade failed")},...e})}function Aa(e){const t=u(),{setShowDatabase:r}=de(),{addError:n}=tn();return mt({mutationFn:async()=>{try{return await St(rr())}catch(e){throw Yr(e)}},onSuccess:()=>{r(!1),t.invalidateQueries({queryKey:Xr.settings.all}),window.location.href=window.Redirectioni10n.pluginRoot},onError:e=>{n(e.message||"Failed to finish setup")},...e})}function Ia(e){const t=u(),{setDatabase:r}=de(),{onSuccess:n,...i}=e||{};return mt({mutationFn:async({reason:e,current:t})=>await St(nr(e,t)),onSuccess:(...e)=>{const[i]=e;r(i.database||{}),t.invalidateQueries({queryKey:Xr.settings.all}),n?.(...e)},...i})}sa({version:Ts(),database:Ra,groups:ia(ta()).optional(),postTypes:ia(Ts()).optional(),canDelete:Xs().optional(),autoTarget:Ts().optional()});const Fa="ok",Da="fail",La="loading",za="warning-current",Ma="warning-not-selected";function $a(e){return e===Fa?(0,i.__)("Good","redirection"):e===Ma||e===za?(0,i.__)("Working but some issues","redirection"):(0,i.__)("Unavailable","redirection")}function Ua({allowChange:e=!0}){const[t,r]=a().useState(!1),n=de(e=>e.apiTest),s=de(e=>e.clearApiTest),c=de(e=>e.api),{mutate:u}=function(){const{setApiTest:e}=de();return mt({mutationFn:async t=>{const r=(e,t,r)=>({message:(0,i.__)("This REST API URL uses a different origin and cannot be tested from the current admin page. Check your WordPress URL/Site URL or proxy configuration.","redirection"),code:"rest_api_cors_mismatch",data:{status:0},request:{url:e,origins:{current:r,test:t}}}),n={};for(const e of t){const{id:t}=e;n[t]={GET:{status:"loading"},POST:{status:"loading"}}}e(n);for(const i of t){const{id:t,url:o}=i,s=o.endsWith("/")?`${o}redirection/v1/plugin/test`:`${o}/redirection/v1/plugin/test`,a=window.location.origin;try{const i=new URL(s,window.location.href).origin;if(i!==a){const o=r(s,i,a);n[t].GET={status:"fail",error:o,code:"cors"},n[t].POST={status:"fail",error:o,code:"cors"},e(n);continue}}catch(e){}try{await St({url:s,method:"GET"}),n[t].GET={status:"ok"}}catch(e){n[t].GET={status:"fail",error:e,code:e?.data?.status||e?.code}}e(n);try{await St({url:s,method:"POST",data:{}}),n[t].POST={status:"ok"}}catch(e){n[t].POST={status:"fail",error:e,code:e?.data?.status||e?.code}}e(n)}return n}})}(),{routes:d,current:p}=c;(0,o.useEffect)(()=>{const e=Object.keys(d).map(e=>({id:e,url:d[e]}));e.length>0&&0===Object.keys(n).length&&u(e.filter(e=>!!e&&!!e.url))},[d,n,u]);const f=()=>{r(!0)},m=e=>t||e===Da,g=jn().map(e=>({text:e.label,value:String(e.value)})),_=function(e,t){if(0===Object.keys(e).length)return 0;const r=2*t.length;let n=0;for(let t=0;t<Object.keys(e).length;t++){const r=Object.keys(e)[t];r&&e[r]&&e[r].GET&&e[r].GET.status!==La&&n++,r&&e[r]&&e[r].POST&&e[r].POST.status!==La&&n++}return Math.round(n/r*100)}(n,g),y=function(e,t,r){const n=Object.keys(e).filter(t=>{return!(!(r=e[t])||!r.GET||!r.POST||r.GET.status!==Da&&r.POST.status!==Da);var r}).length;return 0===n?"ok":n<t.length?(i=e[r])&&i.GET&&i.POST&&i.GET.status===Fa&&i.POST.status===Fa?za:Ma:"fail";var i}(n,g,p),v=_>=100&&m(y)||t,b=h({"api-result-status":!0,"api-result-status_good":y===Fa&&_>=100,"api-result-status_problem":y===za&&Ma&&_>=100,"api-result-status_failed":y===Da&&_>=100});return(0,l.jsxs)("div",{className:"api-result-wrapper",children:[(0,l.jsxs)("div",{className:"api-result-header",children:[(0,l.jsx)("strong",{children:"REST API:"}),(0,l.jsxs)("div",{className:"api-result-progress",children:[(0,l.jsxs)("span",{className:b,children:[_<100&&(0,i.sprintf)(
// translators: %s is the percentage complete
// translators: %s is the percentage complete
(0,i.__)("Testing - %s%%","redirection"),String(_)),_>=100&&$a(y)]}),_<100&&(0,l.jsx)(gn,{})]}),_>=100&&y!==Fa&&(0,l.jsx)("button",{className:"button button-secondary api-result-retry",onClick:e=>{e.preventDefault(),r(!1),s();const t=Object.keys(d).map(e=>({id:e,url:d[e]}));u(t.filter(e=>!!e&&!!e.url))},children:(0,i.__)("Check Again","redirection")})]}),_>=100&&y!==Fa&&(e=>{const t=m(e);let r=(0,i.__)("There are some problems connecting to your REST API. It is not necessary to fix these problems and the plugin is able to work.","redirection");return e===Da&&(r=(0,i.__)("Your REST API is not working and the plugin will not be able to continue until this is fixed.","redirection")),(0,l.jsxs)("div",{className:"api-result-log",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:(0,i.__)("Summary","redirection")}),": ",r]}),!t&&(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-secondary",onClick:f,children:(0,i.__)("Show Problems","redirection")})})]})})(y),v&&g.map((t,r)=>{return(0,l.jsx)(mn,{item:t,result:(i=n,o=t.value,i&&i[o]?i[o]:{}),routes:d,isCurrent:p===t.value,allowChange:e||!1},r);var i,o})]})}function Ba(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(n&&e[n]&&"ok"===e[n].GET.status&&"ok"===e[n].POST.status)return!0}return!1}function qa(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(n&&e[n]&&"ok"===e[n].GET.status&&"ok"===e[n].POST.status)return n}return null}function Ha({setStep:e,step:t}){let r=null,n=null,s=null;try{r=new URL(window.Redirectioni10n.api.WP_API_root),n=new URL(window.Redirectioni10n.pluginBaseUrl),s=new URL(window.location.href)}catch(e){}const a=r&&n&&(r.protocol!==n.protocol||r.host!==n.host),c=r&&s&&r.origin!==s.origin,u=de(e=>e.apiTest),d=Ba(u);return(0,o.useEffect)(()=>()=>{const e=qa(u);null!==e&&window.Redirectioni10n.api.routes[e]&&St.replaceRootURLMiddleware(window.Redirectioni10n.api.routes[e])},[u]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("REST API","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("Redirection uses the {{link}}WordPress REST API{{/link}} to communicate with WordPress. This is enabled and working by default. Sometimes the REST API is blocked by:","redirection"),{link:(0,l.jsx)(N,{url:"https://developer.wordpress.org/rest-api/"})})}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:(0,i.__)("A security plugin (e.g Wordfence)","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("A server firewall or other server configuration (e.g OVH)","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Caching software (e.g Cloudflare)","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Some other plugin that blocks the REST API","redirection")})]}),(0,l.jsx)("p",{children:L((0,i.__)("If you do experience a problem then please consult your plugin documentation, or try contacting your host support. This is generally {{link}}not a problem caused by Redirection{{/link}}.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/rest-api/"})})}),a&&(0,l.jsxs)("div",{className:"wpl-error",children:[(0,i.__)("You have different URLs configured on your WordPress Settings > General page, which is usually an indication of a misconfiguration, and it can cause problems with the REST API. Please review your settings.","redirection"),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:r?r.protocol+"//"+r.host:"unknown url"})}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:n?n.protocol+"//"+n.host:"unknown url"})})]}),c&&(0,l.jsxs)("div",{className:"wpl-error",children:[(0,i.__)("This admin page is being loaded from a different origin than your REST API. The browser will block the setup request until both URLs use the same protocol, host, and port.","redirection"),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:s?s.origin:"unknown url"})}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:r?r.origin:"unknown url"})})]}),(0,l.jsx)(Ua,{allowChange:!1}),(0,l.jsx)("p",{children:(0,i.__)("You will need at least one working REST API to continue.","redirection")}),(0,l.jsx)("div",{className:"wizard-buttons",children:(0,l.jsx)("button",{className:"button-primary button",onClick:()=>e(t+1),disabled:!d,children:(0,i.__)("Finish Setup","redirection")})})]})}function Wa(e){return Wa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wa(e)}function Ga(e,t,r){return(t=function(e){var t=function(e){if("object"!=Wa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Wa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wa(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Va(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Za(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Va(Object(r),!0).forEach(function(t){Ga(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Va(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Qa=r(500),Ka=r.n(Qa),Ja={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Ya=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"];const Xa=function(e){var t=Za(Za({},Ja),e),r=t.className,n=t.percent,i=t.prefixCls,s=t.strokeColor,a=t.strokeLinecap,l=t.strokeWidth,c=t.style,u=t.trailColor,d=t.trailWidth,p=t.transition,h=function(e,t){if(null==e)return{};var r,n,i=m(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(t,Ya);delete h.gapPosition;var g,_,y=Array.isArray(n)?n:[n],v=Array.isArray(s)?s:[s],b=(g=(0,o.useRef)([]),_=(0,o.useRef)(null),(0,o.useEffect)(function(){var e=Date.now(),t=!1;g.current.forEach(function(r){if(r){t=!0;var n=r.style;n.transitionDuration=".3s, .3s, .3s, .06s",_.current&&e-_.current<100&&(n.transitionDuration="0s, 0s")}}),t&&(_.current=Date.now())}),g.current),x=l/2,w=100-l/2,j="M ".concat("round"===a?x:0,",").concat(x,"\n L ").concat("round"===a?w:100,",").concat(x),S="0 0 100 ".concat(l),k=0;return o.createElement("svg",f({className:Ka()("".concat(i,"-line"),r),viewBox:S,preserveAspectRatio:"none",style:c},h),o.createElement("path",{className:"".concat(i,"-line-trail"),d:j,strokeLinecap:a,stroke:u,strokeWidth:d||l,fillOpacity:"0"}),y.map(function(e,t){var r=1;switch(a){case"round":r=1-l/100;break;case"square":r=1-l/2/100;break;default:r=1}var n={strokeDasharray:"".concat(e*r,"px, 100px"),strokeDashoffset:"-".concat(k,"px"),transition:p||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},s=v[t]||v[v.length-1];return k+=e,o.createElement("path",{key:t,className:"".concat(i,"-line-path"),d:j,strokeLinecap:a,stroke:s,strokeWidth:l,fillOpacity:"0",ref:function(e){b[t]=e},style:n})}))};var el,tl=0,rl=!("undefined"==typeof window||!window.document||!window.document.createElement);r.dn(function(e){var t=(void 0)(el.useState(),2),r=t[0],n=t[1];return el.useEffect(function(){var e;n("rc_progress_".concat((rl?(e=tl,tl+=1):e="TEST_OR_SSR",e)))},[]),e||r});const nl=function({message:e,prevent:t=!0}){const r=(0,o.useRef)();return(0,o.useEffect)(()=>{r.current=t=>(t.returnValue=e,t.returnValue)},[e]),(0,o.useEffect)(()=>{if(!t||!r.current)return;const e=e=>{if(r.current)return r.current(e)};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[t]),null};function il({onRetry:e}){return(0,l.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,l.jsx)("h3",{children:(0,i.__)("Database problem","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button button-primary",onClick:e,children:(0,i.__)("Try again","redirection")})})]})}function ol({onRetry:e,error:t}){const{current:r,next:n,debug:o,reason:s}=de(e=>e.database),{mutate:a}=Oa(),c=function(e,t,r,n){return[e?"Message: "+e:null,"Installed: "+t,"Next: "+r,n.length>0?"Debug: "+n.join("\n"):null].filter(e=>e).join("\n")}(s,r,n,o),u="mailto:john@redirection.me?subject=Redirection%20Database&body="+encodeURIComponent("Redirection: "+window.Redirectioni10n.versions);return(0,l.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,l.jsx)("h3",{children:(0,i.__)("Database problem","redirection")}),(0,l.jsx)("p",{children:t}),(0,l.jsxs)("p",{children:[(0,l.jsx)("button",{className:"button button-primary",onClick:e,children:(0,i.__)("Try again","redirection")})," ","-"!==r&&(0,l.jsx)("button",{className:"button button-secondary",onClick:function(){a("skip")},children:(0,i.__)("Skip this stage","redirection")})," ","-"!==r&&(0,l.jsx)("button",{className:"button button-secondary",onClick:function(){a("stop")},children:(0,i.__)("Stop upgrade","redirection")})]}),(0,l.jsx)("p",{children:L((0,i.__)("If you want to {{support}}ask for support{{/support}} please include these details:","redirection"),{support:(0,l.jsx)("button",{type:"button",onClick:function(){window.location.href=u}})})}),(0,l.jsx)(E,{readOnly:!0,value:c,rows:15})]})}function sl(e){return"need-update"===e?(0,i.__)("Upgrading Redirection","redirection"):(0,i.__)("Setting up Redirection","redirection")}function al(e){return"finish-install"===e||"finish-update"===e}function ll({children:e}){const t=de(e=>e.database),{status:r,reason:n,result:s,complete:a}=t,c="ok"===s&&!al(r),{mutate:u}=Oa(),d=(0,o.useCallback)(()=>{u("retry")},[u]),p=(0,o.useCallback)(()=>{u("")},[u]);return(0,o.useEffect)(()=>{(function(e,t){return"error"!==t&&"failed"!==t&&("need-install"===e||"need-update"===e)})(r,s)&&setTimeout(()=>{p()},1e3)},[a,r,s,p]),(0,l.jsxs)("div",{className:"redirection-database",children:[(0,l.jsx)(nl,{message:(0,i.__)("Leaving before the process has completed may cause problems.","redirection"),prevent:"error"!==s&&"failed"!==s&&!al(r)}),(0,l.jsx)("h1",{children:sl(r)}),(0,l.jsx)("p",{children:(0,i.__)("Please remain on this page until complete.","redirection")}),(0,l.jsxs)("div",{className:"redirection-database_progress",children:[(0,l.jsx)("h3",{children:
// translators: %(complete)d is percentage complete as a number
// translators: %(complete)d is percentage complete as a number
(0,i.sprintf)((0,i.__)("Progress: %(complete)d%%","redirection"),{complete:a})}),(0,l.jsx)(Xa,{percent:a,strokeWidth:4,trailWidth:4,strokeLinecap:"square"}),n&&"ok"===s&&(0,l.jsx)("p",{children:n}),c&&(0,l.jsx)("div",{className:"redirection-database_spinner",children:(0,l.jsx)(gn,{})}),"error"===s&&(0,l.jsx)(ol,{error:n||"",onRetry:d}),"failed"===s&&(0,l.jsx)(il,{error:n||"",onRetry:d}),al(r)&&e]})]})}function cl({onCancel:e,onComplete:t}){const r=de(e=>e.loadStatus),{mutate:n}=Ia({onSuccess:()=>{t&&t()}});return(0,l.jsxs)("div",{className:"redirection-database",children:[(0,l.jsx)("h1",{children:(0,i.__)("Manual Install","redirection")}),(0,l.jsxs)("p",{children:[(0,i.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.","redirection")," ",(0,i.__)('Click "Finished! 🎉" when finished.',"redirection")]}),(0,l.jsx)("p",{children:(0,l.jsx)(E,{readOnly:!0,cols:120,value:Redirectioni10n.database.manual.join(";\n\n")+";",spellCheck:!1})}),"error"===r&&(0,l.jsxs)("div",{className:"redirection-database_error wpl-error",children:[(0,l.jsx)("h3",{children:(0,i.__)("Database problem","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("The Redirection database does not appear to exist. Have you run the above SQL?","redirection")})]}),(0,l.jsx)("button",{className:"button button-primary",onClick:function(){n({reason:"database",current:Redirectioni10n.database.next})},type:"button",children:(0,i.__)("Finished! 🎉","redirection")})," ",(0,l.jsx)("button",{className:"button button-secondary",onClick:e,type:"button",children:(0,i.__)("Go back","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("If you do not complete the manual install you will be returned here.","redirection")})]})}function ul({step:e,setStep:t,options:r,setOptions:n}){const{manual:o}=r;return o?(0,l.jsx)(cl,{onCancel:function(){t(0),n({manual:!1})},onComplete:function(){t(e+1)}}):(0,l.jsx)(ll,{children:(0,l.jsx)("div",{className:"wizard-buttons",children:(0,l.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,i.__)("Continue","redirection")})})})}const dl="wordpress-old-slugs";function pl({setOptions:e,options:t,setStep:r,step:n}){const{importers:o=[dl]}=t,{data:s=[]}=on(),a=s.find(e=>e.id===dl),c=s.filter(e=>e.id!==dl);function u(t){const r=o.filter(e=>e!==t.target.name);t.target.checked?e({importers:r.concat(t.target.name)}):e({importers:r})}return(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{children:(0,i.__)("Import Existing Redirects","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Importing existing redirects from WordPress or other plugins is a good way to get started with Redirection. Check each set of redirects you wish to import.","redirection")}),a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("WordPress automatically creates redirects when you change a post URL. Importing these into Redirection will allow you to manage and monitor them.","redirection")}),(0,l.jsx)("ul",{children:(0,l.jsxs)("li",{children:[(0,l.jsx)("input",{id:"wizard-importer-wordpress-old-slugs",type:"checkbox",name:dl,onChange:u,checked:o.includes(dl)}),(0,l.jsxs)("label",{htmlFor:"wizard-importer-wordpress-old-slugs",children:[a.name," (",a.total,")"]})]})})]}),c.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("The following plugins have been detected.","redirection")}),(0,l.jsx)("ul",{children:c.map(e=>{const t=`wizard-importer-${e.id}`;return(0,l.jsxs)("li",{children:[(0,l.jsx)("input",{id:t,type:"checkbox",name:e.id,onChange:u,checked:o.includes(e.id)}),(0,l.jsxs)("label",{htmlFor:t,children:[e.name," (",e.total,")"]})]},e.id)})})]}),(0,l.jsxs)("div",{className:"wizard-buttons",children:[(0,l.jsx)("button",{className:"button-primary button",onClick:()=>r(n+1),children:(0,i.__)("Continue","redirection")})," ",(0,l.jsx)("button",{className:"button",onClick:()=>r(n-1),children:(0,i.__)("Go back","redirection")})]})]})}function hl({step:e,setStep:t,options:r}){const n=sn(),{mutate:s}=n;let a="idle";n.isPending?a="loading":n.isSuccess?a="success":n.isError&&(a="error");const c=(0,o.useCallback)(()=>{const n=r.importers.filter(e=>e.length>0);0!==n.length?s({sourceType:"plugin",mode:"import",pluginId:n,groupId:1,duplicateMode:"import"}):t(e+1)},[s,r.importers,t,e]);return(0,o.useEffect)(()=>{c()},[c]),(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{children:(0,i.__)("Import Existing Redirects","redirection")}),"loading"===a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("Please wait, importing.","redirection")}),(0,l.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})})]}),("success"===a||"error"===a)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:"success"===a?(0,i.__)("Import finished.","redirection"):(0,i.__)("Importing failed.","redirection")}),(0,l.jsxs)("div",{className:"wizard-buttons",children:["error"===a&&(0,l.jsx)("button",{className:"button-secondary button",onClick:c,children:(0,i.__)("Retry","redirection")}),(0,l.jsx)("button",{className:"button-primary button",onClick:()=>t(e+1),children:(0,i.__)("Continue","redirection")})]})]})]})}function fl({options:e}){const t=de(e=>e.apiTest),{addError:r}=tn(),{mutate:n}=Na(),{mutate:o}=Aa(),s=Ba(t);return(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{children:(0,i.__)("Installation Complete","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Redirection is now installed!","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("Please take a moment to consult the {{support}}support site{{/support}} for information about how to use Redirection.","redirection"),{support:(0,l.jsx)(N,{url:"https://redirection.me"})})}),(0,l.jsx)("button",{className:"button button-primary",onClick:function(){if(!s)return void r((0,i.__)("You need at least one working REST API to finish setup.","redirection"));const{ip:a,log:l,monitor:c}=e.settings,u=qa(t);n({expire_redirect:l?7:-1,expire_404:l?7:-1,ip_logging:a?1:0,rest_api:null!==u?Number(u):void 0,monitor_types:c?["post","page"]:void 0,monitor_post:c?1:0},{onSuccess:()=>o()})},type:"button",disabled:!s,children:(0,i.__)("Ready to begin! 🎉","redirection")})]})}const ml=function(){const[e,t]=(0,o.useState)(0),[r,n]=(0,o.useState)({settings:{log:!1,ip:!1,monitor:!1},importers:[]}),s=de(e=>e.database.status),a=de(e=>e.database.reason),c=function(e){return 2===e?pl:4===e?ul:3===e?Ha:1===e?ln:5===e?hl:6===e?fl:he}(e);return(0,l.jsxs)(l.Fragment,{children:["error"===s&&(0,l.jsx)(W,{details:Q(),errors:a,renderDebug:pe,links:Z(),locale:"redirection",children:(0,i.__)("Something went wrong when installing Redirection.","redirection")}),(0,l.jsxs)("div",{className:"wizard-wrapper",children:[0!==e&&3!==e&&(0,l.jsx)("h1",{children:(0,i.__)("Redirection","redirection")}),(0,l.jsx)("div",{className:"wizard",children:(0,l.jsx)(c,{options:r,step:e,setStep:function(e){let n=e;5===e&&0===r.importers.length&&(n=e+1),t(n)},setOptions:e=>n({...r,...e})})})]}),(0,l.jsx)("div",{className:"wizard-support",children:(0,l.jsx)(N,{url:"https://redirection.me/contact/",children:(0,i.__)("I need support!","redirection")})})]})};function gl(e){return"finish-install"===e||"finish-update"===e}function _l(){const{current:e,next:t}=window.Redirectioni10n.database;return e===t?(0,l.jsx)("p",{children:(0,i.__)("A database upgrade is in progress. Please continue to finish.","redirection")}):(0,l.jsx)(l.Fragment,{children:(0,l.jsx)("p",{children:L((0,i.sprintf)(
// translators: %(current)s is the current database version, %(latest)s is the latest database version
// translators: %(current)s is the current database version, %(latest)s is the latest database version
(0,i.__)("Redirection stores data in your database and sometimes this needs upgrading. Your database is at version {{strong}}%(current)s{{/strong}} and the latest is {{strong}}%(latest)s{{/strong}}.","redirection"),{current:window.Redirectioni10n.database.current,latest:window.Redirectioni10n.database.next}),{strong:(0,l.jsx)("strong",{})})})})}function yl(){const{mutate:e}=Ia();function t(){e({reason:"database",current:window.Redirectioni10n.database.next})}return 0===window.Redirectioni10n.database.manual.length?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("Your site already has the latest SQL.","redirection")+" "+(0,i.__)('Click "Complete Upgrade" when finished.',"redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-primary",onClick:t,children:(0,i.__)("Complete Upgrade","redirection")})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{children:[(0,i.__)("If your site needs special database permissions, or you would rather do it yourself, you can manually run the following SQL.")," ",(0,i.__)('Click "Complete Upgrade" when finished.',"redirection")]}),(0,l.jsx)("p",{children:(0,l.jsx)(E,{readOnly:!0,cols:120,value:window.Redirectioni10n.database.manual.join(";\n")+";",spellCheck:!1})}),(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-primary",onClick:t,children:(0,i.__)("Complete Upgrade","redirection")})})]})}function vl({onShowUpgrade:e}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)('Click the "Upgrade Database" button to automatically upgrade the database.',"redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("input",{className:"button-primary",type:"submit",value:(0,i.__)("Upgrade Database","redirection"),onClick:e})})]})}function bl(){const e=de(e=>e.database.reason),t=de(e=>e.database.status),r=de(e=>e.database.result),{mutate:n}=Aa();return(0,l.jsxs)(l.Fragment,{children:["error"===r&&(0,l.jsx)(W,{details:Q(),errors:e,renderDebug:pe,links:Z(),locale:"redirection",children:(0,i.__)("Something went wrong when upgrading Redirection.","redirection")}),(0,l.jsx)("div",{className:"wizard-wrapper",children:(0,l.jsxs)("div",{className:"wizard",children:[(0,l.jsx)(ll,{}),gl(t)&&(0,l.jsx)("button",{className:"button button-primary",onClick:function(){n()},children:(0,i.__)("Finished! 🎉","redirection")})]})})]})}function xl({children:e}){const t=an();return(0,l.jsx)("button",{type:"button",className:"button-link",onClick:function(e){e.preventDefault(),t.isPending||t.mutate({exportType:"redirect",format:"json",redirectScopeType:"all",redirectModule:"all",redirectGroup:0,download:!0,filename:"redirection-backup.json",completionNotice:{message:(0,i.__)("Backup downloaded","redirection")}})},disabled:t.isPending,children:e})}function wl({onShowUpgrade:e}){const[t,r]=(0,o.useState)(!1);function n(e){e.preventDefault(),r(!t)}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h1",{className:"wp-heading-inline",children:(0,i.__)("Upgrade Required","redirection")}),(0,l.jsxs)("div",{className:"wpl-error",children:[(0,l.jsx)("h3",{children:(0,i.__)("Redirection database needs upgrading","redirection")}),_l(),(0,l.jsx)("p",{children:L((0,i.__)("Please make a backup of your Redirection data: {{download}}downloading a backup{{/download}}. If you experience any issues you can import this back into Redirection.","redirection"),{download:(0,l.jsx)(xl,{}),import:(0,l.jsx)(N,{url:"https://redirection.me/support/import-export-redirects/"})})}),t?(0,l.jsx)(yl,{}):(0,l.jsx)(vl,{onShowUpgrade:e})]}),(0,l.jsxs)("div",{className:"database-switch",children:[!t&&(0,l.jsx)("button",{type:"button",onClick:n,children:(0,i.__)("Manual Upgrade","redirection")}),t&&(0,l.jsx)("button",{type:"button",onClick:n,children:(0,i.__)("Automatic Upgrade","redirection")})]})]})}function jl({showDatabase:e,onShowUpgrade:t}){return e?(0,l.jsx)(bl,{}):(0,l.jsx)(wl,{onShowUpgrade:t})}const Sl=({item:e,isCurrent:t,onClick:r,isLast:n,urlBase:i})=>{const o=i+(""===e.value?"":"&sub="+e.value);return(0,l.jsxs)("li",{children:[(0,l.jsx)("a",{className:t?"current":"",href:o,onClick:t=>{t.preventDefault(),r(e.value,o)},children:e.name})," ",!n&&"|"," "]})},kl=(e,t,r)=>e===t.value||e===r&&""===t.value,Cl=({onChangePage:e,menu:t,home:r,urlBase:n,currentPage:i})=>t.length<2?null:(0,l.jsx)("div",{className:"subsubsub-container",children:(0,l.jsx)("ul",{className:"subsubsub",children:t.map((o,s)=>(0,l.jsx)(Sl,{item:o,isCurrent:kl(i,o,r),isLast:s===t.length-1,onClick:e,urlBase:n},s))})});let Tl=!1;function El({notices:e}){const t=e[e.length-1],r=t?.message??"";return(0,l.jsx)(l.Fragment,{children:r+(e.length>1?" ("+e.length+")":"")})}const Rl=function({notices:e,onClear:t,snackBarViewText:r}){const[n,i]=(0,o.useState)(!1);if((0,o.useEffect)(()=>(e.length>0&&(i(!1),Tl&&clearTimeout(Tl),Tl=setTimeout(()=>i(!0),5e3)),()=>{Tl&&clearTimeout(Tl)}),[e]),0===e.length)return null;function s(){n?i(!1):t()}const a=h("notice","notice-info","wpl-notice",n&&"wpl-notice_shrunk");return(0,l.jsxs)("div",{className:a,onClick:s,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},role:"button",tabIndex:0,children:[(0,l.jsx)("div",{className:"closer",children:(0,l.jsx)("span",{className:"dashicons dashicons-yes"})}),(0,l.jsx)("p",{children:n?(0,l.jsx)("span",{className:"dashicons dashicons-warning",title:r}):(0,l.jsx)(El,{notices:e})})]})};function Pl(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Pl(e[r],t[r]))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Pl(e[n],t[n]))return!1}return!0}return!1}function Nl(e){return function(e){const t=new URLSearchParams(e),r={},n=new Map;t.forEach((e,t)=>{const r=t.replace(/\[\d*\]$/,"");n.has(r)||n.set(r,[]),n.get(r).push({key:t,value:e})});for(const[e,t]of n){const n=t.map(e=>e.value);n.length>1?r[e]=n:1===n.length&&(r[e]=n[0])}return r}(e?e.slice(1):document.location.search.slice(1))}function Ol(e,t,r){const n=Nl(r);for(const r in e){const i=Pl(t[r],e[r]);e[r]&&!i||"page"===r?n[r.toLowerCase()]=e[r]:i&&delete n[r.toLowerCase()]}return"?"+function(e){const t=new URLSearchParams;for(const r in e){const n=e[r];if(null!=n)if(Array.isArray(n))if(n.some(e=>"object"==typeof e&&null!==e))t.append(r,JSON.stringify(n));else for(const e of n)null!=e&&t.append(`${r}[]`,String(e));else"object"==typeof n?t.append(r,JSON.stringify(n)):t.append(r,String(n))}return t.toString()}(n)}function Al(e,t){const r=Nl(t);return r.sub&&-1!==e.indexOf(r.sub)?r.sub:e[0]}const Il=function(e){const{page:t,setPage:r,children:n,onPageChange:i,defaultPage:s,baseUrl:a,allowedPages:c}=e,u=(0,o.useRef)(void 0),d=(0,o.useCallback)(()=>{const e=Al(window.Redirectioni10n?.caps?.pages||c);r(e)},[c,r]);return(0,o.useEffect)(()=>(window.addEventListener("popstate",d),()=>{window.removeEventListener("popstate",d)}),[d]),(0,o.useEffect)(()=>{i(),u.current&&u.current!==t&&history.pushState({},"",Ol({sub:t},{sub:s},a)),u.current=t},[a,s,i,t]),(0,l.jsx)(l.Fragment,{children:n})},Fl=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ua,{}),(0,l.jsx)("h3",{children:(0,i.__)("What do I do next?","redirection")}),(0,l.jsxs)("ol",{children:[(0,l.jsx)("li",{children:L((0,i.__)('Take a look at the {{link}}plugin status{{/link}}. It may be able to identify and "magic fix" the problem.',"redirection"),{link:(0,l.jsx)("a",{href:"?page=redirection.php&sub=support"})})}),(0,l.jsx)("li",{children:L((0,i.__)("{{link}}Caching software{{/link}}, in particular Cloudflare, can cache the wrong thing. Try clearing all your caches.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/cloudflare/"})})}),(0,l.jsx)("li",{children:L((0,i.__)("{{link}}Please temporarily disable other plugins!{{/link}} This fixes so many problems.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/plugins/"})})}),(0,l.jsx)("li",{children:L((0,i.__)("Look at your {{link}}Site Health{{/link}} and resolve any issues.","redirection"),{link:(0,l.jsx)(N,{url:Z().siteHealth})})})]})]})};function Dl(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:(0,i.__)("This error may be caused by a browser extension modifying the page. Please try disabling browser extensions for this page.","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("You can also try using a different browser, or using private/incognito mode.","redirection")})]})}function Ll(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{children:[(0,i.__)("Redirection is not working. Try clearing your browser cache and reloading this page.","redirection")," ",(0,i.__)("If you are using a page caching plugin or service (CloudFlare, OVH, etc) then you can also try clearing that cache.","redirection")]}),(0,l.jsx)("p",{children:L((0,i.__)("If that doesn't help, open your browser's error console and create a {{link}}new issue{{/link}} with the details.","redirection"),{link:(0,l.jsx)(N,{url:"https://github.com/johngodley/redirection/issues"})})})]})}const zl=function(e,t,r){const n=e?.stack||"",i=function(e,t){if(e&&(e.includes("chrome-extension://")||e.includes("moz-extension://")))return!0;const r=["Failed to execute 'removeChild'","Failed to execute 'insertBefore'","Failed to execute 'appendChild'","The node to be removed is not a child of this node"];if(t)for(const e of r)if(t.includes(e))return!0;return!1}(n,e?.message||"");return(0,l.jsx)(W,{errors:"",renderDebug:pe,type:"fixed",links:Z(),details:Q().concat([n,t?.componentStack||""]),locale:"redirection",children:i?(0,l.jsx)(Dl,{}):(0,l.jsx)(Ll,{})})},Ml=()=>(0,l.jsx)("div",{className:"wpl-placeholder__container",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})}),$l=function(e){const{isPrimary:t=!1,isSecondary:r=!0,isSubmit:n=!1,isSaving:i=!1,className:o,children:s,disabled:a=!1,isDestructive:c=!1,...u}=e,d=h("button",o,{"button-primary":t,"button-secondary":r,"button-delete":c,"wpl-spinner":i});return(0,l.jsxs)("button",{className:d,disabled:a,type:n?"submit":"button",...u,children:[i&&(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})}),s]})};var Ul="data-focus-lock",Bl="data-focus-lock-disabled";function ql(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Hl="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,Wl=new WeakMap;var Gl={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Vl=function(){return Vl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Vl.apply(this,arguments)};function Zl(e){return e}function Ql(e,t){void 0===t&&(t=Zl);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var i=t(e,n);return r.push(i),function(){r=r.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var i=r;r=[],i.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}};return i}function Kl(e,t){return void 0===t&&(t=Zl),Ql(e,t)}Object.create,Object.create;var Jl=Kl({},function(e){return{target:e.target,currentTarget:e.currentTarget}}),Yl=Kl(),Xl=Kl(),ec=function(e){void 0===e&&(e={});var t=Ql(null);return t.options=Vl({async:!0,ssr:!1},e),t}({async:!0,ssr:"undefined"!=typeof document}),tc=(0,o.createContext)(void 0),rc=[],nc=(0,o.forwardRef)(function(e,t){var r,n,i,s,l,c,u,d=(0,o.useState)(),p=d[0],h=d[1],m=(0,o.useRef)(),g=(0,o.useRef)(!1),_=(0,o.useRef)(null),y=(0,o.useState)({})[1],v=e.children,b=e.disabled,x=void 0!==b&&b,w=e.noFocusGuards,j=void 0!==w&&w,S=e.persistentFocus,k=void 0!==S&&S,C=e.crossFrame,T=void 0===C||C,E=e.autoFocus,R=void 0===E||E,P=(e.allowTextSelection,e.group),N=e.className,O=e.whiteList,A=e.hasPositiveIndices,I=e.shards,F=void 0===I?rc:I,D=e.as,L=void 0===D?"div":D,z=e.lockProps,M=void 0===z?{}:z,$=e.sideCar,U=e.returnFocus,B=void 0!==U&&U,q=e.focusOptions,H=e.onActivation,W=e.onDeactivation,G=(0,o.useState)({})[0],V=(0,o.useCallback)(function(e){var t=e.captureFocusRestore;if(!_.current){var r,n=null==(r=document)?void 0:r.activeElement;_.current=n,n!==document.body&&(_.current=t(n))}m.current&&H&&H(m.current),g.current=!0,y()},[H]),Z=(0,o.useCallback)(function(){g.current=!1,W&&W(m.current),y()},[W]),Q=(0,o.useCallback)(function(e){var t=_.current;if(t){var r=("function"==typeof t?t():t)||document.body,n="function"==typeof B?B(r):B;if(n){var i="object"==typeof n?n:void 0;_.current=null,e?Promise.resolve().then(function(){return r.focus(i)}):r.focus(i)}}},[B]),K=(0,o.useCallback)(function(e){g.current&&Jl.useMedium(e)},[]),J=Yl.useMedium,Y=(0,o.useCallback)(function(e){m.current!==e&&(m.current=e,h(e))},[]),X=f(((r={})[Bl]=x&&"disabled",r[Ul]=P,r),M),ee=!0!==j,te=ee&&"tail"!==j,re=(n=[t,Y],s=i||null,l=function(e){return n.forEach(function(t){return ql(t,e)})},(c=(0,o.useState)(function(){return{value:s,callback:l,facade:{get current(){return c.value},set current(e){var t=c.value;t!==e&&(c.value=e,c.callback(e,t))}}}})[0]).callback=l,u=c.facade,Hl(function(){var e=Wl.get(u);if(e){var t=new Set(e),r=new Set(n),i=u.current;t.forEach(function(e){r.has(e)||ql(e,null)}),r.forEach(function(e){t.has(e)||ql(e,i)})}Wl.set(u,n)},[n]),u),ne=(0,o.useMemo)(function(){return{observed:m,shards:F,enabled:!x,get active(){return g.current}}},[x,g,F,m]);return a().createElement(o.Fragment,null,ee&&[a().createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:x?-1:0,style:Gl}),A?a().createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:x?-1:1,style:Gl}):null],!x&&a().createElement($,{id:G,sideCar:ec,observed:p,disabled:x,persistentFocus:k,crossFrame:T,autoFocus:R,whiteList:O,shards:F,onActivation:V,onDeactivation:Z,returnFocus:Q,focusOptions:q,noFocusGuards:j}),a().createElement(L,f({ref:re},X,{className:N,onBlur:J,onFocus:K}),a().createElement(tc.Provider,{value:ne},v)),te&&a().createElement("div",{"data-focus-guard":!0,tabIndex:x?-1:0,style:Gl}))});nc.propTypes={};const ic=nc;function oc(e,t){return oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oc(e,t)}var sc=function(e){for(var t=Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t},ac=function(e){return Array.isArray(e)?e:[e]},lc=function(e){return Array.isArray(e)?e[0]:e},cc=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},uc=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},dc=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!e||uc(e)||!function(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;var t=window.getComputedStyle(e,null);return!(!t||!t.getPropertyValue||"none"!==t.getPropertyValue("display")&&"hidden"!==t.getPropertyValue("visibility"))}(e)&&!function(e){return e.hasAttribute("inert")}(e)&&t(cc(e))}(t,dc.bind(void 0,e));return e.set(t,n),n},pc=function(e,t){var r=e.get(t);if(void 0!==r)return r;var n=function(e,t){return!(e&&!uc(e))||!!gc(e)&&t(cc(e))}(t,pc.bind(void 0,e));return e.set(t,n),n},hc=function(e){return e.dataset},fc=function(e){return"INPUT"===e.tagName},mc=function(e){return fc(e)&&"radio"===e.type},gc=function(e){var t=e.getAttribute("data-no-autofocus");return![!0,"true",""].includes(t)},_c=function(e){var t;return Boolean(e&&(null===(t=hc(e))||void 0===t?void 0:t.focusGuard))},yc=function(e){return!_c(e)},vc=function(e){return Boolean(e)},bc=function(e,t){var r=Math.max(0,e.tabIndex),n=Math.max(0,t.tabIndex),i=r-n,o=e.index-t.index;if(i){if(!r)return 1;if(!n)return-1}return i||o},xc=function(e,t,r){return sc(e).map(function(e,t){var n=function(e){return e.tabIndex<0&&!e.hasAttribute("tabindex")?0:e.tabIndex}(e);return{node:e,index:t,tabIndex:r&&-1===n?(e.dataset||{}).focusGuard?0:-1:n}}).filter(function(e){return!t||e.tabIndex>=0}).sort(bc)},wc=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),jc="".concat(wc,", [data-focus-guard]"),Sc=function(e,t){return sc((e.shadowRoot||e).children).reduce(function(e,r){return e.concat(r.matches(t?jc:wc)?[r]:[],Sc(r))},[])},kc=function(e,t){return e.reduce(function(e,r){var n,i=Sc(r,t),o=(n=[]).concat.apply(n,i.map(function(e){return function(e,t){var r;return e instanceof HTMLIFrameElement&&(null===(r=e.contentDocument)||void 0===r?void 0:r.body)?kc([e.contentDocument.body],t):[e]}(e,t)}));return e.concat(o,r.parentNode?sc(r.parentNode.querySelectorAll(wc)).filter(function(e){return e===r}):[])},[])},Cc=function(e,t){return sc(e).filter(function(e){return dc(t,e)}).filter(function(e){return function(e){return!((fc(e)||function(e){return"BUTTON"===e.tagName}(e))&&("hidden"===e.type||e.disabled))}(e)})},Tc=function(e,t){return void 0===t&&(t=new Map),sc(e).filter(function(e){return pc(t,e)})},Ec=function(e,t,r){return xc(Cc(kc(e,r),t),!0,r)},Rc=function(e,t){return xc(Cc(kc(e),t),!1)},Pc=function(e,t){return e.shadowRoot?Pc(e.shadowRoot,t):!(void 0===Object.getPrototypeOf(e).contains||!Object.getPrototypeOf(e).contains.call(e,t))||sc(e.children).some(function(e){var r;if(e instanceof HTMLIFrameElement){var n=null===(r=e.contentDocument)||void 0===r?void 0:r.body;return!!n&&Pc(n,t)}return Pc(e,t)})},Nc=function(e){if(void 0===e&&(e=document),e&&e.activeElement){var t=e.activeElement;return t.shadowRoot?Nc(t.shadowRoot):t instanceof HTMLIFrameElement&&function(){try{return t.contentWindow.document}catch(e){return}}()?Nc(t.contentWindow.document):t}},Oc=function(e){return e.parentNode?Oc(e.parentNode):e},Ac=function(e){return ac(e).filter(Boolean).reduce(function(e,t){var r=t.getAttribute(Ul);return e.push.apply(e,r?function(e){for(var t=new Set,r=e.length,n=0;n<r;n+=1)for(var i=n+1;i<r;i+=1){var o=e[n].compareDocumentPosition(e[i]);(o&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(i),(o&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(n)}return e.filter(function(e,r){return!t.has(r)})}(sc(Oc(t).querySelectorAll("[".concat(Ul,'="').concat(r,'"]:not([').concat(Bl,'="disabled"])')))):[t]),e},[])},Ic=function(e,t){return void 0===t&&(t=Nc(lc(e).ownerDocument)),!(!t||t.dataset&&t.dataset.focusGuard)&&Ac(e).some(function(e){return Pc(e,t)||function(e,t){return Boolean(sc(e.querySelectorAll("iframe")).some(function(e){return function(e,t){return e===t}(e,t)}))}(e,t)})},Fc=function(e,t){e&&("focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus())},Dc=function(e,t){return mc(e)&&e.name?function(e,t){return t.filter(mc).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e,t):e},Lc=function(e){return e[0]&&e.length>1?Dc(e[0],e):e[0]},zc=function(e,t){return e.indexOf(Dc(t,e))},Mc="NEW_FOCUS",$c=function(e,t,r){var n,i=e.map(function(e){return e.node}),o=Tc(i.filter((n=r,function(e){var t,r=null===(t=hc(e))||void 0===t?void 0:t.autofocus;return e.autofocus||void 0!==r&&"false"!==r||n.indexOf(e)>=0})));return o&&o.length?Lc(o):Lc(Tc(t))},Uc=function(e,t){return void 0===t&&(t=[]),t.push(e),e.parentNode&&Uc(e.parentNode.host||e.parentNode,t),t},Bc=function(e,t){for(var r=Uc(e),n=Uc(t),i=0;i<r.length;i+=1){var o=r[i];if(n.indexOf(o)>=0)return o}return!1},qc=function(e,t,r){var n=ac(e),i=ac(t),o=n[0],s=!1;return i.filter(Boolean).forEach(function(e){s=Bc(s||e,e)||s,r.filter(Boolean).forEach(function(e){var t=Bc(o,e);t&&(s=!s||Pc(t,s)?t:Bc(t,s))})}),s},Hc=function(e,t){return e.reduce(function(e,r){return e.concat(function(e,t){return Cc((r=e.querySelectorAll("[".concat("data-autofocus-inside","]")),sc(r).map(function(e){return kc([e])}).reduce(function(e,t){return e.concat(t)},[])),t);var r}(r,t))},[])},Wc=function(e,t){var r=Nc(ac(e).length>0?document:lc(e).ownerDocument),n=Ac(e).filter(yc),i=qc(r||e,e,n),o=new Map,s=Rc(n,o),a=s.filter(function(e){var t=e.node;return yc(t)});if(a[0]){var l,c,u,d=Rc([i],o).map(function(e){return e.node}),p=(l=d,c=a,u=new Map,c.forEach(function(e){return u.set(e.node,e)}),l.map(function(e){return u.get(e)}).filter(vc)),h=p.map(function(e){return e.node}),f=p.filter(function(e){return e.tabIndex>=0}).map(function(e){return e.node}),m=function(e,t,r,n,i){var o=e.length,s=e[0],a=e[o-1],l=_c(n);if(!(n&&e.indexOf(n)>=0)){var c=void 0!==n?r.indexOf(n):-1,u=i?r.indexOf(i):c,d=i?e.indexOf(i):-1;if(-1===c)return-1!==d?d:Mc;if(-1===d)return Mc;var p,h,f=c-u,m=r.indexOf(s),g=r.indexOf(a),_=(p=r,h=new Set,p.forEach(function(e){return h.add(Dc(e,p))}),p.filter(function(e){return h.has(e)})),y=void 0!==n?_.indexOf(n):-1,v=i?_.indexOf(i):y,b=_.filter(function(e){return e.tabIndex>=0}),x=void 0!==n?b.indexOf(n):-1,w=i?b.indexOf(i):x,j=x>=0&&w>=0?w-x:v-y;if(!f&&d>=0)return d;if(0===t.length)return d;var S=zc(e,t[0]),k=zc(e,t[t.length-1]);return c<=m&&l&&Math.abs(f)>1?k:c>=g&&l&&Math.abs(f)>1?S:f&&Math.abs(j)>1?d:c<=m?k:c>g?S:f?Math.abs(f)>1?d:(o+d+f)%o:void 0}}(h,f,d,r,t);if(m===Mc){var g=$c(s,f,Hc(n,o))||$c(s,h,Hc(n,o));return g?{node:g}:void console.warn("focus-lock: cannot find any node to move focus into")}return void 0===m?m:p[m]}},Gc=0,Vc=!1,Zc=function(e,t,r){void 0===r&&(r={});var n=Wc(e,t);if(!Vc&&n){if(Gc>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Vc=!0,void setTimeout(function(){Vc=!1},1);Gc++,Fc(n.node,r.focusOptions),Gc--}};function Qc(e){if(!e)return null;if("undefined"==typeof WeakRef)return function(){return e||null};var t=e?new WeakRef(e):null;return function(){return(null==t?void 0:t.deref())||null}}var Kc=function(e){var t=function(e){if(!e)return null;for(var t=[],r=e;r&&r!==document.body;)t.push({current:Qc(r),parent:Qc(r.parentElement),left:Qc(r.previousElementSibling),right:Qc(r.nextElementSibling)}),r=r.parentElement;return{element:Qc(e),stack:t,ownerDocument:e.ownerDocument}}(e);return function(){return function(e){var t,r,n,i,o;if(e)for(var s=e.stack,a=e.ownerDocument,l=new Map,c=0,u=s;c<u.length;c++){var d=u[c],p=null===(t=d.parent)||void 0===t?void 0:t.call(d);if(p&&a.contains(p)){for(var h=null===(r=d.left)||void 0===r?void 0:r.call(d),f=d.current(),m=p.contains(f)?f:void 0,g=null===(n=d.right)||void 0===n?void 0:n.call(d),_=Ec([p],l),y=null!==(o=null!==(i=null!=m?m:null==h?void 0:h.nextElementSibling)&&void 0!==i?i:g)&&void 0!==o?o:h;y;){for(var v=0,b=_;v<b.length;v++){var x=b[v];if(null==y?void 0:y.contains(x.node))return x.node}y=y.nextElementSibling}if(_.length)return _[0].node}}}(t)}},Jc=function(e,t,r){void 0===t&&(t={});var n=function(e){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},e)}(t),i=function(e,t,r){if(!e||!t)return console.error("no element or scope given"),{};var n=ac(t);if(n.every(function(t){return!Pc(t,e)}))return console.error("Active element is not contained in the scope"),{};var i=r?Ec(n,new Map):Rc(n,new Map),o=i.findIndex(function(t){return t.node===e});return-1!==o?{prev:i[o-1],next:i[o+1],first:i[0],last:i[i.length-1]}:void 0}(e,n.scope,n.onlyTabbable);if(i){var o=r(i,n.cycle);o&&Fc(o.node,n.focusOptions)}},Yc=function(e,t,r){var n,i,o,s,a=(i=e,o=null===(n=t.onlyTabbable)||void 0===n||n,{first:(s=o?Ec(ac(i),new Map):Rc(ac(i),new Map))[0],last:s[s.length-1]})[r];a&&Fc(a.node,t.focusOptions)};function Xc(e){setTimeout(e,1)}var eu=function(e){return e&&"current"in e?e.current:e},tu=function(){return document&&document.activeElement===document.body},ru=null,nu=null,iu=function(){return null},ou=null,su=!1,au=!1,lu=function(){return!0};function cu(e,t,r,n){var i=null,o=e;do{var s=n[o];if(s.guard)s.node.dataset.focusAutoGuard&&(i=s);else{if(!s.lockItem)break;if(o!==e)return;i=null}}while((o+=r)!==t);i&&(i.node.tabIndex=0)}var uu=function e(t,r,n){return r&&(r.host===t&&(!r.activeElement||n.contains(r.activeElement))||r.parentNode&&e(t,r.parentNode,n))},du=function(e){return Rc(e,new Map)},pu=function(){var e,t,r,n,i,o,s,a=!1;if(ru){var l=ru,c=l.observed,u=l.persistentFocus,d=l.autoFocus,p=l.shards,h=l.crossFrame,f=l.focusOptions,m=l.noFocusGuards,g=c||ou&&ou.portaledElement;if(tu()&&nu&&nu!==document.body&&(!document.body.contains(nu)||!du([(s=nu).parentNode]).some(function(e){return e.node===s}))){var _=iu();_&&_.focus()}var y=document&&document.activeElement;if(g){var v=[g].concat(p.map(eu).filter(Boolean));if(y&&!function(e){return(ru.whiteList||lu)(e)}(y)||(u||function(){if(!(h?Boolean(su):"meanwhile"===su)||!m||!nu||au)return!1;var e=du(v),t=e.findIndex(function(e){return e.node===nu});return 0===t||t===e.length-1}()||!(tu()||function(e){void 0===e&&(e=document);var t=Nc(e);return!!t&&sc(e.querySelectorAll("[".concat("data-no-focus-lock","]"))).some(function(e){return Pc(e,t)})}())||!nu&&d)&&(g&&!(Ic(v)||y&&function(e,t){return t.some(function(t){return uu(e,t,t)})}(y,v)||(o=y,ou&&ou.portaledElement===o))&&(document&&!nu&&y&&!d?(y.blur&&y.blur(),document.body.focus()):(a=Zc(v,nu,{focusOptions:f}),ou={})),(nu=document&&document.activeElement)!==document.body&&(iu=Kc(nu)),su=!1),document&&y!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var b=document&&document.activeElement,x=(t=Ac(e=v).filter(yc),r=qc(e,e,t),n=xc(kc([r],!0),!0,!0),i=kc(t,!1),n.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:i.indexOf(t)>=0,guard:_c(t)}})),w=x.map(function(e){return e.node}).indexOf(b);w>-1&&(x.filter(function(e){var t=e.guard,r=e.node;return t&&r.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")}),cu(w,x.length,1,x),cu(w,-1,-1,x))}}}return a},hu=function(e){pu()&&e&&(e.stopPropagation(),e.preventDefault())},fu=function(){return Xc(pu)},mu=function(){au=!0},gu=function(){au=!1,su="just",Xc(function(){su="meanwhile"})},_u={moveFocusInside:Zc,focusInside:Ic,focusNextElement:function(e,t){void 0===t&&(t={}),Jc(e,t,function(e,t){var r=e.next,n=e.first;return r||t&&n})},focusPrevElement:function(e,t){void 0===t&&(t={}),Jc(e,t,function(e,t){var r=e.prev,n=e.last;return r||t&&n})},focusFirstElement:function(e,t){void 0===t&&(t={}),Yc(e,t,"first")},focusLastElement:function(e,t){void 0===t&&(t={}),Yc(e,t,"last")},captureFocusRestore:Kc};Jl.assignSyncMedium(function(e){var t=e.target,r=e.currentTarget;r.contains(t)||(ou={observerNode:r,portaledElement:t})}),Yl.assignMedium(fu),Xl.assignMedium(function(e){return e(_u)});const yu=(vu=function(e){return e.filter(function(e){return!e.disabled})},bu=function(e){var t=e.slice(-1)[0];t&&!ru&&(document.addEventListener("focusin",hu),document.addEventListener("focusout",fu),window.addEventListener("focus",mu),window.addEventListener("blur",gu));var r=ru,n=r&&t&&t.id===r.id;ru=t,r&&!n&&(r.onDeactivation(),e.filter(function(e){return e.id===r.id}).length||r.returnFocus(!t)),t?(nu=null,n&&r.observed===t.observed||t.onActivation(_u),pu(),Xc(pu)):(document.removeEventListener("focusin",hu),document.removeEventListener("focusout",fu),window.removeEventListener("focus",mu),window.removeEventListener("blur",gu),nu=null)},function(e){var t,r=[];function n(){t=vu(r.map(function(e){return e.props})),bu(t)}var i=function(i){function o(){return i.apply(this,arguments)||this}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,oc(e,t)}(o,i),o.peek=function(){return t};var s=o.prototype;return s.componentDidMount=function(){r.push(this),n()},s.componentDidUpdate=function(){n()},s.componentWillUnmount=function(){var e=r.indexOf(this);r.splice(e,1),n()},s.render=function(){return a().createElement(e,this.props)},o}(o.PureComponent);return Ga(i,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(e)+")"),i})(function(){return null});var vu,bu,xu=(0,o.forwardRef)(function(e,t){return a().createElement(ic,f({sideCar:yu,ref:t},e))}),wu=ic.propTypes||{};wu.sideCar,m(wu,["sideCar"]),xu.propTypes={};const ju=xu;function Su(e){if(null===e)return null;const{left:t,top:r,height:n}=e;return{left:t,top:r+n}}function ku(e,t){return t?{...e,width:t.getBoundingClientRect().width}:e}function Cu({style:e,align:t}){const r=h("wpl-popover__arrows",{"wpl-popover__arrows__left":"left"===t,"wpl-popover__arrows__right":"right"===t,"wpl-popover__arrows__centre":"centre"===t});return(0,l.jsx)("div",{className:r,style:e})}const Tu=function(e){const{position:t,children:r,popoverPosition:n,align:i,valign:s,hasArrow:a}=e,[c,u]=(0,o.useState)({arrow:{},content:{visibility:"hidden",...t}}),d=(0,o.useCallback)(e=>{if(e){const r=function(e,t,r,n,i,o){if(null===e||null===t)return{};if(!i)return{...e,visibility:"hidden"};const s=e.width?e.width:i.getBoundingClientRect().width,a=t.parentWidth-s-20,l=function(e,t,r,n){return"right"===n?e+t-r:"centre"===n?e-r/2:e}(t.left,t.width,e.width?e.width:s,r);return{...e,left:Math.min(a,l),top:o?e.top+5:e.top}}(t,n,i,0,e,!!a);u({content:r,arrow:ku(r,e)})}},[t,n,i,s,a]);return(0,l.jsxs)(l.Fragment,{children:[a&&(0,l.jsx)(Cu,{style:c.arrow,align:i}),(0,l.jsx)("div",{className:"wpl-popover__content",style:{...c.content,visibility:t&&t.left?"visible":"hidden",...null!==e.style?e.style:{}},ref:d,children:r})]})};function Eu(e,t){if(!t)return!1;const r=e.target;return!(r&&t.contains(r)||"keydown"===e.type||r&&(r.closest(".wpl-dropdowntext__suggestions")||r.closest(".wpl-multioption")))}function Ru(e){const t=(0,o.useRef)(null),{children:r,onOutside:n,className:i}=e,s=(0,o.useCallback)(e=>{(Eu(e,t.current)||"key"in e&&"Escape"===e.key)&&n(e)},[n]);return(0,o.useEffect)(()=>(addEventListener("mousedown",s),addEventListener("keydown",s),()=>{removeEventListener("mousedown",s),removeEventListener("keydown",s)}),[s]),(0,l.jsx)("div",{className:i,ref:t,children:r})}function Pu(e){let t=document.getElementById(e);if(null===t){const r=document.getElementById("wpbody");t=document.createElement("div"),r&&r.parentNode&&(t.setAttribute("id",e),r.parentNode.appendChild(t))}return t}function Nu(e,t="bottom"){const r=document.getElementById("wpwrap");if(null===e||null===r)return null;const n=r.getBoundingClientRect(),{height:i,width:o,left:s,top:a}=e.getBoundingClientRect();return{left:"bottom"===t?s-n.left:s+o/2-n.left-7,top:a-n.top+1,width:o,height:i,parentWidth:n.width,parentHeight:n.height,ref:e}}const Ou=function(e){const{children:t,className:r,align:i="left",valign:s="bottom",onClose:a,hasArrow:c=!1,popoverPosition:u,style:d=null,focusLock:p=!0}=e;return(0,o.useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]),(0,n.createPortal)((0,l.jsx)(Ru,{className:h("wpl-popover",r),onOutside:e=>{u&&!1===Eu(e,u.ref)&&"Escape"!==e.key||a()},children:(0,l.jsx)(ju,{returnFocus:!0,disabled:!p,children:(0,l.jsx)(Tu,{position:Su(u),popoverPosition:u,align:i,hasArrow:c,valign:s,style:d,children:t})})}),Pu("wpl-dropdown-portal")||document.body)},Au=function(e){const{renderContent:t,className:r,renderToggle:n,align:i="left",valign:s="bottom",hasArrow:a=!1,matchMinimum:c=!1,disabled:u=!1,onClose:d}=e,[p,f]=(0,o.useState)(!1),[m,g]=(0,o.useState)(null),_=(0,o.useRef)(null);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:h("wpl-popover__toggle",r,u&&"wpl-popover__toggle__disabled"),ref:_,children:n(p,e=>{if(!_.current)return;const t=Nu(_.current,s);e?.stopPropagation(),u||(g(t),f(!p))})}),p&&m&&(0,l.jsx)(Ou,{align:i,valign:s,hasArrow:a,...void 0!==r?{className:r}:{},onClose:function(){f(!1),d?.()},popoverPosition:m,...c&&m.width?{style:{minWidth:`${m.width}px`}}:{},children:t(()=>f(!1))})]})};function Iu({option:e,onChange:t,isSelected:r,optionsType:n="checkbox",name:i}){const{value:o,disabled:s=!1,label:a}=e,c="radio"===n?`multi_${o}`:`multi_${i}_${o}`;return(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:c,type:n,name:i||o,value:o,onChange:e=>t(i,o,"checkbox"!==n||e.target.checked),checked:r(i,o),disabled:s,tabIndex:0}),(0,l.jsx)("label",{"aria-label":e.label,htmlFor:c,children:a})]})}const Fu=function(e){const{option:t,optionsType:r,onChange:n,isSelected:i}=e,{options:o=[],label:s,value:a}=t;return(0,l.jsxs)("div",{className:"wpl-multioption__group",children:[(0,l.jsx)("h5",{children:s}),o.map((e,t)=>(0,l.jsx)(Iu,{option:e,isSelected:i,onChange:n,name:a||e.value,optionsType:r},t))]})},Du=function(e){const{option:t,isSelected:r,onChange:n}=e;if(t.options){const{optionsType:e="checkbox"}=t;return(0,l.jsx)(Fu,{option:t,optionsType:e,isSelected:r,onChange:n})}const i=t.value||"";return(0,l.jsx)(Iu,{option:{label:t.label,value:i,disabled:t.disabled??!1,default:t.default??!1},isSelected:r,onChange:n,optionsType:"checkbox",name:i})},Lu=e=>{const{children:t,className:r,onClick:n,title:i="",onCancel:o,disabled:s=!1,small:a=!1}=e,c={title:i,onClick:n};return(0,l.jsxs)("div",{className:h("wpl-badge",r,{"wpl-badge__click":n,"wpl-badge__small":a,"wpl-badge__disabled":s}),...c,children:[(0,l.jsx)("div",{className:"wpl-badge__content",children:t}),o&&(0,l.jsx)("div",{className:"wpl-badge__close dashicons dashicons-no-alt",onClick:e=>{e.preventDefault(),!s&&o&&o(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),!s&&o&&o(e))},role:"button",tabIndex:0})]})};function zu(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n){if(n.value===t)return n;if(n.options){const e=zu(n.options,t);if(e)return e}}}return null}function Mu(e,t){return e&&t?{title:e.badge||e.label,default:e.default??!1,onRemove:r=>{if(e.value===t.value)return r(e.value||"",e.value||"",!1);const n=(t.options||[]).find(e=>e.default);n?r(t.value||"",n.value,!0):r(t.value||"",e.value||"",!1)}}:null}function $u(e){const t=zu(e,""),r=Mu(t,t);return r?[r]:[]}function Uu({selected:e,title:t,options:r,showBadges:n,onChange:i,disabled:o}){let s;if(s=function(e){return Array.isArray(e)?-1!==e.indexOf(""):Boolean(e?.[""])}(e)&&r.length>0?$u(r):Array.isArray(e)?function(e,t){return-1!==e.indexOf("")?$u(t):e.map(e=>{const r=zu(t,e);return Mu(r,r)}).filter(e=>null!==e)}(e,r):function(e,t){return Object.keys(e).map(r=>{const n=zu(t,r);return"string"==typeof e[r]?Mu(zu(t,e[r]),n):e[r]?Mu(n,n):null}).filter(e=>null!==e).filter(e=>e&&!0!==e.default)}(e,r),s.length>0&&n){const e=s.slice(0,3).map((e,t)=>e?(0,l.jsx)(Lu,{small:!0,onCancel:t=>function(e,t){e.preventDefault(),e.stopPropagation(),t.onRemove(i)}(t,e),disabled:o,children:e.title},t):null);return s.length>3?e.concat([(0,l.jsx)("span",{children:"..."},"end")]):e}return t.length>0&&(!n||0===s.length)?(0,l.jsx)("h5",{children:t}):null}const Bu=function({onClick:e}){return(0,l.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",onClick:e,children:(0,l.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})},qu=function(e){const{options:t,selected:r,onChange:n,title:i="",badges:o=!1,compact:s=!1,disabled:a=!1,className:c,asObject:u=!1}=e,d=h(c,s&&"wpl-multioption__compact");function p(e,t){if(u){const n=r;return e===t?Boolean(n[t]):n[e]===t}return-1!==r.indexOf(t)}function f(e,t,i){if(u)n({...r,[e]:e===t?i:t});else{const o=r,s=e===t?e:t;n(i?[...o,s]:o.filter(e=>e!==s))}}return(0,l.jsx)(Au,{className:d,renderToggle:(e,n)=>(0,l.jsxs)("div",{className:h("action","wpl-multioption__button",a&&"wpl-multioption__disabled",e?"wpl-multioption__button_enabled":null),onClick:n,tabIndex:0,"aria-label":i||"",children:[(0,l.jsx)(Uu,{selected:r,title:i,showBadges:o,options:t,disabled:a,onChange:f}),(0,l.jsx)(Bu,{})]}),disabled:a,align:"right",matchMinimum:!0,renderContent:()=>(0,l.jsx)("div",{className:h("wpl-multioption",d),children:t.map((e,t)=>(0,l.jsx)(Du,{option:e,isSelected:p,onChange:f},t))})})},Hu=function({level:e="notice",children:t,className:r}){return(0,l.jsx)("div",{className:h(`inline-notice inline-${e}`,r),children:t})},Wu=()=>[{value:-1,label:(0,i.__)("No logs","redirection")},{value:1,label:(0,i.__)("A day","redirection")},{value:7,label:(0,i.__)("A week","redirection")},{value:30,label:(0,i.__)("A month","redirection")},{value:60,label:(0,i.__)("Two months","redirection")},{value:0,label:(0,i.__)("Forever","redirection")}],Gu=function(e){const{settings:t,onChange:r,getLink:n}=e,{expire_redirect:o,expire_404:s,ip_logging:a,log_external:c,track_hits:u,log_header:d,ip_proxy:p=[],ip_headers:h=[]}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("tr",{className:"redirect-option__row",children:(0,l.jsx)("th",{colSpan:2,children:(0,l.jsx)("h2",{className:"title",children:(0,i.__)("Logs","redirection")})})}),(0,l.jsxs)(yn,{title:(0,i.__)("Redirect Logs","redirection")+":",url:n("logs"),children:[(0,l.jsx)(wn,{items:Wu(),name:"expire_redirect",value:String(o),onChange:r})," ",(0,i.__)("(time to keep logs for)","redirection")]}),(0,l.jsxs)(yn,{title:(0,i.__)("404 Logs","redirection")+":",url:n("tracking-404-errors"),children:[(0,l.jsx)(wn,{items:Wu(),name:"expire_404",value:String(s),onChange:r})," ",(0,i.__)("(time to keep logs for)","redirection")]}),(0,l.jsxs)(yn,{title:(0,i.__)("IP Logging","redirection")+":",url:n("options","iplogging"),children:[(0,l.jsx)(wn,{items:[{value:0,label:(0,i.__)("No IP logging","redirection")},{value:1,label:(0,i.__)("Full IP logging","redirection")},{value:2,label:(0,i.__)("Anonymize IP (mask last part)","redirection")}],name:"ip_logging",value:String(a),onChange:r})," ",(0,i.__)("(IP logging level)","redirection")]}),(0,l.jsxs)(yn,{title:(0,i.__)("IP Address","redirection")+":",url:n("options","ipaddress"),children:[(0,l.jsx)(qu,{options:[{value:"HTTP_CF_CONNECTING_IP",label:"HTTP_CF_CONNECTING_IP"},{value:"HTTP_CLIENT_IP",label:"HTTP_CLIENT_IP"},{value:"HTTP_X_FORWARDED_FOR",label:"HTTP_X_FORWARDED_FOR"},{value:"HTTP_X_FORWARDED",label:"HTTP_X_FORWARDED"},{value:"HTTP_X_CLUSTER_CLIENT_IP",label:"HTTP_X_CLUSTER_CLIENT_IP"},{value:"HTTP_FORWARDED_FOR",label:"HTTP_FORWARDED_FOR"},{value:"HTTP_FORWARDED",label:"HTTP_FORWARDED"},{value:"HTTP_VIA",label:"HTTP_VIA"}],selected:h,multiple:!0,badges:h.length>0,hideTitle:h.length>0,onChange:e=>r({ip_headers:e}),title:0===h.length?(0,i.__)("REMOTE_ADDR","redirection"):""}),(0,l.jsx)("p",{children:L((0,i.__)("Only set custom IP headers if your server does not use <code>REMOTE_ADDR</code> to store the client IP address.","redirection"),{code:(0,l.jsx)("code",{})})}),h.length>0&&(0,l.jsx)(Hu,{level:"warning",children:(0,l.jsx)("p",{children:L((0,i.__)("Please ensure you trust the data in these headers. If using a proxy then set its address below.","redirection"),{code:(0,l.jsx)("code",{})})})})]}),h.length>0&&(0,l.jsxs)(yn,{title:(0,i.__)("Proxy Address","redirection")+":",url:n("options","proxy"),children:[(0,l.jsx)(E,{minRows:3,value:p.join("\n"),onChange:e=>r({ip_proxy:e.target.value.split("\n")}),rows:5}),(0,l.jsx)("p",{children:(0,i.__)("If using a proxy then add any IP addresses here to only trust IP headers from those addresses.","redirection")})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Logging","redirection")+":",url:n("options","iplogging"),children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"log-options-log-external",type:"checkbox",disabled:-1===parseInt(o.toString(),10),name:"log_external",onChange:r,checked:-1!==parseInt(o.toString(),10)&&c}),(0,l.jsx)("label",{htmlFor:"log-options-log-external",children:(0,i.__)('Log "external" redirects - those not from Redirection. This can increase your log size and contains no user information.',"redirection")})]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"log-options-track-hits",type:"checkbox",name:"track_hits",onChange:r,checked:u}),(0,l.jsx)("label",{htmlFor:"log-options-track-hits",children:(0,i.__)("Track redirect hits and date of last access. Contains no user information.","redirection")})]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"log-options-log-header",type:"checkbox",name:"log_header",onChange:r,checked:d}),(0,l.jsx)("label",{htmlFor:"log-options-log-header",children:(0,i.__)("Capture HTTP header information with logs (except cookies). It may include user information, and could increase your log size.","redirection")})]})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{}),(0,l.jsx)("td",{children:L((0,i.__)("Redirection stores no user identifiable information other than what is configured above. It is your responsibility to ensure your site meets any applicable {{link}}privacy requirements{{/link}}.","redirection"),{link:(0,l.jsx)(N,{url:n("privacy-gdpr")})})})]})]})};function Vu(e,t,r){const n=[];for(const o in e){const s=e[o],a=!!t.find(e=>e===o);s&&n.push((0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"monitor-type-"+o,type:"checkbox",name:"monitor_type_"+o,onChange:r,checked:a}),(0,l.jsx)("label",{htmlFor:"monitor-type-"+o,children:(0,i.sprintf)(
// translators: %(type)s is the post type name (e.g. post, page)
// translators: %(type)s is the post type name (e.g. post, page)
(0,i.__)("Monitor changes to %(type)s","redirection"),{type:s.toLowerCase()})})]},o))}return n}function Zu(e,t){return 0===parseInt(e.toString(),10)&&t.length>0?t.length>0&&t[0]?Array.isArray(t[0].value)?t[0].value[0]?.value||0:t[0].value:0:e}const Qu=function(e){const{onChange:t,settings:r,groups:n,getLink:o,postTypes:s}=e,{associated_redirect:a,monitor_post:c,monitor_types:u}=r,d=u.length>0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(yn,{title:(0,i.__)("URL Monitor","redirection")+":",url:o("options","monitor"),children:Vu(s,u,function(e){const r=e.target.name.replace("monitor_type_",""),i=u.filter(e=>e!==r);e.target.checked&&i.push(r),t({monitor_types:i,monitor_post:i.length>0?Zu(c,n):0,associated_redirect:i.length>0?a:""})})}),d&&(0,l.jsxs)(yn,{title:(0,i.__)("URL Monitor Changes","redirection")+":",url:o("options","monitor"),children:[(0,l.jsx)(wn,{items:n,name:"monitor_post",value:String(c),onChange:t})," ",(0,i.__)("Save changes to this group","redirection"),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{type:"text",className:"regular-text",name:"associated_redirect",onChange:t,placeholder:(0,i.__)('For example "/amp"',"redirection"),value:a})," ",(0,i.__)("Create associated redirect (added to end of URL)","redirection")]})]})]})},Ku=function(e){const{settings:t,onChange:r,getLink:n,groups:o,postTypes:s}=e,{flag_case:a,flag_trailing:c,flag_query:u,auto_target:d,redirect_cache:p,cache_key:h}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("tr",{className:"redirect-option__row",children:(0,l.jsx)("th",{colSpan:2,children:(0,l.jsx)("h2",{className:"title",children:(0,i.__)("URL","redirection")})})}),(0,l.jsx)(Qu,{settings:t,onChange:r,groups:o,getLink:n,postTypes:s}),(0,l.jsxs)(yn,{title:(0,i.__)("Default URL settings","redirection")+":",url:n("options","urlsettings"),children:[(0,l.jsx)("p",{children:(0,i.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{type:"checkbox",id:"url-options-flag-case",name:"flag_case",onChange:r,checked:a}),(0,l.jsx)("label",{htmlFor:"url-options-flag-case",children:L((0,i.__)("Case insensitive matches (i.e. {{code}}/Exciting-Post{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,l.jsx)("code",{})})})]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{type:"checkbox",id:"url-options-flag-trailing",name:"flag_trailing",onChange:r,checked:c}),(0,l.jsx)("label",{htmlFor:"url-options-flag-trailing",children:L((0,i.__)("Ignore trailing slashes (i.e. {{code}}/exciting-post/{{/code}} will match {{code}}/exciting-post{{/code}})","redirection"),{code:(0,l.jsx)("code",{})})})]})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Default query matching","redirection")+":",url:n("options","querysettings"),children:[(0,l.jsx)("p",{children:(0,i.__)("Applies to all redirections unless you configure them otherwise.","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)(wn,{items:[{value:"exact",label:(0,i.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,i.__)("Ignore all query parameters","redirection")},{value:"pass",label:(0,i.__)("Ignore and pass all query parameters","redirection")}],name:"flag_query",value:u,onChange:r})}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:(0,i.__)("Exact - matches the query parameters exactly defined in your source, in any order","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Ignore - as exact, but ignores any query parameters not in your source","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Pass - as ignore, but also copies the query parameters to the target","redirection")})]})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Auto-generate URL","redirection")+":",url:n("options","autogenerate"),children:[(0,l.jsx)("input",{className:"regular-text",type:"text",value:d,name:"auto_target",onChange:r}),(0,l.jsx)("br",{}),(0,l.jsx)("span",{className:"sub",children:L((0,i.__)("Used to auto-generate a URL if no URL is given. Use the special tags {{code}}$dec${{/code}} or {{code}}$hex${{/code}} to insert a unique ID instead","redirection"),{code:(0,l.jsx)("code",{})})})]}),(0,l.jsxs)(yn,{title:(0,i.__)("HTTP Cache Header","redirection"),url:n("options","cache"),children:[(0,l.jsx)(wn,{items:[{value:-1,label:(0,i.__)("Never cache","redirection")},{value:1,label:(0,i.__)("An hour","redirection")},{value:24,label:(0,i.__)("A day","redirection")},{value:168,label:(0,i.__)("A week","redirection")},{value:0,label:(0,i.__)("Forever","redirection")}],name:"redirect_cache",value:String(p),onChange:r})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)('How long to cache redirected 301 URLs (via "Expires" HTTP header)',"redirection")})]}),(0,l.jsxs)(yn,{title:(0,i.__)("Redirect Caching","redirection"),url:n("options","cache"),children:[(0,l.jsx)("input",{id:"url-options-cache-key",type:"checkbox",name:"cache_key",onChange:r,checked:0!==h&&!1!==h})," ",(0,l.jsx)("label",{htmlFor:"url-options-cache-key",children:(0,l.jsx)("span",{className:"sub",children:(0,i.__)("(beta) Enable caching of redirects via WordPress object cache. Can improve performance. Requires an object cache.","redirection")})})]})]})},Ju=sa({source:sa({flag_regex:Xs(),flag_trailing:Xs(),flag_case:Xs(),flag_query:Ts()}).optional(),options:da(Ts(),ta()).optional()}),Yu=sa({id:Qs().int(),url:Ts(),match_url:Ts().optional(),match_type:Ts(),action_type:Ts(),action_code:Qs().int(),action_data:ta(),match_data:Ju.nullish(),group_id:Qs().int(),title:Ts(),position:Qs().int().nonnegative(),regex:Xs().optional(),last_access:Ts().optional(),enabled:Xs().optional(),hits:Qs().int().nonnegative().optional()}),Xu=(sa({url:Ts().min(1,"Source URL is required"),title:Ts().optional(),match_type:Ts(),action_type:Ts(),action_code:Qs().int().min(100).max(599).optional(),action_data:ta().optional(),match_data:Ju.optional(),group_id:Qs().int().positive(),position:Qs().int().nonnegative().default(0),enabled:Xs().optional()}).partial().extend({id:Qs().int()}),sa({items:ia(Qs().int()),action:ha(["delete","enable","disable","reset"])}),sa({id:Qs().int(),name:Ts(),redirects:Qs().int().nonnegative(),module_id:Qs().int(),moduleName:Ts().optional(),enabled:Xs()})),ed=(sa({name:Ts().min(1,"Group name is required"),moduleId:Qs().int().positive(),position:Qs().int().nonnegative().default(0),enabled:Xs().optional()}).partial().extend({id:Qs().int()}),sa({page:Qs().int().nonnegative(),per_page:Qs().int().positive().max(100),orderby:Ts(),direction:ha(["asc","desc"]),selected:ia(la([Qs(),Ts()])),selectAll:Xs().optional(),displayType:Ts().optional(),displaySelected:ia(Ts()).optional(),filterBy:da(Ts(),Ts()).optional(),groupBy:Ts().optional()})),td=e=>sa({items:ia(e),total:Qs().int().nonnegative(),table:ed.optional()}),rd=(sa({item:ta(),items:ia(ta()).optional(),total:Qs().int().nonnegative().optional()}),sa({code:la([Ts(),Qs()]).optional(),message:Ts().optional(),data:ta().optional(),jsonData:ta().optional(),request:sa({url:Ts(),method:Ts()}).optional()}),td(Yu)),nd=sa({item:Yu}),id=td(Xu),od=sa({item:Xu});function sd(e){return{...!0===e?.global?{page:0}:{},selected:[],selectAll:!1}}function ad(e,t){return"ip"===e?{ip:t}:"agent"===e?{agent:t}:{"url-exact":t}}sa({deleted:Qs().int().nonnegative().optional(),updated:Qs().int().nonnegative().optional(),items:ia(ta()).optional(),total:Qs().int().nonnegative().optional()});const ld=["selected","selectAll","displayType","displaySelected"];function cd(e){const t={};for(const r in e){const n=e[r];ld.includes(r)||null!=n&&("object"!=typeof n||Array.isArray(n)||0!==Object.keys(n).length)&&(Array.isArray(n)&&0===n.length||"string"==typeof n&&""===n.trim()||(t[r]=n))}return t}function ud(e={},t){const r=cd(e);return pt({queryKey:Xr.groups.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await St(Ft(r));return id.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch groups"),t}},...t})}function dd(e){return window.Redirectioni10n.pluginRoot+"&sub=rss&module=1&token="+encodeURIComponent(e)}function pd(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function hd(e){return e?/^https?:\/\//i.test(e)?e:"https://"+e:document.location.origin}function fd(e){const t={};for(const r of e)r&&(t[r.moduleName]||(t[r.moduleName]=[]),t[r.moduleName].push({value:r.id,label:r.name}));return Object.keys(t).map(e=>({label:e,value:t[e]}))}function md(e,t){return"https://redirection.me/support/"+e+(t?"/#"+t:"")}const gd={},_d={},yd=function(){const e=de(e=>e.values),t=de(e=>e.saveStatus),r=de(e=>e.values?.installed??""),n=de(e=>e.values?.warning??""),s=de(e=>e.values?.postTypes),{data:a}=ud({}),c=a?.items?fd(a.items):[],{mutate:u}=Na(),[d,p]=(0,o.useState)(e??_d),h=s??gd;function f(e){if("target"in e){const{target:t}=e,r="checkbox"===t.type?t.checked:t.value;p({...d,[t.name]:r})}else p({...d,...e})}return(0,o.useEffect)(()=>{e&&p(e)},[e]),(0,l.jsxs)("form",{onSubmit:function(e){e.preventDefault(),u(d)},children:[(0,l.jsxs)(vn,{children:[(0,l.jsx)(Gu,{settings:d,onChange:f,getLink:md}),(0,l.jsx)(Ku,{settings:d,onChange:f,getLink:md,groups:c,postTypes:h}),(0,l.jsx)(Sn,{settings:d,onChange:f,getLink:md,installed:r,warning:n})]}),(0,l.jsx)($l,{isPrimary:!0,isSubmit:!0,disabled:t,children:(0,i.__)("Update","redirection")})]})},vd=function({onClose:e,children:t,className:r}){return(0,l.jsx)(Ru,{className:"wpl-click-outside",onOutside:t=>{t.target instanceof HTMLElement&&t.target.classList.contains("wpl-modal_main")&&e()},children:(0,l.jsxs)("div",{className:h("wpl-modal_content",r),children:[(0,l.jsx)("div",{className:"wpl-modal_close",children:(0,l.jsx)("button",{type:"button",onClick:e,children:"✖"})}),t]})})},bd="wpl-modal_shown",xd=function({padding:e=!0,onClose:t,...r}){const n=(0,o.useCallback)(e=>{"Escape"===e.key&&t()},[t]);(0,o.useEffect)(()=>(document.body.classList.add(bd),document.addEventListener("keydown",n),()=>{document.body.classList.remove(bd),document.removeEventListener("keydown",n)}),[n]);const i=h({"wpl-modal_wrapper":!0,"wpl-modal_wrapper-padding":e});return(0,l.jsxs)("div",{className:i,children:[(0,l.jsx)("div",{className:"wpl-modal_backdrop"}),(0,l.jsx)("div",{className:"wpl-modal_main",children:(0,l.jsx)(vd,{onClose:t,...r})})]})},wd=e=>(0,n.createPortal)((0,l.jsx)(xd,{...e}),Pu("wpl-modal")||document.body),jd=function(e){const[t,r]=(0,o.useState)(!1);function n(){r(!1)}return(0,l.jsxs)("div",{className:"wrap",children:[(0,l.jsxs)("form",{action:"",method:"post",onSubmit:function(e){r(!0),e.preventDefault()},children:[(0,l.jsx)("h2",{children:(0,i.__)("Delete Redirection","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Selecting this option will delete all redirections, all logs, and any options associated with the Redirection plugin. Make sure this is what you want to do.","redirection")}),(0,l.jsx)("input",{className:"button-secondary button-delete",type:"submit",name:"delete",value:(0,i.__)("Delete","redirection")})]}),t&&(0,l.jsx)(wd,{onClose:n,children:(0,l.jsxs)("div",{style:{padding:"15px 10px 5px 15px"},children:[(0,l.jsx)("h1",{children:(0,i.__)("Delete the plugin - are you sure?","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Deleting the plugin will remove all your redirections, logs, and settings. Do this if you want to remove the plugin for good, or if you want to reset the plugin.","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Once deleted your redirections will stop working. If they appear to continue working then please clear your browser cache.","redirection")}),(0,l.jsxs)("p",{children:[(0,l.jsx)("button",{className:"button-primary button-delete",onClick:function(){e.onDelete(),n()},children:(0,i.__)("Yes! Delete the plugin","redirection")})," ",(0,l.jsx)("button",{className:"button-secondary",onClick:n,children:(0,i.__)("No! Don't delete the plugin")})]})]})})]})},Sd=function(){const e=de(e=>e.loadStatus),t=de(e=>e.values);Pa();const r=function(){const{incrementProgress:e,decrementProgress:t,addNotice:r,addError:n}=tn();return mt({mutationFn:async()=>{e();try{return await St(er())}catch(e){throw t(),Yr(e)}},onSuccess:()=>{t(),r("Plugin deleted"),window.location.href="/wp-admin/plugins.php"},onError:e=>{n(e.message||"Failed to delete plugin")}})}(),n="success"===e;return"loading"!==e&&t?(0,l.jsxs)("div",{children:["success"===e&&(0,l.jsx)(yd,{}),(0,l.jsx)("hr",{}),n&&(0,l.jsx)(jd,{onDelete:()=>{r.mutate()}})]}):(0,l.jsx)(Ml,{})},kd=()=>(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{children:(0,i.__)("Need help?","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("Full documentation for Redirection can be found at {{site}}https://redirection.me{{/site}}. If you have a problem please check the {{faq}}FAQ{{/faq}} first.","redirection"),{site:(0,l.jsx)(N,{url:"https://redirection.me"}),faq:(0,l.jsx)(N,{url:"https://redirection.me/support/faq/"})})}),(0,l.jsx)("p",{children:(0,l.jsx)("strong",{children:L((0,i.__)("If you want to report a bug please read the {{report}}Reporting Bugs{{/report}} guide.","redirection"),{report:(0,l.jsx)(N,{url:"https://redirection.me/support/reporting-bugs/"})})})}),(0,l.jsx)("div",{className:"inline-notice inline-general",children:(0,l.jsxs)("p",{className:"github",children:[(0,l.jsx)(N,{url:"https://github.com/johngodley/redirection/issues",children:(0,l.jsx)("img",{src:window.Redirectioni10n.pluginBaseUrl+"/images/GitHub-Mark-64px.png",width:"32",height:"32",alt:"GitHub"})}),(0,l.jsx)(N,{url:"https://github.com/johngodley/redirection/issues",children:"https://github.com/johngodley/redirection/"})]})}),(0,l.jsx)("p",{children:(0,i.__)("Please note that any support is provide on as-time-is-available basis and is not guaranteed. I do not provide paid support.","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("If you want to submit information that you don't want in a public repository then send it directly via {{email}}email{{/email}} - include as much information as you can!","redirection"),{email:(0,l.jsx)("button",{type:"button",className:"button-link",onClick:()=>{window.location.href="mailto:john@redirection.me?subject=Redirection%20Issue&body="+encodeURIComponent("Redirection: "+window.Redirectioni10n.versions)}})})}),(0,l.jsx)("h2",{children:(0,i.__)("Need to search and replace?","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("The companion plugin <link>Search Regex</link> allows you to search and replace data on your site and is handy if you want to bulk update a lot of URLs in your posts and pages.","redirection"),{link:(0,l.jsx)(N,{url:"https://searchregex.com/"})})})]});function Cd(e,t){return"http"===e.slice(0,4)?e:pd(t||document.location.origin,e)}function Td(e){return"object"==typeof e&&void 0!==e.url_from?e.url_from:e}function Ed({status:e,headers:t,statusMessage:r,isMatch:n}){if(0===e)return r.length>0?(0,l.jsx)(l.Fragment,{children:r}):(0,l.jsx)(l.Fragment,{children:(0,i.__)("An unknown error","redirection")});if(e>=500)return(0,l.jsx)(l.Fragment,{children:(0,i.__)("Something is wrong with the server. This is not a problem with Redirection and you will need to resolve the error yourself.","redirection")});if(e>=400&&e<500)return(0,l.jsx)(l.Fragment,{children:L((0,i.__)("An error page was returned. This is unlikely to be a problem with Redirection. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/redirect-returning-404/"})})});if(e>=300&&e<400){if(n)return(0,l.jsxs)(l.Fragment,{children:[(0,i.__)("Redirected by Redirection.","redirection")," ",(0,l.jsxs)("span",{className:"redirection-httpstep__match",children:[(0,i.__)("Matches your redirect","redirection")," ",(0,l.jsx)("span",{className:"dashicons dashicons-yes"})]})]});const e=t.find(e=>"x-redirect-agent"===e.name||"x-redirect-by"===e.name)||null;return e?"redirection"===e.value.toLowerCase()?(0,l.jsx)(l.Fragment,{children:(0,i.__)("Redirected by Redirection.","redirection")}):(0,l.jsx)(l.Fragment,{children:L((0,i.sprintf)(
// translators: %1$s is the name of the agent that performed the redirect
// translators: %1$s is the name of the agent that performed the redirect
(0,i.__)("Redirected by %1$s. {{support}}What does this mean?{{/support}}.","redirection"),e.value),{support:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})}):(0,l.jsx)(l.Fragment,{children:L((0,i.__)("Redirected by an unknown agent. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})})}return e>=200&&e<300?(0,l.jsx)(l.Fragment,{children:(0,i.__)("Page was loaded.","redirection")}):null}function Rd({step:e,isFirst:t,isLast:r,isMatch:n}){const{request:i,status:o,statusMessage:s,headers:a}=e,c=100*Math.floor(o/100);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"redirection-httpstep",children:[(0,l.jsx)("div",{className:`redirection-httpstep__status redirection-httpstep__${c>0?c:"500"}`,children:parseInt(o.toString(),10)>0?(0,l.jsx)(N,{url:`https://redirect.li/http/status/code/${o}/`,title:s,children:o}):"Fail"}),(0,l.jsxs)("div",{className:"redirection-httpstep__details",children:[(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:i.url})}),(0,l.jsx)("p",{children:(0,l.jsx)(Ed,{status:parseInt(o.toString(),10),statusMessage:s,headers:a,isFirst:t,isMatch:n})})]})]}),!r&&(0,l.jsx)("div",{children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]})}function Pd(e,t,r,n){if(!Array.isArray(e)||!r||!n)return!1;const i=e.find(e=>"x-redirect-agent"===e.name||"x-redirect-by"===e.name),o=e.find(e=>"location"===e.name);if(i&&o){if("object"==typeof r&&void 0===r.url_from)return"redirection"===i.value.toLowerCase()&&n===t&&Cd(o.value)===Td(r);if("object"==typeof r)return"redirection"===i.value.toLowerCase()&&n===t&&Cd(o.value,r.server)===Td(r)}return!1}const Nd=function({desiredTarget:e,desiredCode:t,http:r,url:n}){const{steps:o}=r;return!r||"error"!==r.status&&"fail"!==r.status||0!==o.length?(0,l.jsxs)("div",{children:[o.map((r,n)=>(0,l.jsx)(Rd,{step:r,isFirst:0===n,isLast:n===o.length-1,isMatch:Pd(r.headers,r.status,e,t)},n)),(0,l.jsxs)("p",{children:[e&&t&&(0,l.jsxs)(l.Fragment,{children:[L((0,i.__)("If this is not expected then this {{support}}support page{{/support}} may help.","redirection"),{support:(0,l.jsx)(N,{url:"https://redirection.me/support/problems/url-not-redirecting/"})})," "]}),(0,i.__)("If your browser is behaving differently then you should clear your browser cache.","redirection")]}),(0,l.jsx)("p",{children:(0,l.jsx)(N,{url:`https://redirect.li/http/?url=${encodeURIComponent(n)}`,className:"button",children:(0,i.__)("View full redirect.li results.","redirection")})})]}):(0,l.jsx)("div",{children:(0,i.__)("Unable to check that URL. It may not be valid or accessible.","redirection")})};function Od({error:e}){return(0,l.jsxs)("div",{className:"wpl-modal_error",children:[(0,l.jsx)("h2",{children:(0,i.__)("Error","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Something went wrong obtaining this information. It may work in the future.","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:e})})]})}function Ad({url:e,desiredCode:t=0,desiredTarget:r=null}){const{data:n,isLoading:o,isError:s,error:a}=function(e,t){return pt({queryKey:Xr.info.http(e),queryFn:async()=>await St(ur(e)),enabled:!!e,staleTime:0,...t})}(e,{enabled:!!e}),c=s&&a&&a.message||"";if(!o&&!s&&!n)return null;const u=h({"redirection-httpcheck":!0,"wpl-modal_loading":o,"redirection-httpcheck_small":s});return(0,l.jsxs)("div",{className:u,children:[o&&(0,l.jsx)(gn,{}),s&&c&&(0,l.jsx)(Od,{error:c}),!o&&!s&&n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:L((0,i.sprintf)(
// translators: %s is the URL being checked
// translators: %s is the URL being checked
(0,i.__)("Check redirect for: {{code}}%s{{/code}}","redirection"),e),{code:(0,l.jsx)("code",{})})}),(0,l.jsx)(Nd,{http:n,url:e,desiredCode:t,desiredTarget:r})]})]})}const Id=function(){const[e,t]=(0,o.useState)(""),[r,n]=(0,o.useState)(""),s=r.length>0;return(0,l.jsxs)("form",{className:"http-tester",onSubmit:function(t){t.preventDefault(),e.length>0&&n(e)},children:[(0,l.jsx)("h3",{children:(0,i.__)("Redirect Tester","redirection")}),(0,l.jsx)("p",{children:L((0,i.__)("Sometimes your browser can cache a URL, making it hard to know if it's working as expected. Use this service from {{link}}redirect.li{{/link}} to get accurate results.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirect.li"})})}),(0,l.jsxs)("div",{className:"redirection-httptest__input",children:[(0,l.jsxs)("span",{children:[(0,i.__)("URL","redirection"),":"]}),(0,l.jsx)("input",{className:"regular-text",type:"text",value:e,onChange:e=>t(e.target.value),placeholder:(0,i.__)("Enter full URL, including http:// or https://","redirection")}),(0,l.jsx)("input",{type:"submit",className:"button-secondary",disabled:0===e.length,value:(0,i.__)("Check","redirection")})]}),s&&(0,l.jsx)("div",{className:"redirection-httptest",children:(0,l.jsx)(Ad,{url:r})})]})},Fd=()=>(0,l.jsxs)("form",{action:Redirectioni10n.pluginRoot+"&sub=support",method:"POST",children:[(0,l.jsx)("input",{type:"hidden",name:"_wpnonce",value:St.nonceMiddleware.nonce}),(0,l.jsx)("input",{type:"hidden",name:"action",value:"fixit"}),(0,l.jsx)("p",{children:(0,i.__)("If the magic button doesn't work then you should read the error and see if you can fix it manually, otherwise follow the 'Need help' section below.","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("input",{type:"submit",className:"button-primary",value:(0,i.__)("⚡️ Magic fix ⚡️","redirection")})})]}),Dd=e=>{const{item:t}=e;return(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:t.name}),(0,l.jsxs)("td",{children:[(0,l.jsx)("span",{className:"plugin-status-"+t.status,children:"good"===t.status?(0,i.__)("Good","redirection"):(0,i.__)("Problem","redirection")})," ",t.message]})]})},Ld=e=>{const{status:t}=e,r=t.filter(e=>"good"!==e.status);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("table",{className:"plugin-status",children:(0,l.jsx)("tbody",{children:t.map((e,t)=>(0,l.jsx)(Dd,{item:e},t))})}),r.length>0&&(0,l.jsx)(Fd,{})]})},zd=function(e){const{debug:t}=e,[r,n]=(0,o.useState)(t.database.current),{mutate:s}=Ia({onSuccess:()=>{window.location.reload()}}),{ip_header:a,database:c}=t;return(0,l.jsx)("table",{className:"plugin-status",children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Database version","redirection")}),(0,l.jsxs)("td",{children:[(0,l.jsx)(wn,{items:[{value:"2.3.1",label:"2.3.1"},{value:"2.3.2",label:"2.3.2"},{value:"2.4",label:"2.4"},{value:"4.0",label:"4.0"},{value:"4.1",label:"4.1"},{value:"4.2",label:"4.2"}],value:r,name:"database_version",onChange:function(e){n(e.target.value)}})," "," ",r!==c.current&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("strong",{children:(0,i.__)("Do not change unless advised to do so!","redirection")})," "," ",(0,l.jsx)("button",{className:"button-secondary button",onClick:function(e){e.preventDefault(),s({reason:"database",current:r})},children:(0,i.__)("Save","redirection")})]})]})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("IP Headers","redirection")}),(0,l.jsx)("td",{children:Object.keys(a).filter(e=>a[e]).map((e,t)=>(0,l.jsxs)("code",{children:[e," = ",a[e]?a[e]:"-"," "]},t))})]})]})})},Md=function(){const e=de(e=>e.pluginStatus.status),t=de(e=>e.pluginStatus.debug);return pt({queryKey:Xr.settings.status(),queryFn:async()=>{try{const e=await St(Xt());return de.getState().setPluginStatus(e),e}catch(e){throw Yr(e)}}}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("WordPress REST API","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Redirection communicates with WordPress through the WordPress REST API. This is a standard part of WordPress, and you will experience problems if you cannot use it.","redirection")}),(0,l.jsx)(Ua,{}),(0,l.jsx)("h2",{children:(0,i.__)("Plugin Status","redirection")}),e.length>0&&(0,l.jsx)(Ld,{status:e}),0===e.length&&(0,l.jsx)("div",{className:"placeholder-inline",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})}),(0,l.jsx)("h2",{children:(0,i.__)("Plugin Debug","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("This information is provided for debugging purposes. Be careful making any changes.","redirection")}),t&&(0,l.jsx)(zd,{debug:t}),!t&&(0,l.jsx)("div",{className:"placeholder-inline",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})})]})},$d=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Md,{}),(0,l.jsx)(Id,{}),(0,l.jsx)(kd,{})]})};function Ud(e,t){if(!1===e)return!1;const r=function(e){try{let t=e;"http:"!==e.slice(0,5)&&"https:"!==e.slice(0,6)&&(t=document.location.protocol+"//"+e);const r=new URL(t);return{protocol:r.protocol,host:r.host,pathname:r.pathname}}catch(e){return{}}}(e);return r.host&&r.host.length>0?t(r):""}function Bd(e){return Ud(e,e=>e.protocol+"//"+(e.host||"")+(e.pathname||""))}function qd(e){return Ud(e,e=>e.protocol+"//"+(e.host||""))}const Hd=({domain:e,asDomain:t,onChange:r,onDelete:n,site:i})=>(0,l.jsxs)("tr",{className:"redirect-alias__item",children:[(0,l.jsx)("td",{children:(0,l.jsx)("input",{className:"regular-text",type:"text",name:"domain",value:e,onChange:r})}),(0,l.jsx)("td",{className:"redirect-alias__item__asdomain",children:e.length>0&&(0,l.jsxs)(o.Fragment,{children:[(0,l.jsx)("code",{children:t})," ⇒ ",(0,l.jsx)("code",{children:i})]})}),(0,l.jsx)("td",{className:"redirect-alias__delete",children:(0,l.jsx)("button",{onClick:e=>{e.preventDefault(),n()},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]}),Wd=({aliases:e,siteDomain:t,onChange:r})=>(0,l.jsxs)(o.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Site Aliases","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("A site alias is another domain that you want to be redirected to this site. For example, an old domain, or a subdomain. This will redirect all URLs, including WordPress login and admin.","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("You will need to configure your system (DNS and server) to pass requests for these domains to this WordPress install.","redirection")}),(0,l.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto inline-edit-row",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Aliased Domain","redirection")}),(0,l.jsx)("th",{className:"redirect-alias__item__asdomain",children:(0,i.__)("Alias","redirection")}),(0,l.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,l.jsxs)("tbody",{children:[e.map((n,i)=>(0,l.jsx)(Hd,{domain:n,asDomain:(qd(n)||"").replace(/https?:\/\//,""),onChange:t=>((e,t,r,n)=>{const i=t.slice();i[e]=n.target.value,r({aliases:i})})(i,e,r,t),onDelete:()=>((e,t,r)=>{r({aliases:[...t.slice(0,e),...t.slice(e+1)]})})(i,e,r),site:t},i)),0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:3,children:(0,i.__)("No aliases","redirection")})})]})]}),(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-secondary",onClick:t=>((e,t,r)=>{r.preventDefault(),t({aliases:e.concat("").slice(0,20)})})(e,r,t),children:(0,i.__)("Add Alias","redirection")})})]}),Gd=({relocate:e,siteDomain:t,onChange:r})=>{const n=((e,t)=>{if(t){const r=Bd(t);if(r&&r.length>0)return(0,l.jsxs)("p",{children:[(0,l.jsx)("code",{children:e})," ⇒ ",(0,l.jsx)("code",{children:r})]})}return null})(t,e);return(0,l.jsxs)(o.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Relocate Site","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Want to redirect the entire site? Enter a domain to redirect everything, except WordPress login and admin. Enabling this option will disable any site aliases or canonical settings.","redirection")}),(0,l.jsxs)("p",{children:[(0,l.jsxs)("strong",{children:[(0,i.__)("Relocate to domain","redirection"),":"]})," ",(0,l.jsx)("input",{type:"text",className:"regular-text",name:"relocate",value:e||"",onChange:e=>r({relocate:e.target.value})})]}),n]})};function Vd(e,t,r){return e=e.replace(/https?:\/\//,""),"www"===r?e="www."+e.replace("www.",""):"nowww"===r&&(e=e.replace("www.","")),(t?"https://":"http://")+e}const Zd=function({https:e,preferredDomain:t,siteDomain:r,onChange:n}){const o=function(e,t,r){return!(!t||e.includes("https:"))||"www"===r&&!e.includes("www.")||!("nowww"!==r||!e.includes("www."))}(r,e,t),s=e=>{n({[e.target.name]:e.target.value})};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Canonical Settings","redirection")}),(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"canonical-https",type:"checkbox",name:"https",onChange:e=>{n({[e.target.name]:e.target.checked})},checked:e})," ",(0,l.jsx)("label",{htmlFor:"canonical-https",children:L((0,i.sprintf)(
// translators: %(site)s is HTTP site URL, %(siteHTTPS)s is HTTPS site URL
// translators: %(site)s is HTTP site URL, %(siteHTTPS)s is HTTPS site URL
(0,i.__)("Force a redirect from HTTP to HTTPS - {{code}}%(site)s{{/code}} ⇒ {{code}}%(siteHTTPS)s{{/code}}","redirection"),{site:r.replace("https","http"),siteHTTPS:r.replace("http:","https:")}),{code:(0,l.jsx)("code",{})})})]}),e&&(0,l.jsx)("div",{className:"inline-notice inline-warning",children:(0,l.jsx)("p",{children:L(
// translators: %(strong)s is the warning title
// translators: %(strong)s is the warning title
(0,i.__)("{{strong}}Warning{{/strong}}: ensure your HTTPS is working before forcing a redirect.","redirection"),{strong:(0,l.jsx)("strong",{})})})}),(0,l.jsxs)("p",{children:[(0,i.__)("Preferred domain","redirection"),":"]}),(a=r,[{
// translators: %(site)s is the site domain
label:L((0,i.sprintf)(
// translators: %(site)s is the site domain
// translators: %(site)s is the site domain
(0,i.__)("Don't set a preferred domain - {{code}}%(site)s{{/code}}","redirection"),{site:a}),{code:(0,l.jsx)("code",{})}),value:""},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:L((0,i.sprintf)(
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
(0,i.__)("Remove www from domain - {{code}}%(siteWWW)s{{/code}} ⇒ {{code}}%(site)s{{/code}}","redirection"),{site:a.replace("www.",""),siteWWW:a.replace("www.","").replace("://","://www.")}),{code:(0,l.jsx)("code",{})}),value:"nowww"},{
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
label:L((0,i.sprintf)(
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
// translators: %(site)s is the site domain without www, %(siteWWW)s is the site domain with www
(0,i.__)("Add www to domain - {{code}}%(site)s{{/code}} ⇒ {{code}}%(siteWWW)s{{/code}}","redirection"),{site:a.replace("www.",""),siteWWW:a.replace("www.","").replace("://","://www.")}),{code:(0,l.jsx)("code",{})}),value:"www"}]).map(e=>{const r=`canonical-preferred-${e.value||"none"}`;return(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:r,type:"radio",name:"preferred_domain",value:e.value,onChange:s,checked:e.value===t})," ",(0,l.jsx)("label",{htmlFor:r,children:e.label})]},e.value)}),o&&(0,l.jsx)("div",{className:"inline-notice inline-error",children:(0,l.jsx)("p",{children:L((0,i.sprintf)(
// translators: %(current)s is current site URL, %(site)s is recommended canonical URL
// translators: %(current)s is current site URL, %(site)s is recommended canonical URL
(0,i.__)("You should update your site URL to match your canonical settings: {{code}}%(current)s{{/code}} ⇒ {{code}}%(site)s{{/code}}","redirection"),{current:r,site:Vd(r,e,t)}),{code:(0,l.jsx)("code",{})})})})]});var a},Qd=e=>e?.ownerDocument??document,Kd=e=>e&&"window"in e&&e.window===e?e:Qd(e).defaultView||window;function Jd(e,t){return!(!t||!e)&&e.contains(t)}const Yd=(e=document)=>e.activeElement;function Xd(e){return e.target}const ep="undefined"!=typeof document?o.useLayoutEffect:()=>{};function tp(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function rp(e){let t=(0,o.useRef)({isFocused:!1,observer:null});return ep(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,o.useCallback)(r=>{let n=Xd(r);if(n instanceof HTMLButtonElement||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n,i=n=>{if(t.current.isFocused=!1,r.disabled){let t=tp(n);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){t.current.observer?.disconnect();let e=r===Yd()?null:Yd();r.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function np(e){if("undefined"==typeof window||null==window.navigator)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function ip(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function op(e){let t=null;return()=>(null==t&&(t=e()),t)}const sp=op(function(){return ip(/^Mac/i)}),ap=op(function(){return ip(/^iPhone/i)}),lp=op(function(){return ip(/^iPad/i)||sp()&&navigator.maxTouchPoints>1}),cp=op(function(){return ap()||lp()}),up=(op(function(){return sp()||cp()}),op(function(){return np(/AppleWebKit/i)&&!dp()})),dp=op(function(){return np(/Chrome/i)}),pp=op(function(){return np(/Android/i)}),hp=op(function(){return np(/Firefox/i)});let fp=null;function mp(e,t,r=!0){let{metaKey:n,ctrlKey:i,altKey:o,shiftKey:s}=t;hp()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(sp()?n=!0:i=!0);let a=up()&&sp()&&!lp()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:n,ctrlKey:i,altKey:o,shiftKey:s}):new MouseEvent("click",{metaKey:n,ctrlKey:i,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});mp.isOpening=r,function(e){if(function(){if(null==fp){fp=!1;try{document.createElement("div").focus({get preventScroll(){return fp=!0,!0}})}catch{}}return fp}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}(e),e.dispatchEvent(a),mp.isOpening=!1}mp.isOpening=!1;let gp=null,_p="keyboard";const yp=new Set;let vp=new Map,bp=!1,xp=!1;const wp={Tab:!0,Escape:!0};function jp(e,t){for(let r of yp)r(e,t)}function Sp(e){bp=!0,!mp.isOpening&&function(e){return!(e.metaKey||!sp()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(gp="keyboard",_p="keyboard",jp("keyboard",e))}function kp(e){gp="pointer",_p="pointerType"in e?e.pointerType:"mouse","mousedown"!==e.type&&"pointerdown"!==e.type||(bp=!0,jp("pointer",e))}function Cp(e){var t;!mp.isOpening&&(""===(t=e).pointerType&&t.isTrusted||(pp()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(bp=!0,gp="virtual",_p="virtual")}function Tp(e){let t=Kd(Xd(e)),r=Qd(Xd(e));Xd(e)!==t&&Xd(e)!==r&&e.isTrusted&&(bp||xp||(gp="virtual",_p="virtual",jp("virtual",e)),bp=!1,xp=!1)}function Ep(){bp=!1,xp=!0}function Rp(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=Kd(e),r=Qd(e);if(vp.get(t))return;let n=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){bp=!0,n.apply(this,arguments)}}),r.addEventListener("keydown",Sp,!0),r.addEventListener("keyup",Sp,!0),r.addEventListener("click",Cp,!0),t.addEventListener("focus",Tp,!0),t.addEventListener("blur",Ep,!1),"undefined"!=typeof PointerEvent&&(r.addEventListener("pointerdown",kp,!0),r.addEventListener("pointermove",kp,!0),r.addEventListener("pointerup",kp,!0)),t.addEventListener("beforeunload",()=>{Pp(e)},{once:!0}),vp.set(t,{focus:n})}const Pp=(e,t)=>{const r=Kd(e),n=Qd(e);t&&n.removeEventListener("DOMContentLoaded",t),vp.has(r)&&(Reflect.defineProperty(r.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:vp.get(r).focus}),n.removeEventListener("keydown",Sp,!0),n.removeEventListener("keyup",Sp,!0),n.removeEventListener("click",Cp,!0),r.removeEventListener("focus",Tp,!0),r.removeEventListener("blur",Ep,!1),"undefined"!=typeof PointerEvent&&(n.removeEventListener("pointerdown",kp,!0),n.removeEventListener("pointermove",kp,!0),n.removeEventListener("pointerup",kp,!0)),vp.delete(r))};function Np(){return"pointer"!==gp}"undefined"!=typeof document&&function(e){const t=Qd(e);let r;"loading"!==t.readyState?Rp(e):(r=()=>{Rp(e)},t.addEventListener("DOMContentLoaded",r))}();const Op=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ap(){let e=(0,o.useRef)(new Map),t=(0,o.useCallback)((t,r,n,i)=>{let o=i?.once?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:i}),t.addEventListener(r,o,i)},[]),r=(0,o.useCallback)((t,r,n,i)=>{let o=e.current.get(n)?.fn||n;t.removeEventListener(r,o,i),e.current.delete(n)},[]),n=(0,o.useCallback)(()=>{e.current.forEach((e,t)=>{r(e.eventTarget,e.type,t,e.options)})},[r]);return(0,o.useEffect)(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function Ip(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:i}=e,s=(0,o.useRef)({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:l}=Ap(),c=(0,o.useCallback)(e=>{Jd(e.currentTarget,Xd(e))&&s.current.isFocusWithin&&!Jd(e.currentTarget,e.relatedTarget)&&(s.current.isFocusWithin=!1,l(),r&&r(e),i&&i(!1))},[r,i,s,l]),u=rp(c),d=(0,o.useCallback)(e=>{if(!Jd(e.currentTarget,Xd(e)))return;let t=Xd(e);const r=Qd(t),o=Yd(r);if(!s.current.isFocusWithin&&o===t){n&&n(e),i&&i(!0),s.current.isFocusWithin=!0,u(e);let t=e.currentTarget;a(r,"focus",e=>{let n=Xd(e);if(s.current.isFocusWithin&&!Jd(t,n)){let e=new r.defaultView.FocusEvent("blur",{relatedTarget:n});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(e,t);let i=tp(e);c(i)}},{capture:!0})}},[n,i,u,a,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}function Fp(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,i=(0,o.useRef)({isFocused:!1,isFocusVisible:t||Np()}),[s,a]=(0,o.useState)(!1),[l,c]=(0,o.useState)(()=>i.current.isFocused&&i.current.isFocusVisible),u=(0,o.useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),d=(0,o.useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=Np(),a(e),u()},[u]);var p,h,f;p=e=>{i.current.isFocusVisible=e,u()},h=[r,s],f={enabled:s,isTextInput:r},Rp(),(0,o.useEffect)(()=>{if(!1===f?.enabled)return;let e=(e,t)=>{(function(e,t,r){let n=r?Xd(r):void 0,i=Qd(n),o=Kd(n);const s=void 0!==o?o.HTMLInputElement:HTMLInputElement,a=void 0!==o?o.HTMLTextAreaElement:HTMLTextAreaElement,l=void 0!==o?o.HTMLElement:HTMLElement,c=void 0!==o?o.KeyboardEvent:KeyboardEvent;let u=Yd(i);return!((e=e||u instanceof s&&!Op.has(u.type)||u instanceof a||u instanceof l&&u.isContentEditable)&&"keyboard"===t&&r instanceof c&&!wp[r.key])})(!!f?.isTextInput,e,t)&&p(Np())};return yp.add(e),()=>{yp.delete(e)}},h);let{focusProps:m}=function(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:i}=e;const s=(0,o.useCallback)(e=>{if(Xd(e)===e.currentTarget)return n&&n(e),i&&i(!1),!0},[n,i]),a=rp(s),l=(0,o.useCallback)(e=>{let t=Xd(e);const n=Qd(t),o=n?Yd(n):Yd();t===e.currentTarget&&t===o&&(r&&r(e),i&&i(!0),a(e))},[i,r,a]);return{focusProps:{onFocus:!t&&(r||i||n)?l:void 0,onBlur:t||!n&&!i?void 0:s}}}({isDisabled:n,onFocusChange:d}),{focusWithinProps:g}=Ip({isDisabled:!n,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:n?g:m}}let Dp=!1,Lp=0;function zp(e){"touch"===e.pointerType&&(Dp=!0,setTimeout(()=>{Dp=!1},500))}function Mp(){let e=Qd(null);if(void 0!==e)return 0===Lp&&"undefined"!=typeof PointerEvent&&e.addEventListener("pointerup",zp),Lp++,()=>{Lp--,Lp>0||"undefined"!=typeof PointerEvent&&e.removeEventListener("pointerup",zp)}}function $p(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:i}=e,[s,a]=(0,o.useState)(!1),l=(0,o.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,o.useEffect)(Mp,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=Ap(),{hoverProps:d,triggerHoverEnd:p}=(0,o.useMemo)(()=>{let e=(e,t)=>{let i=l.target;l.pointerType="",l.target=null,"touch"!==t&&l.isHovered&&i&&(l.isHovered=!1,u(),n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),a(!1))},o={};return"undefined"!=typeof PointerEvent&&(o.onPointerEnter=n=>{Dp&&"mouse"===n.pointerType||((n,o)=>{if(l.pointerType=o,i||"touch"===o||l.isHovered||!Jd(n.currentTarget,Xd(n)))return;l.isHovered=!0;let s=n.currentTarget;l.target=s,c(Qd(Xd(n)),"pointerover",t=>{l.isHovered&&l.target&&!Jd(l.target,Xd(t))&&e(0,t.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:s,pointerType:o}),r&&r(!0),a(!0)})(n,n.pointerType)},o.onPointerLeave=t=>{!i&&Jd(t.currentTarget,Xd(t))&&e(0,t.pointerType)}),{hoverProps:o,triggerHoverEnd:e}},[t,r,n,i,l,c,u]);return(0,o.useEffect)(()=>{i&&p({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:d,isHovered:s}}var Up=Object.defineProperty,Bp=(e,t,r)=>(((e,t,r)=>{t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);let qp=new class{constructor(){Bp(this,"current",this.detect()),Bp(this,"handoffState","pending"),Bp(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}};function Hp(e){var t;return qp.isServer?null:null==e?document:null!=(t=null==e?void 0:e.ownerDocument)?t:document}function Wp(e){var t,r;return qp.isServer?null:null==e?document:null!=(r=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e))?r:document}function Gp(e){var t,r;return null!=(r=null==(t=Wp(e))?void 0:t.activeElement)?r:null}function Vp(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Zp(){let e=[],t={addEventListener:(e,r,n,i)=>(e.addEventListener(r,n,i),t.add(()=>e.removeEventListener(r,n,i))),requestAnimationFrame(...e){let r=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(r))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let r=setTimeout(...e);return t.add(()=>clearTimeout(r))},microTask(...e){let r={current:!0};return Vp(()=>{r.current&&e[0]()}),t.add(()=>{r.current=!1})},style(e,t,r){let n=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add(()=>{Object.assign(e.style,{[t]:n})})},group(e){let t=Zp();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let r=e.indexOf(t);if(r>=0)for(let t of e.splice(r,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Qp(){let[e]=(0,o.useState)(Zp);return(0,o.useEffect)(()=>()=>e.dispose(),[e]),e}let Kp=(e,t)=>{qp.isServer?(0,o.useEffect)(e,t):(0,o.useLayoutEffect)(e,t)};function Jp(e){let t=(0,o.useRef)(e);return Kp(()=>{t.current=e},[e]),t}let Yp=function(e){let t=Jp(e);return o.useCallback((...e)=>t.current(...e),[t])};function Xp({disabled:e=!1}={}){let t=(0,o.useRef)(null),[r,n]=(0,o.useState)(!1),i=Qp(),s=Yp(()=>{t.current=null,n(!1),i.dispose()}),a=Yp(e=>{if(i.dispose(),null===t.current){t.current=e.currentTarget,n(!0);{let r=Hp(e.currentTarget);i.addEventListener(r,"pointerup",s,!1),i.addEventListener(r,"pointermove",e=>{if(t.current){let r=function(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}(e);n(function(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}(r,t.current.getBoundingClientRect()))}},!1),i.addEventListener(r,"pointercancel",s,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:a,onPointerUp:s,onClick:s}}}function eh(e){if(null===e)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function th(e,t,r=!1){let[n,i]=(0,o.useState)(()=>eh(t));return Kp(()=>{if(!t||!e)return;let r=Zp();return r.requestAnimationFrame(function e(){r.requestAnimationFrame(e),i(e=>{let r=eh(t);return r.width===e.width&&r.height===e.height?e:r})}),()=>{r.dispose()}},[t,e]),r?{width:`${n.width}px`,height:`${n.height}px`}:n}function rh(e){return function(e){return"object"==typeof e&&null!==e&&"nodeType"in e}(e)&&"tagName"in e}function nh(e){return rh(e)&&"accessKey"in e}function ih(e){return rh(e)&&"tabIndex"in e}function oh(e){return nh(e)&&"FIELDSET"===e.nodeName}function sh(e){return nh(e)&&"LEGEND"===e.nodeName}function ah(e,t,...r){if(e in t){let n=t[e];return"function"==typeof n?n(...r):n}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ah),n}let lh=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),ch=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var uh,dh=((uh=dh||{})[uh.First=1]="First",uh[uh.Previous=2]="Previous",uh[uh.Next=4]="Next",uh[uh.Last=8]="Last",uh[uh.WrapAround=16]="WrapAround",uh[uh.NoScroll=32]="NoScroll",uh[uh.AutoFocus=64]="AutoFocus",uh),ph=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ph||{}),hh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(hh||{});function fh(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(lh)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var mh=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(mh||{});function gh(e,t=0){var r;return e!==(null==(r=Hp(e))?void 0:r.body)&&ah(t,{0:()=>e.matches(lh),1(){let t=e;for(;null!==t;){if(t.matches(lh))return!0;t=t.parentElement}return!1}})}var _h=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(_h||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let yh=["textarea","input"].join(",");function vh(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?Wp(e[0]):document:Wp(e),s=Array.isArray(e)?r?function(e,t=e=>e){return e.slice().sort((e,r)=>{let n=t(e),i=t(r);if(null===n||null===i)return 0;let o=n.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}(e):e:64&t?function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ch)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):fh(e);i.length>0&&s.length>1&&(s=s.filter(e=>!i.some(t=>null!=t&&"current"in t?(null==t?void 0:t.current)===e:t===e))),n=null!=n?n:null==o?void 0:o.activeElement;let a,l=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,s.indexOf(n))-1;if(4&t)return Math.max(0,s.indexOf(n))+1;if(8&t)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},d=0,p=s.length;do{if(d>=p||d+p<=0)return 0;let e=c+d;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}a=s[e],null==a||a.focus(u),d+=l}while(a!==Gp(a));return 6&t&&function(e){var t,r;return null!=(r=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,yh))&&r}(a)&&a.select(),2}function bh(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function xh(){return bh()||/Android/gi.test(window.navigator.userAgent)}function wh(e,t,r,n){let i=Jp(r);(0,o.useEffect)(()=>{if(e)return document.addEventListener(t,r,n),()=>document.removeEventListener(t,r,n);function r(e){i.current(e)}},[e,t,n])}function jh(e,t,r,n){let i=Jp(r);(0,o.useEffect)(()=>{if(e)return window.addEventListener(t,r,n),()=>window.removeEventListener(t,r,n);function r(e){i.current(e)}},[e,t,n])}function Sh(e,t,r){let n=Jp(r),i=(0,o.useCallback)(function(e,r){if(e.defaultPrevented)return;let i=r(e);if(null===i||!i.getRootNode().contains(i)||!i.isConnected)return;let o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(t);for(let t of o)if(null!==t&&(t.contains(i)||e.composed&&e.composedPath().includes(t)))return;return!gh(i,mh.Loose)&&-1!==i.tabIndex&&e.preventDefault(),n.current(e,i)},[n,t]),s=(0,o.useRef)(null);wh(e,"pointerdown",e=>{var t,r;xh()||(s.current=(null==(r=null==(t=e.composedPath)?void 0:t.call(e))?void 0:r[0])||e.target)},!0),wh(e,"pointerup",e=>{if(xh()||!s.current)return;let t=s.current;return s.current=null,i(e,()=>t)},!0);let a=(0,o.useRef)({x:0,y:0});wh(e,"touchstart",e=>{a.current.x=e.touches[0].clientX,a.current.y=e.touches[0].clientY},!0),wh(e,"touchend",e=>{let t=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY;if(!(Math.abs(t-a.current.x)>=30||Math.abs(r-a.current.y)>=30))return i(e,()=>ih(e.target)?e.target:null)},!0),jh(e,"blur",e=>i(e,()=>{return nh(e=window.document.activeElement)&&"IFRAME"===e.nodeName?window.document.activeElement:null;var e}),!0)}function kh(...e){return(0,o.useMemo)(()=>Hp(...e),[...e])}function Ch(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}var Th=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Th||{}),Eh=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Eh||{});function Rh(){let e=function(){let e=(0,o.useRef)([]),t=(0,o.useCallback)(t=>{for(let r of e.current)null!=r&&("function"==typeof r?r(t):r.current=t)},[]);return(...r)=>{if(!r.every(e=>null==e))return e.current=r,t}}();return(0,o.useCallback)(t=>function({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:i,visible:o=!0,name:s,mergeRefs:a}){a=null!=a?a:Nh;let l=Oh(t,e);if(o)return Ph(l,r,n,s,a);let c=null!=i?i:0;if(2&c){let{static:e=!1,...t}=l;if(e)return Ph(t,r,n,s,a)}if(1&c){let{unmount:e=!0,...t}=l;return ah(e?0:1,{0:()=>null,1:()=>Ph({...t,hidden:!0,style:{display:"none"}},r,n,s,a)})}return Ph(l,r,n,s,a)}({mergeRefs:e,...t}),[e])}function Ph(e,t={},r,n,i){let{as:s=r,children:a,refName:l="ref",...c}=Dh(e,["unmount","static"]),u=void 0!==e.ref?{[l]:e.ref}:{},d="function"==typeof a?a(t):a;d=zh(d),"className"in c&&c.className&&"function"==typeof c.className&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let p={};if(t){let e=!1,r=[];for(let[n,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&r.push(n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){p["data-headlessui-state"]=r.join(" ");for(let e of r)p[`data-${e}`]=""}}if(Mh(s)&&(Object.keys(Fh(c)).length>0||Object.keys(Fh(p)).length>0)){if(!(!(0,o.isValidElement)(d)||Array.isArray(d)&&d.length>1||function(e){return Mh(e.type)}(d))){let e=d.props,t=null==e?void 0:e.className,r="function"==typeof t?(...e)=>Ch(t(...e),c.className):Ch(t,c.className),n=r?{className:r}:{},s=Oh(d.props,Fh(Dh(c,["ref"])));for(let e in p)e in s&&delete p[e];return(0,o.cloneElement)(d,Object.assign({},s,p,u,{ref:i(Lh(d),u.ref)},n))}if(Object.keys(Fh(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Fh(c)).concat(Object.keys(Fh(p))).map(e=>` - ${e}`).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>` - ${e}`).join("\n")].join("\n"))}return(0,o.createElement)(s,Object.assign({},Dh(c,["ref"]),!Mh(s)&&u,!Mh(s)&&p),d)}function Nh(...e){return e.every(e=>null==e)?void 0:t=>{for(let r of e)null!=r&&("function"==typeof r?r(t):r.current=t)}}function Oh(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];if(t.disabled||t["aria-disabled"])for(let e in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(r[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in r)Object.assign(t,{[e](t,...n){let i=r[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...n)}}});return t}function Ah(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];for(let e in r)Object.assign(t,{[e](...t){let n=r[e];for(let e of n)null==e||e(...t)}});return t}function Ih(e){var t;return Object.assign((0,o.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function Fh(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Dh(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}function Lh(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}function zh(e){if(null!=e&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(null!=t&&"fulfilled"===t.status)return zh(t.value)}return e}function Mh(e){return e===o.Fragment||e===Symbol.for("react.fragment")}var $h,Uh=(($h=Uh||{})[$h.None=1]="None",$h[$h.Focusable=2]="Focusable",$h[$h.Hidden=4]="Hidden",$h);let Bh=Ih(function(e,t){var r;let{features:n=1,...i}=e,o={ref:t,"aria-hidden":!(2&~n)||(null!=(r=i["aria-hidden"])?r:void 0),hidden:!(4&~n)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...!(4&~n)&&!!(2&~n)&&{display:"none"}}};return Rh()({ourProps:o,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})}),qh=(0,o.createContext)(null);function Hh({children:e,node:t}){let[r,n]=(0,o.useState)(null),i=Wh(null!=t?t:r);return o.createElement(qh.Provider,{value:i},e,null===i&&o.createElement(Bh,{features:Uh.Hidden,ref:e=>{var t,r;if(e)for(let i of null!=(r=null==(t=Hp(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(i!==document.body&&i!==document.head&&rh(i)&&null!=i&&i.contains(e)){n(i);break}}}))}function Wh(e=null){var t;return null!=(t=(0,o.useContext)(qh))?t:e}function Gh(){let e;return{before({doc:t}){var r;let n=t.documentElement,i=null!=(r=t.defaultView)?r:window;e=Math.max(0,i.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,i=Math.max(0,n.clientWidth-n.offsetWidth),o=Math.max(0,e-i);r.style(n,"paddingRight",`${o}px`)}}}function Vh(){return bh()?{before({doc:e,d:t,meta:r}){function n(e){for(let t of r().containers)for(let r of t())if(r.contains(e))return!0;return!1}t.microTask(()=>{var r;if("auto"!==window.getComputedStyle(e.documentElement).scrollBehavior){let r=Zp();r.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>r.dispose()))}let i=null!=(r=window.scrollY)?r:window.pageYOffset,o=null;t.addEventListener(e,"click",t=>{if(ih(t.target))try{let r=t.target.closest("a");if(!r)return;let{hash:i}=new URL(r.href),s=e.querySelector(i);ih(s)&&!n(s)&&(o=s)}catch{}},!0),t.group(r=>{t.addEventListener(e,"touchstart",e=>{if(r.dispose(),ih(e.target)&&function(e){return rh(e)&&"style"in e}(e.target))if(n(e.target)){let t=e.target;for(;t.parentElement&&n(t.parentElement);)t=t.parentElement;r.style(t,"overscrollBehavior","contain")}else r.style(e.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",e=>{if(ih(e.target)){if(function(e){return nh(e)&&"INPUT"===e.nodeName}(e.target))return;if(n(e.target)){let t=e.target;for(;t.parentElement&&""!==t.dataset.headlessuiPortal&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;""===t.dataset.headlessuiPortal&&e.preventDefault()}else e.preventDefault()}},{passive:!1}),t.add(()=>{var e;let t=null!=(e=window.scrollY)?e:window.pageYOffset;i!==t&&window.scrollTo(0,i),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function Zh(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Qh=function(e,t){let r=new Map,n=new Set;return{getSnapshot:()=>r,subscribe:e=>(n.add(e),()=>n.delete(e)),dispatch(e,...i){let o=t[e].call(r,...i);o&&(r=o,n.forEach(e=>e()))}}}(0,{PUSH(e,t){var r;let n=null!=(r=this.get(e))?r:{doc:e,count:0,d:Zp(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=Zh(n.meta),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t),r.computedMeta=Zh(r.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},r=[Vh(),Gh(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];r.forEach(({before:e})=>null==e?void 0:e(t)),r.forEach(({after:e})=>null==e?void 0:e(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});function Kh(e,t,r=()=>({containers:[]})){let n=function(e){return(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}(Qh),i=t?n.get(t):void 0,s=!!i&&i.count>0;return Kp(()=>{if(t&&e)return Qh.dispatch("PUSH",t,r),()=>Qh.dispatch("POP",t,r)},[e,t]),s}Qh.subscribe(()=>{let e=Qh.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let e="hidden"===t.get(r.doc),n=0!==r.count;(n&&!e||!n&&e)&&Qh.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),0===r.count&&Qh.dispatch("TEARDOWN",r)}});class Jh extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return void 0===t&&(t=this.factory(e),this.set(e,t)),t}}var Yh,Xh,ef,tf=Object.defineProperty,rf=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},nf=(e,t,r)=>(rf(e,t,"read from private field"),r?r.call(e):t.get(e)),of=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},sf=(e,t,r,n)=>(rf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class af{constructor(e){of(this,Yh,{}),of(this,Xh,new Jh(()=>new Set)),of(this,ef,new Set),((e,t,r)=>{((e,t,r)=>{t in e?tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r)})(this,"disposables",Zp()),sf(this,Yh,e),qp.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return nf(this,Yh)}subscribe(e,t){if(qp.isServer)return()=>{};let r={selector:e,callback:t,current:e(nf(this,Yh))};return nf(this,ef).add(r),this.disposables.add(()=>{nf(this,ef).delete(r)})}on(e,t){return qp.isServer?()=>{}:(nf(this,Xh).get(e).add(t),this.disposables.add(()=>{nf(this,Xh).get(e).delete(t)}))}send(e){let t=this.reduce(nf(this,Yh),e);if(t!==nf(this,Yh)){sf(this,Yh,t);for(let e of nf(this,ef)){let t=e.selector(nf(this,Yh));lf(e.current,t)||(e.current=t,e.callback(t))}for(let t of nf(this,Xh).get(e.type))t(nf(this,Yh),e)}}}function lf(e,t){return!!Object.is(e,t)||"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t&&(Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&cf(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&cf(e.entries(),t.entries()):!(!uf(e)||!uf(t))&&cf(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function cf(e,t){for(;;){let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}}function uf(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}Yh=new WeakMap,Xh=new WeakMap,ef=new WeakMap;var df=Object.defineProperty,pf=(e,t,r)=>(((e,t,r)=>{t in e?df(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),hf=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(hf||{});let ff={0(e,t){let r=t.id,n=e.stack,i=e.stack.indexOf(r);if(-1!==i){let t=e.stack.slice();return t.splice(i,1),t.push(r),n=t,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(-1===n)return e;let i=e.stack.slice();return i.splice(n,1),{...e,stack:i}}};class mf extends af{constructor(){super(...arguments),pf(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),pf(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new mf({stack:[]})}reduce(e,t){return ah(t.type,ff,e,t)}}const gf=new Jh(()=>mf.new());var _f=r(721);function yf(e,t,r=lf){return(0,_f.useSyncExternalStoreWithSelector)(Yp(t=>e.subscribe(vf,t)),Yp(()=>e.state),Yp(()=>e.state),Yp(t),r)}function vf(e){return e}function bf(e){return(0,o.useMemo)(()=>e,Object.values(e))}let xf=Symbol();function wf(e,t=!0){return Object.assign(e,{[xf]:t})}function jf(...e){let t=(0,o.useRef)(e);(0,o.useEffect)(()=>{t.current=e},[e]);let r=Yp(e=>{for(let r of t.current)null!=r&&("function"==typeof r?r(e):r.current=e)});return e.every(e=>null==e||(null==e?void 0:e[xf]))?void 0:r}var Sf,kf,Cf=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Cf||{});function Tf(){let e=(0,o.useRef)(0);return jh(!0,"keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}"undefined"!=typeof process&&"undefined"!=typeof globalThis&&"undefined"!=typeof Element&&"test"===(null==(Sf=null==process?void 0:{NODE_ENV:"production"})?void 0:Sf.NODE_ENV)&&void 0===(null==(kf=null==Element?void 0:Element.prototype)?void 0:kf.getAnimations)&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join("\n")),[]});var Ef=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Ef||{});function Rf(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function Pf(e,t,r,n){let[i,s]=(0,o.useState)(r),{hasFlag:a,addFlag:l,removeFlag:c}=function(e=0){let[t,r]=(0,o.useState)(e),n=(0,o.useCallback)(e=>r(e),[]),i=(0,o.useCallback)(e=>r(t=>t|e),[]),s=(0,o.useCallback)(e=>(t&e)===e,[t]),a=(0,o.useCallback)(e=>r(t=>t&~e),[]),l=(0,o.useCallback)(e=>r(t=>t^e),[]);return{flags:t,setFlag:n,addFlag:i,hasFlag:s,removeFlag:a,toggleFlag:l}}(e&&i?3:0),u=(0,o.useRef)(!1),d=(0,o.useRef)(!1),p=Qp();return Kp(()=>{var i;if(e)return r&&s(!0),t?(null==(i=null==n?void 0:n.start)||i.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:i}){let o=Zp();return function(e,{inFlight:t,prepare:r}){if(null!=t&&t.current)return void r();let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(function(e,t){var r,n;let i=Zp();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=null!=(n=null==(r=e.getAnimations)?void 0:r.call(e).filter(e=>e instanceof CSSTransition))?n:[];return 0===s.length?(t(),i.dispose):(Promise.allSettled(s.map(e=>e.finished)).then(()=>{o||t()}),i.dispose)}(e,n))})}),o.dispose}(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(r?(l(3),c(4)):(l(4),c(2)))},run(){d.current?r?(c(3),l(4)):(c(4),l(3)):r?c(1):l(1)},done(){var e;d.current&&function(e){var t,r;return(null!=(r=null==(t=e.getAnimations)?void 0:t.call(e))?r:[]).some(e=>e instanceof CSSTransition&&"finished"!==e.playState)}(t)||(u.current=!1,c(7),r||s(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})):void(r&&l(3))},[e,r,t,p]),e?[i,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}let Nf=(0,o.createContext)(()=>{});function Of({value:e,children:t}){return o.createElement(Nf.Provider,{value:e},t)}const Af=Math.min,If=Math.max,Ff=Math.round,Df=Math.floor,Lf=e=>({x:e,y:e}),zf={left:"right",right:"left",bottom:"top",top:"bottom"};function Mf(e,t,r){return If(e,Af(t,r))}function $f(e,t){return"function"==typeof e?e(t):e}function Uf(e){return e.split("-")[0]}function Bf(e){return e.split("-")[1]}function qf(e){return"x"===e?"y":"x"}function Hf(e){return"y"===e?"height":"width"}function Wf(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Gf(e){return qf(Wf(e))}function Vf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Zf=["left","right"],Qf=["right","left"],Kf=["top","bottom"],Jf=["bottom","top"];function Yf(e){const t=Uf(e);return zf[t]+e.slice(t.length)}function Xf(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function em(){return"undefined"!=typeof window}function tm(e){return im(e)?(e.nodeName||"").toLowerCase():"#document"}function rm(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function nm(e){var t;return null==(t=(im(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function im(e){return!!em()&&(e instanceof Node||e instanceof rm(e).Node)}function om(e){return!!em()&&(e instanceof Element||e instanceof rm(e).Element)}function sm(e){return!!em()&&(e instanceof HTMLElement||e instanceof rm(e).HTMLElement)}function am(e){return!(!em()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof rm(e).ShadowRoot)}function lm(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=ym(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==i&&"contents"!==i}function cm(e){return/^(table|td|th)$/.test(tm(e))}function um(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const dm=/transform|translate|scale|rotate|perspective|filter/,pm=/paint|layout|strict|content/,hm=e=>!!e&&"none"!==e;let fm;function mm(e){const t=om(e)?ym(e):e;return hm(t.transform)||hm(t.translate)||hm(t.scale)||hm(t.rotate)||hm(t.perspective)||!gm()&&(hm(t.backdropFilter)||hm(t.filter))||dm.test(t.willChange||"")||pm.test(t.contain||"")}function gm(){return null==fm&&(fm="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fm}function _m(e){return/^(html|body|#document)$/.test(tm(e))}function ym(e){return rm(e).getComputedStyle(e)}function vm(e){return om(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bm(e){if("html"===tm(e))return e;const t=e.assignedSlot||e.parentNode||am(e)&&e.host||nm(e);return am(t)?t.host:t}function xm(e){const t=bm(e);return _m(t)?e.ownerDocument?e.ownerDocument.body:e.body:sm(t)&&lm(t)?t:xm(t)}function wm(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=xm(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),s=rm(i);if(o){const e=jm(s);return t.concat(s,s.visualViewport||[],lm(i)?i:[],e&&r?wm(e):[])}return t.concat(i,wm(i,[],r))}function jm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sm(e,t,r){let{reference:n,floating:i}=e;const o=Wf(t),s=Gf(t),a=Hf(s),l=Uf(t),c="y"===o,u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:n.y-i.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(Bf(t)){case"start":h[s]-=p*(r&&c?-1:1);break;case"end":h[s]+=p*(r&&c?-1:1)}return h}async function km(e,t){var r;void 0===t&&(t={});const{x:n,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=$f(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(h),m=a[p?"floating"===d?"reference":"floating":d],g=Xf(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(m)))||r?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_="floating"===d?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),v=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},b=Xf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:l}):_);return{top:(g.top-b.top+f.top)/v.y,bottom:(b.bottom-g.bottom+f.bottom)/v.y,left:(g.left-b.left+f.left)/v.x,right:(b.right-g.right+f.right)/v.x}}const Cm=new Set(["left","top"]);function Tm(e){const t=ym(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=sm(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,a=Ff(r)!==o||Ff(n)!==s;return a&&(r=o,n=s),{width:r,height:n,$:a}}function Em(e){return om(e)?e:e.contextElement}function Rm(e){const t=Em(e);if(!sm(t))return Lf(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=Tm(t);let s=(o?Ff(r.width):r.width)/n,a=(o?Ff(r.height):r.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Pm=Lf(0);function Nm(e){const t=rm(e);return gm()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Pm}function Om(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=Em(e);let s=Lf(1);t&&(n?om(n)&&(s=Rm(n)):s=Rm(e));const a=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==rm(e))&&t}(o,r,n)?Nm(o):Lf(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(o){const e=rm(o),t=n&&om(n)?rm(n):n;let r=e,i=jm(r);for(;i&&n&&t!==r;){const e=Rm(i),t=i.getBoundingClientRect(),n=ym(i),o=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=s,r=rm(i),i=jm(r)}}return Xf({width:u,height:d,x:l,y:c})}function Am(e,t){const r=vm(e).scrollLeft;return t?t.left+r:Om(nm(e)).left+r}function Im(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Am(e,r),y:r.top+t.scrollTop}}function Fm(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=rm(e),n=nm(e),i=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=gm();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=Am(n);if(c<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,s=Math.abs(n.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,r);else if("document"===t)n=function(e){const t=nm(e),r=vm(e),n=e.ownerDocument.body,i=If(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=If(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+Am(e);const a=-r.scrollTop;return"rtl"===ym(n).direction&&(s+=If(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}(nm(e));else if(om(t))n=function(e,t){const r=Om(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=sm(e)?Rm(e):Lf(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:n*o.y}}(t,r);else{const r=Nm(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Xf(n)}function Dm(e,t){const r=bm(e);return!(r===t||!om(r)||_m(r))&&("fixed"===ym(r).position||Dm(r,t))}function Lm(e,t,r){const n=sm(t),i=nm(t),o="fixed"===r,s=Om(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Lf(0);function c(){l.x=Am(i)}if(n||!n&&!o)if(("body"!==tm(t)||lm(i))&&(a=vm(t)),n){const e=Om(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!n&&i&&c();const u=!i||n||o?Lf(0):Im(i,a);return{x:s.left+a.scrollLeft-l.x-u.x,y:s.top+a.scrollTop-l.y-u.y,width:s.width,height:s.height}}function zm(e){return"static"===ym(e).position}function Mm(e,t){if(!sm(e)||"fixed"===ym(e).position)return null;if(t)return t(e);let r=e.offsetParent;return nm(e)===r&&(r=r.ownerDocument.body),r}function $m(e,t){const r=rm(e);if(um(e))return r;if(!sm(e)){let t=bm(e);for(;t&&!_m(t);){if(om(t)&&!zm(t))return t;t=bm(t)}return r}let n=Mm(e,t);for(;n&&cm(n)&&zm(n);)n=Mm(n,t);return n&&_m(n)&&zm(n)&&!mm(n)?r:n||function(e){let t=bm(e);for(;sm(t)&&!_m(t);){if(mm(t))return t;if(um(t))return null;t=bm(t)}return null}(e)||r}const Um={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,s=nm(n),a=!!t&&um(t.floating);if(n===s||a&&o)return r;let l={scrollLeft:0,scrollTop:0},c=Lf(1);const u=Lf(0),d=sm(n);if((d||!d&&!o)&&(("body"!==tm(n)||lm(s))&&(l=vm(n)),d)){const e=Om(n);c=Rm(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}const p=!s||d||o?Lf(0):Im(s,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:r.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:nm,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?um(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=wm(e,[],!1).filter(e=>om(e)&&"body"!==tm(e)),i=null;const o="fixed"===ym(e).position;let s=o?bm(e):e;for(;om(s)&&!_m(s);){const t=ym(s),r=mm(s);r||"fixed"!==t.position||(i=null),(o?!r&&!i:!r&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||lm(s)&&!r&&Dm(e,s))?n=n.filter(e=>e!==s):i=t,s=bm(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=Fm(t,o[0],i);let a=s.top,l=s.right,c=s.bottom,u=s.left;for(let e=1;e<o.length;e++){const r=Fm(t,o[e],i);a=If(r.top,a),l=Af(r.right,l),c=Af(r.bottom,c),u=If(r.left,u)}return{width:l-u,height:c-a,x:u,y:a}},getOffsetParent:$m,getElementRects:async function(e){const t=this.getOffsetParent||$m,r=this.getDimensions,n=await r(e.floating);return{reference:Lm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=Tm(e);return{width:t,height:r}},getScale:Rm,isElement:om,isRTL:function(e){return"rtl"===ym(e).direction}};function Bm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qm(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Em(e),u=i||o?[...c?wm(c):[],...t?wm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const d=c&&a?function(e,t){let r,n=null;const i=nm(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:h}=c;if(a||t(),!p||!h)return;const f={rootMargin:-Df(d)+"px "+-Df(i.clientWidth-(u+p))+"px "+-Df(i.clientHeight-(d+h))+"px "+-Df(u)+"px",threshold:If(0,Af(1,l))||1};let m=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!m)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==n||Bm(c,e.getBoundingClientRect())||s(),m=!1}try{n=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(g,f)}n.observe(e)}(!0),o}(c,r):null;let p,h=-1,f=null;s&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),c&&!l&&f.observe(c),t&&f.observe(t));let m=l?Om(e):null;return l&&function t(){const n=Om(e);m&&!Bm(m,n)&&r(),m=n,p=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const Hm=km,Wm=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=$f(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const _=Uf(i),y=Wf(a),v=Uf(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(v||!m?[Yf(a)]:function(e){const t=Yf(e);return[Vf(e),t,Vf(t)]}(a)),w="none"!==f;!p&&w&&x.push(...function(e,t,r,n){const i=Bf(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Qf:Zf:t?Zf:Qf;case"left":case"right":return t?Kf:Jf;default:return[]}}(Uf(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Vf)))),o}(a,m,f,b));const j=[a,...x],S=await l.detectOverflow(t,g),k=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(u&&k.push(S[_]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=Bf(e),i=Gf(e),o=Hf(i);let s="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Yf(s)),[s,Yf(s)]}(i,s,b);k.push(S[e[0]],S[e[1]])}if(C=[...C,{placement:i,overflows:k}],!k.every(e=>e<=0)){var T,E;const e=((null==(T=o.flip)?void 0:T.index)||0)+1,t=j[e];if(t&&("alignment"!==d||y===Wf(t)||C.every(e=>Wf(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let r=null==(E=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:E.placement;if(!r)switch(h){case"bestFit":{var R;const e=null==(R=C.filter(e=>{if(w){const t=Wf(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(r=e);break}case"initialPlacement":r=a}if(i!==r)return{reset:{placement:r}}}return{}}}},Gm=(e,t,r)=>{const n=new Map,i={platform:Um,...r},o={...i.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:s}=r,a=s.detectOverflow?s:{...s,detectOverflow:km},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Sm(c,n,l),p=n,h=0;const f={};for(let r=0;r<o.length;r++){const m=o[r];if(!m)continue;const{name:g,fn:_}=m,{x:y,y:v,data:b,reset:x}=await _({x:u,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=y?y:u,d=null!=v?v:d,f[g]={...f[g],...b},x&&h<50&&(h++,"object"==typeof x&&(x.placement&&(p=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),({x:u,y:d}=Sm(c,p,l))),r=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var Vm="undefined"!=typeof document?o.useLayoutEffect:function(){};function Zm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Zm(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!==n--;){const r=i[n];if(!("_owner"===r&&e.$$typeof||Zm(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function Qm(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Km(e,t){const r=Qm(e);return Math.round(t*r)/r}function Jm(e){const t=o.useRef(e);return Vm(()=>{t.current=e}),t}const Ym=(e,t)=>{const r=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:r,platform:n,elements:i}=e,o=await(null==n.isRTL?void 0:n.isRTL(i.floating)),s=Uf(r),a=Bf(r),l="y"===Wf(r),c=Cm.has(s)?-1:1,u=o&&l?-1:1,d=$f(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*u,y:p*c}:{x:p*c,y:h*u}}(t,e);return s===(null==(r=a.offset)?void 0:r.placement)&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},Xm=(e,t)=>{const r=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=$f(e,t),u={x:r,y:n},d=await o.detectOverflow(t,c),p=Wf(Uf(i)),h=qf(p);let f=u[h],m=u[p];if(s){const e="y"===h?"bottom":"right";f=Mf(f+d["y"===h?"top":"left"],f,f-d[e])}if(a){const e="y"===p?"bottom":"right";m=Mf(m+d["y"===p?"top":"left"],m,m-d[e])}const g=l.fn({...t,[h]:f,[p]:m});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[h]:s,[p]:a}}}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},eg=(e,t)=>{const r=Wm(e);return{name:r.name,fn:r.fn,options:[e,t]}},tg=(e,t)=>{const r=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=$f(e,t),u=await s.detectOverflow(t,c),d=Uf(i),p=Bf(i),h="y"===Wf(i),{width:f,height:m}=o.floating;let g,_;"top"===d||"bottom"===d?(g=d,_=p===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(_=d,g="end"===p?"top":"bottom");const y=m-u.top-u.bottom,v=f-u.left-u.right,b=Af(m-u[g],y),x=Af(f-u[_],v),w=!t.middlewareData.shift;let j=b,S=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(S=v),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(j=y),w&&!p){const e=If(u.left,0),t=If(u.right,0),r=If(u.top,0),n=If(u.bottom,0);h?S=f-2*(0!==e||0!==t?e+t:If(u.left,u.right)):j=m-2*(0!==r||0!==n?r+n:If(u.top,u.bottom))}await l({...t,availableWidth:S,availableHeight:j});const k=await s.getDimensions(a.floating);return f!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}}(e);return{name:r.name,fn:r.fn,options:[e,t]}},rg={...s},ng=rg.useInsertionEffect||(e=>e());function ig(e){const t=o.useRef(()=>{});return ng(()=>{t.current=e}),o.useCallback(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)},[])}var og="undefined"!=typeof document?o.useLayoutEffect:o.useEffect;let sg=!1,ag=0;const lg=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ag++,cg=rg.useId||function(){const[e,t]=o.useState(()=>sg?lg():void 0);return og(()=>{null==e&&t(lg())},[]),o.useEffect(()=>{sg=!0},[]),e};const ug=o.createContext(null),dg=o.createContext(null),pg="data-floating-ui-focusable";function hg(e){void 0===e&&(e={});const{nodeId:t}=e,r=function(e){const{open:t=!1,onOpenChange:r,elements:n}=e,i=cg(),s=o.useRef({}),[a]=o.useState(()=>function(){const e=new Map;return{emit(t,r){var n;null==(n=e.get(t))||n.forEach(e=>e(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,(null==(n=e.get(t))?void 0:n.filter(e=>e!==r))||[])}}}()),l=null!=((null==(f=o.useContext(ug))?void 0:f.id)||null),[c,u]=o.useState(n.reference),d=ig((e,t,n)=>{s.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:n,nested:l}),null==r||r(e,t,n)}),p=o.useMemo(()=>({setPositionReference:u}),[]),h=o.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);var f;return o.useMemo(()=>({dataRef:s,open:t,onOpenChange:d,elements:h,events:a,floatingId:i,refs:p}),[t,d,h,a,i,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||r,s=i.elements,[a,l]=o.useState(null),[c,u]=o.useState(null),d=(null==s?void 0:s.domReference)||a,p=o.useRef(null),h=o.useContext(dg);og(()=>{d&&(p.current=d)},[d]);const f=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[p,h]=o.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=o.useState(i);Zm(f,i)||m(i);const[g,_]=o.useState(null),[y,v]=o.useState(null),b=o.useCallback(e=>{e!==S.current&&(S.current=e,_(e))},[]),x=o.useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),w=a||g,j=l||y,S=o.useRef(null),k=o.useRef(null),C=o.useRef(p),T=null!=u,E=Jm(u),R=Jm(s),P=Jm(d),N=o.useCallback(()=>{if(!S.current||!k.current)return;const e={placement:t,strategy:r,middleware:f};R.current&&(e.platform=R.current),Gm(S.current,k.current,e).then(e=>{const t={...e,isPositioned:!1!==P.current};O.current&&!Zm(C.current,t)&&(C.current=t,n.flushSync(()=>{h(t)}))})},[f,t,r,R,P]);Vm(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[d]);const O=o.useRef(!1);Vm(()=>(O.current=!0,()=>{O.current=!1}),[]),Vm(()=>{if(w&&(S.current=w),j&&(k.current=j),w&&j){if(E.current)return E.current(w,j,N);N()}},[w,j,N,E,T]);const A=o.useMemo(()=>({reference:S,floating:k,setReference:b,setFloating:x}),[b,x]),I=o.useMemo(()=>({reference:w,floating:j}),[w,j]),F=o.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Km(I.floating,p.x),n=Km(I.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Qm(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,p.x,p.y]);return o.useMemo(()=>({...p,update:N,refs:A,elements:I,floatingStyles:F}),[p,N,A,I,F])}({...e,elements:{...s,...c&&{reference:c}}}),m=o.useCallback(e=>{const t=om(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),f.refs.setReference(t)},[f.refs]),g=o.useCallback(e=>{(om(e)||null===e)&&(p.current=e,l(e)),(om(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!om(e))&&f.refs.setReference(e)},[f.refs]),_=o.useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:p}),[f.refs,g,m]),y=o.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),v=o.useMemo(()=>({...f,...i,refs:_,elements:y,nodeId:t}),[f,_,y,t,i]);return og(()=>{i.dataRef.current.floatingContext=v;const e=null==h?void 0:h.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),o.useMemo(()=>({...f,context:v,refs:_,elements:y}),[f,_,y,v])}const fg="active",mg="selected";function gg(e,t,r){const n=new Map,i="item"===r;let o=e;if(i&&e){const{[fg]:t,[mg]:__,...r}=e;o=r}return{..."floating"===r&&{tabIndex:-1,[pg]:""},...o,...t.map(t=>{const n=t?t[r]:null;return"function"==typeof n?e?n(e):null:n}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[r,o]=t;var s;i&&[fg,mg].includes(r)||(0===r.indexOf("on")?(n.has(r)||n.set(r,[]),"function"==typeof o&&(null==(s=n.get(r))||s.push(o),e[r]=function(){for(var e,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return null==(e=n.get(r))?void 0:e.map(e=>e(...i)).find(e=>void 0!==e)})):e[r]=o)}),e):e,{})}}function _g(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}let yg=(0,o.createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});yg.displayName="FloatingContext";let vg=(0,o.createContext)(null);function bg(e=null){!1===e&&(e=null),"string"==typeof e&&(e={to:e});let t=(0,o.useContext)(vg),r=(0,o.useMemo)(()=>e,[JSON.stringify(e,(e,t)=>{var r;return null!=(r=null==t?void 0:t.outerHTML)?r:t})]);Kp(()=>{null==t||t(null!=r?r:null)},[t,r]);let n=(0,o.useContext)(yg);return(0,o.useMemo)(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}function xg({children:e,enabled:t=!0}){let[r,i]=(0,o.useState)(null),[s,a]=(0,o.useState)(0),l=(0,o.useRef)(null),[c,u]=(0,o.useState)(null);!function(e){Kp(()=>{if(!e)return;let t=new MutationObserver(()=>{let t=window.getComputedStyle(e).maxHeight,r=parseFloat(t);if(isNaN(r))return;let n=parseInt(t);isNaN(n)||r!==n&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}(c);let d=t&&null!==r&&null!==c,{to:p="bottom",gap:h=0,offset:f=0,padding:m=0,inner:g}=function(e,t){var r,n,i;let o=wg(null!=(r=null==e?void 0:e.gap)?r:"var(--anchor-gap, 0)",t),s=wg(null!=(n=null==e?void 0:e.offset)?n:"var(--anchor-offset, 0)",t),a=wg(null!=(i=null==e?void 0:e.padding)?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}(r,c),[_,y="center"]=p.split(" ");Kp(()=>{d&&a(0)},[d]);let{refs:v,floatingStyles:b,context:x}=hg({open:d,placement:"selection"===_?"center"===y?"bottom":`bottom-${y}`:"center"===y?`${_}`:`${_}-${y}`,strategy:"absolute",transform:!1,middleware:[Ym({mainAxis:"selection"===_?0:h,crossAxis:f}),Xm({padding:m}),"selection"!==_&&eg({padding:m}),"selection"===_&&g?(S={...g,padding:m,overflowRef:l,offset:s,minItemsVisible:4,referenceOverflowThreshold:m,onFallbackChange(e){var t,r;if(!e)return;let n=x.elements.floating;if(!n)return;let i=parseFloat(getComputedStyle(n).scrollPaddingBottom)||0,o=Math.min(4,n.childElementCount),s=0,l=0;for(let e of null!=(r=null==(t=x.elements.floating)?void 0:t.childNodes)?r:[])if(nh(e)){let t=e.offsetTop,r=t+e.clientHeight+i,a=n.scrollTop,c=a+n.clientHeight;if(!(t>=a&&r<=c)){l=Math.max(0,Math.min(r,c)-Math.max(t,a)),s=e.clientHeight;break}o--}o>=1&&a(e=>{let t=s*o-l+i;return e>=t?e:t})}},{name:"inner",options:S,async fn(e){const{listRef:t,overflowRef:r,onFallbackChange:i,offset:o=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=$f(S,e),{rects:d,elements:{floating:p}}=e,h=t.current[s],f=(null==c?void 0:c.current)||p,m=p.clientTop||f.clientTop,g=0!==p.clientTop,_=0!==f.clientTop,y=p===f;if(!h)return{};const v={...e,...await Ym(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-o).fn(e)},b=await Hm(_g(v,f.scrollHeight+m+p.clientTop),u),x=await Hm(v,{...u,elementContext:"reference"}),w=If(0,b.top),j=v.y+w,k=f.scrollHeight>f.clientHeight?e=>e:Ff,C=k(If(0,f.scrollHeight+(g&&y||_?2*m:0)-w-If(0,b.bottom)));if(f.style.maxHeight=C+"px",f.scrollTop=w,i){const e=f.offsetHeight<h.offsetHeight*Af(a,t.current.length)-1||x.top>=-l||x.bottom>=-l;n.flushSync(()=>i(e))}return r&&(r.current=await Hm(_g({...v,y:j},f.offsetHeight+m+p.clientTop),u)),{y:j}}}):null,tg({padding:m,apply({availableWidth:e,availableHeight:t,elements:r}){Object.assign(r.floating.style,{overflow:"auto",maxWidth:`${e}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${t}px)`})}})].filter(Boolean),whileElementsMounted:qm}),[w=_,j=y]=x.placement.split("-");var S;"selection"===_&&(w="selection");let k=(0,o.useMemo)(()=>({anchor:[w,j].filter(Boolean).join(" ")}),[w,j]),C=function(e,t){const{open:r,elements:i}=e,{enabled:s=!0,overflowRef:a,scrollRef:l,onChange:c}=t,u=ig(c),d=o.useRef(!1),p=o.useRef(null),h=o.useRef(null);o.useEffect(()=>{if(!s)return;function e(e){if(e.ctrlKey||!t||null==a.current)return;const r=e.deltaY,i=a.current.top>=-.5,o=a.current.bottom>=-.5,s=t.scrollHeight-t.clientHeight,l=r<0?-1:1,c=r<0?"max":"min";t.scrollHeight<=t.clientHeight||(!i&&r>0||!o&&r<0?(e.preventDefault(),n.flushSync(()=>{u(e=>e+Math[c](r,s*l))})):/firefox/i.test(function(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:r}=e;return t+"/"+r}).join(" "):navigator.userAgent}())&&(t.scrollTop+=r))}const t=(null==l?void 0:l.current)||i.floating;return r&&t?(t.addEventListener("wheel",e),requestAnimationFrame(()=>{p.current=t.scrollTop,null!=a.current&&(h.current={...a.current})}),()=>{p.current=null,h.current=null,t.removeEventListener("wheel",e)}):void 0},[s,r,i.floating,a,l,u]);const f=o.useMemo(()=>({onKeyDown(){d.current=!0},onWheel(){d.current=!1},onPointerMove(){d.current=!1},onScroll(){const e=(null==l?void 0:l.current)||i.floating;if(a.current&&e&&d.current){if(null!==p.current){const t=e.scrollTop-p.current;(a.current.bottom<-.5&&t<-1||a.current.top<-.5&&t>1)&&n.flushSync(()=>u(e=>e+t))}requestAnimationFrame(()=>{p.current=e.scrollTop})}}}),[i.floating,u,a,l]);return o.useMemo(()=>s?{floating:f}:{},[s,f])}(x,{overflowRef:l,onChange:a}),{getReferenceProps:T,getFloatingProps:E}=function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),r=e.map(e=>null==e?void 0:e.floating),n=e.map(e=>null==e?void 0:e.item),i=o.useCallback(t=>gg(t,e,"reference"),t),s=o.useCallback(t=>gg(t,e,"floating"),r),a=o.useCallback(t=>gg(t,e,"item"),n);return o.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:a}),[i,s,a])}([C]),R=Yp(e=>{u(e),v.setFloating(e)});return o.createElement(vg.Provider,{value:i},o.createElement(yg.Provider,{value:{setFloating:R,setReference:v.setReference,styles:b,getReferenceProps:T,getFloatingProps:E,slot:k}},e))}function wg(e,t,r=void 0){let n=Qp(),i=Yp((e,t)=>{if(null==e)return[r,null];if("number"==typeof e)return[e,null];if("string"==typeof e){if(!t)return[r,null];let i=Sg(e,t);return[i,r=>{let o=jg(e);{let s=o.map(e=>window.getComputedStyle(t).getPropertyValue(e));n.requestAnimationFrame(function a(){n.nextFrame(a);let l=!1;for(let[e,r]of o.entries()){let n=window.getComputedStyle(t).getPropertyValue(r);if(s[e]!==n){s[e]=n,l=!0;break}}if(!l)return;let c=Sg(e,t);i!==c&&(r(c),i=c)})}return n.dispose}]}return[r,null]}),s=(0,o.useMemo)(()=>i(e,t)[0],[e,t]),[a=s,l]=(0,o.useState)();return Kp(()=>{let[r,n]=i(e,t);if(l(r),n)return n(l)},[e,t]),a}function jg(e){let t=/var\((.*)\)/.exec(e);if(t){let e=t[1].indexOf(",");if(-1===e)return[t[1]];let r=t[1].slice(0,e).trim(),n=t[1].slice(e+1).trim();return n?[r,...jg(n)]:[r]}return[]}function Sg(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}vg.displayName="PlacementContext";let kg=(0,o.createContext)(null);kg.displayName="OpenClosedContext";var Cg=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Cg||{});function Tg(){return(0,o.useContext)(kg)}function Eg({value:e,children:t}){return o.createElement(kg.Provider,{value:e},t)}function Rg({children:e}){return o.createElement(kg.Provider,{value:null},e)}function Pg(e){let t=e.parentElement,r=null;for(;t&&!oh(t);)sh(t)&&(r=t),t=t.parentElement;let n=""===(null==t?void 0:t.getAttribute("disabled"));return(!n||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(sh(t))return!1;t=t.previousElementSibling}return!0}(r))&&n}var Ng=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ng||{});function Og(e){let t=Yp(e),r=(0,o.useRef)(!1);(0,o.useEffect)(()=>(r.current=!1,()=>{r.current=!0,Vp(()=>{r.current&&t()})}),[t])}let Ag=(0,o.createContext)(!1);let Ig=o.Fragment,Fg=Ih(function(e,t){let{ownerDocument:r=null,...i}=e,a=(0,o.useRef)(null),l=jf(wf(e=>{a.current=e}),t),c=kh(a.current),u=function(e){let t=(0,o.useContext)(Ag),r=(0,o.useContext)(Lg),[n,i]=(0,o.useState)(()=>{var n;if(!t&&null!==r)return null!=(n=r.current)?n:null;if(qp.isServer)return null;let i=null==e?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(null===e)return null;let o=e.createElement("div");return o.setAttribute("id","headlessui-portal-root"),e.body.appendChild(o)});return(0,o.useEffect)(()=>{null!==n&&(null!=e&&e.body.contains(n)||null==e||e.body.appendChild(n))},[n,e]),(0,o.useEffect)(()=>{t||null!==r&&i(r.current)},[r,i,t]),n}(null!=r?r:c),d=(0,o.useContext)(zg),p=Qp(),h=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in s&&(e=>e.useSyncExternalStore)(s)(()=>()=>{},()=>!1,()=>!e)}(),[t,r]=o.useState(qp.isHandoffComplete);return t&&!1===qp.isHandoffComplete&&r(!1),o.useEffect(()=>{!0!==t&&r(!0)},[t]),o.useEffect(()=>qp.handoff(),[]),!e&&t}(),f=Rh();return Og(()=>{var e;u&&u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u))}),u&&h?(0,n.createPortal)(o.createElement("div",{"data-headlessui-portal":"",ref:e=>{p.dispose(),d&&e&&p.add(d.register(e))}},f({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:Ig,name:"Portal"})),u):null}),Dg=o.Fragment,Lg=(0,o.createContext)(null),zg=(0,o.createContext)(null),Mg=Ih(function(e,t){let r=jf(t),{enabled:n=!0,ownerDocument:i,...s}=e,a=Rh();return n?o.createElement(Fg,{...s,ownerDocument:i,ref:r}):a({ourProps:{ref:r},theirProps:s,slot:{},defaultTag:Ig,name:"Portal"})}),$g=Ih(function(e,t){let{target:r,...n}=e,i={ref:jf(t)},s=Rh();return o.createElement(Lg.Provider,{value:r},s({ourProps:i,theirProps:n,defaultTag:Dg,name:"Popover.Group"}))}),Ug=Object.assign(Mg,{Group:$g});var Bg=Object.defineProperty,qg=(e,t,r)=>(((e,t,r)=>{t in e?Bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Hg=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Hg||{}),Wg=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(Wg||{});let Gg={0:e=>0===e.popoverState?e:{...e,popoverState:0,__demoMode:!1},1:e=>1===e.popoverState?e:{...e,popoverState:1,__demoMode:!1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}};class Vg extends af{constructor(e){super(e),qg(this,"actions",{close:()=>this.send({type:1}),refocusableClose:e=>{this.actions.close();let t=(()=>e?nh(e)?e:"current"in e&&nh(e.current)?e.current:this.state.button:this.state.button)();null==t||t.focus()},open:()=>this.send({type:0}),setButtonId:e=>this.send({type:3,buttonId:e}),setButton:e=>this.send({type:2,button:e}),setPanelId:e=>this.send({type:5,panelId:e}),setPanel:e=>this.send({type:4,panel:e})}),qg(this,"selectors",{isPortalled:e=>{var t;if(!e.button||!e.panel)return!1;let r=null!=(t=Hp(e.button))?t:document;for(let t of r.querySelectorAll("body > *"))if(Number(null==t?void 0:t.contains(e.button))^Number(null==t?void 0:t.contains(e.panel)))return!0;let n=fh(r),i=n.indexOf(e.button),o=(i+n.length-1)%n.length,s=(i+1)%n.length,a=n[o],l=n[s];return!e.panel.contains(a)&&!e.panel.contains(l)}});{let e=this.state.id,t=gf.get(null);this.on(0,()=>t.actions.push(e)),this.on(1,()=>t.actions.pop(e))}}static new({id:e,__demoMode:t=!1}){return new Vg({id:e,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(e,t){return ah(t.type,Gg,e,t)}}const Zg=(0,o.createContext)(null);function Qg(e){let t=(0,o.useContext)(Zg);if(null===t){let t=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Qg),t}return t}let Kg=(0,o.createContext)(null);function Jg(){return(0,o.useContext)(Kg)}Kg.displayName="PopoverGroupContext";let Yg=(0,o.createContext)(null);Yg.displayName="PopoverPanelContext";let Xg=Th.RenderStrategy|Th.Static;function e_(e,t){let r=(0,o.useId)(),{id:n=`headlessui-popover-backdrop-${r}`,transition:i=!1,...s}=e,a=Qg("Popover.Backdrop"),l=yf(a,(0,o.useCallback)(e=>e.popoverState,[])),[c,u]=(0,o.useState)(null),d=jf(t,u),p=Tg(),[h,f]=Pf(i,c,null!==p?(p&Cg.Open)===Cg.Open:l===Hg.Open),m=Yp(e=>{if(Pg(e.currentTarget))return e.preventDefault();a.actions.close()}),g=bf({open:l===Hg.Open}),_={ref:d,id:n,"aria-hidden":!0,onClick:m,...Rf(f)};return Rh()({ourProps:_,theirProps:s,slot:g,defaultTag:"div",features:Xg,visible:h,name:"Popover.Backdrop"})}let t_=Th.RenderStrategy|Th.Static,r_=Ih(function(e,t){var r;let n=(0,o.useId)(),{__demoMode:i=!1,...s}=e,a=function({id:e,__demoMode:t=!1}){let r=(0,o.useMemo)(()=>Vg.new({id:e,__demoMode:t}),[]);return Og(()=>r.dispose()),r}({id:n,__demoMode:i}),l=(0,o.useRef)(null),c=jf(t,wf(e=>{l.current=e})),[u,d,p,h,f]=yf(a,(0,o.useCallback)(e=>[e.popoverState,e.button,e.panel,e.buttonId,e.panelId],[])),m=function(...e){return(0,o.useMemo)(()=>Wp(...e),[...e])}(null!=(r=l.current)?r:d),g=Jp(h),_=Jp(f),y=(0,o.useMemo)(()=>({buttonId:g,panelId:_,close:a.actions.close}),[g,_,a]),v=Jg(),b=null==v?void 0:v.registerPopover,x=Yp(()=>{var e,t;let r=Gp(null!=(e=l.current)?e:d);return null!=(t=null==v?void 0:v.isFocusWithinPopoverGroup())?t:r&&((null==d?void 0:d.contains(r))||(null==p?void 0:p.contains(r)))});(0,o.useEffect)(()=>null==b?void 0:b(y),[b,y]);let[w,j]=function(){let e=(0,o.useContext)(zg),t=(0,o.useRef)([]),r=Yp(r=>(t.current.push(r),e&&e.register(r),()=>n(r))),n=Yp(r=>{let n=t.current.indexOf(r);-1!==n&&t.current.splice(n,1),e&&e.unregister(r)}),i=(0,o.useMemo)(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,(0,o.useMemo)(()=>function({children:e}){return o.createElement(zg.Provider,{value:i},e)},[i])]}(),S=Wh(d),k=function({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=Yp(()=>{var n,i;let o=Hp(r),s=[];for(let t of e)null!==t&&(rh(t)?s.push(t):"current"in t&&rh(t.current)&&s.push(t.current));if(null!=t&&t.current)for(let e of t.current)s.push(e);for(let e of null!=(n=null==o?void 0:o.querySelectorAll("html > *, body > *"))?n:[])e!==document.body&&e!==document.head&&rh(e)&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(i=null==r?void 0:r.getRootNode())?void 0:i.host))||s.some(t=>e.contains(t))||s.push(e));return s});return{resolveContainers:n,contains:Yp(e=>n().some(t=>t.contains(e)))}}({mainTreeNode:S,portals:w,defaultContainers:[{get current(){return a.state.button}},{get current(){return a.state.panel}}]});!function(e,t,r,n){let i=Jp(r);(0,o.useEffect)(()=>{function r(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)},[e,t,n])}(m,"focus",e=>{var t,r,n,i,o,s;e.target!==window&&ih(e.target)&&a.state.popoverState===Hg.Open&&(x()||a.state.button&&a.state.panel&&(k.contains(e.target)||null!=(r=null==(t=a.state.beforePanelSentinel.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(i=null==(n=a.state.afterPanelSentinel.current)?void 0:n.contains)&&i.call(n,e.target)||null!=(s=null==(o=a.state.afterButtonSentinel.current)?void 0:o.contains)&&s.call(o,e.target)||a.actions.close()))},!0),Sh(u===Hg.Open,k.resolveContainers,(e,t)=>{a.actions.close(),gh(t,mh.Loose)||(e.preventDefault(),null==d||d.focus())});let C=bf({open:u===Hg.Open,close:a.actions.refocusableClose}),T=yf(a,(0,o.useCallback)(e=>ah(e.popoverState,{[Hg.Open]:Cg.Open,[Hg.Closed]:Cg.Closed}),[])),E={ref:c},R=Rh();return o.createElement(Hh,{node:S},o.createElement(xg,null,o.createElement(Yg.Provider,{value:null},o.createElement(Zg.Provider,{value:a},o.createElement(Of,{value:a.actions.refocusableClose},o.createElement(Eg,{value:T},o.createElement(j,null,R({ourProps:E,theirProps:s,slot:C,defaultTag:"div",name:"Popover"}))))))))}),n_=Ih(function(e,t){let r=(0,o.useId)(),{id:n=`headlessui-popover-button-${r}`,disabled:i=!1,autoFocus:s=!1,...a}=e,l=Qg("Popover.Button"),[c,u,d,p,h,f,m]=yf(l,(0,o.useCallback)(e=>[e.popoverState,l.selectors.isPortalled(e),e.button,e.buttonId,e.panel,e.panelId,e.afterButtonSentinel],[])),g=(0,o.useRef)(null),_=`headlessui-focus-sentinel-${(0,o.useId)()}`,y=Jg(),v=null==y?void 0:y.closeOthers,b=null!==(0,o.useContext)(Yg);(0,o.useEffect)(()=>{if(!b)return l.actions.setButtonId(n),()=>l.actions.setButtonId(null)},[b,n,l]);let[x]=(0,o.useState)(()=>Symbol()),w=jf(g,t,(0,o.useContext)(yg).setReference,Yp(e=>{if(!b){if(e)l.state.buttons.current.push(x);else{let e=l.state.buttons.current.indexOf(x);-1!==e&&l.state.buttons.current.splice(e,1)}l.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),e&&l.actions.setButton(e)}})),j=jf(g,t),S=Yp(e=>{var t,r,n;if(b){if(l.state.popoverState===Hg.Closed)return;switch(e.key){case Ng.Space:case Ng.Enter:e.preventDefault(),null==(r=(t=e.target).click)||r.call(t),l.actions.close(),null==(n=l.state.button)||n.focus()}}else switch(e.key){case Ng.Space:case Ng.Enter:e.preventDefault(),e.stopPropagation(),l.state.popoverState===Hg.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close();break;case Ng.Escape:if(l.state.popoverState!==Hg.Open)return null==v?void 0:v(l.state.buttonId);if(!g.current)return;let t=Gp(g.current);if(t&&!g.current.contains(t))return;e.preventDefault(),e.stopPropagation(),l.actions.close()}}),k=Yp(e=>{b||e.key===Ng.Space&&e.preventDefault()}),C=Yp(e=>{var t,r;Pg(e.currentTarget)||i||(b?(l.actions.close(),null==(t=l.state.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),l.state.popoverState===Hg.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close(),null==(r=l.state.button)||r.focus()))}),T=Yp(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:R}=Fp({autoFocus:s}),{isHovered:P,hoverProps:N}=$p({isDisabled:i}),{pressed:O,pressProps:A}=Xp({disabled:i}),I=c===Hg.Open,F=bf({open:I,active:O||I,disabled:i,hover:P,focus:E,autofocus:s}),D=function(e,t){return(0,o.useMemo)(()=>{var r;if(e.type)return e.type;let n=null!=(r=e.as)?r:"button";return"string"==typeof n&&"button"===n.toLowerCase()||"BUTTON"===(null==t?void 0:t.tagName)&&!t.hasAttribute("type")?"button":void 0},[e.type,e.as,t])}(e,d),L=Ah(b?{ref:j,type:D,onKeyDown:S,onClick:C,disabled:i||void 0,autoFocus:s}:{ref:w,id:p,type:D,"aria-expanded":c===Hg.Open,"aria-controls":h?f:void 0,disabled:i||void 0,autoFocus:s,onKeyDown:S,onKeyUp:k,onClick:C,onMouseDown:T},R,N,A),z=Tf(),M=Yp(()=>{if(!nh(l.state.panel))return;let e=l.state.panel;ah(z.current,{[Cf.Forwards]:()=>vh(e,dh.First),[Cf.Backwards]:()=>vh(e,dh.Last)})===ph.Error&&vh(fh(Wp(l.state.button)).filter(e=>"true"!==e.dataset.headlessuiFocusGuard),ah(z.current,{[Cf.Forwards]:dh.Next,[Cf.Backwards]:dh.Previous}),{relativeTo:l.state.button})}),$=Rh();return o.createElement(o.Fragment,null,$({ourProps:L,theirProps:a,slot:F,defaultTag:"button",name:"Popover.Button"}),I&&!b&&u&&o.createElement(Bh,{id:_,ref:m,features:Uh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:M}))}),i_=Ih(e_),o_=Ih(e_),s_=Ih(function(e,t){let r=(0,o.useId)(),{id:n=`headlessui-popover-panel-${r}`,focus:i=!1,anchor:s,portal:a=!1,modal:l=!1,transition:c=!1,...u}=e,d=Qg("Popover.Panel"),p=yf(d,d.selectors.isPortalled),[h,f,m,g,_]=yf(d,(0,o.useCallback)(e=>[e.popoverState,e.button,e.__demoMode,e.beforePanelSentinel,e.afterPanelSentinel],[])),y=`headlessui-focus-sentinel-before-${r}`,v=`headlessui-focus-sentinel-after-${r}`,b=(0,o.useRef)(null),x=function(e){return(0,o.useMemo)(()=>e?"string"==typeof e?{to:e}:e:null,[e])}(s),[w,j]=bg(x),S=function(){let{getFloatingProps:e,slot:t}=(0,o.useContext)(yg);return(0,o.useCallback)((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}();x&&(a=!0);let[k,C]=(0,o.useState)(null),T=jf(b,t,x?w:null,d.actions.setPanel,C),E=kh(f),R=kh(b.current);Kp(()=>(d.actions.setPanelId(n),()=>d.actions.setPanelId(null)),[n,d]);let P=Tg(),[N,O]=Pf(c,k,null!==P?(P&Cg.Open)===Cg.Open:h===Hg.Open);(function(e,t,r){let n=Jp(e=>{let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&r()});(0,o.useEffect)(()=>{if(!e)return;let r=null===t?null:nh(t)?t:t.current;if(!r)return;let i=Zp();if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(()=>n.current(r));e.observe(r),i.add(()=>e.disconnect())}if("undefined"!=typeof IntersectionObserver){let e=new IntersectionObserver(()=>n.current(r));e.observe(r),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,n,e])})(N,f,d.actions.close),function(e,t,r=()=>[document.body]){let n=function(e){let t=(0,o.useId)(),r=gf.get("scroll-lock"),[n,i]=yf(r,(0,o.useCallback)(e=>[r.selectors.isTop(e,t),r.selectors.inStack(e,t)],[r,t]));return Kp(()=>{if(e)return r.actions.push(t),()=>r.actions.pop(t)},[r,e,t]),!!e&&(!i||n)}(e);Kh(n,t,e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],r]}})}(!m&&l&&N,R);let A=Yp(e=>{var t;if(e.key===Ng.Escape){if(d.state.popoverState!==Hg.Open||!b.current)return;let r=Gp(b.current);if(r&&!b.current.contains(r))return;e.preventDefault(),e.stopPropagation(),d.actions.close(),null==(t=d.state.button)||t.focus()}});(0,o.useEffect)(()=>{var t;e.static||h===Hg.Closed&&(null==(t=e.unmount)||t)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),(0,o.useEffect)(()=>{if(m||!i||h!==Hg.Open||!b.current)return;let e=Gp(b.current);b.current.contains(e)||vh(b.current,dh.First)},[m,i,b.current,h]);let I=bf({open:h===Hg.Open,close:d.actions.refocusableClose}),F=Ah(x?S():{},{ref:T,id:n,onKeyDown:A,onBlur:i&&h===Hg.Open?e=>{var t,r,n,i,o;let s=e.relatedTarget;s&&b.current&&(null!=(t=b.current)&&t.contains(s)||(d.actions.close(),(null!=(n=null==(r=g.current)?void 0:r.contains)&&n.call(r,s)||null!=(o=null==(i=_.current)?void 0:i.contains)&&o.call(i,s))&&s.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...j,"--button-width":th(N,f,!0).width},...Rf(O)}),D=Tf(),L=Yp(()=>{let e=b.current;e&&ah(D.current,{[Cf.Forwards]:()=>{var t;vh(e,dh.First)===ph.Error&&(null==(t=d.state.afterPanelSentinel.current)||t.focus())},[Cf.Backwards]:()=>{var e;null==(e=d.state.button)||e.focus({preventScroll:!0})}})}),z=Yp(()=>{let e=b.current;e&&ah(D.current,{[Cf.Forwards]:()=>{var e;if(!d.state.button)return;let t=fh(null!=(e=Wp(d.state.button))?e:document.body),r=t.indexOf(d.state.button),n=t.slice(0,r+1),i=[...t.slice(r+1),...n];for(let e of i.slice())if("true"===e.dataset.headlessuiFocusGuard||null!=k&&k.contains(e)){let t=i.indexOf(e);-1!==t&&i.splice(t,1)}vh(i,dh.First,{sorted:!1})},[Cf.Backwards]:()=>{var t;vh(e,dh.Previous)===ph.Error&&(null==(t=d.state.button)||t.focus())}})}),M=Rh();return o.createElement(Rg,null,o.createElement(Yg.Provider,{value:n},o.createElement(Of,{value:d.actions.refocusableClose},o.createElement(Ug,{enabled:!!a&&(e.static||N),ownerDocument:E},N&&p&&o.createElement(Bh,{id:y,ref:g,features:Uh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L}),M({ourProps:F,theirProps:u,slot:I,defaultTag:"div",features:t_,visible:N,name:"Popover.Panel"}),N&&p&&o.createElement(Bh,{id:v,ref:_,features:Uh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:z})))))}),a_=Ih(function(e,t){let r=(0,o.useRef)(null),n=jf(r,t),[i,s]=(0,o.useState)([]),a=Yp(e=>{s(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),l=Yp(e=>(s(t=>[...t,e]),()=>a(e))),c=Yp(()=>{var e;let t=Wp(r.current);if(!t)return!1;let n=Gp(r.current);return!(null==(e=r.current)||!e.contains(n))||i.some(e=>{var r,i;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(i=t.getElementById(e.panelId.current))?void 0:i.contains(n))})}),u=Yp(e=>{for(let t of i)t.buttonId.current!==e&&t.close()}),d=(0,o.useMemo)(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:c,closeOthers:u}),[l,a,c,u]),p=bf({}),h=e,f={ref:n},m=Rh();return o.createElement(Hh,null,o.createElement(Kg.Provider,{value:d},m({ourProps:f,theirProps:h,slot:p,defaultTag:"div",name:"Popover.Group"})))}),l_=Object.assign(r_,{Button:n_,Backdrop:o_,Overlay:i_,Panel:s_,Group:a_}),c_=(0,o.createContext)(void 0),u_=Ih(function(e,t){var r;let n=(0,o.useContext)(c_),{disabled:i=n||!1,autoFocus:s=!1,...a}=e,{isFocusVisible:l,focusProps:c}=Fp({autoFocus:s}),{isHovered:u,hoverProps:d}=$p({isDisabled:i}),{pressed:p,pressProps:h}=Xp({disabled:i}),f=Ah({ref:t,type:null!=(r=a.type)?r:"button",disabled:i||void 0,autoFocus:s},c,d,h),m=bf({disabled:i,hover:u,focus:l,active:p,autofocus:s});return Rh()({ourProps:f,theirProps:a,slot:m,defaultTag:"button",name:"Button"})}),d_=Ih(function(e,t){let r=(0,o.useContext)(Nf);return o.createElement(u_,{ref:t,...Ah({onClick:r},e)})});function p_(e){const{options:t,disabled:r=!1,title:n,selected:i}=e;return(0,l.jsxs)(l_,{className:h("wpl-dropdownbutton",t.length<=1?"wpl-dropdownbutton__single":null),children:[(0,l.jsx)("button",{onClick:function(r){r.preventDefault();const n=i||t[0]?.value;n&&e.onSelect(n)},type:"button",className:h("wpl-dropdownbutton__main",r&&"wpl-dropdownbutton__disabled"),children:(0,l.jsx)("h5",{children:n})}),t.length>1&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n_,{disabled:r,className:h("wpl-dropdownbutton","wpl-popover__toggle",r&&"wpl-dropdownbutton__disabled"),children:(0,l.jsx)(Bu,{})}),(0,l.jsx)(s_,{anchor:"bottom start",className:"wpl-dropdownbutton__popover wpl-popover wpl-popover__content",children:({close:r})=>(0,l.jsx)("ul",{children:t.map(({label:t,value:n,description:o})=>(0,l.jsxs)("li",{className:h({"wpl-dropdownbutton__item":!0,["wpl-dropdownbutton__"+n]:!0,"wpl-dropdownbutton__selected":i===n}),children:[i===n?(0,l.jsx)("span",{className:"wpl-dropdownbutton__selected-icon",children:"✓"}):(0,l.jsx)("span",{className:"wpl-dropdownbutton__selected-icon"}),(0,l.jsxs)(d_,{as:"button",className:"button",onClick:t=>function(t,r,n){t.preventDefault(),t.stopPropagation(),n(),e.onSelect(r)}(t,n,r),children:[t,o&&(0,l.jsx)("span",{children:o})]})]},n))})})]})]})}const h_=({headerValue:e,options:t,onChange:r})=>(0,l.jsx)(wn,{items:t,name:"headerValue",value:e,onChange:e=>r({[e.target.name]:e.target.value})}),f_=e=>"<"+e+">",m_=(e,t)=>e.includes(f_(t));function g_(e,t){return"uri"===t?e.replace(/[^A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]/g,""):"integer"===t?parseInt(e,10):e}const y_=({headerValue:e,headerSettings:t,options:r,onChange:n})=>{const{choices:i,replace:o,replaceType:s}=r,a=t.selected?t.selected:e,c=t.replaceValue?t.replaceValue:"";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(wn,{items:i,name:"headerValue",value:a,onChange:e=>{n({headerValue:e.target.value,headerSettings:{selected:e.target.value,replaceValue:""}})}}),m_(a,o)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:`header-replace-${o}`,children:f_(o).replace(/</g,"").replace(/>/g,"")}),(0,l.jsx)("input",{id:`header-replace-${o}`,type:"text",className:"regular-text",name:"replaceValue",value:c,onChange:e=>{n({headerValue:a.replace(f_(o),e.target.value),headerSettings:{selected:a,replaceValue:g_(e.target.value,s)}})}})]})]})},v_=({headerValue:e,onChange:t})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("label",{htmlFor:"header-plain-value",children:[(0,i.__)("Value","redirection"),":"]})," ",(0,l.jsx)("input",{id:"header-plain-value",type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>t({[e.target.name]:e.target.value})})]}),b_=({headerValue:e,options:t,onChange:r})=>{const{choices:n,implode:o,wildCard:s}=t,a=e.split(o);return(0,l.jsx)(qu,{options:s?n.concat([{value:s,label:(0,i.__)("All","redirection")}]):n,selected:a,onChange:e=>{if(!Array.isArray(e))return;const t=a,n=e.find(e=>!t.includes(e))||t.find(t=>!e.includes(t));if(s&&n===s){const e=1===t.length&&t[0]===s;return void r({headerValue:e?"":s})}r({headerValue:e.filter(e=>e!==s).filter(e=>e).join(o)})},title:(0,i.__)("Values","redirection"),hideTitle:!0,multiple:!0,badges:!0})},x_=e=>e.map(e=>({label:e,value:e})),w_={"X-UA-Compatible":{component:h_,info:"https://frankcode.net/2013/10/17/a-guide-to-ie-compatibility-view-and-x-ua-compatible/",default:"Chrome=1",options:x_(["IE=EmulateIE7","IE=edge","Chrome=1"])},"X-Frame-Options":{component:y_,info:"",default:"deny",options:{choices:x_(["deny","sameorigin","allow-from <URI>"]),replace:"URI",replaceType:"uri"}},"Strict-Transport-Security":{component:y_,default:"max-age=<expire-time>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",options:{choices:x_(["max-age=<expire-time>","max-age=<expire-time>; includeSubDomains","max-age=<expire-time>; preload","max-age=<expire-time>; includeSubDomains; preload"]),replace:"expire-time",replaceType:"integer"}},"X-XSS-Protection":{component:y_,default:"1; mode=block",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",options:{choices:x_(["0","1","1; mode=block","1; report=<URI>"]),replace:"URI",replaceType:"uri"}},"X-Content-Type-Options":{component:h_,default:"nosniff",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",options:x_(["nosniff"])},"Feature-Policy":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy"},"Permissions-Policy":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",default:"camera=(), display-capture=(), geolocation=(), microphone=()"},"Clear-Site-Data":{component:b_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",default:"cache",options:{choices:x_(["cache","cookies","storage","executionContexts"]),implode:",",wildCard:"*"}},"Referrer-Policy":{component:h_,default:"no-referrer-when-downgrade",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",options:x_(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"])},"Content-Security-Policy-Report-Only":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only"},Custom:{component:({headerValue:e,headerName:t,onChange:r})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"text",className:"regular-text",name:"headerName",value:t,onChange:e=>r({[e.target.name]:e.target.value})}),"Value:"," ",(0,l.jsx)("input",{type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>r({[e.target.name]:e.target.value})})]})},"Access-Control-Allow-Methods":{component:b_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",default:"GET",options:{choices:x_(["GET","POST","PUT","HEAD","DELETE","OPTIONS"]),implode:",",wildCard:"*"}},"Access-Control-Allow-Credentials":{component:h_,default:"true",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",options:x_(["true"])},"Access-Control-Allow-Origin":{component:y_,default:"<origin>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",options:{choices:x_(["<origin>","*"]),replace:"origin",replaceType:"uri"}},"X-Robots-Tag":{component:b_,default:"noindex",info:"https://developers.google.com/search/reference/robots_meta_tag#xrobotstag",options:{choices:x_(["noindex","nofollow","none","noarchive","nosnippet","notranslate","noimageindex"]),implode:",",wildCard:"all"}},"Access-Control-Allow-Headers":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers"},"Access-Control-Max-Age":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age"},"Access-Control-Expose-Headers":{component:v_,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"}},j_=e=>{const t=w_[e];return t&&t.options?t.options:null},S_=e=>{const t=w_[e];return t&&t.default?t.default:""},k_=({header:e,onChange:t,onDelete:r})=>{const{location:n,headerName:o,headerValue:s,headerSettings:a,type:c}=e,u=r=>{t({...e,...r})},d=t=>{const{name:r,value:n}=t.target;let i=o;"type"===r&&"Custom"===n?i="":"type"===r&&(i=n),u({headerValue:"type"===r?S_(n):e.headerValue,headerSettings:"type"===r?j_(i):e.headerSettings,headerName:i,[r]:n})},p=((e,t,r,n,i)=>{const o=w_[s=e]?w_[s].component:v_;var s;return(0,l.jsx)(o,{headerName:t,headerValue:""===r?S_(e):r,headerSettings:n,options:j_(e),onChange:i})})(c,o,s,a,u),h=(e=>{const t=w_[e];return t&&t.info?t.info:null})(o);return(0,l.jsxs)("tr",{className:"redirect-headers__item",children:[(0,l.jsx)("td",{className:"redirect-headers__type",children:(0,l.jsx)(wn,{items:[{label:(0,i.__)("Site","redirection"),value:"site"},{label:(0,i.__)("Redirect","redirection"),value:"redirect"}],name:"location",value:n,onChange:d})}),(0,l.jsxs)("td",{className:"redirect-headers__name",children:[(0,l.jsxs)("div",{className:"redirect-headers__name__content",children:[(0,l.jsx)(wn,{items:[{label:(0,i.__)("General","redirection"),value:x_(["X-UA-Compatible","X-Robots-Tag"])},{label:"CORS",value:x_(["Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Max-Age","Access-Control-Allow-Credentials","Access-Control-Allow-Origin","Access-Control-Expose-Headers"])},{label:"Security",value:x_(["X-Frame-Options","X-XSS-Protection","X-Content-Type-Options","Strict-Transport-Security","Feature-Policy","Permissions-Policy","Clear-Site-Data","Referrer-Policy","Content-Security-Policy","Content-Security-Policy-Report-Only","P3P"])},{label:(0,i.__)("Custom Header","redirection"),value:"Custom"}],name:"type",value:c,onChange:d}),p]}),h&&(0,l.jsx)(N,{url:h,children:(0,l.jsx)("span",{className:"dashicons dashicons-editor-help"})})]}),(0,l.jsx)("td",{className:"redirect-headers__delete",children:(0,l.jsx)("button",{onClick:t=>{t.preventDefault(),r(e.id)},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},C_=(e="X-Robots-Tag",t="nofollow",r={})=>({location:"site",type:e,headerName:e,headerValue:t,headerSettings:r}),T_=({headers:e,onChange:t})=>{const[r,n]=(0,o.useState)("header"),s=[{label:(0,i.__)("Add Header","redirection"),value:"header"},{label:(0,i.__)("Add Security Presets","redirection"),value:"security"},{label:(0,i.__)("Add CORS Presets","redirection"),value:"cors"}],a=s.find(e=>e.value===r);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("HTTP Headers","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Site headers are added across your site, including redirects. Redirect headers are only added to redirects.","redirection")}),(0,l.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-headers table-auto inline-edit-row",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Location","redirection")}),(0,l.jsx)("th",{children:(0,i.__)("Header","redirection")}),(0,l.jsx)("th",{})]})}),(0,l.jsxs)("tbody",{children:[e.map((r,n)=>(0,l.jsx)(k_,{header:r,onChange:r=>((e,t,r,n)=>{const i=r.slice();i[e]=t,n({headers:i})})(n,r,e,t),onDelete:()=>((e,t,r)=>{r({headers:[...t.slice(0,e),...t.slice(e+1)]})})(n,e,t)},n)),0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:3,children:(0,i.__)("No headers","redirection")})})]})]}),(0,l.jsx)(p_,{options:s,selected:r,title:a?a.label:s[0]?.label||"",onSelect:r=>{n(r),((e,t,r)=>{"header"===e?r({headers:t.concat([C_()])}):"security"===e?r({headers:t.concat([C_("X-Frame-Options","deny"),C_("X-XSS-Protection","1; mode=block"),C_("X-Content-Type-Options","nosniff"),C_("Content-Security-Policy","default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self';base-uri 'self';form-action 'self'"),"https"===document.location.protocol?C_("Strict-Transport-Security","max-age: 31536000; includeSubDomains"):null,C_("Referrer-Policy","no-referrer-when-downgrade")].filter(e=>e))}):"cors"===e&&r({headers:t.concat([C_("Access-Control-Allow-Origin","*"),C_("Access-Control-Allow-Credentials","true"),C_("Access-Control-Allow-Methods","POST,GET,OPTIONS"),C_("Access-Control-Allow-Headers","origin"),C_("Referrer-Policy","no-referrer-when-downgrade"),C_("P3P",'CP="CAO PSA OUR"')])})})(r,e,t)}}),(0,l.jsx)("p",{children:(0,i.__)("Note that some HTTP headers are set by your server and cannot be changed.","redirection")})]})},E_=function({link:e,onChange:t,onDelete:r}){return(0,l.jsxs)("tr",{className:"redirect-alias__item",children:[(0,l.jsx)("td",{children:(0,l.jsx)("input",{className:"regular-text",type:"text",name:"link",value:e,onChange:t})}),(0,l.jsx)("td",{className:"redirect-alias__delete",children:(0,l.jsx)("button",{onClick:e=>{e.preventDefault(),r()},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},R_=function(e){const{permalinks:t,onChange:r}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Permalink Migration","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Enter old permalinks structures to automatically migrate them to your current one.","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Note: this is in beta and will only migrate posts. Certain permalinks will not work. If yours does not work then you will need to wait until it is out of beta.","redirection")}),(0,l.jsxs)("table",{className:"wp-list-table widefat fixed striped items redirect-aliases table-auto inline-edit-row",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Permalinks","redirection")}),(0,l.jsx)("th",{className:"redirect-alias__delete"})]})}),(0,l.jsxs)("tbody",{children:[t.map((e,n)=>(0,l.jsx)(E_,{link:e,onChange:e=>((e,t,r,n)=>{const i=t.slice();i[e]=n.target.value,r({permalinks:i})})(n,t,r,e),onDelete:()=>((e,t,r)=>{r({permalinks:[...t.slice(0,e),...t.slice(e+1)]})})(n,t,r)},n)),0===t.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:2,children:(0,i.__)("No migrated permalinks","redirection")})})]})]}),(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-secondary",onClick:e=>((e,t,r)=>{r.preventDefault(),t({permalinks:e.concat("").slice(0,10)})})(t,r,e),children:(0,i.__)("Add Permalink","redirection")})})]})};function P_(){const e=qd(Redirectioni10n.pluginRoot),t=de(e=>e.loadStatus),r=de(e=>e.values),n=de(e=>e.saveStatus);Pa();const{mutate:s}=Na(),[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(""),[p,h]=(0,o.useState)([]),[f,m]=(0,o.useState)(""),[g,_]=(0,o.useState)([]),[y,v]=(0,o.useState)([]);(0,o.useEffect)(()=>{r&&(c(r.https||!1),d(r.preferred_domain||""),h(r.headers||[]),m(r.relocate||""),_(r.aliases||[]),v(r.permalinks||[]))},[r]);const b=e=>{void 0!==e.https&&c(e.https),void 0!==e.preferred_domain&&d(e.preferred_domain),void 0!==e.headers&&h(e.headers),void 0!==e.relocate&&m(e.relocate),void 0!==e.aliases&&_(e.aliases),void 0!==e.permalinks&&v(e.permalinks)};return"loading"!==t&&r?(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s({https:a,headers:p,preferred_domain:u,aliases:g.filter(e=>e).map(qd),relocate:Bd(f),permalinks:y})},children:[(0,l.jsx)("div",{className:"inline-notice inline-warning",children:(0,l.jsx)("p",{children:L((0,i.__)("Options on this page can cause problems if used incorrectly. You can {{link}}temporarily disable them{{/link}} to make changes.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/disable-redirection/"})})})}),(0,l.jsx)(Gd,{relocate:f,siteDomain:e,onChange:b}),0===f.length&&(0,l.jsx)(Wd,{aliases:g,siteDomain:e,onChange:b}),0===f.length&&(0,l.jsx)(Zd,{https:a,siteDomain:e,preferredDomain:u,onChange:b}),0===f.length&&(0,l.jsx)(R_,{permalinks:y,onChange:b}),(0,l.jsx)(T_,{headers:p,onChange:b}),(0,l.jsx)("input",{className:"button-primary",type:"submit",name:"update",value:(0,i.__)("Update","redirection"),disabled:n})]}):(0,l.jsx)(Ml,{})}const N_=e=>"url"===e?[{name:"url",title:(0,i.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,i.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,i.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,i.__)("Date","redirection")},{name:"method",title:(0,i.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,i.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,i.__)("Source URL","redirection"),primary:!0},{name:"target",title:(0,i.__)("Target URL","redirection"),sortable:!1},{name:"redirect_by",title:(0,i.__)("Redirect By","redirection"),sortable:!1},{name:"code",title:(0,i.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,i.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,i.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,i.__)("IP","redirection"),sortable:!1}],O_=e=>e?[{value:"group",label:(0,i.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,i.__)("Standard Display","redirection"),grouping:["date","url","target","agent","ip"]},{value:"minimal",label:(0,i.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,i.__)("Display All","redirection"),grouping:A_(e).map(e=>e.value)}],A_=e=>"url"===e?[{value:"url",label:(0,i.__)("URL","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,i.__)("User Agent","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,i.__)("IP","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:[{value:"date",label:(0,i.__)("Date","redirection")},{value:"method",label:(0,i.__)("Method","redirection")},{value:"domain",label:(0,i.__)("Domain","redirection")},{value:"url",label:(0,i.__)("URL","redirection")},{value:"redirect_by",label:(0,i.__)("Redirect By","redirection")},{value:"code",label:(0,i.__)("HTTP code","redirection")},{value:"referrer",label:(0,i.__)("Referrer","redirection")},{value:"agent",label:(0,i.__)("User Agent","redirection")},{value:"target",label:(0,i.__)("Target","redirection")},{value:"ip",label:(0,i.__)("IP","redirection")}],I_=e=>{const t=[{value:"",label:(0,i.__)("No grouping","redirection")},{value:"url",label:(0,i.__)("Group by URL","redirection")},{value:"agent",label:(0,i.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,i.__)("Group by IP","redirection")}),t},F_=window.Redirectioni10n?.per_page?parseInt(window.Redirectioni10n.per_page,10):25,D_={page:0,per_page:F_,orderby:"id",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["last_count","last_access","source","target","code","title"],groupBy:""},L_={page:0,per_page:F_,orderby:"name",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["name","module","redirects"],groupBy:""},z_={page:0,per_page:F_,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","target","agent","ip"],groupBy:""},M_={page:0,per_page:F_,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","agent","ip"],groupBy:""},$_={redirects:D_,groups:L_,logs:z_,errors:M_,redirectsAddTop:!1},U_=X()(se(((e,t)=>(r,n,i)=>{let o={storage:le(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,a=0;const l=new Set,c=new Set;let u=o.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...e)},n,i);const d=()=>{const e=o.partialize({...n()});return u.setItem(o.name,{state:e,version:o.version})},p=i.setState;i.setState=(e,t)=>(p(e,t),d());const h=e((...e)=>(r(...e),d()),n,i);let f;i.getInitialState=()=>h;const m=()=>{var e,t;if(!u)return;const i=++a;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:h)});const p=(null==(t=o.onRehydrateStorage)?void 0:t.call(o,null!=(e=n())?e:h))||void 0;return ce(u.getItem.bind(u))(o.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===o.version)return[!1,e.state];if(o.migrate){const t=o.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(i!==a)return;const[s,l]=e;return f=o.merge(l,null!=(t=n())?t:h),r(f,!0),s?d():void 0}).then(()=>{i===a&&(null==p||p(n(),void 0),f=n(),s=!0,c.forEach(e=>e(f)))}).catch(e=>{i===a&&(null==p||p(void 0,e))})};return i.persist={setOptions:e=>{o={...o,...e},e.storage&&(u=e.storage)},clearStorage:()=>{null==u||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},o.skipHydration||m(),f||h})(e=>({...$_,setRedirectsTable:t=>e(e=>({redirects:{...e.redirects,...t}})),clearRedirectsSelected:()=>e(e=>({redirects:{...e.redirects,selected:[]}})),setRedirectsSelected:t=>e(e=>({redirects:{...e.redirects,selected:t,selectAll:!1}})),setRedirectsAddTop:t=>e({redirectsAddTop:t}),resetRedirectsTable:()=>e({redirects:D_,redirectsAddTop:!1}),setGroupsTable:t=>e(e=>({groups:{...e.groups,...t}})),clearGroupsSelected:()=>e(e=>({groups:{...e.groups,selected:[]}})),setGroupsSelected:t=>e(e=>({groups:{...e.groups,selected:t,selectAll:!1}})),resetGroupsTable:()=>e({groups:L_}),setLogsTable:t=>e(e=>({logs:{...e.logs,...t}})),clearLogsSelected:()=>e(e=>({logs:{...e.logs,selected:[]}})),setLogsSelected:t=>e(e=>({logs:{...e.logs,selected:t,selectAll:!1}})),resetLogsTable:()=>e({logs:z_}),setErrorsTable:t=>e(e=>({errors:{...e.errors,...t}})),clearErrorsSelected:()=>e(e=>({errors:{...e.errors,selected:[]}})),setErrorsSelected:t=>e(e=>({errors:{...e.errors,selected:t,selectAll:!1}})),resetErrorsTable:()=>e({errors:M_}),reset:()=>e($_)}),{name:"redirection-display",partialize:e=>({redirects:{displayType:e.redirects.displayType,displaySelected:e.redirects.displaySelected},groups:{displayType:e.groups.displayType,displaySelected:e.groups.displaySelected},logs:{displayType:e.logs.displayType,displaySelected:e.logs.displaySelected},errors:{displayType:e.errors.displayType,displaySelected:e.errors.displaySelected}}),merge:(e,t)=>{const r=e??{};return{...t,redirects:{...t.redirects,...r.redirects},groups:{...t.groups,...r.groups},logs:{...t.logs,...r.logs},errors:{...t.errors,...r.errors}}}}),{name:"TableStore"}));function B_(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...Dr(t)})}(Zs,e)}const q_=sa({id:la([Qs().int(),Ts()]),created:Ts().optional(),created_time:Ts().optional(),url:Ts().optional(),sent_to:Ts().optional().nullable(),agent:Ts().optional().nullable(),referrer:Ts().optional().nullable(),ip:Ts().optional().nullable(),domain:Ts().optional().nullable(),redirect_id:Qs().int().optional(),redirection_id:Qs().int().optional(),request_method:Ts().optional().nullable(),http_code:Qs().int().optional(),request_data:ta().optional().nullable(),redirect_by:Ts().optional().nullable(),count:B_().int().optional()}),H_=sa({id:la([Qs().int(),Ts()]),created:Ts().optional(),created_time:Ts().optional(),url:Ts().optional(),agent:Ts().optional().nullable(),referrer:Ts().optional().nullable(),domain:Ts().optional().nullable(),ip:Ts().optional().nullable(),http_code:Qs().int().optional(),request_method:Ts().optional().nullable(),request_data:ta().optional().nullable(),count:B_().int().optional()}),W_=td(q_),G_=td(H_);function V_(e){const t=u(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setErrorsTable:s}=U_();return mt({mutationFn:async({action:e,items:t,params:i={}})=>{r();try{return await St(ar(e,{items:t},i))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n();const o="delete"===r.action?"deleted":r.action;i(`404 errors ${o}`),s(sd(r.params)),t.invalidateQueries({queryKey:Xr.errors.all})},onError:e=>{o(e.message||"Failed to perform 404 error action")},...e})}function Z_(e){const{table:t,setTable:r,allowedOrder:n=[],allowedGroup:i=[],allowedFilters:s=[],defaultOrder:a="",pageName:l}=e,c=(0,o.useRef)(!1),u=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(c.current)return;const e=function(e){const t=new URLSearchParams(e?e.slice(1):document.location.search.slice(1)),r={};return t.forEach((e,t)=>{r[t]=e}),r}();if(e.sub!==l&&"redirect"!==l)return void(c.current=!0);const o={};e.orderby&&n.includes(e.orderby)&&(o.orderby=e.orderby),"asc"!==e.direction&&"desc"!==e.direction||(o.direction=e.direction),e.offset&&parseInt(e.offset,10)>0&&(o.page=parseInt(e.offset,10)),e.groupby&&i.includes(e.groupby)&&(o.groupBy=e.groupby);const a={};for(const[t,r]of Object.entries(e)){const e=t.match(/^filterby\[(\w+)\]$/);if(e&&e[1]){const t=e[1];(0===s.length||s.includes(t))&&(a[t]=String(r))}}if(e.filterby&&"object"==typeof e.filterby)for(const t of Object.keys(e.filterby))(0===s.length||s.includes(t))&&(a[t]=e.filterby[t]);Object.keys(a).length>0&&(o.filterBy=a),Object.keys(o).length>0&&r(o),c.current=!0,u.current={...t,...o}},[t,r,n,i,s,l]),(0,o.useEffect)(()=>{if(!c.current)return;const e=u.current;if(e&&e.groupBy===t.groupBy&&e.orderby===t.orderby&&e.direction===t.direction&&e.page===t.page&&JSON.stringify(e.filterBy)===JSON.stringify(t.filterBy))return;u.current=t;const r=new URLSearchParams(document.location.search),n=function(e,t){const r={...e};return"desc"===r.direction&&delete r.direction,r.orderby===t&&delete r.orderby,0===r.page&&delete r.page,r.per_page===parseInt(Redirectioni10n.per_page,10)&&delete r.per_page,"object"==typeof r.filterBy&&0===Object.keys(r.filterBy||{}).length&&(delete r.filterBy,delete r.filter),""===r.groupBy&&(delete r.groupBy,delete r.group),25!==parseInt(Redirectioni10n.per_page,10)&&(r.per_page=parseInt(Redirectioni10n.per_page,10)),delete r.selected,delete r.displaySelected,delete r.displayType,delete r.selectAll,r}(t,a);"redirect"!==l&&r.set("sub",l),n.orderby?r.set("orderby",n.orderby):r.delete("orderby"),n.direction?r.set("direction",n.direction):r.delete("direction"),n.page&&n.page>0?r.set("offset",String(n.page)):r.delete("offset"),n.groupBy?r.set("groupby",n.groupBy):r.delete("groupby");const i=[];if(r.forEach((e,t)=>{t.startsWith("filterby[")&&i.push(t)}),i.forEach(e=>r.delete(e)),t.filterBy&&"object"==typeof t.filterBy)for(const[e,n]of Object.entries(t.filterBy))n&&r.set(`filterby[${e}]`,String(n));const o="?"+r.toString();history.replaceState({},"",o)},[t,a,l])}const Q_="loading",K_="complete",J_=e=>{const{name:t,title:r,table:n,primary:i,onSetOrderBy:o}=e,{direction:s,orderBy:a}=n,c=h({"manage-column":!0,sortable:!0,asc:a===t&&"asc"===s,desc:a===t&&"desc"===s||a!==t,"column-primary":i,["column-"+t]:!0}),u=a===t,d=h("sorting-indicator",{asc:u&&"asc"===s,desc:u&&"desc"===s});return(0,l.jsx)("th",{scope:"col",className:c,children:(0,l.jsxs)("button",{type:"button",className:"button-link",onClick:e=>{e.preventDefault(),o(t,a===t&&"desc"===s?"asc":"desc")},children:[(0,l.jsx)("span",{children:r}),(0,l.jsx)("span",{className:d})]})})},Y_=e=>{const{name:t,title:r,primary:n}=e,i=h({"manage-column":!0,"column-primary":n,["column-"+t]:!0});return(0,l.jsx)("th",{scope:"col",className:i,children:(0,l.jsx)("span",{children:r})})},X_=e=>{const{onSelect:t,disabled:r,selected:n}=e;return(0,l.jsxs)("th",{scope:"col",className:"manage-column column-cb check-column-red",children:[(0,l.jsx)("label",{className:"screen-reader-text",htmlFor:"redirection-select-all",children:(0,i.__)("Select All","redirection")}),(0,l.jsx)("input",{id:"redirection-select-all",type:"checkbox",disabled:r,checked:n,onChange:e=>t(e.target.checked)})]})},ey=e=>{const{disabled:t,onSelect:r,onSetOrderBy:n,headers:i,table:o,hasBulk:s,allSelected:a,isSaving:c}=e;return(0,l.jsxs)("tr",{children:[s&&(0,l.jsx)(X_,{onSelect:r,disabled:t||c,selected:a}),i.map(e=>{const{primary:t=!1,sortable:r=!0}=e;return r?(0,l.jsx)(J_,{table:o,name:e.name,title:e.title,onSetOrderBy:n,primary:t},e.name):(0,l.jsx)(Y_,{name:e.name,title:e.title,primary:t},e.name)})]})},ty=e=>{const{columns:t}=e;return(0,l.jsxs)("tr",{className:"is-placeholder",children:[t.map((e,t)=>(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})},t)),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})})]})},ry=e=>{const{headers:t,rows:r}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ty,{columns:t}),r.slice(0,-1).map((e,r)=>(0,l.jsx)(ty,{columns:t},r))]})},ny=e=>{const{headers:t}=e;return(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:t.length+1,children:(0,i.__)("Nothing to display.","redirection")})})},iy=e=>{const{headers:t}=e;return(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:t.length+1,children:(0,l.jsx)("p",{children:(0,i.__)("Sorry, something went wrong loading the data - please try again","redirection")})})})},oy=(0,o.memo)(function(e){const{isSaving:t,disabled:r,id:n,rowIndex:i,onSelect:s,onShiftSelect:a,isSelected:c}=e,u=(0,o.useCallback)(e=>{e.shiftKey&&a&&(e.preventDefault(),a(i))},[a,i]),d=(0,o.useCallback)(e=>{const t=e.target.value,r=/^\d+$/.test(t)?parseInt(t,10):t;s([r],i)},[s,i]);return(0,l.jsx)("th",{scope:"row",className:"check-column",children:t?(0,l.jsx)(gn,{size:"small"}):(0,l.jsx)("input",{type:"checkbox",name:"item[]",value:n,disabled:r,checked:c,onChange:d,onClick:u})})});function sy(e){const{row:t,rowData:r,displaySelected:n,getRow:i,getRowActions:s,primary:a,total:c}=e,[u,d]=(0,o.useState)(!1),p={...r,rowMode:u,setRowMode:d},f=i(t,p),m=s(t,p);return Array.isArray(f)?(0,l.jsx)(l.Fragment,{children:f.filter(e=>n.includes(e.name)||!0===e.alwaysDisplay).map(e=>(0,l.jsxs)("td",{className:h(`column-${e.name}`,{"column-primary":e.name===a?.name}),children:[e.content,e.name===(a?a.name:f[0]?.name)&&m]},e.name))}):(0,l.jsx)("td",{colSpan:c,children:f})}const ay=(0,o.memo)(function(e){const{row:t,rowIndex:r,status:n,isSelected:i,isSaving:o,isAllSaving:s,displaySelected:a,table:c,getRow:u,getRowActions:d,onSelect:p,onShiftSelect:f,primary:m,headersLength:g}=e,_=function(e,t,r){return{isLoading:e===Q_,isSelected:!!Array.isArray(r.selected)&&r.selected.some(e=>e===t.id),table:r}}(n,t,c);return(0,l.jsxs)("tr",{className:h({disabled:n===Q_||"saving"===n,saving:o||s}),children:[!!p&&(0,l.jsx)(oy,{id:t.id,rowIndex:r,onSelect:p,...f?{onShiftSelect:f}:{},disabled:n===Q_,isSelected:i,isSaving:o||s}),(0,l.jsx)(sy,{row:t,rowData:_,displaySelected:a,getRow:u,getRowActions:d,primary:m,total:g})]})},(e,t)=>e.row===t.row&&e.status===t.status&&e.isSelected===t.isSelected&&e.isSaving===t.isSaving&&e.isAllSaving===t.isAllSaving&&e.displaySelected===t.displaySelected&&e.primary===t.primary&&e.headersLength===t.headersLength),ly=function(e){const{rows:t,headers:r,status:n,table:i,getRow:s,getRowActions:a,onSelect:c,saving:u}=e,{selected:d=[],displaySelected:p}=i,h=r.find(e=>e.primary),f=u.some(e=>-1===e),m=(0,o.useRef)(null),g=(0,o.useCallback)((e,t)=>{void 0!==t&&(m.current=t),c&&c(e)},[c]),_=(0,o.useCallback)(e=>{if(!c)return;if(null===m.current){m.current=e;const r=t[e];return void(r&&c([r.id]))}const r=t.length-1,n=Math.min(m.current,r),i=Math.min(e,r),o=Math.min(n,i),s=Math.max(n,i),a=new Set(d),l=[];for(let e=o;e<=s;e++){const r=t[e];r&&!a.has(r.id)&&l.push(r.id)}l.length>0&&c(l),m.current=e},[c,t,d]);return n===Q_&&0===t.length?(0,l.jsx)(ry,{headers:r,rows:t}):n===K_&&0===t.length?(0,l.jsx)(ny,{headers:r}):"error"===n?(0,l.jsx)(iy,{headers:r}):(0,l.jsx)(l.Fragment,{children:t.map((e,t)=>(0,l.jsx)(ay,{row:e,rowIndex:t,status:n,isSelected:d.some(t=>t===e.id),isSaving:u.some(t=>t===e.id),isAllSaving:f,displaySelected:p,table:i,getRow:s,getRowActions:a,...c?{onSelect:g,onShiftSelect:_}:{},primary:h,headersLength:r.length},e.id))})},cy=e=>{const{headers:t,getRow:r,getRowActions:n,rows:i,table:o,status:s,saving:a,onSelect:c,onSetOrderBy:u}=e,d=(0,l.jsx)(ey,{table:o,disabled:s!==K_||0===i.length,headers:t,onSetOrderBy:u,onSelect:e=>{c&&c(e?i.map(e=>e.id):[])},hasBulk:!!c,allSelected:o.selected.length===i.length&&0!==i.length,isSaving:a.length>0}),p=h("wp-list-table","widefat","fixed","striped","items",{["redirect-log__display__"+o.displayType]:!0,["redirect-log__group__"+o.groupBy]:o.groupBy});return(0,l.jsx)("div",{className:"redirect-table-wrapper",children:(0,l.jsxs)("table",{className:p,children:[(0,l.jsx)("thead",{children:d}),(0,l.jsx)("tbody",{children:(0,l.jsx)(ly,{rows:i,table:o,headers:t,status:s,getRow:r,getRowActions:n,...c?{onSelect:c}:{},saving:a})}),(0,l.jsx)("tfoot",{children:d})]})})},uy=function(e){const{title:t,button:r,className:n,disabled:i,onClick:o}=e;return i?(0,l.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:(0,l.jsx)("span",{children:r})}):(0,l.jsxs)("button",{className:n+" button",type:"button",onClick:function(e){e.preventDefault(),o()},children:[(0,l.jsx)("span",{className:"screen-reader-text",children:t}),(0,l.jsx)("span",{"aria-hidden":"true",children:r})]})},dy=function(e){const{page:t,total:r,perPage:n,onChangePage:s}=e,a=r<=n,[c,u]=(0,o.useState)(String(t+1));if((0,o.useEffect)(()=>{u(String(t+1))},[t]),a)return null;const d=function(e,t){return Math.ceil(e/t)}(r,n);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(uy,{title:(0,i.__)("First page","redirection"),button:"«",className:"first-page",disabled:t<=0,onClick:()=>s(0)}),(0,l.jsx)(uy,{title:(0,i.__)("Prev page","redirection"),button:"‹",className:"prev-page",disabled:t<=0,onClick:()=>s(t-1)}),(0,l.jsxs)("span",{className:"paging-input",children:[(0,l.jsx)("label",{htmlFor:"current-page-selector",className:"screen-reader-text",children:(0,i.__)("Current Page","redirection")}),(0,l.jsx)("input",{className:"current-page",type:"number",min:"1",max:d,name:"paged",value:c,size:2,"aria-describedby":"table-paging",onBlur:()=>{if(!/^\d+$/.test(c))return void u(String(t+1));const e=Number(c),r=Math.min(d,Math.max(1,e));u(String(r)),s(r-1)},onChange:e=>u(e.target.value)}),(0,l.jsx)("span",{className:"tablenav-paging-text",children:(0,i.sprintf)(
// translators: %s is the total number of pages
// translators: %s is the total number of pages
(0,i.__)("of %s","redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(d))})]}),(0,l.jsx)(uy,{title:(0,i.__)("Next page","redirection"),button:"›",className:"next-page",disabled:t>=d-1,onClick:()=>s(t+1)}),(0,l.jsx)(uy,{title:(0,i.__)("Last page","redirection"),button:"»",className:"last-page",disabled:t>=d-1,onClick:()=>s(d-1)})]})},py=function(e){const{total:t,perPage:r,page:n,rowCount:o,onChangePage:s,selected:a,onSelectAll:c,isEverything:u}=e,d=h({"tablenav-pages":!0});return(0,l.jsxs)("div",{className:d,children:[(0,l.jsxs)("span",{className:h("displaying-num",u?"displaying-num-all":null),children:[(0===a||!u&&(a<o||t<=r))&&(0,i.sprintf)(
// translators: %s is the number of items
// translators: %s is the number of items
(0,i._n)("%s item","%s items",t,"redirection"),new Intl.NumberFormat(window.Redirectioni10n.locale).format(t)),a>0&&a>=o&&t>r&&!u&&L((0,i.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,i.__)("%1$d of %2$d selected. {{all}}Select All.{{/all}}","redirection"),a,t),{all:(0,l.jsx)("button",{type:"button",onClick:function(){c(!0)}})}),u&&L((0,i.sprintf)(
// translators: 1: number of selected items, 2: total number of items
// translators: 1: number of selected items, 2: total number of items
(0,i.__)("%1$d of %2$d selected. {{all}}Clear All.{{/all}}","redirection"),a,t),{all:(0,l.jsx)("button",{type:"button",onClick:function(){c(!1)}})})]}),(0,l.jsx)("span",{className:"pagination-links",children:(0,l.jsx)(dy,{onChangePage:s,total:t,perPage:r,page:n},n)})]})},hy=function(e){const{total:t,rowCount:r,table:n,children:i=null,onChangePage:o,disabled:s,className:a,onSelectAll:c}=e;return(0,l.jsxs)("div",{className:h("tablenav",a),children:[(0,l.jsx)("div",{className:"redirect-table__actions",children:i}),t>0&&(0,l.jsx)(py,{perPage:n.perPage,page:n.page,total:t,rowCount:r,onChangePage:o,onSelectAll:c,disabled:s,selected:n.selectAll?t:n.selected.length,isEverything:n.selectAll})]})},fy=({children:e})=>(0,l.jsx)("div",{className:"alignleft actions",children:e}),my=function({selected:e,options:t,isEnabled:r,onGroup:n}){const[s,a]=(0,o.useState)(e);return(0,l.jsxs)("div",{className:"alignleft actions",children:[(0,l.jsx)(wn,{items:t,value:s,name:"filter",onChange:e=>{a(e.target.value)},disabled:!r}),(0,l.jsx)("button",{className:"button",onClick:()=>{n(s)},disabled:!r,children:(0,i.__)("Apply","redirection")})]})};function gy(e,t){return e.options.find(e=>e.value===t)}function _y(e,t){const r=[];return Object.keys(e).forEach(n=>{const i=t.find(e=>e.value===n);if(i){const t=e[n];t&&i.options.find(e=>e.value===t)&&r.push(t)}}),r}const yy=function(e){const{table:t,disabled:r,groupOptions:n,filterOptions:o,onGroup:s,onFilter:a}=e;return(0,l.jsxs)(l.Fragment,{children:[n.length>0&&(0,l.jsx)(my,{selected:t.groupBy?t.groupBy:"",options:n,isEnabled:!r,onGroup:s},t.groupBy),o.length>0&&(0,l.jsx)(fy,{children:(0,l.jsx)(qu,{options:o,selected:_y(t.filterBy,o),onChange:function(e){const t={};if(Array.isArray(e)){for(let r=0;r<e.length;r++){const n=e[r];if(n){const e=o.find(e=>gy(e,n));e&&(t[e.value]=n)}}a(t)}},title:(0,i.__)("Filters","redirection"),disabled:r,multiple:!0,badges:!0})})]})},vy=function(e){const{bulk:t,disabled:r,onBulk:n}=e,[s,a]=(0,o.useState)("-1");return(0,l.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,l.jsxs)("select",{name:"action",value:s,disabled:r,onChange:e=>a(e.target.value),children:[(0,l.jsx)("option",{value:"-1",children:(0,i.__)("Bulk Actions","redirection")}),t.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,l.jsx)("button",{type:"button",className:"button action",disabled:r||-1===parseInt(s,10),onClick:function(){-1!==parseInt(s,10)&&(n(s),a("-1"))},children:(0,i.__)("Apply","redirection")})]})};function by(e,t){if("custom"===e)return(0,i.__)("Custom Display","redirection");for(let r=0;r<t.length;r++){const n=t[r]?.options.find(t=>t.value===e);if(n)return n.label}return t[0]?.label||""}const xy=function(e){const{disabled:t,predefinedGroups:r,customOptions:n,table:o,setDisplay:s,validation:a}=e,{displayType:c,displaySelected:u}=o,d=[{label:(0,i.__)("Pre-defined","redirection"),value:"pre",options:r},{label:(0,i.__)("Custom","redirection"),value:"custom",options:n}];return(0,l.jsx)(qu,{className:"redirect-table-display__filter",options:d,selected:u.concat([c]),onChange:function(e){if(!Array.isArray(e))return;const t=u.concat([c]),r=e.filter(e=>!t.includes(e));if(r.length>0){const e=d[0]?.options?.find(e=>e.value===r[0]);if(e)return void s(e.value,e.grouping)}const i=e.filter(e=>{if(e===c)return!1;const t=d[0]?.options.find(t=>t.value===e);return!t&&n.find(t=>t.value===e)});s("custom",a?a(i):i)},title:by(c,d),disabled:t})};function wy(e,t){if(e){const r=e.find(e=>t[e.name]);return r&&t[r.name]||""}return""}const jy=function({table:e,onSearch:t,searchTypes:r,selected:n,disabled:i=!1,name:s=""}){const a=r?.find(e=>n[e.name]),c=wy(r,n),u=a?a.name:r?.[0]?.name||"",[d,p]=(0,o.useState)(c),[h,f]=(0,o.useState)(u),[m,g]=(0,o.useState)(c);(0,o.useEffect)(()=>{const e=wy(r,n);if(e!==m){const t=r?.find(e=>n[e.name]),i=t?t.name:r?.[0]?.name||"";g(e),p(e),f(i)}},[r,n,m]);const _=i||""===d&&""===e.filter,y=r?r.map(e=>({value:e.name,label:e.title})):[],v=r?.find(e=>e.name===h),b=v?v.title:"";return(0,l.jsxs)("form",{onSubmit:e=>{e?.preventDefault(),t(d,h)},className:"redirect-searchbox",children:[(0,l.jsx)("input",{type:"search",name:"s",value:d,onChange:e=>{p(e.target.value)}}),r&&(0,l.jsx)(p_,{options:y,disabled:i,title:b,onSelect:e=>{f(e),t(d,e)},selected:h}),!r&&(0,l.jsx)("input",{type:"submit",className:"button",value:s,disabled:_})]})},Sy=function(e){const{disabled:t,filterOptions:r,searchOptions:n,predefinedGroups:i,table:o,onSetDisplay:s,onFilter:a,validateDisplay:c}=e;return(0,l.jsxs)("div",{className:"redirect-table-display tablenav",children:[(0,l.jsx)(xy,{disabled:t,customOptions:r,predefinedGroups:i,table:o,setDisplay:s,...c?{validation:c}:{}}),(0,l.jsx)(jy,{disabled:t,table:o,onSearch:function(e,t){const r={...o.filterBy};n.map(e=>delete r[e.name]),e&&(r[t]=e),a(r)},selected:o.filterBy,searchTypes:n})]})},ky=function(e){const{logOptions:t,logActions:r,table:n,total:i,rows:o,getRow:s,getRowActions:a,renderTableActions:c,status:u,saving:d}=e,{displayFilters:p,displayGroups:h,searchOptions:f,groupBy:m,rowFilters:g,bulk:_,headers:y,validateDisplay:v}=t,{onChangePage:b,onFilter:x,onSetDisplay:w,onBulk:j,onGroup:S,onSetOrder:k,onSetAll:C,onSelect:T}=r,E=u===Q_;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Sy,{filterOptions:p,predefinedGroups:h,searchOptions:f,disabled:E,table:n,onFilter:x,onSetDisplay:w,...v?{validateDisplay:v}:{}}),(0,l.jsxs)(hy,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"top",onSelectAll:C,children:[(0,l.jsx)(vy,{bulk:_,disabled:E||0===n.selected.length,onBulk:j}),(0,l.jsx)(yy,{disabled:E,table:n,groupOptions:m,filterOptions:g,onGroup:S,onFilter:x})]}),(0,l.jsx)(cy,{headers:y,rows:o,getRow:s,getRowActions:a,table:n,status:u,onSelect:e=>{0===e.length?T(!1):1===e.length&&void 0!==e[0]?T(e[0]):T(e)},onSetOrderBy:k,saving:d}),(0,l.jsxs)(hy,{total:i,rowCount:o.length,table:n,disabled:E,onChangePage:b,className:"bottom",onSelectAll:C,children:[(0,l.jsx)(vy,{bulk:_,disabled:E||0===n.selected.length,onBulk:j}),c&&c()]})]})};function Cy(e){return Redirectioni10n?.caps?.capabilities.includes(e)}function Ty(e){return Redirectioni10n?.caps?.pages.includes(e)}const Ey="redirection_cap_redirect_manage",Ry="redirection_cap_redirect_add",Py="redirection_cap_group_add",Ny="redirection_cap_404_delete";function Oy(e){const{actions:t,disabled:r=!1}=e;return(0,l.jsx)("div",{className:"row-actions",children:r?(0,l.jsx)("span",{children:" "}):t.length>0&&t.filter(e=>e).reduce((e,t)=>[...e," | ",t],[]).slice(1)})}function Ay(e){const{onClick:t,children:r,href:n="",capability:i=""}=e;return i&&!Cy(i)?null:(0,l.jsx)("a",{href:n||"#",onClick:function(e){t&&(e.preventDefault(),t())},children:r})}const Iy=()=>(0,l.jsx)("div",{className:"redirection-poweredby",children:L((0,i.__)("Powered by {{link}}redirect.li{{/link}}","redirection"),{link:(0,l.jsx)(N,{url:"https://redirect.li"})})});function Fy(e){return!!(e&&e.name&&e.version)&&e.name+" "+e.version}function Dy({error:e}){return(0,l.jsxs)("div",{className:"wpl-modal_error",children:[(0,l.jsx)("h2",{children:(0,i.__)("Useragent Error","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Something went wrong obtaining this information","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:e})})]})}function Ly({agent:e}){return(0,l.jsxs)("div",{className:"redirection-useragent_unknown",children:[(0,l.jsx)("h2",{children:(0,i.__)("Unknown Useragent","redirection")}),(0,l.jsx)("br",{}),(0,l.jsx)("p",{children:e})]})}function zy({agent:e,detail:t}){const r=function(e,t){if(!e)return null;const r=e.slice(0,1).toUpperCase()+e.slice(1);return t?(0,l.jsx)(N,{url:t,children:r}):r}(t.device.type,t.url),n=function(e){const t=[];return e.vendor&&t.push(e.vendor),e.name&&t.push(e.name),t.join(" ")}(t.device),o=Fy(t.os),s=Fy(t.browser),a=Fy(t.engine),c=[];return n&&c.push([(0,i.__)("Device","redirection"),n]),o&&c.push([(0,i.__)("Operating System","redirection"),o]),s&&c.push([(0,i.__)("Browser","redirection"),s]),a&&c.push([(0,i.__)("Engine","redirection"),a]),(0,l.jsxs)("div",{children:[(0,l.jsxs)("h2",{children:[(0,i.__)("Useragent","redirection"),": ",r]}),(0,l.jsx)("table",{children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Agent","redirection")}),(0,l.jsx)("td",{className:"redirection-useragent_agent",children:e})]}),c.map((e,t)=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:e[0]}),(0,l.jsx)("td",{children:e[1]})]},t))]})}),(0,l.jsx)(Iy,{})]})}function My({agent:e}){const{data:t,isLoading:r,isError:n,error:i}=function(e,t){return pt({queryKey:Xr.info.agent(e),queryFn:async()=>await St(cr(e)),enabled:!!e,staleTime:864e5,...t})}(e,{enabled:!!e}),o=h({"redirection-useragent":!0,"wpl-modal_loading":r}),s=t,a=n&&i&&i.message||"";return(0,l.jsxs)("div",{className:o,children:[r&&(0,l.jsx)(gn,{}),n&&a&&(0,l.jsx)(Dy,{error:a}),!r&&!n&&!s&&(0,l.jsx)(Ly,{agent:e}),!r&&!n&&s&&(0,l.jsx)(zy,{agent:e,detail:s})]})}const $y=function(e){const{agent:t}=e,[r,n]=(0,o.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ay,{href:"https://redirect.li/agent/?agent="+encodeURIComponent(t),onClick:()=>n(!0),children:(0,i.__)("Agent Info","redirection")}),r&&(0,l.jsx)(wd,{onClose:()=>n(!1),children:(0,l.jsx)(My,{agent:t})})]})},Uy=({headers:e})=>e&&0!==Object.keys(e).length?(0,l.jsxs)(o.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Request Headers","redirection")}),(0,l.jsx)("table",{children:(0,l.jsx)("tbody",{children:Object.keys(e).map(t=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:t}),(0,l.jsx)("td",{children:e[t]})]},t))})})]}):null,By=({source:e})=>e&&0!==e.length?(0,l.jsxs)(o.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Redirect Source","redirection")}),(0,l.jsx)("ul",{children:e.map((e,t)=>(0,l.jsx)("li",{children:e},t))})]}):null,qy=({data:e})=>{const{headers:t,source:r}=e;return(0,l.jsxs)("div",{className:"redirect-requestdata",children:[t&&(0,l.jsx)(Uy,{headers:t}),r&&(0,l.jsx)(By,{source:r})]})},Hy=function(e){const{data:t}=e,[r,n]=(0,o.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ay,{onClick:()=>n(!0),children:(0,i.__)("View Data","redirection")}),r&&(0,l.jsx)(wd,{onClose:()=>n(!1),children:(0,l.jsx)(qy,{data:t})})]})},Wy=function(e){const{row:t,onDelete:r,disabled:n,groupBy:o}=e,{agent:s,id:a,request_data:c,redirection_id:u}=t,{setLogsTable:d}=U_(),p=[];return p.push((0,l.jsx)(Ay,{onClick:()=>r(a),capability:"redirection_cap_log_delete",children:(0,i.__)("Delete","redirection")},"0")),s&&p.unshift((0,l.jsx)($y,{agent:s},"3")),c&&p.push((0,l.jsx)(Hy,{data:c},"4")),u&&u>0&&p.push((0,l.jsx)(Ay,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+u,children:(0,i.__)("View Redirect","redirection")},"5")),o&&p.push((0,l.jsx)(Ay,{onClick:()=>d({filterBy:ad(o,String(a)),page:0,groupBy:"",selected:[],selectAll:!1}),capability:Ey,children:(0,i.__)("Show All","redirection")},"6")),(0,l.jsx)(Oy,{disabled:n,actions:p})},Gy=e=>{const{enabled:t=!0,children:r}=e;return t?(0,l.jsx)("div",{className:"table-buttons",children:r}):null};var Vy=r(465),Zy=r.n(Vy);function Qy(e){return e.url?pd(hd(e.domain),e.url):""}function Ky(e,t){if(!e.sent_to)return"";const r=t.target||"",n=/^https?:\/\//i.test(e.sent_to)?e.sent_to:pd(hd(e.domain),e.sent_to);return(0,l.jsx)(N,{url:n,children:(0,l.jsx)(Zy(),{searchWords:[r],textToHighlight:e.sent_to,autoEscape:!0})})}function Jy(e){return e.map(e=>function(e){return"redirect"===e?(0,i.__)("Redirects","redirection"):"log"===e?(0,i.__)("Redirect logs","redirection"):"404"===e?(0,i.__)("404 logs","redirection"):"group"===e?(0,i.__)("Groups","redirection"):(0,i.__)("Settings","redirection")}(e)).join(", ")}function Yy(e){return"1"===e?(0,i.__)("WordPress redirects","redirection"):"2"===e?(0,i.__)("Apache redirects","redirection"):"3"===e?(0,i.__)("Nginx redirects","redirection"):(0,i.__)("Everything","redirection")}function Xy(e){return"json"===e?(0,i.__)("JSON","redirection"):"csv"===e?(0,i.__)("CSV","redirection"):"apache"===e?(0,i.__)("Apache .htaccess","redirection"):(0,i.__)("Nginx rewrite rules","redirection")}function ev(e){return"json"===e?(0,i.__)("JSON (complete data)","redirection"):Xy(e)}function tv(e,t){return"redirect"===e?"apache"===t?"redirects.htaccess":"nginx"===t?"redirects.nginx":`redirects.${t}`:"log"===e?`redirect-logs.${t}`:"404"===e?`404-logs.${t}`:"group"===e?`groups.${t}`:`settings.${t}`}function rv(e){return e.includes("url")?e:e.concat(["url"])}const nv=function(){const e=U_(e=>e.logs),{setLogsTable:t,setLogsSelected:r}=U_(),n=de(e=>e.values),o=n?.token||"";Z_({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","target","domain","method","redirect_by"],pageName:"log"});const s=function(){const e=u(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn(),{setLogsTable:o}=U_();return mt({mutationFn:async({action:e,items:n,params:i={}})=>{t();try{return await St(sr(e,{items:n},i))}catch(e){throw r(),Yr(e)}},onSuccess:(t,i)=>{r();const s="delete"===i.action?"deleted":i.action;n(`Logs ${s}`),o(sd(i.params)),e.invalidateQueries({queryKey:Xr.logs.all})},onError:e=>{i(e.message||"Failed to perform log action")}})}(),a=an(),{data:c,isLoading:d,isSuccess:p}=function(e={},t){const r=cd(e);return pt({queryKey:Xr.logs.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await St(zt(r));return W_.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch logs"),t}},...t})}(e),h=c?.items??[],f=c?.total??0;let m="idle";d&&!c?m=Q_:(p||c)&&(m=K_);const g=t=>{if(!window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection")))return;const r=e.groupBy?{groupBy:e.groupBy}:{};s.mutate({action:"delete",items:[t],params:r})},_=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},y={...e,...(v=e.groupBy,v?{displayOptions:A_(v),displaySelected:O_(v)[0]?.grouping||[]}:{})};var v;const b={page:e.page,perPage:e.per_page,orderBy:e.orderby||"date",direction:e.direction,selected:e.selected??[],selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:y.displaySelected??[],groupBy:e.groupBy??""},x={displayFilters:A_(y.groupBy),displayGroups:O_(y.groupBy),searchOptions:[{name:"url",title:(0,i.__)("Search URL","redirection")},{name:"url-exact",title:(0,i.__)("Search exact URL","redirection")},{name:"referrer",title:(0,i.__)("Search referrer","redirection")},{name:"agent",title:(0,i.__)("Search user agent","redirection")},{name:"ip",title:(0,i.__)("Search IP","redirection")},{name:"target",title:(0,i.__)("Search target URL","redirection")},{name:"domain",title:(0,i.__)("Search domain","redirection")}],groupBy:I_(n?.ip_logging||0),bulk:[{id:"delete",name:(0,i.__)("Delete","redirection")},{id:"export-csv",name:(0,i.__)("Export as CSV","redirection")},{id:"export-json",name:(0,i.__)("Export as JSON","redirection")}],rowFilters:y.groupBy?[]:[{label:(0,i.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,i.__)("Redirect By","redirection"),value:"redirect_by",options:[{label:(0,i.__)("WordPress","redirection"),value:"wordpress"},{label:(0,i.__)("Redirection","redirection"),value:"redirection"}]}],headers:N_(y.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,y)),validateDisplay:rv},w={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r={...cd({...e.groupBy?{groupBy:e.groupBy}:{},...e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected}}),displaySelected:y.displaySelected??[]};return void a.mutate({exportType:"log",format:"export-csv"===t?"csv":"json",download:!0,filename:tv("log","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,i.__)("Are you sure you want to delete all items?","redirection"):(0,i.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.groupBy?{groupBy:e.groupBy}:{};e.selectAll?s.mutate({action:t,items:[],params:cd({...r,global:!0,filterBy:e.filterBy})}):s.mutate({action:t,items:e.selected,params:r})},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:"date"===e?"":e,direction:r})},onFilter:_,onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSelect:n=>{if("boolean"==typeof n)r(n?h.map(e=>e.id):[]);else if("number"==typeof n||"string"==typeof n){const r=Array.isArray(e.selected)?e.selected:[],i=r.some(e=>e===n)?r.filter(e=>e!==n):[...r,n];t({selected:i,selectAll:!1})}else r(n)},onSetAll:e=>{t({selected:e?h.map(e=>e.id):[],selectAll:e})}};return(0,l.jsx)(ky,{logOptions:x,logActions:w,table:b,status:m,total:f,rows:h,saving:[],getRow:(e,t)=>function(e,t){const{created:r,created_time:n,url:o,agent:s,referrer:a,ip:c,request_method:u,http_code:d,domain:p,redirect_by:h,count:f}=e,m=t?.table?.filterBy||{},g=m.url||m["url-exact"]||"";return[{name:"date",content:r?(0,l.jsxs)(l.Fragment,{children:[r,n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),n]})]}):""},{name:"method",content:u?u.toUpperCase():""},{name:"domain",content:p||""},{name:"url",content:o?(0,l.jsx)(N,{url:Qy(e),children:(0,l.jsx)(Zy(),{searchWords:[g],textToHighlight:o,autoEscape:!0})}):""},{name:"target",content:Ky(e,m)},{name:"redirect_by",content:h||""},{name:"code",content:d??""},{name:"referrer",content:a?(0,l.jsx)(Zy(),{searchWords:[m.referrer||""],textToHighlight:a,autoEscape:!0}):""},{name:"agent",content:s?(0,l.jsx)(Zy(),{searchWords:[m.agent||""],textToHighlight:s,autoEscape:!0}):""},{name:"ip",content:c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(c),children:(0,l.jsx)(Zy(),{searchWords:[m.ip||""],textToHighlight:c,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,l.jsx)(Oy,{actions:[(0,l.jsx)(Ay,{onClick:()=>{t.onFilter?.({ip:c})},children:(0,i.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:f?new Intl.NumberFormat(window.Redirectioni10n.locale).format(f):""}]}(e,{...t,onFilter:_}),getRowActions:t=>(0,l.jsx)(Wy,{disabled:!1,row:t,onDelete:g,groupBy:e.groupBy}),renderTableActions:()=>(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(Gy,{enabled:h.length>0,children:o&&(0,l.jsx)("div",{className:"table-button-item",children:(0,l.jsx)("a",{href:dd(o),className:"button-secondary",children:(0,i.__)("RSS","redirection")})})})})})},iv="nothing",ov="login",sv="referrer",av="agent",lv="cookie",cv="header",uv="custom",dv="role",pv="server",hv="language";function fv(e){return"url"===e||"random"===e}function mv(e,t){if(e===ov)return{logged_in:t?.logged_in||"",logged_out:t?.logged_out||""};if(e===sv)return{referrer:t?.referrer||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===av)return{agent:t?.agent||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===lv)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===cv)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===uv)return{filter:t?.filter||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===dv)return{role:t?.role||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===pv)return{server:t?.server||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if("ip"===e){let e=[];return Array.isArray(t?.ip)?e=t.ip:t?.ip&&(e=[String(t.ip)]),{ip:e,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}}return e===hv?{language:t?.language||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}:t||{}}function gv(e,t,r){return{url:e,title:"",match_data:{source:{flag_regex:r.flag_regex||!1,flag_trailing:r.flag_trailing||!1,flag_case:r.flag_case||!1,flag_query:r.flag_query||"exact"},options:{}},match_type:"url",action_type:"url",action_code:301,action_data:{},group_id:t,position:0}}const _v=()=>[{value:"url",label:(0,i.__)("URL only","redirection")},{value:"login",label:(0,i.__)("URL and login status","redirection")},{value:"role",label:(0,i.__)("URL and role/capability","redirection")},{value:sv,label:(0,i.__)("URL and referrer","redirection")},{value:"agent",label:(0,i.__)("URL and user agent","redirection")},{value:"cookie",label:(0,i.__)("URL and cookie","redirection")},{value:"ip",label:(0,i.__)("URL and IP","redirection")},{value:"server",label:(0,i.__)("URL and server","redirection")},{value:"header",label:(0,i.__)("URL and HTTP header","redirection")},{value:"custom",label:(0,i.__)("URL and custom filter","redirection")},{value:"page",label:(0,i.__)("URL and WordPress page type","redirection")},{value:hv,label:(0,i.__)("URL and language","redirection")}],yv=()=>[{value:"url",label:(0,i.__)("Redirect to URL","redirection")},{value:"random",label:(0,i.__)("Redirect to random post","redirection")},{value:"pass",label:(0,i.__)("Pass-through","redirection")},{value:"error",label:(0,i.__)("Error (404)","redirection")},{value:iv,label:(0,i.__)("Do nothing (ignore)","redirection")}],vv=()=>[{value:"301",label:(0,i.__)("301 - Moved Permanently","redirection")},{value:"302",label:(0,i.__)("302 - Found","redirection")},{value:"303",label:(0,i.__)("303 - See Other","redirection")},{value:"304",label:(0,i.__)("304 - Not Modified","redirection")},{value:"307",label:(0,i.__)("307 - Temporary Redirect","redirection")},{value:"308",label:(0,i.__)("308 - Permanent Redirect","redirection")}],bv=()=>[{value:"400",label:(0,i.__)("400 - Bad Request","redirection")},{value:"401",label:(0,i.__)("401 - Unauthorized","redirection")},{value:"403",label:(0,i.__)("403 - Forbidden","redirection")},{value:"404",label:(0,i.__)("404 - Not Found","redirection")},{value:"410",label:(0,i.__)("410 - Gone","redirection")},{value:"418",label:(0,i.__)("418 - I'm a teapot","redirection")},{value:"451",label:(0,i.__)("451 - Unavailable For Legal Reasons","redirection")},{value:"500",label:(0,i.__)("500 - Internal Server Error","redirection")},{value:"501",label:(0,i.__)("501 - Not implemented","redirection")},{value:"502",label:(0,i.__)("502 - Bad Gateway","redirection")},{value:"503",label:(0,i.__)("503 - Service Unavailable","redirection")},{value:"504",label:(0,i.__)("504 - Gateway Timeout","redirection")}],xv=()=>vv().concat(bv()),wv=()=>[{value:"flag_regex",label:(0,i.__)("Regex","redirection")},{value:"flag_trailing",label:(0,i.__)("Ignore Slash","redirection")},{value:"flag_case",label:(0,i.__)("Ignore Case","redirection")}],jv=()=>[{value:"exactorder",label:(0,i.__)("Exact match","redirection")},{value:"exact",label:(0,i.__)("Exact match in any order","redirection")},{value:"ignore",label:(0,i.__)("Ignore all parameters","redirection")},{value:"pass",label:(0,i.__)("Ignore & pass parameters to the target","redirection")}],Sv=e=>"url"===e?[{name:"url",title:(0,i.__)("Source URL","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:"agent"===e?[{name:"agent",title:(0,i.__)("User Agent","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:"ip"===e?[{name:"ip",title:(0,i.__)("IP","redirection"),primary:!0,sortable:!1},{name:"count",title:(0,i.__)("Count","redirection"),sortable:!0}]:[{name:"date",title:(0,i.__)("Date","redirection")},{name:"method",title:(0,i.__)("Method","redirection"),sortable:!1},{name:"domain",title:(0,i.__)("Domain","redirection"),sortable:!1},{name:"url",title:(0,i.__)("Source URL","redirection"),primary:!0},{name:"code",title:(0,i.__)("HTTP code","redirection"),sortable:!1},{name:"referrer",title:(0,i.__)("Referrer","redirection"),sortable:!1},{name:"agent",title:(0,i.__)("User Agent","redirection"),sortable:!1},{name:"ip",title:(0,i.__)("IP","redirection")}],kv=e=>{const t=[{id:"delete",name:(0,i.__)("Delete","redirection")},{id:"export-csv",name:(0,i.__)("Export as CSV","redirection")},{id:"export-json",name:(0,i.__)("Export as JSON","redirection")}];return"ip"===e?t.concat([{id:"redirect-ip",name:(0,i.__)("Redirect All","redirection")},{id:"block",name:(0,i.__)("Block IP","redirection")}]):"agent"===e?t:t.concat([{id:"redirect-url",name:(0,i.__)("Redirect All","redirection"),isEverything:!1},{id:"ignore",name:(0,i.__)("Ignore URL","redirection"),isEverything:!1}])},Cv=e=>{const t=[{value:"",label:(0,i.__)("No grouping","redirection")},{value:"url",label:(0,i.__)("Group by URL","redirection")},{value:"agent",label:(0,i.__)("Group by user agent","redirection")}];return e>0&&t.push({value:"ip",label:(0,i.__)("Group by IP","redirection")}),t};function Tv(e){return e?[{value:"group",label:(0,i.__)("Group","redirection"),grouping:[e,"count"]}]:[{value:"standard",label:(0,i.__)("Standard Display","redirection"),grouping:["date","url","agent","ip"]},{value:"minimal",label:(0,i.__)("Compact Display","redirection"),grouping:["date","url"]},{value:"all",label:(0,i.__)("Display All","redirection"),grouping:Ev(e).map(e=>e.value)}]}function Ev(e){return"url"===e?[{value:"url",label:(0,i.__)("URL","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:"agent"===e?[{value:"agent",label:(0,i.__)("User Agent","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:"ip"===e?[{value:"ip",label:(0,i.__)("IP","redirection")},{value:"count",label:(0,i.__)("Count","redirection")}]:[{value:"date",label:(0,i.__)("Date","redirection")},{value:"method",label:(0,i.__)("Method","redirection")},{value:"domain",label:(0,i.__)("Domain","redirection")},{value:"url",label:(0,i.__)("URL","redirection")},{value:"code",label:(0,i.__)("HTTP code","redirection")},{value:"referrer",label:(0,i.__)("Referrer","redirection")},{value:"agent",label:(0,i.__)("User Agent","redirection")},{value:"ip",label:(0,i.__)("IP","redirection")}]}const Rv="^/.*$";function Pv(e){return{url:Rv,match_type:"ip",action_data:{ip:e},match_data:{source:{flag_regex:!0}}}}function Nv(e,t){return"redirect-ip"===e||"ip"===e?{...Pv(t),action_type:"url"}:"block"===e?{...Pv(t),action_type:"error",action_code:403}:"agent"===e?{url:Rv,match_type:"agent",action_data:{agent:t},match_data:{source:{flag_regex:!0}}}:{url:t,match_type:"url",action_type:"ignore"===e?iv:"url"}}const Ov=({title:e=null,children:t,className:r=""})=>(0,l.jsxs)("tr",{className:r,children:[(0,l.jsx)("th",{children:e}),(0,l.jsx)("td",{children:t})]}),Av=({flag_case:e,flag_regex:t,flag_trailing:r})=>[e?"flag_case":null,t?"flag_regex":null,r?"flag_trailing":null].filter(e=>null!==e),Iv=({url:e,flags:t,onFlagChange:r,onChange:n,autoFocus:o=!1})=>{const s=wv();return Array.isArray(e)?(0,l.jsx)(Ov,{title:(0,i.__)("Source URL","redirection"),className:"top",children:(0,l.jsx)("textarea",{value:e.join("\n"),readOnly:!0})}):(0,l.jsxs)(Ov,{title:(0,i.__)("Source URL","redirection"),className:"redirect-edit__source",children:[(0,l.jsx)("input",{type:"text",name:"url",value:e,onChange:n,autoFocus:o,className:"regular-text",placeholder:(0,i.__)("The relative URL you want to redirect from","redirection")}),(0,l.jsx)(qu,{options:s,selected:Av(t),onChange:function(e){const t=Array.isArray(e)?e:[e];r({flag_case:t.includes("flag_case"),flag_trailing:t.includes("flag_trailing"),flag_regex:t.includes("flag_regex")})},title:(0,i.__)("URL options / Regex","redirection"),badges:!0,multiple:!0,hideTitle:!0})]})},Fv=({query:e,regex:t,onChange:r,url:n})=>{if(t)return null;const o=!1===(Array.isArray(n)?n.join(""):n).includes("?")?jv().filter(e=>"exactorder"!==e.value):jv();return(0,l.jsx)(Ov,{title:(0,i.__)("Query Parameters","redirection"),className:"redirect-edit__sourcequery",children:(0,l.jsx)(wn,{name:"flag_query",items:o,value:e,onChange:r})})},Dv=({groups:e,currentGroup:t,onChange:r})=>(0,l.jsx)(wn,{name:"group",value:String(t),items:fd(e),onChange:r}),Lv=({position:e,onChange:t})=>(0,l.jsxs)("span",{className:"redirect-edit-position",children:[(0,l.jsx)("strong",{children:(0,i.__)("Position","redirection")})," ",(0,l.jsx)("input",{type:"number",value:e,name:"position",min:"0",size:3,onChange:t})]}),zv=function({title:e,onChange:t}){return(0,l.jsx)(Ov,{title:(0,i.__)("Title","redirection"),className:"redirect-edit__title",children:(0,l.jsx)("input",{type:"text",name:"title",value:e,onChange:e=>t({title:e.target.value}),placeholder:(0,i.__)("Describe the purpose of this redirect (optional)","redirection")})})},Mv=({actionType:e,actionCode:t,onChange:r})=>{const n=function(e){return"error"===e?bv():"url"===e||"random"===e?vv():null}(e);return n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("strong",{className:"small-flex",children:(0,i.__)("with HTTP code","redirection")}),(0,l.jsx)(wn,{name:"action_code",value:String(t),items:n,onChange:r})]}):null},$v=({actionType:e,matchType:t,onChange:r})=>(0,l.jsx)(wn,{name:"action_type",value:e,items:yv().filter(e=>!("login"===t&&!fv(e.value))),onChange:r}),Uv=({matchType:e,onChange:t})=>(0,l.jsx)(Ov,{title:(0,i.__)("Match","redirection"),children:(0,l.jsx)(wn,{name:"match_type",value:e,items:_v(),onChange:t})}),Bv=function({onChange:e,data:t}){const[r,n]=(0,o.useState)(""),{agent:s,regex:a}=t;return(0,l.jsxs)(Ov,{title:(0,i.__)("User Agent","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",name:"agent",value:s,onChange:e,className:"regular-text",placeholder:(0,i.__)("Match against this browser user agent","redirection")}),(0,l.jsxs)("select",{name:"agent_dropdown",onChange:t=>{""!==t.target.value&&e({target:{name:"agent",value:{mobile:"iPad|iPod|iPhone|Android|BlackBerry|SymbianOS|SCH-Md+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS",feed:"Bloglines|feed|rss",lib:"cURL|Java|libwww-perl|PHP|urllib"}[t.target.value]}}),n("")},value:r,className:"medium",children:[(0,l.jsx)("option",{value:"",children:(0,i.__)("Custom","redirection")}),(0,l.jsx)("option",{value:"mobile",children:(0,i.__)("Mobile","redirection")}),(0,l.jsxs)("option",{value:"feed",children:[(0,i.__)("Feed Readers","redirection")," "]}),(0,l.jsx)("option",{value:"lib",children:(0,i.__)("Libraries","redirection")})]}),(0,l.jsx)("input",{id:"redirect-agent-regex",type:"checkbox",name:"regex",checked:a,onChange:e}),(0,l.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-agent-regex",children:[(0,i.__)("Regex","redirection")," ",(0,l.jsx)("sup",{children:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},qv=({data:e,onChange:t})=>{const{referrer:r,regex:n}=e;return(0,l.jsxs)(Ov,{title:(0,i.__)("Referrer","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",className:"regular-text",name:"referrer",value:r,onChange:t,placeholder:(0,i.__)("Match against this browser referrer text","redirection")}),(0,l.jsx)("input",{id:"redirect-referrer-regex",type:"checkbox",name:"regex",checked:n,onChange:t}),(0,l.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-referrer-regex",children:[(0,i.__)("Regex","redirection")," ",(0,l.jsx)("sup",{children:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Hv=function({onChange:e,data:t}){const[r,n]=(0,o.useState)(""),{name:s,value:a,regex:c}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Ov,{title:(0,i.__)("HTTP Header","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",name:"name",value:s,onChange:e,className:"regular-text",placeholder:(0,i.__)("Header name","redirection")}),(0,l.jsx)("input",{type:"text",name:"value",value:a,onChange:e,className:"regular-text",placeholder:(0,i.__)("Header value","redirection")}),(0,l.jsxs)("select",{name:"agent_dropdown",onChange:t=>{""!==t.target.value&&e({target:{name:"name",value:{accept:"Accept-Language"}[t.target.value]}}),n("")},value:r,className:"medium",children:[(0,l.jsx)("option",{value:"",children:(0,i.__)("Custom","redirection")}),(0,l.jsx)("option",{value:"accept",children:(0,i.__)("Accept Language","redirection")})]}),(0,l.jsx)("input",{id:"redirect-header-regex",type:"checkbox",name:"regex",checked:c,onChange:e}),(0,l.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-header-regex",children:[(0,i.__)("Regex","redirection")," ",(0,l.jsx)("sup",{children:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]}),(0,l.jsx)(Ov,{children:(0,i.__)("Note it is your responsibility to pass HTTP headers to PHP. Please contact your hosting provider for support about this.","redirection")})]})},Wv=({data:e,onChange:t})=>{const{filter:r}=e;return(0,l.jsx)(Ov,{title:(0,i.__)("Filter Name","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",name:"filter",value:r,onChange:t,className:"regular-text",placeholder:(0,i.__)("WordPress filter name","redirection")})})},Gv=({data:e,onChange:t})=>{const{name:r,value:n,regex:o}=e;return(0,l.jsxs)(Ov,{title:(0,i.__)("Cookie","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",name:"name",value:r,onChange:t,className:"regular-text",placeholder:(0,i.__)("Cookie name","redirection")}),(0,l.jsx)("input",{type:"text",name:"value",value:n,onChange:t,className:"regular-text",placeholder:(0,i.__)("Cookie value","redirection")}),(0,l.jsx)("input",{id:"redirect-cookie-regex",type:"checkbox",name:"regex",checked:o,onChange:t}),(0,l.jsxs)("label",{className:"redirect-edit-regex",htmlFor:"redirect-cookie-regex",children:[(0,i.__)("Regex","redirection")," ",(0,l.jsx)("sup",{children:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Vv=({data:e,onChange:t})=>{const{role:r}=e;return(0,l.jsx)(Ov,{title:(0,i.__)("Role","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",value:r,name:"role",placeholder:(0,i.__)("Enter role or capability value","redirection"),onChange:t})})},Zv=({data:e,onChange:t})=>{const{server:r}=e;return(0,l.jsx)(Ov,{title:(0,i.__)("Server","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"server",value:r,placeholder:(0,i.__)("Enter server URL to match against","redirection"),onChange:t})})},Qv=({data:e,onChange:t})=>{const{ip:r=[]}=e;return(0,l.jsx)(Ov,{title:(0,i.__)("IP","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("textarea",{value:r.join("\n"),name:"ip",placeholder:(0,i.__)("Enter IP addresses (one per line)","redirection"),onChange:e=>{t({target:{name:e.target.name,value:e.target.value.split("\n")}})}})})},Kv=()=>(0,l.jsx)(Ov,{title:(0,i.__)("Page Type","redirection"),className:"redirect-edit__match",children:(0,l.jsxs)("p",{children:[(0,i.__)("Only the 404 page type is currently supported.","redirection")," ",(0,i.__)("Please do not try and redirect all your 404s - this is not a good thing to do.","redirection")]})}),Jv=({data:e,onChange:t})=>{const{language:r}=e;return(0,l.jsx)(Ov,{title:(0,i.__)("Language","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"language",value:r,onChange:t,placeholder:(0,i.__)("Comma separated list of languages to match against (i.e. da, en-GB)","redirection")})})},Yv=({matchType:e,actionData:t,onChange:r})=>{const n={[sv]:qv,agent:Bv,cookie:Gv,header:Hv,custom:Wv,role:Vv,server:Zv,ip:Qv,page:Kv,[hv]:Jv};if(n[e]){const i=n[e];return(0,l.jsx)(i,{data:null===t?{}:t,onChange:r})}return null},Xv=({onChange:e,data:t})=>{const{logged_in:r,logged_out:n}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ov,{title:(0,i.__)("Logged In","redirection"),className:"redirect-edit__target__matched",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"logged_in",value:r,onChange:e,placeholder:(0,i.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,l.jsx)(Ov,{title:(0,i.__)("Logged Out","redirection"),className:"redirect-edit__target__unmatched",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"logged_out",value:n,onChange:e,placeholder:(0,i.__)("Target URL when not matched (empty to ignore)","redirection")})})]})};const eb=function(){return(0,l.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:[(0,l.jsx)("circle",{transform:"translate(8 0)",cx:"0",cy:"16",r:"0",children:(0,l.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})}),(0,l.jsx)("circle",{transform:"translate(16 0)",cx:"0",cy:"16",r:"0",children:(0,l.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0.3",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})}),(0,l.jsx)("circle",{transform:"translate(24 0)",cx:"0",cy:"16",r:"0",children:(0,l.jsx)("animate",{attributeName:"r",values:"0; 4; 0; 0",dur:"1.2s",repeatCount:"indefinite",begin:"0.6",keyTimes:"0;0.2;0.7;1",keySplines:"0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.6 0.4 0.8",calcMode:"spline"})})]})},tb=function({options:e,value:t,onSelect:r,onClose:n}){return(0,l.jsx)("ul",{children:e.map((e,i)=>(0,l.jsx)("li",{children:(0,l.jsx)("button",{type:"button",onClick:t=>function(e,t){e.preventDefault(),r(t),n()}(t,e),onKeyDown:t=>function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(t),n())}(t,e),children:(0,l.jsx)(Zy(),{searchWords:[t],textToHighlight:e.title,autoEscape:!0})})},i))})},rb=function(e){const{placeholder:t="",onChange:r,value:n,fetchData:i,name:s="text",disabled:a=!1,className:c,maxChoices:u=-1,maxLength:d=0,canMakeRequest:p=e=>e.length>0,onBlur:f,getLabel:m,setLabel:g=()=>{},loadOnFocus:_=!1,onlyChoices:y=!1}=e,[v,b]=(0,o.useState)(!1),[x,w]=(0,o.useState)([]),[j,S]=(0,o.useState)(Array.isArray(n)?"":n),k=(0,o.useRef)(null),C={"wpl-dropdowntext__suggestion__hide":u>0&&Array.isArray(n)&&n.length>=u,"wpl-dropdowntext__suggestion":u>1},T=function(e,t,r,n){var i=this,s=(0,o.useRef)(null),a=(0,o.useRef)(0),l=(0,o.useRef)(0),c=(0,o.useRef)(null),u=(0,o.useRef)([]),d=(0,o.useRef)(),p=(0,o.useRef)(),h=(0,o.useRef)(e),f=(0,o.useRef)(!0),m=(0,o.useRef)(),g=(0,o.useRef)();h.current=e;var _="undefined"!=typeof window,y=!t&&0!==t&&_;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var v=!!(r=r||{}).leading,b=!("trailing"in r)||!!r.trailing,x=!!r.flushOnExit&&b,w="maxWait"in r,j="debounceOnServer"in r&&!!r.debounceOnServer,S=w?Math.max(+r.maxWait||0,t):null,k=(0,o.useMemo)(function(){var e=function(e){var t=u.current,r=d.current;return u.current=d.current=null,a.current=e,l.current=l.current||e,p.current=h.current.apply(r,t)},r=function(e,t){y&&cancelAnimationFrame(c.current),c.current=y?requestAnimationFrame(e):setTimeout(e,t)},o=function(e){if(!f.current)return!1;var r=e-s.current;return!s.current||r>=t||r<0||w&&e-a.current>=S},k=function(t){return c.current=null,b&&u.current?e(t):(u.current=d.current=null,p.current)},C=function e(){var n=Date.now();if(v&&l.current===a.current&&T(),o(n))return k(n);if(f.current){var i=t-(n-s.current),c=w?Math.min(i,S-(n-a.current)):i;r(e,c)}},T=function(){n&&n({})},E=function(){if(_||j){var n,l=Date.now(),h=o(l);if(u.current=[].slice.call(arguments),d.current=i,s.current=l,x&&!m.current&&(m.current=function(){var e;"hidden"===(null==(e=globalThis.document)?void 0:e.visibilityState)&&g.current.flush()},null==(n=globalThis.document)||null==n.addEventListener||n.addEventListener("visibilitychange",m.current)),h){if(!c.current&&f.current)return a.current=s.current,r(C,t),v?e(s.current):p.current;if(w)return r(C,t),e(s.current)}return c.current||r(C,t),p.current}};return E.cancel=function(){var e=c.current;e&&(y?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,u.current=s.current=d.current=c.current=null,e&&n&&n({})},E.isPending=function(){return!!c.current},E.flush=function(){return c.current?k(Date.now()):p.current},E},[v,w,t,S,b,x,y,_,j,n]);return g.current=k,(0,o.useEffect)(function(){return f.current=!0,function(){var e;x&&g.current.flush(),m.current&&(null==(e=globalThis.document)||null==e.removeEventListener||e.removeEventListener("visibilitychange",m.current),m.current=null),f.current=!1}},[x]),k}(E,450);function E(e){i&&(b(!0),i(e).then(e=>{k.current&&k.current.ownerDocument.activeElement===k.current&&w(e),b(!1)}).catch(()=>{w([]),b(!1)}))}function R(e){if(m)return N(e).map(t=>m(t,e))}function P(e){if(u>0){if(!N(n).find(t=>t===`${e.value}`)){const t=[`${e.value}`].concat(N(n).filter(t=>t!==`${e.value}`)).slice(0,u);r(1!==u||y?t:t[0],[e.title].concat(R(t)?.slice(1)||[])),g(e.value,e.title)}S("")}else S(e.value),r(e.value,R(n));w([])}function N(e){return Array.isArray(e)?e:e?[e]:[]}return(0,o.useEffect)(()=>{n!==j&&S(Array.isArray(n)?"":n)},[n,j]),(0,l.jsxs)("div",{className:h("wpl-dropdowntext",c,C),children:[u>0&&N(n).map(e=>(0,l.jsx)(Lu,{title:e,onCancel:()=>function(e){const t=N(n).filter(t=>t!==e);g(e,null),Array.isArray(n)?r(1===u?t[0]:t,R(t)):r(""),k.current?.focus()}(e),disabled:a,children:m?m(e,n):e},e)),(0,l.jsx)("input",{type:"text",className:h("regular-text",{"wpl-dropdowntext__max":u>=0&&N(n).length>=u}),name:s,value:j,disabled:a,onChange:function(e){S(e.target.value),u<1&&r(e.target.value),i&&T&&(p(e.target.value.trim())?T(e.target.value):w([]))},maxLength:d>0?d:void 0,placeholder:t,ref:k,onFocus:function(){const e=(Array.isArray(n),n.length>0);_&&!e&&E("")},onBlur:function(e){if(e.relatedTarget&&e.relatedTarget.closest(".wpl-dropdowntext__suggestions"))return;const t=`${(f?f(j):j)??""}`;0===x.length?y?S(""):u>0&&i?P({value:t,label:t,title:t}):r(t):t!==j&&S(t),b(!1)},onKeyDown:function(e){"Enter"===e.code&&(b(!1),w([]))}}),v&&(0,l.jsx)("div",{className:"wpl-dropdowntext__loading",children:(0,l.jsx)(eb,{})}),x.length>0&&k.current&&(0,l.jsx)(Ou,{align:"left",onClose:()=>w([]),popoverPosition:Nu(k.current),className:"wpl-dropdowntext__suggestions",focusLock:!1,children:(0,l.jsx)(tb,{options:x,value:j,onSelect:P,onClose:()=>w([])})})]})},nb=function(e){const{onChange:t,url:r}=e;return(0,l.jsx)(rb,{placeholder:(0,i.__)("The target URL you want to redirect, or auto-complete on post name or permalink.","redirection"),onChange:t,fetchData:function(e){return St(It(e))},value:Array.isArray(r)?r.join(""):r||""})},ib=({onChange:e,data:t})=>{const{url:r}=t;return(0,l.jsx)(Ov,{title:(0,i.__)("Target URL","redirection"),className:"redirect-edit__target",children:(0,l.jsx)(nb,{...void 0!==r?{url:r}:{},onChange:t=>e({target:{name:"url",value:t,type:"input"}})})})},ob=({onChange:e,data:t})=>{const{url_from:r,url_notfrom:n}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ov,{title:(0,i.__)("Matched Target","redirection"),className:"redirect-edit__target__matched",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"url_from",value:r,onChange:e,placeholder:(0,i.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,l.jsx)(Ov,{title:(0,i.__)("Unmatched Target","redirection"),className:"redirect-edit__target__unmatched",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"url_notfrom",value:n,onChange:e,placeholder:(0,i.__)("Target URL when not matched (empty to ignore)","redirection")})})]})},sb=({actionType:e,matchType:t,actionData:r,onChange:n})=>{if(fv(e)){const e="login"===(i=t)?Xv:"url"===i||"page"===i?ib:ob,o=mv(t,r);return(0,l.jsx)(e,{data:null===o?{}:o,onChange:n})}var i;return null},ab=(e,t)=>t.startsWith(e)||e.slice(0,t.length)===t,lb=e=>{const{url:t,flag_regex:r,action_data:n={}}=e;if(null===n||!t||!e||"string"!=typeof t)return[];const o=[],{url:s="",logged_in:a="",logged_out:c="",url_from:u="",url_notfrom:d=""}=n;if(Array.isArray(t)||0===t.length||void 0===t)return o;if(t.includes("#")&&o.push((0,l.jsx)(N,{url:"https://redirection.me/support/faq/#anchor",children:(0,i.__)("Anchor values are not sent to the server and cannot be redirected.","redirection")})),"http"===t.slice(0,4)&&!t.includes(document.location.origin))try{const e=new URL(t);o.push((0,l.jsx)(N,{url:"https://redirection.me/support/matching-redirects/#server",children:L((0,i.sprintf)(
// translators: %(server)s is the domain name
// translators: %(server)s is the domain name
(0,i.__)("This will be converted to a server redirect for the domain {{code}}%(server)s{{/code}}.","redirection"),{server:e.hostname}),{code:(0,l.jsx)("code",{})})}))}catch(e){}var p;"http"!==t.slice(0,4)&&"/"!==t.slice(0,1)&&t.length>0&&!1===r&&!t.includes("[source]")&&o.push(L((0,i.__)("The source URL should probably start with a {{code}}/{{/code}}","redirection"),{code:(0,l.jsx)("code",{})})),null===(p=t).match(/[\*\\\(\)\^\$]/)&&!p.includes(".?")||!1!==r||o.push((0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/",children:(0,i.__)('Remember to enable the "regex" option if this is a regular expression.',"redirection")})),t.match(/%\w+%/)&&o.push((0,l.jsx)(N,{url:"tools.php?page=redirection.php&sub=site",children:(0,i.__)('Please add migrated permalinks to the Site page under the "Permalink Migration" section.',"redirection")})),t.includes("^")||t.includes("$")||!r||o.push(
// translators: %(example)s is an example regular expression
L((0,i.sprintf)(
// translators: %(example)s is an example regular expression
// translators: %(example)s is an example regular expression
(0,i.__)("To prevent a greedy regular expression you can use {{code}}^{{/code}} to anchor it to the start of the URL. For example: {{code}}%(example)s{{/code}}","redirection"),{example:"^"+t}),{code:(0,l.jsx)("code",{})})),r&&t.includes("^")&&t.indexOf("^")>0&&o.push(
// translators: %(example)s is an example regular expression with corrected caret position
L((0,i.sprintf)(
// translators: %(example)s is an example regular expression with corrected caret position
// translators: %(example)s is an example regular expression with corrected caret position
(0,i.__)("The caret {{code}}^{{/code}} should be at the start. For example: {{code}}%(example)s{{/code}}","redirection"),{example:"^"+t.replace("^","")}),{code:(0,l.jsx)("code",{})})),r&&t.match(/[a-zA-Z0-9\/]\?/)&&o.push(L((0,i.__)("To match {{code}}?{{/code}} you need to escape it with {{code}}\\?{{/code}}","redirection"),{code:(0,l.jsx)("code",{})})),r&&t.match(/[a-zA-Z0-9 ]\*/)&&o.push(L((0,i.__)("Wildcards are not supported. You need to use a {{link}}regular expression{{/link}}.","redirection"),{link:(0,l.jsx)(N,{url:"https://redirection.me/support/redirect-regular-expressions/"})})),"/(.*)"!==t&&"^/(.*)"!==t||o.push((0,i.__)("If you want to redirect everything please use a site relocation or alias from the Site page.","redirection")),t.length>0&&(u===t||d===t||a===t||c===t||s===t)&&o.push((0,i.__)("Your source is the same as a target and this will create a loop. Leave a target blank if you do not want to take action.","redirection"));const h=[n.url,n.url_from,n.url_notfrom,n.logged_in,n.logged_out].filter(e=>e);return!s||ab(s,"https://")||ab(s,"http://")||"/"===s.slice(0,1)||o.push(
// translators: %(url)s is the user's target URL
L((0,i.sprintf)(
// translators: %(url)s is the user's target URL
// translators: %(url)s is the user's target URL
(0,i.__)("Your target URL should be an absolute URL like {{code}}https://domain.com/%(url)s{{/code}} or start with a slash {{code}}/%(url)s{{/code}}.","redirection"),{url:n.url}),{code:(0,l.jsx)("code",{})})),!1===r&&h.forEach(e=>{const t=e.match(/[|\\\$]/g);null!==t&&o.push(
// translators: %(invalid)s is an invalid character in the URL
L((0,i.sprintf)(
// translators: %(invalid)s is an invalid character in the URL
// translators: %(invalid)s is an invalid character in the URL
(0,i.__)("Your target URL contains the invalid character {{code}}%(invalid)s{{/code}}","redirection"),{invalid:t}),{code:(0,l.jsx)("code",{})}))}),[t,...h].forEach(e=>{const t=(e=>{const t=e.match(/^\/([a-zA-Z0-9_\-%]*\..*)\//);return t&&!e.includes("index.php")?t[0]:null})(e);t&&o.push(
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
L((0,i.sprintf)(
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
// translators: %(relative)s is the relative URL, %(absolute)s is the suggested absolute URL
(0,i.__)("Your URL appears to contain a domain inside the path: {{code}}%(relative)s{{/code}}. Did you mean to use {{code}}%(absolute)s{{/code}} instead?","redirection"),{relative:t,absolute:"https://"+t}),{code:(0,l.jsx)("code",{})}))}),null!==t.match(/(\.html|\.htm|\.php|\.pdf|\.jpg)$/)&&o.push((0,l.jsx)(N,{url:"https://redirection.me/support/problems/url-not-redirecting/",children:(0,i.__)("Some servers may be configured to serve file resources directly, preventing a redirect occurring.","redirection")})),o},cb=({warnings:e})=>0===e.length?null:(0,l.jsx)(Ov,{children:(0,l.jsx)("div",{className:"redirect-edit_warning notice notice-warning redirection-notice",children:e.map((e,t)=>(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"dashicons dashicons-info"}),e]},t))})});function ub(e){const t=u(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setRedirectsTable:s}=U_();return mt({mutationFn:async({items:e,params:i={}})=>{r();try{return await t.cancelQueries({queryKey:Xr.redirects.lists()}),await St(ir("delete",{items:e},i))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n(),i("Redirects deleted"),s(sd(r.params)),t.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:e=>{o(e.message||"Failed to delete redirects")},...e})}function db(e,t){const r=u(),{incrementProgress:n,decrementProgress:i,addNotice:o,addError:s}=tn(),{setRedirectsSelected:a}=U_();return mt({mutationFn:async({items:t})=>{n();try{return await r.cancelQueries({queryKey:Xr.redirects.lists()}),await St(ir(e,{items:t},{}))}catch(e){throw i(),Yr(e)}},onSuccess:()=>{i(),o(`Redirects ${e}d`),a([]),r.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:t=>{s(t.message||`Failed to ${e} redirects`)},...t})}const pb=function(e){const{item:t,onCancel:r,saveButton:n=(0,i.__)("Save","redirection"),childSave:s,callback:a,canSave:c,autoFocus:d,children:p}=e,{data:h,isSuccess:f,refetch:m}=ud({}),g=(0,o.useMemo)(()=>h?.items??[],[h]),_=U_(e=>e.redirectsAddTop),y=U_(e=>e.redirects),{setRedirectsAddTop:v}=U_(),b=de(e=>e.values),x=tn(e=>e.addError),w=b?.auto_target||"",j=(0,o.useMemo)(()=>b?{flag_case:b.flag_case,flag_trailing:b.flag_trailing,flag_regex:b.flag_regex,flag_query:b.flag_query}:{},[b]),{mutate:S}=function(){const e=u(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return mt({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.redirects.lists()});const{id:t,...r}=n,i=await St(Ot(t,r));return nd.parse(i).item}catch(e){throw r(),Yr(e)}},onSuccess:t=>{r(),n("Redirect saved"),e.invalidateQueries({queryKey:Xr.redirects.lists()}),e.invalidateQueries({queryKey:Xr.redirects.detail(t.id)})},onError:e=>{i(e.message||"Failed to update redirect")}})}(),{mutate:k}=function(){const e=u(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return mt({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.redirects.lists()});const t=await St(At(n));return rd.parse(t).items[0]??null}catch(e){throw r(),Yr(e)}},onSuccess:()=>{r(),n("Redirect created"),e.invalidateQueries({queryKey:Xr.redirects.lists()})},onError:e=>{i(e.message||"Failed to create redirect")}})}(),C=(0,o.useRef)(null),T=(0,o.useRef)(!1),E=(0,o.useCallback)(e=>{if(((e,t)=>e.find(e=>e.id===t))(g,e))return e;if(y.filterBy&&"object"==typeof y.filterBy&&"group"in y.filterBy&&y.filterBy.group&&parseInt(String(y.filterBy.group),10)>0)return parseInt(String(y.filterBy.group),10);if(g&&g.length>0){const e=g.find(e=>e.default);return e?e.id:g[0].id}return 0},[g,y.filterBy]),R=g.length>0,P=f&&!R;(0,o.useEffect)(()=>{R?T.current=!1:f&&!T.current&&(T.current=!0,m())},[R,f,m]);const{url:N,match_data:O,match_type:A,action_type:I,action_data:F,group_id:D=0,title:L,action_code:z,position:M=0}=t,{flag_regex:$=!1,flag_trailing:U=!1,flag_case:B=!1,flag_query:q="exact"}=O?.source??{},H={url:N,title:L,flag_regex:$,flag_trailing:U,flag_case:B,flag_query:q,match_type:A,action_type:I,action_code:z,action_data:mv(A,F),options:O?.options??{},group_id:E(D),position:M,warning:[],advanced:!1},[W,G]=(0,o.useState)(H),V=(0,o.useCallback)(()=>{const{match_type:e,action_type:t,title:r,action_code:n}=W;return"url"===e&&"url"===t&&""===r&&301===n},[W]);(0,o.useEffect)(()=>{G(e=>({...e,advanced:!V()}))},[]),(0,o.useEffect)(()=>{G(e=>({...e,warning:lb(e)}))},[W.url,W.action_type,W.match_type,W.action_data]),(0,o.useEffect)(()=>{a&&C.current&&a(C.current.clientHeight)},[W,a]);const Z=(0,o.useCallback)(()=>{const e=gv("",W.group_id,j);G(t=>({...t,url:e.url,title:"",flag_regex:e.match_data.source.flag_regex,flag_trailing:e.match_data.source.flag_trailing,flag_case:e.match_data.source.flag_case,flag_query:e.match_data.source.flag_query,match_type:e.match_type,action_type:e.action_type,action_code:e.action_code,action_data:e.action_data,options:e.match_data.options,position:0,advanced:!1,warning:[]}))},[W.group_id,j]),Q=(0,o.useCallback)(e=>{e.preventDefault();const{url:n,title:o,flag_regex:a,flag_trailing:l,flag_case:u,flag_query:d,match_type:p,action_type:h,group_id:f,action_code:m,position:_,action_data:y,options:v}=W,b=f>0?f:g[0]?.id;if(void 0===b)return void x((0,i.__)("Unable to create a redirect because no groups are available. Please reload the page.","redirection"));const w={...t.id?{id:parseInt(String(t.id),10)}:{},url:n,title:o,match_data:{source:{flag_regex:a,flag_trailing:l,flag_case:u,flag_query:d},...v?{options:v}:{}},match_type:p,action_type:h,...void 0!==_?{position:_}:{},...void 0!==b?{group_id:b}:{},action_code:"number"==typeof m?m:parseInt(String(m),10),action_data:mv(p,y)};c&&!c(Array.isArray(n))||(w.id?S({id:w.id,...w}):k(w),r?r(e):Z(),s&&s())},[W,g,t.id,c,S,k,r,Z,s,x]),K=(0,o.useCallback)(e=>{G(t=>({...t,...e,warning:lb({...t,...e})}))},[]),J=(0,o.useCallback)(e=>{e.preventDefault(),K({advanced:!W.advanced})},[W.advanced,K]),Y=(0,o.useCallback)(e=>{G(t=>({...t,group_id:parseInt(e.target.value,10)}))},[]),X=(0,o.useCallback)(e=>{const t={};Object.keys(j).filter(e=>"flag_query"!==e).forEach(e=>{t[e]=!1}),K({...t,...e})},[j,K]),ee=(0,o.useCallback)(e=>{const{target:t}=e,r="checkbox"===t.type?t.checked:t.value;return{[t.name]:r}},[]),te=(0,o.useCallback)(e=>{const t=ee(e);t.action_data=mv(t.match_type,W.action_data),"login"===t.match_type&&(t.action_type="url"),K(t)},[W.action_data,ee,K]),re=(0,o.useCallback)(e=>{K(ee(e))},[ee,K]),ne=(0,o.useCallback)(e=>{G(t=>({...t,options:{...t.options,[e.target.name]:e.target.checked??e.target.value}}))},[]),ie=(0,o.useCallback)(e=>{const t=ee(e).action_type;var r;K({action_type:t,action_code:(r=t,"error"===r?404:"pass"===r?200:301),action_data:mv(W.match_type,W.action_data||{})})},[W.match_type,W.action_data,ee,K]),oe=(0,o.useCallback)(e=>{const t={action_data:{...W.action_data,...ee(e)}};K(t)},[W.action_data,ee,K]),se=(0,o.useCallback)(()=>{const{match_type:e,action_type:t,action_data:r,url:n,group_id:i}=W;return!(!R&&i<=0||0===n.length&&!w||fv(t)&&(o=e,(!(s=r)||"url"!==o&&"page"!==o&&!(o===ov?s.logged_in||s.logged_out:o===sv?s.referrer:o===av?s.agent:o===lv||o===cv?s.name&&s.value:o===uv?s.filter:o===dv?s.role:o===pv?s.server:"ip"===o?s.ip:o===hv&&s.language))&&""===w));var o,s},[W,w,R]),{url:ae,advanced:le,flag_regex:ce,action_type:ue,match_type:pe,action_data:he,flag_query:fe,group_id:me,position:ge,title:_e,action_code:ye,options:ve,warning:be}=W,xe=P?[(0,i.__)("No groups are available. Reload the page before creating a redirect.","redirection"),...be]:be;return(0,l.jsx)("form",{onSubmit:Q,ref:C,children:(0,l.jsx)("table",{className:"redirect-edit inline-edit-row",children:(0,l.jsxs)("tbody",{children:[(0,l.jsx)(Iv,{url:ae,flags:W,defaultFlags:j,autoFocus:d??!1,onFlagChange:X,onChange:re}),(0,l.jsx)(Fv,{query:fe,regex:ce,onChange:re,url:ae}),le&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(zv,{title:_e,onChange:e=>K(e)}),(0,l.jsx)(Uv,{matchType:pe,onChange:te}),(0,l.jsx)(Yv,{matchType:pe,actionData:he,onChange:oe}),(0,l.jsxs)(Ov,{title:(0,i.__)("When matched","redirection"),className:"redirect-edit__action",children:[(0,l.jsx)($v,{actionType:ue,matchType:pe,onChange:ie}),(0,l.jsx)(Mv,{actionType:ue,actionCode:ye,onChange:re}),le&&["url","random"].includes(ue)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{id:"redirect-log-exclude",type:"checkbox",name:"log_exclude",checked:Boolean(ve.log_exclude),onChange:ne}),(0,l.jsx)("label",{htmlFor:"redirect-log-exclude",children:(0,i.__)("Exclude from logs","redirection")})]}):null]})]}),(0,l.jsx)(sb,{actionType:ue,matchType:pe,actionData:he,onChange:oe}),(0,l.jsxs)(Ov,{title:(0,i.__)("Group","redirection"),className:"redirect-edit__group",children:[(0,l.jsx)(Dv,{groups:g,currentGroup:me,onChange:Y}),le&&(0,l.jsx)(Lv,{position:ge,onChange:re})]}),p&&p,(0,l.jsx)(Ov,{children:(0,l.jsxs)("div",{className:"table-actions",children:[(0,l.jsx)($l,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:!se(),children:n})," "," ",r&&(0,l.jsx)($l,{onClick:r,children:(0,i.__)("Cancel","redirection")}),_&&!r&&(0,l.jsx)($l,{onClick:e=>{e.preventDefault(),v(!1)},children:(0,i.__)("Close","redirection")})," ",V()&&(0,l.jsx)("button",{type:"button",onClick:J,className:"redirection-edit_advanced",title:(0,i.__)("Show advanced options","redirection"),children:(0,l.jsx)("svg",{"aria-hidden":"true",role:"img",focusable:"false",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{d:"M18 12h-2.18c-.17.7-.44 1.35-.81 1.93l1.54 1.54-2.1 2.1-1.54-1.54c-.58.36-1.23.63-1.91.79V19H8v-2.18c-.68-.16-1.33-.43-1.91-.79l-1.54 1.54-2.12-2.12 1.54-1.54c-.36-.58-.63-1.23-.79-1.91H1V9.03h2.17c.16-.7.44-1.35.8-1.94L2.43 5.55l2.1-2.1 1.54 1.54c.58-.37 1.24-.64 1.93-.81V2h3v2.18c.68.16 1.33.43 1.91.79l1.54-1.54 2.12 2.12-1.54 1.54c.36.59.64 1.24.8 1.94H18V12zm-8.5 1.5c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3z"})})})]})}),(0,l.jsx)(cb,{warnings:xe})]})})})};const hb=function(e){const{onClose:t,redirect:r,rows:n}=e,s=de(e=>e.values),a={flag_regex:s?.flag_regex||!1,flag_trailing:s?.flag_trailing||!1,flag_case:s?.flag_case||!1,flag_query:s?.flag_query||"exact"},{mutate:c}=V_(),u=function(e,t){return e?Array.isArray(e)?[...new Set(e.map(e=>function(e,t){const r=t.find(t=>t.id===e||t.id===parseInt(e,10));return r?r.url:e}(e,t)))]:e:""}(r.url,n),[d,p]=(0,o.useState)(!1),h={...gv(Array.isArray(u)?u[0]??"":u,0,a),...r,url:u};return(0,l.jsx)(wd,{onClose:t,padding:!0,children:(0,l.jsx)("div",{className:"add-new",children:(0,l.jsx)(pb,{item:h,saveButton:(0,i.__)("Add Redirect","redirection"),onCancel:t,childSave:()=>{return d&&(e=Array.isArray(u)?u:[u],void c({action:"delete",items:e,params:{groupBy:"url",deleteConfirm:!0}}));var e},canSave:e=>d&&confirm(e?(0,i.__)("Are you sure you want to delete the selected items?","redirection"):(0,i.__)("Are you sure you want to delete this item?","redirection"))||!d,autoFocus:!0,children:Cy(Ny)&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Delete Log Entries","redirection")}),(0,l.jsxs)("td",{className:"edit-left",style:{padding:"7px 0px"},children:[(0,l.jsx)("input",{id:"create-redirect-delete-log",type:"checkbox",checked:d,onChange:e=>p(e.target.checked)}),(0,l.jsx)("label",{htmlFor:"create-redirect-delete-log",children:Array.isArray(u)&&u.length<=1||!Array.isArray(u)?(0,i.__)("Delete logs for this entry","redirection"):(0,i.__)("Delete logs for these entries","redirection")})]})]})})})})},fb=function(e){const{row:t,onDelete:r,onCreate:n,table:o,disabled:s}=e,{setErrorsTable:a}=U_(),{url:c,ip:u,agent:d,id:p}=t,{groupBy:h}=o,f=[];return f.push((0,l.jsx)(Ay,{onClick:()=>r(p),capability:Ny,children:(0,i.__)("Delete","redirection")},"0")),f.push((0,l.jsx)(Ay,{onClick:()=>n(Nv(h,"ip"===h?[p]:""===h?c:p)),capability:Ry,children:(0,i.__)("Add Redirect","redirection")},"1")),d&&f.unshift((0,l.jsx)($y,{agent:d},"3")),f.push((0,l.jsx)(Ay,{onClick:()=>{return e=ad(h,""===h?t.url:String(t.id)),void a({filterBy:e,page:0,groupBy:"",selected:[],selectAll:!1});var e},capability:Ey,children:(0,i.__)("Show All","redirection")},"4")),"ip"===h?f.push((0,l.jsx)(Ay,{onClick:()=>n(Nv("block",[u])),capability:Ry,children:(0,i.__)("Block IP","redirection")},"5")):"agent"!==h&&f.push((0,l.jsx)(Ay,{onClick:()=>n(Nv("ignore",c)),capability:Ry,children:(0,i.__)("Ignore URL","redirection")},"6")),(0,l.jsx)(Oy,{disabled:s,actions:f})};function mb(e){return e.url?pd(hd(e.domain),e.url):""}function gb(e){return e.includes("url")?e:e.concat(["url"])}const _b=function(){const e=U_(e=>e.errors),{setErrorsTable:t,setErrorsSelected:r}=U_(),n=de(e=>e.values),[s,a]=(0,o.useState)(null);Z_({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","domain","method"],pageName:"404s"});const c=V_(),u=an(),{data:d,isFetching:p}=function(e={},t){const r=cd(e);return pt({queryKey:Xr.errors.list(r),placeholderData:e=>e,queryFn:async()=>{try{const e=await St(Mt(r));return G_.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch 404 errors"),t}},...t})}(e),h=d?.items??[],f=d?.total??0;let m="idle";function g(e){r([]),a(e)}function _(t){if(!window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection")))return;const r=e.groupBy?{groupBy:e.groupBy}:{};c.mutate({action:"delete",items:[t],params:r})}p&&!d?m=Q_:d&&(m=K_);const y=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},v={...e,...(b=e.groupBy,b?{displayOptions:Ev(b),displaySelected:Tv(b)[0]?.grouping||[]}:{})};var b;const x={page:e.page,perPage:e.per_page,orderBy:e.orderby||"date",direction:e.direction,selected:e.selected??[],selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:v.displaySelected??[],groupBy:e.groupBy??""},w={displayFilters:Ev(v.groupBy),displayGroups:Tv(v.groupBy),searchOptions:[{name:"url",title:(0,i.__)("Search URL","redirection")},{name:"url-exact",title:(0,i.__)("Search exact URL","redirection")},{name:"referrer",title:(0,i.__)("Search referrer","redirection")},{name:"agent",title:(0,i.__)("Search user agent","redirection")},{name:"ip",title:(0,i.__)("Search IP","redirection")},{name:"domain",title:(0,i.__)("Search domain","redirection")}],groupBy:Cv(n?.ip_logging||0),bulk:kv(v.groupBy),rowFilters:v.groupBy?[]:[{label:(0,i.__)("Method","redirection"),value:"method",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"HEAD",value:"head"}]},{label:(0,i.__)("HTTP Status Code","redirection"),value:"http",options:xv().filter(e=>parseInt(e.value,10)>=400&&parseInt(e.value,10)<500)}],headers:Sv(v.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,v)),validateDisplay:gb},j={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:function(t){if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r={...cd({...e.groupBy?{groupBy:e.groupBy}:{},...e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected}}),displaySelected:v.displaySelected??[]};return void u.mutate({exportType:"404",format:"export-csv"===t?"csv":"json",download:!0,filename:tv("404","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,i.__)("Are you sure you want to delete all items?","redirection"):(0,i.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.groupBy?{groupBy:e.groupBy}:{};"delete"===t?e.selectAll?c.mutate({action:"delete",items:[],params:cd({...r,global:!0,filterBy:e.filterBy})}):c.mutate({action:"delete",items:e.selected,params:r}):a(Nv(t,e.selected))},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:"date"===e?"":e,direction:r})},onFilter:y,onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSelect:n=>{if("boolean"==typeof n)r(n?h.map(e=>e.id):[]);else if("number"==typeof n||"string"==typeof n){const r=Array.isArray(e.selected)?e.selected:[],i=r.includes(n)?r.filter(e=>e!==n):[...r,n];t({selected:i,selectAll:!1})}else r(n)},onSetAll:e=>{t({selected:e?h.map(e=>e.id):[],selectAll:e})}};return(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(hb,{onClose:()=>a(null),redirect:s,rows:h}),(0,l.jsx)(ky,{logOptions:w,logActions:j,table:x,status:m,total:f,rows:h,saving:[],getRow:(e,t)=>function(e,t){const{created:r,created_time:n,url:o,agent:s,referrer:a,ip:c,domain:u,request_method:d,http_code:p,count:h}=e,f=t?.table?.filterBy||{},m=f.url||f["url-exact"]||"";return[{name:"date",content:r?(0,l.jsxs)(l.Fragment,{children:[r,n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),n]})]}):""},{name:"method",content:d?d.toUpperCase():""},{name:"domain",content:u??""},{name:"url",content:o?(0,l.jsx)(N,{url:mb(e),children:(0,l.jsx)(Zy(),{searchWords:[m],textToHighlight:o,autoEscape:!0})}):""},{name:"code",content:p??""},{name:"referrer",content:a?(0,l.jsx)(Zy(),{searchWords:[f.referrer||""],textToHighlight:a,autoEscape:!0}):""},{name:"agent",content:s?(0,l.jsx)(Zy(),{searchWords:[f.agent||""],textToHighlight:s,autoEscape:!0}):""},{name:"ip",content:c?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("a",{href:"https://redirect.li/ip/?ip="+encodeURIComponent(c),children:(0,l.jsx)(Zy(),{searchWords:[f.ip||""],textToHighlight:c,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,l.jsx)(Oy,{actions:[(0,l.jsx)(Ay,{onClick:()=>{t.onFilter?.({ip:c})},children:(0,i.__)("Filter by IP","redirection")},"filter-ip")]})]}):""},{name:"count",content:h?new Intl.NumberFormat(window.Redirectioni10n.locale).format(h):""}]}(e,{...t,onFilter:y}),getRowActions:(e,t)=>(0,l.jsx)(fb,{disabled:!1,row:e,onCreate:g,onDelete:_,table:t.table}),renderTableActions:()=>Cy(Ny)&&function(e){const{filterBy:t,groupBy:r}=e;return void 0!==t.url||!r&&0===Object.keys(t).length}(v)?(0,l.jsx)(Gy,{enabled:h.length>0,children:null}):(0,l.jsx)(l.Fragment,{})})]})},yb=function({error:e}){if(!e||"object"!=typeof e)return null;const t=e,r=function(e){return void 0!==e.code?String(e.code):e.name&&"Error"!==e.name?e.name:null}(t);return(0,l.jsxs)("div",{className:"wpl-error import-export-error",children:[(0,l.jsxs)("p",{children:[r&&(0,l.jsxs)("strong",{children:[r,": "]}),t.message||(0,i.__)("An unknown error occurred.","redirection")]}),(0,l.jsx)(z,{error:t,links:Z(),locale:"redirection"}),(0,l.jsx)(cn,{error:t})]})},vb=function({title:e,badge:t,meta:r=[],stats:n=[],className:i="",actions:o,children:s,variant:a="default",wrapped:c=!0}){const u=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"file-sniff__header",children:[(0,l.jsx)("div",{className:"file-sniff__name",children:e}),t&&(0,l.jsx)("div",{className:"file-sniff__badge",children:t})]}),r.length>0&&(0,l.jsx)("div",{className:"file-sniff__meta",children:r.map(e=>(0,l.jsxs)("div",{className:h("file-sniff__meta-row",{"file-sniff__meta-row--full-width":e.fullWidth}),children:[(0,l.jsx)("div",{className:"file-sniff__meta-label",children:e.label}),(0,l.jsx)("div",{className:"file-sniff__meta-value",children:e.value}),e.description&&(0,l.jsx)("div",{className:"file-sniff__meta-description",children:e.description})]},e.label))}),n.length>0&&(0,l.jsx)("div",{className:"file-sniff__stats",children:n.map(e=>(0,l.jsxs)("div",{className:"file-sniff__stat",children:[(0,l.jsx)("div",{className:"file-sniff__stat-value",children:e.value}),(0,l.jsx)("div",{className:"file-sniff__stat-label",children:e.label})]},e.label))}),s,o&&(0,l.jsx)("div",{className:"import-source-card__actions",children:o})]});return c?(0,l.jsx)("div",{className:h("file-sniff__card",i,{"file-sniff__card--success":"success"===a}),children:u}):u},bb=function(e){const{plugin:t,onSelect:r,isActive:n=!1,isImporting:o=!1}=e,{name:s,description:a,source:c,total:u}=t;return(0,l.jsx)(vb,{title:s,badge:(0,i.__)("Plugin","redirection"),meta:[{label:(0,i.__)("Import type","redirection"),value:a},{label:(0,i.__)("Stored in","redirection"),value:c}],stats:[{label:(0,i._n)("Redirect","Redirects",u,"redirection"),value:u}],actions:(0,l.jsx)("button",{type:"button",onClick:()=>{r(t)},className:"button-secondary",disabled:o,children:n?(0,i.__)("Clear importer","redirection"):(0,i.__)("Use importer","redirection")}),className:h("import-source-card","import-source-card--plugin",{"import-source-card--active":n})})},xb=[",",";","|","\t"];function wb(e){return e.name.toLowerCase().endsWith(".json")}function jb(e){const t=e.replace(/^\ufeff/,"").trim();if(0===t.length)return{format:"other",valid:!1,error:"read-failed"};if(t.startsWith("{")||t.startsWith("["))return kb(e);const r=Sb(e);return r.valid?r:Cb(e)}function Sb(e){const t=e.replace(/^\ufeff/,"").replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("#"));if(0===t.length)return{format:"apache",valid:!1,error:"unknown-apache-layout"};let r=0;const n=new Set;return t.forEach(e=>{/^rewriterule\s+/i.test(e)?(r+=1,n.add("rewrite")):/^redirectmatch\s+/i.test(e)?(r+=1,n.add("redirectmatch")):/^redirect\s+/i.test(e)&&(r+=1,n.add("redirect"))}),0===r?{format:"apache",valid:!1,error:"unknown-apache-layout"}:{format:"apache",valid:!0,importSupported:!0,rules:r,ruleTypes:Array.from(n)}}function kb(e){try{const t=JSON.parse(e.replace(/^\ufeff/,"")),r={};if("object"!=typeof t||null===t||Array.isArray(t))return{format:"json",valid:!1,error:"not-redirection-json"};if(Array.isArray(t.groups)&&(r.groups=t.groups.length),Array.isArray(t.redirects)&&(r.redirects=t.redirects.length),"object"==typeof t.settings&&null!==t.settings&&(r.settings=Object.keys(t.settings).length),Array.isArray(t.logs)&&(r.logs=t.logs.length),Array.isArray(t.errors_404)&&(r.errors_404=t.errors_404.length),0===Object.keys(r).length)return{format:"json",valid:!1,error:"not-redirection-json"};const n={format:"json",valid:!0,contents:r};return"string"==typeof t.plugin?.version&&(n.version=t.plugin.version),n}catch{return{format:"json",valid:!1,error:"invalid-json"}}}function Cb(e){const t=e.replace(/^\ufeff/,"").replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(e=>e.trim()).filter(e=>e.length>0);if(0===t.length)return{format:"csv",valid:!1,error:"empty-csv"};const r=t.slice(0,5),n=function(e){let t=null;for(const r of xb){const n=e.map(e=>Tb(e,r).length),i=n[0]||0;if(i<2)continue;const o=n.filter(e=>e===i).length,s=10*o+i;(null===t||s>t.score)&&(t={separator:r,columns:i,score:s})}return t}(r);if(null===n)return{format:"csv",valid:!1,error:"separator-not-detected"};const i=function(e){return Rb(e,["source","target"])||Rb(e,["source url","target url"])?"redirects":Rb(e,["id","name","module_id","status"])?"groups":Rb(e,["date","source","target","ip","referrer","agent"])?"logs":Rb(e,["date","source","ip","referrer","useragent"])?"errors_404":null}(Tb(r[0]||"",n.separator).map(Eb));return null===i?function(e){if(e.length<2||e.length>4)return!1;const t=e[0]?.trim()||"",r=e[1]?.trim()||"",n=e[2]?.trim(),i=e[3]?.trim();if(0===t.length||0===r.length)return!1;if(void 0!==n&&""!==n&&"0"!==n&&"1"!==n)return!1;if(void 0!==i&&""!==i){const e=Number(i);if(!Number.isInteger(e)||e<100||e>599)return!1}return!0}(Tb(r[0]||"",n.separator))?{format:"csv",valid:!0,type:"redirects",importSupported:!0,separator:n.separator,columns:n.columns,rows:t.length}:{format:"csv",valid:!1,separator:n.separator,columns:n.columns,rows:Math.max(t.length-1,0),error:"unknown-csv-layout"}:{format:"csv",valid:!0,type:i,importSupported:"redirects"===i,separator:n.separator,columns:n.columns,rows:Math.max(t.length-1,0)}}function Tb(e,t){const r=[];let n="",i=!1;for(let o=0;o<e.length;o++){const s=e[o],a=e[o+1];'"'===s?i&&'"'===a?(n+='"',o++):i=!i:s!==t||i?n+=s:(r.push(n),n="")}return r.push(n),r}function Eb(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function Rb(e,t){return!(e.length<t.length)&&t.every((t,r)=>e[r]===t)}const Pb=function({activeImportType:e,file:t,fileInfo:r,fileInputRef:n,hover:o,importingStatus:s,isImporting:a,isSniffing:c,onAddFileClick:u,onClearFile:d,onClick:p,onFileInputChange:f}){const m=h("dropzone","import-source-card",{"dropzone-dropped":!1!==t,"dropzone-importing":"loading"===s,"dropzone-hover":o,"import-source-card--active":"file"===e&&!1!==t}),g="file"!==e&&!1!==t;return(0,l.jsxs)("div",{className:m,onClick:g?p:void 0,onKeyDown:g?e=>{g&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p()))}:void 0,role:g?"button":void 0,tabIndex:g?0:void 0,children:[(0,l.jsx)("input",{ref:n,type:"file",style:{display:"none"},onChange:f,accept:".json,.csv,.htaccess"}),!1===t?(0,l.jsx)(vb,{title:(0,i.__)("Import file","redirection"),badge:(0,i.__)("File","redirection"),meta:[{label:(0,i.__)("Import type","redirection"),value:(0,i.__)("Upload a file","redirection")},{label:(0,i.__)("Supported formats","redirection"),value:(0,i.__)("CSV, JSON, and .htaccess","redirection")}],children:(0,l.jsx)("div",{className:"file-sniff__meta-description",children:(0,i.__)("Drag and drop a file anywhere on this page.","redirection")}),actions:(0,l.jsx)("button",{type:"button",className:"button-secondary",onClick:u,children:(0,i.__)("Add file","redirection")}),wrapped:!1}):(0,l.jsxs)("div",{className:"dropzone-selected",children:[(()=>{if(!1===t)return null;if(c)return(0,l.jsx)("p",{children:(0,i.__)("Inspecting file…","redirection")});if(null===r)return null;if(!r.valid)return(0,l.jsx)("div",{className:"inline-notice inline-error",children:(0,l.jsx)("p",{children:"not-redirection-json"===r?.error?(0,i.__)("Not a Redirection JSON export","redirection"):"invalid-json"===r?.error?(0,i.__)("Invalid JSON","redirection"):"empty-csv"===r?.error?(0,i.__)("Empty CSV file","redirection"):"separator-not-detected"===r?.error?(0,i.__)("Unable to detect a CSV separator","redirection"):"unknown-csv-layout"===r?.error?(0,i.__)("Unknown CSV layout","redirection"):"unknown-apache-layout"===r?.error?(0,i.__)("Unknown Apache .htaccess layout","redirection"):"unsupported-file-type"===r?.error?(0,i.__)("Unsupported file type","redirection"):"read-failed"===r?.error?(0,i.__)("Unable to read file","redirection"):""})});const e=[{label:(0,i.__)("Details","redirection"),value:!1===t?"":t.size<1024?`${t.size} B`:t.size<1048576?`${(t.size/1024).toFixed(1)} KB`:`${(t.size/1048576).toFixed(1)} MB`}],n=[];let o="",s="";var a,u,d,p;return"json"===r.format&&(s=(0,i.__)("JSON","redirection"),r.version&&e.push({label:(0,i.__)("Plugin version","redirection"),value:r.version}),void 0!==r.contents?.groups&&n.push({label:(0,i._n)("Group","Groups",r.contents.groups||0,"redirection"),value:r.contents.groups||0}),void 0!==r.contents?.redirects&&n.push({label:(0,i._n)("Redirect","Redirects",r.contents.redirects||0,"redirection"),value:r.contents.redirects||0}),void 0!==r.contents?.logs&&n.push({label:(0,i._n)("Log","Logs",r.contents.logs||0,"redirection"),value:r.contents.logs||0}),void 0!==r.contents?.errors_404&&n.push({label:(0,i._n)("404 log","404 logs",r.contents.errors_404||0,"redirection"),value:r.contents.errors_404||0}),void 0!==r.contents?.settings&&n.push({label:(0,i.__)("Settings","redirection"),value:r.contents.settings||0})),"csv"===r.format&&(s=(0,i.__)("CSV","redirection"),"redirects"===r.type?o=(0,i.__)("This redirect CSV can be imported.","redirection"):"groups"===r.type?o=(0,i.__)("Group CSV exports can be viewed, but group import is only supported with JSON.","redirection"):"logs"===r.type?o=(0,i.__)("Redirect log CSV exports can be viewed, but log import is only supported with JSON.","redirection"):"errors_404"===r.type&&(o=(0,i.__)("404 log CSV exports can be viewed, but 404 log import is only supported with JSON.","redirection")),"redirects"===r.type&&e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("Redirects","redirection")}),"groups"===r.type&&e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("Groups","redirection")}),"logs"===r.type&&e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("Redirect logs","redirection")}),"errors_404"===r.type&&e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("404 logs","redirection")}),e.push({label:(0,i.__)("Separator","redirection"),value:"csv"===r?.format&&r.separator?","===r.separator?(0,i.__)("Comma","redirection"):";"===r.separator?(0,i.__)("Semicolon","redirection"):"|"===r.separator?(0,i.__)("Pipe","redirection"):(0,i.__)("Tab","redirection"):""}),n.push({label:(a=r,u=r.rows||0,"groups"===a.type?(0,i._n)("Group","Groups",u,"redirection"):"logs"===a.type?(0,i._n)("Log","Logs",u,"redirection"):"errors_404"===a.type?(0,i._n)("404 log","404 logs",u,"redirection"):(0,i._n)("Redirect","Redirects",u,"redirection")),value:r.rows||0})),"apache"===r.format&&(s=(0,i.__)("Apache .htaccess","redirection"),o=(0,i.__)("This Apache .htaccess content can be imported.","redirection"),e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("Apache redirect rules","redirection")}),n.push({label:(d=r,p=r.rules||0,d.ruleTypes?.includes("rewrite")&&1===d.ruleTypes.length?(0,i._n)("Rewrite rule","Rewrite rules",p,"redirection"):d.ruleTypes?.includes("redirect")&&1===d.ruleTypes.length?(0,i._n)("Redirect rule","Redirect rules",p,"redirection"):d.ruleTypes?.includes("redirectmatch")&&1===d.ruleTypes.length?(0,i._n)("RedirectMatch rule","RedirectMatch rules",p,"redirection"):(0,i._n)("Apache rule","Apache rules",p,"redirection")),value:r.rules||0})),(0,l.jsx)(vb,{title:t.name,badge:(0,i.__)("File","redirection"),meta:[{label:(0,i.__)("Import type","redirection"),value:s,description:o||void 0},...e],stats:n,wrapped:!1})})(),(0,l.jsx)("div",{className:"import-source-card__actions",children:(0,l.jsx)("button",{type:"button",className:"button-secondary",onClick:d,disabled:a,children:(0,i.__)("Clear file","redirection")})})]})]})},Nb=function({activeImportType:e,activePluginId:t,file:r,disabled:n=!1,deleteSource:o,duplicateMode:s,group:a,groupRows:c,fileInfo:u,isJsonFile:d,selectedSections:p,onChange:h}){const f=fd(c),m="plugin"===e&&("wordpress-old-slugs"===t||"safe-redirect-manager"===t),g="file"===e||"paste"===e,_=g&&r&&d(r)?[{value:"0",label:(0,i.__)("Use groups in file","redirection")},...f]:f,y=g&&"json"===u?.format&&u.valid&&u.contents?u.contents:null,v=g&&"csv"===u?.format&&u.valid&&!0===u.importSupported,b=g&&"apache"===u?.format&&u.valid,x=y?Number(y.redirects||0)>0&&p.includes("redirects"):"plugin"===e||v||b,w=null!==y||x||m;return(0,l.jsxs)("fieldset",{className:"groups inline-edit-row",disabled:n,children:[(0,l.jsx)("h3",{children:(0,i.__)("Import options","redirection")}),!w&&(0,l.jsx)("p",{children:(0,i.__)("Select an import source to see available options.","redirection")}),y&&(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Contents","redirection")}),(0,l.jsx)("div",{className:"groups__control groups__control--stacked",children:Object.entries(y).map(([e,t])=>(0,l.jsxs)("label",{className:"groups__checkbox",htmlFor:`import_section_${e}`,children:[(0,l.jsx)("input",{id:`import_section_${e}`,type:"checkbox",name:`import_section_${e}`,checked:p.includes(e),onChange:h,disabled:n})," ",(0,l.jsxs)("span",{children:["settings"===e&&(0,i.__)("Settings","redirection"),"groups"===e&&(0,i.__)("Groups","redirection"),"redirects"===e&&(0,i.__)("Redirects","redirection"),"logs"===e&&(0,i.__)("Redirect logs","redirection"),"errors_404"===e&&(0,i.__)("404 logs","redirection")," (",t,")"]})]},e))})]}),x&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Group","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsx)(wn,{items:_,name:"group",value:String(a),onChange:h,disabled:n})})]}),(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Duplicates","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsx)(wn,{items:[{value:"import",label:(0,i.__)("Do not check duplicates","redirection")},{value:"ignore",label:(0,i.__)("Ignore duplicates","redirection")},{value:"update",label:(0,i.__)("Update duplicates","redirection")}],name:"duplicate_mode",value:s,onChange:h,disabled:n})})]})]}),m&&(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Delete original data","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsxs)("label",{className:"groups__checkbox",htmlFor:"delete_source",children:[(0,l.jsx)("input",{id:"delete_source",type:"checkbox",name:"delete_source",checked:o,onChange:h,disabled:n})," ",(0,l.jsx)("span",{children:(0,i.__)("Remove the original redirect data after import","redirection")})]})})]})]})},Ob=function({activeImportType:e,lastImport:t,lastImportWasDryRun:r}){if(!1===t)return null;const n=!0===r;let o=[];0===t.created&&0===t.updated&&t.ignored>0?o=[{label:(0,i.__)("Status","redirection"),value:n?(0,i.__)("All matching redirects would be ignored.","redirection"):(0,i.__)("All matching redirects were ignored.","redirection")}]:0===t.created&&0===t.updated&&0===t.groups_created&&0===t.groups_updated&&0===t.groups_ignored&&0===t.logs_imported&&0===t.errors_imported&&0===t.settings_imported&&(o=[{label:(0,i.__)("Status","redirection"),value:n?(0,i.__)("No redirects were found to preview.","redirection"):(0,i.__)("No redirects were imported.","redirection")}]),n&&(o=o.concat([{label:(0,i.__)("Mode","redirection"),value:(0,i.__)("Preview only. No changes have been made.","redirection")}]));const s=[{label:(0,i._n)("Redirect created","Redirects created",t.created,"redirection"),value:t.created},{label:(0,i._n)("Redirect updated","Redirects updated",t.updated,"redirection"),value:t.updated},{label:(0,i._n)("Redirect ignored","Redirects ignored",t.ignored,"redirection"),value:t.ignored},{label:(0,i._n)("Group created","Groups created",t.groups_created,"redirection"),value:t.groups_created},{label:(0,i._n)("Group updated","Groups updated",t.groups_updated,"redirection"),value:t.groups_updated},{label:(0,i._n)("Group ignored","Groups ignored",t.groups_ignored,"redirection"),value:t.groups_ignored},{label:(0,i._n)("Log imported","Logs imported",t.logs_imported,"redirection"),value:t.logs_imported},{label:(0,i._n)("404 log imported","404 logs imported",t.errors_imported,"redirection"),value:t.errors_imported},{label:(0,i._n)("Setting imported","Settings imported",t.settings_imported,"redirection"),value:t.settings_imported}],a=e=>{return"updated"===e.result&&e.redirect_id?(0,l.jsx)("a",{href:(t=e.redirect_id,t?window.Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+t:""),children:e.source||" "}):e.source||" ";var t};return(0,l.jsx)("div",{className:"file-sniff",children:(0,l.jsx)(vb,{title:n?(0,i.__)("Preview results","redirection"):(0,i.__)("Import results","redirection"),badge:(0,i.__)("Success","redirection"),meta:o,stats:s,variant:"success",children:null!==e&&t.preview.length>0&&(0,l.jsx)("div",{className:"io-preview-table",children:(0,l.jsxs)("table",{className:"wp-list-table widefat fixed striped items table-auto inline-edit-row",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Source","redirection")}),(0,l.jsx)("th",{children:(0,i.__)("Target","redirection")}),(0,l.jsx)("th",{className:"io-preview-table__code",children:(0,i.__)("HTTP","redirection")}),(0,l.jsx)("th",{className:"io-preview-table__regex",children:(0,i.__)("Regex","redirection")}),(0,l.jsx)("th",{children:(0,i.__)("Group","redirection")})]})}),(0,l.jsx)("tbody",{children:t.preview.map((e,t)=>(0,l.jsxs)("tr",{className:"ignored"===e.result?"io-preview-table__row--ignored":void 0,children:[(0,l.jsx)("td",{children:a(e)}),(0,l.jsx)("td",{children:e.target||" "}),(0,l.jsx)("td",{className:"io-preview-table__code",children:e.code||""}),(0,l.jsx)("td",{className:"io-preview-table__regex",children:e.regex?(0,i.__)("Yes","redirection"):(0,i.__)("No","redirection")}),(0,l.jsx)("td",{children:e.group||""})]},`${e.source}-${e.target}-${t}`))})]})})})})},Ab=function({activeImportType:e,isImporting:t,pasteInfo:r,pasteText:n,onClearPaste:o,onPasteTextChange:s,onSelect:a}){const c="paste"===e&&n.trim().length>0,u=()=>{const e=new Blob([n]).size;return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`};return(0,l.jsxs)(vb,{title:(0,i.__)("Copy/paste","redirection"),badge:(0,i.__)("Paste","redirection"),meta:(()=>{const e=[{label:(0,i.__)("Import type","redirection"),value:(0,i.__)("Paste redirects or export data","redirection")},{label:(0,i.__)("Supported formats","redirection"),value:(0,i.__)("CSV, JSON, and .htaccess","redirection")}];if(0===n.trim().length||null===r||!r.valid)return e;let t=(0,i.__)("CSV","redirection");return"json"===r.format?t=(0,i.__)("JSON","redirection"):"apache"===r.format&&(t=(0,i.__)("Apache .htaccess","redirection")),e[0]={label:(0,i.__)("Import type","redirection"),value:t},e[1]={label:(0,i.__)("Details","redirection"),value:u()},"json"===r.format&&r.version&&e.push({label:(0,i.__)("Plugin version","redirection"),value:r.version}),"csv"===r.format&&e.push({label:(0,i.__)("Separator","redirection"),value:"csv"===r?.format&&r.separator?","===r.separator?(0,i.__)("Comma","redirection"):";"===r.separator?(0,i.__)("Semicolon","redirection"):"|"===r.separator?(0,i.__)("Pipe","redirection"):(0,i.__)("Tab","redirection"):""}),"apache"===r.format&&e.push({label:(0,i.__)("Contains","redirection"),value:(0,i.__)("Apache redirect rules","redirection")}),e})(),stats:(()=>{if(0===n.trim().length||null===r||!r.valid)return[];if("json"===r.format){const e=[];return void 0!==r.contents?.groups&&e.push({label:(0,i._n)("Group","Groups",r.contents.groups||0,"redirection"),value:r.contents.groups||0}),void 0!==r.contents?.redirects&&e.push({label:(0,i._n)("Redirect","Redirects",r.contents.redirects||0,"redirection"),value:r.contents.redirects||0}),void 0!==r.contents?.logs&&e.push({label:(0,i._n)("Log","Logs",r.contents.logs||0,"redirection"),value:r.contents.logs||0}),void 0!==r.contents?.errors_404&&e.push({label:(0,i._n)("404 log","404 logs",r.contents.errors_404||0,"redirection"),value:r.contents.errors_404||0}),void 0!==r.contents?.settings&&e.push({label:(0,i.__)("Settings","redirection"),value:r.contents.settings||0}),e}return"apache"===r.format?[{label:(e=r,t=r.rules||0,e.ruleTypes?.includes("rewrite")&&1===e.ruleTypes.length?(0,i._n)("Rewrite rule","Rewrite rules",t,"redirection"):e.ruleTypes?.includes("redirect")&&1===e.ruleTypes.length?(0,i._n)("Redirect rule","Redirect rules",t,"redirection"):e.ruleTypes?.includes("redirectmatch")&&1===e.ruleTypes.length?(0,i._n)("RedirectMatch rule","RedirectMatch rules",t,"redirection"):(0,i._n)("Apache rule","Apache rules",t,"redirection")),value:r.rules||0}]:[{label:(o=r,s=r.rows||0,"groups"===o.type?(0,i._n)("Group","Groups",s,"redirection"):"logs"===o.type?(0,i._n)("Log","Logs",s,"redirection"):"errors_404"===o.type?(0,i._n)("404 log","404 logs",s,"redirection"):(0,i._n)("Redirect","Redirects",s,"redirection")),value:r.rows||0}];var e,t,o,s})(),className:h("import-source-card","import-source-card--paste",{"import-source-card--active":c}),actions:n.trim().length>0?(0,l.jsx)("button",{type:"button",className:"button-secondary",onClick:o,disabled:t,children:(0,i.__)("Clear pasted content","redirection")}):void 0,children:[(0,l.jsx)("div",{className:"import-source-card__textarea-wrap",children:(0,l.jsx)("textarea",{className:"import-source-card__textarea",value:n,onChange:e=>s(e.currentTarget.value),onFocus:a,placeholder:(0,i.__)("Paste redirects or a Redirection export here","redirection"),rows:8,disabled:t})}),n.trim().length>0&&null!==r&&!r.valid&&(0,l.jsx)("div",{className:"inline-notice inline-error",children:(0,l.jsx)("p",{children:"not-redirection-json"===r?.error?(0,i.__)("Not a Redirection JSON export","redirection"):"invalid-json"===r?.error?(0,i.__)("Invalid JSON","redirection"):"empty-csv"===r?.error?(0,i.__)("Empty CSV content","redirection"):"separator-not-detected"===r?.error?(0,i.__)("Unable to detect a CSV separator","redirection"):"unknown-csv-layout"===r?.error?(0,i.__)("Unknown CSV layout","redirection"):"unknown-apache-layout"===r?.error?(0,i.__)("Unknown Apache .htaccess layout","redirection"):(0,i.__)("Unsupported pasted content","redirection")})})]})},Ib=function(){const{state:e,fileInputRef:t,importingStatus:r,onAddFileClick:n,onCancel:s,onClearFile:a,onClearPaste:c,onDragEnter:u,onDragLeave:d,onDragOver:p,onDrop:f,onFileInputChange:m,onImport:g,onOptionsChange:_,onSelectFileImporter:y,onSelectPasteImporter:v,onPasteTextChange:b,onSelectPlugin:x}=function(){const[e,t]=(0,o.useState)(null),[r,n]=(0,o.useState)(null),[s,a]=(0,o.useState)(0),[l,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[p,h]=(0,o.useState)(!1),[f,m]=(0,o.useState)(""),[g,_]=(0,o.useState)("import"),[y,v]=(0,o.useState)(!1),[b,x]=(0,o.useState)([]),[w,j]=(0,o.useState)(null),[S,k]=(0,o.useState)(null),[C,T]=(0,o.useState)(!1),[E,R]=(0,o.useState)(!1),[P,N]=(0,o.useState)(null),O=(0,o.useRef)(null),A=(0,o.useRef)(0),I=(0,o.useRef)(!1),{data:F,isSuccess:D,refetch:L}=ud({}),z=F?.items??[],M=z.length>0,{data:$=[],isLoading:U}=on(),B=$,q=sn({onSuccess:(e,t)=>{const r="preview"===t.mode,n=e;R({created:0,updated:0,ignored:0,groups_created:0,groups_updated:0,groups_ignored:0,logs_imported:0,errors_imported:0,settings_imported:0,preview:[],...n,preview:n.preview||[]}),N(r)}}),H=q.isPending,W=q.error||null,G=!1!==E&&!1===P,V=B.find(e=>e.id===r)||null,Z="paste"===e?p:u,Q="file"===e||"paste"===e?!1!==Z:null!==V,K="file"===e||"paste"===e||!0===V?.preview_supported;let J="idle";H?J="loading":q.isSuccess&&(J="success"),(0,o.useEffect)(()=>()=>{d(!1),h(!1),m(""),t(null),n(null),R(!1),N(null)},[]),(0,o.useEffect)(()=>{M?I.current=!1:D&&!I.current&&(I.current=!0,L())},[M,D,L]),(0,o.useEffect)(()=>{let e=!0;return!1===u?(j(null),T(!1),void x([])):(T(!0),j(null),async function(e){const t=await e.text();return wb(e)?kb(t):e.name.toLowerCase().endsWith(".csv")?Cb(t):e.name.toLowerCase().endsWith(".htaccess")?Sb(t):{format:"other",valid:!1,error:"unsupported-file-type"}}(u).then(t=>{e&&(j(t),"json"===t.format&&t.valid&&t.contents&&x(Object.keys(t.contents)))}).catch(()=>{e&&j({format:wb(u)?"json":"other",valid:!1,error:"read-failed"})}).finally(()=>{e&&T(!1)}),()=>{e=!1})},[u]),(0,o.useEffect)(()=>{if(0===f.trim().length)return h(!1),k(null),void("paste"===e&&x([]));const t=jb(f);var r,n;k(t),h((r=f,"json"===(n=t.format)?new File([r],"pasted-import.json",{type:"application/json"}):"csv"===n?new File([r],"pasted-import.csv",{type:"text/csv"}):"apache"===n?new File([r],"pasted-import.htaccess",{type:"text/plain"}):new File([r],"pasted-import.txt",{type:"text/plain"}))),"json"===t.format&&t.valid&&t.contents?x(Object.keys(t.contents)):x([])},[f,e]);const Y=e=>{q.reset(),R(!1),N(null),d(e),t("file"),n(null),x([]),e&&wb(e)?a(0):z[0]&&a(z[0].id)},X=()=>{q.reset(),c(!1),d(!1),"file"===e&&t(null),R(!1),N(null),O.current&&(O.current.value="")},ee=()=>{q.reset(),h(!1),m(""),k(null),"paste"===e&&t(null),x([]),R(!1),N(null)};return{state:{activeImportType:e,activePluginId:r,group:s,hover:l,file:u,duplicateMode:g,deleteSource:y,fileInfo:w,pasteFile:p,pasteText:f,pasteInfo:S,isSniffing:C,currentError:W,selectedSections:b,lastImport:E,lastImportWasDryRun:P,groupRows:z,hasGroups:M,importers:B,isLoadingImporters:U,isImporting:H,hasCompletedImport:G,hasActiveImport:Q,previewSupported:K},fileInputRef:O,importingStatus:J,onAddFileClick:()=>{O.current?.click()},onCancel:()=>{q.reset(),t(null),n(null),_("import"),v(!1),X(),ee()},onClearFile:X,onClearPaste:ee,onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),"loading"!==J&&e.dataTransfer.types.includes("Files")&&(A.current+=1,c(!0))},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),A.current>0&&(A.current-=1),0===A.current&&c(!1)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),A.current=0,c(!1),"loading"!==J&&e.dataTransfer.files.length>0&&Y(e.dataTransfer.files[0]||!1)},onFileInputChange:e=>{const t=e.target.files;t&&t.length>0&&Y(t[0]||!1)},onImport:(t=!1)=>{const r=(o=t?"preview":"import","file"!==e&&"paste"!==e||!Z?"plugin"===e&&V?{sourceType:"plugin",mode:o,pluginId:V.id,groupId:s,duplicateMode:g,deleteSource:y}:null:{sourceType:"file",mode:o,file:Z,groupId:s,duplicateMode:g,deleteSource:y,importSections:b}),n=V?.name||"";var o;if(!r)return;const a=function(e){return"plugin"===e.sourceType&&"import"===e.mode&&!0===e.deleteSource&&("wordpress-old-slugs"===e.pluginId||"safe-redirect-manager"===e.pluginId)}(r)?(0,i.__)("This will import the redirects and delete the original data. Are you sure?","redirection"):(0,i.sprintf)(
// translators: %s is the plugin name
// translators: %s is the plugin name
(0,i.__)("Are you sure you want to import from %s?","redirection"),n);("plugin"!==r.sourceType||"import"!==r.mode||confirm(a))&&(R(!1),N(null),q.reset(),q.mutate(r))},onOptionsChange:e=>{const{name:t,value:r}=e.currentTarget;if("group"===t)q.reset(),a(parseInt(r,10)),R(!1),N(null);else if("duplicate_mode"===t)q.reset(),_(r),R(!1),N(null);else if("delete_source"===t&&e.currentTarget instanceof HTMLInputElement){const{checked:t}=e.currentTarget;q.reset(),v(t),R(!1),N(null)}else if(t.startsWith("import_section_")&&e.currentTarget instanceof HTMLInputElement){const r=t.replace("import_section_",""),{checked:n}=e.currentTarget;q.reset(),x(e=>n?[...e,r]:e.filter(e=>e!==r)),R(!1),N(null)}},onSelectPasteImporter:()=>{f.trim().length>0&&(q.reset(),t("paste"),n(null),R(!1),N(null))},onPasteTextChange:e=>{const r=e.trim().length>0?jb(e):null;q.reset(),R(!1),N(null),m(e),t(e.trim().length>0?"paste":null),n(null),"json"===r?.format&&r.valid?a(0):e.trim().length>0&&z[0]&&a(z[0].id)},onSelectFileImporter:()=>{!1!==u&&(q.reset(),t("file"),n(null),R(!1),N(null))},onSelectPlugin:i=>{if(q.reset(),R(!1),N(null),"plugin"===e&&r===i.id)return t(null),void n(null);t("plugin"),n(i.id),0===s&&z[0]&&a(z[0].id)}}}(),w="paste"===e.activeImportType?e.pasteFile:e.file,j="paste"===e.activeImportType?e.pasteInfo:e.fileInfo,S=("file"===e.activeImportType||"paste"===e.activeImportType)&&"json"===j?.format&&j.valid&&0===e.selectedSections.length,k=("file"===e.activeImportType||"paste"===e.activeImportType)&&"csv"===j?.format&&j.valid&&!1===j.importSupported,C="json"===j?.format&&j.valid&&j.contents?j.contents:null,T=null!==C&&Number(C.redirects||0)>0&&e.selectedSections.includes("redirects")&&0!==e.group,E="plugin"===e.activeImportType||("file"===e.activeImportType||"paste"===e.activeImportType)&&(T||"csv"===j?.format&&j.valid&&!0===j.importSupported||"apache"===j?.format&&j.valid);return(0,l.jsx)("div",{className:h("redirect-io-page",{"redirect-io-page--dragging":e.hover}),onDragEnter:u,onDragLeave:d,onDragOver:p,onDrop:f,children:(0,l.jsxs)("section",{className:"io-section io-section--import",children:[(0,l.jsx)("p",{children:(0,i.__)("Import redirects from a file or another plugin. You can also drag and drop a file anywhere on this page.","redirection")}),(0,l.jsxs)("div",{className:"inline-notice notice-warning",children:[(0,l.jsx)("p",{children:L((0,i.__)("{{strong}}CSV file format{{/strong}}: {{code}}source URL, target URL{{/code}} - and can be optionally followed with {{code}}regex, http code{{/code}} ({{code}}regex{{/code}} - 0 for no, 1 for yes).","redirection"),{code:(0,l.jsx)("code",{}),strong:(0,l.jsx)("strong",{})})}),(0,l.jsx)("p",{children:(0,i.__)("CSV files need a recognised header otherwise they are assumed to be redirects. Use JSON for full data support.","redirection")})]}),(0,l.jsxs)("div",{className:"import-sources",children:[(0,l.jsx)(Pb,{activeImportType:e.activeImportType,file:e.file,fileInfo:e.fileInfo,fileInputRef:t,hover:e.hover,importingStatus:r,isImporting:e.isImporting,isSniffing:e.isSniffing,onAddFileClick:n,onClearFile:a,onClick:y,onFileInputChange:m}),(0,l.jsx)(Ab,{activeImportType:e.activeImportType,isImporting:e.isImporting,pasteInfo:e.pasteInfo,pasteText:e.pasteText,onClearPaste:c,onPasteTextChange:b,onSelect:v}),e.isLoadingImporters&&(0,l.jsx)(vb,{title:"",className:"import-source-card import-source-card--placeholder",children:(0,l.jsx)(Ml,{})}),e.importers.length>0&&(R=e.importers,(0,l.jsx)(l.Fragment,{children:R.map(t=>(0,l.jsx)(bb,{plugin:t,onSelect:x,isActive:e.activePluginId===t.id&&"plugin"===e.activeImportType,isImporting:e.isImporting},t.id))}))]}),!e.hasCompletedImport&&(0,l.jsx)(Nb,{activeImportType:e.activeImportType,activePluginId:e.activePluginId,file:w,disabled:!e.hasActiveImport||e.isImporting||E&&!e.hasGroups,deleteSource:e.deleteSource,duplicateMode:e.duplicateMode,group:e.group,groupRows:e.groupRows,fileInfo:j,isJsonFile:wb,selectedSections:e.selectedSections,onChange:_}),(0,l.jsx)("div",{className:"import-actions",children:e.hasCompletedImport?(0,l.jsx)("button",{className:"button-secondary",onClick:s,children:(0,i.__)("OK","redirection")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{className:"button-secondary",onClick:()=>g(!0),disabled:!e.hasActiveImport||E&&!e.hasGroups||!e.previewSupported||S||k||e.isImporting||("file"===e.activeImportType||"paste"===e.activeImportType)&&(!1===w||e.isSniffing||null===j||!1===j.valid),children:(0,i.__)("Preview","redirection")})," ",(0,l.jsx)("button",{className:"button-primary",onClick:()=>g(!1),disabled:!e.hasActiveImport||E&&!e.hasGroups||S||k||e.isImporting||("file"===e.activeImportType||"paste"===e.activeImportType)&&(!1===w||e.isSniffing||null===j||!1===j.valid),children:(0,i.__)("Import","redirection")})]})}),e.currentError&&(0,l.jsx)(yb,{error:e.currentError}),(0,l.jsx)(Ob,{activeImportType:e.activeImportType,lastImport:e.lastImport,lastImportWasDryRun:e.lastImportWasDryRun})]})});var R},Fb=function({disabled:e,onView:t,onDownload:r}){return(0,l.jsxs)("div",{className:"import-actions",children:[(0,l.jsx)("button",{type:"button",className:"button-secondary",onClick:t,disabled:e,children:(0,i.__)("View","redirection")})," ",(0,l.jsx)("button",{type:"button",className:"button-primary",onClick:r,disabled:e,children:(0,i.__)("Download","redirection")})]})},Db=function({format:e,availableFormats:t,disabled:r,onChange:n}){return(0,l.jsxs)("div",{className:"export-options__field",children:[(0,l.jsx)("label",{className:"export-options__label",htmlFor:"export-format",children:(0,i.__)("Format","redirection")}),(0,l.jsx)("select",{id:"export-format",value:e,disabled:r,onChange:e=>n(e.target.value),children:t.map(e=>(0,l.jsx)("option",{value:e,children:ev(e)},e))})]})},Lb=function({selectedTypes:e,format:t,availableFormats:r,disabled:n,onChange:o}){const s=e.length>0;return(0,l.jsxs)("div",{className:"groups export-options",children:[(0,l.jsx)("h3",{children:(0,i.__)("Export options","redirection")}),s&&(0,l.jsx)(Db,{format:t,availableFormats:r,disabled:n,onChange:e=>o("format",e)}),!s&&(0,l.jsxs)("div",{className:"export-options__field",children:[(0,l.jsx)("span",{className:"export-options__label",children:(0,i.__)("Format","redirection")}),(0,i.__)("Select one or more export types to choose a format.","redirection")]})]})};function zb(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const Mb=function({lastResult:e}){if(!1===e)return null;const t=[{label:(0,i.__)("Action","redirection"),value:"view"===e.action?(0,i.__)("Viewed in browser","redirection"):(0,i.__)("Downloaded","redirection")},{label:(0,i.__)("Format","redirection"),value:Xy(e.format)},{label:(0,i.__)("Export","redirection"),value:Jy(e.types)},{label:(0,i.__)("File size","redirection"),value:(n=e.data,r=new Blob([n]).size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(1)} MB`)}];var r,n;const o=[];return null!==e.total&&o.push({label:(0,i.__)("Items exported","redirection"),value:zb(e.total)}),(0,l.jsx)("div",{className:"export-results",children:(0,l.jsx)(vb,{title:"view"===e.action?(0,i.__)("View results","redirection"):(0,i.__)("Download ready","redirection"),badge:(0,i.__)("Success","redirection"),meta:t,stats:o,variant:"success",children:"view"===e.action&&(0,l.jsx)("textarea",{className:"module-export",rows:14,readOnly:!0,value:e.data})})})};function $b(e){const t=window.Redirectioni10n?.locale||void 0;return new Intl.NumberFormat(t).format(e)}const Ub=function({meta:e,isPreviewLoading:t,previewTotal:r,previewEstimatedSize:n}){const o=[];let s=(0,i.__)("Preview","redirection");return t?s=(0,i.__)("Loading","redirection"):null!==r&&(o.push({label:(0,i._n)("Item available","Items available",r,"redirection"),value:$b(r)}),null!==n&&o.push({label:(0,i.__)("Approximate file size","redirection"),value:(a=n,a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`)})),(0,l.jsx)(vb,{title:(0,i.__)("Export preview","redirection"),badge:s,meta:e,stats:o});var a},Bb=function({exportTypes:e,selectedTypes:t,redirectScopeType:r,redirectModule:n,redirectGroup:o,groupRows:s,isExporting:a,onChange:c,onToggle:u}){return(0,l.jsx)("div",{className:"export-types",children:e.map(e=>{const d=t.includes(e.id);return(0,l.jsx)(vb,{title:e.name,badge:(0,i.__)("Export","redirection"),meta:[{label:(0,i.__)("Export type","redirection"),value:e.description,fullWidth:!0}],stats:[{label:(0,i._n)("Format","Formats",e.formats.length,"redirection"),value:e.formats.length}],actions:(0,l.jsxs)("label",{className:"groups__checkbox",htmlFor:`export-type-${e.id}`,children:[(0,l.jsx)("input",{id:`export-type-${e.id}`,type:"checkbox",checked:d,onChange:()=>u(e.id),disabled:a}),(0,l.jsx)("span",{children:(0,i.__)("Include in export","redirection")})]}),className:h("import-source-card",{"import-source-card--active":d}),children:"redirect"===e.id&&d&&(0,l.jsxs)("div",{className:"import-source-card__options",children:[(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Scope","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsxs)("select",{value:r,disabled:a,onChange:e=>c("redirectScopeType",e.target.value),children:[(0,l.jsx)("option",{value:"all",children:(0,i.__)("Everything","redirection")}),(0,l.jsx)("option",{value:"module",children:(0,i.__)("Module","redirection")}),(0,l.jsx)("option",{value:"group",children:(0,i.__)("Group","redirection")})]})})]}),"module"===r&&(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Module","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsxs)("select",{value:n,disabled:a,onChange:e=>c("redirectModule",e.target.value),children:[(0,l.jsx)("option",{value:"1",children:(0,i.__)("WordPress redirects","redirection")}),(0,l.jsx)("option",{value:"2",children:(0,i.__)("Apache redirects","redirection")}),(0,l.jsx)("option",{value:"3",children:(0,i.__)("Nginx redirects","redirection")})]})})]}),"group"===r&&(0,l.jsxs)("div",{className:"groups__row",children:[(0,l.jsx)("div",{className:"groups__label",children:(0,i.__)("Group","redirection")}),(0,l.jsx)("div",{className:"groups__control",children:(0,l.jsx)("select",{value:String(o),disabled:a,onChange:e=>c("redirectGroup",e.target.value),children:s.map(e=>(0,l.jsx)("option",{value:e.id,children:e.moduleName?`${e.name} (${e.moduleName})`:e.name},e.id))})})]})]})},e.id)})})},qb=[{id:"redirect",name:(0,i.__)("Redirects","redirection"),description:(0,i.__)("Export redirect rules in Redirection.","redirection"),formats:["json","csv","apache","nginx"]},{id:"log",name:(0,i.__)("Redirect logs","redirection"),description:(0,i.__)("Export redirect activity logs.","redirection"),formats:["json","csv"]},{id:"404",name:(0,i.__)("404 logs","redirection"),description:(0,i.__)("Export 404 request logs.","redirection"),formats:["json","csv"]},{id:"group",name:(0,i.__)("Groups","redirection"),description:(0,i.__)("Export redirect groups and their module assignments.","redirection"),formats:["json","csv"]},{id:"setting",name:(0,i.__)("Settings","redirection"),description:(0,i.__)("Export a portable subset of plugin settings and site-level Redirection options.","redirection"),formats:["json"]}],Hb=function(){const{data:e}=ud({}),t=(0,o.useMemo)(()=>e?.items??[],[e?.items]),[r,n]=(0,o.useState)([]),[s,a]=(0,o.useState)("all"),[l,c]=(0,o.useState)("all"),[u,d]=(0,o.useState)(0),[p,h]=(0,o.useState)("json"),[f,m]=(0,o.useState)(!1),g=an({onSuccess:(e,t)=>{m({action:t.download?"download":"view",types:t.exportTypes||[t.exportType],format:t.format,data:e.data,total:e.total})}}),_=r.length>0,y=r.length===qb.length,v=r[0]||"redirect",b=r.includes("redirect"),x=function(e,t){return pt({queryKey:["export-preview",e],queryFn:async()=>{const t=await St(function(e){if(rn(e.exportTypes)){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Vt({types:e.exportTypes,scope_type:t,scope_value:nn(t,r,n),format:e.format||"json"})}if("redirect"===e.exportType){const t=e.redirectScopeType||"all",r=e.redirectModule||"all",n=e.redirectGroup||0;return Wt({scope_type:t,scope_value:nn(t,r,n),format:e.format||"json"})}return"log"===e.exportType?Kt({format:e.format||"json"}):Yt({format:e.format||"json"})}(e));return{total:Number(t.total??0),estimatedSize:Number(t.estimated_size??0)}},...t})}({exportType:v,exportTypes:r,format:p,redirectScopeType:s,redirectModule:l,redirectGroup:u},{enabled:!1}),w=(0,o.useMemo)(()=>{if(0===r.length)return[];if(1!==r.length)return["json"];const e=qb.find(e=>e.id===r[0]);return e?.formats??["json"]},[r]),j=t.find(e=>e.id===u)||null,S=g.isPending,k=x.isLoading||x.isFetching,C=x.refetch,T=g.error||null,E=!_||x.isError||"number"!=typeof x.data?.total?null:x.data.total,R=!_||x.isError||"number"!=typeof x.data?.estimatedSize?null:x.data.estimatedSize,P=[{label:(0,i.__)("Export","redirection"),value:_?Jy(r):(0,i.__)("No export selected","redirection")}];var N,O;b&&(P.push({label:(0,i.__)("Scope","redirection"),value:(N=s,O=j?j.name:(0,i.__)("Group","redirection"),"module"===N?(0,i.__)("Module","redirection"):"group"===N?O:(0,i.__)("Everything","redirection"))}),"module"===s&&P.push({label:(0,i.__)("Module","redirection"),value:Yy(l)})),_&&P.push({label:(0,i.__)("Format","redirection"),value:Xy(p)}),(0,o.useEffect)(()=>{0===u&&t[0]&&d(t[0].id)},[t,u]),(0,o.useEffect)(()=>{"module"===s&&"all"===l&&c("1"),"group"===s&&t[0]&&!t.some(e=>e.id===u)&&d(t[0].id)},[t,u,l,s]),(0,o.useEffect)(()=>{0!==w.length&&(w.includes(p)||h(w[0]||"json"))},[w,p]),(0,o.useEffect)(()=>{_&&C()},[_,p,v,s,l,u,r,C]);const A=e=>{if(0===r.length)return;const t={message:"download"===e?(0,i.__)("Export downloaded","redirection"):(0,i.__)("Export viewed","redirection")},n={exportType:v,exportTypes:r,format:p,redirectScopeType:s,redirectModule:l,redirectGroup:u,download:"download"===e,completionNotice:t};"download"===e&&(n.filename=function(e,t){return 1===e.length&&e[0]?tv(e[0],t):`redirection-export.${t}`}(r,p)),g.mutate(n)};return{exportTypes:qb,availableFormats:w,groupRows:t,summaryMeta:P,hasAllTypesSelected:y,hasSelectedTypes:_,state:{selectedTypes:r,redirectScopeType:s,redirectModule:l,redirectGroup:u,format:p,isExporting:S,isPreviewLoading:k,previewTotal:E,previewEstimatedSize:R,currentError:T,lastResult:f},onChange:(e,r)=>{if(g.reset(),"redirectScopeType"===e){const e=r;a(e),"module"===e&&"all"===l&&c("1"),"group"===e&&t[0]&&0===u&&d(t[0].id)}else"redirectModule"===e?c(r):"redirectGroup"===e?d(Number(r)):h(r);m(!1)},onToggleType:e=>{g.reset(),n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),m(!1)},onToggleAllTypes:e=>{g.reset(),n(e?qb.map(e=>e.id):[]),m(!1)},onDownload:()=>A("download"),onView:()=>A("view")}},Wb=function(){const{exportTypes:e,availableFormats:t,groupRows:r,hasAllTypesSelected:n,hasSelectedTypes:o,summaryMeta:s,state:a,onChange:c,onDownload:u,onToggleAllTypes:d,onToggleType:p,onView:h}=Hb();return(0,l.jsx)("div",{className:"redirect-io-page",children:(0,l.jsxs)("section",{className:"io-section io-section--export",children:[(0,l.jsx)("p",{children:(0,i.__)("Export redirects, redirect logs, 404 logs, groups, or settings. You can combine multiple export cards, and mixed exports are bundled as JSON.","redirection")}),(0,l.jsx)("div",{className:"inline-notice notice-warning",children:(0,l.jsx)("p",{children:(0,i.__)("You can also export directly from the redirects, redirect logs, or 404 logs pages for more control over filtering.","redirection")})}),(0,l.jsx)("div",{className:"export-types-toggle",children:(0,l.jsxs)("label",{className:"groups__checkbox",htmlFor:"export-types-toggle-all",children:[(0,l.jsx)("input",{id:"export-types-toggle-all",type:"checkbox",checked:n,onChange:e=>d(e.target.checked),disabled:a.isExporting}),(0,l.jsx)("span",{children:(0,i.__)("Select all","redirection")})]})}),(0,l.jsx)(Bb,{exportTypes:e,selectedTypes:a.selectedTypes,redirectScopeType:a.redirectScopeType,redirectModule:a.redirectModule,redirectGroup:a.redirectGroup,groupRows:r,isExporting:a.isExporting,onChange:c,onToggle:p}),(0,l.jsx)(Lb,{selectedTypes:a.selectedTypes,format:a.format,availableFormats:t,disabled:a.isExporting||!o,onChange:(e,t)=>c(e,t)}),a.currentError&&(0,l.jsx)(yb,{error:a.currentError}),(0,l.jsx)("div",{className:"export-summary",children:(0,l.jsx)(Ub,{meta:s,isPreviewLoading:a.isPreviewLoading,previewTotal:a.previewTotal,previewEstimatedSize:a.previewEstimatedSize})}),(0,l.jsx)(Fb,{disabled:a.isExporting||!o,onView:h,onDownload:u}),a.isExporting&&(0,l.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})}),!a.isExporting&&(0,l.jsx)(Mb,{lastResult:a.lastResult})]})})},Gb=()=>[{value:"name",label:(0,i.__)("Name","redirection")},{value:"module",label:(0,i.__)("Module","redirection")},{value:"status",label:(0,i.__)("Status","redirection")},{value:"redirects",label:(0,i.__)("Redirects","redirection")}],Vb=e=>[{label:(0,i.__)("Status","redirection"),value:"status",options:[{label:(0,i.__)("Enabled","redirection"),value:"enabled"},{label:(0,i.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,i.__)("Module","redirection"),value:"module",options:e}];function Zb(e){const t=u(),{incrementProgress:r,decrementProgress:n,addNotice:i,addError:o}=tn(),{setGroupsTable:s}=U_();return mt({mutationFn:async({action:e,items:i,params:o={}})=>{r();try{return await t.cancelQueries({queryKey:Xr.groups.lists()}),await St(or(e,{items:i},o))}catch(e){throw n(),Yr(e)}},onSuccess:(e,r)=>{n();let o=r.action;"enable"===r.action?o="enabled":"disable"===r.action&&(o="disabled"),i(`Groups ${o}`),s({page:0,selected:[],selectAll:!1}),t.invalidateQueries({queryKey:Xr.groups.lists()})},onError:e=>{o(e.message||"Failed to perform group action")},...e})}const Qb=[{value:1,label:"WordPress"},{value:2,label:"Apache"},{value:3,label:"Nginx"}];function Kb(){return Qb}const Jb=function(e){const{disabled:t}=e,[r,n]=(0,o.useState)(""),[s,a]=(0,o.useState)(1),{mutate:c}=function(){const e=u(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return mt({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.groups.lists()});const t=await St(Lt(n));return id.parse(t).items[0]??null}catch(e){throw r(),Yr(e)}},onSuccess:()=>{r(),n("Group created"),e.invalidateQueries({queryKey:Xr.groups.lists()})},onError:e=>{i(e.message||"Failed to create group")}})}();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:(0,i.__)("Add Group","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Use groups to organise your redirects. Groups are assigned to a module, which affects how the redirects in that group work. If you are unsure then stick to the WordPress module.","redirection")}),(0,l.jsxs)("form",{onSubmit:function(e){e.preventDefault(),c({name:r,moduleId:s,position:0}),n("")},children:[(0,l.jsx)("table",{className:"form-table redirect-groups inline-edit-row",children:(0,l.jsx)("tbody",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Name","redirection")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("input",{size:30,className:"regular-text",type:"text",name:"name",value:r,onChange:e=>n(e.target.value),disabled:t}),(0,l.jsx)(wn,{name:"group",value:String(s),onChange:e=>a(parseInt(e.target.value,10)),items:Kb().map(e=>({label:e.label,value:String(e.value)})),disabled:t})," ",(0,l.jsx)("span",{className:"table-actions",children:(0,l.jsx)($l,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:t||""===r,children:(0,i.__)("Add","redirection")})})]})]})})}),2===s&&(0,l.jsx)("p",{children:(0,i.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")})]})]})},Yb=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:o}=Zb(),{setRowMode:s,rowMode:a}=r,{id:c,enabled:u}=n,d=[];return"edit"===a?null:(Cy(Py)&&d.push((0,l.jsx)(Ay,{onClick:()=>s("edit"!==a&&"edit"),children:(0,i.__)("Edit","redirection")},"0")),Cy("redirection_cap_group_delete")&&d.push((0,l.jsx)(Ay,{onClick:()=>{window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection"))&&o({action:"delete",items:[c]})},children:(0,i.__)("Delete","redirection")},"1")),Cy(Ey)&&d.push((0,l.jsx)(Ay,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[group]")+"="+c,children:(0,i.__)("View Redirects","redirection")},"2")),Cy(Py)&&(u?d.push((0,l.jsx)(Ay,{onClick:()=>o({action:"disable",items:[c]}),children:(0,i.__)("Disable","redirection")},"3")):d.push((0,l.jsx)(Ay,{onClick:()=>o({action:"enable",items:[c]}),children:(0,i.__)("Enable","redirection")},"3"))),(0,l.jsx)(Oy,{disabled:t,actions:d}))},Xb=function({row:e}){const{enabled:t}=e;return t?(0,l.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,l.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},ex=function({row:e,filters:t}){const{enabled:r,name:n}=e;return r?(0,l.jsx)(Zy(),{searchWords:[t.name],textToHighlight:n,autoEscape:!0}):(0,l.jsx)("s",{children:n})},tx=function({row:e}){const{module_id:t}=e,r=function(e){const t=Qb.find(t=>t.value===e);return t?t.label:"WordPress"}(t),{setGroupsTable:n}=U_();return(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(Lu,{onClick:()=>n({filterBy:{module:String(t)},page:0}),title:(0,i.sprintf)(
// translators: %(type)s is the module type name
// translators: %(type)s is the module type name
(0,i.__)("Filter on: %(type)s","redirection"),{type:r}),children:r})})},rx=function(e){const{group:t,onCancel:r}=e,[n,s]=(0,o.useState)(t.name),[a,c]=(0,o.useState)(t.module_id),{mutate:d}=function(){const e=u(),{incrementProgress:t,decrementProgress:r,addNotice:n,addError:i}=tn();return mt({mutationFn:async n=>{t();try{await e.cancelQueries({queryKey:Xr.groups.lists()});const{id:t,...r}=n,i=await St(Dt(t,r));return od.parse(i).item}catch(e){throw r(),Yr(e)}},onSuccess:t=>{r(),n("Group saved"),e.invalidateQueries({queryKey:Xr.groups.lists()}),e.invalidateQueries({queryKey:Xr.groups.detail(t.id)})},onError:e=>{i(e.message||"Failed to update group")}})}();return(0,l.jsx)("form",{onSubmit:function(e){e.preventDefault(),e.stopPropagation(),r(),d({id:t.id,name:n,moduleId:a})},children:(0,l.jsx)("table",{className:"edit-groups inline-edit-row",children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Name","redirection")}),(0,l.jsx)("td",{children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"name",value:n,onChange:e=>s(e.target.value)})})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,i.__)("Module","redirection")}),(0,l.jsx)("td",{children:(0,l.jsx)(wn,{name:"module_id",value:String(a),onChange:e=>c(parseInt(e.target.value,10)),items:Kb().map(e=>({label:e.label,value:String(e.value)}))})})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{}),(0,l.jsxs)("td",{children:[(0,l.jsxs)("div",{className:"table-actions",children:[(0,l.jsx)($l,{isPrimary:!0,isSecondary:!1,isSubmit:!0,children:(0,i.__)("Save","redirection")})," ",(0,l.jsx)($l,{onClick:r,children:(0,i.__)("Cancel","redirection")})]}),2===a&&(0,l.jsxs)("p",{children:[(0,l.jsx)("br",{}),(0,i.__)("Note that you will need to set the Apache module path in your Redirection options.","redirection")]})]})]})]})})})};function nx(e){return e.includes("name")?e:e.concat(["name"])}const ix=function(){const e=U_(e=>e.groups),{setGroupsTable:t,setGroupsSelected:r}=U_();Z_({table:e,setTable:t,allowedOrder:["name","id"],allowedFilters:["name","status","module"],defaultOrder:"name",pageName:"groups"});const n=Zb(),o=an(),{data:s,isLoading:a}=ud(e),c=s?.items??[],u=s?.total??0,d=a&&!s?"loading":"complete",p={displayFilters:Gb(),displayGroups:[{value:"standard",label:(0,i.__)("Standard Display","redirection"),grouping:["name","module","redirects"]},{value:"minimal",label:(0,i.__)("Compact Display","redirection"),grouping:["name"]},{value:"all",label:(0,i.__)("Display All","redirection"),grouping:Gb().map(e=>e.value)}],searchOptions:[{name:"name",title:(0,i.__)("Search","redirection")}],groupBy:[],bulk:[{id:"delete",name:(0,i.__)("Delete","redirection")},{id:"enable",name:(0,i.__)("Enable","redirection")},{id:"disable",name:(0,i.__)("Disable","redirection")},{id:"export-csv",name:(0,i.__)("Export as CSV","redirection")},{id:"export-json",name:(0,i.__)("Export as JSON","redirection")}],rowFilters:Vb(Kb().map(e=>({label:e.label,value:`${e.value}`}))),headers:[{name:"status",title:(0,i.__)("Status","redirection"),sortable:!1},{name:"name",title:(0,i.__)("Name","redirection"),primary:!0},{name:"redirects",title:(0,i.__)("Redirects","redirection"),sortable:!1},{name:"module",title:(0,i.__)("Module","redirection"),sortable:!1}].filter(t=>function(e,t){return t.displaySelected?.includes(e)??!1}(t.name,e)),validateDisplay:nx},h={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;if("export-csv"===t||"export-json"===t){const r=cd(e.selectAll?{global:!0,filterBy:e.filterBy}:{items:e.selected});return void o.mutate({exportType:"group",format:"export-csv"===t?"csv":"json",download:!0,filename:tv("group","export-csv"===t?"csv":"json"),params:r})}if("delete"===t){const t=e.selectAll?(0,i.__)("Are you sure you want to delete all items?","redirection"):(0,i.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}const r=e.selected;if(e.selectAll){const r={global:!0,filterBy:e.filterBy};n.mutate({action:t,items:[],params:r})}else n.mutate({action:t,items:r})},onSelect:n=>{const i=e.selected;"boolean"==typeof n?r(n?c.map(e=>e.id):[]):Array.isArray(n)?r(n):i.includes(n)?t({selected:i.filter(e=>e!==n),selectAll:!1}):t({selected:[...i,n],selectAll:!1})},onSetOrder:(e,r)=>{t({orderby:e,direction:r})},onFilter:e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},onSetDisplay:(e,r)=>{t({displayType:e,displaySelected:r})},onSetAll:e=>{t({selected:e?c.map(e=>e.id):[],selectAll:e})},onGroup:e=>{t({groupBy:e,page:0,selected:[],selectAll:!1})}},f={page:e.page,perPage:e.per_page,orderBy:e.orderby,direction:e.direction,selected:e.selected,selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:e.displaySelected??[],groupBy:e.groupBy??""};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ky,{logOptions:p,logActions:h,table:f,status:d,total:u,rows:c,saving:[],getRow:(e,t)=>function(e,t){const{redirects:r}=e,{rowMode:n,setRowMode:i}=t;return[{name:"status",content:(0,l.jsx)(Xb,{row:e})},{name:"name",content:"edit"===n?(0,l.jsx)(rx,{group:e,onCancel:()=>i(!1)}):(0,l.jsx)(ex,{row:e,filters:t.table.filterBy})},{name:"redirects",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(r)},{name:"module",content:(0,l.jsx)(tx,{row:e})}]}(e,t),getRowActions:(e,t)=>(0,l.jsx)(Yb,{disabled:!1,row:e,rowParams:t})}),Cy(Py)&&(0,l.jsx)(Jb,{disabled:!1})]})},ox=()=>[{value:"source",label:(0,i.__)("Source","redirection")},{value:"flags",label:(0,i.__)("URL options","redirection")},{value:"query",label:(0,i.__)("Query Parameters","redirection")},{value:"title",label:(0,i.__)("Title","redirection")},{value:"target",label:(0,i.__)("Target","redirection")},{value:"code",label:(0,i.__)("HTTP code","redirection")},{value:"match_type",label:(0,i.__)("Match Type","redirection")},{value:"position",label:(0,i.__)("Position","redirection")},{value:"last_count",label:(0,i.__)("Hits","redirection")},{value:"last_access",label:(0,i.__)("Last Access","redirection")},{value:"status",label:(0,i.__)("Status","redirection")},{value:"action_type",label:(0,i.__)("Action Type","redirection")},{value:"group",label:(0,i.__)("Group","redirection")}],sx=function(e){const{addTop:t}=e,r=h({"add-new":!0,edit:!0,addTop:t});return(0,l.jsxs)(l.Fragment,{children:[!t&&Cy(Ry)&&(0,l.jsx)("h2",{children:(0,i.__)("Add redirect","redirection")}),(0,l.jsx)("div",{className:r,children:(0,l.jsx)(pb,{item:gv("",0,e.defaultFlags),saveButton:(0,i.__)("Add redirect","redirection"),autoFocus:!!t})})]})},ax=function(e){const{disabled:t,rowParams:r,row:n}=e,{mutate:o}=ub(),{mutate:s}=db("disable"),{mutate:a}=db("enable"),{setRowMode:c,rowMode:u}=r,{id:d,enabled:p,regex:h,action_type:f,match_type:m}=n,g=[];return"edit"===u?null:(Cy(Ry)&&g.push((0,l.jsx)(Ay,{onClick:()=>c("edit"),children:(0,i.__)("Edit","redirection")},"1")),Cy("redirection_cap_redirect_delete")&&g.push((0,l.jsx)(Ay,{onClick:()=>{window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection"))&&o({items:[d]})},children:(0,i.__)("Delete","redirection")},"2")),Cy(Ry)&&(p?g.push((0,l.jsx)(Ay,{onClick:()=>s({items:[d]}),children:(0,i.__)("Disable","redirection")},"3")):g.push((0,l.jsx)(Ay,{onClick:()=>a({items:[d]}),children:(0,i.__)("Enable","redirection")},"4"))),!p||h||"url"!==f||"url"!==m&&"server"!==m||g.push((0,l.jsx)(Ay,{onClick:()=>c("check"),children:(0,i.__)("Check Redirect","redirection")},"5")),(0,l.jsx)(Oy,{disabled:t,actions:g}))},lx=function({row:e}){const{enabled:t}=e;return t?(0,l.jsx)("div",{className:"redirect-status redirect-status__enabled",children:"✓"}):(0,l.jsx)("div",{className:"redirect-status redirect-status__disabled",children:"×"})},cx=(e,t)=>e.includes(t);function ux(e,t,r){return"server"===r?e.server+t:t}function dx(e,t){const{match_type:r,regex:n,action_data:i,url:o}=e;return n?t:(0,l.jsx)(N,{url:ux(i,o,r),children:t})}function px(e,t){return t?e:(0,l.jsx)("s",{children:e})}const hx=function(e){const{displaySelected:t,row:r,filters:n}=e,{match_type:i,url:o,title:s,action_data:a,enabled:c}=r,u=(0,l.jsx)(Zy(),{searchWords:[n.url||""],textToHighlight:ux(a,o,i),autoEscape:!0}),d=(0,l.jsx)(Zy(),{searchWords:[n.title||""],textToHighlight:s,autoEscape:!0});return cx(t,"title")&&!cx(t,"source")?(0,l.jsx)("p",{children:dx(r,px(s?d:u,c))}):(0,l.jsxs)(l.Fragment,{children:[cx(t,"title")&&s&&(0,l.jsx)("p",{children:dx(r,px(d,c))}),cx(t,"source")&&u&&(0,l.jsx)("p",{children:dx(r,px(u,c))})]})},fx=function(e){const{row:t,filters:r}=e,{match_type:n,action_data:i}=t;return"url"===n&&i?(0,l.jsx)("span",{className:"target",children:(0,l.jsx)(Zy(),{searchWords:[r.target??""],textToHighlight:i.url??"",autoEscape:!0})}):null},mx=function({name:e,className:t,strikethrough:r}){return(0,l.jsx)(Lu,{className:h("redirect-source__flag",t),children:r?(0,l.jsx)("s",{children:e}):e})},gx=function(e){const{row:t,defaultFlags:r}=e,{match_data:{source:n}}=t;return(0,l.jsx)(l.Fragment,{children:Object.keys(n).filter(e=>r[e]!==n[e]&&"flag_query"!==e).map(e=>{const t=wv().find(t=>t.value===e);return(0,l.jsx)(mx,{name:t?.label||"",className:"redirect-source__"+e,strikethrough:!!r[e]&&!n[e]},e)})})},yx=function(e){const{defaultFlags:t,row:r}=e,{match_data:{source:n}}=r;if(t.flag_query!==n.flag_query){let e;return e="ignore"===n.flag_query?(0,i.__)("Ignore Query","redirection"):"pass"===n.flag_query?(0,i.__)("Ignore & Pass Query","redirection"):(0,i.__)("Exact Query","redirection"),(0,l.jsx)(mx,{name:e})}return null},vx=function(e){const{row:t,table:r,defaultFlags:n}=e,{displaySelected:i}=r;return(0,l.jsxs)("div",{className:"redirect-column-wrap",children:[(0,l.jsxs)("div",{className:"redirect-source__details",children:[(0,l.jsx)(hx,{row:t,displaySelected:i,filters:r.filterBy}),cx(i,"target")&&(0,l.jsx)(fx,{row:t,filters:r.filterBy})]}),(0,l.jsxs)("div",{className:"redirect-source__flags",children:[cx(i,"flags")&&(0,l.jsx)(gx,{row:t,defaultFlags:n}),cx(i,"query")&&(0,l.jsx)(yx,{row:t,defaultFlags:n})]})]})},bx=function(e){const{action_code:t,action_type:r}=e;return"pass"===r?(0,i.__)("pass","redirection"):r===iv?"-":t},xx=function(e){const{row:t,group:r}=e,n=r.rows.find(e=>e.id===t.group_id);return n?(0,l.jsxs)("div",{className:"redirect-column-wrap",children:[n.name," ",(0,l.jsx)(Lu,{children:n.moduleName})]}):null};function wx(e,t){const r=t.find(t=>t.value===e);return r?r.label:"-"}function jx({url:e,desiredCode:t=0,desiredTarget:r=null}){return(0,l.jsx)(Ad,{url:e,desiredCode:t,desiredTarget:r})}function Sx(e){let t=encodeURIComponent(e).replace(/%2F/gi,"/");return t=t.replace(/%3F/gi,"?"),t=t.replace(/%3D/gi,"="),t=t.replace(/%26/gi,"&"),t}function kx(e){return e.includes("source")?e:e.concat(["source"])}function Cx(e){return e.includes("title")||e.includes("source")?kx(e):kx(e.concat(["title"]))}function Tx(e){return[{value:"0",label:(0,i.__)("All groups","redirection")}].concat(fd(e))}const Ex=function(){const e=U_(e=>e.redirects),t=U_(e=>e.redirectsAddTop),{setRedirectsTable:r,setRedirectsSelected:n}=U_(),o=de(e=>e.values);Z_({table:e,setTable:r,allowedOrder:["id","url","last_access","last_count","position"],allowedFilters:["url","url-exact","target","title","group","status","match","action"],defaultOrder:"id",pageName:"redirect"});const{data:s,isSuccess:a}=ud({}),c=s?.items??[],u=ub(),d=db("enable"),p=db("disable"),h=db("reset"),f=an(),{data:m,isLoading:g,isSuccess:_}=function(e={},t){const r=cd(e);return pt({queryKey:Xr.redirects.list(r),refetchOnMount:"always",refetchOnReconnect:!0,placeholderData:e=>e,queryFn:async()=>{try{const e=await St(Nt(r));return rd.parse(e)}catch(e){const t=Yr(e);throw tn.getState().addError(t.message||"Failed to fetch redirects"),t}},...t})}(e),y=m?.items??[],v=m?.total??0;let b="idle";g&&!m?b=Q_:(_||m)&&(b=K_);const x={flag_query:o?.flag_query??"ignore",flag_case:o?.flag_case??!1,flag_trailing:o?.flag_trailing??!1,flag_regex:o?.flag_regex??!1},w=b===K_&&a&&Cy(Ry),j=e=>{r({filterBy:e,page:0,selected:[],selectAll:!1})},S={displayFilters:ox(),displayGroups:[{value:"standard",label:(0,i.__)("Standard Display","redirection"),grouping:["last_count","last_access","source","target","code","title"]},{value:"minimal",label:(0,i.__)("Compact Display","redirection"),grouping:["source","last_count","last_access","target"]},{value:"all",label:(0,i.__)("Display All","redirection"),grouping:ox().map(e=>e.value)}],searchOptions:[{name:"url",title:(0,i.__)("Search URL","redirection")},{name:"target",title:(0,i.__)("Search target URL","redirection")},{name:"title",title:(0,i.__)("Search title","redirection")}],groupBy:Tx(c),bulk:[{id:"delete",name:(0,i.__)("Delete","redirection")},{id:"enable",name:(0,i.__)("Enable","redirection")},{id:"disable",name:(0,i.__)("Disable","redirection")},{id:"reset",name:(0,i.__)("Reset hits","redirection")},{id:"export-csv",name:(0,i.__)("Export as CSV","redirection")},{id:"export-json",name:(0,i.__)("Export as JSON","redirection")},{id:"copy-csv",name:(0,i.__)("Copy CSV","redirection")},{id:"copy-json",name:(0,i.__)("Copy JSON","redirection")}],rowFilters:[{label:(0,i.__)("Status","redirection"),value:"status",options:[{label:(0,i.__)("Enabled","redirection"),value:"enabled"},{label:(0,i.__)("Disabled","redirection"),value:"disabled"}]},{label:(0,i.__)("URL match","redirection"),value:"url-match",options:[{label:(0,i.__)("Regular Expression","redirection"),value:"regular"},{label:(0,i.__)("Plain","redirection"),value:"plain"}]},{label:(0,i.__)("Match Type","redirection"),value:"match",options:_v()},{label:(0,i.__)("Action Type","redirection"),value:"action",options:yv()},{label:(0,i.__)("HTTP Status Code","redirection"),value:"http",options:xv()},{label:(0,i.__)("Last Accessed","redirection"),value:"access",options:[{label:(0,i.__)("Never accessed","redirection"),value:"never"},{label:(0,i.__)("Not accessed in last month","redirection"),value:"month"},{label:(0,i.__)("Not accessed in last year","redirection"),value:"year"}]}],headers:[{name:"status",title:(0,i.__)("Status","redirection"),sortable:!1},{name:"source",title:(0,i.__)("URL","redirection"),primary:!0},{name:"match_type",title:(0,i.__)("Match Type","redirection"),sortable:!1},{name:"action_type",title:(0,i.__)("Action Type","redirection"),sortable:!1},{name:"code",title:(0,i.__)("Code","redirection"),sortable:!1},{name:"group",title:(0,i.__)("Group","redirection"),sortable:!1},{name:"position",title:(0,i.__)("Pos","redirection")},{name:"last_count",title:(0,i.__)("Hits","redirection"),sortable:!0},{name:"last_access",title:(0,i.__)("Last Access","redirection")}].filter(t=>function(e,t){return t.displaySelected.includes(e)}(t.name,e)),validateDisplay:Cx},k={onChangePage:e=>{r({page:e,selected:[],selectAll:!1})},onBulk:t=>{const r=e.selected;if(0!==r.length||e.selectAll){if("delete"===t){const t=e.selectAll?(0,i.__)("Are you sure you want to delete all items?","redirection"):(0,i.__)("Are you sure you want to delete the selected items?","redirection");if(!window.confirm(t))return}if(["export-csv","export-json","copy-csv","copy-json"].includes(t)){const n=cd(e.selectAll?{global:!0,filterBy:e.filterBy}:{items:r}),o=t.endsWith("csv")?"csv":"json",s=t.startsWith("copy-"),a={exportType:"redirect",format:o,download:!s,copy:s,completionNotice:{message:s?(0,i.__)("Export copied","redirection"):(0,i.__)("Export downloaded","redirection")},params:n};return s||(a.filename=tv("redirect",o)),void f.mutate(a)}if(e.selectAll){const r={global:!0,filterBy:e.filterBy};"delete"===t&&u.mutate({items:[],params:r})}else switch(t){case"delete":u.mutate({items:r});break;case"enable":d.mutate({items:r});break;case"disable":p.mutate({items:r});break;case"reset":h.mutate({items:r})}}},onSelect:t=>{if("boolean"==typeof t)n(t?y.map(e=>e.id):[]);else if("number"==typeof t||"string"==typeof t){const n=e.selected.includes(t)?e.selected.filter(e=>e!==t):[...e.selected,t];r({selected:n,selectAll:!1})}else n(t)},onSetOrder:(e,t)=>{r({orderby:e,direction:t})},onFilter:t=>{j({...t,...e.filterBy?.group?{group:String(e.filterBy.group)}:{}})},onSetDisplay:(e,t)=>{r({displayType:e,displaySelected:t})},onSetAll:e=>{r({selected:e?y.map(e=>e.id):[],selectAll:e})},onGroup:t=>{j(parseInt(t,10)>0?{...e.filterBy||{},group:t}:{})}},C={page:e.page,perPage:e.per_page,orderBy:e.orderby,direction:e.direction,selected:e.selected,selectAll:e.selectAll??!1,filter:"",filterBy:e.filterBy??{},displayType:e.displayType??"standard",displaySelected:e.displaySelected??[],groupBy:String(e.filterBy?.group??"0")};return(0,l.jsxs)("div",{className:"redirects",children:[t&&Cy(Ry)&&(0,l.jsx)(sx,{defaultFlags:x,addTop:!0}),(0,l.jsx)(ky,{logOptions:S,logActions:k,table:C,status:b,total:v,rows:y,saving:[],getRow:(e,t)=>function(e,t,r,n,i){const{last_access:o,hits:s,position:a,match_type:c,action_type:u,action_code:d,action_data:p}=e,{rowMode:h,setRowMode:f}=t;return"edit"===h?(0,l.jsx)(pb,{item:e,onCancel:()=>f(!1)}):[{name:"status",content:(0,l.jsx)(lx,{row:e})},{name:"source",content:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(vx,{row:e,table:t.table,defaultFlags:n}),"check"===h&&(0,l.jsx)(wd,{onClose:()=>f(null),children:(0,l.jsx)(jx,{url:pd((m=e,"server"===m.match_type?m.action_data.server??"":document.location.origin),Sx(e.url)),desiredCode:d,desiredTarget:p})})]}),alwaysDisplay:!0},{name:"match_type",content:wx(c,_v())},{name:"action_type",content:wx(u,yv())},{name:"code",content:bx(e)},{name:"group",content:(0,l.jsx)(xx,{row:e,group:i})},{name:"position",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(a)},{name:"last_count",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(s)},{name:"last_access",content:o}];var m}(e,t,0,x,{rows:c}),getRowActions:(e,t)=>(0,l.jsx)(ax,{disabled:!1,row:e,rowParams:t})}),w&&!t&&(0,l.jsx)(sx,{defaultFlags:x,addTop:!1})]})},Rx=function({page:e}){switch(e){case"support":return(0,l.jsx)($d,{});case"404s":return(0,l.jsx)(_b,{});case"log":return(0,l.jsx)(nv,{});case"import":return(0,l.jsx)(Ib,{});case"export":return(0,l.jsx)(Wb,{});case"groups":return(0,l.jsx)(ix,{});case"options":return(0,l.jsx)(Sd,{});case"site":return(0,l.jsx)(P_,{})}return(0,l.jsx)(Ex,{})},Px=function(){return(0,l.jsxs)(W,{errors:"",details:Q().concat(["Buster: 5.9.0 === "+Redirectioni10n.version]),type:"fixed",title:(0,i.__)("Cached Redirection detected","redirection"),links:Z(),locale:"redirection",children:[(0,l.jsx)("p",{children:(0,i.__)("Please clear your browser cache and reload this page.","redirection")}),(0,l.jsxs)("p",{children:[(0,i.__)("If you are using a caching system such as Cloudflare then please read this:","redirection"),(0,l.jsx)(N,{url:"https://redirection.me/support/problems/cloudflare/",children:(0,i.__)("clearing your cache.","redirection")})]})]})},Nx=function(){const{update_notice:e=!1}=window.Redirectioni10n,{mutate:t}=Na();return e&&Cy("redirection_cap_option_manage")?(0,l.jsx)(Hu,{className:"update-notice",children:(0,l.jsxs)("p",{children:[L((0,i.sprintf)(
// translators: %s is the version number
// translators: %s is the version number
(0,i.__)("Version %s installed! Please read the {{url}}release notes{{/url}} for details.","redirection"),e),{url:(0,l.jsx)(N,{url:"https://redirection.me/blog/redirection-version-"+e.replace(".","-")+"/"})})," ",(0,l.jsx)($l,{onClick:function(){t({update_notice:window.Redirectioni10n.update_notice}),window.Redirectioni10n.update_notice=!1},children:(0,i.__)("OK","redirection")})]})}):null},Ox=Redirectioni10n?.caps?.pages||[];function Ax(){const e=tn(e=>e.errors),t=tn(e=>e.notices),{clearErrors:r,clearNotices:n}=tn(),s=de(e=>e.database.status),a=de(e=>e.showDatabase),c=de(e=>e.database.inProgress),u=de(e=>e.values?.plugin_update??""),{setShowDatabase:d,setApi:p}=de(),{setErrorsTable:h,setLogsTable:f,setRedirectsTable:m,setRedirectsAddTop:g,setGroupsTable:_}=U_(),[y,v]=(0,o.useState)(Al(Ox));(0,o.useEffect)(()=>{if(window.Redirectioni10n?.api?.routes&&p({routes:window.Redirectioni10n.api.routes,current:window.Redirectioni10n.api.current??""}),window.Redirectioni10n?.settings&&!de.getState().values){const{setValues:e,setLoadStatus:t}=de.getState();e(window.Redirectioni10n.settings),t("success")}if(window.Redirectioni10n?.database){const{setDatabase:e}=de.getState();e(window.Redirectioni10n.database)}},[p]);const b=(0,o.useCallback)(e=>{v(e)},[]),x=(0,o.useCallback)(()=>{r()},[r]),w=(0,o.useMemo)(()=>[{name:(0,i.__)("Redirects","redirection"),value:""},{name:(0,i.__)("Groups","redirection"),value:"groups"},{name:(0,i.__)("Site","redirection"),value:"site"},{name:(0,i.__)("Log","redirection"),value:"log"},{name:(0,i.__)("404s","redirection"),value:"404s"},{name:(0,i.__)("Import","redirection"),value:"import"},{name:(0,i.__)("Export","redirection"),value:"export"},{name:(0,i.__)("Options","redirection"),value:"options"},{name:(0,i.__)("Support","redirection"),value:"support"}].filter(e=>Ty(e.value)||""===e.value&&Ty("redirect")),[]),j=(0,o.useMemo)(()=>({redirect:(0,i.__)("Redirections","redirection"),site:(0,i.__)("Site","redirection"),groups:(0,i.__)("Groups","redirection"),import:(0,i.__)("Import redirects","redirection"),export:(0,i.__)("Export redirects","redirection"),log:(0,i.__)("Logs","redirection"),"404s":(0,i.__)("404 errors","redirection"),options:(0,i.__)("Options","redirection"),support:(0,i.__)("Support","redirection")}),[]),S=(0,o.useCallback)(e=>{b(""===e?"redirect":e),"404s"===e?h({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):"log"===e?f({orderby:"",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):""===e?m({orderby:"id",direction:"desc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""}):"groups"===e&&_({orderby:"name",direction:"asc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""})},[b,h,f,m,_]);if("5.9.0"!==Redirectioni10n.version)return(0,l.jsx)(Px,{});if("need-install"===s||"finish-install"===s)return(0,l.jsx)(V,{renderCrash:zl,extra:{page:y},children:(0,l.jsx)(ml,{})});const k="prompt"===u&&("need-update"===s||"finish-update"===s);return(0,l.jsx)(V,{renderCrash:zl,extra:{page:y},children:(0,l.jsxs)("div",{className:"wrap redirection notranslate",translate:"no",children:[k&&(0,l.jsx)(jl,{onShowUpgrade:()=>d(!0),showDatabase:a}),!c&&"finish-update"!==s&&!a&&(0,l.jsxs)(Il,{page:y,setPage:b,onPageChange:x,allowedPages:Ox,baseUrl:"?page=redirection.php",defaultPage:"redirect",children:[(0,l.jsx)("h1",{className:"wp-heading-inline",children:j[y]}),"redirect"===y&&Cy(Ry)&&(0,l.jsx)("button",{type:"button",onClick:()=>g(!0),className:"page-title-action",children:(0,i.__)("Add redirect","redirection")}),(0,l.jsx)(Nx,{}),(0,l.jsx)(Cl,{onChangePage:S,currentPage:y,menu:w,home:"redirect",urlBase:Redirectioni10n.pluginRoot}),(0,l.jsx)(W,{errors:e,onClear:()=>r(),renderDebug:pe,details:Q(),links:Z(),locale:"redirection",children:(0,l.jsx)(Fl,{})}),(0,l.jsx)(Rx,{page:y}),(0,l.jsx)(Rl,{notices:t,onClear:()=>n(),snackBarViewText:(0,i.__)("View notice","redirection")})]})]})})}var Ix=class extends fe{constructor(e={}){super(),this.config=e,this.#W=new Map}#W;build(e,t,r){const n=t.queryKey,i=t.queryHash??Ce(n,t);let o=this.get(i);return o||(o=new et({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#W.has(e.queryHash)||(this.#W.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#W.get(e.queryHash);t&&(e.destroy(),t===e&&this.#W.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){qe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#W.get(e)}getAll(){return[...this.#W.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Se(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Se(e,t)):t}notify(e){qe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){qe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){qe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fx=class extends fe{constructor(e={}){super(),this.config=e,this.#G=new Set,this.#V=new Map,this.#Z=0}#G;#V;#Z;build(e,t,r){const n=new ht({client:e,mutationCache:this,mutationId:++this.#Z,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#G.add(e);const t=Dx(e);if("string"==typeof t){const r=this.#V.get(t);r?r.push(e):this.#V.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#G.delete(e)){const t=Dx(e);if("string"==typeof t){const r=this.#V.get(t);if(r)if(r.length>1){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#V.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Dx(e);if("string"==typeof t){const r=this.#V.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}return!0}runNext(e){const t=Dx(e);if("string"==typeof t){const r=this.#V.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}return Promise.resolve()}clear(){qe.batch(()=>{this.#G.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#G.clear(),this.#V.clear()})}getAll(){return Array.from(this.#G)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){return this.getAll().filter(t=>ke(e,t))}notify(e){qe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return qe.batch(()=>Promise.all(e.map(e=>e.continue().catch(ve))))}};function Dx(e){return e.options.scope?.id}function Lx(e,t){console.error(`TanStack ${e} error:`,{error:t,userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",timestamp:(new Date).toISOString(),redirectionData:"object"==typeof window.Redirectioni10n&&window.Redirectioni10n?{version:window.Redirectioni10n.version,locale:window.Redirectioni10n.locale,apiRoot:window.Redirectioni10n.api?.WP_API_root}:null})}const zx=new class{#Q;#U;#h;#K;#J;#Y;#X;#ee;constructor(e={}){this.#Q=e.queryCache||new Ix,this.#U=e.mutationCache||new Fx,this.#h=e.defaultOptions||{},this.#K=new Map,this.#J=new Map,this.#Y=0}mount(){this.#Y++,1===this.#Y&&(this.#X=me.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#Q.onFocus())}),this.#ee=He.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#Q.onOnline())}))}unmount(){this.#Y--,0===this.#Y&&(this.#X?.(),this.#X=void 0,this.#ee?.(),this.#ee=void 0)}isFetching(e){return this.#Q.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#U.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#Q.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#Q.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(we(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#Q.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=this.#Q.get(n.queryHash),o=i?.state.data,s=function(e,t){return"function"==typeof e?e(t):e}(t,o);if(void 0!==s)return this.#Q.build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return qe.batch(()=>this.#Q.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#Q.get(t.queryHash)?.state}removeQueries(e){const t=this.#Q;qe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const r=this.#Q;return qe.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=qe.batch(()=>this.#Q.findAll(e).map(e=>e.cancel(r)));return Promise.all(n).then(ve).catch(ve)}invalidateQueries(e,t={}){return qe.batch(()=>(this.#Q.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=qe.batch(()=>this.#Q.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(ve)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(n).then(ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const r=this.#Q.build(this,t);return r.isStaleByTime(we(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ve).catch(ve)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ve).catch(ve)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return He.isOnline()?this.#U.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#Q}getMutationCache(){return this.#U}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#K.set(Te(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#K.values()],r={};return t.forEach(t=>{Ee(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#J.set(Te(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#J.values()],r={};return t.forEach(t=>{Ee(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#h.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ce(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ze&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#h.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#Q.clear(),this.#U.clear()}}({queryCache:new Ix({onError:e=>{Lx("Query",e)}}),mutationCache:new Fx({onError:e=>{Lx("Mutation",e)}}),defaultOptions:{queries:{staleTime:0,retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});let Mx=!1;function $x(e,t){const r=e?.stack||"",n="object"==typeof window.Redirectioni10n&&!!window.Redirectioni10n&&!!window.Redirectioni10n.api&&"object"==typeof window.Redirectioni10n.api&&"string"==typeof window.Redirectioni10n.versions;return console.error("Redirection app crashed:",{error:e,errorInfo:t,redirectionData:"object"==typeof window.Redirectioni10n&&window.Redirectioni10n?{version:window.Redirectioni10n.version,locale:window.Redirectioni10n.locale,apiRoot:window.Redirectioni10n.api?.WP_API_root}:null}),(0,l.jsxs)(W,{errors:"",type:"fixed",links:n?Z():void 0,details:(n?Q():[]).concat([r,t?.componentStack||""]),locale:"redirection",title:(0,i.__)("Redirection plugin error","redirection"),children:[(0,l.jsx)("p",{children:(0,i.__)("The Redirection plugin encountered an error and could not load properly.","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("strong",{children:(0,i.__)("Possible solutions:","redirection")})}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:(0,i.__)("Refresh the page","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Clear browser cache","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Disable conflicting plugins","redirection")}),(0,l.jsx)("li",{children:(0,i.__)("Check for JavaScript errors in browser console","redirection")})]})]})}function Ux(){return(0,l.jsx)(V,{renderCrash:$x,children:(0,l.jsx)(Bx,{})})}function Bx(){const[e,t]=(0,o.useState)(Mx),r=function(){if("object"!=typeof window.Redirectioni10n||!window.Redirectioni10n)throw new Error("Redirectioni10n global data is missing. This may indicate a plugin conflict or caching issue.");if(!window.Redirectioni10n.api)throw new Error("Redirectioni10n.api is missing. The WordPress REST API configuration was not loaded.");const e=window.Redirectioni10n.api.WP_API_root;if(!e)throw new Error("WP_API_root is missing from Redirectioni10n.api");const t=window.Redirectioni10n.api.WP_API_nonce??"";let r=window.Redirectioni10n.locale,n=!1;try{new Intl.NumberFormat(r)}catch(e){r="en-US",n=!0}return{apiRoot:e,apiNonce:t,locale:r,localeWasInvalid:n}}();return(0,o.useEffect)(()=>{Mx||(r.localeWasInvalid&&(console.warn("Invalid locale:",window.Redirectioni10n.locale,"falling back to en-US"),window.Redirectioni10n.locale=r.locale),r.apiNonce||console.warn("WP_API_nonce is missing from Redirectioni10n.api"),St.resetMiddlewares(),St.use(St.createRootURLMiddleware(r.apiRoot)),St.use(St.createNonceMiddleware(r.apiNonce)),Mx=!0),t(!0)},[r.apiNonce,r.apiRoot,r.locale,r.localeWasInvalid]),e?(0,l.jsxs)(d,{client:zx,children:[(0,l.jsx)(Ax,{}),!1]}):(0,l.jsx)(l.Fragment,{})}document.querySelector("#react-ui")&&window.Redirectioni10n&&(function(){const e=document.getElementById("react-ui");e&&(0,n.createRoot)(e).render((0,l.jsx)(Ux,{}))}(),window.redirection=window.Redirectioni10n.version)},465(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(2))&&n.__esModule?n:{default:n};t.default=i.default,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=function(e){var t=e.activeClassName,r=void 0===t?"":t,i=e.activeIndex,l=void 0===i?-1:i,c=e.activeStyle,u=e.autoEscape,d=e.caseSensitive,p=void 0!==d&&d,h=e.className,f=e.findChunks,m=e.highlightClassName,g=void 0===m?"":m,_=e.highlightStyle,y=void 0===_?{}:_,v=e.highlightTag,b=void 0===v?"mark":v,x=e.sanitize,w=e.searchWords,j=e.textToHighlight,S=e.unhighlightTag,k=void 0===S?"span":S,C=e.unhighlightClassName,T=void 0===C?"":C,E=e.unhighlightStyle,R=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),P=(0,o.findAll)({autoEscape:u,caseSensitive:p,findChunks:f,sanitize:x,searchWords:w,textToHighlight:j}),N=b,O=-1,A="",I=void 0,F=(0,a.default)(function(e){var t={};for(var r in e)t[r.toLowerCase()]=e[r];return t});return(0,s.createElement)("span",n({className:h},R,{children:P.map(function(e,t){var n=j.substr(e.start,e.end-e.start);if(e.highlight){O++;var i;i="object"==typeof g?p?g[n]:(g=F(g))[n.toLowerCase()]:g;var o=O===+l;A=i+" "+(o?r:""),I=!0===o&&null!=c?Object.assign({},y,c):y;var a={children:n,className:A,key:t,style:I};return"string"!=typeof N&&(a.highlightIndex=O),(0,s.createElement)(N,a)}return(0,s.createElement)(k,{children:n,className:T,key:t,style:E})})}))};var i,o=r(3),s=r(4),a=(i=r(5))&&i.__esModule?i:{default:i};e.exports=t.default},function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return n.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return n.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return n.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return n.findChunks}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=function(e){var t=e.autoEscape,o=e.caseSensitive,s=void 0!==o&&o,a=e.findChunks,l=void 0===a?n:a,c=e.sanitize,u=e.searchWords,d=e.textToHighlight;return i({chunksToHighlight:r({chunks:l({autoEscape:t,caseSensitive:s,sanitize:c,searchWords:u,textToHighlight:d})}),totalLength:d?d.length:0})};var r=t.combineChunks=function(e){var t=e.chunks;return t.sort(function(e,t){return e.start-t.start}).reduce(function(e,t){if(0===e.length)return[t];var r=e.pop();if(t.start<=r.end){var n=Math.max(r.end,t.end);e.push({start:r.start,end:n})}else e.push(r,t);return e},[])},n=function(e){var t=e.autoEscape,r=e.caseSensitive,n=e.sanitize,i=void 0===n?o:n,s=e.searchWords,a=e.textToHighlight;return a=i(a),s.filter(function(e){return e}).reduce(function(e,n){n=i(n),t&&(n=n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var o=new RegExp(n,r?"g":"gi"),s=void 0;s=o.exec(a);){var l=s.index,c=o.lastIndex;c>l&&e.push({start:l,end:c}),s.index==o.lastIndex&&o.lastIndex++}return e},[])};t.findChunks=n;var i=t.fillInChunks=function(e){var t=e.chunksToHighlight,r=e.totalLength,n=[],i=function(e,t,r){t-e>0&&n.push({start:e,end:t,highlight:r})};if(0===t.length)i(0,r,!1);else{var o=0;t.forEach(function(e){i(o,e.start,!1),i(e.start,e.end,!0),o=e.end}),i(o,r,!1)}return n};function o(e){return e}}])},function(e,t){e.exports=r(609)},function(e,t){"use strict";var r=function(e,t){return e===t};e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=void 0,i=[],o=void 0,s=!1,a=function(e,r){return t(e,i[r])};return function(){for(var t=arguments.length,r=Array(t),l=0;l<t;l++)r[l]=arguments[l];return s&&n===this&&r.length===i.length&&r.every(a)?o:(s=!0,n=this,i=r,o=e.apply(this,r))}}}])},49(e,t,r){"use strict";var n=r(609),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,s=n.useRef,a=n.useEffect,l=n.useMemo,c=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,u){var d=s(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=n(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var r=n(e);return void 0!==u&&u(t,r)?(o=e,t):(o=e,s=r)}var o,s,a=!1,l=void 0===r?null:r;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,r,n,u]);var h=o(e,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=h},[h]),c(h),h}},721(e,t,r){"use strict";e.exports=r(49)},609(e){"use strict";e.exports=window.React},500(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=s(e,o(r)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=s(t,r));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()}};const t={};function r(n){const i=t[n];if(void 0!==i)return i.exports;const o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.m=e,(()=>{const e=[];r.O=(t,n,i,o)=>{if(n){o=o||0;for(var s=e.length;s>0&&e[s-1][2]>o;s--)e[s]=e[s-1];return void(e[s]=[n,i,o])}let a=1/0;for(s=0;s<e.length;s++){let[n,i,o]=e[s],c=!0;for(var l=0;l<n.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(e=>r.O[e](n[l]))?n.splice(l--,1):(c=!1,o<a&&(a=o));if(c){e.splice(s--,1);const r=i();void 0!==r&&(t=r)}}return t}})(),r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;r.t=function(n,i){if(1&i&&(n=this(n)),8&i)return n;if("object"==typeof n&&n){if(4&i&&n.__esModule)return n;if(16&i&&"function"==typeof n.then)return n}const o=Object.create(null);r.r(o);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,r.d(o,s),o}})(),r.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var i=t[n++],o=t[n++];r.o(e,i)?0===o&&n++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.hasOwn(e,t),r.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={57:0,350:0};r.O.j=t=>0===e[t];const t=(t,n)=>{let[i,o,s]=n;var a,l,c=0;if(i.some(t=>0!==e[t])){for(a in o)r.o(o,a)&&(r.m[a]=o[a]);if(s)var u=s(r)}for(t&&t(n);c<i.length;c++)l=i[c],r.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return r.O(u)},n=globalThis.webpackChunkredirection||=[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();let n=r.O(void 0,[350],()=>r(872));n=r.O(n)})();