Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uhtml

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uhtml - npm Package Compare versions

Comparing version 4.4.1 to 4.4.2

20

cjs/init.js

@@ -593,9 +593,2 @@ 'use strict';

/**
* @typedef {Object} Entry
* @property {number[]} path
* @property {function} update
* @property {string} name
*/
/**
* @param {DocumentFragment} f content retrieved from the template

@@ -613,3 +606,3 @@ * @param {Entry[]} e entries per each hole in the template

* @property {Node} t the target comment node or element
* @property {string} n the name of the attribute, if any
* @property {string | null} n the attribute name, if any, or `null`
*/

@@ -621,3 +614,3 @@

* @param {Node} t the target comment node or element
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Detail}

@@ -628,5 +621,12 @@ */

/**
* @typedef {Object} Entry
* @property {number[]} p the path to retrieve the node
* @property {function} u the update function
* @property {string | null} n the attribute name, if any, or `null`
*/
/**
* @param {number[]} p the path to retrieve the node
* @param {function} u the update function
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Entry}

@@ -633,0 +633,0 @@ */

@@ -12,9 +12,2 @@ 'use strict';

/**
* @typedef {Object} Entry
* @property {number[]} path
* @property {function} update
* @property {string} name
*/
/**
* @param {DocumentFragment} f content retrieved from the template

@@ -33,3 +26,3 @@ * @param {Entry[]} e entries per each hole in the template

* @property {Node} t the target comment node or element
* @property {string} n the name of the attribute, if any
* @property {string | null} n the attribute name, if any, or `null`
*/

@@ -41,3 +34,3 @@

* @param {Node} t the target comment node or element
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Detail}

@@ -49,5 +42,12 @@ */

/**
* @typedef {Object} Entry
* @property {number[]} p the path to retrieve the node
* @property {function} u the update function
* @property {string | null} n the attribute name, if any, or `null`
*/
/**
* @param {number[]} p the path to retrieve the node
* @param {function} u the update function
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Entry}

@@ -54,0 +54,0 @@ */

'use strict';
/*! (c) Andrea Giammarchi - MIT */
const { Hole, unroll } = require('./rabbit.js');
const { attr } = require('./handler.js');
const { cache } = require('./literals.js');
const { empty } = require('./utils.js');
const create = (require('./creator.js'));
const parser = (require('./parser.js'));
const render = (require('./render/node.js'));
/** @typedef {import("./literals.js").DOMValue} DOMValue */
/** @typedef {import("./literals.js").Target} Target */
const tag = svg => {
const parse = create(parser(svg));
return (template, ...values) => parse(template, values).n;
};
const tag = svg => (template, ...values) => unroll(
cache(empty),
new Hole(svg, template, values)
);

@@ -23,2 +22,16 @@ /** @type {(template: TemplateStringsArray, ...values:DOMValue[]) => Target} A tag to render HTML content. */

/**
* Render directly within a generic container.
* @template T
* @param {T} where the DOM node where to render content
* @param {(() => Target) | Target} what the node to render
* @returns
*/
const render = (where, what) => {
where.replaceChildren(
(typeof what === 'function' ? what() : what).valueOf()
);
return where;
};
exports.render = render;

@@ -25,0 +38,0 @@ exports.html = html;

@@ -35,3 +35,3 @@ 'use strict';

const wr = new WeakRef(where);
dispose = effect(() => { render(wr.deref(), what().valueOf(), false) });
dispose = effect(() => { render(wr.deref(), what(), false) });
effects.set(where, dispose);

@@ -42,5 +42,5 @@ return create(dispose, onGC, { return: where });

effects.delete(where);
return render(where, what.valueOf(), false);
return render(where, what, false);
}
};
};

@@ -592,9 +592,2 @@

/**
* @typedef {Object} Entry
* @property {number[]} path
* @property {function} update
* @property {string} name
*/
/**
* @param {DocumentFragment} f content retrieved from the template

@@ -612,3 +605,3 @@ * @param {Entry[]} e entries per each hole in the template

* @property {Node} t the target comment node or element
* @property {string} n the name of the attribute, if any
* @property {string | null} n the attribute name, if any, or `null`
*/

@@ -620,3 +613,3 @@

* @param {Node} t the target comment node or element
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Detail}

@@ -627,5 +620,12 @@ */

/**
* @typedef {Object} Entry
* @property {number[]} p the path to retrieve the node
* @property {function} u the update function
* @property {string | null} n the attribute name, if any, or `null`
*/
/**
* @param {number[]} p the path to retrieve the node
* @param {function} u the update function
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Entry}

@@ -632,0 +632,0 @@ */

@@ -11,9 +11,2 @@ import { empty } from './utils.js';

/**
* @typedef {Object} Entry
* @property {number[]} path
* @property {function} update
* @property {string} name
*/
/**
* @param {DocumentFragment} f content retrieved from the template

@@ -31,3 +24,3 @@ * @param {Entry[]} e entries per each hole in the template

* @property {Node} t the target comment node or element
* @property {string} n the name of the attribute, if any
* @property {string | null} n the attribute name, if any, or `null`
*/

@@ -39,3 +32,3 @@

* @param {Node} t the target comment node or element
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Detail}

@@ -46,5 +39,12 @@ */

/**
* @typedef {Object} Entry
* @property {number[]} p the path to retrieve the node
* @property {function} u the update function
* @property {string | null} n the attribute name, if any, or `null`
*/
/**
* @param {number[]} p the path to retrieve the node
* @param {function} u the update function
* @param {string?} n the attribute name, if any, or `null`
* @param {string | null} n the attribute name, if any, or `null`
* @returns {Entry}

@@ -51,0 +51,0 @@ */

/*! (c) Andrea Giammarchi - MIT */
import { Hole, unroll } from './rabbit.js';
import { attr } from './handler.js';
import { cache } from './literals.js';
import { empty } from './utils.js';
import create from './creator.js';
import parser from './parser.js';
import render from './render/node.js';
/** @typedef {import("./literals.js").DOMValue} DOMValue */
/** @typedef {import("./literals.js").Target} Target */
const tag = svg => {
const parse = create(parser(svg));
return (template, ...values) => parse(template, values).n;
};
const tag = svg => (template, ...values) => unroll(
cache(empty),
new Hole(svg, template, values)
);

@@ -22,2 +21,16 @@ /** @type {(template: TemplateStringsArray, ...values:DOMValue[]) => Target} A tag to render HTML content. */

/**
* Render directly within a generic container.
* @template T
* @param {T} where the DOM node where to render content
* @param {(() => Target) | Target} what the node to render
* @returns
*/
const render = (where, what) => {
where.replaceChildren(
(typeof what === 'function' ? what() : what).valueOf()
);
return where;
};
export { render, html, svg, attr };

@@ -34,3 +34,3 @@ import { create, drop } from 'gc-hook';

const wr = new WeakRef(where);
dispose = effect(() => { render(wr.deref(), what().valueOf(), false) });
dispose = effect(() => { render(wr.deref(), what(), false) });
effects.set(where, dispose);

@@ -41,5 +41,5 @@ return create(dispose, onGC, { return: where });

effects.delete(where);
return render(where, what.valueOf(), false);
return render(where, what, false);
}
};
};

@@ -1,3 +0,2 @@

