"use strict";var wp;(wp||={}).router=(()=>{var qt=Object.create;var V=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bt=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},ut=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Vt(t))!Ut.call(e,a)&&a!==r&&V(e,a,{get:()=>t[a],enumerable:!(n=Qt(t,a))||n.enumerable});return e};var O=(e,t,r)=>(r=e!=null?qt($t(e)):{},ut(t||!e||!e.__esModule?V(r,"default",{value:e,enumerable:!0}):r,e)),Gt=e=>ut(V({},"__esModule",{value:!0}),e);var tt=T((ge,Pt)=>{Pt.exports=window.wp.element});var et=T((me,Ot)=>{Ot.exports=window.wp.url});var Rt=T((ye,_t)=>{_t.exports=window.wp.compose});var rt=T((we,At)=>{At.exports=window.ReactJSXRuntime});var Ht=T((Oe,Mt)=>{Mt.exports=window.wp.privateApis});var ce={};Bt(ce,{privateApis:()=>it});var Jt=Object.create;function K(){var e=Jt(null);return e.__=void 0,delete e.__,e}var vt=function(t,r,n){this.path=t,this.matcher=r,this.delegate=n};vt.prototype.to=function(t,r){var n=this.delegate;if(n&&n.willAddRoute&&(t=n.willAddRoute(this.matcher.target,t)),this.matcher.add(this.path,t),r){if(r.length===0)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,t,r,this.delegate)}};var $=function(t){this.routes=K(),this.children=K(),this.target=t};$.prototype.add=function(t,r){this.routes[t]=r};$.prototype.addChild=function(t,r,n,a){var o=new $(r);this.children[t]=o;var i=X(t,o,a);a&&a.contextEntered&&a.contextEntered(r,i),n(i)};function X(e,t,r){function n(a,o){var i=e+a;if(o)o(X(i,t,r));else return new vt(i,t,r)}return n}function Yt(e,t,r){for(var n=0,a=0;a0&&t.charCodeAt(0)===47&&(t=t.substr(1));for(var n=t.split("/"),a=void 0,o=void 0,i=0;i2&&i.slice(s-2)==="[]"&&(c=!0,i=i.slice(0,s-2),n[i]||(n[i]=[])),u=o[1]?ft(o[1]):""),c?n[i].push(u):n[i]=u}return n};y.prototype.recognize=function(t){var r,n=[this.rootState],a={},o=!1,i=t.indexOf("#");i!==-1&&(t=t.substr(0,i));var s=t.indexOf("?");if(s!==-1){var c=t.substr(s+1,t.length);t=t.substr(0,s),a=this.parseQueryString(c)}t.charAt(0)!=="/"&&(t="/"+t);var u=t;y.ENCODE_AND_DECODE_PATH_SEGMENTS?t=pt(t):(t=decodeURI(t),u=decodeURI(u));var h=t.length;h>1&&t.charAt(h-1)==="/"&&(t=t.substr(0,h-1),u=u.substr(0,u.length-1),o=!0);for(var d=0;d=0&&(t.hash=e.substr(r),e=e.substr(0,r));var n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}var m=O(tt()),P=O(et()),J=O(Rt()),nt=O(rt()),k=St(),at=(0,m.createContext)(null);at.displayName="RoutesContext";var I=(0,m.createContext)({pathArg:"p"});I.displayName="ConfigContext";var Ct=new WeakMap;function Nt(){let e=k.location,t=Ct.get(e);return t||(t={...e,query:Object.fromEntries(new URLSearchParams(e.search))},Ct.set(e,t)),t}function kt(){let e=(0,m.useContext)(at);if(!e)throw new Error("useLocation must be used within a RouterProvider");return e}function Y(){let{pathArg:e,beforeNavigate:t}=(0,m.useContext)(I),r=(0,J.useEvent)(async(n,a={})=>{let o=(0,P.getQueryArgs)(n),i=(0,P.getPath)("http://domain.com/"+n)??"",s=()=>{let u=t?t({path:i,query:o}):{path:i,query:o};return k.push({search:(0,P.buildQueryString)({[e]:u.path,...u.query})},a.state)};if(!window.matchMedia("(min-width: 782px)").matches||!document.startViewTransition||!a.transition){s();return}await new Promise(u=>{let h=a.transition??"";document.documentElement.classList.add(h),document.startViewTransition(()=>s()).finished.finally(()=>{document.documentElement.classList.remove(h),u()})})});return(0,m.useMemo)(()=>({navigate:r,back:k.back,invalidate:()=>{k.replace({search:k.location.search})}}),[r])}function ue(e,t,r,n){let{query:a={}}=e,[o,i]=(0,m.useState)();return(0,m.useEffect)(()=>{let{[r]:s="/",...c}=a,u=t.recognize(s)?.[0];async function h(d){let v=d.handler,p=async(E={})=>{let q=await Promise.all(Object.entries(E).map(async([_,R])=>typeof R=="function"?[_,await R({query:c,params:d.params,...n})]:[_,R]));return Object.fromEntries(q)},[g,x]=await Promise.all([p(v.areas),p(v.widths)]);i({name:v.name,areas:g,widths:x,params:d.params,query:c,path:(0,P.addQueryArgs)(s,c)})}return u?h(u):i({name:"404",path:(0,P.addQueryArgs)(s,c),areas:{},widths:{},query:c,params:{}}),()=>i(void 0)},[t,a,r,n]),o}function Dt({routes:e,pathArg:t,beforeNavigate:r,children:n,matchResolverArgs:a}){let o=(0,m.useSyncExternalStore)(k.listen,Nt,Nt),i=(0,m.useMemo)(()=>{let d=new yt;return(e??[]).forEach(v=>{d.add([{path:v.path,handler:v}],{as:v.name})}),d},[e]),s=ue(o,i,t,a),c=(0,J.usePrevious)(s),u=(0,m.useMemo)(()=>({beforeNavigate:r,pathArg:t}),[r,t]),h=s||c;return h?(0,nt.jsx)(I.Provider,{value:u,children:(0,nt.jsx)(at.Provider,{value:h,children:n})}):null}var W=O(tt()),D=O(et());var Lt=O(rt());function ot(e,t={}){let r=Y(),{pathArg:n,beforeNavigate:a}=(0,W.useContext)(I);function o(h){h?.preventDefault(),r.navigate(e,t)}let i=(0,D.getQueryArgs)(e),s=(0,D.getPath)("http://domain.com/"+e)??"",c=(0,W.useMemo)(()=>a?a({path:s,query:i}):{path:s,query:i},[s,i,a]),[u]=window.location.href.split("?");return{href:`${u}?${(0,D.buildQueryString)({[n]:c.path,...c.query})}`,onClick:o}}function Tt({to:e,options:t,children:r,...n}){let{href:a,onClick:o}=ot(e,t);return(0,Lt.jsx)("a",{href:a,onClick:o,...n,children:r})}var jt=O(Ht()),{lock:zt,unlock:_e}=(0,jt.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/router");var it={};zt(it,{useHistory:Y,useLocation:kt,RouterProvider:Dt,useLink:ot,Link:Tt});return Gt(ce);})();