jq79 0.6.1 → 0.6.2
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/dist/jq79.cjs +13 -13
- package/dist/jq79.cjs.map +1 -1
- package/dist/jq79.global.js +13 -13
- package/dist/jq79.global.js.map +1 -1
- package/dist/jq79.js +13 -13
- package/dist/jq79.js.map +1 -1
- package/package.json +2 -1
- package/src/jq79.ts +98 -25
- package/src/reactive.ts +169 -38
package/dist/jq79.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var me=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var sn=Object.prototype.hasOwnProperty;var rn=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var on=(e,t)=>{for(var n in t)me(e,n,{get:t[n],enumerable:!0})},an=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of nn(t))!sn.call(e,r)&&r!==n&&me(e,r,{get:()=>t[r],enumerable:!(s=tn(t,r))||s.enumerable});return e};var ln=e=>an(me({},"__esModule",{value:!0}),e);var L=(e,t,n)=>rn(e,typeof t!="symbol"?t+"":t,n);var Hs={};on(Hs,{$:()=>de,$$:()=>ye,$create:()=>Ee,$reactive:()=>pe,$toRaw:()=>Z,C79:()=>Y,Component79:()=>Y,PendingComponent79:()=>Oe,enableHotReload:()=>Qt,hotUpdate:()=>Yt,parseComponent:()=>zs,renderComponent:()=>ds});module.exports=ln(Hs);function de(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 Ee=(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 o of r)n.appendChild(o);else n.setAttribute(s,r);return n},cn=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),st={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},dn=new Set(["http:","https:","mailto:"]);function un(e){try{let t=new URL(e,"https://example.com");return dn.has(t.protocol)}catch{return!1}}var fn={"https:":"443","http:":"80"};function pn(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(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${r.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var ot=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(pn).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||fn[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function hn(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var rt=512;function it(e,t,n,s){if(n>rt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${rt} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=gn(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function gn(e,t,n){let s=e.tagName.toLowerCase();if(!cn.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=st[s]?.has(i),d=st["*"]?.has(i);!a&&!d||(i==="href"||i==="src")&&(!un(o.value)||n&&!hn(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),it(e,r,t+1,n),r}function at(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return it(n.content,s,0,t?.allowUrl),s.innerHTML}var mn=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),be=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},ut=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&be(r)?ut(r,o,n):n(o,r)})},lt=" keys",Le=e=>e?`${e}.${lt}`:lt,ct=(e,t)=>({children:null,own:null,deep:null,parent:e,segment:t}),yn=e=>!e.own?.size&&!e.deep?.size&&!e.children?.size,De=Symbol("jq79.raw"),Z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[De];)t=t[De];return t},ft=Symbol("jq79.store"),re=e=>e!==null&&typeof e=="object"&&e[ft]===!0,ne=[],fe=e=>{ne.push(new Set);try{return e()}finally{ne.pop()}},En=0,Me=new Set,dt="$__attach",we=Symbol("jq79.alsoWakenBy"),pe=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=ct(null,""),a=(c,l)=>{let f=i;return c.split(".").forEach(u=>{let y=f.children??(f.children=new Map),E=y.get(u);E||(E=ct(f,u),y.set(u,E)),f=E}),(l.deep?f.deep??(f.deep=new Set):f.own??(f.own=new Set)).add(l),f},d=(c,l)=>{(l.deep?c.deep:c.own)?.delete(l);let f=c;for(;f?.parent&&yn(f);)f.parent.children.delete(f.segment),f=f.parent},g=c=>{let l=i;for(let f of c.split("."))if(l=l.children?.get(f),!l)return;return l},h=c=>{let l=new Set,f=m=>{let R=m.children?[...m.children.values()]:[];for(;R.length;){let N=R.pop();N.own?.forEach(T=>l.add(T)),N.deep?.forEach(T=>l.add(T)),N.children?.forEach(T=>R.push(T))}},u=i,y=c.split("."),E="";for(let m=0;m<y.length-1;m++){if(u=u.children?.get(y[m]),!u)return l;E=E?`${E}.${y[m]}`:y[m],u.deep?.forEach(R=>l.add(R)),W.has(E)&&u.own?.forEach(R=>l.add(R)),m===y.length-2&&y[m+1]==="length"&&(u.own?.forEach(R=>l.add(R)),f(u))}return u=u.children?.get(y[y.length-1]),u&&(u.own?.forEach(m=>l.add(m)),u.deep?.forEach(m=>l.add(m)),f(u)),l},w=(c,l)=>{if(c.deep||l.size<2)return l;let f=new Set;if(l.forEach(y=>{for(let E=y.indexOf(".");E!==-1;E=y.indexOf(".",E+1))f.add(y.slice(0,E))}),!f.size)return l;let u=new Set;return l.forEach(y=>{f.has(y)||u.add(y)}),u},_=c=>{let l=null,f=null,u=null,y=Me,E=A=>u?u.has(A):l===A,m=A=>{let F=a(A,c);u?u.set(A,F):l===null?(l=A,f=F):(u=new Map([[l,f],[A,F]]),l=f=null)},R=A=>{if(u){u.forEach((F,V)=>{A.has(V)||(d(F,c),u.delete(V))});return}l!==null&&!A.has(l)&&(d(f,c),l=f=null)},N=()=>{u?u.forEach(A=>d(A,c)):f&&d(f,c),u=null,l=f=null},T=A=>{if(A.size===y.size){let V=!0;if(A.forEach(ge=>{V&&(V=y.has(ge))}),V)return}y=A;let F=w(c,A);R(F),F.forEach(V=>{E(V)||m(V)})};return c.reindex.add(T),T(c.deps),()=>{c.reindex.delete(T),N(),y=Me}},P=c=>{let l=g(c);l&&U(new Set([...l.own??[],...l.deep??[]]))},k=c=>P(Le(c)),U=c=>{let l=Array.from(c),f=!0;for(let u=1;f&&u<l.length;u++)f=l[u-1].order<l[u].order;f||l.sort((u,y)=>u.order-y.order),l.forEach(u=>{s.has(u)&&u.run()})},b=(c,l,f=!1)=>{t.get(c)?.forEach(u=>u(l,c)),n.forEach(u=>u(c,l)),f?s.forEach(u=>u.run()):U(h(c))},C=(c,l)=>c!==l&&c!==null&&l!==null&&typeof c=="object"&&typeof l=="object"&&!re(c)&&!re(l)&&be(c)&&be(l)&&Array.isArray(c)===Array.isArray(l),j=c=>Array.isArray(c)?c.length:Object.keys(c).length,v=null,B=(c,l)=>{if(Array.isArray(l)){let y=c.length,E=l.length;if(!y||!E)return v;let m=Math.max(y,E),R=[];for(let N=0;N<m;N++)if(!Object.is(Z(c[N]),Z(l[N]))&&(R.push(String(N)),R.length*2>=m))return v;return R}let f=new Set([...Object.keys(c),...Object.keys(l)]);if(!f.size)return v;let u=[];return f.forEach(y=>{Object.is(Z(c[y]),Z(l[y]))||u.push(y)}),u.length*2>=f.size?v:u},K=(c,l,f,u)=>{let y=new Set,E=R=>{let N=g(R);N?.own?.forEach(T=>y.add(T)),N?.deep?.forEach(T=>y.add(T))},m=B(l,f);if(!m)return b(c,u);if(t.get(c)?.forEach(R=>R(u,c)),n.forEach(R=>R(c,u)),E(c),m.forEach(R=>{let N=Z(f[R]),T=`${c}.${R}`,A=q(N)?p(N,T):N;t.get(T)?.forEach(F=>F(A,T)),h(T).forEach(F=>y.add(F))}),j(l)!==j(f)&&E(Le(c)),Array.isArray(f)&&l.length!==f.length){let R=`${c}.length`;t.get(R)?.forEach(N=>N(f.length,R)),E(R)}U(y)},q=c=>c!==null&&typeof c=="object"&&be(c),W=new Map,S=(c,l)=>{let f=W.get(l);f?.store!==c&&(f?.unsubscribe(),W.set(l,{store:c,unsubscribe:c.$onAny((u,y)=>b(`${l}.${u}`,y))}))},x=c=>{W.get(c)?.unsubscribe(),W.delete(c)},p=(c,l)=>{let f=r.get(c);if(f)return f;let u=null,y=new Proxy(c,{has(E,m){return Reflect.has(E,m)||typeof m=="string"&&u?.has(m)===!0},ownKeys(E){return ne[ne.length-1]?.add(Le(l)),Reflect.ownKeys(E)},get(E,m,R){if(m===De)return E;if(m===ft)return l==="";if(typeof m!="string")return Reflect.get(E,m,R);if(l===""&&m in o)return o[m];let N=l?`${l}.${m}`:m;ne[ne.length-1]?.add(N);let T=Reflect.get(E,m,R);if(re(T))return S(T,N),T;let A=Z(T);return q(A)?p(A,N):A},set(E,m,R,N){if(N!==y&&!Object.prototype.hasOwnProperty.call(E,m))return Reflect.set(E,m,R,N);let T=l?`${l}.${m}`:m,A=re(R)?R:Z(R),F=!Object.prototype.hasOwnProperty.call(E,m);if(!F&&Object.is(E[m],A)&&(A===null||typeof A!="object"))return!0;let V=E[m];E[m]=A,u?.delete(m),re(A)?S(A,T):x(T);let ge=re(A)||!q(A)?A:p(A,T);return!F&&C(V,A)?K(T,V,A,ge):b(T,ge,F),!0},deleteProperty(E,m){if(typeof m!="string")return Reflect.deleteProperty(E,m);let R=Object.prototype.hasOwnProperty.call(E,m),N=Reflect.deleteProperty(E,m);if(N&&R){let T=l?`${l}.${m}`:m;(u??(u=new Set)).add(m),x(T),b(T,void 0),k(l)}return N}});return r.set(c,y),y},$=p(Z(e),"");Object.entries(Z(e)).forEach(([c,l])=>{re(l)&&S(l,c)});let O=(c,l,{immediate:f=!1}={})=>(t.has(c)||t.set(c,new Set),t.get(c).add(l),f&&l(mn($,c),c),()=>t.get(c)?.delete(l)),z=(c,{immediate:l=!1}={})=>(n.add(c),l&&ut($,"",(f,u)=>c(f,u)),()=>n.delete(c)),H=(c,{deep:l=!1,alsoWakenBy:f}={})=>{let u=!1,y=!1,E={deps:Me,reindex:new Set,deep:l,order:En++,run:()=>{if(u){y=!0;return}u=!0;try{let N=0;do{y=!1;let T=new Set;ne.push(T);try{c()}finally{ne.pop(),E.deps=T}}while(y&&++N<100);y&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{u=!1,E.reindex.forEach(N=>N(E.deps))}}};s.add(E);let m=_(E),R=()=>{s.delete(E),m()};return f?.length?M(E,f,R):(E.run(),R)},M=(c,l,f)=>{let u=l.map(y=>y?.[dt]?.(c)).filter(Boolean);return c.run(),()=>{f(),u.forEach(y=>y())}},I=c=>{s.add(c);let l=_(c);return()=>{s.delete(c),l()}},G=()=>{W.forEach(({unsubscribe:c})=>c()),W.clear()};return o.$on=O,o.$onAny=z,o.$effect=H,o.$dispose=G,o[dt]=I,$},oe=(e,t=!1)=>{let n=[],s=[],r=e[we];return{effect:o=>{n.push(e.$effect(o,{deep:t,alsoWakenBy:r})),s.push(o)},onDispose:o=>{n.push(o)},refresh:()=>{s.forEach(o=>o())},dispose:()=>{n.splice(0).forEach(o=>o()),s.length=0}}};var pt=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,ht=/\$:\s*/y,Re=/import(?=\s*\()/y,gt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,Q=(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},J=(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 o=
|
|
5
|
-
`||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}}
|
|
6
|
-
`||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},
|
|
7
|
-
`||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var
|
|
8
|
-
); }`)}catch{s=null}
|
|
9
|
-
= $value`,C=new Set;Object.entries(h).forEach(([S,x])=>{let p=U(S);g[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${k(S)} - ${k(S)} wins`),g[p]=x,It(b(x),["$value"])===null&&(C.add(S),console.warn(`jq79: ${k(S)}="${x}" is not assignable - updates from <${t.tag}> will be dropped`))});let j=()=>{let S={};return _.forEach(({name:x,expr:p})=>{if(x!==void 0)S[x]=D(p,n);else{let $=D(p,n);$!==null&&typeof $=="object"&&Object.assign(S,$)}}),Object.entries(h).forEach(([x,p])=>{S[U(x)]=D(p,n)}),S},v=null,B=null,K=null,q=new Set,W=S=>{if(S==null){if(!n[Xt]?.has(e)||q.has("unfilled"))return;q.add("unfilled"),console.error(`jq79: <${t.tag}> 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}q.has("type")||(q.add("type"),console.error(`jq79: <${t.tag}> is ${typeof S}, not a component - nothing renders here`))};return s.effect(()=>{let S=D(e,n),x=S instanceof Y?S:null;if(x||W(S),x===B||(K?.dispose(),K=null,v?.destroy(),v=null,B=x,!x))return;let p=new Y({template:x.template,scripts:x.scripts,styles:x.styles,modules:x.modules,filename:x.filename,siblings:x.siblings,name:x.name});if(d&&(p.slots=d),Object.keys(h).length){let M=new Set;p.modelWriteback=(I,G)=>{let c=I==null?"default":se(String(I)),l=h[c];return l===void 0?(M.has(c)||(M.add(c),console.warn(`jq79: <${t.tag}> has no ${k(c)} - bound: ${Object.keys(h).map(k).join(", ")}`)),!1):C.has(c)?!1:(fe(()=>D(b(l),n,{$value:G})),!0)}}w.forEach(([M,I])=>qn(p,M,I,n));let $=Ms(p.scripts);Ds(t,e,Object.keys(g),$);let O=Pt(fe(j),$),z=document.createDocumentFragment();if(We>=$t){console.error(`jq79: <${t.tag}> is ${$t} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}We++;try{(r?p.renderShadow(O):p.render(O)).mount(z)}finally{We--}i.parentNode.insertBefore(z,i);let H=oe(n,!0);if(P){let M=[];H.effect(()=>{let I=Pt(j(),$),G=Object.keys(I);M.forEach(c=>{c in I||(p.data[c]=void 0)}),G.forEach(c=>{p.data[c]=I[c]}),M=G})}else Object.entries(g).forEach(([M,I])=>{$!==null&&!$.has(M)||H.effect(()=>{p.data[M]=D(I,n)})});K=H,v=p}),s.onDispose(()=>{K?.dispose(),v?.destroy()}),a},ns=(e,t)=>{let n=()=>{let s=D(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},he=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(he):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?he(t):[]):[],ss=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?ot(e):()=>!1,rs=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"]),xt=(e,t,n)=>{let s=rs.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},Qe=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?ns(r,t):t;if(Zn(e.tag))return ts(e,o,n,s);if(e.tag==="template"&&Ye(e)!==void 0)return Yn(e);let i=Rt(o,e.tag);if(i)return Tt(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[Ze]?.count===0)throw Gn(e.component,o);let d=a instanceof HTMLUnknownElement||e.tag.includes("-");if(d){let b=!1;n.effect(()=>{if(b)return;let C=Rt(o,e.tag);if(!C)return;b=!0;let j=Tt(C,e,o,n,s),v=Xe(j);n.onDispose(()=>Pe(v)),a.replaceWith(j)})}Object.entries(e.attrs).forEach(([b,C])=>{if(b.startsWith("@"))In(a,b,C,o);else if(b===":model"||b.startsWith(":model."))d||console.warn(`jq79: ${b} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!Je(b))if(b.startsWith(":"))if(d)a.setAttribute(b,C);else{let j=b.slice(1),v=C||se(j);n.effect(()=>xt(a,j,D(v,o)))}else a.setAttribute(b,C)});let g=e.attrs[":attrs"];if(g!==void 0){let b=[];n.effect(()=>{b.forEach(j=>a.removeAttribute(j));let C=D(g,o);b=C&&typeof C=="object"?Object.keys(C):[],b.forEach(j=>xt(a,j,C[j]))})}let h=e.attrs[":class"],w=Object.entries(e.attrs).filter(([b])=>b.startsWith(":class.")).map(([b,C])=>[b.slice(7),C]);if(h!==void 0||w.length){let b=new Set(he(e.attrs.class??"")),C=[];n.effect(()=>{let j=h!==void 0?he(D(h,o)):[];w.forEach(([v,B])=>{D(B,o)&&j.push(...he(v))}),C.forEach(v=>{!j.includes(v)&&!b.has(v)&&a.classList.remove(v)}),a.classList.add(...j),C=j})}let _=e.attrs[":text"],P=e.attrs[":html"],k=e.attrs[":html.allowed"];k!==void 0&&P===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),_!==void 0?n.effect(()=>{a.textContent=String(D(_,o)??"")}):P!==void 0?n.effect(()=>{let b=k!==void 0?{allowUrl:ss(D(k,o))}:void 0;a.innerHTML=at(String(D(P,o)??""),b)}):a instanceof HTMLTemplateElement?ce(e.children,o,n,s,a.content):ce(e.children,o,n,s,a);let U=e.attrs[":value"];return U!==void 0&&n.effect(()=>{let b=String(D(U,o)??"");a.value!==b&&(a.value=b)}),[":checked",":selected"].forEach(b=>{let C=e.attrs[b];if(C===void 0)return;let j=b.slice(1);n.effect(()=>{a[j]=!!D(C,o)})}),a},os=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,d=null;return n.effect(()=>{let g=e.find(w=>w.expr===void 0||D(w.expr,t))??null;if(g===a||(d?.dispose(),i&&Pe(i),i=null,a=g,!g))return;d=oe(t);let h=Qe(g.node,t,d,s);i=Xe(h),r.parentNode.insertBefore(h,r.nextSibling)}),o},ue=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},is=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let o=e[r];if(o<0)continue;let i=0,a=n.length;for(;i<a;){let d=i+a>>1;e[n[d]]<o?i=d+1:a=d}i>0&&(s[r]=n[i-1]),n[i]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},as=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Gt=(e,t)=>typeof e=="string"?t.some(n=>At(e,n)):Object.values(e.attrs).some(n=>t.some(s=>At(n,s)))||e.children.some(n=>Gt(n,t)),Nt=/[A-Za-z0-9_$]/,ls=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,At=(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(!Nt.test(s)&&!Nt.test(r))return!0}return!1},cs=(e,t,n,s)=>{let r=e.attrs[":each"].match(kn);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,d=e.attrs[":key"],g=d===o,h=d!==void 0&&!g&&ls.test(d)&&d.startsWith(`${o}.`)?d.slice(o.length+1):void 0,{[":each"]:w,[":key"]:_,...P}=e.attrs,k={...e,attrs:P},U=["$index",...i?[i]:[]],b=Gt(k,U),C=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(C),(":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 v=[],B=!1;return n.effect(()=>{let K=Bn(t);try{let q=D(a,t),W=Array.isArray(q),S=W?null:as(q)?Object.keys(q):[],x=W?q.length:S.length,p=new Map;v.forEach((l,f)=>{l.pos=f;let u=p.get(l.key);u?u.push(l):p.set(l.key,[l])});let $=new Set,O=[],z=[],H=[],M;for(let l=0;l<x;l++){let f=W?l:S[l],u=W?q[l]:q[f],y=f;g?y=u:h!==void 0&&u!==null&&typeof u=="object"?y=u[h]:d!==void 0&&(M===void 0?(M=Object.create(t),ue(M,o,u),i&&ue(M,i,f),ue(M,"$index",l)):(M[o]=u,i&&(M[i]=f),M.$index=l),y=D(d,M)),$.has(y)&&!B&&(B=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),$.add(y);let E=p.get(y)?.shift();if(E&&Object.is(E.item,u)){let T=E.scope;T.$index!==l&&(b&&O.push(E),T.$index=l),i&&T[i]!==f&&(T[i]=f),z.push(E),H.push(E.pos);continue}E&&(E.fx.dispose(),Pe(E.range));let m=Object.create(t);ue(m,o,u),i&&ue(m,i,f),ue(m,"$index",l);let R=oe(t),N=Xe(Qe(k,m,R,s));z.push({key:y,item:u,scope:m,fx:R,range:N,pos:l}),H.push(-1)}let I=new Set;p.forEach(l=>l.forEach(f=>I.add(f))),I.size&&(I.forEach(l=>l.fx.dispose()),Un(Wn(v,l=>I.has(l))));let G=C,c=is(H);z.forEach((l,f)=>{!c[f]&&G.nextSibling!==l.range.first&&Fn(l.range,G),G=l.range.last}),O.forEach(l=>fe(()=>l.fx.refresh())),v=z}finally{zn(K)}}),j},ce=(e,t,n,s=!1,r)=>{let o=r??document.createDocumentFragment(),i=0;for(;i<e.length;){let a=e[i];if(typeof a=="string"){let d=document.createTextNode(a);a.includes("{{")&&n.effect(()=>{d.textContent=Mn(a,t)}),o.appendChild(d),i++;continue}if(":each"in a.attrs){o.appendChild(cs(a,t,n,s)),i++;continue}if(":if"in a.attrs){let d=[{expr:a.attrs[":if"],node:a}];i++;let g=w=>{let _=i;for(;_<e.length&&typeof e[_]=="string"&&!e[_].trim();)_++;let P=e[_];if(typeof P=="object"&&w in P.attrs)return i=_+1,P};for(let w=g(":elseif");w;w=g(":elseif"))d.push({expr:w.attrs[":elseif"],node:w});let h=g(":else");h&&d.push({node:h}),o.appendChild(os(d,t,n,s));continue}o.appendChild(Qe(a,t,n,s)),i++}return o},ds=(e,t,n=!1)=>ce(e.template,t,oe(t),n),us=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fs=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,et=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,ps=e=>e.split(et).map((t,n)=>n%2===1?t:t.replace(fs,(s,r,o)=>us.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),Zt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,hs=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,gs=e=>e.split(et).map((t,n)=>n%2===1?t:t.replace(Zt,(s,r,o)=>{let i=0,a=o.replace(hs,(d,g,h)=>h===void 0?d:`${g}:props.${i++}="${h}"`);return`<${r}${a}>`})).join(""),ms=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,ys=/<\/slot\.([\w.$-]+)(\s*)>/gi,Es=/^slot\./i,bs=e=>Es.test(e)?`slot.${ze(e.slice(5))}`:e,He=":jq79-component",ws=/^[A-Z]/,Ss=/\/\s*$/,Rs=(e,t)=>{if(!ws.test(e))return t;let n=` ${He}="${e}"`,s=Ss.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},$s=e=>e.split(et).map((t,n)=>n%2===1?t:t.replace(Zt,(s,r,o)=>{let i=o.replace(ms,(a,d,g)=>g===void 0?a:`${d}${ze(g)}`);return`<${bs(r)}${Rs(r,i)}>`}).replace(ys,(s,r,o)=>`</slot.${ze(r)}${o}>`)).join(""),ve="data-jq79",Ts=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)},Kt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ve]=t,Kt(n.children,t))})},xs=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${ve}="${t}"]${i}`}).join(", "),Vt=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=xs(n.selectorText,t):n instanceof CSSGroupingRule&&Vt(n.cssRules,t)})},Ns=(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),Vt(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
|
|
10
|
-
`)},
|
|
11
|
-
//# sourceURL=${e}?jq79-script=${t}`:"",
|
|
12
|
-
;$__state.done = true })()${
|
|
1
|
+
var be=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var dn=Object.getOwnPropertyNames;var un=Object.prototype.hasOwnProperty;var fn=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pn=(e,t)=>{for(var n in t)be(e,n,{get:t[n],enumerable:!0})},hn=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of dn(t))!un.call(e,r)&&r!==n&&be(e,r,{get:()=>t[r],enumerable:!(s=cn(t,r))||s.enumerable});return e};var gn=e=>hn(be({},"__esModule",{value:!0}),e);var P=(e,t,n)=>fn(e,typeof t!="symbol"?t+"":t,n);var Qs={};pn(Qs,{$:()=>pe,$$:()=>we,$create:()=>Se,$reactive:()=>me,$toRaw:()=>z,C79:()=>te,Component79:()=>te,PendingComponent79:()=>Le,enableHotReload:()=>an,hotUpdate:()=>on,parseComponent:()=>Ys,renderComponent:()=>Es});module.exports=gn(Qs);function pe(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function we(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var Se=(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 o of r)n.appendChild(o);else n.setAttribute(s,r);return n},mn=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),lt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},yn=new Set(["http:","https:","mailto:"]);function En(e){try{let t=new URL(e,"https://example.com");return yn.has(t.protocol)}catch{return!1}}var bn={"https:":"443","http:":"80"};function wn(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(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${r.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var dt=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(wn).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||bn[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function Sn(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var ct=512;function ut(e,t,n,s){if(n>ct)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${ct} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=Rn(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function Rn(e,t,n){let s=e.tagName.toLowerCase();if(!mn.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=lt[s]?.has(i),d=lt["*"]?.has(i);!a&&!d||(i==="href"||i==="src")&&(!En(o.value)||n&&!Sn(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),ut(e,r,t+1,n),r}function ft(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return ut(n.content,s,0,t?.allowUrl),s.innerHTML}var $n=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),Re=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 o=t?`${t}.${s}`:s;r&&typeof r=="object"&&Re(r)?yt(r,o,n):n(o,r)})},pt=" keys",ke=e=>e?`${e}.${pt}`:pt,ht=".length",gt=(e,t)=>({children:null,own:null,deep:null,parent:e,segment:t}),Tn=e=>!e.own?.size&&!e.deep?.size&&!e.children?.size,qe=Symbol("jq79.raw"),z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[qe];)t=t[qe];return t},Et=Symbol("jq79.store"),ae=e=>e!==null&&typeof e=="object"&&e[Et]===!0,oe=[],ge=e=>{oe.push(new Set);try{return e()}finally{oe.pop()}},xn=0,Ie=new Set,mt="$__attach",$e=Symbol("jq79.alsoWakenBy"),me=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=gt(null,""),a=(l,c)=>{let f=i;return l.split(".").forEach(u=>{let E=f.children??(f.children=new Map),y=E.get(u);y||(y=gt(f,u),E.set(u,y)),f=y}),(c.deep?f.deep??(f.deep=new Set):f.own??(f.own=new Set)).add(c),f},d=(l,c)=>{(c.deep?l.deep:l.own)?.delete(c);let f=l;for(;f?.parent&&Tn(f);)f.parent.children.delete(f.segment),f=f.parent},g=l=>{let c=i;for(let f of l.split("."))if(c=c.children?.get(f),!c)return;return c},h=l=>{let c=new Set,f=m=>{let T=m.children?[...m.children.values()]:[];for(;T.length;){let R=T.pop();R.own?.forEach(A=>c.add(A)),R.deep?.forEach(A=>c.add(A)),R.children?.forEach(A=>T.push(A))}},u=i,E=l.split("."),y="";for(let m=0;m<E.length-1;m++){if(u=u.children?.get(E[m]),!u)return c;y=y?`${y}.${E[m]}`:E[m],u.deep?.forEach(T=>c.add(T)),p.has(y)&&u.own?.forEach(T=>c.add(T)),m===E.length-2&&E[m+1]==="length"&&(u.own?.forEach(T=>c.add(T)),f(u))}return u=u.children?.get(E[E.length-1]),u&&(u.own?.forEach(m=>c.add(m)),u.deep?.forEach(m=>c.add(m)),f(u)),c},w=(l,c,f)=>{if(c===f)return!1;for(let u=c;u<f;u++){let E=l.charCodeAt(u);if(E<48||E>57)return!1}return!0},C=(l,c)=>{if(l.deep||c.size<2)return c;let f=new Set;c.forEach(y=>{y.endsWith(ht)&&f.add(y.slice(0,-ht.length))});let u=new Set;if(c.forEach(y=>{let m=0,T="";for(let R=y.indexOf(".");R!==-1;R=y.indexOf(".",R+1)){let A=y.slice(0,R);(!(m>0&&w(y,m,R))||f.has(T))&&u.add(A),T=A,m=R+1}}),!u.size)return c;let E=new Set;return c.forEach(y=>{u.has(y)||E.add(y)}),E},L=l=>{let c=null,f=null,u=null,E=Ie,y=$=>u?u.has($):c===$,m=$=>{let K=a($,l);u?u.set($,K):c===null?(c=$,f=K):(u=new Map([[c,f],[$,K]]),c=f=null)},T=$=>{if(u){u.forEach((K,X)=>{$.has(X)||(d(K,l),u.delete(X))});return}c!==null&&!$.has(c)&&(d(f,l),c=f=null)},R=()=>{u?u.forEach($=>d($,l)):f&&d(f,l),u=null,c=f=null},A=$=>{if($.size===E.size){let X=!0;if($.forEach(Ee=>{X&&(X=E.has(Ee))}),X)return}E=$;let K=C(l,$);T(K),K.forEach(X=>{y(X)||m(X)})};return l.reindex.add(A),A(l.deps),()=>{l.reindex.delete(A),R(),E=Ie}},I=l=>{let c=g(l);c&&b(new Set([...c.own??[],...c.deep??[]]))},Z=l=>I(ke(l)),b=l=>{let c=Array.from(l),f=!0;for(let u=1;f&&u<c.length;u++)f=c[u-1].order<c[u].order;f||c.sort((u,E)=>u.order-E.order),c.forEach(u=>{s.has(u)&&u.run()})},j=(l,c,f=!1)=>{t.get(l)?.forEach(u=>u(c,l)),n.forEach(u=>u(l,c)),f?s.forEach(u=>u.run()):b(h(l))},v=(l,c)=>l!==c&&l!==null&&c!==null&&typeof l=="object"&&typeof c=="object"&&!ae(l)&&!ae(c)&&Re(l)&&Re(c)&&Array.isArray(l)===Array.isArray(c),k=l=>Array.isArray(l)?l.length:Object.keys(l).length,F=null,J=-1,B=(l,c)=>{let f=c.length>l.length,u=f?l:c,E=f?c:l,y=0;for(;y<u.length&&Object.is(z(u[y]),z(E[y]));)y++;for(let m=y;m<u.length;m++)if(!Object.is(z(u[m]),z(E[m+1])))return J;return y},Y=(l,c)=>{if(Array.isArray(c)){let E=l.length,y=c.length;if(!E||!y)return F;let m=Math.max(E,y);if(Math.abs(E-y)===1){let R=B(l,c);if(R!==J){let A=[];for(let $=R;$<m;$++)A.push(String($));return{keys:A,exact:!0}}}let T=[];for(let R=0;R<m;R++)if(!Object.is(z(l[R]),z(c[R]))&&(T.push(String(R)),T.length*2>=m))return F;return{keys:T,exact:!1}}let f=new Set([...Object.keys(l),...Object.keys(c)]);if(!f.size)return F;let u=[];return f.forEach(E=>{Object.is(z(l[E]),z(c[E]))||u.push(E)}),u.length*2>=f.size?F:{keys:u,exact:!1}},S=(l,c,f,u)=>{let E=new Set,y=T=>{let R=g(T);R?.own?.forEach(A=>E.add(A)),R?.deep?.forEach(A=>E.add(A))},m=Y(c,f);if(!m)return j(l,u);if(t.get(l)?.forEach(T=>T(u,l)),n.forEach(T=>T(l,u)),y(l),m.keys.forEach(T=>{let R=`${l}.${T}`,A=t.get(R);if(A){let $=z(f[T]),K=_($)?H($,R):$;A.forEach(X=>X(K,R))}m.exact?y(R):h(R).forEach($=>E.add($))}),k(c)!==k(f)&&y(ke(l)),Array.isArray(f)&&c.length!==f.length){let T=`${l}.length`;t.get(T)?.forEach(R=>R(f.length,T)),y(T)}b(E)},_=l=>l!==null&&typeof l=="object"&&Re(l),p=new Map,x=(l,c)=>{let f=p.get(c);f?.store!==l&&(f?.unsubscribe(),p.set(c,{store:l,unsubscribe:l.$onAny((u,E)=>j(`${c}.${u}`,E))}))},O=l=>{p.get(l)?.unsubscribe(),p.delete(l)},H=(l,c)=>{let f=r.get(l);if(f)return f;let u=null,E=new Proxy(l,{has(y,m){return Reflect.has(y,m)||typeof m=="string"&&u?.has(m)===!0},ownKeys(y){return oe[oe.length-1]?.add(ke(c)),Reflect.ownKeys(y)},get(y,m,T){if(m===qe)return y;if(m===Et)return c==="";if(typeof m!="string")return Reflect.get(y,m,T);if(c===""&&m in o)return o[m];let R=c?`${c}.${m}`:m;oe[oe.length-1]?.add(R);let A=Reflect.get(y,m,T);if(ae(A))return x(A,R),A;let $=z(A);return _($)?H($,R):$},set(y,m,T,R){if(R!==E&&!Object.prototype.hasOwnProperty.call(y,m))return Reflect.set(y,m,T,R);let A=c?`${c}.${m}`:m,$=ae(T)?T:z(T),K=!Object.prototype.hasOwnProperty.call(y,m);if(!K&&Object.is(y[m],$)&&($===null||typeof $!="object"))return!0;let X=y[m];y[m]=$,u?.delete(m),ae($)?x($,A):O(A);let Ee=ae($)||!_($)?$:H($,A);return!K&&v(X,$)?S(A,X,$,Ee):j(A,Ee,K),!0},deleteProperty(y,m){if(typeof m!="string")return Reflect.deleteProperty(y,m);let T=Object.prototype.hasOwnProperty.call(y,m),R=Reflect.deleteProperty(y,m);if(R&&T){let A=c?`${c}.${m}`:m;(u??(u=new Set)).add(m),O(A),j(A,void 0),Z(c)}return R}});return r.set(l,E),E},G=H(z(e),"");Object.entries(z(e)).forEach(([l,c])=>{ae(c)&&x(c,l)});let D=(l,c,{immediate:f=!1}={})=>(t.has(l)||t.set(l,new Set),t.get(l).add(c),f&&c($n(G,l),l),()=>t.get(l)?.delete(c)),U=(l,{immediate:c=!1}={})=>(n.add(l),c&&yt(G,"",(f,u)=>l(f,u)),()=>n.delete(l)),V=(l,{deep:c=!1,alsoWakenBy:f}={})=>{let u=!1,E=!1,y={deps:Ie,reindex:new Set,deep:c,order:xn++,run:()=>{if(u){E=!0;return}u=!0;try{let R=0;do{E=!1;let A=new Set;oe.push(A);try{l()}finally{oe.pop(),y.deps=A}}while(E&&++R<100);E&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{u=!1,y.reindex.forEach(R=>R(y.deps))}}};s.add(y);let m=L(y),T=()=>{s.delete(y),m()};return f?.length?W(y,f,T):(y.run(),T)},W=(l,c,f)=>{let u=c.map(E=>E?.[mt]?.(l)).filter(Boolean);return l.run(),()=>{f(),u.forEach(E=>E())}},N=l=>{s.add(l);let c=L(l);return()=>{s.delete(l),c()}},q=()=>{p.forEach(({unsubscribe:l})=>l()),p.clear()};return o.$on=D,o.$onAny=U,o.$effect=V,o.$dispose=q,o[mt]=N,G},Ue=class{constructor(t,n){P(this,"scope",t);P(this,"disposers",null);P(this,"runs",null);P(this,"options");let s=t[$e];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]()}},le=(e,t=!1)=>new Ue(e,t);var bt=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,wt=/\$:\s*/y,xe=/import(?=\s*\()/y,St=/\$:\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},Q=(e,t)=>{let n=e.indexOf(`
|
|
2
|
+
`,t);return n===-1?e.length:n},ee=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},Te=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=Q(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=ee(e,n);continue}break}return n},Nn=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 o=e.lastIndexOf("/*",n-2);if(o===-1)return!0;n=o-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 Nn.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},An=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,_n=(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""},Rt=(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=Q(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=ee(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 o=Te(e,s+1);if(!(o<e.length&&(An.test(e.slice(o,o+2))||[",","="].includes(_n(e,s)))))return s;s=o;continue}}s++}return e.length},Cn=e=>{let t=[],n=0,s=0,r=0,o=a=>{t.push({raw:e.slice(s,a),codeEnd:Math.max(0,r-s)}),s=a+1,r=s},i=0;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=ne(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=Q(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=ee(e,i);continue}if(a==="/"&&se(e,i)){i=re(e,i),r=i;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;else if(a===","&&n<=0){o(i),i++;continue}/\s/.test(a)||(r=i+1),i++}return o(e.length),t},We=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return Ae.test(t)?[t]:[];let n=[];for(let s of Be(t.slice(1,Tt(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=He(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=Fe(s,":");if(o!==-1){n.push(...We(s.slice(o+1)));continue}}n.push(...We(s))}return n},jn=e=>{let t=[],n=Cn(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let d=o.slice(a.length,i),g=o.slice(i),h=He(d),w=(h===-1?d:d.slice(0,h)).trim(),C=d[0]==="{"||d[0]==="[";C?t.push(...We(w)):Ae.test(w)&&t.push(w);let L=_e(d).code;return{text:`${a}${C?`(${L})`:L}${g}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},_e=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let d=ne(e,s);n+=e.slice(s,d),s=d,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let d=a==="/"?Q(e,s):ee(e,s);n+=e.slice(s,d),s=d;continue}if(i==="/"&&se(e,s)){let d=re(e,s);n+=e.slice(s,d),s=d,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(xe.lastIndex=s,xe.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){bt.lastIndex=s;let d=bt.exec(e);if(d){let h=s+d[0].length,w=Rt(e,h),{vars:C,code:L}=jn(e.slice(h,w));t.push(...C),n+=L,s=w,o=!1;continue}wt.lastIndex=s;let g=wt.exec(e);if(g){St.lastIndex=s;let h=St.exec(e);h&&t.push(h[1]);let w=s+g[0].length,C=Rt(e,w);n+=`$__effect(() => { ${_e(e.slice(w,C)).code} });`,s=C;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
|
|
5
|
+
`||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},Ne=/export\s+default(?![\w$])/y,$t=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,On=e=>{let t=[],n=0,s=0;for(let r=0;r<=e.length;r++){let o=e[r];if(o==="{")n++;else if(o==="}")n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}}return t},Pn=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=On(e),o=[],i=s;if(r.length>1){let a=`$__mod${n}`;o.push(`${a} = ${s}`),i=a}for(let a of r)a.startsWith("{")?o.push(`${a.replace(/\s+as\s+/g,": ")} = ${i}`):a.startsWith("*")?o.push(`${a.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${a} = $__default(${i})`);return`const ${o.join(", ")}`},Ae=/^[A-Za-z_$][\w$]*$/,Tt=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=Q(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=ee(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},Fe=(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=Q(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=ee(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},Be=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=ne(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=Q(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=ee(e,r);continue}if(o==="/"&&se(e,r)){r=re(e,r);continue}if(o!==void 0&&"([{".includes(o))n++;else if(o!==void 0&&")]}".includes(o))n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}r++}return t},He=e=>{let t=0;for(;t<e.length;){let n=Fe(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},Ce=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=Tt(t);if(n>=t.length)return null;let s=[];for(let r of Be(t.slice(1,n))){if(r.startsWith("..."))continue;let o=He(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),d=Fe(i,":"),g=(d===-1?i:i.slice(0,d)).trim();if(!Ae.test(g))continue;let h={name:g};a!==void 0&&(h.default=a);let w=d===-1?"":i.slice(d+1).trim();Ae.test(w)&&(h.as=w),s.push(h)}return s},vn=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=Q(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=ee(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]))){Ne.lastIndex=t;let o=Ne.exec(e);if(o)return t+o[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},Ln=/^async(?![\w$])/,Mn=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Dn=e=>{let t=vn(e);if(t===-1)return null;let n=Te(e,t),s=e.slice(n);Ln.test(s)&&(n=Te(e,n+5));let r=Mn.exec(e.slice(n));if(r&&(n=Te(e,n+r[0].length)),e[n]!=="(")return null;let o=0,i=n;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=ne(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=Q(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=ee(e,i);continue}if(a==="/"&&se(e,i)){i=re(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return Be(e.slice(n+1,i))[0]??""},je=e=>{let t=Dn(e);if(t===null)return null;let n=Ce(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},xt=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],d=e[n+1],g=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let h=ne(e,n);t+=e.slice(n,h),n=h,r=!1;continue}if(a==="/"&&(d==="/"||d==="*")){let h=d==="/"?Q(e,n):ee(e,n);t+=e.slice(n,h),n=h;continue}if(a==="/"&&se(e,n)){let h=re(e,n);t+=e.slice(n,h),n=h,r=!1;continue}if(a==="i"&&g){if(xe.lastIndex=n,xe.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){$t.lastIndex=n;let h=$t.exec(e);if(h){t+=Pn(h[1],h[3],i++),n+=h[0].length,r=!1;continue}}}if(a==="e"&&g&&s===0&&r){Ne.lastIndex=n;let h=Ne.exec(e);if(h){o=!0,t+="$__exports.default =",n+=h[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 o?t:null};var kn="0.6.2",Bt=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Ht=e=>{let t=Bt(e),n=t[Xe];return delete t[Xe],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[Ht(s)]:[]})}},Nt=new Map,zt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=Nt.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
|
|
8
|
+
); }`)}catch{s=null}Nt.set(n,s)}return s},In=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,qn=100,de=new Map,et=new Set,Oe=0,Ze=!1,Ke=new Set,Un=()=>{Ze=!1,!(Oe>0)&&(de.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(et.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 = () => {}".`))}),de.clear())},Gt=()=>{Ze||Oe>0||!de.size||(Ze=!0,queueMicrotask(Un))},Zt=e=>{Oe++;let t=()=>{Oe--,Gt()};e.then(t,t)},Wn=(e,t)=>{if(Ke.has(e))return;Ke.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.`)},Kt=(e,t,n)=>{if(!(n instanceof ReferenceError))return Wn(e,n);let s=In.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;et.has(o)||de.has(o)||de.size>=qn||(de.set(o,{name:r,expr:e,scope:t}),Gt())},Vt=(e,t,n)=>{let s=zt(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},M=(e,t,n)=>{try{return Vt(e,t,n)}catch(s){Kt(e,t,s);return}},Xt=(e,t,n)=>{try{return Vt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;Kt(e,t,s);return}},ze=/{{\s*([\s\S]+?)\s*}}/g,At=new Map,Fn=e=>{let t=At.get(e);if(t)return t;let n=[],s=0;ze.lastIndex=0;for(let r=ze.exec(e);r;r=ze.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)),At.set(e,n),n},Bn=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(M(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(M(s.expr,t)??"");return n},Hn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),tt=e=>Hn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),zn=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Gn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let d=Xt(n,s,{$event:a});typeof d=="function"&&d.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},Zn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=d=>{i.has("prevent")&&d.preventDefault(),i.has("stop")&&d.stopPropagation(),i.has("once")&&e.off(r,a),ge(()=>{let g=Xt(n,s,{$event:d});typeof g=="function"&&g(d)})};e.on(r,a)},ie=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Ve=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),nt=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},Me=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Kn=e=>{e.forEach(t=>{if(t.first===t.last)return Me(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Vn=(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},Xn=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let o=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=o}},_t=(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},ce=null,Pe=null,Jn=e=>{let t={memo:ce,base:Pe};return ce=new Map,Pe=e,t},Yn=e=>{ce=e.memo,Pe=e.base},Ct=(e,t)=>{if(!ce)return _t(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===Pe){if(ce.has(t))return ce.get(t);let r=_t(s,t);return ce.set(t,r),r}for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}return null},Qn=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()},es=(e,t)=>{let n=Qn(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)"}.`)},jt=200,Ge=0,Jt=Symbol("jq79.slots"),ts=e=>e==="slot"||e.startsWith("slot."),Yt=e=>e?ie(e):"default",st=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),ns=e=>e==="default"?":slot":`:slot.${e}`,ss=e=>typeof e!="string"||e.trim()!=="",rs=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?st(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=Yt(o.slice(6));if(i in t){console.warn(`jq79: two <template ${ns(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(ss);return s&&"default"in t?console.warn(`jq79: <${e.tag}> 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},os=(e,t,n)=>{Ce(t)?.forEach(({name:s,as:r,default:o})=>{let i=r??s;Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&o!==void 0?M(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},is=e=>{let t=st(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}`)},as=(e,t)=>{let n=Object.entries(rs(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=ls(o,t)}),s},ls=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);os(i,e.binder,n);let a=i[$e]??[];Object.defineProperty(i,$e,{value:[...a,s]});let d=le(i);return r.onDispose(()=>d.dispose()),fe(e.nodes,i,d,o)},cs=(e,t,n,s)=>{let r=Yt(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let d=t[Jt]?.[r];if(!d)return o.insertBefore(fe(e.children,t,n,s),a),o;let g={};return Object.entries(e.attrs).forEach(([h,w])=>{if(!(h===De||tt(h)||h.startsWith("@")))if(h.startsWith(":")){let C=w||h.slice(1);g[ie(h.slice(1))]=()=>M(C,t)}else g[ie(h)]=()=>w}),o.insertBefore(d(g,t,n,s),a),o},Ot=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let d=as(t,n),g={},h={},w=[],C=[],L=!1;Object.entries(t.attrs).forEach(([S,_])=>{if(S!==De){if(S===":props"||S.startsWith(":props.")){L=!0,C.push({expr:_});return}if(!tt(S))if(S.startsWith("@"))w.push([S,_]);else if(S===":model"||S.startsWith(":model.")){let p=S===":model"?"default":ie(S.slice(7));h[p]=_||(S===":model"?"model":p)}else if(S.startsWith(":")){let p=ie(S.slice(1));g[p]=_||p,C.push({name:p,expr:_||p})}else{let p=ie(S),x=JSON.stringify(_);g[p]=x,C.push({name:p,expr:x})}}});let I=S=>S==="default"?":model":`:model.${S}`,Z=S=>S==="default"?"model":S,b=S=>`${S}
|
|
9
|
+
= $value`,j=new Set;Object.entries(h).forEach(([S,_])=>{let p=Z(S);g[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${I(S)} - ${I(S)} wins`),g[p]=_,zt(b(_),["$value"])===null&&(j.add(S),console.warn(`jq79: ${I(S)}="${_}" is not assignable - updates from <${t.tag}> will be dropped`))});let v=()=>{let S={};return C.forEach(({name:_,expr:p})=>{if(_!==void 0)S[_]=M(p,n);else{let x=M(p,n);x!==null&&typeof x=="object"&&Object.assign(S,x)}}),Object.entries(h).forEach(([_,p])=>{S[Z(_)]=M(p,n)}),S},k=null,F=null,J=null,B=new Set,Y=S=>{if(S==null){if(!n[rn]?.has(e)||B.has("unfilled"))return;B.add("unfilled"),console.error(`jq79: <${t.tag}> 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}B.has("type")||(B.add("type"),console.error(`jq79: <${t.tag}> is ${typeof S}, not a component - nothing renders here`))};return s.effect(()=>{let S=M(e,n),_=S instanceof te?S:null;if(_||Y(S),_===F||(J?.dispose(),J=null,k?.destroy(),k=null,F=_,!_))return;let p=new te({template:_.template,scripts:_.scripts,styles:_.styles,modules:_.modules,filename:_.filename,siblings:_.siblings,name:_.name});if(d&&(p.slots=d),Object.keys(h).length){let D=new Set;p.modelWriteback=(U,V)=>{let W=U==null?"default":ie(String(U)),N=h[W];return N===void 0?(D.has(W)||(D.add(W),console.warn(`jq79: <${t.tag}> has no ${I(W)} - bound: ${Object.keys(h).map(I).join(", ")}`)),!1):j.has(W)?!1:(ge(()=>M(b(N),n,{$value:V})),!0)}}w.forEach(([D,U])=>Zn(p,D,U,n));let x=Bs(p.scripts);Hs(t,e,Object.keys(g),x);let O=qt(ge(v),x),H=document.createDocumentFragment();if(Ge>=jt){console.error(`jq79: <${t.tag}> is ${jt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ge++;try{(r?p.renderShadow(O):p.render(O)).mount(H)}finally{Ge--}i.parentNode.insertBefore(H,i);let G=le(n,!0);if(L){let D=[];G.effect(()=>{let U=qt(v(),x),V=Object.keys(U);D.forEach(W=>{W in U||(p.data[W]=void 0)}),V.forEach(W=>{p.data[W]=U[W]}),D=V})}else Object.entries(g).forEach(([D,U])=>{x!==null&&!x.has(D)||G.effect(()=>{p.data[D]=M(U,n)})});J=G,k=p}),s.onDispose(()=>{J?.dispose(),k?.destroy()}),a},ds=(e,t)=>{let n=()=>{let s=M(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},ye=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(ye):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?ye(t):[]):[],us=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?dt(e):()=>!1,fs=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"]),Pt=(e,t,n)=>{let s=fs.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},rt=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?ds(r,t):t;if(ts(e.tag))return cs(e,o,n,s);if(e.tag==="template"&&st(e)!==void 0)return is(e);let i=Ct(o,e.tag);if(i)return Ot(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[Ye]?.count===0)throw es(e.component,o);let d=a instanceof HTMLUnknownElement||e.tag.includes("-");if(d){let b=!1;n.effect(()=>{if(b)return;let j=Ct(o,e.tag);if(!j)return;b=!0;let v=Ot(j,e,o,n,s),k=nt(v);n.onDispose(()=>Me(k)),a.replaceWith(v)})}for(let b in e.attrs){let j=e.attrs[b];if(b.startsWith("@"))Gn(a,b,j,o);else if(b===":model"||b.startsWith(":model."))d||console.warn(`jq79: ${b} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!tt(b))if(b.startsWith(":"))if(d)a.setAttribute(b,j);else{let v=b.slice(1),k=j||ie(v);n.effect(()=>Pt(a,v,M(k,o)))}else a.setAttribute(b,j)}let g=e.attrs[":attrs"];if(g!==void 0){let b=[];n.effect(()=>{b.forEach(v=>a.removeAttribute(v));let j=M(g,o);b=j&&typeof j=="object"?Object.keys(j):[],b.forEach(v=>Pt(a,v,j[v]))})}let h=e.attrs[":class"],w=null;for(let b in e.attrs)b.startsWith(":class.")&&(w??(w=[])).push([b.slice(7),e.attrs[b]]);if(h!==void 0||w){let b=new Set(ye(e.attrs.class??"")),j=[];n.effect(()=>{let v=h!==void 0?ye(M(h,o)):[];w?.forEach(([k,F])=>{M(F,o)&&v.push(...ye(k))}),j.forEach(k=>{!v.includes(k)&&!b.has(k)&&a.classList.remove(k)}),a.classList.add(...v),j=v})}let C=e.attrs[":text"],L=e.attrs[":html"],I=e.attrs[":html.allowed"];I!==void 0&&L===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),C!==void 0?n.effect(()=>{a.textContent=String(M(C,o)??"")}):L!==void 0?n.effect(()=>{let b=I!==void 0?{allowUrl:us(M(I,o))}:void 0;a.innerHTML=ft(String(M(L,o)??""),b)}):a instanceof HTMLTemplateElement?fe(e.children,o,n,s,a.content):fe(e.children,o,n,s,a);let Z=e.attrs[":value"];return Z!==void 0&&n.effect(()=>{let b=String(M(Z,o)??"");a.value!==b&&(a.value=b)}),[":checked",":selected"].forEach(b=>{let j=e.attrs[b];if(j===void 0)return;let v=b.slice(1);n.effect(()=>{a[v]=!!M(j,o)})}),a},ps=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,d=null;return n.effect(()=>{let g=e.find(w=>w.expr===void 0||M(w.expr,t))??null;if(g===a||(d?.dispose(),i&&Me(i),i=null,a=g,!g))return;d=le(t);let h=rt(g.node,t,d,s);i=nt(h),r.parentNode.insertBefore(h,r.nextSibling)}),o},he=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},hs=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let o=e[r];if(o<0)continue;let i=0,a=n.length;for(;i<a;){let d=i+a>>1;e[n[d]]<o?i=d+1:a=d}i>0&&(s[r]=n[i-1]),n[i]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},gs=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Qt=(e,t)=>typeof e=="string"?t.some(n=>Lt(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Lt(n,s)))||e.children.some(n=>Qt(n,t)),vt=/[A-Za-z0-9_$]/,ms=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Lt=(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(!vt.test(s)&&!vt.test(r))return!0}return!1},ys=(e,t,n,s)=>{let r=e.attrs[":each"].match(zn);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,d=e.attrs[":key"],g=d===o,h=d!==void 0&&!g&&ms.test(d)&&d.startsWith(`${o}.`)?d.slice(o.length+1):void 0,{[":each"]:w,[":key"]:C,...L}=e.attrs,I={...e,attrs:L},Z=["$index",...i?[i]:[]],b=Qt(I,Z),j=document.createComment("each"),v=document.createDocumentFragment();v.appendChild(j),(":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 k=[],F=!1;return n.effect(()=>{let J=Jn(t);try{let B=M(a,t),Y=Array.isArray(B),S=Y?null:gs(B)?Object.keys(B):[],_=Y?B.length:S.length,p=new Map;k.forEach((N,q)=>{N.pos=q;let l=p.get(N.key);l?l.push(N):p.set(N.key,[N])});let x=new Set,O=[],H=[],G=[],D;for(let N=0;N<_;N++){let q=Y?N:S[N],l=Y?B[N]:B[q],c=q;g?c=l:h!==void 0&&l!==null&&typeof l=="object"?c=l[h]:d!==void 0&&(D===void 0?(D=Object.create(t),he(D,o,l),i&&he(D,i,q),he(D,"$index",N)):(D[o]=l,i&&(D[i]=q),D.$index=N),c=M(d,D)),x.has(c)&&!F&&(F=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),x.add(c);let f=p.get(c)?.shift();if(f&&Object.is(f.item,l)){let m=f.scope;m.$index!==N&&(b&&O.push(f),m.$index=N),i&&m[i]!==q&&(m[i]=q),H.push(f),G.push(f.pos);continue}f&&(f.fx.dispose(),Me(f.range));let u=Object.create(t);he(u,o,l),i&&he(u,i,q),he(u,"$index",N);let E=le(t),y=nt(rt(I,u,E,s));H.push({key:c,item:l,scope:u,fx:E,range:y,pos:N}),G.push(-1)}let U=new Set;p.forEach(N=>N.forEach(q=>U.add(q))),U.size&&(U.forEach(N=>{N.dead=!0,N.fx.dispose()}),Kn(Vn(k,N=>N.dead===!0)));let V=j,W=hs(G);H.forEach((N,q)=>{!W[q]&&V.nextSibling!==N.range.first&&Xn(N.range,V),V=N.range.last}),O.forEach(N=>ge(()=>N.fx.refresh())),k=H}finally{Yn(J)}}),v},fe=(e,t,n,s=!1,r)=>{let o=r??document.createDocumentFragment(),i=0;for(;i<e.length;){let a=e[i];if(typeof a=="string"){let d=document.createTextNode(a);if(a.includes("{{")){let g=Fn(a);n.effect(()=>{let h=Bn(g,t);d.textContent!==h&&(d.textContent=h)})}o.appendChild(d),i++;continue}if(":each"in a.attrs){o.appendChild(ys(a,t,n,s)),i++;continue}if(":if"in a.attrs){let d=[{expr:a.attrs[":if"],node:a}];i++;let g=w=>{let C=i;for(;C<e.length&&typeof e[C]=="string"&&!e[C].trim();)C++;let L=e[C];if(typeof L=="object"&&w in L.attrs)return i=C+1,L};for(let w=g(":elseif");w;w=g(":elseif"))d.push({expr:w.attrs[":elseif"],node:w});let h=g(":else");h&&d.push({node:h}),o.appendChild(ps(d,t,n,s));continue}o.appendChild(rt(a,t,n,s)),i++}return o},Es=(e,t,n=!1)=>fe(e.template,t,le(t),n),bs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ws=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,ot=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Ss=e=>e.split(ot).map((t,n)=>n%2===1?t:t.replace(ws,(s,r,o)=>bs.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),en=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Rs=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,$s=e=>e.split(ot).map((t,n)=>n%2===1?t:t.replace(en,(s,r,o)=>{let i=0,a=o.replace(Rs,(d,g,h)=>h===void 0?d:`${g}:props.${i++}="${h}"`);return`<${r}${a}>`})).join(""),Ts=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,xs=/<\/slot\.([\w.$-]+)(\s*)>/gi,Ns=/^slot\./i,As=e=>Ns.test(e)?`slot.${Ve(e.slice(5))}`:e,Xe=":jq79-component",_s=/^[A-Z]/,Cs=/\/\s*$/,js=(e,t)=>{if(!_s.test(e))return t;let n=` ${Xe}="${e}"`,s=Cs.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Os=e=>e.split(ot).map((t,n)=>n%2===1?t:t.replace(en,(s,r,o)=>{let i=o.replace(Ts,(a,d,g)=>g===void 0?a:`${d}${Ve(g)}`);return`<${As(r)}${js(r,i)}>`}).replace(xs,(s,r,o)=>`</slot.${Ve(r)}${o}>`)).join(""),De="data-jq79",Ps=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)},tn=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[De]=t,tn(n.children,t))})},vs=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${De}="${t}"]${i}`}).join(", "),nn=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=vs(n.selectorText,t):n instanceof CSSGroupingRule&&nn(n.cssRules,t)})},Ls=(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),nn(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
|
|
10
|
+
`)},Ms=/^[A-Z][A-Za-z0-9]*$/,Je=e=>{let t=Ss($s(Os(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(d=>{d.tagName==="TEMPLATE"?o.push(d):r.push(d)});let i=Mt(r,e),a={};return o.forEach(d=>{let g=d.getAttribute("name");if(g===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!Ms.test(g)){console.warn(`jq79: <template name="${g}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(g in a){console.warn(`jq79: two <template name="${g}"> in one file; the second was ignored`);return}a[g]=new te({...Mt(Array.from(d.content.children),d.innerHTML),siblings:a,name:g})}),Object.keys(a).length&&(i.siblings=a),i},Mt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:Bt(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(Ht(i))}),s.forEach(i=>{"lang"in i.attrs&&console.warn(`jq79: <style lang="${i.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.`)});let o=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(s.some(o)){let i=Ps(t);tn(r,i),s.forEach(a=>{o(a)&&(a.scoped=Ls(a.content,i))})}return{template:r,scripts:n,styles:s}},it=e=>/\.html?([?#]|$)/.test(e)?Qe(e):import(e),Ds=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,ks=(e,t)=>{if(!Ds.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},sn=(e,t)=>e?`
|
|
11
|
+
//# sourceURL=${e}?jq79-script=${t}`:"",Dt=e=>e.scoped??e.content,ve=new Map,Is=e=>{let t=ve.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},ve.set(e,t)}t.count++},qs=e=>{let t=ve.get(e);t&&--t.count<=0&&(t.el.remove(),ve.delete(e))},Us=(e,t,n,s={},r=it,o={})=>{let i={...ln,...s},a=new Proxy(t,{has:(h,w)=>w!=="$__effect"&&w!=="$__import"&&w!=="$__state"&&(Reflect.has(h,w)||!(w in globalThis)&&!(w in i))}),d={},g=new Function("$scope","$__effect","$__import","$__state",...Object.keys(i),`return (async () => { with ($scope) { ${e} }
|
|
12
|
+
;$__state.done = true })()${sn(o.filename,o.index??0)}`)(a,n,r,d,...Object.values(i));return g.catch(h=>console.error("jq79: error in :setup script",h)),Zt(g),{settled:g,sync:d.done===!0}},kt=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:M(s,e))})},at=e=>{let t=e.attrs[":setup"];if(t===void 0)return null;if(t.trim()==="")return[];let n=Ce(t);return n||Ws(e,t),n},It=new WeakSet,Ws=(e,t)=>{t.trim()==="_"||It.has(e)||(It.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`))},Fs=e=>{let t=new Set;return e.forEach(n=>{(je(n.content)??at(n))?.forEach(({name:r})=>t.add(r))}),t},Bs=e=>{let t=null;return e.forEach(n=>{let s=je(n.content)??at(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),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},Ut=new WeakMap,Hs=(e,t,n,s)=>{if(s===null)return;let r=Ut.get(e)??new Set;Ut.set(e,r),n.forEach(o=>{s.has(o)||r.has(o)||(r.add(o),console.warn(`jq79: :${o} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},zs=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,o])=>{t.has(r)||(n[r]=o,s=!0)}),s?n:null},rn=Symbol("jq79.unfilledProps"),Ye=Symbol("jq79.pendingScripts"),Gs=e=>e&&e.default!==void 0?e.default:e,Zs=(e,t,n,s={},r=it,o={})=>{let i={...ln,...s},a={},d=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
|
|
13
13
|
${e}
|
|
14
|
-
;$__exports.done = true })()${
|
|
14
|
+
;$__exports.done = true })()${sn(o.filename,o.index??0)}`)(a,Gs,r,...Object.values(i)),g=I=>console.error("jq79: error in factory script",I),h=!1,w,C=()=>{if(h)return w;h=!0;let I=a.default;if(typeof I!="function")return;let Z=b=>{b&&typeof b=="object"&&Object.assign(t,b)};try{let b=I(t,{$data:t,$props:t,$effect:n,...s});b instanceof Promise?w=b.then(Z).catch(g):Z(b)}catch(b){g(b)}return w},L=d.then(C,g);return Zt(L),a.done&&C(),{settled:L,sync:a.done===!0&&w===void 0}},Ks="__JQ79_HMR_ENABLED__",Vs="__JQ79_HMR__",ue=null,Xs=e=>{if(!ue||!e.filename)return;let t=ue.get(e.filename);t||ue.set(e.filename,t=new Set),t.add(new WeakRef(e))},Wt=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},on=(e,t)=>{if(!ue)return 0;let n=Wt(e),s=Je(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,d]of ue)if(Wt(a)===n){for(let g of d){let h=g.deref();if(!h){d.delete(g);continue}let w=o(h);if(!w){r=!0;continue}h.hotReplace(w)&&i++}d.size||ue.delete(a)}return r?0:i},an=()=>{ue??(ue=new Map),globalThis[Vs]={update:on}},Ft=3e3,Js=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${Ft/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.`)},Ft);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},Qe=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return new te(await t.text(),{filename:e})},te=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,"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"?Je(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(),Xs(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"?Je(t):t;et.clear(),de.clear(),Ke.clear();let s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,a=o?this.endMarker.nextSibling:null,d={...this.data},g=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(d,g),!i)?!1:(g&&this.styleEls.forEach(h=>i.insertBefore(h,a)),i.insertBefore(this.content,a),this.mountRoot=i,this.settleMounted(),!0)}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new Le(Qe(t))}static fetchAll(t){return Promise.all(t.map(Qe))}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=Fs(this.scripts),r=zs(this.siblings,s),o=r?Object.assign(Object.create(r),t):{...t},i=new Set([...s].filter(p=>!(p in t)));i.size&&Object.defineProperty(o,rn,{value:i}),this.slots&&Object.defineProperty(o,Jt,{value:this.slots}),Object.defineProperty(o,Ye,{value:{count:0}});let a=me(o),d=le(a);this.data=a,this.fx=d,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let g=this.startMarker,h=!1,w=(p,x)=>{p==="model:update"&&!h&&(h=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let O=new CustomEvent(p,{detail:x,bubbles:!0,composed:!0,cancelable:!0});return g===this.startMarker&&this.emitListeners.get(p)?.forEach(H=>H(O,x)),O.cancelBubble||g.dispatchEvent(O),!O.defaultPrevented},C,L=new Promise(p=>{C=p});this.resolveMounted=C,this.renderDone=!1;let I=this.endMarker,Z=p=>{let x=[];for(let O=g.nextSibling;O&&O!==I;O=O.nextSibling)O instanceof Element&&(O.matches(p)&&x.push(O),x.push(...Array.from(O.querySelectorAll(p))));return x},b=p=>Z(p)[0]??null,j=this.modules,v=p=>j&&p in j?Promise.resolve(j[p]):it(ks(p,this.filename)),F=Object.assign(Object.create(null),{$emit:w,$updateModel:(...p)=>{let[x,O]=p.length>1?p:[void 0,p[0]];return g!==this.startMarker?!1:this.modelWriteback?.(x,O)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(p=>[p,!0]))}),J=p=>`await $mounted();${p}`,B=[],Y=!0;this.scripts.forEach((p,x)=>{let O;B.push(new Promise(l=>{O=l}));let H=!1,G=()=>{H=!0,O()},U={$mounted:()=>(G(),L),$self:b,$$self:Z,...F,...r},V={filename:this.filename,index:x},W=":mounted"in p.attrs,N=xt(p.content),q=(()=>{if(N!==null){W&&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."),kt(a,je(p.content));let u=W?J(N):N;return Zs(u,a,E=>d.effect(E),U,v,V)}let{vars:l,code:c}=_e(p.content);kt(a,at(p)),l.forEach(u=>{u in a||(a[u]=void 0)});let f=W?J(c):c;return Us(f,a,u=>d.effect(u),U,v,V)})();if(q.sync)q.settled.then(G,G);else{let l=o[Ye];l.count++;let c=()=>{l.count--,G()};q.settled.then(c,c)}!q.sync&&!H&&(Y=!1)});let S=document.createDocumentFragment(),_=new Proxy(a,{has:(p,x)=>typeof x=="string"&&x in F||Reflect.has(p,x),get:(p,x,O)=>typeof x=="string"&&x in F&&!Reflect.has(p,x)?F[x]:Reflect.get(p,x,O)});return S.append(this.startMarker,this.endMarker),this.content=S,Y?(this.endMarker.parentNode.insertBefore(fe(this.template,_,d,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(B).then(()=>{g===this.startMarker&&(this.endMarker.parentNode.insertBefore(fe(this.template,_,d,n),this.endMarker),this.renderDone=!0,this.settleMounted())}),Js(this,B)),n?this.styleEls=this.styles.map(p=>{let x=document.createElement("style");return x.textContent=p.content,x}):(this.styles.forEach(p=>Is(Dt(p))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?pe(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"?pe(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.styleEls.forEach(s=>n.appendChild(s)),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),this}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.ownsSharedStyles&&(this.styles.forEach(t=>qs(Dt(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};P(te,"version",kn);var Le=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 Ys=e=>new te(e),ln={$:pe,$$:we,$create:Se,$reactive:me,$toRaw:z,Component79:te};typeof globalThis<"u"&&globalThis[Ks]&&an();0&&(module.exports={$,$$,$create,$reactive,$toRaw,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
|
|
15
15
|
//# sourceMappingURL=jq79.cjs.map
|