@vertesia/ui 1.3.0-dev.20260621.071017Z → 1.3.0-dev.20260622.054226Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +15 -5
- package/lib/router/Router.js.map +1 -1
- package/lib/shell/login/SigninScreen.js +9 -1
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/package.json +6 -6
- package/src/router/Router.tsx +14 -5
- package/src/shell/login/SigninScreen.tsx +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAA0C,KAAK,eAAe,EAAsB,MAAM,QAAQ,CAAC;AAE1G,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;CAAE,CAAC;AACtF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;CACvD;AACD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,YAAY,CAAC;CAC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ED,wBAAgB,iBAAiB,WAgBhC;AAED,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7E,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAOxD;AAED,wBAAgB,WAAW,aAG1B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,QAQzC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,QAyB3D"}
|
package/lib/router/Router.js
CHANGED
|
@@ -132,11 +132,21 @@ export function useNavigate() {
|
|
|
132
132
|
}
|
|
133
133
|
export function useRouterBasePath() {
|
|
134
134
|
const { router } = useRouterContext();
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
|
|
135
|
+
// The base path apps prepend to build absolute in-app links (e.g. `${base}/items/${id}`). It MUST
|
|
136
|
+
// include the served `<base href>` mount so links stay on the mount and match the full
|
|
137
|
+
// `useLocation().pathname` (which carries the mount). `getMountBasename()` is '' for the
|
|
138
|
+
// origin-served Studio UI and the mount (no trailing slash) for gateway-served apps.
|
|
139
|
+
const mount = getMountBasename();
|
|
140
|
+
if (router instanceof NestedRouter) {
|
|
141
|
+
// NestedRouter.basePath is relative to the parent router, which sits at the mount, so it must
|
|
142
|
+
// be mount-prefixed too. A bare nested base of '/' (an app whose NestedRouterProvider has no
|
|
143
|
+
// basePath) would otherwise make `${base}/items` resolve to `//items` — a protocol-relative
|
|
144
|
+
// URL that escapes the app. Origin-served Studio (mount '') keeps the raw nested basePath.
|
|
145
|
+
if (!mount)
|
|
146
|
+
return router.basePath;
|
|
147
|
+
return router.basePath === '/' ? mount : joinPath(mount, router.basePath);
|
|
148
|
+
}
|
|
149
|
+
return mount;
|
|
140
150
|
}
|
|
141
151
|
export function useParams(arg) {
|
|
142
152
|
const { params } = useRouterContext();
|
package/lib/router/Router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAkD,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAwB,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAwB1G,MAAM,OAAgB,UAAU;IAC5B,4DAA4D;IAC5D,KAAK,CAAU;IACf,OAAO,GAAuB,IAAI,WAAW,EAAE,CAAC;IAChD,YAAY,MAAe,EAAE,KAAc;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAID,KAAK,CAAC,IAAY;QACd,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;QAChD,4GAA4G;QAC5G,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;CAGJ;AAED,MAAM,OAAO,MAAO,SAAQ,UAAU;IAClC,MAAM,CAAoB;IAC1B,QAAQ,CAAwC;IAChD,SAAS,GAAqB,IAAI,gBAAgB,EAAE,CAAC;IACrD,YAAY,MAAe,EAAE,WAA+C;QACxE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,CAAC,WAAW,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E,GAAG,gBAAgB,EAAE,CAAC;IACtC,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IACxC,SAAS,CAAC,GAAG,EAAE;QACX,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,OAAO,GAAG,EAAE;YACR,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC;QACjC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAExB,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;YAC5B,MAAM,QAAQ,GAAG,CAAC,EAAS,EAAE,EAAE;gBAC3B,IAAI,OAAO,EAAE,CAAC;oBACV,EAAE,CAAC,cAAc,EAAE,CAAC;oBACnB,EAAwB,CAAC,WAAW,GAAG,EAAE,CAAC;gBAC/C,CAAC;YACL,CAAC,CAAC;YACF,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAClD,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YACzD,CAAC,CAAC;QACN,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -41,7 +41,15 @@ function SigninScreenImpl({ isNested = false, lightLogo, darkLogo, preservePath,
|
|
|
41
41
|
const [pendingProvider, setPendingProvider] = useState(null);
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (!preservePath) {
|
|
44
|
-
|
|
44
|
+
// Reset to the app's mount root, not the bare origin. A gateway-mounted app carries a
|
|
45
|
+
// served `<base href>` deep mount; collapsing to '/' drops the app off that mount (the
|
|
46
|
+
// bare origin serves no app) and the address bar can no longer be reloaded. This effect
|
|
47
|
+
// also flashes briefly for already-authenticated users during the loading transition, so
|
|
48
|
+
// a bare '/' here loses the URL even on a normal login. Deriving the root from
|
|
49
|
+
// `document.baseURI` keeps it inside the mount; for the origin-served Studio UI the
|
|
50
|
+
// pathname is '/', so the behavior is unchanged.
|
|
51
|
+
const mountRoot = new URL(document.baseURI).pathname || '/';
|
|
52
|
+
history.replaceState({}, '', mountRoot);
|
|
45
53
|
}
|
|
46
54
|
}, [preservePath]);
|
|
47
55
|
// Route based on authError surfaced by the session.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SigninScreen.js","sourceRoot":"","sources":["../../../src/shell/login/SigninScreen.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,eAAoC,MAAM,mBAAmB,CAAC;AACrE,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EACH,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EAGrB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AAWvB,MAAM,UAAU,YAAY,CAAC,EACzB,aAAa,EACb,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,uBAAuB,GACP;IAChB,M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CAAkC,YAC9E,CAAC,CAAC,qBAAqB,CAAC,GACzB,EACJ,eAAM,SAAS,EAAC,aAAa,uBAAS,EACtC,KAAC,SAAS,IAAC,SAAS,EAAC,gBAAgB,GAAG,IACtC,IACJ,GACJ,GACJ,CACT,CAAC;AACN,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRef as n,useEffect as a,createContext as r,useContext as i,useState as s,useMemo as o}from"react";import{useSafeLayoutEffect as h}from"@vertesia/ui/core";class c{path;params;hash;constructor(t){let e=t.lastIndexOf("#");e>-1?(this.hash=t.substring(e),t=t.substring(0,e)):this.hash="",e=t.indexOf("?"),e>-1?(this.path=t.substring(0,e),this.params=new URLSearchParams(t.substring(e+1))):(this.path=t,this.params=new URLSearchParams)}add(t){for(const[e,n]of Object.entries(t))this.params.set(e,n);return this}toString(){return`${this.path}?${this.params.toString()}${this.hash}`}}function l(t){return"/"===t||""===t}function u(t,e){return e=t.endsWith("/")&&e.startsWith("/")?t+e.substring(1):t.endsWith("/")||e.startsWith("/")?t+e:`${t}/${e}`}function d(){if("undefined"==typeof document)return"";const t=document.querySelector("base[href]");if(!t)return"";try{return new URL(t.href,document.URL).pathname.replace(/\/+$/,"")}catch{return""}}function f(t){const e=d();return e&&t.startsWith("/")?t===e||t.startsWith(`${e}/`)?t:u(e,t):t}function m(t){const e=d();return e?t===e?"/":t.startsWith(`${e}/`)?t.slice(e.length)||"/":t:t}function p(t){if(""===t)return[];if("/"===t)return[""];let e=0,n=t.length;return t.startsWith("./")?e=2:t.startsWith("/")&&(e=1),t.endsWith("/")&&(n=t.length-1),(e>0||n<t.length?t.substring(e,n):t).split("/")}function w(t){if("string"==typeof t)return p(t);if(Array.isArray(t))return t;throw new Error(`Unsupported path object: ${t}`)}var g=Object.freeze({__proto__:null,getMountBasename:d,getPathSegments:p,isRootPath:l,joinPath:u,stripMountBasename:m,toSegments:w,withMountBasename:f});const v=Symbol("BASE_PATH");class P{name;type;location;state;_canceled=!1;constructor(t,e,n,a){this.name=t,this.type=e,this.location=n,this.state=a}get isPageLoad(){return"initial"===this.type}get isBackForward(){return"popState"===this.type}get isLinkClick(){return"linkClick"===this.type}get isNavigation(){return"navigate"===this.type}get isCancelable(){return"beforeChange"===this.name}cancel(){if("afterChange"===this.name)throw new Error("Cannot cancel afterChange event");this._canceled=!0}}class b extends P{constructor(t,e,n){super("beforeChange",t,e,n)}}class L extends P{constructor(t,e,n){super("afterChange",t,e,n)}}class y{stickyParams;_popStateListener;_linkNavListener;_listeners=[];addListener(t){this._listeners.push(t)}fireLocationChange(t){for(const e of this._listeners)e(t)}firePageLoad(){this.fireLocationChange(new L("initial",new URL(window.location.href)))}addStickyParams(t){return this.stickyParams?new c(t).add(this.stickyParams).toString():t}normalizeCurrentUrl(){if("undefined"==typeof window||!this.stickyParams)return;const t=window.location.pathname+window.location.search+window.location.hash,e=this.addStickyParams(t);if(e!==t){const t=new URL(e,window.location.href);window.history.replaceState(window.history.state,"",t.href)}}navigate(t,e={}){if(e.stepsBack&&e.stepsBack>0)this.stepBack(e.stepsBack,e);else{if(e.basePath){let n=e.basePath;n.startsWith("/")||(n=`/${n}`),t=u(n,t)}t=f(t=this.addStickyParams(t)),this._navigate(new URL(t,window.location.href),"navigate",e)}}stepBack(t,e={}){const n=window.history.state.historyChain||[],a=n.length>=t?new URL(n[n.length-t].href,window.location.href):new URL(window.location.origin,window.location.href);this._navigate(a,"popState",e);const r={from:window.location.href,historyChain:n.slice(0,-t),data:e.state||void 0,title:e.title||document.title};window.history.replaceState(r,"",a.href),this.fireLocationChange(new L("popState",a,e.state))}_navigate(t,e,n){const a=new b(e,t,n.state);if(this.fireLocationChange(a),a._canceled)return;const r=window.history.state,i={title:n.title||document.title,href:window.location.pathname+window.location.search+window.location.hash};let s=[];!n.replace&&r?.historyChain&&(s=[...r.historyChain]),n.replace||(s.push(i),s.length>10&&(s=s.slice(-10)));const o={from:window.location.href,historyChain:s,data:n.state||void 0,title:n.title||document.title};window.history[n.replace?"replaceState":"pushState"](o,"",t.href),this.fireLocationChange(new L(e,t,n.state))}start(){if("undefined"==typeof window)return;const t=t=>{let e;const n=new URL(window.location.href);let a;t.state?(e="popState",a=t.state.data):e="linkClick",this.fireLocationChange(new L(e,n,a))};this._popStateListener=t,this._linkNavListener=t=>{const e=t.target;if("a"===e.tagName.toLowerCase()&&(e.hasAttribute("download")||e.href?.startsWith("blob:")))return;const n=function(t){if(t&&"a"===t.tagName.toLowerCase()){const e=t?.href.trim();if("string"==typeof e&&e.length>0)return new URL(e)}return null}(e);if(n&&n.origin===window.location.origin){t.preventDefault();const e=new URL(this.addStickyParams(n.href)),a=t[v]||t.target[v];a&&(e.pathname=u(a,e.pathname)),this._navigate(e,"linkClick",{})}},window.addEventListener("popstate",t),document.body.addEventListener("click",this._linkNavListener)}stop(){this._popStateListener&&window.removeEventListener("popstate",this._popStateListener),this._linkNavListener&&document.body.removeEventListener("click",this._linkNavListener)}}function k({basePath:e,children:r}){const i=n(null);return a(()=>{if(i.current){const t=i.current,n=t=>{"a"===t.target.tagName.toLowerCase()&&(t[v]=e)};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}},[e]),t("div",{ref:i,className:"h-full w-full",children:r})}class S{tree=new _;loadMapping(t){for(const[e,n]of Object.entries(t))this.addSegments(p(e),n)}addPath(t,e){this.addSegments(p(t),e)}addSegments(t,e){let n=this.tree;for(let a=0,r=t.length;a<r;a++){const i=t[a];if(":"===i[0]){let e=n.wildcard;if(e){if(!(e instanceof x))throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard ":" segment will overwrite an existing wildcard segment at path: /${t.slice(0,a).join("/")}`)}else e=new x(i),n.wildcard=e;n=e}else{if("*"===i){if(n.wildcard)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard "*" segment already exists at path: /${t.slice(0,a).join("/")}`);if(n.wildcard=new $(i,e),a<r-1)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard segment must be the last segment`);return}{let t=n.children[i];t||(t=new R(i),n.children[i]=t),n=t}}}if(void 0!==n.value)throw new Error(`Failed to index path segments: ${t.join("/")}. A value already exists at path: /${t.join("/")}`);n.value=e}match(t){const e=w(t);if(0===e.length)return null;const n={};let a,r,i=this.tree;for(const t of e){const e=i.match(t,n);if(!e)return null;i=e}if(!i.value){if(i instanceof C&&i.wildcard instanceof $&&(i=i.wildcard.match("",n),!i.value))throw new Error("Wildcard segment node `*` must have a value");if(!i.value)return null}return n._&&n._.length>0?(a=e.slice(0,-n._.length),r=n._):a=e,{params:n,matchedSegments:a,remainingSegments:r,value:i.value}}}class C{name;value;children={};wildcard;constructor(t,e){this.name=t,this.value=e}match(t,e){const n=this.children[t];if(n)return n;if(this.wildcard){if(this.wildcard instanceof $)return this.wildcard.match(t,e);if(this.wildcard instanceof x)return e[this.wildcard.paramName]=t,this.wildcard;throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`)}return null}}class _ extends C{constructor(){super("#root")}}class R extends C{}class x extends C{paramName;constructor(t,e){super(t,e),this.paramName=t.substring(1)}}class ${name;value;constructor(t,e){this.name=t,this.value=e}match(t,e){return e._?t&&e._.push(t):e._=t?[t]:[],this}}class E{index;matcher=new S;constructor(t,e){this.index=e;for(const e of t)this.matcher.addPath(e.path,e)}match(t){const e=l(t)&&this.index;return this.matcher.match(e?this.index:t)}}class N extends E{prompt;observer;navigator=new y;constructor(t,e){super(t),this.navigator.addListener(t=>{if((!t.isCancelable||!this.prompt?.when||window.confirm(this.prompt.message))&&(this.observer&&this.observer(t),"afterChange"===t.name)){const n=this.match(m(t.location.pathname));e(n?.value?{...n,state:t.state}:null)}})}getTopRouter(){return this}setStickyParams(t){this.navigator.stickyParams=null!=t?t:void 0,this.navigator.normalizeCurrentUrl()}withObserver(t){return this.observer=t,this}start(){this.navigator.start(),this.navigator.firePageLoad()}stop(){this.navigator.stop()}navigate(t,e){this.navigator.navigate(t,e)}}class j extends E{parent;basePath;constructor(t,e,n){super(n),this.parent=t,this.basePath=e}getTopRouter(){return this.parent instanceof N?this.parent:this.parent.getTopRouter()}navigate(t,e){let n;if(e?.isBasePathNested??!0){const a=e?.basePath;n=a?u(this.basePath,a):this.basePath,this.parent.navigate(t,{...e,basePath:n})}else this.parent.navigate(t,{...e,basePath:e?.basePath})}}const U=r(void 0);function W(){const t=i(U);if(!t)throw new Error("useRouter must be used within a RouterProvider");return t}function B(){const{navigate:t}=W();return t}function A(){const{router:t}=W();return t instanceof j?t.basePath:d()}function z(t){const{params:e}=W();return t?e[t]:e}function O(){const{location:t}=W();return t}function T(t){a(()=>{const e=document.title;return document.title=t,()=>{document.title=e}},[t])}function F(t){const{router:e}=W(),n=e.getTopRouter();a(()=>(n.prompt=t,()=>{n.prompt=void 0}),[t,n]),a(()=>{if(t.when){const e=t.when,n=t=>{e&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}}},[t.when])}function D({children:e,to:n,onClick:a,replace:r=!0}){const i=B();return t("span",{onClick:t=>{const e=t.target.closest("a"),s=e?.getAttribute("href"),o=n??s;e&&o&&(t.stopPropagation(),t.preventDefault(),i(o,{replace:r}),a?.(t))},children:e})}function M({children:e,href:n,className:a,target:r,topLevelNav:i,clearBreadcrumbs:s=!1,replace:o,skipStickyParams:h}){const{router:c}=W(),l=!n||n.startsWith("#"),u=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("//")||!!r&&"_self"!==r,d=!l&&!u,m=d?f(h?n:c.getTopRouter().navigator.addStickyParams(n)):n;return t("a",{href:m,className:a,target:r,onClick:t=>{if(t.defaultPrevented||!d)return;t.stopPropagation(),t.preventDefault();(i?c.getTopRouter():c).navigate(n,{replace:o??s})},children:e})}function I({spinner:e}){const n=W(),a=n.route;if(a.Component){const e=a.Component;return t(e,{...n.params})}if(a.LazyComponent)return t(q,{route:a,spinner:e});throw new Error(`Invalid route for ${a.path}. Either Component or LazyCOmponent must be specified.`)}function q({route:e,spinner:n}){const[r,i]=s(null);return a(()=>{e.LazyComponent().then(t=>{if(!t.default)throw new Error(`Lazy module for ${e.path} does not have a default export`);i(()=>t.default)})},[e]),r?t(r,{}):n||null}function H({basePath:e,fixLinks:n=!1,children:a}){const r=W(),i=n?e=>t(k,{basePath:r.matchedRoutePath,children:e}):t=>t;return t(U.Provider,{value:{...r,navigate:(t,n)=>{if(!1===n?.isBasePathNested)return r.navigate(t,n);const a=n?.basePath?u(e,n.basePath):e;return r.navigate(t,{...n,basePath:a})}},children:i(a||t(I,{}))})}function V(){const t=W();return e("div",{children:["Route not found for path ",t.matchedRoutePath]})}function G(){return{params:{},matchedSegments:[],state:null,value:{path:"virtual:404",Component:()=>t(V,{})}}}function J({routes:e,index:a,children:r,fixLinks:i=!1}){const s=W(),h=n(s.matchedRoutePath),c=o(()=>{if("undefined"==typeof window)return null;const t=new j(s.router,h.current,e);return t.index=a,t},[s.router,a,e]),l=o(()=>{if(c&&s.matchedRoutePath===c.basePath)return c.match(s.remainingPath||"/")||G()},[s.matchedRoutePath,s.remainingPath,c]),u=i?e=>t(k,{basePath:s.matchedRoutePath,children:e}):t=>t;return l&&t(U.Provider,{value:{...s,router:c,route:l.value,params:l.params,matchedRoutePath:`/${l.matchedSegments.join("/")}`,remainingPath:l.remainingSegments?`/${l.remainingSegments.join("/")}`:void 0,navigate:(t,e)=>{if(c)return c.navigate(t,e)}},children:u(r||t(I,{}))})}function K({routes:e,index:n,onChange:a,children:r}){const[i,c]=s(void 0),l=o(()=>{if("undefined"==typeof window)return null;const t=new N(e,e=>{null===e&&(e=G()),c({location:window.location,route:e.value,params:e.params,state:e.state,router:t,matchedRoutePath:`/${e.matchedSegments.join("/")}`,remainingPath:e.remainingSegments?`/${e.remainingSegments.join("/")}`:void 0,navigate:(e,n)=>t.navigate(e,n)})}).withObserver(a);return t.index=n,t},[n,a,e]);return h(()=>(l?.start(),()=>{l?.stop()}),[l]),i&&t(U.Provider,{value:i,children:r||t(I,{})})}export{L as AfterLocationChangeEvent,v as BASE_PATH,E as BaseRouter,b as BeforeLocationChangeEvent,k as FixLinks,y as HistoryNavigator,P as LocationChangeEvent,D as Nav,M as NavLink,H as NestedNavigationContext,j as NestedRouter,J as NestedRouterProvider,g as Path,S as PathMatcher,U as ReactRouterContext,I as RouteComponent,N as Router,K as RouterProvider,O as useLocation,B as useNavigate,F as useNavigationPrompt,T as usePageTitle,z as useParams,A as useRouterBasePath,W as useRouterContext};
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRef as n,useEffect as a,createContext as r,useContext as i,useState as s,useMemo as o}from"react";import{useSafeLayoutEffect as h}from"@vertesia/ui/core";class c{path;params;hash;constructor(t){let e=t.lastIndexOf("#");e>-1?(this.hash=t.substring(e),t=t.substring(0,e)):this.hash="",e=t.indexOf("?"),e>-1?(this.path=t.substring(0,e),this.params=new URLSearchParams(t.substring(e+1))):(this.path=t,this.params=new URLSearchParams)}add(t){for(const[e,n]of Object.entries(t))this.params.set(e,n);return this}toString(){return`${this.path}?${this.params.toString()}${this.hash}`}}function l(t){return"/"===t||""===t}function u(t,e){return e=t.endsWith("/")&&e.startsWith("/")?t+e.substring(1):t.endsWith("/")||e.startsWith("/")?t+e:`${t}/${e}`}function d(){if("undefined"==typeof document)return"";const t=document.querySelector("base[href]");if(!t)return"";try{return new URL(t.href,document.URL).pathname.replace(/\/+$/,"")}catch{return""}}function f(t){const e=d();return e&&t.startsWith("/")?t===e||t.startsWith(`${e}/`)?t:u(e,t):t}function m(t){const e=d();return e?t===e?"/":t.startsWith(`${e}/`)?t.slice(e.length)||"/":t:t}function p(t){if(""===t)return[];if("/"===t)return[""];let e=0,n=t.length;return t.startsWith("./")?e=2:t.startsWith("/")&&(e=1),t.endsWith("/")&&(n=t.length-1),(e>0||n<t.length?t.substring(e,n):t).split("/")}function w(t){if("string"==typeof t)return p(t);if(Array.isArray(t))return t;throw new Error(`Unsupported path object: ${t}`)}var g=Object.freeze({__proto__:null,getMountBasename:d,getPathSegments:p,isRootPath:l,joinPath:u,stripMountBasename:m,toSegments:w,withMountBasename:f});const v=Symbol("BASE_PATH");class P{name;type;location;state;_canceled=!1;constructor(t,e,n,a){this.name=t,this.type=e,this.location=n,this.state=a}get isPageLoad(){return"initial"===this.type}get isBackForward(){return"popState"===this.type}get isLinkClick(){return"linkClick"===this.type}get isNavigation(){return"navigate"===this.type}get isCancelable(){return"beforeChange"===this.name}cancel(){if("afterChange"===this.name)throw new Error("Cannot cancel afterChange event");this._canceled=!0}}class b extends P{constructor(t,e,n){super("beforeChange",t,e,n)}}class L extends P{constructor(t,e,n){super("afterChange",t,e,n)}}class y{stickyParams;_popStateListener;_linkNavListener;_listeners=[];addListener(t){this._listeners.push(t)}fireLocationChange(t){for(const e of this._listeners)e(t)}firePageLoad(){this.fireLocationChange(new L("initial",new URL(window.location.href)))}addStickyParams(t){return this.stickyParams?new c(t).add(this.stickyParams).toString():t}normalizeCurrentUrl(){if("undefined"==typeof window||!this.stickyParams)return;const t=window.location.pathname+window.location.search+window.location.hash,e=this.addStickyParams(t);if(e!==t){const t=new URL(e,window.location.href);window.history.replaceState(window.history.state,"",t.href)}}navigate(t,e={}){if(e.stepsBack&&e.stepsBack>0)this.stepBack(e.stepsBack,e);else{if(e.basePath){let n=e.basePath;n.startsWith("/")||(n=`/${n}`),t=u(n,t)}t=f(t=this.addStickyParams(t)),this._navigate(new URL(t,window.location.href),"navigate",e)}}stepBack(t,e={}){const n=window.history.state.historyChain||[],a=n.length>=t?new URL(n[n.length-t].href,window.location.href):new URL(window.location.origin,window.location.href);this._navigate(a,"popState",e);const r={from:window.location.href,historyChain:n.slice(0,-t),data:e.state||void 0,title:e.title||document.title};window.history.replaceState(r,"",a.href),this.fireLocationChange(new L("popState",a,e.state))}_navigate(t,e,n){const a=new b(e,t,n.state);if(this.fireLocationChange(a),a._canceled)return;const r=window.history.state,i={title:n.title||document.title,href:window.location.pathname+window.location.search+window.location.hash};let s=[];!n.replace&&r?.historyChain&&(s=[...r.historyChain]),n.replace||(s.push(i),s.length>10&&(s=s.slice(-10)));const o={from:window.location.href,historyChain:s,data:n.state||void 0,title:n.title||document.title};window.history[n.replace?"replaceState":"pushState"](o,"",t.href),this.fireLocationChange(new L(e,t,n.state))}start(){if("undefined"==typeof window)return;const t=t=>{let e;const n=new URL(window.location.href);let a;t.state?(e="popState",a=t.state.data):e="linkClick",this.fireLocationChange(new L(e,n,a))};this._popStateListener=t,this._linkNavListener=t=>{const e=t.target;if("a"===e.tagName.toLowerCase()&&(e.hasAttribute("download")||e.href?.startsWith("blob:")))return;const n=function(t){if(t&&"a"===t.tagName.toLowerCase()){const e=t?.href.trim();if("string"==typeof e&&e.length>0)return new URL(e)}return null}(e);if(n&&n.origin===window.location.origin){t.preventDefault();const e=new URL(this.addStickyParams(n.href)),a=t[v]||t.target[v];a&&(e.pathname=u(a,e.pathname)),this._navigate(e,"linkClick",{})}},window.addEventListener("popstate",t),document.body.addEventListener("click",this._linkNavListener)}stop(){this._popStateListener&&window.removeEventListener("popstate",this._popStateListener),this._linkNavListener&&document.body.removeEventListener("click",this._linkNavListener)}}function k({basePath:e,children:r}){const i=n(null);return a(()=>{if(i.current){const t=i.current,n=t=>{"a"===t.target.tagName.toLowerCase()&&(t[v]=e)};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}},[e]),t("div",{ref:i,className:"h-full w-full",children:r})}class S{tree=new _;loadMapping(t){for(const[e,n]of Object.entries(t))this.addSegments(p(e),n)}addPath(t,e){this.addSegments(p(t),e)}addSegments(t,e){let n=this.tree;for(let a=0,r=t.length;a<r;a++){const i=t[a];if(":"===i[0]){let e=n.wildcard;if(e){if(!(e instanceof x))throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard ":" segment will overwrite an existing wildcard segment at path: /${t.slice(0,a).join("/")}`)}else e=new x(i),n.wildcard=e;n=e}else{if("*"===i){if(n.wildcard)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard "*" segment already exists at path: /${t.slice(0,a).join("/")}`);if(n.wildcard=new $(i,e),a<r-1)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard segment must be the last segment`);return}{let t=n.children[i];t||(t=new R(i),n.children[i]=t),n=t}}}if(void 0!==n.value)throw new Error(`Failed to index path segments: ${t.join("/")}. A value already exists at path: /${t.join("/")}`);n.value=e}match(t){const e=w(t);if(0===e.length)return null;const n={};let a,r,i=this.tree;for(const t of e){const e=i.match(t,n);if(!e)return null;i=e}if(!i.value){if(i instanceof C&&i.wildcard instanceof $&&(i=i.wildcard.match("",n),!i.value))throw new Error("Wildcard segment node `*` must have a value");if(!i.value)return null}return n._&&n._.length>0?(a=e.slice(0,-n._.length),r=n._):a=e,{params:n,matchedSegments:a,remainingSegments:r,value:i.value}}}class C{name;value;children={};wildcard;constructor(t,e){this.name=t,this.value=e}match(t,e){const n=this.children[t];if(n)return n;if(this.wildcard){if(this.wildcard instanceof $)return this.wildcard.match(t,e);if(this.wildcard instanceof x)return e[this.wildcard.paramName]=t,this.wildcard;throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`)}return null}}class _ extends C{constructor(){super("#root")}}class R extends C{}class x extends C{paramName;constructor(t,e){super(t,e),this.paramName=t.substring(1)}}class ${name;value;constructor(t,e){this.name=t,this.value=e}match(t,e){return e._?t&&e._.push(t):e._=t?[t]:[],this}}class E{index;matcher=new S;constructor(t,e){this.index=e;for(const e of t)this.matcher.addPath(e.path,e)}match(t){const e=l(t)&&this.index;return this.matcher.match(e?this.index:t)}}class N extends E{prompt;observer;navigator=new y;constructor(t,e){super(t),this.navigator.addListener(t=>{if((!t.isCancelable||!this.prompt?.when||window.confirm(this.prompt.message))&&(this.observer&&this.observer(t),"afterChange"===t.name)){const n=this.match(m(t.location.pathname));e(n?.value?{...n,state:t.state}:null)}})}getTopRouter(){return this}setStickyParams(t){this.navigator.stickyParams=null!=t?t:void 0,this.navigator.normalizeCurrentUrl()}withObserver(t){return this.observer=t,this}start(){this.navigator.start(),this.navigator.firePageLoad()}stop(){this.navigator.stop()}navigate(t,e){this.navigator.navigate(t,e)}}class j extends E{parent;basePath;constructor(t,e,n){super(n),this.parent=t,this.basePath=e}getTopRouter(){return this.parent instanceof N?this.parent:this.parent.getTopRouter()}navigate(t,e){let n;if(e?.isBasePathNested??!0){const a=e?.basePath;n=a?u(this.basePath,a):this.basePath,this.parent.navigate(t,{...e,basePath:n})}else this.parent.navigate(t,{...e,basePath:e?.basePath})}}const U=r(void 0);function W(){const t=i(U);if(!t)throw new Error("useRouter must be used within a RouterProvider");return t}function B(){const{navigate:t}=W();return t}function A(){const{router:t}=W(),e=d();return t instanceof j?e?"/"===t.basePath?e:u(e,t.basePath):t.basePath:e}function z(t){const{params:e}=W();return t?e[t]:e}function O(){const{location:t}=W();return t}function T(t){a(()=>{const e=document.title;return document.title=t,()=>{document.title=e}},[t])}function F(t){const{router:e}=W(),n=e.getTopRouter();a(()=>(n.prompt=t,()=>{n.prompt=void 0}),[t,n]),a(()=>{if(t.when){const e=t.when,n=t=>{e&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}}},[t.when])}function D({children:e,to:n,onClick:a,replace:r=!0}){const i=B();return t("span",{onClick:t=>{const e=t.target.closest("a"),s=e?.getAttribute("href"),o=n??s;e&&o&&(t.stopPropagation(),t.preventDefault(),i(o,{replace:r}),a?.(t))},children:e})}function M({children:e,href:n,className:a,target:r,topLevelNav:i,clearBreadcrumbs:s=!1,replace:o,skipStickyParams:h}){const{router:c}=W(),l=!n||n.startsWith("#"),u=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("//")||!!r&&"_self"!==r,d=!l&&!u,m=d?f(h?n:c.getTopRouter().navigator.addStickyParams(n)):n;return t("a",{href:m,className:a,target:r,onClick:t=>{if(t.defaultPrevented||!d)return;t.stopPropagation(),t.preventDefault();(i?c.getTopRouter():c).navigate(n,{replace:o??s})},children:e})}function I({spinner:e}){const n=W(),a=n.route;if(a.Component){const e=a.Component;return t(e,{...n.params})}if(a.LazyComponent)return t(q,{route:a,spinner:e});throw new Error(`Invalid route for ${a.path}. Either Component or LazyCOmponent must be specified.`)}function q({route:e,spinner:n}){const[r,i]=s(null);return a(()=>{e.LazyComponent().then(t=>{if(!t.default)throw new Error(`Lazy module for ${e.path} does not have a default export`);i(()=>t.default)})},[e]),r?t(r,{}):n||null}function H({basePath:e,fixLinks:n=!1,children:a}){const r=W(),i=n?e=>t(k,{basePath:r.matchedRoutePath,children:e}):t=>t;return t(U.Provider,{value:{...r,navigate:(t,n)=>{if(!1===n?.isBasePathNested)return r.navigate(t,n);const a=n?.basePath?u(e,n.basePath):e;return r.navigate(t,{...n,basePath:a})}},children:i(a||t(I,{}))})}function V(){const t=W();return e("div",{children:["Route not found for path ",t.matchedRoutePath]})}function G(){return{params:{},matchedSegments:[],state:null,value:{path:"virtual:404",Component:()=>t(V,{})}}}function J({routes:e,index:a,children:r,fixLinks:i=!1}){const s=W(),h=n(s.matchedRoutePath),c=o(()=>{if("undefined"==typeof window)return null;const t=new j(s.router,h.current,e);return t.index=a,t},[s.router,a,e]),l=o(()=>{if(c&&s.matchedRoutePath===c.basePath)return c.match(s.remainingPath||"/")||G()},[s.matchedRoutePath,s.remainingPath,c]),u=i?e=>t(k,{basePath:s.matchedRoutePath,children:e}):t=>t;return l&&t(U.Provider,{value:{...s,router:c,route:l.value,params:l.params,matchedRoutePath:`/${l.matchedSegments.join("/")}`,remainingPath:l.remainingSegments?`/${l.remainingSegments.join("/")}`:void 0,navigate:(t,e)=>{if(c)return c.navigate(t,e)}},children:u(r||t(I,{}))})}function K({routes:e,index:n,onChange:a,children:r}){const[i,c]=s(void 0),l=o(()=>{if("undefined"==typeof window)return null;const t=new N(e,e=>{null===e&&(e=G()),c({location:window.location,route:e.value,params:e.params,state:e.state,router:t,matchedRoutePath:`/${e.matchedSegments.join("/")}`,remainingPath:e.remainingSegments?`/${e.remainingSegments.join("/")}`:void 0,navigate:(e,n)=>t.navigate(e,n)})}).withObserver(a);return t.index=n,t},[n,a,e]);return h(()=>(l?.start(),()=>{l?.stop()}),[l]),i&&t(U.Provider,{value:i,children:r||t(I,{})})}export{L as AfterLocationChangeEvent,v as BASE_PATH,E as BaseRouter,b as BeforeLocationChangeEvent,k as FixLinks,y as HistoryNavigator,P as LocationChangeEvent,D as Nav,M as NavLink,H as NestedNavigationContext,j as NestedRouter,J as NestedRouterProvider,g as Path,S as PathMatcher,U as ReactRouterContext,I as RouteComponent,N as Router,K as RouterProvider,O as useLocation,B as useNavigate,F as useNavigationPrompt,T as usePageTitle,z as useParams,A as useRouterBasePath,W as useRouterContext};
|
|
2
2
|
//# sourceMappingURL=vertesia-ui-router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertesia-ui-router.js","sources":["router/PathWithParams.js","router/path.js","router/HistoryNavigator.js","router/FixLinks.js","router/PathMatcher.js","router/Router.js","router/Nav.js","router/RouteComponent.js","router/NestedNavigationContext.js","router/Route404.js","router/NestedRouterProvider.js","router/RouterProvider.js"],"sourcesContent":["export class PathWithParams {\n path;\n params;\n hash;\n constructor(path) {\n let i = path.lastIndexOf('#');\n if (i > -1) {\n this.hash = path.substring(i);\n path = path.substring(0, i);\n }\n else {\n this.hash = '';\n }\n i = path.indexOf('?');\n if (i > -1) {\n this.path = path.substring(0, i);\n this.params = new URLSearchParams(path.substring(i + 1));\n }\n else {\n this.path = path;\n this.params = new URLSearchParams();\n }\n }\n add(params) {\n for (const [key, value] of Object.entries(params)) {\n this.params.set(key, value);\n }\n return this;\n }\n toString() {\n return `${this.path}?${this.params.toString()}${this.hash}`;\n }\n}\n//# sourceMappingURL=PathWithParams.js.map","export function isRootPath(path) {\n return path === '/' || path === '';\n}\nexport function joinPath(path1, path2) {\n if (path1.endsWith('/') && path2.startsWith('/')) {\n path2 = path1 + path2.substring(1);\n }\n else if (path1.endsWith('/')) {\n path2 = path1 + path2;\n }\n else if (path2.startsWith('/')) {\n path2 = path1 + path2;\n }\n else {\n path2 = `${path1}/${path2}`;\n }\n return path2;\n}\n/**\n * The mount base path from an explicit `<base href>` element, or `''` when there is none.\n *\n * Apps served under a deep gateway mount carry `<base href=\"/tenants/.../app/\">`, injected at serve\n * time. The router otherwise resolves absolute routes against the origin, which collapses the URL\n * off the mount (and breaks in-app links). This returns the base pathname without a trailing slash\n * so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}\n * can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and\n * every caller becomes a no-op there.\n */\nexport function getMountBasename() {\n if (typeof document === 'undefined')\n return '';\n const base = document.querySelector('base[href]');\n if (!base)\n return '';\n try {\n return new URL(base.href, document.URL).pathname.replace(/\\/+$/, '');\n }\n catch {\n return '';\n }\n}\n/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */\nexport function withMountBasename(path) {\n const base = getMountBasename();\n if (!base || !path.startsWith('/'))\n return path;\n if (path === base || path.startsWith(`${base}/`))\n return path;\n return joinPath(base, path);\n}\n/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */\nexport function stripMountBasename(path) {\n const base = getMountBasename();\n if (!base)\n return path;\n if (path === base)\n return '/';\n if (path.startsWith(`${base}/`))\n return path.slice(base.length) || '/';\n return path;\n}\nexport function getPathSegments(path) {\n if (path === '') {\n return [];\n }\n if (path === '/') {\n return [''];\n }\n let s = 0, e = path.length;\n if (path.startsWith('./')) {\n s = 2;\n }\n else if (path.startsWith('/')) {\n s = 1;\n }\n if (path.endsWith('/')) {\n e = path.length - 1;\n }\n return (s > 0 || e < path.length ? path.substring(s, e) : path).split('/');\n}\nexport function toSegments(path) {\n if (typeof path === 'string') {\n return getPathSegments(path);\n }\n else if (Array.isArray(path)) {\n return path;\n }\n else {\n throw new Error(`Unsupported path object: ${path}`);\n }\n}\n// export class Path {\n// static parse(path: string, abs = false) {\n// if (abs !== undefined) {\n// abs = path.startsWith('/');\n// }\n// return new Path(getPathSegments(path), abs);\n// }\n// constructor(public segments: string[], public isAbsolute = false) {\n// }\n// getParameters() {\n// const out = [];\n// for (const segment of this.segments) {\n// if (segment[0] === ':') {\n// out.push(segment.substring(1));\n// }\n// }\n// if (this.segments[this.segments.length - 1] === '*') {\n// out.push('_');\n// }\n// return out;\n// }\n// resolveParameters(path: string) {\n// const params: PathMatchParams = {};\n// const resolvedSegments = getPathSegments(path);\n// if (resolvedSegments.length < this.segments.length) {\n// return null;\n// }\n// const segments = this.segments;\n// for (let i = 0, l = segments.length; i < l; i++) {\n// const seg = segments[i];\n// if (seg[0] === ':') {\n// params[seg.substring(1)] = resolvedSegments[i];\n// }\n// }\n// if (resolvedSegments.length - this.segments.length) {\n// params._ = resolvedSegments.slice(this.segments.length);\n// }\n// return params;\n// }\n// match(path: string | string[] | Path) {\n// const segments = toSegments(path);\n// if (segments.length < this.segments.length) {\n// return false;\n// }\n// let params: PathMatchParams | undefined;\n// const mySegments = this.segments;\n// for (let i = 0, l = mySegments.length; i < l; i++) {\n// const segment = mySegments[i];\n// if (segment === ':') {\n// if (!params) params = {};\n// params[segment.substring(1)] = segment;\n// } else if (segment !== segments[i]) {\n// if (i === l - 1 && segment === '*') {\n// if (!params) params = {};\n// params._ = segments.slice(i);\n// return params;\n// }\n// return false;\n// }\n// }\n// return params ? params : false;\n// }\n// join(path: Path | string | string[]) {\n// const segments = toSegments(path);\n// return new Path(this.segments.concat(segments), this.isAbsolute);\n// }\n// getRelativePath(path: Path | string | string[], asAbsolute: boolean = false) {\n// const segments = toSegments(path);\n// const extraSegmentsCount = segments.length - this.segments.length;\n// if (extraSegmentsCount <= 0) {\n// return null;\n// }\n// return new Path(segments.slice(this.segments.length), asAbsolute);\n// }\n// prependSegments(segments: string[]) {\n// this.segments = segments.concat(this.segments);\n// }\n// appendSegments(segments: string[]) {\n// this.segments = this.segments.concat(segments);\n// }\n// toAbsolutePath() {\n// return '/' + this.segments.join('/');\n// }\n// toRelativePath() {\n// return this.segments.join('/');\n// }\n// toString() {\n// const path = this.segments.join('/');\n// return this.isAbsolute ? '/' + path : path;\n// }\n// }\n//# sourceMappingURL=path.js.map","import { PathWithParams } from './PathWithParams';\nimport { joinPath, withMountBasename } from './path';\nconst BASE_PATH = Symbol('BASE_PATH');\nexport { BASE_PATH };\nexport class LocationChangeEvent {\n name;\n type;\n location;\n state;\n _canceled = false;\n constructor(name, type, location, state) {\n this.name = name;\n this.type = type;\n this.location = location;\n this.state = state;\n }\n get isPageLoad() {\n return this.type === 'initial';\n }\n get isBackForward() {\n return this.type === 'popState';\n }\n get isLinkClick() {\n return this.type === 'linkClick';\n }\n get isNavigation() {\n return this.type === 'navigate';\n }\n get isCancelable() {\n return this.name === 'beforeChange';\n }\n cancel() {\n if (this.name === 'afterChange') {\n throw new Error('Cannot cancel afterChange event');\n }\n this._canceled = true;\n }\n}\nexport class BeforeLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('beforeChange', type, location, state);\n }\n}\nexport class AfterLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('afterChange', type, location, state);\n }\n}\nfunction getElementHrefAsUrl(elem) {\n if (elem && elem.tagName.toLowerCase() === 'a') {\n const href = elem?.href.trim();\n if (typeof href === 'string' && href.length > 0) {\n return new URL(href);\n }\n }\n return null;\n}\nexport class HistoryNavigator {\n // params to preserve in the query string when navigating\n stickyParams;\n _popStateListener;\n _linkNavListener;\n _listeners = [];\n addListener(listener) {\n this._listeners.push(listener);\n }\n fireLocationChange(event) {\n for (const listener of this._listeners) {\n listener(event);\n }\n }\n /**\n * Should be called when the page is first loaded.\n * It will fire a location change event with type `initial` and the current window.location as the location\n */\n firePageLoad() {\n this.fireLocationChange(new AfterLocationChangeEvent('initial', new URL(window.location.href)));\n }\n addStickyParams(path) {\n if (this.stickyParams) {\n return new PathWithParams(path).add(this.stickyParams).toString();\n }\n return path;\n }\n /**\n * Rewrite the current browser URL in place so that the sticky params are present, without\n * navigating. Used on load / when the params first become known so the address bar reflects\n * the active account/project before the first navigation.\n *\n * Idempotent and side-effect-light: only calls replaceState when the URL would actually\n * change, preserves the existing history state, and never fires a location-change event\n * (so there is no route re-match or component remount).\n */\n normalizeCurrentUrl() {\n if (typeof window === 'undefined' || !this.stickyParams) {\n return;\n }\n const current = window.location.pathname + window.location.search + window.location.hash;\n const normalized = this.addStickyParams(current);\n if (normalized !== current) {\n const to = new URL(normalized, window.location.href);\n window.history.replaceState(window.history.state, '', to.href);\n }\n }\n navigate(to, options = {}) {\n if (options.stepsBack && options.stepsBack > 0) {\n this.stepBack(options.stepsBack, options);\n return;\n }\n if (options.basePath) {\n let basePath = options.basePath;\n if (!basePath.startsWith('/')) {\n basePath = `/${basePath}`;\n }\n to = joinPath(basePath, to);\n }\n to = this.addStickyParams(to);\n // Keep absolute app routes under the served `<base href>` mount instead of resolving them\n // against the bare origin (which collapses the URL off the mount). No-op when origin-served.\n to = withMountBasename(to);\n this._navigate(new URL(to, window.location.href), 'navigate', options);\n }\n stepBack(steps, options = {}) {\n const historyChain = window.history.state.historyChain || [];\n const to = historyChain.length >= steps\n ? new URL(historyChain[historyChain.length - steps].href, window.location.href)\n : new URL(window.location.origin, window.location.href);\n this._navigate(to, 'popState', options);\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain.slice(0, -steps),\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history.replaceState(stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent('popState', to, options.state));\n }\n _navigate(to, type, options) {\n const beforeEvent = new BeforeLocationChangeEvent(type, to, options.state);\n this.fireLocationChange(beforeEvent);\n if (beforeEvent._canceled) {\n return;\n }\n // Build navigation chain by preserving previous history\n const currentState = window.history.state;\n const currentTitle = options.title || document.title;\n // Create new history chain entry\n const newChainEntry = {\n title: currentTitle,\n href: window.location.pathname + window.location.search + window.location.hash,\n };\n // Build the history chain - clear if using replace\n let historyChain = [];\n if (!options.replace && currentState?.historyChain) {\n historyChain = [...currentState.historyChain];\n }\n // Only add to chain if not replacing\n if (!options.replace) {\n historyChain.push(newChainEntry);\n // Limit chain length to prevent memory issues (keep last 10 entries)\n if (historyChain.length > 10) {\n historyChain = historyChain.slice(-10);\n }\n }\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain,\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history[options.replace ? 'replaceState' : 'pushState'](stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, options.state));\n }\n start() {\n if (typeof window === 'undefined') {\n return;\n }\n const _popStateListener = (ev) => {\n let type;\n const to = new URL(window.location.href);\n let state;\n if (ev.state) {\n type = 'popState';\n state = ev.state.data;\n }\n else {\n type = 'linkClick';\n }\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, state));\n };\n const _linkNavListener = (ev) => {\n const target = ev.target;\n // Skip anchors with download attribute or blob: URLs - they are file downloads, not navigation\n if (target.tagName.toLowerCase() === 'a' &&\n (target.hasAttribute('download') ||\n target.href?.startsWith('blob:'))) {\n return;\n }\n const url = getElementHrefAsUrl(target);\n if (url && url.origin === window.location.origin) {\n ev.preventDefault();\n const to = new URL(this.addStickyParams(url.href));\n const basePath = ev[BASE_PATH] ||\n ev.target[BASE_PATH];\n if (basePath) {\n to.pathname = joinPath(basePath, to.pathname);\n }\n this._navigate(to, 'linkClick', {});\n }\n };\n this._popStateListener = _popStateListener;\n this._linkNavListener = _linkNavListener;\n window.addEventListener('popstate', _popStateListener);\n document.body.addEventListener('click', this._linkNavListener);\n }\n stop() {\n if (this._popStateListener)\n window.removeEventListener('popstate', this._popStateListener);\n if (this._linkNavListener)\n document.body.removeEventListener('click', this._linkNavListener);\n }\n}\n//# sourceMappingURL=HistoryNavigator.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from 'react';\nimport { BASE_PATH } from './HistoryNavigator';\nexport function FixLinks({ basePath, children }) {\n const ref = useRef(null);\n useEffect(() => {\n if (ref.current) {\n const divElem = ref.current;\n const listener = (ev) => {\n const elem = ev.target;\n if (elem.tagName.toLowerCase() === 'a') {\n ev[BASE_PATH] = basePath;\n }\n };\n divElem.addEventListener('click', listener);\n return () => {\n divElem.removeEventListener('click', listener);\n };\n }\n }, [basePath]);\n return (_jsx(\"div\", { ref: ref, className: \"h-full w-full\", children: children }));\n}\n//# sourceMappingURL=FixLinks.js.map","import { getPathSegments, toSegments } from './path';\n/**\n * Path matcher which support :param and *wildcard segments.\n * The wildcard segment is only supported as the last segment\n */\nexport class PathMatcher {\n tree = new RootSegmentNode();\n loadMapping(mapping) {\n for (const [key, value] of Object.entries(mapping)) {\n this.addSegments(getPathSegments(key), value);\n }\n }\n addPath(path, value) {\n this.addSegments(getPathSegments(path), value);\n }\n addSegments(segments, value) {\n let node = this.tree;\n for (let i = 0, l = segments.length; i < l; i++) {\n const segment = segments[i];\n if (segment[0] === ':') {\n let childNode = node.wildcard;\n if (!childNode) {\n childNode = new VariableSegmentNode(segment);\n node.wildcard = childNode;\n }\n else if (!(childNode instanceof VariableSegmentNode)) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \":\" segment will overwrite an existing wildcard segment at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node = childNode;\n }\n else if (segment === '*') {\n if (node.wildcard) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \"*\" segment already exists at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node.wildcard = new WildcardSegmentNode(segment, value);\n if (i < l - 1) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard segment must be the last segment`);\n }\n return;\n }\n else {\n let childNode = node.children[segment];\n if (!childNode) {\n childNode = new LiteralSegmentNode(segment);\n node.children[segment] = childNode;\n } // else // a literal segment already exists\n node = childNode;\n }\n }\n if (node.value !== undefined) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A value already exists at path: ${`/${segments.join('/')}`}`);\n }\n node.value = value;\n }\n match(path) {\n const segments = toSegments(path);\n if (segments.length === 0) {\n return null;\n }\n const params = {};\n let node = this.tree;\n for (const segment of segments) {\n const match = node.match(segment, params);\n if (match) {\n node = match;\n }\n else {\n return null;\n }\n }\n if (!node.value) {\n // not a leaf node (partial match)\n if (node instanceof ParentSegmentNode) {\n if (node.wildcard instanceof WildcardSegmentNode) {\n node = node.wildcard.match('', params);\n if (!node.value) {\n throw new Error('Wildcard segment node `*` must have a value');\n }\n }\n }\n if (!node.value)\n return null; // not a leaf node, neither a trailing wildcard (partial match)\n }\n let matchedSegments, remainingSegments;\n if (params._ && params._.length > 0) {\n matchedSegments = segments.slice(0, -params._.length);\n remainingSegments = params._;\n }\n else {\n matchedSegments = segments;\n }\n return { params, matchedSegments, remainingSegments, value: node.value };\n }\n}\nclass ParentSegmentNode {\n name;\n value;\n children = {};\n wildcard;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n const node = this.children[segment];\n if (node) {\n return node;\n }\n else if (this.wildcard) {\n if (this.wildcard instanceof WildcardSegmentNode) {\n return this.wildcard.match(segment, params);\n }\n else if (this.wildcard instanceof VariableSegmentNode) {\n params[this.wildcard.paramName] = segment;\n return this.wildcard;\n }\n else {\n throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`);\n }\n }\n else {\n return null;\n }\n }\n}\nclass RootSegmentNode extends ParentSegmentNode {\n constructor() {\n super('#root');\n }\n}\nclass LiteralSegmentNode extends ParentSegmentNode {\n}\nclass VariableSegmentNode extends ParentSegmentNode {\n paramName;\n constructor(name, value) {\n super(name, value);\n this.paramName = name.substring(1);\n }\n}\nclass WildcardSegmentNode {\n name;\n value;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n if (!params._) {\n params._ = segment ? [segment] : [];\n }\n else {\n if (segment)\n params._.push(segment);\n }\n return this;\n }\n}\n//# sourceMappingURL=PathMatcher.js.map","import { createContext, useContext, useEffect } from 'react';\nimport { HistoryNavigator } from './HistoryNavigator';\nimport { PathMatcher } from './PathMatcher';\nimport { getMountBasename, isRootPath, joinPath, stripMountBasename } from './path';\nexport class BaseRouter {\n // the path to use when navigating to the root of the router\n index;\n matcher = new PathMatcher();\n constructor(routes, index) {\n this.index = index;\n for (const route of routes) {\n this.matcher.addPath(route.path, route);\n }\n }\n match(path) {\n const useIndex = isRootPath(path) && this.index;\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n return this.matcher.match(useIndex ? this.index : path);\n }\n}\nexport class Router extends BaseRouter {\n prompt;\n observer;\n navigator = new HistoryNavigator();\n constructor(routes, updateState) {\n super(routes);\n this.navigator.addListener((event) => {\n if (event.isCancelable && this.prompt?.when) {\n if (!window.confirm(this.prompt.message))\n return;\n }\n if (this.observer) {\n this.observer(event);\n }\n // only process afterChange events\n if (event.name === 'afterChange') {\n // Match app-relative: strip the served `<base href>` mount prefix (no-op when origin-served).\n const match = this.match(stripMountBasename(event.location.pathname));\n if (match?.value) {\n updateState({\n ...match,\n state: event.state,\n });\n }\n else {\n updateState(null);\n }\n }\n });\n }\n getTopRouter() {\n return this;\n }\n /**\n * Subsequent navigations will preserve the given params in the query string.\n * Use null to clear the sticky params.\n * @param params\n */\n setStickyParams(params) {\n this.navigator.stickyParams = params != null ? params : undefined;\n // Reflect the params in the current URL immediately, so the address bar is correct on\n // load (not only after the first navigation).\n this.navigator.normalizeCurrentUrl();\n }\n withObserver(observer) {\n this.observer = observer;\n return this;\n }\n start() {\n this.navigator.start();\n // initialize with the current location\n this.navigator.firePageLoad();\n }\n stop() {\n this.navigator.stop();\n }\n navigate(path, options) {\n this.navigator.navigate(path, options);\n }\n}\nexport class NestedRouter extends BaseRouter {\n parent;\n basePath;\n constructor(parent, basePath, routes) {\n super(routes);\n this.parent = parent;\n this.basePath = basePath;\n }\n getTopRouter() {\n if (this.parent instanceof Router) {\n return this.parent;\n }\n else {\n return this.parent.getTopRouter();\n }\n }\n navigate(path, options) {\n // base path is nested by default in a NestedRouter unless explicitly set to false by caller\n const isBasePathNested = options?.isBasePathNested ?? true;\n let basePath;\n if (isBasePathNested) {\n const childBasePath = options?.basePath;\n // e.g. \"/store\" + \"/objects/123\" => \"/store/objects/123\"\n basePath = childBasePath ? joinPath(this.basePath, childBasePath) : this.basePath;\n this.parent.navigate(path, {\n ...options,\n basePath,\n });\n }\n else {\n // isBasePathNested === false: navigate to an absolute path without adding this router's basePath\n // Pass through to parent without adding our basePath prefix\n this.parent.navigate(path, {\n ...options,\n basePath: options?.basePath,\n });\n }\n }\n}\nconst ReactRouterContext = createContext(undefined);\nexport { ReactRouterContext };\nexport function useRouterContext() {\n const ctx = useContext(ReactRouterContext);\n if (!ctx) {\n throw new Error('useRouter must be used within a RouterProvider');\n }\n return ctx;\n}\nexport function useNavigate() {\n const { navigate } = useRouterContext();\n return navigate;\n}\nexport function useRouterBasePath() {\n const { router } = useRouterContext();\n // For a nested router the base is its mount segment within the parent. For a top-level router the\n // base is the served `<base href>` mount prefix (empty for the origin-served Studio UI) — NOT the\n // matched route, so apps can build mount-correct sibling links (e.g. `${base}/assistant`) and\n // compare them against the full `useLocation().pathname`, which carries the mount.\n return router instanceof NestedRouter ? router.basePath : getMountBasename();\n}\nexport function useParams(arg) {\n const { params } = useRouterContext();\n if (arg) {\n return params[arg];\n }\n else {\n return params;\n }\n}\nexport function useLocation() {\n const { location } = useRouterContext();\n return location;\n}\nexport function usePageTitle(title) {\n useEffect(() => {\n const prev = document.title;\n document.title = title;\n return () => {\n document.title = prev;\n };\n }, [title]);\n}\nexport function useNavigationPrompt(prompt) {\n const { router } = useRouterContext();\n const topRouter = router.getTopRouter();\n useEffect(() => {\n topRouter.prompt = prompt;\n return () => {\n topRouter.prompt = undefined;\n };\n }, [prompt, topRouter]);\n useEffect(() => {\n if (prompt.when) {\n const doBlock = prompt.when;\n const listener = (ev) => {\n if (doBlock) {\n ev.preventDefault();\n ev.returnValue = '';\n }\n };\n window.addEventListener('beforeunload', listener);\n return () => {\n window.removeEventListener('beforeunload', listener);\n };\n }\n }, [prompt.when]);\n}\n//# sourceMappingURL=Router.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { withMountBasename } from './path';\nimport { useNavigate, useRouterContext } from './Router';\nexport function Nav({ children, to, onClick, replace = true }) {\n const navigate = useNavigate();\n const _onClick = (ev) => {\n const link = ev.target.closest('a');\n const rawHref = link?.getAttribute('href');\n const target = to ?? rawHref;\n if (link && target) {\n ev.stopPropagation();\n ev.preventDefault();\n navigate(target, { replace });\n onClick?.(ev);\n }\n };\n return (_jsx(\"span\", { onClick: _onClick, children: children }));\n}\nexport function NavLink({ children, href, className, target, topLevelNav, clearBreadcrumbs = false, replace, skipStickyParams, }) {\n const { router } = useRouterContext();\n // In-app route = not an external URL, `_blank` target, or bare hash. Relative paths count too —\n // they must be routed, else the global link listener re-applies the module base path (wrong URL).\n const isAnchorOrEmpty = !href || href.startsWith('#');\n const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');\n const isInternal = !isAnchorOrEmpty && !isExternal;\n // Keep the rendered href under the served `<base href>` mount (correct middle-click / hover /\n // open-in-new-tab); the onClick navigates via the router which applies the same rule. No-op when\n // origin-served (Studio UI). Click handler below passes the raw `href` — navigate() re-bases it.\n const resolvedHref = isInternal\n ? withMountBasename(!skipStickyParams ? router.getTopRouter().navigator.addStickyParams(href) : href)\n : href;\n const _onClick = (ev) => {\n if (ev.defaultPrevented || !isInternal) {\n return;\n }\n ev.stopPropagation();\n ev.preventDefault();\n const actualRouter = topLevelNav ? router.getTopRouter() : router;\n actualRouter.navigate(href, { replace: replace ?? clearBreadcrumbs });\n };\n return (_jsx(\"a\", { href: resolvedHref, className: className, target: target, onClick: _onClick, children: children }));\n}\n//# sourceMappingURL=Nav.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from 'react';\nimport { useRouterContext } from './Router';\nexport function RouteComponent({ spinner }) {\n const ctx = useRouterContext();\n const route = ctx.route;\n if (route.Component) {\n const Component = route.Component;\n return _jsx(Component, { ...ctx.params });\n }\n else if (route.LazyComponent) {\n return _jsx(LazyRouteComponent, { route: route, spinner: spinner });\n }\n else {\n throw new Error(`Invalid route for ${route.path}. Either Component or LazyCOmponent must be specified.`);\n }\n}\nfunction LazyRouteComponent({ route, spinner }) {\n const [Component, setComponent] = useState(null);\n useEffect(() => {\n void route.LazyComponent().then((module) => {\n if (!module.default) {\n throw new Error(`Lazy module for ${route.path} does not have a default export`);\n }\n // we need to wrap the component type in an arrow function\n // otherwise the setState function will execute the function as a state update function\n setComponent(() => module.default);\n });\n }, [route]);\n return Component ? _jsx(Component, {}) : spinner || null;\n}\n//# sourceMappingURL=RouteComponent.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FixLinks } from './FixLinks';\nimport { joinPath } from './path';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, useRouterContext } from './Router';\nexport function NestedNavigationContext({ basePath, fixLinks = false, children }) {\n const ctx = useRouterContext();\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n navigate: (to, options) => {\n if (options?.isBasePathNested === false) {\n // Navigate to an absolute path without adding this context's basePath\n return ctx.navigate(to, options);\n }\n const actualBasePath = options?.basePath ? joinPath(basePath, options.basePath) : basePath;\n return ctx.navigate(to, { ...options, basePath: actualBasePath });\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) }));\n}\n//# sourceMappingURL=NestedNavigationContext.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouterContext } from './Router';\nexport function Route404Component() {\n const ctx = useRouterContext();\n return _jsxs(\"div\", { children: [\"Route not found for path \", ctx.matchedRoutePath] });\n}\nexport function createRoute404() {\n return {\n params: {},\n matchedSegments: [],\n state: null,\n value: {\n path: 'virtual:404',\n Component: () => _jsx(Route404Component, {}),\n },\n };\n}\n//# sourceMappingURL=Route404.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo, useRef } from 'react';\nimport { FixLinks } from './FixLinks';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { NestedRouter, ReactRouterContext, useRouterContext } from './Router';\nexport function NestedRouterProvider({ routes, index, children, fixLinks = false }) {\n const ctx = useRouterContext();\n // Capture basePath once at mount. When the parent router switches to a different\n // top-level route (e.g. /store -> /studio), the lazy loader briefly keeps rendering\n // this (now-stale) module with a new ctx. Keeping basePath stable lets the\n // ctx.matchedRoutePath !== nestedRouter.basePath check below detect the mismatch and\n // skip rendering instead of running match() against the wrong route table.\n const basePathRef = useRef(ctx.matchedRoutePath);\n const nestedRouter = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const nestedRouter = new NestedRouter(ctx.router, basePathRef.current, routes);\n nestedRouter.index = index;\n return nestedRouter;\n }, [ctx.router, index, routes]);\n const nestedRouteMatch = useMemo(() => {\n if (!nestedRouter) {\n return undefined;\n }\n if (ctx.matchedRoutePath !== nestedRouter.basePath) {\n // The change belongs to another router level and will be handled there.\n return undefined;\n }\n return nestedRouter.match(ctx.remainingPath || '/') || createRoute404();\n }, [ctx.matchedRoutePath, ctx.remainingPath, nestedRouter]);\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (nestedRouteMatch && (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n router: nestedRouter,\n route: nestedRouteMatch.value,\n params: nestedRouteMatch.params,\n matchedRoutePath: `/${nestedRouteMatch.matchedSegments.join('/')}`,\n remainingPath: nestedRouteMatch.remainingSegments\n ? `/${nestedRouteMatch.remainingSegments.join('/')}`\n : undefined,\n navigate: (to, options) => {\n if (nestedRouter) {\n return nestedRouter.navigate(to, options);\n }\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) })));\n}\n//# sourceMappingURL=NestedRouterProvider.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { useMemo, useState } from 'react';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, Router } from './Router';\nexport function RouterProvider({ routes, index, onChange, children }) {\n const [state, setState] = useState(undefined);\n const router = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const router = new Router(routes, (match) => {\n if (match === null) {\n match = createRoute404();\n }\n setState({\n location: window.location,\n route: match.value,\n params: match.params,\n state: match.state,\n router: router,\n matchedRoutePath: `/${match.matchedSegments.join('/')}`,\n remainingPath: match.remainingSegments ? `/${match.remainingSegments.join('/')}` : undefined,\n navigate: (to, options) => {\n return router.navigate(to, options);\n },\n });\n }).withObserver(onChange);\n router.index = index;\n return router;\n }, [index, onChange, routes]);\n useSafeLayoutEffect(() => {\n router?.start();\n return () => {\n router?.stop();\n };\n }, [router]);\n return (state && (_jsx(ReactRouterContext.Provider, { value: state, children: children ? children : _jsx(RouteComponent, {}) })));\n}\n//# sourceMappingURL=RouterProvider.js.map"],"names":["PathWithParams","path","params","hash","constructor","i","lastIndexOf","this","substring","indexOf","URLSearchParams","add","key","value","Object","entries","set","toString","isRootPath","joinPath","path1","path2","endsWith","startsWith","getMountBasename","document","base","querySelector","URL","href","pathname","replace","withMountBasename","stripMountBasename","slice","length","getPathSegments","s","e","split","toSegments","Array","isArray","Error","BASE_PATH","Symbol","LocationChangeEvent","name","type","location","state","_canceled","isPageLoad","isBackForward","isLinkClick","isNavigation","isCancelable","cancel","BeforeLocationChangeEvent","super","AfterLocationChangeEvent","HistoryNavigator","stickyParams","_popStateListener","_linkNavListener","_listeners","addListener","listener","push","fireLocationChange","event","firePageLoad","window","addStickyParams","normalizeCurrentUrl","current","search","normalized","to","history","replaceState","navigate","options","stepsBack","stepBack","basePath","_navigate","steps","historyChain","origin","stateToStore","from","data","undefined","title","beforeEvent","currentState","newChainEntry","start","ev","target","tagName","toLowerCase","hasAttribute","url","elem","trim","getElementHrefAsUrl","preventDefault","addEventListener","body","stop","removeEventListener","FixLinks","children","ref","useRef","useEffect","divElem","_jsx","className","PathMatcher","tree","RootSegmentNode","loadMapping","mapping","addSegments","addPath","segments","node","l","segment","childNode","wildcard","VariableSegmentNode","join","WildcardSegmentNode","LiteralSegmentNode","match","matchedSegments","remainingSegments","ParentSegmentNode","_","paramName","BaseRouter","index","matcher","routes","route","useIndex","Router","prompt","observer","navigator","updateState","when","confirm","message","getTopRouter","setStickyParams","withObserver","NestedRouter","parent","isBasePathNested","childBasePath","ReactRouterContext","createContext","useRouterContext","ctx","useContext","useNavigate","useRouterBasePath","router","useParams","arg","useLocation","usePageTitle","prev","useNavigationPrompt","topRouter","doBlock","returnValue","Nav","onClick","link","closest","rawHref","getAttribute","stopPropagation","NavLink","topLevelNav","clearBreadcrumbs","skipStickyParams","isAnchorOrEmpty","isExternal","test","isInternal","resolvedHref","defaultPrevented","RouteComponent","spinner","Component","LazyComponent","LazyRouteComponent","setComponent","useState","then","module","default","NestedNavigationContext","fixLinks","wrapWithFixLinks","matchedRoutePath","Provider","actualBasePath","Route404Component","_jsxs","createRoute404","NestedRouterProvider","basePathRef","nestedRouter","useMemo","nestedRouteMatch","remainingPath","RouterProvider","onChange","setState","useSafeLayoutEffect"],"mappings":"sNAAO,MAAMA,EACTC,KACAC,OACAC,KACA,WAAAC,CAAYH,GACR,IAAII,EAAIJ,EAAKK,YAAY,KACrBD,GAAI,GACJE,KAAKJ,KAAOF,EAAKO,UAAUH,GAC3BJ,EAAOA,EAAKO,UAAU,EAAGH,IAGzBE,KAAKJ,KAAO,GAEhBE,EAAIJ,EAAKQ,QAAQ,KACbJ,GAAI,GACJE,KAAKN,KAAOA,EAAKO,UAAU,EAAGH,GAC9BE,KAAKL,OAAS,IAAIQ,gBAAgBT,EAAKO,UAAUH,EAAI,MAGrDE,KAAKN,KAAOA,EACZM,KAAKL,OAAS,IA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,CAAC3B,EAAOgF,EAAU9E,IAOrB,OANAgF,EAAoB,KAChBvD,GAAQ1E,QACD,KACH0E,GAAQ7D,SAEb,CAAC6D,IACI1H,GAAUqE,EAAK8C,EAAmBgD,SAAU,CAAExM,MAAOqC,EAAOgE,SAAUA,GAAsBK,EAAKgF,EAAgB,CAAA,IAC7H"}
|
|
1
|
+
{"version":3,"file":"vertesia-ui-router.js","sources":["router/PathWithParams.js","router/path.js","router/HistoryNavigator.js","router/FixLinks.js","router/PathMatcher.js","router/Router.js","router/Nav.js","router/RouteComponent.js","router/NestedNavigationContext.js","router/Route404.js","router/NestedRouterProvider.js","router/RouterProvider.js"],"sourcesContent":["export class PathWithParams {\n path;\n params;\n hash;\n constructor(path) {\n let i = path.lastIndexOf('#');\n if (i > -1) {\n this.hash = path.substring(i);\n path = path.substring(0, i);\n }\n else {\n this.hash = '';\n }\n i = path.indexOf('?');\n if (i > -1) {\n this.path = path.substring(0, i);\n this.params = new URLSearchParams(path.substring(i + 1));\n }\n else {\n this.path = path;\n this.params = new URLSearchParams();\n }\n }\n add(params) {\n for (const [key, value] of Object.entries(params)) {\n this.params.set(key, value);\n }\n return this;\n }\n toString() {\n return `${this.path}?${this.params.toString()}${this.hash}`;\n }\n}\n//# sourceMappingURL=PathWithParams.js.map","export function isRootPath(path) {\n return path === '/' || path === '';\n}\nexport function joinPath(path1, path2) {\n if (path1.endsWith('/') && path2.startsWith('/')) {\n path2 = path1 + path2.substring(1);\n }\n else if (path1.endsWith('/')) {\n path2 = path1 + path2;\n }\n else if (path2.startsWith('/')) {\n path2 = path1 + path2;\n }\n else {\n path2 = `${path1}/${path2}`;\n }\n return path2;\n}\n/**\n * The mount base path from an explicit `<base href>` element, or `''` when there is none.\n *\n * Apps served under a deep gateway mount carry `<base href=\"/tenants/.../app/\">`, injected at serve\n * time. The router otherwise resolves absolute routes against the origin, which collapses the URL\n * off the mount (and breaks in-app links). This returns the base pathname without a trailing slash\n * so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}\n * can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and\n * every caller becomes a no-op there.\n */\nexport function getMountBasename() {\n if (typeof document === 'undefined')\n return '';\n const base = document.querySelector('base[href]');\n if (!base)\n return '';\n try {\n return new URL(base.href, document.URL).pathname.replace(/\\/+$/, '');\n }\n catch {\n return '';\n }\n}\n/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */\nexport function withMountBasename(path) {\n const base = getMountBasename();\n if (!base || !path.startsWith('/'))\n return path;\n if (path === base || path.startsWith(`${base}/`))\n return path;\n return joinPath(base, path);\n}\n/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */\nexport function stripMountBasename(path) {\n const base = getMountBasename();\n if (!base)\n return path;\n if (path === base)\n return '/';\n if (path.startsWith(`${base}/`))\n return path.slice(base.length) || '/';\n return path;\n}\nexport function getPathSegments(path) {\n if (path === '') {\n return [];\n }\n if (path === '/') {\n return [''];\n }\n let s = 0, e = path.length;\n if (path.startsWith('./')) {\n s = 2;\n }\n else if (path.startsWith('/')) {\n s = 1;\n }\n if (path.endsWith('/')) {\n e = path.length - 1;\n }\n return (s > 0 || e < path.length ? path.substring(s, e) : path).split('/');\n}\nexport function toSegments(path) {\n if (typeof path === 'string') {\n return getPathSegments(path);\n }\n else if (Array.isArray(path)) {\n return path;\n }\n else {\n throw new Error(`Unsupported path object: ${path}`);\n }\n}\n// export class Path {\n// static parse(path: string, abs = false) {\n// if (abs !== undefined) {\n// abs = path.startsWith('/');\n// }\n// return new Path(getPathSegments(path), abs);\n// }\n// constructor(public segments: string[], public isAbsolute = false) {\n// }\n// getParameters() {\n// const out = [];\n// for (const segment of this.segments) {\n// if (segment[0] === ':') {\n// out.push(segment.substring(1));\n// }\n// }\n// if (this.segments[this.segments.length - 1] === '*') {\n// out.push('_');\n// }\n// return out;\n// }\n// resolveParameters(path: string) {\n// const params: PathMatchParams = {};\n// const resolvedSegments = getPathSegments(path);\n// if (resolvedSegments.length < this.segments.length) {\n// return null;\n// }\n// const segments = this.segments;\n// for (let i = 0, l = segments.length; i < l; i++) {\n// const seg = segments[i];\n// if (seg[0] === ':') {\n// params[seg.substring(1)] = resolvedSegments[i];\n// }\n// }\n// if (resolvedSegments.length - this.segments.length) {\n// params._ = resolvedSegments.slice(this.segments.length);\n// }\n// return params;\n// }\n// match(path: string | string[] | Path) {\n// const segments = toSegments(path);\n// if (segments.length < this.segments.length) {\n// return false;\n// }\n// let params: PathMatchParams | undefined;\n// const mySegments = this.segments;\n// for (let i = 0, l = mySegments.length; i < l; i++) {\n// const segment = mySegments[i];\n// if (segment === ':') {\n// if (!params) params = {};\n// params[segment.substring(1)] = segment;\n// } else if (segment !== segments[i]) {\n// if (i === l - 1 && segment === '*') {\n// if (!params) params = {};\n// params._ = segments.slice(i);\n// return params;\n// }\n// return false;\n// }\n// }\n// return params ? params : false;\n// }\n// join(path: Path | string | string[]) {\n// const segments = toSegments(path);\n// return new Path(this.segments.concat(segments), this.isAbsolute);\n// }\n// getRelativePath(path: Path | string | string[], asAbsolute: boolean = false) {\n// const segments = toSegments(path);\n// const extraSegmentsCount = segments.length - this.segments.length;\n// if (extraSegmentsCount <= 0) {\n// return null;\n// }\n// return new Path(segments.slice(this.segments.length), asAbsolute);\n// }\n// prependSegments(segments: string[]) {\n// this.segments = segments.concat(this.segments);\n// }\n// appendSegments(segments: string[]) {\n// this.segments = this.segments.concat(segments);\n// }\n// toAbsolutePath() {\n// return '/' + this.segments.join('/');\n// }\n// toRelativePath() {\n// return this.segments.join('/');\n// }\n// toString() {\n// const path = this.segments.join('/');\n// return this.isAbsolute ? '/' + path : path;\n// }\n// }\n//# sourceMappingURL=path.js.map","import { PathWithParams } from './PathWithParams';\nimport { joinPath, withMountBasename } from './path';\nconst BASE_PATH = Symbol('BASE_PATH');\nexport { BASE_PATH };\nexport class LocationChangeEvent {\n name;\n type;\n location;\n state;\n _canceled = false;\n constructor(name, type, location, state) {\n this.name = name;\n this.type = type;\n this.location = location;\n this.state = state;\n }\n get isPageLoad() {\n return this.type === 'initial';\n }\n get isBackForward() {\n return this.type === 'popState';\n }\n get isLinkClick() {\n return this.type === 'linkClick';\n }\n get isNavigation() {\n return this.type === 'navigate';\n }\n get isCancelable() {\n return this.name === 'beforeChange';\n }\n cancel() {\n if (this.name === 'afterChange') {\n throw new Error('Cannot cancel afterChange event');\n }\n this._canceled = true;\n }\n}\nexport class BeforeLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('beforeChange', type, location, state);\n }\n}\nexport class AfterLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('afterChange', type, location, state);\n }\n}\nfunction getElementHrefAsUrl(elem) {\n if (elem && elem.tagName.toLowerCase() === 'a') {\n const href = elem?.href.trim();\n if (typeof href === 'string' && href.length > 0) {\n return new URL(href);\n }\n }\n return null;\n}\nexport class HistoryNavigator {\n // params to preserve in the query string when navigating\n stickyParams;\n _popStateListener;\n _linkNavListener;\n _listeners = [];\n addListener(listener) {\n this._listeners.push(listener);\n }\n fireLocationChange(event) {\n for (const listener of this._listeners) {\n listener(event);\n }\n }\n /**\n * Should be called when the page is first loaded.\n * It will fire a location change event with type `initial` and the current window.location as the location\n */\n firePageLoad() {\n this.fireLocationChange(new AfterLocationChangeEvent('initial', new URL(window.location.href)));\n }\n addStickyParams(path) {\n if (this.stickyParams) {\n return new PathWithParams(path).add(this.stickyParams).toString();\n }\n return path;\n }\n /**\n * Rewrite the current browser URL in place so that the sticky params are present, without\n * navigating. Used on load / when the params first become known so the address bar reflects\n * the active account/project before the first navigation.\n *\n * Idempotent and side-effect-light: only calls replaceState when the URL would actually\n * change, preserves the existing history state, and never fires a location-change event\n * (so there is no route re-match or component remount).\n */\n normalizeCurrentUrl() {\n if (typeof window === 'undefined' || !this.stickyParams) {\n return;\n }\n const current = window.location.pathname + window.location.search + window.location.hash;\n const normalized = this.addStickyParams(current);\n if (normalized !== current) {\n const to = new URL(normalized, window.location.href);\n window.history.replaceState(window.history.state, '', to.href);\n }\n }\n navigate(to, options = {}) {\n if (options.stepsBack && options.stepsBack > 0) {\n this.stepBack(options.stepsBack, options);\n return;\n }\n if (options.basePath) {\n let basePath = options.basePath;\n if (!basePath.startsWith('/')) {\n basePath = `/${basePath}`;\n }\n to = joinPath(basePath, to);\n }\n to = this.addStickyParams(to);\n // Keep absolute app routes under the served `<base href>` mount instead of resolving them\n // against the bare origin (which collapses the URL off the mount). No-op when origin-served.\n to = withMountBasename(to);\n this._navigate(new URL(to, window.location.href), 'navigate', options);\n }\n stepBack(steps, options = {}) {\n const historyChain = window.history.state.historyChain || [];\n const to = historyChain.length >= steps\n ? new URL(historyChain[historyChain.length - steps].href, window.location.href)\n : new URL(window.location.origin, window.location.href);\n this._navigate(to, 'popState', options);\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain.slice(0, -steps),\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history.replaceState(stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent('popState', to, options.state));\n }\n _navigate(to, type, options) {\n const beforeEvent = new BeforeLocationChangeEvent(type, to, options.state);\n this.fireLocationChange(beforeEvent);\n if (beforeEvent._canceled) {\n return;\n }\n // Build navigation chain by preserving previous history\n const currentState = window.history.state;\n const currentTitle = options.title || document.title;\n // Create new history chain entry\n const newChainEntry = {\n title: currentTitle,\n href: window.location.pathname + window.location.search + window.location.hash,\n };\n // Build the history chain - clear if using replace\n let historyChain = [];\n if (!options.replace && currentState?.historyChain) {\n historyChain = [...currentState.historyChain];\n }\n // Only add to chain if not replacing\n if (!options.replace) {\n historyChain.push(newChainEntry);\n // Limit chain length to prevent memory issues (keep last 10 entries)\n if (historyChain.length > 10) {\n historyChain = historyChain.slice(-10);\n }\n }\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain,\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history[options.replace ? 'replaceState' : 'pushState'](stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, options.state));\n }\n start() {\n if (typeof window === 'undefined') {\n return;\n }\n const _popStateListener = (ev) => {\n let type;\n const to = new URL(window.location.href);\n let state;\n if (ev.state) {\n type = 'popState';\n state = ev.state.data;\n }\n else {\n type = 'linkClick';\n }\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, state));\n };\n const _linkNavListener = (ev) => {\n const target = ev.target;\n // Skip anchors with download attribute or blob: URLs - they are file downloads, not navigation\n if (target.tagName.toLowerCase() === 'a' &&\n (target.hasAttribute('download') ||\n target.href?.startsWith('blob:'))) {\n return;\n }\n const url = getElementHrefAsUrl(target);\n if (url && url.origin === window.location.origin) {\n ev.preventDefault();\n const to = new URL(this.addStickyParams(url.href));\n const basePath = ev[BASE_PATH] ||\n ev.target[BASE_PATH];\n if (basePath) {\n to.pathname = joinPath(basePath, to.pathname);\n }\n this._navigate(to, 'linkClick', {});\n }\n };\n this._popStateListener = _popStateListener;\n this._linkNavListener = _linkNavListener;\n window.addEventListener('popstate', _popStateListener);\n document.body.addEventListener('click', this._linkNavListener);\n }\n stop() {\n if (this._popStateListener)\n window.removeEventListener('popstate', this._popStateListener);\n if (this._linkNavListener)\n document.body.removeEventListener('click', this._linkNavListener);\n }\n}\n//# sourceMappingURL=HistoryNavigator.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from 'react';\nimport { BASE_PATH } from './HistoryNavigator';\nexport function FixLinks({ basePath, children }) {\n const ref = useRef(null);\n useEffect(() => {\n if (ref.current) {\n const divElem = ref.current;\n const listener = (ev) => {\n const elem = ev.target;\n if (elem.tagName.toLowerCase() === 'a') {\n ev[BASE_PATH] = basePath;\n }\n };\n divElem.addEventListener('click', listener);\n return () => {\n divElem.removeEventListener('click', listener);\n };\n }\n }, [basePath]);\n return (_jsx(\"div\", { ref: ref, className: \"h-full w-full\", children: children }));\n}\n//# sourceMappingURL=FixLinks.js.map","import { getPathSegments, toSegments } from './path';\n/**\n * Path matcher which support :param and *wildcard segments.\n * The wildcard segment is only supported as the last segment\n */\nexport class PathMatcher {\n tree = new RootSegmentNode();\n loadMapping(mapping) {\n for (const [key, value] of Object.entries(mapping)) {\n this.addSegments(getPathSegments(key), value);\n }\n }\n addPath(path, value) {\n this.addSegments(getPathSegments(path), value);\n }\n addSegments(segments, value) {\n let node = this.tree;\n for (let i = 0, l = segments.length; i < l; i++) {\n const segment = segments[i];\n if (segment[0] === ':') {\n let childNode = node.wildcard;\n if (!childNode) {\n childNode = new VariableSegmentNode(segment);\n node.wildcard = childNode;\n }\n else if (!(childNode instanceof VariableSegmentNode)) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \":\" segment will overwrite an existing wildcard segment at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node = childNode;\n }\n else if (segment === '*') {\n if (node.wildcard) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \"*\" segment already exists at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node.wildcard = new WildcardSegmentNode(segment, value);\n if (i < l - 1) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard segment must be the last segment`);\n }\n return;\n }\n else {\n let childNode = node.children[segment];\n if (!childNode) {\n childNode = new LiteralSegmentNode(segment);\n node.children[segment] = childNode;\n } // else // a literal segment already exists\n node = childNode;\n }\n }\n if (node.value !== undefined) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A value already exists at path: ${`/${segments.join('/')}`}`);\n }\n node.value = value;\n }\n match(path) {\n const segments = toSegments(path);\n if (segments.length === 0) {\n return null;\n }\n const params = {};\n let node = this.tree;\n for (const segment of segments) {\n const match = node.match(segment, params);\n if (match) {\n node = match;\n }\n else {\n return null;\n }\n }\n if (!node.value) {\n // not a leaf node (partial match)\n if (node instanceof ParentSegmentNode) {\n if (node.wildcard instanceof WildcardSegmentNode) {\n node = node.wildcard.match('', params);\n if (!node.value) {\n throw new Error('Wildcard segment node `*` must have a value');\n }\n }\n }\n if (!node.value)\n return null; // not a leaf node, neither a trailing wildcard (partial match)\n }\n let matchedSegments, remainingSegments;\n if (params._ && params._.length > 0) {\n matchedSegments = segments.slice(0, -params._.length);\n remainingSegments = params._;\n }\n else {\n matchedSegments = segments;\n }\n return { params, matchedSegments, remainingSegments, value: node.value };\n }\n}\nclass ParentSegmentNode {\n name;\n value;\n children = {};\n wildcard;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n const node = this.children[segment];\n if (node) {\n return node;\n }\n else if (this.wildcard) {\n if (this.wildcard instanceof WildcardSegmentNode) {\n return this.wildcard.match(segment, params);\n }\n else if (this.wildcard instanceof VariableSegmentNode) {\n params[this.wildcard.paramName] = segment;\n return this.wildcard;\n }\n else {\n throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`);\n }\n }\n else {\n return null;\n }\n }\n}\nclass RootSegmentNode extends ParentSegmentNode {\n constructor() {\n super('#root');\n }\n}\nclass LiteralSegmentNode extends ParentSegmentNode {\n}\nclass VariableSegmentNode extends ParentSegmentNode {\n paramName;\n constructor(name, value) {\n super(name, value);\n this.paramName = name.substring(1);\n }\n}\nclass WildcardSegmentNode {\n name;\n value;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n if (!params._) {\n params._ = segment ? [segment] : [];\n }\n else {\n if (segment)\n params._.push(segment);\n }\n return this;\n }\n}\n//# sourceMappingURL=PathMatcher.js.map","import { createContext, useContext, useEffect } from 'react';\nimport { HistoryNavigator } from './HistoryNavigator';\nimport { PathMatcher } from './PathMatcher';\nimport { getMountBasename, isRootPath, joinPath, stripMountBasename } from './path';\nexport class BaseRouter {\n // the path to use when navigating to the root of the router\n index;\n matcher = new PathMatcher();\n constructor(routes, index) {\n this.index = index;\n for (const route of routes) {\n this.matcher.addPath(route.path, route);\n }\n }\n match(path) {\n const useIndex = isRootPath(path) && this.index;\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n return this.matcher.match(useIndex ? this.index : path);\n }\n}\nexport class Router extends BaseRouter {\n prompt;\n observer;\n navigator = new HistoryNavigator();\n constructor(routes, updateState) {\n super(routes);\n this.navigator.addListener((event) => {\n if (event.isCancelable && this.prompt?.when) {\n if (!window.confirm(this.prompt.message))\n return;\n }\n if (this.observer) {\n this.observer(event);\n }\n // only process afterChange events\n if (event.name === 'afterChange') {\n // Match app-relative: strip the served `<base href>` mount prefix (no-op when origin-served).\n const match = this.match(stripMountBasename(event.location.pathname));\n if (match?.value) {\n updateState({\n ...match,\n state: event.state,\n });\n }\n else {\n updateState(null);\n }\n }\n });\n }\n getTopRouter() {\n return this;\n }\n /**\n * Subsequent navigations will preserve the given params in the query string.\n * Use null to clear the sticky params.\n * @param params\n */\n setStickyParams(params) {\n this.navigator.stickyParams = params != null ? params : undefined;\n // Reflect the params in the current URL immediately, so the address bar is correct on\n // load (not only after the first navigation).\n this.navigator.normalizeCurrentUrl();\n }\n withObserver(observer) {\n this.observer = observer;\n return this;\n }\n start() {\n this.navigator.start();\n // initialize with the current location\n this.navigator.firePageLoad();\n }\n stop() {\n this.navigator.stop();\n }\n navigate(path, options) {\n this.navigator.navigate(path, options);\n }\n}\nexport class NestedRouter extends BaseRouter {\n parent;\n basePath;\n constructor(parent, basePath, routes) {\n super(routes);\n this.parent = parent;\n this.basePath = basePath;\n }\n getTopRouter() {\n if (this.parent instanceof Router) {\n return this.parent;\n }\n else {\n return this.parent.getTopRouter();\n }\n }\n navigate(path, options) {\n // base path is nested by default in a NestedRouter unless explicitly set to false by caller\n const isBasePathNested = options?.isBasePathNested ?? true;\n let basePath;\n if (isBasePathNested) {\n const childBasePath = options?.basePath;\n // e.g. \"/store\" + \"/objects/123\" => \"/store/objects/123\"\n basePath = childBasePath ? joinPath(this.basePath, childBasePath) : this.basePath;\n this.parent.navigate(path, {\n ...options,\n basePath,\n });\n }\n else {\n // isBasePathNested === false: navigate to an absolute path without adding this router's basePath\n // Pass through to parent without adding our basePath prefix\n this.parent.navigate(path, {\n ...options,\n basePath: options?.basePath,\n });\n }\n }\n}\nconst ReactRouterContext = createContext(undefined);\nexport { ReactRouterContext };\nexport function useRouterContext() {\n const ctx = useContext(ReactRouterContext);\n if (!ctx) {\n throw new Error('useRouter must be used within a RouterProvider');\n }\n return ctx;\n}\nexport function useNavigate() {\n const { navigate } = useRouterContext();\n return navigate;\n}\nexport function useRouterBasePath() {\n const { router } = useRouterContext();\n // The base path apps prepend to build absolute in-app links (e.g. `${base}/items/${id}`). It MUST\n // include the served `<base href>` mount so links stay on the mount and match the full\n // `useLocation().pathname` (which carries the mount). `getMountBasename()` is '' for the\n // origin-served Studio UI and the mount (no trailing slash) for gateway-served apps.\n const mount = getMountBasename();\n if (router instanceof NestedRouter) {\n // NestedRouter.basePath is relative to the parent router, which sits at the mount, so it must\n // be mount-prefixed too. A bare nested base of '/' (an app whose NestedRouterProvider has no\n // basePath) would otherwise make `${base}/items` resolve to `//items` — a protocol-relative\n // URL that escapes the app. Origin-served Studio (mount '') keeps the raw nested basePath.\n if (!mount)\n return router.basePath;\n return router.basePath === '/' ? mount : joinPath(mount, router.basePath);\n }\n return mount;\n}\nexport function useParams(arg) {\n const { params } = useRouterContext();\n if (arg) {\n return params[arg];\n }\n else {\n return params;\n }\n}\nexport function useLocation() {\n const { location } = useRouterContext();\n return location;\n}\nexport function usePageTitle(title) {\n useEffect(() => {\n const prev = document.title;\n document.title = title;\n return () => {\n document.title = prev;\n };\n }, [title]);\n}\nexport function useNavigationPrompt(prompt) {\n const { router } = useRouterContext();\n const topRouter = router.getTopRouter();\n useEffect(() => {\n topRouter.prompt = prompt;\n return () => {\n topRouter.prompt = undefined;\n };\n }, [prompt, topRouter]);\n useEffect(() => {\n if (prompt.when) {\n const doBlock = prompt.when;\n const listener = (ev) => {\n if (doBlock) {\n ev.preventDefault();\n ev.returnValue = '';\n }\n };\n window.addEventListener('beforeunload', listener);\n return () => {\n window.removeEventListener('beforeunload', listener);\n };\n }\n }, [prompt.when]);\n}\n//# sourceMappingURL=Router.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { withMountBasename } from './path';\nimport { useNavigate, useRouterContext } from './Router';\nexport function Nav({ children, to, onClick, replace = true }) {\n const navigate = useNavigate();\n const _onClick = (ev) => {\n const link = ev.target.closest('a');\n const rawHref = link?.getAttribute('href');\n const target = to ?? rawHref;\n if (link && target) {\n ev.stopPropagation();\n ev.preventDefault();\n navigate(target, { replace });\n onClick?.(ev);\n }\n };\n return (_jsx(\"span\", { onClick: _onClick, children: children }));\n}\nexport function NavLink({ children, href, className, target, topLevelNav, clearBreadcrumbs = false, replace, skipStickyParams, }) {\n const { router } = useRouterContext();\n // In-app route = not an external URL, `_blank` target, or bare hash. Relative paths count too —\n // they must be routed, else the global link listener re-applies the module base path (wrong URL).\n const isAnchorOrEmpty = !href || href.startsWith('#');\n const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');\n const isInternal = !isAnchorOrEmpty && !isExternal;\n // Keep the rendered href under the served `<base href>` mount (correct middle-click / hover /\n // open-in-new-tab); the onClick navigates via the router which applies the same rule. No-op when\n // origin-served (Studio UI). Click handler below passes the raw `href` — navigate() re-bases it.\n const resolvedHref = isInternal\n ? withMountBasename(!skipStickyParams ? router.getTopRouter().navigator.addStickyParams(href) : href)\n : href;\n const _onClick = (ev) => {\n if (ev.defaultPrevented || !isInternal) {\n return;\n }\n ev.stopPropagation();\n ev.preventDefault();\n const actualRouter = topLevelNav ? router.getTopRouter() : router;\n actualRouter.navigate(href, { replace: replace ?? clearBreadcrumbs });\n };\n return (_jsx(\"a\", { href: resolvedHref, className: className, target: target, onClick: _onClick, children: children }));\n}\n//# sourceMappingURL=Nav.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from 'react';\nimport { useRouterContext } from './Router';\nexport function RouteComponent({ spinner }) {\n const ctx = useRouterContext();\n const route = ctx.route;\n if (route.Component) {\n const Component = route.Component;\n return _jsx(Component, { ...ctx.params });\n }\n else if (route.LazyComponent) {\n return _jsx(LazyRouteComponent, { route: route, spinner: spinner });\n }\n else {\n throw new Error(`Invalid route for ${route.path}. Either Component or LazyCOmponent must be specified.`);\n }\n}\nfunction LazyRouteComponent({ route, spinner }) {\n const [Component, setComponent] = useState(null);\n useEffect(() => {\n void route.LazyComponent().then((module) => {\n if (!module.default) {\n throw new Error(`Lazy module for ${route.path} does not have a default export`);\n }\n // we need to wrap the component type in an arrow function\n // otherwise the setState function will execute the function as a state update function\n setComponent(() => module.default);\n });\n }, [route]);\n return Component ? _jsx(Component, {}) : spinner || null;\n}\n//# sourceMappingURL=RouteComponent.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FixLinks } from './FixLinks';\nimport { joinPath } from './path';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, useRouterContext } from './Router';\nexport function NestedNavigationContext({ basePath, fixLinks = false, children }) {\n const ctx = useRouterContext();\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n navigate: (to, options) => {\n if (options?.isBasePathNested === false) {\n // Navigate to an absolute path without adding this context's basePath\n return ctx.navigate(to, options);\n }\n const actualBasePath = options?.basePath ? joinPath(basePath, options.basePath) : basePath;\n return ctx.navigate(to, { ...options, basePath: actualBasePath });\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) }));\n}\n//# sourceMappingURL=NestedNavigationContext.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouterContext } from './Router';\nexport function Route404Component() {\n const ctx = useRouterContext();\n return _jsxs(\"div\", { children: [\"Route not found for path \", ctx.matchedRoutePath] });\n}\nexport function createRoute404() {\n return {\n params: {},\n matchedSegments: [],\n state: null,\n value: {\n path: 'virtual:404',\n Component: () => _jsx(Route404Component, {}),\n },\n };\n}\n//# sourceMappingURL=Route404.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo, useRef } from 'react';\nimport { FixLinks } from './FixLinks';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { NestedRouter, ReactRouterContext, useRouterContext } from './Router';\nexport function NestedRouterProvider({ routes, index, children, fixLinks = false }) {\n const ctx = useRouterContext();\n // Capture basePath once at mount. When the parent router switches to a different\n // top-level route (e.g. /store -> /studio), the lazy loader briefly keeps rendering\n // this (now-stale) module with a new ctx. Keeping basePath stable lets the\n // ctx.matchedRoutePath !== nestedRouter.basePath check below detect the mismatch and\n // skip rendering instead of running match() against the wrong route table.\n const basePathRef = useRef(ctx.matchedRoutePath);\n const nestedRouter = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const nestedRouter = new NestedRouter(ctx.router, basePathRef.current, routes);\n nestedRouter.index = index;\n return nestedRouter;\n }, [ctx.router, index, routes]);\n const nestedRouteMatch = useMemo(() => {\n if (!nestedRouter) {\n return undefined;\n }\n if (ctx.matchedRoutePath !== nestedRouter.basePath) {\n // The change belongs to another router level and will be handled there.\n return undefined;\n }\n return nestedRouter.match(ctx.remainingPath || '/') || createRoute404();\n }, [ctx.matchedRoutePath, ctx.remainingPath, nestedRouter]);\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (nestedRouteMatch && (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n router: nestedRouter,\n route: nestedRouteMatch.value,\n params: nestedRouteMatch.params,\n matchedRoutePath: `/${nestedRouteMatch.matchedSegments.join('/')}`,\n remainingPath: nestedRouteMatch.remainingSegments\n ? `/${nestedRouteMatch.remainingSegments.join('/')}`\n : undefined,\n navigate: (to, options) => {\n if (nestedRouter) {\n return nestedRouter.navigate(to, options);\n }\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) })));\n}\n//# sourceMappingURL=NestedRouterProvider.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { useMemo, useState } from 'react';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, Router } from './Router';\nexport function RouterProvider({ routes, index, onChange, children }) {\n const [state, setState] = useState(undefined);\n const router = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const router = new Router(routes, (match) => {\n if (match === null) {\n match = createRoute404();\n }\n setState({\n location: window.location,\n route: match.value,\n params: match.params,\n state: match.state,\n router: router,\n matchedRoutePath: `/${match.matchedSegments.join('/')}`,\n remainingPath: match.remainingSegments ? `/${match.remainingSegments.join('/')}` : undefined,\n navigate: (to, options) => {\n return router.navigate(to, options);\n },\n });\n }).withObserver(onChange);\n router.index = index;\n return router;\n }, [index, onChange, routes]);\n useSafeLayoutEffect(() => {\n router?.start();\n return () => {\n router?.stop();\n };\n }, [router]);\n return (state && (_jsx(ReactRouterContext.Provider, { value: state, children: children ? children : _jsx(RouteComponent, {}) })));\n}\n//# sourceMappingURL=RouterProvider.js.map"],"names":["PathWithParams","path","params","hash","constructor","i","lastIndexOf","this","substring","indexOf","URLSearchParams","add","key","value","Object","entries","set","toString","isRootPath","joinPath","path1","path2","endsWith","startsWith","getMountBasename","document","base","querySelector","URL","href","pathname","replace","withMountBasename","stripMountBasename","slice","length","getPathSegments","s","e","split","toSegments","Array","isArray","Error","BASE_PATH","Symbol","LocationChangeEvent","name","type","location","state","_canceled","isPageLoad","isBackForward","isLinkClick","isNavigation","isCancelable","cancel","BeforeLocationChangeEvent","super","AfterLocationChangeEvent","HistoryNavigator","stickyParams","_popStateListener","_linkNavListener","_listeners","addListener","listener","push","fireLocationChange","event","firePageLoad","window","addStickyParams","normalizeCurrentUrl","current","search","normalized","to","history","replaceState","navigate","options","stepsBack","stepBack","basePath","_navigate","steps","historyChain","origin","stateToStore","from","data","undefined","title","beforeEvent","currentState","newChainEntry","start","ev","target","tagName","toLowerCase","hasAttribute","url","elem","trim","getElementHrefAsUrl","preventDefault","addEventListener","body","stop","removeEventListener","FixLinks","children","ref","useRef","useEffect","divElem","_jsx","className","PathMatcher","tree","RootSegmentNode","loadMapping","mapping","addSegments","addPath","segments","node","l","segment","childNode","wildcard","VariableSegmentNode","join","WildcardSegmentNode","LiteralSegmentNode","match","matchedSegments","remainingSegments","ParentSegmentNode","_","paramName","BaseRouter","index","matcher","routes","route","useIndex","Router","prompt","observer","navigator","updateState","when","confirm","message","getTopRouter","setStickyParams","withObserver","NestedRouter","parent","isBasePathNested","childBasePath","ReactRouterContext","createContext","useRouterContext","ctx","useContext","useNavigate","useRouterBasePath","router","mount","useParams","arg","useLocation","usePageTitle","prev","useNavigationPrompt","topRouter","doBlock","returnValue","Nav","onClick","link","closest","rawHref","getAttribute","stopPropagation","NavLink","topLevelNav","clearBreadcrumbs","skipStickyParams","isAnchorOrEmpty","isExternal","test","isInternal","resolvedHref","defaultPrevented","RouteComponent","spinner","Component","LazyComponent","LazyRouteComponent","setComponent","useState","then","module","default","NestedNavigationContext","fixLinks","wrapWithFixLinks","matchedRoutePath","Provider","actualBasePath","Route404Component","_jsxs","createRoute404","NestedRouterProvider","basePathRef","nestedRouter","useMemo","nestedRouteMatch","remainingPath","RouterProvider","onChange","setState","useSafeLayoutEffect"],"mappings":"sNAAO,MAAMA,EACTC,KACAC,OACAC,KACA,WAAAC,CAAYH,GACR,IAAII,EAAIJ,EAAKK,YAAY,KACrBD,GAAI,GACJE,KAAKJ,KAAOF,EAAKO,UAAUH,GAC3BJ,EAAOA,EAAKO,UAAU,EAAGH,IAGzBE,KAAKJ,KAAO,GAEhBE,EAAIJ,EAAKQ,QAAQ,KACbJ,GAAI,GACJE,KAAKN,KAAOA,EAAKO,UAAU,EAAGH,GAC9BE,KAAKL,OAAS,IAAIQ,gBAAgBT,EAAKO,UAAUH,EAAI,MAGrDE,KAAKN,KAAOA,EACZM,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