File: /home/icsla/public_html/wp-content/plugins/redirection/build/redirection.js
/*! Redirection v5.8.0 - please refer to license.txt for license information */
(()=>{var e,t,n,r={174(e,t,n){"use strict";const r=window.ReactDOM,i=window.wp.i18n;var o=n(609),s=n.t(o,2),a=n.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,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=p(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const h=function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=p(e))&&(r&&(r+=" "),r+=t);return r};function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(null,arguments)}function m(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}var g=o.useLayoutEffect,y=function(e,t){"function"!=typeof e?e.current=t:e(t)},_={"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(_).forEach(function(t){e.style.setProperty(t,_[t],"important")})},b=null,x=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-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,n){var r,i,s=(r=n,i=a().useRef(r),g(function(){i.current=r}),i);o.useLayoutEffect(function(){var n=function(e){return s.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var C=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],T=function(e,t){var n,r=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),_=function(e,t){var n=a().useRef();return a().useCallback(function(r){e.current=r,n.current&&y(n.current,null),n.current=t,t&&y(t,r)},[t])}(g,t),T=o.useRef(0),E=o.useRef(),P=function(){var e=g.current,t=r&&E.current?E.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,j.reduce(function(e,t){return e[t]=n[t],e},{})),i=r.boxSizing;return""===i?null:(S&&"border-box"===i&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px"),{sizingStyle:r,paddingSize:parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),borderSize:parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth)})}(e);if(t){E.current=t;var n=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=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*n;"border-box"===a&&(u=u+i+o),l=Math.max(u,l);var d=c*r;return"border-box"===a&&(d=d+i+o),[l=Math.min(d,l),c]}(t,e.value||e.placeholder||"x",s,i),o=n[0],a=n[1];T.current!==o&&(T.current=o,e.style.setProperty("height",o+"px","important"),d(o,{rowHeight:a}))}};return o.useLayoutEffect(P),function(e,t){k(document.body,"reset",function(n){e.current.form===n.target&&t()})}(g,function(){if(!h){var e=g.current.value;requestAnimationFrame(function(){var t=g.current;t&&e!==t.value&&P()})}}),k(window,"resize",P),n=P,k(document.fonts,"loadingdone",n),o.createElement("textarea",f({},p,{onChange:function(e){h||P(),c(e)},ref:_}))},E=o.forwardRef(T);const P=function(e){const{error:t,mini:n,context:r,renderDebug:s,versions:a,noParse:c=!1,details:u=[],locale:d}=e,[p,h]=(0,o.useState)(!n);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,n){const r=t?[t]:[],{request:i=!1,data:o}=e;r.push("");const{apiFetch:s}=i||{};s&&s.status&&s.statusText&&(r.push("Action: "+s.action),s.body&&"{}"!==s.body&&r.push("Params: "+s.body),r.push("Code: "+s.status+" "+s.statusText),r.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&&r.push("Error: "+a),o&&r.push("Raw: "+o),n&&(r.push(""),r.push("Context:"),r.push(n)),r}(t,a,r);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})})]})},R=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)(P,{...e,error:e.error||{},mini:!0})]})},O=({url:e,children:t,title:n,className:r})=>(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:n,className:r,children:t});function N(e){return 404===e?.request?.apiFetch?.status}function A(e){const t=e.code;return"disabled"===t||"rest_disabled"===t}function F(e){return"rest_api_redirected"===e?.code}function I(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 z=window.wp.element;function D(e,t){try{return(0,z.createInterpolateElement)(e.replace(/\{\{/g,"<").replace(/\}\}/g,">"),t)}catch(t){return e}}const L=({error:e,links:t,locale:n})=>{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.",n)});if(function(e){const t=e,{request:n,code:r}=t;return!!(n&&n.status&&r)&&(-1!==[400,401,403,405].indexOf(n.status)||"rest_no_route"===r)&&0===parseInt(String(r),10)}(e))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:I(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.",n)}),(0,l.jsx)("p",{children:(0,l.jsx)(O,{url:t.api,children:(0,i.__)("Read this REST API guide for more information.",n)})})]});if(N(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.",n)}),(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.",n)})}),(0,l.jsxs)("ul",{children:[(0,l.jsx)("li",{children:D((0,i.__)("Can you access your {{api}}REST API{{/api}} without it redirecting?",n),{api:(0,l.jsx)(O,{url:t.rootUrl,children:t.rootUrl})})}),(0,l.jsx)("li",{children:D((0,i.__)("Check your {{link}}Site Health{{/link}} and fix any issues.",n),{link:(0,l.jsx)(O,{url:t.siteHealth,children:t.siteHealth})})}),(0,l.jsx)("li",{children:(0,i.__)("Your server configuration is blocking access to the REST API.",n)}),(0,l.jsx)("li",{children:(0,i.__)("A security plugin or firewall is blocking access. You will need to whitelist the REST API.",n)})]}),(0,l.jsx)("p",{children:(0,l.jsx)(O,{url:t.api,children:(0,i.__)("Read this REST API guide for more information.",n)})})]});if(F(e))return(0,l.jsx)("p",{children:(0,i.__)("Your REST API is being redirected. Please remove the redirection for the API.",n)});if(function(e){return"rest_api_cors_mismatch"===e?.code}(e)){const t=e?.request?.origins?.current,r=e?.request?.origins?.test;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:I(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.",n)}),t&&r&&(0,l.jsxs)("ul",{children:[(0,l.jsxs)("li",{children:[(0,i.__)("Current admin page origin:",n)," ",(0,l.jsx)("code",{children:t})]}),(0,l.jsxs)("li",{children:[(0,i.__)("REST API origin:",n)," ",(0,l.jsx)("code",{children:r})]})]}),(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.",n)})]})}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.",n)});if(function(e){return void 0===e.message}(e))return(0,l.jsx)("p",{children:(0,i.__)("An unknown error occurred.",n)});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:I(e)}),(0,l.jsx)("p",{children:(0,i.__)("Your REST API is showing a deprecated PHP error. Please fix this error.",n)})]});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:I(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",n)}),(0,l.jsx)("p",{children:(0,l.jsx)(O,{url:t.http,children:(0,i.__)("Read this REST API guide for more information.",n)})})]});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.",n)});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 n=e.split("<br />").filter(e=>e);return n.slice(0,n.length-1).join(" ").trim()}(e?.request?.apiFetch?.body||"");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{children:I(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.",n)}),t.length>1&&(0,l.jsxs)("p",{children:[(0,l.jsxs)("strong",{children:[(0,i.__)("Possible cause",n),":"]})," ",(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:I(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.",n)}),(0,l.jsx)("p",{children:(0,l.jsx)(O,{url:t.url,children:(0,i.__)("Read this REST API guide for more information.",n)})})]}):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:I(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.",n)})]}):(0,l.jsx)("p",{children:I(e)})};function M(e,t,n){return N(e)?(0,i.__)("REST API 404"):t||(0,i.__)("Something went wrong 🙁",n)}const U=function(e){const{title:t,children:n,error:r,links:i,locale:o}=e,s=function(e){return!N(e)&&!F(e)&&!A(e)}(r),a=function(e){return!!N(e)||!!F(e)||!!A(e)}(r),c=!N(r);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:M(r,t,o)}),(0,l.jsx)("div",{className:"wpl-error__title",children:(0,l.jsx)(L,{error:r,links:i,locale:o})}),s&&n,(0,l.jsx)(P,{error:r,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}:{}})]})},$=function(e){const{title:t,children:n,error:r,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)(L,{error:r,links:o,locale:s})}),n,(0,l.jsx)(P,{...e})]})},B=function(e){const{title:t,children:n,error:r,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)(L,{error:r,links:o,locale:s})}),n,(0,l.jsx)(P,{...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)(P,{...e,error:e.error||{},mini:!0})]})};function H({current:e,change:t,total:n}){return(0,l.jsxs)("div",{className:"wpl-error__page",children:[e>0&&(0,l.jsx)("span",{onClick:()=>t(e-1),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t(e-1))},role:"button",tabIndex:0,children:"←"}),`${e+1}/${n}`,e+1<n&&(0,l.jsx)("span",{onClick:()=>t(e+1),onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t(e+1))},role:"button",tabIndex:0,children:"→"})]})}const W=function(e){const{onClear:t,mini:n=!1,type:r=""}=e,i=(0,o.useMemo)(()=>Array.isArray(e.errors)?e.errors:[e.errors],[e.errors]),[s,a]=(0,o.useState)(0);(0,o.useEffect)(()=>{!n&&i.length>0&&window.scrollTo(0,0)},[i,n]);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 n=e[0];return"rest_cookie_invalid_nonce"===n?.code?R:400===n?.jsonData?.status?q:"error"===t?$:"fixed"===t?B:U}(i,r);return(0,l.jsxs)("div",{className:h("wpl-error",{"wpl-error__mini":n}),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 Z 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:n}=this.state,{renderCrash:r,children:i,extra:o}=this.props;return e?r(t,n,o):i}}const G=Z;function V(){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 n=new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,o);return o},J=e=>e,Y=e=>{const t=(e=>e?K(e):K)(e),n=e=>function(e,t=J){const n=o.useSyncExternalStore(e.subscribe,o.useCallback(()=>t(e.getState()),[e,t]),o.useCallback(()=>t(e.getInitialState()),[e,t]));return o.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},X=e=>e?Y(e):Y,ee=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,te=new Map,ne=e=>{const t=te.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},re=/.+ (.+) .+/,ie=/^([^@]+)@/;function oe(e){var t,n,r;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==(n=re.exec(s))?void 0:n[1])||(null==(r=ie.exec(s))?void 0:r[1])}const se=(e,t={})=>(n,r,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(n,r,i);const{connection:u,...d}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};const r=te.get(n.name);if(r)return{type:"tracked",store:e,...r};const i={connection:t.connect(n),stores:{}};return te.set(n.name,i),{type:"tracked",store:e,...i}})(a,c,l);let p=!0;i.setState=(e,t,o)=>{const c=n(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,r()),c):(null==u||u.send({...d,type:`${a}/${d.type}`},{...ne(l.name),[a]:i.getState()}),c)},i.devtools={cleanup:()=>{u&&"function"==typeof u.unsubscribe&&u.unsubscribe(),((e,t)=>{if(void 0===t)return;const n=te.get(e);n&&(delete n.stores[t],0===Object.keys(n.stores).length&&te.delete(e))})(l.name,a)}};const h=(...e)=>{const t=p;p=!1,n(...e),p=t},f=e(i.setState,r,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=(...n)=>{"__setState"!==n[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(...n)}}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(ne(l.name));case"COMMIT":return void 0===a?void(null==u||u.init(i.getState())):null==u?void 0:u.init(ne(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(ne(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:n}=e.payload,r=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!r)return;return h(void 0===a?r:r[a]),void(null==u||u.send(null,n))}case"PAUSE_RECORDING":return p=!p}return}}),f},ae=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};function le(e,t){let n;try{n=e()}catch(e){return}const r={getItem:e=>{var r;const i=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(r=n.getItem(e))?r:null;return o instanceof Promise?o.then(i):i(o)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)};return r}const ce=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>ce(e)(n),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 n={...e.apiTest};return Object.keys(t).forEach(e=>{t[e]&&(n[e]=t[e])}),{apiTest:n}}),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),n="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:D((0,i.__)("Please check the {{link}}support site{{/link}} before proceeding further.","redirection"),{link:(0,l.jsx)(O,{url:"https://redirection.me/support/"})})}),(0,l.jsx)("p",{children:D((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:n,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:D((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:D((0,i.__)("Full documentation can be found on the {{link}}Redirection website.{{/link}}","redirection"),{link:(0,l.jsx)(O,{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:D((0,i.__)("{{link}}Monitor 404 errors{{/link}}, get detailed information about the visitor, and fix any problems","redirection"),{link:(0,l.jsx)(O,{url:"https://redirection.me/support/tracking-404-errors/"})})}),(0,l.jsx)("li",{children:D((0,i.__)("{{link}}Import{{/link}} from .htaccess, CSV, and a variety of other plugins","redirection"),{link:(0,l.jsx)(O,{url:"https://redirection.me/support/import-export-redirects/"})})}),(0,l.jsx)("li",{children:D((0,i.__)("More powerful URL matching, including {{regular}}regular expressions{{/regular}}, and {{other}}other conditions{{/other}}","redirection"),{regular:(0,l.jsx)(O,{url:"https://redirection.me/support/redirect-regular-expressions/"}),other:(0,l.jsx)(O,{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;#n;constructor(){super(),this.#n=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.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=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)},ye=new class{#r=ge;#i=!1;setTimeoutProvider(e){this.#r=e}setTimeout(e,t){return this.#r.setTimeout(e,t)}clearTimeout(e){this.#r.clearTimeout(e)}setInterval(e,t){return this.#r.setInterval(e,t)}clearInterval(e){this.#r.clearInterval(e)}},_e="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:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(r){if(t.queryHash!==Ce(s,t.options))return!1}else if(!Ee(t.queryKey,s))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof a&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function ke(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Te(t.options.mutationKey)!==Te(o))return!1}else if(!Ee(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||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,n)=>(e[n]=t[n],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(n=>Ee(e[n],t[n]))}var Pe=Object.prototype.hasOwnProperty;function Re(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Ne(e)&&Ne(t);if(!(r||Ae(e)&&Ae(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),s=o.length,a=r?new Array(s):{};let l=0;for(let c=0;c<s;c++){const s=r?c:o[c],u=e[s],d=t[s];if(u===d){a[s]=u,(r?c<i:Pe.call(e,s))&&l++;continue}if(null===u||null===d||"object"!=typeof u||"object"!=typeof d){a[s]=d;continue}const p=Re(u,d,n+1);a[s]=p,p===u&&l++}return i===s&&l===i?e:a}function Oe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ae(e){if(!Fe(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!Fe(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function Fe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ie(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?Re(e,t):t}function ze(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function De(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Le=Symbol();function Me(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Le?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function Ue(e,t){return"function"==typeof e?e(...t):!!e}var $e=(()=>{let e=()=>_e;return{isServer:()=>e(),setIsServer(t){e=t}}})(),Be=function(e){setTimeout(e,0)},qe=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Be;const o=r=>{t?e.push(r):i(()=>{n(r)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}(),He=new class extends fe{#o=!0;#t;#n;constructor(){super(),this.#n=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=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 n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}function Ze(e){return Math.min(1e3*2**e,3e4)}function Ge(e){return"online"!==(e??"online")||He.isOnline()}var Ve=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Qe(e){let t,n=!1,r=0;const i=We(),o=()=>"pending"!==i.status,s=()=>me.isFocused()&&("always"===e.networkMode||He.isOnline())&&e.canRun(),a=()=>Ge(e.networkMode)&&e.canRun(),l=e=>{o()||(t?.(),i.resolve(e))},c=e=>{o()||(t?.(),i.reject(e))},u=()=>new Promise(n=>{t=e=>{(o()||s())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,o()||e.onContinue?.()}),d=()=>{if(o())return;let t;const i=0===r?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??($e.isServer()?0:3),a=e.retryDelay??Ze,l="function"==typeof a?a(r,t):a,p=!0===i||"number"==typeof i&&r<i||"function"==typeof i&&i(r,t);var h;!n&&p?(r++,e.onFail?.(r,t),(h=l,new Promise(e=>{ye.setTimeout(e,h)})).then(()=>s()?void 0:u()).then(()=>{n?c(t):d()})):c(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!o()){const n=new Ve(t);c(n),e.onCancel?.(n)}},continue:()=>(t?.(),i),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!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=ye.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($e.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#s&&(ye.clearTimeout(this.#s),this.#s=void 0)}};function Je(e){return{onFetch:(t,n)=>{const r=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 n=!1;const c=e=>{!function(e,n,r){let i,o=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t.signal,o||(o=!0,i.aborted?r():i.addEventListener("abort",r,{once:!0})),i)})}(e,0,()=>n=!0)},u=Me(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(null==r&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?De:ze;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,r,a)}};if(i&&o.length){const e="backward"===i,t={pages:o,pageParams:s},n=(e?Xe:Ye)(r,t);a=await d(t,n,e)}else{const t=e??o.length;do{const e=0===l?s[0]??r.initialPageParam:Ye(r,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},n):t.fetchFn=c}}}function Ye(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Xe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):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=rt(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=rt(this.options);void 0!==e.data&&(this.setState(nt(e.data,e.dataUpdatedAt)),this.#l=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const n=Ie(this.state.data,e,this.options);return this.#m({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}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===Le||!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 n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,n.signal)})},i=()=>{const e=Me(this.options,t),n=(()=>{const e={client:this.#d,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#f=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#d,state:this.state,fetchFn:i};return r(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 Ve&&e.revert&&this.setState({...this.#c,fetchStatus:"idle"}),n.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 Ve){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 n={...t,...nt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#c=e.manual?n:void 0,n;case"error":const r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,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:Ge(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function nt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function rt(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var it=class extends fe{constructor(e,t){super(),this.options=t,this.#d=e,this.#y=null,this.#_=We(),this.bindMethods(),this.setOptions(t)}#d;#v=void 0;#b=void 0;#x=void 0;#w;#j;#_;#y;#S;#k;#C;#T;#E;#P;#R=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#v.addObserver(this),ot(this.#v,this.options)?this.#O():this.updateResult(),this.#N())}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.#F(),this.#v.removeObserver(this)}setOptions(e){const t=this.options,n=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.#I(),this.#v.setOptions(this.options),t._defaulted&&!Oe(this.options,t)&&this.#d.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#v,observer:this});const r=this.hasListeners();r&&at(this.#v,n,this.options,t)&&this.#O(),this.updateResult(),!r||this.#v===n&&je(this.options.enabled,this.#v)===je(t.enabled,this.#v)&&we(this.options.staleTime,this.#v)===we(t.staleTime,this.#v)||this.#z();const i=this.#D();!r||this.#v===n&&je(this.options.enabled,this.#v)===je(t.enabled,this.#v)&&i===this.#P||this.#L(i)}getOptimisticResult(e){const t=this.#d.getQueryCache().build(this.#d,e),n=this.createResult(t,e);return r=n,!Oe(this.getCurrentResult(),r)&&(this.#x=n,this.#j=this.options,this.#w=this.#v.state),n;var r}getCurrentResult(){return this.#x}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#_.status||this.#_.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#R.add(e)}getCurrentQuery(){return this.#v}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#d.defaultQueryOptions(e),n=this.#d.getQueryCache().build(this.#d,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#O({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#x))}#O(e){this.#I();let t=this.#v.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ve)),t}#z(){this.#A();const e=we(this.options.staleTime,this.#v);if($e.isServer()||this.#x.isStale||!be(e))return;const t=xe(this.#x.dataUpdatedAt,e)+1;this.#T=ye.setTimeout(()=>{this.#x.isStale||this.updateResult()},t)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#v):this.options.refetchInterval)??!1}#L(e){this.#F(),this.#P=e,!$e.isServer()&&!1!==je(this.options.enabled,this.#v)&&be(this.#P)&&0!==this.#P&&(this.#E=ye.setInterval(()=>{(this.options.refetchIntervalInBackground||me.isFocused())&&this.#O()},this.#P))}#N(){this.#z(),this.#L(this.#D())}#A(){void 0!==this.#T&&(ye.clearTimeout(this.#T),this.#T=void 0)}#F(){void 0!==this.#E&&(ye.clearInterval(this.#E),this.#E=void 0)}createResult(e,t){const n=this.#v,r=this.options,i=this.#x,o=this.#w,s=this.#j,a=e!==n?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,n,t,r);(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=Ie(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=Ie(i?.data,c,t),this.#k=c,this.#y=null}catch(e){this.#y=e}this.#y&&(p=this.#y,c=this.#k,h=Date.now(),f="error");const g="fetching"===u.fetchStatus,y="pending"===f,_="error"===f,v=y&&g,b=void 0!==c,x={status:f,fetchStatus:u.fetchStatus,isPending:y,isSuccess:"success"===f,isError:_,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&&!y,isLoadingError:_&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:_&&b,isStale:lt(e,t),refetch:this.refetch,promise:this.#_,isEnabled:!1!==je(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==x.data,r="error"===x.status&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},o=()=>{const e=this.#_=x.promise=We();i(e)},s=this.#_;switch(s.status){case"pending":e.queryHash===n.queryHash&&i(s);break;case"fulfilled":(r||x.data!==s.value)&&o();break;case"rejected":r&&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),Oe(t,e)||(this.#x=t,this.#M({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#R.size)return!0;const r=new Set(n??this.#R);return this.options.throwOnError&&r.add("error"),Object.keys(this.#x).some(t=>{const n=t;return this.#x[n]!==e[n]&&r.has(n)})})()}))}#I(){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.#N()}#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,n){if(!1!==je(t.enabled,e)&&"static"!==we(t.staleTime,e)){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&<(e,t)}return!1}function at(e,t,n,r){return(e!==t||!1===je(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&<(e,n)}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,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()}));function pt(e,t){return function(e,t,n){const r=o.useContext(ut),i=o.useContext(ct),s=u(n),a=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const l=s.getQueryCache().get(a.queryHash),c=!1!==e.subscribed;a._optimisticResults=r?"isRestoring":c?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,n=e=>"static"===e?e:Math.max(e??t,t),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>n(r(...e)):n(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(a),((e,t,n)=>{const r=n?.state.error&&"function"==typeof e.throwOnError?Ue(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(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=!r&&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:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||Ue(n,[e.error,r])))({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&&!$e.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(h,r)){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.#$=e.mutationCache,this.#U=[],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.#U.includes(e)||(this.#U.push(e),this.clearGcTimeout(),this.#$.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#U=this.#U.filter(t=>t!==e),this.scheduleGc(),this.#$.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#U.length||("pending"===this.state.status?this.scheduleGc():this.#$.remove(this))}continue(){return this.#p?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#m({type:"continue"})},n={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#p=Qe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):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.#$.canRun(this)});const r="pending"===this.state.status,i=!this.#p.canStart();try{if(r)t();else{this.#m({type:"pending",variables:e,isPaused:i}),this.#$.config.onMutate&&await this.#$.config.onMutate(e,this,n);const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#m({type:"pending",context:t,variables:e,isPaused:i})}const o=await this.#p.start();return await(this.#$.config.onSuccess?.(o,e,this.state.context,this,n)),await(this.options.onSuccess?.(o,e,this.state.context,n)),await(this.#$.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(o,null,e,this.state.context,n)),this.#m({type:"success",data:o}),o}catch(t){try{await(this.#$.config.onError?.(t,e,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onError?.(t,e,this.state.context,n))}catch(e){Promise.reject(e)}try{await(this.#$.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n))}catch(e){Promise.reject(e)}try{await(this.options.onSettled?.(void 0,t,e,this.state.context,n))}catch(e){Promise.reject(e)}throw this.#m({type:"error",error:t}),t}finally{this.#$.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.#U.forEach(t=>{t.onMutationUpdate(e)}),this.#$.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),Oe(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,n=this.#x.context,r={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===e?.type){try{this.#q.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if("error"===e?.type){try{this.#q.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#q.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#x)})})}};function mt(e,t){const n=u(t),[r]=o.useState(()=>new ft(n,e));o.useEffect(()=>{r.setOptions(e)},[r,e]);const i=o.useSyncExternalStore(o.useCallback(e=>r.subscribe(qe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=o.useCallback((e,t)=>{r.mutate(e,t).catch(ve)},[r]);if(i.error&&Ue(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const gt=e=>"object"==typeof e&&null!==e,yt=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 _t=[];function vt(e,t,n){return{code:(r=e,"number"==typeof r?`${r}`:gt(r)&&r.error_code?r.error_code:gt(r)&&r.code?r.code:gt(r)&&r.name?r.name:gt(r)&&r.data?.error_code?r.data.error_code:String(r)),message:yt(t),request:n,data:n.apiFetch?.data?n.apiFetch?.data:null,jsonData:e&&e.data?e.data:null};var r}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=[..._t,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 n=t.apiFetch?.status;if(""===e&&void 0!==n&&(n<200||n>300))return e;try{const n=JSON.parse(e.replace(/\ufeff/,""));if(0===n)throw vt("json-zero","Failed to get data",t);return n}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:n,statusText:r}=t.apiFetch;if(e?.code&&e?.message)throw vt(e,e,t);if(void 0!==n&&(n<200||n>=300))throw vt(n,r,t)}return e})(t,e)))(e)],n=e=>r=>{const i=t[e];return i?i(r,e===t.length-1?()=>Promise.resolve():n(e+1)):Promise.reject(new Error("Middleware step is undefined"))};return new Promise((t,r)=>{n(0)(e).then(e=>t(e)).catch(n=>"rest_cookie_invalid_nonce"!==n.code?r(n):e.apiFetch?.nonceRefreshed?r(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(n=>{if(!n)throw vt("rest_cookie_invalid_nonce","REST API nonce refresh failed.",e);jt.nonceMiddleware.nonce=n,e.apiFetch={...e.apiFetch||{},nonceRefreshed:!0},jt(e).then(t).catch(r)}).catch(r))})};jt.getUrl=e=>jt.rootURLMiddleware({url:e},e=>jt.nonceMiddleware(e,e=>e.url)),jt.use=function(e){_t.unshift(e)},jt.createNonceMiddleware=e=>{const t=(e=>{const t=(e,n)=>{const{headers:r={}}=e;for(const i in r)if("x-wp-nonce"===i.toLowerCase()&&r[i]===t.nonce)return n(e);return n({...e,headers:{...r,"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,n)=>{return t.url.startsWith("http")?n(t):n({...t,url:(r=e,i=t.url,function(e){return e.replace("wp-json/wp-json","wp-json").replace("=/wp-json","=")}((o=function(e){return e.replace(/\/$/,"")}(r),s=function(e,t){return-1!==e.indexOf("?")?t.replace("?","&"):t}(r,function(e){return e.replace(/^\//,"")}(i)),o+"/"+s)))});var r,i,o,s};return t.rootURL=e,t}(e);return jt.rootURLMiddleware=t,t},jt.resetMiddlewares=()=>{_t=[]},jt.replaceRootURLMiddleware=e=>{for(let t=0;t<_t.length;t++)_t[t]===jt.rootURLMiddleware&&(_t[t]=jt.createRootURLMiddleware(e))};const St=jt,kt=(e,t={})=>{const n=e+"/";if(Object.keys(t).length>0){const e=function(e){const t=new URLSearchParams;function n(e,r){for(const i in r){const o=r[i];if(null!=o)if(Array.isArray(o))for(const n of o)null!=n&&t.append(`${e}[${i}][]`,String(n));else"object"==typeof o?n(`${e}[${i}]`,o):t.append(`${e}[${i}]`,String(o))}}for(const r in e){const i=e[r];if(null!=i)if(Array.isArray(i))for(const e of i)null!=e&&t.append(`${r}[]`,String(e));else"object"==typeof i?n(r,i):t.append(r,String(i))}return t.toString()}(t);if(e.length>0)return n+(-1===n.indexOf("?")?"?":"&")+e}return n},Ct=(e,t={})=>({headers:{Accept:"application/json, */*;q=0.1"},url:kt(e,t),credentials:"include",method:"get",redirect:"error"}),Tt=(e,t={},n={})=>{const r={headers:{"Content-Type":"application/json; charset=utf-8",Accept:"application/json, */*;q=0.1"},url:kt(e,n),credentials:"include",method:"post",body:"{}"};return Object.keys(t).length>0&&(r.body=JSON.stringify(t)),r},Et=(e,t={},n={})=>Tt(e,t,n),Pt=()=>Ct("redirection/v1/setting"),Rt=e=>Tt("redirection/v1/setting",e),Ot=e=>Ct("redirection/v1/redirect",e),Nt=(e,t)=>Tt("redirection/v1/redirect/"+e,t),At=(e,t)=>Tt("redirection/v1/redirect",e,t),Ft=e=>Ct("redirection/v1/redirect/post",{text:e}),It=e=>Ct("redirection/v1/group",e),zt=(e,t)=>Tt("redirection/v1/group/"+e,t),Dt=(e,t)=>Tt("redirection/v1/group",e,t),Lt=e=>Ct("redirection/v1/log",e),Mt=e=>Ct("redirection/v1/404",e),Ut=(e,t)=>((e,t,n)=>{const r=Tt(e,{});delete r.headers["Content-Type"];const i=new FormData;return i.append("file",n),r.body=i,r})("redirection/v1/import/file/"+e,0,t),$t=()=>Ct("redirection/v1/import/plugin"),Bt=e=>Tt("redirection/v1/import/plugin",{plugin:e}),qt=(e,t)=>Ct("redirection/v1/export/"+e+"/"+t),Ht=()=>Ct("redirection/v1/plugin"),Wt=()=>Et("redirection/v1/plugin/delete"),Zt=e=>Tt("redirection/v1/plugin/data",e?{upgrade:e}:{}),Gt=()=>Tt("redirection/v1/plugin/finish",{}),Vt=(e,t)=>Tt("redirection/v1/plugin/fix",{reason:e,current:t}),Qt=(e,t,n)=>Tt("redirection/v1/bulk/redirect/"+e,t,n),Kt=(e,t,n)=>Tt("redirection/v1/bulk/group/"+e,t,n),Jt=(e,t,n)=>Tt("redirection/v1/bulk/log/"+e,t,n),Yt=(e,t,n)=>Tt("redirection/v1/bulk/404/"+e,t,n),Xt=(e,t=1)=>`https://api.redirect.li/v${t}/`+e,en=e=>({url:Xt("useragent/"+encodeURIComponent(e)),method:"get"}),tn=e=>({url:Xt("http?url="+encodeURIComponent(e),2),method:"get"});var nn;function rn(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(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:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}Symbol("zod_brand");class on extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(nn=globalThis).__zod_globalConfig??(nn.__zod_globalConfig={});const an=globalThis.__zod_globalConfig;function ln(e){return e&&Object.assign(an,e),an}function cn(e){const t=Object.values(e).filter(e=>"number"==typeof e),n=Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t);return n}function un(e,t){return"bigint"==typeof t?t.toString():t}function dn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function pn(e){return null==e}function hn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const fn=Symbol("evaluating");function mn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==fn)return void 0===r&&(r=fn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function gn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function yn(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function vn(e){return JSON.stringify(e)}const bn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function xn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const wn=dn(()=>{if(an.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function jn(e){if(!1===xn(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==xn(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Sn(e){return jn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const kn=new Set(["string","number","symbol"]);function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function En(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 Pn={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 Rn(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function On(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function Nn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function An(e){return"string"==typeof e?e:e?.message}function Fn(e,t,n){const r=e.message?e.message:An(e.inst?._zod.def?.error?.(e))??An(t?.error?.(e))??An(n.customError?.(e))??An(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=s),a}function In(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function zn(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const Dn=(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,un,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ln=rn("$ZodError",Dn),Mn=rn("$ZodError",Dn,{Parent:Error}),Un=(e,t)=>{Ln.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(o))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,un,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,un,2)}},isEmpty:{get:()=>0===e.issues.length}})},$n=rn("ZodError",Un),Bn=rn("ZodError",Un,{Parent:Error});class qn extends Error{constructor(e,t){const n=e.issues,r=n.map(e=>{const t=e.path.join(".");return`${t?`${t}: `:""}${e.message}`}).join("\n");super(n.length>0?`API response validation failed:\n${r}`:"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 Hn(e){return e instanceof $n?(console.error("API Validation Error:",e.format()),new qn(e)):e instanceof Error?e:"object"==typeof e&&null!==e&&"message"in e?new Error(e.message||"Unknown error"):new Error("Unknown error occurred")}const Wn={redirects:{all:["redirects"],lists:()=>[...Wn.redirects.all,"list"],list:e=>[...Wn.redirects.lists(),e],detail:e=>[...Wn.redirects.all,"detail",e]},groups:{all:["groups"],lists:()=>[...Wn.groups.all,"list"],list:e=>[...Wn.groups.lists(),e],detail:e=>[...Wn.groups.all,"detail",e]},logs:{all:["logs"],lists:()=>[...Wn.logs.all,"list"],list:e=>[...Wn.logs.lists(),e]},errors:{all:["errors"],lists:()=>[...Wn.errors.all,"list"],list:e=>[...Wn.errors.lists(),e]},settings:{all:["settings"],get:()=>[...Wn.settings.all,"get"],status:()=>[...Wn.settings.all,"status"]},pluginInfo:{all:["pluginInfo"],get:()=>[...Wn.pluginInfo.all,"get"]},io:{all:["io"],importers:()=>[...Wn.io.all,"importers"]},info:{all:["info"],ip:e=>[...Wn.info.all,"ip",e],agent:e=>[...Wn.info.all,"agent",e],http:e=>[...Wn.info.all,"http",e]}},Zn={errors:[],notices:[],inProgress:0},Gn=X()(se(e=>({...Zn,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(Zn)}),{name:"MessageStore"}));function Vn(e){return pt({queryKey:Wn.io.importers(),queryFn:async()=>{const e=await St($t());return e?.importers||[]},...e})}function Qn(e){const t=u(),{addNotice:n,addError:r}=Gn();return mt({mutationFn:async e=>await St(Bt(e)),onSuccess:()=>{n("Import completed"),t.invalidateQueries({queryKey:Wn.redirects.lists()})},onError:e=>{r(e.message||"Import failed")},...e})}function Kn({setStep:e,step:t,options:n,setOptions:r}){const{log:o=!1,ip:s=!1,monitor:a=!1}=n?.settings??{},{data:c=[]}=Vn(),u=0===c.length?t+2:t+1;function d(e){r({settings:{...n.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")," ",D((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(O,{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){r({settings:{...n.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")," ",D((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(O,{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")," ",D((0,i.__)("{{link}}Read more about this.{{/link}}","redirection"),{link:(0,l.jsx)(O,{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 Jn=function({error:e}){const{request:t}=e,n=function(e){return!!(e&&e.raw&&e.raw.length>500)}(t),[r,s]=(0,o.useState)(n);return t&&t.raw?(0,l.jsxs)(l.Fragment,{children:[n&&r&&(0,l.jsx)("button",{className:"api-result-hide",type:"button",onClick:e=>{e.preventDefault(),s(!1)},children:(0,i.__)("Show Full","redirection")}),n&&!r&&(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:r?t.raw.substring(0,500)+" ...":t.raw})]}):null},Yn=(e,t)=>{const n=e.data?.status;return"number"==typeof n&&n>0?`${t} ${n}`:`${t} ${"rest_api_cors_mismatch"===e.code?"blocked":"failed"}`},Xn=({error:e,methods:t})=>{const n=(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,n)=>(0,l.jsx)("span",{className:"api-result-method_fail",children:Yn(e,t)},n)),n&&(0,l.jsxs)("strong",{children:[n,": "]}),e.message]}),(0,l.jsx)(L,{error:e,links:V(),locale:"redirection"}),(0,l.jsx)(Jn,{error:e})]})]},t.join(""))},er=({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("")),tr=e=>e.code?e.code:0,nr=({result:e})=>{const t=[],{GET:n,POST:r}=e;return n.status===r.status&&tr(n)===tr(r)?("fail"===n.status&&n.error?t.push((0,l.jsx)(Xn,{error:n.error,methods:["GET","POST"]},"get-post")):t.push((0,l.jsx)(er,{methods:["GET","POST"]},"get-post")),t):("fail"===n.status&&n.error?t.push((0,l.jsx)(Xn,{error:n.error,methods:["GET"]},"get")):t.push((0,l.jsx)(er,{methods:["GET"]},"get")),"fail"===r.status&&r.error?t.push((0,l.jsx)(Xn,{error:r.error,methods:["POST"]},"post")):t.push((0,l.jsx)(er,{methods:["POST"]},"post")),t)},rr=({item:e,result:t,routes:n,isCurrent:r,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&&!r&&(0,l.jsx)("input",{type:"submit",className:"button button-secondary",value:(0,i.__)("Switch to this API","redirection")}),o&&r&&(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)(O,{url:n[e.value]||"",children:n[e.value]||""})})]}),(0,l.jsx)(nr,{result:t})]}),ir=({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"})})},or=e=>{const{title:t,url:n=!1,children:r}=e;return(0,l.jsxs)("tr",{children:[(0,l.jsxs)("th",{children:[!n&&t,n&&(0,l.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",children:t})]}),(0,l.jsx)("td",{children:r})]})},sr=e=>(0,l.jsx)("table",{className:"form-table",children:(0,l.jsx)("tbody",{children:e.children})}),ar=({value:e,label:t,disabled:n=!1})=>Array.isArray(e)?(0,l.jsx)("optgroup",{label:String(t),disabled:n,children:e.map((e,t)=>(0,l.jsx)(ar,{label:e.label,value:e.value,disabled:e.disabled||!1},t))}):(0,l.jsx)("option",{value:e,disabled:n,children:t}),lr=ar,cr=({items:e,value:t,name:n,onChange:r,disabled:i=!1,className:o})=>(0,l.jsx)("select",{name:n,value:t,onChange:r,disabled:i,className:o,children:e.map((e,t)=>(0,l.jsx)(lr,{value:e.value,label:e.label,disabled:e.disabled||!1},t))}),ur=()=>[{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")}],dr=function(e){const{settings:t,onChange:n,getLink:r,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)(or,{title:(0,i.__)("RSS Token","redirection")+":",url:r("options","rsstoken"),children:[(0,l.jsx)("input",{className:"regular-text",type:"text",value:c,name:"token",onChange:n}),(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)(or,{title:(0,i.__)("Apache .htaccess","redirection"),url:r("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:n})]}),(0,l.jsx)("p",{className:"sub",children:D((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)(or,{title:(0,i.__)("REST API","redirection"),url:r("options","restapi"),children:[(0,l.jsx)(cr,{items:ur(),name:"rest_api",value:String(u),onChange:n})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)("How Redirection uses the REST API - don't change unless necessary","redirection")})]}),(0,l.jsxs)(or,{title:(0,i.__)("Data Upgrade","redirection"),children:[(0,l.jsx)(cr,{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:n})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)("Decide how Redirection updates itself, if needed.","redirection")})]})]})},pr=/^[cC][0-9a-z]{6,}$/,hr=/^[0-9a-z]+$/,fr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,mr=/^[0-9a-vA-V]{20}$/,gr=/^[A-Za-z0-9]{27}$/,yr=/^[a-zA-Z0-9_-]{21}$/,_r=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vr=/^([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})$/,br=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)$/,xr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wr=/^(?:(?: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])$/,jr=/^(([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}|:))$/,Sr=/^((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])$/,kr=/^(([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])$/,Cr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tr=/^[A-Za-z0-9_-]*$/,Er=/^https?$/,Pr=/^\+[1-9]\d{6,14}$/,Rr="(?:(?:\\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])))",Or=new RegExp(`^${Rr}$`);function Nr(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 Ar=/^-?\d+$/,Fr=/^-?\d+(?:\.\d+)?$/,Ir=/^(?:true|false)$/i,zr=/^[^A-Z]*$/,Dr=/^[^a-z]*$/,Lr=rn("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mr={number:"number",bigint:"bigint",object:"date"},Ur=rn("$ZodCheckLessThan",(e,t)=>{Lr.init(e,t);const n=Mr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$r=rn("$ZodCheckGreaterThan",(e,t)=>{Lr.init(e,t);const n=Mr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Br=rn("$ZodCheckMultipleOf",(e,t)=>{Lr.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),qr=rn("$ZodCheckNumberFormat",(e,t)=>{Lr.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Pn[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=Ar)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,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:r,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:r,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})}}),Hr=rn("$ZodCheckMaxLength",(e,t)=>{var n;Lr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!pn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=In(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wr=rn("$ZodCheckMinLength",(e,t)=>{var n;Lr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!pn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=In(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zr=rn("$ZodCheckLengthEquals",(e,t)=>{var n;Lr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!pn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,i=r.length;if(i===t.length)return;const o=In(r),s=i>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Gr=rn("$ZodCheckStringFormat",(e,t)=>{var n,r;Lr.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Vr=rn("$ZodCheckRegex",(e,t)=>{Gr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Qr=rn("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zr),Gr.init(e,t)}),Kr=rn("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Dr),Gr.init(e,t)}),Jr=rn("$ZodCheckIncludes",(e,t)=>{Lr.init(e,t);const n=Cn(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);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=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Yr=rn("$ZodCheckStartsWith",(e,t)=>{Lr.init(e,t);const n=new RegExp(`^${Cn(t.prefix)}.*`);t.pattern??(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=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Xr=rn("$ZodCheckEndsWith",(e,t)=>{Lr.init(e,t);const n=new RegExp(`.*${Cn(t.suffix)}$`);t.pattern??(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=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ei=rn("$ZodCheckOverwrite",(e,t)=>{Lr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class ti{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),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,n.join("\n"))}}const ni=e=>(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new on;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Fn(e,o,ln())));throw bn(t,i?.callee),t}return s.value},ri=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>Fn(e,o,ln())));throw bn(t,i?.callee),t}return s.value},ii=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new on;return o.issues.length?{success:!1,error:new(e??Ln)(o.issues.map(e=>Fn(e,i,ln())))}:{success:!0,data:o.value}},oi=ii(Mn),si=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Fn(e,i,ln())))}:{success:!0,data:o.value}},ai=si(Mn),li=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ni(e)(t,n,i)},ci=e=>(t,n,r)=>ni(e)(t,n,r),ui=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ri(e)(t,n,i)},di=e=>async(t,n,r)=>ri(e)(t,n,r),pi=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ii(e)(t,n,i)},hi=e=>(t,n,r)=>ii(e)(t,n,r),fi=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return si(e)(t,n,i)},mi=e=>async(t,n,r)=>si(e)(t,n,r),gi={major:4,minor:4,patch:3},yi=rn("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gi;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=Rn(e);for(const o of t){if(o._zod.def.when){if(On(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===n?.async)throw new on;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||(i=Rn(e,t)))});else{if(e.issues.length===t)continue;i||(i=Rn(e,t))}}return r?r.then(()=>e):e},n=(n,i,o)=>{if(Rn(n))return n.aborted=!0,n;const s=t(i,r,o);if(s instanceof Promise){if(!1===o.async)throw new on;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=>n(e,i,o)):n(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new on;return s.then(e=>t(e,r,o))}return t(s,r,o)}}mn(e,"~standard",()=>({validate:t=>{try{const n=oi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return ai(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),_i=rn("$ZodString",(e,t)=>{var n;yi.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),vi=rn("$ZodStringFormat",(e,t)=>{Gr.init(e,t),_i.init(e,t)}),bi=rn("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vr),vi.init(e,t)}),xi=rn("$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=br(e))}else t.pattern??(t.pattern=br());vi.init(e,t)}),wi=rn("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xr),vi.init(e,t)}),ji=rn("$ZodURL",(e,t)=>{vi.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Er.source&&!/^https?:\/\//i.test(r))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.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)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Si=rn("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),vi.init(e,t)}),ki=rn("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=yr),vi.init(e,t)}),Ci=rn("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pr),vi.init(e,t)}),Ti=rn("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hr),vi.init(e,t)}),Ei=rn("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fr),vi.init(e,t)}),Pi=rn("$ZodXID",(e,t)=>{t.pattern??(t.pattern=mr),vi.init(e,t)}),Ri=rn("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=gr),vi.init(e,t)}),Oi=rn("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Nr({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Rr}T(?:${r})$`)}(t)),vi.init(e,t)}),Ni=rn("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Or),vi.init(e,t)}),Ai=rn("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Nr(t)}$`)),vi.init(e,t)}),Fi=rn("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_r),vi.init(e,t)}),Ii=rn("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wr),vi.init(e,t),e._zod.bag.format="ipv4"}),zi=rn("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=jr),vi.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Di=rn("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Sr),vi.init(e,t)}),Li=rn("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kr),vi.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Mi(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 Ui=rn("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cr),vi.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Mi(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),$i=rn("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Tr),vi.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Tr.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Mi(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Bi=rn("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pr),vi.init(e,t)}),qi=rn("$ZodJWT",(e,t)=>{vi.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Hi=rn("$ZodNumber",(e,t)=>{yi.init(e,t),e._zod.pattern=e._zod.bag.pattern??Fr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Wi=rn("$ZodNumberFormat",(e,t)=>{qr.init(e,t),Hi.init(e,t)}),Zi=rn("$ZodBoolean",(e,t)=>{yi.init(e,t),e._zod.pattern=Ir,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Gi=rn("$ZodUnknown",(e,t)=>{yi.init(e,t),e._zod.parse=e=>e}),Vi=rn("$ZodNever",(e,t)=>{yi.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Qi(e,t,n){e.issues.length&&t.issues.push(...Nn(n,e.issues)),t.value[n]=e.value}const Ki=rn("$ZodArray",(e,t)=>{yi.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.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:[]},r);a instanceof Promise?o.push(a.then(t=>Qi(t,n,e))):Qi(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function Ji(e,t,n,r,i,o){const s=n in r;if(e.issues.length){if(i&&o&&!s)return;t.issues.push(...Nn(n,e.issues))}s||i?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function Yi(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Xi(e,t,n,r,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:[]},r);o instanceof Promise?e.push(o.then(e=>Ji(e,n,i,t,u,d))):Ji(o,n,i,t,u,d)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const eo=rn("$ZodObject",(e,t)=>{yi.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=dn(()=>Yi(t));mn(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const i=xn,o=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.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 r=c[e],i="optional"===r._zod.optin,o="optional"===r._zod.optout,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ji(n,t,e,a,i,o))):Ji(s,t,e,a,i,o)}return o?Xi(l,a,t,n,r.value,e):l.length?Promise.all(l).then(()=>t):t}}),to=rn("$ZodObjectJIT",(e,t)=>{eo.init(e,t);const n=e._zod.parse,r=dn(()=>Yi(t));let i;const o=xn,s=!an.jitless,a=s&&wn.value,l=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=r.value);const p=u.value;return o(p)?s&&a&&!1===d?.async&&!0!==d.jitless?(i||(i=(e=>{const t=new ti(["shape","payload","ctx"]),n=r.value,i=e=>{const t=vn(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 n.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=vn(r),a=e[r],l="optional"===a?._zod?.optin,c="optional"===a?._zod?.optout;t.write(`const ${n} = ${i(r)};`),l&&c?t.write(`\n if (${n}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):l?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${s} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${s}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${s}] = undefined;\n } else {\n newResult[${s}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),u=i(u,d),l?Xi([],p,u,d,c,e):u):n(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u)}});function no(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!Rn(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Fn(e,r,ln())))}),t)}const ro=rn("$ZodUnion",(e,t)=>{yi.init(e,t),mn(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),mn(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),mn(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),mn(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=>hn(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.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=>no(t,r,e,i)):no(s,r,e,i)}}),io=rn("$ZodIntersection",(e,t)=>{yi.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>so(e,t,n)):so(e,i,o)}});function oo(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(jn(e)&&jn(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const n of r){const r=oo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=oo(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function so(e,t,n){const r=new Map;let i;for(const n of t.issues)if("unrecognized_keys"===n.code){i??(i=n);for(const e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);const o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),Rn(e))return e;const s=oo(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const ao=rn("$ZodRecord",(e,t)=>{yi.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!jn(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],s=t.keyType._zod.values;if(s){n.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:[]},r);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>Fn(e,r,ln())),input:l,path:[l],inst:e});continue}const c=s.value,u=t.valueType._zod.run({value:i[l],issues:[]},r);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&n.issues.push(...Nn(l,e.issues)),n.value[c]=e.value})):(u.issues.length&&n.issues.push(...Nn(l,u.issues)),n.value[c]=u.value)}let l;for(const e in i)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.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:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&Fr.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},r);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?n.value[s]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Fn(e,r,ln())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...Nn(s,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...Nn(s,l.issues)),n.value[a.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),lo=rn("$ZodEnum",(e,t)=>{yi.init(e,t);const n=cn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>kn.has(typeof e)).map(e=>"string"==typeof e?Cn(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),co=rn("$ZodTransform",(e,t)=>{yi.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new sn(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new on;return n.value=i,n.fallback=!0,n}});function uo(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const po=rn("$ZodOptional",(e,t)=>{yi.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${hn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>uo(e,r)):uo(i,r)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),ho=rn("$ZodExactOptional",(e,t)=>{po.init(e,t),mn(e._zod,"values",()=>t.innerType._zod.values),mn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),fo=rn("$ZodNullable",(e,t)=>{yi.init(e,t),mn(e._zod,"optin",()=>t.innerType._zod.optin),mn(e._zod,"optout",()=>t.innerType._zod.optout),mn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${hn(e.source)}|null)$`):void 0}),mn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),mo=rn("$ZodDefault",(e,t)=>{yi.init(e,t),e._zod.optin="optional",mn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>go(e,t)):go(r,t)}});function go(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const yo=rn("$ZodPrefault",(e,t)=>{yi.init(e,t),e._zod.optin="optional",mn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),_o=rn("$ZodNonOptional",(e,t)=>{yi.init(e,t),mn(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>vo(t,e)):vo(i,e)}});function vo(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 bo=rn("$ZodCatch",(e,t)=>{yi.init(e,t),e._zod.optin="optional",mn(e._zod,"optout",()=>t.innerType._zod.optout),mn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Fn(e,n,ln()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Fn(e,n,ln()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),xo=rn("$ZodPipe",(e,t)=>{yi.init(e,t),mn(e._zod,"values",()=>t.in._zod.values),mn(e._zod,"optin",()=>t.in._zod.optin),mn(e._zod,"optout",()=>t.out._zod.optout),mn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>wo(e,t.in,n)):wo(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>wo(e,t.out,n)):wo(r,t.out,n)}});function wo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const jo=rn("$ZodReadonly",(e,t)=>{yi.init(e,t),mn(e._zod,"propValues",()=>t.innerType._zod.propValues),mn(e._zod,"values",()=>t.innerType._zod.values),mn(e._zod,"optin",()=>t.innerType?._zod?.optin),mn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(So):So(r)}});function So(e){return e.value=Object.freeze(e.value),e}const ko=rn("$ZodCustom",(e,t)=>{Lr.init(e,t),yi.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Co(t,n,r,e));Co(i,n,r,e)}});function Co(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(zn(e))}}var To;Symbol("ZodOutput"),Symbol("ZodInput");(To=globalThis).__zod_globalRegistry??(To.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.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 n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const Eo=globalThis.__zod_globalRegistry;function Po(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...En(t)})}function Ro(e,t){return new Ur({check:"less_than",...En(t),value:e,inclusive:!1})}function Oo(e,t){return new Ur({check:"less_than",...En(t),value:e,inclusive:!0})}function No(e,t){return new $r({check:"greater_than",...En(t),value:e,inclusive:!1})}function Ao(e,t){return new $r({check:"greater_than",...En(t),value:e,inclusive:!0})}function Fo(e,t){return new Br({check:"multiple_of",...En(t),value:e})}function Io(e,t){return new Hr({check:"max_length",...En(t),maximum:e})}function zo(e,t){return new Wr({check:"min_length",...En(t),minimum:e})}function Do(e,t){return new Zr({check:"length_equals",...En(t),length:e})}function Lo(e){return new ei({check:"overwrite",tx:e})}function Mo(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??Eo,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 Uo(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),Uo(o,t,r),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&qo(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function $o(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.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 n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;(o||r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}}function Bo(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.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&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(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:n.path??[]})};for(const t of[...e.seen.entries()].reverse())r(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 n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.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 n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ho(t,"input",e.processors),output:Ho(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function qo(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return qo(r.element,n);if("set"===r.type)return qo(r.valueType,n);if("lazy"===r.type)return qo(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return qo(r.innerType,n);if("intersection"===r.type)return qo(r.left,n)||qo(r.right,n);if("record"===r.type||"map"===r.type)return qo(r.keyType,n)||qo(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||qo(r.in,n)||qo(r.out,n);if("object"===r.type){for(const e in r.shape)if(qo(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(qo(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(qo(e,n))return!0;return!(!r.rest||!qo(r.rest,n))}return!1}const Ho=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=Mo({...i??{},target:o,io:t,processors:n});return Uo(e,s),$o(s,e),Bo(s,e)},Wo={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zo=(e,t,n,r)=>{const i=e._zod.def;Uo(i.innerType,t,r),t.seen.get(e).ref=i.innerType},Go=rn("ZodISODateTime",(e,t)=>{Oi.init(e,t),ms.init(e,t)});const Vo=rn("ZodISODate",(e,t)=>{Ni.init(e,t),ms.init(e,t)});const Qo=rn("ZodISOTime",(e,t)=>{Ai.init(e,t),ms.init(e,t)});const Ko=rn("ZodISODuration",(e,t)=>{Fi.init(e,t),ms.init(e,t)});const Jo=ni(Bn),Yo=ri(Bn),Xo=ii(Bn),es=si(Bn),ts=li(Bn),ns=ci(Bn),rs=ui(Bn),is=di(Bn),os=pi(Bn),ss=hi(Bn),as=fi(Bn),ls=mi(Bn),cs=new WeakMap;function us(e,t,n){const r=Object.getPrototypeOf(e);let i=cs.get(r);if(i||(i=new Set,cs.set(r,i)),!i.has(t)){i.add(t);for(const e in n){const t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const ds=rn("ZodType",(e,t)=>(yi.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ho(e,"input"),output:Ho(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Mo({...n,processors:t});return Uo(e,r),$o(r,e),Bo(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Jo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Xo(e,t,n),e.parseAsync=async(t,n)=>Yo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>es(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ts(e,t,n),e.decode=(t,n)=>ns(e,t,n),e.encodeAsync=async(t,n)=>rs(e,t,n),e.decodeAsync=async(t,n)=>is(e,t,n),e.safeEncode=(t,n)=>os(e,t,n),e.safeDecode=(t,n)=>ss(e,t,n),e.safeEncodeAsync=async(t,n)=>as(e,t,n),e.safeDecodeAsync=async(t,n)=>ls(e,t,n),us(e,"ZodType",{check(...e){const t=this.def;return this.clone(yn(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 Tn(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,n){return new e({type:"custom",check:"custom",fn:t,...En(n)})}(fa,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return function(e,t){const n=function(e,t){const n=new Lr({check:"custom",...En(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(zn(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(zn(r))}},e(t.value,t)),t);return n}(e,t)}(e,t))},overwrite(e){return this.check(Lo(e))},optional(){return ra(this)},exactOptional(){return new ia({type:"optional",innerType:this})},nullable(){return sa(this)},nullish(){return ra(sa(this))},nonoptional(e){return function(e,t){return new ca({type:"nonoptional",innerType:e,...En(t)})}(this,e)},array(){return Ws(this)},or(e){return Qs([this,e])},and(e){return new Ks({type:"intersection",left:this,right:e})},transform(e){return pa(this,new ta({type:"transform",transform:e}))},default(e){return t=e,new aa({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():Sn(t)}});var t},prefault(e){return t=e,new la({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():Sn(t)}});var t},catch(e){return new ua({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return pa(this,e)},readonly(){return new ha({type:"readonly",innerType:this})},describe(e){const t=this.clone();return Eo.add(t,{description:e}),t},meta(...e){if(0===e.length)return Eo.get(this);const t=this.clone();return Eo.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:()=>Eo.get(e)?.description,configurable:!0}),e)),ps=rn("_ZodString",(e,t)=>{_i.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Wo[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),l&&(r.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,us(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new Vr({check:"string_format",format:"regex",...En(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new Jr({check:"string_format",format:"includes",...En(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new Yr({check:"string_format",format:"starts_with",...En(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new Xr({check:"string_format",format:"ends_with",...En(t),suffix:e})}(...e))},min(...e){return this.check(zo(...e))},max(...e){return this.check(Io(...e))},length(...e){return this.check(Do(...e))},nonempty(...e){return this.check(zo(1,...e))},lowercase(e){return this.check(function(e){return new Qr({check:"string_format",format:"lowercase",...En(e)})}(e))},uppercase(e){return this.check(function(e){return new Kr({check:"string_format",format:"uppercase",...En(e)})}(e))},trim(){return this.check(Lo(e=>e.trim()))},normalize(...e){return this.check(function(e){return Lo(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(Lo(e=>e.toLowerCase()))},toUpperCase(){return this.check(Lo(e=>e.toUpperCase()))},slugify(){return this.check(Lo(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})}),hs=rn("ZodString",(e,t)=>{_i.init(e,t),ps.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...En(t)})}(gs,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...En(t)})}(vs,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...En(t)})}(Fs,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...En(t)})}(bs,t)),e.guid=t=>e.check(Po(ys,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...En(t)})}(_s,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...En(t)})}(_s,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...En(t)})}(_s,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...En(t)})}(_s,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...En(t)})}(xs,t)),e.guid=t=>e.check(Po(ys,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...En(t)})}(ws,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...En(t)})}(js,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...En(t)})}(Ss,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...En(t)})}(Os,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...En(t)})}(Ns,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...En(t)})}(ks,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...En(t)})}(Cs,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...En(t)})}(Ts,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...En(t)})}(Es,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...En(t)})}(Ps,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...En(t)})}(Rs,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...En(t)})}(As,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,...En(t)})}(Go,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...En(t)})}(Vo,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,...En(t)})}(Qo,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...En(t)})}(Ko,e)}(t))});function fs(e){return function(e,t){return new e({type:"string",...En(t)})}(hs,e)}const ms=rn("ZodStringFormat",(e,t)=>{vi.init(e,t),ps.init(e,t)}),gs=rn("ZodEmail",(e,t)=>{wi.init(e,t),ms.init(e,t)}),ys=rn("ZodGUID",(e,t)=>{bi.init(e,t),ms.init(e,t)}),_s=rn("ZodUUID",(e,t)=>{xi.init(e,t),ms.init(e,t)}),vs=rn("ZodURL",(e,t)=>{ji.init(e,t),ms.init(e,t)}),bs=rn("ZodEmoji",(e,t)=>{Si.init(e,t),ms.init(e,t)}),xs=rn("ZodNanoID",(e,t)=>{ki.init(e,t),ms.init(e,t)}),ws=rn("ZodCUID",(e,t)=>{Ci.init(e,t),ms.init(e,t)}),js=rn("ZodCUID2",(e,t)=>{Ti.init(e,t),ms.init(e,t)}),Ss=rn("ZodULID",(e,t)=>{Ei.init(e,t),ms.init(e,t)}),ks=rn("ZodXID",(e,t)=>{Pi.init(e,t),ms.init(e,t)}),Cs=rn("ZodKSUID",(e,t)=>{Ri.init(e,t),ms.init(e,t)}),Ts=rn("ZodIPv4",(e,t)=>{Ii.init(e,t),ms.init(e,t)}),Es=rn("ZodIPv6",(e,t)=>{zi.init(e,t),ms.init(e,t)}),Ps=rn("ZodCIDRv4",(e,t)=>{Di.init(e,t),ms.init(e,t)}),Rs=rn("ZodCIDRv6",(e,t)=>{Li.init(e,t),ms.init(e,t)}),Os=rn("ZodBase64",(e,t)=>{Ui.init(e,t),ms.init(e,t)}),Ns=rn("ZodBase64URL",(e,t)=>{$i.init(e,t),ms.init(e,t)}),As=rn("ZodE164",(e,t)=>{Bi.init(e,t),ms.init(e,t)}),Fs=rn("ZodJWT",(e,t)=>{qi.init(e,t),ms.init(e,t)}),Is=rn("ZodNumber",(e,t)=>{Hi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.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?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof i&&(r.minimum=i),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof o&&(r.maximum=o),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),us(e,"ZodNumber",{gt(e,t){return this.check(No(e,t))},gte(e,t){return this.check(Ao(e,t))},min(e,t){return this.check(Ao(e,t))},lt(e,t){return this.check(Ro(e,t))},lte(e,t){return this.check(Oo(e,t))},max(e,t){return this.check(Oo(e,t))},int(e){return this.check(Ls(e))},safe(e){return this.check(Ls(e))},positive(e){return this.check(No(0,e))},nonnegative(e){return this.check(Ao(0,e))},negative(e){return this.check(Ro(0,e))},nonpositive(e){return this.check(Oo(0,e))},multipleOf(e,t){return this.check(Fo(e,t))},step(e,t){return this.check(Fo(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function zs(e){return function(e,t){return new e({type:"number",checks:[],...En(t)})}(Is,e)}const Ds=rn("ZodNumberFormat",(e,t)=>{Wi.init(e,t),Is.init(e,t)});function Ls(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...En(t)})}(Ds,e)}const Ms=rn("ZodBoolean",(e,t)=>{Zi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function Us(e){return function(e,t){return new e({type:"boolean",...En(t)})}(Ms,e)}const $s=rn("ZodUnknown",(e,t)=>{Gi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Bs(){return new $s({type:"unknown"})}const qs=rn("ZodNever",(e,t)=>{Vi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});const Hs=rn("ZodArray",(e,t)=>{Ki.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,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=Uo(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,us(e,"ZodArray",{min(e,t){return this.check(zo(e,t))},nonempty(e){return this.check(zo(1,e))},max(e,t){return this.check(Io(e,t))},length(e,t){return this.check(Do(e,t))},unwrap(){return this.element}})});function Ws(e,t){return function(e,t,n){return new e({type:"array",element:t,...En(n)})}(Hs,e,t)}const Zs=rn("ZodObject",(e,t)=>{to.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const e in s)i.properties[e]=Uo(s[e],t,{...r,path:[...r.path,"properties",e]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Uo(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),mn(e,"shape",()=>t.shape),us(e,"ZodObject",{keyof(){return ea(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Bs()})},loose(){return this.clone({...this._zod.def,catchall:Bs()})},strict(){return this.clone({...this._zod.def,catchall:function(e,t){return new e({type:"never",...En(t)})}(qs,e)});var e},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!jn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=yn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return gn(this,"shape",n),n}});return Tn(e,r)}(this,e)},safeExtend(e){return function(e,t){if(!jn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=yn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return gn(this,"shape",n),n}});return Tn(e,n)}(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 n=yn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Tn(e,n)}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Tn(e,yn(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return gn(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=yn(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return gn(this,"shape",r),r},checks:[]});return Tn(e,i)}(this,e)},partial(...e){return function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=yn(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return gn(this,"shape",i),i},checks:[]});return Tn(t,i)}(na,this,e[0])},required(...e){return function(e,t,n){const r=yn(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)i[t]=new e({type:"nonoptional",innerType:r[t]});return gn(this,"shape",i),i}});return Tn(t,r)}(ca,this,e[0])}})});function Gs(e,t){const n={type:"object",shape:e??{},...En(t)};return new Zs(n)}const Vs=rn("ZodUnion",(e,t)=>{ro.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>Uo(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function Qs(e,t){return new Vs({type:"union",options:e,...En(t)})}const Ks=rn("ZodIntersection",(e,t)=>{io.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Uo(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=Uo(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=l})(e,t,n,r)}),Js=rn("ZodRecord",(e,t)=>{ao.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,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=Uo(o.valueType,t,{...r,path:[...r.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=Uo(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Uo(o.valueType,t,{...r,path:[...r.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,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ys(e,t,n){return t&&t._zod?new Js({type:"record",keyType:e,valueType:t,...En(n)}):new Js({type:"record",keyType:fs(),valueType:e,...En(t)})}const Xs=rn("ZodEnum",(e,t)=>{lo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=cn(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new Xs({...t,checks:[],...En(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Xs({...t,checks:[],...En(r),entries:i})}});function ea(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Xs({type:"enum",entries:n,...En(t)})}const ta=rn("ZodTransform",(e,t)=>{co.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new sn(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(zn(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(zn(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});const na=rn("ZodOptional",(e,t)=>{po.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function ra(e){return new na({type:"optional",innerType:e})}const ia=rn("ZodExactOptional",(e,t)=>{ho.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),oa=rn("ZodNullable",(e,t)=>{fo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Uo(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sa(e){return new oa({type:"nullable",innerType:e})}const aa=rn("ZodDefault",(e,t)=>{mo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Uo(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),la=rn("ZodPrefault",(e,t)=>{yo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Uo(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),ca=rn("ZodNonOptional",(e,t)=>{_o.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Uo(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}),ua=rn("ZodCatch",(e,t)=>{bo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;Uo(i.innerType,t,r),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")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),da=rn("ZodPipe",(e,t)=>{xo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;Uo(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function pa(e,t){return new da({type:"pipe",in:e,out:t})}const ha=rn("ZodReadonly",(e,t)=>{jo.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Uo(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),fa=rn("ZodCustom",(e,t)=>{ko.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}),ma=Gs({support:Us().optional(),token:fs().optional(),ip_logging:zs().int().optional(),expire_redirect:zs().int().optional(),expire_404:zs().int().optional(),auto_target:fs().optional(),location:fs().optional(),monitor_post:zs().int().optional(),monitor_types:Ws(fs()).optional(),associated_redirect:fs().optional(),redirect_cache:zs().int().optional(),rest_api:zs().int().optional(),https:Us().optional(),headers:Ws(Bs()).optional(),flag_regex:Us().optional(),flag_query:fs().optional(),flag_trailing:Us().optional(),flag_case:Us().optional(),postTypes:Ys(fs(),fs()).optional(),installed:fs().optional(),warning:fs().optional(),plugin_update:fs().optional()}).passthrough(),ga=Gs({status:ea(["ok","need-update","error"]),version:fs().optional(),required:fs().optional(),reason:fs().optional()});function ya(e){return pt({queryKey:Wn.settings.get(),queryFn:async()=>{de.getState().setLoadStatus("loading"),de.getState().setError(!1);try{const e=await St(Pt()),t=e?.settings||e,n={...t,postTypes:e?.post_types||t.postTypes,installed:e?.installed||t.installed,warning:e?.warning||t.warning};try{const e=ma.parse(n);return de.getState().setValues(e),de.getState().setLoadStatus("success"),e}catch(e){if(e instanceof $n)return de.getState().setValues(n),de.getState().setLoadStatus("success"),Gn.getState().addError("Settings validation failed, using unvalidated data."),n;throw e}}catch(e){const t=Hn(e);throw de.getState().setLoadStatus("error"),de.getState().setError(t.message||"Failed to load settings"),Gn.getState().addError(t.message||"Failed to load settings"),t}},...e})}function _a(e){const t=u(),{updateValues:n,setSaveStatus:r}=de(),{incrementProgress:i,decrementProgress:o,addNotice:s,addError:a}=Gn();return mt({mutationFn:async e=>{i(),r(!0);try{const t=await St(Rt(e)),n=t?.settings||t;return ma.parse(n)}catch(e){throw o(),r(!1),Hn(e)}},onSuccess:e=>{o(),r(!1),n(e),s("Settings saved"),t.invalidateQueries({queryKey:Wn.settings.all})},onError:e=>{a(e.message||"Failed to save settings")},...e})}function va(e){const{setDatabase:t}=de(),{incrementProgress:n,decrementProgress:r,addError:i}=Gn();return mt({mutationFn:async e=>{n(),t({inProgress:!0});try{return await St(Zt("skip"===e||"stop"===e?{upgrade:e}:void 0))}catch(e){throw r(),t({inProgress:!1,result:"failed"}),Hn(e)}},onSuccess:e=>{r(),t({inProgress:!1,...e})},onError:e=>{i(e.message||"Database upgrade failed")},...e})}function ba(e){const t=u(),{setShowDatabase:n}=de(),{addError:r}=Gn();return mt({mutationFn:async()=>{try{return await St(Gt())}catch(e){throw Hn(e)}},onSuccess:()=>{n(!1),t.invalidateQueries({queryKey:Wn.settings.all}),window.location.href=window.Redirectioni10n.pluginRoot},onError:e=>{r(e.message||"Failed to finish setup")},...e})}function xa(e){const t=u(),{setDatabase:n}=de(),{onSuccess:r,...i}=e||{};return mt({mutationFn:async({reason:e,current:t})=>await St(Vt(e,t)),onSuccess:(...e)=>{const[i]=e;n(i.database||{}),t.invalidateQueries({queryKey:Wn.settings.all}),r?.(...e)},...i})}Gs({version:fs(),database:ga,groups:Ws(Bs()).optional(),postTypes:Ws(fs()).optional(),canDelete:Us().optional(),autoTarget:fs().optional()});const wa="ok",ja="fail",Sa="loading",ka="warning-current",Ca="warning-not-selected";function Ta(e){return e===wa?(0,i.__)("Good","redirection"):e===Ca||e===ka?(0,i.__)("Working but some issues","redirection"):(0,i.__)("Unavailable","redirection")}function Ea({allowChange:e=!0}){const[t,n]=a().useState(!1),r=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 n=(e,t,n)=>({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:n,test:t}}}),r={};for(const e of t){const{id:t}=e;r[t]={GET:{status:"loading"},POST:{status:"loading"}}}e(r);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=n(s,i,a);r[t].GET={status:"fail",error:o,code:"cors"},r[t].POST={status:"fail",error:o,code:"cors"},e(r);continue}}catch(e){}try{await St({url:s,method:"GET"}),r[t].GET={status:"ok"}}catch(e){r[t].GET={status:"fail",error:e,code:e?.data?.status||e?.code}}e(r);try{await St({url:s,method:"POST",data:{}}),r[t].POST={status:"ok"}}catch(e){r[t].POST={status:"fail",error:e,code:e?.data?.status||e?.code}}e(r)}return r}})}(),{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(r).length&&u(e.filter(e=>!!e&&!!e.url))},[d,r,u]);const f=()=>{n(!0)},m=e=>t||e===ja,g=ur().map(e=>({text:e.label,value:String(e.value)})),y=function(e,t){if(0===Object.keys(e).length)return 0;const n=2*t.length;let r=0;for(let t=0;t<Object.keys(e).length;t++){const n=Object.keys(e)[t];n&&e[n]&&e[n].GET&&e[n].GET.status!==Sa&&r++,n&&e[n]&&e[n].POST&&e[n].POST.status!==Sa&&r++}return Math.round(r/n*100)}(r,g),_=function(e,t,n){const r=Object.keys(e).filter(t=>{return!(!(n=e[t])||!n.GET||!n.POST||n.GET.status!==ja&&n.POST.status!==ja);var n}).length;return 0===r?"ok":r<t.length?(i=e[n])&&i.GET&&i.POST&&i.GET.status===wa&&i.POST.status===wa?ka:Ca:"fail";var i}(r,g,p),v=y>=100&&m(_)||t,b=h({"api-result-status":!0,"api-result-status_good":_===wa&&y>=100,"api-result-status_problem":_===ka&&Ca&&y>=100,"api-result-status_failed":_===ja&&y>=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:[y<100&&(0,i.sprintf)(
// translators: %s is the percentage complete
// translators: %s is the percentage complete
(0,i.__)("Testing - %s%%","redirection"),String(y)),y>=100&&Ta(_)]}),y<100&&(0,l.jsx)(ir,{})]}),y>=100&&_!==wa&&(0,l.jsx)("button",{className:"button button-secondary api-result-retry",onClick:e=>{e.preventDefault(),n(!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")})]}),y>=100&&_!==wa&&(e=>{const t=m(e);let n=(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===ja&&(n=(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")}),": ",n]}),!t&&(0,l.jsx)("p",{children:(0,l.jsx)("button",{className:"button-secondary",onClick:f,children:(0,i.__)("Show Problems","redirection")})})]})})(_),v&&g.map((t,n)=>{return(0,l.jsx)(rr,{item:t,result:(i=r,o=t.value,i&&i[o]?i[o]:{}),routes:d,isCurrent:p===t.value,allowChange:e||!1},n);var i,o})]})}function Pa(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r&&e[r]&&"ok"===e[r].GET.status&&"ok"===e[r].POST.status)return!0}return!1}function Ra(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r&&e[r]&&"ok"===e[r].GET.status&&"ok"===e[r].POST.status)return r}return null}function Oa({setStep:e,step:t}){let n=null,r=null,s=null;try{n=new URL(window.Redirectioni10n.api.WP_API_root),r=new URL(window.Redirectioni10n.pluginBaseUrl),s=new URL(window.location.href)}catch(e){}const a=n&&r&&(n.protocol!==r.protocol||n.host!==r.host),c=n&&s&&n.origin!==s.origin,u=de(e=>e.apiTest),d=Pa(u);return(0,o.useEffect)(()=>()=>{const e=Ra(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:D((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)(O,{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:D((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)(O,{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:n?n.protocol+"//"+n.host:"unknown url"})}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:r?r.protocol+"//"+r.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:n?n.origin:"unknown url"})})]}),(0,l.jsx)(Ea,{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 Na(e){return Na="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},Na(e)}function Aa(e,t,n){return(t=function(e){var t=function(e){if("object"!=Na(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Na(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Na(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fa(Object(n),!0).forEach(function(t){Aa(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var za=n(500),Da=n.n(za),La={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Ma=["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"];const Ua=function(e){var t=Ia(Ia({},La),e),n=t.className,r=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 n,r,i=m(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,Ma);delete h.gapPosition;var g,y,_=Array.isArray(r)?r:[r],v=Array.isArray(s)?s:[s],b=(g=(0,o.useRef)([]),y=(0,o.useRef)(null),(0,o.useEffect)(function(){var e=Date.now(),t=!1;g.current.forEach(function(n){if(n){t=!0;var r=n.style;r.transitionDuration=".3s, .3s, .3s, .06s",y.current&&e-y.current<100&&(r.transitionDuration="0s, 0s")}}),t&&(y.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:Da()("".concat(i,"-line"),n),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"}),_.map(function(e,t){var n=1;switch(a){case"round":n=1-l/100;break;case"square":n=1-l/2/100;break;default:n=1}var r={strokeDasharray:"".concat(e*n,"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:r})}))};var $a,Ba=0,qa=!("undefined"==typeof window||!window.document||!window.document.createElement);n.dn(function(e){var t=(void 0)($a.useState(),2),n=t[0],r=t[1];return $a.useEffect(function(){var e;r("rc_progress_".concat((qa?(e=Ba,Ba+=1):e="TEST_OR_SSR",e)))},[]),e||n});const Ha=function({message:e,prevent:t=!0}){const n=(0,o.useRef)();return(0,o.useEffect)(()=>{n.current=t=>(t.returnValue=e,t.returnValue)},[e]),(0,o.useEffect)(()=>{if(!t||!n.current)return;const e=e=>{if(n.current)return n.current(e)};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[t]),null};function Wa({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 Za({onRetry:e,error:t}){const{current:n,next:r,debug:o,reason:s}=de(e=>e.database),{mutate:a}=va(),c=function(e,t,n,r){return[e?"Message: "+e:null,"Installed: "+t,"Next: "+n,r.length>0?"Debug: "+r.join("\n"):null].filter(e=>e).join("\n")}(s,n,r,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")})," ","-"!==n&&(0,l.jsx)("button",{className:"button button-secondary",onClick:function(){a("skip")},children:(0,i.__)("Skip this stage","redirection")})," ","-"!==n&&(0,l.jsx)("button",{className:"button button-secondary",onClick:function(){a("stop")},children:(0,i.__)("Stop upgrade","redirection")})]}),(0,l.jsx)("p",{children:D((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 Ga(e){return"need-update"===e?(0,i.__)("Upgrading Redirection","redirection"):(0,i.__)("Setting up Redirection","redirection")}function Va(e){return"finish-install"===e||"finish-update"===e}function Qa({children:e}){const t=de(e=>e.database),{status:n,reason:r,result:s,complete:a}=t,c="ok"===s&&!Va(n),{mutate:u}=va(),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)})(n,s)&&setTimeout(()=>{p()},1e3)},[a,n,s,p]),(0,l.jsxs)("div",{className:"redirection-database",children:[(0,l.jsx)(Ha,{message:(0,i.__)("Leaving before the process has completed may cause problems.","redirection"),prevent:"error"!==s&&"failed"!==s&&!Va(n)}),(0,l.jsx)("h1",{children:Ga(n)}),(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)(Ua,{percent:a,strokeWidth:4,trailWidth:4,strokeLinecap:"square"}),r&&"ok"===s&&(0,l.jsx)("p",{children:r}),c&&(0,l.jsx)("div",{className:"redirection-database_spinner",children:(0,l.jsx)(ir,{})}),"error"===s&&(0,l.jsx)(Za,{error:r||"",onRetry:d}),"failed"===s&&(0,l.jsx)(Wa,{error:r||"",onRetry:d}),Va(n)&&e]})]})}function Ka({onCancel:e,onComplete:t}){const n=de(e=>e.loadStatus),{mutate:r}=xa({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"===n&&(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(){r({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 Ja({step:e,setStep:t,options:n,setOptions:r}){const{manual:o}=n;return o?(0,l.jsx)(Ka,{onCancel:function(){t(0),r({manual:!1})},onComplete:function(){t(e+1)}}):(0,l.jsx)(Qa,{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 Ya="wordpress-old-slugs";function Xa({setOptions:e,options:t,setStep:n,step:r}){const{importers:o=[Ya]}=t,{data:s=[]}=Vn(),a=s.find(e=>e.id===Ya),c=s.filter(e=>e.id!==Ya);function u(t){const n=o.filter(e=>e!==t.target.name);t.target.checked?e({importers:n.concat(t.target.name)}):e({importers:n})}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:Ya,onChange:u,checked:o.includes(Ya)}),(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:()=>n(r+1),children:(0,i.__)("Continue","redirection")})," ",(0,l.jsx)("button",{className:"button",onClick:()=>n(r-1),children:(0,i.__)("Go back","redirection")})]})]})}function el({step:e,setStep:t,options:n}){const r=Qn(),{mutate:s}=r;let a="idle";r.isPending?a="loading":r.isSuccess?a="success":r.isError&&(a="error");const c=(0,o.useCallback)(()=>{s(n.importers)},[s,n.importers]);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 tl({options:e}){const t=de(e=>e.apiTest),{addError:n}=Gn(),{mutate:r}=_a(),{mutate:o}=ba(),s=Pa(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:D((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)(O,{url:"https://redirection.me"})})}),(0,l.jsx)("button",{className:"button button-primary",onClick:function(){if(!s)return void n((0,i.__)("You need at least one working REST API to finish setup.","redirection"));const{ip:a,log:l,monitor:c}=e.settings,u=Ra(t);r({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 nl=function(){const[e,t]=(0,o.useState)(0),[n,r]=(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?Xa:4===e?Ja:3===e?Oa:1===e?Kn:5===e?el:6===e?tl:he}(e);return(0,l.jsxs)(l.Fragment,{children:["error"===s&&(0,l.jsx)(W,{details:Q(),errors:a,renderDebug:pe,links:V(),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:n,step:e,setStep:function(e){let r=e;5===e&&0===n.importers.length&&(r=e+1),t(r)},setOptions:e=>r({...n,...e})})})]}),(0,l.jsx)("div",{className:"wizard-support",children:(0,l.jsx)(O,{url:"https://redirection.me/contact/",children:(0,i.__)("I need support!","redirection")})})]})};function rl(e){return window.Redirectioni10n.pluginRoot+"&sub=rss&module=1&token="+encodeURIComponent(e)}function il(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function ol(e){return e?/^https?:\/\//i.test(e)?e:"https://"+e:document.location.origin}function sl(e){const t={};for(const n of e)n&&(t[n.moduleName]||(t[n.moduleName]=[]),t[n.moduleName].push({value:n.id,label:n.name}));return Object.keys(t).map(e=>({label:e,value:t[e]}))}function al(e,t){const n=window.Redirectioni10n.api.WP_API_nonce;return window.Redirectioni10n.pluginRoot+"&sub=io&export="+encodeURIComponent(e)+"&exporter="+encodeURIComponent(t)+"&_wpnonce="+encodeURIComponent(n)}function ll(e){return"finish-install"===e||"finish-update"===e}function cl(){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:D((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 ul(){const{mutate:e}=xa();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 dl({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 pl(){const e=de(e=>e.database.reason),t=de(e=>e.database.status),n=de(e=>e.database.result),{mutate:r}=ba();return(0,l.jsxs)(l.Fragment,{children:["error"===n&&(0,l.jsx)(W,{details:Q(),errors:e,renderDebug:pe,links:V(),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)(Qa,{}),ll(t)&&(0,l.jsx)("button",{className:"button button-primary",onClick:function(){r()},children:(0,i.__)("Finished! 🎉","redirection")})]})})]})}function hl({onShowUpgrade:e}){const[t,n]=(0,o.useState)(!1);function r(e){e.preventDefault(),n(!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")}),cl(),(0,l.jsx)("p",{children:D((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)(O,{url:al("all","json")}),import:(0,l.jsx)(O,{url:"https://redirection.me/support/import-export-redirects/"})})}),t?(0,l.jsx)(ul,{}):(0,l.jsx)(dl,{onShowUpgrade:e})]}),(0,l.jsxs)("div",{className:"database-switch",children:[!t&&(0,l.jsx)("button",{type:"button",onClick:r,children:(0,i.__)("Manual Upgrade","redirection")}),t&&(0,l.jsx)("button",{type:"button",onClick:r,children:(0,i.__)("Automatic Upgrade","redirection")})]})]})}function fl({showDatabase:e,onShowUpgrade:t}){return e?(0,l.jsx)(pl,{}):(0,l.jsx)(hl,{onShowUpgrade:t})}const ml=({item:e,isCurrent:t,onClick:n,isLast:r,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(),n(e.value,o)},children:e.name})," ",!r&&"|"," "]})},gl=(e,t,n)=>e===t.value||e===n&&""===t.value,yl=({onChangePage:e,menu:t,home:n,urlBase:r,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)(ml,{item:o,isCurrent:gl(i,o,n),isLast:s===t.length-1,onClick:e,urlBase:r},s))})});let _l=!1;function vl({notices:e}){const t=e[e.length-1],n=t?.message??"";return(0,l.jsx)(l.Fragment,{children:n+(e.length>1?" ("+e.length+")":"")})}const bl=function({notices:e,onClear:t,snackBarViewText:n}){const[r,i]=(0,o.useState)(!1);if((0,o.useEffect)(()=>(e.length>0&&(i(!1),_l&&clearTimeout(_l),_l=setTimeout(()=>i(!0),5e3)),()=>{_l&&clearTimeout(_l)}),[e]),0===e.length)return null;function s(){r?i(!1):t()}const a=h("notice","notice-info","wpl-notice",r&&"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:r?(0,l.jsx)("span",{className:"dashicons dashicons-warning",title:n}):(0,l.jsx)(vl,{notices:e})})]})};function xl(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 n=0;n<e.length;n++)if(!xl(e[n],t[n]))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!xl(e[r],t[r]))return!1}return!0}return!1}function wl(e){return function(e){const t=new URLSearchParams(e),n={},r=new Map;t.forEach((e,t)=>{const n=t.replace(/\[\d*\]$/,"");r.has(n)||r.set(n,[]),r.get(n).push({key:t,value:e})});for(const[e,t]of r){const r=t.map(e=>e.value);r.length>1?n[e]=r:1===r.length&&(n[e]=r[0])}return n}(e?e.slice(1):document.location.search.slice(1))}function jl(e,t,n){const r=wl(n);for(const n in e){const i=xl(t[n],e[n]);e[n]&&!i||"page"===n?r[n.toLowerCase()]=e[n]:i&&delete r[n.toLowerCase()]}return"?"+function(e){const t=new URLSearchParams;for(const n in e){const r=e[n];if(null!=r)if(Array.isArray(r))if(r.some(e=>"object"==typeof e&&null!==e))t.append(n,JSON.stringify(r));else for(const e of r)null!=e&&t.append(`${n}[]`,String(e));else"object"==typeof r?t.append(n,JSON.stringify(r)):t.append(n,String(r))}return t.toString()}(r)}function Sl(e,t){const n=wl(t);return n.sub&&-1!==e.indexOf(n.sub)?n.sub:e[0]}const kl=function(e){const{page:t,setPage:n,children:r,onPageChange:i,defaultPage:s,baseUrl:a,allowedPages:c}=e,u=(0,o.useRef)(void 0),d=(0,o.useCallback)(()=>{const e=Sl(window.Redirectioni10n?.caps?.pages||c);n(e)},[c,n]);return(0,o.useEffect)(()=>(window.addEventListener("popstate",d),()=>{window.removeEventListener("popstate",d)}),[d]),(0,o.useEffect)(()=>{i(),u.current&&u.current!==t&&history.pushState({},"",jl({sub:t},{sub:s},a)),u.current=t},[a,s,i,t]),(0,l.jsx)(l.Fragment,{children:r})},Cl=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ea,{}),(0,l.jsx)("h3",{children:(0,i.__)("What do I do next?","redirection")}),(0,l.jsxs)("ol",{children:[(0,l.jsx)("li",{children:D((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:D((0,i.__)("{{link}}Caching software{{/link}}, in particular Cloudflare, can cache the wrong thing. Try clearing all your caches.","redirection"),{link:(0,l.jsx)(O,{url:"https://redirection.me/support/problems/cloudflare/"})})}),(0,l.jsx)("li",{children:D((0,i.__)("{{link}}Please temporarily disable other plugins!{{/link}} This fixes so many problems.","redirection"),{link:(0,l.jsx)(O,{url:"https://redirection.me/support/problems/plugins/"})})}),(0,l.jsx)("li",{children:D((0,i.__)("Look at your {{link}}Site Health{{/link}} and resolve any issues.","redirection"),{link:(0,l.jsx)(O,{url:V().siteHealth})})})]})]})};function Tl(){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 El(){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:D((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)(O,{url:"https://github.com/johngodley/redirection/issues"})})})]})}const Pl=function(e,t,n){const r=e?.stack||"",i=function(e,t){if(e&&(e.includes("chrome-extension://")||e.includes("moz-extension://")))return!0;const n=["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 n)if(t.includes(e))return!0;return!1}(r,e?.message||"");return(0,l.jsx)(W,{errors:"",renderDebug:pe,type:"fixed",links:V(),details:Q().concat([r,t?.componentStack||""]),locale:"redirection",children:i?(0,l.jsx)(Tl,{}):(0,l.jsx)(El,{})})},Rl=()=>(0,l.jsx)("div",{className:"wpl-placeholder__container",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})}),Ol=function(e){const{isPrimary:t=!1,isSecondary:n=!0,isSubmit:r=!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":n,"button-delete":c,"wpl-spinner":i});return(0,l.jsxs)("button",{className:d,disabled:a,type:r?"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 Nl="data-focus-lock",Al="data-focus-lock-disabled";function Fl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Il="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,zl=new WeakMap;var Dl={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},Ll=function(){return Ll=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ll.apply(this,arguments)};function Ml(e){return e}function Ul(e,t){void 0===t&&(t=Ml);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),n={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),n}}}};return i}function $l(e,t){return void 0===t&&(t=Ml),Ul(e,t)}Object.create,Object.create;var Bl=$l({},function(e){return{target:e.target,currentTarget:e.currentTarget}}),ql=$l(),Hl=$l(),Wl=function(e){void 0===e&&(e={});var t=Ul(null);return t.options=Ll({async:!0,ssr:!1},e),t}({async:!0,ssr:"undefined"!=typeof document}),Zl=(0,o.createContext)(void 0),Gl=[],Vl=(0,o.forwardRef)(function(e,t){var n,r,i,s,l,c,u,d=(0,o.useState)(),p=d[0],h=d[1],m=(0,o.useRef)(),g=(0,o.useRef)(!1),y=(0,o.useRef)(null),_=(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,P=void 0===E||E,R=(e.allowTextSelection,e.group),O=e.className,N=e.whiteList,A=e.hasPositiveIndices,F=e.shards,I=void 0===F?Gl:F,z=e.as,D=void 0===z?"div":z,L=e.lockProps,M=void 0===L?{}:L,U=e.sideCar,$=e.returnFocus,B=void 0!==$&&$,q=e.focusOptions,H=e.onActivation,W=e.onDeactivation,Z=(0,o.useState)({})[0],G=(0,o.useCallback)(function(e){var t=e.captureFocusRestore;if(!y.current){var n,r=null==(n=document)?void 0:n.activeElement;y.current=r,r!==document.body&&(y.current=t(r))}m.current&&H&&H(m.current),g.current=!0,_()},[H]),V=(0,o.useCallback)(function(){g.current=!1,W&&W(m.current),_()},[W]),Q=(0,o.useCallback)(function(e){var t=y.current;if(t){var n=("function"==typeof t?t():t)||document.body,r="function"==typeof B?B(n):B;if(r){var i="object"==typeof r?r:void 0;y.current=null,e?Promise.resolve().then(function(){return n.focus(i)}):n.focus(i)}}},[B]),K=(0,o.useCallback)(function(e){g.current&&Bl.useMedium(e)},[]),J=ql.useMedium,Y=(0,o.useCallback)(function(e){m.current!==e&&(m.current=e,h(e))},[]),X=f(((n={})[Al]=x&&"disabled",n[Nl]=R,n),M),ee=!0!==j,te=ee&&"tail"!==j,ne=(r=[t,Y],s=i||null,l=function(e){return r.forEach(function(t){return Fl(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,Il(function(){var e=zl.get(u);if(e){var t=new Set(e),n=new Set(r),i=u.current;t.forEach(function(e){n.has(e)||Fl(e,null)}),n.forEach(function(e){t.has(e)||Fl(e,i)})}zl.set(u,r)},[r]),u),re=(0,o.useMemo)(function(){return{observed:m,shards:I,enabled:!x,get active(){return g.current}}},[x,g,I,m]);return a().createElement(o.Fragment,null,ee&&[a().createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:x?-1:0,style:Dl}),A?a().createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:x?-1:1,style:Dl}):null],!x&&a().createElement(U,{id:Z,sideCar:Wl,observed:p,disabled:x,persistentFocus:k,crossFrame:T,autoFocus:P,whiteList:N,shards:I,onActivation:G,onDeactivation:V,returnFocus:Q,focusOptions:q,noFocusGuards:j}),a().createElement(D,f({ref:ne},X,{className:O,onBlur:J,onFocus:K}),a().createElement(Zl.Provider,{value:re},v)),te&&a().createElement("div",{"data-focus-guard":!0,tabIndex:x?-1:0,style:Dl}))});Vl.propTypes={};const Ql=Vl;function Kl(e,t){return Kl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Kl(e,t)}var Jl=function(e){for(var t=Array(e.length),n=0;n<e.length;++n)t[n]=e[n];return t},Yl=function(e){return Array.isArray(e)?e:[e]},Xl=function(e){return Array.isArray(e)?e[0]:e},ec=function(e){return e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode},tc=function(e){return e===document||e&&e.nodeType===Node.DOCUMENT_NODE},nc=function(e,t){var n=e.get(t);if(void 0!==n)return n;var r=function(e,t){return!e||tc(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(ec(e))}(t,nc.bind(void 0,e));return e.set(t,r),r},rc=function(e,t){var n=e.get(t);if(void 0!==n)return n;var r=function(e,t){return!(e&&!tc(e))||!!ac(e)&&t(ec(e))}(t,rc.bind(void 0,e));return e.set(t,r),r},ic=function(e){return e.dataset},oc=function(e){return"INPUT"===e.tagName},sc=function(e){return oc(e)&&"radio"===e.type},ac=function(e){var t=e.getAttribute("data-no-autofocus");return![!0,"true",""].includes(t)},lc=function(e){var t;return Boolean(e&&(null===(t=ic(e))||void 0===t?void 0:t.focusGuard))},cc=function(e){return!lc(e)},uc=function(e){return Boolean(e)},dc=function(e,t){var n=Math.max(0,e.tabIndex),r=Math.max(0,t.tabIndex),i=n-r,o=e.index-t.index;if(i){if(!n)return 1;if(!r)return-1}return i||o},pc=function(e,t,n){return Jl(e).map(function(e,t){var r=function(e){return e.tabIndex<0&&!e.hasAttribute("tabindex")?0:e.tabIndex}(e);return{node:e,index:t,tabIndex:n&&-1===r?(e.dataset||{}).focusGuard?0:-1:r}}).filter(function(e){return!t||e.tabIndex>=0}).sort(dc)},hc=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),fc="".concat(hc,", [data-focus-guard]"),mc=function(e,t){return Jl((e.shadowRoot||e).children).reduce(function(e,n){return e.concat(n.matches(t?fc:hc)?[n]:[],mc(n))},[])},gc=function(e,t){return e.reduce(function(e,n){var r,i=mc(n,t),o=(r=[]).concat.apply(r,i.map(function(e){return function(e,t){var n;return e instanceof HTMLIFrameElement&&(null===(n=e.contentDocument)||void 0===n?void 0:n.body)?gc([e.contentDocument.body],t):[e]}(e,t)}));return e.concat(o,n.parentNode?Jl(n.parentNode.querySelectorAll(hc)).filter(function(e){return e===n}):[])},[])},yc=function(e,t){return Jl(e).filter(function(e){return nc(t,e)}).filter(function(e){return function(e){return!((oc(e)||function(e){return"BUTTON"===e.tagName}(e))&&("hidden"===e.type||e.disabled))}(e)})},_c=function(e,t){return void 0===t&&(t=new Map),Jl(e).filter(function(e){return rc(t,e)})},vc=function(e,t,n){return pc(yc(gc(e,n),t),!0,n)},bc=function(e,t){return pc(yc(gc(e),t),!1)},xc=function(e,t){return e.shadowRoot?xc(e.shadowRoot,t):!(void 0===Object.getPrototypeOf(e).contains||!Object.getPrototypeOf(e).contains.call(e,t))||Jl(e.children).some(function(e){var n;if(e instanceof HTMLIFrameElement){var r=null===(n=e.contentDocument)||void 0===n?void 0:n.body;return!!r&&xc(r,t)}return xc(e,t)})},wc=function(e){if(void 0===e&&(e=document),e&&e.activeElement){var t=e.activeElement;return t.shadowRoot?wc(t.shadowRoot):t instanceof HTMLIFrameElement&&function(){try{return t.contentWindow.document}catch(e){return}}()?wc(t.contentWindow.document):t}},jc=function(e){return e.parentNode?jc(e.parentNode):e},Sc=function(e){return Yl(e).filter(Boolean).reduce(function(e,t){var n=t.getAttribute(Nl);return e.push.apply(e,n?function(e){for(var t=new Set,n=e.length,r=0;r<n;r+=1)for(var i=r+1;i<n;i+=1){var o=e[r].compareDocumentPosition(e[i]);(o&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&t.add(i),(o&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(e,n){return!t.has(n)})}(Jl(jc(t).querySelectorAll("[".concat(Nl,'="').concat(n,'"]:not([').concat(Al,'="disabled"])')))):[t]),e},[])},kc=function(e,t){return void 0===t&&(t=wc(Xl(e).ownerDocument)),!(!t||t.dataset&&t.dataset.focusGuard)&&Sc(e).some(function(e){return xc(e,t)||function(e,t){return Boolean(Jl(e.querySelectorAll("iframe")).some(function(e){return function(e,t){return e===t}(e,t)}))}(e,t)})},Cc=function(e,t){e&&("focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus())},Tc=function(e,t){return sc(e)&&e.name?function(e,t){return t.filter(sc).filter(function(t){return t.name===e.name}).filter(function(e){return e.checked})[0]||e}(e,t):e},Ec=function(e){return e[0]&&e.length>1?Tc(e[0],e):e[0]},Pc=function(e,t){return e.indexOf(Tc(t,e))},Rc="NEW_FOCUS",Oc=function(e,t,n){var r,i=e.map(function(e){return e.node}),o=_c(i.filter((r=n,function(e){var t,n=null===(t=ic(e))||void 0===t?void 0:t.autofocus;return e.autofocus||void 0!==n&&"false"!==n||r.indexOf(e)>=0})));return o&&o.length?Ec(o):Ec(_c(t))},Nc=function(e,t){return void 0===t&&(t=[]),t.push(e),e.parentNode&&Nc(e.parentNode.host||e.parentNode,t),t},Ac=function(e,t){for(var n=Nc(e),r=Nc(t),i=0;i<n.length;i+=1){var o=n[i];if(r.indexOf(o)>=0)return o}return!1},Fc=function(e,t,n){var r=Yl(e),i=Yl(t),o=r[0],s=!1;return i.filter(Boolean).forEach(function(e){s=Ac(s||e,e)||s,n.filter(Boolean).forEach(function(e){var t=Ac(o,e);t&&(s=!s||xc(t,s)?t:Ac(t,s))})}),s},Ic=function(e,t){return e.reduce(function(e,n){return e.concat(function(e,t){return yc((n=e.querySelectorAll("[".concat("data-autofocus-inside","]")),Jl(n).map(function(e){return gc([e])}).reduce(function(e,t){return e.concat(t)},[])),t);var n}(n,t))},[])},zc=function(e,t){var n=wc(Yl(e).length>0?document:Xl(e).ownerDocument),r=Sc(e).filter(cc),i=Fc(n||e,e,r),o=new Map,s=bc(r,o),a=s.filter(function(e){var t=e.node;return cc(t)});if(a[0]){var l,c,u,d=bc([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(uc)),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,n,r,i){var o=e.length,s=e[0],a=e[o-1],l=lc(r);if(!(r&&e.indexOf(r)>=0)){var c=void 0!==r?n.indexOf(r):-1,u=i?n.indexOf(i):c,d=i?e.indexOf(i):-1;if(-1===c)return-1!==d?d:Rc;if(-1===d)return Rc;var p,h,f=c-u,m=n.indexOf(s),g=n.indexOf(a),y=(p=n,h=new Set,p.forEach(function(e){return h.add(Tc(e,p))}),p.filter(function(e){return h.has(e)})),_=void 0!==r?y.indexOf(r):-1,v=i?y.indexOf(i):_,b=y.filter(function(e){return e.tabIndex>=0}),x=void 0!==r?b.indexOf(r):-1,w=i?b.indexOf(i):x,j=x>=0&&w>=0?w-x:v-_;if(!f&&d>=0)return d;if(0===t.length)return d;var S=Pc(e,t[0]),k=Pc(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,n,t);if(m===Rc){var g=Oc(s,f,Ic(r,o))||Oc(s,h,Ic(r,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]}},Dc=0,Lc=!1,Mc=function(e,t,n){void 0===n&&(n={});var r=zc(e,t);if(!Lc&&r){if(Dc>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"),Lc=!0,void setTimeout(function(){Lc=!1},1);Dc++,Cc(r.node,n.focusOptions),Dc--}};function Uc(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 $c=function(e){var t=function(e){if(!e)return null;for(var t=[],n=e;n&&n!==document.body;)t.push({current:Uc(n),parent:Uc(n.parentElement),left:Uc(n.previousElementSibling),right:Uc(n.nextElementSibling)}),n=n.parentElement;return{element:Uc(e),stack:t,ownerDocument:e.ownerDocument}}(e);return function(){return function(e){var t,n,r,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===(n=d.left)||void 0===n?void 0:n.call(d),f=d.current(),m=p.contains(f)?f:void 0,g=null===(r=d.right)||void 0===r?void 0:r.call(d),y=vc([p],l),_=null!==(o=null!==(i=null!=m?m:null==h?void 0:h.nextElementSibling)&&void 0!==i?i:g)&&void 0!==o?o:h;_;){for(var v=0,b=y;v<b.length;v++){var x=b[v];if(null==_?void 0:_.contains(x.node))return x.node}_=_.nextElementSibling}if(y.length)return y[0].node}}}(t)}},Bc=function(e,t,n){void 0===t&&(t={});var r=function(e){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},e)}(t),i=function(e,t,n){if(!e||!t)return console.error("no element or scope given"),{};var r=Yl(t);if(r.every(function(t){return!xc(t,e)}))return console.error("Active element is not contained in the scope"),{};var i=n?vc(r,new Map):bc(r,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,r.scope,r.onlyTabbable);if(i){var o=n(i,r.cycle);o&&Cc(o.node,r.focusOptions)}},qc=function(e,t,n){var r,i,o,s,a=(i=e,o=null===(r=t.onlyTabbable)||void 0===r||r,{first:(s=o?vc(Yl(i),new Map):bc(Yl(i),new Map))[0],last:s[s.length-1]})[n];a&&Cc(a.node,t.focusOptions)};function Hc(e){setTimeout(e,1)}var Wc=function(e){return e&&"current"in e?e.current:e},Zc=function(){return document&&document.activeElement===document.body},Gc=null,Vc=null,Qc=function(){return null},Kc=null,Jc=!1,Yc=!1,Xc=function(){return!0};function eu(e,t,n,r){var i=null,o=e;do{var s=r[o];if(s.guard)s.node.dataset.focusAutoGuard&&(i=s);else{if(!s.lockItem)break;if(o!==e)return;i=null}}while((o+=n)!==t);i&&(i.node.tabIndex=0)}var tu=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},nu=function(e){return bc(e,new Map)},ru=function(){var e,t,n,r,i,o,s,a=!1;if(Gc){var l=Gc,c=l.observed,u=l.persistentFocus,d=l.autoFocus,p=l.shards,h=l.crossFrame,f=l.focusOptions,m=l.noFocusGuards,g=c||Kc&&Kc.portaledElement;if(Zc()&&Vc&&Vc!==document.body&&(!document.body.contains(Vc)||!nu([(s=Vc).parentNode]).some(function(e){return e.node===s}))){var y=Qc();y&&y.focus()}var _=document&&document.activeElement;if(g){var v=[g].concat(p.map(Wc).filter(Boolean));if(_&&!function(e){return(Gc.whiteList||Xc)(e)}(_)||(u||function(){if(!(h?Boolean(Jc):"meanwhile"===Jc)||!m||!Vc||Yc)return!1;var e=nu(v),t=e.findIndex(function(e){return e.node===Vc});return 0===t||t===e.length-1}()||!(Zc()||function(e){void 0===e&&(e=document);var t=wc(e);return!!t&&Jl(e.querySelectorAll("[".concat("data-no-focus-lock","]"))).some(function(e){return xc(e,t)})}())||!Vc&&d)&&(g&&!(kc(v)||_&&function(e,t){return t.some(function(t){return tu(e,t,t)})}(_,v)||(o=_,Kc&&Kc.portaledElement===o))&&(document&&!Vc&&_&&!d?(_.blur&&_.blur(),document.body.focus()):(a=Mc(v,Vc,{focusOptions:f}),Kc={})),(Vc=document&&document.activeElement)!==document.body&&(Qc=$c(Vc)),Jc=!1),document&&_!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var b=document&&document.activeElement,x=(t=Sc(e=v).filter(cc),n=Fc(e,e,t),r=pc(gc([n],!0),!0,!0),i=gc(t,!1),r.map(function(e){var t=e.node;return{node:t,index:e.index,lockItem:i.indexOf(t)>=0,guard:lc(t)}})),w=x.map(function(e){return e.node}).indexOf(b);w>-1&&(x.filter(function(e){var t=e.guard,n=e.node;return t&&n.dataset.focusAutoGuard}).forEach(function(e){return e.node.removeAttribute("tabIndex")}),eu(w,x.length,1,x),eu(w,-1,-1,x))}}}return a},iu=function(e){ru()&&e&&(e.stopPropagation(),e.preventDefault())},ou=function(){return Hc(ru)},su=function(){Yc=!0},au=function(){Yc=!1,Jc="just",Hc(function(){Jc="meanwhile"})},lu={moveFocusInside:Mc,focusInside:kc,focusNextElement:function(e,t){void 0===t&&(t={}),Bc(e,t,function(e,t){var n=e.next,r=e.first;return n||t&&r})},focusPrevElement:function(e,t){void 0===t&&(t={}),Bc(e,t,function(e,t){var n=e.prev,r=e.last;return n||t&&r})},focusFirstElement:function(e,t){void 0===t&&(t={}),qc(e,t,"first")},focusLastElement:function(e,t){void 0===t&&(t={}),qc(e,t,"last")},captureFocusRestore:$c};Bl.assignSyncMedium(function(e){var t=e.target,n=e.currentTarget;n.contains(t)||(Kc={observerNode:n,portaledElement:t})}),ql.assignMedium(ou),Hl.assignMedium(function(e){return e(lu)});const cu=(uu=function(e){return e.filter(function(e){return!e.disabled})},du=function(e){var t=e.slice(-1)[0];t&&!Gc&&(document.addEventListener("focusin",iu),document.addEventListener("focusout",ou),window.addEventListener("focus",su),window.addEventListener("blur",au));var n=Gc,r=n&&t&&t.id===n.id;Gc=t,n&&!r&&(n.onDeactivation(),e.filter(function(e){return e.id===n.id}).length||n.returnFocus(!t)),t?(Vc=null,r&&n.observed===t.observed||t.onActivation(lu),ru(),Hc(ru)):(document.removeEventListener("focusin",iu),document.removeEventListener("focusout",ou),window.removeEventListener("focus",su),window.removeEventListener("blur",au),Vc=null)},function(e){var t,n=[];function r(){t=uu(n.map(function(e){return e.props})),du(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,Kl(e,t)}(o,i),o.peek=function(){return t};var s=o.prototype;return s.componentDidMount=function(){n.push(this),r()},s.componentDidUpdate=function(){r()},s.componentWillUnmount=function(){var e=n.indexOf(this);n.splice(e,1),r()},s.render=function(){return a().createElement(e,this.props)},o}(o.PureComponent);return Aa(i,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(e)+")"),i})(function(){return null});var uu,du,pu=(0,o.forwardRef)(function(e,t){return a().createElement(Ql,f({sideCar:cu,ref:t},e))}),hu=Ql.propTypes||{};hu.sideCar,m(hu,["sideCar"]),pu.propTypes={};const fu=pu;function mu(e){if(null===e)return null;const{left:t,top:n,height:r}=e;return{left:t,top:n+r}}function gu(e,t){return t?{...e,width:t.getBoundingClientRect().width}:e}function yu({style:e,align:t}){const n=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:n,style:e})}const _u=function(e){const{position:t,children:n,popoverPosition:r,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 n=function(e,t,n,r,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,n,r){return"right"===r?e+t-n:"centre"===r?e-n/2:e}(t.left,t.width,e.width?e.width:s,n);return{...e,left:Math.min(a,l),top:o?e.top+5:e.top}}(t,r,i,0,e,!!a);u({content:n,arrow:gu(n,e)})}},[t,r,i,s,a]);return(0,l.jsxs)(l.Fragment,{children:[a&&(0,l.jsx)(yu,{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:n})]})};function vu(e,t){if(!t)return!1;const n=e.target;return!(n&&t.contains(n)||"keydown"===e.type||n&&(n.closest(".wpl-dropdowntext__suggestions")||n.closest(".wpl-multioption")))}function bu(e){const t=(0,o.useRef)(null),{children:n,onOutside:r,className:i}=e,s=(0,o.useCallback)(e=>{(vu(e,t.current)||"key"in e&&"Escape"===e.key)&&r(e)},[r]);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:n})}function xu(e){let t=document.getElementById(e);if(null===t){const n=document.getElementById("wpbody");t=document.createElement("div"),n&&n.parentNode&&(t.setAttribute("id",e),n.parentNode.appendChild(t))}return t}function wu(e,t="bottom"){const n=document.getElementById("wpwrap");if(null===e||null===n)return null;const r=n.getBoundingClientRect(),{height:i,width:o,left:s,top:a}=e.getBoundingClientRect();return{left:"bottom"===t?s-r.left:s+o/2-r.left-7,top:a-r.top+1,width:o,height:i,parentWidth:r.width,parentHeight:r.height,ref:e}}const ju=function(e){const{children:t,className:n,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,r.createPortal)((0,l.jsx)(bu,{className:h("wpl-popover",n),onOutside:e=>{u&&!1===vu(e,u.ref)&&"Escape"!==e.key||a()},children:(0,l.jsx)(fu,{returnFocus:!0,disabled:!p,children:(0,l.jsx)(_u,{position:mu(u),popoverPosition:u,align:i,hasArrow:c,valign:s,style:d,children:t})})}),xu("wpl-dropdown-portal")||document.body)},Su=function(e){const{renderContent:t,className:n,renderToggle:r,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),y=(0,o.useRef)(null);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:h("wpl-popover__toggle",n,u&&"wpl-popover__toggle__disabled"),ref:y,children:r(p,e=>{if(!y.current)return;const t=wu(y.current,s);e?.stopPropagation(),u||(g(t),f(!p))})}),p&&m&&(0,l.jsx)(ju,{align:i,valign:s,hasArrow:a,...void 0!==n?{className:n}:{},onClose:function(){f(!1),d?.()},popoverPosition:m,...c&&m.width?{style:{minWidth:`${m.width}px`}}:{},children:t(()=>f(!1))})]})};function ku({option:e,onChange:t,isSelected:n,optionsType:r="checkbox",name:i}){const{value:o,disabled:s=!1,label:a}=e,c="radio"===r?`multi_${o}`:`multi_${i}_${o}`;return(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:c,type:r,name:i||o,value:o,onChange:e=>t(i,o,"checkbox"!==r||e.target.checked),checked:n(i,o),disabled:s,tabIndex:0}),(0,l.jsx)("label",{"aria-label":e.label,htmlFor:c,children:a})]})}const Cu=function(e){const{option:t,optionsType:n,onChange:r,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)(ku,{option:e,isSelected:i,onChange:r,name:a||e.value,optionsType:n},t))]})},Tu=function(e){const{option:t,isSelected:n,onChange:r}=e;if(t.options){const{optionsType:e="checkbox"}=t;return(0,l.jsx)(Cu,{option:t,optionsType:e,isSelected:n,onChange:r})}const i=t.value||"";return(0,l.jsx)(ku,{option:{label:t.label,value:i,disabled:t.disabled??!1,default:t.default??!1},isSelected:n,onChange:r,optionsType:"checkbox",name:i})},Eu=e=>{const{children:t,className:n,onClick:r,title:i="",onCancel:o,disabled:s=!1,small:a=!1}=e,c={title:i,onClick:r};return(0,l.jsxs)("div",{className:h("wpl-badge",n,{"wpl-badge__click":r,"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 Pu(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r){if(r.value===t)return r;if(r.options){const e=Pu(r.options,t);if(e)return e}}}return null}function Ru(e,t){return e&&t?{title:e.badge||e.label,default:e.default??!1,onRemove:n=>{if(e.value===t.value)return n(e.value||"",e.value||"",!1);const r=(t.options||[]).find(e=>e.default);r?n(t.value||"",r.value,!0):n(t.value||"",e.value||"",!1)}}:null}function Ou(e){const t=Pu(e,""),n=Ru(t,t);return n?[n]:[]}function Nu({selected:e,title:t,options:n,showBadges:r,onChange:i,disabled:o}){let s;if(s=function(e){return Array.isArray(e)?-1!==e.indexOf(""):Boolean(e?.[""])}(e)&&n.length>0?Ou(n):Array.isArray(e)?function(e,t){return-1!==e.indexOf("")?Ou(t):e.map(e=>{const n=Pu(t,e);return Ru(n,n)}).filter(e=>null!==e)}(e,n):function(e,t){return Object.keys(e).map(n=>{const r=Pu(t,n);return"string"==typeof e[n]?Ru(Pu(t,e[n]),r):e[n]?Ru(r,r):null}).filter(e=>null!==e).filter(e=>e&&!0!==e.default)}(e,n),s.length>0&&r){const e=s.slice(0,3).map((e,t)=>e?(0,l.jsx)(Eu,{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&&(!r||0===s.length)?(0,l.jsx)("h5",{children:t}):null}const Au=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"})})},Fu=function(e){const{options:t,selected:n,onChange:r,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 r=n;return e===t?Boolean(r[t]):r[e]===t}return-1!==n.indexOf(t)}function f(e,t,i){if(u)r({...n,[e]:e===t?i:t});else{const o=n,s=e===t?e:t;r(i?[...o,s]:o.filter(e=>e!==s))}}return(0,l.jsx)(Su,{className:d,renderToggle:(e,r)=>(0,l.jsxs)("div",{className:h("action","wpl-multioption__button",a&&"wpl-multioption__disabled",e?"wpl-multioption__button_enabled":null),onClick:r,tabIndex:0,"aria-label":i||"",children:[(0,l.jsx)(Nu,{selected:n,title:i,showBadges:o,options:t,disabled:a,onChange:f}),(0,l.jsx)(Au,{})]}),disabled:a,align:"right",matchMinimum:!0,renderContent:()=>(0,l.jsx)("div",{className:h("wpl-multioption",d),children:t.map((e,t)=>(0,l.jsx)(Tu,{option:e,isSelected:p,onChange:f},t))})})},Iu=function({level:e="notice",children:t,className:n}){return(0,l.jsx)("div",{className:h(`inline-notice inline-${e}`,n),children:t})},zu=()=>[{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")}],Du=function(e){const{settings:t,onChange:n,getLink:r}=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)(or,{title:(0,i.__)("Redirect Logs","redirection")+":",url:r("logs"),children:[(0,l.jsx)(cr,{items:zu(),name:"expire_redirect",value:String(o),onChange:n})," ",(0,i.__)("(time to keep logs for)","redirection")]}),(0,l.jsxs)(or,{title:(0,i.__)("404 Logs","redirection")+":",url:r("tracking-404-errors"),children:[(0,l.jsx)(cr,{items:zu(),name:"expire_404",value:String(s),onChange:n})," ",(0,i.__)("(time to keep logs for)","redirection")]}),(0,l.jsxs)(or,{title:(0,i.__)("IP Logging","redirection")+":",url:r("options","iplogging"),children:[(0,l.jsx)(cr,{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:n})," ",(0,i.__)("(IP logging level)","redirection")]}),(0,l.jsxs)(or,{title:(0,i.__)("IP Address","redirection")+":",url:r("options","ipaddress"),children:[(0,l.jsx)(Fu,{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=>n({ip_headers:e}),title:0===h.length?(0,i.__)("REMOTE_ADDR","redirection"):""}),(0,l.jsx)("p",{children:D((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)(Iu,{level:"warning",children:(0,l.jsx)("p",{children:D((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)(or,{title:(0,i.__)("Proxy Address","redirection")+":",url:r("options","proxy"),children:[(0,l.jsx)(E,{minRows:3,value:p.join("\n"),onChange:e=>n({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)(or,{title:(0,i.__)("Logging","redirection")+":",url:r("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:n,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:n,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:n,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:D((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)(O,{url:r("privacy-gdpr")})})})]})]})};function Lu(e,t,n){const r=[];for(const o in e){const s=e[o],a=!!t.find(e=>e===o);s&&r.push((0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:"monitor-type-"+o,type:"checkbox",name:"monitor_type_"+o,onChange:n,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 r}function Mu(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 Uu=function(e){const{onChange:t,settings:n,groups:r,getLink:o,postTypes:s}=e,{associated_redirect:a,monitor_post:c,monitor_types:u}=n,d=u.length>0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(or,{title:(0,i.__)("URL Monitor","redirection")+":",url:o("options","monitor"),children:Lu(s,u,function(e){const n=e.target.name.replace("monitor_type_",""),i=u.filter(e=>e!==n);e.target.checked&&i.push(n),t({monitor_types:i,monitor_post:i.length>0?Mu(c,r):0,associated_redirect:i.length>0?a:""})})}),d&&(0,l.jsxs)(or,{title:(0,i.__)("URL Monitor Changes","redirection")+":",url:o("options","monitor"),children:[(0,l.jsx)(cr,{items:r,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")]})]})]})},$u=function(e){const{settings:t,onChange:n,getLink:r,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)(Uu,{settings:t,onChange:n,groups:o,getLink:r,postTypes:s}),(0,l.jsxs)(or,{title:(0,i.__)("Default URL settings","redirection")+":",url:r("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:n,checked:a}),(0,l.jsx)("label",{htmlFor:"url-options-flag-case",children:D((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:n,checked:c}),(0,l.jsx)("label",{htmlFor:"url-options-flag-trailing",children:D((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)(or,{title:(0,i.__)("Default query matching","redirection")+":",url:r("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)(cr,{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:n})}),(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)(or,{title:(0,i.__)("Auto-generate URL","redirection")+":",url:r("options","autogenerate"),children:[(0,l.jsx)("input",{className:"regular-text",type:"text",value:d,name:"auto_target",onChange:n}),(0,l.jsx)("br",{}),(0,l.jsx)("span",{className:"sub",children:D((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)(or,{title:(0,i.__)("HTTP Cache Header","redirection"),url:r("options","cache"),children:[(0,l.jsx)(cr,{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:n})," "," ",(0,l.jsx)("span",{className:"sub",children:(0,i.__)('How long to cache redirected 301 URLs (via "Expires" HTTP header)',"redirection")})]}),(0,l.jsxs)(or,{title:(0,i.__)("Redirect Caching","redirection"),url:r("options","cache"),children:[(0,l.jsx)("input",{id:"url-options-cache-key",type:"checkbox",name:"cache_key",onChange:n,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")})})]})]})},Bu=Gs({source:Gs({flag_regex:Us(),flag_trailing:Us(),flag_case:Us(),flag_query:fs()}).optional(),options:Ys(fs(),Bs()).optional()}),qu=Gs({id:zs().int(),url:fs(),match_url:fs().optional(),match_type:fs(),action_type:fs(),action_code:zs().int(),action_data:Bs(),match_data:Bu.nullish(),group_id:zs().int(),title:fs(),position:zs().int().nonnegative(),regex:Us().optional(),last_access:fs().optional(),enabled:Us().optional(),hits:zs().int().nonnegative().optional()}),Hu=(Gs({url:fs().min(1,"Source URL is required"),title:fs().optional(),match_type:fs(),action_type:fs(),action_code:zs().int().min(100).max(599).optional(),action_data:Bs().optional(),match_data:Bu.optional(),group_id:zs().int().positive(),position:zs().int().nonnegative().default(0),enabled:Us().optional()}).partial().extend({id:zs().int()}),Gs({items:Ws(zs().int()),action:ea(["delete","enable","disable","reset"])}),Gs({id:zs().int(),name:fs(),redirects:zs().int().nonnegative(),module_id:zs().int(),moduleName:fs().optional(),enabled:Us()})),Wu=(Gs({name:fs().min(1,"Group name is required"),moduleId:zs().int().positive(),position:zs().int().nonnegative().default(0),enabled:Us().optional()}).partial().extend({id:zs().int()}),Gs({page:zs().int().nonnegative(),per_page:zs().int().positive().max(100),orderby:fs(),direction:ea(["asc","desc"]),selected:Ws(Qs([zs(),fs()])),selectAll:Us().optional(),displayType:fs().optional(),displaySelected:Ws(fs()).optional(),filterBy:Ys(fs(),fs()).optional(),groupBy:fs().optional()})),Zu=e=>Gs({items:Ws(e),total:zs().int().nonnegative(),table:Wu.optional()}),Gu=(Gs({item:Bs(),items:Ws(Bs()).optional(),total:zs().int().nonnegative().optional()}),Gs({code:Qs([fs(),zs()]).optional(),message:fs().optional(),data:Bs().optional(),jsonData:Bs().optional(),request:Gs({url:fs(),method:fs()}).optional()}),Zu(qu)),Vu=Gs({item:qu}),Qu=Zu(Hu),Ku=Gs({item:Hu});function Ju(e){return{...!0===e?.global?{page:0}:{},selected:[],selectAll:!1}}function Yu(e,t){return"ip"===e?{ip:t}:"agent"===e?{agent:t}:{"url-exact":t}}Gs({deleted:zs().int().nonnegative().optional(),updated:zs().int().nonnegative().optional(),items:Ws(Bs()).optional(),total:zs().int().nonnegative().optional()});const Xu=["selected","selectAll","displayType","displaySelected"];function ed(e){const t={};for(const n in e){const r=e[n];Xu.includes(n)||null!=r&&("object"!=typeof r||Array.isArray(r)||0!==Object.keys(r).length)&&(Array.isArray(r)&&0===r.length||"string"==typeof r&&""===r.trim()||(t[n]=r))}return t}function td(e={},t){const n=ed(e);return pt({queryKey:Wn.groups.list(n),refetchOnMount:"always",refetchOnReconnect:!0,queryFn:async()=>{try{const e=await St(It(n));return Qu.parse(e)}catch(e){throw Hn(e)}},...t})}function nd(e,t){return"https://redirection.me/support/"+e+(t?"/#"+t:"")}const rd={},id={},od=function(){const e=de(e=>e.values),t=de(e=>e.saveStatus),n=de(e=>e.values?.installed??""),r=de(e=>e.values?.warning??""),s=de(e=>e.values?.postTypes),{data:a}=td({}),c=a?.items?sl(a.items):[],{mutate:u}=_a(),[d,p]=(0,o.useState)(e??id),h=s??rd;function f(e){if("target"in e){const{target:t}=e,n="checkbox"===t.type?t.checked:t.value;p({...d,[t.name]:n})}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)(sr,{children:[(0,l.jsx)(Du,{settings:d,onChange:f,getLink:nd}),(0,l.jsx)($u,{settings:d,onChange:f,getLink:nd,groups:c,postTypes:h}),(0,l.jsx)(dr,{settings:d,onChange:f,getLink:nd,installed:n,warning:r})]}),(0,l.jsx)(Ol,{isPrimary:!0,isSubmit:!0,disabled:t,children:(0,i.__)("Update","redirection")})]})},sd=function({onClose:e,children:t,className:n}){return(0,l.jsx)(bu,{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",n),children:[(0,l.jsx)("div",{className:"wpl-modal_close",children:(0,l.jsx)("button",{type:"button",onClick:e,children:"✖"})}),t]})})},ad="wpl-modal_shown",ld=function({padding:e=!0,onClose:t,...n}){const r=(0,o.useCallback)(e=>{"Escape"===e.key&&t()},[t]);(0,o.useEffect)(()=>(document.body.classList.add(ad),document.addEventListener("keydown",r),()=>{document.body.classList.remove(ad),document.removeEventListener("keydown",r)}),[r]);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)(sd,{onClose:t,...n})})]})},cd=e=>(0,r.createPortal)((0,l.jsx)(ld,{...e}),xu("wpl-modal")||document.body),ud=function(e){const[t,n]=(0,o.useState)(!1);function r(){n(!1)}return(0,l.jsxs)("div",{className:"wrap",children:[(0,l.jsxs)("form",{action:"",method:"post",onSubmit:function(e){n(!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)(cd,{onClose:r,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(),r()},children:(0,i.__)("Yes! Delete the plugin","redirection")})," ",(0,l.jsx)("button",{className:"button-secondary",onClick:r,children:(0,i.__)("No! Don't delete the plugin")})]})]})})]})},dd=function(){const e=de(e=>e.loadStatus),t=de(e=>e.values);ya();const n=function(){const{incrementProgress:e,decrementProgress:t,addNotice:n,addError:r}=Gn();return mt({mutationFn:async()=>{e();try{return await St(Wt())}catch(e){throw t(),Hn(e)}},onSuccess:()=>{t(),n("Plugin deleted"),window.location.href="/wp-admin/plugins.php"},onError:e=>{r(e.message||"Failed to delete plugin")}})}(),r="success"===e;return"loading"!==e&&t?(0,l.jsxs)("div",{children:["success"===e&&(0,l.jsx)(od,{}),(0,l.jsx)("hr",{}),r&&(0,l.jsx)(ud,{onDelete:()=>{n.mutate()}})]}):(0,l.jsx)(Rl,{})},pd=()=>(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{children:(0,i.__)("Need help?","redirection")}),(0,l.jsx)("p",{children:D((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)(O,{url:"https://redirection.me"}),faq:(0,l.jsx)(O,{url:"https://redirection.me/support/faq/"})})}),(0,l.jsx)("p",{children:(0,l.jsx)("strong",{children:D((0,i.__)("If you want to report a bug please read the {{report}}Reporting Bugs{{/report}} guide.","redirection"),{report:(0,l.jsx)(O,{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)(O,{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)(O,{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:D((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:D((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)(O,{url:"https://searchregex.com/"})})})]});function hd(e,t){return"http"===e.slice(0,4)?e:il(t||document.location.origin,e)}function fd(e){return"object"==typeof e&&void 0!==e.url_from?e.url_from:e}function md({status:e,headers:t,statusMessage:n,isMatch:r}){if(0===e)return n.length>0?(0,l.jsx)(l.Fragment,{children:n}):(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:D((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)(O,{url:"https://redirection.me/support/problems/redirect-returning-404/"})})});if(e>=300&&e<400){if(r)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:D((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)(O,{url:"https://redirection.me/support/problems/redirected-by-another-agent/"})})}):(0,l.jsx)(l.Fragment,{children:D((0,i.__)("Redirected by an unknown agent. {{support}}What does this mean?{{/support}}.","redirection"),{support:(0,l.jsx)(O,{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 gd({step:e,isFirst:t,isLast:n,isMatch:r}){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)(O,{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)(md,{status:parseInt(o.toString(),10),statusMessage:s,headers:a,isFirst:t,isMatch:r})})]})]}),!n&&(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 yd(e,t,n,r){if(!Array.isArray(e)||!n||!r)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 n&&void 0===n.url_from)return"redirection"===i.value.toLowerCase()&&r===t&&hd(o.value)===fd(n);if("object"==typeof n)return"redirection"===i.value.toLowerCase()&&r===t&&hd(o.value,n.server)===fd(n)}return!1}const _d=function({desiredTarget:e,desiredCode:t,http:n,url:r}){const{steps:o}=n;return!n||"error"!==n.status&&"fail"!==n.status||0!==o.length?(0,l.jsxs)("div",{children:[o.map((n,r)=>(0,l.jsx)(gd,{step:n,isFirst:0===r,isLast:r===o.length-1,isMatch:yd(n.headers,n.status,e,t)},r)),(0,l.jsxs)("p",{children:[e&&t&&(0,l.jsxs)(l.Fragment,{children:[D((0,i.__)("If this is not expected then this {{support}}support page{{/support}} may help.","redirection"),{support:(0,l.jsx)(O,{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)(O,{url:`https://redirect.li/http/?url=${encodeURIComponent(r)}`,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 vd({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 bd({url:e,desiredCode:t=0,desiredTarget:n=null}){const{data:r,isLoading:o,isError:s,error:a}=function(e,t){return pt({queryKey:Wn.info.http(e),queryFn:async()=>await St(tn(e)),enabled:!!e,staleTime:0,...t})}(e,{enabled:!!e}),c=s&&a&&a.message||"";if(!o&&!s&&!r)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)(ir,{}),s&&c&&(0,l.jsx)(vd,{error:c}),!o&&!s&&r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h2",{children:D((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)(_d,{http:r,url:e,desiredCode:t,desiredTarget:n})]})]})}const xd=function(){const[e,t]=(0,o.useState)(""),[n,r]=(0,o.useState)(""),s=n.length>0;return(0,l.jsxs)("form",{className:"http-tester",onSubmit:function(t){t.preventDefault(),e.length>0&&r(e)},children:[(0,l.jsx)("h3",{children:(0,i.__)("Redirect Tester","redirection")}),(0,l.jsx)("p",{children:D((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)(O,{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)(bd,{url:n})})]})},wd=()=>(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")})})]}),jd=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]})]})},Sd=e=>{const{status:t}=e,n=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)(jd,{item:e},t))})}),n.length>0&&(0,l.jsx)(wd,{})]})},kd=function(e){const{debug:t}=e,[n,r]=(0,o.useState)(t.database.current),{mutate:s}=xa({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)(cr,{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:n,name:"database_version",onChange:function(e){r(e.target.value)}})," "," ",n!==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:n})},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))})]})]})})},Cd=function(){const e=de(e=>e.pluginStatus.status),t=de(e=>e.pluginStatus.debug);return pt({queryKey:Wn.settings.status(),queryFn:async()=>{try{const e=await St(Ht());return de.getState().setPluginStatus(e),e}catch(e){throw Hn(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)(Ea,{}),(0,l.jsx)("h2",{children:(0,i.__)("Plugin Status","redirection")}),e.length>0&&(0,l.jsx)(Sd,{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)(kd,{debug:t}),!t&&(0,l.jsx)("div",{className:"placeholder-inline",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})})]})},Td=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Cd,{}),(0,l.jsx)(xd,{}),(0,l.jsx)(pd,{})]})};function Ed(e,t){if(!1===e)return!1;const n=function(e){try{let t=e;"http:"!==e.slice(0,5)&&"https:"!==e.slice(0,6)&&(t=document.location.protocol+"//"+e);const n=new URL(t);return{protocol:n.protocol,host:n.host,pathname:n.pathname}}catch(e){return{}}}(e);return n.host&&n.host.length>0?t(n):""}function Pd(e){return Ed(e,e=>e.protocol+"//"+(e.host||"")+(e.pathname||""))}function Rd(e){return Ed(e,e=>e.protocol+"//"+(e.host||""))}const Od=({domain:e,asDomain:t,onChange:n,onDelete:r,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:n})}),(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(),r()},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]}),Nd=({aliases:e,siteDomain:t,onChange:n})=>(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((r,i)=>(0,l.jsx)(Od,{domain:r,asDomain:(Rd(r)||"").replace(/https?:\/\//,""),onChange:t=>((e,t,n,r)=>{const i=t.slice();i[e]=r.target.value,n({aliases:i})})(i,e,n,t),onDelete:()=>((e,t,n)=>{n({aliases:[...t.slice(0,e),...t.slice(e+1)]})})(i,e,n),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,n)=>{n.preventDefault(),t({aliases:e.concat("").slice(0,20)})})(e,n,t),children:(0,i.__)("Add Alias","redirection")})})]}),Ad=({relocate:e,siteDomain:t,onChange:n})=>{const r=((e,t)=>{if(t){const n=Pd(t);if(n&&n.length>0)return(0,l.jsxs)("p",{children:[(0,l.jsx)("code",{children:e})," ⇒ ",(0,l.jsx)("code",{children:n})]})}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=>n({relocate:e.target.value})})]}),r]})};function Fd(e,t,n){return e=e.replace(/https?:\/\//,""),"www"===n?e="www."+e.replace("www.",""):"nowww"===n&&(e=e.replace("www.","")),(t?"https://":"http://")+e}const Id=function({https:e,preferredDomain:t,siteDomain:n,onChange:r}){const o=function(e,t,n){return!(!t||e.includes("https:"))||"www"===n&&!e.includes("www.")||!("nowww"!==n||!e.includes("www."))}(n,e,t),s=e=>{r({[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=>{r({[e.target.name]:e.target.checked})},checked:e})," ",(0,l.jsx)("label",{htmlFor:"canonical-https",children:D((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:n.replace("https","http"),siteHTTPS:n.replace("http:","https:")}),{code:(0,l.jsx)("code",{})})})]}),e&&(0,l.jsx)("div",{className:"inline-notice inline-warning",children:(0,l.jsx)("p",{children:D(
// 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=n,[{
// translators: %(site)s is the site domain
label:D((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:D((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:D((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 n=`canonical-preferred-${e.value||"none"}`;return(0,l.jsxs)("p",{children:[(0,l.jsx)("input",{id:n,type:"radio",name:"preferred_domain",value:e.value,onChange:s,checked:e.value===t})," ",(0,l.jsx)("label",{htmlFor:n,children:e.label})]},e.value)}),o&&(0,l.jsx)("div",{className:"inline-notice inline-error",children:(0,l.jsx)("p",{children:D((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:n,site:Fd(n,e,t)}),{code:(0,l.jsx)("code",{})})})})]});var a},zd=e=>e?.ownerDocument??document,Dd=e=>e&&"window"in e&&e.window===e?e:zd(e).defaultView||window;function Ld(e,t){return!(!t||!e)&&e.contains(t)}const Md=(e=document)=>e.activeElement;function Ud(e){return e.target}const $d="undefined"!=typeof document?o.useLayoutEffect:()=>{};function Bd(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function qd(e){let t=(0,o.useRef)({isFocused:!1,observer:null});return $d(()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,o.useCallback)(n=>{let r=Ud(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r,i=r=>{if(t.current.isFocused=!1,n.disabled){let t=Bd(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};n.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===Md()?null:Md();n.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function Hd(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 Wd(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Zd(e){let t=null;return()=>(null==t&&(t=e()),t)}const Gd=Zd(function(){return Wd(/^Mac/i)}),Vd=Zd(function(){return Wd(/^iPhone/i)}),Qd=Zd(function(){return Wd(/^iPad/i)||Gd()&&navigator.maxTouchPoints>1}),Kd=Zd(function(){return Vd()||Qd()}),Jd=(Zd(function(){return Gd()||Kd()}),Zd(function(){return Hd(/AppleWebKit/i)&&!Yd()})),Yd=Zd(function(){return Hd(/Chrome/i)}),Xd=Zd(function(){return Hd(/Android/i)}),ep=Zd(function(){return Hd(/Firefox/i)});let tp=null;function np(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:o,shiftKey:s}=t;ep()&&window.event?.type?.startsWith("key")&&"_blank"===e.target&&(Gd()?r=!0:i=!0);let a=Jd()&&Gd()&&!Qd()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:r,ctrlKey:i,altKey:o,shiftKey:s}):new MouseEvent("click",{metaKey:r,ctrlKey:i,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});np.isOpening=n,function(e){if(function(){if(null==tp){tp=!1;try{document.createElement("div").focus({get preventScroll(){return tp=!0,!0}})}catch{}}return tp}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}(e),e.dispatchEvent(a),np.isOpening=!1}np.isOpening=!1;let rp=null,ip="keyboard";const op=new Set;let sp=new Map,ap=!1,lp=!1;const cp={Tab:!0,Escape:!0};function up(e,t){for(let n of op)n(e,t)}function dp(e){ap=!0,!np.isOpening&&function(e){return!(e.metaKey||!Gd()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(rp="keyboard",ip="keyboard",up("keyboard",e))}function pp(e){rp="pointer",ip="pointerType"in e?e.pointerType:"mouse","mousedown"!==e.type&&"pointerdown"!==e.type||(ap=!0,up("pointer",e))}function hp(e){var t;!np.isOpening&&(""===(t=e).pointerType&&t.isTrusted||(Xd()&&t.pointerType?"click"===t.type&&1===t.buttons:0===t.detail&&!t.pointerType))&&(ap=!0,rp="virtual",ip="virtual")}function fp(e){let t=Dd(Ud(e)),n=zd(Ud(e));Ud(e)!==t&&Ud(e)!==n&&e.isTrusted&&(ap||lp||(rp="virtual",ip="virtual",up("virtual",e)),ap=!1,lp=!1)}function mp(){ap=!1,lp=!0}function gp(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=Dd(e),n=zd(e);if(sp.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ap=!0,r.apply(this,arguments)},n.addEventListener("keydown",dp,!0),n.addEventListener("keyup",dp,!0),n.addEventListener("click",hp,!0),t.addEventListener("focus",fp,!0),t.addEventListener("blur",mp,!1),"undefined"!=typeof PointerEvent&&(n.addEventListener("pointerdown",pp,!0),n.addEventListener("pointermove",pp,!0),n.addEventListener("pointerup",pp,!0)),t.addEventListener("beforeunload",()=>{yp(e)},{once:!0}),sp.set(t,{focus:r})}const yp=(e,t)=>{const n=Dd(e),r=zd(e);t&&r.removeEventListener("DOMContentLoaded",t),sp.has(n)&&(n.HTMLElement.prototype.focus=sp.get(n).focus,r.removeEventListener("keydown",dp,!0),r.removeEventListener("keyup",dp,!0),r.removeEventListener("click",hp,!0),n.removeEventListener("focus",fp,!0),n.removeEventListener("blur",mp,!1),"undefined"!=typeof PointerEvent&&(r.removeEventListener("pointerdown",pp,!0),r.removeEventListener("pointermove",pp,!0),r.removeEventListener("pointerup",pp,!0)),sp.delete(n))};function _p(){return"pointer"!==rp}"undefined"!=typeof document&&function(e){const t=zd(e);let n;"loading"!==t.readyState?gp(e):(n=()=>{gp(e)},t.addEventListener("DOMContentLoaded",n))}();const vp=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function bp(){let e=(0,o.useRef)(new Map),t=(0,o.useCallback)((t,n,r,i)=>{let o=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:o,options:i}),t.addEventListener(n,o,i)},[]),n=(0,o.useCallback)((t,n,r,i)=>{let o=e.current.get(r)?.fn||r;t.removeEventListener(n,o,i),e.current.delete(r)},[]),r=(0,o.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,o.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function xp(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,s=(0,o.useRef)({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:l}=bp(),c=(0,o.useCallback)(e=>{Ld(e.currentTarget,Ud(e))&&s.current.isFocusWithin&&!Ld(e.currentTarget,e.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(e),i&&i(!1))},[n,i,s,l]),u=qd(c),d=(0,o.useCallback)(e=>{if(!Ld(e.currentTarget,Ud(e)))return;let t=Ud(e);const n=zd(t),o=Md(n);if(!s.current.isFocusWithin&&o===t){r&&r(e),i&&i(!0),s.current.isFocusWithin=!0,u(e);let t=e.currentTarget;a(n,"focus",e=>{let r=Ud(e);if(s.current.isFocusWithin&&!Ld(t,r)){let e=new n.defaultView.FocusEvent("blur",{relatedTarget:r});!function(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}(e,t);let i=Bd(e);c(i)}},{capture:!0})}},[r,i,u,a,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}function wp(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=(0,o.useRef)({isFocused:!1,isFocusVisible:t||_p()}),[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=_p(),a(e),u()},[u]);var p,h,f;p=e=>{i.current.isFocusVisible=e,u()},h=[n,s],f={enabled:s,isTextInput:n},gp(),(0,o.useEffect)(()=>{if(!1===f?.enabled)return;let e=(e,t)=>{(function(e,t,n){let r=n?Ud(n):void 0,i=zd(r),o=Dd(r);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=Md(i);return!((e=e||u instanceof s&&!vp.has(u.type)||u instanceof a||u instanceof l&&u.isContentEditable)&&"keyboard"===t&&n instanceof c&&!cp[n.key])})(!!f?.isTextInput,e,t)&&p(_p())};return op.add(e),()=>{op.delete(e)}},h);let{focusProps:m}=function(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e;const s=(0,o.useCallback)(e=>{if(Ud(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),a=qd(s),l=(0,o.useCallback)(e=>{let t=Ud(e);const r=zd(t),o=r?Md(r):Md();t===e.currentTarget&&t===o&&(n&&n(e),i&&i(!0),a(e))},[i,n,a]);return{focusProps:{onFocus:!t&&(n||i||r)?l:void 0,onBlur:t||!r&&!i?void 0:s}}}({isDisabled:r,onFocusChange:d}),{focusWithinProps:g}=xp({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:r?g:m}}let jp=!1,Sp=0;function kp(e){"touch"===e.pointerType&&(jp=!0,setTimeout(()=>{jp=!1},500))}function Cp(){let e=zd(null);if(void 0!==e)return 0===Sp&&"undefined"!=typeof PointerEvent&&e.addEventListener("pointerup",kp),Sp++,()=>{Sp--,Sp>0||"undefined"!=typeof PointerEvent&&e.removeEventListener("pointerup",kp)}}function Tp(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[s,a]=(0,o.useState)(!1),l=(0,o.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,o.useEffect)(Cp,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=bp(),{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(),r&&r({type:"hoverend",target:i,pointerType:t}),n&&n(!1),a(!1))},o={};return"undefined"!=typeof PointerEvent&&(o.onPointerEnter=r=>{jp&&"mouse"===r.pointerType||((r,o)=>{if(l.pointerType=o,i||"touch"===o||l.isHovered||!Ld(r.currentTarget,Ud(r)))return;l.isHovered=!0;let s=r.currentTarget;l.target=s,c(zd(Ud(r)),"pointerover",t=>{l.isHovered&&l.target&&!Ld(l.target,Ud(t))&&e(0,t.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:s,pointerType:o}),n&&n(!0),a(!0)})(r,r.pointerType)},o.onPointerLeave=t=>{!i&&Ld(t.currentTarget,Ud(t))&&e(0,t.pointerType)}),{hoverProps:o,triggerHoverEnd:e}},[t,n,r,i,l,c,u]);return(0,o.useEffect)(()=>{i&&p({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:d,isHovered:s}}var Ep=Object.defineProperty,Pp=(e,t,n)=>(((e,t,n)=>{t in e?Ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let Rp=new class{constructor(){Pp(this,"current",this.detect()),Pp(this,"handoffState","pending"),Pp(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 Op(e){var t;return Rp.isServer?null:null==e?document:null!=(t=null==e?void 0:e.ownerDocument)?t:document}function Np(e){var t,n;return Rp.isServer?null:null==e?document:null!=(n=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e))?n:document}function Ap(e){var t,n;return null!=(n=null==(t=Np(e))?void 0:t.activeElement)?n:null}function Fp(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch(e=>setTimeout(()=>{throw e}))}function Ip(){let e=[],t={addEventListener:(e,n,r,i)=>(e.addEventListener(n,r,i),t.add(()=>e.removeEventListener(n,r,i))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(n))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let n=setTimeout(...e);return t.add(()=>clearTimeout(n))},microTask(...e){let n={current:!0};return Fp(()=>{n.current&&e[0]()}),t.add(()=>{n.current=!1})},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add(()=>{Object.assign(e.style,{[t]:r})})},group(e){let t=Ip();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function zp(){let[e]=(0,o.useState)(Ip);return(0,o.useEffect)(()=>()=>e.dispose(),[e]),e}let Dp=(e,t)=>{Rp.isServer?(0,o.useEffect)(e,t):(0,o.useLayoutEffect)(e,t)};function Lp(e){let t=(0,o.useRef)(e);return Dp(()=>{t.current=e},[e]),t}let Mp=function(e){let t=Lp(e);return o.useCallback((...e)=>t.current(...e),[t])};function Up({disabled:e=!1}={}){let t=(0,o.useRef)(null),[n,r]=(0,o.useState)(!1),i=zp(),s=Mp(()=>{t.current=null,r(!1),i.dispose()}),a=Mp(e=>{if(i.dispose(),null===t.current){t.current=e.currentTarget,r(!0);{let n=Op(e.currentTarget);i.addEventListener(n,"pointerup",s,!1),i.addEventListener(n,"pointermove",e=>{if(t.current){let n=function(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}(e);r(function(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}(n,t.current.getBoundingClientRect()))}},!1),i.addEventListener(n,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:a,onPointerUp:s,onClick:s}}}function $p(e){if(null===e)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Bp(e,t,n=!1){let[r,i]=(0,o.useState)(()=>$p(t));return Dp(()=>{if(!t||!e)return;let n=Ip();return n.requestAnimationFrame(function e(){n.requestAnimationFrame(e),i(e=>{let n=$p(t);return n.width===e.width&&n.height===e.height?e:n})}),()=>{n.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}function qp(e){return function(e){return"object"==typeof e&&null!==e&&"nodeType"in e}(e)&&"tagName"in e}function Hp(e){return qp(e)&&"accessKey"in e}function Wp(e){return qp(e)&&"tabIndex"in e}function Zp(e){return Hp(e)&&"FIELDSET"===e.nodeName}function Gp(e){return Hp(e)&&"LEGEND"===e.nodeName}function Vp(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=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(r,Vp),r}let Qp=["[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(","),Kp=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Jp,Yp=((Jp=Yp||{})[Jp.First=1]="First",Jp[Jp.Previous=2]="Previous",Jp[Jp.Next=4]="Next",Jp[Jp.Last=8]="Last",Jp[Jp.WrapAround=16]="WrapAround",Jp[Jp.NoScroll=32]="NoScroll",Jp[Jp.AutoFocus=64]="AutoFocus",Jp),Xp=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Xp||{}),eh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(eh||{});function th(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(Qp)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var nh=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(nh||{});function rh(e,t=0){var n;return e!==(null==(n=Op(e))?void 0:n.body)&&Vp(t,{0:()=>e.matches(Qp),1(){let t=e;for(;null!==t;){if(t.matches(Qp))return!0;t=t.parentElement}return!1}})}var ih=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(ih||{});"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 oh=["textarea","input"].join(",");function sh(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:i=[]}={}){let o=Array.isArray(e)?e.length>0?Np(e[0]):document:Np(e),s=Array.isArray(e)?n?function(e,t=e=>e){return e.slice().sort((e,n)=>{let r=t(e),i=t(n);if(null===r||null===i)return 0;let o=r.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(Kp)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):th(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))),r=null!=r?r: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(r))-1;if(4&t)return Math.max(0,s.indexOf(r))+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!==Ap(a));return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,oh))&&n}(a)&&a.select(),2}function ah(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function lh(){return ah()||/Android/gi.test(window.navigator.userAgent)}function ch(e,t,n,r){let i=Lp(n);(0,o.useEffect)(()=>{if(e)return document.addEventListener(t,n,r),()=>document.removeEventListener(t,n,r);function n(e){i.current(e)}},[e,t,r])}function uh(e,t,n,r){let i=Lp(n);(0,o.useEffect)(()=>{if(e)return window.addEventListener(t,n,r),()=>window.removeEventListener(t,n,r);function n(e){i.current(e)}},[e,t,r])}function dh(e,t,n){let r=Lp(n),i=(0,o.useCallback)(function(e,n){if(e.defaultPrevented)return;let i=n(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!rh(i,nh.Loose)&&-1!==i.tabIndex&&e.preventDefault(),r.current(e,i)},[r,t]),s=(0,o.useRef)(null);ch(e,"pointerdown",e=>{var t,n;lh()||(s.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)},!0),ch(e,"pointerup",e=>{if(lh()||!s.current)return;let t=s.current;return s.current=null,i(e,()=>t)},!0);let a=(0,o.useRef)({x:0,y:0});ch(e,"touchstart",e=>{a.current.x=e.touches[0].clientX,a.current.y=e.touches[0].clientY},!0),ch(e,"touchend",e=>{let t=e.changedTouches[0].clientX,n=e.changedTouches[0].clientY;if(!(Math.abs(t-a.current.x)>=30||Math.abs(n-a.current.y)>=30))return i(e,()=>Wp(e.target)?e.target:null)},!0),uh(e,"blur",e=>i(e,()=>{return Hp(e=window.document.activeElement)&&"IFRAME"===e.nodeName?window.document.activeElement:null;var e}),!0)}function ph(...e){return(0,o.useMemo)(()=>Op(...e),[...e])}function hh(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}var fh=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(fh||{}),mh=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(mh||{});function gh(){let e=function(){let e=(0,o.useRef)([]),t=(0,o.useCallback)(t=>{for(let n of e.current)null!=n&&("function"==typeof n?n(t):n.current=t)},[]);return(...n)=>{if(!n.every(e=>null==e))return e.current=n,t}}();return(0,o.useCallback)(t=>function({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:o=!0,name:s,mergeRefs:a}){a=null!=a?a:_h;let l=vh(t,e);if(o)return yh(l,n,r,s,a);let c=null!=i?i:0;if(2&c){let{static:e=!1,...t}=l;if(e)return yh(t,n,r,s,a)}if(1&c){let{unmount:e=!0,...t}=l;return Vp(e?0:1,{0:()=>null,1:()=>yh({...t,hidden:!0,style:{display:"none"}},n,r,s,a)})}return yh(l,n,r,s,a)}({mergeRefs:e,...t}),[e])}function yh(e,t={},n,r,i){let{as:s=n,children:a,refName:l="ref",...c}=jh(e,["unmount","static"]),u=void 0!==e.ref?{[l]:e.ref}:{},d="function"==typeof a?a(t):a;d=kh(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,n=[];for(let[r,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&n.push(r.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e){p["data-headlessui-state"]=n.join(" ");for(let e of n)p[`data-${e}`]=""}}if(Ch(s)&&(Object.keys(wh(c)).length>0||Object.keys(wh(p)).length>0)){if(!(!(0,o.isValidElement)(d)||Array.isArray(d)&&d.length>1||function(e){return Ch(e.type)}(d))){let e=d.props,t=null==e?void 0:e.className,n="function"==typeof t?(...e)=>hh(t(...e),c.className):hh(t,c.className),r=n?{className:n}:{},s=vh(d.props,wh(jh(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(Sh(d),u.ref)},r))}if(Object.keys(wh(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(wh(c)).concat(Object.keys(wh(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({},jh(c,["ref"]),!Ch(s)&&u,!Ch(s)&&p),d)}function _h(...e){return e.every(e=>null==e)?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function vh(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])for(let e in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(n[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function bh(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];for(let e in n)Object.assign(t,{[e](...t){let r=n[e];for(let e of r)null==e||e(...t)}});return t}function xh(e){var t;return Object.assign((0,o.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function wh(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function jh(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function Sh(e){return o.version.split(".")[0]>="19"?e.props.ref:e.ref}function kh(e){if(null!=e&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(null!=t&&"fulfilled"===t.status)return kh(t.value)}return e}function Ch(e){return e===o.Fragment||e===Symbol.for("react.fragment")}var Th,Eh=((Th=Eh||{})[Th.None=1]="None",Th[Th.Focusable=2]="Focusable",Th[Th.Hidden=4]="Hidden",Th);let Ph=xh(function(e,t){var n;let{features:r=1,...i}=e,o={ref:t,"aria-hidden":!(2&~r)||(null!=(n=i["aria-hidden"])?n:void 0),hidden:!(4&~r)||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&~r)&&!!(2&~r)&&{display:"none"}}};return gh()({ourProps:o,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})}),Rh=(0,o.createContext)(null);function Oh({children:e,node:t}){let[n,r]=(0,o.useState)(null),i=Nh(null!=t?t:n);return o.createElement(Rh.Provider,{value:i},e,null===i&&o.createElement(Ph,{features:Eh.Hidden,ref:e=>{var t,n;if(e)for(let i of null!=(n=null==(t=Op(e))?void 0:t.querySelectorAll("html > *, body > *"))?n:[])if(i!==document.body&&i!==document.head&&qp(i)&&null!=i&&i.contains(e)){r(i);break}}}))}function Nh(e=null){var t;return null!=(t=(0,o.useContext)(Rh))?t:e}function Ah(){let e;return{before({doc:t}){var n;let r=t.documentElement,i=null!=(n=t.defaultView)?n:window;e=Math.max(0,i.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),o=Math.max(0,e-i);n.style(r,"paddingRight",`${o}px`)}}}function Fh(){return ah()?{before({doc:e,d:t,meta:n}){function r(e){for(let t of n().containers)for(let n of t())if(n.contains(e))return!0;return!1}t.microTask(()=>{var n;if("auto"!==window.getComputedStyle(e.documentElement).scrollBehavior){let n=Ip();n.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>n.dispose()))}let i=null!=(n=window.scrollY)?n:window.pageYOffset,o=null;t.addEventListener(e,"click",t=>{if(Wp(t.target))try{let n=t.target.closest("a");if(!n)return;let{hash:i}=new URL(n.href),s=e.querySelector(i);Wp(s)&&!r(s)&&(o=s)}catch{}},!0),t.group(n=>{t.addEventListener(e,"touchstart",e=>{if(n.dispose(),Wp(e.target)&&function(e){return qp(e)&&"style"in e}(e.target))if(r(e.target)){let t=e.target;for(;t.parentElement&&r(t.parentElement);)t=t.parentElement;n.style(t,"overscrollBehavior","contain")}else n.style(e.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",e=>{if(Wp(e.target)){if(function(e){return Hp(e)&&"INPUT"===e.nodeName}(e.target))return;if(r(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 Ih(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let zh=function(e,t){let n=new Map,r=new Set;return{getSnapshot:()=>n,subscribe:e=>(r.add(e),()=>r.delete(e)),dispatch(e,...i){let o=t[e].call(n,...i);o&&(n=o,r.forEach(e=>e()))}}}(0,{PUSH(e,t){var n;let r=null!=(n=this.get(e))?n:{doc:e,count:0,d:Ip(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Ih(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Ih(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta:()=>e.computedMeta},n=[Fh(),Ah(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];n.forEach(({before:e})=>null==e?void 0:e(t)),n.forEach(({after:e})=>null==e?void 0:e(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});function Dh(e,t,n=()=>({containers:[]})){let r=function(e){return(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}(zh),i=t?r.get(t):void 0,s=!!i&&i.count>0;return Dp(()=>{if(t&&e)return zh.dispatch("PUSH",t,n),()=>zh.dispatch("POP",t,n)},[e,t]),s}zh.subscribe(()=>{let e=zh.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e="hidden"===t.get(n.doc),r=0!==n.count;(r&&!e||!r&&e)&&zh.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),0===n.count&&zh.dispatch("TEARDOWN",n)}});class Lh 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 Mh,Uh,$h,Bh=Object.defineProperty,qh=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Hh=(e,t,n)=>(qh(e,t,"read from private field"),n?n.call(e):t.get(e)),Wh=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Zh=(e,t,n,r)=>(qh(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Gh{constructor(e){Wh(this,Mh,{}),Wh(this,Uh,new Lh(()=>new Set)),Wh(this,$h,new Set),((e,t,n)=>{((e,t,n)=>{t in e?Bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n)})(this,"disposables",Ip()),Zh(this,Mh,e),Rp.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Hh(this,Mh)}subscribe(e,t){if(Rp.isServer)return()=>{};let n={selector:e,callback:t,current:e(Hh(this,Mh))};return Hh(this,$h).add(n),this.disposables.add(()=>{Hh(this,$h).delete(n)})}on(e,t){return Rp.isServer?()=>{}:(Hh(this,Uh).get(e).add(t),this.disposables.add(()=>{Hh(this,Uh).get(e).delete(t)}))}send(e){let t=this.reduce(Hh(this,Mh),e);if(t!==Hh(this,Mh)){Zh(this,Mh,t);for(let e of Hh(this,$h)){let t=e.selector(Hh(this,Mh));Vh(e.current,t)||(e.current=t,e.callback(t))}for(let t of Hh(this,Uh).get(e.type))t(Hh(this,Mh),e)}}}function Vh(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&&Qh(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size===t.size&&Qh(e.entries(),t.entries()):!(!Kh(e)||!Kh(t))&&Qh(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()))}function Qh(e,t){for(;;){let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}}function Kh(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}Mh=new WeakMap,Uh=new WeakMap,$h=new WeakMap;var Jh=Object.defineProperty,Yh=(e,t,n)=>(((e,t,n)=>{t in e?Jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Xh=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Xh||{});let ef={0(e,t){let n=t.id,r=e.stack,i=e.stack.indexOf(n);if(-1!==i){let t=e.stack.slice();return t.splice(i,1),t.push(n),r=t,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(-1===r)return e;let i=e.stack.slice();return i.splice(r,1),{...e,stack:i}}};class tf extends Gh{constructor(){super(...arguments),Yh(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),Yh(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new tf({stack:[]})}reduce(e,t){return Vp(t.type,ef,e,t)}}const nf=new Lh(()=>tf.new());var rf=n(721);function of(e,t,n=Vh){return(0,rf.useSyncExternalStoreWithSelector)(Mp(t=>e.subscribe(sf,t)),Mp(()=>e.state),Mp(()=>e.state),Mp(t),n)}function sf(e){return e}function af(e){return(0,o.useMemo)(()=>e,Object.values(e))}let lf=Symbol();function cf(e,t=!0){return Object.assign(e,{[lf]:t})}function uf(...e){let t=(0,o.useRef)(e);(0,o.useEffect)(()=>{t.current=e},[e]);let n=Mp(e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)});return e.every(e=>null==e||(null==e?void 0:e[lf]))?void 0:n}var df,pf,hf=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(hf||{});function ff(){let e=(0,o.useRef)(0);return uh(!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==(df=null==process?void 0:{NODE_ENV:"production"})?void 0:df.NODE_ENV)&&void 0===(null==(pf=null==Element?void 0:Element.prototype)?void 0:pf.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 mf=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(mf||{});function gf(e){let t={};for(let n in e)!0===e[n]&&(t[`data-${n}`]="");return t}function yf(e,t,n,r){let[i,s]=(0,o.useState)(n),{hasFlag:a,addFlag:l,removeFlag:c}=function(e=0){let[t,n]=(0,o.useState)(e),r=(0,o.useCallback)(e=>n(e),[]),i=(0,o.useCallback)(e=>n(t=>t|e),[]),s=(0,o.useCallback)(e=>(t&e)===e,[t]),a=(0,o.useCallback)(e=>n(t=>t&~e),[]),l=(0,o.useCallback)(e=>n(t=>t^e),[]);return{flags:t,setFlag:r,addFlag:i,hasFlag:s,removeFlag:a,toggleFlag:l}}(e&&i?3:0),u=(0,o.useRef)(!1),d=(0,o.useRef)(!1),p=zp();return Dp(()=>{var i;if(e)return n&&s(!0),t?(null==(i=null==r?void 0:r.start)||i.call(r,n),function(e,{prepare:t,run:n,done:r,inFlight:i}){let o=Ip();return function(e,{inFlight:t,prepare:n}){if(null!=t&&t.current)return void n();let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(function(e,t){var n,r;let i=Ip();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=null!=(r=null==(n=e.getAnimations)?void 0:n.call(e).filter(e=>e instanceof CSSTransition))?r:[];return 0===s.length?(t(),i.dispose):(Promise.allSettled(s.map(e=>e.finished)).then(()=>{o||t()}),i.dispose)}(e,r))})}),o.dispose}(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(n?(l(3),c(4)):(l(4),c(2)))},run(){d.current?n?(c(3),l(4)):(c(4),l(3)):n?c(1):l(1)},done(){var e;d.current&&function(e){var t,n;return(null!=(n=null==(t=e.getAnimations)?void 0:t.call(e))?n:[]).some(e=>e instanceof CSSTransition&&"finished"!==e.playState)}(t)||(u.current=!1,c(7),n||s(!1),null==(e=null==r?void 0:r.end)||e.call(r,n))}})):void(n&&l(3))},[e,n,t,p]),e?[i,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}let _f=(0,o.createContext)(()=>{});function vf({value:e,children:t}){return o.createElement(_f.Provider,{value:e},t)}const bf=Math.min,xf=Math.max,wf=Math.round,jf=Math.floor,Sf=e=>({x:e,y:e}),kf={left:"right",right:"left",bottom:"top",top:"bottom"};function Cf(e,t,n){return xf(e,bf(t,n))}function Tf(e,t){return"function"==typeof e?e(t):e}function Ef(e){return e.split("-")[0]}function Pf(e){return e.split("-")[1]}function Rf(e){return"x"===e?"y":"x"}function Of(e){return"y"===e?"height":"width"}function Nf(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function Af(e){return Rf(Nf(e))}function Ff(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const If=["left","right"],zf=["right","left"],Df=["top","bottom"],Lf=["bottom","top"];function Mf(e){const t=Ef(e);return kf[t]+e.slice(t.length)}function Uf(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function $f(){return"undefined"!=typeof window}function Bf(e){return Wf(e)?(e.nodeName||"").toLowerCase():"#document"}function qf(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Hf(e){var t;return null==(t=(Wf(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Wf(e){return!!$f()&&(e instanceof Node||e instanceof qf(e).Node)}function Zf(e){return!!$f()&&(e instanceof Element||e instanceof qf(e).Element)}function Gf(e){return!!$f()&&(e instanceof HTMLElement||e instanceof qf(e).HTMLElement)}function Vf(e){return!(!$f()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof qf(e).ShadowRoot)}function Qf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=om(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function Kf(e){return/^(table|td|th)$/.test(Bf(e))}function Jf(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const Yf=/transform|translate|scale|rotate|perspective|filter/,Xf=/paint|layout|strict|content/,em=e=>!!e&&"none"!==e;let tm;function nm(e){const t=Zf(e)?om(e):e;return em(t.transform)||em(t.translate)||em(t.scale)||em(t.rotate)||em(t.perspective)||!rm()&&(em(t.backdropFilter)||em(t.filter))||Yf.test(t.willChange||"")||Xf.test(t.contain||"")}function rm(){return null==tm&&(tm="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tm}function im(e){return/^(html|body|#document)$/.test(Bf(e))}function om(e){return qf(e).getComputedStyle(e)}function sm(e){return Zf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function am(e){if("html"===Bf(e))return e;const t=e.assignedSlot||e.parentNode||Vf(e)&&e.host||Hf(e);return Vf(t)?t.host:t}function lm(e){const t=am(e);return im(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gf(t)&&Qf(t)?t:lm(t)}function cm(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=lm(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=qf(i);if(o){const e=um(s);return t.concat(s,s.visualViewport||[],Qf(i)?i:[],e&&n?cm(e):[])}return t.concat(i,cm(i,[],n))}function um(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dm(e,t,n){let{reference:r,floating:i}=e;const o=Nf(t),s=Af(t),a=Of(s),l=Ef(t),c="y"===o,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Pf(t)){case"start":h[s]-=p*(n&&c?-1:1);break;case"end":h[s]+=p*(n&&c?-1:1)}return h}async function pm(e,t){var n;void 0===t&&(t={});const{x:r,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}=Tf(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=Uf(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===d?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,_=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),v=await(null==o.isElement?void 0:o.isElement(_))&&await(null==o.getScale?void 0:o.getScale(_))||{x:1,y:1},b=Uf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:l}):y);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 hm=new Set(["left","top"]);function fm(e){const t=om(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Gf(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=wf(n)!==o||wf(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function mm(e){return Zf(e)?e:e.contextElement}function gm(e){const t=mm(e);if(!Gf(t))return Sf(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=fm(t);let s=(o?wf(n.width):n.width)/r,a=(o?wf(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const ym=Sf(0);function _m(e){const t=qf(e);return rm()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ym}function vm(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=mm(e);let s=Sf(1);t&&(r?Zf(r)&&(s=gm(r)):s=gm(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==qf(e))&&t}(o,n,r)?_m(o):Sf(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=qf(o),t=r&&Zf(r)?qf(r):r;let n=e,i=um(n);for(;i&&r&&t!==n;){const e=gm(i),t=i.getBoundingClientRect(),r=om(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=s,n=qf(i),i=um(n)}}return Uf({width:u,height:d,x:l,y:c})}function bm(e,t){const n=sm(e).scrollLeft;return t?t.left+n:vm(Hf(e)).left+n}function xm(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-bm(e,n),y:n.top+t.scrollTop}}function wm(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=qf(e),r=Hf(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=rm();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=bm(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=Hf(e),n=sm(e),r=e.ownerDocument.body,i=xf(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=xf(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+bm(e);const a=-n.scrollTop;return"rtl"===om(r).direction&&(s+=xf(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(Hf(e));else if(Zf(t))r=function(e,t){const n=vm(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Gf(e)?gm(e):Sf(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=_m(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Uf(r)}function jm(e,t){const n=am(e);return!(n===t||!Zf(n)||im(n))&&("fixed"===om(n).position||jm(n,t))}function Sm(e,t,n){const r=Gf(t),i=Hf(t),o="fixed"===n,s=vm(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Sf(0);function c(){l.x=bm(i)}if(r||!r&&!o)if(("body"!==Bf(t)||Qf(i))&&(a=sm(t)),r){const e=vm(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const u=!i||r||o?Sf(0):xm(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 km(e){return"static"===om(e).position}function Cm(e,t){if(!Gf(e)||"fixed"===om(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Hf(e)===n&&(n=n.ownerDocument.body),n}function Tm(e,t){const n=qf(e);if(Jf(e))return n;if(!Gf(e)){let t=am(e);for(;t&&!im(t);){if(Zf(t)&&!km(t))return t;t=am(t)}return n}let r=Cm(e,t);for(;r&&Kf(r)&&km(r);)r=Cm(r,t);return r&&im(r)&&km(r)&&!nm(r)?n:r||function(e){let t=am(e);for(;Gf(t)&&!im(t);){if(nm(t))return t;if(Jf(t))return null;t=am(t)}return null}(e)||n}const Em={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=Hf(r),a=!!t&&Jf(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Sf(1);const u=Sf(0),d=Gf(r);if((d||!d&&!o)&&(("body"!==Bf(r)||Qf(s))&&(l=sm(r)),d)){const e=vm(r);c=gm(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!s||d||o?Sf(0):xm(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:Hf,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?Jf(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=cm(e,[],!1).filter(e=>Zf(e)&&"body"!==Bf(e)),i=null;const o="fixed"===om(e).position;let s=o?am(e):e;for(;Zf(s)&&!im(s);){const t=om(s),n=nm(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||Qf(s)&&!n&&jm(e,s))?r=r.filter(e=>e!==s):i=t,s=am(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=wm(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 n=wm(t,o[e],i);a=xf(n.top,a),l=bf(n.right,l),c=bf(n.bottom,c),u=xf(n.left,u)}return{width:l-u,height:c-a,x:u,y:a}},getOffsetParent:Tm,getElementRects:async function(e){const t=this.getOffsetParent||Tm,n=this.getDimensions,r=await n(e.floating);return{reference:Sm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=fm(e);return{width:t,height:n}},getScale:gm,isElement:Zf,isRTL:function(e){return"rtl"===om(e).direction}};function Pm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rm(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=mm(e),u=i||o?[...c?cm(c):[],...t?cm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const d=c&&a?function(e,t){let n,r=null;const i=Hf(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=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:-jf(d)+"px "+-jf(i.clientWidth-(u+p))+"px "+-jf(i.clientHeight-(d+h))+"px "+-jf(u)+"px",threshold:xf(0,bf(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||Pm(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,f)}r.observe(e)}(!0),o}(c,n):null;let p,h=-1,f=null;s&&(f=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let m=l?vm(e):null;return l&&function t(){const r=vm(e);m&&!Pm(m,r)&&n(),m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const Om=pm,Nm=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;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}=Tf(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const y=Ef(i),_=Nf(a),v=Ef(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(v||!m?[Mf(a)]:function(e){const t=Mf(e);return[Ff(e),t,Ff(t)]}(a)),w="none"!==f;!p&&w&&x.push(...function(e,t,n,r){const i=Pf(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?zf:If:t?If:zf;case"left":case"right":return t?Df:Lf;default:return[]}}(Ef(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Ff)))),o}(a,m,f,b));const j=[a,...x],S=await l.detectOverflow(t,g),k=[];let C=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&k.push(S[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Pf(e),i=Af(e),o=Of(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Mf(s)),[s,Mf(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||_===Nf(t)||C.every(e=>Nf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(E=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:E.placement;if(!n)switch(h){case"bestFit":{var P;const e=null==(P=C.filter(e=>{if(w){const t=Nf(e.placement);return t===_||"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:P[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},Am=(e,t,n)=>{const r=new Map,i={platform:Em,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:pm},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}=dm(c,r,l),p=r,h=0;const f={};for(let n=0;n<o.length;n++){const m=o[n];if(!m)continue;const{name:g,fn:y}=m,{x:_,y:v,data:b,reset:x}=await y({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=_?_: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}=dm(c,p,l))),n=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var Fm="undefined"!=typeof document?o.useLayoutEffect:function(){};function Im(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 n,r,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Im(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(!("_owner"===n&&e.$$typeof||Im(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function zm(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dm(e,t){const n=zm(e);return Math.round(t*n)/n}function Lm(e){const t=o.useRef(e);return Fm(()=>{t.current=e}),t}const Mm=(e,t)=>{const n=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=Ef(n),a=Pf(n),l="y"===Nf(n),c=hm.has(s)?-1:1,u=o&&l?-1:1,d=Tf(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==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}}(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>{const n=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Tf(e,t),u={x:n,y:r},d=await o.detectOverflow(t,c),p=Nf(Ef(i)),h=Rf(p);let f=u[h],m=u[p];if(s){const e="y"===h?"bottom":"right";f=Cf(f+d["y"===h?"top":"left"],f,f-d[e])}if(a){const e="y"===p?"bottom":"right";m=Cf(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-n,y:g.y-r,enabled:{[h]:s,[p]:a}}}}}}(e);return{name:n.name,fn:n.fn,options:[e,t]}},$m=(e,t)=>{const n=Nm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bm=(e,t)=>{const n=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Tf(e,t),u=await s.detectOverflow(t,c),d=Ef(i),p=Pf(i),h="y"===Nf(i),{width:f,height:m}=o.floating;let g,y;"top"===d||"bottom"===d?(g=d,y=p===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,g="end"===p?"top":"bottom");const _=m-u.top-u.bottom,v=f-u.left-u.right,b=bf(m-u[g],_),x=bf(f-u[y],v),w=!t.middlewareData.shift;let j=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=v),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(j=_),w&&!p){const e=xf(u.left,0),t=xf(u.right,0),n=xf(u.top,0),r=xf(u.bottom,0);h?S=f-2*(0!==e||0!==t?e+t:xf(u.left,u.right)):j=m-2*(0!==n||0!==r?n+r:xf(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:n.name,fn:n.fn,options:[e,t]}},qm={...s},Hm=qm.useInsertionEffect||(e=>e());function Wm(e){const t=o.useRef(()=>{});return Hm(()=>{t.current=e}),o.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}var Zm="undefined"!=typeof document?o.useLayoutEffect:o.useEffect;let Gm=!1,Vm=0;const Qm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Vm++,Km=qm.useId||function(){const[e,t]=o.useState(()=>Gm?Qm():void 0);return Zm(()=>{null==e&&t(Qm())},[]),o.useEffect(()=>{Gm=!0},[]),e};const Jm=o.createContext(null),Ym=o.createContext(null),Xm="data-floating-ui-focusable";function eg(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=Km(),s=o.useRef({}),[a]=o.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),l=null!=((null==(f=o.useContext(Jm))?void 0:f.id)||null),[c,u]=o.useState(r.reference),d=Wm((e,t,r)=>{s.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:r,nested:l}),null==n||n(e,t,r)}),p=o.useMemo(()=>({setPositionReference:u}),[]),h=o.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.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||n,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(Ym);Zm(()=>{d&&(p.current=d)},[d]);const f=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="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:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=o.useState(i);Im(f,i)||m(i);const[g,y]=o.useState(null),[_,v]=o.useState(null),b=o.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),x=o.useCallback(e=>{e!==k.current&&(k.current=e,v(e))},[]),w=a||g,j=l||_,S=o.useRef(null),k=o.useRef(null),C=o.useRef(p),T=null!=u,E=Lm(u),P=Lm(s),R=Lm(d),O=o.useCallback(()=>{if(!S.current||!k.current)return;const e={placement:t,strategy:n,middleware:f};P.current&&(e.platform=P.current),Am(S.current,k.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};N.current&&!Im(C.current,t)&&(C.current=t,r.flushSync(()=>{h(t)}))})},[f,t,n,P,R]);Fm(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[d]);const N=o.useRef(!1);Fm(()=>(N.current=!0,()=>{N.current=!1}),[]),Fm(()=>{if(w&&(S.current=w),j&&(k.current=j),w&&j){if(E.current)return E.current(w,j,O);O()}},[w,j,O,E,T]);const A=o.useMemo(()=>({reference:S,floating:k,setReference:b,setFloating:x}),[b,x]),F=o.useMemo(()=>({reference:w,floating:j}),[w,j]),I=o.useMemo(()=>{const e={position:n,left:0,top:0};if(!F.floating)return e;const t=Dm(F.floating,p.x),r=Dm(F.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...zm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,F.floating,p.x,p.y]);return o.useMemo(()=>({...p,update:O,refs:A,elements:F,floatingStyles:I}),[p,O,A,F,I])}({...e,elements:{...s,...c&&{reference:c}}}),m=o.useCallback(e=>{const t=Zf(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u(t),f.refs.setReference(t)},[f.refs]),g=o.useCallback(e=>{(Zf(e)||null===e)&&(p.current=e,l(e)),(Zf(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!Zf(e))&&f.refs.setReference(e)},[f.refs]),y=o.useMemo(()=>({...f.refs,setReference:g,setPositionReference:m,domReference:p}),[f.refs,g,m]),_=o.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),v=o.useMemo(()=>({...f,...i,refs:y,elements:_,nodeId:t}),[f,y,_,t,i]);return Zm(()=>{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:y,elements:_}),[f,y,_,v])}const tg="active",ng="selected";function rg(e,t,n){const r=new Map,i="item"===n;let o=e;if(i&&e){const{[tg]:t,[ng]:__,...n}=e;o=n}return{..."floating"===n&&{tabIndex:-1,[Xm]:""},...o,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,o]=t;var s;i&&[tg,ng].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(s=r.get(n))||s.push(o),e[n]=function(){for(var e,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return null==(e=r.get(n))?void 0:e.map(e=>e(...i)).find(e=>void 0!==e)})):e[n]=o)}),e):e,{})}}function ig(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}let og=(0,o.createContext)({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});og.displayName="FloatingContext";let sg=(0,o.createContext)(null);function ag(e=null){!1===e&&(e=null),"string"==typeof e&&(e={to:e});let t=(0,o.useContext)(sg),n=(0,o.useMemo)(()=>e,[JSON.stringify(e,(e,t)=>{var n;return null!=(n=null==t?void 0:t.outerHTML)?n:t})]);Dp(()=>{null==t||t(null!=n?n:null)},[t,n]);let r=(0,o.useContext)(og);return(0,o.useMemo)(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}function lg({children:e,enabled:t=!0}){let[n,i]=(0,o.useState)(null),[s,a]=(0,o.useState)(0),l=(0,o.useRef)(null),[c,u]=(0,o.useState)(null);!function(e){Dp(()=>{if(!e)return;let t=new MutationObserver(()=>{let t=window.getComputedStyle(e).maxHeight,n=parseFloat(t);if(isNaN(n))return;let r=parseInt(t);isNaN(r)||n!==r&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}(c);let d=t&&null!==n&&null!==c,{to:p="bottom",gap:h=0,offset:f=0,padding:m=0,inner:g}=function(e,t){var n,r,i;let o=cg(null!=(n=null==e?void 0:e.gap)?n:"var(--anchor-gap, 0)",t),s=cg(null!=(r=null==e?void 0:e.offset)?r:"var(--anchor-offset, 0)",t),a=cg(null!=(i=null==e?void 0:e.padding)?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}(n,c),[y,_="center"]=p.split(" ");Dp(()=>{d&&a(0)},[d]);let{refs:v,floatingStyles:b,context:x}=eg({open:d,placement:"selection"===y?"center"===_?"bottom":`bottom-${_}`:"center"===_?`${y}`:`${y}-${_}`,strategy:"absolute",transform:!1,middleware:[Mm({mainAxis:"selection"===y?0:h,crossAxis:f}),Um({padding:m}),"selection"!==y&&$m({padding:m}),"selection"===y&&g?(S={...g,padding:m,overflowRef:l,offset:s,minItemsVisible:4,referenceOverflowThreshold:m,onFallbackChange(e){var t,n;if(!e)return;let r=x.elements.floating;if(!r)return;let i=parseFloat(getComputedStyle(r).scrollPaddingBottom)||0,o=Math.min(4,r.childElementCount),s=0,l=0;for(let e of null!=(n=null==(t=x.elements.floating)?void 0:t.childNodes)?n:[])if(Hp(e)){let t=e.offsetTop,n=t+e.clientHeight+i,a=r.scrollTop,c=a+r.clientHeight;if(!(t>=a&&n<=c)){l=Math.max(0,Math.min(n,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:n,onFallbackChange:i,offset:o=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=Tf(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,y=0!==f.clientTop,_=p===f;if(!h)return{};const v={...e,...await Mm(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-o).fn(e)},b=await Om(ig(v,f.scrollHeight+m+p.clientTop),u),x=await Om(v,{...u,elementContext:"reference"}),w=xf(0,b.top),j=v.y+w,k=f.scrollHeight>f.clientHeight?e=>e:wf,C=k(xf(0,f.scrollHeight+(g&&_||y?2*m:0)-w-xf(0,b.bottom)));if(f.style.maxHeight=C+"px",f.scrollTop=w,i){const e=f.offsetHeight<h.offsetHeight*bf(a,t.current.length)-1||x.top>=-l||x.bottom>=-l;r.flushSync(()=>i(e))}return n&&(n.current=await Om(ig({...v,y:j},f.offsetHeight+m+p.clientTop),u)),{y:j}}}):null,Bm({padding:m,apply({availableWidth:e,availableHeight:t,elements:n}){Object.assign(n.floating.style,{overflow:"auto",maxWidth:`${e}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${t}px)`})}})].filter(Boolean),whileElementsMounted:Rm}),[w=y,j=_]=x.placement.split("-");var S;"selection"===y&&(w="selection");let k=(0,o.useMemo)(()=>({anchor:[w,j].filter(Boolean).join(" ")}),[w,j]),C=function(e,t){const{open:n,elements:i}=e,{enabled:s=!0,overflowRef:a,scrollRef:l,onChange:c}=t,u=Wm(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 n=e.deltaY,i=a.current.top>=-.5,o=a.current.bottom>=-.5,s=t.scrollHeight-t.clientHeight,l=n<0?-1:1,c=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!i&&n>0||!o&&n<0?(e.preventDefault(),r.flushSync(()=>{u(e=>e+Math[c](n,s*l))})):/firefox/i.test(function(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||i.floating;return n&&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,n,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)&&r.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),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),i=o.useCallback(t=>rg(t,e,"reference"),t),s=o.useCallback(t=>rg(t,e,"floating"),n),a=o.useCallback(t=>rg(t,e,"item"),r);return o.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:a}),[i,s,a])}([C]),P=Mp(e=>{u(e),v.setFloating(e)});return o.createElement(sg.Provider,{value:i},o.createElement(og.Provider,{value:{setFloating:P,setReference:v.setReference,styles:b,getReferenceProps:T,getFloatingProps:E,slot:k}},e))}function cg(e,t,n=void 0){let r=zp(),i=Mp((e,t)=>{if(null==e)return[n,null];if("number"==typeof e)return[e,null];if("string"==typeof e){if(!t)return[n,null];let i=dg(e,t);return[i,n=>{let o=ug(e);{let s=o.map(e=>window.getComputedStyle(t).getPropertyValue(e));r.requestAnimationFrame(function a(){r.nextFrame(a);let l=!1;for(let[e,n]of o.entries()){let r=window.getComputedStyle(t).getPropertyValue(n);if(s[e]!==r){s[e]=r,l=!0;break}}if(!l)return;let c=dg(e,t);i!==c&&(n(c),i=c)})}return r.dispose}]}return[n,null]}),s=(0,o.useMemo)(()=>i(e,t)[0],[e,t]),[a=s,l]=(0,o.useState)();return Dp(()=>{let[n,r]=i(e,t);if(l(n),r)return r(l)},[e,t]),a}function ug(e){let t=/var\((.*)\)/.exec(e);if(t){let e=t[1].indexOf(",");if(-1===e)return[t[1]];let n=t[1].slice(0,e).trim(),r=t[1].slice(e+1).trim();return r?[n,...ug(r)]:[n]}return[]}function dg(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}sg.displayName="PlacementContext";let pg=(0,o.createContext)(null);pg.displayName="OpenClosedContext";var hg=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(hg||{});function fg(){return(0,o.useContext)(pg)}function mg({value:e,children:t}){return o.createElement(pg.Provider,{value:e},t)}function gg({children:e}){return o.createElement(pg.Provider,{value:null},e)}function yg(e){let t=e.parentElement,n=null;for(;t&&!Zp(t);)Gp(t)&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(Gp(t))return!1;t=t.previousElementSibling}return!0}(n))&&r}var _g=(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))(_g||{});function vg(e){let t=Mp(e),n=(0,o.useRef)(!1);(0,o.useEffect)(()=>(n.current=!1,()=>{n.current=!0,Fp(()=>{n.current&&t()})}),[t])}let bg=(0,o.createContext)(!1);let xg=o.Fragment,wg=xh(function(e,t){let{ownerDocument:n=null,...i}=e,a=(0,o.useRef)(null),l=uf(cf(e=>{a.current=e}),t),c=ph(a.current),u=function(e){let t=(0,o.useContext)(bg),n=(0,o.useContext)(Sg),[r,i]=(0,o.useState)(()=>{var r;if(!t&&null!==n)return null!=(r=n.current)?r:null;if(Rp.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!==r&&(null!=e&&e.body.contains(r)||null==e||e.body.appendChild(r))},[r,e]),(0,o.useEffect)(()=>{t||null!==n&&i(n.current)},[n,i,t]),r}(null!=n?n:c),d=(0,o.useContext)(kg),p=zp(),h=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in s&&(e=>e.useSyncExternalStore)(s)(()=>()=>{},()=>!1,()=>!e)}(),[t,n]=o.useState(Rp.isHandoffComplete);return t&&!1===Rp.isHandoffComplete&&n(!1),o.useEffect(()=>{!0!==t&&n(!0)},[t]),o.useEffect(()=>Rp.handoff(),[]),!e&&t}(),f=gh();return vg(()=>{var e;u&&u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u))}),u&&h?(0,r.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:xg,name:"Portal"})),u):null}),jg=o.Fragment,Sg=(0,o.createContext)(null),kg=(0,o.createContext)(null),Cg=xh(function(e,t){let n=uf(t),{enabled:r=!0,ownerDocument:i,...s}=e,a=gh();return r?o.createElement(wg,{...s,ownerDocument:i,ref:n}):a({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:xg,name:"Portal"})}),Tg=xh(function(e,t){let{target:n,...r}=e,i={ref:uf(t)},s=gh();return o.createElement(Sg.Provider,{value:n},s({ourProps:i,theirProps:r,defaultTag:jg,name:"Popover.Group"}))}),Eg=Object.assign(Cg,{Group:Tg});var Pg=Object.defineProperty,Rg=(e,t,n)=>(((e,t,n)=>{t in e?Pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Og=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Og||{}),Ng=(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))(Ng||{});let Ag={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 Fg extends Gh{constructor(e){super(e),Rg(this,"actions",{close:()=>this.send({type:1}),refocusableClose:e=>{this.actions.close();let t=(()=>e?Hp(e)?e:"current"in e&&Hp(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})}),Rg(this,"selectors",{isPortalled:e=>{var t;if(!e.button||!e.panel)return!1;let n=null!=(t=Op(e.button))?t:document;for(let t of n.querySelectorAll("body > *"))if(Number(null==t?void 0:t.contains(e.button))^Number(null==t?void 0:t.contains(e.panel)))return!0;let r=th(n),i=r.indexOf(e.button),o=(i+r.length-1)%r.length,s=(i+1)%r.length,a=r[o],l=r[s];return!e.panel.contains(a)&&!e.panel.contains(l)}});{let e=this.state.id,t=nf.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 Fg({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 Vp(t.type,Ag,e,t)}}const Ig=(0,o.createContext)(null);function zg(e){let t=(0,o.useContext)(Ig);if(null===t){let t=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,zg),t}return t}let Dg=(0,o.createContext)(null);function Lg(){return(0,o.useContext)(Dg)}Dg.displayName="PopoverGroupContext";let Mg=(0,o.createContext)(null);Mg.displayName="PopoverPanelContext";let Ug=fh.RenderStrategy|fh.Static;function $g(e,t){let n=(0,o.useId)(),{id:r=`headlessui-popover-backdrop-${n}`,transition:i=!1,...s}=e,a=zg("Popover.Backdrop"),l=of(a,(0,o.useCallback)(e=>e.popoverState,[])),[c,u]=(0,o.useState)(null),d=uf(t,u),p=fg(),[h,f]=yf(i,c,null!==p?(p&hg.Open)===hg.Open:l===Og.Open),m=Mp(e=>{if(yg(e.currentTarget))return e.preventDefault();a.actions.close()}),g=af({open:l===Og.Open}),y={ref:d,id:r,"aria-hidden":!0,onClick:m,...gf(f)};return gh()({ourProps:y,theirProps:s,slot:g,defaultTag:"div",features:Ug,visible:h,name:"Popover.Backdrop"})}let Bg=fh.RenderStrategy|fh.Static,qg=xh(function(e,t){var n;let r=(0,o.useId)(),{__demoMode:i=!1,...s}=e,a=function({id:e,__demoMode:t=!1}){let n=(0,o.useMemo)(()=>Fg.new({id:e,__demoMode:t}),[]);return vg(()=>n.dispose()),n}({id:r,__demoMode:i}),l=(0,o.useRef)(null),c=uf(t,cf(e=>{l.current=e})),[u,d,p,h,f]=of(a,(0,o.useCallback)(e=>[e.popoverState,e.button,e.panel,e.buttonId,e.panelId],[])),m=function(...e){return(0,o.useMemo)(()=>Np(...e),[...e])}(null!=(n=l.current)?n:d),g=Lp(h),y=Lp(f),_=(0,o.useMemo)(()=>({buttonId:g,panelId:y,close:a.actions.close}),[g,y,a]),v=Lg(),b=null==v?void 0:v.registerPopover,x=Mp(()=>{var e,t;let n=Ap(null!=(e=l.current)?e:d);return null!=(t=null==v?void 0:v.isFocusWithinPopoverGroup())?t:n&&((null==d?void 0:d.contains(n))||(null==p?void 0:p.contains(n)))});(0,o.useEffect)(()=>null==b?void 0:b(_),[b,_]);let[w,j]=function(){let e=(0,o.useContext)(kg),t=(0,o.useRef)([]),n=Mp(n=>(t.current.push(n),e&&e.register(n),()=>r(n))),r=Mp(n=>{let r=t.current.indexOf(n);-1!==r&&t.current.splice(r,1),e&&e.unregister(n)}),i=(0,o.useMemo)(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,(0,o.useMemo)(()=>function({children:e}){return o.createElement(kg.Provider,{value:i},e)},[i])]}(),S=Nh(d),k=function({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=Mp(()=>{var r,i;let o=Op(n),s=[];for(let t of e)null!==t&&(qp(t)?s.push(t):"current"in t&&qp(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!=(r=null==o?void 0:o.querySelectorAll("html > *, body > *"))?r:[])e!==document.body&&e!==document.head&&qp(e)&&"headlessui-portal-root"!==e.id&&(n&&(e.contains(n)||e.contains(null==(i=null==n?void 0:n.getRootNode())?void 0:i.host))||s.some(t=>e.contains(t))||s.push(e));return s});return{resolveContainers:r,contains:Mp(e=>r().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,n,r){let i=Lp(n);(0,o.useEffect)(()=>{function n(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)},[e,t,r])}(m,"focus",e=>{var t,n,r,i,o,s;e.target!==window&&Wp(e.target)&&a.state.popoverState===Og.Open&&(x()||a.state.button&&a.state.panel&&(k.contains(e.target)||null!=(n=null==(t=a.state.beforePanelSentinel.current)?void 0:t.contains)&&n.call(t,e.target)||null!=(i=null==(r=a.state.afterPanelSentinel.current)?void 0:r.contains)&&i.call(r,e.target)||null!=(s=null==(o=a.state.afterButtonSentinel.current)?void 0:o.contains)&&s.call(o,e.target)||a.actions.close()))},!0),dh(u===Og.Open,k.resolveContainers,(e,t)=>{a.actions.close(),rh(t,nh.Loose)||(e.preventDefault(),null==d||d.focus())});let C=af({open:u===Og.Open,close:a.actions.refocusableClose}),T=of(a,(0,o.useCallback)(e=>Vp(e.popoverState,{[Og.Open]:hg.Open,[Og.Closed]:hg.Closed}),[])),E={ref:c},P=gh();return o.createElement(Oh,{node:S},o.createElement(lg,null,o.createElement(Mg.Provider,{value:null},o.createElement(Ig.Provider,{value:a},o.createElement(vf,{value:a.actions.refocusableClose},o.createElement(mg,{value:T},o.createElement(j,null,P({ourProps:E,theirProps:s,slot:C,defaultTag:"div",name:"Popover"}))))))))}),Hg=xh(function(e,t){let n=(0,o.useId)(),{id:r=`headlessui-popover-button-${n}`,disabled:i=!1,autoFocus:s=!1,...a}=e,l=zg("Popover.Button"),[c,u,d,p,h,f,m]=of(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),y=`headlessui-focus-sentinel-${(0,o.useId)()}`,_=Lg(),v=null==_?void 0:_.closeOthers,b=null!==(0,o.useContext)(Mg);(0,o.useEffect)(()=>{if(!b)return l.actions.setButtonId(r),()=>l.actions.setButtonId(null)},[b,r,l]);let[x]=(0,o.useState)(()=>Symbol()),w=uf(g,t,(0,o.useContext)(og).setReference,Mp(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=uf(g,t),S=Mp(e=>{var t,n,r;if(b){if(l.state.popoverState===Og.Closed)return;switch(e.key){case _g.Space:case _g.Enter:e.preventDefault(),null==(n=(t=e.target).click)||n.call(t),l.actions.close(),null==(r=l.state.button)||r.focus()}}else switch(e.key){case _g.Space:case _g.Enter:e.preventDefault(),e.stopPropagation(),l.state.popoverState===Og.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close();break;case _g.Escape:if(l.state.popoverState!==Og.Open)return null==v?void 0:v(l.state.buttonId);if(!g.current)return;let t=Ap(g.current);if(t&&!g.current.contains(t))return;e.preventDefault(),e.stopPropagation(),l.actions.close()}}),k=Mp(e=>{b||e.key===_g.Space&&e.preventDefault()}),C=Mp(e=>{var t,n;yg(e.currentTarget)||i||(b?(l.actions.close(),null==(t=l.state.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),l.state.popoverState===Og.Closed?(null==v||v(l.state.buttonId),l.actions.open()):l.actions.close(),null==(n=l.state.button)||n.focus()))}),T=Mp(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:P}=wp({autoFocus:s}),{isHovered:R,hoverProps:O}=Tp({isDisabled:i}),{pressed:N,pressProps:A}=Up({disabled:i}),F=c===Og.Open,I=af({open:F,active:N||F,disabled:i,hover:R,focus:E,autofocus:s}),z=function(e,t){return(0,o.useMemo)(()=>{var n;if(e.type)return e.type;let r=null!=(n=e.as)?n:"button";return"string"==typeof r&&"button"===r.toLowerCase()||"BUTTON"===(null==t?void 0:t.tagName)&&!t.hasAttribute("type")?"button":void 0},[e.type,e.as,t])}(e,d),D=bh(b?{ref:j,type:z,onKeyDown:S,onClick:C,disabled:i||void 0,autoFocus:s}:{ref:w,id:p,type:z,"aria-expanded":c===Og.Open,"aria-controls":h?f:void 0,disabled:i||void 0,autoFocus:s,onKeyDown:S,onKeyUp:k,onClick:C,onMouseDown:T},P,O,A),L=ff(),M=Mp(()=>{if(!Hp(l.state.panel))return;let e=l.state.panel;Vp(L.current,{[hf.Forwards]:()=>sh(e,Yp.First),[hf.Backwards]:()=>sh(e,Yp.Last)})===Xp.Error&&sh(th(Np(l.state.button)).filter(e=>"true"!==e.dataset.headlessuiFocusGuard),Vp(L.current,{[hf.Forwards]:Yp.Next,[hf.Backwards]:Yp.Previous}),{relativeTo:l.state.button})}),U=gh();return o.createElement(o.Fragment,null,U({ourProps:D,theirProps:a,slot:I,defaultTag:"button",name:"Popover.Button"}),F&&!b&&u&&o.createElement(Ph,{id:y,ref:m,features:Eh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:M}))}),Wg=xh($g),Zg=xh($g),Gg=xh(function(e,t){let n=(0,o.useId)(),{id:r=`headlessui-popover-panel-${n}`,focus:i=!1,anchor:s,portal:a=!1,modal:l=!1,transition:c=!1,...u}=e,d=zg("Popover.Panel"),p=of(d,d.selectors.isPortalled),[h,f,m,g,y]=of(d,(0,o.useCallback)(e=>[e.popoverState,e.button,e.__demoMode,e.beforePanelSentinel,e.afterPanelSentinel],[])),_=`headlessui-focus-sentinel-before-${n}`,v=`headlessui-focus-sentinel-after-${n}`,b=(0,o.useRef)(null),x=function(e){return(0,o.useMemo)(()=>e?"string"==typeof e?{to:e}:e:null,[e])}(s),[w,j]=ag(x),S=function(){let{getFloatingProps:e,slot:t}=(0,o.useContext)(og);return(0,o.useCallback)((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}();x&&(a=!0);let[k,C]=(0,o.useState)(null),T=uf(b,t,x?w:null,d.actions.setPanel,C),E=ph(f),P=ph(b.current);Dp(()=>(d.actions.setPanelId(r),()=>d.actions.setPanelId(null)),[r,d]);let R=fg(),[O,N]=yf(c,k,null!==R?(R&hg.Open)===hg.Open:h===Og.Open);(function(e,t,n){let r=Lp(e=>{let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&n()});(0,o.useEffect)(()=>{if(!e)return;let n=null===t?null:Hp(t)?t:t.current;if(!n)return;let i=Ip();if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}if("undefined"!=typeof IntersectionObserver){let e=new IntersectionObserver(()=>r.current(n));e.observe(n),i.add(()=>e.disconnect())}return()=>i.dispose()},[t,r,e])})(O,f,d.actions.close),function(e,t,n=()=>[document.body]){let r=function(e){let t=(0,o.useId)(),n=nf.get("scroll-lock"),[r,i]=of(n,(0,o.useCallback)(e=>[n.selectors.isTop(e,t),n.selectors.inStack(e,t)],[n,t]));return Dp(()=>{if(e)return n.actions.push(t),()=>n.actions.pop(t)},[n,e,t]),!!e&&(!i||r)}(e);Dh(r,t,e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],n]}})}(!m&&l&&O,P);let A=Mp(e=>{var t;if(e.key===_g.Escape){if(d.state.popoverState!==Og.Open||!b.current)return;let n=Ap(b.current);if(n&&!b.current.contains(n))return;e.preventDefault(),e.stopPropagation(),d.actions.close(),null==(t=d.state.button)||t.focus()}});(0,o.useEffect)(()=>{var t;e.static||h===Og.Closed&&(null==(t=e.unmount)||t)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),(0,o.useEffect)(()=>{if(m||!i||h!==Og.Open||!b.current)return;let e=Ap(b.current);b.current.contains(e)||sh(b.current,Yp.First)},[m,i,b.current,h]);let F=af({open:h===Og.Open,close:d.actions.refocusableClose}),I=bh(x?S():{},{ref:T,id:r,onKeyDown:A,onBlur:i&&h===Og.Open?e=>{var t,n,r,i,o;let s=e.relatedTarget;s&&b.current&&(null!=(t=b.current)&&t.contains(s)||(d.actions.close(),(null!=(r=null==(n=g.current)?void 0:n.contains)&&r.call(n,s)||null!=(o=null==(i=y.current)?void 0:i.contains)&&o.call(i,s))&&s.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...j,"--button-width":Bp(O,f,!0).width},...gf(N)}),z=ff(),D=Mp(()=>{let e=b.current;e&&Vp(z.current,{[hf.Forwards]:()=>{var t;sh(e,Yp.First)===Xp.Error&&(null==(t=d.state.afterPanelSentinel.current)||t.focus())},[hf.Backwards]:()=>{var e;null==(e=d.state.button)||e.focus({preventScroll:!0})}})}),L=Mp(()=>{let e=b.current;e&&Vp(z.current,{[hf.Forwards]:()=>{var e;if(!d.state.button)return;let t=th(null!=(e=Np(d.state.button))?e:document.body),n=t.indexOf(d.state.button),r=t.slice(0,n+1),i=[...t.slice(n+1),...r];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)}sh(i,Yp.First,{sorted:!1})},[hf.Backwards]:()=>{var t;sh(e,Yp.Previous)===Xp.Error&&(null==(t=d.state.button)||t.focus())}})}),M=gh();return o.createElement(gg,null,o.createElement(Mg.Provider,{value:r},o.createElement(vf,{value:d.actions.refocusableClose},o.createElement(Eg,{enabled:!!a&&(e.static||O),ownerDocument:E},O&&p&&o.createElement(Ph,{id:_,ref:g,features:Eh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:D}),M({ourProps:I,theirProps:u,slot:F,defaultTag:"div",features:Bg,visible:O,name:"Popover.Panel"}),O&&p&&o.createElement(Ph,{id:v,ref:y,features:Eh.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L})))))}),Vg=xh(function(e,t){let n=(0,o.useRef)(null),r=uf(n,t),[i,s]=(0,o.useState)([]),a=Mp(e=>{s(t=>{let n=t.indexOf(e);if(-1!==n){let e=t.slice();return e.splice(n,1),e}return t})}),l=Mp(e=>(s(t=>[...t,e]),()=>a(e))),c=Mp(()=>{var e;let t=Np(n.current);if(!t)return!1;let r=Ap(n.current);return!(null==(e=n.current)||!e.contains(r))||i.some(e=>{var n,i;return(null==(n=t.getElementById(e.buttonId.current))?void 0:n.contains(r))||(null==(i=t.getElementById(e.panelId.current))?void 0:i.contains(r))})}),u=Mp(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=af({}),h=e,f={ref:r},m=gh();return o.createElement(Oh,null,o.createElement(Dg.Provider,{value:d},m({ourProps:f,theirProps:h,slot:p,defaultTag:"div",name:"Popover.Group"})))}),Qg=Object.assign(qg,{Button:Hg,Backdrop:Zg,Overlay:Wg,Panel:Gg,Group:Vg}),Kg=(0,o.createContext)(void 0),Jg=xh(function(e,t){var n;let r=(0,o.useContext)(Kg),{disabled:i=r||!1,autoFocus:s=!1,...a}=e,{isFocusVisible:l,focusProps:c}=wp({autoFocus:s}),{isHovered:u,hoverProps:d}=Tp({isDisabled:i}),{pressed:p,pressProps:h}=Up({disabled:i}),f=bh({ref:t,type:null!=(n=a.type)?n:"button",disabled:i||void 0,autoFocus:s},c,d,h),m=af({disabled:i,hover:u,focus:l,active:p,autofocus:s});return gh()({ourProps:f,theirProps:a,slot:m,defaultTag:"button",name:"Button"})}),Yg=xh(function(e,t){let n=(0,o.useContext)(_f);return o.createElement(Jg,{ref:t,...bh({onClick:n},e)})});function Xg(e){const{options:t,disabled:n=!1,title:r,selected:i}=e;return(0,l.jsxs)(Qg,{className:h("wpl-dropdownbutton",t.length<=1?"wpl-dropdownbutton__single":null),children:[(0,l.jsx)("button",{onClick:function(n){n.preventDefault();const r=i||t[0]?.value;r&&e.onSelect(r)},type:"button",className:h("wpl-dropdownbutton__main",n&&"wpl-dropdownbutton__disabled"),children:(0,l.jsx)("h5",{children:r})}),t.length>1&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Hg,{disabled:n,className:h("wpl-dropdownbutton","wpl-popover__toggle",n&&"wpl-dropdownbutton__disabled"),children:(0,l.jsx)(Au,{})}),(0,l.jsx)(Gg,{anchor:"bottom start",className:"wpl-dropdownbutton__popover wpl-popover wpl-popover__content",children:({close:n})=>(0,l.jsx)("ul",{children:t.map(({label:t,value:r,description:o})=>(0,l.jsxs)("li",{className:h({"wpl-dropdownbutton__item":!0,["wpl-dropdownbutton__"+r]:!0,"wpl-dropdownbutton__selected":i===r}),children:[i===r?(0,l.jsx)("span",{className:"wpl-dropdownbutton__selected-icon",children:"✓"}):(0,l.jsx)("span",{className:"wpl-dropdownbutton__selected-icon"}),(0,l.jsxs)(Yg,{as:"button",className:"button",onClick:t=>function(t,n,r){t.preventDefault(),t.stopPropagation(),r(),e.onSelect(n)}(t,r,n),children:[t,o&&(0,l.jsx)("span",{children:o})]})]},r))})})]})]})}const ey=({headerValue:e,options:t,onChange:n})=>(0,l.jsx)(cr,{items:t,name:"headerValue",value:e,onChange:e=>n({[e.target.name]:e.target.value})}),ty=e=>"<"+e+">",ny=(e,t)=>e.includes(ty(t));function ry(e,t){return"uri"===t?e.replace(/[^A-Za-z0-9-._~:/?#\[\]@!$&'()*+,;=]/g,""):"integer"===t?parseInt(e,10):e}const iy=({headerValue:e,headerSettings:t,options:n,onChange:r})=>{const{choices:i,replace:o,replaceType:s}=n,a=t.selected?t.selected:e,c=t.replaceValue?t.replaceValue:"";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(cr,{items:i,name:"headerValue",value:a,onChange:e=>{r({headerValue:e.target.value,headerSettings:{selected:e.target.value,replaceValue:""}})}}),ny(a,o)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:`header-replace-${o}`,children:ty(o).replace(/</g,"").replace(/>/g,"")}),(0,l.jsx)("input",{id:`header-replace-${o}`,type:"text",className:"regular-text",name:"replaceValue",value:c,onChange:e=>{r({headerValue:a.replace(ty(o),e.target.value),headerSettings:{selected:a,replaceValue:ry(e.target.value,s)}})}})]})]})},oy=({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})})]}),sy=({headerValue:e,options:t,onChange:n})=>{const{choices:r,implode:o,wildCard:s}=t,a=e.split(o);return(0,l.jsx)(Fu,{options:s?r.concat([{value:s,label:(0,i.__)("All","redirection")}]):r,selected:a,onChange:e=>{if(!Array.isArray(e))return;const t=a,r=e.find(e=>!t.includes(e))||t.find(t=>!e.includes(t));if(s&&r===s){const e=1===t.length&&t[0]===s;return void n({headerValue:e?"":s})}n({headerValue:e.filter(e=>e!==s).filter(e=>e).join(o)})},title:(0,i.__)("Values","redirection"),hideTitle:!0,multiple:!0,badges:!0})},ay=e=>e.map(e=>({label:e,value:e})),ly={"X-UA-Compatible":{component:ey,info:"https://frankcode.net/2013/10/17/a-guide-to-ie-compatibility-view-and-x-ua-compatible/",default:"Chrome=1",options:ay(["IE=EmulateIE7","IE=edge","Chrome=1"])},"X-Frame-Options":{component:iy,info:"",default:"deny",options:{choices:ay(["deny","sameorigin","allow-from <URI>"]),replace:"URI",replaceType:"uri"}},"Strict-Transport-Security":{component:iy,default:"max-age=<expire-time>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security",options:{choices:ay(["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:iy,default:"1; mode=block",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection",options:{choices:ay(["0","1","1; mode=block","1; report=<URI>"]),replace:"URI",replaceType:"uri"}},"X-Content-Type-Options":{component:ey,default:"nosniff",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options",options:ay(["nosniff"])},"Feature-Policy":{component:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy"},"Permissions-Policy":{component:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy",default:"camera=(), display-capture=(), geolocation=(), microphone=()"},"Clear-Site-Data":{component:sy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data",default:"cache",options:{choices:ay(["cache","cookies","storage","executionContexts"]),implode:",",wildCard:"*"}},"Referrer-Policy":{component:ey,default:"no-referrer-when-downgrade",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy",options:ay(["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:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only"},Custom:{component:({headerValue:e,headerName:t,onChange:n})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"text",className:"regular-text",name:"headerName",value:t,onChange:e=>n({[e.target.name]:e.target.value})}),"Value:"," ",(0,l.jsx)("input",{type:"text",className:"regular-text",name:"headerValue",value:e,onChange:e=>n({[e.target.name]:e.target.value})})]})},"Access-Control-Allow-Methods":{component:sy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods",default:"GET",options:{choices:ay(["GET","POST","PUT","HEAD","DELETE","OPTIONS"]),implode:",",wildCard:"*"}},"Access-Control-Allow-Credentials":{component:ey,default:"true",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials",options:ay(["true"])},"Access-Control-Allow-Origin":{component:iy,default:"<origin>",info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin",options:{choices:ay(["<origin>","*"]),replace:"origin",replaceType:"uri"}},"X-Robots-Tag":{component:sy,default:"noindex",info:"https://developers.google.com/search/reference/robots_meta_tag#xrobotstag",options:{choices:ay(["noindex","nofollow","none","noarchive","nosnippet","notranslate","noimageindex"]),implode:",",wildCard:"all"}},"Access-Control-Allow-Headers":{component:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers"},"Access-Control-Max-Age":{component:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age"},"Access-Control-Expose-Headers":{component:oy,info:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"}},cy=e=>{const t=ly[e];return t&&t.options?t.options:null},uy=e=>{const t=ly[e];return t&&t.default?t.default:""},dy=({header:e,onChange:t,onDelete:n})=>{const{location:r,headerName:o,headerValue:s,headerSettings:a,type:c}=e,u=n=>{t({...e,...n})},d=t=>{const{name:n,value:r}=t.target;let i=o;"type"===n&&"Custom"===r?i="":"type"===n&&(i=r),u({headerValue:"type"===n?uy(r):e.headerValue,headerSettings:"type"===n?cy(i):e.headerSettings,headerName:i,[n]:r})},p=((e,t,n,r,i)=>{const o=ly[s=e]?ly[s].component:oy;var s;return(0,l.jsx)(o,{headerName:t,headerValue:""===n?uy(e):n,headerSettings:r,options:cy(e),onChange:i})})(c,o,s,a,u),h=(e=>{const t=ly[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)(cr,{items:[{label:(0,i.__)("Site","redirection"),value:"site"},{label:(0,i.__)("Redirect","redirection"),value:"redirect"}],name:"location",value:r,onChange:d})}),(0,l.jsxs)("td",{className:"redirect-headers__name",children:[(0,l.jsxs)("div",{className:"redirect-headers__name__content",children:[(0,l.jsx)(cr,{items:[{label:(0,i.__)("General","redirection"),value:ay(["X-UA-Compatible","X-Robots-Tag"])},{label:"CORS",value:ay(["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:ay(["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)(O,{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(),n(e.id)},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},py=(e="X-Robots-Tag",t="nofollow",n={})=>({location:"site",type:e,headerName:e,headerValue:t,headerSettings:n}),hy=({headers:e,onChange:t})=>{const[n,r]=(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===n);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((n,r)=>(0,l.jsx)(dy,{header:n,onChange:n=>((e,t,n,r)=>{const i=n.slice();i[e]=t,r({headers:i})})(r,n,e,t),onDelete:()=>((e,t,n)=>{n({headers:[...t.slice(0,e),...t.slice(e+1)]})})(r,e,t)},r)),0===e.length&&(0,l.jsx)("tr",{children:(0,l.jsx)("td",{colSpan:3,children:(0,i.__)("No headers","redirection")})})]})]}),(0,l.jsx)(Xg,{options:s,selected:n,title:a?a.label:s[0]?.label||"",onSelect:n=>{r(n),((e,t,n)=>{"header"===e?n({headers:t.concat([py()])}):"security"===e?n({headers:t.concat([py("X-Frame-Options","deny"),py("X-XSS-Protection","1; mode=block"),py("X-Content-Type-Options","nosniff"),py("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?py("Strict-Transport-Security","max-age: 31536000; includeSubDomains"):null,py("Referrer-Policy","no-referrer-when-downgrade")].filter(e=>e))}):"cors"===e&&n({headers:t.concat([py("Access-Control-Allow-Origin","*"),py("Access-Control-Allow-Credentials","true"),py("Access-Control-Allow-Methods","POST,GET,OPTIONS"),py("Access-Control-Allow-Headers","origin"),py("Referrer-Policy","no-referrer-when-downgrade"),py("P3P",'CP="CAO PSA OUR"')])})})(n,e,t)}}),(0,l.jsx)("p",{children:(0,i.__)("Note that some HTTP headers are set by your server and cannot be changed.","redirection")})]})},fy=function({link:e,onChange:t,onDelete:n}){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(),n()},children:(0,l.jsx)("span",{className:"dashicons dashicons-trash"})})})]})},my=function(e){const{permalinks:t,onChange:n}=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,r)=>(0,l.jsx)(fy,{link:e,onChange:e=>((e,t,n,r)=>{const i=t.slice();i[e]=r.target.value,n({permalinks:i})})(r,t,n,e),onDelete:()=>((e,t,n)=>{n({permalinks:[...t.slice(0,e),...t.slice(e+1)]})})(r,t,n)},r)),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,n)=>{n.preventDefault(),t({permalinks:e.concat("").slice(0,10)})})(t,n,e),children:(0,i.__)("Add Permalink","redirection")})})]})};function gy(){const e=Rd(Redirectioni10n.pluginRoot),t=de(e=>e.loadStatus),n=de(e=>e.values),r=de(e=>e.saveStatus);ya();const{mutate:s}=_a(),[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(""),[p,h]=(0,o.useState)([]),[f,m]=(0,o.useState)(""),[g,y]=(0,o.useState)([]),[_,v]=(0,o.useState)([]);(0,o.useEffect)(()=>{n&&(c(n.https||!1),d(n.preferred_domain||""),h(n.headers||[]),m(n.relocate||""),y(n.aliases||[]),v(n.permalinks||[]))},[n]);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&&y(e.aliases),void 0!==e.permalinks&&v(e.permalinks)};return"loading"!==t&&n?(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s({https:a,headers:p,preferred_domain:u,aliases:g.filter(e=>e).map(Rd),relocate:Pd(f),permalinks:_})},children:[(0,l.jsx)("div",{className:"inline-notice inline-warning",children:(0,l.jsx)("p",{children:D((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)(O,{url:"https://redirection.me/support/disable-redirection/"})})})}),(0,l.jsx)(Ad,{relocate:f,siteDomain:e,onChange:b}),0===f.length&&(0,l.jsx)(Nd,{aliases:g,siteDomain:e,onChange:b}),0===f.length&&(0,l.jsx)(Id,{https:a,siteDomain:e,preferredDomain:u,onChange:b}),0===f.length&&(0,l.jsx)(my,{permalinks:_,onChange:b}),(0,l.jsx)(hy,{headers:p,onChange:b}),(0,l.jsx)("input",{className:"button-primary",type:"submit",name:"update",value:(0,i.__)("Update","redirection"),disabled:r})]}):(0,l.jsx)(Rl,{})}const yy=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}],_y=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:vy(e).map(e=>e.value)}],vy=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")}],by=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},xy=window.Redirectioni10n?.per_page?parseInt(window.Redirectioni10n.per_page,10):25,wy={page:0,per_page:xy,orderby:"id",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["last_count","last_access","source","target","code","title"],groupBy:""},jy={page:0,per_page:xy,orderby:"name",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["name","module","redirects"],groupBy:""},Sy={page:0,per_page:xy,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","target","agent","ip"],groupBy:""},ky={page:0,per_page:xy,orderby:"",direction:"desc",selected:[],filterBy:{},displayType:"standard",displaySelected:["date","url","agent","ip"],groupBy:""},Cy={redirects:wy,groups:jy,logs:Sy,errors:ky,redirectsAddTop:!1},Ty=X()(se(((e,t)=>(n,r,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.`),n(...e)},r,i);const d=()=>{const e=o.partialize({...r()});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)=>(n(...e),d()),r,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=r())?t:h)});const p=(null==(t=o.onRehydrateStorage)?void 0:t.call(o,null!=(e=r())?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=r())?t:h),n(f,!0),s?d():void 0}).then(()=>{i===a&&(null==p||p(r(),void 0),f=r(),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=>({...Cy,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:wy,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:jy}),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:Sy}),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:ky}),reset:()=>e(Cy)}),{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 n=e??{};return{...t,redirects:{...t.redirects,...n.redirects},groups:{...t.groups,...n.groups},logs:{...t.logs,...n.logs},errors:{...t.errors,...n.errors}}}}),{name:"TableStore"}));function Ey(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...En(t)})}(Is,e)}const Py=Gs({id:Qs([zs().int(),fs()]),created:fs().optional(),created_time:fs().optional(),url:fs().optional(),sent_to:fs().optional().nullable(),agent:fs().optional().nullable(),referrer:fs().optional().nullable(),ip:fs().optional().nullable(),domain:fs().optional().nullable(),redirect_id:zs().int().optional(),redirection_id:zs().int().optional(),request_method:fs().optional().nullable(),http_code:zs().int().optional(),request_data:Bs().optional().nullable(),redirect_by:fs().optional().nullable(),count:Ey().int().optional()}),Ry=Gs({id:Qs([zs().int(),fs()]),created:fs().optional(),created_time:fs().optional(),url:fs().optional(),agent:fs().optional().nullable(),referrer:fs().optional().nullable(),domain:fs().optional().nullable(),ip:fs().optional().nullable(),http_code:zs().int().optional(),request_method:fs().optional().nullable(),request_data:Bs().optional().nullable(),count:Ey().int().optional()}),Oy=Zu(Py),Ny=Zu(Ry);function Ay(e){const t=u(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=Gn(),{setErrorsTable:s}=Ty();return mt({mutationFn:async({action:e,items:t,params:i={}})=>{n();try{return await St(Yt(e,{items:t},i))}catch(e){throw r(),Hn(e)}},onSuccess:(e,n)=>{r();const o="delete"===n.action?"deleted":n.action;i(`404 errors ${o}`),s(Ju(n.params)),t.invalidateQueries({queryKey:Wn.errors.all})},onError:e=>{o(e.message||"Failed to perform 404 error action")},...e})}function Fy(e){const{table:t,setTable:n,allowedOrder:r=[],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)),n={};return t.forEach((e,t)=>{n[t]=e}),n}();if(e.sub!==l&&"redirect"!==l)return void(c.current=!0);const o={};e.orderby&&r.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,n]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(n))}}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&&n(o),c.current=!0,u.current={...t,...o}},[t,n,r,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 n=new URLSearchParams(document.location.search),r=function(e,t){const n={...e};return"desc"===n.direction&&delete n.direction,n.orderby===t&&delete n.orderby,0===n.page&&delete n.page,n.per_page===parseInt(Redirectioni10n.per_page,10)&&delete n.per_page,"object"==typeof n.filterBy&&0===Object.keys(n.filterBy||{}).length&&(delete n.filterBy,delete n.filter),""===n.groupBy&&(delete n.groupBy,delete n.group),25!==parseInt(Redirectioni10n.per_page,10)&&(n.per_page=parseInt(Redirectioni10n.per_page,10)),delete n.selected,delete n.displaySelected,delete n.displayType,delete n.selectAll,n}(t,a);"redirect"!==l&&n.set("sub",l),r.orderby?n.set("orderby",r.orderby):n.delete("orderby"),r.direction?n.set("direction",r.direction):n.delete("direction"),r.page&&r.page>0?n.set("offset",String(r.page)):n.delete("offset"),r.groupBy?n.set("groupby",r.groupBy):n.delete("groupby");const i=[];if(n.forEach((e,t)=>{t.startsWith("filterby[")&&i.push(t)}),i.forEach(e=>n.delete(e)),t.filterBy&&"object"==typeof t.filterBy)for(const[e,r]of Object.entries(t.filterBy))r&&n.set(`filterby[${e}]`,String(r));const o="?"+n.toString();history.replaceState({},"",o)},[t,a,l])}const Iy="idle",zy="loading",Dy="complete",Ly=e=>{const{name:t,title:n,table:r,primary:i,onSetOrderBy:o}=e,{direction:s,orderBy:a}=r,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:n}),(0,l.jsx)("span",{className:d})]})})},My=e=>{const{name:t,title:n,primary:r}=e,i=h({"manage-column":!0,"column-primary":r,["column-"+t]:!0});return(0,l.jsx)("th",{scope:"col",className:i,children:(0,l.jsx)("span",{children:n})})},Uy=e=>{const{onSelect:t,disabled:n,selected:r}=e;return(0,l.jsxs)("td",{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:n,checked:r,onChange:e=>t(e.target.checked)})]})},$y=e=>{const{disabled:t,onSelect:n,onSetOrderBy:r,headers:i,table:o,hasBulk:s,allSelected:a,isSaving:c}=e;return(0,l.jsxs)("tr",{children:[s&&(0,l.jsx)(Uy,{onSelect:n,disabled:t||c,selected:a}),i.map(e=>{const{primary:t=!1,sortable:n=!0}=e;return n?(0,l.jsx)(Ly,{table:o,name:e.name,title:e.title,onSetOrderBy:r,primary:t},e.name):(0,l.jsx)(My,{name:e.name,title:e.title,primary:t},e.name)})]})},By=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"})})]})},qy=e=>{const{headers:t,rows:n}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(By,{columns:t}),n.slice(0,-1).map((e,n)=>(0,l.jsx)(By,{columns:t},n))]})},Hy=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")})})},Wy=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")})})})},Zy=(0,o.memo)(function(e){const{isSaving:t,disabled:n,id:r,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,n=/^\d+$/.test(t)?parseInt(t,10):t;s([n],i)},[s,i]);return(0,l.jsx)("th",{scope:"row",className:"check-column",children:t?(0,l.jsx)(ir,{size:"small"}):(0,l.jsx)("input",{type:"checkbox",name:"item[]",value:r,disabled:n,checked:c,onChange:d,onClick:u})})});function Gy(e){const{row:t,rowData:n,displaySelected:r,getRow:i,getRowActions:s,primary:a,total:c}=e,[u,d]=(0,o.useState)(!1),p={...n,rowMode:u,setRowMode:d},h=i(t,p),f=s(t,p);return Array.isArray(h)?(0,l.jsx)(l.Fragment,{children:h.filter(e=>r.includes(e.name)||!0===e.alwaysDisplay).map(e=>(0,l.jsxs)("td",{className:`column-${e.name}`,children:[e.content,e.name===(a?a.name:h[0]?.name)&&f]},e.name))}):(0,l.jsx)("td",{colSpan:c,children:h})}const Vy=(0,o.memo)(function(e){const{row:t,rowIndex:n,status:r,isSelected:i,isSaving:o,isAllSaving:s,displaySelected:a,table:c,getRow:u,getRowActions:d,onSelect:p,onShiftSelect:f,primary:m,headersLength:g}=e,y=function(e,t,n){return{isLoading:e===zy,isSelected:!!Array.isArray(n.selected)&&n.selected.some(e=>e===t.id),table:n}}(r,t,c);return(0,l.jsxs)("tr",{className:h({disabled:r===zy||"saving"===r,saving:o||s}),children:[!!p&&(0,l.jsx)(Zy,{id:t.id,rowIndex:n,onSelect:p,...f?{onShiftSelect:f}:{},disabled:r===zy,isSelected:i,isSaving:o||s}),(0,l.jsx)(Gy,{row:t,rowData:y,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),Qy=function(e){const{rows:t,headers:n,status:r,table:i,getRow:s,getRowActions:a,onSelect:c,saving:u}=e,{selected:d=[],displaySelected:p}=i,h=n.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]),y=(0,o.useCallback)(e=>{if(!c)return;if(null===m.current){m.current=e;const n=t[e];return void(n&&c([n.id]))}const n=t.length-1,r=Math.min(m.current,n),i=Math.min(e,n),o=Math.min(r,i),s=Math.max(r,i),a=new Set(d),l=[];for(let e=o;e<=s;e++){const n=t[e];n&&!a.has(n.id)&&l.push(n.id)}l.length>0&&c(l),m.current=e},[c,t,d]);return r===zy&&0===t.length?(0,l.jsx)(qy,{headers:n,rows:t}):r===Dy&&0===t.length?(0,l.jsx)(Hy,{headers:n}):"error"===r?(0,l.jsx)(Wy,{headers:n}):(0,l.jsx)(l.Fragment,{children:t.map((e,t)=>(0,l.jsx)(Vy,{row:e,rowIndex:t,status:r,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:y}:{},primary:h,headersLength:n.length},e.id))})},Ky=e=>{const{headers:t,getRow:n,getRowActions:r,rows:i,table:o,status:s,saving:a,onSelect:c,onSetOrderBy:u}=e,d=(0,l.jsx)($y,{table:o,disabled:s!==Dy||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.jsxs)("table",{className:p,children:[(0,l.jsx)("thead",{children:d}),(0,l.jsx)("tbody",{children:(0,l.jsx)(Qy,{rows:i,table:o,headers:t,status:s,getRow:n,getRowActions:r,...c?{onSelect:c}:{},saving:a})}),(0,l.jsx)("tfoot",{children:d})]})},Jy=function(e){const{title:t,button:n,className:r,disabled:i,onClick:o}=e;return i?(0,l.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:n}):(0,l.jsxs)("button",{className:r+" 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:n})]})},Yy=function(e){const{page:t,total:n,perPage:r,onChangePage:s}=e,a=n<=r,[c,u]=(0,o.useState)(t+1);if((0,o.useEffect)(()=>{u(t+1)},[t]),a)return null;const d=function(e,t){return Math.ceil(e/t)}(n,r);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Jy,{title:(0,i.__)("First page","redirection"),button:"«",className:"first-page",disabled:t<=0,onClick:()=>s(0)}),(0,l.jsx)(Jy,{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:()=>s(Math.min(d-1,Math.max(0,c-1))),onChange:e=>u(parseInt(e.target.value,10))}),(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)(Jy,{title:(0,i.__)("Next page","redirection"),button:"›",className:"next-page",disabled:t>=d-1,onClick:()=>s(t+1)}),(0,l.jsx)(Jy,{title:(0,i.__)("Last page","redirection"),button:"»",className:"last-page",disabled:t>=d-1,onClick:()=>s(d-1)})]})},Xy=function(e){const{total:t,perPage:n,page:r,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<=n))&&(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>n&&!u&&D((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&&D((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)(Yy,{onChangePage:s,total:t,perPage:n,page:r},r)})]})},e_=function(e){const{total:t,rowCount:n,table:r,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)(Xy,{perPage:r.perPage,page:r.page,total:t,rowCount:n,onChangePage:o,onSelectAll:c,disabled:s,selected:r.selectAll?t:r.selected.length,isEverything:r.selectAll})]})},t_=({children:e})=>(0,l.jsx)("div",{className:"alignleft actions",children:e}),n_=function({selected:e,options:t,isEnabled:n,onGroup:r}){const[s,a]=(0,o.useState)(e);return(0,l.jsxs)("div",{className:"alignleft actions",children:[(0,l.jsx)(cr,{items:t,value:s,name:"filter",onChange:e=>{a(e.target.value)},disabled:!n}),(0,l.jsx)("button",{className:"button",onClick:()=>{r(s)},disabled:!n,children:(0,i.__)("Apply","redirection")})]})};function r_(e,t){return e.options.find(e=>e.value===t)}function i_(e,t){const n=[];return Object.keys(e).forEach(r=>{const i=t.find(e=>e.value===r);if(i){const t=e[r];t&&i.options.find(e=>e.value===t)&&n.push(t)}}),n}const o_=function(e){const{table:t,disabled:n,groupOptions:r,filterOptions:o,onGroup:s,onFilter:a}=e;return(0,l.jsxs)(l.Fragment,{children:[r.length>0&&(0,l.jsx)(n_,{selected:t.groupBy?t.groupBy:"",options:r,isEnabled:!n,onGroup:s},t.groupBy),o.length>0&&(0,l.jsx)(t_,{children:(0,l.jsx)(Fu,{options:o,selected:i_(t.filterBy,o),onChange:function(e){const t={};if(Array.isArray(e)){for(let n=0;n<e.length;n++){const r=e[n];if(r){const e=o.find(e=>r_(e,r));e&&(t[e.value]=r)}}a(t)}},title:(0,i.__)("Filters","redirection"),disabled:n,multiple:!0,badges:!0})})]})},s_=function(e){const{bulk:t,disabled:n,onBulk:r}=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:n,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:n||-1===parseInt(s,10),onClick:function(){-1!==parseInt(s,10)&&(r(s),a("-1"))},children:(0,i.__)("Apply","redirection")})]})};function a_(e,t){if("custom"===e)return(0,i.__)("Custom Display","redirection");for(let n=0;n<t.length;n++){const r=t[n]?.options.find(t=>t.value===e);if(r)return r.label}return t[0]?.label||""}const l_=function(e){const{disabled:t,predefinedGroups:n,customOptions:r,table:o,setDisplay:s,validation:a}=e,{displayType:c,displaySelected:u}=o,d=[{label:(0,i.__)("Pre-defined","redirection"),value:"pre",options:n},{label:(0,i.__)("Custom","redirection"),value:"custom",options:r}];return(0,l.jsx)(Fu,{className:"redirect-table-display__filter",options:d,selected:u.concat([c]),onChange:function(e){if(!Array.isArray(e))return;const t=u.concat([c]),n=e.filter(e=>!t.includes(e));if(n.length>0){const e=d[0]?.options?.find(e=>e.value===n[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&&r.find(t=>t.value===e)});s("custom",a?a(i):i)},title:a_(c,d),disabled:t})};function c_(e,t){if(e){const n=e.find(e=>t[e.name]);return n&&t[n.name]||""}return""}const u_=function({table:e,onSearch:t,searchTypes:n,selected:r,disabled:i=!1,name:s=""}){const a=n?.find(e=>r[e.name]),c=c_(n,r),u=a?a.name:n?.[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=c_(n,r);if(e!==m){const t=n?.find(e=>r[e.name]),i=t?t.name:n?.[0]?.name||"";g(e),p(e),f(i)}},[n,r,m]);const y=i||""===d&&""===e.filter,_=n?n.map(e=>({value:e.name,label:e.title})):[],v=n?.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)}}),n&&(0,l.jsx)(Xg,{options:_,disabled:i,title:b,onSelect:e=>{f(e),t(d,e)},selected:h}),!n&&(0,l.jsx)("input",{type:"submit",className:"button",value:s,disabled:y})]})},d_=function(e){const{disabled:t,filterOptions:n,searchOptions:r,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)(l_,{disabled:t,customOptions:n,predefinedGroups:i,table:o,setDisplay:s,...c?{validation:c}:{}}),(0,l.jsx)(u_,{disabled:t,table:o,onSearch:function(e,t){const n={...o.filterBy};r.map(e=>delete n[e.name]),e&&(n[t]=e),a(n)},selected:o.filterBy,searchTypes:r})]})},p_=function(e){const{logOptions:t,logActions:n,table:r,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:y,headers:_,validateDisplay:v}=t,{onChangePage:b,onFilter:x,onSetDisplay:w,onBulk:j,onGroup:S,onSetOrder:k,onSetAll:C,onSelect:T}=n,E=u===zy;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d_,{filterOptions:p,predefinedGroups:h,searchOptions:f,disabled:E,table:r,onFilter:x,onSetDisplay:w,...v?{validateDisplay:v}:{}}),(0,l.jsxs)(e_,{total:i,rowCount:o.length,table:r,disabled:E,onChangePage:b,className:"top",onSelectAll:C,children:[(0,l.jsx)(s_,{bulk:y,disabled:E||0===r.selected.length,onBulk:j}),(0,l.jsx)(o_,{disabled:E,table:r,groupOptions:m,filterOptions:g,onGroup:S,onFilter:x})]}),(0,l.jsx)(Ky,{headers:_,rows:o,getRow:s,getRowActions:a,table:r,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)(e_,{total:i,rowCount:o.length,table:r,disabled:E,onChangePage:b,className:"bottom",onSelectAll:C,children:[(0,l.jsx)(s_,{bulk:y,disabled:E||0===r.selected.length,onBulk:j}),c&&c()]})]})};function h_(e){return Redirectioni10n?.caps?.capabilities.includes(e)}function f_(e){return Redirectioni10n?.caps?.pages.includes(e)}const m_="redirection_cap_redirect_manage",g_="redirection_cap_redirect_add",y_="redirection_cap_group_add",v_="redirection_cap_404_delete";function b_(e){const{actions:t,disabled:n=!1}=e;return(0,l.jsx)("div",{className:"row-actions",children:n?(0,l.jsx)("span",{children:" "}):t.length>0&&t.filter(e=>e).reduce((e,t)=>[...e," | ",t],[]).slice(1)})}function x_(e){const{onClick:t,children:n,href:r="",capability:i=""}=e;return i&&!h_(i)?null:(0,l.jsx)("a",{href:r||"#",onClick:function(e){t&&(e.preventDefault(),t())},children:n})}const w_=()=>(0,l.jsx)("div",{className:"redirection-poweredby",children:D((0,i.__)("Powered by {{link}}redirect.li{{/link}}","redirection"),{link:(0,l.jsx)(O,{url:"https://redirect.li"})})});function j_(e){return!!(e&&e.name&&e.version)&&e.name+" "+e.version}function S_({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 k_({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 C_({agent:e,detail:t}){const n=function(e,t){if(!e)return null;const n=e.slice(0,1).toUpperCase()+e.slice(1);return t?(0,l.jsx)(O,{url:t,children:n}):n}(t.device.type,t.url),r=function(e){const t=[];return e.vendor&&t.push(e.vendor),e.name&&t.push(e.name),t.join(" ")}(t.device),o=j_(t.os),s=j_(t.browser),a=j_(t.engine),c=[];return r&&c.push([(0,i.__)("Device","redirection"),r]),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"),": ",n]}),(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)(w_,{})]})}function T_({agent:e}){const{data:t,isLoading:n,isError:r,error:i}=function(e,t){return pt({queryKey:Wn.info.agent(e),queryFn:async()=>await St(en(e)),enabled:!!e,staleTime:864e5,...t})}(e,{enabled:!!e}),o=h({"redirection-useragent":!0,"wpl-modal_loading":n}),s=t,a=r&&i&&i.message||"";return(0,l.jsxs)("div",{className:o,children:[n&&(0,l.jsx)(ir,{}),r&&a&&(0,l.jsx)(S_,{error:a}),!n&&!r&&!s&&(0,l.jsx)(k_,{agent:e}),!n&&!r&&s&&(0,l.jsx)(C_,{agent:e,detail:s})]})}const E_=function(e){const{agent:t}=e,[n,r]=(0,o.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x_,{href:"https://redirect.li/agent/?agent="+encodeURIComponent(t),onClick:()=>r(!0),children:(0,i.__)("Agent Info","redirection")}),n&&(0,l.jsx)(cd,{onClose:()=>r(!1),children:(0,l.jsx)(T_,{agent:t})})]})},P_=({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,R_=({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,O_=({data:e})=>{const{headers:t,source:n}=e;return(0,l.jsxs)("div",{className:"redirect-requestdata",children:[t&&(0,l.jsx)(P_,{headers:t}),n&&(0,l.jsx)(R_,{source:n})]})},N_=function(e){const{data:t}=e,[n,r]=(0,o.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x_,{onClick:()=>r(!0),children:(0,i.__)("View Data","redirection")}),n&&(0,l.jsx)(cd,{onClose:()=>r(!1),children:(0,l.jsx)(O_,{data:t})})]})},A_=function(e){const{row:t,onDelete:n,disabled:r,groupBy:o}=e,{agent:s,id:a,request_data:c,redirection_id:u}=t,{setLogsTable:d}=Ty(),p=[];return p.push((0,l.jsx)(x_,{onClick:()=>n(a),capability:"redirection_cap_log_delete",children:(0,i.__)("Delete","redirection")},"0")),s&&p.unshift((0,l.jsx)(E_,{agent:s},"3")),c&&p.push((0,l.jsx)(N_,{data:c},"4")),u&&u>0&&p.push((0,l.jsx)(x_,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[id]")+"="+u,children:(0,i.__)("View Redirect","redirection")},"5")),o&&p.push((0,l.jsx)(x_,{onClick:()=>d({filterBy:Yu(o,String(a)),page:0,groupBy:"",selected:[],selectAll:!1}),capability:m_,children:(0,i.__)("Show All","redirection")},"6")),(0,l.jsx)(b_,{disabled:r,actions:p})},F_=e=>{const{enabled:t=!0,children:n}=e;return t?(0,l.jsx)("div",{className:"table-buttons",children:n}):null};var I_=n(465),z_=n.n(I_);function D_(e){return e.url?il(ol(e.domain),e.url):""}function L_(e,t){if(!e.sent_to)return"";const n=t.target||"",r=/^https?:\/\//i.test(e.sent_to)?e.sent_to:il(ol(e.domain),e.sent_to);return(0,l.jsx)(O,{url:r,children:(0,l.jsx)(z_(),{searchWords:[n],textToHighlight:e.sent_to,autoEscape:!0})})}function M_(e){return e.includes("url")?e:e.concat(["url"])}const U_=function(){const e=Ty(e=>e.logs),{setLogsTable:t,setLogsSelected:n}=Ty(),r=de(e=>e.values),o=r?.token||"";Fy({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:n,addNotice:r,addError:i}=Gn(),{setLogsTable:o}=Ty();return mt({mutationFn:async({action:e,items:r,params:i={}})=>{t();try{return await St(Jt(e,{items:r},i))}catch(e){throw n(),Hn(e)}},onSuccess:(t,i)=>{n();const s="delete"===i.action?"deleted":i.action;r(`Logs ${s}`),o(Ju(i.params)),e.invalidateQueries({queryKey:Wn.logs.all})},onError:e=>{i(e.message||"Failed to perform log action")}})}(),{data:a,isLoading:c,isSuccess:d}=function(e={},t){const n=ed(e);return pt({queryKey:Wn.logs.list(n),queryFn:async()=>{try{const e=await St(Lt(n));return Oy.parse(e)}catch(e){const t=Hn(e);throw Gn.getState().addError(t.message||"Failed to fetch logs"),t}},...t})}(e),p=a?.items??[],h=a?.total??0;let f=Iy;c?f=zy:d&&(f=Dy);const m=t=>{if(!window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection")))return;const n=e.groupBy?{groupBy:e.groupBy}:{};s.mutate({action:"delete",items:[t],params:n})},g=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},y={...e,...(_=e.groupBy,_?{displayOptions:vy(_),displaySelected:_y(_)[0]?.grouping||[]}:{})};var _;const v={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??""},b={displayFilters:vy(y.groupBy),displayGroups:_y(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:by(r?.ip_logging||0),bulk:[{id:"delete",name:(0,i.__)("Delete","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:yy(y.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,y)),validateDisplay:M_},x={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;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 n=e.groupBy?{groupBy:e.groupBy}:{};e.selectAll?s.mutate({action:t,items:[],params:ed({...n,global:!0,filterBy:e.filterBy})}):s.mutate({action:t,items:e.selected,params:n})},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:"date"===e?"":e,direction:n})},onFilter:g,onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSelect:r=>{if("boolean"==typeof r)n(r?p.map(e=>e.id):[]);else if("number"==typeof r||"string"==typeof r){const n=Array.isArray(e.selected)?e.selected:[],i=n.some(e=>e===r)?n.filter(e=>e!==r):[...n,r];t({selected:i,selectAll:!1})}else n(r)},onSetAll:e=>{t({selected:e?p.map(e=>e.id):[],selectAll:e})}};return(0,l.jsx)(p_,{logOptions:b,logActions:x,table:v,status:f,total:h,rows:p,saving:[],getRow:(e,t)=>function(e,t){const{created:n,created_time:r,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:n?(0,l.jsxs)(l.Fragment,{children:[n,r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),r]})]}):""},{name:"method",content:u?u.toUpperCase():""},{name:"domain",content:p||""},{name:"url",content:o?(0,l.jsx)(O,{url:D_(e),children:(0,l.jsx)(z_(),{searchWords:[g],textToHighlight:o,autoEscape:!0})}):""},{name:"target",content:L_(e,m)},{name:"redirect_by",content:h||""},{name:"code",content:d??""},{name:"referrer",content:a?(0,l.jsx)(z_(),{searchWords:[m.referrer||""],textToHighlight:a,autoEscape:!0}):""},{name:"agent",content:s?(0,l.jsx)(z_(),{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)(z_(),{searchWords:[m.ip||""],textToHighlight:c,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,l.jsx)(b_,{actions:[(0,l.jsx)(x_,{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:g}),getRowActions:t=>(0,l.jsx)(A_,{disabled:!1,row:t,onDelete:m,groupBy:e.groupBy}),renderTableActions:()=>(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(F_,{enabled:p.length>0,children:o&&(0,l.jsx)("div",{className:"table-button-item",children:(0,l.jsx)("a",{href:rl(o),className:"button-secondary",children:(0,i.__)("RSS","redirection")})})})})})},$_="url",B_="error",q_="random",H_="pass",W_="nothing",Z_="url",G_="login",V_="referrer",Q_="agent",K_="cookie",J_="header",Y_="custom",X_="role",ev="server",tv="ip",nv="page",rv="language";function iv(e){return e===$_||e===q_}function ov(e,t){if(e===G_)return{logged_in:t?.logged_in||"",logged_out:t?.logged_out||""};if(e===V_)return{referrer:t?.referrer||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Q_)return{agent:t?.agent||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===K_)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===J_)return{name:t?.name||"",value:t?.value||"",regex:t?.regex||!1,url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===Y_)return{filter:t?.filter||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===X_)return{role:t?.role||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===ev)return{server:t?.server||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""};if(e===tv){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===rv?{language:t?.language||"",url_from:t?.url_from||"",url_notfrom:t?.url_notfrom||""}:t||{}}function sv(e,t,n){return{url:e,title:"",match_data:{source:{flag_regex:n.flag_regex||!1,flag_trailing:n.flag_trailing||!1,flag_case:n.flag_case||!1,flag_query:n.flag_query||"exact"},options:{}},match_type:Z_,action_type:$_,action_code:301,action_data:{},group_id:t,position:0}}const av=()=>[{value:Z_,label:(0,i.__)("URL only","redirection")},{value:G_,label:(0,i.__)("URL and login status","redirection")},{value:X_,label:(0,i.__)("URL and role/capability","redirection")},{value:V_,label:(0,i.__)("URL and referrer","redirection")},{value:Q_,label:(0,i.__)("URL and user agent","redirection")},{value:K_,label:(0,i.__)("URL and cookie","redirection")},{value:tv,label:(0,i.__)("URL and IP","redirection")},{value:ev,label:(0,i.__)("URL and server","redirection")},{value:J_,label:(0,i.__)("URL and HTTP header","redirection")},{value:Y_,label:(0,i.__)("URL and custom filter","redirection")},{value:nv,label:(0,i.__)("URL and WordPress page type","redirection")},{value:rv,label:(0,i.__)("URL and language","redirection")}],lv=()=>[{value:$_,label:(0,i.__)("Redirect to URL","redirection")},{value:q_,label:(0,i.__)("Redirect to random post","redirection")},{value:H_,label:(0,i.__)("Pass-through","redirection")},{value:B_,label:(0,i.__)("Error (404)","redirection")},{value:W_,label:(0,i.__)("Do nothing (ignore)","redirection")}],cv=()=>[{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")}],uv=()=>[{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")}],dv=()=>cv().concat(uv()),pv=()=>[{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")}],hv=()=>[{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")}],fv=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")}],mv=e=>{const t=[{id:"delete",name:(0,i.__)("Delete","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}])},gv=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 yv(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:_v(e).map(e=>e.value)}]}function _v(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 vv="^/.*$";function bv(e){return{url:vv,match_type:tv,action_data:{ip:e},match_data:{source:{flag_regex:!0}}}}function xv(e,t){return"redirect-ip"===e||"ip"===e?{...bv(t),action_type:$_}:"block"===e?{...bv(t),action_type:B_,action_code:403}:"agent"===e?{url:vv,match_type:Q_,action_data:{agent:t},match_data:{source:{flag_regex:!0}}}:{url:t,match_type:Z_,action_type:"ignore"===e?W_:$_}}const wv=({title:e=null,children:t,className:n=""})=>(0,l.jsxs)("tr",{className:n,children:[(0,l.jsx)("th",{children:e}),(0,l.jsx)("td",{children:t})]}),jv=({flag_case:e,flag_regex:t,flag_trailing:n})=>[e?"flag_case":null,t?"flag_regex":null,n?"flag_trailing":null].filter(e=>null!==e),Sv=({url:e,flags:t,onFlagChange:n,onChange:r,autoFocus:o=!1})=>{const s=pv();return Array.isArray(e)?(0,l.jsx)(wv,{title:(0,i.__)("Source URL","redirection"),className:"top",children:(0,l.jsx)("textarea",{value:e.join("\n"),readOnly:!0})}):(0,l.jsxs)(wv,{title:(0,i.__)("Source URL","redirection"),className:"redirect-edit__source",children:[(0,l.jsx)("input",{type:"text",name:"url",value:e,onChange:r,autoFocus:o,className:"regular-text",placeholder:(0,i.__)("The relative URL you want to redirect from","redirection")}),(0,l.jsx)(Fu,{options:s,selected:jv(t),onChange:function(e){const t=Array.isArray(e)?e:[e];n({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})]})},kv=({query:e,regex:t,onChange:n,url:r})=>{if(t)return null;const o=!1===(Array.isArray(r)?r.join(""):r).includes("?")?hv().filter(e=>"exactorder"!==e.value):hv();return(0,l.jsx)(wv,{title:(0,i.__)("Query Parameters","redirection"),className:"redirect-edit__sourcequery",children:(0,l.jsx)(cr,{name:"flag_query",items:o,value:e,onChange:n})})},Cv=({groups:e,currentGroup:t,onChange:n})=>(0,l.jsx)(cr,{name:"group",value:String(t),items:sl(e),onChange:n}),Tv=({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})]}),Ev=function({title:e,onChange:t}){return(0,l.jsx)(wv,{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")})})},Pv=({actionType:e,actionCode:t,onChange:n})=>{const r=function(e){return e===B_?uv():e===$_||e===q_?cv():null}(e);return r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("strong",{className:"small-flex",children:(0,i.__)("with HTTP code","redirection")}),(0,l.jsx)(cr,{name:"action_code",value:String(t),items:r,onChange:n})]}):null},Rv=({actionType:e,matchType:t,onChange:n})=>(0,l.jsx)(cr,{name:"action_type",value:e,items:lv().filter(e=>!(t===G_&&!iv(e.value))),onChange:n}),Ov=({matchType:e,onChange:t})=>(0,l.jsx)(wv,{title:(0,i.__)("Match","redirection"),children:(0,l.jsx)(cr,{name:"match_type",value:e,items:av(),onChange:t})}),Nv=function({onChange:e,data:t}){const[n,r]=(0,o.useState)(""),{agent:s,regex:a}=t;return(0,l.jsxs)(wv,{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]}}),r("")},value:n,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)(O,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Av=({data:e,onChange:t})=>{const{referrer:n,regex:r}=e;return(0,l.jsxs)(wv,{title:(0,i.__)("Referrer","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",className:"regular-text",name:"referrer",value:n,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:r,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)(O,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Fv=function({onChange:e,data:t}){const[n,r]=(0,o.useState)(""),{name:s,value:a,regex:c}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(wv,{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]}}),r("")},value:n,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)(O,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]}),(0,l.jsx)(wv,{children:(0,i.__)("Note it is your responsibility to pass HTTP headers to PHP. Please contact your hosting provider for support about this.","redirection")})]})},Iv=({data:e,onChange:t})=>{const{filter:n}=e;return(0,l.jsx)(wv,{title:(0,i.__)("Filter Name","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",name:"filter",value:n,onChange:t,className:"regular-text",placeholder:(0,i.__)("WordPress filter name","redirection")})})},zv=({data:e,onChange:t})=>{const{name:n,value:r,regex:o}=e;return(0,l.jsxs)(wv,{title:(0,i.__)("Cookie","redirection"),className:"redirect-edit__match",children:[(0,l.jsx)("input",{type:"text",name:"name",value:n,onChange:t,className:"regular-text",placeholder:(0,i.__)("Cookie name","redirection")}),(0,l.jsx)("input",{type:"text",name:"value",value:r,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)(O,{url:"https://redirection.me/support/redirect-regular-expressions/",children:"?"})})]})]})},Dv=({data:e,onChange:t})=>{const{role:n}=e;return(0,l.jsx)(wv,{title:(0,i.__)("Role","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",value:n,name:"role",placeholder:(0,i.__)("Enter role or capability value","redirection"),onChange:t})})},Lv=({data:e,onChange:t})=>{const{server:n}=e;return(0,l.jsx)(wv,{title:(0,i.__)("Server","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"server",value:n,placeholder:(0,i.__)("Enter server URL to match against","redirection"),onChange:t})})},Mv=({data:e,onChange:t})=>{const{ip:n=[]}=e;return(0,l.jsx)(wv,{title:(0,i.__)("IP","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("textarea",{value:n.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")}})}})})},Uv=()=>(0,l.jsx)(wv,{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")]})}),$v=({data:e,onChange:t})=>{const{language:n}=e;return(0,l.jsx)(wv,{title:(0,i.__)("Language","redirection"),className:"redirect-edit__match",children:(0,l.jsx)("input",{type:"text",className:"regular-text",name:"language",value:n,onChange:t,placeholder:(0,i.__)("Comma separated list of languages to match against (i.e. da, en-GB)","redirection")})})},Bv=({matchType:e,actionData:t,onChange:n})=>{const r={[V_]:Av,[Q_]:Nv,[K_]:zv,[J_]:Fv,[Y_]:Iv,[X_]:Dv,[ev]:Lv,[tv]:Mv,[nv]:Uv,[rv]:$v};if(r[e]){const i=r[e];return(0,l.jsx)(i,{data:null===t?{}:t,onChange:n})}return null},qv=({onChange:e,data:t})=>{const{logged_in:n,logged_out:r}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(wv,{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:n,onChange:e,placeholder:(0,i.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,l.jsx)(wv,{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:r,onChange:e,placeholder:(0,i.__)("Target URL when not matched (empty to ignore)","redirection")})})]})};const Hv=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"})})]})},Wv=function({options:e,value:t,onSelect:n,onClose:r}){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(),n(t),r()}(t,e),onKeyDown:t=>function(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n(t),r())}(t,e),children:(0,l.jsx)(z_(),{searchWords:[t],textToHighlight:e.title,autoEscape:!0})})},i))})},Zv=function(e){const{placeholder:t="",onChange:n,value:r,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:y=!1,onlyChoices:_=!1}=e,[v,b]=(0,o.useState)(!1),[x,w]=(0,o.useState)([]),[j,S]=(0,o.useState)(Array.isArray(r)?"":r),k=(0,o.useRef)(null),C={"wpl-dropdowntext__suggestion__hide":u>0&&Array.isArray(r)&&r.length>=u,"wpl-dropdowntext__suggestion":u>1},T=function(e,t,n,r){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 y="undefined"!=typeof window,_=!t&&0!==t&&y;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,x=!!n.flushOnExit&&b,w="maxWait"in n,j="debounceOnServer"in n&&!!n.debounceOnServer,S=w?Math.max(+n.maxWait||0,t):null,k=(0,o.useMemo)(function(){var e=function(e){var t=u.current,n=d.current;return u.current=d.current=null,a.current=e,l.current=l.current||e,p.current=h.current.apply(n,t)},n=function(e,t){_&&cancelAnimationFrame(c.current),c.current=_?requestAnimationFrame(e):setTimeout(e,t)},o=function(e){if(!f.current)return!1;var n=e-s.current;return!s.current||n>=t||n<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 r=Date.now();if(v&&l.current===a.current&&T(),o(r))return k(r);if(f.current){var i=t-(r-s.current),c=w?Math.min(i,S-(r-a.current)):i;n(e,c)}},T=function(){r&&r({})},E=function(){if(y||j){var r,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==(r=globalThis.document)||null==r.addEventListener||r.addEventListener("visibilitychange",m.current)),h){if(!c.current&&f.current)return a.current=s.current,n(C,t),v?e(s.current):p.current;if(w)return n(C,t),e(s.current)}return c.current||n(C,t),p.current}};return E.cancel=function(){var e=c.current;e&&(_?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,u.current=s.current=d.current=c.current=null,e&&r&&r({})},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,r]);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 P(e){if(m)return O(e).map(t=>m(t,e))}function R(e){if(u>0){if(!O(r).find(t=>t===`${e.value}`)){const t=[`${e.value}`].concat(O(r).filter(t=>t!==`${e.value}`)).slice(0,u);n(1!==u||_?t:t[0],[e.title].concat(P(t)?.slice(1)||[])),g(e.value,e.title)}S("")}else S(e.value),n(e.value,P(r));w([])}function O(e){return Array.isArray(e)?e:e?[e]:[]}return(0,o.useEffect)(()=>{r!==j&&S(Array.isArray(r)?"":r)},[r,j]),(0,l.jsxs)("div",{className:h("wpl-dropdowntext",c,C),children:[u>0&&O(r).map(e=>(0,l.jsx)(Eu,{title:e,onCancel:()=>function(e){const t=O(r).filter(t=>t!==e);g(e,null),Array.isArray(r)?n(1===u?t[0]:t,P(t)):n(""),k.current?.focus()}(e),disabled:a,children:m?m(e,r):e},e)),(0,l.jsx)("input",{type:"text",className:h("regular-text",{"wpl-dropdowntext__max":u>=0&&O(r).length>=u}),name:s,value:j,disabled:a,onChange:function(e){S(e.target.value),u<1&&n(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(r),r.length>0);y&&!e&&E("")},onBlur:function(e){if(e.relatedTarget&&e.relatedTarget.closest(".wpl-dropdowntext__suggestions"))return;const t=`${(f?f(j):j)??""}`;0===x.length?_?S(""):u>0&&i?R({value:t,label:t,title:t}):n(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)(Hv,{})}),x.length>0&&k.current&&(0,l.jsx)(ju,{align:"left",onClose:()=>w([]),popoverPosition:wu(k.current),className:"wpl-dropdowntext__suggestions",focusLock:!1,children:(0,l.jsx)(Wv,{options:x,value:j,onSelect:R,onClose:()=>w([])})})]})},Gv=function(e){const{onChange:t,url:n}=e;return(0,l.jsx)(Zv,{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(Ft(e))},value:Array.isArray(n)?n.join(""):n||""})},Vv=({onChange:e,data:t})=>{const{url:n}=t;return(0,l.jsx)(wv,{title:(0,i.__)("Target URL","redirection"),className:"redirect-edit__target",children:(0,l.jsx)(Gv,{...void 0!==n?{url:n}:{},onChange:t=>e({target:{name:"url",value:t,type:"input"}})})})},Qv=({onChange:e,data:t})=>{const{url_from:n,url_notfrom:r}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(wv,{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:n,onChange:e,placeholder:(0,i.__)("Target URL when matched (empty to ignore)","redirection")})}),(0,l.jsx)(wv,{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:r,onChange:e,placeholder:(0,i.__)("Target URL when not matched (empty to ignore)","redirection")})})]})},Kv=({actionType:e,matchType:t,actionData:n,onChange:r})=>{if(iv(e)){const e=(i=t)===G_?qv:i===Z_||i===nv?Vv:Qv,o=ov(t,n);return(0,l.jsx)(e,{data:null===o?{}:o,onChange:r})}var i;return null},Jv=(e,t)=>t.startsWith(e)||e.slice(0,t.length)===t,Yv=e=>{const{url:t,flag_regex:n,action_data:r={}}=e;if(null===r||!t||!e||"string"!=typeof t)return[];const o=[],{url:s="",logged_in:a="",logged_out:c="",url_from:u="",url_notfrom:d=""}=r;if(Array.isArray(t)||0===t.length||void 0===t)return o;if(t.includes("#")&&o.push((0,l.jsx)(O,{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)(O,{url:"https://redirection.me/support/matching-redirects/#server",children:D((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===n&&!t.includes("[source]")&&o.push(D((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!==n||o.push((0,l.jsx)(O,{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)(O,{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("$")||!n||o.push(
// translators: %(example)s is an example regular expression
D((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",{})})),n&&t.includes("^")&&t.indexOf("^")>0&&o.push(
// translators: %(example)s is an example regular expression with corrected caret position
D((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",{})})),n&&t.match(/[a-zA-Z0-9\/]\?/)&&o.push(D((0,i.__)("To match {{code}}?{{/code}} you need to escape it with {{code}}\\?{{/code}}","redirection"),{code:(0,l.jsx)("code",{})})),n&&t.match(/[a-zA-Z0-9 ]\*/)&&o.push(D((0,i.__)("Wildcards are not supported. You need to use a {{link}}regular expression{{/link}}.","redirection"),{link:(0,l.jsx)(O,{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=[r.url,r.url_from,r.url_notfrom,r.logged_in,r.logged_out].filter(e=>e);return!s||Jv(s,"https://")||Jv(s,"http://")||"/"===s.slice(0,1)||o.push(
// translators: %(url)s is the user's target URL
D((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:r.url}),{code:(0,l.jsx)("code",{})})),!1===n&&h.forEach(e=>{const t=e.match(/[|\\\$]/g);null!==t&&o.push(
// translators: %(invalid)s is an invalid character in the URL
D((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
D((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)(O,{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},Xv=({warnings:e})=>0===e.length?null:(0,l.jsx)(wv,{children:(0,l.jsx)("div",{className:"redirect-edit_warning notice notice-warning",children:e.map((e,t)=>(0,l.jsxs)("p",{children:[(0,l.jsx)("span",{className:"dashicons dashicons-info"}),e]},t))})});function eb(e){const t=u(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=Gn(),{setRedirectsTable:s}=Ty();return mt({mutationFn:async({items:e,params:i={}})=>{n();try{return await t.cancelQueries({queryKey:Wn.redirects.lists()}),await St(Qt("delete",{items:e},i))}catch(e){throw r(),Hn(e)}},onSuccess:(e,n)=>{r(),i("Redirects deleted"),s(Ju(n.params)),t.invalidateQueries({queryKey:Wn.redirects.lists()})},onError:e=>{o(e.message||"Failed to delete redirects")},...e})}function tb(e,t){const n=u(),{incrementProgress:r,decrementProgress:i,addNotice:o,addError:s}=Gn(),{setRedirectsSelected:a}=Ty();return mt({mutationFn:async({items:t})=>{r();try{return await n.cancelQueries({queryKey:Wn.redirects.lists()}),await St(Qt(e,{items:t},{}))}catch(e){throw i(),Hn(e)}},onSuccess:()=>{i(),o(`Redirects ${e}d`),a([]),n.invalidateQueries({queryKey:Wn.redirects.lists()})},onError:t=>{s(t.message||`Failed to ${e} redirects`)},...t})}const nb=function(e){const{item:t,onCancel:n,saveButton:r=(0,i.__)("Save","redirection"),childSave:s,callback:a,canSave:c,autoFocus:d,children:p}=e,{data:h,isSuccess:f}=td({}),m=(0,o.useMemo)(()=>h?.items??[],[h]),g=Ty(e=>e.redirectsAddTop),y=Ty(e=>e.redirects),{setRedirectsAddTop:_}=Ty(),v=de(e=>e.values),b=Gn(e=>e.addError),x=v?.auto_target||"",w=(0,o.useMemo)(()=>v?{flag_case:v.flag_case,flag_trailing:v.flag_trailing,flag_regex:v.flag_regex,flag_query:v.flag_query}:{},[v]),{mutate:j}=function(){const e=u(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=Gn();return mt({mutationFn:async r=>{t();try{await e.cancelQueries({queryKey:Wn.redirects.lists()});const{id:t,...n}=r,i=await St(Nt(t,n));return Vu.parse(i).item}catch(e){throw n(),Hn(e)}},onSuccess:t=>{n(),r("Redirect saved"),e.invalidateQueries({queryKey:Wn.redirects.lists()}),e.invalidateQueries({queryKey:Wn.redirects.detail(t.id)})},onError:e=>{i(e.message||"Failed to update redirect")}})}(),{mutate:S}=function(){const e=u(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=Gn();return mt({mutationFn:async r=>{t();try{await e.cancelQueries({queryKey:Wn.redirects.lists()});const t=await St(At(r));return Gu.parse(t).items[0]??null}catch(e){throw n(),Hn(e)}},onSuccess:()=>{n(),r("Redirect created"),e.invalidateQueries({queryKey:Wn.redirects.lists()})},onError:e=>{i(e.message||"Failed to create redirect")}})}(),k=(0,o.useRef)(null),C=(0,o.useCallback)(e=>{if(((e,t)=>e.find(e=>e.id===t))(m,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(m&&m.length>0){const e=m.find(e=>e.default);return e?e.id:m[0].id}return 0},[m,y.filterBy]),T=m.length>0,E=f&&!T,{url:P,match_data:R,match_type:O,action_type:N,action_data:A,group_id:F=0,title:I,action_code:z,position:D=0}=t,{flag_regex:L=!1,flag_trailing:M=!1,flag_case:U=!1,flag_query:$="exact"}=R?.source??{},B={url:P,title:I,flag_regex:L,flag_trailing:M,flag_case:U,flag_query:$,match_type:O,action_type:N,action_code:z,action_data:ov(O,A),options:R?.options??{},group_id:C(F),position:D,warning:[],advanced:!1},[q,H]=(0,o.useState)(B),W=(0,o.useCallback)(()=>{const{match_type:e,action_type:t,title:n,action_code:r}=q;return e===Z_&&t===$_&&""===n&&301===r},[q]);(0,o.useEffect)(()=>{H(e=>({...e,advanced:!W()}))},[]),(0,o.useEffect)(()=>{H(e=>({...e,warning:Yv(e)}))},[q.url,q.action_type,q.match_type,q.action_data]),(0,o.useEffect)(()=>{a&&k.current&&a(k.current.clientHeight)},[q,a]);const Z=(0,o.useCallback)(()=>{const e=sv("",q.group_id,w);H(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:[]}))},[q.group_id,w]),G=(0,o.useCallback)(e=>{e.preventDefault();const{url:r,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:g,position:y,action_data:_,options:v}=q,x=f>0?f:m[0]?.id;if(void 0===x)return void b((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:r,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!==y?{position:y}:{},...void 0!==x?{group_id:x}:{},action_code:"number"==typeof g?g:parseInt(String(g),10),action_data:ov(p,_)};c&&!c(Array.isArray(r))||(w.id?j({id:w.id,...w}):S(w),n?n(e):Z(),s&&s())},[q,m,t.id,c,j,S,n,Z,s,b]),V=(0,o.useCallback)(e=>{H(t=>({...t,...e,warning:Yv({...t,...e})}))},[]),Q=(0,o.useCallback)(e=>{e.preventDefault(),V({advanced:!q.advanced})},[q.advanced,V]),K=(0,o.useCallback)(e=>{H(t=>({...t,group_id:parseInt(e.target.value,10)}))},[]),J=(0,o.useCallback)(e=>{const t={};Object.keys(w).filter(e=>"flag_query"!==e).forEach(e=>{t[e]=!1}),V({...t,...e})},[w,V]),Y=(0,o.useCallback)(e=>{const{target:t}=e,n="checkbox"===t.type?t.checked:t.value;return{[t.name]:n}},[]),X=(0,o.useCallback)(e=>{const t=Y(e);t.action_data=ov(t.match_type,q.action_data),t.match_type===G_&&(t.action_type=$_),V(t)},[q.action_data,Y,V]),ee=(0,o.useCallback)(e=>{V(Y(e))},[Y,V]),te=(0,o.useCallback)(e=>{H(t=>({...t,options:{...t.options,[e.target.name]:e.target.checked??e.target.value}}))},[]),ne=(0,o.useCallback)(e=>{const t=Y(e).action_type;var n;V({action_type:t,action_code:(n=t,n===B_?404:n===H_?200:301),action_data:ov(q.match_type,q.action_data||{})})},[q.match_type,q.action_data,Y,V]),re=(0,o.useCallback)(e=>{const t={action_data:{...q.action_data,...Y(e)}};V(t)},[q.action_data,Y,V]),ie=(0,o.useCallback)(()=>{const{match_type:e,action_type:t,action_data:n,url:r,group_id:i}=q;return!(!T&&i<=0||0===r.length&&!x||iv(t)&&(o=e,(!(s=n)||o!==Z_&&o!==nv&&!(o===G_?s.logged_in||s.logged_out:o===V_?s.referrer:o===Q_?s.agent:o===K_||o===J_?s.name&&s.value:o===Y_?s.filter:o===X_?s.role:o===ev?s.server:o===tv?s.ip:o===rv&&s.language))&&""===x));var o,s},[q,x,T]),{url:oe,advanced:se,flag_regex:ae,action_type:le,match_type:ce,action_data:ue,flag_query:pe,group_id:he,position:fe,title:me,action_code:ge,options:ye,warning:_e}=q,ve=E?[(0,i.__)("No groups are available. Reload the page before creating a redirect.","redirection"),..._e]:_e;return(0,l.jsx)("form",{onSubmit:G,ref:k,children:(0,l.jsx)("table",{className:"redirect-edit inline-edit-row",children:(0,l.jsxs)("tbody",{children:[(0,l.jsx)(Sv,{url:oe,flags:q,defaultFlags:w,autoFocus:d??!1,onFlagChange:J,onChange:ee}),(0,l.jsx)(kv,{query:pe,regex:ae,onChange:ee,url:oe}),se&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ev,{title:me,onChange:e=>V(e)}),(0,l.jsx)(Ov,{matchType:ce,onChange:X}),(0,l.jsx)(Bv,{matchType:ce,actionData:ue,onChange:re}),(0,l.jsxs)(wv,{title:(0,i.__)("When matched","redirection"),className:"redirect-edit__action",children:[(0,l.jsx)(Rv,{actionType:le,matchType:ce,onChange:ne}),(0,l.jsx)(Pv,{actionType:le,actionCode:ge,onChange:ee}),se&&["url","random"].includes(le)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{id:"redirect-log-exclude",type:"checkbox",name:"log_exclude",checked:Boolean(ye.log_exclude),onChange:te}),(0,l.jsx)("label",{htmlFor:"redirect-log-exclude",children:(0,i.__)("Exclude from logs","redirection")})]}):null]})]}),(0,l.jsx)(Kv,{actionType:le,matchType:ce,actionData:ue,onChange:re}),(0,l.jsxs)(wv,{title:(0,i.__)("Group","redirection"),className:"redirect-edit__group",children:[(0,l.jsx)(Cv,{groups:m,currentGroup:he,onChange:K}),se&&(0,l.jsx)(Tv,{position:fe,onChange:ee})]}),p&&p,(0,l.jsx)(wv,{children:(0,l.jsxs)("div",{className:"table-actions",children:[(0,l.jsx)(Ol,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:!ie(),children:r})," "," ",n&&(0,l.jsx)(Ol,{onClick:n,children:(0,i.__)("Cancel","redirection")}),g&&!n&&(0,l.jsx)(Ol,{onClick:e=>{e.preventDefault(),_(!1)},children:(0,i.__)("Close","redirection")})," ",W()&&(0,l.jsx)("button",{type:"button",onClick:Q,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)(Xv,{warnings:ve})]})})})};const rb=function(e){const{onClose:t,redirect:n,rows:r}=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}=Ay(),u=function(e,t){return e?Array.isArray(e)?[...new Set(e.map(e=>function(e,t){const n=t.find(t=>t.id===e||t.id===parseInt(e,10));return n?n.url:e}(e,t)))]:e:""}(n.url,r),[d,p]=(0,o.useState)(!1),h={...sv(Array.isArray(u)?u[0]??"":u,0,a),...n,url:u};return(0,l.jsx)(cd,{onClose:t,padding:!0,children:(0,l.jsx)("div",{className:"add-new",children:(0,l.jsx)(nb,{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:h_(v_)&&(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")})]})]})})})})},ib=function(e){const{row:t,onDelete:n,onCreate:r,table:o,disabled:s}=e,{setErrorsTable:a}=Ty(),{url:c,ip:u,agent:d,id:p}=t,{groupBy:h}=o,f=[];return f.push((0,l.jsx)(x_,{onClick:()=>n(p),capability:v_,children:(0,i.__)("Delete","redirection")},"0")),f.push((0,l.jsx)(x_,{onClick:()=>r(xv(h,"ip"===h?[p]:""===h?c:p)),capability:g_,children:(0,i.__)("Add Redirect","redirection")},"1")),d&&f.unshift((0,l.jsx)(E_,{agent:d},"3")),f.push((0,l.jsx)(x_,{onClick:()=>{return e=Yu(h,""===h?t.url:String(t.id)),void a({filterBy:e,page:0,groupBy:"",selected:[],selectAll:!1});var e},capability:m_,children:(0,i.__)("Show All","redirection")},"4")),"ip"===h?f.push((0,l.jsx)(x_,{onClick:()=>r(xv("block",[u])),capability:g_,children:(0,i.__)("Block IP","redirection")},"5")):"agent"!==h&&f.push((0,l.jsx)(x_,{onClick:()=>r(xv("ignore",c)),capability:g_,children:(0,i.__)("Ignore URL","redirection")},"6")),(0,l.jsx)(b_,{disabled:s,actions:f})};function ob(e){return e.url?il(ol(e.domain),e.url):""}function sb(e){return e.includes("url")?e:e.concat(["url"])}const ab=function(){const e=Ty(e=>e.errors),{setErrorsTable:t,setErrorsSelected:n}=Ty(),r=de(e=>e.values),[s,a]=(0,o.useState)(null);Fy({table:e,setTable:t,allowedGroup:["url","ip","agent"],allowedFilters:["url","url-exact","referrer","agent","ip","domain","method"],pageName:"404s"});const c=Ay(),{data:u,isFetching:d}=function(e={},t){const n=ed(e);return pt({queryKey:Wn.errors.list(n),queryFn:async()=>{try{const e=await St(Mt(n));return Ny.parse(e)}catch(e){const t=Hn(e);throw Gn.getState().addError(t.message||"Failed to fetch 404 errors"),t}},...t})}(e),p=u?.items??[],h=u?.total??0;let f=Iy;function m(e){n([]),a(e)}function g(t){if(!window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection")))return;const n=e.groupBy?{groupBy:e.groupBy}:{};c.mutate({action:"delete",items:[t],params:n})}d?f=zy:u&&(f=Dy);const y=e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},_={...e,...(v=e.groupBy,v?{displayOptions:_v(v),displaySelected:yv(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:_.displaySelected??[],groupBy:e.groupBy??""},x={displayFilters:_v(_.groupBy),displayGroups:yv(_.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:gv(r?.ip_logging||0),bulk:mv(_.groupBy),rowFilters:_.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:dv().filter(e=>parseInt(e.value,10)>=400&&parseInt(e.value,10)<500)}],headers:fv(_.groupBy).filter(e=>function(e,t){return t.displaySelected.includes(e)}(e.name,_)),validateDisplay:sb},w={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:function(t){if(0===e.selected.length&&!e.selectAll)return;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 n=e.groupBy?{groupBy:e.groupBy}:{};"delete"===t?e.selectAll?c.mutate({action:"delete",items:[],params:ed({...n,global:!0,filterBy:e.filterBy})}):c.mutate({action:"delete",items:e.selected,params:n}):a(xv(t,e.selected))},onGroup:e=>{t({groupBy:e,selected:[],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:"date"===e?"":e,direction:n})},onFilter:y,onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSelect:r=>{if("boolean"==typeof r)n(r?p.map(e=>e.id):[]);else if("number"==typeof r||"string"==typeof r){const n=Array.isArray(e.selected)?e.selected:[],i=n.includes(r)?n.filter(e=>e!==r):[...n,r];t({selected:i,selectAll:!1})}else n(r)},onSetAll:e=>{t({selected:e?p.map(e=>e.id):[],selectAll:e})}};return(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(rb,{onClose:()=>a(null),redirect:s,rows:p}),(0,l.jsx)(p_,{logOptions:x,logActions:w,table:b,status:f,total:h,rows:p,saving:[],getRow:(e,t)=>function(e,t){const{created:n,created_time:r,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:n?(0,l.jsxs)(l.Fragment,{children:[n,r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("br",{}),r]})]}):""},{name:"method",content:d?d.toUpperCase():""},{name:"domain",content:u??""},{name:"url",content:o?(0,l.jsx)(O,{url:ob(e),children:(0,l.jsx)(z_(),{searchWords:[m],textToHighlight:o,autoEscape:!0})}):""},{name:"code",content:p??""},{name:"referrer",content:a?(0,l.jsx)(z_(),{searchWords:[f.referrer||""],textToHighlight:a,autoEscape:!0}):""},{name:"agent",content:s?(0,l.jsx)(z_(),{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)(z_(),{searchWords:[f.ip||""],textToHighlight:c,autoEscape:!0})}),""===t?.table?.groupBy&&t?.onFilter&&(0,l.jsx)(b_,{actions:[(0,l.jsx)(x_,{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)(ib,{disabled:!1,row:e,onCreate:m,onDelete:g,table:t.table}),renderTableActions:()=>h_(v_)&&function(e){const{filterBy:t,groupBy:n}=e;return void 0!==t.url||!n&&0===Object.keys(t).length}(_)?(0,l.jsx)(F_,{enabled:p.length>0,children:null}):(0,l.jsx)(l.Fragment,{})})]})},lb="redirect",cb=({logType:e,title:t})=>{const n=function(e){return e===lb?"log":"404"===e?"404s":e}(e);return(0,l.jsxs)("form",{method:"post",action:Redirectioni10n.pluginRoot+"&sub="+n,children:[(0,l.jsx)("input",{type:"hidden",name:"_wpnonce",value:St.nonceMiddleware?.nonce}),(0,l.jsx)("input",{type:"hidden",name:"export-csv",value:""}),(0,l.jsx)("input",{className:"button",type:"submit",name:"",value:t})]})},ub=function(e){const{plugin:t,doImport:n}=e,{name:r,total:o}=t;return(0,l.jsxs)("div",{className:"plugin-importer",children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:r})," (",/* translators: %d is the number of redirects that can be imported */ /* translators: %d is the number of redirects that can be imported */
(0,i.sprintf)((0,i.__)("total = %d","redirection"),o),")"]}),(0,l.jsx)("button",{type:"button",onClick:()=>{n(t)},className:"button-secondary",children:(0,i.sprintf)(
// translators: %s is the plugin name
// translators: %s is the plugin name
(0,i.__)("Import from %s","redirection"),r)})]})},db=function(){const[e,t]=(0,o.useState)(0),[n,r]=(0,o.useState)(!1),[s,a]=(0,o.useState)("all"),[c,d]=(0,o.useState)("json"),[p,f]=(0,o.useState)(!1),[m,g]=(0,o.useState)(!1),[y,_]=(0,o.useState)(!1),v=(0,o.useRef)(null),{data:b}=td({}),x=b?.items??[],{data:w=[]}=Vn(),j=function(e){const t=u(),{addNotice:n,addError:r,incrementProgress:i,decrementProgress:o}=Gn();return mt({mutationFn:async({file:e,groupId:t})=>{i();try{return await St(Ut(String(t),e))}catch(e){throw o(),Hn(e)}},onSuccess:e=>{o(),n(`Imported ${e?.imported||0} redirects`),t.invalidateQueries({queryKey:Wn.redirects.lists()})},onError:e=>{r(e.message||"Import failed")},...e})}({onSuccess:e=>{g(e?.imported||0),f(!1)}}),S=Qn(),k=function(e){const{addError:t,incrementProgress:n,decrementProgress:r}=Gn();return mt({mutationFn:async({moduleId:e,format:t})=>{n();try{return(await St(qt(e,t))).data}catch(e){throw r(),Hn(e)}},onSuccess:()=>{r()},onError:e=>{t(e.message||"Export failed")},...e})}({onSuccess:e=>{_(e)}});let C="idle";k.isPending?C="loading":k.isSuccess&&(C="success");let T="idle";j.isPending||S.isPending?T="loading":(j.isSuccess||S.isSuccess)&&(T="success"),(0,o.useEffect)(()=>()=>{f(!1),g(!1),_(!1)},[]);const E=e=>{e.preventDefault(),e.stopPropagation(),"loading"!==T&&r(!0)},P=e=>{e.preventDefault(),e.stopPropagation(),r(!1)},R=e=>{e.preventDefault(),e.stopPropagation()},O=e=>{if(e.preventDefault(),e.stopPropagation(),r(!1),"loading"===T)return;const n=e.dataTransfer.files;n.length>0&&(f(n[0]||!1),x.length>0&&x[0]&&t(x[0].id))},N=e=>{const n=e.target.files;n&&n.length>0&&(f(n[0]||!1),x[0]&&t(x[0].id))},A=()=>{v.current?.click()},F=()=>{p&&j.mutate({file:p,groupId:e})},I=()=>{r(!1),f(!1),g(!1),_(!1),v.current&&(v.current.value="")},z=e=>{const{target:n}=e,{name:r,value:i}=n;"group"===r?t(parseInt(i,10)):"module"===r?(a(i),"everything"===i&&d("json")):"format"===r&&d(i)},L=e=>{confirm((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"),e.name))&&S.mutate(e.id)};return(0,l.jsxs)("div",{className:"import",children:[(0,l.jsx)("h2",{children:(0,i.__)("Import","redirection")}),(()=>{const t=h({dropzone:!0,"dropzone-dropped":!1!==p,"dropzone-importing":"loading"===T,"dropzone-hover":n});let r;return r="loading"===T?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Importing","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:p&&p.name})}),(0,l.jsx)("div",{className:"is-placeholder",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})})]}):"success"===T&&!1!==m&&!1===p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Finished importing","redirection")}),(0,l.jsxs)("p",{children:[(0,i.__)("Total redirects imported:","redirection")," ",m]}),0===m&&(0,l.jsx)("p",{children:(0,i.__)("Double-check the file is the correct format!","redirection")}),(0,l.jsx)("button",{className:"button-secondary",onClick:I,children:(0,i.__)("OK","redirection")})]}):!1===p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("Import a CSV, .htaccess, or JSON file.","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Click 'Add File' or drag and drop here.","redirection")}),(0,l.jsx)("button",{type:"button",className:"button-secondary",onClick:A,children:(0,i.__)("Add File","redirection")})]}):(()=>{const t=p&&"application/json"===p.type;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:(0,i.__)("File selected","redirection")}),(0,l.jsx)("p",{children:(0,l.jsx)("code",{children:p&&p.name})}),!t&&(0,l.jsxs)("div",{className:"groups",children:[(0,i.__)("Import to group","redirection")," ",(0,l.jsx)(cr,{items:sl(x),name:"group",value:String(e),onChange:z})]}),(0,l.jsx)("button",{className:"button-primary",onClick:F,children:(0,i.__)("Upload","redirection")})," "," ",(0,l.jsx)("button",{className:"button-secondary",onClick:I,children:(0,i.__)("Cancel","redirection")})]})})(),(0,l.jsxs)("div",{className:t,onDragEnter:E,onDragLeave:P,onDragOver:R,onDrop:O,children:[(0,l.jsx)("input",{ref:v,type:"file",style:{display:"none"},onChange:N,accept:".json,.csv,.htaccess"}),r]})})(),(0,l.jsx)("p",{children:(0,i.__)("All imports will be appended to the current database - nothing is merged.","redirection")}),(0,l.jsxs)("div",{className:"inline-notice notice-warning",children:[(0,l.jsx)("p",{children:D((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 does not include all information, and everything is imported/exported as "URL only" matches. Use the JSON format for a full set of data.',"redirection")})]}),(0,l.jsx)("h2",{children:(0,i.__)("Export","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("Export to CSV, Apache .htaccess, Nginx, or Redirection JSON. The JSON format contains full information, and other formats contain partial information appropriate to the format.","redirection")}),(0,l.jsxs)("p",{className:"redirect-export_buttons",children:[(0,l.jsxs)("select",{name:"module",onChange:z,value:s,children:[(0,l.jsx)("option",{value:"0",children:(0,i.__)("Everything","redirection")}),(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")})]}),(0,l.jsxs)("select",{name:"format",onChange:z,value:c,children:[(0,l.jsx)("option",{value:"json",children:(0,i.__)("Complete data (JSON)","redirection")}),(0,l.jsx)("option",{value:"csv",children:(0,i.__)("CSV","redirection")}),(0,l.jsx)("option",{value:"apache",children:(0,i.__)("Apache .htaccess","redirection")}),(0,l.jsx)("option",{value:"nginx",children:(0,i.__)("Nginx rewrite rules","redirection")})]}),(0,l.jsx)("button",{className:"button-primary",onClick:()=>{k.mutate({moduleId:s,format:c})},children:(0,i.__)("View","redirection")}),(0,l.jsx)("button",{className:"button-secondary",onClick:()=>{window.location.href=al(s,c)},children:(0,i.__)("Download","redirection")})]}),"loading"===C&&(0,l.jsx)("div",{className:"loader-wrapper loader-textarea",children:(0,l.jsx)("div",{className:"wpl-placeholder__loading"})}),y&&"loading"!==C&&(U=y,(0,l.jsxs)("div",{children:[(0,l.jsx)("textarea",{className:"module-export",rows:14,readOnly:!0,value:U}),(0,l.jsx)("input",{className:"button-secondary",type:"submit",value:(0,i.__)("Close","redirection"),onClick:I})]})),(0,l.jsx)("h2",{children:(0,i.__)("Export Logs","redirection")}),(0,l.jsx)(cb,{logType:lb,title:(0,i.__)("Export redirect","redirection")}),(0,l.jsx)("br",{}),(0,l.jsx)(cb,{logType:"404",title:(0,i.__)("Export 404","redirection")}),w.length>0&&(M=w,(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{children:(0,i.__)("Plugin Importers","redirection")}),(0,l.jsx)("p",{children:(0,i.__)("The following redirect plugins were detected on your site and can be imported from.","redirection")}),M.map((e,t)=>(0,l.jsx)(ub,{plugin:e,doImport:L},t))]}))]});var M,U},pb=()=>[{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")}],hb=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 fb(e){const t=u(),{incrementProgress:n,decrementProgress:r,addNotice:i,addError:o}=Gn(),{setGroupsTable:s}=Ty();return mt({mutationFn:async({action:e,items:i,params:o={}})=>{n();try{return await t.cancelQueries({queryKey:Wn.groups.lists()}),await St(Kt(e,{items:i},o))}catch(e){throw r(),Hn(e)}},onSuccess:(e,n)=>{r();let o=n.action;"enable"===n.action?o="enabled":"disable"===n.action&&(o="disabled"),i(`Groups ${o}`),s({page:0,selected:[],selectAll:!1}),t.invalidateQueries({queryKey:Wn.groups.lists()})},onError:e=>{o(e.message||"Failed to perform group action")},...e})}const mb=[{value:1,label:"WordPress"},{value:2,label:"Apache"},{value:3,label:"Nginx"}];function gb(){return mb}const yb=function(e){const{disabled:t}=e,[n,r]=(0,o.useState)(""),[s,a]=(0,o.useState)(1),{mutate:c}=function(){const e=u(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=Gn();return mt({mutationFn:async r=>{t();try{await e.cancelQueries({queryKey:Wn.groups.lists()});const t=await St(Dt(r));return Qu.parse(t).items[0]??null}catch(e){throw n(),Hn(e)}},onSuccess:()=>{n(),r("Group created"),e.invalidateQueries({queryKey:Wn.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:n,moduleId:s,position:0}),r("")},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:n,onChange:e=>r(e.target.value),disabled:t}),(0,l.jsx)(cr,{name:"group",value:String(s),onChange:e=>a(parseInt(e.target.value,10)),items:gb().map(e=>({label:e.label,value:String(e.value)})),disabled:t})," ",(0,l.jsx)("span",{className:"table-actions",children:(0,l.jsx)(Ol,{isPrimary:!0,isSecondary:!1,isSubmit:!0,disabled:t||""===n,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")})]})]})},_b=function(e){const{disabled:t,rowParams:n,row:r}=e,{mutate:o}=fb(),{setRowMode:s,rowMode:a}=n,{id:c,enabled:u}=r,d=[];return"edit"===a?null:(h_(y_)&&d.push((0,l.jsx)(x_,{onClick:()=>s("edit"!==a&&"edit"),children:(0,i.__)("Edit","redirection")},"0")),h_("redirection_cap_group_delete")&&d.push((0,l.jsx)(x_,{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")),h_(m_)&&d.push((0,l.jsx)(x_,{href:Redirectioni10n.pluginRoot+"&"+encodeURIComponent("filterby[group]")+"="+c,children:(0,i.__)("View Redirects","redirection")},"2")),h_(y_)&&(u?d.push((0,l.jsx)(x_,{onClick:()=>o({action:"disable",items:[c]}),children:(0,i.__)("Disable","redirection")},"3")):d.push((0,l.jsx)(x_,{onClick:()=>o({action:"enable",items:[c]}),children:(0,i.__)("Enable","redirection")},"3"))),(0,l.jsx)(b_,{disabled:t,actions:d}))},vb=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:"×"})},bb=function({row:e,filters:t}){const{enabled:n,name:r}=e;return n?(0,l.jsx)(z_(),{searchWords:[t.name],textToHighlight:r,autoEscape:!0}):(0,l.jsx)("s",{children:r})},xb=function({row:e}){const{module_id:t}=e,n=function(e){const t=mb.find(t=>t.value===e);return t?t.label:"WordPress"}(t),{setGroupsTable:r}=Ty();return(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(Eu,{onClick:()=>r({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:n}),children:n})})},wb=function(e){const{group:t,onCancel:n}=e,[r,s]=(0,o.useState)(t.name),[a,c]=(0,o.useState)(t.module_id),{mutate:d}=function(){const e=u(),{incrementProgress:t,decrementProgress:n,addNotice:r,addError:i}=Gn();return mt({mutationFn:async r=>{t();try{await e.cancelQueries({queryKey:Wn.groups.lists()});const{id:t,...n}=r,i=await St(zt(t,n));return Ku.parse(i).item}catch(e){throw n(),Hn(e)}},onSuccess:t=>{n(),r("Group saved"),e.invalidateQueries({queryKey:Wn.groups.lists()}),e.invalidateQueries({queryKey:Wn.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(),n(),d({id:t.id,name:r,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:r,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)(cr,{name:"module_id",value:String(a),onChange:e=>c(parseInt(e.target.value,10)),items:gb().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)(Ol,{isPrimary:!0,isSecondary:!1,isSubmit:!0,children:(0,i.__)("Save","redirection")})," ",(0,l.jsx)(Ol,{onClick:n,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 jb(e){return e.includes("name")?e:e.concat(["name"])}const Sb=function(){const e=Ty(e=>e.groups),{setGroupsTable:t,setGroupsSelected:n}=Ty();Fy({table:e,setTable:t,allowedOrder:["name","id"],allowedFilters:["name","status","module"],defaultOrder:"name",pageName:"groups"});const r=fb(),{data:o,isLoading:s}=td(e),a=o?.items??[],c=o?.total??0,u=s?"loading":"complete",d={displayFilters:pb(),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:pb().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")}],rowFilters:hb(gb().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:jb},p={onChangePage:e=>{t({page:e,selected:[],selectAll:!1})},onBulk:t=>{if(0===e.selected.length&&!e.selectAll)return;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 n=e.selected;if(e.selectAll){const n={global:!0,filterBy:e.filterBy};r.mutate({action:t,items:[],params:n})}else r.mutate({action:t,items:n})},onSelect:r=>{const i=e.selected;"boolean"==typeof r?n(r?a.map(e=>e.id):[]):Array.isArray(r)?n(r):i.includes(r)?t({selected:i.filter(e=>e!==r),selectAll:!1}):t({selected:[...i,r],selectAll:!1})},onSetOrder:(e,n)=>{t({orderby:e,direction:n})},onFilter:e=>{t({filterBy:e,page:0,selected:[],selectAll:!1})},onSetDisplay:(e,n)=>{t({displayType:e,displaySelected:n})},onSetAll:e=>{t({selected:e?a.map(e=>e.id):[],selectAll:e})},onGroup:e=>{t({groupBy:e,page:0,selected:[],selectAll:!1})}},h={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)(p_,{logOptions:d,logActions:p,table:h,status:u,total:c,rows:a,saving:[],getRow:(e,t)=>function(e,t){const{redirects:n}=e,{rowMode:r,setRowMode:i}=t;return[{name:"status",content:(0,l.jsx)(vb,{row:e})},{name:"name",content:"edit"===r?(0,l.jsx)(wb,{group:e,onCancel:()=>i(!1)}):(0,l.jsx)(bb,{row:e,filters:t.table.filterBy})},{name:"redirects",content:new Intl.NumberFormat(window.Redirectioni10n.locale).format(n)},{name:"module",content:(0,l.jsx)(xb,{row:e})}]}(e,t),getRowActions:(e,t)=>(0,l.jsx)(_b,{disabled:!1,row:e,rowParams:t})}),h_(y_)&&(0,l.jsx)(yb,{disabled:!1})]})},kb=()=>[{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")}],Cb=function(e){const{addTop:t}=e,n=h({"add-new":!0,edit:!0,addTop:t});return(0,l.jsxs)(l.Fragment,{children:[!t&&h_(g_)&&(0,l.jsx)("h2",{children:(0,i.__)("Add new redirection","redirection")}),(0,l.jsx)("div",{className:n,children:(0,l.jsx)(nb,{item:sv("",0,e.defaultFlags),saveButton:(0,i.__)("Add Redirect","redirection"),autoFocus:!!t})})]})},Tb=function(e){const{disabled:t,rowParams:n,row:r}=e,{mutate:o}=eb(),{mutate:s}=tb("disable"),{mutate:a}=tb("enable"),{setRowMode:c,rowMode:u}=n,{id:d,enabled:p,regex:h,action_type:f,match_type:m}=r,g=[];return"edit"===u?null:(h_(g_)&&g.push((0,l.jsx)(x_,{onClick:()=>c("edit"),children:(0,i.__)("Edit","redirection")},"1")),h_("redirection_cap_redirect_delete")&&g.push((0,l.jsx)(x_,{onClick:()=>{window.confirm((0,i.__)("Are you sure you want to delete this item?","redirection"))&&o({items:[d]})},children:(0,i.__)("Delete","redirection")},"2")),h_(g_)&&(p?g.push((0,l.jsx)(x_,{onClick:()=>s({items:[d]}),children:(0,i.__)("Disable","redirection")},"3")):g.push((0,l.jsx)(x_,{onClick:()=>a({items:[d]}),children:(0,i.__)("Enable","redirection")},"4"))),!p||h||"url"!==f||"url"!==m&&"server"!==m||g.push((0,l.jsx)(x_,{onClick:()=>c("check"),children:(0,i.__)("Check Redirect","redirection")},"5")),(0,l.jsx)(b_,{disabled:t,actions:g}))},Eb=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:"×"})},Pb=(e,t)=>e.includes(t);function Rb(e,t,n){return n===ev?e.server+t:t}function Ob(e,t){const{match_type:n,regex:r,action_data:i,url:o}=e;return r?t:(0,l.jsx)(O,{url:Rb(i,o,n),children:t})}function Nb(e,t){return t?e:(0,l.jsx)("s",{children:e})}const Ab=function(e){const{displaySelected:t,row:n,filters:r}=e,{match_type:i,url:o,title:s,action_data:a,enabled:c}=n,u=(0,l.jsx)(z_(),{searchWords:[r.url||""],textToHighlight:Rb(a,o,i),autoEscape:!0}),d=(0,l.jsx)(z_(),{searchWords:[r.title||""],textToHighlight:s,autoEscape:!0});return Pb(t,"title")&&!Pb(t,"source")?(0,l.jsx)("p",{children:Ob(n,Nb(s?d:u,c))}):(0,l.jsxs)(l.Fragment,{children:[Pb(t,"title")&&s&&(0,l.jsx)("p",{children:Ob(n,Nb(d,c))}),Pb(t,"source")&&u&&(0,l.jsx)("p",{children:Ob(n,Nb(u,c))})]})},Fb=function(e){const{row:t,filters:n}=e,{match_type:r,action_data:i}=t;return r===Z_&&i?(0,l.jsx)("span",{className:"target",children:(0,l.jsx)(z_(),{searchWords:[n.target??""],textToHighlight:i.url??"",autoEscape:!0})}):null},Ib=function({name:e,className:t,strikethrough:n}){return(0,l.jsx)(Eu,{className:h("redirect-source__flag",t),children:n?(0,l.jsx)("s",{children:e}):e})},zb=function(e){const{row:t,defaultFlags:n}=e,{match_data:{source:r}}=t;return(0,l.jsx)(l.Fragment,{children:Object.keys(r).filter(e=>n[e]!==r[e]&&"flag_query"!==e).map(e=>{const t=pv().find(t=>t.value===e);return(0,l.jsx)(Ib,{name:t?.label||"",className:"redirect-source__"+e,strikethrough:!!n[e]&&!r[e]},e)})})},Db=function(e){const{defaultFlags:t,row:n}=e,{match_data:{source:r}}=n;if(t.flag_query!==r.flag_query){let e;return e="ignore"===r.flag_query?(0,i.__)("Ignore Query","redirection"):"pass"===r.flag_query?(0,i.__)("Ignore & Pass Query","redirection"):(0,i.__)("Exact Query","redirection"),(0,l.jsx)(Ib,{name:e})}return null},Lb=function(e){const{row:t,table:n,defaultFlags:r}=e,{displaySelected:i}=n;return(0,l.jsxs)("div",{className:"redirect-column-wrap",children:[(0,l.jsxs)("div",{className:"redirect-source__details",children:[(0,l.jsx)(Ab,{row:t,displaySelected:i,filters:n.filterBy}),Pb(i,"target")&&(0,l.jsx)(Fb,{row:t,filters:n.filterBy})]}),(0,l.jsxs)("div",{className:"redirect-source__flags",children:[Pb(i,"flags")&&(0,l.jsx)(zb,{row:t,defaultFlags:r}),Pb(i,"query")&&(0,l.jsx)(Db,{row:t,defaultFlags:r})]})]})},Mb=function(e){const{action_code:t,action_type:n}=e;return n===H_?(0,i.__)("pass","redirection"):n===W_?"-":t},Ub=function(e){const{row:t,group:n}=e,r=n.rows.find(e=>e.id===t.group_id);return r?(0,l.jsxs)("div",{className:"redirect-column-wrap",children:[r.name," ",(0,l.jsx)(Eu,{children:r.moduleName})]}):null};function $b(e,t){const n=t.find(t=>t.value===e);return n?n.label:"-"}function Bb({url:e,desiredCode:t=0,desiredTarget:n=null}){return(0,l.jsx)(bd,{url:e,desiredCode:t,desiredTarget:n})}function qb(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 Hb(e){return e.includes("source")?e:e.concat(["source"])}function Wb(e){return e.includes("title")||e.includes("source")?Hb(e):Hb(e.concat(["title"]))}function Zb(e){return[{value:"0",label:(0,i.__)("All groups","redirection")}].concat(sl(e))}const Gb=function(){const e=Ty(e=>e.redirects),t=Ty(e=>e.redirectsAddTop),{setRedirectsTable:n,setRedirectsSelected:r}=Ty(),o=de(e=>e.values);Fy({table:e,setTable:n,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}=td({}),c=s?.items??[],u=eb(),d=tb("enable"),p=tb("disable"),h=tb("reset"),{data:f,isLoading:m,isSuccess:g}=function(e={},t){const n=ed(e);return pt({queryKey:Wn.redirects.list(n),refetchOnMount:"always",refetchOnReconnect:!0,queryFn:async()=>{try{const e=await St(Ot(n));return Gu.parse(e)}catch(e){throw Hn(e)}},...t})}(e),y=f?.items??[],_=f?.total??0;let v=Iy;m?v=zy:g&&(v=Dy);const b={flag_query:o?.flag_query??"ignore",flag_case:o?.flag_case??!1,flag_trailing:o?.flag_trailing??!1,flag_regex:o?.flag_regex??!1},x=v===Dy&&a&&h_(g_),w=e=>{n({filterBy:e,page:0,selected:[],selectAll:!1})},j={displayFilters:kb(),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:kb().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:Zb(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")}],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:av()},{label:(0,i.__)("Action Type","redirection"),value:"action",options:lv()},{label:(0,i.__)("HTTP Status Code","redirection"),value:"http",options:dv()},{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:Wb},S={onChangePage:e=>{n({page:e,selected:[],selectAll:!1})},onBulk:t=>{const n=e.selected;if(0!==n.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(e.selectAll){const n={global:!0,filterBy:e.filterBy};"delete"===t&&u.mutate({items:[],params:n})}else switch(t){case"delete":u.mutate({items:n});break;case"enable":d.mutate({items:n});break;case"disable":p.mutate({items:n});break;case"reset":h.mutate({items:n})}}},onSelect:t=>{if("boolean"==typeof t)r(t?y.map(e=>e.id):[]);else if("number"==typeof t||"string"==typeof t){const r=e.selected.includes(t)?e.selected.filter(e=>e!==t):[...e.selected,t];n({selected:r,selectAll:!1})}else r(t)},onSetOrder:(e,t)=>{n({orderby:e,direction:t})},onFilter:t=>{w({...t,...e.filterBy?.group?{group:String(e.filterBy.group)}:{}})},onSetDisplay:(e,t)=>{n({displayType:e,displaySelected:t})},onSetAll:e=>{n({selected:e?y.map(e=>e.id):[],selectAll:e})},onGroup:t=>{w(parseInt(t,10)>0?{...e.filterBy||{},group:t}:{})}},k={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&&h_(g_)&&(0,l.jsx)(Cb,{defaultFlags:b,addTop:!0}),(0,l.jsx)(p_,{logOptions:j,logActions:S,table:k,status:v,total:_,rows:y,saving:[],getRow:(e,t)=>function(e,t,n,r,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)(nb,{item:e,onCancel:()=>f(!1)}):[{name:"status",content:(0,l.jsx)(Eb,{row:e})},{name:"source",content:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Lb,{row:e,table:t.table,defaultFlags:r}),"check"===h&&(0,l.jsx)(cd,{onClose:()=>f(null),children:(0,l.jsx)(Bb,{url:il((m=e,"server"===m.match_type?m.action_data.server??"":document.location.origin),qb(e.url)),desiredCode:d,desiredTarget:p})})]}),alwaysDisplay:!0},{name:"match_type",content:$b(c,av())},{name:"action_type",content:$b(u,lv())},{name:"code",content:Mb(e)},{name:"group",content:(0,l.jsx)(Ub,{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,b,{rows:c}),getRowActions:(e,t)=>(0,l.jsx)(Tb,{disabled:!1,row:e,rowParams:t})}),x&&!t&&(0,l.jsx)(Cb,{defaultFlags:b,addTop:!1})]})},Vb=function({page:e}){switch(e){case"support":return(0,l.jsx)(Td,{});case"404s":return(0,l.jsx)(ab,{});case"log":return(0,l.jsx)(U_,{});case"io":return(0,l.jsx)(db,{});case"groups":return(0,l.jsx)(Sb,{});case"options":return(0,l.jsx)(dd,{});case"site":return(0,l.jsx)(gy,{})}return(0,l.jsx)(Gb,{})},Qb=function(){return(0,l.jsxs)(W,{errors:"",details:Q().concat(["Buster: 5.8.0 === "+Redirectioni10n.version]),type:"fixed",title:(0,i.__)("Cached Redirection detected","redirection"),links:V(),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)(O,{url:"https://redirection.me/support/problems/cloudflare/",children:(0,i.__)("clearing your cache.","redirection")})]})]})},Kb=function(){const{update_notice:e=!1}=window.Redirectioni10n,{mutate:t}=_a();return e&&h_("redirection_cap_option_manage")?(0,l.jsx)(Iu,{children:(0,l.jsxs)("p",{children:[D((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)(O,{url:"https://redirection.me/blog/redirection-version-"+e.replace(".","-")+"/"})})," ",(0,l.jsx)(Ol,{onClick:function(){t({update_notice:window.Redirectioni10n.update_notice}),window.Redirectioni10n.update_notice=!1},children:(0,i.__)("OK","redirection")})]})}):null},Jb=Redirectioni10n?.caps?.pages||[];function Yb(){const e=Gn(e=>e.errors),t=Gn(e=>e.notices),{clearErrors:n,clearNotices:r}=Gn(),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:y}=Ty(),[_,v]=(0,o.useState)(Sl(Jb));(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)(()=>{n()},[n]),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/Export","redirection"),value:"io"},{name:(0,i.__)("Options","redirection"),value:"options"},{name:(0,i.__)("Support","redirection"),value:"support"}].filter(e=>f_(e.value)||""===e.value&&f_("redirect")),[]),j=(0,o.useMemo)(()=>({redirect:(0,i.__)("Redirections","redirection"),site:(0,i.__)("Site","redirection"),groups:(0,i.__)("Groups","redirection"),io:(0,i.__)("Import/Export","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&&y({orderby:"name",direction:"asc",page:0,perPage:25,selected:[],filter:"",filterBy:"",groupBy:""})},[b,h,f,m,y]);if("5.8.0"!==Redirectioni10n.version)return(0,l.jsx)(Qb,{});if("need-install"===s||"finish-install"===s)return(0,l.jsx)(G,{renderCrash:Pl,extra:{page:_},children:(0,l.jsx)(nl,{})});const k="prompt"===u&&("need-update"===s||"finish-update"===s);return(0,l.jsx)(G,{renderCrash:Pl,extra:{page:_},children:(0,l.jsxs)("div",{className:"wrap redirection notranslate",translate:"no",children:[k&&(0,l.jsx)(fl,{onShowUpgrade:()=>d(!0),showDatabase:a}),!c&&"finish-update"!==s&&!a&&(0,l.jsxs)(kl,{page:_,setPage:b,onPageChange:x,allowedPages:Jb,baseUrl:"?page=redirection.php",defaultPage:"redirect",children:[(0,l.jsx)("h1",{className:"wp-heading-inline",children:j[_]}),"redirect"===_&&h_(g_)&&(0,l.jsx)("button",{type:"button",onClick:()=>g(!0),className:"page-title-action",children:(0,i.__)("Add New","redirection")}),(0,l.jsx)(Kb,{}),(0,l.jsx)(yl,{onChangePage:S,currentPage:_,menu:w,home:"redirect",urlBase:Redirectioni10n.pluginRoot}),(0,l.jsx)(W,{errors:e,onClear:()=>n(),renderDebug:pe,details:Q(),links:V(),locale:"redirection",children:(0,l.jsx)(Cl,{})}),(0,l.jsx)(Vb,{page:_}),(0,l.jsx)(bl,{notices:t,onClear:()=>r(),snackBarViewText:(0,i.__)("View notice","redirection")})]})]})})}var Xb=class extends fe{constructor(e={}){super(),this.config=e,this.#W=new Map}#W;build(e,t,n){const r=t.queryKey,i=t.queryHash??Ce(r,t);let o=this.get(i);return o||(o=new et({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),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()})})}},ex=class extends fe{constructor(e={}){super(),this.config=e,this.#Z=new Set,this.#G=new Map,this.#V=0}#Z;#G;#V;build(e,t,n){const r=new ht({client:e,mutationCache:this,mutationId:++this.#V,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#Z.add(e);const t=tx(e);if("string"==typeof t){const n=this.#G.get(t);n?n.push(e):this.#G.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#Z.delete(e)){const t=tx(e);if("string"==typeof t){const n=this.#G.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#G.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=tx(e);if("string"==typeof t){const n=this.#G.get(t),r=n?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=tx(e);if("string"==typeof t){const n=this.#G.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){qe.batch(()=>{this.#Z.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#Z.clear(),this.#G.clear()})}getAll(){return Array.from(this.#Z)}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 tx(e){return e.options.scope?.id}function nx(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 rx=new class{#Q;#$;#h;#K;#J;#Y;#X;#ee;constructor(e={}){this.#Q=e.queryCache||new Xb,this.#$=e.mutationCache||new ex,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.#$.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),n=this.#Q.build(this,t),r=n.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(we(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#Q.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#Q.get(r.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,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return qe.batch(()=>this.#Q.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}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 n=this.#Q;return qe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=qe.batch(()=>this.#Q.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=qe.batch(()=>this.#Q.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(ve)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#Q.build(this,t);return n.isStaleByTime(we(t.staleTime,n))?n.fetch(t):Promise.resolve(n.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.#$.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#Q}getMutationCache(){return this.#$}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()],n={};return t.forEach(t=>{Ee(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#J.set(Te(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#J.values()],n={};return t.forEach(t=>{Ee(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}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===Le&&(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.#$.clear()}}({queryCache:new Xb({onError:e=>{nx("Query",e)}}),mutationCache:new ex({onError:e=>{nx("Mutation",e)}}),defaultOptions:{queries:{staleTime:0,retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});let ix=!1;function ox(e,t){const n=e?.stack||"",r="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:r?V():void 0,details:(r?Q():[]).concat([n,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 sx(){return(0,l.jsx)(G,{renderCrash:ox,children:(0,l.jsx)(ax,{})})}function ax(){const[e,t]=(0,o.useState)(ix),n=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 n=window.Redirectioni10n.locale,r=!1;try{new Intl.NumberFormat(n)}catch(e){n="en-US",r=!0}return{apiRoot:e,apiNonce:t,locale:n,localeWasInvalid:r}}();return(0,o.useEffect)(()=>{ix||(n.localeWasInvalid&&(console.warn("Invalid locale:",window.Redirectioni10n.locale,"falling back to en-US"),window.Redirectioni10n.locale=n.locale),n.apiNonce||console.warn("WP_API_nonce is missing from Redirectioni10n.api"),St.resetMiddlewares(),St.use(St.createRootURLMiddleware(n.apiRoot)),St.use(St.createNonceMiddleware(n.apiNonce)),ix=!0),t(!0)},[n.apiNonce,n.apiRoot,n.locale,n.localeWasInvalid]),e?(0,l.jsxs)(d,{client:rx,children:[(0,l.jsx)(Yb,{}),!1]}):(0,l.jsx)(l.Fragment,{})}document.querySelector("#react-ui")&&window.Redirectioni10n&&(function(){const e=document.getElementById("react-ui");e&&(0,r.createRoot)(e).render((0,l.jsx)(sx,{}))}(),window.redirection=window.Redirectioni10n.version)},465(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=(r=n(2))&&r.__esModule?r:{default:r};t.default=i.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=function(e){var t=e.activeClassName,n=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,y=e.highlightStyle,_=void 0===y?{}:y,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,P=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),R=(0,o.findAll)({autoEscape:u,caseSensitive:p,findChunks:f,sanitize:x,searchWords:w,textToHighlight:j}),O=b,N=-1,A="",F=void 0,I=(0,a.default)(function(e){var t={};for(var n in e)t[n.toLowerCase()]=e[n];return t});return(0,s.createElement)("span",r({className:h},P,{children:R.map(function(e,t){var r=j.substr(e.start,e.end-e.start);if(e.highlight){N++;var i;i="object"==typeof g?p?g[r]:(g=I(g))[r.toLowerCase()]:g;var o=N===+l;A=i+" "+(o?n:""),F=!0===o&&null!=c?Object.assign({},_,c):_;var a={children:r,className:A,key:t,style:F};return"string"!=typeof O&&(a.highlightIndex=N),(0,s.createElement)(O,a)}return(0,s.createElement)(k,{children:r,className:T,key:t,style:E})})}))};var i,o=n(3),s=n(4),a=(i=n(5))&&i.__esModule?i:{default:i};e.exports=t.default},function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return r.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return r.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return r.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return r.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?r:a,c=e.sanitize,u=e.searchWords,d=e.textToHighlight;return i({chunksToHighlight:n({chunks:l({autoEscape:t,caseSensitive:s,sanitize:c,searchWords:u,textToHighlight:d})}),totalLength:d?d.length:0})};var n=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 n=e.pop();if(t.start<=n.end){var r=Math.max(n.end,t.end);e.push({start:n.start,end:r})}else e.push(n,t);return e},[])},r=function(e){var t=e.autoEscape,n=e.caseSensitive,r=e.sanitize,i=void 0===r?o:r,s=e.searchWords,a=e.textToHighlight;return a=i(a),s.filter(function(e){return e}).reduce(function(e,r){r=i(r),t&&(r=r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var o=new RegExp(r,n?"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=r;var i=t.fillInChunks=function(e){var t=e.chunksToHighlight,n=e.totalLength,r=[],i=function(e,t,n){t-e>0&&r.push({start:e,end:t,highlight:n})};if(0===t.length)i(0,n,!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,n,!1)}return r};function o(e){return e}}])},function(e,t){e.exports=n(609)},function(e,t){"use strict";var n=function(e,t){return e===t};e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=void 0,i=[],o=void 0,s=!1,a=function(e,n){return t(e,i[n])};return function(){for(var t=arguments.length,n=Array(t),l=0;l<t;l++)n[l]=arguments[l];return s&&r===this&&n.length===i.length&&n.every(a)?o:(s=!0,r=this,i=n,o=e.apply(this,n))}}}])},49(e,t,n){"use strict";var r=n(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=r.useSyncExternalStore,s=r.useRef,a=r.useEffect,l=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,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=r(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 n=r(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,s=n)}var o,s,a=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,n,r,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,n){"use strict";e.exports=n(49)},609(e){"use strict";e.exports=window.React},500(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=s(e,o(n)))}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 n in e)r.call(e,n)&&e[n]&&(t=s(t,n));return t}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(t,n,r,i)=>{if(!n){var s=1/0;for(u=0;u<e.length;u++){for(var[n,r,i]=e[u],a=!0,l=0;l<n.length;l++)(!1&i||s>=i)&&Object.keys(o.O).every(e=>o.O[e](n[l]))?n.splice(l--,1):(a=!1,i<s&&(s=i));if(a){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var i=Object.create(null);o.r(i);var s={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,o.d(i,s),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{var e={57:0,350:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[s,a,l]=n,c=0;if(s.some(t=>0!==e[t])){for(r in a)o.o(a,r)&&(o.m[r]=a[r]);if(l)var u=l(o)}for(t&&t(n);c<s.length;c++)i=s[c],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(u)},n=globalThis.webpackChunkredirection=globalThis.webpackChunkredirection||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var s=o.O(void 0,[350],()=>o(174));s=o.O(s)})();