jq79 0.7.1 → 0.7.3
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/README.md +1 -0
- package/dev/vite.ts +192 -24
- package/dist/dom.d.ts +22 -4
- package/dist/html.d.ts +9 -0
- package/dist/jq79-sw.js +32 -0
- package/dist/jq79.cjs +18 -14
- package/dist/jq79.cjs.map +1 -1
- package/dist/jq79.d.ts +15 -12
- package/dist/jq79.global.js +18 -14
- package/dist/jq79.global.js.map +1 -1
- package/dist/jq79.js +18 -14
- package/dist/jq79.js.map +1 -1
- package/dist/precompile.cjs +24 -0
- package/dist/precompile.cjs.map +1 -0
- package/dist/precompile.d.ts +3 -0
- package/dist/precompile.js +24 -0
- package/dist/precompile.js.map +1 -0
- package/dist/reactive.d.ts +6 -0
- package/dist/source.d.ts +65 -0
- package/dist/vite.cjs +102 -11
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +103 -12
- package/dist/vite.js.map +1 -1
- package/package.json +12 -2
- package/src/dom.ts +28 -4
- package/src/html.ts +289 -0
- package/src/jq79.ts +551 -366
- package/src/precompile.ts +237 -0
- package/src/reactive.ts +149 -9
- package/src/source.ts +388 -0
- package/src/sw.ts +87 -0
package/dist/jq79.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
var Fn=Object.defineProperty;var Un=(e,t,n)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>Un(e,typeof t!="symbol"?t+"":t,n);function we(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function He(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var ze=(e,t={})=>{let n=document.createElement(e);for(let[s,r]of Object.entries(t))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let i of r)n.appendChild(i);else n.setAttribute(s,r);return n},Bn=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),bt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Hn=new Set(["http:","https:","mailto:"]);function zn(e){try{let t=new URL(e,"https://example.com");return Hn.has(t.protocol)}catch{return!1}}var Gn={"https:":"443","http:":"80"};function Zn(e){let t=e.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!t)return null;let[,n,s]=t,r=n.split(".");return r.some(o=>o!=="*"&&!/^[a-z\d-]+$/.test(o))?null:{host:new RegExp(`^${r.map(o=>o==="*"?"[^.]+":o).join("\\.")}$`),port:!s||s==="*"?null:s}}var St=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(Zn).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||Gn[n.protocol]||"";return t.some(i=>i.host.test(s)&&(i.port===null||i.port===r))}};function Kn(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var wt=512;function Rt(e,t,n,s){if(n>wt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${wt} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let i=Vn(r,n,s);i&&t.appendChild(i)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function Vn(e,t,n){let s=e.tagName.toLowerCase();if(!Bn.has(s))return null;let r=document.createElement(s);for(let i of Array.from(e.attributes)){let o=i.name.toLowerCase(),l=bt[s]?.has(o),a=bt["*"]?.has(o);!l&&!a||(o==="href"||o==="src")&&(!zn(i.value)||n&&!Kn(n,i.value,s,o))||r.setAttribute(o,i.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Rt(e,r,t+1,n),r}function Ge(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return Rt(n.content,s,0,t?.allowUrl),s.innerHTML}var Xn=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),Te=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Ct=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let i=t?`${t}.${s}`:s;r&&typeof r=="object"&&Te(r)?Ct(r,i,n):n(i,r)})},Jn=(e,t)=>{e.own===null?e.own=t:e.own!==t&&(e.ownMany??(e.ownMany=new Set)).add(t)},Yn=(e,t)=>{e.deep===null?e.deep=t:e.deep!==t&&(e.deepMany??(e.deepMany=new Set)).add(t)},Qn=(e,t)=>{e.own===t?e.own=null:e.ownMany?.delete(t)&&e.ownMany.size===0&&(e.ownMany=null)},es=(e,t)=>{e.deep===t?e.deep=null:e.deepMany?.delete(t)&&e.deepMany.size===0&&(e.deepMany=null)},me=(e,t)=>{e.own!==null&&t(e.own),e.ownMany?.forEach(t)},Se=(e,t)=>{e.deep!==null&&t(e.deep),e.deepMany?.forEach(t)},$t=" keys",Ze=e=>e?`${e}.${$t}`:$t,Tt=".length",Nt=(e,t)=>({children:null,own:null,ownMany:null,deep:null,deepMany:null,parent:e,segment:t}),ts=e=>e.own===null&&e.deep===null&&!e.ownMany?.size&&!e.deepMany?.size&&!e.children?.size,Ve=Symbol("jq79.raw"),Z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[Ve];)t=t[Ve];return t},_t=Symbol("jq79.store"),ue=e=>e!==null&&typeof e=="object"&&e[_t]===!0,le=[],Re=e=>{le.push(new Set);try{return e()}finally{le.pop()}},ns=0,Ke=new Set,xt="$__attach",Ne=Symbol("jq79.alsoWakenBy"),xe=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,i=Object.create(null),o=Nt(null,""),l=(f,d)=>{let g=o;return f.split(".").forEach(h=>{let b=g.children??(g.children=new Map),y=b.get(h);y||(y=Nt(g,h),b.set(h,y)),g=y}),d.deep?Yn(g,d):Jn(g,d),g},a=(f,d)=>{d.deep?es(f,d):Qn(f,d);let g=f;for(;g?.parent&&ts(g);)g.parent.children.delete(g.segment),g=g.parent},u=f=>{let d=o;for(let g of f.split("."))if(d=d.children?.get(g),!d)return;return d},c=f=>{let d=new Set,g=E=>{let $=E.children?[...E.children.values()]:[];for(;$.length;){let N=$.pop();me(N,O=>d.add(O)),Se(N,O=>d.add(O)),N.children?.forEach(O=>$.push(O))}},h=o,b=f.split("."),y="";for(let E=0;E<b.length-1;E++){if(h=h.children?.get(b[E]),!h)return d;y=y?`${y}.${b[E]}`:b[E],Se(h,$=>d.add($)),C.has(y)&&me(h,$=>d.add($)),E===b.length-2&&b[E+1]==="length"&&(me(h,$=>d.add($)),g(h))}return h=h.children?.get(b[b.length-1]),h&&(me(h,E=>d.add(E)),Se(h,E=>d.add(E)),g(h)),d},p=(f,d,g)=>{if(d===g)return!1;for(let h=d;h<g;h++){let b=f.charCodeAt(h);if(b<48||b>57)return!1}return!0},w=(f,d)=>{if(f.deep||d.size<2)return d;let g=new Set;d.forEach(y=>{y.endsWith(Tt)&&g.add(y.slice(0,-Tt.length))});let h=new Set;if(d.forEach(y=>{let E=0,$="";for(let N=y.indexOf(".");N!==-1;N=y.indexOf(".",N+1)){let O=y.slice(0,N);(!(E>0&&p(y,E,N))||g.has($))&&h.add(O),$=O,E=N+1}}),!h.size)return d;let b=new Set;return d.forEach(y=>{h.has(y)||b.add(y)}),b},v=f=>{let d=null,g=null,h=null,b=Ke,y=x=>h?h.has(x):d===x,E=x=>{let B=l(x,f);h?h.set(x,B):d===null?(d=x,g=B):(h=new Map([[d,g],[x,B]]),d=g=null)},$=x=>{if(h){h.forEach((B,W)=>{x.has(W)||(a(B,f),h.delete(W))});return}d!==null&&!x.has(d)&&(a(g,f),d=g=null)},N=()=>{h?h.forEach(x=>a(x,f)):g&&a(g,f),h=null,d=g=null},O=x=>{if(x.size===b.size){let W=!0;if(x.forEach(ce=>{W&&(W=b.has(ce))}),W)return}b=x;let B=w(f,x);$(B),B.forEach(W=>{y(W)||E(W)})};return f.reindex.add(O),O(f.deps),()=>{f.reindex.delete(O),N(),b=Ke}},I=f=>{let d=u(f);if(d){let g=new Set;me(d,h=>g.add(h)),Se(d,h=>g.add(h)),M(g)}},U=f=>I(Ze(f)),M=f=>{let d=Array.from(f),g=!0;for(let h=1;g&&h<d.length;h++)g=d[h-1].order<d[h].order;g||d.sort((h,b)=>h.order-b.order),d.forEach(h=>{s.has(h)&&h.run()})},S=(f,d,g=!1)=>{t.get(f)?.forEach(h=>h(d,f)),n.forEach(h=>h(f,d)),g?s.forEach(h=>h.run()):M(c(f))},F=(f,d)=>f!==d&&f!==null&&d!==null&&typeof f=="object"&&typeof d=="object"&&!ue(f)&&!ue(d)&&Te(f)&&Te(d)&&Array.isArray(f)===Array.isArray(d),L=null,D=-1,H=(f,d)=>{let g=d.length>f.length,h=g?f:d,b=g?d:f,y=0;for(;y<h.length&&Object.is(Z(h[y]),Z(b[y]));)y++;for(let E=y;E<h.length;E++)if(!Object.is(Z(h[E]),Z(b[E+1])))return D;return y},J=(f,d)=>{if(Array.isArray(d)){let $=f.length,N=d.length,O=$!==N;if(!$||!N)return L;let x=Math.max($,N);if(Math.abs($-N)===1){let W=H(f,d);if(W!==D){let ce=[];for(let Be=W;Be<x;Be++)ce.push(String(Be));return{keys:ce,exact:!0,keysChanged:O}}}let B=[];for(let W=0;W<x;W++)if(!Object.is(Z(f[W]),Z(d[W]))&&(B.push(String(W)),B.length*2>=x))return L;return{keys:B,exact:!1,keysChanged:O}}let g=Object.keys(f),h=Object.keys(d),b=new Set([...g,...h]);if(!b.size)return L;let y=[];b.forEach($=>{Object.is(Z(f[$]),Z(d[$]))||y.push($)});let E=g.length!==h.length||g.some(($,N)=>$!==h[N]);return y.length*2>=b.size?L:{keys:y,exact:!1,keysChanged:E}},Y=(f,d,g,h)=>{let b=new Set,y=$=>{let N=u($);N&&(me(N,O=>b.add(O)),Se(N,O=>b.add(O)))},E=J(d,g);if(!E)return S(f,h);if(t.get(f)?.forEach($=>$(h,f)),n.forEach($=>$(f,h)),y(f),E.keys.forEach($=>{let N=`${f}.${$}`,O=t.get(N);if(O){let x=Z(g[$]),B=R(x)?A(x,N):x;O.forEach(W=>W(B,N))}E.exact?y(N):c(N).forEach(x=>b.add(x))}),E.keysChanged&&y(Ze(f)),Array.isArray(g)&&d.length!==g.length){let $=`${f}.length`;t.get($)?.forEach(N=>N(g.length,$)),y($)}M(b)},R=f=>f!==null&&typeof f=="object"&&Te(f),C=new Map,m=(f,d)=>{let g=C.get(d);g?.store!==f&&(g?.unsubscribe(),C.set(d,{store:f,unsubscribe:f.$onAny((h,b)=>S(`${d}.${h}`,b))}))},_=f=>{C.get(f)?.unsubscribe(),C.delete(f)},A=(f,d)=>{let g=r.get(f);if(g)return g;let h=null,b=new Proxy(f,{has(y,E){return Reflect.has(y,E)||typeof E=="string"&&h?.has(E)===!0},ownKeys(y){return le[le.length-1]?.add(Ze(d)),Reflect.ownKeys(y)},get(y,E,$){if(E===Ve)return y;if(E===_t)return d==="";if(typeof E!="string")return Reflect.get(y,E,$);if(d===""&&E in i)return i[E];let N=d?`${d}.${E}`:E;le[le.length-1]?.add(N);let O=Reflect.get(y,E,$);if(ue(O))return m(O,N),O;let x=Z(O);return R(x)?A(x,N):x},set(y,E,$,N){if(N!==b&&!Object.prototype.hasOwnProperty.call(y,E))return Reflect.set(y,E,$,N);let O=d?`${d}.${E}`:E,x=ue($)?$:Z($),B=!Object.prototype.hasOwnProperty.call(y,E);if(!B&&Object.is(y[E],x)&&(x===null||typeof x!="object"))return!0;let W=y[E];y[E]=x,h?.delete(E),ue(x)?m(x,O):_(O);let ce=ue(x)||!R(x)?x:A(x,O);return!B&&F(W,x)?Y(O,W,x,ce):S(O,ce,B),!0},deleteProperty(y,E){if(typeof E!="string")return Reflect.deleteProperty(y,E);let $=Object.prototype.hasOwnProperty.call(y,E),N=Reflect.deleteProperty(y,E);if(N&&$){let O=d?`${d}.${E}`:E;(h??(h=new Set)).add(E),_(O),S(O,void 0),U(d)}return N}});return r.set(f,b),b},z=A(Z(e),"");Object.entries(Z(e)).forEach(([f,d])=>{ue(d)&&m(d,f)});let V=(f,d,{immediate:g=!1}={})=>(t.has(f)||t.set(f,new Set),t.get(f).add(d),g&&d(Xn(z,f),f),()=>t.get(f)?.delete(d)),K=(f,{immediate:d=!1}={})=>(n.add(f),d&&Ct(z,"",(g,h)=>f(g,h)),()=>n.delete(f)),T=(f,{deep:d=!1,alsoWakenBy:g}={})=>{let h=!1,b=!1,y={deps:Ke,reindex:new Set,deep:d,order:ns++,run:()=>{if(h){b=!0;return}h=!0;try{let N=0;do{b=!1;let O=new Set;le.push(O);try{f()}finally{le.pop(),y.deps=O}}while(b&&++N<100);b&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{h=!1,y.reindex.forEach(N=>N(y.deps))}}};s.add(y);let E=v(y),$=()=>{s.delete(y),E()};return g?.length?q(y,g,$):(y.run(),$)},q=(f,d,g)=>{let h=d.map(b=>b?.[xt]?.(f)).filter(Boolean);return f.run(),()=>{g(),h.forEach(b=>b())}},P=f=>{s.add(f);let d=v(f);return()=>{s.delete(f),d()}},G=()=>{C.forEach(({unsubscribe:f})=>f()),C.clear()};return i.$on=V,i.$onAny=K,i.$effect=T,i.$dispose=G,i[xt]=P,z},Xe=class{constructor(t,n){k(this,"scope",t);k(this,"disposers",null);k(this,"runs",null);k(this,"options");let s=t[Ne];this.options=n||s?{deep:n,alsoWakenBy:s}:void 0}effect(t){(this.disposers??(this.disposers=[])).push(this.scope.$effect(t,this.options)),(this.runs??(this.runs=[])).push(t)}onDispose(t){(this.disposers??(this.disposers=[])).push(t)}refresh(){this.runs?.forEach(t=>t())}dispose(){let t=this.disposers;if(this.disposers=null,this.runs=null,t)for(let n=0;n<t.length;n++)t[n]()}},de=(e,t=!1)=>new Xe(e,t);var At=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Ot=/\$:\s*/y,_e=/import(?=\s*\()/y,vt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,te=(e,t)=>{let n=e[t],s=t+1;for(;s<e.length;){if(e[s]==="\\"){s+=2;continue}if(e[s]===n)return s+1;s++}return e.length},Q=(e,t)=>{let n=e.indexOf(`
|
|
2
|
-
`,t);return n===-1?e.length:n},
|
|
3
|
-
`)return n;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(n++;n<e.length&&/[a-z]/i.test(e[n]);)n++;return n}n++}return e.length},
|
|
4
|
-
`){let i=
|
|
5
|
-
`||o===";"||o==="}"?i=!0:/\s/.test(o)||(i=!1),n+=o,s++}return{vars:t,code:n}},
|
|
6
|
-
`||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},
|
|
7
|
-
`||
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
= $value`,S=new Set;Object.entries(c).forEach(([R,C])=>{let m=U(R);u[m]!==void 0&&console.warn(`jq79: <${X(t)}> binds prop "${m}" through both :${m} and ${I(R)} - ${I(R)} wins`),u[m]=C,$s(M(C),["$value"])===null&&(S.add(R),console.warn(`jq79: ${I(R)}="${C}" is not assignable - updates from <${X(t)}> will be dropped`))});let F=()=>{let R={};return w.forEach(({name:C,expr:m})=>{if(C!==void 0)R[C]=j(m,n);else{let _=j(m,n);_!==null&&typeof _=="object"&&Object.assign(R,_)}}),Object.entries(c).forEach(([C,m])=>{R[U(C)]=j(m,n)}),R},L=null,D=null,H=null,J=new Set,Y=R=>{if(R==null){if(!n[qn]?.has(e)||J.has("unfilled"))return;J.add("unfilled"),console.error(`jq79: <${X(t)}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${e}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}J.has("type")||(J.add("type"),console.error(`jq79: <${X(t)}> is ${typeof R}, not a component - nothing renders here`))};return s.effect(()=>{let R=j(e,n),C=R instanceof ie?R:null;if(C||Y(R),C===D||(H?.dispose(),H=null,L?.destroy(),L=null,D=C,!C))return;Zs(t,C);let m=new ie({template:C.template,scripts:C.scripts,styles:C.styles,modules:C.modules,filename:C.filename,siblings:C.siblings,name:C.name});if(a&&(m.slots=a),Object.keys(c).length){let K=new Set;m.modelWriteback=(T,q)=>{let P=T==null?"default":oe(String(T)),G=c[P];return G===void 0?(K.has(P)||(K.add(P),console.warn(`jq79: <${X(t)}> has no ${I(P)} - bound: ${Object.keys(c).map(I).join(", ")}`)),!1):S.has(P)?!1:(Re(()=>j(M(G),n,{$value:q})),!0)}}p.forEach(([K,T])=>Os(m,K,T,n));let _=Yr(m.scripts);Qr(t,e,Object.keys(u),_);let A=Qt(Re(F),_),z=document.createDocumentFragment();if(rt>=Wt){console.error(`jq79: <${X(t)}> is ${Wt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}rt++;try{(r?m.renderShadow(A):m.render(A)).mount(z)}finally{rt--}l?l.parentNode.insertBefore(z,l):i.appendChild(z);let V=de(n,!0);if(v){let K=[];V.effect(()=>{let T=Qt(F(),_),q=Object.keys(T);K.forEach(P=>{P in T||(m.data[P]=void 0)}),q.forEach(P=>{m.data[P]=T[P]}),K=q})}else Object.entries(u).forEach(([K,T])=>{_!==null&&!_.has(K)||V.effect(()=>{m.data[K]=j(T,n)})});H=V,L=m}),s.onDispose(()=>{H?.dispose(),L?.destroy()}),i},Ks=(e,t)=>{let n=()=>{let s=j(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},ae=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(ae):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?ae(t):[]):[],Vs=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?St(e):()=>!1,Xs=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),Tn=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),Js={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},Bt=new Map,Ys=(e,t)=>{let n=`${e} ${t}`,s=Bt.get(n);if(s!==void 0)return s;let r=Js[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,l]=r;i=new DOMParser().parseFromString(`<${o}><${l} ${t}="x"/></${o}>`,"text/html").querySelector(l)?.getAttributeNames().find(u=>u.toLowerCase()===t)??t}return Bt.set(n,i),i},Nn=(e,t)=>{let n=e.namespaceURI;if(n===null||n===rn)return t;let s=t.replace(/-/g,"").toLowerCase(),r=Ys(n,s);return r===s?t:r},xn=(e,t,n)=>{let s=Xs.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},re={cloneSkeletons:!0,scopedNames:!0},Qs=new Set([":text",":html",":value",":checked",":selected"]),er=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||Qs.has(e)?!0:e.startsWith(":")?e===":model"?!1:!be(e)&&!e.includes("."):e!==qe,Cn=e=>{if(e.component||e.tag.includes("-")||Sn(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!er(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||Cn(t))},_n=(e,t,n)=>{let s=Tn(e),r,i=null;for(let p in e.attrs){let w=e.attrs[p];if(p.startsWith("@"))n.push({kind:"event",path:t,attr:p,expr:w});else if(p===":class")r=w;else if(p.startsWith(":class."))(i??(i=[])).push([p.slice(7),w]);else if(!be(p))if(p.startsWith(":")){let v=p.slice(1);n.push({kind:"attr",path:t,name:Nn(s,v),expr:w||oe(v)})}else s.setAttribute(p,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(ae(e.attrs.class??""))});let o=e.attrs[":text"],l=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):l!==void 0?n.push({kind:"html",path:t,expr:l}):e.children.forEach((p,w)=>{if(typeof p=="string"){p.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:gn(p)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(p));return}s.appendChild(_n(p,[...t,w],n))});let a=e.attrs[":value"];a!==void 0&&n.push({kind:"value",path:t,expr:a});let u=e.attrs[":checked"];u!==void 0&&n.push({kind:"checked",path:t,expr:u});let c=e.attrs[":selected"];return c!==void 0&&n.push({kind:"selected",path:t,expr:c}),s},tr=3,An=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:An(n)),0),Ht=new WeakMap,zt=new WeakSet,nr=e=>{let t=Ht.get(e);if(t!==void 0)return t;if(!zt.has(e))return zt.add(e),null;let n=null;if(Cn(e)&&An(e)>=tr){let s=[];n={skeleton:_n(e,[],s),ops:s}}return Ht.set(e,n),n},sr=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},rr=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:sr(s,r.path);if(r.kind==="text"){let o=i,l=r.parts;n.effect(()=>{let a=mn(l,t);o.textContent!==a&&(o.textContent=a)})}else if(r.kind==="event")En(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:l,expr:a}=r;n.effect(()=>xn(o,l,j(a,t)))}else if(r.kind==="class"){let o=i,{classExpr:l,toggles:a,staticClasses:u}=r,c=[];n.effect(()=>{let p=l!==void 0?ae(j(l,t)):[];a?.forEach(([w,v])=>{j(v,t)&&p.push(...ae(w))}),c.forEach(w=>{!p.includes(w)&&!u.has(w)&&o.classList.remove(w)}),o.classList.add(...p),c=p})}else if(r.kind==="textContent"){let o=i,{expr:l}=r;n.effect(()=>{let a=String(j(l,t)??"");o.textContent!==a&&(o.textContent=a)})}else if(r.kind==="html"){let o=i,{expr:l}=r;n.effect(()=>{o.innerHTML=Ge(String(j(l,t)??""))})}else if(r.kind==="value"){let o=i,{expr:l}=r;n.effect(()=>{let a=String(j(l,t)??"");o.value!==a&&(o.value=a)})}else if(r.kind==="checked"){let o=i,{expr:l}=r;n.effect(()=>{let a=!!j(l,t);o.checked!==a&&(o.checked=a)})}else if(r.kind==="selected"){let o=i,{expr:l}=r;n.effect(()=>{let a=!!j(l,t);o.selected!==a&&(o.selected=a)})}else{let o=r}}return s},gt=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?Ks(r,t):t;if(Sn(e.tag))return zs(e,i,n,s);if(e.tag==="template"&&$e(e)!==void 0)return Us(e);let o=It(e,i);if(o)return Ut(o,e,i,n,s);if(re.cloneSkeletons){let S=nr(e);if(S)return rr(S,i,n)}let l=Tn(e);if(e.component!==void 0&&i[ut]?.count===0)throw Ds(e.component,i);let a=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(a){let S=!1;n.effect(()=>{if(S)return;let F=It(e,i);if(!F)return;S=!0;let L=Ut(F,e,i,n,s),D=ht(L);n.onDispose(()=>Fe(D)),l.replaceWith(L)})}for(let S in e.attrs){let F=e.attrs[S];if(S.startsWith("@"))En(l,S,F,i);else if(S===":model"||S.startsWith(":model."))a||console.warn(`jq79: ${S} on <${X(e)}> does nothing - :model binds component tags only (for now)`);else if(!be(S))if(S.startsWith(":"))if(a)l.setAttribute(S,F);else{let L=S.slice(1),D=F||oe(L),H=Nn(l,L);n.effect(()=>xn(l,H,j(D,i)))}else l.setAttribute(S,F)}let u=e.attrs[":class"],c=null;for(let S in e.attrs)S.startsWith(":class.")&&(c??(c=[])).push([S.slice(7),e.attrs[S]]);if(u!==void 0||c){let S=new Set(ae(e.attrs.class??"")),F=[];n.effect(()=>{let L=u!==void 0?ae(j(u,i)):[];c?.forEach(([D,H])=>{j(H,i)&&L.push(...ae(D))}),F.forEach(D=>{!L.includes(D)&&!S.has(D)&&l.classList.remove(D)}),l.classList.add(...L),F=L})}let p=e.attrs[":text"],w=e.attrs[":html"],v=e.attrs[":html.allowed"];v!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),p!==void 0?n.effect(()=>{let S=String(j(p,i)??"");l.textContent!==S&&(l.textContent=S)}):w!==void 0?n.effect(()=>{let S=v!==void 0?{allowUrl:Vs(j(v,i))}:void 0;l.innerHTML=Ge(String(j(w,i)??""),S)}):l instanceof HTMLTemplateElement?ge(e.children,i,n,s,l.content):ge(e.children,i,n,s,l);let I=e.attrs[":value"];I!==void 0&&n.effect(()=>{let S=String(j(I,i)??"");l.value!==S&&(l.value=S)});let U=e.attrs[":checked"];U!==void 0&&n.effect(()=>{let S=!!j(U,i);l.checked!==S&&(l.checked=S)});let M=e.attrs[":selected"];return M!==void 0&&n.effect(()=>{let S=!!j(M,i);l.selected!==S&&(l.selected=S)}),l},or=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,l=null,a=null;return n.effect(()=>{let u=e.find(p=>p.expr===void 0||j(p.expr,t))??null;if(u===l||(a?.dispose(),o&&Fe(o),o=null,l=u,!u))return;a=de(t);let c=gt(u.node,t,a,s);o=ht(c),r.parentNode.insertBefore(c,r.nextSibling)}),i},ye=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},ir=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,l=n.length;for(;o<l;){let a=o+l>>1;e[n[a]]<i?o=a+1:l=a}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},lr=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},On=(e,t)=>typeof e=="string"?t.some(n=>Zt(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Zt(n,s)))||e.children.some(n=>On(n,t)),Gt=/[A-Za-z0-9_$]/,ar=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Zt=(e,t)=>{for(let n=e.indexOf(t);n!==-1;n=e.indexOf(t,n+1)){let s=n===0?"":e[n-1],r=e[n+t.length]??"";if(!Gt.test(s)&&!Gt.test(r))return!0}return!1},ot=new WeakMap,cr=e=>{let t=ot.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(As);if(!n)return ot.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],l=o===s,a=o!==void 0&&!l&&ar.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:u,[":key"]:c,...p}=e.attrs,w={...e,attrs:p},v=["$index",...r?[r]:[]],I=On(w,v),U=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),M={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:l,keyProp:a,itemNode:w,readsPosition:I,namesComponent:U};return ot.set(e,M),M},ur=(e,t,n,s)=>{let r=cr(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:l,keyExpr:a,keyIsItem:u,keyProp:c,itemNode:p,readsPosition:w,namesComponent:v}=r,I=document.createComment("each"),U=document.createDocumentFragment();U.appendChild(I),(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let M=[],S=!1;return n.effect(()=>{let F=ks(t);try{let L=j(l,t),D=Array.isArray(L),H=D?null:lr(L)?Object.keys(L):[],J=D?L.length:H.length,Y=new Map;M.forEach((T,q)=>{T.pos=q;let P=Y.get(T.key);P?P.push(T):Y.set(T.key,[T])});let R=new Set,C=[],m=[],_=[],A;for(let T=0;T<J;T++){let q=D?T:H[T],P=D?L[T]:L[q],G=q;u?G=P:c!==void 0&&P!==null&&typeof P=="object"?G=P[c]:a!==void 0&&(A===void 0?(A=Object.create(t),ye(A,i,P),o&&ye(A,o,q),ye(A,"$index",T)):(A[i]=P,o&&(A[o]=q),A.$index=T),G=j(a,A)),R.has(G)&&!S&&(S=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),R.add(G);let f=Y.get(G)?.shift();if(f&&Object.is(f.item,P)){let b=f.scope;b.$index!==T&&(w&&C.push(f),b.$index=T),o&&b[o]!==q&&(b[o]=q),m.push(f),_.push(f.pos);continue}f&&(f.fx.dispose(),Fe(f.range));let d=Object.create(t);ye(d,i,P),o&&ye(d,o,q),ye(d,"$index",T),v||bn.add(d);let g=de(t),h=ht(gt(p,d,g,s));m.push({key:G,item:P,scope:d,fx:g,range:h,pos:T}),_.push(-1)}let z=new Set;Y.forEach(T=>T.forEach(q=>z.add(q))),z.size&&(z.forEach(T=>{T.dead=!0,T.fx.dispose()}),vs(js(M,T=>T.dead===!0)));let V=I,K=ir(_);m.forEach((T,q)=>{!K[q]&&V.nextSibling!==T.range.first&&Ps(T.range,V),V=T.range.last}),C.forEach(T=>Re(()=>T.fx.refresh())),M=m}finally{Ms(F)}}),U},vn=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},it=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${X(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},dr=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${X(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${X(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},fr=[":if",":elseif",":else",":each"],pr=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=fr.find(s=>s in e.attrs);if(n!==void 0){if($e(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${$e(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},hr=[...yn,":model",":slot"].map(e=>e.slice(1)),gr={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},mr=e=>{for(let t in e.attrs){let n=gr[t];n!==void 0&&console.warn(`jq79: ${n}`)}},yr=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||be(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=hr.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},jn=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(pr(s,t),mr(s),yr(s),jn(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(it(r),":if"in r.attrs){s++;let i=l=>{let a=vn(e,s),u=e[a];if(typeof u=="object"&&l in u.attrs)return s=a+1,u};for(let l=i(":elseif");l;l=i(":elseif"))it(l);let o=i(":else");o&&it(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&dr(r,n),n=!1,s++}},Kt=new WeakMap,Er=(e,t,n)=>{let s=Kt.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=u=>{let c=vn(e,i),p=e[c];if(typeof p=="object"&&u in p.attrs)return i=c+1,p};for(let u=o(":elseif");u;u=o(":elseif"))r.push({expr:u.attrs[":elseif"],node:u});let l=o(":else");l&&r.push({node:l});let a={branches:r,next:i};return Kt.set(t,a),a},ge=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let l=e[o];if(typeof l=="string"){let a=document.createTextNode(l);if(l.includes("{{")){let u=gn(l);n.effect(()=>{let c=mn(u,t);a.textContent!==c&&(a.textContent=c)})}i.appendChild(a),o++;continue}if(":each"in l.attrs){i.appendChild(ur(l,t,n,s)),o++;continue}if(":if"in l.attrs){let a=Er(e,l,o);i.appendChild(or(a.branches,t,n,s)),o=a.next;continue}i.appendChild(gt(l,t,n,s)),o++}return i},Eo=(e,t,n=!1)=>ge(e.template,t,de(t),n),br=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),wr=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,mt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Sr=e=>e.split(mt).map((t,n)=>n%2===1?t:t.replace(wr,(s,r,i)=>br.has(r.toLowerCase())?s:`<${r}${i}></${r}>`)).join(""),Pn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Rr=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,$r=e=>e.split(mt).map((t,n)=>n%2===1?t:t.replace(Pn,(s,r,i)=>{let o=0,l=i.replace(Rr,(a,u,c)=>c===void 0?a:`${u}:props.${o++}="${c}"`);return`<${r}${l}>`})).join(""),Tr=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,Nr=/<\/slot\.([\w.$-]+)(\s*)>/gi,xr=/^slot\./i,Cr=e=>xr.test(e)?`slot.${De(e.slice(5))}`:e,qe=":jq79-component",kn=/^[A-Z]/,_r="c79-",Ue=e=>`${_r}${De(e[0].toLowerCase()+e.slice(1))}`,Ar=e=>kn.test(e)?Ue(e):Cr(e),Or=/<\/([A-Z][\w.-]*)(\s*)>/g,vr=/\/\s*$/,jr=(e,t)=>{if(!kn.test(e))return t;let n=` ${qe}="${e}"`,s=vr.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Pr=e=>e.split(mt).map((t,n)=>n%2===1?t:t.replace(Pn,(s,r,i)=>{let o=i.replace(Tr,(l,a,u)=>u===void 0?l:`${a}${De(u)}`);return`<${Ar(r)}${jr(r,o)}>`}).replace(Nr,(s,r,i)=>`</slot.${De(r)}${i}>`).replace(Or,(s,r,i)=>`</${Ue(r)}${i}>`)).join(""),Ee="data-jq79",kr=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)},Mn=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Ee]=t,Mn(n.children,t))})},Mr=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${Ee}="${t}"]${o}`}).join(", "),Ln=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Mr(n.selectorText,t):n instanceof CSSGroupingRule&&Ln(n.cssRules,t)})},Lr=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Dr=/[a-z]/,Ir=e=>e.replace(Lr,(t,n,s)=>Dr.test(s)?`${n}${Ue(s)}`:t),qr=/^\s*@(media|supports|container|layer|scope|document)\b/i,Wr=/^\s*@/,Fr=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!Wr.test(s)?Ir(n):n,n=""},l=u=>{o(),t+=u,s+=u},a=(u,c)=>{o(),t+=u,s="",c!==void 0?r.push(c):u==="}"&&r.pop()};for(let u=0;u<e.length;){let c=e[u];if(c==="/"&&e[u+1]==="*"){let p=e.indexOf("*/",u+2),w=p===-1?e.length:p+2;l(e.slice(u,w)),u=w}else if(c==='"'||c==="'"){let p=u+1;for(;p<e.length&&e[p]!==c;)p+=e[p]==="\\"?2:1;l(e.slice(u,Math.min(p+1,e.length))),u=p+1}else c==="{"?(a("{",qr.test(s)),u++):c==="}"||c===";"?(a(c),u++):(n+=c,s+=c,u++)}return o(),t},Ur=(e,t)=>{/:deep\(|::v-deep|>>>/.test(e)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(e),Ln(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
;$__state.done = true })()${Dn(i.filename,i.index??0)}`)(l,n,r,a,...Object.values(o));return u.catch(c=>console.error("jq79: error in :setup script",c)),dn(u),{settled:u,sync:a.done===!0}},Jt=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:j(s,e))})},Et=e=>{let t=e.attrs[":setup"];if(t===void 0)return null;if(t.trim()==="")return[];let n=je(t);return n||Xr(e,t),n},Yt=new WeakSet,Xr=(e,t)=>{t.trim()==="_"||Yt.has(e)||(Yt.add(e),console.warn(`jq79: :setup="${t}" is not a props pattern, so this component declares no signature and takes whatever a parent passes - write the props it takes ("{ a, b }"), a bare :setup for none, or "_" to stay open on purpose`))},Jr=e=>{let t=new Set;return e.forEach(n=>{(Pe(n.content)??Et(n))?.forEach(({name:r})=>t.add(r))}),t},Yr=e=>{let t=null;return e.forEach(n=>{let s=Pe(n.content)??Et(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:i})=>r.add(i))}),t},Qt=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},en=new WeakMap,Qr=(e,t,n,s)=>{if(s===null)return;let r=en.get(e)??new Set;en.set(e,r),n.forEach(i=>{s.has(i)||r.has(i)||(r.add(i),console.warn(`jq79: :${i} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},eo=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,i])=>{t.has(r)||(n[r]=i,s=!0)}),s?n:null},qn=Symbol("jq79.unfilledProps"),ut=Symbol("jq79.pendingScripts"),to=e=>e&&e.default!==void 0?e.default:e,no=(e,t,n,s={},r=yt,i={})=>{let o={...Wn,...s},l={},a=new Function("$__exports","$__default","$__import",...Object.keys(o),`return (async () => { "use strict";
|
|
1
|
+
var Ns=Object.defineProperty;var Cs=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var P=(e,t,n)=>Cs(e,typeof t!="symbol"?t+"":t,n);function $e(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function Ye(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var Je=(e,t={})=>{let n=document.createElement(e);for(let[s,r]of Object.entries(t))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let i of r)n.appendChild(i);else n.setAttribute(s,r);return n},vs=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),Bt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Ms=new Set(["http:","https:","mailto:"]);function Ps(e){try{let t=new URL(e,"https://example.com");return Ms.has(t.protocol)}catch{return!1}}var As={"https:":"443","http:":"80"};function _s(e){let t=e.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!t)return null;let[,n,s]=t,r=n.split(".");return r.some(o=>o!=="*"&&!/^[a-z\d-]+$/.test(o))?null:{host:new RegExp(`^${r.map(o=>o==="*"?"[^.]+":o).join("\\.")}$`),port:!s||s==="*"?null:s}}var Ut=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(_s).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||As[n.protocol]||"";return t.some(i=>i.host.test(s)&&(i.port===null||i.port===r))}};function Os(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var Ht=512;function Kt(e,t,n,s){if(n>Ht)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Ht} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let i=js(r,n,s);i&&t.appendChild(i)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function js(e,t,n){let s=e.tagName.toLowerCase();if(!vs.has(s))return null;let r=document.createElement(s);for(let i of Array.from(e.attributes)){let o=i.name.toLowerCase(),a=Bt[s]?.has(o),l=Bt["*"]?.has(o);!a&&!l||(o==="href"||o==="src")&&(!Ps(i.value)||n&&!Os(n,i.value,s,o))||r.setAttribute(o,i.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Kt(e,r,t+1,n),r}function et(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return Kt(n.content,s,0,t?.allowUrl),s.innerHTML}var ks=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),_e=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Yt=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let i=t?`${t}.${s}`:s;r&&typeof r=="object"&&_e(r)?Yt(r,i,n):n(i,r)})},Ls=(e,t)=>{e.own===null?e.own=t:e.own!==t&&(e.ownMany??(e.ownMany=new Set)).add(t)},Ds=(e,t)=>{e.deep===null?e.deep=t:e.deep!==t&&(e.deepMany??(e.deepMany=new Set)).add(t)},Is=(e,t)=>{e.own===t?e.own=null:e.ownMany?.delete(t)&&e.ownMany.size===0&&(e.ownMany=null)},qs=(e,t)=>{e.deep===t?e.deep=null:e.deepMany?.delete(t)&&e.deepMany.size===0&&(e.deepMany=null)},we=(e,t)=>{e.own!==null&&t(e.own),e.ownMany?.forEach(t)},xe=(e,t)=>{e.deep!==null&&t(e.deep),e.deepMany?.forEach(t)},zt=" keys",tt=e=>e?`${e}.${zt}`:zt,Gt=".length",Vt=(e,t)=>({children:null,own:null,ownMany:null,deep:null,deepMany:null,parent:e,segment:t}),Ws=e=>e.own===null&&e.deep===null&&!e.ownMany?.size&&!e.deepMany?.size&&!e.children?.size,st=Symbol("jq79.raw"),Q=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[st];)t=t[st];return t},Jt=Symbol("jq79.store"),fe=e=>e!==null&&typeof e=="object"&&e[Jt]===!0,rt=null,ce=[],J=null,Se=e=>{ce.push(new Set);let t=J;J=null;try{return e()}finally{ce.pop(),J=t}},Fs=e=>{e.adopted.forEach((t,n)=>{e.read?.has(n)||(t(),e.adopted.delete(n))})},Zt=e=>{e.adopted?.forEach(t=>t()),e.adopted=null},Bs=0,nt=new Set,Qt="$__attach",Xt="$__holds",Oe=Symbol("jq79.alsoWakenBy"),it=Symbol("jq79.owner"),je=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,i=Object.create(null),o=Vt(null,""),a=(c,u)=>{let g=o;return c.split(".").forEach(h=>{let b=g.children??(g.children=new Map),y=b.get(h);y||(y=Vt(g,h),b.set(h,y)),g=y}),u.deep?Ds(g,u):Ls(g,u),g},l=(c,u)=>{u.deep?qs(c,u):Is(c,u);let g=c;for(;g?.parent&&Ws(g);)g.parent.children.delete(g.segment),g=g.parent},f=c=>{let u=o;for(let g of c.split("."))if(u=u.children?.get(g),!u)return;return u},d=c=>{let u=new Set,g=E=>{let R=E.children?[...E.children.values()]:[];for(;R.length;){let T=R.pop();we(T,M=>u.add(M)),xe(T,M=>u.add(M)),T.children?.forEach(M=>R.push(M))}},h=o,b=c.split("."),y="";for(let E=0;E<b.length-1;E++){if(h=h.children?.get(b[E]),!h)return u;y=y?`${y}.${b[E]}`:b[E],xe(h,T=>u.add(T));let R=m.get(y);R&&we(h,T=>{R.store[Xt](T)||u.add(T)}),E===b.length-2&&b[E+1]==="length"&&(we(h,T=>u.add(T)),g(h))}return h=h.children?.get(b[b.length-1]),h&&(we(h,E=>u.add(E)),xe(h,E=>u.add(E)),g(h)),u},p=(c,u,g)=>{if(u===g)return!1;for(let h=u;h<g;h++){let b=c.charCodeAt(h);if(b<48||b>57)return!1}return!0},w=(c,u)=>{if(c.deep||u.size<2)return u;let g=new Set;u.forEach(y=>{y.endsWith(Gt)&&g.add(y.slice(0,-Gt.length))});let h=new Set;if(u.forEach(y=>{let E=0,R="";for(let T=y.indexOf(".");T!==-1;T=y.indexOf(".",T+1)){let M=y.slice(0,T);(!(E>0&&p(y,E,T))||g.has(R))&&h.add(M),R=M,E=T+1}}),!h.size)return u;let b=new Set;return u.forEach(y=>{h.has(y)||b.add(y)}),b},A=c=>{let u=null,g=null,h=null,b=nt,y=$=>h?h.has($):u===$,E=$=>{let V=a($,c);h?h.set($,V):u===null?(u=$,g=V):(h=new Map([[u,g],[$,V]]),u=g=null)},R=$=>{if(h){h.forEach((V,B)=>{$.has(B)||(l(V,c),h.delete(B))});return}u!==null&&!$.has(u)&&(l(g,c),u=g=null)},T=()=>{h?h.forEach($=>l($,c)):g&&l(g,c),h=null,u=g=null},M=$=>{if($.size===b.size){let B=!0;if($.forEach(ue=>{B&&(B=b.has(ue))}),B)return}b=$;let V=w(c,$);R(V),V.forEach(B=>{y(B)||E(B)})};return c.reindex.add(M),M(c.deps),()=>{c.reindex.delete(M),T(),b=nt}},L=c=>{let u=f(c);if(u){let g=new Set;we(u,h=>g.add(h)),xe(u,h=>g.add(h)),k(g)}},G=c=>L(tt(c)),k=c=>{let u=Array.from(c),g=!0;for(let h=1;g&&h<u.length;h++)g=u[h-1].order<u[h].order;g||u.sort((h,b)=>h.order-b.order),u.forEach(h=>{s.has(h)&&h.run()})},S=(c,u,g=!1)=>{t.get(c)?.forEach(h=>h(u,c)),n.forEach(h=>h(c,u)),g?s.forEach(h=>h.run()):k(d(c))},D=(c,u)=>c!==u&&c!==null&&u!==null&&typeof c=="object"&&typeof u=="object"&&!fe(c)&&!fe(u)&&_e(c)&&_e(u)&&Array.isArray(c)===Array.isArray(u),I=null,j=-1,H=(c,u)=>{let g=u.length>c.length,h=g?c:u,b=g?u:c,y=0;for(;y<h.length&&Object.is(Q(h[y]),Q(b[y]));)y++;for(let E=y;E<h.length;E++)if(!Object.is(Q(h[E]),Q(b[E+1])))return j;return y},ie=(c,u)=>{if(Array.isArray(u)){let R=c.length,T=u.length,M=R!==T;if(!R||!T)return I;let $=Math.max(R,T);if(Math.abs(R-T)===1){let B=H(c,u);if(B!==j){let ue=[];for(let Xe=B;Xe<$;Xe++)ue.push(String(Xe));return{keys:ue,exact:!0,keysChanged:M}}}let V=[];for(let B=0;B<$;B++)if(!Object.is(Q(c[B]),Q(u[B]))&&(V.push(String(B)),V.length*2>=$))return I;return{keys:V,exact:!1,keysChanged:M}}let g=Object.keys(c),h=Object.keys(u),b=new Set([...g,...h]);if(!b.size)return I;let y=[];b.forEach(R=>{Object.is(Q(c[R]),Q(u[R]))||y.push(R)});let E=g.length!==h.length||g.some((R,T)=>R!==h[T]);return y.length*2>=b.size?I:{keys:y,exact:!1,keysChanged:E}},x=(c,u,g,h)=>{let b=new Set,y=R=>{let T=f(R);T&&(we(T,M=>b.add(M)),xe(T,M=>b.add(M)))},E=ie(u,g);if(!E)return S(c,h);if(t.get(c)?.forEach(R=>R(h,c)),n.forEach(R=>R(c,h)),y(c),E.keys.forEach(R=>{let T=`${c}.${R}`,M=t.get(T);if(M){let $=Q(g[R]),V=v($)?U($,T):$;M.forEach(B=>B(V,T))}E.exact?y(T):d(T).forEach($=>b.add($))}),E.keysChanged&&y(tt(c)),Array.isArray(g)&&u.length!==g.length){let R=`${c}.length`;t.get(R)?.forEach(T=>T(g.length,R)),y(R)}k(b)},v=c=>c!==null&&typeof c=="object"&&_e(c),m=new Map,C=(c,u)=>{let g=m.get(u);g?.store!==c&&(g?.unsubscribe(),m.set(u,{store:c,unsubscribe:c.$onAny((h,b)=>S(`${u}.${h}`,b))}))},_=c=>{m.get(c)?.unsubscribe(),m.delete(c)},U=(c,u)=>{let g=r.get(c);if(g)return g;let h=null,b=new Proxy(c,{has(y,E){return Reflect.has(y,E)||typeof E=="string"&&h?.has(E)===!0},ownKeys(y){return ce[ce.length-1]?.add(tt(u)),J!==null&&J.home!==s&&W(J),Reflect.ownKeys(y)},get(y,E,R){if(E===st)return y;if(E===Jt)return u==="";if(typeof E!="string")return Reflect.get(y,E,R);if(u===""&&E in i)return i[E];let T=u?`${u}.${E}`:E;ce[ce.length-1]?.add(T),J!==null&&J.home!==s&&W(J);let M=Reflect.get(y,E,R);if(fe(M))return C(M,T),M;let $=Q(M);return v($)?U($,T):$},set(y,E,R,T){if(T!==b&&!Object.prototype.hasOwnProperty.call(y,E))return Reflect.set(y,E,R,T);let M=u?`${u}.${E}`:E,$=fe(R)?R:Q(R),V=!Object.prototype.hasOwnProperty.call(y,E);if(!V&&Object.is(y[E],$)&&($===null||typeof $!="object"))return!0;let B=y[E];y[E]=$,h?.delete(E),fe($)?C($,M):_(M);let ue=fe($)||!v($)?$:U($,M);return!V&&D(B,$)?x(M,B,$,ue):S(M,ue,V),!0},deleteProperty(y,E){if(typeof E!="string")return Reflect.deleteProperty(y,E);let R=Object.prototype.hasOwnProperty.call(y,E),T=Reflect.deleteProperty(y,E);if(T&&R){let M=u?`${u}.${E}`:E;(h??(h=new Set)).add(E),_(M),S(M,void 0),G(u)}return T}});return r.set(c,b),b},Z=U(Q(e),"");Object.entries(Q(e)).forEach(([c,u])=>{fe(u)&&C(u,c)});let q=(c,u,{immediate:g=!1}={})=>(t.has(c)||t.set(c,new Set),t.get(c).add(u),g&&u(ks(Z,c),c),()=>t.get(c)?.delete(u)),K=(c,{immediate:u=!1}={})=>(n.add(c),u&&Yt(Z,"",(g,h)=>c(g,h)),()=>n.delete(c)),X=(c,{deep:u=!1,alsoWakenBy:g}={})=>{let h=!1,b=!1,y={deps:nt,reindex:new Set,deep:u,order:Bs++,home:s,adopted:null,read:null,run:()=>{if(h){b=!0;return}h=!0;try{let T=0;do{b=!1,y.read=null;let M=new Set;ce.push(M);let $=J;J=y;try{c()}finally{ce.pop(),J=$,y.deps=M}}while(b&&++T<100);b&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{h=!1,y.adopted&&Fs(y),y.reindex.forEach(T=>T(y.deps))}}};s.add(y);let E=A(y),R=()=>{s.delete(y),E(),Zt(y)};return g?.length?z(y,g,R):(y.run(),rt=y,R)},z=(c,u,g)=>{let h=u.map(b=>b?.[Qt]?.(c)).filter(Boolean);return c.run(),rt=c,()=>{g(),h.forEach(b=>b())}},N=c=>{s.add(c);let u=A(c);return()=>{s.delete(c),u()}},W=c=>{(c.read??(c.read=new Set)).add(s),!(c.adopted?.has(s)||s.has(c))&&(c.adopted??(c.adopted=new Map)).set(s,N(c))},F=()=>{m.forEach(({unsubscribe:c})=>c()),m.clear(),s.forEach(c=>{c.home===s&&Zt(c)})};return i.$on=q,i.$onAny=K,i.$effect=X,i.$dispose=F,i[Qt]=N,i[Xt]=c=>s.has(c),Z},ot=class{constructor(t,n){P(this,"scope",t);P(this,"disposers",null);P(this,"runs",null);P(this,"children",null);P(this,"owners",null);P(this,"options");let s=t[Oe];this.options=n||s?{deep:n,alsoWakenBy:s}:void 0,this.ownedBy(t)}ownedBy(t){let n=t[it];!n||this.owners?.includes(n)||((this.owners??(this.owners=[])).push(n),(n.children??(n.children=new Set)).add(this))}effect(t){(this.disposers??(this.disposers=[])).push(this.scope.$effect(t,this.options)),(this.runs??(this.runs=[])).push(rt)}onDispose(t){(this.disposers??(this.disposers=[])).push(t)}refresh(){this.runs?.forEach(t=>t.run())}rerun(){let t=this.runs?[...this.runs]:null,n=this.children?[...this.children]:null;t?.forEach(s=>{this.runs&&s.run()}),n?.forEach(s=>s.rerun())}dispose(){let t=this.disposers;if(this.disposers=null,this.runs=null,this.children=null,this.owners?.forEach(n=>n.children?.delete(this)),this.owners=null,t)for(let n=0;n<t.length;n++)t[n]()}},pe=(e,t=!1)=>new ot(e,t);var en=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,tn=/\$:\s*/y,Le=/import(?=\s*\()/y,nn=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,ne=(e,t)=>{let n=e[t],s=t+1;for(;s<e.length;){if(e[s]==="\\"){s+=2;continue}if(e[s]===n)return s+1;s++}return e.length},ee=(e,t)=>{let n=e.indexOf(`
|
|
2
|
+
`,t);return n===-1?e.length:n},te=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},ke=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=ee(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=te(e,n);continue}break}return n},Hs=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),se=(e,t)=>{let n=t-1;for(;n>=0;){let r=e[n];if(/\s/.test(r)){n--;continue}if(r==="/"&&e[n-1]==="*"){let i=e.lastIndexOf("/*",n-2);if(i===-1)return!0;n=i-1;continue}break}if(n<0)return!0;let s=e[n];if(/[\w$]/.test(s)){let r=n;for(;r>0&&/[\w$]/.test(e[r-1]);)r--;return Hs.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},re=(e,t)=>{let n=t+1,s=!1;for(;n<e.length;){let r=e[n];if(r==="\\"){n+=2;continue}if(r===`
|
|
3
|
+
`)return n;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(n++;n<e.length&&/[a-z]/i.test(e[n]);)n++;return n}n++}return e.length},Us=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Ks=(e,t)=>{let n=t-1;for(;n>=0;){let s=e[n];if(/\s/.test(s)){n--;continue}if(s==="/"&&e[n-1]==="*"){let r=e.lastIndexOf("/*",n-2);if(r===-1)return"";n=r-1;continue}return s}return""},sn=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=ne(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=ee(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=te(e,s);continue}if(r==="/"&&se(e,s)){s=re(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
|
|
4
|
+
`){let i=ke(e,s+1);if(!(i<e.length&&(Us.test(e.slice(i,i+2))||[",","="].includes(Ks(e,s)))))return s;s=i;continue}}s++}return e.length},zs=e=>{let t=[],n=0,s=0,r=0,i=a=>{t.push({raw:e.slice(s,a),codeEnd:Math.max(0,r-s)}),s=a+1,r=s},o=0;for(;o<e.length;){let a=e[o];if(a==="'"||a==='"'||a==="`"){o=ne(e,o),r=o;continue}if(a==="/"&&e[o+1]==="/"){o=ee(e,o);continue}if(a==="/"&&e[o+1]==="*"){o=te(e,o);continue}if(a==="/"&&se(e,o)){o=re(e,o),r=o;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;else if(a===","&&n<=0){i(o),o++;continue}/\s/.test(a)||(r=o+1),o++}return i(e.length),t},at=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return Ie.test(t)?[t]:[];let n=[];for(let s of ct(t.slice(1,on(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=dt(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let i=lt(s,":");if(i!==-1){n.push(...at(s.slice(i+1)));continue}}n.push(...at(s))}return n},Gs=e=>{let t=[],n=zs(e).map(({raw:i,codeEnd:o})=>{let a=i.match(/^\s*/)[0];if(o<=a.length)return{text:i,empty:!0};let l=i.slice(a.length,o),f=i.slice(o),d=dt(l),p=(d===-1?l:l.slice(0,d)).trim(),w=l[0]==="{"||l[0]==="[";w?t.push(...at(p)):Ie.test(p)&&t.push(p);let A=qe(l).code;return{text:`${a}${w?`(${A})`:A}${f}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(i=>i.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},qe=e=>{let t=[],n="",s=0,r=0,i=!0;for(;s<e.length;){let o=e[s],a=e[s+1];if(o==="'"||o==='"'||o==="`"){let l=ne(e,s);n+=e.slice(s,l),s=l,i=!1;continue}if(o==="/"&&(a==="/"||a==="*")){let l=a==="/"?ee(e,s):te(e,s);n+=e.slice(s,l),s=l;continue}if(o==="/"&&se(e,s)){let l=re(e,s);n+=e.slice(s,l),s=l,i=!1;continue}if(o==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(Le.lastIndex=s,Le.test(e))){n+="$__import",s+=6,i=!1;continue}if(r===0&&i){en.lastIndex=s;let l=en.exec(e);if(l){let d=s+l[0].length,p=sn(e,d),{vars:w,code:A}=Gs(e.slice(d,p));t.push(...w),n+=A,s=p,i=!1;continue}tn.lastIndex=s;let f=tn.exec(e);if(f){nn.lastIndex=s;let d=nn.exec(e);d&&t.push(d[1]);let p=s+f[0].length,w=sn(e,p);n+=`$__effect(() => { ${qe(e.slice(p,w)).code} });`,s=w;continue}}"([{".includes(o)?r++:")]}".includes(o)&&(r=Math.max(0,r-1)),o===`
|
|
5
|
+
`||o===";"||o==="}"?i=!0:/\s/.test(o)||(i=!1),n+=o,s++}return{vars:t,code:n}},De=/export\s+default(?![\w$])/y,rn=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Vs=e=>{let t=[],n=0,s=0;for(let r=0;r<=e.length;r++){let i=e[r];if(i==="{")n++;else if(i==="}")n--;else if(r===e.length||i===","&&n===0){let o=e.slice(s,r).trim();o&&t.push(o),s=r+1}}return t},Zs=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Vs(e),i=[],o=s;if(r.length>1){let a=`$__mod${n}`;i.push(`${a} = ${s}`),o=a}for(let a of r)a.startsWith("{")?i.push(`${a.replace(/\s+as\s+/g,": ")} = ${o}`):a.startsWith("*")?i.push(`${a.replace(/^\*\s*as\s+/,"")} = ${o}`):i.push(`${a} = $__default(${o})`);return`const ${i.join(", ")}`},Ie=/^[A-Za-z_$][\w$]*$/,on=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=ne(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=ee(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=te(e,n);continue}if(s==="/"&&se(e,n)){n=re(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},lt=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=ne(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=ee(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=te(e,s);continue}if(r==="/"&&r!==t&&se(e,s)){s=re(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},ct=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let i=e[r];if(i==="'"||i==='"'||i==="`"){r=ne(e,r);continue}if(i==="/"&&e[r+1]==="/"){r=ee(e,r);continue}if(i==="/"&&e[r+1]==="*"){r=te(e,r);continue}if(i==="/"&&se(e,r)){r=re(e,r);continue}if(i!==void 0&&"([{".includes(i))n++;else if(i!==void 0&&")]}".includes(i))n--;else if(r===e.length||i===","&&n===0){let o=e.slice(s,r).trim();o&&t.push(o),s=r+1}r++}return t},dt=e=>{let t=0;for(;t<e.length;){let n=lt(e.slice(t),"=");if(n===-1)return-1;let s=t+n;if(e[s+1]!=="="&&e[s+1]!==">"&&e[s-1]!=="="&&e[s-1]!=="!")return s;t=s+1}return-1},Ne=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=on(t);if(n>=t.length)return null;let s=[];for(let r of ct(t.slice(1,n))){if(r.startsWith("..."))continue;let i=dt(r),o=i===-1?r:r.slice(0,i),a=i===-1?void 0:r.slice(i+1).trim(),l=lt(o,":"),f=(l===-1?o:o.slice(0,l)).trim();if(!Ie.test(f))continue;let d={name:f};a!==void 0&&(d.default=a);let p=l===-1?"":o.slice(l+1).trim();Ie.test(p)&&(d.as=p),s.push(d)}return s},Qs=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=ne(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=ee(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=te(e,t);continue}if(r==="/"&&se(e,t)){t=re(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){De.lastIndex=t;let i=De.exec(e);if(i)return t+i[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
|
|
6
|
+
`||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},Xs=/^async(?![\w$])/,Ys=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Js=e=>{let t=Qs(e);if(t===-1)return null;let n=ke(e,t),s=e.slice(n);Xs.test(s)&&(n=ke(e,n+5));let r=Ys.exec(e.slice(n));if(r&&(n=ke(e,n+r[0].length)),e[n]!=="(")return null;let i=0,o=n;for(;o<e.length;){let a=e[o];if(a==="'"||a==='"'||a==="`"){o=ne(e,o);continue}if(a==="/"&&e[o+1]==="/"){o=ee(e,o);continue}if(a==="/"&&e[o+1]==="*"){o=te(e,o);continue}if(a==="/"&&se(e,o)){o=re(e,o);continue}if("([{".includes(a))i++;else if(")]}".includes(a)&&--i===0)break;o++}return ct(e.slice(n+1,o))[0]??""},Ce=e=>{let t=Js(e);if(t===null)return null;let n=Ne(t),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},an=e=>{let t="",n=0,s=0,r=!0,i=!1,o=0;for(;n<e.length;){let a=e[n],l=e[n+1],f=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let d=ne(e,n);t+=e.slice(n,d),n=d,r=!1;continue}if(a==="/"&&(l==="/"||l==="*")){let d=l==="/"?ee(e,n):te(e,n);t+=e.slice(n,d),n=d;continue}if(a==="/"&&se(e,n)){let d=re(e,n);t+=e.slice(n,d),n=d,r=!1;continue}if(a==="i"&&f){if(Le.lastIndex=n,Le.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){rn.lastIndex=n;let d=rn.exec(e);if(d){t+=Zs(d[1],d[3],o++),n+=d[0].length,r=!1;continue}}}if(a==="e"&&f&&s===0&&r){De.lastIndex=n;let d=De.exec(e);if(d){i=!0,t+="$__exports.default =",n+=d[0].length,r=!1;continue}}"([{".includes(a)?s++:")]}".includes(a)&&(s=Math.max(0,s-1)),a===`
|
|
7
|
+
`||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return i?t:null},er=new Set(["true","false","null","undefined","this","typeof","instanceof","in","new","void","delete","of","await","yield","NaN","Infinity","arguments","case","do","else","return"]),tr=new Set(["function","class","let","const","var","eval","with"]),nr=new Set(["$scope","$r","$t"]),sr=/^(?:\+\+|--|=>|\*\*=|<<=|>>>=|>>=|&&=|\|\|=|\?\?=|[+\-*/%&|^]=(?!=))/,rr=/^(?:>>>|===|!==|\*\*|<<|>>|==|!=|<=|>=|&&|\|\||\?\?|\?\.)/,or=e=>/[A-Za-z_$]/.test(e),ir=/^(?:0[xXbBoO][\da-fA-F_]+|\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?\d+)?)n?/,ut=e=>{let t=new Set,n=[0],s=[],r=!1,i="",o=0;for(;o<e.length;){let a=e[o];if(/\s/.test(a)){o++;continue}if(a==="/"&&e[o+1]==="/"){o=ee(e,o);continue}if(a==="/"&&e[o+1]==="*"){o=te(e,o);continue}if(a==="/"&&se(e,o)){o=re(e,o),i="value";continue}if(a==='"'||a==="'"){o=ne(e,o),i="value";continue}if(a==="`"){let d=o+1;for(;d<e.length;){if(e[d]==="\\"){d+=2;continue}if(e[d]==="`"){d++;break}if(e[d]==="$"&&e[d+1]==="{"){let p=1,w=d+=2;for(;d<e.length&&p>0;)e[d]==="{"?p++:e[d]==="}"&&p--,d++;let A=ut(e.slice(w,d-1));if(A===null)return null;A.forEach(L=>t.add(L));continue}d++}o=d,i="value";continue}if(/\d/.test(a)&&i!=="."&&i!=="?."){let d=ir.exec(e.slice(o));o+=d?d[0].length:1,i="value";continue}if(or(a)){let d=o;for(;d<e.length&&/[\w$]/.test(e[d]);)d++;let p=e.slice(o,d);if(o=d,tr.has(p))return null;if(i==="."||i==="?."){i="value";continue}if(er.has(p)){i=p==="this"?"value":"op";continue}if(nr.has(p))return null;let w=o;for(;w<e.length&&/\s/.test(e[w]);)w++;if(e[w]==="(")return null;e[w]===":"&&e[w+1]!==":"&&s[s.length-1]==="{"&&n[n.length-1]===0||t.add(p),i="value";continue}let l=e.slice(o);if(sr.test(l))return null;let f=rr.exec(l);if(f){(f[0]==="&&"||f[0]==="||"||f[0]==="??")&&(r=!0),i=f[0]==="?."?"?.":"op",o+=f[0].length;continue}if(a==="=")return null;a==="("||a==="["||a==="{"?(s.push(a),n.push(0)):a===")"||a==="]"||a==="}"?(s.pop(),n.length>1&&n.pop()):a==="?"?(n[n.length-1]++,r=!0):a===":"&&n[n.length-1]>0&&n[n.length-1]--,i=a,o++}return r&&t.size>1?null:[...t]};var oe=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),We=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),lr=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,pt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,cr=e=>e.split(pt).map((t,n)=>n%2===1?t:t.replace(lr,(s,r,i)=>ar.has(r.toLowerCase())?s:`<${r}${i}></${r}>`)).join(""),cn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,dr=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,ur=e=>e.split(pt).map((t,n)=>n%2===1?t:t.replace(cn,(s,r,i)=>{let o=0,a=i.replace(dr,(l,f,d)=>d===void 0?l:`${f}:props.${o++}="${d}"`);return`<${r}${a}>`})).join(""),fr=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,pr=/<\/slot\.([\w.$-]+)(\s*)>/gi,hr=/^slot\./i,gr=e=>hr.test(e)?`slot.${We(e.slice(5))}`:e,ve=":jq79-component",dn=/^[A-Z]/,mr="c79-",Me=e=>`${mr}${We(e[0].toLowerCase()+e.slice(1))}`,yr=e=>dn.test(e)?Me(e):gr(e),Er=/<\/([A-Z][\w.-]*)(\s*)>/g,wr=/\/\s*$/,Sr=(e,t)=>{if(!dn.test(e))return t;let n=` ${ve}="${e}"`,s=wr.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},br=e=>e.split(pt).map((t,n)=>n%2===1?t:t.replace(cn,(s,r,i)=>{let o=i.replace(fr,(a,l,f)=>f===void 0?a:`${l}${We(f)}`);return`<${yr(r)}${Sr(r,o)}>`}).replace(pr,(s,r,i)=>`</slot.${We(r)}${i}>`).replace(Er,(s,r,i)=>`</${Me(r)}${i}>`)).join(""),un=e=>cr(ur(br(e))),fn=/^[A-Z][A-Za-z0-9]*$/,ft=/{{\s*([\s\S]+?)\s*}}/g,ln=new Map,ht=e=>{let t=ln.get(e);if(t)return t;let n=[],s=0;ft.lastIndex=0;for(let r=ft.exec(e);r;r=ft.exec(e))r.index>s&&n.push(e.slice(s,r.index)),n.push({expr:r[1]}),s=r.index+r[0].length;return s<e.length&&n.push(e.slice(s)),ln.set(e,n),n},gt=new Set([":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),he=e=>gt.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),pn=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Fe=e=>e==="slot"||e.startsWith("slot."),mt=e=>e?oe(e):"default",yt=e=>`${e}
|
|
8
|
+
= $value`,Et=["$scope","$r"],hn=e=>`with ($scope) { return (${e}
|
|
9
|
+
); }`,gn=(e,t)=>{let n=ut(e);if(n===null)return null;let s=n.filter(i=>!t.includes(i));return`${s.length===0?"":`let $t; ${s.map(i=>`const ${i} = ($t = $scope.${i}) !== undefined ? $t : $r($scope, ${JSON.stringify(i)});`).join(" ")}`} return (${e}
|
|
10
|
+
);`},Be=(e,t)=>`${e.join(",")}
|
|
11
|
+
${t}`,wt=e=>`await $mounted();${e}`,mn=e=>["$scope","$__effect","$__import","$__state",...e],yn=e=>`return (async () => { with ($scope) { ${e} }
|
|
12
|
+
;$__state.done = true })()`,En=e=>["$__exports","$__default","$__import",...e],wn=e=>`return (async () => { "use strict";
|
|
14
13
|
${e}
|
|
15
|
-
;$__exports.done = true })()
|
|
14
|
+
;$__exports.done = true })()`,Sn=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:Ne(t)},bn=(e,t)=>{let n=new Set;return e.forEach(s=>{(Ce(s.content)??t(s))?.forEach(({name:i})=>n.add(i))}),n};var Tn="__jq79precompiled",Rn="jq79-precompiled",$n=(e,t)=>`function anonymous(${e.join(",")}
|
|
15
|
+
) {
|
|
16
|
+
${t}
|
|
17
|
+
}`;var Tr="0.7.3",Gn=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Vn="http://www.w3.org/1999/xhtml",Zn=e=>{let t=Gn(e),n=e.namespaceURI,s=t[ve];delete t[ve];let r=n!==null&&n!==Vn;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(i=>{if(i.nodeType===Node.TEXT_NODE){let o=i.textContent??"";return o?[o]:[]}return i.nodeType===Node.ELEMENT_NODE?[Zn(i)]:[]})}},Ke=new Map,Ue=new Map,jt=!1,$t,Te=class extends Error{constructor(n,s){super(`${n}. ${s}`);P(this,"reason",n);P(this,"hint",s)}},Rr=()=>new Te("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),$r=(e,t)=>{let n=globalThis[Tn];if(Array.isArray(n)&&n.length>0)for(let[s,r,i]of n.splice(0))Ue.set(Be(s,r),i);return Ue.size===0?void 0:Ue.get(Be(e,t))},kt=(e,t,n="")=>{let s=$r(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if($t!==void 0)return xr(e,t,n,$t);if(jt)throw Rr();return new Function(...e,t+n)},Qn=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},xn="__jq79built",xr=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${xn} = ${$n(e,t)}${n}`;let i,o=l=>{i=l.error??new SyntaxError(l.message),l.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let a=r[xn];if(typeof a=="function")return Ue.set(Be(e,t),a),a;throw i!==void 0?i:new Te("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},Nn=new Set,Nr=(e,t)=>{Nn.has(e)||(Nn.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},St=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},Xn=(e,t)=>{try{return kt([...Et,...t],hn(e))}catch(n){return n instanceof Te&&Nr(e,n),null}},Cr=(e,t)=>{if(!ae.scopedNames)return null;let n=gn(e,t);if(n===null)return null;try{return kt([...Et,...t],n)}catch{return null}},Yn=(e,t,n)=>{let s=Ke.get(e);if(s===void 0){let r=Cr(t,n);s=r?{fn:r,scoped:!0}:{fn:Xn(t,n),scoped:!1},Ke.set(e,s)}return s},Jn=(e,t)=>`${t.join(",")}|${e}`,vr=(e,t)=>Yn(Jn(e,t),e,t).fn,Mr=(e,t,n)=>{let s=Xn(t,n);return Ke.set(e,{fn:s,scoped:!1}),s},Pr=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Ar=100,me=new Map,Lt=new Set,ze=0,xt=!1,Nt=new Set,_r=()=>{xt=!1,!(ze>0)&&(me.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Lt.add(s),console.warn(`jq79: ${e} is not defined - evaluating "${t}". Template expressions resolve against the component store: a top-level let/var/const in a :setup script, a declared prop, or a global. Note a "function name() {}" declaration is not on the store - write "const name = () => {}".`))}),me.clear())},es=()=>{xt||ze>0||!me.size||(xt=!0,queueMicrotask(_r))},ts=e=>{ze++;let t=()=>{ze--,es()};e.then(t,t)},Or=(e,t)=>{if(Nt.has(e))return;Nt.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},ns=(e,t,n)=>{if(!(n instanceof ReferenceError))return Or(e,n);let s=Pr.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let i=`${r}|${e}`;Lt.has(i)||me.has(i)||me.size>=Ar||(me.set(i,{name:r,expr:e,scope:t}),es())},ss=(e,t,n)=>{let s=n?Object.keys(n):[],r=Jn(e,s),{fn:i,scoped:o}=Yn(r,e,s);if(!i)return;let a=n?Object.values(n):[];if(!o)return i(t,St,...a);try{return i(t,St,...a)}catch(l){if(!(l instanceof ReferenceError))throw l;let f=Mr(r,e,s);if(!f)throw l;return f(t,St,...a)}},O=(e,t,n)=>{try{return ss(e,t,n)}catch(s){ns(e,t,s);return}},rs=(e,t,n)=>{try{return ss(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;ns(e,t,s);return}},os=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(O(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(O(s.expr,t)??"");return n},is=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i);e.addEventListener(r,a=>{if(o.has("self")&&a.target!==e)return;o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation();let l=rs(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:o.has("once"),capture:o.has("capture")})},jr=(e,t,n,s)=>{let[r,...i]=t.slice(1).split("."),o=new Set(i),a=l=>{o.has("prevent")&&l.preventDefault(),o.has("stop")&&l.stopPropagation(),o.has("once")&&e.off(r,a),Se(()=>{let f=rs(n,s,{$event:l});typeof f=="function"&&f(l)})};e.on(r,a)},Dt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},Qe=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},kr=e=>{e.forEach(t=>{if(t.first===t.last)return Qe(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Lr=(e,t)=>{let n=[],s=null;return e.forEach(r=>{if(!t(r)){s=null;return}s&&s.last.nextSibling===r.range.first?s.last=r.range.last:n.push(s={first:r.range.first,last:r.range.last})}),n},Dr=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let i=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=i}},Cn=(e,t)=>{let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r;return null},ge=null,Ge=null,as=new WeakSet,Ir=e=>{let t={memo:ge,base:Ge};return ge=new Map,Ge=e,t},qr=e=>{ge=e.memo,Ge=e.base},vn=(e,t)=>e.component!==void 0?Mn(t,e.component):e.tag.includes("-")?Mn(t,e.tag):null,Y=e=>e.component??e.tag,Mn=(e,t)=>{if(!ge)return Cn(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===Ge){if(ge.has(t))return ge.get(t);let r=Cn(s,t);return ge.set(t,r),r}if(!as.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},Wr=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},Fr=(e,t)=>{let n=Wr(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},Pn=100,bt=0,ls=Symbol("jq79.slots"),Ae=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Br=e=>e==="default"?":slot":`:slot.${e}`,Hr=e=>typeof e!="string"||e.trim()!=="",Ur=e=>{let t={},n=[];e.children.forEach(r=>{let i=typeof r=="object"&&r.tag==="template"?Ae(r):void 0;if(typeof r=="string"||i===void 0){n.push(r);return}let o=mt(i.slice(6));if(o in t){console.warn(`jq79: two <template ${Br(o)}> in <${Y(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[i]||void 0}});let s=n.some(Hr);return s&&"default"in t?console.warn(`jq79: <${Y(e)}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(t.default={nodes:n,binder:e.attrs[":slot"]||void 0}),t},Kr=(e,t,n)=>{Ne(t)?.forEach(({name:s,as:r,default:i})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&i!==void 0?O(i,e):a},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},zr=e=>{let t=Ae(e);return console.warn(`jq79: <template ${t}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${t}`)},Gr=(e,t)=>{let n=Object.entries(Ur(e));if(!n.length)return null;let s={};return n.forEach(([r,i])=>{s[r]=Vr(i,t)}),s},Vr=(e,t)=>(n,s,r,i)=>{let o=Object.create(t);Kr(o,e.binder,n);let a=o[Oe]??[];Object.defineProperty(o,Oe,{value:[...a,s]});let l=pe(o);return l.ownedBy(s),r.onDispose(()=>l.dispose()),Ee(e.nodes,o,l,i)},Zr=(e,t,n,s)=>{let r=mt(e.tag.slice(5)),i=document.createDocumentFragment(),o=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);i.append(o,a);let l=t[ls]?.[r];if(!l)return i.insertBefore(Ee(e.children,t,n,s),a),i;let f={};return Object.entries(e.attrs).forEach(([d,p])=>{if(!(d===Re||he(d)||d.startsWith("@")))if(d.startsWith(":")){let w=p||d.slice(1);f[oe(d.slice(1))]=()=>O(w,t)}else f[oe(d)]=()=>p}),i.insertBefore(l(f,t,n,s),a),i},cs="data-c79-box",Qr=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(Me(e));s.setAttribute(cs,"");let r=t.attrs[Re];return r!==void 0&&s.setAttribute(Re,r),n||Io(),s},An=new WeakSet,Xr=(e,t)=>{if(e.ns===void 0||An.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;An.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${Y(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},_n=(e,t,n,s,r)=>{let i=Qr(e,t,r),o=!(i instanceof DocumentFragment),a=o?null:document.createComment(`/${e}`);o||i.append(document.createComment(e),a);let l=Gr(t,n),f={},d={},p=[],w=[],A=!1;Object.entries(t.attrs).forEach(([x,v])=>{if(x!==Re){if(x===":props"||x.startsWith(":props.")){A=!0,w.push({expr:v});return}if(!he(x))if(x.startsWith("@"))p.push([x,v]);else if(x===":model"||x.startsWith(":model.")){let m=x===":model"?"default":oe(x.slice(7));d[m]=v||(x===":model"?"model":m)}else if(x.startsWith(":")){let m=oe(x.slice(1));f[m]=v||m,w.push({name:m,expr:v||m})}else{let m=oe(x),C=JSON.stringify(v);f[m]=C,w.push({name:m,expr:C})}}});let L=x=>x==="default"?":model":`:model.${x}`,G=x=>x==="default"?"model":x,k=new Set;Object.entries(d).forEach(([x,v])=>{let m=G(x);f[m]!==void 0&&console.warn(`jq79: <${Y(t)}> binds prop "${m}" through both :${m} and ${L(x)} - ${L(x)} wins`),f[m]=v,vr(yt(v),["$value"])===null&&(k.add(x),console.warn(`jq79: ${L(x)}="${v}" is not assignable - updates from <${Y(t)}> will be dropped`))});let S=()=>{let x={};return w.forEach(({name:v,expr:m})=>{if(v!==void 0)x[v]=O(m,n);else{let C=O(m,n);C!==null&&typeof C=="object"&&Object.assign(x,C)}}),Object.entries(d).forEach(([v,m])=>{x[G(v)]=O(m,n)}),x},D=null,I=null,j=null,H=new Set,ie=x=>{if(x==null){if(!n[Rs]?.has(e)||H.has("unfilled"))return;H.add("unfilled"),console.error(`jq79: <${Y(t)}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${e}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}H.has("type")||(H.add("type"),console.error(`jq79: <${Y(t)}> is ${typeof x}, not a component - nothing renders here`))};return s.effect(()=>{let x=O(e,n),v=x instanceof le?x:null;if(v||ie(x),v===I||(j?.dispose(),j=null,D?.destroy(),D=null,I=v,!v))return;Xr(t,v);let m=new le({template:v.template,scripts:v.scripts,styles:v.styles,modules:v.modules,filename:v.filename,siblings:v.siblings,name:v.name});if(l&&(m.slots=l),Object.keys(d).length){let q=new Set;m.modelWriteback=(K,X)=>{let z=K==null?"default":oe(String(K)),N=d[z];return N===void 0?(q.has(z)||(q.add(z),console.warn(`jq79: <${Y(t)}> has no ${L(z)} - bound: ${Object.keys(d).map(L).join(", ")}`)),!1):k.has(z)?!1:(Se(()=>O(yt(N),n,{$value:X})),!0)}}p.forEach(([q,K])=>jr(m,q,K,n));let C=Ho(m.scripts);Uo(t,e,Object.keys(f),C);let _=Hn(Se(S),C),U=document.createDocumentFragment();if(bt>=Pn){console.error(`jq79: <${Y(t)}> is ${Pn} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}bt++;try{(r?m.renderShadow(_):m.render(_)).mount(U)}finally{bt--}a?a.parentNode.insertBefore(U,a):i.appendChild(U);let Z=pe(n,!0);if(A){let q=[];Z.effect(()=>{let K=Hn(S(),C),X=Object.keys(K);q.forEach(z=>{z in K||(m.data[z]=void 0)}),X.forEach(z=>{m.data[z]=K[z]}),q=X})}else Object.entries(f).forEach(([q,K])=>{C!==null&&!C.has(q)||Z.effect(()=>{m.data[q]=O(K,n)})});j=Z,D=m}),s.onDispose(()=>{j?.dispose(),D?.destroy()}),i},Yr=(e,t)=>{let n=()=>{let s=O(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let i=n();return i!==null&&Reflect.has(i,r)||Reflect.has(s,r)},get(s,r){let i=n();return i!==null&&Reflect.has(i,r)?i[r]:Reflect.get(s,r)},set(s,r,i){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=i,!0):Reflect.set(s,r,i)}})},de=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(de):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?de(t):[]):[],Jr=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Ut(e):()=>!1,eo=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),ds=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),to={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},On=new Map,no=(e,t)=>{let n=`${e} ${t}`,s=On.get(n);if(s!==void 0)return s;let r=to[e],i=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,a]=r;i=new DOMParser().parseFromString(`<${o}><${a} ${t}="x"/></${o}>`,"text/html").querySelector(a)?.getAttributeNames().find(f=>f.toLowerCase()===t)??t}return On.set(n,i),i},us=(e,t)=>{let n=e.namespaceURI;if(n===null||n===Vn)return t;let s=t.replace(/-/g,"").toLowerCase(),r=no(n,s);return r===s?t:r},fs=(e,t,n)=>{let s=eo.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},ae={cloneSkeletons:!0,scopedNames:!0},so=new Set([":text",":html",":value",":checked",":selected"]),ro=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||so.has(e)?!0:e.startsWith(":")?e===":model"?!1:!he(e)&&!e.includes("."):e!==ve,ps=e=>{if(e.component||e.tag.includes("-")||Fe(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!ro(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||ps(t))},hs=(e,t,n)=>{let s=ds(e),r,i=null;for(let p in e.attrs){let w=e.attrs[p];if(p.startsWith("@"))n.push({kind:"event",path:t,attr:p,expr:w});else if(p===":class")r=w;else if(p.startsWith(":class."))(i??(i=[])).push([p.slice(7),w]);else if(!he(p))if(p.startsWith(":")){let A=p.slice(1);n.push({kind:"attr",path:t,name:us(s,A),expr:w||oe(A)})}else s.setAttribute(p,w)}(r!==void 0||i)&&n.push({kind:"class",path:t,classExpr:r,toggles:i,staticClasses:new Set(de(e.attrs.class??""))});let o=e.attrs[":text"],a=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):a!==void 0?n.push({kind:"html",path:t,expr:a}):e.children.forEach((p,w)=>{if(typeof p=="string"){p.includes("{{")?(n.push({kind:"text",path:[...t,w],parts:ht(p)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(p));return}s.appendChild(hs(p,[...t,w],n))});let l=e.attrs[":value"];l!==void 0&&n.push({kind:"value",path:t,expr:l});let f=e.attrs[":checked"];f!==void 0&&n.push({kind:"checked",path:t,expr:f});let d=e.attrs[":selected"];return d!==void 0&&n.push({kind:"selected",path:t,expr:d}),s},oo=3,gs=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:gs(n)),0),jn=new WeakMap,kn=new WeakSet,io=e=>{let t=jn.get(e);if(t!==void 0)return t;if(!kn.has(e))return kn.add(e),null;let n=null;if(ps(e)&&gs(e)>=oo){let s=[];n={skeleton:hs(e,[],s),ops:s}}return jn.set(e,n),n},ao=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},lo=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let i=r.path.length===0?s:ao(s,r.path);if(r.kind==="text"){let o=i,a=r.parts;n.effect(()=>{let l=os(a,t);o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="event")is(i,r.attr,r.expr,t);else if(r.kind==="attr"){let o=i,{name:a,expr:l}=r;n.effect(()=>fs(o,a,O(l,t)))}else if(r.kind==="class"){let o=i,{classExpr:a,toggles:l,staticClasses:f}=r,d=[];n.effect(()=>{let p=a!==void 0?de(O(a,t)):[];l?.forEach(([w,A])=>{O(A,t)&&p.push(...de(w))}),d.forEach(w=>{!p.includes(w)&&!f.has(w)&&o.classList.remove(w)}),o.classList.add(...p),d=p})}else if(r.kind==="textContent"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(O(a,t)??"");o.textContent!==l&&(o.textContent=l)})}else if(r.kind==="html"){let o=i,{expr:a}=r;n.effect(()=>{o.innerHTML=et(String(O(a,t)??""))})}else if(r.kind==="value"){let o=i,{expr:a}=r;n.effect(()=>{let l=String(O(a,t)??"");o.value!==l&&(o.value=l)})}else if(r.kind==="checked"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!O(a,t);o.checked!==l&&(o.checked=l)})}else if(r.kind==="selected"){let o=i,{expr:a}=r;n.effect(()=>{let l=!!O(a,t);o.selected!==l&&(o.selected=l)})}else{let o=r}}return s},It=(e,t,n,s)=>{let r=e.attrs[":with"],i=r!==void 0?Yr(r,t):t;if(Fe(e.tag))return Zr(e,i,n,s);if(e.tag==="template"&&Ae(e)!==void 0)return zr(e);let o=vn(e,i);if(o)return _n(o,e,i,n,s);if(ae.cloneSkeletons){let S=io(e);if(S)return lo(S,i,n)}let a=ds(e);if(e.component!==void 0&&i[At]?.count===0)throw Fr(e.component,i);let l=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(l){let S=!1;n.effect(()=>{if(S)return;let D=vn(e,i);if(!D)return;S=!0;let I=_n(D,e,i,n,s),j=Dt(I);n.onDispose(()=>Qe(j)),a.replaceWith(I)})}for(let S in e.attrs){let D=e.attrs[S];if(S.startsWith("@"))is(a,S,D,i);else if(S===":model"||S.startsWith(":model."))l||console.warn(`jq79: ${S} on <${Y(e)}> does nothing - :model binds component tags only (for now)`);else if(!he(S))if(S.startsWith(":"))if(l)a.setAttribute(S,D);else{let I=S.slice(1),j=D||oe(I),H=us(a,I);n.effect(()=>fs(a,H,O(j,i)))}else a.setAttribute(S,D)}let f=e.attrs[":class"],d=null;for(let S in e.attrs)S.startsWith(":class.")&&(d??(d=[])).push([S.slice(7),e.attrs[S]]);if(f!==void 0||d){let S=new Set(de(e.attrs.class??"")),D=[];n.effect(()=>{let I=f!==void 0?de(O(f,i)):[];d?.forEach(([j,H])=>{O(H,i)&&I.push(...de(j))}),D.forEach(j=>{!I.includes(j)&&!S.has(j)&&a.classList.remove(j)}),a.classList.add(...I),D=I})}let p=e.attrs[":text"],w=e.attrs[":html"],A=e.attrs[":html.allowed"];A!==void 0&&w===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),p!==void 0?n.effect(()=>{let S=String(O(p,i)??"");a.textContent!==S&&(a.textContent=S)}):w!==void 0?n.effect(()=>{let S=A!==void 0?{allowUrl:Jr(O(A,i))}:void 0;a.innerHTML=et(String(O(w,i)??""),S)}):a instanceof HTMLTemplateElement?Ee(e.children,i,n,s,a.content):Ee(e.children,i,n,s,a);let L=e.attrs[":value"];L!==void 0&&n.effect(()=>{let S=String(O(L,i)??"");a.value!==S&&(a.value=S)});let G=e.attrs[":checked"];G!==void 0&&n.effect(()=>{let S=!!O(G,i);a.checked!==S&&(a.checked=S)});let k=e.attrs[":selected"];return k!==void 0&&n.effect(()=>{let S=!!O(k,i);a.selected!==S&&(a.selected=S)}),a},co=(e,t,n,s)=>{let r=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(r);let o=null,a=null,l=null;return n.effect(()=>{let f=e.find(p=>p.expr===void 0||O(p.expr,t))??null;if(f===a||(l?.dispose(),o&&Qe(o),o=null,a=f,!f))return;l=pe(t);let d=It(f.node,t,l,s);o=Dt(d),r.parentNode.insertBefore(d,r.nextSibling)}),n.onDispose(()=>l?.dispose()),i},be=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},uo=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let i=e[r];if(i<0)continue;let o=0,a=n.length;for(;o<a;){let l=o+a>>1;e[n[l]]<i?o=l+1:a=l}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},fo=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ms=(e,t)=>typeof e=="string"?t.some(n=>Dn(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Dn(n,s)))||e.children.some(n=>ms(n,t)),ys=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||Fe(e.tag)||e.children.some(ys)),Ln=/[A-Za-z0-9_$]/,po=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Dn=(e,t)=>{for(let n=e.indexOf(t);n!==-1;n=e.indexOf(t,n+1)){let s=n===0?"":e[n-1],r=e[n+t.length]??"";if(!Ln.test(s)&&!Ln.test(r))return!0}return!1},Tt=new WeakMap,ho=e=>{let t=Tt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(pn);if(!n)return Tt.set(e,null),null;let[,s,r,i]=n,o=e.attrs[":key"],a=o===s,l=o!==void 0&&!a&&po.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:f,[":key"]:d,...p}=e.attrs,w={...e,attrs:p},A=["$index",...r?[r]:[]],L=ms(w,A),G=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),k=o!==void 0&&ys(w),S={itemName:s,atName:r,listExpr:i,keyExpr:o,keyIsItem:a,keyProp:l,itemNode:w,readsPosition:L,namesComponent:G,nestsScopes:k};return Tt.set(e,S),S},go=(e,t,n,s)=>{let r=ho(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:i,atName:o,listExpr:a,keyExpr:l,keyIsItem:f,keyProp:d,itemNode:p,readsPosition:w,namesComponent:A,nestsScopes:L}=r,G=document.createComment("each"),k=document.createDocumentFragment();k.appendChild(G),(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let S=[],D=!1;return n.effect(()=>{let I=Ir(t);try{let j=O(a,t),H=Array.isArray(j),ie=H?null:fo(j)?Object.keys(j):[],x=H?j.length:ie.length,v=new Map;S.forEach((N,W)=>{N.pos=W;let F=v.get(N.key);F?F.push(N):v.set(N.key,[N])});let m=new Set,C=[],_=[],U=[],Z=[],q;for(let N=0;N<x;N++){let W=H?N:ie[N],F=H?j[N]:j[W],c=W;f?c=F:d!==void 0&&F!==null&&typeof F=="object"?c=F[d]:l!==void 0&&(q===void 0?(q=Object.create(t),be(q,i,F),o&&be(q,o,W),be(q,"$index",N)):(q[i]=F,o&&(q[o]=W),q.$index=N),c=O(l,q)),m.has(c)&&!D&&(D=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),m.add(c);let u=v.get(c)?.shift();if(u&&Object.is(u.item,F)){let y=u.scope;y.$index!==N&&(w&&C.push(u),y.$index=N),o&&y[o]!==W&&(y[o]=W),U.push(u),Z.push(u.pos);continue}if(u&&l!==void 0){let y=u.scope;y[i]=F,y.$index!==N&&(y.$index=N),o&&y[o]!==W&&(y[o]=W),u.item=F,_.push(u),U.push(u),Z.push(u.pos);continue}u&&(u.fx.dispose(),Qe(u.range));let g=Object.create(t);be(g,i,F),o&&be(g,o,W),be(g,"$index",N),A||as.add(g);let h=pe(t);L&&Object.defineProperty(g,it,{value:h});let b=Dt(It(p,g,h,s));U.push({key:c,item:F,scope:g,fx:h,range:b,pos:N}),Z.push(-1)}let K=new Set;v.forEach(N=>N.forEach(W=>K.add(W))),K.size&&(K.forEach(N=>{N.dead=!0,N.fx.dispose()}),kr(Lr(S,N=>N.dead===!0)));let X=G,z=uo(Z);U.forEach((N,W)=>{!z[W]&&X.nextSibling!==N.range.first&&Dr(N.range,X),X=N.range.last}),C.forEach(N=>Se(()=>N.fx.refresh())),_.forEach(N=>Se(()=>N.fx.rerun())),S=U}finally{qr(I)}}),n.onDispose(()=>S.forEach(I=>I.fx.dispose())),k},Es=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},Rt=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${Y(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},mo=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${Y(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${Y(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},yo=[":if",":elseif",":else",":each"],Eo=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=yo.find(s=>s in e.attrs);if(n!==void 0){if(Ae(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Ae(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},wo=[...gt,":model",":slot"].map(e=>e.slice(1)),So={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},bo=e=>{for(let t in e.attrs){let n=So[t];n!==void 0&&console.warn(`jq79: ${n}`)}},To=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||he(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=wo.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},ws=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(Eo(s,t),bo(s),To(s),ws(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(Rt(r),":if"in r.attrs){s++;let i=a=>{let l=Es(e,s),f=e[l];if(typeof f=="object"&&a in f.attrs)return s=l+1,f};for(let a=i(":elseif");a;a=i(":elseif"))Rt(a);let o=i(":else");o&&Rt(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&mo(r,n),n=!1,s++}},In=new WeakMap,Ro=(e,t,n)=>{let s=In.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],i=n+1,o=f=>{let d=Es(e,i),p=e[d];if(typeof p=="object"&&f in p.attrs)return i=d+1,p};for(let f=o(":elseif");f;f=o(":elseif"))r.push({expr:f.attrs[":elseif"],node:f});let a=o(":else");a&&r.push({node:a});let l={branches:r,next:i};return In.set(t,l),l},Ee=(e,t,n,s=!1,r)=>{let i=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let a=e[o];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let f=ht(a);n.effect(()=>{let d=os(f,t);l.textContent!==d&&(l.textContent=d)})}i.appendChild(l),o++;continue}if(":each"in a.attrs){i.appendChild(go(a,t,n,s)),o++;continue}if(":if"in a.attrs){let l=Ro(e,a,o);i.appendChild(co(l.branches,t,n,s)),o=l.next;continue}i.appendChild(It(a,t,n,s)),o++}return i},hi=(e,t,n=!1)=>Ee(e.template,t,pe(t),n),Re="data-jq79",$o=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)},Ss=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Re]=t,Ss(n.children,t))})},xo=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),i=r===-1?s:s.slice(0,r),o=r===-1?"":s.slice(r);return`${i}[${Re}="${t}"]${o}`}).join(", "),bs=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=xo(n.selectorText,t):n instanceof CSSGroupingRule&&bs(n.cssRules,t)})},No=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,Co=/[a-z]/,vo=e=>e.replace(No,(t,n,s)=>Co.test(s)?`${n}${Me(s)}`:t),Mo=/^\s*@(media|supports|container|layer|scope|document)\b/i,Po=/^\s*@/,Ao=e=>{let t="",n="",s="",r=[],i=()=>r.length===0||r[r.length-1],o=()=>{t+=i()&&!Po.test(s)?vo(n):n,n=""},a=f=>{o(),t+=f,s+=f},l=(f,d)=>{o(),t+=f,s="",d!==void 0?r.push(d):f==="}"&&r.pop()};for(let f=0;f<e.length;){let d=e[f];if(d==="/"&&e[f+1]==="*"){let p=e.indexOf("*/",f+2),w=p===-1?e.length:p+2;a(e.slice(f,w)),f=w}else if(d==='"'||d==="'"){let p=f+1;for(;p<e.length&&e[p]!==d;)p+=e[p]==="\\"?2:1;a(e.slice(f,Math.min(p+1,e.length))),f=p+1}else d==="{"?(l("{",Mo.test(s)),f++):d==="}"||d===";"?(l(d),f++):(n+=d,s+=d,f++)}return o(),t},_o=(e,t)=>{/:deep\(|::v-deep|>>>/.test(e)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(e),bs(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
|
|
18
|
+
`)},Ct=e=>{let t=un(e),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],i=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?i.push(l):r.push(l)});let o=qn(r,e),a={};return i.forEach(l=>{let f=l.getAttribute("name");if(f===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!fn.test(f)){console.warn(`jq79: <template name="${f}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(f in a){console.warn(`jq79: two <template name="${f}"> in one file; the second was ignored`);return}a[f]=new le({...qn(Array.from(l.content.children),l.innerHTML),siblings:a,name:f})}),Object.keys(a).length&&(o.siblings=a),o},Oo=/^(?:text|application)\/(?:x-)?typescript$/i,jo=e=>"lang"in e?`lang="${e.lang}"`:Oo.test(e.type?.trim()??"")?`type="${e.type}"`:null,qn=(e,t)=>{let n=[],s=[],r=[];e.forEach(o=>{let a={attrs:Gn(o),content:o.textContent??""};o.tagName==="SCRIPT"?n.push(a):o.tagName==="STYLE"?s.push(a):r.push(Zn(o))}),n.forEach(o=>{let a=jo(o.attrs);a&&console.warn(`jq79: <script ${a}> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its types were never stripped: the script will throw, or - for a plain \`let x: T = ...\` - silently fail to declare x.`)}),s.forEach(o=>{"lang"in o.attrs&&console.warn(`jq79: <style lang="${o.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)}),s.forEach(o=>{"lang"in o.attrs||(o.content=Ao(o.content))});let i=o=>"scoped"in o.attrs&&!("lang"in o.attrs);if(s.some(i)){let o=$o(t);Ss(r,o),s.forEach(a=>{i(a)&&(a.scoped=_o(a.content,o))})}return ws(r),{template:r,scripts:n,styles:s}},qt=e=>/\.html?([?#]|$)/.test(e)?_t(e):import(e),ko=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,Lo=(e,t)=>{if(!ko.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},Do=(e,t)=>e?`
|
|
19
|
+
//# sourceURL=${e}?jq79-script=${t}`:"",Ts=(e,t,n)=>{try{return kt(e,t,Do(n.filename,n.index??0))}catch(s){throw s instanceof Te?new Error(`jq79: safeEval() is on, and script ${n.index??0} of ${n.filename??"a component built from a string"} ${s.reason}. ${s.hint}`):s}},Wn=e=>e.scoped??e.content,Pe=`:where([${cs}]) { display: contents }`,Wt=()=>jt&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype,Ve=e=>{let t=new CSSStyleSheet;return t.replaceSync(e),t},Ft=(e,t)=>{e.adoptedStyleSheets.includes(t)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])},vt=(e,t)=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(n=>n!==t)},He=null,Mt=null,Io=()=>{if(Wt()){Ft(document,Mt??(Mt=Ve(Pe)));return}He?.isConnected||(He=document.createElement("style"),He.textContent=Pe,document.head.appendChild(He))},Ze=new Map,qo=e=>{let t=Ze.get(e);if(!t){if(Wt()){let n=Ve(e);Ft(document,n),t={sheet:n,count:0}}else{let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0}}Ze.set(e,t)}t.count++},Wo=e=>{let t=Ze.get(e);t&&--t.count<=0&&(t.sheet?vt(document,t.sheet):t.el?.remove(),Ze.delete(e))},Fo=(e,t,n,s={},r=qt,i={})=>{let o={...xs,...s},a=new Proxy(t,{has:(d,p)=>p!=="$__effect"&&p!=="$__import"&&p!=="$__state"&&(Reflect.has(d,p)||!(p in globalThis)&&!(p in o))}),l={},f=Ts(mn(Object.keys(o)),yn(e),i)(a,n,r,l,...Object.values(o));return f.catch(d=>console.error("jq79: error in :setup script",d)),ts(f),{settled:f,sync:l.done===!0}},Fn=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:O(s,e))})},Pt=e=>{let t=Sn(e);return!t&&e.attrs[":setup"]!==void 0&&Bo(e,e.attrs[":setup"]),t},Bn=new WeakSet,Bo=(e,t)=>{t.trim()==="_"||Bn.has(e)||(Bn.add(e),console.warn(`jq79: :setup="${t}" is not a props pattern, so this component declares no signature and takes whatever a parent passes - write the props it takes ("{ a, b }"), a bare :setup for none, or "_" to stay open on purpose`))},Ho=e=>{let t=null;return e.forEach(n=>{let s=Ce(n.content)??Pt(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:i})=>r.add(i))}),t},Hn=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Un=new WeakMap,Uo=(e,t,n,s)=>{if(s===null)return;let r=Un.get(e)??new Set;Un.set(e,r),n.forEach(i=>{s.has(i)||r.has(i)||(r.add(i),console.warn(`jq79: :${i} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},Ko=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,i])=>{t.has(r)||(n[r]=i,s=!0)}),s?n:null},Rs=Symbol("jq79.unfilledProps"),At=Symbol("jq79.pendingScripts"),zo=e=>e&&e.default!==void 0?e.default:e,Go=(e,t,n,s={},r=qt,i={})=>{let o={...xs,...s},a={},l=Ts(En(Object.keys(o)),wn(e),i)(a,zo,r,...Object.values(o)),f=L=>console.error("jq79: error in factory script",L),d=!1,p,w=()=>{if(d)return p;d=!0;let L=a.default;if(typeof L!="function")return;let G=k=>{k&&typeof k=="object"&&Object.assign(t,k)};try{let k=L(t,{$data:t,$props:t,$effect:n,...s});k instanceof Promise?p=k.then(G).catch(f):G(k)}catch(k){f(k)}return p},A=l.then(w,f);return ts(A),a.done&&w(),{settled:A,sync:a.done===!0&&p===void 0}},Vo="__JQ79_HMR_ENABLED__",Zo="__JQ79_HMR__",ye=null,Qo=e=>{if(!ye||!e.filename)return;let t=ye.get(e.filename);t||ye.set(e.filename,t=new Set),t.add(new WeakRef(e))},Kn=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},Xo=(e,t)=>{if(!ye)return 0;let n=Kn(e),s=Ct(t),r=!1,i=a=>a.name===void 0?s:s.siblings?.[a.name]??null,o=0;for(let[a,l]of ye)if(Kn(a)===n){for(let f of l){let d=f.deref();if(!d){l.delete(f);continue}let p=i(d);if(!p){r=!0;continue}d.hotReplace(p)&&o++}l.size||ye.delete(a)}return r?0:o},Yo=()=>{ye??(ye=new Map),globalThis[Zo]={update:Xo}},zn=3e3,Jo=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${zn/1e3}s for a :setup script and has rendered nothing. The template waits until every script returns or calls $mounted() - add an await $mounted() above the slow part to render first and fill in after.`)},zn);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},_t=async e=>{let[t]=await Promise.all([fetch(e).then(n=>{if(!n.ok)throw new Error(`failed to fetch component from ${e}: ${n.status}`);return n.text()}),$s?.then(()=>ni(e))]);return new le(t,{filename:e})},$s,ei="/jq79-sw.js",ti=async e=>{let t=typeof navigator>"u"?void 0:navigator.serviceWorker;if(!t)throw new Error("jq79: safeEval() compiles components in a service worker, and this page can't have one - service workers need https (or localhost). Precompile with the jq79/vite plugin instead, or use safeEval({ nonce: true }) on a page whose server issues a nonce.");let n;try{n=await t.register(e)}catch(s){throw new Error(`jq79: safeEval() couldn't register its service worker at ${e} (${s.message}). Serve jq79-sw.js from the jq79 package at your site's root, or pass its URL: safeEval({ worker: "/path/jq79-sw.js" }).`)}await t.ready,!t.controller&&await new Promise(s=>{t.addEventListener("controllerchange",()=>s(),{once:!0}),t.controller?s():n.active?.postMessage("jq79:claim")})},ni=e=>{let t=new URL(e,document.baseURI);return t.hash="",t.searchParams.set(Rn,""),new Promise((n,s)=>{let r=document.createElement("script"),i=Qn();i&&r.setAttribute("nonce",i),r.src=t.href,r.onload=()=>{r.remove(),n()},r.onerror=()=>{r.remove(),s(new Error(`jq79: the precompiled functions of ${e} did not load, and safeEval() can't render it without them`))},document.head.append(r)})},le=class{constructor(t,n={}){P(this,"template");P(this,"scripts");P(this,"styles");P(this,"modules");P(this,"filename");P(this,"siblings");P(this,"name");P(this,"slots");P(this,"modelWriteback");P(this,"data",null);P(this,"fx",null);P(this,"content",null);P(this,"startMarker",null);P(this,"endMarker",null);P(this,"styleEls",[]);P(this,"shadowCss",null);P(this,"shadowSheets",[]);P(this,"sheetRoot",null);P(this,"ownsSharedStyles",!1);P(this,"useShadow",!1);P(this,"mountRoot",null);P(this,"resolveMounted",null);P(this,"renderDone",!1);P(this,"emitListeners",new Map);let s=typeof t=="string"?Ct(t):t;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof t=="string"?void 0:t.modules),this.filename=n.filename??(typeof t=="string"?void 0:t.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),Qo(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([t,n])=>{n.filename??(n.filename=this.filename),n.modules??(n.modules=this.modules),this.name||(this[t]=n)})}hotReplace(t){let n=typeof t=="string"?Ct(t):t;Lt.clear(),me.clear(),Nt.clear();let s=this.startMarker,r=!!(s&&this.content),i=r&&s.isConnected,o=i?s.parentNode:null,a=i?this.endMarker.nextSibling:null,l={...this.data},f=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,this.siblings=n.siblings,this.adoptSiblings(),!r||(this.renderWith(l,f),!o)?!1:(f&&this.placeShadowStyles(o,a),o.insertBefore(this.content,a),this.mountRoot=o,this.settleMounted(),!0)}static debug(t){if(t){let n=ae.scopedNames;for(let s in t){let r=t[s];Object.prototype.hasOwnProperty.call(ae,s)?typeof r=="boolean"?ae[s]=r:console.warn(`jq79: Component79.debug ignored "${s}" - the flags are booleans, and the ones it knows are: ${Object.keys(ae).join(", ")}`):console.warn(`jq79: Component79.debug does not know "${s}" - the flags it has are: ${Object.keys(ae).join(", ")}`)}ae.scopedNames!==n&&Ke.clear()}return{...ae}}static safeEval(t={}){jt=!0;let n=[];if(t.nonce){let r=Qn();r===void 0?n.push(Promise.reject(new Error("jq79: safeEval({ nonce: true }) found no nonce on this page - no <script> carries one. The nonce belongs on the script that loads the page, the one the CSP names."))):$t=r}let s=t.worker??(t.nonce?!1:ei);return s!==!1&&n.push($s??($s=ti(s))),Promise.all(n).then(()=>{})}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new Ot(_t(t))}static fetchAll(t){return Promise.all(t.map(_t))}on(t,n){return this.emitListeners.has(t)||this.emitListeners.set(t,new Set),this.emitListeners.get(t).add(n),this}off(t,n){return this.emitListeners.get(t)?.delete(n),this}render(t={}){return this.renderWith(t,!1)}renderShadow(t={}){return this.renderWith(t,!0)}renderWith(t,n){this.destroy();let s=bn(this.scripts,Pt),r=Ko(this.siblings,s),i=r?Object.assign(Object.create(r),t):{...t},o=new Set([...s].filter(m=>!(m in t)));o.size&&Object.defineProperty(i,Rs,{value:o}),this.slots&&Object.defineProperty(i,ls,{value:this.slots}),Object.defineProperty(i,At,{value:{count:0}});let a=je(i),l=pe(a);this.data=a,this.fx=l,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let f=this.startMarker,d=!1,p=(m,C)=>{m==="model:update"&&!d&&(d=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let _=new CustomEvent(m,{detail:C,bubbles:!0,composed:!0,cancelable:!0});return f===this.startMarker&&this.emitListeners.get(m)?.forEach(U=>U(_,C)),_.cancelBubble||f.dispatchEvent(_),!_.defaultPrevented},w,A=new Promise(m=>{w=m});this.resolveMounted=w,this.renderDone=!1;let L=this.endMarker,G=(m=>{let C=[];for(let _=f.nextSibling;_&&_!==L;_=_.nextSibling)_ instanceof Element&&(_.matches(m)&&C.push(_),C.push(...Array.from(_.querySelectorAll(m))));return C}),k=(m=>G(m)[0]??null),S=this.modules,D=m=>S&&m in S?Promise.resolve(S[m]):qt(Lo(m,this.filename)),j=Object.assign(Object.create(null),{$emit:p,$updateModel:(...m)=>{let[C,_]=m.length>1?m:[void 0,m[0]];return f!==this.startMarker?!1:this.modelWriteback?.(C,_)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(m=>[m,!0]))}),H=[],ie=!0;this.scripts.forEach((m,C)=>{let _;H.push(new Promise(F=>{_=F}));let U=!1,Z=()=>{U=!0,_()},K={$mounted:()=>(Z(),A),$self:k,$$self:G,...j,...r},X={filename:this.filename,index:C},z=":mounted"in m.attrs,N=an(m.content),W=(()=>{if(N!==null){z&&console.warn("jq79: :mounted on a factory script renders the template before the factory has returned, so none of its bindings exist yet - await $mounted() inside the factory instead."),Fn(a,Ce(m.content));let g=z?wt(N):N;return Go(g,a,h=>l.effect(h),K,D,X)}let{vars:F,code:c}=qe(m.content);Fn(a,Pt(m)),F.forEach(g=>{g in a||(a[g]=void 0)});let u=z?wt(c):c;return Fo(u,a,g=>l.effect(g),K,D,X)})();if(W.sync)W.settled.then(Z,Z);else{let F=i[At];F.count++;let c=()=>{F.count--,Z()};W.settled.then(c,c)}!W.sync&&!U&&(ie=!1)});let x=document.createDocumentFragment(),v=new Proxy(a,{has:(m,C)=>typeof C=="string"&&C in j||Reflect.has(m,C),get:(m,C,_)=>typeof C=="string"&&C in j&&!Reflect.has(m,C)?j[C]:Reflect.get(m,C,_)});if(x.append(this.startMarker,this.endMarker),this.content=x,ie?(this.endMarker.parentNode.insertBefore(Ee(this.template,v,l,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(H).then(()=>{f===this.startMarker&&(this.endMarker.parentNode.insertBefore(Ee(this.template,v,l,n),this.endMarker),this.renderDone=!0,this.settleMounted())}),Jo(this,H)),n)if(Wt())this.shadowCss=[...this.styles.map(m=>m.content),Pe];else{let m=document.createElement("style");m.textContent=Pe,this.styleEls=[...this.styles.map(C=>{let _=document.createElement("style");return _.textContent=C.content,_}),m]}else this.styles.forEach(m=>qo(Wn(m))),this.ownsSharedStyles=!0;return this}mount(t,n){let s=typeof t=="string"?$e(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(s)}mountShadow(t,n){let s=typeof t=="string"?$e(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(s)}attach(t){this.mountRoot&&this.detach();let n=this.useShadow&&t instanceof Element?t.shadowRoot??t.attachShadow({mode:"open"}):t;return this.useShadow&&this.placeShadowStyles(n,null),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),this}placeShadowStyles(t,n){if(this.shadowCss&&typeof ShadowRoot<"u"&&t instanceof ShadowRoot){this.sheetRoot&&this.sheetRoot!==t&&this.shadowSheets.forEach(s=>vt(this.sheetRoot,s)),this.shadowSheets.length===0&&(this.shadowSheets=this.shadowCss.map(s=>s===Pe?Mt??(Mt=Ve(s)):Ve(s))),this.shadowSheets.forEach(s=>Ft(t,s)),this.sheetRoot=t;return}this.shadowCss&&this.styleEls.length===0&&(this.styleEls=this.shadowCss.map(s=>{let r=document.createElement("style");return r.textContent=s,r})),this.styleEls.forEach(s=>t.insertBefore(s,n))}settleMounted(){this.renderDone&&this.mountRoot&&this.resolveMounted?.()}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let t=this.startMarker;for(;t;){let n=t.nextSibling;if(this.content.appendChild(t),t===this.endMarker)break;t=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(t=>t.parentNode?.removeChild(t)),this.styleEls=[],this.sheetRoot&&this.shadowSheets.forEach(t=>{t!==Mt&&vt(this.sheetRoot,t)}),this.shadowCss=null,this.shadowSheets=[],this.sheetRoot=null,this.ownsSharedStyles&&(this.styles.forEach(t=>Wo(Wn(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};P(le,"version",Tr);var Ot=class{constructor(t){P(this,"chain");this.chain=t}queue(t){return this.chain=this.chain.then(n=>(t(n),n)),this}then(t,n){return this.chain.then(t,n)}catch(t){return this.chain.catch(t)}finally(t){return this.chain.finally(t)}mount(t,n){return this.queue(s=>s.mount(t,n))}mountShadow(t,n){return this.queue(s=>s.mountShadow(t,n))}render(t={}){return this.queue(n=>n.render(t))}renderShadow(t={}){return this.queue(n=>n.renderShadow(t))}on(t,n){return this.queue(s=>s.on(t,n))}off(t,n){return this.queue(s=>s.off(t,n))}detach(){return this.queue(t=>t.detach())}destroy(){return this.queue(t=>t.destroy())}};var gi=e=>new le(e),xs={$:$e,$$:Ye,$create:Je,$reactive:je,$toRaw:Q,Component79:le};typeof globalThis<"u"&&globalThis[Vo]&&Yo();export{$e as $,Ye as $$,Je as $create,je as $reactive,Q as $toRaw,le as C79,le as Component79,Ot as PendingComponent79,Yo as enableHotReload,Xo as hotUpdate,gi as parseComponent,hi as renderComponent};
|
|
16
20
|
//# sourceMappingURL=jq79.js.map
|