@domphy/app 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @domphy/app
2
+
3
+ A port of the Next.js App Router feature set for Domphy: nested routing and layouts, client navigation with prefetching, loading/error/not-found boundaries, data loading with revalidation, the Metadata API, middleware, server rendering with hydration, API route handlers, and image/script helpers.
4
+
5
+ It is a runtime library — routes are declared as a plain object tree (the equivalent of the `app/` directory) and pages/layouts are ordinary Domphy blocks. No bundler plugin or file-system convention is required.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @domphy/app
11
+ ```
12
+
13
+ ## Quick Example
14
+
15
+ ```ts
16
+ import { createApp, defineRoutes, navLink } from "@domphy/app"
17
+ import type { RouteContext } from "@domphy/app"
18
+
19
+ const routes = defineRoutes([
20
+ {
21
+ path: "/",
22
+ layout: (children) => ({
23
+ div: [
24
+ { nav: [{ a: "Home", $: [navLink({ href: "/" })] }] },
25
+ children,
26
+ ],
27
+ }),
28
+ page: () => ({ h1: "Home" }),
29
+ metadata: { title: { default: "My Site", template: "%s | My Site" } },
30
+ children: [
31
+ {
32
+ path: "blog/[slug]",
33
+ loader: async ({ params }) => fetchPost(params.slug as string),
34
+ loading: () => ({ p: "Loading..." }),
35
+ metadata: (context) => ({ title: `Post ${context.params.slug}` }),
36
+ page: (context: RouteContext<Post>) => ({
37
+ article: [{ h1: context.data.title }, { p: context.data.body }],
38
+ }),
39
+ },
40
+ ],
41
+ },
42
+ ])
43
+
44
+ const app = createApp(routes)
45
+ await app.render(document.getElementById("app")!)
46
+ ```
47
+
48
+ ## Feature Map
49
+
50
+ | Next.js | @domphy/app |
51
+ | --- | --- |
52
+ | `app/` directory segments | `Route` tree (`path`, `children`) |
53
+ | `page.tsx` / `layout.tsx` | `page` / `layout` blocks |
54
+ | `loading.tsx` / `error.tsx` / `not-found.tsx` | `loading` / `error` / `notFound` blocks |
55
+ | `[slug]`, `[...all]`, `[[...all]]`, `(group)` | same segment syntax in `path` |
56
+ | `fetch` caching / ISR `revalidate` | `loader` + `revalidate` seconds |
57
+ | `next/link` | `navLink()` patch (prefetch on hover/visible, active state) |
58
+ | `useRouter()` | `app.router` — `push`, `replace`, `back`, `forward`, `refresh`, `prefetch` |
59
+ | `usePathname()` / `useSearchParams()` | `router.state.get("pathname", listener)` / `router.searchParams(listener)` |
60
+ | `redirect()` / `permanentRedirect()` / `notFound()` | same functions, callable from loaders, metadata and middleware |
61
+ | `middleware.ts` (redirect, rewrite) | `middleware` option + `rewrite()` |
62
+ | Metadata API / `generateMetadata` | `metadata` object or function per segment |
63
+ | SSR + hydration | `app.renderToString(url)` + `app.hydrate(target)` |
64
+ | `route.ts` API handlers | `createApiHandler()` on web-standard Request/Response |
65
+ | `next/image` | `optimizedImage()` patch (lazy, srcset via loader, fill, blur) |
66
+ | `next/script` | `script()` block (afterInteractive, lazyOnload, dedupe) |
67
+
68
+ Out of scope (build-time concerns that belong to your bundler or host): the compiler/dev server, React Server Components, static export, font optimization and the image optimization server (`optimizedImage` delegates URL generation to any image CDN through its `loader` prop).
69
+
70
+ ## Server Rendering
71
+
72
+ ```ts
73
+ const result = await app.renderToString(request.url, { headers: request.headers })
74
+ // result.html, result.css, result.head, result.status, result.redirect,
75
+ // result.bootstrapScript (inline loader data for hydration)
76
+ ```
77
+
78
+ On the client:
79
+
80
+ ```ts
81
+ await app.hydrate(document.getElementById("app")!.firstElementChild as HTMLElement)
82
+ ```
83
+
84
+ ## Documentation
85
+
86
+ Full guides at [domphy.com/docs/app](https://www.domphy.com/docs/app/).
@@ -0,0 +1,4 @@
1
+ "use strict";var Domphy=(()=>{var z=Object.defineProperty,Dt=Object.defineProperties,jt=Object.getOwnPropertyDescriptor,Ht=Object.getOwnPropertyDescriptors,$t=Object.getOwnPropertyNames,ut=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var ct=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t)=>{for(var n in t||(t={}))dt.call(t,n)&&ct(e,n,t[n]);if(ut)for(var n of ut(t))Ut.call(t,n)&&ct(e,n,t[n]);return e},x=(e,t)=>Dt(e,Ht(t));var pt=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},Ft=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $t(t))!dt.call(e,s)&&s!==n&&z(e,s,{get:()=>t[s],enumerable:!(r=jt(t,s))||r.enumerable});return e};var zt=e=>Ft(z({},"__esModule",{value:!0}),e);var b=(e,t,n)=>new Promise((r,s)=>{var i=l=>{try{a(n.next(l))}catch(h){s(h)}},o=l=>{try{a(n.throw(l))}catch(h){s(h)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);a((n=n.apply(e,t)).next())});var Ce={};pt(Ce,{app:()=>Y});var Y={};pt(Y,{AppRouter:()=>A,DataCache:()=>U,DomphyApp:()=>V,NotFoundSignal:()=>T,PREFETCH_LIFETIME:()=>Ye,RedirectSignal:()=>S,applyHeadTags:()=>K,buildHref:()=>Wt,buildNotFoundTree:()=>at,buildTree:()=>q,compareSpecificity:()=>ft,compileRoutes:()=>I,createApiHandler:()=>Jt,createApp:()=>_e,createBrowserHistory:()=>nt,createMemoryHistory:()=>we,defaultErrorBlock:()=>it,defaultNotFoundBlock:()=>ot,defineRoutes:()=>Me,getRouter:()=>lt,isRewrite:()=>G,json:()=>D,matchPath:()=>gt,matchRoute:()=>O,metadataToHeadTags:()=>$,navLink:()=>Se,notFound:()=>qt,optimizedImage:()=>ke,parseSegment:()=>J,permanentRedirect:()=>Kt,redirect:()=>Gt,renderHeadTags:()=>et,resetScripts:()=>Ee,resolveMetadata:()=>tt,rewrite:()=>Vt,script:()=>Te,splitPath:()=>W});function J(e){return e.startsWith("(")&&e.endsWith(")")?{kind:"group",value:e.slice(1,-1)}:e.startsWith("[[...")&&e.endsWith("]]")?{kind:"optional-catchall",value:e.slice(5,-2)}:e.startsWith("[...")&&e.endsWith("]")?{kind:"catchall",value:e.slice(4,-1)}:e.startsWith("[")&&e.endsWith("]")?{kind:"dynamic",value:e.slice(1,-1)}:{kind:"static",value:e}}function W(e){return e.split("/").filter(t=>t.length>0)}function I(e){let t=[];function n(r,s,i,o,a){for(let l of r){let h=W(l.path),u=h.map(J),c=[...s,...u.filter(f=>f.kind!=="group")],p=`${a}/${h.join("/")}`.replace(/\/+/g,"/"),m=[...i,l],g=[...o,p===""?"/":p];(l.page||l.redirect)&&t.push({id:p===""?"/":p,segments:c,chain:m,chainIds:g}),l.children&&n(l.children,c,m,g,p)}}return n(e,[],[],[],""),t.sort(ft),t}var mt={static:0,dynamic:1,catchall:2,"optional-catchall":3,group:0};function ft(e,t){let n=Math.max(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let s=e.segments[r],i=t.segments[r];if(!s)return-1;if(!i)return 1;let o=mt[s.kind]-mt[i.kind];if(o!==0)return o}return 0}function gt(e,t){let n=W(t).map(i=>decodeURIComponent(i)),r={},s=0;for(let i=0;i<e.length;i++){let o=e[i],a=i===e.length-1;if(o.kind==="static"){if(n[s]!==o.value)return null;s++;continue}if(o.kind==="dynamic"){if(s>=n.length)return null;r[o.value]=n[s],s++;continue}if(o.kind==="catchall")return!a||s>=n.length?null:(r[o.value]=n.slice(s),r);if(o.kind==="optional-catchall")return a?(r[o.value]=n.slice(s),r):null}return s!==n.length?null:r}function O(e,t){for(let n of e){let r=gt(n.segments,t);if(r)return{route:n,params:r,pathname:t}}return null}function Wt(e,t={}){return`/${W(e).map(J).filter(r=>r.kind!=="group").flatMap(r=>{if(r.kind==="static")return[r.value];let s=t[r.value];if(s===void 0){if(r.kind==="optional-catchall")return[];throw new Error(`Missing param "${r.value}" for pattern "${e}".`)}return(Array.isArray(s)?s:[s]).map(o=>encodeURIComponent(o))}).join("/")}`}var S=class extends Error{constructor(t,n){super(`Redirect to ${t}`),this.name="RedirectSignal",this.to=t,this.permanent=n}},T=class extends Error{constructor(){super("Not found"),this.name="NotFoundSignal"}};function Gt(e){throw new S(e,!1)}function Kt(e){throw new S(e,!0)}function qt(){throw new T}function Vt(e){return{__domphyRewrite:e}}function G(e){return typeof e=="object"&&e!==null&&typeof e.__domphyRewrite=="string"}var Yt=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"];function D(e,t={}){let n=new Headers(t.headers);return n.has("content-type")||n.set("content-type","application/json; charset=utf-8"),new Response(JSON.stringify(e),x(k({},t),{headers:n}))}function Jt(e){let t=e.map(s=>({apiRoute:s,routeNode:{path:s.path,page:()=>({div:""})}})),n=I(t.map(s=>s.routeNode)),r=new Map(t.map(s=>[s.routeNode,s.apiRoute]));return s=>b(null,null,function*(){let i=new URL(s.url),o=O(n,i.pathname);if(!o)return D({error:"Not Found"},{status:404});let a=r.get(o.route.chain[o.route.chain.length-1]),l=Yt.filter(c=>a[c]),h=s.method.toUpperCase(),u=a[h];if(!u&&h==="HEAD"&&a.GET&&(u=a.GET),!u&&h==="OPTIONS")return new Response(null,{status:204,headers:{allow:l.join(", ")}});if(!u)return D({error:"Method Not Allowed"},{status:405,headers:{allow:l.join(", ")}});try{let c=yield u(s,{params:o.params});return h==="HEAD"?new Response(null,{status:c.status,headers:c.headers}):c}catch(c){return c instanceof S?new Response(null,{status:c.permanent?308:307,headers:{location:c.to}}):c instanceof T?D({error:"Not Found"},{status:404}):D({error:"Internal Server Error"},{status:500})}})}var Xt=Object.defineProperty,yt=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,vt=(e,t,n)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t)=>{for(var n in t||(t={}))Zt.call(t,n)&&vt(e,n,t[n]);if(yt)for(var n of yt(t))Qt.call(t,n)&&vt(e,n,t[n]);return e},te=["onAbort","onAuxClick","onBeforeMatch","onBeforeToggle","onBlur","onCancel","onCanPlay","onCanPlayThrough","onChange","onClick","onClose","onContextLost","onContextMenu","onContextRestored","onCopy","onCueChange","onCut","onDblClick","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDragStart","onDrop","onDurationChange","onEmptied","onEnded","onError","onFocus","onFormData","onInput","onInvalid","onKeyDown","onKeyPress","onKeyUp","onLoad","onLoadedData","onLoadedMetadata","onLoadStart","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPaste","onPause","onPlay","onPlaying","onProgress","onRateChange","onReset","onResize","onScroll","onScrollEnd","onSecurityPolicyViolation","onSeeked","onSeeking","onSelect","onSlotChange","onStalled","onSubmit","onSuspend","onTimeUpdate","onToggle","onVolumeChange","onWaiting","onWheel","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onGotPointerCapture","onLostPointerCapture","onCompositionStart","onCompositionUpdate","onCompositionEnd","onTransitionEnd","onTransitionStart","onAnimationStart","onAnimationEnd","onAnimationIteration","onFullscreenChange","onFullscreenError","onFocusIn","onFocusOut"],ee=te.reduce((e,t)=>{let n=t.slice(2).toLowerCase();return e[n]=t,e},{}),kt=["a","abbr","address","article","aside","audio","b","base","blockquote","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","slot","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","bdi","bdo","math","menu","search","area","embed","hr","animate","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","prefetch","radialGradient","rect","set","solidColor","stop","svg","switch","symbol","tbreak","text","textPath","tspan","use","view"],E=[],ne=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e).catch(t=>{setTimeout(()=>{throw t},0)})},bt=100,j=class{constructor(){this._listeners={},this._pending=new Map,this._scheduled=!1,this._flushing=new Map,this._selfDepth=0}_dispose(){if(this._listeners)for(let e in this._listeners)this._listeners[e].clear();this._listeners=null}addListener(e,t){if(!this._listeners)return()=>{};if(typeof e!="string"||typeof t!="function")throw new Error("Event name must be a string, listener must be a function");this._listeners[e]||(this._listeners[e]=new Set);let n=()=>this.removeListener(e,t);return this._listeners[e].has(t)||(this._listeners[e].add(t),typeof t.onSubscribe=="function"&&t.onSubscribe(n)),n}removeListener(e,t){if(!this._listeners)return;let n=this._listeners[e];n&&n.has(t)&&(n.delete(t),n.size===0&&delete this._listeners[e])}notify(e,...t){if(!this._listeners||!this._listeners[e])return;let n=E.length?E[E.length-1]:null;if(n&&n[0]===this&&n[1]===e){let r=this._flushing.get(e);if(r&&r[0]===t[0])return;if(this._selfDepth>=bt){console.error(`[Domphy] Runaway self-update on "${e}" \u2014 stopped after ${bt} iterations`);return}this._selfDepth++,this._pending.set(e,{args:t,chain:[]})}else{if(this._isCircular(e))return;this._pending.set(e,{args:t,chain:[...E]})}this._scheduled||(this._scheduled=!0,ne(()=>this._flushAll()))}_isCircular(e){let t=E.findIndex(([r,s])=>r===this&&s===e);if(t===-1)return!1;let n=[...E.slice(t).map(([,r])=>r),e];return console.error(`[Domphy] Circular dependency detected:
2
+ ${n.join(" \u2192 ")}`),!0}_flushAll(){this._scheduled=!1;let e=this._pending;this._pending=new Map;for(let[t,{args:n,chain:r}]of e)E=r,this._flush(t,n);E=[],this._pending.size===0&&(this._selfDepth=0)}_flush(e,t){if(!this._listeners)return;let n=this._listeners[e];if(n){E.push([this,e]),this._flushing.set(e,t);for(let r of[...n])if(n.has(r))try{r(...t)}catch(s){console.error(s)}this._flushing.delete(e),E.pop()}}},_t=class{constructor(e,t=typeof e){this.name=t,this._isState=!0,this._notifier=new j,this.initialValue=e,this._value=e}get(e){return e&&this.addListener(e),this._value}set(e){this._notifier&&(this._value=e,this._notifier.notify(this.name,e))}reset(){this.set(this.initialValue)}addListener(e){return this._notifier?this._notifier.addListener(this.name,e):()=>{}}removeListener(e){this._notifier&&this._notifier.removeListener(this.name,e)}_dispose(){this._notifier&&(this._notifier._dispose(),this._notifier=null)}};function L(e={},t={}){let n=["animation","transition","boxShadow","textShadow","background","fontFamily"],r=["class","rel","transform","acceptCharset","sandbox"],s=["content"];Object.prototype.toString.call(t)==="[object Object]"&&Object.getPrototypeOf(t)===Object.prototype&&(t=M(t));for(let i in t){let o=t[i];if(!(o==null||o===""))if(typeof o=="object"&&!Array.isArray(o))typeof e[i]=="object"?e[i]=L(e[i],o):e[i]=o;else if(n.includes(i))if(typeof e[i]=="function"||typeof o=="function"){let a=e[i];e[i]=l=>{let h=typeof a=="function"?a(l):a,u=typeof o=="function"?o(l):o;return[h,u].filter(c=>c).join(", ")}}else e[i]=[e[i],o].filter(a=>a).join(", ");else if(s.includes(i))if(typeof e[i]=="function"||typeof o=="function"){let a=e[i];e[i]=l=>{let h=typeof a=="function"?a(l):a,u=typeof o=="function"?o(l):o;return[h,u].filter(c=>c).join("")}}else e[i]=[e[i],o].filter(a=>a).join("");else if(r.includes(i))if(typeof e[i]=="function"||typeof o=="function"){let a=e[i];e[i]=l=>{let h=typeof a=="function"?a(l):a,u=typeof o=="function"?o(l):o;return[h,u].filter(c=>c).join(" ")}}else e[i]=[e[i],o].filter(a=>a).join(" ");else if(i.startsWith("on")){let a=i.replace("on","").toLowerCase();ie(e,a,o)}else if(i.startsWith("_on")){let a=i.replace("_on","");se(e,a,o)}else e[i]=o}return e}function re(e=""){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t*16777619>>>0;return String.fromCharCode(97+t%26)+t.toString(16)}function xt(e,t){return e instanceof _t||e!=null&&e._isState?e:new _t(e,t)}function se(e,t,n){let r=`_on${t}`,s=e[r];typeof s=="function"?e[r]=(...i)=>{s(...i),n(...i)}:e[r]=n}function ie(e,t,n){let r=ee[t];if(!r)throw Error(`invalid event name "${t}"`);let s=e[r];typeof s=="function"?e[r]=(i,o)=>{s(i,o),n(i,o)}:e[r]=n}function M(e,t=new WeakMap){if(e===null||typeof e!="object"||typeof e=="function")return e;if(t.has(e))return t.get(e);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&!Array.isArray(e))return e;let r;if(Array.isArray(e)){r=[],t.set(e,r);for(let s of e)r.push(M(s,t));return r}if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(e instanceof Map){r=new Map,t.set(e,r);for(let[s,i]of e)r.set(M(s,t),M(i,t));return r}if(e instanceof Set){r=new Set,t.set(e,r);for(let s of e)r.add(M(s,t));return r}if(ArrayBuffer.isView(e))return new e.constructor(e);if(e instanceof ArrayBuffer)return e.slice(0);r=Object.create(n),t.set(e,r);for(let s of Reflect.ownKeys(e))r[s]=M(e[s],t);return r}function St(e,t=!1){if(Object.prototype.toString.call(e)!=="[object Object]")throw Error(`typeof ${e} is invalid DomphyElement`);let n=Object.keys(e);for(let r=0;r<n.length;r++){let s=n[r],i=e[s];if(r==0&&!kt.includes(s)&&!s.includes("-")&&!t)throw Error(`key ${s} is not valid HTML tag name`);if(s=="style"&&i&&Object.prototype.toString.call(i)!=="[object Object]")throw Error('"style" must be a object');if(s=="$")e.$.forEach(o=>St(o,!0));else{if(s.startsWith("_on")&&typeof i!="function")throw Error(`hook ${s} value "${i}" must be a function `);if(s.startsWith("on")&&typeof i!="function")throw Error(`event ${s} value "${i}" must be a function `);if(s=="_portal"&&typeof i!="function")throw Error('"_portal" must be a function return HTMLElement');if(s=="_context"&&Object.prototype.toString.call(i)!=="[object Object]")throw Error('"_context" must be a object');if(s=="_metadata"&&Object.prototype.toString.call(i)!=="[object Object]")throw Error('"_metadata" must be a object');if(s=="_key"&&typeof i!="string"&&typeof i!="number")throw Error('"_key" must be a string or number')}}return!0}function Rt(e){return/<([a-z][\w-]*)(\s[^>]*)?>.*<\/\1>|<([a-z][\w-]*)(\s[^>]*)?\/>/i.test(e.trim())}function Et(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Tt(e){return Object.keys(e).find(t=>kt.includes(t))}function Mt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function oe(e){if(e.indexOf("@")===0)return[e];for(var t=[],n=0,r=0,s="",i=0,o=e.length;i<o;i++){var a=e[i];if(a==="(")n+=1;else if(a===")")n-=1;else if(a==="[")r+=1;else if(a==="]")r-=1;else if(a===","&&!n&&!r){t.push(s.trim()),s="";continue}s+=a}return t.push(s.trim()),t}function X(e){let t=e.trim();return t.startsWith("@")?t.replace(/\s+/g,""):t.replace(/\s*([>+~,])\s*/g,"$1").replace(/\s+/g," ").replace(/\(\s*odd\s*\)/g,"(2n+1)").replace(/\(\s*even\s*\)/g,"(2n)").trim()}function ae(e,t){for(let n=0;n<e.length;n++){let r=e[n],s=null;typeof r.selectorText=="string"?s=X(r.selectorText):typeof r.cssText=="string"&&r.cssText.startsWith("@")&&(s=X(r.cssText.split("{")[0])),s&&!t.has(s)&&t.set(s,r)}return t}function Ct(e){var t;let n=e.querySelector("#domphy-style");return n||(n=document.createElement("style"),n.id="domphy-style",e.appendChild(n)),n.dataset.domphyBase!=="true"&&((t=n.sheet)==null||t.insertRule("[hidden] { display: none !important; }",0),n.dataset.domphyBase="true"),n}var Z=e=>{if(Array.isArray(e.$)){let t={};return e.$.forEach(n=>L(t,Z(n))),delete e.$,L(t,e),t}else return e},le=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"],he=["svg","circle","path","rect","ellipse","line","polyline","polygon","g","defs","use","symbol","linearGradient","radialGradient","stop","clipPath","mask","filter","text","tspan","textPath","image","pattern","marker","animate","animateTransform","animateMotion","feGaussianBlur","feComposite","feColorMatrix","feMerge","feMergeNode","feOffset","feFlood","feBlend","foreignObject"],Lt=["allowFullScreen","async","autoFocus","autoPlay","checked","compact","contentEditable","controls","declare","default","defer","disabled","formNoValidate","hidden","isMap","itemScope","loop","multiple","muted","noHref","noShade","noValidate","open","playsInline","readonly","required","reversed","scoped","selected","sortable","trueSpeed","typeMustMatch","wmode","autoCapitalize","translate","spellCheck","inert","download","noModule","paused","autoPictureInPicture"],B={transform:["webkit","ms"],transition:["webkit","ms"],animation:["webkit"],userSelect:["webkit","ms"],flexDirection:["webkit","ms"],flexWrap:["webkit","ms"],justifyContent:["webkit","ms"],alignItems:["webkit","ms"],alignSelf:["webkit","ms"],order:["webkit","ms"],flexGrow:["webkit","ms"],flexShrink:["webkit","ms"],flexBasis:["webkit","ms"],columns:["webkit"],columnCount:["webkit"],columnGap:["webkit"],columnRule:["webkit"],columnWidth:["webkit"],boxSizing:["webkit"],appearance:["webkit","moz"],filter:["webkit"],backdropFilter:["webkit"],clipPath:["webkit"],mask:["webkit"],maskImage:["webkit"],textSizeAdjust:["webkit","ms"],hyphens:["webkit","ms"],writingMode:["webkit","ms"],gridTemplateColumns:["ms"],gridTemplateRows:["ms"],gridAutoColumns:["ms"],gridAutoRows:["ms"],gridColumn:["ms"],gridRow:["ms"],marginInlineStart:["webkit"],marginInlineEnd:["webkit"],paddingInlineStart:["webkit"],paddingInlineEnd:["webkit"],minInlineSize:["webkit"],maxInlineSize:["webkit"],minBlockSize:["webkit"],maxBlockSize:["webkit"],inlineSize:["webkit"],blockSize:["webkit"],tabSize:["moz"],overscrollBehavior:["webkit","ms"],touchAction:["ms"],resize:["webkit"],printColorAdjust:["webkit"],backgroundClip:["webkit"],boxDecorationBreak:["webkit"],overflowScrolling:["webkit"]},ue=["viewBox","preserveAspectRatio","gradientTransform","gradientUnits","spreadMethod","markerStart","markerMid","markerEnd","markerHeight","markerWidth","markerUnits","refX","refY","patternContentUnits","patternTransform","patternUnits","filterUnits","primitiveUnits","kernelUnitLength","clipPathUnits","maskContentUnits","maskUnits"],ce=class{constructor(e,t,n){this._notifier=new j,this._releases=[],this.parent=n,this.isBoolean=Lt.includes(e),ue.includes(e)?this.name=e:this.name=Mt(e),this.value=void 0,this.set(t)}render(){if(!this.parent||!this.parent.domElement)return;let e=this.parent.domElement,t=["value"];this.isBoolean?this.value===!1||this.value==null?e.removeAttribute(this.name):e.setAttribute(this.name,this.value===!0?"":this.value):this.value==null?e.removeAttribute(this.name):t.includes(this.name)?e[this.name]=this.value:e.setAttribute(this.name,this.value)}set(e){var t,n;let r=this.value;if(this._releases.length){for(let s of this._releases)s();this._releases=[]}if(e==null)this.value=null;else if(typeof e=="function"){let s=()=>{if(!this.parent||this.parent._disposed)return;let i=this.value;this.value=this.isBoolean?!!e(s):e(s),this.render(),i!==this.value&&this._notifier.notify(this.name,this.value)};s.elementNode=this.parent,s.debug=`class:${(t=this.parent)==null?void 0:t.tagName}_${(n=this.parent)==null?void 0:n.nodeId} attribute:${this.name}`,s.onSubscribe=i=>{this._releases.push(i),this.parent&&this.parent.addHook("BeforeRemove",()=>{i(),s=null})},this.value=this.isBoolean?!!e(s):e(s)}else this.value=this.isBoolean?!!e:e;this.render(),r!==this.value&&this._notifier.notify(this.name,this.value)}addListener(e){let t=e;t.onSubscribe=n=>{var r;return(r=this.parent)==null?void 0:r.addHook("BeforeRemove",n)},this._notifier.addListener(this.name,t)}remove(){this.parent&&this.parent.attributes&&this.parent.attributes.remove(this.name),this._dispose()}_dispose(){this._notifier._dispose(),this.value=null,this.parent=null}generateHTML(){let{name:e,value:t}=this;if(this.isBoolean)return t?`${e}`:"";{let n=Array.isArray(t)?JSON.stringify(t):t;return`${e}="${Et(String(n))}"`}}},de=class{constructor(e){this.items={},this.parent=e}generateHTML(){if(!this.items)return"";let e=Object.values(this.items).map(t=>t.generateHTML()).join(" ");return e?` ${e}`:""}get(e){var t;if(this.items)return(t=this.items[e])==null?void 0:t.value}set(e,t){!this.items||!this.parent||(this.items[e]?this.items[e].set(t):this.items[e]=new ce(e,t,this.parent))}addListener(e,t){this.has(e)&&this.items[e].addListener(t)}has(e){return this.items?Object.prototype.hasOwnProperty.call(this.items,e):!1}remove(e){this.items&&(this.items[e]&&(this.items[e]._dispose(),delete this.items[e]),this.parent&&this.parent.domElement&&this.parent.domElement instanceof Element&&this.parent.domElement.removeAttribute(e))}_dispose(){if(this.items)for(let e in this.items)this.items[e]._dispose();this.items=null,this.parent=null}toggle(e,t){if(!Lt.includes(e))throw Error(`${e} is not a boolean attribute`);t===!0?this.set(e,!0):t===!1?this.remove(e):this.has(e)?this.remove(e):this.set(e,!0)}addClass(e){if(!e||typeof e!="string")return;let t=(r,s)=>{let i=(r||"").split(" ").filter(o=>o);return!i.includes(s)&&i.push(e),i.join(" ")},n=this.get("class");typeof n=="function"?this.set("class",()=>t(n(),e)):this.set("class",t(n,e))}hasClass(e){return!e||typeof e!="string"?!1:(this.get("class")||"").split(" ").filter(t=>t).includes(e)}toggleClass(e){!e||typeof e!="string"||(this.hasClass(e)?this.removeClass(e):this.addClass(e))}removeClass(e){if(!e||typeof e!="string")return;let t=(this.get("class")||"").split(" ").filter(n=>n).filter(n=>n!==e);t.length>0?this.set("class",t.join(" ")):this.remove("class")}replaceClass(e,t){!e||!t||typeof e!="string"||typeof t!="string"||this.hasClass(e)&&(this.removeClass(e),this.addClass(t))}},pe=class{constructor(e,t){this.type="TextNode",this.parent=t,this.text=e===""?"\u200B":String(e)}_createDOMNode(){let e;if(Rt(this.text)){let t=document.createElement("template");t.innerHTML=this.text.trim(),e=t.content.firstChild||document.createTextNode("")}else e=document.createTextNode(this.text);return this.domText=e,e}_dispose(){this.domText=void 0,this.text=""}generateHTML(){return this.text==="\u200B"?"&#8203;":Rt(this.text)?this.text:Et(this.text)}render(e){let t=this._createDOMNode();e.appendChild(t)}},me=class{constructor(e){this.items=[],this._nextKey=0,this.owner=e}_createNode(e){return typeof e=="object"&&e!==null?new R(e,this.owner,this._nextKey++):new pe(e==null?"":String(e),this.owner)}_moveDomElement(e,t){if(!this.owner||!this.owner.domElement)return;let n=this.owner.domElement,r=e instanceof R?e.domElement:e.domText;if(r){let s=n.childNodes[t]||null;r!==s&&n.insertBefore(r,s)}}_swapDomElement(e,t){if(!this.owner||!this.owner.domElement)return;let n=this.owner.domElement,r=e instanceof R?e.domElement:e.domText,s=t instanceof R?t.domElement:t.domText;if(!r||!s)return;let i=r.nextSibling,o=s.nextSibling;n.insertBefore(r,o),n.insertBefore(s,i)}update(e,t=!0,n=!1){var r,s,i,o;let a=this.items.slice(),l=new Map;for(let p of a)p instanceof R&&p.key!==null&&p.key!==void 0&&l.set(p.key,p);!n&&this.owner.domElement&&((s=(r=this.owner._hooks)==null?void 0:r.BeforeUpdate)==null||s.call(r,this.owner,e));let h=new Set(a),u=new Set;for(let p=0;p<e.length;p++){let m=e[p],g=typeof m=="object"&&m!==null,f=g?m._key:void 0,v=g?Tt(m):void 0;if(f!==void 0){let y=l.get(f);if(y instanceof R&&y.tagName===v){l.delete(f);let _=this.items.indexOf(y);if(_!==p&&_>=0){let d=!!y._portal;this.move(_,p,d?!1:t,!0)}y.parent=this.owner,y.patch(m),u.add(y);continue}}else if(g){let y=this.items[p];if(y instanceof R&&y.key==null&&y.tagName===v&&h.has(y)&&!u.has(y)){y.parent=this.owner,y.patch(m),u.add(y);continue}}u.add(this.insert(m,p,t,!0))}let c=this.items.slice(e.length);for(let p of c)this.remove(p,t,!0);l.forEach(p=>this.remove(p,t,!0)),n||(o=(i=this.owner._hooks)==null?void 0:i.Update)==null||o.call(i,this.owner)}insert(e,t,n=!0,r=!1){var s,i;let o=this.items.length,a=typeof t!="number"||isNaN(t)||t<0||t>o?o:t,l=this._createNode(e);if(this.items.splice(a,0,l),l instanceof R){l._hooks.Insert&&l._hooks.Insert(l);let h=this.owner.domElement;if(n&&h)if(l._portal){let u=l._portal(this.owner.getRoot());u&&l.render(u)}else{let u=l._createDOMNode(),c=(s=h.childNodes[a])!=null?s:null;h.insertBefore(u,c);let p=h.getRootNode(),m=p instanceof ShadowRoot?p:document.head,g=Ct(m);l.styles.render(g),l._hooks.Mount&&l._hooks.Mount(l),l.children.items.forEach(f=>{if(f instanceof R&&f._portal){let v=f._portal(f.getRoot());v&&f.render(v)}else f.render(u)})}}else{let h=this.owner.domElement;if(n&&h){let u=l._createDOMNode(),c=(i=h.childNodes[a])!=null?i:null;h.insertBefore(u,c)}}return!r&&this.owner.domElement&&this.owner._hooks.Update&&this.owner._hooks.Update(this.owner),l}remove(e,t=!0,n=!1){let r=this.items.indexOf(e);if(!(r<0)){if(e instanceof R){if(e._beforeRemoveFired)return;let s=()=>{let i=e.domElement,o=this.items.indexOf(e);o>=0&&this.items.splice(o,1),t&&i&&i.remove(),e._dispose()};if(e._hooks.BeforeRemove&&e.domElement){let i=!1,o=()=>{i||(i=!0,s())};e._beforeRemoveFired=!0,e._hooks.BeforeRemove(e,o),e._hooks.BeforeRemove.length<2&&!i&&o()}else s()}else{let s=e.domText;this.items.splice(r,1),t&&s&&s.remove(),e._dispose()}!n&&this.owner.domElement&&this.owner._hooks.Update&&this.owner._hooks.Update(this.owner)}}clear(e=!0,t=!1){if(this.items.length===0)return;let n=this.items.slice();for(let r of n)this.remove(r,e,!0);!t&&this.owner.domElement&&this.owner._hooks.Update&&this.owner._hooks.Update(this.owner)}_dispose(){this.items.forEach(e=>e._dispose()),this.items=[]}swap(e,t,n=!0,r=!1){if(e<0||t<0||e>=this.items.length||t>=this.items.length||e===t)return;let s=this.items[e],i=this.items[t];this.items[e]=i,this.items[t]=s,n&&this._swapDomElement(s,i),!r&&this.owner.domElement&&this.owner._hooks.Update&&this.owner._hooks.Update(this.owner)}move(e,t,n=!0,r=!1){if(e<0||e>=this.items.length||t<0||t>=this.items.length||e===t)return;let s=this.items[e];this.items.splice(e,1),this.items.splice(t,0,s),n&&this._moveDomElement(s,t),!r&&this.owner.domElement&&this.owner._hooks.Update&&this.owner._hooks.Update(this.owner)}generateHTML(){let e="";for(let t of this.items)e+=t.generateHTML();return e}},fe=class{constructor(e,t,n){this.value="",this.name=e,this.cssName=Mt(e),this.parentRule=n,this.set(t)}_domUpdate(){if(!this.parentRule)return;let e=this.parentRule.domRule;if(e&&e.style){let t=e.style;t.setProperty(this.cssName,String(this.value)),B[this.name]&&B[this.name].forEach(n=>{t.setProperty(`-${n}-${this.cssName}`,String(this.value))})}}_dispose(){this.value="",this.parentRule=null}set(e){var t,n,r,s;if(typeof e=="function"){let i=(()=>{var o;!this.parentRule||(o=this.parentRule.parentNode)!=null&&o._disposed||(this.value=e(i),this._domUpdate())});i.onSubscribe=o=>{var a;(a=this.parentRule.parentNode)==null||a.addHook("BeforeRemove",()=>{o(),i=null})},i.elementNode=this.parentRule.root,i.debug=`class:${(n=(t=this.parentRule)==null?void 0:t.root)==null?void 0:n.tagName}_${(s=(r=this.parentRule)==null?void 0:r.root)==null?void 0:s.nodeId} style:${this.name}`,this.value=e(i)}else this.value=e;this._domUpdate()}remove(){if(this.parentRule){if(this.parentRule.domRule instanceof CSSStyleRule){let e=this.parentRule.domRule.style;e.removeProperty(this.cssName),B[this.name]&&B[this.name].forEach(t=>{e.removeProperty(`-${t}-${this.cssName}`)})}delete this.parentRule.styleBlock[this.name],this._dispose()}}cssText(){let e=`${this.cssName}: ${this.value}`;return B[this.name]&&B[this.name].forEach(t=>{e+=`; -${t}-${this.cssName}: ${this.value}`}),e}},C=class Q{constructor(t,n){this.domRule=null,this.styleBlock={},this.selectorText=t,this.styleList=new Pt(this),this.parent=n}_dispose(){if(this.styleBlock)for(let t of Object.values(this.styleBlock))t._dispose();this.styleList&&this.styleList._dispose(),this.styleBlock=null,this.styleList=null,this.domRule=null,this.parent=null}get root(){let t=this.parent;for(;t instanceof Q;)t=t.parent;return t}get parentNode(){let t=this.parent;for(;t&&t instanceof Q;)t=t.parent;return t}insertStyle(t,n){this.styleBlock&&(this.styleBlock[t]?this.styleBlock[t].set(n):this.styleBlock[t]=new fe(t,n,this))}removeStyle(t){this.styleBlock&&this.styleBlock[t]&&this.styleBlock[t].remove()}cssText(){if(!this.styleBlock||!this.styleList)return"";let t=Object.values(this.styleBlock).map(r=>r.cssText()).join(";"),n=this.styleList.cssText();return`${this.selectorText} { ${t} ${n} } `}mount(t){!t||!this.styleList||(this.domRule=t,"cssRules"in t&&this.styleList.mount(t.cssRules))}remove(){if(this.domRule&&this.domRule.parentStyleSheet){let t=this.domRule.parentStyleSheet,n=t.cssRules;for(let r=0;r<n.length;r++)if(n[r]===this.domRule){t.deleteRule(r);break}}this._dispose()}render(t){if(!this.styleBlock||!this.styleList)return;let n=Object.values(this.styleBlock).map(r=>r.cssText()).join(";");try{if(this.selectorText.startsWith("@")){if(/^@(media|supports|container|layer)\b/.test(this.selectorText)){let r=t.insertRule(`${this.selectorText} {}`,t.cssRules.length),s=t.cssRules[r];"cssRules"in s&&(this.mount(s),this.styleList.render(s))}else if(this.selectorText.startsWith("@keyframes")||this.selectorText.startsWith("@font-face")){let r=this.cssText(),s=t.insertRule(r,t.cssRules.length),i=t.cssRules[s];this.mount(i)}}else{let r=`${this.selectorText} { ${n} }`,s=t.insertRule(r,t.cssRules.length),i=t.cssRules[s];i&&"selectorText"in i&&this.mount(i)}}catch(r){console.warn("Failed to insert rule:",this.selectorText,r)}}},Pt=class{constructor(e){this.items=[],this.domStyle=null,this.parent=e}get parentNode(){let e=this.parent;for(;e&&e instanceof C;)e=e.parent;return e}addCSS(e,t=""){if(!this.items||!this.parent)return;let n={};function r(s,i){return s.startsWith("&")?`${i}${s.slice(1)}`:`${i} ${s}`}for(let s in e){let i=e[s],o=oe(s);for(let a of o){let l=r(a,t);if(/^@(container|layer|supports|media)\b/.test(a)){if(typeof i=="object"&&i!=null){let h=new C(a,this.parent);h.styleList.addCSS(i,t),this.items.push(h)}}else if(a.startsWith("@keyframes")){let h=new C(a,this.parent);h.styleList.addCSS(i,""),this.items.push(h)}else if(a.startsWith("@font-face")){let h=new C(a,this.parent);for(let u in i)h.insertStyle(u,i[u]);this.items.push(h)}else if(typeof i=="object"&&i!=null){let h=new C(l,this.parent);this.items.push(h);for(let[u,c]of Object.entries(i))if(typeof c=="object"&&c!=null){let p=r(u,l);u.startsWith("&")?this.addCSS(c,p):h.styleList.insertRule(p).styleList.addCSS(c,p)}else h.insertStyle(u,c)}else n[a]=i}}if(Object.keys(n).length){let s=new C(t,this.parent);for(let i in n)s.insertStyle(i,n[i]);this.items.push(s)}}cssText(){return this.items?this.items.map(e=>e.cssText()).join(""):""}insertRule(e){if(!this.items||!this.parent)return null;let t=this.items.find(n=>n.selectorText===e);return t||(t=new C(e,this.parent),this.items.push(t)),t}hydrate(e){if(this.items)for(let t of this.items){let n=e.get(X(t.selectorText));n&&t.mount(n)}}mount(e){if(!this.items)return;if(!e)throw Error("Require domRuleList argument");let t=0,n=r=>r.replace("(odd)","(2n+1)").replace("(even)","(2n)");this.items.forEach((r,s)=>{let i=s-t,o=e[i];o&&(r.selectorText.startsWith("@")&&o instanceof CSSKeyframesRule||"keyText"in o?r.mount(o):"selectorText"in o?o.selectorText!==n(r.selectorText)?t+=1:r.mount(o):"cssRules"in o&&r.mount(o))})}render(e){e instanceof HTMLStyleElement?(this.domStyle=e,this.items.forEach(t=>t.render(e.sheet))):e instanceof CSSGroupingRule&&this.items.forEach(t=>t.render(e))}_dispose(){if(this.items)for(let e=0;e<this.items.length;e++)this.items[e]._dispose();this.items=[],this.parent=null,this.domStyle=null}},R=class N{constructor(t,n=null,r=0){this._disposed=!1,this._beforeRemoveFired=!1,this.type="ElementNode",this.parent=null,this.children=new me(this),this.styles=new Pt(this),this.attributes=new de(this),this.domElement=null,this._hooks={},this._events=null,this._boundEvents=new Set,this._context={},this._metadata={},this.key=null;var s,i;t=M(t),St(t),t.style=t.style||{},this.parent=n,this.tagName=Tt(t),t=Z(t),this.key=(s=t._key)!=null?s:null,this._context=t._context||{},this._metadata=t._metadata||{};let o=`${(i=this.parent)==null?void 0:i.nodeId}.${r}`,a=JSON.stringify(t.style||{},(h,u)=>typeof u=="function"?o:u);this.nodeId=re(o+a),this.attributes.addClass(`${this.tagName}_${this.nodeId}`),t._onSchedule&&t._onSchedule(this,t),this.merge(t);let l=t[this.tagName];if(l!=null&&l!=null)if(typeof l=="function"){let h=()=>{if(this._disposed)return;let u=l(h);this.children.update(Array.isArray(u)?u:[u])};h.elementNode=this,h.debug=`class:${this.tagName}_${this.nodeId} children`,h.onSubscribe=u=>this.addHook("BeforeRemove",()=>{u(),h=null}),h&&h()}else this.children.update(Array.isArray(l)?l:[l]);this._hooks.Init&&this._hooks.Init(this)}_createDOMNode(){let t=he.includes(this.tagName)?document.createElementNS("http://www.w3.org/2000/svg",this.tagName):document.createElement(this.tagName);if(this.domElement=t,this._events)for(let n in this._events)this._bindEvent(n);return this.attributes&&Object.values(this.attributes.items).forEach(n=>n.render()),t}_bindEvent(t){if(!this.domElement||this._boundEvents.has(t))return;this._boundEvents.add(t);let n=r=>{var s,i;return(i=(s=this._events)==null?void 0:s[t])==null?void 0:i.call(s,r,this)};this.domElement.addEventListener(t,n),this.addHook("BeforeRemove",r=>{var s;(s=r.domElement)==null||s.removeEventListener(t,n),n=null})}_dispose(){var t,n,r,s;this._disposed||(this._disposed=!0,this._beforeRemoveFired||(this._beforeRemoveFired=!0,(n=(t=this._hooks).BeforeRemove)==null||n.call(t,this,()=>{})),this.children&&this.children._dispose(),this.styles&&(this.styles.items.forEach(i=>i.remove()),this.styles._dispose()),this.attributes&&this.attributes._dispose(),(s=(r=this._hooks).Remove)==null||s.call(r,this),this.domElement=null,this._hooks={},this._events=null,this._context={},this._metadata={},this.parent=null)}merge(t){L(this._context,t._context),L(this._metadata,t._metadata);let n=Object.keys(t);for(let r=0;r<n.length;r++){let s=n[r],i=t[s];["$","_onSchedule","_key","_context","_metadata","style",this.tagName].includes(s)||(["_onInit","_onInsert","_onMount","_onBeforeUpdate","_onUpdate","_onBeforeRemove","_onRemove"].includes(s)?this.addHook(s.substring(3),i):s.startsWith("on")?this.addEvent(s.substring(2).toLowerCase(),i):s=="_portal"?this._portal=i:s=="class"&&typeof i=="string"?this.attributes.addClass(i):this.attributes.set(s,i))}t.style&&this.styles.addCSS(t.style||{},`.${`${this.tagName}_${this.nodeId}`}`)}patch(t){let n=M(t);n.style=n.style||{},n=Z(n);let r=n[this.tagName];if(typeof r!="function"){let h=r==null?[]:Array.isArray(r)?r:[r];this.children.update(h,!!this.domElement,!0)}n._context&&L(this._context,n._context),n._metadata&&L(this._metadata,n._metadata);let s=`${this.tagName}_${this.nodeId}`,i=["$","_onSchedule","_key","_context","_metadata","style",this.tagName],o=["_onInit","_onInsert","_onMount","_onBeforeUpdate","_onUpdate","_onBeforeRemove","_onRemove"],a=new Set(["class"]),l=null;this._events={};for(let h of Object.keys(n)){if(i.includes(h)||o.includes(h)||h==="_portal")continue;let u=n[h];h.startsWith("on")&&typeof u=="function"?this.addEvent(h.substring(2).toLowerCase(),u):h==="class"&&typeof u=="string"?l=u:(this.attributes.set(h,u),a.add(h))}if(this.attributes.set("class",l?`${s} ${l}`:s),this.attributes.items)for(let h of Object.keys(this.attributes.items))a.has(h)||this.attributes.remove(h);if(this._events)for(let h in this._events)this._bindEvent(h)}addEvent(t,n){this._events=this._events||{};let r=this._events[t];typeof r=="function"?this._events[t]=(s,i)=>{r(s,i),n(s,i)}:this._events[t]=n}addHook(t,n){let r=this._hooks[t];if(typeof r=="function"){let s=((...i)=>{r(...i),n(...i)});try{Object.defineProperty(s,"length",{value:Math.max(r.length,n.length),configurable:!0})}catch(i){}this._hooks[t]=s}else this._hooks[t]=n}getRoot(){let t=this;for(;t&&t instanceof N&&t.parent;)t=t.parent;return t}getContext(t){let n=this;for(;n&&(!n._context||!Object.prototype.hasOwnProperty.call(n._context,t));)n=n.parent;return n&&n._context?n._context[t]:void 0}setContext(t,n){this._context=this._context||{},this._context[t]=n}getMetadata(t){return this._metadata?this._metadata[t]:void 0}setMetadata(t,n){this._metadata=this._metadata||{},this._metadata[t]=n}generateCSS(){if(!this.styles||!this.children)return"";let t=this.styles.cssText();return t+=this.children.items.map(n=>n instanceof N?n.generateCSS():"").join(""),t}generateHTML(){if(!this.children||!this.attributes)return"";let t=this.attributes.generateHTML();if(le.includes(this.tagName))return`<${this.tagName}${t}>`;let n=this.children.generateHTML();return`<${this.tagName}${t}>${n}</${this.tagName}>`}mount(t,n){if(!t)throw new Error("Missing dom node on bind");if(this.domElement=t,this._events)for(let r in this._events)this._bindEvent(r);if(this.children&&this.children.items.forEach((r,s)=>{let i=t.childNodes[s];i&&(r instanceof N?r.mount(i):r.domText=i)}),n){let r=n.sheet;r&&this._hydrateStyles(ae(r.cssRules,new Map))}this._hooks.Mount&&this._hooks.Mount(this)}_hydrateStyles(t){var n;if((n=this.styles)==null||n.hydrate(t),this.children)for(let r of this.children.items)r instanceof N&&r._hydrateStyles(t)}render(t){let n=this._createDOMNode();t.appendChild(n),this._hooks.Mount&&this._hooks.Mount(this);let r=this.getRoot().styles.domStyle,s=t.getRootNode(),i=s instanceof ShadowRoot?s:document.head;return r||(r=Ct(i)),this.styles.render(r),this.children.items.forEach(o=>{if(o instanceof N&&o._portal){let a=o._portal(this.getRoot());a&&o.render(a)}else o.render(n)}),n}remove(){if(this.parent)this.parent.children.remove(this);else{let t=()=>{var n;(n=this.domElement)==null||n.remove(),this._dispose()};if(this._hooks.BeforeRemove&&this.domElement){let n=!1,r=()=>{n||(n=!0,t())};this._beforeRemoveFired=!0,this._hooks.BeforeRemove(this,r),this._hooks.BeforeRemove.length<2&&!n&&r()}else t()}}},Ot=class{constructor(e){this._notifier=new j,this.initialRecord=wt({},e),this._record=wt({},e)}get(e,t){return t&&this._notifier.addListener(e,t),this._record[e]}set(e,t){this._record[e]=t,this._notifier.notify(e)}addListener(e,t){return this._notifier.addListener(e,t)}removeListener(e,t){this._notifier.removeListener(e,t)}reset(e){this.set(e,this.initialRecord[e])}_dispose(){this._notifier._dispose()}};function tt(e,t){return b(this,null,function*(){let n={},r=null;for(let s of e){if(!s)continue;let i=typeof s=="function"?yield s(t):s;for(let a of Object.keys(i)){if(a==="title")continue;let l=i[a];l!==void 0&&(n[a]=l)}let o=i.title;if(o!==void 0){if(typeof o=="string"){n.title=r?r.replace("%s",o):o;continue}o.absolute!==void 0?n.title=o.absolute:o.default!==void 0&&(n.title=r?r.replace("%s",o.default):o.default),o.template!==void 0&&(r=o.template)}}return n})}function H(e,t){return!t||/^[a-z][a-z0-9+.-]*:/i.test(e)?e:new URL(e,t).toString()}function ge(e){if(typeof e=="string")return e;let t=[];return t.push(e.index===!1?"noindex":"index"),t.push(e.follow===!1?"nofollow":"follow"),e.noarchive&&t.push("noarchive"),e.nosnippet&&t.push("nosnippet"),e.noimageindex&&t.push("noimageindex"),t.join(", ")}function $(e){var l,h,u,c,p,m,g,f,v,y,_;let t=[],n=e.metadataBase,r=(d,w)=>{w!==void 0&&t.push({tag:"meta",attributes:{name:d,content:w}})},s=(d,w)=>{w!==void 0&&t.push({tag:"meta",attributes:{property:d,content:w}})};e.title!==void 0&&t.push({tag:"title",attributes:{},content:e.title}),r("description",e.description),r("application-name",e.applicationName),r("generator",e.generator),r("keywords",(l=e.keywords)==null?void 0:l.join(", ")),r("referrer",e.referrer),r("theme-color",e.themeColor),r("color-scheme",e.colorScheme),r("viewport",e.viewport),e.robots!==void 0&&r("robots",ge(e.robots));for(let d of(h=e.authors)!=null?h:[])r("author",d.name),d.url&&t.push({tag:"link",attributes:{rel:"author",href:d.url}});if(e.icons!==void 0){let d=typeof e.icons=="string"?{icon:e.icons}:e.icons;d.icon&&t.push({tag:"link",attributes:{rel:"icon",href:d.icon}}),d.shortcut&&t.push({tag:"link",attributes:{rel:"shortcut icon",href:d.shortcut}}),d.apple&&t.push({tag:"link",attributes:{rel:"apple-touch-icon",href:d.apple}})}let i=e.openGraph;if(i){s("og:title",(u=i.title)!=null?u:e.title),s("og:description",(c=i.description)!=null?c:e.description),s("og:url",i.url?H(i.url,n):void 0),s("og:site_name",i.siteName),s("og:type",i.type),s("og:locale",i.locale);for(let d of(p=i.images)!=null?p:[]){let w=typeof d=="string"?{url:d}:d;s("og:image",H(w.url,n)),w.width!==void 0&&s("og:image:width",String(w.width)),w.height!==void 0&&s("og:image:height",String(w.height)),w.alt!==void 0&&s("og:image:alt",w.alt)}}let o=e.twitter;if(o){r("twitter:card",(m=o.card)!=null?m:"summary"),r("twitter:title",(g=o.title)!=null?g:e.title),r("twitter:description",(f=o.description)!=null?f:e.description),r("twitter:site",o.site),r("twitter:creator",o.creator);for(let d of(v=o.images)!=null?v:[])r("twitter:image",H(d,n))}let a=e.alternates;if(a){a.canonical&&t.push({tag:"link",attributes:{rel:"canonical",href:H(a.canonical,n)}});for(let d of Object.keys((y=a.languages)!=null?y:{}))t.push({tag:"link",attributes:{rel:"alternate",hreflang:d,href:H(a.languages[d],n)}})}for(let d of Object.keys((_=e.other)!=null?_:{}))r(d,e.other[d]);return t}function ye(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function ve(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function et(e){return e.map(t=>{var r;let n=Object.keys(t.attributes).map(s=>` ${s}="${ye(t.attributes[s])}"`).join("");return t.tag==="title"?`<title>${ve((r=t.content)!=null?r:"")}</title>`:`<${t.tag}${n}>`}).join(`
3
+ `)}var Bt="data-domphy-head";function K(e){var t;if(typeof document!="undefined"){for(let n of Array.from(document.head.querySelectorAll(`[${Bt}]`)))n.remove();for(let n of e){if(n.tag==="title"){document.title=(t=n.content)!=null?t:"";continue}let r=document.createElement(n.tag);for(let s of Object.keys(n.attributes))r.setAttribute(s,n.attributes[s]);r.setAttribute(Bt,""),document.head.appendChild(r)}}}var Ye=3e4,U=class{constructor(){this.entries=new Map;this.inflight=new Map}seed(t){for(let n of Object.keys(t))this.entries.set(n,{data:t[n],timestamp:Date.now(),consumable:!0})}snapshot(t){let n={};for(let r of t){let s=this.entries.get(r);s&&(n[r]=s.data)}return n}invalidate(t){if(t===void 0){this.entries.clear();return}for(let n of this.entries.keys())n.startsWith(t)&&this.entries.delete(n)}load(t,n,r,s){return b(this,null,function*(){let i=this.entries.get(t);if(i){let l=s!==void 0?s*1e3:0,h=Date.now()-i.timestamp<=l,u=i.consumable&&Date.now()-i.timestamp<=3e4;if(h||u)return i.consumable&&!h&&this.entries.delete(t),i.data;this.entries.delete(t)}let o=this.inflight.get(t);if(o)return o;let a=Promise.resolve(n(r)).then(l=>(this.inflight.delete(t),s!==void 0&&s>0&&this.entries.set(t,{data:l,timestamp:Date.now(),consumable:!1}),l),l=>{throw this.inflight.delete(t),l});return this.inflight.set(t,a),a})}prefetch(t,n,r,s){return b(this,null,function*(){if(s!==void 0){yield this.load(t,n,r,s);return}let i=this.entries.get(t);if(i&&Date.now()-i.timestamp<=3e4||this.inflight.has(t))return;let o=yield n(r);this.entries.set(t,{data:o,timestamp:Date.now(),consumable:!0})})}};function nt(){var n,r,s;let e=new Map,t=(r=(n=window.history.state)==null?void 0:n.__domphyIndex)!=null?r:0;return((s=window.history.state)==null?void 0:s.__domphyIndex)===void 0&&window.history.replaceState({__domphyIndex:t},""),"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),{url:()=>new URL(window.location.href),push:i=>{t++,window.history.pushState({__domphyIndex:t},"",i)},replace:i=>{window.history.replaceState({__domphyIndex:t},"",i)},go:i=>window.history.go(i),listen:i=>{let o=()=>{var a,l;t=(l=(a=window.history.state)==null?void 0:a.__domphyIndex)!=null?l:0,i(new URL(window.location.href))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},saveScroll:i=>e.set(t,i),readScroll:()=>{var i;return(i=e.get(t))!=null?i:null}}}var Nt="http://localhost";function we(e="/"){let t=[e],n=0,r=new Set;return{url:()=>new URL(t[n],Nt),push:s=>{t.splice(n+1),t.push(s),n++},replace:s=>{t[n]=s},go:s=>{let i=Math.min(Math.max(n+s,0),t.length-1);if(i===n)return;n=i;let o=new URL(t[n],Nt);for(let a of r)a(o)},listen:s=>(r.add(s),()=>r.delete(s))}}function it(e){return{div:[{h2:"Application error"},{p:e.message}]}}function ot(){return{div:[{h2:"404"},{p:"This page could not be found."}]}}function rt(e,t){return e.findIndex(n=>n.status===t)}function q(e){var _;let{match:t,baseContext:n,results:r,retry:s,defaultError:i,defaultNotFound:o}=e,{chain:a,chainIds:l}=t.route,h={};for(let d=0;d<a.length;d++)h[l[d]]=(_=r[d])==null?void 0:_.data;let u=a.map((d,w)=>{var P;return x(k({},n),{data:(P=r[w])==null?void 0:P.data,segmentData:h})}),c=rt(r,"error"),p=rt(r,"notfound"),m=rt(r,"pending"),g,f,v;if(c!==-1){let d=st(a,c,P=>!!P.error);g=(d===-1?i:a[d].error)(r[c].error,s),g._key=`${l[Math.max(d,0)]}:error`,f=Math.min(d,c-1),v="error"}else if(p!==-1){let d=st(a,p,P=>!!P.notFound);g=(d===-1?o:a[d].notFound)(),g._key=`${l[Math.max(d,0)]}:notfound`,f=Math.min(d,p-1),v="notfound"}else if(m!==-1){let d=st(a,m,w=>!!w.loading);if(d===-1)return{element:{div:""},status:"loading"};g=a[d].loading(u[d]),g._key=`${l[d]}:loading`,f=Math.min(d,m-1),v="loading"}else g=a[a.length-1].page(u[a.length-1]),g._key=`${t.route.id}:page`,f=a.length-1,v="idle";let y=g;for(let d=f;d>=0;d--){let w=a[d].layout;w&&(y=w(y,u[d]),y._key===void 0&&(y._key=`${l[d]}:layout`))}return{element:y,status:v}}function st(e,t,n){for(let r=t;r>=0;r--)if(n(e[r]))return r;return-1}function at(e){let t=e();return t._key===void 0&&(t._key="app:notfound"),{element:t,status:"notfound"}}var F=null;function lt(){if(!F)throw new Error("No router created yet. Call createApp() or new AppRouter() first.");return F}var A=class{constructor(t,n={}){this.events=new j;this.cache=new U;this.navigationToken=0;this.releaseHistory=null;this.currentMatch=null;this.metadata={};this.lastRedirect=null;this.lastData={};var r,s,i;this.routes=I(t),this.middleware=(r=n.middleware)!=null?r:[],this.notFoundBlock=(s=n.notFound)!=null?s:ot,this.errorBlock=(i=n.error)!=null?i:(o=>it(o)),this.headers=n.headers,this.history=n.history!==void 0?n.history:typeof window!="undefined"?nt():null,this.state=new Ot({pathname:"/",search:"",hash:"",params:{},status:"idle",error:null}),this.tree=xt({div:""}),F=this}start(){return b(this,null,function*(){this.history&&!this.releaseHistory&&(this.releaseHistory=this.history.listen(n=>{this.transition(n,{fromHistory:!0})}));let t=this.history?this.history.url():new URL("/","http://localhost");yield this.transition(t,{initial:!0})})}destroy(){var t;(t=this.releaseHistory)==null||t.call(this),this.releaseHistory=null,F===this&&(F=null)}currentUrl(){if(this.history)return this.history.url();let t=this.state.get("search");return new URL(`${this.state.get("pathname")}${t}`,"http://localhost")}resolve(t){return new URL(t,this.currentUrl())}navigate(r){return b(this,arguments,function*(t,n={}){let s=this.resolve(t);if(typeof window!="undefined"&&s.origin!==this.currentUrl().origin){window.location.assign(s.href);return}yield this.transition(s,n)})}push(t,n={}){return this.navigate(t,n)}replace(t,n={}){return this.navigate(t,x(k({},n),{replace:!0}))}back(){var t;(t=this.history)==null||t.go(-1)}forward(){var t;(t=this.history)==null||t.go(1)}refresh(){return b(this,null,function*(){this.cache.invalidate(),yield this.transition(this.currentUrl(),{replace:!0,scroll:!1})})}prefetch(t){return b(this,null,function*(){try{let n=this.resolve(t),r=O(this.routes,n.pathname);if(!r)return;let s=this.loaderContext(n,r);yield Promise.all(r.route.chain.map((i,o)=>{if(!i.loader)return Promise.resolve();let a=this.cacheKey(r.route.chainIds[o],n);return this.cache.prefetch(a,i.loader,s,i.revalidate)}))}catch(n){}})}searchParams(t){return new URLSearchParams(this.state.get("search",t))}addEventListener(t,n){return this.events.addListener(t,n)}getMatch(){return this.currentMatch}cacheKey(t,n){return`${t}|${n.pathname}${n.search}`}loaderContext(t,n){return{pathname:n.pathname,url:t.pathname+t.search,params:n.params,searchParams:t.searchParams,headers:this.headers}}transition(r){return b(this,arguments,function*(t,n={}){var o,a;let s=++this.navigationToken,i=t.pathname+t.search+t.hash;n.fromHistory||(this.lastRedirect=null),this.events.notify("routeChangeStart",i),this.saveScroll();try{let l=t.pathname,h={url:t,pathname:t.pathname,searchParams:t.searchParams,headers:this.headers};for(let c of this.middleware){let p=yield c(h);G(p)&&(l=p.__domphyRewrite)}if(s!==this.navigationToken)return;let u=O(this.routes,l);if(u){let c=u.route.chain[u.route.chain.length-1];if(c.redirect)throw new S(c.redirect,(o=c.permanent)!=null?o:!1);for(let p of u.route.chain)for(let m of(a=p.middleware)!=null?a:[]){let g=yield m(h);if(G(g)){yield this.transition(new URL(g.__domphyRewrite,t),n);return}}if(s!==this.navigationToken)return;yield this.renderMatch(t,u,s,n)}else yield this.renderNotFound(t,s,n)}catch(l){if(s!==this.navigationToken)return;if(l instanceof S){yield this.transition(this.resolve(l.to),x(k({},n),{replace:!0})),this.lastRedirect={to:l.to,permanent:l.permanent};return}if(l instanceof T){yield this.renderNotFound(t,s,n);return}let h=l instanceof Error?l:new Error(String(l));this.tree.set(this.errorBlock(h,()=>{this.refresh()})),this.state.set("status","error"),this.state.set("error",h),this.events.notify("routeChangeError",h,i);return}s===this.navigationToken&&this.events.notify("routeChangeComplete",i)})}renderMatch(t,n,r,s){return b(this,null,function*(){let{chain:i,chainIds:o}=n.route,a=this.loaderContext(t,n),l=i.map(()=>({status:"pending"})),h=null,u=i.map((f,v)=>{if(!f.loader)return l[v]={status:"success",data:void 0},Promise.resolve();let y=this.cacheKey(o[v],t);return this.cache.load(y,f.loader,a,f.revalidate).then(_=>{l[v]={status:"success",data:_}},_=>{_ instanceof S?h=h!=null?h:_:_ instanceof T?l[v]={status:"notfound"}:l[v]={status:"error",error:_ instanceof Error?_:new Error(String(_))}})}),c=!1,p=Promise.all(u).then(()=>{c=!0});if(yield new Promise(f=>setTimeout(f,0)),!c&&i.some(f=>f.loading)){let f=q({match:n,baseContext:this.baseContext(t,n),results:l.map(v=>k({},v)),retry:()=>{this.refresh()},defaultError:this.errorBlock,defaultNotFound:this.notFoundBlock});r===this.navigationToken&&f.status==="loading"&&(this.state.set("status","loading"),this.tree.set(f.element))}if(yield p,r!==this.navigationToken)return;if(h)throw h;let m=q({match:n,baseContext:this.baseContext(t,n),results:l,retry:()=>{this.refresh()},defaultError:this.errorBlock,defaultNotFound:this.notFoundBlock}),g={};i.forEach((f,v)=>{f.loader&&l[v].status==="success"&&(g[this.cacheKey(o[v],t)]=l[v].data)}),this.lastData=g,this.currentMatch=n,yield this.applyMetadata(n,a),r===this.navigationToken&&this.commit(t,n,m.element,m.status,s)})}renderNotFound(t,n,r){return b(this,null,function*(){let s=at(this.notFoundBlock);this.currentMatch=null,this.metadata={},K([]),n===this.navigationToken&&this.commit(t,null,s.element,"notfound",r)})}baseContext(t,n){return{pathname:n.pathname,url:t.pathname+t.search,params:n.params,searchParams:t.searchParams,hash:t.hash,headers:this.headers}}applyMetadata(t,n){return b(this,null,function*(){try{this.metadata=yield tt(t.route.chain.map(r=>r.metadata),n)}catch(r){this.metadata={}}K($(this.metadata))})}commit(t,n,r,s,i){var o;if(this.history&&!i.fromHistory&&!i.initial){let a=t.pathname+t.search+t.hash;i.replace?this.history.replace(a):this.history.push(a)}this.state.set("pathname",t.pathname),this.state.set("search",t.search),this.state.set("hash",t.hash),this.state.set("params",(o=n==null?void 0:n.params)!=null?o:{}),this.state.set("error",null),this.state.set("status",s),this.tree.set(r),this.restoreScroll(t,i)}saveScroll(){var t,n;typeof window!="undefined"&&((n=(t=this.history)==null?void 0:t.saveScroll)==null||n.call(t,{x:window.scrollX,y:window.scrollY}))}restoreScroll(t,n){var r,s,i,o;if(!(typeof window=="undefined"||n.scroll===!1||n.initial)){if(n.fromHistory){let a=(s=(r=this.history)==null?void 0:r.readScroll)==null?void 0:s.call(r);window.scrollTo((i=a==null?void 0:a.x)!=null?i:0,(o=a==null?void 0:a.y)!=null?o:0);return}if(t.hash){let a=document.getElementById(t.hash.slice(1));if(a){a.scrollIntoView();return}}window.scrollTo(0,0)}}};var At="__DOMPHY_APP_DATA__",V=class{constructor(t,n={}){this.node=null;this.routes=t,this.options=n,this.router=new A(t,n)}element(){let t=this.router;return{div:n=>[t.tree.get(n)],style:{display:"contents"}}}render(t){return b(this,null,function*(){return yield this.router.start(),this.node=new R(this.element()),this.node.render(t),this.node})}hydrate(t,n){return b(this,null,function*(){let r=globalThis[At];return r&&typeof r=="object"&&this.router.cache.seed(r),yield this.router.start(),this.node=new R(this.element()),this.node.mount(t,n),this.node})}destroy(){var t;(t=this.node)==null||t.remove(),this.node=null,this.router.destroy()}renderToString(r){return b(this,arguments,function*(t,n={}){let s=typeof t=="string"?new URL(t,"http://localhost"):t,i=new A(this.routes,x(k({},this.options),{history:null,headers:n.headers}));yield i.transition(s,{initial:!0});let o=i.state.get("status"),a=i.lastRedirect,l=new R({div:[i.tree.get()],style:{display:"contents"}}),h=i.lastData,u={html:l.generateHTML(),css:l.generateCSS(),head:et($(i.metadata)),status:a?a.permanent?308:307:o==="notfound"?404:200,redirect:a==null?void 0:a.to,data:h,bootstrapScript:`<script>window.${At} = ${be(h)};</script>`};return i.destroy(),u})}};function be(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function _e(e,t={}){return new V(e,t)}var Re=[640,750,828,1080,1200,1920,2048,3840];function ke(e){let{src:t,alt:n="",width:r,height:s,fill:i=!1,sizes:o,quality:a=75,priority:l=!1,placeholder:h="empty",blurDataURL:u,loader:c,deviceSizes:p=Re}=e,m={src:c?c({src:t,width:r!=null?r:p[p.length-1],quality:a}):t,alt:n,loading:l?"eager":"lazy",decoding:"async",fetchPriority:l?"high":"auto",style:{}};return c&&(m.srcSet=p.map(g=>`${c({src:t,width:g,quality:a})} ${g}w`).join(", "),o&&(m.sizes=o)),r!==void 0&&(m.width=r),s!==void 0&&(m.height=s),i&&(m.style=x(k({},m.style),{position:"absolute",inset:"0",width:"100%",height:"100%",objectFit:"cover"})),h==="blur"&&u&&(m.style=x(k({},m.style),{backgroundImage:`url("${u}")`,backgroundSize:"cover",backgroundPosition:"center"}),m.onLoad=g=>{let f=g.target;f.style.backgroundImage=""}),m}function xe(e){return e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}function Se(e){let{href:t,replace:n=!1,scroll:r=!0,prefetch:s="hover",exact:i=!1}=e,o=()=>{var u;return(u=e.router)!=null?u:lt()},a=u=>{let c=new URL(t,"http://localhost").pathname;return i||c==="/"?u===c:u===c||u.startsWith(`${c}/`)},l=!1,h=()=>{l||(l=!0,o().prefetch(t))};return{href:t,ariaCurrent:u=>a(o().state.get("pathname",u))?"page":null,dataActive:u=>a(o().state.get("pathname",u))?"":null,onClick:u=>{let c=u,p=c.currentTarget;xe(c)||p.target&&p.target!=="_self"||p.hasAttribute("download")||new URL(p.href,window.location.href).origin===window.location.origin&&(c.preventDefault(),o().navigate(t,{replace:n,scroll:r}))},onMouseEnter:()=>{s==="hover"&&h()},onFocus:()=>{s==="hover"&&h()},_onMount:u=>{if(s!=="visible")return;if(typeof IntersectionObserver=="undefined"){h();return}let c=new IntersectionObserver(p=>{p.some(m=>m.isIntersecting)&&(h(),c.disconnect())});c.observe(u.domElement),u.setMetadata("navLinkObserver",c)},_onRemove:u=>{let c=u.getMetadata("navLinkObserver");c==null||c.disconnect()}}}var ht=new Set;function Ee(){ht.clear()}function It(e){let t=globalThis.requestIdleCallback;t?t(e):setTimeout(e,0)}function Te(e){let{src:t,strategy:n="afterInteractive",id:r,async:s=!0,onLoad:i,onError:o}=e,a=r!=null?r:t,l=u=>{ht.has(a)||(ht.add(a),u.src=t)},h={script:"",async:s,onLoad:()=>i==null?void 0:i(),onError:()=>o==null?void 0:o(),_onMount:u=>{let c=u.domElement;if(n==="afterInteractive"){l(c);return}document.readyState==="complete"?It(()=>l(c)):window.addEventListener("load",()=>It(()=>l(c)),{once:!0})}};return r!==void 0&&(h.id=r),h}function Me(e){return e}return zt(Ce);})();
4
+ //# sourceMappingURL=app.global.js.map