const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:i}=Object;let o;var a=(e,t,n)=>(o||(o=s()),n?o.setStartAfter(e):o.setStartBefore(e),o.setEndAfter(t),o.deleteContents(),e);const c=({firstChild:e,lastChild:t},n)=>a(e,t,n);let d=!1;const h=(e,t)=>d&&11===e.nodeType?1/t<0?t?c(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,u=e=>document.createComment(e);class f extends((e=>{function t(e){return i(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=u("<>");#t=u("</>");#n=r;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),d=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){c(this,!1)}replaceWith(e){c(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===r&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const p=(e,t,n)=>e.setAttribute(t,n),g=(e,t)=>e.removeAttribute(t);let m;const C=(t,n,r)=>{r=r.slice(1),m||(m=new WeakMap);const s=m.get(t)||l(m,t,{});let i=s[r];return i&&i[0]&&t.removeEventListener(r,...i),i=e(n)?n:[n,!1],s[r]=i,i[0]&&t.addEventListener(r,...i),n};function x(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const $=(e,t,n)=>e[n]=t,v=(e,t,n)=>$(e,t,n.slice(1)),y=(e,t,n)=>null==t?(g(e,n),t):$(e,t,n),b=(e,t)=>("function"==typeof t?t(e):t.current=e,t),N=(e,t,n)=>(null==t?g(e,n):p(e,n,t),t),w=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),A=(e,t,n)=>{const{length:s}=t;if(e.data=`[${s}]`,s)return((e,t,n,r,s)=>{const l=n.length;let i=t.length,o=l,a=0,c=0,d=null;for(;a<i||c<o;)if(i===a){const t=o<l?c?r(n[c-1],-0).nextSibling:r(n[o-c],0):s;for(;c<o;)e.insertBefore(r(n[c++],1),t)}else if(o===c)for(;a<i;)d&&d.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[i-1]===n[o-1])i--,o--;else if(t[a]===n[o-1]&&n[c]===t[i-1]){const s=r(t[--i],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--o],1),s),t[i]=n[o]}else{if(!d){d=new Map;let e=c;for(;e<o;)d.set(n[e],e++)}if(d.has(t[a])){const s=d.get(t[a]);if(c<s&&s<o){let l=a,h=1;for(;++l<i&&l<o&&d.get(t[l])===s+h;)h++;if(h>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,h,e);switch(n.length){case 1:n[0].remove();case 0:break;default:a(h(n[0],0),h(n.at(-1),-0),!1)}return r},O=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?g(e,s):p(e,s,r)}return t}],["class",(e,t)=>y(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",b],["style",(e,t)=>null==t?y(e,t,"style"):$(e.style,t,"cssText")]]),W=(e,r,s)=>{switch(r[0]){case".":return v;case"?":return w;case"@":return C;default:return s||"ownerSVGElement"in e?"ref"===r?b:N:O.get(r)||(r in e?r.startsWith("on")?$:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?y:N:N)}},k=(e,t)=>(e.textContent=null==t?"":t,t),S=(e,t,n)=>({p:e,u:t,n:n}),E=(e,t)=>t.reduceRight(T,e),T=(e,t)=>e.childNodes[t];const B=/^(?:plaintext|script|style|textarea|title|xmp)$/i,M=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,j=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,L=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,P=/[\x01\x02]/g;let z,D,F=document.createElement("template");var R=(e,t)=>{if(t)return z||(z=document.createElementNS("http://www.w3.org/2000/svg","svg"),D=s(),D.selectNodeContents(z)),D.createContextualFragment(e);F.innerHTML=e;const{content:n}=F;return F=F.cloneNode(!1),n};const Z=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},G=()=>document.createTextNode(""),H=(t,n,s)=>{const i=R(((e,t,n)=>{let r=0;return e.join("").trim().replace(j,((e,t,r,s)=>`<${t}${r.replace(L,"=$2$1").trimEnd()}${s?n||M.test(t)?" /":`></${t}`:""}>`)).replace(P,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,_,s),s),{length:o}=t;let a=r;if(o>1){const t=[],r=document.createTreeWalker(i,129);let l=0,c=`${_}${l++}`;for(a=[];l<o;){const i=r.nextNode();if(8===i.nodeType){if(i.data===c){const r=e(n[l-1])?A:x;r===x&&t.push(i),a.push(S(Z(i),r,null)),c=`${_}${l++}`}}else{let e;for(;i.hasAttribute(c);){e||(e=Z(i));const t=i.getAttribute(c);a.push(S(e,W(i,t,s),t)),g(i,c),c=`${_}${l++}`}!s&&B.test(i.localName)&&i.textContent.trim()===`\x3c!--${c}--\x3e`&&(a.push(S(e||Z(i),k,null)),c=`${_}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(G())}const{childNodes:c}=i;let{length:d}=c;return d<1?(d=1,i.appendChild(G())):1===d&&1!==o&&1!==c[0].nodeType&&(d=0),l(V,t,{f:i,e:a,d:1===d})},V=new WeakMap,_="isµ";var q=(e,t)=>(e.replaceChildren(("function"==typeof t?t():t).valueOf()),e);
/*! (c) Andrea Giammarchi - MIT */
const I=e=>{const t=(e=>(t,n)=>{const{f:s,e:l,d:i}=e(t,n),o=s.cloneNode(!0);let a,c,d=l===r?r:[];for(let e=0;e<l.length;e++){const{p:t,u:n,n:s}=l[e],i=t===c?a:a=E(o,c=t);d[e]={v:r,u:n,t:i,n:s}}return{n:i?o.firstChild:new f(o),d:d}})((n=e,(e,t)=>V.get(e)||H(e,t,n)));var n;return(e,...n)=>t(e,n).n},J=I(!1),K=I(!0);export{O as attr,J as html,q as render,K as svg};
const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:i}=Object;let o;var a=(e,t,n)=>(o||(o=s()),n?o.setStartAfter(e):o.setStartBefore(e),o.setEndAfter(t),o.deleteContents(),e);const c=({firstChild:e,lastChild:t},n)=>a(e,t,n);let d=!1;const h=(e,t)=>d&&11===e.nodeType?1/t<0?t?c(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,u=e=>document.createComment(e);class f extends((e=>{function t(e){return i(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=u("<>");#t=u("</>");#n=r;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),d=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){c(this,!1)}replaceWith(e){c(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===r&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const p=(e,t,n)=>e.setAttribute(t,n),g=(e,t)=>e.removeAttribute(t);let m;const C=(t,n,r)=>{r=r.slice(1),m||(m=new WeakMap);const s=m.get(t)||l(m,t,{});let i=s[r];return i&&i[0]&&t.removeEventListener(r,...i),i=e(n)?n:[n,!1],s[r]=i,i[0]&&t.addEventListener(r,...i),n};function v(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const x=(e,t,n)=>e[n]=t,b=(e,t,n)=>x(e,t,n.slice(1)),$=(e,t,n)=>null==t?(g(e,n),t):x(e,t,n),w=(e,t)=>("function"==typeof t?t(e):t.current=e,t),y=(e,t,n)=>(null==t?g(e,n):p(e,n,t),t),N=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),A=(e,t,n)=>{const{length:s}=t;if(e.data=`[${s}]`,s)return((e,t,n,r,s)=>{const l=n.length;let i=t.length,o=l,a=0,c=0,d=null;for(;a<i||c<o;)if(i===a){const t=o<l?c?r(n[c-1],-0).nextSibling:r(n[o-c],0):s;for(;c<o;)e.insertBefore(r(n[c++],1),t)}else if(o===c)for(;a<i;)d&&d.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[i-1]===n[o-1])i--,o--;else if(t[a]===n[o-1]&&n[c]===t[i-1]){const s=r(t[--i],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--o],1),s),t[i]=n[o]}else{if(!d){d=new Map;let e=c;for(;e<o;)d.set(n[e],e++)}if(d.has(t[a])){const s=d.get(t[a]);if(c<s&&s<o){let l=a,h=1;for(;++l<i&&l<o&&d.get(t[l])===s+h;)h++;if(h>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,h,e);switch(n.length){case 1:n[0].remove();case 0:break;default:a(h(n[0],0),h(n.at(-1),-0),!1)}return r},k=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?g(e,s):p(e,s,r)}return t}],["class",(e,t)=>$(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",w],["style",(e,t)=>null==t?$(e,t,"style"):x(e.style,t,"cssText")]]),O=(e,r,s)=>{switch(r[0]){case".":return b;case"?":return N;case"@":return C;default:return s||"ownerSVGElement"in e?"ref"===r?w:y:k.get(r)||(r in e?r.startsWith("on")?x:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?$:y:y)}},W=(e,t)=>(e.textContent=null==t?"":t,t),S=(e,t,n)=>({p:e,u:t,n:n}),E=e=>({s:e,t:null,n:null,d:r}),T=(e,t)=>t.reduceRight(B,e),B=(e,t)=>e.childNodes[t];var M=e=>(t,n)=>{const{f:s,e:l,d:i}=e(t,n),o=s.cloneNode(!0);let a,c,d=l===r?r:[];for(let e=0;e<l.length;e++){const{p:t,u:n,n:s}=l[e],i=t===c?a:a=T(o,c=t);d[e]={v:r,u:n,t:i,n:s}}return((e,t)=>({n:e,d:t}))(i?o.firstChild:new f(o),d)};const j=/^(?:plaintext|script|style|textarea|title|xmp)$/i,L=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,P=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,z=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,D=/[\x01\x02]/g;let F,R,Z=document.createElement("template");var G=(e,t)=>{if(t)return F||(F=document.createElementNS("http://www.w3.org/2000/svg","svg"),R=s(),R.selectNodeContents(F)),R.createContextualFragment(e);Z.innerHTML=e;const{content:n}=Z;return Z=Z.cloneNode(!1),n};const H=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=()=>document.createTextNode(""),_=(t,n,s)=>{const i=G(((e,t,n)=>{let r=0;return e.join("").trim().replace(P,((e,t,r,s)=>`<${t}${r.replace(z,"=$2$1").trimEnd()}${s?n||L.test(t)?" /":`></${t}`:""}>`)).replace(D,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,I,s),s),{length:o}=t;let a=r;if(o>1){const t=[],r=document.createTreeWalker(i,129);let l=0,c=`${I}${l++}`;for(a=[];l<o;){const i=r.nextNode();if(8===i.nodeType){if(i.data===c){const r=e(n[l-1])?A:v;r===v&&t.push(i),a.push(S(H(i),r,null)),c=`${I}${l++}`}}else{let e;for(;i.hasAttribute(c);){e||(e=H(i));const t=i.getAttribute(c);a.push(S(e,O(i,t,s),t)),g(i,c),c=`${I}${l++}`}!s&&j.test(i.localName)&&i.textContent.trim()===`\x3c!--${c}--\x3e`&&(a.push(S(e||H(i),W,null)),c=`${I}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(V())}const{childNodes:c}=i;let{length:d}=c;return d<1?(d=1,i.appendChild(V())):1===d&&1!==o&&1!==c[0].nodeType&&(d=0),l(q,t,{f:i,e:a,d:1===d})},q=new WeakMap,I="isµ";var J=e=>(t,n)=>q.get(t)||_(t,n,e);const K=M(J(!1)),Q=M(J(!0)),U=({u:e})=>e===A?E([]):e===v?E(r):null,X=(e,{s:t,t:n,v:r})=>{let s=0,{d:l,s:i}=e;if(e.t!==n){const{n:s,d:o}=(t?Q:K)(n,r);e.t=n,e.n=s,e.d=l=o,r.length&&(e.s=i=o.map(U))}for(;s<l.length;s++){const e=r[s],t=l[s],{v:n,u:o,t:a,n:c}=t;switch(o){case A:t.v=A(a,Y(i[s],e),n);break;case v:const r=e instanceof ee?X(i[s],e):e;r!==n&&(t.v=v.call(t,a,r));break;default:e!==n&&(t.v=o(a,e,c,n))}}return e.n},Y=({s:e},t)=>{let n=0,{length:s}=t;for(s<e.length&&e.splice(s);n<s;n++){const s=t[n],l=s instanceof ee,i=e[n]||(e[n]=l?E(r):null);l&&(t[n]=X(i,s))}return t};class ee{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const te=e=>(t,...n)=>X(E(r),new ee(e,t,n)),ne=te(!1),re=te(!0),se=(e,t)=>(e.replaceChildren(("function"==typeof t?t():t).valueOf()),e);export{k as attr,ne as html,se as render,re as svg};
{
"name": "uhtml",
"version": "4.4.1",
"version": "4.4.2",
"description": "A micro HTML/SVG render",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

function t(){throw new Error("Cycle detected")}const e=Symbol.for("preact-signals");function n(){if(h>1)return void h--;let t,e=!1;for(;void 0!==r;){let n=r;for(r=void 0,c++;void 0!==n;){const i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&p(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=i}}if(c=0,h--,e)throw t}function i(t){if(h>0)return t();h++;try{return t()}finally{n()}}let s,r,o=0;function l(t){if(o>0)return t();const e=s;s=void 0,o++;try{return t()}finally{o--,s=e}}let h=0,c=0,f=0;function u(t){if(void 0===s)return;let e=t.n;return void 0===e||e.t!==s?(e={i:0,S:t,p:s.s,n:void 0,t:s,e:void 0,x:void 0,r:e},void 0!==s.s&&(s.s.n=e),s.s=e,t.n=e,32&s.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=s.s,e.n=void 0,s.s.n=e,s.s=e),e):void 0}function a(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function d(t){return new a(t)}function p(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function v(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function y(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t}t.s=e}function g(t){a.call(this,void 0),this.x=t,this.s=void 0,this.g=f-1,this.f=4}function w(t){return new g(t)}function m(t){const e=t.u;if(t.u=void 0,"function"==typeof e){h++;const i=s;s=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,x(t),e}finally{s=i,n()}}}function x(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,m(t)}function b(t){if(s!==this)throw new Error("Out-of-order effect");y(this),s=t,this.f&=-2,8&this.f&&x(this),n()}function C(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function S(t){const e=new C(t);try{e.c()}catch(t){throw e.d(),t}return e.d.bind(e)}a.prototype.brand=e,a.prototype.h=function(){return!0},a.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},a.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n)}},a.prototype.subscribe=function(t){const e=this;return S((function(){const n=e.value,i=32&this.f;this.f&=-33;try{t(n)}finally{this.f|=i}}))},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return this.value+""},a.prototype.toJSON=function(){return this.value},a.prototype.peek=function(){return this.v},Object.defineProperty(a.prototype,"value",{get(){const t=u(this);return void 0!==t&&(t.i=this.i),this.v},set(e){if(s instanceof g&&function(){throw new Error("Computed cannot have side-effects")}(),e!==this.v){c>100&&t(),this.v=e,this.i++,f++,h++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{n()}}}}),(g.prototype=new a).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===f)return!0;if(this.g=f,this.f|=1,this.i>0&&!p(this))return this.f&=-2,!0;const t=s;try{v(this),s=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return s=t,y(this),this.f&=-2,!0},g.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t)}a.prototype.S.call(this,t)},g.prototype.U=function(t){if(void 0!==this.t&&(a.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t)}},g.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N()}},g.prototype.peek=function(){if(this.h()||t(),16&this.f)throw this.v;return this.v},Object.defineProperty(g.prototype,"value",{get(){1&this.f&&t();const e=u(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),C.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t)}finally{t()}},C.prototype.S=function(){1&this.f&&t(),this.f|=1,this.f&=-9,m(this),v(this),h++;const e=s;return s=this,b.bind(this,e)},C.prototype.N=function(){2&this.f||(this.f|=2,this.o=r,r=this)},C.prototype.d=function(){this.f|=8,1&this.f||x(this)};const{isArray:N}=Array,{getPrototypeOf:$,getOwnPropertyDescriptor:k}=Object,O=[],W=()=>document.createRange(),A=(t,e,n)=>(t.set(e,n),n),{setPrototypeOf:E}=Object;let M;var j=(t,e,n)=>(M||(M=W()),n?M.setStartAfter(t):M.setStartBefore(t),M.setEndAfter(e),M.deleteContents(),t);const T=({firstChild:t,lastChild:e},n)=>j(t,e,n);let P=!1;const U=(t,e)=>P&&11===t.nodeType?1/e<0?e?T(t,!0):t.lastChild:e?t.valueOf():t.firstChild:t,B=t=>document.createComment(t);class R extends((t=>{function e(t){return E(t,new.target.prototype)}return e.prototype=t.prototype,e})(DocumentFragment)){#t=B("<>");#e=B("</>");#n=O;constructor(t){super(t),this.replaceChildren(this.#t,...t.childNodes,this.#e),P=!0}get firstChild(){return this.#t}get lastChild(){return this.#e}get parentNode(){return this.#t.parentNode}remove(){T(this,!1)}replaceWith(t){T(this,!0).replaceWith(t)}valueOf(){let{firstChild:t,lastChild:e,parentNode:n}=this;if(n===this)this.#n===O&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[t];t!==e;)this.#n.push(t=t.nextSibling);this.replaceChildren(...this.#n)}return this}}const z=(t,e,n)=>t.setAttribute(e,n),F=(t,e)=>t.removeAttribute(e);let L;const D=(t,e,n)=>{n=n.slice(1),L||(L=new WeakMap);const i=L.get(t)||A(L,t,{});let s=i[n];return s&&s[0]&&t.removeEventListener(n,...s),s=N(e)?e:[e,!1],i[n]=s,s[0]&&t.addEventListener(n,...s),e};function H(t,e){let{n:n}=this,i=!1;switch(typeof e){case"object":if(null!==e){(n||t).replaceWith(this.n=e.valueOf());break}case"undefined":i=!0;default:t.data=i?"":e,n&&(this.n=null,n.replaceWith(t))}return e}const Z=(t,e,n)=>t[n]=e,G=(t,e,n)=>Z(t,e,n.slice(1)),J=(t,e,n)=>null==e?(F(t,n),e):Z(t,e,n),V=(t,e)=>("function"==typeof e?e(t):e.current=t,e),_=(t,e,n)=>(null==e?F(t,n):z(t,n,e),e),q=(t,e,n)=>(t.toggleAttribute(n.slice(1),e),e),I=(t,e,n)=>{const{length:i}=e;if(t.data=`[${i}]`,i)return((t,e,n,i,s)=>{const r=n.length;let o=e.length,l=r,h=0,c=0,f=null;for(;h<o||c<l;)if(o===h){const e=l<r?c?i(n[c-1],-0).nextSibling:i(n[l-c],0):s;for(;c<l;)t.insertBefore(i(n[c++],1),e)}else if(l===c)for(;h<o;)f&&f.has(e[h])||t.removeChild(i(e[h],-1)),h++;else if(e[h]===n[c])h++,c++;else if(e[o-1]===n[l-1])o--,l--;else if(e[h]===n[l-1]&&n[c]===e[o-1]){const s=i(e[--o],-1).nextSibling;t.insertBefore(i(n[c++],1),i(e[h++],-1).nextSibling),t.insertBefore(i(n[--l],1),s),e[o]=n[l]}else{if(!f){f=new Map;let t=c;for(;t<l;)f.set(n[t],t++)}if(f.has(e[h])){const s=f.get(e[h]);if(c<s&&s<l){let r=h,u=1;for(;++r<o&&r<l&&f.get(e[r])===s+u;)u++;if(u>s-c){const r=i(e[h],0);for(;c<s;)t.insertBefore(i(n[c++],1),r)}else t.replaceChild(i(n[c++],1),i(e[h++],-1))}else h++}else t.removeChild(i(e[h++],-1))}return n})(t.parentNode,n,e,U,t);switch(n.length){case 1:n[0].remove();case 0:break;default:j(U(n[0],0),U(n.at(-1),-0),!1)}return O},K=new Map([["aria",(t,e)=>{for(const n in e){const i=e[n],s="role"===n?n:`aria-${n}`;null==i?F(t,s):z(t,s,i)}return e}],["class",(t,e)=>J(t,e,null==e?"class":"className")],["data",(t,e)=>{const{dataset:n}=t;for(const t in e)null==e[t]?delete n[t]:n[t]=e[t];return e}],["ref",V],["style",(t,e)=>null==e?J(t,e,"style"):Z(t.style,e,"cssText")]]),Q=(t,e,n)=>{switch(e[0]){case".":return G;case"?":return q;case"@":return D;default:return n||"ownerSVGElement"in t?"ref"===e?V:_:K.get(e)||(e in t?e.startsWith("on")?Z:((t,e)=>{let n;do{n=k(t,e)}while(!n&&(t=$(t)));return n})(t,e)?.set?J:_:_)}},X=(t,e)=>(t.textContent=null==e?"":e,e),Y=(t,e,n,i)=>({v:t,u:e,t:n,n:i}),tt=(t,e,n)=>({p:t,u:e,n:n}),et=t=>({s:t,t:null,n:null,d:O}),nt=(t,e)=>e.reduceRight(it,t),it=(t,e)=>t.childNodes[e];var st=t=>(e,n)=>{const{f:i,e:s,d:r}=t(e,n),o=i.cloneNode(!0);let l,h,c=s===O?O:[];for(let t=0;t<s.length;t++){const{p:e,u:n,n:i}=s[t],r=e===h?l:l=nt(o,h=e);c[t]=Y(O,n,r,i)}return((t,e)=>({n:t,d:e}))(r?o.firstChild:new R(o),c)};const rt=/^(?:plaintext|script|style|textarea|title|xmp)$/i,ot=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,lt=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,ht=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,ct=/[\x01\x02]/g;let ft,ut,at=document.createElement("template");var dt=(t,e)=>{if(e)return ft||(ft=document.createElementNS("http://www.w3.org/2000/svg","svg"),ut=W(),ut.selectNodeContents(ft)),ut.createContextualFragment(t);at.innerHTML=t;const{content:n}=at;return at=at.cloneNode(!1),n};const pt=t=>{const e=[];let n;for(;n=t.parentNode;)e.push(e.indexOf.call(n.childNodes,t)),t=n;return e},vt=()=>document.createTextNode(""),yt=(t,e,n)=>{const i=dt(((t,e,n)=>{let i=0;return t.join("").trim().replace(lt,((t,e,i,s)=>`<${e}${i.replace(ht,"=$2$1").trimEnd()}${s?n||ot.test(e)?" /":`></${e}`:""}>`)).replace(ct,(t=>""===t?`\x3c!--${e+i++}--\x3e`:e+i++))})(t,wt,n),n),{length:s}=t;let r=O;if(s>1){const t=[],o=document.createTreeWalker(i,129);let l=0,h=`${wt}${l++}`;for(r=[];l<s;){const i=o.nextNode();if(8===i.nodeType){if(i.data===h){const n=N(e[l-1])?I:H;n===H&&t.push(i),r.push(tt(pt(i),n,null)),h=`${wt}${l++}`}}else{let t;for(;i.hasAttribute(h);){t||(t=pt(i));const e=i.getAttribute(h);r.push(tt(t,Q(i,e,n),e)),F(i,h),h=`${wt}${l++}`}!n&&rt.test(i.localName)&&i.textContent.trim()===`\x3c!--${h}--\x3e`&&(r.push(tt(t||pt(i),X,null)),h=`${wt}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(vt())}const{childNodes:o}=i;let{length:l}=o;return l<1?(l=1,i.appendChild(vt())):1===l&&1!==s&&1!==o[0].nodeType&&(l=0),A(gt,t,((t,e,n)=>({f:t,e:e,d:n}))(i,r,1===l))},gt=new WeakMap,wt="isµ";var mt=t=>(e,n)=>gt.get(e)||yt(e,n,t);const xt=st(mt(!1)),bt=st(mt(!0)),Ct=({u:t})=>t===I?et([]):t===H?et(O):null,St=(t,{s:e,t:n,v:i})=>{let s=0,{d:r,s:o}=t;if(t.t!==n){const{n:s,d:l}=(e?bt:xt)(n,i);t.t=n,t.n=s,t.d=r=l,i.length&&(t.s=o=l.map(Ct))}for(;s<r.length;s++){const t=i[s],e=r[s],{v:n,u:l,t:h,n:c}=e;switch(l){case I:e.v=I(h,Nt(o[s],t),n);break;case H:const i=t instanceof $t?St(o[s],t):t;i!==n&&(e.v=H.call(e,h,i));break;default:t!==n&&(e.v=l(h,t,c,n))}}return t.n},Nt=({s:t},e)=>{let n=0,{length:i}=e;for(i<t.length&&t.splice(i);n<i;n++){const i=e[n],s=i instanceof $t,r=t[n]||(t[n]=s?et(O):null);s&&(e[n]=St(r,i))}return e};class $t{constructor(t,e,n){this.s=t,this.t=e,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const kt=t=>(e,...n)=>new $t(t,e,n),Ot=kt(!1),Wt=kt(!0),At=new WeakMap;var Et=(t,e,n)=>{const i=At.get(t)||A(At,t,et(O)),s=n&&"function"==typeof e?e():e,{n:r}=i,o=s instanceof $t?St(i,s):s;return r!==o&&t.replaceChildren((i.n=o).valueOf()),t};
/*! (c) Andrea Giammarchi - MIT */const Mt=new WeakMap,jt=t=>(e,n)=>{const i=Mt.get(e)||A(Mt,e,new Map);return i.get(n)||A(i,n,function(e,...n){return St(this,new $t(t,e,n))}.bind(et(O)))},Tt=jt(!1),Pt=jt(!0),Ut=new FinalizationRegistry((([t,e,n])=>{n&&console.debug(`Held value ${String(e)} not relevant anymore`),t(e)})),Bt=Object.create(null),Rt=new WeakMap,zt=t=>t();const Ft=(Lt=S,(t,e)=>{let n=Rt.get(t);var i;if(n&&(i=n,Ut.unregister(i),n()),"function"==typeof e){const i=new WeakRef(t);return n=Lt((()=>{Et(i.deref(),e().valueOf(),!1)})),Rt.set(t,n),((t,e,{debug:n,return:i,token:s=t}=Bt)=>{const r=i||new Proxy(t,Bt),o=[r,[e,t,!!n]];return!1!==s&&o.push(s),Ut.register(...o),r})(n,zt,{return:t})}return Rt.delete(t),Et(t,e.valueOf(),!1)});var Lt;export{$t as Hole,a as Signal,K as attr,i as batch,w as computed,S as effect,Ot as html,Tt as htmlFor,Ft as render,d as signal,Wt as svg,Pt as svgFor,l as untracked};
/*! (c) Andrea Giammarchi - MIT */const Mt=new WeakMap,jt=t=>(e,n)=>{const i=Mt.get(e)||A(Mt,e,new Map);return i.get(n)||A(i,n,function(e,...n){return St(this,new $t(t,e,n))}.bind(et(O)))},Tt=jt(!1),Pt=jt(!0),Ut=new FinalizationRegistry((([t,e,n])=>{n&&console.debug(`Held value ${String(e)} not relevant anymore`),t(e)})),Bt=Object.create(null),Rt=new WeakMap,zt=t=>t();const Ft=(Lt=S,(t,e)=>{let n=Rt.get(t);var i;if(n&&(i=n,Ut.unregister(i),n()),"function"==typeof e){const i=new WeakRef(t);return n=Lt((()=>{Et(i.deref(),e(),!1)})),Rt.set(t,n),((t,e,{debug:n,return:i,token:s=t}=Bt)=>{const r=i||new Proxy(t,Bt),o=[r,[e,t,!!n]];return!1!==s&&o.push(s),Ut.register(...o),r})(n,zt,{return:t})}return Rt.delete(t),Et(t,e,!1)});var Lt;export{$t as Hole,a as Signal,K as attr,i as batch,w as computed,S as effect,Ot as html,Tt as htmlFor,Ft as render,d as signal,Wt as svg,Pt as svgFor,l as untracked};

@@ -1,3 +0,3 @@

const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:i}=Object;let o;var a=(e,t,n)=>(o||(o=s()),n?o.setStartAfter(e):o.setStartBefore(e),o.setEndAfter(t),o.deleteContents(),e);const c=({firstChild:e,lastChild:t},n)=>a(e,t,n);let u=!1;const d=(e,t)=>u&&11===e.nodeType?1/t<0?t?c(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,h=e=>document.createComment(e);class f extends((e=>{function t(e){return i(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=h("<>");#t=h("</>");#n=r;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),u=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){c(this,!1)}replaceWith(e){c(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===r&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const p=(e,t,n)=>e.setAttribute(t,n),g=(e,t)=>e.removeAttribute(t);let m;const v=(t,n,r)=>{r=r.slice(1),m||(m=new WeakMap);const s=m.get(t)||l(m,t,{});let i=s[r];return i&&i[0]&&t.removeEventListener(r,...i),i=e(n)?n:[n,!1],s[r]=i,i[0]&&t.addEventListener(r,...i),n};function C(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const w=(e,t,n)=>e[n]=t,b=(e,t,n)=>w(e,t,n.slice(1)),x=(e,t,n)=>null==t?(g(e,n),t):w(e,t,n),y=(e,t)=>("function"==typeof t?t(e):t.current=e,t),$=(e,t,n)=>(null==t?g(e,n):p(e,n,t),t),N=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,t,n)=>{const{length:s}=t;if(e.data=`[${s}]`,s)return((e,t,n,r,s)=>{const l=n.length;let i=t.length,o=l,a=0,c=0,u=null;for(;a<i||c<o;)if(i===a){const t=o<l?c?r(n[c-1],-0).nextSibling:r(n[o-c],0):s;for(;c<o;)e.insertBefore(r(n[c++],1),t)}else if(o===c)for(;a<i;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[i-1]===n[o-1])i--,o--;else if(t[a]===n[o-1]&&n[c]===t[i-1]){const s=r(t[--i],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--o],1),s),t[i]=n[o]}else{if(!u){u=new Map;let e=c;for(;e<o;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(c<s&&s<o){let l=a,d=1;for(;++l<i&&l<o&&u.get(t[l])===s+d;)d++;if(d>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,d,e);switch(n.length){case 1:n[0].remove();case 0:break;default:a(d(n[0],0),d(n.at(-1),-0),!1)}return r},O=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?g(e,s):p(e,s,r)}return t}],["class",(e,t)=>x(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",y],["style",(e,t)=>null==t?x(e,t,"style"):w(e.style,t,"cssText")]]),W=(e,r,s)=>{switch(r[0]){case".":return b;case"?":return N;case"@":return v;default:return s||"ownerSVGElement"in e?"ref"===r?y:$:O.get(r)||(r in e?r.startsWith("on")?w:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?x:$:$)}},A=(e,t)=>(e.textContent=null==t?"":t,t),M=(e,t,n)=>({p:e,u:t,n:n}),S=e=>({s:e,t:null,n:null,d:r}),E=(e,t)=>t.reduceRight(T,e),T=(e,t)=>e.childNodes[t];var j=e=>(t,n)=>{const{f:s,e:l,d:i}=e(t,n),o=s.cloneNode(!0);let a,c,u=l===r?r:[];for(let e=0;e<l.length;e++){const{p:t,u:n,n:s}=l[e],i=t===c?a:a=E(o,c=t);u[e]={v:r,u:n,t:i,n:s}}return((e,t)=>({n:e,d:t}))(i?o.firstChild:new f(o),u)};const B=/^(?:plaintext|script|style|textarea|title|xmp)$/i,P=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,R=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,z=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,F=/[\x01\x02]/g;let L,D,H=document.createElement("template");var Z=(e,t)=>{if(t)return L||(L=document.createElementNS("http://www.w3.org/2000/svg","svg"),D=s(),D.selectNodeContents(L)),D.createContextualFragment(e);H.innerHTML=e;const{content:n}=H;return H=H.cloneNode(!1),n};const G=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=()=>document.createTextNode(""),_=(t,n,s)=>{const i=Z(((e,t,n)=>{let r=0;return e.join("").trim().replace(R,((e,t,r,s)=>`<${t}${r.replace(z,"=$2$1").trimEnd()}${s?n||P.test(t)?" /":`></${t}`:""}>`)).replace(F,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,I,s),s),{length:o}=t;let a=r;if(o>1){const t=[],r=document.createTreeWalker(i,129);let l=0,c=`${I}${l++}`;for(a=[];l<o;){const i=r.nextNode();if(8===i.nodeType){if(i.data===c){const r=e(n[l-1])?k:C;r===C&&t.push(i),a.push(M(G(i),r,null)),c=`${I}${l++}`}}else{let e;for(;i.hasAttribute(c);){e||(e=G(i));const t=i.getAttribute(c);a.push(M(e,W(i,t,s),t)),g(i,c),c=`${I}${l++}`}!s&&B.test(i.localName)&&i.textContent.trim()===`\x3c!--${c}--\x3e`&&(a.push(M(e||G(i),A,null)),c=`${I}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(V())}const{childNodes:c}=i;let{length:u}=c;return u<1?(u=1,i.appendChild(V())):1===u&&1!==o&&1!==c[0].nodeType&&(u=0),l(q,t,{f:i,e:a,d:1===u})},q=new WeakMap,I="isµ";var J=e=>(t,n)=>q.get(t)||_(t,n,e);const K=j(J(!1)),Q=j(J(!0)),U=({u:e})=>e===k?S([]):e===C?S(r):null,X=(e,{s:t,t:n,v:r})=>{let s=0,{d:l,s:i}=e;if(e.t!==n){const{n:s,d:o}=(t?Q:K)(n,r);e.t=n,e.n=s,e.d=l=o,r.length&&(e.s=i=o.map(U))}for(;s<l.length;s++){const e=r[s],t=l[s],{v:n,u:o,t:a,n:c}=t;switch(o){case k:t.v=k(a,Y(i[s],e),n);break;case C:const r=e instanceof ee?X(i[s],e):e;r!==n&&(t.v=C.call(t,a,r));break;default:e!==n&&(t.v=o(a,e,c,n))}}return e.n},Y=({s:e},t)=>{let n=0,{length:s}=t;for(s<e.length&&e.splice(s);n<s;n++){const s=t[n],l=s instanceof ee,i=e[n]||(e[n]=l?S(r):null);l&&(t[n]=X(i,s))}return t};class ee{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:i}=Object;let o;var a=(e,t,n)=>(o||(o=s()),n?o.setStartAfter(e):o.setStartBefore(e),o.setEndAfter(t),o.deleteContents(),e);const c=({firstChild:e,lastChild:t},n)=>a(e,t,n);let u=!1;const d=(e,t)=>u&&11===e.nodeType?1/t<0?t?c(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,h=e=>document.createComment(e);class f extends((e=>{function t(e){return i(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=h("<>");#t=h("</>");#n=r;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),u=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){c(this,!1)}replaceWith(e){c(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===r&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const p=(e,t,n)=>e.setAttribute(t,n),g=(e,t)=>e.removeAttribute(t);let m;const v=(t,n,r)=>{r=r.slice(1),m||(m=new WeakMap);const s=m.get(t)||l(m,t,{});let i=s[r];return i&&i[0]&&t.removeEventListener(r,...i),i=e(n)?n:[n,!1],s[r]=i,i[0]&&t.addEventListener(r,...i),n};function C(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const w=(e,t,n)=>e[n]=t,b=(e,t,n)=>w(e,t,n.slice(1)),x=(e,t,n)=>null==t?(g(e,n),t):w(e,t,n),y=(e,t)=>("function"==typeof t?t(e):t.current=e,t),$=(e,t,n)=>(null==t?g(e,n):p(e,n,t),t),N=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),k=(e,t,n)=>{const{length:s}=t;if(e.data=`[${s}]`,s)return((e,t,n,r,s)=>{const l=n.length;let i=t.length,o=l,a=0,c=0,u=null;for(;a<i||c<o;)if(i===a){const t=o<l?c?r(n[c-1],-0).nextSibling:r(n[o-c],0):s;for(;c<o;)e.insertBefore(r(n[c++],1),t)}else if(o===c)for(;a<i;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[i-1]===n[o-1])i--,o--;else if(t[a]===n[o-1]&&n[c]===t[i-1]){const s=r(t[--i],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--o],1),s),t[i]=n[o]}else{if(!u){u=new Map;let e=c;for(;e<o;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(c<s&&s<o){let l=a,d=1;for(;++l<i&&l<o&&u.get(t[l])===s+d;)d++;if(d>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,d,e);switch(n.length){case 1:n[0].remove();case 0:break;default:a(d(n[0],0),d(n.at(-1),-0),!1)}return r},W=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?g(e,s):p(e,s,r)}return t}],["class",(e,t)=>x(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",y],["style",(e,t)=>null==t?x(e,t,"style"):w(e.style,t,"cssText")]]),A=(e,r,s)=>{switch(r[0]){case".":return b;case"?":return N;case"@":return v;default:return s||"ownerSVGElement"in e?"ref"===r?y:$:W.get(r)||(r in e?r.startsWith("on")?w:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?x:$:$)}},O=(e,t)=>(e.textContent=null==t?"":t,t),M=(e,t,n)=>({p:e,u:t,n:n}),S=e=>({s:e,t:null,n:null,d:r}),E=(e,t)=>t.reduceRight(T,e),T=(e,t)=>e.childNodes[t];var j=e=>(t,n)=>{const{f:s,e:l,d:i}=e(t,n),o=s.cloneNode(!0);let a,c,u=l===r?r:[];for(let e=0;e<l.length;e++){const{p:t,u:n,n:s}=l[e],i=t===c?a:a=E(o,c=t);u[e]={v:r,u:n,t:i,n:s}}return((e,t)=>({n:e,d:t}))(i?o.firstChild:new f(o),u)};const B=/^(?:plaintext|script|style|textarea|title|xmp)$/i,P=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,R=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,z=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,F=/[\x01\x02]/g;let L,D,H=document.createElement("template");var Z=(e,t)=>{if(t)return L||(L=document.createElementNS("http://www.w3.org/2000/svg","svg"),D=s(),D.selectNodeContents(L)),D.createContextualFragment(e);H.innerHTML=e;const{content:n}=H;return H=H.cloneNode(!1),n};const G=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=()=>document.createTextNode(""),_=(t,n,s)=>{const i=Z(((e,t,n)=>{let r=0;return e.join("").trim().replace(R,((e,t,r,s)=>`<${t}${r.replace(z,"=$2$1").trimEnd()}${s?n||P.test(t)?" /":`></${t}`:""}>`)).replace(F,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,I,s),s),{length:o}=t;let a=r;if(o>1){const t=[],r=document.createTreeWalker(i,129);let l=0,c=`${I}${l++}`;for(a=[];l<o;){const i=r.nextNode();if(8===i.nodeType){if(i.data===c){const r=e(n[l-1])?k:C;r===C&&t.push(i),a.push(M(G(i),r,null)),c=`${I}${l++}`}}else{let e;for(;i.hasAttribute(c);){e||(e=G(i));const t=i.getAttribute(c);a.push(M(e,A(i,t,s),t)),g(i,c),c=`${I}${l++}`}!s&&B.test(i.localName)&&i.textContent.trim()===`\x3c!--${c}--\x3e`&&(a.push(M(e||G(i),O,null)),c=`${I}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(V())}const{childNodes:c}=i;let{length:u}=c;return u<1?(u=1,i.appendChild(V())):1===u&&1!==o&&1!==c[0].nodeType&&(u=0),l(q,t,{f:i,e:a,d:1===u})},q=new WeakMap,I="isµ";var J=e=>(t,n)=>q.get(t)||_(t,n,e);const K=j(J(!1)),Q=j(J(!0)),U=({u:e})=>e===k?S([]):e===C?S(r):null,X=(e,{s:t,t:n,v:r})=>{let s=0,{d:l,s:i}=e;if(e.t!==n){const{n:s,d:o}=(t?Q:K)(n,r);e.t=n,e.n=s,e.d=l=o,r.length&&(e.s=i=o.map(U))}for(;s<l.length;s++){const e=r[s],t=l[s],{v:n,u:o,t:a,n:c}=t;switch(o){case k:t.v=k(a,Y(i[s],e),n);break;case C:const r=e instanceof ee?X(i[s],e):e;r!==n&&(t.v=C.call(t,a,r));break;default:e!==n&&(t.v=o(a,e,c,n))}}return e.n},Y=({s:e},t)=>{let n=0,{length:s}=t;for(s<e.length&&e.splice(s);n<s;n++){const s=t[n],l=s instanceof ee,i=e[n]||(e[n]=l?S(r):null);l&&(t[n]=X(i,s))}return t};class ee{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const te=e=>(t,...n)=>new ee(e,t,n),ne=te(!1),re=te(!0),se=new WeakMap;var le=(e,t,n)=>{const s=se.get(e)||l(se,e,S(r)),i=n&&"function"==typeof t?t():t,{n:o}=s,a=i instanceof ee?X(s,i):i;return o!==a&&e.replaceChildren((s.n=a).valueOf()),e};
/*! (c) Andrea Giammarchi - MIT */const ie=new WeakMap,oe=e=>(t,n)=>{const s=ie.get(t)||l(ie,t,new Map);return s.get(n)||l(s,n,function(t,...n){return X(this,new ee(e,t,n))}.bind(S(r)))},ae=oe(!1),ce=oe(!0),ue=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),de=Object.create(null),he=new WeakMap,fe=e=>e();var pe=e=>(t,n)=>{let r=he.get(t);var s;if(r&&(s=r,ue.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{le(s.deref(),n().valueOf(),!1)})),he.set(t,r),((e,t,{debug:n,return:r,token:s=e}=de)=>{const l=r||new Proxy(e,de),i=[l,[t,e,!!n]];return!1!==s&&i.push(s),ue.register(...i),l})(r,fe,{return:t})}return he.delete(t),le(t,n.valueOf(),!1)};export{ee as Hole,O as attr,ne as html,ae as htmlFor,pe as reactive,re as svg,ce as svgFor};
/*! (c) Andrea Giammarchi - MIT */const ie=new WeakMap,oe=e=>(t,n)=>{const s=ie.get(t)||l(ie,t,new Map);return s.get(n)||l(s,n,function(t,...n){return X(this,new ee(e,t,n))}.bind(S(r)))},ae=oe(!1),ce=oe(!0),ue=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),de=Object.create(null),he=new WeakMap,fe=e=>e();var pe=e=>(t,n)=>{let r=he.get(t);var s;if(r&&(s=r,ue.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{le(s.deref(),n(),!1)})),he.set(t,r),((e,t,{debug:n,return:r,token:s=e}=de)=>{const l=r||new Proxy(e,de),i=[l,[t,e,!!n]];return!1!==s&&i.push(s),ue.register(...i),l})(r,fe,{return:t})}return he.delete(t),le(t,n,!1)};export{ee as Hole,W as attr,ne as html,ae as htmlFor,pe as reactive,re as svg,ce as svgFor};
/*! (c) Andrea Giammarchi */
let e=null;const t=t=>{let n=e;n||(e=new Set);try{t()}finally{if(!n){[e,n]=[null,e];for(const e of n)e._()}}},n=e=>{const t=[...e];return e.clear(),t};class r extends Set{constructor(e){super()._=e}dispose(){for(const e of n(this))e.delete(this),e.dispose?.()}}let s=null;const l=e=>{const t=new r((()=>{const n=s;s=t;try{e()}finally{s=n}}));return t},o=(e,t)=>{const n=l((()=>{t=e(t)}));return s&&s.add(n),n._(),()=>n.dispose()};class i extends Set{constructor(e){super()._=e}get value(){return s&&s.add(this.add(s)),this._}set value(t){if(this._!==t){this._=t;const r=!e;for(const t of n(this))r?t._():e.add(t)}}peek(){return this._}toJSON(){return this.value}valueOf(){return this.value}toString(){return String(this.value)}}const a=e=>new i(e);class c extends i{constructor(e,t){super(t).f=e,this.e=null}get value(){return this.e||(this.e=l((()=>{super.value=this.f(this._)})))._(),super.value}set value(e){throw new Error("computed is read-only")}}const u=(e,t)=>new c(e,t);const{isArray:d}=Array,{getPrototypeOf:h,getOwnPropertyDescriptor:f}=Object,p=[],g=()=>document.createRange(),v=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:m}=Object;let w;var C=(e,t,n)=>(w||(w=g()),n?w.setStartAfter(e):w.setStartBefore(e),w.setEndAfter(t),w.deleteContents(),e);const y=({firstChild:e,lastChild:t},n)=>C(e,t,n);let x=!1;const b=(e,t)=>x&&11===e.nodeType?1/t<0?t?y(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,$=e=>document.createComment(e);class N extends((e=>{function t(e){return m(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=$("<>");#t=$("</>");#n=p;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),x=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){y(this,!1)}replaceWith(e){y(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===p&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const k=(e,t,n)=>e.setAttribute(t,n),O=(e,t)=>e.removeAttribute(t);let S;const W=(e,t,n)=>{n=n.slice(1),S||(S=new WeakMap);const r=S.get(e)||v(S,e,{});let s=r[n];return s&&s[0]&&e.removeEventListener(n,...s),s=d(t)?t:[t,!1],r[n]=s,s[0]&&e.addEventListener(n,...s),t};function _(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const A=(e,t,n)=>e[n]=t,M=(e,t,n)=>A(e,t,n.slice(1)),E=(e,t,n)=>null==t?(O(e,n),t):A(e,t,n),T=(e,t)=>("function"==typeof t?t(e):t.current=e,t),j=(e,t,n)=>(null==t?O(e,n):k(e,n,t),t),B=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),P=(e,t,n)=>{const{length:r}=t;if(e.data=`[${r}]`,r)return((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,a=0,c=0,u=null;for(;a<o||c<i;)if(o===a){const t=i<l?c?r(n[c-1],-0).nextSibling:r(n[i-c],0):s;for(;c<i;)e.insertBefore(r(n[c++],1),t)}else if(i===c)for(;a<o;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[o-1]===n[i-1])o--,i--;else if(t[a]===n[i-1]&&n[c]===t[o-1]){const s=r(t[--o],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[o]=n[i]}else{if(!u){u=new Map;let e=c;for(;e<i;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(c<s&&s<i){let l=a,d=1;for(;++l<o&&l<i&&u.get(t[l])===s+d;)d++;if(d>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,b,e);switch(n.length){case 1:n[0].remove();case 0:break;default:C(b(n[0],0),b(n.at(-1),-0),!1)}return p},R=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?O(e,s):k(e,s,r)}return t}],["class",(e,t)=>E(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",T],["style",(e,t)=>null==t?E(e,t,"style"):A(e.style,t,"cssText")]]),z=(e,t,n)=>{switch(t[0]){case".":return M;case"?":return B;case"@":return W;default:return n||"ownerSVGElement"in e?"ref"===t?T:j:R.get(t)||(t in e?t.startsWith("on")?A:((e,t)=>{let n;do{n=f(e,t)}while(!n&&(e=h(e)));return n})(e,t)?.set?E:j:j)}},F=(e,t)=>(e.textContent=null==t?"":t,t),L=(e,t,n)=>({p:e,u:t,n:n}),D=e=>({s:e,t:null,n:null,d:p}),H=(e,t)=>t.reduceRight(Z,e),Z=(e,t)=>e.childNodes[t];var G=e=>(t,n)=>{const{f:r,e:s,d:l}=e(t,n),o=r.cloneNode(!0);let i,a,c=s===p?p:[];for(let e=0;e<s.length;e++){const{p:t,u:n,n:r}=s[e],l=t===a?i:i=H(o,a=t);c[e]={v:p,u:n,t:l,n:r}}return((e,t)=>({n:e,d:t}))(l?o.firstChild:new N(o),c)};const J=/^(?:plaintext|script|style|textarea|title|xmp)$/i,V=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,q=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,I=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,K=/[\x01\x02]/g;let Q,U,X=document.createElement("template");var Y=(e,t)=>{if(t)return Q||(Q=document.createElementNS("http://www.w3.org/2000/svg","svg"),U=g(),U.selectNodeContents(Q)),U.createContextualFragment(e);X.innerHTML=e;const{content:n}=X;return X=X.cloneNode(!1),n};const ee=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},te=()=>document.createTextNode(""),ne=(e,t,n)=>{const r=Y(((e,t,n)=>{let r=0;return e.join("").trim().replace(q,((e,t,r,s)=>`<${t}${r.replace(I,"=$2$1").trimEnd()}${s?n||V.test(t)?" /":`></${t}`:""}>`)).replace(K,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(e,se,n),n),{length:s}=e;let l=p;if(s>1){const e=[],o=document.createTreeWalker(r,129);let i=0,a=`${se}${i++}`;for(l=[];i<s;){const r=o.nextNode();if(8===r.nodeType){if(r.data===a){const n=d(t[i-1])?P:_;n===_&&e.push(r),l.push(L(ee(r),n,null)),a=`${se}${i++}`}}else{let e;for(;r.hasAttribute(a);){e||(e=ee(r));const t=r.getAttribute(a);l.push(L(e,z(r,t,n),t)),O(r,a),a=`${se}${i++}`}!n&&J.test(r.localName)&&r.textContent.trim()===`\x3c!--${a}--\x3e`&&(l.push(L(e||ee(r),F,null)),a=`${se}${i++}`)}}for(i=0;i<e.length;i++)e[i].replaceWith(te())}const{childNodes:o}=r;let{length:i}=o;return i<1?(i=1,r.appendChild(te())):1===i&&1!==s&&1!==o[0].nodeType&&(i=0),v(re,e,{f:r,e:l,d:1===i})},re=new WeakMap,se="isµ";var le=e=>(t,n)=>re.get(t)||ne(t,n,e);const oe=G(le(!1)),ie=G(le(!0)),ae=({u:e})=>e===P?D([]):e===_?D(p):null,ce=(e,{s:t,t:n,v:r})=>{let s=0,{d:l,s:o}=e;if(e.t!==n){const{n:s,d:i}=(t?ie:oe)(n,r);e.t=n,e.n=s,e.d=l=i,r.length&&(e.s=o=i.map(ae))}for(;s<l.length;s++){const e=r[s],t=l[s],{v:n,u:i,t:a,n:c}=t;switch(i){case P:t.v=P(a,ue(o[s],e),n);break;case _:const r=e instanceof de?ce(o[s],e):e;r!==n&&(t.v=_.call(t,a,r));break;default:e!==n&&(t.v=i(a,e,c,n))}}return e.n},ue=({s:e},t)=>{let n=0,{length:r}=t;for(r<e.length&&e.splice(r);n<r;n++){const r=t[n],s=r instanceof de,l=e[n]||(e[n]=s?D(p):null);s&&(t[n]=ce(l,r))}return t};class de{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
let e=null;const t=t=>{let n=e;n||(e=new Set);try{t()}finally{if(!n){[e,n]=[null,e];for(const e of n)e._()}}},n=e=>{const t=[...e];return e.clear(),t};class r extends Set{constructor(e){super()._=e}dispose(){for(const e of n(this))e.delete(this),e.dispose?.()}}let s=null;const l=e=>{const t=new r((()=>{const n=s;s=t;try{e()}finally{s=n}}));return t},o=(e,t)=>{const n=l((()=>{t=e(t)}));return s&&s.add(n),n._(),()=>n.dispose()};class i extends Set{constructor(e){super()._=e}get value(){return s&&s.add(this.add(s)),this._}set value(t){if(this._!==t){this._=t;const r=!e;for(const t of n(this))r?t._():e.add(t)}}peek(){return this._}toJSON(){return this.value}valueOf(){return this.value}toString(){return String(this.value)}}const a=e=>new i(e);class c extends i{constructor(e,t){super(t).f=e,this.e=null}get value(){return this.e||(this.e=l((()=>{super.value=this.f(this._)})))._(),super.value}set value(e){throw new Error("computed is read-only")}}const u=(e,t)=>new c(e,t);const{isArray:d}=Array,{getPrototypeOf:h,getOwnPropertyDescriptor:f}=Object,p=[],g=()=>document.createRange(),v=(e,t,n)=>(e.set(t,n),n),{setPrototypeOf:m}=Object;let w;var C=(e,t,n)=>(w||(w=g()),n?w.setStartAfter(e):w.setStartBefore(e),w.setEndAfter(t),w.deleteContents(),e);const y=({firstChild:e,lastChild:t},n)=>C(e,t,n);let x=!1;const b=(e,t)=>x&&11===e.nodeType?1/t<0?t?y(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,$=e=>document.createComment(e);class N extends((e=>{function t(e){return m(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=$("<>");#t=$("</>");#n=p;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),x=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){y(this,!1)}replaceWith(e){y(this,!0).replaceWith(e)}valueOf(){let{firstChild:e,lastChild:t,parentNode:n}=this;if(n===this)this.#n===p&&(this.#n=[...this.childNodes]);else{if(n)for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling);this.replaceChildren(...this.#n)}return this}}const k=(e,t,n)=>e.setAttribute(t,n),S=(e,t)=>e.removeAttribute(t);let O;const W=(e,t,n)=>{n=n.slice(1),O||(O=new WeakMap);const r=O.get(e)||v(O,e,{});let s=r[n];return s&&s[0]&&e.removeEventListener(n,...s),s=d(t)?t:[t,!1],r[n]=s,s[0]&&e.addEventListener(n,...s),t};function _(e,t){let{n:n}=this,r=!1;switch(typeof t){case"object":if(null!==t){(n||e).replaceWith(this.n=t.valueOf());break}case"undefined":r=!0;default:e.data=r?"":t,n&&(this.n=null,n.replaceWith(e))}return t}const A=(e,t,n)=>e[n]=t,M=(e,t,n)=>A(e,t,n.slice(1)),E=(e,t,n)=>null==t?(S(e,n),t):A(e,t,n),T=(e,t)=>("function"==typeof t?t(e):t.current=e,t),j=(e,t,n)=>(null==t?S(e,n):k(e,n,t),t),B=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),P=(e,t,n)=>{const{length:r}=t;if(e.data=`[${r}]`,r)return((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,a=0,c=0,u=null;for(;a<o||c<i;)if(o===a){const t=i<l?c?r(n[c-1],-0).nextSibling:r(n[i-c],0):s;for(;c<i;)e.insertBefore(r(n[c++],1),t)}else if(i===c)for(;a<o;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[c])a++,c++;else if(t[o-1]===n[i-1])o--,i--;else if(t[a]===n[i-1]&&n[c]===t[o-1]){const s=r(t[--o],-1).nextSibling;e.insertBefore(r(n[c++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[o]=n[i]}else{if(!u){u=new Map;let e=c;for(;e<i;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(c<s&&s<i){let l=a,d=1;for(;++l<o&&l<i&&u.get(t[l])===s+d;)d++;if(d>s-c){const l=r(t[a],0);for(;c<s;)e.insertBefore(r(n[c++],1),l)}else e.replaceChild(r(n[c++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,n,t,b,e);switch(n.length){case 1:n[0].remove();case 0:break;default:C(b(n[0],0),b(n.at(-1),-0),!1)}return p},R=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?S(e,s):k(e,s,r)}return t}],["class",(e,t)=>E(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",T],["style",(e,t)=>null==t?E(e,t,"style"):A(e.style,t,"cssText")]]),z=(e,t,n)=>{switch(t[0]){case".":return M;case"?":return B;case"@":return W;default:return n||"ownerSVGElement"in e?"ref"===t?T:j:R.get(t)||(t in e?t.startsWith("on")?A:((e,t)=>{let n;do{n=f(e,t)}while(!n&&(e=h(e)));return n})(e,t)?.set?E:j:j)}},F=(e,t)=>(e.textContent=null==t?"":t,t),L=(e,t,n)=>({p:e,u:t,n:n}),D=e=>({s:e,t:null,n:null,d:p}),H=(e,t)=>t.reduceRight(Z,e),Z=(e,t)=>e.childNodes[t];var G=e=>(t,n)=>{const{f:r,e:s,d:l}=e(t,n),o=r.cloneNode(!0);let i,a,c=s===p?p:[];for(let e=0;e<s.length;e++){const{p:t,u:n,n:r}=s[e],l=t===a?i:i=H(o,a=t);c[e]={v:p,u:n,t:l,n:r}}return((e,t)=>({n:e,d:t}))(l?o.firstChild:new N(o),c)};const J=/^(?:plaintext|script|style|textarea|title|xmp)$/i,V=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,q=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,I=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,K=/[\x01\x02]/g;let Q,U,X=document.createElement("template");var Y=(e,t)=>{if(t)return Q||(Q=document.createElementNS("http://www.w3.org/2000/svg","svg"),U=g(),U.selectNodeContents(Q)),U.createContextualFragment(e);X.innerHTML=e;const{content:n}=X;return X=X.cloneNode(!1),n};const ee=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},te=()=>document.createTextNode(""),ne=(e,t,n)=>{const r=Y(((e,t,n)=>{let r=0;return e.join("").trim().replace(q,((e,t,r,s)=>`<${t}${r.replace(I,"=$2$1").trimEnd()}${s?n||V.test(t)?" /":`></${t}`:""}>`)).replace(K,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(e,se,n),n),{length:s}=e;let l=p;if(s>1){const e=[],o=document.createTreeWalker(r,129);let i=0,a=`${se}${i++}`;for(l=[];i<s;){const r=o.nextNode();if(8===r.nodeType){if(r.data===a){const n=d(t[i-1])?P:_;n===_&&e.push(r),l.push(L(ee(r),n,null)),a=`${se}${i++}`}}else{let e;for(;r.hasAttribute(a);){e||(e=ee(r));const t=r.getAttribute(a);l.push(L(e,z(r,t,n),t)),S(r,a),a=`${se}${i++}`}!n&&J.test(r.localName)&&r.textContent.trim()===`\x3c!--${a}--\x3e`&&(l.push(L(e||ee(r),F,null)),a=`${se}${i++}`)}}for(i=0;i<e.length;i++)e[i].replaceWith(te())}const{childNodes:o}=r;let{length:i}=o;return i<1?(i=1,r.appendChild(te())):1===i&&1!==s&&1!==o[0].nodeType&&(i=0),v(re,e,{f:r,e:l,d:1===i})},re=new WeakMap,se="isµ";var le=e=>(t,n)=>re.get(t)||ne(t,n,e);const oe=G(le(!1)),ie=G(le(!0)),ae=({u:e})=>e===P?D([]):e===_?D(p):null,ce=(e,{s:t,t:n,v:r})=>{let s=0,{d:l,s:o}=e;if(e.t!==n){const{n:s,d:i}=(t?ie:oe)(n,r);e.t=n,e.n=s,e.d=l=i,r.length&&(e.s=o=i.map(ae))}for(;s<l.length;s++){const e=r[s],t=l[s],{v:n,u:i,t:a,n:c}=t;switch(i){case P:t.v=P(a,ue(o[s],e),n);break;case _:const r=e instanceof de?ce(o[s],e):e;r!==n&&(t.v=_.call(t,a,r));break;default:e!==n&&(t.v=i(a,e,c,n))}}return e.n},ue=({s:e},t)=>{let n=0,{length:r}=t;for(r<e.length&&e.splice(r);n<r;n++){const r=t[n],s=r instanceof de,l=e[n]||(e[n]=s?D(p):null);s&&(t[n]=ce(l,r))}return t};class de{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const he=e=>(t,...n)=>new de(e,t,n),fe=he(!1),pe=he(!0),ge=new WeakMap;var ve=(e,t,n)=>{const r=ge.get(e)||v(ge,e,D(p)),s=n&&"function"==typeof t?t():t,{n:l}=r,o=s instanceof de?ce(r,s):s;return l!==o&&e.replaceChildren((r.n=o).valueOf()),e};
/*! (c) Andrea Giammarchi - MIT */const me=new WeakMap,we=e=>(t,n)=>{const r=me.get(t)||v(me,t,new Map);return r.get(n)||v(r,n,function(t,...n){return ce(this,new de(e,t,n))}.bind(D(p)))},Ce=we(!1),ye=we(!0),xe=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),be=Object.create(null),$e=new WeakMap,Ne=e=>e();const ke=(e=>(t,n)=>{let r=$e.get(t);var s;if(r&&(s=r,xe.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{ve(s.deref(),n().valueOf(),!1)})),$e.set(t,r),((e,t,{debug:n,return:r,token:s=e}=be)=>{const l=r||new Proxy(e,be),o=[l,[t,e,!!n]];return!1!==s&&o.push(s),xe.register(...o),l})(r,Ne,{return:t})}return $e.delete(t),ve(t,n.valueOf(),!1)})(o);export{c as Computed,de as Hole,i as Signal,R as attr,t as batch,u as computed,o as effect,fe as html,Ce as htmlFor,ke as render,a as signal,pe as svg,ye as svgFor};
/*! (c) Andrea Giammarchi - MIT */const me=new WeakMap,we=e=>(t,n)=>{const r=me.get(t)||v(me,t,new Map);return r.get(n)||v(r,n,function(t,...n){return ce(this,new de(e,t,n))}.bind(D(p)))},Ce=we(!1),ye=we(!0),xe=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),be=Object.create(null),$e=new WeakMap,Ne=e=>e();const ke=(e=>(t,n)=>{let r=$e.get(t);var s;if(r&&(s=r,xe.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{ve(s.deref(),n(),!1)})),$e.set(t,r),((e,t,{debug:n,return:r,token:s=e}=be)=>{const l=r||new Proxy(e,be),o=[l,[t,e,!!n]];return!1!==s&&o.push(s),xe.register(...o),l})(r,Ne,{return:t})}return $e.delete(t),ve(t,n,!1)})(o);export{c as Computed,de as Hole,i as Signal,R as attr,t as batch,u as computed,o as effect,fe as html,Ce as htmlFor,ke as render,a as signal,pe as svg,ye as svgFor};

@@ -5,3 +5,3 @@ export function cloned(node: any): any;

export function asElement({ [nodeType]: type }: {
"__@nodeType@24978": any;
"__@nodeType@24977": any;
}): boolean;

@@ -8,0 +8,0 @@ export function changeParentNode(node: any, parent: any): any;

@@ -15,7 +15,2 @@ export function cel(f: DocumentFragment, e: Entry[], d: boolean): {

export type DOMValue = null | undefined | string | number | boolean | Node | Element | PersistentFragment;
export type Entry = {
path: number[];
update: Function;
name: string;
};
export type Detail = {

@@ -35,6 +30,20 @@ /**

/**
* the name of the attribute, if any
* the attribute name, if any, or `null`
*/
n: string;
n: string | null;
};
export type Entry = {
/**
* the path to retrieve the node
*/
p: number[];
/**
* the update function
*/
u: Function;
/**
* the attribute name, if any, or `null`
*/
n: string | null;
};
export type Cache = {

@@ -41,0 +50,0 @@ /**

export type DOMValue = import("./literals.js").DOMValue;
export type Target = import("./literals.js").Target;
import render from './render/node.js';
/**
* Render directly within a generic container.
* @template T
* @param {T} where the DOM node where to render content
* @param {(() => Target) | Target} what the node to render
* @returns
*/
export function render<T>(where: T, what: (() => Target) | Target): T;
/** @type {(template: TemplateStringsArray, ...values:DOMValue[]) => Target} A tag to render HTML content. */

@@ -9,2 +16,2 @@ export const html: (template: TemplateStringsArray, ...values: DOMValue[]) => Target;

import { attr } from './handler.js';
export { render, attr };
export { attr };
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc