@hozu/runtime-client 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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/browser/chunk-7HUHKEFT.js +1 -0
  4. package/dist/browser/chunk-DRLGN2D4.js +1 -0
  5. package/dist/browser/chunk-FZY6ENWQ.js +1 -0
  6. package/dist/browser/chunk-HGZ7KQUC.js +1 -0
  7. package/dist/browser/chunk-Z7ZFHZVV.js +1 -0
  8. package/dist/browser/client.js +1 -0
  9. package/dist/browser/navigate.js +1 -0
  10. package/dist/browser-dev/client.js +1604 -0
  11. package/dist/browser.d.ts +2 -0
  12. package/dist/browser.d.ts.map +1 -0
  13. package/dist/browser.js +3 -0
  14. package/dist/browser.js.map +1 -0
  15. package/dist/dev.d.ts +6 -0
  16. package/dist/dev.d.ts.map +1 -0
  17. package/dist/dev.js +42 -0
  18. package/dist/dev.js.map +1 -0
  19. package/dist/dom.d.ts +11 -0
  20. package/dist/dom.d.ts.map +1 -0
  21. package/dist/dom.js +70 -0
  22. package/dist/dom.js.map +1 -0
  23. package/dist/files.js +1 -0
  24. package/dist/hydrate.d.ts +56 -0
  25. package/dist/hydrate.d.ts.map +1 -0
  26. package/dist/hydrate.js +163 -0
  27. package/dist/hydrate.js.map +1 -0
  28. package/dist/index.d.ts +7 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +5 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/live.d.ts +2 -0
  33. package/dist/live.d.ts.map +1 -0
  34. package/dist/live.js +7 -0
  35. package/dist/live.js.map +1 -0
  36. package/dist/motion.d.ts +5 -0
  37. package/dist/motion.d.ts.map +1 -0
  38. package/dist/motion.js +78 -0
  39. package/dist/motion.js.map +1 -0
  40. package/dist/mount.d.ts +65 -0
  41. package/dist/mount.d.ts.map +1 -0
  42. package/dist/mount.js +550 -0
  43. package/dist/mount.js.map +1 -0
  44. package/dist/navigate.d.ts +18 -0
  45. package/dist/navigate.d.ts.map +1 -0
  46. package/dist/navigate.js +197 -0
  47. package/dist/navigate.js.map +1 -0
  48. package/dist/uploads.d.ts +2 -0
  49. package/dist/uploads.d.ts.map +1 -0
  50. package/dist/uploads.js +21 -0
  51. package/dist/uploads.js.map +1 -0
  52. package/dist/visible.d.ts +2 -0
  53. package/dist/visible.d.ts.map +1 -0
  54. package/dist/visible.js +26 -0
  55. package/dist/visible.js.map +1 -0
  56. package/dist/widget.d.ts +16 -0
  57. package/dist/widget.d.ts.map +1 -0
  58. package/dist/widget.js +53 -0
  59. package/dist/widget.js.map +1 -0
  60. package/files.d.ts +1 -0
  61. package/package.json +53 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 olevatorr
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,15 @@
1
+ # @hozu/runtime-client
2
+
3
+ Hozu client runtime: fine-grained DOM islands, no virtual DOM, about 7.5 KB gzipped.
4
+
5
+ Part of [Hozu](https://github.com/olevatorr/Hozu#readme), an AI-first web framework. Most apps start from
6
+ `npm create hozu@latest`, which installs the right packages and sets up Claude Code or `AGENTS.md` agents.
7
+
8
+ ```sh
9
+ npm install @hozu/runtime-client
10
+ ```
11
+
12
+ Requires Node 22.18 or newer. Documentation: the [README](https://github.com/olevatorr/Hozu#readme) and the
13
+ agent skill that `create-hozu` writes into each app.
14
+
15
+ MIT © olevatorr
@@ -0,0 +1 @@
1
+ var s=(t,e,n=[])=>{if(typeof t=="string")e.has(t)&&n.push(t);else if(t&&typeof t=="object")for(let o of Object.values(t))s(o,e,n);return n};function c(t,e,n){let o=s(e,n);if(!o.length)return t;let r=new FormData;r.append("request",t);for(let f of o)r.append(f,n.get(f));return r}export{c as encode};
@@ -0,0 +1 @@
1
+ var a=new WeakSet;function c(n){let s=n.defaultView;if(!s?.IntersectionObserver||a.has(n))return;a.add(n);let r=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&t.target.dispatchEvent(new s.Event("visible"))}),i=e=>{e instanceof s.Element&&e.hasAttribute("data-hozu-visible")&&r.observe(e);for(let t of e.querySelectorAll("[data-hozu-visible]"))r.observe(t)};i(n),new s.MutationObserver(e=>{for(let t of e)for(let o of t.addedNodes)o.nodeType===1&&i(o)}).observe(n.body,{childList:!0,subtree:!0})}export{c as watch};
@@ -0,0 +1 @@
1
+ var n=t=>r=>{let e=t.defaultView?.EventSource;e&&new e(new URL("live",import.meta.url)).addEventListener("message",a=>r(JSON.parse(a.data)))};export{n as liveStream};
@@ -0,0 +1 @@
1
+ var a=t=>t.split(",").map(n=>Number.parseFloat(n)*(n.trim().endsWith("ms")?1:1e3)||0);function u(t){let n=t.ownerDocument.defaultView?.getComputedStyle(t);if(!n)return 0;let e=(s,o)=>{let r=a(s),i=a(o);return Math.max(0,...r.map((d,f)=>d+(i[f%i.length]??0)))};return Math.max(e(n.transitionDuration,n.transitionDelay),e(n.animationDuration,n.animationDelay))}var p=(t,n)=>{let e=t.ownerDocument.defaultView;if(!e?.requestAnimationFrame)return n();e.requestAnimationFrame(()=>e.requestAnimationFrame(n))};function c(t,n){let e=u(t);if(e===0)return n();let s=!1,o=()=>{s||(s=!0,t.removeEventListener("transitionend",o),t.removeEventListener("animationend",o),n())};t.addEventListener("transitionend",o),t.addEventListener("animationend",o),setTimeout(o,e+50)}var v=t=>t.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0;function m(t,n,e,s){let o=`${n}-${e}-from`,r=`${n}-${e}-active`,i=`${n}-${e}-to`;t.classList.add(o,r),p(t,()=>{t.classList.remove(o),t.classList.add(i),c(t,()=>{t.classList.remove(r,i),s()})})}function l(t,n){for(let e of t)e.nodeType===1&&m(e,n,"enter",()=>{})}function L(t,n){for(let e of t)e.nodeType===1?m(e,n,"leave",()=>e.remove()):e.remove()}function $(t,n,e){let s=t.getBoundingClientRect(),o=n.left-s.left,r=n.top-s.top;if(!o&&!r)return;let i=t.style;i.transitionDuration="0s",i.transform=`translate(${o}px, ${r}px)`,t.offsetWidth,t.classList.add(`${e}-move`),i.transitionDuration="",i.transform="",c(t,()=>t.classList.remove(`${e}-move`))}export{l as enter,$ as flip,L as leave,v as reduced};
@@ -0,0 +1 @@
1
+ function d(e){let o=new AbortController,l=e.props(),i,a=t=>{i=void 0,e.doc.defaultView?.console.error(`Widget ${e.name} failed`,t)},s=()=>{e.load(e.ref.url).then(t=>{if(!o.signal.aborted)try{i=t({el:e.el,props:l,emit:e.emit,signal:o.signal})??void 0}catch(n){a(n)}},a)},r=e.doc.defaultView;if(e.ref.load==="eager"||!r)s();else if(e.ref.load==="idle")(r.requestIdleCallback??r.setTimeout)(s);else if(!r.IntersectionObserver)s();else{let t=new r.IntersectionObserver(n=>{n.some(c=>c.isIntersecting)&&(t.disconnect(),s())});t.observe(e.el),o.signal.addEventListener("abort",()=>t.disconnect())}e.watch(()=>{let t=e.props();if(!e.same(t,l)){l=t;try{i?.update?.(t)}catch(n){a(n)}}}),e.own(()=>{o.abort(),i?.destroy?.()})}export{d as mountWidget};
@@ -0,0 +1 @@
1
+ function F(t,e){let n=t;for(let o of e){if(n===null||typeof n!="object")return null;n=n[o]}return n===void 0?null:n}function Q(t,e,n,o=0){if(o===e.length)return n;let s=e[o];if(Array.isArray(t)){let u=t.slice();return u[Number(s)]=Q(t[Number(s)]??null,e,n,o+1),u}let c=t!==null&&typeof t=="object"?t:{};return{...c,[s]:Q(c[s]??null,e,n,o+1)}}function P(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object")return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!P(t[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o of n)if(!Object.hasOwn(e,o)||!P(t[o],e[o]))return!1;return!0}var gt=(t,e,n)=>{let[o="",s=""]=t.split("?"),c=o.replace(/\/:([A-Za-z]\w*)[?*+]?/g,(w,T)=>[F(e,[T])??[]].flat().map(j=>`/${encodeURIComponent(String(j))}`).join(""))||"/",u=s.split("&"),x="";if(n&&typeof n=="object")for(let w of Object.keys(n).sort()){let T=n[w],g=`${encodeURIComponent(w)}=${encodeURIComponent(String(T))}`;T!==null&&typeof T!="object"&&!u.includes(g)&&(x+=`${x&&"&"}${g}`)}return x?`${c}?${x}`:c};var rt=class extends Error{name="CompileError"};function W(t,e){if("literal"in t){let s=t.literal;return()=>s}if("object"in t){let s=Object.entries(t.object).map(([c,u])=>[c,W(u,e)]);return c=>{let u={};for(let[x,w]of s)u[x]=w(c);return u}}if("fn"in t){let s=e[t.fn];if(!s)throw new rt(`No implementation bound for fn ${t.fn}`);let c=W(t.arg,e);return u=>s(c(u))}if("link"in t){let s=t.link,c=W(t.params,e),u=W(t.search,e);return x=>gt(x.routes?.[s]??"",c(x),u(x))}if("test"in t){let s=it(t.test,e);return c=>s(c)}let{path:n}=t;if(t.ref==="binding"){let s=t.depth;return n.length?c=>F(c.bindings?.[s],n):c=>c.bindings?.[s]??null}if(t.ref==="dom"){let[s,...c]=n;return u=>u.dom&&s?F(u.dom(s),c):null}let o=t.ref;return n.length===0?s=>s[o]??null:s=>F(s[o],n)}var K=t=>typeof t=="number"||typeof t=="string"?t:Number.NaN;function it(t,e){switch(t.op){case"and":{let n=t.args.map(o=>it(o,e));return o=>n.every(s=>s(o))}case"or":{let n=t.args.map(o=>it(o,e));return o=>n.some(s=>s(o))}case"not":{let n=it(t.arg,e);return o=>!n(o)}case"fn":{let n=W({fn:t.fn,arg:t.arg},e);return o=>n(o)===!0}default:{let n=W(t.left,e),o=W(t.right,e);switch(t.op){case"eq":return s=>P(n(s),o(s));case"neq":return s=>!P(n(s),o(s));case"lt":return s=>K(n(s))<K(o(s));case"lte":return s=>K(n(s))<=K(o(s));case"gt":return s=>K(n(s))>K(o(s));default:return s=>K(n(s))>=K(o(s))}}}}function Wt(t,e){let{path:n}=t,o=W(t.value,e);switch(t.op){case"set":return(s,c)=>Q(s,n,o({...c,context:s}));case"append":return(s,c)=>{let u=F(s,n);return Q(s,n,[...Array.isArray(u)?u:[],o({...c,context:s})])};case"inc":return(s,c)=>Q(s,n,Number(F(s,n)??0)+Number(o({...c,context:s})));case"removeWhere":{let s=t.key;return(c,u)=>{let x=F(c,n),w=o({...u,context:c}),T=Array.isArray(x)?x:[];return Q(c,n,T.filter(g=>!P(g!==null&&typeof g=="object"&&!Array.isArray(g)?g[s]:null,w)))}}}}var qt=(t,e)=>n=>t({...n,routes:e});function yt(t,e={},n={}){let o=t.machine;if(!o)throw new rt(`Feature ${t.id} has no machine`);let s=Object.keys(o.states),c=new Map(s.map((g,j)=>[g,j])),u=g=>{let j=c.get(g);if(j===void 0)throw new rt(`Unknown state "${g}" in ${t.id}`);return j},x=[],w=(g,j)=>(x.push(j),{id:j,guard:g.guard?it(g.guard,e):null,target:u(g.target),assign:g.assign.map(C=>Wt(C,e)),navigate:g.navigate?qt(W(g.navigate,e),n):null}),T=s.map(g=>{let j=o.states[g],C=new Map;for(let[E,O]of Object.entries(j.on))C.set(E,O.map((q,I)=>w(q,`${g}/on/${E}/${I}`)));let _=new Map;j.after.forEach((E,O)=>{let q=w(E.transition,`${g}/after/${O}`);_.set(E.ms,[..._.get(E.ms)??[],q])});let M=j.invoke;return{name:g,final:j.final,on:C,invoke:M&&{effect:M.effect,input:W(M.input,e),done:M.done.map((E,O)=>w(E,`${g}/invoke/done/${O}`)),failed:new Map(Object.entries(M.failed).map(([E,O])=>[E,O.map((q,I)=>w(q,`${g}/invoke/failed/${E}/${I}`))]))},after:_,timers:[..._.keys()].sort((E,O)=>E-O)}});return{feature:t.id,initial:u(o.initial),initialContext:o.initialContext,states:T,index:c,transitions:x}}function St(t,e,n,o,s){let c=t.states[e];c.invoke&&s.push({type:"invoke",entry:o,effect:c.invoke.effect,input:c.invoke.input({context:n})});for(let u of c.timers)s.push({type:"timer",entry:o,ms:u})}function jt(t,e,n,o=1){let s=t.index.get(e);if(s===void 0)throw new Error(`Unknown state "${e}" in ${t.feature}`);let c=[];return St(t,s,n,o,c),{snapshot:{state:e,context:n,entry:o},effects:c,taken:null}}var ht=t=>jt(t,t.states[t.initial].name,t.initialContext),st=t=>({snapshot:t,effects:[],taken:null});function ut(t,e,n,o){if(!n)return st(e);for(let s of n){if(s.guard&&!s.guard(o))continue;let c=e.context;for(let w of s.assign)c=w(c,o);let u=e.entry+1,x=s.navigate===null?[]:[{type:"navigate",url:String(s.navigate(o))}];return St(t,s.target,c,u,x),{snapshot:{state:t.states[s.target].name,context:c,entry:u},effects:x,taken:s.id}}return st(e)}function xt(t,e,n){let o=t.states[t.index.get(e.state)??-1];if(!o||o.final)return st(e);let s=e.context;switch(n.type){case"event":return ut(t,e,o.on.get(n.event),{context:s,event:n.payload});case"done":return n.entry!==e.entry||!o.invoke?st(e):ut(t,e,o.invoke.done,{context:s,result:n.result});case"failed":{if(n.entry!==e.entry||!o.invoke)return st(e);let c=o.invoke.failed,u=c.has(n.error),x=u?n.data:{message:Dt(n.data,n.error)};return ut(t,e,c.get(u?n.error:"Unexpected"),{context:s,error:x})}case"timer":return n.entry!==e.entry?st(e):ut(t,e,o.after.get(n.ms),{context:s})}}function Dt(t,e){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&typeof t.message=="string"?t.message:e}var pt="http://www.w3.org/2000/svg",Bt=new Set(["contenteditable","draggable","spellcheck"]),X=t=>t==null?"":typeof t=="object"?JSON.stringify(t):String(t);function Ot(t,e){return e==null?null:typeof e=="boolean"?t.startsWith("aria-")||t.startsWith("data-")||Bt.has(t)?String(e):e?"":null:X(e)}var $t=new Set(["value","checked","selected","muted"]),wt=new Set(["scroll","wheel","touchstart","touchmove","touchend","pointermove","mousemove"]),Nt=t=>typeof t=="number"&&!Number.isNaN(t)?t:null,at=new Map,Ft=t=>t?[...t].map(e=>{let n=`u${at.size+1}`;return at.set(n,e),{name:e.name,size:e.size,type:e.type,token:n}}):[],bt=t=>e=>{let n=t.target;switch(e){case"value":return typeof n?.value=="string"?n.value:"";case"checked":return n?.checked===!0;case"valueAsNumber":return Nt(n?.valueAsNumber);case"files":return Ft(n?.files??t.dataTransfer?.files);case"form":{let o={},s=t.target,c=s.ownerDocument.defaultView;for(let[u,x]of new(c?.FormData??FormData)(s))o[u]=typeof x=="string"?x:x.name;return o}case"open":return n?.open===!0;case"returnValue":return typeof n?.returnValue=="string"?n.returnValue:"";default:{let o=e in t?t[e]:n?.[e];return typeof o=="number"?Nt(o):typeof o=="string"||typeof o=="boolean"?o:null}}},At=(t,e)=>t?e.length?`${t} ${e.join(" ")}`:t:e.join(" ");var Tt=JSON.stringify;function mt(t){if(t===null)return"null";switch(typeof t){case"string":return Tt(t);case"boolean":return t?"true":"false";case"number":if(!Number.isFinite(t))throw new TypeError(`Non-finite number ${t} is not valid JSON`);return Object.is(t,-0)?"0":String(t);case"object":{if(Array.isArray(t))return`[${t.map(mt).join(",")}]`;let e=t,n=Object.keys(e).sort(),o="{";for(let s=0;s<n.length;s++){let c=n[s],u=e[c];if(u===void 0)throw new TypeError(`Undefined value at key "${c}"`);o+=`${s?",":""}${Tt(c)}:${mt(u)}`}return`${o}}`}default:throw new TypeError(`Value of type ${typeof t} is not valid JSON`)}}var kt=t=>{switch(t.op){case"and":case"or":return t.args.some(kt);case"not":return kt(t.arg);case"fn":return Y(t.arg);default:return Y(t.left)||Y(t.right)}},Y=t=>"ref"in t?t.ref==="context"||t.ref==="binding":"object"in t?Object.values(t.object).some(Y):"fn"in t?Y(t.arg):"test"in t&&kt(t.test),_t=(t,e)=>t+mt(e),Jt=t=>t instanceof Map?{data:t,versions:new Map}:t;var ot=(t,e)=>t!==null&&t.nodeType===8&&t.data===e;function tt(t,e){let n=[t],o=t;for(;o!==e&&(o=o.nextSibling,!!o);)n.push(o);return n}function vt(t,e){let n=t.next?t.next.previousSibling:t.parent.lastChild;return e(),[n?n.nextSibling:t.parent.firstChild,t.next?t.next.previousSibling:t.parent.lastChild]}function Et(t,e){for(;t.nextSibling&&t.nextSibling!==e;)t.nextSibling.remove()}function Ct(t,e){let{machine:n,fns:o={},params:s=null,search:c=null,routes:u={}}=e,{data:x}=Jt(e.payload),w=[],T=new Set,g=n?e.snapshot?null:ht(n):null,j=e.snapshot??g?.snapshot??null,C=[],_=new Set,M=new Set,E=new WeakMap,O=(r,a,i)=>{let h=E.get(r);return h||(h=W(r,o),E.set(r,h)),h({context:j?.context??null,bindings:a,params:s,search:c,routes:u,...i?{dom:i}:{}})},q=(r,a,i,h)=>{let b=O(a,i);h(b),Y(a)&&r.push(()=>{let p=O(a,i);p!==b&&(b=p,h(p))})},I=(r,a)=>{if(r.claim&&ot(r.next,a)){let i=r.next;return r.next=i.nextSibling,i}return r.parent.insertBefore(t.createComment(a),r.next)},ct=r=>{if(!r.claim||!ot(r.next,"["))return;let a=0;for(;r.next;){let i=r.next;if(r.next=i.nextSibling,ot(i,"["))a++;else if(ot(i,"]")&&--a===0)return}},D=(r,a,i,h,b)=>{switch(r.kind){case"text":{let p;i.claim&&i.next?.nodeType===3?(p=i.next,i.next=p.nextSibling):p=i.parent.insertBefore(t.createTextNode(""),i.next),i.claim&&ot(i.next,"")&&(i.next=i.next.nextSibling),q(h,r.value,a,d=>{let l=X(d);p.data!==l&&(p.data=l)});return}case"el":{let p=r.tag,d=p==="svg"?pt:b,l,f=i.claim&&i.next?.nodeType===1&&i.next.localName===p;f?(l=i.next,i.next=l.nextSibling):(l=d?t.createElementNS(d,p):t.createElement(p),r.class&&l.setAttribute("class",r.class),i.parent.insertBefore(l,i.next));for(let m in r.attrs){let k=r.attrs[m],B=$t.has(m)&&m in l;f&&!Y(k)||q(h,k,a,z=>{if(B){let L=l,lt=m==="value"?X(z):z===!0;L[m]!==lt&&(L[m]=lt);return}let G=Ot(m,z);G===null?l.removeAttribute(m):l.getAttribute(m)!==G&&l.setAttribute(m,G)})}et(l,r,a,h);for(let m in r.on){let k=r.on[m];l.addEventListener(m,B=>{m==="submit"&&B.preventDefault(),Z({type:"event",event:k.event,payload:O(k.payload,a,bt(B))})},wt.has(m)?{passive:!0}:void 0)}if(p==="textarea")return;let v={parent:l,next:f?l.firstChild:null,claim:f},N=p==="foreignObject"?null:d;for(let m of r.children)D(m,a,v,h,N);return}case"when":{let p=()=>j?r.states.includes(j.state):!1;A(i,h,p,(d,l)=>{if(p())for(let f of r.children)D(f,a,d,l,b)},r.motion);return}case"query":{let p=a;A(i,h,()=>{let l=_t(r.query,O(r.input,a)),f=x.get(l);return f&&p!==a&&p.splice(0,p.length,...a,f.ok?f.value:f.data),`${l}|${f?f.ok?"ready":r.failed[f.error]?f.error:"Unexpected":""}`},(l,f)=>{let v=O(r.input,a),N=_t(r.query,v),m=x.get(N);if(p=a,!m){l.claim||R(N,r.query,v),r.pending&&D(r.pending,a,l,f,b);return}let k=m.ok?r.ready:r.failed[m.error]??r.failed.Unexpected;p=[...a,m.ok?m.value:m.data],k&&D(k,p,l,f,b)});return}case"each":V(r,a,i,h,b);return;case"widget":$(r,a,i,h);return;case"if":{let p=()=>O({test:r.test},a)===!0;A(i,h,p,(d,l)=>{let f=p()?r.ifTrue:r.ifFalse;for(let v of f)D(v,a,d,l,b)},r.motion);return}case"html":{let p=I(i,"["),d;if(i.claim){for(;i.next&&!ot(i.next,"]");)i.next=i.next.nextSibling;d=i.next??i.parent.appendChild(t.createComment("]")),i.next=d.nextSibling}else d=I(i,"]");let l=i.claim?X(O(r.value,a)):null;q(h,r.value,a,f=>{let v=X(f);if(v===l)return;l=v,Et(p,d);let N=t.createElement("template");N.innerHTML=v,d.parentNode.insertBefore(N.content,d)});return}case"global":{let p=I(i,"g"),d=r.target==="window"?t.defaultView:t,l=[];for(let f in r.on){let v=r.on[f],N=k=>Z({type:"event",event:v.event,payload:O(v.payload,a,bt(k))}),m=wt.has(f)?{passive:!0}:void 0;d.addEventListener(f,N,m),l.push(()=>d.removeEventListener(f,N))}M.add({el:p,stop:()=>l.forEach(f=>f())});return}default:ct(i)}},et=(r,a,i,h)=>{let b=Object.entries(a.toggle);if(b.length){let p=()=>{let l=[];for(let[f,v]of b)O(v,i)===!0&&l.push(f);return At(a.class,l)},d=p();r.getAttribute("class")!==d&&r.setAttribute("class",d),b.some(([,l])=>Y(l))&&h.push(()=>{let l=p();l!==d&&(d=l,r.setAttribute("class",l))})}for(let p in a.vars)q(h,a.vars[p],i,d=>{let l=r.style;d===null||d===""?l.removeProperty(p):l.getPropertyValue(p)!==X(d)&&l.setProperty(p,X(d))})},$=(r,a,i,h)=>{let b=e.widgets?.[r.widget],p=b?.tag??"div",d,l=i.claim&&i.next?.nodeType===1&&i.next.localName===p;if(l?(d=i.next,i.next=d.nextSibling):(d=t.createElement(p),r.class&&d.setAttribute("class",r.class),i.parent.insertBefore(d,i.next)),et(d,r,a,h),!l||b?.wraps){let f={parent:d,next:l?d.firstChild:null,claim:l};for(let v of r.children)D(v,a,f,h,null)}!b||!e.loadWidget||!e.mountWidget||e.mountWidget({el:d,ref:b,name:r.widget,doc:t,props:()=>O(r.props,a),emit:(f,v)=>{let N=r.on[f];N&&Z({type:"event",event:N.event,payload:O(N.payload,a,m=>m==="detail"?v:null)})},load:e.loadWidget,watch:f=>h.push(f),own:f=>M.add({el:d,stop:f}),same:P})},J=new Set,R=(r,a,i)=>{!e.onQuery||J.has(r)||(J.add(r),e.onQuery(a,i).then(h=>{J.delete(r),x.set(r,h);for(let b of C)b();y()}))},y=()=>{for(let r=C.length-1;r>=0;r--)_.delete(C[r])&&C.splice(r,1);for(let r of M)r.el.isConnected||(r.stop(),M.delete(r))},A=(r,a,i,h,b=null)=>{let p=I(r,"["),d=i(),l=[];h(r,l);let f=I(r,"]");a.push(()=>{let v=i();if(v===d){for(let B of l)B();return}d=v,l=[];let N=e.motion;if(!b||!N||N.reduced(t)){Et(p,f),h({parent:f.parentNode,next:f,claim:!1},l);return}N.leave(p.nextSibling===f?[]:tt(p.nextSibling,f.previousSibling),b);let[m,k]=vt({parent:f.parentNode,next:f,claim:!1},()=>h({parent:f.parentNode,next:f,claim:!1},l));m&&k&&m!==f&&N.enter(tt(m,k),b)})},V=(r,a,i,h,b)=>{let p=I(i,"["),d=m=>{let k=r.key===null?m:F(m,[r.key]);return typeof k=="string"?`s${k}`:JSON.stringify(k)},l=()=>{let m=O(r.source,a);return Array.isArray(m)?m:[]},f=(m,k)=>{let B=[...a,m],z=[],[G,L]=vt(k,()=>D(r.item,B,k,z,b));return{key:d(m),value:m,scope:B,block:z,first:G,last:L}},v=l().map(m=>f(m,i)),N=I(i,"]");h.push(()=>{let m=e.motion,k=r.motion&&m&&!m.reduced(t)?r.motion:null,B=k?new Map(v.flatMap(S=>S.first.nodeType===1?[[S,S.first.getBoundingClientRect()]]:[])):null,z=new Map(v.map(S=>[S.key,S])),G=new Set,L=[];for(let S of l()){let H=d(S),nt=z.get(H);if(nt){z.delete(H),nt.value=S,nt.scope.splice(0,nt.scope.length,...a,S);for(let ft of nt.block)ft();L.push(nt)}else{let ft=f(S,{parent:t.createDocumentFragment(),next:null,claim:!1});G.add(ft),L.push(ft)}}for(let S of z.values())if(k)m.leave(tt(S.first,S.last),k);else for(let H of tt(S.first,S.last))H.remove();let lt=N.parentNode,dt=p.nextSibling??N;for(let S of L)if(S.first===dt)dt=S.last.nextSibling??N;else for(let H of tt(S.first,S.last))lt.insertBefore(H,dt);if(v=L,!!k)for(let S of L)if(G.has(S))m.enter(tt(S.first,S.last),k);else{let H=B?.get(S);H&&m.flip(S.first,H,k)}})},U=r=>{for(let a of r.effects)if(a.type==="navigate")e.onNavigate?.(a.url);else if(a.type==="timer"){let i=setTimeout(()=>{T.delete(i),Z({type:"timer",entry:a.entry,ms:a.ms})},a.ms);T.add(i)}else e.onInvoke?.(a.effect,a.input).then(i=>Z(i.ok?{type:"done",entry:a.entry,result:i.value}:{type:"failed",entry:a.entry,error:i.error,data:i.data}))};function Z(r){if(!n||!j)return;let a=xt(n,j,r);if(a.taken){j=a.snapshot;for(let i of C)i();y(),U(a)}}return{attach(r,a,i,h,b){let p={parent:r,next:a,claim:b},d=r.namespaceURI===pt?pt:null,l=[],[f,v]=vt(p,()=>D(i,h,p,l,d));f&&v&&w.push([f,v]);let N=f?.isConnected===!0,m=()=>{if(N&&!f.isConnected)_.add(m);else for(let k of l)k()};C.push(m)},start(){g&&U(g),g=null},sync:()=>{for(let r of C)r();y()},dispatch:Z,snapshot:()=>j,destroy:()=>{for(let r of T)clearTimeout(r);T.clear();for(let r of M)r.stop();M.clear(),C.length=0;for(let[r,a]of w)for(let i of tt(r,a))i.remove();w.length=0}}}var Vt=function(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,o,s,c,u){return o?e?".jsx":".js":s&&(!c||!u)?n:s+c+"."+u.toLowerCase()+"js"}):t},Mt=t=>t.islands.flatMap(([e,n,...o])=>{let s=t.ids[e],c=s.slice(0,s.indexOf("."));return o.map(u=>({feature:c,node:s,scope:[...Array(n).fill(null),...u]}))}),It=t=>new URL(t,import.meta.url),Rt=async(t,e,n)=>{let o=JSON.stringify({effect:t,input:e,keys:n}),s=at.size?await(await import("./chunk-7HUHKEFT.js")).encode(o,e,at):o;return await(await fetch(It("effect"),{method:"POST",headers:typeof s=="string"?{"content-type":"application/json"}:{},body:s})).json()},zt=async(t,e)=>await(await fetch(It("query"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:t,input:e})})).json(),Lt=async t=>(await import(Vt(t))).default,Ht=async t=>(await import(Vt(t))).fns;async function Ut(t,{transport:e=Rt,query:n=zt,live:o,loadFns:s=Ht,loadWidget:c=Lt}={}){let u=new Map,x=t.getElementById("hozu-payload");if(!x?.textContent)return u;let w={data:new Map,versions:new Map},T={},g={},j={},C=new Map,_={},M=new Map,E=($,J)=>{let R=$+JSON.stringify(J),y=M.get(R);return y||(y=n($,J).finally(()=>M.delete(R)),M.set(R,y)),y},O=async($,J)=>{let{result:R,refreshed:y}=await e($,J,[...w.data.keys()]);for(let[A,V]of y)w.data.set(A,V),w.versions.set(A,(w.versions.get(A)??0)+1);if(y.length)for(let A of u.values())A.sync();return R},q=null,I={doc:t,apps:u,islands:Mt,async mount($,J){!_.motion&&$.motion&&(_.motion=await import("./chunk-HGZ7KQUC.js")),$.visible&&import("./chunk-DRLGN2D4.js").then(y=>y.watch(t)),!_.mountWidget&&Object.keys($.widgets).length&&(_.mountWidget=(await import("./chunk-Z7ZFHZVV.js")).mountWidget),!_.fns&&$.fns&&(Object.assign(T,await s($.fns)),_.fns=!0),Object.assign(g,$.widgets),Object.assign(j,$.routes);for(let[y,A]of $.data)w.data.has(y)&&w.versions.set(y,(w.versions.get(y)??0)+1),w.data.set(y,A);let R=[];for(let[y,A]of Object.entries($.features)){if(u.has(y))continue;let V=$.snapshots?.[y],U=Ct(t,{machine:A?yt({id:y,machine:A},T,j):null,payload:w,params:$.params,search:$.search,...V?{snapshot:V}:{},fns:T,widgets:g,routes:j,get motion(){return _.motion},get mountWidget(){return _.mountWidget},loadWidget:c,onQuery:E,onInvoke:O,onNavigate:Z=>t.defaultView?.location.assign(Z)});u.set(y,U),R.push(U)}Mt($).forEach((y,A)=>{let V=J[A],U=$.nodes[y.node];V?.parentNode&&U&&u.get(y.feature)?.attach(V.parentNode,V.nextSibling,U,y.scope,!0)});for(let y of u.values())y.sync();for(let y of R)y.start();for(let[y,A]of Object.entries($.live??{}))C.set(y,A);C.size&&!_.live&&(_.live=!0,(o??(await import("./chunk-FZY6ENWQ.js")).liveStream(t))(async y=>{let A=[...C].filter(([,V])=>V.tags.some(U=>y.includes(U)));for(let[V,U]of A)w.data.set(V,await n(U.query,U.input));if(A.length)for(let V of u.values())V.sync()}))}},ct=JSON.parse(x.textContent),D=[],et=t.createTreeWalker(t.body??t,128);for(;et.nextNode();)et.currentNode.data==="i"&&D.push(et.currentNode);return await I.mount(ct,D),ct.soft&&import("./navigate.js").then($=>$.soft(I)),u}Ut(document);
@@ -0,0 +1 @@
1
+ var b='title,meta[name=description],meta[name=robots],link[rel=canonical],meta[property],script[type="application/ld+json"]',S={"?":"(?:/[^/]+)?","+":"(?:/[^/]+)+","*":"(?:/[^/]+)*"},A=r=>{let n=0,t=r.split(/(\/:[A-Za-z]\w*[?*+]?)/).map((o,a)=>{if(a%2===0)return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let s=o.at(-1);return n+=s==="+"||s==="*"?1.01:1,S[s]??"/[^/]+"}).join("");return{pattern:new RegExp(`^${t.replace(/\/$/,"")}/?$`),keys:n}};function O(r,n){let t=null,o=1/0;for(let[a,s]of Object.entries(r)){let{pattern:i,keys:f}=A(s);f<o&&i.test(n)&&(t=a,o=f)}return t}function E(r){let n=[],t=(r.ownerDocument??r).createTreeWalker(r,128),o=null;for(;t.nextNode();){let a=t.currentNode;a.data==="i"?n.push({marker:a,view:o}):a.data.startsWith("v:")?o=a.data.slice(2):a.data==="/v"&&(o=null)}return n}function C(r,n,t,o){n.islands(t).forEach((a,s)=>{let i=o[s]?.view;if(!i)return;let f=r.views.get(i)??new Set;f.add(a.feature),r.views.set(i,f)}),r.soft=t.soft??{},Object.assign(r.routes,t.routes)}function k(r){let n=new Map,t=null;for(let o of[...r.childNodes])o.nodeType===8&&o.data.startsWith("v:")?(t=[o],n.set(o.data.slice(2),t)):t&&(t.push(o),o.nodeType===8&&o.data==="/v"&&(t=null));return n}async function z(r,n,t,o){let{doc:a,apps:s}=r,{views:i}=n,f=t.getElementById("hozu-payload"),y=k(t.body),c=k(a.body);if(!f?.textContent||o.some(e=>!y.has(e)||!c.has(e)))return!1;let p=JSON.parse(f.textContent),d=new Set(o),m=E(t.body),w=new Set;for(let e of d)for(let l of i.get(e)??[])w.add(l);r.islands(p).forEach((e,l)=>{let u=m[l]?.view;(u==null||!d.has(u))&&w.add(e.feature)});for(let[e,l]of s)w.has(e)||(l.destroy(),s.delete(e));for(let e of[...i.keys()])d.has(e)||i.delete(e);let v=a.getElementById("hozu-payload"),h=0,g=[...c.keys()].filter(e=>d.has(e));for(let[e,l]of y){if(d.has(e)){h++;continue}let u=g[h]?c.get(g[h])[0]:v;for(let x of l)a.body.insertBefore(x,u)}for(let[e,l]of c)if(!d.has(e))for(let u of l)u.remove();v&&(v.textContent=f.textContent);for(let e of a.head.querySelectorAll(b))e.remove();for(let e of t.head.querySelectorAll(b))a.head.append(e);return a.documentElement.lang=t.documentElement.lang,await r.mount(p,m.map(e=>e.view!==null&&d.has(e.view)?void 0:e.marker)),C(n,r,p,m),!0}function I(r){let{doc:n}=r,t=n.defaultView,o=n.getElementById("hozu-payload");if(!t?.navigation||!o?.textContent)return;let a={views:new Map,soft:{},routes:{}};C(a,r,JSON.parse(o.textContent),E(n.body));let s=null,i=!1,f=y=>{s||(s=n.createElement("div"),s.setAttribute("aria-live","polite"),s.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap",n.body.append(s)),s.textContent=y};t.navigation.addEventListener("navigate",y=>{let c=y;if(i||!c.canIntercept||c.hashChange||c.downloadRequest!==null||c.formData||c.navigationType==="reload")return;let p=new URL(c.destination.url);if(p.origin!==t.location.origin)return;let d=O(a.routes,p.pathname),m=d?a.soft[d]:void 0;if(!m)return;let w=()=>{i=!0,t.location.replace(p.href)};c.intercept({handler:async()=>{let v=n.documentElement;v.setAttribute("data-hozu-navigating","");try{let h=await t.fetch(p.href,{headers:{accept:"text/html"}}),g=h.headers.get("content-type")??"";if(h.status!==200||h.redirected||!g.includes("text/html"))return w();let e=new t.DOMParser().parseFromString(await h.text(),"text/html"),l=!0,u=async()=>{l=await z(r,a,e,m)},x=n.startViewTransition;if(x?await x.call(n,u).updateCallbackDone:await u(),!l)return w();f(n.title)}catch{w()}finally{v.removeAttribute("data-hozu-navigating")}}})})}export{E as islandsIn,k as ranges,O as routeOf,I as soft,z as swap,C as track};