import{c as t}from"./p-7bff44eb.js";let r;const e=e=>{var n;const o=window,s=new URL(o.location.href),l=null!==(n=null==e?void 0:e.parseURL)&&void 0!==n?n:i,{state:u,onChange:f,dispose:p}=t({url:s,activePath:l(s)},((t,r,e)=>"url"===e?t.href!==r.href:t!==r)),c=t=>{history.pushState(null,null,t);const r=new URL(t,document.baseURI);u.url=r,u.activePath=l(r)},v=t=>{const{activePath:r}=u;for(let e of t){const n=a(r,e.path);if(n){if(null!=e.to){const n="string"==typeof e.to?e.to:e.to(r);return c(n),v(t)}return{params:n,route:e}}}},d=()=>{const t=new URL(o.location.href);u.url=t,u.activePath=l(t)},g=r={Switch:(t,r)=>{const e=v(r);if(e)return"function"==typeof e.route.jsx?e.route.jsx(e.params):e.route.jsx},get url(){return u.url},get activePath(){return u.activePath},push:c,onChange:f,dispose:()=>{r=void 0,o.removeEventListener("popstate",d),p()}};return d(),o.addEventListener("popstate",d),g},n=(t,r)=>{var e;return"to"in t?{path:t.path,to:t.to}:{path:t.path,id:t.id,jsx:null!==(e=t.render)&&void 0!==e?e:r}},o=(t,e=r)=>({href:t,onClick:r=>{r.metaKey||r.ctrlKey||2!=r.which&&1!=r.button&&(r.preventDefault(),e.push(t))}}),a=(t,r)=>{if("string"==typeof r){if(r===t)return{}}else if("function"==typeof r){const e=r(t);if(e)return!0===e?{}:{...e}}else{const e=r.exec(t);if(e)return r.lastIndex=0,{...e}}},i=t=>t.pathname.toLowerCase(),s=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g"),l=t=>t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),u=t=>t.replace(/([=!:$/()])/g,"\\$1"),f=t=>t&&t.sensitive?"":"i",p=(t,r,e)=>{for(var n=(e=e||{}).strict,o=!1!==e.end,a=l(e.delimiter||"/"),i=e.delimiters||"./",s=[].concat(e.endsWith||[]).map(l).concat("$").join("|"),u="",p=!1,c=0;c<t.length;c++){var v=t[c];if("string"==typeof v)u+=l(v),p=c===t.length-1&&i.indexOf(v[v.length-1])>-1;else{var d=l(v.prefix||""),g=v.repeat?"(?:"+v.pattern+")(?:"+d+"(?:"+v.pattern+"))*":v.pattern;r&&r.push(v),u+=v.optional?v.partial?d+"("+g+")?":"(?:"+d+"("+g+"))?":d+"("+g+")"}}return o?(n||(u+="(?:"+a+")?"),u+="$"===s?"$":"(?="+s+")"):(n||(u+="(?:"+a+"(?="+s+"))?"),p||(u+="(?="+a+"|"+s+")")),new RegExp("^"+u,f(e))},c=(t,r,e)=>t instanceof RegExp?((t,r)=>{if(!r)return t;var e=t.source.match(/\((?!\?)/g);if(e)for(var n=0;n<e.length;n++)r.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,pattern:null});return t})(t,r):Array.isArray(t)?((t,r,e)=>{for(var n=[],o=0;o<t.length;o++)n.push(c(t[o],r,e).source);return new RegExp("(?:"+n.join("|")+")",f(e))})(t,r,e):((t,r,e)=>p(((t,r)=>{for(var e,n=[],o=0,a=0,i="",f=r&&r.delimiter||"/",p=r&&r.delimiters||"./",c=!1;null!==(e=s.exec(t));){var v=e[0],d=e[1],g=e.index;if(i+=t.slice(a,g),a=g+v.length,d)i+=d[1],c=!0;else{var h="",m=t[a],w=e[2],y=e[3],x=e[4],$=e[5];if(!c&&i.length){var R=i.length-1;p.indexOf(i[R])>-1&&(h=i[R],i=i.slice(0,R))}i&&(n.push(i),i="",c=!1);var b=h||f,E=y||x;n.push({name:w||o++,prefix:h,delimiter:b,optional:"?"===$||"*"===$,repeat:"+"===$||"*"===$,partial:""!==h&&void 0!==m&&m!==h,pattern:E?u(E):"[^"+l(b)+"]+?"})}}return(i||a<t.length)&&n.push(i+t.substr(a)),n})(t,e),r,e))(t,r,e);let v=0;const d={},g=(t,r={})=>{const{exact:e=!1,strict:n=!1}=r,{re:o,keys:a}=((t,r)=>{const e=`${r.end}${r.strict}`,n=d[e]||(d[e]={}),o=JSON.stringify(t);if(n[o])return n[o];const a=[],i={re:c(t,a,r),keys:a};return v<1e4&&(n[o]=i,v+=1),i})(t,{end:e,strict:n});return t=>{const r=o.exec(t);if(!r)return;const[n,...i]=r;return e&&t!==n?void 0:a.reduce(((t,r,e)=>(t[r.name]=i[e],t)),{})}},{state:h,set:m}=(t({router:e()}),t({router:e(),routes:null,mode:null,wrapper:null,recommendations:null,layout:null,plugins:null})),{state:w}=t({tabs:[]});export{n as R,g as a,m as b,o as h,w as m,h as r}