PageSourceSearch

https://cpic-global.net/_build/assets/routing-IHA2C6Hd.js

js cpic-global.net collected 2026-10-07 23:24:31 UTC 7,931 bytes, 1 lines download raw bytes

1import{T as N,a as w,g as ce,u as V,I as D,H as X,e as B,z as ie,o as G,U as le,R as ue,W as fe,D as he,b as de}from"./web-14CxgGdG.js";function pe(){let t=new Set;function e(r){return t.add(r),()=>t.delete(r)}let n=!1;function s(r,a){if(n)return!(n=!1);const o={to:r,options:a,defaultPrevented:!1,preventDefault:()=>o.defaultPrevented=!0};for(const i of t)i.listener({...o,from:i.location,retry:f=>{f&&(n=!0),i.navigate(r,{...a,resolve:!1})}});return!o.defaultPrevented}return{subscribe:e,confirm:s}}let U;function J(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),U=window.history.state._depth}J();function _e(t){return{...t,_depth:window.history.state&&window.history.state._depth}}function qe(t,e){let n=!1;return()=>{const s=U;J();const r=s==null?null:U-s;if(n){n=!1;return}r&&e(r)?(n=!0,window.history.go(-r)):t()}}const me=/^(?:[a-z0-9]+:)?\/\//i,ge=/^\/+|(\/)\/+$/g,ye="http://sr";function E(t,e=!1){const n=t.replace(ge,"$1");return n?e||/^[?#]/.test(n)?n:"/"+n:""}function I(t,e,n){if(me.test(e))return;const s=E(t),r=n&&E(n);let a="";return!r||e.startsWith("/")?a=s:r.toLowerCase().indexOf(s.toLowerCase())!==0?a=s+r:a=r,(a||"/")+E(e,!a)}function we(t,e){if(t==null)throw new Error(e);return t}function ve(t,e){return E(t).replace(/\/*(\*.*)?$/g,"")+E(e)}function Q(t){const e={};return t.searchParams.forEach((n,s)=>{s in e?Array.isArray(e[s])?e[s].push(n):e[s]=[e[s],n]:e[s]=n}),e}function Pe(t,e,n){const[s,r]=t.split("/*",2),a=s.split("/").filter(Boolean),o=a.length;return i=>{const f=i.split("/").filter(Boolean),h=f.length-o;if(h<0||h>0&&r===void 0&&!e)return null;const u={path:o?"":"/",params:{}},m=p=>n===void 0?void 0:n[p];for(let p=0;p<o;p++){const d=a[p],y=d[0]===":",v=y?f[p]:f[p].toLowerCase(),b=y?d.slice(1):d.toLowerCase();if(y&&W(v,m(b)))u.params[b]=v;else if(y||!W(v,b))return null;u.path+=`/${v}`}if(r){const p=h?f.slice(-h).join("/"):"";if(W(p,m(r)))u.params[r]=p;else return null}return u}}function W(t,e){const n=s=>s===t;return e===void 0?!0:typeof e=="string"?n(e):typeof e=="function"?e(t):Array.isArray(e)?e.some(n):e instanceof RegExp?e.test(t):!1}function Re(t){const[e,n]=t.pattern.split("/*",2),s=e.split("/").filter(Boolean);return s.reduce((r,a)=>r+(a.startsWith(":")?2:3),s.length-(n===void 0?0:1))}function Y(t){const e=new Map,n=ce();return new Proxy({},{get(s,r){return e.has(r)||N(n,()=>e.set(r,w(()=>t()[r]))),e.get(r)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(t())}})}function xe(t,e){const n=new URLSearchParams(t);Object.entries(e).forEach(([r,a])=>{a==null||a===""||a instanceof Array&&!a.length?n.delete(r):a instanceof Array?(n.delete(r),a.forEach(o=>{n.append(r,String(o))})):n.set(r,String(a))});const s=n.toString();return s?`?${s}`:""}function Z(t){let e=/(\/?\:[^\/]+)\?/.exec(t);if(!e)return[t];let n=t.slice(0,e.index),s=t.slice(e.index+e[0].length);const r=[n,n+=e[1]];for(;e=/^(\/\:[^\/]+)\?/.exec(s);)r.push(n+=e[1]),s=s.slice(e[0].length);return Z(s).reduce((a,o)=>[...a,...r.map(i=>i+o)],[])}const Se=100,be=X(),k=X(),C=()=>we(D(be),"<A> and 'use' router primitives can be only used inside a Route."),Ae=()=>D(k)||C().base,We=t=>{const e=Ae();return w(()=>e.resolvePath(t()))},$e=t=>{const e=C();return w(()=>{const n=t();return n!==void 0?e.renderPath(n):n})},Ee=()=>C().navigatorFactory(),Ce=()=>C().location,Ue=()=>C().params,De=()=>{const t=Ce(),e=Ee(),n=(s,r)=>{const a=V(()=>xe(t.search,s)+t.hash);e(a,{scroll:!1,resolve:!1,...r})};return[t.query,n]};function Le(t,e=""){const{component:n,preload:s,load:r,children:a,info:o}=t,i=!a||Array.isArray(a)&&!a.length,f={key:t,component:n,preload:s||r,info:o};return ee(t.path).reduce((h,u)=>{for(const m of Z(u)){const p=ve(e,m);let d=i?p:p.split("/*",1)[0];d=d.split("/").map(y=>y.startsWith(":")||y.startsWith("*")?y:encodeURIComponent(y)).join("/"),h.push({...f,originalPath:u,pattern:d,matcher:Pe(d,!i,t.matchFilters)})}return h},[])}function Fe(t,e=0){return{routes:t,score:Re(t[t.length-1])*1e4-e,matcher(n){const s=[];for(let r=t.length-1;r>=0;r--){const a=t[r],o=a.matcher(n);if(!o)return null;s.unshift({...o,route:a})}return s}}}function ee(t){return Array.isArray(t)?t:[t]}function Oe(t,e="",n=[],s=[]){const r=ee(t);for(let a=0,o=r.length;a<o;a++){const i=r[a];if(i&&typeof i=="object"){i.hasOwnProperty("path")||(i.path="");const f=Le(i,e);for(const h of f){n.push(h);const u=Array.isArray(i.children)&&i.children.length===0;if(i.children&&!u)Oe(i.children,h.pattern,n,s);else{const m=Fe([...n],s.length);s.push(m)}n.pop()}}}return n.length?s:s.sort((a,o)=>o.score-a.score)}function $(t,e){for(let n=0,s=t.length;n<s;n++){const r=t[n].matcher(e);if(r)return r}return[]}function je(t,e,n){const s=new URL(ye),r=w(u=>{const m=t();try{return new URL(m,s)}catch{return console.error(`Invalid path ${m}`),u}},s,{equals:(u,m)=>u.href===m.href}),a=w(()=>r().pathname),o=w(()=>r().search,!0),i=w(()=>r().hash),f=()=>
1"",h=G(o,()=>Q(r()));return{get pathname(){return a()},get search(){return o()},get hash(){return i()},get state(){return e()},get key(){return f()},query:n?n(h):Y(h)}}let P;function Me(){return P}let S=!1;function ze(){return S}function Te(t){S=t}function He(t,e,n,s={}){const{signal:[r,a],utils:o={}}=t,i=o.parsePath||(c=>c),f=o.renderPath||(c=>c),h=o.beforeLeave||pe(),u=I("",s.base||"");if(u===void 0)throw new Error(`${u} is not a valid base path`);u&&!r().value&&a({value:u,replace:!0,scroll:!1});const[m,p]=B(!1);let d;const y=(c,l)=>{l.value===v()&&l.state===L()||(d===void 0&&p(!0),P=c,d=l,ue(()=>{d===l&&(b(d.value),te(d.state),fe(),M[1](g=>g.filter(R=>R.pending)))}).finally(()=>{d===l&&he(()=>{P=void 0,c==="navigate"&&ae(d),p(!1),d=void 0})}))},[v,b]=B(r().value),[L,te]=B(r().state),F=je(v,L,o.queryWrapper),O=[],M=B([]),z=w(()=>typeof s.transformUrl=="function"?$(e(),s.transformUrl(F.pathname)):$(e(),F.pathname)),T=()=>{const c=z(),l={};for(let g=0;g<c.length;g++)Object.assign(l,c[g].params);return l},ne=o.paramsWrapper?o.paramsWrapper(T,e):Y(T),H={pattern:u,path:()=>u,outlet:()=>null,resolvePath(c){return I(u,c)}};return ie(G(r,c=>y("native",c),{defer:!0})),{base:H,location:F,params:ne,isRouting:m,renderPath:f,parsePath:i,navigatorFactory:se,matches:z,beforeLeave:h,preloadRoute:oe,singleFlight:s.singleFlight===void 0?!0:s.singleFlight,submissions:M};function re(c,l,g){V(()=>{if(typeof l=="number"){l&&(o.go?o.go(l):console.warn("Router integration does not support relative routing"));return}const R=!l||l[0]==="?",{replace:_,resolve:x,scroll:q,state:A}={replace:!1,resolve:!R,scroll:!0,...g},j=x?c.resolvePath(l):I(R&&F.pathname||"",l);if(j===void 0)throw new Error(`Path '${l}' is not a routable path`);if(O.length>=Se)throw new Error("Too many redirects");const K=v();(j!==K||A!==L())&&(le||h.confirm(j,g)&&(O.push({value:K,replace:_,scroll:q,state:L()}),y("navigate",{value:j,state:A})))})}function se(c){return c=c||D(k)||H,(l,g)=>re(c,l,g)}function ae(c){const l=O[0];l&&(a({...c,replace:l.replace,scroll:l.scroll}),O.length=0)}function oe(c,l){const g=$(e(),c.pathname),R=P;P="preload";for(let _ in g){const{route:x,params:q}=g[_];x.component&&x.component.preload&&x.component.preload();const{preload:A}=x;S=!0,l&&A&&N(n(),()=>A({params:q,location:{pathname:c.pathname,search:c.search,hash:c.hash,query:Q(c),state:null,key:""},intent:"preload"})),S=!1}P=R}}function Ke(t,e,n,s){const{base:r,location:a,params:o}=t,{pattern:i,component:f,preload:h}=s().route,u=w(()=>s().path);f&&f.preload&&f.preload(),S=!0;const m=h?h({params:o,location:a,intent:P||"initial"}):void 0;return S=!1,{parent:e,pattern:i,path:u,outlet:()=>f?de(f,{params:o,location:a,data:m,get children(){return n()}}):n(),resolvePath(d){return I(r.path(),d,u())}}}export{be as R,He as a,k as b,Oe as c,Ke as d,pe as e,J as f,Me as g,De as h,Ee as i,ze as j,_e as k,Ce as l,ye as m,qe as n,We as o,$e as p,E as q,Te as s,Ue as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.