jq79 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dom.d.ts CHANGED
@@ -4,4 +4,9 @@ export declare function $$(selector: string): Element[];
4
4
  export declare function $$(el: Element, selector: string): Element[];
5
5
  export declare const $create: (tag: string, attrs?: Record<string, any>) => HTMLElement;
6
6
  export declare function isSafeUrl(value: string): boolean;
7
- export declare function sanitizeHTML(html: string): string;
7
+ export type AllowUrl = (url: URL, tag: string, attr: string) => boolean;
8
+ export type SanitizeOptions = {
9
+ allowUrl?: AllowUrl;
10
+ };
11
+ export declare const allowedHosts: (patterns: string | string[]) => AllowUrl;
12
+ export declare function sanitizeHTML(html: string, options?: SanitizeOptions): string;
package/dist/jq79.cjs CHANGED
@@ -1,12 +1,12 @@
1
- var z=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var ze=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ge=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},Ke=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qe(t))!He.call(e,r)&&r!==n&&z(e,r,{get:()=>t[r],enumerable:!(s=Ue(t,r))||s.enumerable});return e};var Ze=e=>Ke(z({},"__esModule",{value:!0}),e);var T=(e,t,n)=>ze(e,typeof t!="symbol"?t+"":t,n);var Ft={};Ge(Ft,{$:()=>I,$$:()=>G,$create:()=>K,$reactive:()=>q,Component79:()=>F,enableHotReload:()=>We,hotUpdate:()=>Ie,parseComponent:()=>kt,renderComponent:()=>wt});module.exports=Ze(Ft);function I(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function G(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var K=(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},Je=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),ue={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Ve=new Set(["http:","https:","mailto:"]);function Xe(e){try{let t=new URL(e,"https://example.com");return Ve.has(t.protocol)}catch{return!1}}function de(e,t){for(let n of Array.from(e.childNodes))if(n.nodeType===Node.ELEMENT_NODE){let s=Qe(n);s&&t.appendChild(s)}else n.nodeType===Node.TEXT_NODE&&t.appendChild(n.cloneNode())}function Qe(e){let t=e.tagName.toLowerCase();if(!Je.has(t))return null;let n=document.createElement(t);for(let s of Array.from(e.attributes)){let r=s.name.toLowerCase(),o=ue[t]?.has(r),i=ue["*"]?.has(r);!o&&!i||(r==="href"||r==="src")&&!Xe(s.value)||n.setAttribute(r,s.value)}return t==="a"&&n.setAttribute("rel","noopener noreferrer"),de(e,n),n}function pe(e){let t=new DOMParser().parseFromString(e,"text/html"),n=document.createElement("div");return de(t.body,n),n.innerHTML}var Ye=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),he=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},me=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&he(r)?me(r,o,n):n(o,r)})},et=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),ee=Symbol("jq79.raw"),Z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[ee];)t=t[ee];return t},ge=Symbol("jq79.store"),U=e=>e!==null&&typeof e=="object"&&e[ge]===!0,W=[],te=e=>{W.push(new Set);try{return e()}finally{W.pop()}},q=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(a,u,m=!1)=>{t.get(a)?.forEach(S=>S(u,a)),n.forEach(S=>S(a,u)),s.forEach(S=>{(m||Array.from(S.deps).some(x=>et(x,a)))&&S.run()})},c=a=>a!==null&&typeof a=="object"&&he(a),l=new Map,d=(a,u)=>{let m=l.get(u);m?.store!==a&&(m?.unsubscribe(),l.set(u,{store:a,unsubscribe:a.$onAny((S,x)=>i(`${u}.${S}`,x))}))},f=a=>{l.get(a)?.unsubscribe(),l.delete(a)},p=(a,u)=>{let m=r.get(a);if(m)return m;let S=null,x=new Proxy(a,{has(R,g){return Reflect.has(R,g)||typeof g=="string"&&S?.has(g)===!0},get(R,g,b){if(g===ee)return R;if(g===ge)return u==="";if(typeof g!="string")return Reflect.get(R,g,b);if(u===""&&g in o)return o[g];let w=u?`${u}.${g}`:g;W[W.length-1]?.add(w);let C=Reflect.get(R,g,b);if(U(C))return d(C,w),C;let $=Z(C);return c($)?p($,w):$},set(R,g,b,w){if(w!==x&&!Object.prototype.hasOwnProperty.call(R,g))return Reflect.set(R,g,b,w);let C=u?`${u}.${g}`:g,$=U(b)?b:Z(b),P=!Object.prototype.hasOwnProperty.call(R,g);if(!P&&Object.is(R[g],$)&&($===null||typeof $!="object"))return!0;R[g]=$,S?.delete(g),U($)?d($,C):f(C);let _=U($)||!c($)?$:p($,C);return i(C,_,P),!0},deleteProperty(R,g){if(typeof g!="string")return Reflect.deleteProperty(R,g);let b=Object.prototype.hasOwnProperty.call(R,g),w=Reflect.deleteProperty(R,g);if(w&&b){let C=u?`${u}.${g}`:g;(S??(S=new Set)).add(g),f(C),i(C,void 0)}return w}});return r.set(a,x),x},h=p(Z(e),"");Object.entries(Z(e)).forEach(([a,u])=>{U(u)&&d(u,a)});let y=(a,u,{immediate:m=!1}={})=>(t.has(a)||t.set(a,new Set),t.get(a).add(u),m&&u(Ye(h,a),a),()=>t.get(a)?.delete(u)),E=(a,{immediate:u=!1}={})=>(n.add(a),u&&me(h,"",(m,S)=>a(m,S)),()=>n.delete(a)),v=a=>{let u=!1,m=!1,S={deps:new Set,run:()=>{if(u){m=!0;return}u=!0;try{let x=0;do{m=!1;let R=new Set;W.push(R);try{a()}finally{W.pop(),S.deps=R}}while(m&&++x<100);m&&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}}};return s.add(S),S.run(),()=>{s.delete(S)}},L=()=>{l.forEach(({unsubscribe:a})=>a()),l.clear()};return o.$on=y,o.$onAny=E,o.$effect=v,o.$dispose=L,h},B=e=>{let t=[],n=[];return{effect:s=>{t.push(e.$effect(s)),n.push(s)},onDispose:s=>{t.push(s)},refresh:()=>{n.forEach(s=>s())},dispose:()=>{t.splice(0).forEach(s=>s()),n.length=0}}};var ye=/(?:let|var|const)\s+([A-Za-z_$][\w$]*)/y,Ee=/\$:\s*/y,V=/import(?=\s*\()/y,be=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,j=(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},O=(e,t)=>{let n=e.indexOf(`
2
- `,t);return n===-1?e.length:n},A=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},J=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=O(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=A(e,n);continue}break}return n},tt=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),M=(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 tt.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},D=(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},nt=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,st=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=j(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=O(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=A(e,s);continue}if(r==="/"&&M(e,s)){s=D(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=J(e,s+1);if(o>=e.length||!nt.test(e.slice(o,o+2)))return s;s=o;continue}}s++}return e.length},ne=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],c=e[s+1];if(i==="'"||i==='"'||i==="`"){let l=j(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(c==="/"||c==="*")){let l=c==="/"?O(e,s):A(e,s);n+=e.slice(s,l),s=l;continue}if(i==="/"&&M(e,s)){let l=D(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(V.lastIndex=s,V.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){ye.lastIndex=s;let l=ye.exec(e);if(l){t.push(l[1]),n+=l[1],s+=l[0].length,o=!1;continue}Ee.lastIndex=s;let d=Ee.exec(e);if(d){be.lastIndex=s;let f=be.exec(e);f&&t.push(f[1]);let p=s+d[0].length,h=st(e,p);n+=`$__effect(() => { ${ne(e.slice(p,h)).code} });`,s=h;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}},X=/export\s+default(?![\w$])/y,Se=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,rt=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},ot=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=rt(e),o=[],i=s;if(r.length>1){let c=`$__mod${n}`;o.push(`${c} = ${s}`),i=c}for(let c of r)c.startsWith("{")?o.push(`${c.replace(/\s+as\s+/g,": ")} = ${i}`):c.startsWith("*")?o.push(`${c.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${c} = $__default(${i})`);return`const ${o.join(", ")}`},it=/^[A-Za-z_$][\w$]*$/,we=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=j(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=O(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=A(e,s);continue}if(r==="/"&&r!==t&&M(e,s)){s=D(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},Re=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=j(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=O(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=A(e,r);continue}if(o==="/"&&M(e,r)){r=D(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},ct=e=>{let t=0;for(;t<e.length;){let n=we(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},se=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=j(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=O(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=A(t,s);continue}if(o==="/"&&M(t,s)){s=D(t,s);continue}if("([{".includes(o))n++;else if(")]}".includes(o)&&--n===0)break;s++}if(s>=t.length)return null;let r=[];for(let o of Re(t.slice(1,s))){if(o.startsWith("..."))continue;let i=ct(o),c=i===-1?o:o.slice(0,i),l=i===-1?void 0:o.slice(i+1).trim(),d=we(c,":"),f=(d===-1?c:c.slice(0,d)).trim();it.test(f)&&r.push(l===void 0?{name:f}:{name:f,default:l})}return r},at=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=j(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=O(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=A(e,t);continue}if(r==="/"&&M(e,t)){t=D(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){X.lastIndex=t;let o=X.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},lt=/^async(?![\w$])/,ft=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,ut=e=>{let t=at(e);if(t===-1)return null;let n=J(e,t),s=e.slice(n);lt.test(s)&&(n=J(e,n+5));let r=ft.exec(e.slice(n));if(r&&(n=J(e,n+r[0].length)),e[n]!=="(")return null;let o=0,i=n;for(;i<e.length;){let c=e[i];if(c==="'"||c==='"'||c==="`"){i=j(e,i);continue}if(c==="/"&&e[i+1]==="/"){i=O(e,i);continue}if(c==="/"&&e[i+1]==="*"){i=A(e,i);continue}if(c==="/"&&M(e,i)){i=D(e,i);continue}if("([{".includes(c))o++;else if(")]}".includes(c)&&--o===0)break;i++}return Re(e.slice(n+1,i))[0]??""},$e=e=>{let t=ut(e);if(t===null)return null;let n=se(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},xe=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let c=e[n],l=e[n+1],d=n===0||!/[\w$.]/.test(e[n-1]);if(c==="'"||c==='"'||c==="`"){let f=j(e,n);t+=e.slice(n,f),n=f,r=!1;continue}if(c==="/"&&(l==="/"||l==="*")){let f=l==="/"?O(e,n):A(e,n);t+=e.slice(n,f),n=f;continue}if(c==="/"&&M(e,n)){let f=D(e,n);t+=e.slice(n,f),n=f,r=!1;continue}if(c==="i"&&d){if(V.lastIndex=n,V.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){Se.lastIndex=n;let f=Se.exec(e);if(f){t+=ot(f[1],f[3],i++),n+=f[0].length,r=!1;continue}}}if(c==="e"&&d&&s===0&&r){X.lastIndex=n;let f=X.exec(e);if(f){o=!0,t+="$__exports.default =",n+=f[0].length,r=!1;continue}}"([{".includes(c)?s++:")]}".includes(c)&&(s=Math.max(0,s-1)),c===`
7
- `||c===";"||c==="}"?r=!0:/\s/.test(c)||(r=!1),t+=c,n++}return o?t:null};var Ae=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),je=e=>({tag:e.tagName.toLowerCase(),attrs:Ae(e),children:Array.from(e.childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[je(t)]:[]})}),Te=new Map,dt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=Te.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}); }`)}catch{s=null}Te.set(n,s)}return s},N=(e,t,n)=>{let s=dt(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch{return}},pt=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>N(s,t)??""),Me=new Set([":attrs",":if",":elseif",":else",":each",":key",":with",":text",":html"]),ht=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,mt=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,c=>{if(i.has("self")&&c.target!==e)return;i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation();let l=N(n,s,{$event:c});typeof l=="function"&&l.call(e,c)},{once:i.has("once"),capture:i.has("capture")})},Ce=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),oe=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},Q=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},gt=({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}},Ne=(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},_e=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),c=document.createDocumentFragment();c.append(o,i);let l={};Object.entries(t.attrs).forEach(([h,y])=>{if(!(h===ae||Me.has(h)||h.startsWith("@")))if(h.startsWith(":")){let E=Ce(h.slice(1));l[E]=y||E}else l[Ce(h)]=JSON.stringify(y)});let d=null,f=null,p=null;return s.effect(()=>{let h=N(e,n),y=h instanceof F?h:null;if(y===f||(p?.dispose(),p=null,d?.destroy(),d=null,f=y,!y))return;let E=new F({template:y.template,scripts:y.scripts,styles:y.styles,modules:y.modules,filename:y.filename}),v=te(()=>Object.fromEntries(Object.entries(l).map(([u,m])=>[u,N(m,n)]))),L=document.createDocumentFragment();(r?E.renderShadow(v):E.render(v)).mount(L),i.parentNode.insertBefore(L,i);let a=B(n);Object.entries(l).forEach(([u,m])=>{a.effect(()=>{E.data[u]=N(m,n)})}),p=a,d=E}),s.onDispose(()=>{p?.dispose(),d?.destroy()}),c},yt=(e,t)=>{let n=()=>{let s=N(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)}})},ie=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?yt(r,t):t,i=Ne(o,e.tag);if(i)return _e(i,e,o,n,s);let c=document.createElement(e.tag);if(c instanceof HTMLUnknownElement||e.tag.includes("-")){let p=!1;n.effect(()=>{if(p)return;let h=Ne(o,e.tag);if(!h)return;p=!0;let y=_e(h,e,o,n,s),E=oe(y);n.onDispose(()=>Q(E)),c.replaceWith(y)})}Object.entries(e.attrs).forEach(([p,h])=>{p.startsWith("@")?mt(c,p,h,o):Me.has(p)||c.setAttribute(p,h)});let l=e.attrs[":attrs"];if(l!==void 0){let p=[];n.effect(()=>{p.forEach(y=>c.removeAttribute(y));let h=N(l,o);p=h&&typeof h=="object"?Object.keys(h):[],p.forEach(y=>{let E=h[y];E!=null&&E!==!1&&c.setAttribute(y,String(E))})})}let d=e.attrs[":text"],f=e.attrs[":html"];return d!==void 0?n.effect(()=>{c.textContent=String(N(d,o)??"")}):f!==void 0?n.effect(()=>{c.innerHTML=pe(String(N(f,o)??""))}):c.appendChild(ce(e.children,o,n,s)),c},Et=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,c=null,l=null;return n.effect(()=>{let d=e.find(p=>p.expr===void 0||N(p.expr,t))??null;if(d===c||(l?.dispose(),i&&Q(i),i=null,c=d,!d))return;l=B(t);let f=ie(d.node,t,l,s);i=oe(f),r.parentNode.insertBefore(f,r.nextSibling)}),o},H=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},bt=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},St=(e,t,n,s)=>{let r=e.attrs[":each"].match(ht);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,c]=r,l=e.attrs[":key"],{[":each"]:d,[":key"]:f,...p}=e.attrs,h={...e,attrs:p},y=document.createComment("each"),E=document.createDocumentFragment();E.appendChild(y),(":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=[],L=!1;return n.effect(()=>{let a=N(c,t),u=Array.isArray(a)?a.map((b,w)=>[w,b]):bt(a)?Object.entries(a):[],m=new Map;v.forEach(b=>{let w=m.get(b.key);w?w.push(b):m.set(b.key,[b])});let S=new Set,x=[],R=u.map(([b,w],C)=>{let $=Object.create(t);H($,o,w),i&&H($,i,b),H($,"$index",C);let P=l!==void 0?N(l,$):b;S.has(P)&&!L&&(L=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),S.add(P);let _=m.get(P)?.shift();if(_&&Object.is(_.item,w))return _.scope.$index!==C&&x.push(_),H(_.scope,"$index",C),i&&H(_.scope,i,b),_;_&&(_.fx.dispose(),Q(_.range));let fe=B(t),Be=oe(ie(h,$,fe,s));return{key:P,item:w,scope:$,fx:fe,range:Be}});m.forEach(b=>b.forEach(w=>{w.fx.dispose(),Q(w.range)}));let g=y;R.forEach(b=>{g.nextSibling!==b.range.first&&gt(b.range,g),g=b.range.last}),x.forEach(b=>te(()=>b.fx.refresh())),v=R}),E},ce=(e,t,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<e.length;){let i=e[o];if(typeof i=="string"){let c=document.createTextNode(i);i.includes("{{")&&n.effect(()=>{c.textContent=pt(i,t)}),r.appendChild(c),o++;continue}if(":each"in i.attrs){r.appendChild(St(i,t,n,s)),o++;continue}if(":if"in i.attrs){let c=[{expr:i.attrs[":if"],node:i}];o++;let l=f=>{let p=o;for(;p<e.length&&typeof e[p]=="string"&&!e[p].trim();)p++;let h=e[p];if(typeof h=="object"&&f in h.attrs)return o=p+1,h};for(let f=l(":elseif");f;f=l(":elseif"))c.push({expr:f.attrs[":elseif"],node:f});let d=l(":else");d&&c.push({node:d}),r.appendChild(Et(c,t,n,s));continue}r.appendChild(ie(i,t,n,s)),o++}return r},wt=(e,t,n=!1)=>ce(e.template,t,B(t),n),Rt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$t=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,xt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Tt=e=>e.split(xt).map((t,n)=>n%2===1?t:t.replace($t,(s,r,o)=>Rt.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),ae="data-jq79",Ct=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)},De=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ae]=t,De(n.children,t))})},Nt=(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}[${ae}="${t}"]${i}`}).join(", "),Pe=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Nt(n.selectorText,t):n instanceof CSSGroupingRule&&Pe(n.cssRules,t)})},_t=(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),Pe(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
8
- `)},re=e=>{let n=new DOMParser().parseFromString(`<template>${Tt(e)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];Array.from(n.content.children).forEach(c=>{let l={attrs:Ae(c),content:c.textContent??""};c.tagName==="SCRIPT"?s.push(l):c.tagName==="STYLE"?r.push(l):o.push(je(c))}),r.forEach(c=>{"lang"in c.attrs&&console.warn(`jq79: <style lang="${c.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=c=>"scoped"in c.attrs&&!("lang"in c.attrs);if(r.some(i)){let c=Ct(e);De(o,c),r.forEach(l=>{i(l)&&(l.scoped=_t(l.content,c))})}return{template:o,scripts:s,styles:r}},le=e=>/\.html?([?#]|$)/.test(e)?F.fetch(e):import(e),ke=(e,t)=>e?`
9
- //# sourceURL=${e}?jq79-script=${t}`:"",ve=e=>e.scoped??e.content,Y=new Map,vt=e=>{let t=Y.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},Y.set(e,t)}t.count++},Lt=e=>{let t=Y.get(e);t&&--t.count<=0&&(t.el.remove(),Y.delete(e))},Fe={$:I,$$:G,$create:K,$reactive:q},Ot=(e,t,n,s={},r=le,o={})=>{let i={...Fe,...s},c=new Proxy(t,{has:(d,f)=>f!=="$__effect"&&f!=="$__import"&&(Reflect.has(d,f)||!(f in globalThis)&&!(f in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${e} } })()${ke(o.filename,o.index??0)}`)(c,n,r,...Object.values(i)).catch(d=>console.error("jq79: error in :setup script",d))},Le=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:N(s,e))})},At=e=>e&&e.default!==void 0?e.default:e,jt=(e,t,n,s={},r=le,o={})=>{let i={...Fe,...s},c={},l=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
10
- ${e}
11
- ;$__exports.done = true })()${ke(o.filename,o.index??0)}`)(c,At,r,...Object.values(i)),d=h=>console.error("jq79: error in factory script",h),f=!1,p=()=>{if(f)return;f=!0;let h=c.default;if(typeof h!="function")return;let y=E=>{E&&typeof E=="object"&&Object.assign(t,E)};try{let E=h(t,{$data:t,$props:t,$effect:n,...s});E instanceof Promise?E.then(y).catch(d):y(E)}catch(E){d(E)}};l.then(p,d),c.done&&p()},Mt="__JQ79_HMR_ENABLED__",Dt="__JQ79_HMR__",k=null,Pt=e=>{if(!k||!e.filename)return;let t=k.get(e.filename);t||k.set(e.filename,t=new Set),t.add(new WeakRef(e))},Oe=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},Ie=(e,t)=>{if(!k)return 0;let n=Oe(e),s=re(t),r=0;for(let[o,i]of k)if(Oe(o)===n){for(let c of i){let l=c.deref();if(!l){i.delete(c);continue}l.hotReplace(s)&&r++}i.size||k.delete(o)}return r},We=()=>{k??(k=new Map),globalThis[Dt]={update:Ie}},F=class e{constructor(t,n={}){T(this,"template");T(this,"scripts");T(this,"styles");T(this,"modules");T(this,"filename");T(this,"data",null);T(this,"fx",null);T(this,"content",null);T(this,"startMarker",null);T(this,"endMarker",null);T(this,"styleEls",[]);T(this,"ownsSharedStyles",!1);T(this,"useShadow",!1);T(this,"mountRoot",null);T(this,"resolveMounted",null);T(this,"emitListeners",new Map);let s=typeof t=="string"?re(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),Pt(this)}hotReplace(t){let n=typeof t=="string"?re(t):t,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,c=o?this.endMarker.nextSibling:null,l={...this.data},d=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,!r||(this.renderWith(l,d),!i)?!1:(d&&this.styleEls.forEach(f=>i.insertBefore(f,c)),i.insertBefore(this.content,c),this.mountRoot=i,this.resolveMounted?.(),!0)}static async fetch(t){let n=await fetch(t);if(!n.ok)throw new Error(`failed to fetch component from ${t}: ${n.status}`);return new e(await n.text(),{filename:t})}on(t,n){return this.emitListeners.has(t)||this.emitListeners.set(t,new Set),this.emitListeners.get(t).add(n),this}off(t,n){return this.emitListeners.get(t)?.delete(n),this}render(t={}){return this.renderWith(t,!1)}renderShadow(t={}){return this.renderWith(t,!0)}renderWith(t,n){this.destroy();let s=q({...t}),r=B(s);this.data=s,this.fx=r,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,i=(a,u)=>{let m=new CustomEvent(a,{detail:u,bubbles:!0,composed:!0}),S=o.dispatchEvent(m);return o===this.startMarker&&this.emitListeners.get(a)?.forEach(x=>x(m,u)),S},c,l=new Promise(a=>{c=a});this.resolveMounted=c;let d=()=>l,f=this.endMarker,p=a=>{let u=[];for(let m=o.nextSibling;m&&m!==f;m=m.nextSibling)m instanceof Element&&(m.matches(a)&&u.push(m),u.push(...Array.from(m.querySelectorAll(a))));return u},h=a=>p(a)[0]??null,y=this.modules,E=a=>y&&a in y?Promise.resolve(y[a]):le(a),v=a=>`await $mounted();${a}`;this.scripts.forEach((a,u)=>{let m={$emit:i,$mounted:d,$self:h,$$self:p},S={filename:this.filename,index:u},x=xe(a.content);if(x!==null){Le(s,$e(a.content));let w=":mounted"in a.attrs?v(x):x;jt(w,s,r.effect,m,E,S);return}let{vars:R,code:g}=ne(a.content);Le(s,se(a.attrs[":setup"])),R.forEach(w=>{w in s||(s[w]=void 0)});let b=":mounted"in a.attrs?v(g):g;Ot(b,s,r.effect,m,E,S)});let L=document.createDocumentFragment();return L.append(this.startMarker,ce(this.template,s,r,n),this.endMarker),this.content=L,n?this.styleEls=this.styles.map(a=>{let u=document.createElement("style");return u.textContent=a.content,u}):(this.styles.forEach(a=>vt(ve(a))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?I(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"?I(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.resolveMounted?.(),this}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=>Lt(ve(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},kt=e=>new F(e);typeof globalThis<"u"&&globalThis[Mt]&&We();0&&(module.exports={$,$$,$create,$reactive,Component79,enableHotReload,hotUpdate,parseComponent,renderComponent});
1
+ var z=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Qt=Object.prototype.hasOwnProperty;var Yt=(t,n,e)=>n in t?z(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var te=(t,n)=>{for(var e in n)z(t,e,{get:n[e],enumerable:!0})},ee=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Vt(n))!Qt.call(t,r)&&r!==e&&z(t,r,{get:()=>n[r],enumerable:!(s=Jt(n,r))||s.enumerable});return t};var ne=t=>ee(z({},"__esModule",{value:!0}),t);var A=(t,n,e)=>Yt(t,typeof n!="symbol"?n+"":n,e);var Je={};te(Je,{$:()=>U,$$:()=>G,$create:()=>Z,$reactive:()=>B,Component79:()=>F,enableHotReload:()=>Kt,hotUpdate:()=>Zt,parseComponent:()=>Xe,renderComponent:()=>je});module.exports=ne(Je);function U(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function G(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var Z=(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},se=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),yt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},re=new Set(["http:","https:","mailto:"]);function oe(t){try{let n=new URL(t,"https://example.com");return re.has(n.protocol)}catch{return!1}}var ie={"https:":"443","http:":"80"};function le(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 bt=t=>{let n=(Array.isArray(t)?t:t.split(",")).map(le).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),r=e.port||ie[e.protocol]||"";return n.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function ce(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var Et=512;function wt(t,n,e,s){if(e>Et)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Et} elements`);for(let r of Array.from(t.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=ae(r,e,s);o&&n.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&n.appendChild(r.cloneNode())}function ae(t,n,e){let s=t.tagName.toLowerCase();if(!se.has(s))return null;let r=document.createElement(s);for(let o of Array.from(t.attributes)){let i=o.name.toLowerCase(),l=yt[s]?.has(i),a=yt["*"]?.has(i);!l&&!a||(i==="href"||i==="src")&&(!oe(o.value)||e&&!ce(e,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),wt(t,r,n+1,e),r}function St(t,n){let e=new DOMParser().parseFromString(t,"text/html"),s=document.createElement("div");return wt(e.body,s,0,n?.allowUrl),s.innerHTML}var fe=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),Rt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},$t=(t,n,e)=>{Object.entries(t).forEach(([s,r])=>{let o=n?`${n}.${s}`:s;r&&typeof r=="object"&&Rt(r)?$t(r,o,e):e(o,r)})},ue=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),nt=Symbol("jq79.raw"),K=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[nt];)n=n[nt];return n},xt=Symbol("jq79.store"),H=t=>t!==null&&typeof t=="object"&&t[xt]===!0,I=[],st=t=>{I.push(new Set);try{return t()}finally{I.pop()}},B=t=>{let n=new Map,e=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(c,d,m=!1)=>{n.get(c)?.forEach(S=>S(d,c)),e.forEach(S=>S(c,d)),s.forEach(S=>{(m||Array.from(S.deps).some(C=>ue(C,c)))&&S.run()})},l=c=>c!==null&&typeof c=="object"&&Rt(c),a=new Map,p=(c,d)=>{let m=a.get(d);m?.store!==c&&(m?.unsubscribe(),a.set(d,{store:c,unsubscribe:c.$onAny((S,C)=>i(`${d}.${S}`,C))}))},f=c=>{a.get(c)?.unsubscribe(),a.delete(c)},h=(c,d)=>{let m=r.get(c);if(m)return m;let S=null,C=new Proxy(c,{has(x,y){return Reflect.has(x,y)||typeof y=="string"&&S?.has(y)===!0},get(x,y,b){if(y===nt)return x;if(y===xt)return d==="";if(typeof y!="string")return Reflect.get(x,y,b);if(d===""&&y in o)return o[y];let R=d?`${d}.${y}`:y;I[I.length-1]?.add(R);let _=Reflect.get(x,y,b);if(H(_))return p(_,R),_;let T=K(_);return l(T)?h(T,R):T},set(x,y,b,R){if(R!==C&&!Object.prototype.hasOwnProperty.call(x,y))return Reflect.set(x,y,b,R);let _=d?`${d}.${y}`:y,T=H(b)?b:K(b),P=!Object.prototype.hasOwnProperty.call(x,y);if(!P&&Object.is(x[y],T)&&(T===null||typeof T!="object"))return!0;x[y]=T,S?.delete(y),H(T)?p(T,_):f(_);let L=H(T)||!l(T)?T:h(T,_);return i(_,L,P),!0},deleteProperty(x,y){if(typeof y!="string")return Reflect.deleteProperty(x,y);let b=Object.prototype.hasOwnProperty.call(x,y),R=Reflect.deleteProperty(x,y);if(R&&b){let _=d?`${d}.${y}`:y;(S??(S=new Set)).add(y),f(_),i(_,void 0)}return R}});return r.set(c,C),C},g=h(K(t),"");Object.entries(K(t)).forEach(([c,d])=>{H(d)&&p(d,c)});let E=(c,d,{immediate:m=!1}={})=>(n.has(c)||n.set(c,new Set),n.get(c).add(d),m&&d(fe(g,c),c),()=>n.get(c)?.delete(d)),u=(c,{immediate:d=!1}={})=>(e.add(c),d&&$t(g,"",(m,S)=>c(m,S)),()=>e.delete(c)),w=c=>{let d=!1,m=!1,S={deps:new Set,run:()=>{if(d){m=!0;return}d=!0;try{let C=0;do{m=!1;let x=new Set;I.push(x);try{c()}finally{I.pop(),S.deps=x}}while(m&&++C<100);m&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{d=!1}}};return s.add(S),S.run(),()=>{s.delete(S)}},$=()=>{a.forEach(({unsubscribe:c})=>c()),a.clear()};return o.$on=E,o.$onAny=u,o.$effect=w,o.$dispose=$,g},W=t=>{let n=[],e=[];return{effect:s=>{n.push(t.$effect(s)),e.push(s)},onDispose:s=>{n.push(s)},refresh:()=>{e.forEach(s=>s())},dispose:()=>{n.splice(0).forEach(s=>s()),e.length=0}}};var Tt=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Ct=/\$:\s*/y,J=/import(?=\s*\()/y,At=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,j=(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},v=(t,n)=>{let e=t.indexOf(`
2
+ `,n);return e===-1?t.length:e},O=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},X=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=v(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=O(t,e);continue}break}return e},de=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),M=(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 de.has(t.slice(r,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},D=(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},pe=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,he=(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""},Nt=(t,n)=>{let e=0,s=n;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=j(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=v(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(r==="/"&&M(t,s)){s=D(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=X(t,s+1);if(!(o<t.length&&(pe.test(t.slice(o,o+2))||[",","="].includes(he(t,s)))))return s;s=o;continue}}s++}return t.length},me=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=j(t,i),r=i;continue}if(l==="/"&&t[i+1]==="/"){i=v(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&M(t,i)){i=D(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},rt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return ot.test(n)?[n]:[];let e=[];for(let s of lt(n.slice(1,Lt(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=ct(s);if(r!==-1&&(s=s.slice(0,r).trim()),n.startsWith("{")){let o=it(s,":");if(o!==-1){e.push(...rt(s.slice(o+1)));continue}}e.push(...rt(s))}return e},ge=t=>{let n=[],e=me(t).map(({raw:o,codeEnd:i})=>{let l=o.match(/^\s*/)[0];if(i<=l.length)return{text:o,empty:!0};let a=o.slice(l.length,i),p=o.slice(i),f=ct(a),h=(f===-1?a:a.slice(0,f)).trim(),g=a[0]==="{"||a[0]==="[";g?n.push(...rt(h)):ot.test(h)&&n.push(h);let E=Q(a).code;return{text:`${l}${g?`(${E})`:E}${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}},Q=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 a=j(t,s);e+=t.slice(s,a),s=a,o=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let a=l==="/"?v(t,s):O(t,s);e+=t.slice(s,a),s=a;continue}if(i==="/"&&M(t,s)){let a=D(t,s);e+=t.slice(s,a),s=a,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(J.lastIndex=s,J.test(t))){e+="$__import",s+=6,o=!1;continue}if(r===0&&o){Tt.lastIndex=s;let a=Tt.exec(t);if(a){let f=s+a[0].length,h=Nt(t,f),{vars:g,code:E}=ge(t.slice(f,h));n.push(...g),e+=E,s=h,o=!1;continue}Ct.lastIndex=s;let p=Ct.exec(t);if(p){At.lastIndex=s;let f=At.exec(t);f&&n.push(f[1]);let h=s+p[0].length,g=Nt(t,h);e+=`$__effect(() => { ${Q(t.slice(h,g)).code} });`,s=g;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}},V=/export\s+default(?![\w$])/y,_t=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,ye=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},Ee=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let r=ye(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$]*$/,Lt=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=j(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=v(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=O(t,e);continue}if(s==="/"&&M(t,e)){e=D(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},it=(t,n)=>{let e=0,s=0;for(;s<t.length;){let r=t[s];if(r==="'"||r==='"'||r==="`"){s=j(t,s);continue}if(r==="/"&&t[s+1]==="/"){s=v(t,s);continue}if(r==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(r==="/"&&r!==n&&M(t,s)){s=D(t,s);continue}if("([{".includes(r))e++;else if(")]}".includes(r))e--;else if(e===0&&r===n)return s;s++}return-1},lt=t=>{let n=[],e=0,s=0,r=0;for(;r<=t.length;){let o=t[r];if(o==="'"||o==='"'||o==="`"){r=j(t,r);continue}if(o==="/"&&t[r+1]==="/"){r=v(t,r);continue}if(o==="/"&&t[r+1]==="*"){r=O(t,r);continue}if(o==="/"&&M(t,r)){r=D(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},ct=t=>{let n=0;for(;n<t.length;){let e=it(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},at=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=Lt(n);if(e>=n.length)return null;let s=[];for(let r of lt(n.slice(1,e))){if(r.startsWith("..."))continue;let o=ct(r),i=o===-1?r:r.slice(0,o),l=o===-1?void 0:r.slice(o+1).trim(),a=it(i,":"),p=(a===-1?i:i.slice(0,a)).trim();ot.test(p)&&s.push(l===void 0?{name:p}:{name:p,default:l})}return s},be=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let r=t[n];if(r==="'"||r==='"'||r==="`"){n=j(t,n),s=!1;continue}if(r==="/"&&t[n+1]==="/"){n=v(t,n);continue}if(r==="/"&&t[n+1]==="*"){n=O(t,n);continue}if(r==="/"&&M(t,n)){n=D(t,n),s=!1;continue}if(r==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){V.lastIndex=n;let o=V.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},we=/^async(?![\w$])/,Se=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Re=t=>{let n=be(t);if(n===-1)return null;let e=X(t,n),s=t.slice(e);we.test(s)&&(e=X(t,e+5));let r=Se.exec(t.slice(e));if(r&&(e=X(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=j(t,i);continue}if(l==="/"&&t[i+1]==="/"){i=v(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&M(t,i)){i=D(t,i);continue}if("([{".includes(l))o++;else if(")]}".includes(l)&&--o===0)break;i++}return lt(t.slice(e+1,i))[0]??""},vt=t=>{let n=Re(t);if(n===null)return null;let e=at(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},Ot=t=>{let n="",e=0,s=0,r=!0,o=!1,i=0;for(;e<t.length;){let l=t[e],a=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(l==="'"||l==='"'||l==="`"){let f=j(t,e);n+=t.slice(e,f),e=f,r=!1;continue}if(l==="/"&&(a==="/"||a==="*")){let f=a==="/"?v(t,e):O(t,e);n+=t.slice(e,f),e=f;continue}if(l==="/"&&M(t,e)){let f=D(t,e);n+=t.slice(e,f),e=f,r=!1;continue}if(l==="i"&&p){if(J.lastIndex=e,J.test(t)){n+="$__import",e+=6,r=!1;continue}if(s===0&&r){_t.lastIndex=e;let f=_t.exec(t);if(f){n+=Ee(f[1],f[3],i++),e+=f[0].length,r=!1;continue}}}if(l==="e"&&p&&s===0&&r){V.lastIndex=e;let f=V.exec(t);if(f){o=!0,n+="$__exports.default =",e+=f[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 It=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),Wt=t=>({tag:t.tagName.toLowerCase(),attrs:It(t),children:Array.from(t.childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[Wt(n)]:[]})}),jt=new Map,$e=(t,n)=>{let e=`${n.join(",")}|${t}`,s=jt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}); }`)}catch{s=null}jt.set(e,s)}return s},N=(t,n,e)=>{let s=$e(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},xe=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>N(s,n)??""),Ht=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed"]),Te=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Ce=(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 a=N(e,s,{$event:l});typeof a=="function"&&a.call(t,l)},{once:i.has("once"),capture:i.has("capture")})},Mt=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),ut=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},Y=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},Ae=({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}},Dt=(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},Pt=(t,n,e,s,r)=>{let o=document.createComment(t),i=document.createComment(`/${t}`),l=document.createDocumentFragment();l.append(o,i);let a={};Object.entries(n.attrs).forEach(([g,E])=>{if(!(g===ht||Ht.has(g)||g.startsWith("@")))if(g.startsWith(":")){let u=Mt(g.slice(1));a[u]=E||u}else a[Mt(g)]=JSON.stringify(E)});let p=null,f=null,h=null;return s.effect(()=>{let g=N(t,e),E=g instanceof F?g:null;if(E===f||(h?.dispose(),h=null,p?.destroy(),p=null,f=E,!E))return;let u=new F({template:E.template,scripts:E.scripts,styles:E.styles,modules:E.modules,filename:E.filename}),w=st(()=>Object.fromEntries(Object.entries(a).map(([d,m])=>[d,N(m,e)]))),$=document.createDocumentFragment();(r?u.renderShadow(w):u.render(w)).mount($),i.parentNode.insertBefore($,i);let c=W(e);Object.entries(a).forEach(([d,m])=>{c.effect(()=>{u.data[d]=N(m,e)})}),h=c,p=u}),s.onDispose(()=>{h?.dispose(),p?.destroy()}),l},Ne=(t,n)=>{let e=()=>{let s=N(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)}})},tt=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(tt):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?tt(n):[]):[],_e=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?bt(t):()=>!1,dt=(t,n,e,s)=>{let r=t.attrs[":with"],o=r!==void 0?Ne(r,n):n,i=Dt(o,t.tag);if(i)return Pt(i,t,o,e,s);let l=document.createElement(t.tag);if(l instanceof HTMLUnknownElement||t.tag.includes("-")){let u=!1;e.effect(()=>{if(u)return;let w=Dt(o,t.tag);if(!w)return;u=!0;let $=Pt(w,t,o,e,s),c=ut($);e.onDispose(()=>Y(c)),l.replaceWith($)})}Object.entries(t.attrs).forEach(([u,w])=>{u.startsWith("@")?Ce(l,u,w,o):Ht.has(u)||l.setAttribute(u,w)});let a=t.attrs[":attrs"];if(a!==void 0){let u=[];e.effect(()=>{u.forEach($=>l.removeAttribute($));let w=N(a,o);u=w&&typeof w=="object"?Object.keys(w):[],u.forEach($=>{let c=w[$];c!=null&&c!==!1&&l.setAttribute($,String(c))})})}let p=t.attrs[":class"];if(p!==void 0){let u=new Set(tt(t.attrs.class??"")),w=[];e.effect(()=>{let $=tt(N(p,o));w.forEach(c=>{!$.includes(c)&&!u.has(c)&&l.classList.remove(c)}),l.classList.add(...$),w=$})}let f=t.attrs[":text"],h=t.attrs[":html"],g=t.attrs[":html.allowed"];g!==void 0&&h===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),f!==void 0?e.effect(()=>{l.textContent=String(N(f,o)??"")}):h!==void 0?e.effect(()=>{let u=g!==void 0?{allowUrl:_e(N(g,o))}:void 0;l.innerHTML=St(String(N(h,o)??""),u)}):l.appendChild(pt(t.children,o,e,s));let E=t.attrs[":value"];return E!==void 0&&e.effect(()=>{let u=String(N(E,o)??"");l.value!==u&&(l.value=u)}),[":checked",":selected"].forEach(u=>{let w=t.attrs[u];if(w===void 0)return;let $=u.slice(1);e.effect(()=>{l[$]=!!N(w,o)})}),l},Le=(t,n,e,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,l=null,a=null;return e.effect(()=>{let p=t.find(h=>h.expr===void 0||N(h.expr,n))??null;if(p===l||(a?.dispose(),i&&Y(i),i=null,l=p,!p))return;a=W(n);let f=dt(p.node,n,a,s);i=ut(f),r.parentNode.insertBefore(f,r.nextSibling)}),o},q=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},ve=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Oe=(t,n,e,s)=>{let r=t.attrs[":each"].match(Te);if(!r)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,o,i,l]=r,a=t.attrs[":key"],{[":each"]:p,[":key"]:f,...h}=t.attrs,g={...t,attrs:h},E=document.createComment("each"),u=document.createDocumentFragment();u.appendChild(E),(":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 w=[],$=!1;return e.effect(()=>{let c=N(l,n),d=Array.isArray(c)?c.map((b,R)=>[R,b]):ve(c)?Object.entries(c):[],m=new Map;w.forEach(b=>{let R=m.get(b.key);R?R.push(b):m.set(b.key,[b])});let S=new Set,C=[],x=d.map(([b,R],_)=>{let T=Object.create(n);q(T,o,R),i&&q(T,i,b),q(T,"$index",_);let P=a!==void 0?N(a,T):b;S.has(P)&&!$&&($=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),S.add(P);let L=m.get(P)?.shift();if(L&&Object.is(L.item,R))return L.scope.$index!==_&&C.push(L),q(L.scope,"$index",_),i&&q(L.scope,i,b),L;L&&(L.fx.dispose(),Y(L.range));let gt=W(n),Xt=ut(dt(g,T,gt,s));return{key:P,item:R,scope:T,fx:gt,range:Xt}});m.forEach(b=>b.forEach(R=>{R.fx.dispose(),Y(R.range)}));let y=E;x.forEach(b=>{y.nextSibling!==b.range.first&&Ae(b.range,y),y=b.range.last}),C.forEach(b=>st(()=>b.fx.refresh())),w=x}),u},pt=(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=xe(i,n)}),r.appendChild(l),o++;continue}if(":each"in i.attrs){r.appendChild(Oe(i,n,e,s)),o++;continue}if(":if"in i.attrs){let l=[{expr:i.attrs[":if"],node:i}];o++;let a=f=>{let h=o;for(;h<t.length&&typeof t[h]=="string"&&!t[h].trim();)h++;let g=t[h];if(typeof g=="object"&&f in g.attrs)return o=h+1,g};for(let f=a(":elseif");f;f=a(":elseif"))l.push({expr:f.attrs[":elseif"],node:f});let p=a(":else");p&&l.push({node:p}),r.appendChild(Le(l,n,e,s));continue}r.appendChild(dt(i,n,e,s)),o++}return r},je=(t,n,e=!1)=>pt(t.template,n,W(n),e),Me=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),De=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Pe=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,ke=t=>t.split(Pe).map((n,e)=>e%2===1?n:n.replace(De,(s,r,o)=>Me.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),ht="data-jq79",Fe=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)},Bt=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[ht]=n,Bt(e.children,n))})},Ue=(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}[${ht}="${n}"]${i}`}).join(", "),qt=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=Ue(e.selectorText,n):e instanceof CSSGroupingRule&&qt(e.cssRules,n)})},Ie=(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),qt(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
8
+ `)},ft=t=>{let e=new DOMParser().parseFromString(`<template>${ke(t)}</template>`,"text/html").querySelector("template"),s=[],r=[],o=[];Array.from(e.content.children).forEach(l=>{let a={attrs:It(l),content:l.textContent??""};l.tagName==="SCRIPT"?s.push(a):l.tagName==="STYLE"?r.push(a):o.push(Wt(l))}),r.forEach(l=>{"lang"in l.attrs&&console.warn(`jq79: <style lang="${l.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=l=>"scoped"in l.attrs&&!("lang"in l.attrs);if(r.some(i)){let l=Fe(t);Bt(o,l),r.forEach(a=>{i(a)&&(a.scoped=Ie(a.content,l))})}return{template:o,scripts:s,styles:r}},mt=t=>/\.html?([?#]|$)/.test(t)?F.fetch(t):import(t),zt=(t,n)=>t?`
9
+ //# sourceURL=${t}?jq79-script=${n}`:"",kt=t=>t.scoped??t.content,et=new Map,We=t=>{let n=et.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},et.set(t,n)}n.count++},He=t=>{let n=et.get(t);n&&--n.count<=0&&(n.el.remove(),et.delete(t))},Gt={$:U,$$:G,$create:Z,$reactive:B},Be=(t,n,e,s={},r=mt,o={})=>{let i={...Gt,...s},l=new Proxy(n,{has:(p,f)=>f!=="$__effect"&&f!=="$__import"&&(Reflect.has(p,f)||!(f in globalThis)&&!(f in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${zt(o.filename,o.index??0)}`)(l,e,r,...Object.values(i)).catch(p=>console.error("jq79: error in :setup script",p))},Ft=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:N(s,t))})},qe=t=>t&&t.default!==void 0?t.default:t,ze=(t,n,e,s={},r=mt,o={})=>{let i={...Gt,...s},l={},a=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
10
+ ${t}
11
+ ;$__exports.done = true })()${zt(o.filename,o.index??0)}`)(l,qe,r,...Object.values(i)),p=g=>console.error("jq79: error in factory script",g),f=!1,h=()=>{if(f)return;f=!0;let g=l.default;if(typeof g!="function")return;let E=u=>{u&&typeof u=="object"&&Object.assign(n,u)};try{let u=g(n,{$data:n,$props:n,$effect:e,...s});u instanceof Promise?u.then(E).catch(p):E(u)}catch(u){p(u)}};a.then(h,p),l.done&&h()},Ge="__JQ79_HMR_ENABLED__",Ze="__JQ79_HMR__",k=null,Ke=t=>{if(!k||!t.filename)return;let n=k.get(t.filename);n||k.set(t.filename,n=new Set),n.add(new WeakRef(t))},Ut=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},Zt=(t,n)=>{if(!k)return 0;let e=Ut(t),s=ft(n),r=0;for(let[o,i]of k)if(Ut(o)===e){for(let l of i){let a=l.deref();if(!a){i.delete(l);continue}a.hotReplace(s)&&r++}i.size||k.delete(o)}return r},Kt=()=>{k??(k=new Map),globalThis[Ze]={update:Zt}},F=class t{constructor(n,e={}){A(this,"template");A(this,"scripts");A(this,"styles");A(this,"modules");A(this,"filename");A(this,"data",null);A(this,"fx",null);A(this,"content",null);A(this,"startMarker",null);A(this,"endMarker",null);A(this,"styleEls",[]);A(this,"ownsSharedStyles",!1);A(this,"useShadow",!1);A(this,"mountRoot",null);A(this,"resolveMounted",null);A(this,"emitListeners",new Map);let s=typeof n=="string"?ft(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),Ke(this)}hotReplace(n){let e=typeof n=="string"?ft(n):n,s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,l=o?this.endMarker.nextSibling:null,a={...this.data},p=this.useShadow;return r&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,!r||(this.renderWith(a,p),!i)?!1:(p&&this.styleEls.forEach(f=>i.insertBefore(f,l)),i.insertBefore(this.content,l),this.mountRoot=i,this.resolveMounted?.(),!0)}static async fetch(n){let e=await fetch(n);if(!e.ok)throw new Error(`failed to fetch component from ${n}: ${e.status}`);return new t(await e.text(),{filename:n})}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=B({...n}),r=W(s);this.data=s,this.fx=r,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let o=this.startMarker,i=(c,d)=>{let m=new CustomEvent(c,{detail:d,bubbles:!0,composed:!0}),S=o.dispatchEvent(m);return o===this.startMarker&&this.emitListeners.get(c)?.forEach(C=>C(m,d)),S},l,a=new Promise(c=>{l=c});this.resolveMounted=l;let p=()=>a,f=this.endMarker,h=c=>{let d=[];for(let m=o.nextSibling;m&&m!==f;m=m.nextSibling)m instanceof Element&&(m.matches(c)&&d.push(m),d.push(...Array.from(m.querySelectorAll(c))));return d},g=c=>h(c)[0]??null,E=this.modules,u=c=>E&&c in E?Promise.resolve(E[c]):mt(c),w=c=>`await $mounted();${c}`;this.scripts.forEach((c,d)=>{let m={$emit:i,$mounted:p,$self:g,$$self:h},S={filename:this.filename,index:d},C=Ot(c.content);if(C!==null){Ft(s,vt(c.content));let R=":mounted"in c.attrs?w(C):C;ze(R,s,r.effect,m,u,S);return}let{vars:x,code:y}=Q(c.content);Ft(s,at(c.attrs[":setup"])),x.forEach(R=>{R in s||(s[R]=void 0)});let b=":mounted"in c.attrs?w(y):y;Be(b,s,r.effect,m,u,S)});let $=document.createDocumentFragment();return $.append(this.startMarker,pt(this.template,s,r,e),this.endMarker),this.content=$,e?this.styleEls=this.styles.map(c=>{let d=document.createElement("style");return d.textContent=c.content,d}):(this.styles.forEach(c=>We(kt(c))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?U(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"?U(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=>He(kt(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},Xe=t=>new F(t);typeof globalThis<"u"&&globalThis[Ge]&&Kt();0&&(module.exports={$,$$,$create,$reactive,Component79,enableHotReload,hotUpdate,parseComponent,renderComponent});
12
12
  //# sourceMappingURL=jq79.cjs.map