jq79 0.4.16 → 0.4.18

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.js CHANGED
@@ -1,14 +1,14 @@
1
- var ce=Object.defineProperty;var ue=(t,n,e)=>n in t?ce(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var _=(t,n,e)=>ue(t,typeof n!="symbol"?n+"":n,e);function Z(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function ut(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var ft=(t,n={})=>{let e=document.createElement(t);for(let[s,o]of Object.entries(n))if(s==="className")e.className=Array.isArray(o)?o.join(" "):o;else if(s==="textContent")e.textContent=o;else if(s==="children")for(let i of o)e.appendChild(i);else e.setAttribute(s,o);return e},fe=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),jt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},de=new Set(["http:","https:","mailto:"]);function pe(t){try{let n=new URL(t,"https://example.com");return de.has(n.protocol)}catch{return!1}}var he={"https:":"443","http:":"80"};function me(t){let n=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!n)return null;let[,e,s]=n,o=e.split(".");return o.some(r=>r!=="*"&&!/^[a-z\d-]+$/.test(r))?null:{host:new RegExp(`^${o.map(r=>r==="*"?"[^.]+":r).join("\\.")}$`),port:!s||s==="*"?null:s}}var Ot=t=>{let n=(Array.isArray(t)?t:t.split(",")).map(me).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),o=e.port||he[e.protocol]||"";return n.some(i=>i.host.test(s)&&(i.port===null||i.port===o))}};function ge(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var Nt=512;function _t(t,n,e,s){if(e>Nt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Nt} elements`);for(let o of Array.from(t.childNodes))if(o.nodeType===Node.ELEMENT_NODE){let i=ye(o,e,s);i&&n.appendChild(i)}else o.nodeType===Node.TEXT_NODE&&n.appendChild(o.cloneNode())}function ye(t,n,e){let s=t.tagName.toLowerCase();if(!fe.has(s))return null;let o=document.createElement(s);for(let i of Array.from(t.attributes)){let r=i.name.toLowerCase(),a=jt[s]?.has(r),u=jt["*"]?.has(r);!a&&!u||(r==="href"||r==="src")&&(!pe(i.value)||e&&!ge(e,i.value,s,r))||o.setAttribute(r,i.value)}return s==="a"&&o.setAttribute("rel","noopener noreferrer"),_t(t,o,n+1,e),o}function Lt(t,n){let e=document.createElement("template");e.innerHTML=t;let s=document.createElement("div");return _t(e.content,s,0,n?.allowUrl),s.innerHTML}var be=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),Pt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Mt=(t,n,e)=>{Object.entries(t).forEach(([s,o])=>{let i=n?`${n}.${s}`:s;o&&typeof o=="object"&&Pt(o)?Mt(o,i,e):e(i,o)})},Ee=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),dt=Symbol("jq79.raw"),Y=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[dt];)n=n[dt];return n},Dt=Symbol("jq79.store"),G=t=>t!==null&&typeof t=="object"&&t[Dt]===!0,B=[],K=t=>{B.push(new Set);try{return t()}finally{B.pop()}},vt="$__attach",Q=Symbol("jq79.alsoWakenBy"),tt=t=>{let n=new Map,e=new Set,s=new Set,o=new WeakMap,i=Object.create(null),r=(h,g,$=!1)=>{n.get(h)?.forEach(w=>w(g,h)),e.forEach(w=>w(h,g)),s.forEach(w=>{($||Array.from(w.deps).some(c=>Ee(c,h)))&&w.run()})},a=h=>h!==null&&typeof h=="object"&&Pt(h),u=new Map,p=(h,g)=>{let $=u.get(g);$?.store!==h&&($?.unsubscribe(),u.set(g,{store:h,unsubscribe:h.$onAny((w,c)=>r(`${g}.${w}`,c))}))},d=h=>{u.get(h)?.unsubscribe(),u.delete(h)},m=(h,g)=>{let $=o.get(h);if($)return $;let w=null,c=new Proxy(h,{has(f,l){return Reflect.has(f,l)||typeof l=="string"&&w?.has(l)===!0},get(f,l,T){if(l===dt)return f;if(l===Dt)return g==="";if(typeof l!="string")return Reflect.get(f,l,T);if(g===""&&l in i)return i[l];let j=g?`${g}.${l}`:l;B[B.length-1]?.add(j);let N=Reflect.get(f,l,T);if(G(N))return p(N,j),N;let b=Y(N);return a(b)?m(b,j):b},set(f,l,T,j){if(j!==c&&!Object.prototype.hasOwnProperty.call(f,l))return Reflect.set(f,l,T,j);let N=g?`${g}.${l}`:l,b=G(T)?T:Y(T),L=!Object.prototype.hasOwnProperty.call(f,l);if(!L&&Object.is(f[l],b)&&(b===null||typeof b!="object"))return!0;f[l]=b,w?.delete(l),G(b)?p(b,N):d(N);let v=G(b)||!a(b)?b:m(b,N);return r(N,v,L),!0},deleteProperty(f,l){if(typeof l!="string")return Reflect.deleteProperty(f,l);let T=Object.prototype.hasOwnProperty.call(f,l),j=Reflect.deleteProperty(f,l);if(j&&T){let N=g?`${g}.${l}`:l;(w??(w=new Set)).add(l),d(N),r(N,void 0)}return j}});return o.set(h,c),c},E=m(Y(t),"");Object.entries(Y(t)).forEach(([h,g])=>{G(g)&&p(g,h)});let O=(h,g,{immediate:$=!1}={})=>(n.has(h)||n.set(h,new Set),n.get(h).add(g),$&&g(be(E,h),h),()=>n.get(h)?.delete(g)),x=(h,{immediate:g=!1}={})=>(e.add(h),g&&Mt(E,"",($,w)=>h($,w)),()=>e.delete(h)),y=(h,g)=>{let $=!1,w=!1,c={deps:new Set,run:()=>{if($){w=!0;return}$=!0;try{let f=0;do{w=!1;let l=new Set;B.push(l);try{h()}finally{B.pop(),c.deps=l}}while(w&&++f<100);w&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{$=!1}}};return s.add(c),g?.length?S(c,g):(c.run(),()=>{s.delete(c)})},S=(h,g)=>{let $=g.map(w=>w?.[vt]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),$.forEach(w=>w())}},R=h=>(s.add(h),()=>{s.delete(h)}),A=()=>{u.forEach(({unsubscribe:h})=>h()),u.clear()};return i.$on=O,i.$onAny=x,i.$effect=y,i.$dispose=A,i[vt]=R,E},k=t=>{let n=[],e=[],s=t[Q];return{effect:o=>{n.push(t.$effect(o,s)),e.push(o)},onDispose:o=>{n.push(o)},refresh:()=>{e.forEach(o=>o())},dispose:()=>{n.splice(0).forEach(o=>o()),e.length=0}}};var qt=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Wt=/\$:\s*/y,nt=/import(?=\s*\()/y,Ut=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,q=(t,n)=>{let e=t[n],s=n+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===e)return s+1;s++}return t.length},M=(t,n)=>{let e=t.indexOf(`
2
- `,n);return e===-1?t.length:e},D=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},et=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=D(t,e);continue}break}return e},we=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),W=(t,n)=>{let e=n-1;for(;e>=0;){let o=t[e];if(/\s/.test(o)){e--;continue}if(o==="/"&&t[e-1]==="*"){let i=t.lastIndexOf("/*",e-2);if(i===-1)return!0;e=i-1;continue}break}if(e<0)return!0;let s=t[e];if(/[\w$]/.test(s)){let o=e;for(;o>0&&/[\w$]/.test(t[o-1]);)o--;return we.has(t.slice(o,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},U=(t,n)=>{let e=n+1,s=!1;for(;e<t.length;){let o=t[e];if(o==="\\"){e+=2;continue}if(o===`
3
- `)return e;if(o==="[")s=!0;else if(o==="]")s=!1;else if(o==="/"&&!s){for(e++;e<t.length&&/[a-z]/i.test(t[e]);)e++;return e}e++}return t.length},Se=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Re=(t,n)=>{let e=n-1;for(;e>=0;){let s=t[e];if(/\s/.test(s)){e--;continue}if(s==="/"&&t[e-1]==="*"){let o=t.lastIndexOf("/*",e-2);if(o===-1)return"";e=o-1;continue}return s}return""},Ft=(t,n)=>{let e=0,s=n;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=q(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(o==="/"&&W(t,s)){s=U(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else{if(e<=0&&o===";")return s;if(e<=0&&o===`
4
- `){let i=et(t,s+1);if(!(i<t.length&&(Se.test(t.slice(i,i+2))||[",","="].includes(Re(t,s)))))return s;s=i;continue}}s++}return t.length},$e=t=>{let n=[],e=0,s=0,o=0,i=a=>{n.push({raw:t.slice(s,a),codeEnd:Math.max(0,o-s)}),s=a+1,o=s},r=0;for(;r<t.length;){let a=t[r];if(a==="'"||a==='"'||a==="`"){r=q(t,r),o=r;continue}if(a==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(a==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(a==="/"&&W(t,r)){r=U(t,r),o=r;continue}if("([{".includes(a))e++;else if(")]}".includes(a))e--;else if(a===","&&e<=0){i(r),r++;continue}/\s/.test(a)||(o=r+1),r++}return i(t.length),n},pt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return ot.test(n)?[n]:[];let e=[];for(let s of mt(n.slice(1,It(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let o=gt(s);if(o!==-1&&(s=s.slice(0,o).trim()),n.startsWith("{")){let i=ht(s,":");if(i!==-1){e.push(...pt(s.slice(i+1)));continue}}e.push(...pt(s))}return e},Te=t=>{let n=[],e=$e(t).map(({raw:i,codeEnd:r})=>{let a=i.match(/^\s*/)[0];if(r<=a.length)return{text:i,empty:!0};let u=i.slice(a.length,r),p=i.slice(r),d=gt(u),m=(d===-1?u:u.slice(0,d)).trim(),E=u[0]==="{"||u[0]==="[";E?n.push(...pt(m)):ot.test(m)&&n.push(m);let O=rt(u).code;return{text:`${a}${E?`(${O})`:O}${p}`,empty:!1}}),s=[];for(;e.length&&e[e.length-1].empty;)s.unshift(e.pop().text);let o=e.map(i=>i.text).join(",")+s.join("");return o.trimStart().startsWith("(")&&(o=`;${o}`),{vars:n,code:o}},rt=t=>{let n=[],e="",s=0,o=0,i=!0;for(;s<t.length;){let r=t[s],a=t[s+1];if(r==="'"||r==='"'||r==="`"){let u=q(t,s);e+=t.slice(s,u),s=u,i=!1;continue}if(r==="/"&&(a==="/"||a==="*")){let u=a==="/"?M(t,s):D(t,s);e+=t.slice(s,u),s=u;continue}if(r==="/"&&W(t,s)){let u=U(t,s);e+=t.slice(s,u),s=u,i=!1;continue}if(r==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(nt.lastIndex=s,nt.test(t))){e+="$__import",s+=6,i=!1;continue}if(o===0&&i){qt.lastIndex=s;let u=qt.exec(t);if(u){let d=s+u[0].length,m=Ft(t,d),{vars:E,code:O}=Te(t.slice(d,m));n.push(...E),e+=O,s=m,i=!1;continue}Wt.lastIndex=s;let p=Wt.exec(t);if(p){Ut.lastIndex=s;let d=Ut.exec(t);d&&n.push(d[1]);let m=s+p[0].length,E=Ft(t,m);e+=`$__effect(() => { ${rt(t.slice(m,E)).code} });`,s=E;continue}}"([{".includes(r)?o++:")]}".includes(r)&&(o=Math.max(0,o-1)),r===`
5
- `||r===";"||r==="}"?i=!0:/\s/.test(r)||(i=!1),e+=r,s++}return{vars:n,code:e}},st=/export\s+default(?![\w$])/y,kt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,xe=t=>{let n=[],e=0,s=0;for(let o=0;o<=t.length;o++){let i=t[o];if(i==="{")e++;else if(i==="}")e--;else if(o===t.length||i===","&&e===0){let r=t.slice(s,o).trim();r&&n.push(r),s=o+1}}return n},Ce=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let o=xe(t),i=[],r=s;if(o.length>1){let a=`$__mod${e}`;i.push(`${a} = ${s}`),r=a}for(let a of o)a.startsWith("{")?i.push(`${a.replace(/\s+as\s+/g,": ")} = ${r}`):a.startsWith("*")?i.push(`${a.replace(/^\*\s*as\s+/,"")} = ${r}`):i.push(`${a} = $__default(${r})`);return`const ${i.join(", ")}`},ot=/^[A-Za-z_$][\w$]*$/,It=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=q(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=D(t,e);continue}if(s==="/"&&W(t,e)){e=U(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},ht=(t,n)=>{let e=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=q(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(o==="/"&&o!==n&&W(t,s)){s=U(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else if(e===0&&o===n)return s;s++}return-1},mt=t=>{let n=[],e=0,s=0,o=0;for(;o<=t.length;){let i=t[o];if(i==="'"||i==='"'||i==="`"){o=q(t,o);continue}if(i==="/"&&t[o+1]==="/"){o=M(t,o);continue}if(i==="/"&&t[o+1]==="*"){o=D(t,o);continue}if(i==="/"&&W(t,o)){o=U(t,o);continue}if(i!==void 0&&"([{".includes(i))e++;else if(i!==void 0&&")]}".includes(i))e--;else if(o===t.length||i===","&&e===0){let r=t.slice(s,o).trim();r&&n.push(r),s=o+1}o++}return n},gt=t=>{let n=0;for(;n<t.length;){let e=ht(t.slice(n),"=");if(e===-1)return-1;let s=n+e;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;n=s+1}return-1},X=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=It(n);if(e>=n.length)return null;let s=[];for(let o of mt(n.slice(1,e))){if(o.startsWith("..."))continue;let i=gt(o),r=i===-1?o:o.slice(0,i),a=i===-1?void 0:o.slice(i+1).trim(),u=ht(r,":"),p=(u===-1?r:r.slice(0,u)).trim();if(!ot.test(p))continue;let d={name:p};a!==void 0&&(d.default=a);let m=u===-1?"":r.slice(u+1).trim();ot.test(m)&&(d.as=m),s.push(d)}return s},Ae=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let o=t[n];if(o==="'"||o==='"'||o==="`"){n=q(t,n),s=!1;continue}if(o==="/"&&t[n+1]==="/"){n=M(t,n);continue}if(o==="/"&&t[n+1]==="*"){n=D(t,n);continue}if(o==="/"&&W(t,n)){n=U(t,n),s=!1;continue}if(o==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){st.lastIndex=n;let i=st.exec(t);if(i)return n+i[0].length}"([{".includes(o)?e++:")]}".includes(o)&&(e=Math.max(0,e-1)),o===`
6
- `||o===";"||o==="}"?s=!0:/\s/.test(o)||(s=!1),n++}return-1},je=/^async(?![\w$])/,Ne=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Oe=t=>{let n=Ae(t);if(n===-1)return null;let e=et(t,n),s=t.slice(e);je.test(s)&&(e=et(t,e+5));let o=Ne.exec(t.slice(e));if(o&&(e=et(t,e+o[0].length)),t[e]!=="(")return null;let i=0,r=e;for(;r<t.length;){let a=t[r];if(a==="'"||a==='"'||a==="`"){r=q(t,r);continue}if(a==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(a==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(a==="/"&&W(t,r)){r=U(t,r);continue}if("([{".includes(a))i++;else if(")]}".includes(a)&&--i===0)break;r++}return mt(t.slice(e+1,r))[0]??""},yt=t=>{let n=Oe(t);if(n===null)return null;let e=X(n),s=e?.find(o=>o.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 e},Ht=t=>{let n="",e=0,s=0,o=!0,i=!1,r=0;for(;e<t.length;){let a=t[e],u=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(a==="'"||a==='"'||a==="`"){let d=q(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(a==="/"&&(u==="/"||u==="*")){let d=u==="/"?M(t,e):D(t,e);n+=t.slice(e,d),e=d;continue}if(a==="/"&&W(t,e)){let d=U(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(a==="i"&&p){if(nt.lastIndex=e,nt.test(t)){n+="$__import",e+=6,o=!1;continue}if(s===0&&o){kt.lastIndex=e;let d=kt.exec(t);if(d){n+=Ce(d[1],d[3],r++),e+=d[0].length,o=!1;continue}}}if(a==="e"&&p&&s===0&&o){st.lastIndex=e;let d=st.exec(t);if(d){i=!0,n+="$__exports.default =",e+=d[0].length,o=!1;continue}}"([{".includes(a)?s++:")]}".includes(a)&&(s=Math.max(0,s-1)),a===`
7
- `||a===";"||a==="}"?o=!0:/\s/.test(a)||(o=!1),n+=a,e++}return i?n:null};var Yt=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),Qt=t=>({tag:t.tagName.toLowerCase(),attrs:Yt(t),children:Array.from((t instanceof HTMLTemplateElement?t.content:t).childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[Qt(n)]:[]})}),Bt=new Map,te=(t,n)=>{let e=`${n.join(",")}|${t}`,s=Bt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}
8
- ); }`)}catch{s=null}Bt.set(e,s)}return s},C=(t,n,e)=>{let s=te(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},_e=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>C(s,n)??""),Le=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Rt=t=>Le.has(t)||t.startsWith(":class.")||t.startsWith(":props.")||t===":slot"||t.startsWith(":slot."),ve=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Pe=(t,n,e,s)=>{let[o,...i]=n.slice(1).split("."),r=new Set(i);t.addEventListener(o,a=>{if(r.has("self")&&a.target!==t)return;r.has("prevent")&&a.preventDefault(),r.has("stop")&&a.stopPropagation();let u=C(e,s,{$event:a});typeof u=="function"&&u.call(t,a)},{once:r.has("once"),capture:r.has("capture")})},Me=(t,n,e,s)=>{let[o,...i]=n.slice(1).split("."),r=new Set(i),a=u=>{r.has("prevent")&&u.preventDefault(),r.has("stop")&&u.stopPropagation(),r.has("once")&&t.off(o,a),K(()=>{let p=C(e,s,{$event:u});typeof p=="function"&&p(u)})};t.on(o,a)},I=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),$t=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},it=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},De=({first:t,last:n},e)=>{let s=e.nextSibling;for(let o=t;o;){let i=o===n?null:o.nextSibling;e.parentNode.insertBefore(o,s),o=i}},zt=(t,n)=>{let e=n.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let o of Object.keys(s))if(/^[A-Z]/.test(o)&&o.replace(/-/g,"").toLowerCase()===e)return o;return null},Zt=200,bt=0,ee=Symbol("jq79.slots"),qe=t=>t==="slot"||t.startsWith("slot."),ne=t=>t?I(t):"default",Tt=t=>Object.keys(t.attrs).find(n=>n===":slot"||n.startsWith(":slot.")),We=t=>t==="default"?":slot":`:slot.${t}`,Ue=t=>typeof t!="string"||t.trim()!=="",Fe=t=>{let n={},e=[];t.children.forEach(o=>{let i=typeof o=="object"&&o.tag==="template"?Tt(o):void 0;if(typeof o=="string"||i===void 0){e.push(o);return}let r=ne(i.slice(6));if(r in n){console.warn(`jq79: two <template ${We(r)}> in <${t.tag}>; the second was ignored`);return}n[r]={nodes:o.children,binder:o.attrs[i]||void 0}});let s=e.some(Ue);return s&&"default"in n?console.warn(`jq79: <${t.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(n.default={nodes:e,binder:t.attrs[":slot"]||void 0}),n},ke=(t,n,e)=>{X(n)?.forEach(({name:s,as:o,default:i})=>{let r=o??s;Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>{let a=e[s]?.();return a===void 0&&i!==void 0?C(i,t):a},set:()=>console.warn(`jq79: "${r}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},Ie=t=>{let n=Tt(t);return console.warn(`jq79: <template ${n}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${n}`)},He=(t,n)=>{let e=Object.entries(Fe(t));if(!e.length)return null;let s={};return e.forEach(([o,i])=>{s[o]=Be(i,n)}),s},Be=(t,n)=>(e,s,o,i)=>{let r=Object.create(n);ke(r,t.binder,e);let a=r[Q]??[];Object.defineProperty(r,Q,{value:[...a,s]});let u=k(r);return o.onDispose(()=>u.dispose()),z(t.nodes,r,u,i)},ze=(t,n,e,s)=>{let o=ne(t.tag.slice(5)),i=document.createDocumentFragment(),r=document.createComment(t.tag),a=document.createComment(`/${t.tag}`);i.append(r,a);let u=n[ee]?.[o];if(!u)return i.insertBefore(z(t.children,n,e,s),a),i;let p={};return Object.entries(t.attrs).forEach(([d,m])=>{if(!(d===lt||Rt(d)||d.startsWith("@")))if(d.startsWith(":")){let E=m||d.slice(1);p[I(d.slice(1))]=()=>C(E,n)}else p[I(d)]=()=>m}),i.insertBefore(u(p,n,e,s),a),i},Gt=(t,n,e,s,o)=>{let i=document.createComment(t),r=document.createComment(`/${t}`),a=document.createDocumentFragment();a.append(i,r);let u=He(n,e),p={},d={},m=[],E=[],O=!1;Object.entries(n.attrs).forEach(([c,f])=>{if(c!==lt){if(c===":props"||c.startsWith(":props.")){O=!0,E.push({expr:f});return}if(!Rt(c))if(c.startsWith("@"))m.push([c,f]);else if(c===":model"||c.startsWith(":model.")){let l=c===":model"?"default":I(c.slice(7));d[l]=f||(c===":model"?"model":l)}else if(c.startsWith(":")){let l=I(c.slice(1));p[l]=f||l,E.push({name:l,expr:f||l})}else{let l=I(c),T=JSON.stringify(f);p[l]=T,E.push({name:l,expr:T})}}});let x=c=>c==="default"?":model":`:model.${c}`,y=c=>c==="default"?"model":c,S=c=>`${c}
9
- = $value`;Object.entries(d).forEach(([c,f])=>{let l=y(c);p[l]!==void 0&&console.warn(`jq79: <${n.tag}> binds prop "${l}" through both :${l} and ${x(c)} - ${x(c)} wins`),p[l]=f,te(S(f),["$value"])===null&&console.warn(`jq79: ${x(c)}="${f}" is not assignable - updates from <${n.tag}> will be dropped`)});let R=()=>{let c={};return E.forEach(({name:f,expr:l})=>{if(f!==void 0)c[f]=C(l,e);else{let T=C(l,e);T!==null&&typeof T=="object"&&Object.assign(c,T)}}),Object.entries(d).forEach(([f,l])=>{c[y(f)]=C(l,e)}),c},A=null,h=null,g=null,$=new Set,w=c=>{if(c==null){if(!e[ae]?.has(t)||$.has("unfilled"))return;$.add("unfilled"),console.error(`jq79: <${n.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${t}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}$.has("type")||($.add("type"),console.error(`jq79: <${n.tag}> is ${typeof c}, not a component - nothing renders here`))};return s.effect(()=>{let c=C(t,e),f=c instanceof F?c:null;if(f||w(c),f===h||(g?.dispose(),g=null,A?.destroy(),A=null,h=f,!f))return;let l=new F({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(u&&(l.slots=u),Object.keys(d).length){let b=new Set,L=(v,P)=>{b.has(v)||(b.add(v),console.warn(P))};l.on("model:update",(v,P)=>{if(P===null||typeof P!="object"){L("payload",`jq79: model:update expects a { name?, value } payload, got ${P===null?"null":typeof P}`);return}let ct=P.name==null?"default":I(String(P.name)),At=d[ct];if(At===void 0){L(ct,`jq79: <${n.tag}> has no ${x(ct)} - bound: ${Object.keys(d).map(x).join(", ")}`);return}K(()=>C(S(At),e,{$value:P.value}))})}m.forEach(([b,L])=>Me(l,b,L,e));let T=K(R),j=document.createDocumentFragment();if(bt>=Zt){console.error(`jq79: <${n.tag}> is ${Zt} 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{(o?l.renderShadow(T):l.render(T)).mount(j)}finally{bt--}r.parentNode.insertBefore(j,r);let N=k(e);if(O){let b=[];N.effect(()=>{let L=R(),v=Object.keys(L);b.forEach(P=>{P in L||(l.data[P]=void 0)}),v.forEach(P=>{l.data[P]=L[P]}),b=v})}else Object.entries(p).forEach(([b,L])=>{N.effect(()=>{l.data[b]=C(L,e)})});g=N,A=l}),s.onDispose(()=>{g?.dispose(),A?.destroy()}),a},Ze=(t,n)=>{let e=()=>{let s=C(t,n);return s!==null&&typeof s=="object"?s:null};return new Proxy(n,{has(s,o){let i=e();return i!==null&&Reflect.has(i,o)||Reflect.has(s,o)},get(s,o){let i=e();return i!==null&&Reflect.has(i,o)?i[o]:Reflect.get(s,o)},set(s,o,i){let r=e();return r!==null&&Reflect.has(r,o)?(r[o]=i,!0):Reflect.set(s,o,i)}})},V=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(V):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?V(n):[]):[],Ge=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?Ot(t):()=>!1,xt=(t,n,e,s)=>{let o=t.attrs[":with"],i=o!==void 0?Ze(o,n):n;if(qe(t.tag))return ze(t,i,e,s);if(t.tag==="template"&&Tt(t)!==void 0)return Ie(t);let r=zt(i,t.tag);if(r)return Gt(r,t,i,e,s);let a=document.createElement(t.tag);if(a instanceof HTMLUnknownElement||t.tag.includes("-")){let y=!1;e.effect(()=>{if(y)return;let S=zt(i,t.tag);if(!S)return;y=!0;let R=Gt(S,t,i,e,s),A=$t(R);e.onDispose(()=>it(A)),a.replaceWith(R)})}Object.entries(t.attrs).forEach(([y,S])=>{y.startsWith("@")?Pe(a,y,S,i):y===":model"||y.startsWith(":model.")?a instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${y} on <${t.tag}> does nothing - :model binds component tags only (for now)`):Rt(y)||a.setAttribute(y,S)});let u=t.attrs[":attrs"];if(u!==void 0){let y=[];e.effect(()=>{y.forEach(R=>a.removeAttribute(R));let S=C(u,i);y=S&&typeof S=="object"?Object.keys(S):[],y.forEach(R=>{let A=S[R];A!=null&&A!==!1&&a.setAttribute(R,String(A))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,S])=>[y.slice(7),S]);if(p!==void 0||d.length){let y=new Set(V(t.attrs.class??"")),S=[];e.effect(()=>{let R=p!==void 0?V(C(p,i)):[];d.forEach(([A,h])=>{C(h,i)&&R.push(...V(A))}),S.forEach(A=>{!R.includes(A)&&!y.has(A)&&a.classList.remove(A)}),a.classList.add(...R),S=R})}let m=t.attrs[":text"],E=t.attrs[":html"],O=t.attrs[":html.allowed"];O!==void 0&&E===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),m!==void 0?e.effect(()=>{a.textContent=String(C(m,i)??"")}):E!==void 0?e.effect(()=>{let y=O!==void 0?{allowUrl:Ge(C(O,i))}:void 0;a.innerHTML=Lt(String(C(E,i)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(z(t.children,i,e,s)):a.appendChild(z(t.children,i,e,s));let x=t.attrs[":value"];return x!==void 0&&e.effect(()=>{let y=String(C(x,i)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let S=t.attrs[y];if(S===void 0)return;let R=y.slice(1);e.effect(()=>{a[R]=!!C(S,i)})}),a},Ke=(t,n,e,s)=>{let o=document.createComment("if"),i=document.createDocumentFragment();i.appendChild(o);let r=null,a=null,u=null;return e.effect(()=>{let p=t.find(m=>m.expr===void 0||C(m.expr,n))??null;if(p===a||(u?.dispose(),r&&it(r),r=null,a=p,!p))return;u=k(n);let d=xt(p.node,n,u,s);r=$t(d),o.parentNode.insertBefore(d,o.nextSibling)}),i},J=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},Xe=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Je=(t,n,e,s)=>{let o=t.attrs[":each"].match(ve);if(!o)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,i,r,a]=o,u=t.attrs[":key"],{[":each"]:p,[":key"]:d,...m}=t.attrs,E={...t,attrs:m},O=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(O),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let y=[],S=!1;return e.effect(()=>{let R=C(a,n),A=Array.isArray(R)?R.map((f,l)=>[l,f]):Xe(R)?Object.entries(R):[],h=new Map;y.forEach(f=>{let l=h.get(f.key);l?l.push(f):h.set(f.key,[f])});let g=new Set,$=[],w=A.map(([f,l],T)=>{let j=Object.create(n);J(j,i,l),r&&J(j,r,f),J(j,"$index",T);let N=u!==void 0?C(u,j):f;g.has(N)&&!S&&(S=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),g.add(N);let b=h.get(N)?.shift();if(b&&Object.is(b.item,l))return b.scope.$index!==T&&$.push(b),J(b.scope,"$index",T),r&&J(b.scope,r,f),b;b&&(b.fx.dispose(),it(b.range));let L=k(n),v=$t(xt(E,j,L,s));return{key:N,item:l,scope:j,fx:L,range:v}});h.forEach(f=>f.forEach(l=>{l.fx.dispose(),it(l.range)}));let c=O;w.forEach(f=>{c.nextSibling!==f.range.first&&De(f.range,c),c=f.range.last}),$.forEach(f=>K(()=>f.fx.refresh())),y=w}),x},z=(t,n,e,s=!1)=>{let o=document.createDocumentFragment(),i=0;for(;i<t.length;){let r=t[i];if(typeof r=="string"){let a=document.createTextNode(r);r.includes("{{")&&e.effect(()=>{a.textContent=_e(r,n)}),o.appendChild(a),i++;continue}if(":each"in r.attrs){o.appendChild(Je(r,n,e,s)),i++;continue}if(":if"in r.attrs){let a=[{expr:r.attrs[":if"],node:r}];i++;let u=d=>{let m=i;for(;m<t.length&&typeof t[m]=="string"&&!t[m].trim();)m++;let E=t[m];if(typeof E=="object"&&d in E.attrs)return i=m+1,E};for(let d=u(":elseif");d;d=u(":elseif"))a.push({expr:d.attrs[":elseif"],node:d});let p=u(":else");p&&a.push({node:p}),o.appendChild(Ke(a,n,e,s));continue}o.appendChild(xt(r,n,e,s)),i++}return o},An=(t,n,e=!1)=>z(t.template,n,k(n),e),Ve=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ye=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,se=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Qe=t=>t.split(se).map((n,e)=>e%2===1?n:n.replace(Ye,(s,o,i)=>Ve.has(o.toLowerCase())?s:`<${o}${i}></${o}>`)).join(""),tn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,en=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,nn=t=>t.split(se).map((n,e)=>e%2===1?n:n.replace(tn,(s,o,i)=>{let r=0,a=i.replace(en,(u,p,d)=>d===void 0?u:`${p}:props.${r++}="${d}"`);return`<${o}${a}>`})).join(""),lt="data-jq79",sn=t=>{let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619);return(n>>>0).toString(36)},oe=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[lt]=n,oe(e.children,n))})},on=(t,n)=>t.split(",").map(e=>{let s=e.trim(),o=s.indexOf("::"),i=o===-1?s:s.slice(0,o),r=o===-1?"":s.slice(o);return`${i}[${lt}="${n}"]${r}`}).join(", "),re=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=on(e.selectorText,n):e instanceof CSSGroupingRule&&re(e.cssRules,n)})},rn=(t,n)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let e=new CSSStyleSheet;return e.replaceSync(t),re(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
10
- `)},an=/^[A-Z][A-Za-z0-9]*$/,Et=t=>{let n=Qe(nn(t)),s=new DOMParser().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template"),o=[],i=[];Array.from(s.content.children).forEach(u=>{u.tagName==="TEMPLATE"?i.push(u):o.push(u)});let r=Kt(o,t),a={};return i.forEach(u=>{let p=u.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!an.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new F({...Kt(Array.from(u.content.children),u.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(r.siblings=a),r},Kt=(t,n)=>{let e=[],s=[],o=[];t.forEach(r=>{let a={attrs:Yt(r),content:r.textContent??""};r.tagName==="SCRIPT"?e.push(a):r.tagName==="STYLE"?s.push(a):o.push(Qt(r))}),s.forEach(r=>{"lang"in r.attrs&&console.warn(`jq79: <style lang="${r.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 i=r=>"scoped"in r.attrs&&!("lang"in r.attrs);if(s.some(i)){let r=sn(n);oe(o,r),s.forEach(a=>{i(a)&&(a.scoped=rn(a.content,r))})}return{template:o,scripts:e,styles:s}},Ct=t=>/\.html?([?#]|$)/.test(t)?wt(t):import(t),ie=(t,n)=>t?`
11
- //# sourceURL=${t}?jq79-script=${n}`:"",Xt=t=>t.scoped??t.content,at=new Map,ln=t=>{let n=at.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},at.set(t,n)}n.count++},cn=t=>{let n=at.get(t);n&&--n.count<=0&&(n.el.remove(),at.delete(t))},un=(t,n,e,s={},o=Ct,i={})=>{let r={...le,...s},a=new Proxy(n,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in r))});new Function("$scope","$__effect","$__import",...Object.keys(r),`return (async () => { with ($scope) { ${t} } })()${ie(i.filename,i.index??0)}`)(a,e,o,...Object.values(r)).catch(p=>console.error("jq79: error in :setup script",p))},Jt=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:C(s,t))})},fn=t=>{let n=new Set;return t.forEach(e=>{(yt(e.content)??X(e.attrs[":setup"]))?.forEach(({name:o})=>n.add(o))}),n},dn=(t,n)=>{if(!t)return null;let e=Object.create(null),s=!1;return Object.entries(t).forEach(([o,i])=>{n.has(o)||(e[o]=i,s=!0)}),s?e:null},ae=Symbol("jq79.unfilledProps"),pn=t=>t&&t.default!==void 0?t.default:t,hn=(t,n,e,s={},o=Ct,i={})=>{let r={...le,...s},a={},u=new Function("$__exports","$__default","$__import",...Object.keys(r),`return (async () => { "use strict";
1
+ var pe=Object.defineProperty;var he=(t,n,e)=>n in t?pe(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var N=(t,n,e)=>he(t,typeof n!="symbol"?n+"":n,e);function K(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function dt(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var pt=(t,n={})=>{let e=document.createElement(t);for(let[s,r]of Object.entries(n))if(s==="className")e.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")e.textContent=r;else if(s==="children")for(let o of r)e.appendChild(o);else e.setAttribute(s,r);return e},ge=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),Ot={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},me=new Set(["http:","https:","mailto:"]);function ye(t){try{let n=new URL(t,"https://example.com");return me.has(n.protocol)}catch{return!1}}var be={"https:":"443","http:":"80"};function Ee(t){let n=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!n)return null;let[,e,s]=n,r=e.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 vt=t=>{let n=(Array.isArray(t)?t:t.split(",")).map(Ee).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),r=e.port||be[e.protocol]||"";return n.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function Se(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var Lt=512;function Pt(t,n,e,s){if(e>Lt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Lt} elements`);for(let r of Array.from(t.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=we(r,e,s);o&&n.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&n.appendChild(r.cloneNode())}function we(t,n,e){let s=t.tagName.toLowerCase();if(!ge.has(s))return null;let r=document.createElement(s);for(let o of Array.from(t.attributes)){let i=o.name.toLowerCase(),l=Ot[s]?.has(i),u=Ot["*"]?.has(i);!l&&!u||(i==="href"||i==="src")&&(!ye(o.value)||e&&!Se(e,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Pt(t,r,n+1,e),r}function Mt(t,n){let e=document.createElement("template");e.innerHTML=t;let s=document.createElement("div");return Pt(e.content,s,0,n?.allowUrl),s.innerHTML}var Re=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),qt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Wt=(t,n,e)=>{Object.entries(t).forEach(([s,r])=>{let o=n?`${n}.${s}`:s;r&&typeof r=="object"&&qt(r)?Wt(r,o,e):e(o,r)})},$e=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),ht=Symbol("jq79.raw"),Y=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[ht];)n=n[ht];return n},Ut=Symbol("jq79.store"),V=t=>t!==null&&typeof t=="object"&&t[Ut]===!0,z=[],J=t=>{z.push(new Set);try{return t()}finally{z.pop()}},Dt="$__attach",tt=Symbol("jq79.alsoWakenBy"),et=t=>{let n=new Map,e=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(h,m,T=!1)=>{n.get(h)?.forEach(S=>S(m,h)),e.forEach(S=>S(h,m)),s.forEach(S=>{(T||Array.from(S.deps).some(c=>$e(c,h)))&&S.run()})},l=h=>h!==null&&typeof h=="object"&&qt(h),u=new Map,p=(h,m)=>{let T=u.get(m);T?.store!==h&&(T?.unsubscribe(),u.set(m,{store:h,unsubscribe:h.$onAny((S,c)=>i(`${m}.${S}`,c))}))},d=h=>{u.get(h)?.unsubscribe(),u.delete(h)},g=(h,m)=>{let T=r.get(h);if(T)return T;let S=null,c=new Proxy(h,{has(f,a){return Reflect.has(f,a)||typeof a=="string"&&S?.has(a)===!0},get(f,a,w){if(a===ht)return f;if(a===Ut)return m==="";if(typeof a!="string")return Reflect.get(f,a,w);if(m===""&&a in o)return o[a];let A=m?`${m}.${a}`:a;z[z.length-1]?.add(A);let j=Reflect.get(f,a,w);if(V(j))return p(j,A),j;let E=Y(j);return l(E)?g(E,A):E},set(f,a,w,A){if(A!==c&&!Object.prototype.hasOwnProperty.call(f,a))return Reflect.set(f,a,w,A);let j=m?`${m}.${a}`:a,E=V(w)?w:Y(w),v=!Object.prototype.hasOwnProperty.call(f,a);if(!v&&Object.is(f[a],E)&&(E===null||typeof E!="object"))return!0;f[a]=E,S?.delete(a),V(E)?p(E,j):d(j);let L=V(E)||!l(E)?E:g(E,j);return i(j,L,v),!0},deleteProperty(f,a){if(typeof a!="string")return Reflect.deleteProperty(f,a);let w=Object.prototype.hasOwnProperty.call(f,a),A=Reflect.deleteProperty(f,a);if(A&&w){let j=m?`${m}.${a}`:a;(S??(S=new Set)).add(a),d(j),i(j,void 0)}return A}});return r.set(h,c),c},b=g(Y(t),"");Object.entries(Y(t)).forEach(([h,m])=>{V(m)&&p(m,h)});let O=(h,m,{immediate:T=!1}={})=>(n.has(h)||n.set(h,new Set),n.get(h).add(m),T&&m(Re(b,h),h),()=>n.get(h)?.delete(m)),x=(h,{immediate:m=!1}={})=>(e.add(h),m&&Wt(b,"",(T,S)=>h(T,S)),()=>e.delete(h)),y=(h,m)=>{let T=!1,S=!1,c={deps:new Set,run:()=>{if(T){S=!0;return}T=!0;try{let f=0;do{S=!1;let a=new Set;z.push(a);try{h()}finally{z.pop(),c.deps=a}}while(S&&++f<100);S&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{T=!1}}};return s.add(c),m?.length?R(c,m):(c.run(),()=>{s.delete(c)})},R=(h,m)=>{let T=m.map(S=>S?.[Dt]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),T.forEach(S=>S())}},$=h=>(s.add(h),()=>{s.delete(h)}),_=()=>{u.forEach(({unsubscribe:h})=>h()),u.clear()};return o.$on=O,o.$onAny=x,o.$effect=y,o.$dispose=_,o[Dt]=$,b},I=t=>{let n=[],e=[],s=t[tt];return{effect:r=>{n.push(t.$effect(r,s)),e.push(r)},onDispose:r=>{n.push(r)},refresh:()=>{e.forEach(r=>r())},dispose:()=>{n.splice(0).forEach(r=>r()),e.length=0}}};var Ft=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,It=/\$:\s*/y,st=/import(?=\s*\()/y,kt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,q=(t,n)=>{let e=t[n],s=n+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===e)return s+1;s++}return t.length},M=(t,n)=>{let e=t.indexOf(`
2
+ `,n);return e===-1?t.length:e},D=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},nt=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=D(t,e);continue}break}return e},Te=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),W=(t,n)=>{let e=n-1;for(;e>=0;){let r=t[e];if(/\s/.test(r)){e--;continue}if(r==="/"&&t[e-1]==="*"){let o=t.lastIndexOf("/*",e-2);if(o===-1)return!0;e=o-1;continue}break}if(e<0)return!0;let s=t[e];if(/[\w$]/.test(s)){let r=e;for(;r>0&&/[\w$]/.test(t[r-1]);)r--;return Te.has(t.slice(r,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},U=(t,n)=>{let e=n+1,s=!1;for(;e<t.length;){let r=t[e];if(r==="\\"){e+=2;continue}if(r===`
3
+ `)return e;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(e++;e<t.length&&/[a-z]/i.test(t[e]);)e++;return e}e++}return t.length},xe=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Ce=(t,n)=>{let e=n-1;for(;e>=0;){let s=t[e];if(/\s/.test(s)){e--;continue}if(s==="/"&&t[e-1]==="*"){let r=t.lastIndexOf("/*",e-2);if(r===-1)return"";e=r-1;continue}return s}return""},Bt=(t,n)=>{let e=0,s=n;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=q(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(r==="/"&&W(t,s)){s=U(t,s);continue}if("([{".includes(r))e++;else if(")]}".includes(r))e--;else{if(e<=0&&r===";")return s;if(e<=0&&r===`
4
+ `){let o=nt(t,s+1);if(!(o<t.length&&(xe.test(t.slice(o,o+2))||[",","="].includes(Ce(t,s)))))return s;s=o;continue}}s++}return t.length},_e=t=>{let n=[],e=0,s=0,r=0,o=l=>{n.push({raw:t.slice(s,l),codeEnd:Math.max(0,r-s)}),s=l+1,r=s},i=0;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=q(t,i),r=i;continue}if(l==="/"&&t[i+1]==="/"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=D(t,i);continue}if(l==="/"&&W(t,i)){i=U(t,i),r=i;continue}if("([{".includes(l))e++;else if(")]}".includes(l))e--;else if(l===","&&e<=0){o(i),i++;continue}/\s/.test(l)||(r=i+1),i++}return o(t.length),n},gt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return ot.test(n)?[n]:[];let e=[];for(let s of yt(n.slice(1,zt(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=bt(s);if(r!==-1&&(s=s.slice(0,r).trim()),n.startsWith("{")){let o=mt(s,":");if(o!==-1){e.push(...gt(s.slice(o+1)));continue}}e.push(...gt(s))}return e},Ae=t=>{let n=[],e=_e(t).map(({raw:o,codeEnd:i})=>{let l=o.match(/^\s*/)[0];if(i<=l.length)return{text:o,empty:!0};let u=o.slice(l.length,i),p=o.slice(i),d=bt(u),g=(d===-1?u:u.slice(0,d)).trim(),b=u[0]==="{"||u[0]==="[";b?n.push(...gt(g)):ot.test(g)&&n.push(g);let O=it(u).code;return{text:`${l}${b?`(${O})`:O}${p}`,empty:!1}}),s=[];for(;e.length&&e[e.length-1].empty;)s.unshift(e.pop().text);let r=e.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:n,code:r}},it=t=>{let n=[],e="",s=0,r=0,o=!0;for(;s<t.length;){let i=t[s],l=t[s+1];if(i==="'"||i==='"'||i==="`"){let u=q(t,s);e+=t.slice(s,u),s=u,o=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let u=l==="/"?M(t,s):D(t,s);e+=t.slice(s,u),s=u;continue}if(i==="/"&&W(t,s)){let u=U(t,s);e+=t.slice(s,u),s=u,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(st.lastIndex=s,st.test(t))){e+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ft.lastIndex=s;let u=Ft.exec(t);if(u){let d=s+u[0].length,g=Bt(t,d),{vars:b,code:O}=Ae(t.slice(d,g));n.push(...b),e+=O,s=g,o=!1;continue}It.lastIndex=s;let p=It.exec(t);if(p){kt.lastIndex=s;let d=kt.exec(t);d&&n.push(d[1]);let g=s+p[0].length,b=Bt(t,g);e+=`$__effect(() => { ${it(t.slice(g,b)).code} });`,s=b;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
+ `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),e+=i,s++}return{vars:n,code:e}},rt=/export\s+default(?![\w$])/y,Ht=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,je=t=>{let n=[],e=0,s=0;for(let r=0;r<=t.length;r++){let o=t[r];if(o==="{")e++;else if(o==="}")e--;else if(r===t.length||o===","&&e===0){let i=t.slice(s,r).trim();i&&n.push(i),s=r+1}}return n},Ne=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let r=je(t),o=[],i=s;if(r.length>1){let l=`$__mod${e}`;o.push(`${l} = ${s}`),i=l}for(let l of r)l.startsWith("{")?o.push(`${l.replace(/\s+as\s+/g,": ")} = ${i}`):l.startsWith("*")?o.push(`${l.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${l} = $__default(${i})`);return`const ${o.join(", ")}`},ot=/^[A-Za-z_$][\w$]*$/,zt=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=q(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=M(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=D(t,e);continue}if(s==="/"&&W(t,e)){e=U(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},mt=(t,n)=>{let e=0,s=0;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=q(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=M(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=D(t,s);continue}if(r==="/"&&r!==n&&W(t,s)){s=U(t,s);continue}if("([{".includes(r))e++;else if(")]}".includes(r))e--;else if(e===0&&r===n)return s;s++}return-1},yt=t=>{let n=[],e=0,s=0,r=0;for(;r<=t.length;){let o=t[r];if(o==="'"||o==='"'||o==="`"){r=q(t,r);continue}if(o==="/"&&t[r+1]==="/"){r=M(t,r);continue}if(o==="/"&&t[r+1]==="*"){r=D(t,r);continue}if(o==="/"&&W(t,r)){r=U(t,r);continue}if(o!==void 0&&"([{".includes(o))e++;else if(o!==void 0&&")]}".includes(o))e--;else if(r===t.length||o===","&&e===0){let i=t.slice(s,r).trim();i&&n.push(i),s=r+1}r++}return n},bt=t=>{let n=0;for(;n<t.length;){let e=mt(t.slice(n),"=");if(e===-1)return-1;let s=n+e;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;n=s+1}return-1},Z=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=zt(n);if(e>=n.length)return null;let s=[];for(let r of yt(n.slice(1,e))){if(r.startsWith("..."))continue;let o=bt(r),i=o===-1?r:r.slice(0,o),l=o===-1?void 0:r.slice(o+1).trim(),u=mt(i,":"),p=(u===-1?i:i.slice(0,u)).trim();if(!ot.test(p))continue;let d={name:p};l!==void 0&&(d.default=l);let g=u===-1?"":i.slice(u+1).trim();ot.test(g)&&(d.as=g),s.push(d)}return s},Oe=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let r=t[n];if(r==="'"||r==='"'||r==="`"){n=q(t,n),s=!1;continue}if(r==="/"&&t[n+1]==="/"){n=M(t,n);continue}if(r==="/"&&t[n+1]==="*"){n=D(t,n);continue}if(r==="/"&&W(t,n)){n=U(t,n),s=!1;continue}if(r==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){rt.lastIndex=n;let o=rt.exec(t);if(o)return n+o[0].length}"([{".includes(r)?e++:")]}".includes(r)&&(e=Math.max(0,e-1)),r===`
6
+ `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),n++}return-1},Le=/^async(?![\w$])/,ve=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Pe=t=>{let n=Oe(t);if(n===-1)return null;let e=nt(t,n),s=t.slice(e);Le.test(s)&&(e=nt(t,e+5));let r=ve.exec(t.slice(e));if(r&&(e=nt(t,e+r[0].length)),t[e]!=="(")return null;let o=0,i=e;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=q(t,i);continue}if(l==="/"&&t[i+1]==="/"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=D(t,i);continue}if(l==="/"&&W(t,i)){i=U(t,i);continue}if("([{".includes(l))o++;else if(")]}".includes(l)&&--o===0)break;i++}return yt(t.slice(e+1,i))[0]??""},lt=t=>{let n=Pe(t);if(n===null)return null;let e=Z(n),s=e?.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 e},Zt=t=>{let n="",e=0,s=0,r=!0,o=!1,i=0;for(;e<t.length;){let l=t[e],u=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(l==="'"||l==='"'||l==="`"){let d=q(t,e);n+=t.slice(e,d),e=d,r=!1;continue}if(l==="/"&&(u==="/"||u==="*")){let d=u==="/"?M(t,e):D(t,e);n+=t.slice(e,d),e=d;continue}if(l==="/"&&W(t,e)){let d=U(t,e);n+=t.slice(e,d),e=d,r=!1;continue}if(l==="i"&&p){if(st.lastIndex=e,st.test(t)){n+="$__import",e+=6,r=!1;continue}if(s===0&&r){Ht.lastIndex=e;let d=Ht.exec(t);if(d){n+=Ne(d[1],d[3],i++),e+=d[0].length,r=!1;continue}}}if(l==="e"&&p&&s===0&&r){rt.lastIndex=e;let d=rt.exec(t);if(d){o=!0,n+="$__exports.default =",e+=d[0].length,r=!1;continue}}"([{".includes(l)?s++:")]}".includes(l)&&(s=Math.max(0,s-1)),l===`
7
+ `||l===";"||l==="}"?r=!0:/\s/.test(l)||(r=!1),n+=l,e++}return o?n:null};var Me="0.4.18",ne=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),se=t=>({tag:t.tagName.toLowerCase(),attrs:ne(t),children:Array.from((t instanceof HTMLTemplateElement?t.content:t).childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[se(n)]:[]})}),Gt=new Map,re=(t,n)=>{let e=`${n.join(",")}|${t}`,s=Gt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}
8
+ ); }`)}catch{s=null}Gt.set(e,s)}return s},C=(t,n,e)=>{let s=re(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},De=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>C(s,n)??""),qe=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Tt=t=>qe.has(t)||t.startsWith(":class.")||t.startsWith(":props.")||t===":slot"||t.startsWith(":slot."),We=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Ue=(t,n,e,s)=>{let[r,...o]=n.slice(1).split("."),i=new Set(o);t.addEventListener(r,l=>{if(i.has("self")&&l.target!==t)return;i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation();let u=C(e,s,{$event:l});typeof u=="function"&&u.call(t,l)},{once:i.has("once"),capture:i.has("capture")})},Fe=(t,n,e,s)=>{let[r,...o]=n.slice(1).split("."),i=new Set(o),l=u=>{i.has("prevent")&&u.preventDefault(),i.has("stop")&&u.stopPropagation(),i.has("once")&&t.off(r,l),J(()=>{let p=C(e,s,{$event:u});typeof p=="function"&&p(u)})};t.on(r,l)},k=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),St=t=>t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`),xt=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},at=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},Ie=({first:t,last:n},e)=>{let s=e.nextSibling;for(let r=t;r;){let o=r===n?null:r.nextSibling;e.parentNode.insertBefore(r,s),r=o}},Kt=(t,n)=>{let e=n.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===e)return r;return null},Vt=200,Et=0,oe=Symbol("jq79.slots"),ke=t=>t==="slot"||t.startsWith("slot."),ie=t=>t?k(t):"default",Ct=t=>Object.keys(t.attrs).find(n=>n===":slot"||n.startsWith(":slot.")),Be=t=>t==="default"?":slot":`:slot.${t}`,He=t=>typeof t!="string"||t.trim()!=="",ze=t=>{let n={},e=[];t.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Ct(r):void 0;if(typeof r=="string"||o===void 0){e.push(r);return}let i=ie(o.slice(6));if(i in n){console.warn(`jq79: two <template ${Be(i)}> in <${t.tag}>; the second was ignored`);return}n[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=e.some(He);return s&&"default"in n?console.warn(`jq79: <${t.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(n.default={nodes:e,binder:t.attrs[":slot"]||void 0}),n},Ze=(t,n,e)=>{Z(n)?.forEach(({name:s,as:r,default:o})=>{let i=r??s;Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:()=>{let l=e[s]?.();return l===void 0&&o!==void 0?C(o,t):l},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},Ge=t=>{let n=Ct(t);return console.warn(`jq79: <template ${n}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${n}`)},Ke=(t,n)=>{let e=Object.entries(ze(t));if(!e.length)return null;let s={};return e.forEach(([r,o])=>{s[r]=Ve(o,n)}),s},Ve=(t,n)=>(e,s,r,o)=>{let i=Object.create(n);Ze(i,t.binder,e);let l=i[tt]??[];Object.defineProperty(i,tt,{value:[...l,s]});let u=I(i);return r.onDispose(()=>u.dispose()),G(t.nodes,i,u,o)},Je=(t,n,e,s)=>{let r=ie(t.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(t.tag),l=document.createComment(`/${t.tag}`);o.append(i,l);let u=n[oe]?.[r];if(!u)return o.insertBefore(G(t.children,n,e,s),l),o;let p={};return Object.entries(t.attrs).forEach(([d,g])=>{if(!(d===ut||Tt(d)||d.startsWith("@")))if(d.startsWith(":")){let b=g||d.slice(1);p[k(d.slice(1))]=()=>C(b,n)}else p[k(d)]=()=>g}),o.insertBefore(u(p,n,e,s),l),o},Jt=(t,n,e,s,r)=>{let o=document.createComment(t),i=document.createComment(`/${t}`),l=document.createDocumentFragment();l.append(o,i);let u=Ke(n,e),p={},d={},g=[],b=[],O=!1;Object.entries(n.attrs).forEach(([c,f])=>{if(c!==ut){if(c===":props"||c.startsWith(":props.")){O=!0,b.push({expr:f});return}if(!Tt(c))if(c.startsWith("@"))g.push([c,f]);else if(c===":model"||c.startsWith(":model.")){let a=c===":model"?"default":k(c.slice(7));d[a]=f||(c===":model"?"model":a)}else if(c.startsWith(":")){let a=k(c.slice(1));p[a]=f||a,b.push({name:a,expr:f||a})}else{let a=k(c),w=JSON.stringify(f);p[a]=w,b.push({name:a,expr:w})}}});let x=c=>c==="default"?":model":`:model.${c}`,y=c=>c==="default"?"model":c,R=c=>`${c}
9
+ = $value`;Object.entries(d).forEach(([c,f])=>{let a=y(c);p[a]!==void 0&&console.warn(`jq79: <${n.tag}> binds prop "${a}" through both :${a} and ${x(c)} - ${x(c)} wins`),p[a]=f,re(R(f),["$value"])===null&&console.warn(`jq79: ${x(c)}="${f}" is not assignable - updates from <${n.tag}> will be dropped`)});let $=()=>{let c={};return b.forEach(({name:f,expr:a})=>{if(f!==void 0)c[f]=C(a,e);else{let w=C(a,e);w!==null&&typeof w=="object"&&Object.assign(c,w)}}),Object.entries(d).forEach(([f,a])=>{c[y(f)]=C(a,e)}),c},_=null,h=null,m=null,T=new Set,S=c=>{if(c==null){if(!e[fe]?.has(t)||T.has("unfilled"))return;T.add("unfilled"),console.error(`jq79: <${n.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${t}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}T.has("type")||(T.add("type"),console.error(`jq79: <${n.tag}> is ${typeof c}, not a component - nothing renders here`))};return s.effect(()=>{let c=C(t,e),f=c instanceof F?c:null;if(f||S(c),f===h||(m?.dispose(),m=null,_?.destroy(),_=null,h=f,!f))return;let a=new F({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(u&&(a.slots=u),Object.keys(d).length){let v=new Set,L=(H,P)=>{v.has(H)||(v.add(H),console.warn(P))};a.on("model:update",(H,P)=>{if(P===null||typeof P!="object"){L("payload",`jq79: model:update expects a { name?, value } payload, got ${P===null?"null":typeof P}`);return}let ft=P.name==null?"default":k(String(P.name)),Nt=d[ft];if(Nt===void 0){L(ft,`jq79: <${n.tag}> has no ${x(ft)} - bound: ${Object.keys(d).map(x).join(", ")}`);return}J(()=>C(R(Nt),e,{$value:P.value}))})}g.forEach(([v,L])=>Fe(a,v,L,e));let w=wn(a.scripts),A=te(J($),w),j=document.createDocumentFragment();if(Et>=Vt){console.error(`jq79: <${n.tag}> is ${Vt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Et++;try{(r?a.renderShadow(A):a.render(A)).mount(j)}finally{Et--}i.parentNode.insertBefore(j,i);let E=I(e);if(O){let v=[];E.effect(()=>{let L=te($(),w),H=Object.keys(L);v.forEach(P=>{P in L||(a.data[P]=void 0)}),H.forEach(P=>{a.data[P]=L[P]}),v=H})}else Object.entries(p).forEach(([v,L])=>{w!==null&&!w.has(v)||E.effect(()=>{a.data[v]=C(L,e)})});m=E,_=a}),s.onDispose(()=>{m?.dispose(),_?.destroy()}),l},Xe=(t,n)=>{let e=()=>{let s=C(t,n);return s!==null&&typeof s=="object"?s:null};return new Proxy(n,{has(s,r){let o=e();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=e();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=e();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},Q=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(Q):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?Q(n):[]):[],Qe=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?vt(t):()=>!1,_t=(t,n,e,s)=>{let r=t.attrs[":with"],o=r!==void 0?Xe(r,n):n;if(ke(t.tag))return Je(t,o,e,s);if(t.tag==="template"&&Ct(t)!==void 0)return Ge(t);let i=Kt(o,t.tag);if(i)return Jt(i,t,o,e,s);let l=document.createElement(t.tag);if(l instanceof HTMLUnknownElement||t.tag.includes("-")){let y=!1;e.effect(()=>{if(y)return;let R=Kt(o,t.tag);if(!R)return;y=!0;let $=Jt(R,t,o,e,s),_=xt($);e.onDispose(()=>at(_)),l.replaceWith($)})}Object.entries(t.attrs).forEach(([y,R])=>{y.startsWith("@")?Ue(l,y,R,o):y===":model"||y.startsWith(":model.")?l instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${y} on <${t.tag}> does nothing - :model binds component tags only (for now)`):Tt(y)||l.setAttribute(y,R)});let u=t.attrs[":attrs"];if(u!==void 0){let y=[];e.effect(()=>{y.forEach($=>l.removeAttribute($));let R=C(u,o);y=R&&typeof R=="object"?Object.keys(R):[],y.forEach($=>{let _=R[$];_!=null&&_!==!1&&l.setAttribute($,String(_))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,R])=>[y.slice(7),R]);if(p!==void 0||d.length){let y=new Set(Q(t.attrs.class??"")),R=[];e.effect(()=>{let $=p!==void 0?Q(C(p,o)):[];d.forEach(([_,h])=>{C(h,o)&&$.push(...Q(_))}),R.forEach(_=>{!$.includes(_)&&!y.has(_)&&l.classList.remove(_)}),l.classList.add(...$),R=$})}let g=t.attrs[":text"],b=t.attrs[":html"],O=t.attrs[":html.allowed"];O!==void 0&&b===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),g!==void 0?e.effect(()=>{l.textContent=String(C(g,o)??"")}):b!==void 0?e.effect(()=>{let y=O!==void 0?{allowUrl:Qe(C(O,o))}:void 0;l.innerHTML=Mt(String(C(b,o)??""),y)}):l instanceof HTMLTemplateElement?l.content.appendChild(G(t.children,o,e,s)):l.appendChild(G(t.children,o,e,s));let x=t.attrs[":value"];return x!==void 0&&e.effect(()=>{let y=String(C(x,o)??"");l.value!==y&&(l.value=y)}),[":checked",":selected"].forEach(y=>{let R=t.attrs[y];if(R===void 0)return;let $=y.slice(1);e.effect(()=>{l[$]=!!C(R,o)})}),l},Ye=(t,n,e,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,l=null,u=null;return e.effect(()=>{let p=t.find(g=>g.expr===void 0||C(g.expr,n))??null;if(p===l||(u?.dispose(),i&&at(i),i=null,l=p,!p))return;u=I(n);let d=_t(p.node,n,u,s);i=xt(d),r.parentNode.insertBefore(d,r.nextSibling)}),o},X=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},tn=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},en=(t,n,e,s)=>{let r=t.attrs[":each"].match(We);if(!r)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,o,i,l]=r,u=t.attrs[":key"],{[":each"]:p,[":key"]:d,...g}=t.attrs,b={...t,attrs:g},O=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(O),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let y=[],R=!1;return e.effect(()=>{let $=C(l,n),_=Array.isArray($)?$.map((f,a)=>[a,f]):tn($)?Object.entries($):[],h=new Map;y.forEach(f=>{let a=h.get(f.key);a?a.push(f):h.set(f.key,[f])});let m=new Set,T=[],S=_.map(([f,a],w)=>{let A=Object.create(n);X(A,o,a),i&&X(A,i,f),X(A,"$index",w);let j=u!==void 0?C(u,A):f;m.has(j)&&!R&&(R=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),m.add(j);let E=h.get(j)?.shift();if(E&&Object.is(E.item,a))return E.scope.$index!==w&&T.push(E),X(E.scope,"$index",w),i&&X(E.scope,i,f),E;E&&(E.fx.dispose(),at(E.range));let v=I(n),L=xt(_t(b,A,v,s));return{key:j,item:a,scope:A,fx:v,range:L}});h.forEach(f=>f.forEach(a=>{a.fx.dispose(),at(a.range)}));let c=O;S.forEach(f=>{c.nextSibling!==f.range.first&&Ie(f.range,c),c=f.range.last}),T.forEach(f=>J(()=>f.fx.refresh())),y=S}),x},G=(t,n,e,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<t.length;){let i=t[o];if(typeof i=="string"){let l=document.createTextNode(i);i.includes("{{")&&e.effect(()=>{l.textContent=De(i,n)}),r.appendChild(l),o++;continue}if(":each"in i.attrs){r.appendChild(en(i,n,e,s)),o++;continue}if(":if"in i.attrs){let l=[{expr:i.attrs[":if"],node:i}];o++;let u=d=>{let g=o;for(;g<t.length&&typeof t[g]=="string"&&!t[g].trim();)g++;let b=t[g];if(typeof b=="object"&&d in b.attrs)return o=g+1,b};for(let d=u(":elseif");d;d=u(":elseif"))l.push({expr:d.attrs[":elseif"],node:d});let p=u(":else");p&&l.push({node:p}),r.appendChild(Ye(l,n,e,s));continue}r.appendChild(_t(i,n,e,s)),o++}return r},qn=(t,n,e=!1)=>G(t.template,n,I(n),e),nn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,At=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,rn=t=>t.split(At).map((n,e)=>e%2===1?n:n.replace(sn,(s,r,o)=>nn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),le=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,on=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,ln=t=>t.split(At).map((n,e)=>e%2===1?n:n.replace(le,(s,r,o)=>{let i=0,l=o.replace(on,(u,p,d)=>d===void 0?u:`${p}:props.${i++}="${d}"`);return`<${r}${l}>`})).join(""),an=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,cn=/<\/slot\.([\w.$-]+)(\s*)>/gi,un=/^slot\./i,fn=t=>un.test(t)?`slot.${St(t.slice(5))}`:t,dn=t=>t.split(At).map((n,e)=>e%2===1?n:n.replace(le,(s,r,o)=>{let i=o.replace(an,(l,u,p)=>p===void 0?l:`${u}${St(p)}`);return`<${fn(r)}${i}>`}).replace(cn,(s,r,o)=>`</slot.${St(r)}${o}>`)).join(""),ut="data-jq79",pn=t=>{let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619);return(n>>>0).toString(36)},ae=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[ut]=n,ae(e.children,n))})},hn=(t,n)=>t.split(",").map(e=>{let s=e.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${ut}="${n}"]${i}`}).join(", "),ce=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=hn(e.selectorText,n):e instanceof CSSGroupingRule&&ce(e.cssRules,n)})},gn=(t,n)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let e=new CSSStyleSheet;return e.replaceSync(t),ce(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
10
+ `)},mn=/^[A-Z][A-Za-z0-9]*$/,wt=t=>{let n=rn(ln(dn(t))),s=new DOMParser().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(u=>{u.tagName==="TEMPLATE"?o.push(u):r.push(u)});let i=Xt(r,t),l={};return o.forEach(u=>{let p=u.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!mn.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in l){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}l[p]=new F({...Xt(Array.from(u.content.children),u.innerHTML),siblings:l,name:p})}),Object.keys(l).length&&(i.siblings=l),i},Xt=(t,n)=>{let e=[],s=[],r=[];t.forEach(i=>{let l={attrs:ne(i),content:i.textContent??""};i.tagName==="SCRIPT"?e.push(l):i.tagName==="STYLE"?s.push(l):r.push(se(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=pn(n);ae(r,i),s.forEach(l=>{o(l)&&(l.scoped=gn(l.content,i))})}return{template:r,scripts:e,styles:s}},jt=t=>/\.html?([?#]|$)/.test(t)?Rt(t):import(t),ue=(t,n)=>t?`
11
+ //# sourceURL=${t}?jq79-script=${n}`:"",Qt=t=>t.scoped??t.content,ct=new Map,yn=t=>{let n=ct.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},ct.set(t,n)}n.count++},bn=t=>{let n=ct.get(t);n&&--n.count<=0&&(n.el.remove(),ct.delete(t))},En=(t,n,e,s={},r=jt,o={})=>{let i={...de,...s},l=new Proxy(n,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${ue(o.filename,o.index??0)}`)(l,e,r,...Object.values(i)).catch(p=>console.error("jq79: error in :setup script",p))},Yt=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:C(s,t))})},Sn=t=>{let n=new Set;return t.forEach(e=>{(lt(e.content)??Z(e.attrs[":setup"]))?.forEach(({name:r})=>n.add(r))}),n},wn=t=>{let n=null;return t.forEach(e=>{let s=lt(e.content)??Z(e.attrs[":setup"]);if(!s)return;let r=n??(n=new Set);s.forEach(({name:o})=>r.add(o))}),n},te=(t,n)=>{if(n===null)return t;let e={};return Object.keys(t).forEach(s=>{n.has(s)&&(e[s]=t[s])}),e},Rn=(t,n)=>{if(!t)return null;let e=Object.create(null),s=!1;return Object.entries(t).forEach(([r,o])=>{n.has(r)||(e[r]=o,s=!0)}),s?e:null},fe=Symbol("jq79.unfilledProps"),$n=t=>t&&t.default!==void 0?t.default:t,Tn=(t,n,e,s={},r=jt,o={})=>{let i={...de,...s},l={},u=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
12
12
  ${t}
13
- ;$__exports.done = true })()${ie(i.filename,i.index??0)}`)(a,pn,o,...Object.values(r)),p=E=>console.error("jq79: error in factory script",E),d=!1,m=()=>{if(d)return;d=!0;let E=a.default;if(typeof E!="function")return;let O=x=>{x&&typeof x=="object"&&Object.assign(n,x)};try{let x=E(n,{$data:n,$props:n,$effect:e,...s});x instanceof Promise?x.then(O).catch(p):O(x)}catch(x){p(x)}};u.then(m,p),a.done&&m()},mn="__JQ79_HMR_ENABLED__",gn="__JQ79_HMR__",H=null,yn=t=>{if(!H||!t.filename)return;let n=H.get(t.filename);n||H.set(t.filename,n=new Set),n.add(new WeakRef(t))},Vt=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},bn=(t,n)=>{if(!H)return 0;let e=Vt(t),s=Et(n),o=!1,i=a=>a.name===void 0?s:s.siblings?.[a.name]??null,r=0;for(let[a,u]of H)if(Vt(a)===e){for(let p of u){let d=p.deref();if(!d){u.delete(p);continue}let m=i(d);if(!m){o=!0;continue}d.hotReplace(m)&&r++}u.size||H.delete(a)}return o?0:r},En=()=>{H??(H=new Map),globalThis[gn]={update:bn}},wt=async t=>{let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new F(await n.text(),{filename:t})},F=class{constructor(n,e={}){_(this,"template");_(this,"scripts");_(this,"styles");_(this,"modules");_(this,"filename");_(this,"siblings");_(this,"name");_(this,"slots");_(this,"data",null);_(this,"fx",null);_(this,"content",null);_(this,"startMarker",null);_(this,"endMarker",null);_(this,"styleEls",[]);_(this,"ownsSharedStyles",!1);_(this,"useShadow",!1);_(this,"mountRoot",null);_(this,"resolveMounted",null);_(this,"emitListeners",new Map);let s=typeof n=="string"?Et(n):n;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=e.modules??(typeof n=="string"?void 0:n.modules),this.filename=e.filename??(typeof n=="string"?void 0:n.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),yn(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([n,e])=>{e.filename??(e.filename=this.filename),e.modules??(e.modules=this.modules),this.name||(this[n]=e)})}hotReplace(n){let e=typeof n=="string"?Et(n):n,s=this.startMarker,o=!!(s&&this.content),i=o&&s.isConnected,r=i?s.parentNode:null,a=i?this.endMarker.nextSibling:null,u={...this.data},p=this.useShadow;return o&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,this.siblings=e.siblings,this.adoptSiblings(),!o||(this.renderWith(u,p),!r)?!1:(p&&this.styleEls.forEach(d=>r.insertBefore(d,a)),r.insertBefore(this.content,a),this.mountRoot=r,this.resolveMounted?.(),!0)}static fetch(n){if(Array.isArray(n))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new St(wt(n))}static fetchAll(n){return Promise.all(n.map(wt))}on(n,e){return this.emitListeners.has(n)||this.emitListeners.set(n,new Set),this.emitListeners.get(n).add(e),this}off(n,e){return this.emitListeners.get(n)?.delete(e),this}render(n={}){return this.renderWith(n,!1)}renderShadow(n={}){return this.renderWith(n,!0)}renderWith(n,e){this.destroy();let s=fn(this.scripts),o=dn(this.siblings,s),i=o?Object.assign(Object.create(o),n):{...n},r=new Set([...s].filter(c=>!(c in n)));r.size&&Object.defineProperty(i,ae,{value:r}),this.slots&&Object.defineProperty(i,ee,{value:this.slots});let a=tt(i),u=k(a);this.data=a,this.fx=u,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let p=this.startMarker,d=(c,f)=>{let l=new CustomEvent(c,{detail:f,bubbles:!0,composed:!0,cancelable:!0});return p===this.startMarker&&this.emitListeners.get(c)?.forEach(T=>T(l,f)),l.cancelBubble||p.dispatchEvent(l),!l.defaultPrevented},m,E=new Promise(c=>{m=c});this.resolveMounted=m;let O=()=>E,x=this.endMarker,y=c=>{let f=[];for(let l=p.nextSibling;l&&l!==x;l=l.nextSibling)l instanceof Element&&(l.matches(c)&&f.push(l),f.push(...Array.from(l.querySelectorAll(c))));return f},S=c=>y(c)[0]??null,R=this.modules,A=c=>R&&c in R?Promise.resolve(R[c]):Ct(c),h=Object.assign(Object.create(null),{$emit:d,$slots:Object.fromEntries(Object.keys(this.slots??{}).map(c=>[c,!0]))}),g=c=>`await $mounted();${c}`;this.scripts.forEach((c,f)=>{let l={$mounted:O,$self:S,$$self:y,...h,...o},T={filename:this.filename,index:f},j=Ht(c.content);if(j!==null){Jt(a,yt(c.content));let v=":mounted"in c.attrs?g(j):j;hn(v,a,u.effect,l,A,T);return}let{vars:N,code:b}=rt(c.content);Jt(a,X(c.attrs[":setup"])),N.forEach(v=>{v in a||(a[v]=void 0)});let L=":mounted"in c.attrs?g(b):b;un(L,a,u.effect,l,A,T)});let $=document.createDocumentFragment(),w=new Proxy(a,{has:(c,f)=>typeof f=="string"&&f in h||Reflect.has(c,f),get:(c,f,l)=>typeof f=="string"&&f in h&&!Reflect.has(c,f)?h[f]:Reflect.get(c,f,l)});return $.append(this.startMarker,z(this.template,w,u,e),this.endMarker),this.content=$,e?this.styleEls=this.styles.map(c=>{let f=document.createElement("style");return f.textContent=c.content,f}):(this.styles.forEach(c=>ln(Xt(c))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?Z(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0)&&this.renderWith(e??{},this.useShadow),this.attach(s)}mountShadow(n,e){let s=typeof n=="string"?Z(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0||!this.useShadow)&&this.renderWith(e??{},!0),this.attach(s)}attach(n){this.mountRoot&&this.detach();let e=this.useShadow&&n instanceof Element?n.shadowRoot??n.attachShadow({mode:"open"}):n;return this.useShadow&&this.styleEls.forEach(s=>e.appendChild(s)),e.appendChild(this.content),this.mountRoot=e,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let n=this.startMarker;for(;n;){let e=n.nextSibling;if(this.content.appendChild(n),n===this.endMarker)break;n=e}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(n=>n.parentNode?.removeChild(n)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(n=>cn(Xt(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},St=class{constructor(n){_(this,"chain");this.chain=n}queue(n){return this.chain=this.chain.then(e=>(n(e),e)),this}then(n,e){return this.chain.then(n,e)}catch(n){return this.chain.catch(n)}finally(n){return this.chain.finally(n)}mount(n,e){return this.queue(s=>s.mount(n,e))}mountShadow(n,e){return this.queue(s=>s.mountShadow(n,e))}render(n={}){return this.queue(e=>e.render(n))}renderShadow(n={}){return this.queue(e=>e.renderShadow(n))}on(n,e){return this.queue(s=>s.on(n,e))}off(n,e){return this.queue(s=>s.off(n,e))}detach(){return this.queue(n=>n.detach())}destroy(){return this.queue(n=>n.destroy())}};var jn=t=>new F(t),le={$:Z,$$:ut,$create:ft,$reactive:tt,Component79:F};typeof globalThis<"u"&&globalThis[mn]&&En();export{Z as $,ut as $$,ft as $create,tt as $reactive,F as C79,F as Component79,St as PendingComponent79,En as enableHotReload,bn as hotUpdate,jn as parseComponent,An as renderComponent};
13
+ ;$__exports.done = true })()${ue(o.filename,o.index??0)}`)(l,$n,r,...Object.values(i)),p=b=>console.error("jq79: error in factory script",b),d=!1,g=()=>{if(d)return;d=!0;let b=l.default;if(typeof b!="function")return;let O=x=>{x&&typeof x=="object"&&Object.assign(n,x)};try{let x=b(n,{$data:n,$props:n,$effect:e,...s});x instanceof Promise?x.then(O).catch(p):O(x)}catch(x){p(x)}};u.then(g,p),l.done&&g()},xn="__JQ79_HMR_ENABLED__",Cn="__JQ79_HMR__",B=null,_n=t=>{if(!B||!t.filename)return;let n=B.get(t.filename);n||B.set(t.filename,n=new Set),n.add(new WeakRef(t))},ee=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},An=(t,n)=>{if(!B)return 0;let e=ee(t),s=wt(n),r=!1,o=l=>l.name===void 0?s:s.siblings?.[l.name]??null,i=0;for(let[l,u]of B)if(ee(l)===e){for(let p of u){let d=p.deref();if(!d){u.delete(p);continue}let g=o(d);if(!g){r=!0;continue}d.hotReplace(g)&&i++}u.size||B.delete(l)}return r?0:i},jn=()=>{B??(B=new Map),globalThis[Cn]={update:An}},Rt=async t=>{let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new F(await n.text(),{filename:t})},F=class{constructor(n,e={}){N(this,"template");N(this,"scripts");N(this,"styles");N(this,"modules");N(this,"filename");N(this,"siblings");N(this,"name");N(this,"slots");N(this,"data",null);N(this,"fx",null);N(this,"content",null);N(this,"startMarker",null);N(this,"endMarker",null);N(this,"styleEls",[]);N(this,"ownsSharedStyles",!1);N(this,"useShadow",!1);N(this,"mountRoot",null);N(this,"resolveMounted",null);N(this,"emitListeners",new Map);let s=typeof n=="string"?wt(n):n;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=e.modules??(typeof n=="string"?void 0:n.modules),this.filename=e.filename??(typeof n=="string"?void 0:n.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),_n(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([n,e])=>{e.filename??(e.filename=this.filename),e.modules??(e.modules=this.modules),this.name||(this[n]=e)})}hotReplace(n){let e=typeof n=="string"?wt(n):n,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,l=o?this.endMarker.nextSibling:null,u={...this.data},p=this.useShadow;return r&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,this.siblings=e.siblings,this.adoptSiblings(),!r||(this.renderWith(u,p),!i)?!1:(p&&this.styleEls.forEach(d=>i.insertBefore(d,l)),i.insertBefore(this.content,l),this.mountRoot=i,this.resolveMounted?.(),!0)}static fetch(n){if(Array.isArray(n))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new $t(Rt(n))}static fetchAll(n){return Promise.all(n.map(Rt))}on(n,e){return this.emitListeners.has(n)||this.emitListeners.set(n,new Set),this.emitListeners.get(n).add(e),this}off(n,e){return this.emitListeners.get(n)?.delete(e),this}render(n={}){return this.renderWith(n,!1)}renderShadow(n={}){return this.renderWith(n,!0)}renderWith(n,e){this.destroy();let s=Sn(this.scripts),r=Rn(this.siblings,s),o=r?Object.assign(Object.create(r),n):{...n},i=new Set([...s].filter(c=>!(c in n)));i.size&&Object.defineProperty(o,fe,{value:i}),this.slots&&Object.defineProperty(o,oe,{value:this.slots});let l=et(o),u=I(l);this.data=l,this.fx=u,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let p=this.startMarker,d=(c,f)=>{let a=new CustomEvent(c,{detail:f,bubbles:!0,composed:!0,cancelable:!0});return p===this.startMarker&&this.emitListeners.get(c)?.forEach(w=>w(a,f)),a.cancelBubble||p.dispatchEvent(a),!a.defaultPrevented},g,b=new Promise(c=>{g=c});this.resolveMounted=g;let O=()=>b,x=this.endMarker,y=c=>{let f=[];for(let a=p.nextSibling;a&&a!==x;a=a.nextSibling)a instanceof Element&&(a.matches(c)&&f.push(a),f.push(...Array.from(a.querySelectorAll(c))));return f},R=c=>y(c)[0]??null,$=this.modules,_=c=>$&&c in $?Promise.resolve($[c]):jt(c),h=Object.assign(Object.create(null),{$emit:d,$slots:Object.fromEntries(Object.keys(this.slots??{}).map(c=>[c,!0]))}),m=c=>`await $mounted();${c}`;this.scripts.forEach((c,f)=>{let a={$mounted:O,$self:R,$$self:y,...h,...r},w={filename:this.filename,index:f},A=Zt(c.content);if(A!==null){Yt(l,lt(c.content));let L=":mounted"in c.attrs?m(A):A;Tn(L,l,u.effect,a,_,w);return}let{vars:j,code:E}=it(c.content);Yt(l,Z(c.attrs[":setup"])),j.forEach(L=>{L in l||(l[L]=void 0)});let v=":mounted"in c.attrs?m(E):E;En(v,l,u.effect,a,_,w)});let T=document.createDocumentFragment(),S=new Proxy(l,{has:(c,f)=>typeof f=="string"&&f in h||Reflect.has(c,f),get:(c,f,a)=>typeof f=="string"&&f in h&&!Reflect.has(c,f)?h[f]:Reflect.get(c,f,a)});return T.append(this.startMarker,G(this.template,S,u,e),this.endMarker),this.content=T,e?this.styleEls=this.styles.map(c=>{let f=document.createElement("style");return f.textContent=c.content,f}):(this.styles.forEach(c=>yn(Qt(c))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?K(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0)&&this.renderWith(e??{},this.useShadow),this.attach(s)}mountShadow(n,e){let s=typeof n=="string"?K(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0||!this.useShadow)&&this.renderWith(e??{},!0),this.attach(s)}attach(n){this.mountRoot&&this.detach();let e=this.useShadow&&n instanceof Element?n.shadowRoot??n.attachShadow({mode:"open"}):n;return this.useShadow&&this.styleEls.forEach(s=>e.appendChild(s)),e.appendChild(this.content),this.mountRoot=e,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let n=this.startMarker;for(;n;){let e=n.nextSibling;if(this.content.appendChild(n),n===this.endMarker)break;n=e}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(n=>n.parentNode?.removeChild(n)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(n=>bn(Qt(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};N(F,"version",Me);var $t=class{constructor(n){N(this,"chain");this.chain=n}queue(n){return this.chain=this.chain.then(e=>(n(e),e)),this}then(n,e){return this.chain.then(n,e)}catch(n){return this.chain.catch(n)}finally(n){return this.chain.finally(n)}mount(n,e){return this.queue(s=>s.mount(n,e))}mountShadow(n,e){return this.queue(s=>s.mountShadow(n,e))}render(n={}){return this.queue(e=>e.render(n))}renderShadow(n={}){return this.queue(e=>e.renderShadow(n))}on(n,e){return this.queue(s=>s.on(n,e))}off(n,e){return this.queue(s=>s.off(n,e))}detach(){return this.queue(n=>n.detach())}destroy(){return this.queue(n=>n.destroy())}};var Wn=t=>new F(t),de={$:K,$$:dt,$create:pt,$reactive:et,Component79:F};typeof globalThis<"u"&&globalThis[xn]&&jn();export{K as $,dt as $$,pt as $create,et as $reactive,F as C79,F as Component79,$t as PendingComponent79,jn as enableHotReload,An as hotUpdate,Wn as parseComponent,qn as renderComponent};
14
14
  //# sourceMappingURL=jq79.js.map