(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{privateApis:()=>b});const n=window.wp.element;function r(){return 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},r.apply(this,arguments)}var o,a=o||(o={});a.Pop="POP",a.Push="PUSH",a.Replace="REPLACE";function u(e){e.preventDefault(),e.returnValue=""}function i(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}const c=window.wp.url,s=function(e){function t(){var e=l.location,t=f.state||{};return[t.idx,{pathname:e.pathname,search:e.search,hash:e.hash,state:t.usr||null,key:t.key||"default"}]}function n(e){return"string"==typeof e?e:function(e){var t=e.pathname,n=e.search;return(void 0===t?"/":t)+(void 0===n?"":n)+(void 0===(e=e.hash)?"":e)}(e)}function a(e,t){return void 0===t&&(t=null),r({pathname:v.pathname,hash:"",search:""},"string"==typeof e?function(e){var t={};if(e){var n=e.indexOf("#");0<=n&&(t.hash=e.substr(n),e=e.substr(0,n)),0<=(n=e.indexOf("?"))&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}(e):e,{state:t,key:Math.random().toString(36).substr(2,8)})}function c(e){d=e,e=t(),p=e[0],v=e[1],y.call({action:d,location:v})}function s(e){f.go(e)}void 0===e&&(e={});var l=void 0===(e=e.window)?document.defaultView:e,f=l.history,h=null;l.addEventListener("popstate",(function(){if(h)g.call(h),h=null;else{var e=o.Pop,n=t(),r=n[0];if(n=n[1],g.length){if(null!=r){var a=p-r;a&&(h={action:e,location:n,retry:function(){s(-1*a)}},s(a))}}else c(e)}}));var d=o.Pop,p=(e=t())[0],v=e[1],y=i(),g=i();return null==p&&(p=0,f.replaceState(r({},f.state,{idx:p}),"")),{get action(){return d},get location(){return v},createHref:n,push:function e(t,r){var u=o.Push,i=a(t,r);if(!g.length||(g.call({action:u,location:i,retry:function(){e(t,r)}}),0)){var s=[{usr:i.state,key:i.key,idx:p+1},n(i)];i=s[0],s=s[1];try{f.pushState(i,"",s)}catch(e){l.location.assign(s)}c(u)}},replace:function e(t,r){var u=o.Replace,i=a(t,r);g.length&&(g.call({action:u,location:i,retry:function(){e(t,r)}}),1)||(i=[{usr:i.state,key:i.key,idx:p},n(i)],f.replaceState(i[0],"",i[1]),c(u))},go:s,back:function(){s(-1)},forward:function(){s(1)},listen:function(e){return y.push(e)},block:function(e){var t=g.push(e);return 1===g.length&&l.addEventListener("beforeunload",u),function(){t(),g.length||l.removeEventListener("beforeunload",u)}}}}(),l=s.push,f=s.replace;s.push=function(e,t){const n=(0,c.getQueryArgs)(window.location.href),r=(0,c.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,c.addQueryArgs)(r,e);return l.call(s,o,t)},s.replace=function(e,t){const n=(0,c.getQueryArgs)(window.location.href),r=(0,c.removeQueryArgs)(window.location.href,...Object.keys(n)),o=(0,c.addQueryArgs)(r,e);return f.call(s,o,t)};const h=s,d=(0,n.createContext)(),p=(0,n.createContext)();function v(e){const t=new URLSearchParams(e.search);return{...e,params:Object.fromEntries(t.entries())}}const y=window.wp.privateApis,{lock:g,unlock:w}=(0,y.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/router"),b={};g(b,{useHistory:function(){return(0,n.useContext)(p)},useLocation:function(){return(0,n.useContext)(d)},RouterProvider:function({children:e}){const[t,r]=(0,n.useState)((()=>v(h.location)));return(0,n.useEffect)((()=>h.listen((({location:e})=>{r(v(e))}))),[]),(0,n.createElement)(p.Provider,{value:h},(0,n.createElement)(d.Provider,{value:t},e))}}),(window.wp=window.wp||{}).router=t})(); //# sourceMappingURL=index.min.js.map