@nextwebwg/html-next 1.0.0-alpha.3 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # `@nextwebwg/html-next`
2
2
 
3
- Reference implementation for the [Declarative HTML Components proposal](https://nextwebwg.org/html-next/),
4
- including the [HTML Forms](https://nextwebwg.org/html-forms/) validity model it builds on
5
- (`@nextwebwg/html-next/validation`). It replaces `@nextwebwg/declarative-components`. It provides three paths over one component language:
3
+ Reference implementation for the [Declarative HTML Components proposal](https://nextwebwg.org/html-next/)
4
+ and the [HTML Forms proposal](https://nextwebwg.org/html-forms/): the validity model
5
+ (`@nextwebwg/html-next/validation`) and native form request construction
6
+ (`@nextwebwg/html-next/forms`). It replaces `@nextwebwg/declarative-components`. It provides three
7
+ paths over one component language:
6
8
 
7
9
  - a complete browser distributable for dynamic component graphs;
8
10
  - an application/library compiler that emits native DOM and graph-scoped runtime support; and
@@ -12,6 +14,11 @@ The live runtime supports every declarative capability. Builds analyze an applic
12
14
  graph and share the support that graph requires; Vue conversion preserves the same observable
13
15
  contract through Vue's own reactivity.
14
16
 
17
+ `@nextwebwg/html-next/forms` builds requests from native forms and submitters, preserving
18
+ successful-control, validation, encoding, and cancellation semantics. It accepts native DOM objects
19
+ and imports nothing else from this package, so a consumer that only wants HTML Forms pays only for
20
+ that subpath.
21
+
15
22
  See the [proposal](https://nextwebwg.org/html-next/) and
16
23
  [independent goal ledger](docs/delivery-goals.md).
17
24
 
@@ -1,9 +1,9 @@
1
- var K=class extends Error{diagnostic;constructor(e){let n=e.source?`${e.source}: `:"";super(`${n}${e.code}: ${e.message}`),this.name="HtmlDiagnosticError",this.diagnostic=Object.freeze({...e})}};function y(t,e,n){throw new K(n===void 0?{code:t,message:e}:{code:t,message:e,source:n})}function rt([t],[e]){return t.localeCompare(e)}async function ot(t,e){let n=new Map,r=new Map,o=new Map,i=async c=>{let l=new URL(c.url).href,f=r.get(l)??l,d=n.get(f);if(d!==void 0)return d.url;let h;try{h=await e.fetchComponent(l)}catch(g){if(g instanceof K)throw g;y("HL009",`Component \`${l}\` failed to load: ${g instanceof Error?g.message:String(g)}.`,l)}let u=e.resolver.assertFinalURL(c,h.url,l);r.set(l,u);let p=n.get(u);if(p!==void 0)return p.url;let m=e.parseComponentResource(h.source,u),v=m.definition,C=o.get(v.contract.tag);C!==void 0&&C!==u&&y("HL007",`Both \`${C}\` and \`${u}\` declare <${v.contract.tag}>.`,u),o.set(v.contract.tag,u);let k={url:u,trustRoot:c.trustRoot,definition:v,dependencies:[],shadowedByCustomElement:e.isCustomElementRegistered?.(v.contract.tag)??!1,complete:!1};if(n.set(u,k),v.controller!==void 0){let g=e.resolver.resolveDependency(v.controller,u,c.trustRoot);k.controller=Object.freeze({specifier:v.controller,url:g.url})}for(let g of m.dependencies){let b=e.resolver.resolveDependency(g,u,c.trustRoot),w=await i(b);k.dependencies.includes(w)||k.dependencies.push(w)}return k.complete=!0,u},a=[];for(let c of t)a.push(await i(e.resolver.resolveRoot(c)));let s=[];for(let[c,l]of Array.from(n).sort(rt))l.complete||y("HL008",`Component graph did not finish loading \`${c}\`.`),s.push([c,Object.freeze({url:c,trustRoot:l.trustRoot,definition:l.definition,dependencies:Object.freeze(Array.from(l.dependencies)),...l.controller===void 0?{}:{controller:l.controller},shadowedByCustomElement:l.shadowedByCustomElement})]);return Object.freeze({roots:Object.freeze(a),nodes:new Map(s),tags:new Map(Array.from(o).sort(rt))})}function J(t){if(typeof t!="object"||t===null||Object.isFrozen(t))return t;for(let e of Object.values(t))J(e);return Object.freeze(t)}function it(t){let e="",n=!0;for(let r of t)r==="-"?n=!0:(e+=n?r.toUpperCase():r,n=!1);return e}function Re(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var cn=new Set(["string","boolean","number","integer","null","absent","trusted-html","trusted-script","function","unknown"]),ce=class extends SyntaxError{constructor(n,r){super(`${n} at character ${r+1}.`);this.position=r;this.name="TypeSyntaxError"}position},Se=class{constructor(e){this.source=e}source;#e=0;parse(){let e=this.#t();return this.#d(),this.#e!==this.source.length&&this.#l("Unexpected type syntax"),e}#t(){let e=[this.#n()];for(;this.#s("|");)e.push(this.#n());return e.length===1?e[0]:Ne(e)}#n(){let e=this.#o();for(;this.#s("?");)e=Ne([e,{kind:"terminal",name:"null"},{kind:"terminal",name:"absent"}]);return e}#o(){if(this.#s("(")){let r=this.#t();return this.#a(")"),r}let e=this.#c();if(e!==void 0)return{kind:"keyword",value:e};let n=this.#r();if(n===void 0&&this.#l("Expected a type, keyword, or group"),n==="list"||n==="record"){this.#a("(");let r=this.#t();return this.#a(")"),n==="list"?{kind:"list",item:r}:{kind:"record",value:r}}return n==="object"?this.#i():cn.has(n)?{kind:"terminal",name:n}:{kind:"keyword",value:n}}#i(){this.#a("("),this.#a("{");let e=[],n=!1;for(;!this.#s("}");){if(this.#d(),this.source.startsWith("...",this.#e))this.#e+=3,n=!0;else{let r=this.#c()??this.#r();r===void 0&&this.#l("Expected an object field or `...`");let o=this.#s("?");this.#a(":");let i=this.#t();e.some(a=>a.name===r)&&this.#l(`Duplicate object field \`${r}\``),e.push({name:r,type:i,optional:o})}if(this.#s("}"))break;this.#a(","),n&&(this.#d(),this.source.startsWith("}",this.#e)||this.#l("The open marker must be last"))}return this.#a(")"),{kind:"object",fields:e,open:n}}#r(){this.#d();let e=/^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.#e));if(e!==null)return this.#e+=e[0].length,e[0]}#c(){this.#d();let e=this.source[this.#e];if(e!=='"'&&e!=="'")return;this.#e+=1;let n="";for(;this.#e<this.source.length;){let r=this.source[this.#e++];if(r===e)return n;if(r!=="\\"){n+=r;continue}this.#e>=this.source.length&&this.#l("Unterminated escape");let o=this.source[this.#e++];n+={n:`
2
- `,r:"\r",t:" ","\\":"\\",'"':'"',"'":"'"}[o]??o}this.#l("Unterminated quoted keyword")}#s(e){return this.#d(),this.source.startsWith(e,this.#e)?(this.#e+=e.length,!0):!1}#a(e){this.#s(e)||this.#l(`Expected \`${e}\``)}#d(){for(;/\s/.test(this.source[this.#e]??"");)this.#e+=1}#l(e){throw new ce(e,this.#e)}};function Ne(t){let e=t.flatMap(o=>o.kind==="union"?o.members:[o]),n=new Map(e.map(o=>[U(o),o])),r=Array.from(n.values());return r.length===1?r[0]:{kind:"union",members:r}}function de(t){if(t.trim()==="")throw new ce("A type expression cannot be empty",0);return J(new Se(t).parse())}function $e(t){return typeof t=="object"&&t!==null&&"kind"in t&&["terminal","keyword","union","list","record","object"].includes(String(t.kind))}function le(t){return $e(t)?t:typeof t=="string"?{kind:"terminal",name:t}:Ne(t.enum.map(e=>({kind:"keyword",value:e})))}function U(t){let e=$e(t)?t:le(t);switch(e.kind){case"terminal":return e.name;case"keyword":return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(e.value)?e.value:JSON.stringify(e.value);case"union":return e.members.map(n=>U(n)).join(" | ");case"list":return`list(${U(e.item)})`;case"record":return`record(${U(e.value)})`;case"object":return`object({ ${[...e.fields.map(n=>`${n.name}${n.optional?"?":""}: ${U(n.type)}`),...e.open?["..."]:[]].join(", ")} })`}}function j(t,e,n){return{ok:!1,issues:[{reason:t,message:e,path:n}]}}function Q(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}function st(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Te(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return Symbol.for("html-next.bad-json")}}function dn(t,e){if(typeof t!="object"||t===null)return!1;if(t.kind===e&&"value"in t)return!0;let n=e==="trusted-html"?"TrustedHTML":"TrustedScript";return t.constructor?.name===n||Object.prototype.toString.call(t)===`[object ${n}]`}function ln(t,e,n){switch(e){case"string":return typeof t=="string"?{ok:!0,value:t}:j("typeMismatch","Must be a string.",n);case"boolean":return typeof t=="boolean"?{ok:!0,value:t}:t===""||t==="true"?{ok:!0,value:!0}:t==="false"?{ok:!0,value:!1}:j("typeMismatch","Must be true or false.",n);case"number":case"integer":{let r=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(r)?e==="integer"&&!Number.isInteger(r)?j("typeMismatch","Must be an integer.",n):{ok:!0,value:r}:j("badInput",`Must be ${e==="integer"?"an integer":"a finite number"}.`,n)}case"null":return t===null?{ok:!0,value:null}:j("typeMismatch","Must be null.",n);case"absent":return t===void 0?{ok:!0,value:void 0}:j("typeMismatch","Must be absent.",n);case"trusted-html":case"trusted-script":return dn(t,e)?{ok:!0,value:t}:j("untrustedValue",`Must be a ${e==="trusted-html"?"TrustedHTML":"TrustedScript"} value.`,n);case"function":return typeof t=="function"?{ok:!0,value:t}:j("typeMismatch","Must be a function supplied through a property.",n);case"unknown":return{ok:!0,value:t}}}function Y(t,e,n){switch(e.kind){case"terminal":return ln(t,e.name,n);case"keyword":return t===e.value?{ok:!0,value:t}:j("typeMismatch",`Must be ${JSON.stringify(e.value)}.`,n);case"union":{for(let r of e.members){let o=Y(t,r,n);if(o.ok)return o}return j("typeMismatch",`Must match ${U(e)}.`,n)}case"list":{let r=Te(t);if(!Array.isArray(r))return j("typeMismatch","Must be a list.",n);let o=[],i=[];return r.forEach((a,s)=>{let c=Y(a,e.item,Q(n,s));c.ok?o.push(c.value):i.push(...c.issues)}),i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"record":{let r=Te(t);if(!st(r))return j("typeMismatch","Must be a string-keyed record.",n);let o={},i=[];for(let[a,s]of Object.entries(r)){let c=Y(s,e.value,Q(n,a));c.ok?o[a]=c.value:i.push(...c.issues)}return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"object":{let r=Te(t);if(!st(r))return j("typeMismatch","Must be an object.",n);let o={},i=[],a=new Map(e.fields.map(s=>[s.name,s]));for(let s of e.fields){if(!(s.name in r)){s.optional||i.push({reason:"typeMismatch",message:"Required field is absent.",path:Q(n,s.name)});continue}let c=Y(r[s.name],s.type,Q(n,s.name));c.ok?o[s.name]=c.value:i.push(...c.issues)}for(let[s,c]of Object.entries(r))a.has(s)||(e.open?o[s]=c:i.push({reason:"typeMismatch",message:"Field is not declared by this closed object type.",path:Q(n,s)}));return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}}}function B(t,e,n="$"){return Y(t,le(e),n)}function Ae(t,e){let n=B(t,e);if(!n.ok)throw new TypeError(n.issues.map(o=>`${o.path}: ${o.message}`).join("; "));let r=le(e);if(r.kind==="terminal"&&(r.name==="function"||r.name==="unknown"))throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);return r.kind==="list"||r.kind==="record"||r.kind==="object"||r.kind==="union"&&typeof n.value=="object"&&n.value!==null?JSON.stringify(n.value):n.value===null?"null":n.value===void 0?"":String(n.value)}function _(t){let e=le(t);return e.kind==="terminal"?!["function","unknown","trusted-html","trusted-script"].includes(e.name):e.kind==="keyword"?!0:e.kind==="union"?e.members.every(_):e.kind==="list"?_(e.item):e.kind==="record"?_(e.value):e.fields.every(n=>_(n.type))}function He(t){let e;try{e=de(t)}catch(n){y("HC013",n instanceof Error?n.message:"Invalid prop type expression.")}return e.kind==="terminal"&&(e.name==="string"||e.name==="boolean"||e.name==="number")?e.name:e.kind==="keyword"?{enum:[e.value]}:e.kind==="union"&&e.members.every(n=>n.kind==="keyword")?{enum:e.members.map(n=>n.value)}:e}var E=Symbol("absent"),ee=class extends Error{constructor(n){super(`\`${n}\` is not declared in scope.`);this.identifier=n;this.name="UndeclaredName"}identifier},De=/\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y,un=/\\([\s\S])/g,fn=/%s/g,pn={or:1,and:2,"=":3,"!=":3,"^=":3,"$=":3,"*=":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6};function at(t){return pn[t]??0}function mn(t){return t==="round"||t==="clamp"||t==="min"||t==="max"||t==="abs"||t==="format"}function hn(t){let e=0,n=0,r="";function o(){De.lastIndex=e;let d=De.exec(t);if(d===null){let h=t.slice(e).trimStart()[0];throw h==='"'||h==="'"?new SyntaxError("Unterminated string literal."):new SyntaxError(`Unexpected character \`${h}\`.`)}e=De.lastIndex,d[1]!==void 0||d[5]!==void 0?(n=4,r=d[1]??d[5]):d[2]!==void 0?(n=1,r=Number(d[2])):d[3]!==void 0?(n=2,r=d[3].slice(1,-1).replace(un,"$1")):d[4]!==void 0?(n=3,r=d[4]):(n=0,r="")}function i(d){return r!==d?!1:(o(),!0)}function a(d){if(!i(d))throw new SyntaxError(`Expected \`${d}\`.`)}function s(d){let h=c(),u=at(r);for(;u>=d;){let p=r;o(),h={kind:"binary",op:p,left:h,right:s(u+1)},u=at(r)}return h}function c(){if(n===3&&r==="not")return o(),{kind:"unary",op:"not",operand:c()};if(i("-"))return{kind:"unary",op:"-",operand:c()};let d=l();for(;n===4;)if(i(".")){if(n!==3)throw new SyntaxError("Expected a property name after `.`.");let h=r;o(),d={kind:"member",object:d,key:h}}else if(i("[")){let h=s(1);a("]"),d={kind:"index",object:d,index:h}}else break;return d}function l(){let d=n,h=r;if(d===1||d===2)return o(),{kind:"literal",value:h};if(d===4&&h==="("){o();let u=s(1);return a(")"),u}if(d===4&&h==="{"){o();let u=[];if(!i("}")){do{if(r==="}")break;if(n!==3&&n!==2)throw new SyntaxError("Object keys must be identifiers or strings.");let p=r;o(),a(":"),u.push({key:p,value:s(1)})}while(i(","));a("}")}return{kind:"object",pairs:u}}if(d===4&&h==="["){o();let u=[];if(!i("]")){do{if(r==="]")break;u.push(s(1))}while(i(","));a("]")}return{kind:"array",items:u}}if(d===3){let u=h;if(o(),u==="true")return{kind:"literal",value:!0};if(u==="false")return{kind:"literal",value:!1};if(u==="null")return{kind:"literal",value:null};if(r==="("&&mn(u)){o();let p=[];if(!i(")")){do p.push(s(1));while(i(","));a(")")}return{kind:"call",fn:u,args:p}}return{kind:"id",name:u}}throw new SyntaxError("Unexpected end of expression.")}o();let f=s(1);if(n!==0)throw new SyntaxError("Unexpected trailing input in expression.");return f}function X(t){return t===E||t===null}function L(t){if(t===E||t===null||t===!1)return!1;if(t===!0)return!0;if(typeof t=="string")return t.length>0;if(typeof t=="number")return t!==0&&t===t;if(Array.isArray(t))return t.length>0;for(let e in t)if(Object.hasOwn(t,e))return!0;return!1}function ue(t){return typeof t=="number"&&t===t?t:E}function H(t,e){switch(t.kind){case"literal":return t.value;case"id":{let n=e.get(t.name);if(n===void 0)throw new ee(t.name);return n}case"member":{let n=H(t.object,e);if(X(n)||typeof n!="object"||Array.isArray(n))return E;let r=n[t.key];return r===void 0?E:r}case"index":{let n=H(t.object,e),r=H(t.index,e);if(X(n)||X(r))return E;if(Array.isArray(n)&&typeof r=="number"){let o=n[r];return o===void 0?E:o}if(typeof n=="object"&&typeof r=="string"){let o=n[r];return o===void 0?E:o}return E}case"unary":{let n=H(t.operand,e);if(t.op==="not")return!L(n);let r=ue(n);return r===E?E:-r}case"binary":return yn(t,e);case"call":return gn(t,e);case"object":{let n={};for(let r of t.pairs)n[r.key]=H(r.value,e);return n}case"array":{let n=[];for(let r of t.items)n.push(H(r,e));return n}}}function yn(t,e){let{op:n}=t;if(n==="and")return L(H(t.left,e))&&L(H(t.right,e));if(n==="or")return L(H(t.left,e))||L(H(t.right,e));let r=H(t.left,e),o=H(t.right,e);if(n==="=")return r===o;if(n==="!=")return r!==o;if(n==="^="||n==="$="||n==="*=")return typeof r!="string"||typeof o!="string"?E:n==="^="?r.startsWith(o):n==="$="?r.endsWith(o):r.includes(o);let i=ue(r),a=ue(o);if(i===E||a===E)return E;switch(n){case"<":return i<a;case"<=":return i<=a;case">":return i>a;case">=":return i>=a;case"+":return i+a;case"-":return i-a;case"*":return i*a;case"/":return i/a;case"%":return i%a;default:return E}}function gn(t,e){let{args:n,fn:r}=t,o=[];for(let a of n)o.push(H(a,e));if(r==="format"){let a=o[0];if(typeof a!="string")return E;let s=1;return a.replace(fn,()=>s<o.length?P(o[s++]):"%s")}for(let a=0;a<o.length;a+=1){let s=ue(o[a]);if(s===E)return E;o[a]=s}let i=o;switch(r){case"abs":return i.length===1?Math.abs(i[0]):E;case"round":return i.length===1?Math.round(i[0]):E;case"min":return i.length>0?Math.min(...i):E;case"max":return i.length>0?Math.max(...i):E;case"clamp":return i.length===3?Math.min(Math.max(i[0],i[1]),i[2]):E;default:return E}}var ct=new Map;function Me(t){if(t.kind==="id")return t.name;if(t.kind==="member"){let e=Me(t.object);return e===void 0?void 0:`${e}.${t.key}`}if(t.kind==="index"&&t.index.kind==="literal"){let e=t.index.value;if(typeof e!="string"&&typeof e!="number")return;let n=Me(t.object);return n===void 0?void 0:`${n}.${e}`}}function O(t,e){let n=Me(t);if(n!==void 0){e.includes(n)||e.push(n);return}switch(t.kind){case"literal":return;case"id":return;case"member":O(t.object,e);return;case"index":O(t.object,e),O(t.index,e);return;case"unary":O(t.operand,e);return;case"binary":O(t.left,e),O(t.right,e);return;case"call":for(let r of t.args)O(r,e);return;case"object":for(let r of t.pairs)O(r.value,e);return;case"array":for(let r of t.items)O(r,e)}}function Pe(t,e){if(t.kind==="id")return e.push(t.name),!0;if(t.kind==="member")return Pe(t.object,e)?(e.push(t.key),!0):!1;if(t.kind!=="index"||!Pe(t.object,e))return!1;let n=t.index,r=n.kind==="literal"?n.value:void 0;return e.push(typeof r=="string"||typeof r=="number"?r:{kind:"index",expression:n}),!0}function fe(t){let e=ct.get(t);if(e!==void 0)return e;let n=hn(t),r=[];return O(n,r),r.sort(),e={source:t,ast:n,dependencies:r},ct.set(t,e),e}function je(t,e){let n=[];if(!(!Pe(fe(t).ast,n)||!e.has(n[0])))return n}function dt(t,e){return H(fe(t).ast,e)}function I(t,e){return H("ast"in t?t.ast:t,e)}function P(t){return X(t)?"":Array.isArray(t)?t.map(P).join(" "):typeof t=="object"?"":String(t)}function bn(t){return t.startsWith("aria-")||t==="contenteditable"||t==="draggable"||t==="spellcheck"}function lt(t,e=""){return typeof t=="boolean"&&bn(e)?String(t):X(t)||t===!1?null:t===!0?"":typeof t=="number"||typeof t=="string"?String(t):Array.isArray(t)?t.map(P).join(" "):null}var vn=new Set(["href","src","action","formaction","poster","data","xlink:href"]),wn=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),kn=new Set(["srcdoc","style"]);function te(t){let e=t.replace(/[\u0000-\u0020\u007f]+/g,"");return/^(?:data|javascript|vbscript):/i.test(e)}function ne(t){return vn.has(t.toLowerCase())}function Le(t,e,n){let r=e.createElement("template");r.innerHTML=t;for(let o of Array.from(r.content.querySelectorAll("*"))){if(n?.(o),wn.has(o.localName)){o.remove();continue}for(let i of Array.from(o.attributes)){let a=i.name.toLowerCase();(a.startsWith("on")||kn.has(a)||ne(a)&&te(i.value))&&o.removeAttribute(i.name)}}return r.content}var Cn=/^(?:if|else-if|else|for|with|value|state|computed|data)$/,xn=/^(?:@|v-|#|on:|use:|transition:|animate:)/,En=/^(?:innerhtml|outerhtml|srcdoc)$/,Rn=/^(?:base|embed|link|meta|object|script|style)$/;function ut(t){return Cn.test(t)}function Oe(t,e){return Rn.test(t.toLowerCase())&&y("HT009",`<${t}> is not permitted in rendered component markup.`,e),t}function Ie(t,e,n=""){let r=t.toLowerCase();return(r.startsWith("on")||xn.test(r))&&y("HT010",`Literal attribute \`${t}\` uses target-framework directive syntax that is not supported.`,e),r==="srcdoc"&&y("HT007","Literal `srcdoc` is not permitted in a component definition.",e),ne(r)&&te(n)&&y("HT007",`Literal \`${t}\` contains an executable URL.`,e),t}function ft(t,e){let n=t.toLowerCase();return(n.startsWith("on")||En.test(n))&&y("HT007",`Dynamic ${t} requires a future trusted-content type.`,e),t}function z(t){return"tagName"in t}function re(t){return t.nodeName==="#text"}function N(t){return"localName"in t?t.localName:t.tagName}function pe(t){return"attrs"in t?t.attrs:t.attributes}function V(t){return(N(t)==="template"?t.content:void 0)?.childNodes??t.childNodes}function oe(t){return"value"in t?t.value:"nodeValue"in t?t.nodeValue??"":""}function ht(t){let e=[];for(let n of t)n.nodeName!=="#comment"&&(!re(n)||oe(n).trim()!=="")&&e.push(n);return e}function x(t,e){return"attrs"in t?t.attrs.find(n=>n.name===e)?.value:t.getAttribute(e)??void 0}function yt(t){let e="";for(let n of V(t))re(n)&&(e+=oe(n));return e}function gt(t,e){let n=[];for(let r of V(t))z(r)&&N(r)===e&&n.push(r);return n}function bt(t,e){for(let n of V(t)){if(!z(n))continue;let r=N(n);r==="link"&&y("HL001","External definition dependencies require the application-owned graph resolver.",e),Oe(r,e);for(let o of pe(n))/^on(?!:)/i.test(o.name)&&Ie(o.name,e,o.value);bt(n,e)}}var Tn=/^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/,pt=/^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/,Sn=/^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/,mt=/^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/,ze=/^[a-z][a-z0-9-]*$/,Nn=/^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/,Ue=/^[A-Za-z_$][A-Za-z0-9_$-]*$/;function Ve(t,...e){let n=new Set(t.roots);for(let r of e)r!==void 0&&n.add(r);return{roots:n,writableRoots:t.writableRoots,handlers:t.handlers}}function S(t,e,n){let r=Mn(t,n);return $n(r,e,n),r}function $n(t,e,n){for(let r of t.dependencies){let o=r.split(".",1)[0];e.roots.has(o)||y("HT003",`Expression root \`${o}\` is not declared in this scope.`,n)}}function An(t,e,n){let r=Object.create(null),o=(a,s)=>{r[a]??=s},i=a=>{for(let s of pe(a))if(s.name.startsWith(":"))/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)&&o(s.value,{attribute:s.name.slice(1).toLowerCase()});else if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase();if(/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)){let l=n.resolveDomProperty(N(a),c)??(s.value.toLowerCase()===c?s.value:c);o(s.value,{property:l})}}for(let s of V(a))z(s)&&N(s)!=="slot"&&i(s)};return i(t),r}function Hn(t,e,n,r=!0){let o=Object.create(null),i=Object.create(null);if(t===void 0)return o;let a=gt(t,"prop");a.sort((s,c)=>{let l=x(s,"name")??"",f=x(c,"name")??"";return l<f?-1:l>f?1:0});for(let s of a){let c=x(s,"name");(c===void 0||c==="")&&y("HC010","A <prop> requires a `name` attribute.",n),/^[A-Za-z][A-Za-z0-9_-]*$/.test(c)||y("HC010",`Invalid prop name \`${c}\`.`,n);let l=x(s,"type");(l===void 0||l==="")&&y("HC013",`Prop \`${c}\` requires a \`type\` attribute.`,n);let f=c.toLowerCase(),d=i[f];d!==void 0&&y("HC011",`Props \`${d}\` and \`${c}\` collide after lowercase normalization.`,n),i[f]=c;let h=e[c];h===void 0&&r&&y("HC018",`Prop \`${c}\` is declared but never bound in the markup.`,n),h??={attribute:c.toLowerCase()};let u=He(l),p=x(s,"required")!==void 0,m=yt(s).trim();m===""&&y("HC003",`\`props.${c}.description\` must be a non-empty string.`,n),_(u)||y("HC017",`Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`,n);let v=x(s,"default");p&&v!==void 0&&y("HC019",`Required prop \`${c}\` cannot also declare a default.`,n);let C={type:u,required:p,target:h,description:m};if(v!==void 0){let k=B(v,u);k.ok||y("HC015",`Default for prop \`${c}\` does not satisfy its type.`,n),C.default=k.value}o[c]=C}return o}function Dn(t,e,n,r,o,i,a){let s=x(t,"component")??"";s.trim()===""&&y("HC003","`component` must be a non-empty string.",i),/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s)||y("HC005","The `component` tag must be lowercase and contain a hyphen.",i);let c=x(t,"status");c!==void 0&&!/^(?:early|experimental|stable|deprecated)$/.test(c)&&y("HC007","Component `status` is not recognized.",i);let l=x(t,"summary");return l!==void 0&&l.trim()===""&&y("HC003","`summary` must be a non-empty string.",i),(!/^[a-z][a-z0-9-]*$/.test(n)||r&&!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n))&&y("HC008","`nativeElement` must be a lowercase HTML element or component tag.",i),{version:1,name:it(s),tag:s,...c===void 0?{}:{status:c},...l===void 0?{}:{summary:l},nativeElement:n,props:Hn(e,o,i,a)}}function Mn(t,e){try{return fe(t)}catch{y("HT013",`Malformed expression \`${t}\`.`,e)}}function Pn(t,e,n){let r=[];for(let o of ht(V(t))){z(o)||y("HC023","Handler bodies contain declarative step elements only.",n);let i=x(o,"$if"),a=i===void 0?void 0:S(i,e,n);if(N(o)==="set"){let s=x(o,"name")??"",c=x(o,":value"),l=x(o,"value");(s===""||c===void 0==(l===void 0))&&y("HC023","A <set> requires `name` and exactly one of `value` or `:value`.",n),S(s,e,n);let f=je(s,e.writableRoots);f===void 0&&y("HT005",`Handler write \`${s}\` is not rooted in declared state.`,n);let d={kind:"set",path:s,writablePath:f,value:S(c??JSON.stringify(l),e,n)};a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="dispatch"){let s=x(o,"event")??"";ze.test(s)||y("HC023","A <dispatch> requires a valid `event` name.",n);let c=x(o,":value"),l=x(o,"value");c!==void 0&&l!==void 0&&y("HC023","A <dispatch> may declare only one of `value` or `:value`.",n);let f=c===void 0&&l===void 0?void 0:S(c??JSON.stringify(l),e,n),d={kind:"dispatch",event:s};f!==void 0&&(d.value=f),a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="validate"||N(o)==="focus"){let s=x(o,"target")??x(o,"ref")??x(o,"name")??"";Ue.test(s)||y("HC023",`<${N(o)}> requires a valid target reference.`,n);let c={kind:N(o),target:s};a!==void 0&&(c.guard=a),r.push(c);continue}y("HC023",`<${N(o)}> is not a recognized handler step.`,n)}return r}function jn(t,e,n){let r=[],o=new Set(Object.keys(e.props)),i=new Set,a=new Set;if(t===void 0)return{declarations:r,scope:{roots:o,writableRoots:i,handlers:a}};let s=[],c=new Set,l=new Set;for(let d of V(t)){if(!z(d))continue;let h=d;s.push(h);let u=N(h);/^(?:prop|state|computed|data|handler|event|method)$/.test(u)||y("HC021",`<${u}> is not a recognized definition declaration.`,n);let p=x(h,"name")??"";if(p===""&&y("HC010",`A <${u}> requires a \`name\` attribute.`,n),u==="event"){l.has(p)&&y("HC020",`Event \`${p}\` is declared more than once.`,n),l.add(p);continue}c.has(p)&&y("HC020",`Declaration \`${p}\` collides in the flat component scope.`,n),c.add(p),o.add(p),u==="state"?i.add(p):u==="handler"&&a.add(p)}let f={roots:o,writableRoots:i,handlers:a};for(let d of s){let h=N(d);if(h==="prop")continue;let u=x(d,"name");if(h==="state"){let p=x(d,":value"),m=x(d,"value");p!==void 0&&m!==void 0&&y("HC013",`<state name="${u}"> may declare only one of \`value\` or \`:value\`.`,n);let v=p===void 0&&m===void 0?void 0:S(p??JSON.stringify(m),f,n),C={kind:h,name:u},k=x(d,"type");k!==void 0&&(He(k),C.type=k),m!==void 0&&(C.value=m),v!==void 0&&(C.expression=v),r.push(C);continue}if(h==="computed"){let p=x(d,"from");(p===void 0||p==="")&&y("HC013",`<computed name="${u}"> requires a \`from\` expression.`,n),r.push({kind:h,name:u,expression:S(p,f,n)});continue}if(h==="data"){let p=x(d,"src"),m=x(d,"type"),v=x(d,"debounce"),C=x(d,"poll"),k=[],g=new Set;for(let w of gt(d,"param")){let R=x(w,"name")??"",T=x(w,":value");(!Ue.test(R)||T===void 0)&&y("HC024","A data <param> requires a valid `name` and a `:value` expression.",n),g.has(R)&&y("HC024",`Data source \`${u}\` repeats a parameter name.`,n),g.add(R),k.push({name:R,expression:S(T,f,n)})}let b={kind:h,name:u,parameters:k};p!==void 0&&(b.source=p),m!==void 0&&(b.type=m),v!==void 0&&(b.debounce=v),C!==void 0&&(b.poll=C),r.push(b);continue}if(h==="event"){r.push({kind:h,name:u,type:x(d,"type")??"object",bubbles:x(d,"bubbles")!=="false",composed:x(d,"composed")!=="false",cancelable:x(d,"cancelable")==="true"});continue}if(h==="method"){r.push({kind:h,name:u,exportName:x(d,"export")??u,returns:x(d,"returns")??"undefined"});continue}r.push({kind:"handler",name:u,steps:Pn(d,f,n)})}for(let d of r)if(d.kind==="handler")for(let h of d.steps)h.kind==="dispatch"&&!l.has(h.event)&&y("HC023",`Handler \`${d.name}\` dispatches undeclared component event \`${h.event}\`.`,n);return{declarations:r,scope:f}}function Ln(t,e,n,r,o,i){let a=[];for(let s of t){if(s.name.startsWith("bind:")){let c=s.name.slice(5).toLowerCase();(c===""||pt.test(c))&&y("HT007",`Two-way binding cannot target \`${c||s.name}\`.`,o);let l=S(s.value,r,o),f=je(s.value,r.writableRoots);f===void 0&&y("HT005",`\`${s.value}\` is not a writable state-rooted path.`,o),a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l,twoWay:!0,writablePath:f});continue}if(s.name.startsWith("class:")||s.name.startsWith("style:")){let c=s.name.startsWith("class:")?"class":"style",l=s.name.slice(c.length+1);(c==="class"?l!==""&&!/\s/.test(l):/^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(l))||y("HT020",`\`${s.name}\` does not name a valid ${c} binding target.`,o),a.push({kind:"attribute",name:l,expression:s.value,expressionPlan:S(s.value,r,o),target:c});continue}if(s.name.startsWith("$")){let c=s.name.slice(1).toLowerCase();c!=="value"&&c!=="html"&&y("HT012",`\`$${c}\` is not a known content directive.`,o),a.push({kind:"directive",name:c,expression:s.value,expressionPlan:S(s.value,r,o)});continue}if(s.name.startsWith(":")){let c=s.name.slice(1).toLowerCase();pt.test(c)&&y("HT007",`\`:${c}\` cannot bind a raw content sink.`,o);let l=S(s.value,r,o);a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l});continue}if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase(),l=S(s.value,r,o),f=i.resolveDomProperty(e,c);f===void 0&&y("HP001",`\`${c}\` is not a native property of <${e}>.`,o),ft(f,o),a.push({kind:"property",key:c,name:f,expression:s.value,expressionPlan:l});continue}Ie(s.name,o,s.value),a.push({kind:"literal",name:s.name,value:s.value})}return a}function On(t,e,n){if(t===void 0)return;let r=[];for(let o of t){let[i="",...a]=o.name.slice(3).split(".");(!ze.test(i)||a.some(s=>!ze.test(s)))&&y("HT010",`\`${o.name}\` is not a valid declarative event binding.`,n);for(let s=0;s<a.length;s+=1){let c=a[s];a.indexOf(c)!==s&&y("HT010",`\`${o.name}\` repeats an event modifier.`,n),Nn.test(c)||y("HT010",`\`${o.name}\` contains an unsupported event modifier.`,n)}a.includes("passive")&&a.includes("prevent")&&y("HT010",`\`${o.name}\` cannot combine passive and prevent.`,n),e.handlers.has(o.value)||y("HT010",`Event binding \`${o.name}\` names undeclared handler \`${o.value}\`.`,n),r.push({name:i,handler:o.value,modifiers:a})}return r}function In(t,e,n){if(t!==void 0)return Ue.test(t)||y("HT019","`$ref` requires a valid non-empty name.",n),e.has(t)&&y("HT019",`Reference \`${t}\` is duplicated.`,n),e.add(t),t}function zn(t,e,n){if(t===void 0)return;let r=[],o=[];t.$if!==void 0&&r.push("$if"),t.$each!==void 0&&r.push("$each"),t.$with!==void 0&&r.push("$with"),t.$match!==void 0&&r.push("$match"),t.$when!==void 0&&r.push("$when"),t.$else!==void 0&&r.push("$else"),t.$where!==void 0&&o.push("$where"),t.$sort!==void 0&&o.push("$sort"),t.$limit!==void 0&&o.push("$limit"),t.$key!==void 0&&o.push("$key"),r.length>1&&y("HT014",`An element carries one structural directive; found ${r.join(", ")}.`,n);let i=t.$each;i===void 0&&o.length>0&&y("HT014",`${o.join(", ")} may only modify \`$each\`.`,n);let a=t.$if;if(a!==void 0){let f=a;return{kind:"if",test:f,testPlan:S(f,e,n)}}let s=t.$with;if(s!==void 0){let f=mt.exec(s);return f===null&&y("HT015","`$with` must be written `expr as name`.",n),{kind:"with",expr:f[1],expressionPlan:S(f[1],e,n),alias:f[2]}}if(i!==void 0){let f=Sn.exec(i);f===null&&y("HT016","`$each` must be written `item of items` (optionally `item, i of items`).",n);let d=f[1],h=f[2];(e.roots.has(d)||h!==void 0&&e.roots.has(h))&&y("HC020","Loop locals may not collide with an existing scope name.",n);let u=Ve(e,d,h,"loop"),p={kind:"each",item:d,list:f[3],listPlan:S(f[3],e,n)};h!==void 0&&(p.index=h);let m=t.$where;m!==void 0&&(p.where=m,p.wherePlan=S(m,u,n)),t.$sort!==void 0&&(p.sort=t.$sort);let v=t.$limit;v!==void 0&&(p.limit=v,p.limitPlan=S(v,u,n));let C=t.$key;return C!==void 0&&(p.key=C,p.keyPlan=S(C,u,n)),p}let c=t.$match;if(c!==void 0){let f=c.trim();if(f==="")return{kind:"match"};let d=mt.exec(f);return d===null&&y("HT017","`$match` scope must be written `expr as name`.",n),{kind:"match",expr:d[1],expressionPlan:S(d[1],e,n),alias:d[2]}}let l=t.$when;if(l!==void 0){let f=l;return{kind:"when",test:f,testPlan:S(f,e,n)}}if(t.$else!==void 0)return{kind:"else"}}function qe(t,e,n,r,o,i){let a=N(t);ut(a)&&y("HT009",`<${a}> is reserved but not supported by this profile.`,r),Oe(a,r);let s,c=[],l,f;for(let g of pe(t))Tn.test(g.name)?(s??={})[g.name]=g.value:g.name==="$ref"?f=g.value:g.name.startsWith("on:")?(l??=[]).push(g):g.name!=="as"&&c.push(g);let d=zn(s,n,r),h=d?.kind==="each"?Ve(n,d.item,d.index,"loop"):d?.kind==="with"||d?.kind==="match"&&d.alias!==void 0?Ve(n,d.alias):n,u=Ln(c,a,e,h,r,i),p=On(l,h,r),m=In(f,o.refs,r),v=[],C=V(t);for(let g of C)if(g.nodeName!=="#comment"){if(re(g)){let b=oe(g);b.trim()!==""&&v.push({kind:"text",value:b});continue}if(z(g)){if(N(g)==="slot"){let b=x(g,"name"),w=x(g,":name");b!==void 0&&w!==void 0&&y("HT008","A slot cannot declare both `name` and `:name`.",r);for(let M of pe(g))M.name!=="name"&&M.name!==":name"&&y("HT008","A slot has an unsupported attribute.",r);b===void 0&&w===void 0&&(o.defaults+=1,o.defaults>1&&y("HT008","A component may declare one default slot.",r)),b!==void 0&&((b===""||o.names.has(b))&&y("HT008",`Slot name \`${b}\` is empty or duplicated.`,r),o.names.add(b));let R=[];for(let M of V(g))if(M.nodeName!=="#comment")if(re(M)){let ae=oe(M);ae.trim()!==""&&R.push({kind:"text",value:ae})}else z(M)&&R.push(qe(M,e,h,r,o,i));let A={dynamic:w!==void 0,required:R.length===0};if(b!==void 0&&(A.name=b),o.contracts.push(A),b===void 0&&w===void 0&&R.length===0)v.push({kind:"slot"});else{let M={kind:"slot",fallback:R};b!==void 0&&(M.name=b),w!==void 0&&(M.nameExpression=S(w,h,r)),v.push(M)}continue}v.push(qe(g,e,h,r,o,i))}}if(u.some(g=>g.kind==="directive")&&v.length>0&&y("HT006","A content directive cannot coexist with children.",r),u.some(g=>g.kind==="property"&&g.name==="textContent")&&v.length>0&&y("HT006","A content-replacing property binding cannot coexist with children.",r),d?.kind==="match"){let g=0;for(let w of v)w.kind==="element"&&(g+=1);let b=!1;for(let w of v)w.kind==="element"&&(g-=1,w.flow?.kind==="when"?b&&y("HT018","A `$when` arm may not follow `$else`.",r):w.flow?.kind==="else"?(b&&y("HT018","A `$match` has at most one `$else`.",r),b=!0,g!==0&&y("HT018","`$else` must be the last arm.",r)):y("HT018","Every direct child of a `$match` must be a `$when` or `$else` arm.",r))}let k={kind:"element",name:a,attributes:u,children:v};return d!==void 0&&(k.flow=d),p!==void 0&&(k.events=p),m!==void 0&&(k.ref=m),k}function vt(t,e,n){let r=ht(t);(r.length!==1||!z(r[0])||N(r[0])!=="template"||x(r[0],"component")===void 0)&&y("HS001","A source must contain exactly one top-level <template component>.",e);let o=r[0],i,a=!1,s,c;for(let b of V(o)){if(b.nodeName==="#comment"||re(b)&&oe(b).trim()==="")continue;z(b)||y("HT001","A component's markup must be exactly one element root.",e);let w=N(b);w==="props"||w==="defs"?(i!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),i=b,a=w==="props",bt(b,e)):w==="style"?(s!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),s=b):c===void 0?c=b:y("HT001","A component's markup must be exactly one element root.",e)}c===void 0&&y("HT001","A component's markup must be exactly one element root.",e);let l=N(c),f=(x(c,"as")??l).split("|");for(let b=f.length-1;b>=0;b-=1)f[b]=f[b].trim(),f[b]===""&&f.splice(b,1);let d=!n.isNativeElement(l);d&&x(c,"as")!==void 0&&y("HT021","A delegated component root cannot also declare native `as` choices.",e),!d&&(f.length===0||!f.includes(l)||f.some((b,w)=>f.indexOf(b)!==w)||f.some(b=>!n.isNativeElement(b)))&&y("HT021","A polymorphic root must list unique native choices including its markup root.",e);let h=An(c,e,n),u=Dn(o,i,l,d,h,e,a),{declarations:p,scope:m}=jn(a?void 0:i,u,e),v={defaults:0,names:new Set,contracts:[],refs:new Set},C=qe(c,u,m,e,v,n),k=x(o,"controller");k===""&&y("HC022","A controller specifier cannot be empty.",e);let g={source:{file:e},contract:u,template:C,css:s===void 0?"":yt(s).trim(),declarations:p,slots:v.contracts,root:d?{kind:"component",tag:l}:{kind:"native",element:l,choices:f}};return k!==void 0&&(g.controller=k),J(g)}var wt=new WeakMap;function Vn(t){let e={},n={},r=o=>{if(o.includes("-"))return!1;if(Object.hasOwn(e,o))return e[o];let i=t.createElement(o),a=t.defaultView?.HTMLUnknownElement,s=a===void 0?i.constructor.name!=="HTMLUnknownElement":!(i instanceof a);return e[o]=s,s};return{isNativeElement:r,resolveDomProperty(o,i){if(!r(o))return;let a=`${o}:${i}`;if(a in n)return n[a]||void 0;let s=t.createElement(o),c=i.toLowerCase();for(;s!==null;){for(let l of Object.getOwnPropertyNames(s))if(l.toLowerCase()===c)return n[a]=l,l;s=Object.getPrototypeOf(s)}n[a]=""}}}function _e(t,e=t.ownerDocument.URL){(t.localName!=="template"||!t.hasAttribute("component"))&&y("HS001","A browser component carrier must be a <template component>.",e);let n=t.ownerDocument,r=wt.get(n);return r===void 0&&(r=Vn(n),wt.set(n,r)),vt([t],e,r)}function kt(t,e,n){let r=n.createElement("template");r.innerHTML=t;let o;for(let a of r.content.childNodes)a.nodeType===1&&a.localName==="template"&&a.hasAttribute("component")&&(o!==void 0&&y("HS001","A component resource must contain exactly one <template component>.",e),o=a);o===void 0&&y("HS001","A component resource must contain exactly one <template component>.",e);let i=[];for(let a of r.content.childNodes){if(a===o||a.nodeType===8||a.nodeType===3&&(a.nodeValue??"").trim()==="")continue;(a.nodeType!==1||a.localName!=="link"||a.getAttribute("rel")!=="component")&&y("HT009","A component resource may contain only dependency links and one inert carrier.",e);let s=a.getAttribute("href");(s===null||s.trim()==="")&&y("HL006","A component dependency link requires a non-empty `href`.",e),i.push(s)}return{definition:_e(o,e),dependencies:i}}var me=class{#e=new Map;#t=new Map;define(e,n){this.#e.has(e)&&y("HR001",`More than one definition declares <${e}>.`),this.#e.set(e,Object.freeze(n));for(let r of this.#t.get(e)??[])r();this.#t.delete(e)}get(e){return this.#e.get(e)}whenDefined(e){return this.#e.has(e)?Promise.resolve():new Promise(n=>{let r=this.#t.get(e)??[];r.push(n),this.#t.set(e,r)})}addGraph(e,n){for(let r of e.nodes.values())r.shadowedByCustomElement||this.define(r.definition.contract.tag,{node:r,...r.controller===void 0||n===void 0?{}:{loadController:()=>n(r)}})}};var Ct=/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/|\.\.?\/)/;function xt(t){return new URL("./",t).href}function qn(t,e){return t.endsWith("/")?e:xt(e)}var he=class{#e;#t;constructor(e={},n="file:///"){this.#e=new URL(n).href,this.#t=new Map(Object.entries(e.imports??{}).map(([r,o])=>[r,new URL(o,this.#e).href]))}resolveRoot(e){if(Ct.test(e)){let n=new URL(e,this.#e).href;return Object.freeze({url:n,trustRoot:xt(n)})}return this.#n(e)}resolveDependency(e,n,r){if(!Ct.test(e))return this.#n(e);let o=new URL(e,n).href;return Object.freeze({url:o,trustRoot:r})}assertFinalURL(e,n){return new URL(n,e.url).href}#n(e){let n=this.#t.get(e);if(n!==void 0)return Object.freeze({url:n,trustRoot:qn(e,n),mapping:e});let r=Array.from(this.#t.keys()).filter(i=>i.endsWith("/")&&e.startsWith(i)).sort((i,a)=>a.length-i.length)[0];r===void 0&&y("HL002",`Bare resource specifier \`${e}\` is not mapped by the application.`);let o=this.#t.get(r);return Object.freeze({url:new URL(e.slice(r.length),o).href,trustRoot:o,mapping:r})}};var Et=new Map;function Be(t,e=n=>import(n)){let n=t.controller;if(n===void 0)return Promise.reject(new TypeError(`<${t.definition.contract.tag}> does not declare a controller.`));let r=Et.get(n.url);return r===void 0&&(r=e(n.url).then(o=>{let i=o?.default;return typeof i!="function"&&y("HJ002",`Controller module \`${n.url}\` must default-export a function.`,t.url),Object.freeze({...o,default:i})}).catch(o=>{if(o instanceof Error&&"diagnostic"in o)throw o;y("HJ001",`Controller module \`${n.url}\` failed to load: ${o instanceof Error?o.message:String(o)}.`,t.url)}),Et.set(n.url,r)),r}async function Rt(t,e=n=>import(n)){return(await Be(t,e)).default}function Un(t,e,n){let r=new Set,o=t.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g,(a,s)=>{r.add(s);let c=n[s];return c==null?"":encodeURIComponent(String(c))}),i=new URL(o,e);for(let[a,s]of Object.entries(n))if(!(r.has(a)||s==null))if(Array.isArray(s))for(let c of s)i.searchParams.append(a,String(c));else i.searchParams.set(a,String(s));return i.href}var ye=class{constructor(e){this.options=e;this.#e=e.fetch??globalThis.fetch.bind(globalThis),this.#t=e.setTimer??((n,r)=>setTimeout(n,r)),this.#n=e.clearTimer??(n=>clearTimeout(n))}options;#e;#t;#n;#o={};#i;#r;#c=0;#s=!1;update(e){this.#o={...e},this.#s=!0,this.#a();let n=++this.#c,r=()=>{this.#l(n)};(this.options.debounce??0)>0?this.#r=this.#t(r,this.options.debounce):r()}disconnect(){this.#s&&(this.#s=!1,this.#c+=1,this.#a())}#a(){this.#i?.abort(),this.#i=void 0,this.#r!==void 0&&this.#n(this.#r),this.#r=void 0}#d(e){return!this.#s||e!==this.#c}async#l(e){if(this.#d(e))return;let n=new AbortController;this.#i=n;let r=this.options;r.onState({pending:!0,value:null,error:null,ok:!1});try{let o=await this.#e(Un(r.source,r.baseURL,this.#o),{signal:n.signal});if(!o.ok)throw new TypeError(`Request failed with ${o.status}.`);let i=r.type==="text"?await o.text():await o.json(),a=r.adapt===void 0?i:r.adapt(i);if(this.#d(e))return;r.onState({pending:!1,value:a,error:null,ok:!0})}catch(o){if(n.signal.aborted||this.#d(e))return;r.onState({pending:!1,value:null,error:o,ok:!1})}finally{this.#i===n&&(this.#i=void 0),!this.#d(e)&&(r.poll??0)>0&&(this.#r=this.#t(()=>{this.#l(e)},r.poll))}}};var $,_n=0,Tt=100,We=new WeakMap,ge=new WeakMap;function St(t){let{dependency:e,previousSubscriber:n,nextSubscriber:r}=t;n===void 0?e.first=r:n.nextSubscriber=r,r===void 0?e.last=n:r.previousSubscriber=n}function Nt(t){if(t.length>8)return[];for(;t.length>0;)t.pop();return t}var Fe=class{#e=[];#t=[];#n=!1;#o=!1;enqueue(e){e.stopped||e.queued||(e.queued=!0,this.#e.push(e),!this.#n&&!this.#o&&(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})))}enqueueDependency(e){if(this.#o||this.#e.length>0)return!1;for(let n=e.first;n!==void 0;n=n.nextSubscriber){let r=n.effect;if(r.scheduler!==this){for(let o of this.#e)o.queued=!1;return this.#e=[],!1}r.queued||(r.queued=!0,this.#e.push(r))}return this.#n||(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})),!0}flush(){this.#o||this.#e.length===0||this.#i()}#i(){this.#o=!0;let e=0,n,r=0;try{for(;this.#e.length>0;){if(e+=1,e>Tt){for(let o of this.#e)o.queued=!1;this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit.")}if(n=this.#e,n.length>1){let o=1,i=n[0];for(;o<n.length;){let a=n[o];if(i.priority>a.priority||i.priority===a.priority&&i.id>a.id)break;i=a,o+=1}o<n.length&&n.sort((a,s)=>a.priority-s.priority||a.id-s.id)}this.#e=this.#t,r=0;do{let o=n[r];if(o.queued=!1,r+=1,o.computed===void 0?o.execute():o.computed.refresh(),this.#e.length===1&&r===n.length&&this.#e[0].computed===void 0){e+=1,e>Tt&&(this.#e[0].queued=!1,this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit."));let i=this.#e;this.#e=Nt(n),n=i,r=0}else this.#e.length>0&&this.#r(n,r)}while(r<n.length);this.#t=Nt(n),n=void 0}}finally{if(n!==void 0){for(;r<n.length;)n[r++].queued=!1;this.#t=[]}if(this.#e.length>0){for(let o of this.#e)o.queued=!1;this.#e=[]}this.#o=!1}}#r(e,n){if(this.#e.some(r=>r.computed!==void 0))for(let r=e.length-1;r>=n;r-=1){let o=e[r];o.computed===void 0&&(e.splice(r,1),this.#e.push(o))}}},be=class{constructor(e,n,r,o){this.scheduler=e;this.run=n;this.priority=r;this.computed=o}scheduler;run;priority;computed;id=_n++;dependencies=void 0;stopped=!1;paused=!1;queued=!1;#e=void 0;#t=void 0;execute(){if(this.stopped||this.paused)return;if(this.#t=void 0,this.#e!==void 0){let n=this.#e;this.#e=void 0,n()}let e=$;$=this;try{let n=this.run();n!==void 0&&(this.#e=n)}finally{$=e;let n=this.#t,r=n===void 0?this.dependencies:n.nextDependency;for(n===void 0?this.dependencies=void 0:n.nextDependency=void 0;r!==void 0;){let o=r.nextDependency;St(r),r=o}}}track(e){let n=this.#t===void 0?this.dependencies:this.#t.nextDependency;if(n?.dependency===e){this.#t=n;return}for(let i=this.dependencies;i!==n;i=i?.nextDependency)if(i?.dependency===e)return;let r={dependency:e,effect:this,nextDependency:n,previousSubscriber:void 0,nextSubscriber:void 0};this.#t===void 0?this.dependencies=r:this.#t.nextDependency=r,this.#t=r;let o=e.first;if(this.computed!==void 0&&o!==void 0)r.nextSubscriber=o,o.previousSubscriber=r,e.first=r;else{let i=e.last;r.previousSubscriber=i,i===void 0?e.first=r:i.nextSubscriber=r,e.last=r}}schedule(){if(this.computed!==void 0){this.computed.invalidate();return}this.paused||this.scheduler.enqueue(this)}pause(){this.stopped||this.paused||(this.paused=!0,this.#n(),this.#e?.(),this.#e=void 0)}resume(){this.stopped||!this.paused||(this.paused=!1,this.execute())}stop(){this.stopped||(this.stopped=!0,this.#n(),this.#e?.(),this.#e=void 0)}#n(){let e=this.dependencies;for(;e!==void 0;){let n=e.nextDependency;St(e),e=n}this.dependencies=void 0,this.#t=void 0}},Ze=class{#e={first:void 0,last:void 0};#t;constructor(e){this.#t=e}get(){return $!==void 0&&$.track(this.#e),this.#t}set(e){Object.is(this.#t,e)||(this.#t=e,W(this.#e))}update(e){this.set(e(this.#t))}},ve=class{#e;#t;#n;#o;#i=!1;#r=!0;#c=!1;#s=!1;constructor(e,n,r={first:void 0,last:void 0}){this.#e=r,this.#t=n,this.#n=new be(e,()=>this.#l(),0,this)}get(){return this.#n.paused||this.#n.stopped?this.#d():(this.#a(),$!==void 0&&$.track(this.#e),this.#o)}invalidate(){if(!(this.#n.stopped||this.#r)){this.#r=!0;for(let e=this.#e.first;e!==void 0;e=e.nextSubscriber)if(e.effect.computed===void 0){this.#n.scheduler.enqueue(this.#n);return}W(this.#e)}}refresh(){this.#a()}pause(){this.#n.stopped||this.#n.paused||(this.#r=!0,this.#n.pause())}resume(){this.#n.stopped||!this.#n.paused||(this.#n.paused=!1)}stop(){this.#n.stop()}#a(){if(this.#c&&y("HR006","A reactive computed value depends on itself."),!this.#r||this.#n.stopped||this.#n.paused)return;let e=this.#i;this.#n.execute(),e&&this.#s&&W(this.#e,$?.computed===void 0?void 0:$)}#d(){this.#c&&y("HR006","A reactive computed value depends on itself.");let e=$;this.#c=!0,$=void 0;try{return this.#t()}finally{$=e,this.#c=!1}}#l(){this.#c=!0,this.#r=!1;try{let e=this.#t();this.#s=!this.#i||!Object.is(this.#o,e),this.#o=e,this.#i=!0}catch(e){throw this.#r=!0,e}finally{this.#c=!1}}};function W(t,e){let n=t?.first;if(n===void 0)return;let r=n!==t.last;if(!r&&n.effect.computed!==void 0){n.effect!==e&&n.effect.computed.invalidate();return}if(n.effect.computed===void 0){if(e===void 0&&r&&n.effect.scheduler.enqueueDependency(t))return;for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}return}for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}}function $t(t){return new Ze(t)}function At(t,e){return new ve(t,e)}function F(t,e,n=1,r=!0){let o=new be(t,e,n);return r?o.execute():o.paused=!0,o}var we=class t{constructor(e=[],n=new Fe,r){this.scheduler=n;this.parent=r;for(let[o,i]of e)this.set(o,i)}scheduler;parent;#e=new Map;#t;#n;has(e){return this.#o(e)!==void 0||this.parent?.has(e)===!0}get(e){let n=this.#o(e);return n===void 0?this.parent?.get(e):($!==void 0&&$.track(n),n.value)}set(e,n){let r=this.#r(n),o=this.#o(e);if(o===void 0){o={value:r,first:void 0,last:void 0},this.#e.set(e,o),this.#n=o;return}Object.is(o.value,r)||(o.value=r,W(o))}defineComputed(e,n){let r=this.#o(e);r===void 0&&(r={value:null,first:void 0,last:void 0},this.#e.set(e,r),this.#n=r);let o=new ve(this.scheduler,()=>this.#r(n()),r);return r.computed=o,Object.hasOwn(this,"get")||(this.get=this.#i),o}fork(e=[]){return new t(e,this.scheduler,this)}#o(e){return e!==this.#t&&(this.#t=e,this.#n=this.#e.get(e)),this.#n}#i(e){let n=this.#o(e);return n===void 0?this.parent?.get(e):n.computed!==void 0?n.computed.get():($!==void 0&&$.track(n),n.value)}#r(e){if(e===null||typeof e!="object")return e;let n=We.get(e);if(n!==void 0)return n;let r=new Proxy(e,{get:(o,i,a)=>{if($!==void 0){let s=ge.get(o);s===void 0&&(s=new Map,ge.set(o,s));let c=s.get(i);c===void 0&&(c={first:void 0,last:void 0},s.set(i,c)),$.track(c)}return this.#r(Reflect.get(o,i,a))},set:(o,i,a,s)=>{let c=Reflect.get(o,i,s),l=this.#r(a),f=Reflect.set(o,i,l,s);return Object.is(c,l)||W(ge.get(o)?.get(i)),f},deleteProperty:(o,i)=>{let a=Reflect.has(o,i),s=Reflect.deleteProperty(o,i);return a&&W(ge.get(o)?.get(i)),s}});return We.set(e,r),We.set(r,r),r}};var Bn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|--[\w-]+\s*:[^;{}]*|:(user-invalid|invalid|valid)(?![\w-])/g;function Ht(t){return t.replace(Bn,(e,n)=>n===void 0?e:`:is(:${n}, [data-${n}])`)}var Z="data-component",ke="data-slotted";function Mt(t,e,n){let r=new Set((t.getAttribute(e)??"").split(/\s+/).filter(Boolean));r.add(n),t.setAttribute(e,Array.from(r).join(" "))}function Ce(t){t.nodeType===1&&t.setAttribute(ke,"")}function Ge(t){return`data-${t}-state`}var Dt={slotted:"[--slotted]",state:"[--state]"},Wn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|:(slotted|host-state)\(/g;function Fn(t,e=["slotted","host-state"]){return t.replace(Wn,(n,r)=>r===void 0||!e.includes(r)?n:`:where(${r==="slotted"?Dt.slotted:Dt.state}):is(`)}function Zn(t){return/:where\(\s*\[--slotted\]\s*\)/.test(t)?"slotted":"own"}function Gn(t,e){let n=0;for(let r=e;r<t.length;r+=1){let o=t[r];if(o==='"'||o==="'"){let i=t.indexOf(o,r+1);r=i===-1?t.length:i}else if(o==="(")n+=1;else if(o===")"&&--n===0)return r}return t.length}var Kn=/\[\s*([\w-]+)\s*(?:=\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^\]\s]+))\s*)?\]/g;function Jn(t,e,n,r){let o="";for(let i of t.matchAll(Kn)){let a=r(i[1]),s=i[2]??i[3]??i[4];n.add(a),o+=`[${Ge(e)}~="${s===void 0?a:`${a}=${encodeURIComponent(s)}`}"]`}return o}function Qn(t){let e="";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="["){let s=t.indexOf("]",n),c=s===-1?t.length:s+1;e+=t.slice(n,c),n=c-1;continue}let o=e.at(-1),a=o===void 0||/[\s>+~(,]/.test(o)?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+(?![\w-]|\()/.exec(t.slice(n))?.[0]:void 0;if(a!==void 0){e+=`:is(${a}, :where([${Z}~="${a}"]))`,n+=a.length-1;continue}e+=r}return e}function Yn(t,e,n,r,o=i=>i){/:scope(?![\w-])/.test(t)&&y("HY003",`\`:scope\` is not part of component styles; select the root with \`:host\` (in <${e}>).`);let i="",a=0,s=/:where\(\s*\[--state\]\s*\):is\(/g;for(let c=s.exec(t);c!==null;c=s.exec(t)){let l=c.index+c[0].length-1,f=Gn(t,l);i+=`${t.slice(a,c.index)}${n}${Jn(t.slice(l+1,f),e,r,o)}`,a=f+1,s.lastIndex=a}return i+=t.slice(a),i=i.replace(/:where\(\s*\[--slotted\]\s*\):is\(/g,`:where([${ke}], [${ke}] *):is(`).replace(/:host(?![\w-])/g,n),Qn(Ht(i))}function Xn(t,e,n,r){let o=`[${Z}~="${t}"]`;return[r,e.trim()===""?"":`@scope (${o}) to ([${Z}], [${ke}]) {
1
+ var W=class extends Error{diagnostic;constructor(e){let n=e.source?`${e.source}: `:"";super(`${n}${e.code}: ${e.message}`),this.name="HtmlDiagnosticError",this.diagnostic=Object.freeze({...e})}};function y(t,e,n){throw new W(n===void 0?{code:t,message:e}:{code:t,message:e,source:n})}function ot([t],[e]){return t.localeCompare(e)}async function it(t,e){let n=new Map,r=new Map,o=new Map,i=async c=>{let l=new URL(c.url).href,f=r.get(l)??l,d=n.get(f);if(d!==void 0)return d.url;let h;try{h=await e.fetchComponent(l)}catch(g){if(g instanceof W)throw g;y("HL009",`Component \`${l}\` failed to load: ${g instanceof Error?g.message:String(g)}.`,l)}let u=e.resolver.assertFinalURL(c,h.url,l);r.set(l,u);let p=n.get(u);if(p!==void 0)return p.url;let m=e.parseComponentResource(h.source,u),v=m.definition,C=o.get(v.contract.tag);C!==void 0&&C!==u&&y("HL007",`Both \`${C}\` and \`${u}\` declare <${v.contract.tag}>.`,u),o.set(v.contract.tag,u);let k={url:u,trustRoot:c.trustRoot,definition:v,dependencies:[],shadowedByCustomElement:e.isCustomElementRegistered?.(v.contract.tag)??!1,complete:!1};if(n.set(u,k),v.controller!==void 0){let g;try{g=e.resolver.resolveDependency(v.controller,u,c.trustRoot)}catch(b){throw b instanceof W&&b.diagnostic.code==="HL003"&&y("HL005",`Controller \`${v.controller}\` is outside the component's approved root.`,u),b}k.controller=Object.freeze({specifier:v.controller,url:g.url})}for(let g of m.dependencies){let b=e.resolver.resolveDependency(g,u,c.trustRoot),w=await i(b);k.dependencies.includes(w)||k.dependencies.push(w)}return k.complete=!0,u},a=[];for(let c of t)a.push(await i(e.resolver.resolveRoot(c)));let s=[];for(let[c,l]of Array.from(n).sort(ot))l.complete||y("HL008",`Component graph did not finish loading \`${c}\`.`),s.push([c,Object.freeze({url:c,trustRoot:l.trustRoot,definition:l.definition,dependencies:Object.freeze(Array.from(l.dependencies)),...l.controller===void 0?{}:{controller:l.controller},shadowedByCustomElement:l.shadowedByCustomElement})]);return Object.freeze({roots:Object.freeze(a),nodes:new Map(s),tags:new Map(Array.from(o).sort(ot))})}function J(t){if(typeof t!="object"||t===null||Object.isFrozen(t))return t;for(let e of Object.values(t))J(e);return Object.freeze(t)}function st(t){let e="",n=!0;for(let r of t)r==="-"?n=!0:(e+=n?r.toUpperCase():r,n=!1);return e}function Re(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var dn=new Set(["string","boolean","number","integer","null","absent","trusted-html","trusted-script","function","unknown"]),ce=class extends SyntaxError{constructor(n,r){super(`${n} at character ${r+1}.`);this.position=r;this.name="TypeSyntaxError"}position},Se=class{constructor(e){this.source=e}source;#e=0;parse(){let e=this.#t();return this.#d(),this.#e!==this.source.length&&this.#l("Unexpected type syntax"),e}#t(){let e=[this.#n()];for(;this.#s("|");)e.push(this.#n());return e.length===1?e[0]:Ne(e)}#n(){let e=this.#r();for(;this.#s("?");)e=Ne([e,{kind:"terminal",name:"null"},{kind:"terminal",name:"absent"}]);return e}#r(){if(this.#s("(")){let r=this.#t();return this.#a(")"),r}let e=this.#c();if(e!==void 0)return{kind:"keyword",value:e};let n=this.#o();if(n===void 0&&this.#l("Expected a type, keyword, or group"),n==="list"||n==="record"){this.#a("(");let r=this.#t();return this.#a(")"),n==="list"?{kind:"list",item:r}:{kind:"record",value:r}}return n==="object"?this.#i():dn.has(n)?{kind:"terminal",name:n}:{kind:"keyword",value:n}}#i(){this.#a("("),this.#a("{");let e=[],n=!1;for(;!this.#s("}");){if(this.#d(),this.source.startsWith("...",this.#e))this.#e+=3,n=!0;else{let r=this.#c()??this.#o();r===void 0&&this.#l("Expected an object field or `...`");let o=this.#s("?");this.#a(":");let i=this.#t();e.some(a=>a.name===r)&&this.#l(`Duplicate object field \`${r}\``),e.push({name:r,type:i,optional:o})}if(this.#s("}"))break;this.#a(","),n&&(this.#d(),this.source.startsWith("}",this.#e)||this.#l("The open marker must be last"))}return this.#a(")"),{kind:"object",fields:e,open:n}}#o(){this.#d();let e=/^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.#e));if(e!==null)return this.#e+=e[0].length,e[0]}#c(){this.#d();let e=this.source[this.#e];if(e!=='"'&&e!=="'")return;this.#e+=1;let n="";for(;this.#e<this.source.length;){let r=this.source[this.#e++];if(r===e)return n;if(r!=="\\"){n+=r;continue}this.#e>=this.source.length&&this.#l("Unterminated escape");let o=this.source[this.#e++];n+={n:`
2
+ `,r:"\r",t:" ","\\":"\\",'"':'"',"'":"'"}[o]??o}this.#l("Unterminated quoted keyword")}#s(e){return this.#d(),this.source.startsWith(e,this.#e)?(this.#e+=e.length,!0):!1}#a(e){this.#s(e)||this.#l(`Expected \`${e}\``)}#d(){for(;/\s/.test(this.source[this.#e]??"");)this.#e+=1}#l(e){throw new ce(e,this.#e)}};function Ne(t){let e=t.flatMap(o=>o.kind==="union"?o.members:[o]),n=new Map(e.map(o=>[q(o),o])),r=Array.from(n.values());return r.length===1?r[0]:{kind:"union",members:r}}function de(t){if(t.trim()==="")throw new ce("A type expression cannot be empty",0);return J(new Se(t).parse())}function $e(t){return typeof t=="object"&&t!==null&&"kind"in t&&["terminal","keyword","union","list","record","object"].includes(String(t.kind))}function le(t){return $e(t)?t:typeof t=="string"?{kind:"terminal",name:t}:Ne(t.enum.map(e=>({kind:"keyword",value:e})))}function q(t){let e=$e(t)?t:le(t);switch(e.kind){case"terminal":return e.name;case"keyword":return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(e.value)?e.value:JSON.stringify(e.value);case"union":return e.members.map(n=>q(n)).join(" | ");case"list":return`list(${q(e.item)})`;case"record":return`record(${q(e.value)})`;case"object":return`object({ ${[...e.fields.map(n=>`${n.name}${n.optional?"?":""}: ${q(n.type)}`),...e.open?["..."]:[]].join(", ")} })`}}function j(t,e,n){return{ok:!1,issues:[{reason:t,message:e,path:n}]}}function Q(t,e){return typeof e=="number"?`${t}[${e}]`:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}function at(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Te(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return Symbol.for("html-next.bad-json")}}function ln(t,e){if(typeof t!="object"||t===null)return!1;if(t.kind===e&&"value"in t)return!0;let n=e==="trusted-html"?"TrustedHTML":"TrustedScript";return t.constructor?.name===n||Object.prototype.toString.call(t)===`[object ${n}]`}function un(t,e,n){switch(e){case"string":return typeof t=="string"?{ok:!0,value:t}:j("typeMismatch","Must be a string.",n);case"boolean":return typeof t=="boolean"?{ok:!0,value:t}:t===""||t==="true"?{ok:!0,value:!0}:t==="false"?{ok:!0,value:!1}:j("typeMismatch","Must be true or false.",n);case"number":case"integer":{let r=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(r)?e==="integer"&&!Number.isInteger(r)?j("typeMismatch","Must be an integer.",n):{ok:!0,value:r}:j("badInput",`Must be ${e==="integer"?"an integer":"a finite number"}.`,n)}case"null":return t===null?{ok:!0,value:null}:j("typeMismatch","Must be null.",n);case"absent":return t===void 0?{ok:!0,value:void 0}:j("typeMismatch","Must be absent.",n);case"trusted-html":case"trusted-script":return ln(t,e)?{ok:!0,value:t}:j("untrustedValue",`Must be a ${e==="trusted-html"?"TrustedHTML":"TrustedScript"} value.`,n);case"function":return typeof t=="function"?{ok:!0,value:t}:j("typeMismatch","Must be a function supplied through a property.",n);case"unknown":return{ok:!0,value:t}}}function Y(t,e,n){switch(e.kind){case"terminal":return un(t,e.name,n);case"keyword":return t===e.value?{ok:!0,value:t}:j("typeMismatch",`Must be ${JSON.stringify(e.value)}.`,n);case"union":{for(let r of e.members){let o=Y(t,r,n);if(o.ok)return o}return j("typeMismatch",`Must match ${q(e)}.`,n)}case"list":{let r=Te(t);if(!Array.isArray(r))return j("typeMismatch","Must be a list.",n);let o=[],i=[];return r.forEach((a,s)=>{let c=Y(a,e.item,Q(n,s));c.ok?o.push(c.value):i.push(...c.issues)}),i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"record":{let r=Te(t);if(!at(r))return j("typeMismatch","Must be a string-keyed record.",n);let o={},i=[];for(let[a,s]of Object.entries(r)){let c=Y(s,e.value,Q(n,a));c.ok?o[a]=c.value:i.push(...c.issues)}return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}case"object":{let r=Te(t);if(!at(r))return j("typeMismatch","Must be an object.",n);let o={},i=[],a=new Map(e.fields.map(s=>[s.name,s]));for(let s of e.fields){if(!(s.name in r)){s.optional||i.push({reason:"typeMismatch",message:"Required field is absent.",path:Q(n,s.name)});continue}let c=Y(r[s.name],s.type,Q(n,s.name));c.ok?o[s.name]=c.value:i.push(...c.issues)}for(let[s,c]of Object.entries(r))a.has(s)||(e.open?o[s]=c:i.push({reason:"typeMismatch",message:"Field is not declared by this closed object type.",path:Q(n,s)}));return i.length===0?{ok:!0,value:o}:{ok:!1,issues:i}}}}function B(t,e,n="$"){return Y(t,le(e),n)}function Ae(t,e){let n=B(t,e);if(!n.ok)throw new TypeError(n.issues.map(o=>`${o.path}: ${o.message}`).join("; "));let r=le(e);if(r.kind==="terminal"&&(r.name==="function"||r.name==="unknown"))throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);return r.kind==="list"||r.kind==="record"||r.kind==="object"||r.kind==="union"&&typeof n.value=="object"&&n.value!==null?JSON.stringify(n.value):n.value===null?"null":n.value===void 0?"":String(n.value)}function _(t){let e=le(t);return e.kind==="terminal"?!["function","unknown","trusted-html","trusted-script"].includes(e.name):e.kind==="keyword"?!0:e.kind==="union"?e.members.every(_):e.kind==="list"?_(e.item):e.kind==="record"?_(e.value):e.fields.every(n=>_(n.type))}function He(t){let e;try{e=de(t)}catch(n){y("HC013",n instanceof Error?n.message:"Invalid prop type expression.")}return e.kind==="terminal"&&(e.name==="string"||e.name==="boolean"||e.name==="number")?e.name:e.kind==="keyword"?{enum:[e.value]}:e.kind==="union"&&e.members.every(n=>n.kind==="keyword")?{enum:e.members.map(n=>n.value)}:e}var E=Symbol("absent"),ee=class extends Error{constructor(n){super(`\`${n}\` is not declared in scope.`);this.identifier=n;this.name="UndeclaredName"}identifier},De=/\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y,fn=/\\([\s\S])/g,pn=/%s/g,mn={or:1,and:2,"=":3,"!=":3,"^=":3,"$=":3,"*=":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6};function ct(t){return mn[t]??0}function hn(t){return t==="round"||t==="clamp"||t==="min"||t==="max"||t==="abs"||t==="format"}function yn(t){let e=0,n=0,r="";function o(){De.lastIndex=e;let d=De.exec(t);if(d===null){let h=t.slice(e).trimStart()[0];throw h==='"'||h==="'"?new SyntaxError("Unterminated string literal."):new SyntaxError(`Unexpected character \`${h}\`.`)}e=De.lastIndex,d[1]!==void 0||d[5]!==void 0?(n=4,r=d[1]??d[5]):d[2]!==void 0?(n=1,r=Number(d[2])):d[3]!==void 0?(n=2,r=d[3].slice(1,-1).replace(fn,"$1")):d[4]!==void 0?(n=3,r=d[4]):(n=0,r="")}function i(d){return r!==d?!1:(o(),!0)}function a(d){if(!i(d))throw new SyntaxError(`Expected \`${d}\`.`)}function s(d){let h=c(),u=ct(r);for(;u>=d;){let p=r;o(),h={kind:"binary",op:p,left:h,right:s(u+1)},u=ct(r)}return h}function c(){if(n===3&&r==="not")return o(),{kind:"unary",op:"not",operand:c()};if(i("-"))return{kind:"unary",op:"-",operand:c()};let d=l();for(;n===4;)if(i(".")){if(n!==3)throw new SyntaxError("Expected a property name after `.`.");let h=r;o(),d={kind:"member",object:d,key:h}}else if(i("[")){let h=s(1);a("]"),d={kind:"index",object:d,index:h}}else break;return d}function l(){let d=n,h=r;if(d===1||d===2)return o(),{kind:"literal",value:h};if(d===4&&h==="("){o();let u=s(1);return a(")"),u}if(d===4&&h==="{"){o();let u=[];if(!i("}")){do{if(r==="}")break;if(n!==3&&n!==2)throw new SyntaxError("Object keys must be identifiers or strings.");let p=r;o(),a(":"),u.push({key:p,value:s(1)})}while(i(","));a("}")}return{kind:"object",pairs:u}}if(d===4&&h==="["){o();let u=[];if(!i("]")){do{if(r==="]")break;u.push(s(1))}while(i(","));a("]")}return{kind:"array",items:u}}if(d===3){let u=h;if(o(),u==="true")return{kind:"literal",value:!0};if(u==="false")return{kind:"literal",value:!1};if(u==="null")return{kind:"literal",value:null};if(r==="("&&hn(u)){o();let p=[];if(!i(")")){do p.push(s(1));while(i(","));a(")")}return{kind:"call",fn:u,args:p}}return{kind:"id",name:u}}throw new SyntaxError("Unexpected end of expression.")}o();let f=s(1);if(n!==0)throw new SyntaxError("Unexpected trailing input in expression.");return f}function X(t){return t===E||t===null}function L(t){if(t===E||t===null||t===!1)return!1;if(t===!0)return!0;if(typeof t=="string")return t.length>0;if(typeof t=="number")return t!==0&&t===t;if(Array.isArray(t))return t.length>0;for(let e in t)if(Object.hasOwn(t,e))return!0;return!1}function ue(t){return typeof t=="number"&&t===t?t:E}function H(t,e){switch(t.kind){case"literal":return t.value;case"id":{let n=e.get(t.name);if(n===void 0)throw new ee(t.name);return n}case"member":{let n=H(t.object,e);if(X(n)||typeof n!="object"||Array.isArray(n))return E;let r=n[t.key];return r===void 0?E:r}case"index":{let n=H(t.object,e),r=H(t.index,e);if(X(n)||X(r))return E;if(Array.isArray(n)&&typeof r=="number"){let o=n[r];return o===void 0?E:o}if(typeof n=="object"&&typeof r=="string"){let o=n[r];return o===void 0?E:o}return E}case"unary":{let n=H(t.operand,e);if(t.op==="not")return!L(n);let r=ue(n);return r===E?E:-r}case"binary":return gn(t,e);case"call":return bn(t,e);case"object":{let n={};for(let r of t.pairs)n[r.key]=H(r.value,e);return n}case"array":{let n=[];for(let r of t.items)n.push(H(r,e));return n}}}function gn(t,e){let{op:n}=t;if(n==="and")return L(H(t.left,e))&&L(H(t.right,e));if(n==="or")return L(H(t.left,e))||L(H(t.right,e));let r=H(t.left,e),o=H(t.right,e);if(n==="=")return r===o;if(n==="!=")return r!==o;if(n==="^="||n==="$="||n==="*=")return typeof r!="string"||typeof o!="string"?E:n==="^="?r.startsWith(o):n==="$="?r.endsWith(o):r.includes(o);let i=ue(r),a=ue(o);if(i===E||a===E)return E;switch(n){case"<":return i<a;case"<=":return i<=a;case">":return i>a;case">=":return i>=a;case"+":return i+a;case"-":return i-a;case"*":return i*a;case"/":return i/a;case"%":return i%a;default:return E}}function bn(t,e){let{args:n,fn:r}=t,o=[];for(let a of n)o.push(H(a,e));if(r==="format"){let a=o[0];if(typeof a!="string")return E;let s=1;return a.replace(pn,()=>s<o.length?P(o[s++]):"%s")}for(let a=0;a<o.length;a+=1){let s=ue(o[a]);if(s===E)return E;o[a]=s}let i=o;switch(r){case"abs":return i.length===1?Math.abs(i[0]):E;case"round":return i.length===1?Math.round(i[0]):E;case"min":return i.length>0?Math.min(...i):E;case"max":return i.length>0?Math.max(...i):E;case"clamp":return i.length===3?Math.min(Math.max(i[0],i[1]),i[2]):E;default:return E}}var dt=new Map;function Me(t){if(t.kind==="id")return t.name;if(t.kind==="member"){let e=Me(t.object);return e===void 0?void 0:`${e}.${t.key}`}if(t.kind==="index"&&t.index.kind==="literal"){let e=t.index.value;if(typeof e!="string"&&typeof e!="number")return;let n=Me(t.object);return n===void 0?void 0:`${n}.${e}`}}function O(t,e){let n=Me(t);if(n!==void 0){e.includes(n)||e.push(n);return}switch(t.kind){case"literal":return;case"id":return;case"member":O(t.object,e);return;case"index":O(t.object,e),O(t.index,e);return;case"unary":O(t.operand,e);return;case"binary":O(t.left,e),O(t.right,e);return;case"call":for(let r of t.args)O(r,e);return;case"object":for(let r of t.pairs)O(r.value,e);return;case"array":for(let r of t.items)O(r,e)}}function Pe(t,e){if(t.kind==="id")return e.push(t.name),!0;if(t.kind==="member")return Pe(t.object,e)?(e.push(t.key),!0):!1;if(t.kind!=="index"||!Pe(t.object,e))return!1;let n=t.index,r=n.kind==="literal"?n.value:void 0;return e.push(typeof r=="string"||typeof r=="number"?r:{kind:"index",expression:n}),!0}function fe(t){let e=dt.get(t);if(e!==void 0)return e;let n=yn(t),r=[];return O(n,r),r.sort(),e={source:t,ast:n,dependencies:r},dt.set(t,e),e}function je(t,e){let n=[];if(!(!Pe(fe(t).ast,n)||!e.has(n[0])))return n}function lt(t,e){return H(fe(t).ast,e)}function I(t,e){return H("ast"in t?t.ast:t,e)}function P(t){return X(t)?"":Array.isArray(t)?t.map(P).join(" "):typeof t=="object"?"":String(t)}function vn(t){return t.startsWith("aria-")||t==="contenteditable"||t==="draggable"||t==="spellcheck"}function ut(t,e=""){return typeof t=="boolean"&&vn(e)?String(t):X(t)||t===!1?null:t===!0?"":typeof t=="number"||typeof t=="string"?String(t):Array.isArray(t)?t.map(P).join(" "):null}var wn=new Set(["href","src","action","formaction","poster","data","xlink:href"]),kn=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),Cn=new Set(["srcdoc","style"]);function te(t){let e=t.replace(/[\u0000-\u0020\u007f]+/g,"");return/^(?:data|javascript|vbscript):/i.test(e)}function ne(t){return wn.has(t.toLowerCase())}function Le(t,e,n){let r=e.createElement("template");r.innerHTML=t;for(let o of Array.from(r.content.querySelectorAll("*"))){if(n?.(o),kn.has(o.localName)){o.remove();continue}for(let i of Array.from(o.attributes)){let a=i.name.toLowerCase();(a.startsWith("on")||Cn.has(a)||ne(a)&&te(i.value))&&o.removeAttribute(i.name)}}return r.content}var xn=/^(?:if|else-if|else|for|with|value|state|computed|data)$/,En=/^(?:@|v-|#|on:|use:|transition:|animate:)/,Rn=/^(?:innerhtml|outerhtml|srcdoc)$/,Tn=/^(?:base|embed|link|meta|object|script|style)$/;function ft(t){return xn.test(t)}function Oe(t,e){return Tn.test(t.toLowerCase())&&y("HT009",`<${t}> is not permitted in rendered component markup.`,e),t}function Ie(t,e,n=""){let r=t.toLowerCase();return(r.startsWith("on")||En.test(r))&&y("HT010",`Literal attribute \`${t}\` uses target-framework directive syntax that is not supported.`,e),r==="srcdoc"&&y("HT007","Literal `srcdoc` is not permitted in a component definition.",e),ne(r)&&te(n)&&y("HT007",`Literal \`${t}\` contains an executable URL.`,e),t}function pt(t,e){let n=t.toLowerCase();return(n.startsWith("on")||Rn.test(n))&&y("HT007",`Dynamic ${t} requires a future trusted-content type.`,e),t}function z(t){return"tagName"in t}function re(t){return t.nodeName==="#text"}function N(t){return"localName"in t?t.localName:t.tagName}function pe(t){return"attrs"in t?t.attrs:t.attributes}function V(t){return(N(t)==="template"?t.content:void 0)?.childNodes??t.childNodes}function oe(t){return"value"in t?t.value:"nodeValue"in t?t.nodeValue??"":""}function yt(t){let e=[];for(let n of t)n.nodeName!=="#comment"&&(!re(n)||oe(n).trim()!=="")&&e.push(n);return e}function x(t,e){return"attrs"in t?t.attrs.find(n=>n.name===e)?.value:t.getAttribute(e)??void 0}function gt(t){let e="";for(let n of V(t))re(n)&&(e+=oe(n));return e}function bt(t,e){let n=[];for(let r of V(t))z(r)&&N(r)===e&&n.push(r);return n}function vt(t,e){for(let n of V(t)){if(!z(n))continue;let r=N(n);r==="link"&&y("HL001","External definition dependencies require the application-owned graph resolver.",e),Oe(r,e);for(let o of pe(n))/^on(?!:)/i.test(o.name)&&Ie(o.name,e,o.value);vt(n,e)}}var Sn=/^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/,mt=/^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/,Nn=/^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/,ht=/^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/,ze=/^[a-z][a-z0-9-]*$/,$n=/^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/,qe=/^[A-Za-z_$][A-Za-z0-9_$-]*$/;function Ve(t,...e){let n=new Set(t.roots);for(let r of e)r!==void 0&&n.add(r);return{roots:n,writableRoots:t.writableRoots,handlers:t.handlers}}function S(t,e,n){let r=Pn(t,n);return An(r,e,n),r}function An(t,e,n){for(let r of t.dependencies){let o=r.split(".",1)[0];e.roots.has(o)||y("HT003",`Expression root \`${o}\` is not declared in this scope.`,n)}}function Hn(t,e,n){let r=Object.create(null),o=(a,s)=>{r[a]??=s},i=a=>{for(let s of pe(a))if(s.name.startsWith(":"))/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)&&o(s.value,{attribute:s.name.slice(1).toLowerCase()});else if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase();if(/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)){let l=n.resolveDomProperty(N(a),c)??(s.value.toLowerCase()===c?s.value:c);o(s.value,{property:l})}}for(let s of V(a))z(s)&&N(s)!=="slot"&&i(s)};return i(t),r}function Dn(t,e,n,r=!0){let o=Object.create(null),i=Object.create(null);if(t===void 0)return o;let a=bt(t,"prop");a.sort((s,c)=>{let l=x(s,"name")??"",f=x(c,"name")??"";return l<f?-1:l>f?1:0});for(let s of a){let c=x(s,"name");(c===void 0||c==="")&&y("HC010","A <prop> requires a `name` attribute.",n),/^[A-Za-z][A-Za-z0-9_-]*$/.test(c)||y("HC010",`Invalid prop name \`${c}\`.`,n);let l=x(s,"type");(l===void 0||l==="")&&y("HC013",`Prop \`${c}\` requires a \`type\` attribute.`,n);let f=c.toLowerCase(),d=i[f];d!==void 0&&y("HC011",`Props \`${d}\` and \`${c}\` collide after lowercase normalization.`,n),i[f]=c;let h=e[c];h===void 0&&r&&y("HC018",`Prop \`${c}\` is declared but never bound in the markup.`,n),h??={attribute:c.toLowerCase()};let u=He(l),p=x(s,"required")!==void 0,m=gt(s).trim();m===""&&y("HC003",`\`props.${c}.description\` must be a non-empty string.`,n),_(u)||y("HC017",`Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`,n);let v=x(s,"default");p&&v!==void 0&&y("HC019",`Required prop \`${c}\` cannot also declare a default.`,n);let C={type:u,required:p,target:h,description:m};if(v!==void 0){let k=B(v,u);k.ok||y("HC015",`Default for prop \`${c}\` does not satisfy its type.`,n),C.default=k.value}o[c]=C}return o}function Mn(t,e,n,r,o,i,a){let s=x(t,"component")??"";s.trim()===""&&y("HC003","`component` must be a non-empty string.",i),/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s)||y("HC005","The `component` tag must be lowercase and contain a hyphen.",i);let c=x(t,"status");c!==void 0&&!/^(?:early|experimental|stable|deprecated)$/.test(c)&&y("HC007","Component `status` is not recognized.",i);let l=x(t,"summary");return l!==void 0&&l.trim()===""&&y("HC003","`summary` must be a non-empty string.",i),(!/^[a-z][a-z0-9-]*$/.test(n)||r&&!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n))&&y("HC008","`nativeElement` must be a lowercase HTML element or component tag.",i),{version:1,name:st(s),tag:s,...c===void 0?{}:{status:c},...l===void 0?{}:{summary:l},nativeElement:n,props:Dn(e,o,i,a)}}function Pn(t,e){try{return fe(t)}catch{y("HT013",`Malformed expression \`${t}\`.`,e)}}function jn(t,e,n){let r=[];for(let o of yt(V(t))){z(o)||y("HC023","Handler bodies contain declarative step elements only.",n);let i=x(o,"$if"),a=i===void 0?void 0:S(i,e,n);if(N(o)==="set"){let s=x(o,"name")??"",c=x(o,":value"),l=x(o,"value");(s===""||c===void 0==(l===void 0))&&y("HC023","A <set> requires `name` and exactly one of `value` or `:value`.",n),S(s,e,n);let f=je(s,e.writableRoots);f===void 0&&y("HT005",`Handler write \`${s}\` is not rooted in declared state.`,n);let d={kind:"set",path:s,writablePath:f,value:S(c??JSON.stringify(l),e,n)};a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="dispatch"){let s=x(o,"event")??"";ze.test(s)||y("HC023","A <dispatch> requires a valid `event` name.",n);let c=x(o,":value"),l=x(o,"value");c!==void 0&&l!==void 0&&y("HC023","A <dispatch> may declare only one of `value` or `:value`.",n);let f=c===void 0&&l===void 0?void 0:S(c??JSON.stringify(l),e,n),d={kind:"dispatch",event:s};f!==void 0&&(d.value=f),a!==void 0&&(d.guard=a),r.push(d);continue}if(N(o)==="validate"||N(o)==="focus"){let s=x(o,"target")??x(o,"ref")??x(o,"name")??"";qe.test(s)||y("HC023",`<${N(o)}> requires a valid target reference.`,n);let c={kind:N(o),target:s};a!==void 0&&(c.guard=a),r.push(c);continue}y("HC023",`<${N(o)}> is not a recognized handler step.`,n)}return r}function Ln(t,e,n){let r=[],o=new Set(Object.keys(e.props)),i=new Set,a=new Set;if(t===void 0)return{declarations:r,scope:{roots:o,writableRoots:i,handlers:a}};let s=[],c=new Set,l=new Set;for(let d of V(t)){if(!z(d))continue;let h=d;s.push(h);let u=N(h);/^(?:prop|state|computed|data|handler|event|method)$/.test(u)||y("HC021",`<${u}> is not a recognized definition declaration.`,n);let p=x(h,"name")??"";if(p===""&&y("HC010",`A <${u}> requires a \`name\` attribute.`,n),u==="event"){l.has(p)&&y("HC020",`Event \`${p}\` is declared more than once.`,n),l.add(p);continue}c.has(p)&&y("HC020",`Declaration \`${p}\` collides in the flat component scope.`,n),c.add(p),o.add(p),u==="state"?i.add(p):u==="handler"&&a.add(p)}let f={roots:o,writableRoots:i,handlers:a};for(let d of s){let h=N(d);if(h==="prop")continue;let u=x(d,"name");if(h==="state"){let p=x(d,":value"),m=x(d,"value");p!==void 0&&m!==void 0&&y("HC013",`<state name="${u}"> may declare only one of \`value\` or \`:value\`.`,n);let v=p===void 0&&m===void 0?void 0:S(p??JSON.stringify(m),f,n),C={kind:h,name:u},k=x(d,"type");k!==void 0&&(He(k),C.type=k),m!==void 0&&(C.value=m),v!==void 0&&(C.expression=v),r.push(C);continue}if(h==="computed"){let p=x(d,"from");(p===void 0||p==="")&&y("HC013",`<computed name="${u}"> requires a \`from\` expression.`,n),r.push({kind:h,name:u,expression:S(p,f,n)});continue}if(h==="data"){let p=x(d,"src"),m=x(d,"type"),v=x(d,"debounce"),C=x(d,"poll"),k=[],g=new Set;for(let w of bt(d,"param")){let R=x(w,"name")??"",T=x(w,":value");(!qe.test(R)||T===void 0)&&y("HC024","A data <param> requires a valid `name` and a `:value` expression.",n),g.has(R)&&y("HC024",`Data source \`${u}\` repeats a parameter name.`,n),g.add(R),k.push({name:R,expression:S(T,f,n)})}let b={kind:h,name:u,parameters:k};p!==void 0&&(b.source=p),m!==void 0&&(b.type=m),v!==void 0&&(b.debounce=v),C!==void 0&&(b.poll=C),r.push(b);continue}if(h==="event"){r.push({kind:h,name:u,type:x(d,"type")??"object",bubbles:x(d,"bubbles")!=="false",composed:x(d,"composed")!=="false",cancelable:x(d,"cancelable")==="true"});continue}if(h==="method"){r.push({kind:h,name:u,exportName:x(d,"export")??u,returns:x(d,"returns")??"undefined"});continue}r.push({kind:"handler",name:u,steps:jn(d,f,n)})}for(let d of r)if(d.kind==="handler")for(let h of d.steps)h.kind==="dispatch"&&!l.has(h.event)&&y("HC023",`Handler \`${d.name}\` dispatches undeclared component event \`${h.event}\`.`,n);return{declarations:r,scope:f}}function On(t,e,n,r,o,i){let a=[];for(let s of t){if(s.name.startsWith("bind:")){let c=s.name.slice(5).toLowerCase();(c===""||mt.test(c))&&y("HT007",`Two-way binding cannot target \`${c||s.name}\`.`,o);let l=S(s.value,r,o),f=je(s.value,r.writableRoots);f===void 0&&y("HT005",`\`${s.value}\` is not a writable state-rooted path.`,o),a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l,twoWay:!0,writablePath:f});continue}if(s.name.startsWith("class:")||s.name.startsWith("style:")){let c=s.name.startsWith("class:")?"class":"style",l=s.name.slice(c.length+1);(c==="class"?l!==""&&!/\s/.test(l):/^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(l))||y("HT020",`\`${s.name}\` does not name a valid ${c} binding target.`,o),a.push({kind:"attribute",name:l,expression:s.value,expressionPlan:S(s.value,r,o),target:c});continue}if(s.name.startsWith("$")){let c=s.name.slice(1).toLowerCase();c!=="value"&&c!=="html"&&y("HT012",`\`$${c}\` is not a known content directive.`,o),a.push({kind:"directive",name:c,expression:s.value,expressionPlan:S(s.value,r,o)});continue}if(s.name.startsWith(":")){let c=s.name.slice(1).toLowerCase();mt.test(c)&&y("HT007",`\`:${c}\` cannot bind a raw content sink.`,o);let l=S(s.value,r,o);a.push({kind:"attribute",name:c,expression:s.value,expressionPlan:l});continue}if(s.name.startsWith(".")){let c=s.name.slice(1).toLowerCase(),l=S(s.value,r,o),f=i.resolveDomProperty(e,c);f===void 0&&y("HP001",`\`${c}\` is not a native property of <${e}>.`,o),pt(f,o),a.push({kind:"property",key:c,name:f,expression:s.value,expressionPlan:l});continue}Ie(s.name,o,s.value),a.push({kind:"literal",name:s.name,value:s.value})}return a}function In(t,e,n){if(t===void 0)return;let r=[];for(let o of t){let[i="",...a]=o.name.slice(3).split(".");(!ze.test(i)||a.some(s=>!ze.test(s)))&&y("HT010",`\`${o.name}\` is not a valid declarative event binding.`,n);for(let s=0;s<a.length;s+=1){let c=a[s];a.indexOf(c)!==s&&y("HT010",`\`${o.name}\` repeats an event modifier.`,n),$n.test(c)||y("HT010",`\`${o.name}\` contains an unsupported event modifier.`,n)}a.includes("passive")&&a.includes("prevent")&&y("HT010",`\`${o.name}\` cannot combine passive and prevent.`,n),e.handlers.has(o.value)||y("HT010",`Event binding \`${o.name}\` names undeclared handler \`${o.value}\`.`,n),r.push({name:i,handler:o.value,modifiers:a})}return r}function zn(t,e,n){if(t!==void 0)return qe.test(t)||y("HT019","`$ref` requires a valid non-empty name.",n),e.has(t)&&y("HT019",`Reference \`${t}\` is duplicated.`,n),e.add(t),t}function Vn(t,e,n){if(t===void 0)return;let r=[],o=[];t.$if!==void 0&&r.push("$if"),t.$each!==void 0&&r.push("$each"),t.$with!==void 0&&r.push("$with"),t.$match!==void 0&&r.push("$match"),t.$when!==void 0&&r.push("$when"),t.$else!==void 0&&r.push("$else"),t.$where!==void 0&&o.push("$where"),t.$sort!==void 0&&o.push("$sort"),t.$limit!==void 0&&o.push("$limit"),t.$key!==void 0&&o.push("$key"),r.length>1&&y("HT014",`An element carries one structural directive; found ${r.join(", ")}.`,n);let i=t.$each;i===void 0&&o.length>0&&y("HT014",`${o.join(", ")} may only modify \`$each\`.`,n);let a=t.$if;if(a!==void 0){let f=a;return{kind:"if",test:f,testPlan:S(f,e,n)}}let s=t.$with;if(s!==void 0){let f=ht.exec(s);return f===null&&y("HT015","`$with` must be written `expr as name`.",n),{kind:"with",expr:f[1],expressionPlan:S(f[1],e,n),alias:f[2]}}if(i!==void 0){let f=Nn.exec(i);f===null&&y("HT016","`$each` must be written `item of items` (optionally `item, i of items`).",n);let d=f[1],h=f[2];(e.roots.has(d)||h!==void 0&&e.roots.has(h))&&y("HC020","Loop locals may not collide with an existing scope name.",n);let u=Ve(e,d,h,"loop"),p={kind:"each",item:d,list:f[3],listPlan:S(f[3],e,n)};h!==void 0&&(p.index=h);let m=t.$where;m!==void 0&&(p.where=m,p.wherePlan=S(m,u,n)),t.$sort!==void 0&&(p.sort=t.$sort);let v=t.$limit;v!==void 0&&(p.limit=v,p.limitPlan=S(v,u,n));let C=t.$key;return C!==void 0&&(p.key=C,p.keyPlan=S(C,u,n)),p}let c=t.$match;if(c!==void 0){let f=c.trim();if(f==="")return{kind:"match"};let d=ht.exec(f);return d===null&&y("HT017","`$match` scope must be written `expr as name`.",n),{kind:"match",expr:d[1],expressionPlan:S(d[1],e,n),alias:d[2]}}let l=t.$when;if(l!==void 0){let f=l;return{kind:"when",test:f,testPlan:S(f,e,n)}}if(t.$else!==void 0)return{kind:"else"}}function Ue(t,e,n,r,o,i){let a=N(t);ft(a)&&y("HT009",`<${a}> is reserved but not supported by this profile.`,r),Oe(a,r);let s,c=[],l,f;for(let g of pe(t))Sn.test(g.name)?(s??={})[g.name]=g.value:g.name==="$ref"?f=g.value:g.name.startsWith("on:")?(l??=[]).push(g):g.name!=="as"&&c.push(g);let d=Vn(s,n,r),h=d?.kind==="each"?Ve(n,d.item,d.index,"loop"):d?.kind==="with"||d?.kind==="match"&&d.alias!==void 0?Ve(n,d.alias):n,u=On(c,a,e,h,r,i),p=In(l,h,r),m=zn(f,o.refs,r),v=[],C=V(t);for(let g of C)if(g.nodeName!=="#comment"){if(re(g)){let b=oe(g);b.trim()!==""&&v.push({kind:"text",value:b});continue}if(z(g)){if(N(g)==="slot"){let b=x(g,"name"),w=x(g,":name");b!==void 0&&w!==void 0&&y("HT008","A slot cannot declare both `name` and `:name`.",r);for(let M of pe(g))M.name!=="name"&&M.name!==":name"&&y("HT008","A slot has an unsupported attribute.",r);b===void 0&&w===void 0&&(o.defaults+=1,o.defaults>1&&y("HT008","A component may declare one default slot.",r)),b!==void 0&&((b===""||o.names.has(b))&&y("HT008",`Slot name \`${b}\` is empty or duplicated.`,r),o.names.add(b));let R=[];for(let M of V(g))if(M.nodeName!=="#comment")if(re(M)){let ae=oe(M);ae.trim()!==""&&R.push({kind:"text",value:ae})}else z(M)&&R.push(Ue(M,e,h,r,o,i));let A={dynamic:w!==void 0,required:R.length===0};if(b!==void 0&&(A.name=b),o.contracts.push(A),b===void 0&&w===void 0&&R.length===0)v.push({kind:"slot"});else{let M={kind:"slot",fallback:R};b!==void 0&&(M.name=b),w!==void 0&&(M.nameExpression=S(w,h,r)),v.push(M)}continue}v.push(Ue(g,e,h,r,o,i))}}if(u.some(g=>g.kind==="directive")&&v.length>0&&y("HT006","A content directive cannot coexist with children.",r),u.some(g=>g.kind==="property"&&g.name==="textContent")&&v.length>0&&y("HT006","A content-replacing property binding cannot coexist with children.",r),d?.kind==="match"){let g=0;for(let w of v)w.kind==="element"&&(g+=1);let b=!1;for(let w of v)w.kind==="element"&&(g-=1,w.flow?.kind==="when"?b&&y("HT018","A `$when` arm may not follow `$else`.",r):w.flow?.kind==="else"?(b&&y("HT018","A `$match` has at most one `$else`.",r),b=!0,g!==0&&y("HT018","`$else` must be the last arm.",r)):y("HT018","Every direct child of a `$match` must be a `$when` or `$else` arm.",r))}let k={kind:"element",name:a,attributes:u,children:v};return d!==void 0&&(k.flow=d),p!==void 0&&(k.events=p),m!==void 0&&(k.ref=m),k}function wt(t,e,n){let r=yt(t);(r.length!==1||!z(r[0])||N(r[0])!=="template"||x(r[0],"component")===void 0)&&y("HS001","A source must contain exactly one top-level <template component>.",e);let o=r[0],i,a=!1,s,c;for(let b of V(o)){if(b.nodeName==="#comment"||re(b)&&oe(b).trim()==="")continue;z(b)||y("HT001","A component's markup must be exactly one element root.",e);let w=N(b);w==="props"||w==="defs"?(i!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),i=b,a=w==="props",vt(b,e)):w==="style"?(s!==void 0&&y("HS002","A component has one optional declaration group, one markup root, and one optional <style>.",e),s=b):c===void 0?c=b:y("HT001","A component's markup must be exactly one element root.",e)}c===void 0&&y("HT001","A component's markup must be exactly one element root.",e);let l=N(c),f=(x(c,"as")??l).split("|");for(let b=f.length-1;b>=0;b-=1)f[b]=f[b].trim(),f[b]===""&&f.splice(b,1);let d=!n.isNativeElement(l);d&&x(c,"as")!==void 0&&y("HT021","A delegated component root cannot also declare native `as` choices.",e),!d&&(f.length===0||!f.includes(l)||f.some((b,w)=>f.indexOf(b)!==w)||f.some(b=>!n.isNativeElement(b)))&&y("HT021","A polymorphic root must list unique native choices including its markup root.",e);let h=Hn(c,e,n),u=Mn(o,i,l,d,h,e,a),{declarations:p,scope:m}=Ln(a?void 0:i,u,e),v={defaults:0,names:new Set,contracts:[],refs:new Set},C=Ue(c,u,m,e,v,n),k=x(o,"controller");k===""&&y("HC022","A controller specifier cannot be empty.",e);let g={source:{file:e},contract:u,template:C,css:s===void 0?"":gt(s).trim(),declarations:p,slots:v.contracts,root:d?{kind:"component",tag:l}:{kind:"native",element:l,choices:f}};return k!==void 0&&(g.controller=k),J(g)}var kt=new WeakMap;function Un(t){let e={},n={},r=o=>{if(o.includes("-"))return!1;if(Object.hasOwn(e,o))return e[o];let i=t.createElement(o),a=t.defaultView?.HTMLUnknownElement,s=a===void 0?i.constructor.name!=="HTMLUnknownElement":!(i instanceof a);return e[o]=s,s};return{isNativeElement:r,resolveDomProperty(o,i){if(!r(o))return;let a=`${o}:${i}`;if(a in n)return n[a]||void 0;let s=t.createElement(o),c=i.toLowerCase();for(;s!==null;){for(let l of Object.getOwnPropertyNames(s))if(l.toLowerCase()===c)return n[a]=l,l;s=Object.getPrototypeOf(s)}n[a]=""}}}function _e(t,e=t.ownerDocument.URL){(t.localName!=="template"||!t.hasAttribute("component"))&&y("HS001","A browser component carrier must be a <template component>.",e);let n=t.ownerDocument,r=kt.get(n);return r===void 0&&(r=Un(n),kt.set(n,r)),wt([t],e,r)}function Ct(t,e,n){let r=n.createElement("template");r.innerHTML=t;let o;for(let a of r.content.childNodes)a.nodeType===1&&a.localName==="template"&&a.hasAttribute("component")&&(o!==void 0&&y("HS001","A component resource must contain exactly one <template component>.",e),o=a);o===void 0&&y("HS001","A component resource must contain exactly one <template component>.",e);let i=[];for(let a of r.content.childNodes){if(a===o||a.nodeType===8||a.nodeType===3&&(a.nodeValue??"").trim()==="")continue;(a.nodeType!==1||a.localName!=="link"||a.getAttribute("rel")!=="component")&&y("HT009","A component resource may contain only dependency links and one inert carrier.",e);let s=a.getAttribute("href");(s===null||s.trim()==="")&&y("HL006","A component dependency link requires a non-empty `href`.",e),i.push(s)}return{definition:_e(o,e),dependencies:i}}var me=class{#e=new Map;#t=new Map;define(e,n){this.#e.has(e)&&y("HR001",`More than one definition declares <${e}>.`),this.#e.set(e,Object.freeze(n));for(let r of this.#t.get(e)??[])r();this.#t.delete(e)}get(e){return this.#e.get(e)}whenDefined(e){return this.#e.has(e)?Promise.resolve():new Promise(n=>{let r=this.#t.get(e)??[];r.push(n),this.#t.set(e,r)})}addGraph(e,n){for(let r of e.nodes.values())r.shadowedByCustomElement||this.define(r.definition.contract.tag,{node:r,...r.controller===void 0||n===void 0?{}:{loadController:()=>n(r)}})}};var xt=/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/|\.\.?\/)/;function Et(t){return new URL("./",t).href}function qn(t){let e=new URL(t);return e.origin==="null"?Et(t):new URL("/",e).href}function _n(t,e){return t.endsWith("/")?e:Et(e)}function Be(t,e){return t===e||t.startsWith(e.endsWith("/")?e:`${e}/`)}var he=class{#e;#t;#n;#r;constructor(e={},n="file:///",r=n){let o=new URL(n),i=new URL(r);this.#e=o.href,this.#t=i.origin,this.#n=qn(i.href),this.#r=new Map(Object.entries(e.imports??{}).map(([a,s])=>[a,new URL(s,this.#e).href]))}resolveRoot(e){if(xt.test(e)){let n=new URL(e,this.#e);return n.origin!==this.#t&&y("HL010",`Cross-origin component root \`${n.href}\` requires an application-owned import-map entry.`,this.#e),Object.freeze({url:n.href,trustRoot:this.#n})}return this.#i(e)}resolveDependency(e,n,r){if(!xt.test(e))return this.#i(e);let o=new URL(e,n).href;return Be(o,r)||y("HL003",`Dependency \`${e}\` escapes approved root \`${r}\`.`,n),Object.freeze({url:o,trustRoot:r})}assertFinalURL(e,n,r=e.url){let o=new URL(n,e.url).href;return Be(o,e.trustRoot)||y("HL004",`Final component URL \`${o}\` escapes approved root \`${e.trustRoot}\`.`,r),o}#i(e){let n=this.#r.get(e);if(n!==void 0)return Object.freeze({url:n,trustRoot:_n(e,n),mapping:e});let r=Array.from(this.#r.keys()).filter(a=>a.endsWith("/")&&e.startsWith(a)).sort((a,s)=>s.length-a.length)[0];r===void 0&&y("HL002",`Bare resource specifier \`${e}\` is not mapped by the application.`);let o=this.#r.get(r),i=new URL(e.slice(r.length),o).href;return Be(i,o)||y("HL003",`Mapped resource \`${e}\` escapes approved root \`${o}\`.`),Object.freeze({url:i,trustRoot:o,mapping:r})}};var Rt=new Map;function We(t,e=n=>import(n)){let n=t.controller;if(n===void 0)return Promise.reject(new TypeError(`<${t.definition.contract.tag}> does not declare a controller.`));let r=Rt.get(n.url);return r===void 0&&(r=e(n.url).then(o=>{let i=o?.default;return typeof i!="function"&&y("HJ002",`Controller module \`${n.url}\` must default-export a function.`,t.url),Object.freeze({...o,default:i})}).catch(o=>{if(o instanceof Error&&"diagnostic"in o)throw o;y("HJ001",`Controller module \`${n.url}\` failed to load: ${o instanceof Error?o.message:String(o)}.`,t.url)}),Rt.set(n.url,r)),r}async function Tt(t,e=n=>import(n)){return(await We(t,e)).default}function Bn(t,e,n){let r=new Set,o=t.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g,(a,s)=>{r.add(s);let c=n[s];return c==null?"":encodeURIComponent(String(c))}),i=new URL(o,e);for(let[a,s]of Object.entries(n))if(!(r.has(a)||s==null))if(Array.isArray(s))for(let c of s)i.searchParams.append(a,String(c));else i.searchParams.set(a,String(s));return i.href}var ye=class{constructor(e){this.options=e;this.#e=e.fetch??globalThis.fetch.bind(globalThis),this.#t=e.setTimer??((n,r)=>setTimeout(n,r)),this.#n=e.clearTimer??(n=>clearTimeout(n))}options;#e;#t;#n;#r={};#i;#o;#c=0;#s=!1;update(e){this.#r={...e},this.#s=!0,this.#a();let n=++this.#c,r=()=>{this.#l(n)};(this.options.debounce??0)>0?this.#o=this.#t(r,this.options.debounce):r()}disconnect(){this.#s&&(this.#s=!1,this.#c+=1,this.#a())}#a(){this.#i?.abort(),this.#i=void 0,this.#o!==void 0&&this.#n(this.#o),this.#o=void 0}#d(e){return!this.#s||e!==this.#c}async#l(e){if(this.#d(e))return;let n=new AbortController;this.#i=n;let r=this.options;r.onState({pending:!0,value:null,error:null,ok:!1});try{let o=await this.#e(Bn(r.source,r.baseURL,this.#r),{signal:n.signal});if(!o.ok)throw new TypeError(`Request failed with ${o.status}.`);let i=r.type==="text"?await o.text():await o.json(),a=r.adapt===void 0?i:r.adapt(i);if(this.#d(e))return;r.onState({pending:!1,value:a,error:null,ok:!0})}catch(o){if(n.signal.aborted||this.#d(e))return;r.onState({pending:!1,value:null,error:o,ok:!1})}finally{this.#i===n&&(this.#i=void 0),!this.#d(e)&&(r.poll??0)>0&&(this.#o=this.#t(()=>{this.#l(e)},r.poll))}}};var $,Wn=0,St=100,Fe=new WeakMap,ge=new WeakMap;function Nt(t){let{dependency:e,previousSubscriber:n,nextSubscriber:r}=t;n===void 0?e.first=r:n.nextSubscriber=r,r===void 0?e.last=n:r.previousSubscriber=n}function $t(t){if(t.length>8)return[];for(;t.length>0;)t.pop();return t}var Ze=class{#e=[];#t=[];#n=!1;#r=!1;enqueue(e){e.stopped||e.queued||(e.queued=!0,this.#e.push(e),!this.#n&&!this.#r&&(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})))}enqueueDependency(e){if(this.#r||this.#e.length>0)return!1;for(let n=e.first;n!==void 0;n=n.nextSubscriber){let r=n.effect;if(r.scheduler!==this){for(let o of this.#e)o.queued=!1;return this.#e=[],!1}r.queued||(r.queued=!0,this.#e.push(r))}return this.#n||(this.#n=!0,queueMicrotask(()=>{this.#n=!1,this.flush()})),!0}flush(){this.#r||this.#e.length===0||this.#i()}#i(){this.#r=!0;let e=0,n,r=0;try{for(;this.#e.length>0;){if(e+=1,e>St){for(let o of this.#e)o.queued=!1;this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit.")}if(n=this.#e,n.length>1){let o=1,i=n[0];for(;o<n.length;){let a=n[o];if(i.priority>a.priority||i.priority===a.priority&&i.id>a.id)break;i=a,o+=1}o<n.length&&n.sort((a,s)=>a.priority-s.priority||a.id-s.id)}this.#e=this.#t,r=0;do{let o=n[r];if(o.queued=!1,r+=1,o.computed===void 0?o.execute():o.computed.refresh(),this.#e.length===1&&r===n.length&&this.#e[0].computed===void 0){e+=1,e>St&&(this.#e[0].queued=!1,this.#e=[],y("HR006","A reactive flush exceeded the propagation-depth limit."));let i=this.#e;this.#e=$t(n),n=i,r=0}else this.#e.length>0&&this.#o(n,r)}while(r<n.length);this.#t=$t(n),n=void 0}}finally{if(n!==void 0){for(;r<n.length;)n[r++].queued=!1;this.#t=[]}if(this.#e.length>0){for(let o of this.#e)o.queued=!1;this.#e=[]}this.#r=!1}}#o(e,n){if(this.#e.some(r=>r.computed!==void 0))for(let r=e.length-1;r>=n;r-=1){let o=e[r];o.computed===void 0&&(e.splice(r,1),this.#e.push(o))}}},be=class{constructor(e,n,r,o){this.scheduler=e;this.run=n;this.priority=r;this.computed=o}scheduler;run;priority;computed;id=Wn++;dependencies=void 0;stopped=!1;paused=!1;queued=!1;#e=void 0;#t=void 0;execute(){if(this.stopped||this.paused)return;if(this.#t=void 0,this.#e!==void 0){let n=this.#e;this.#e=void 0,n()}let e=$;$=this;try{let n=this.run();n!==void 0&&(this.#e=n)}finally{$=e;let n=this.#t,r=n===void 0?this.dependencies:n.nextDependency;for(n===void 0?this.dependencies=void 0:n.nextDependency=void 0;r!==void 0;){let o=r.nextDependency;Nt(r),r=o}}}track(e){let n=this.#t===void 0?this.dependencies:this.#t.nextDependency;if(n?.dependency===e){this.#t=n;return}for(let i=this.dependencies;i!==n;i=i?.nextDependency)if(i?.dependency===e)return;let r={dependency:e,effect:this,nextDependency:n,previousSubscriber:void 0,nextSubscriber:void 0};this.#t===void 0?this.dependencies=r:this.#t.nextDependency=r,this.#t=r;let o=e.first;if(this.computed!==void 0&&o!==void 0)r.nextSubscriber=o,o.previousSubscriber=r,e.first=r;else{let i=e.last;r.previousSubscriber=i,i===void 0?e.first=r:i.nextSubscriber=r,e.last=r}}schedule(){if(this.computed!==void 0){this.computed.invalidate();return}this.paused||this.scheduler.enqueue(this)}pause(){this.stopped||this.paused||(this.paused=!0,this.#n(),this.#e?.(),this.#e=void 0)}resume(){this.stopped||!this.paused||(this.paused=!1,this.execute())}stop(){this.stopped||(this.stopped=!0,this.#n(),this.#e?.(),this.#e=void 0)}#n(){let e=this.dependencies;for(;e!==void 0;){let n=e.nextDependency;Nt(e),e=n}this.dependencies=void 0,this.#t=void 0}},Ge=class{#e={first:void 0,last:void 0};#t;constructor(e){this.#t=e}get(){return $!==void 0&&$.track(this.#e),this.#t}set(e){Object.is(this.#t,e)||(this.#t=e,F(this.#e))}update(e){this.set(e(this.#t))}},ve=class{#e;#t;#n;#r;#i=!1;#o=!0;#c=!1;#s=!1;constructor(e,n,r={first:void 0,last:void 0}){this.#e=r,this.#t=n,this.#n=new be(e,()=>this.#l(),0,this)}get(){return this.#n.paused||this.#n.stopped?this.#d():(this.#a(),$!==void 0&&$.track(this.#e),this.#r)}invalidate(){if(!(this.#n.stopped||this.#o)){this.#o=!0;for(let e=this.#e.first;e!==void 0;e=e.nextSubscriber)if(e.effect.computed===void 0){this.#n.scheduler.enqueue(this.#n);return}F(this.#e)}}refresh(){this.#a()}pause(){this.#n.stopped||this.#n.paused||(this.#o=!0,this.#n.pause())}resume(){this.#n.stopped||!this.#n.paused||(this.#n.paused=!1)}stop(){this.#n.stop()}#a(){if(this.#c&&y("HR006","A reactive computed value depends on itself."),!this.#o||this.#n.stopped||this.#n.paused)return;let e=this.#i;this.#n.execute(),e&&this.#s&&F(this.#e,$?.computed===void 0?void 0:$)}#d(){this.#c&&y("HR006","A reactive computed value depends on itself.");let e=$;this.#c=!0,$=void 0;try{return this.#t()}finally{$=e,this.#c=!1}}#l(){this.#c=!0,this.#o=!1;try{let e=this.#t();this.#s=!this.#i||!Object.is(this.#r,e),this.#r=e,this.#i=!0}catch(e){throw this.#o=!0,e}finally{this.#c=!1}}};function F(t,e){let n=t?.first;if(n===void 0)return;let r=n!==t.last;if(!r&&n.effect.computed!==void 0){n.effect!==e&&n.effect.computed.invalidate();return}if(n.effect.computed===void 0){if(e===void 0&&r&&n.effect.scheduler.enqueueDependency(t))return;for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}return}for(let o=n;o!==void 0;){let i=o.nextSubscriber;o.effect!==e&&o.effect.schedule(),o=i}}function At(t){return new Ge(t)}function Ht(t,e){return new ve(t,e)}function Z(t,e,n=1,r=!0){let o=new be(t,e,n);return r?o.execute():o.paused=!0,o}var we=class t{constructor(e=[],n=new Ze,r){this.scheduler=n;this.parent=r;for(let[o,i]of e)this.set(o,i)}scheduler;parent;#e=new Map;#t;#n;has(e){return this.#r(e)!==void 0||this.parent?.has(e)===!0}get(e){let n=this.#r(e);return n===void 0?this.parent?.get(e):($!==void 0&&$.track(n),n.value)}set(e,n){let r=this.#o(n),o=this.#r(e);if(o===void 0){o={value:r,first:void 0,last:void 0},this.#e.set(e,o),this.#n=o;return}Object.is(o.value,r)||(o.value=r,F(o))}defineComputed(e,n){let r=this.#r(e);r===void 0&&(r={value:null,first:void 0,last:void 0},this.#e.set(e,r),this.#n=r);let o=new ve(this.scheduler,()=>this.#o(n()),r);return r.computed=o,Object.hasOwn(this,"get")||(this.get=this.#i),o}fork(e=[]){return new t(e,this.scheduler,this)}#r(e){return e!==this.#t&&(this.#t=e,this.#n=this.#e.get(e)),this.#n}#i(e){let n=this.#r(e);return n===void 0?this.parent?.get(e):n.computed!==void 0?n.computed.get():($!==void 0&&$.track(n),n.value)}#o(e){if(e===null||typeof e!="object")return e;let n=Fe.get(e);if(n!==void 0)return n;let r=new Proxy(e,{get:(o,i,a)=>{if($!==void 0){let s=ge.get(o);s===void 0&&(s=new Map,ge.set(o,s));let c=s.get(i);c===void 0&&(c={first:void 0,last:void 0},s.set(i,c)),$.track(c)}return this.#o(Reflect.get(o,i,a))},set:(o,i,a,s)=>{let c=Reflect.get(o,i,s),l=this.#o(a),f=Reflect.set(o,i,l,s);return Object.is(c,l)||F(ge.get(o)?.get(i)),f},deleteProperty:(o,i)=>{let a=Reflect.has(o,i),s=Reflect.deleteProperty(o,i);return a&&F(ge.get(o)?.get(i)),s}});return Fe.set(e,r),Fe.set(r,r),r}};var Fn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|--[\w-]+\s*:[^;{}]*|:(user-invalid|invalid|valid)(?![\w-])/g;function Dt(t){return t.replace(Fn,(e,n)=>n===void 0?e:`:is(:${n}, [data-${n}])`)}var G="data-component",ke="data-slotted";function Pt(t,e,n){let r=new Set((t.getAttribute(e)??"").split(/\s+/).filter(Boolean));r.add(n),t.setAttribute(e,Array.from(r).join(" "))}function Ce(t){t.nodeType===1&&t.setAttribute(ke,"")}function Ke(t){return`data-${t}-state`}var Mt={slotted:"[--slotted]",state:"[--state]"},Zn=/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|:(slotted|host-state)\(/g;function Gn(t,e=["slotted","host-state"]){return t.replace(Zn,(n,r)=>r===void 0||!e.includes(r)?n:`:where(${r==="slotted"?Mt.slotted:Mt.state}):is(`)}function Kn(t){return/:where\(\s*\[--slotted\]\s*\)/.test(t)?"slotted":"own"}function Jn(t,e){let n=0;for(let r=e;r<t.length;r+=1){let o=t[r];if(o==='"'||o==="'"){let i=t.indexOf(o,r+1);r=i===-1?t.length:i}else if(o==="(")n+=1;else if(o===")"&&--n===0)return r}return t.length}var Qn=/\[\s*([\w-]+)\s*(?:=\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^\]\s]+))\s*)?\]/g;function Yn(t,e,n,r){let o="";for(let i of t.matchAll(Qn)){let a=r(i[1]),s=i[2]??i[3]??i[4];n.add(a),o+=`[${Ke(e)}~="${s===void 0?a:`${a}=${encodeURIComponent(s)}`}"]`}return o}function Xn(t){let e="";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="["){let s=t.indexOf("]",n),c=s===-1?t.length:s+1;e+=t.slice(n,c),n=c-1;continue}let o=e.at(-1),a=o===void 0||/[\s>+~(,]/.test(o)?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+(?![\w-]|\()/.exec(t.slice(n))?.[0]:void 0;if(a!==void 0){e+=`:is(${a}, :where([${G}~="${a}"]))`,n+=a.length-1;continue}e+=r}return e}function er(t,e,n,r,o=i=>i){/:scope(?![\w-])/.test(t)&&y("HY003",`\`:scope\` is not part of component styles; select the root with \`:host\` (in <${e}>).`);let i="",a=0,s=/:where\(\s*\[--state\]\s*\):is\(/g;for(let c=s.exec(t);c!==null;c=s.exec(t)){let l=c.index+c[0].length-1,f=Jn(t,l);i+=`${t.slice(a,c.index)}${n}${Yn(t.slice(l+1,f),e,r,o)}`,a=f+1,s.lastIndex=a}return i+=t.slice(a),i=i.replace(/:where\(\s*\[--slotted\]\s*\):is\(/g,`:where([${ke}], [${ke}] *):is(`).replace(/:host(?![\w-])/g,n),Xn(Dt(i))}function tr(t,e,n,r){let o=`[${G}~="${t}"]`;return[r,e.trim()===""?"":`@scope (${o}) to ([${G}], [${ke}]) {
3
3
  ${e}
4
- }`,n.trim()===""?"":`@scope (${o}) to ([${Z}]) {
4
+ }`,n.trim()===""?"":`@scope (${o}) to ([${G}]) {
5
5
  ${n}
6
6
  }`].filter(i=>i!=="").join(`
7
- `)}function Pt(t){if(typeof t=="string")return!0;if(t===null||typeof t!="object")return!1;if("enum"in t)return!0;let e=t;return e.kind==="union"?(e.members??[]).every(Pt):e.kind!=="list"&&e.kind!=="record"&&e.kind!=="object"}function er(t,e,n){let r=new Set((t.declarations??[]).filter(o=>o.kind==="state").map(o=>o.name));for(let o of e){let i=t.contract.props[o];i===void 0&&!r.has(o)&&y("HY001",`\`:host-state()\` tests \`${o}\`, which is not a declared prop or state.`,n),i!==void 0&&!Pt(i.type)&&y("HY002",`\`:host-state()\` cannot test \`${o}\`, whose type is structured.`,n)}}function jt(t,e,n,r){let o=e.contract.tag;if(t.trim()==="")return{css:"",stateNames:[]};let i=(n.defaultView??globalThis).CSSStyleSheet,a=Fn(t),s=new Set,c=[],l=n.defaultView??globalThis,f=l.CSSStyleRule,d=l.CSSGroupingRule,h=new Map([...Object.keys(e.contract.props),...(e.declarations??[]).filter(g=>g.kind==="state").map(g=>g.name)].map(g=>[g.toLowerCase(),g])),u=g=>h.get(g.toLowerCase())??g,p=g=>{g.selectorText=Yn(g.selectorText,o,":scope",s,u);for(let b of Array.from(g.cssRules??[]))b instanceof f&&p(b)},m=(g,b,w)=>{let R=g.cssRules;for(let T=0;T<R.length;){let A=R[T];A instanceof f?Zn(A.selectorText)===b?(p(A),T+=1):g.deleteRule(T):A instanceof d?(m(A,b,!1),T+=1):(w&&b==="own"&&c.push(A.cssText),g.deleteRule(T))}},v=g=>{let b=new i;return b.replaceSync(a),m(b,g,!0),Array.from(b.cssRules,w=>w.cssText).join(`
8
- `)},C=v("own"),k=v("slotted");return er(e,s,r),{css:Xn(o,C,k,c.join(`
9
- `)),stateNames:[...s]}}function Lt(t,e){let n=[];for(let r of t){let o=e(r);(o===!0||typeof o=="string"&&o.length>0||typeof o=="number"&&o!==0&&!Number.isNaN(o))&&n.push(r),(typeof o=="string"||typeof o=="number")&&n.push(`${r}=${encodeURIComponent(String(o))}`)}return n.join(" ")}var xe=new WeakSet,Bt=new WeakMap,Ot=new WeakMap,tr=Symbol.for("@nextwebwg/html-next.runtime.v1");function Qe(t){return t[tr]??={}}function G(t){return Bt.get(t)}function Wt(t){let e=Qe(t),n=e.registry;return(n===void 0||n.root!==t.documentElement)&&(n={root:t.documentElement,definitions:new Map,discoverySelector:void 0},e.registry=n),n}var Ft=new WeakMap;function Zt(t,e,n){let r=jt(t,e,n);return Ft.set(e,r.stateNames),r.css}function Gt(t,e,n){t.definitions.set(e,n),t.discoverySelector!==void 0&&(t.discoverySelector+=`,${e}`)}function nr(t){return t.discoverySelector??=["template[component]","[data-component]",...Array.from(t.definitions.keys())].join(",")}function rr(t,e){let n=t.getAttribute("component")??"",r=`${t.ownerDocument.URL}#template[component="${n}"][${e+1}]`;t.hasAttribute("src")&&y("HL001","External definitions require the application-owned graph resolver.",r);let o=_e(t,r),i=Array.from(t.content.children).find(a=>a.localName==="style");return{wrapper:t,style:i,definition:o}}function Kt(t,e=document){let n=Wt(e),r=0;for(let o of t.nodes.values()){if(o.shadowedByCustomElement)continue;let i=o.definition.contract.tag;n.definitions.has(i)&&y("HR001",`More than one definition declares <${i}>.`);let a=o.definition.css===""?void 0:e.createElement("style");a!==void 0&&(a.textContent=Zt(o.definition.css,o.definition,e),e.head.append(a)),Gt(n,i,{definition:o.definition,style:a}),r+=1}return r}function Ye(t,e,n=!1){let r=t.type==="boolean"&&n&&e===""?!0:e,o=B(r,t.type);if(!o.ok){let i=o.issues.map(a=>`${a.path}: ${a.message}`).join("; ");y("HR002",`A prop invocation value does not satisfy its declared type. ${i}`)}return o.value}function or(t,e,n){return n!==void 0?Ye(e,n):(e.required&&y("HC020",`Required prop \`${t}\` was not provided.`),e.default===void 0?E:e.default)}function ir(t,e){let n=Ot.get(t);if(n===void 0){let r=Object.create(null),o=Object.create(null);for(let i of Object.keys(t.contract.props)){let a=Re(i);r[a]=i,o[`data-${a}`]=i,a!==i.toLowerCase()&&(o[`data-${i.toLowerCase()}`]=i)}n=[r,o],Ot.set(t,n)}return n[e?1:0]}function sr(t,e,n=!1){let r=e.contract,o=ir(e,n),i=Object.create(null),a=[],s;for(let p of Array.from(t.attributes)){if(p.name.toLowerCase()==="as"&&e.root?.kind==="native"){s=p.value.toLowerCase();continue}let m=o[p.name.toLowerCase()];if(m===void 0){n||a.push(p);continue}i[m]=Ye(r.props[m],p.value,!n)}let c=e.root?.kind==="native"?n?t.localName:s??e.root.element:e.template.name;e.root?.kind==="native"&&!e.root.choices.includes(c)&&y(n?"HR005":"HR002",`<${r.tag}> cannot use root <${c}>; expected one of ${e.root.choices.join(", ")}.`);let l=new Set(Object.keys(i).filter(p=>i[p]!==void 0)),f=new we;for(let[p,m]of Object.entries(r.props))m.required&&i[p]===void 0&&y("HC020",`Required prop \`${p}\` was not provided.`),f.set(p,i[p]!==void 0?i[p]:m.default===void 0?E:m.default);let d=e.declarations??[];for(let p of d)(p.kind==="state"||p.kind==="computed"||p.kind==="data")&&f.set(p.name,null);for(let p of d)p.kind==="data"?f.set(p.name,{pending:!0,value:null,error:null,ok:!1}):p.kind==="state"&&f.set(p.name,p.expression===void 0?null:D(p.expression.source,f));let h=[];for(let p of d)p.kind!=="computed"||p.expression===void 0||h.push(f.defineComputed(p.name,()=>I(p.expression,f)));let u=(()=>{try{return new URL(e.source.file,t.ownerDocument.baseURI).href}catch{return t.ownerDocument.baseURI}})();for(let p of d){if(p.kind!=="data"||p.source===void 0)continue;let m=p,v=p.source,C=new ye({source:v,baseURL:u,...m.type===void 0?{}:{type:m.type},...m.debounce===void 0?{}:{debounce:Number(m.debounce)},...m.poll===void 0?{}:{poll:Number(m.poll)},onState:k=>f.set(m.name,k)});h.push(F(f.scheduler,()=>{let k=Object.fromEntries(m.parameters.map(g=>[g.name,I(g.expression,f)]));return C.update(k),()=>C.disconnect()},0))}return{scope:f,passThrough:a,effects:h,rootName:c,explicit:l}}function Je(t,e){return t.fork(Object.entries(e))}function D(t,e){try{return dt(t,e)}catch(n){throw n instanceof ee&&y("HB001",n.message),n}}var ie="http://www.w3.org/2000/svg",It=new Map;function ar(t,e){if(t.namespaceURI!==ie)return e;let n=It.get(e);if(n===void 0){let r=t.ownerDocument.createElement("template");r.innerHTML=`<svg ${e}>`,n=r.content.firstChild.attributes[0]?.name??e,It.set(e,n)}return n}function Jt(t,e,n){return e==="svg"||n.namespace===ie?t.createElementNS(ie,e):t.createElement(e)}function cr(t,e){let n=t.namespaceURI===ie&&t.localName!=="foreignObject"?ie:void 0;return n===e.namespace?e:Object.create(e,{namespace:{value:n,enumerable:!0}})}function q(t,e,n,r=1){t.effects.push(F(e.scheduler,n,r))}function Qt(t,e,n){let[r,...o]=e;if(typeof r!="string")return;if(o.length===0){t.set(r,n);return}let i=t.get(r);for(let c=0;c<o.length-1;c+=1){let l=o[c],f=typeof l=="object"?I(l.expression,t):l;if(typeof f!="string"&&typeof f!="number"||i==null)return;i=i[f]}let a=o.at(-1),s=typeof a=="object"?I(a.expression,t):a;(typeof s=="string"||typeof s=="number")&&i!=null&&(i[s]=n)}function dr(t){return t instanceof HTMLInputElement?t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?null:t.valueAsNumber:t.value:t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions,e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:t.value??t.getAttribute("value")}function lr(t,e,n){let r=e.toLowerCase();if(r==="checked"&&t instanceof HTMLInputElement)return t.checked=L(n),!0;if(r==="value"&&t instanceof HTMLSelectElement&&t.multiple){let o=new Set(Array.isArray(n)?n.map(String):[]);for(let i of Array.from(t.options))i.selected=o.has(i.value);return!0}return r==="value"&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)?(t.value=n==null?"":String(n),!0):!1}function ur(t,e,n,r){for(let o of t.steps)if(!(o.guard!==void 0&&!L(I(o.guard,n))))if(o.kind==="set")Qt(n,o.writablePath,I(o.value,n));else if(o.kind==="dispatch"){let i=Yt(r.definition,o.event),a=o.value===void 0?void 0:I(o.value,n);i!==void 0&&a!==void 0&&(B(a,de(i.type)).ok||y("HR002",`Event \`${o.event}\` detail does not satisfy its declared type.`)),Xt(r.root??e,o.event,a,i)}else{let i=r.refs[o.target];o.kind==="focus"?i?.focus():i?.reportValidity?.()}}function Yt(t,e){return(t.declarations??[]).find(n=>n.kind==="event"&&n.name===e)}function Xt(t,e,n,r){return t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:r?.bubbles??!0,composed:r?.composed??!0,cancelable:r?.cancelable??!1}))}function fr(t,e,n){if(n.includes("self")&&t.target!==e)return!1;if(t instanceof MouseEvent){let o=n.filter(a=>["left","middle","right"].includes(a)),i={left:0,middle:1,right:2};if(o.length>0&&!o.some(a=>t.button===i[a]))return!1}let r=["ctrl","shift","alt","meta"];for(let o of r)if(n.includes(o)&&!t[`${o}Key`])return!1;if(n.includes("exact")&&r.some(o=>!n.includes(o)&&t[`${o}Key`]))return!1;if(t instanceof KeyboardEvent){let o=n.filter(a=>["enter","escape","space","tab","up","down","left","right"].includes(a)),i={enter:"Enter",escape:"Escape",space:" ",tab:"Tab",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"};if(o.length>0&&!o.some(a=>t.key===i[a]))return!1}return!0}function zt(t,e,n,r){for(let o of e.events??[]){let i=(r.definition.declarations??[]).find(s=>s.kind==="handler"&&s.name===o.handler),a=s=>{fr(s,t,o.modifiers)&&(o.modifiers.includes("prevent")&&s.preventDefault(),o.modifiers.includes("stop")&&s.stopPropagation(),ur(i,t,n,r))};if(o.name==="connect"||o.name==="disconnect"){(o.name==="connect"?r.connectCallbacks:r.disconnectCallbacks).add(()=>a(new Event(o.name)));continue}q(r,n,()=>(t.addEventListener(o.name,a,{capture:o.modifiers.includes("capture"),passive:o.modifiers.includes("passive"),once:o.modifiers.includes("once")}),()=>t.removeEventListener(o.name,a,{capture:o.modifiers.includes("capture")})),2)}}function pr(t,e,n){e=ar(t,e),n===null||ne(e)&&te(n)?t.removeAttribute(e):t.setAttribute(e,n)}function mr(t,e,n,r){let o=D(e.expression,n);e.name==="value"?t.textContent=P(o):t.replaceChildren(Le(P(o),r,i=>xe.add(i)))}function hr(t,e,n){let r=D(t.expression,e);return t.name==="value"?n.createTextNode(P(r)):Le(P(r),n,o=>xe.add(o))}function yr(t,e){return typeof t=="number"&&typeof e=="number"?t-e:P(t).localeCompare(P(e))}function gr(t,e,n){let r=t.slice();if(e.where!==void 0){let o=e.where;r=r.filter(i=>L(D(o,Je(n,{[e.item]:i}))))}if(e.sort!==void 0){let o=e.sort.split(",").map(a=>a.trim()).filter(a=>a!==""),i=(a,s)=>a!==null&&typeof a=="object"&&!Array.isArray(a)?D(`${e.item}.${s}`,Je(n,{[e.item]:a})):a;r.sort((a,s)=>{for(let c of o){let l=c.startsWith("-"),f=l?c.slice(1).trim():c,d=yr(i(a,f),i(s,f));if(d!==0)return l?-d:d}return 0})}if(e.limit!==void 0){let o=D(e.limit,n);typeof o=="number"&&(r=r.slice(0,Math.max(0,Math.trunc(o))))}return r}function en(t,e){let n=e.createDocumentFragment();return n.append(...t),Array.from(n.childNodes)}function br(t,e){let n=t.nextSibling;for(;n!==null&&n!==e;){let r=n.nextSibling;n.remove(),n=r}}function vr(t,e,n,r,o){if(t.flow?.kind==="each")return xr(t,e,n,r,o);let i=n.createComment("html-next:start"),a=n.createComment("html-next:end"),s=n.createDocumentFragment();s.append(i,a);let c=[];return q(o,e,()=>{for(let d of c)d.stop();c=[],br(i,a);let l=o.effects.length,f=[];if(t.flow?.kind==="if"){if(L(D(t.flow.test,e))){let{flow:d,...h}=t;f=se(h,e,n,r,o)}}else if(t.flow?.kind==="with"){let d=e.fork([[t.flow.alias,D(t.flow.expr,e)]]),{flow:h,...u}=t;f=se(u,d,n,r,o)}else t.flow?.kind==="match"&&(f=Er(t,e,n,o));c=o.effects.slice(l),a.before(...en(f,n))}),[s]}function wr(t,e){if(t.end.nextSibling===e)return;let n=[],r=t.start;for(;r!==null&&(n.push(r),r!==t.end);)r=r.nextSibling;let o=e.parentNode;if(o===null)return;let i=o.moveBefore;for(let a of n)i===void 0?o.insertBefore(a,e):i.call(o,a,e)}function kr(t){for(let n of t.effects)n.stop();let e=t.start;for(;e!==null;){let n=e.nextSibling;if(e.parentNode?.removeChild(e),e===t.end)break;e=n}}function Cr(t){let e=-1,n=!0;for(let s of t)s<0||(s<e&&(n=!1),e=s);if(n)return;let r=[],o=new Int32Array(t.length).fill(-1);for(let s=0;s<t.length;s+=1){let c=t[s];if(c<0)continue;let l=0,f=r.length;for(;l<f;){let d=l+f>>>1;t[r[d]]<c?l=d+1:f=d}l>0&&(o[s]=r[l-1]),r[l]=s}let i=new Uint8Array(t.length),a=r.at(-1)??-1;for(;a>=0;)i[a]=1,a=o[a];return i}function xr(t,e,n,r,o){let i=t.flow,a=n.createComment("html-next:each-start"),s=n.createComment("html-next:each-end"),c=n.createDocumentFragment();c.append(a,s);let l=new Map;return q(o,e,()=>{let f=D(i.list,e),d=Array.isArray(f)?gr(f,i,e):[],h=new Map,u=i.key!==void 0,p=u?[]:void 0,m;if(u){m=new Map;let g=0;for(let b of l.keys())m.set(b,g++)}let v=u?[]:void 0,{flow:C,...k}=t;for(let g=0;g<d.length;g+=1){let b=d[g],w={[i.item]:b,loop:{index:g,first:g===0,last:g===d.length-1,count:d.length}};i.index!==void 0&&(w[i.index]=g);let R,T=g;i.key!==void 0&&(R=e.fork(Object.entries(w)),T=D(i.key,R)),h.has(T)&&y("HR004",`A keyed list produced duplicate key \`${P(T)}\`.`);let A=l.get(T);if(A===void 0){R??=e.fork(Object.entries(w));let M=o.effects.length,ae=en(se(k,R,n,r,o),n),tt=n.createComment("html-next:item-start"),nt=n.createComment("html-next:item-end");s.before(tt,...ae,nt),A={start:tt,end:nt,scope:R,effects:o.effects.slice(M)}}else A.scope.set(i.item,b),i.index!==void 0&&A.scope.set(i.index,g),A.scope.set("loop",w.loop);h.set(T,A),p?.push(A),v?.push(m?.get(T)??-1)}for(let[g,b]of l)h.has(g)||kr(b);if(p!==void 0&&v!==void 0){let g=Cr(v),b=s;for(let w=p.length-1;w>=0;w-=1){let R=p[w];(v[w]<0||g!==void 0&&g[w]!==1)&&wr(R,b),b=R.start}}l=h}),[c]}function tn(t,e,n,r,o,i){return t.flow?.kind==="if"||t.flow?.kind==="each"||t.flow?.kind==="with"||t.flow?.kind==="match"?o.committed&&o.frameworkOwned&&i!==void 0?[i]:vr(t,e,n,r,o):se(t,e,n,r,o,i)}function Er(t,e,n,r){let o=t.flow,i=o.expr!==void 0?Je(e,{[o.alias]:D(o.expr,e)}):e,a;for(let d of t.children)if(d.kind==="element"){if(d.flow?.kind==="when"&&L(D(d.flow.test,i))){a=d;break}if(d.flow?.kind==="else"){a=d;break}}if(a===void 0)return[];let{flow:s,...c}=a,l=se(c,i,n,[],r);if(t.name==="template")return l;let f=Jt(n,t.name,r);for(let d of t.attributes)d.kind==="literal"&&f.setAttribute(d.name,d.value);return f.append(...l),[f]}function se(t,e,n,r,o,i){let a=t.attributes.find(m=>m.kind==="directive");if(t.name==="template"){if(a!==void 0){let m=n.createTextNode("");return q(o,e,()=>{let v=D(a.expression,e);a.name==="value"&&(m.data=P(v))}),a.name==="value"?[m]:[hr(a,e,n)]}return nn(t.children,e,n,o)}let s=t===o.definition.template?o.rootName:t.name;if(o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name))return[i];if(o.hydrationRanges!==void 0&&!o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name)){let m=Xe(i,!1),v=b=>b.kind==="element"?b.attributes.find(w=>w.kind==="literal"&&w.name==="slot")?.value??"":"",C=m?.ranges.filter(b=>!b.fallback)??[],k=(b,w)=>{let R=0;for(let T of b)R+=Ee(T,e,n,o,w[R]).length};for(let b of C)k(t.children.filter(w=>v(w)===b.slot),b.content);let g=new Set(C.map(b=>b.slot));return k(t.children.filter(b=>!g.has(v(b))),m?.carried??[]),[i]}let c=i instanceof Element&&i.localName===s,l=c?i:Jt(n,s,o);t===o.definition.template&&(o.root=l);let f=c?Array.from(l.childNodes):[],d=c&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement)?{value:l.value,focused:l.ownerDocument.activeElement===l,...l instanceof HTMLInputElement?{checked:l.checked}:{},...l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement?{selectionStart:l.selectionStart,selectionEnd:l.selectionEnd}:{}}:void 0;t.ref!==void 0&&(o.refs[t.ref]=l);for(let m of t.attributes)m.kind==="literal"&&l.setAttribute(m.name,m.value);for(let m of r){let v=m.name==="class"||m.name==="style"?l.getAttribute(m.name):null;l.setAttribute(m.name,v===null||v===""?m.value:`${v}${m.name==="class"?" ":"; "}${m.value}`)}for(let m of t.attributes)if(m.kind==="attribute"){if(q(o,e,()=>{let v=D(m.expression,e);m.target==="class"?l.classList.toggle(m.name,L(v)):m.target==="style"?l.style.setProperty(m.name,P(v)):m.twoWay===!0&&lr(l,m.name,v)||pr(l,m.name,lt(v,m.name))}),m.twoWay===!0&&m.writablePath!==void 0){let v=l instanceof HTMLSelectElement||l instanceof HTMLInputElement&&["checkbox","radio","file"].includes(l.type)?"change":"input",C=()=>{l instanceof HTMLInputElement&&l.type==="radio"&&!l.checked||Qt(e,m.writablePath,dr(l))};q(o,e,()=>(l.addEventListener(v,C),()=>l.removeEventListener(v,C)),2)}}else m.kind==="property"&&q(o,e,()=>{l[m.name]=D(m.expression,e)});if(a!==void 0)return q(o,e,()=>mr(l,a,e,n)),zt(l,t,e,o),[l];let h=[],u=0,p=cr(l,o);for(let m of t.children){let v=u;if(o.frameworkOwned&&m.kind==="element"){let k=f.findIndex((g,b)=>b<u?!1:g instanceof Element&&(g.localName===m.name||(g.getAttribute("data-component")??"").split(/\s+/).includes(m.name)));k<0&&m.flow!==void 0&&(k=f.findIndex((g,b)=>b>=u&&g instanceof Comment)),k>=0&&(v=k)}let C=Ee(m,e,n,p,f[v]);h.push(...C),u=v+C.length}if(c&&!o.frameworkOwned){h=h.flatMap(m=>m.nodeType===11?Array.from(m.childNodes):[m]);for(let m=0;m<h.length;m+=1){let v=h[m];l.childNodes[m]!==v&&l.insertBefore(v,l.childNodes[m]??null)}for(;l.childNodes.length>h.length;)l.lastChild.remove()}else c||l.append(...h);return d!==void 0&&(l.value=d.value,l instanceof HTMLInputElement&&"checked"in d&&(l.checked=d.checked),(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&"selectionStart"in d&&typeof d.selectionStart=="number"&&typeof d.selectionEnd=="number"&&(d.focused&&l.focus({preventScroll:!0}),l.setSelectionRange(d.selectionStart,d.selectionEnd))),zt(l,t,e,o),[l]}function nn(t,e,n,r){let o=[];for(let i of t)o.push(...Ee(i,e,n,r));return o}function Rr(t,e){return e.projectedSlotNames.get(t)??(t instanceof Element?t.getAttribute("slot")??"":"")}function Tr(t,e,n,r){let o=t.nameExpression===void 0?t.name??"":P(I(t.nameExpression,e)),i=r.projectedNodes.filter(d=>Rr(d,r)===o),a=r.hydrationRanges?.shift();if(a!==void 0){if(a.fallback){let d=[],h=0;for(let u of t.fallback??[]){let p=Ee(u,e,n,r,a.content[h]);d.push(...p),h+=p.length}return[a.markers[0],...d,...a.markers.slice(1)]}for(let d of a.content)Ce(d);return a.markers.length===1?[a.markers[0]]:[a.markers[0],...a.content,a.markers[1]]}let s=d=>`"${d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}"`,c=(d,h)=>Sr(n,d,h),l=(d,h)=>{if(d.length===0)return[c("marker",`slot=${s(o)}`)];let u=`slot=${s(o)}${h?' fallback=""':""}`;return[c("start",u),...d,c("end","")]};if(i.length===0)return l(nn(t.fallback??[],e,n,r),!0);if(r.committed){for(let d of i)Ce(d);return l([...i],!1)}let f=n.createComment(`html-next:slot:${o}`);return r.slotInsertions.push({anchor:f,nodes:i}),l([f],!1)}function Vt(t){let e=new Map,n=t.trim(),r={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};for(;n!=="";){let o=/^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);if(o===null||e.has(o[1]))return new Map;let i=(o[2]??o[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g,(a,s)=>s.startsWith("#x")?String.fromCodePoint(parseInt(s.slice(2),16)):s.startsWith("#")?String.fromCodePoint(Number(s.slice(1))):r[s]);e.set(o[1],i),n=n.slice(o[0].length)}return e}var qt=new WeakMap;function rn(t){let e=qt.get(t);if(e===void 0){let n=t.createElement("div");n.innerHTML='<?probe x="1"?>',e=n.firstChild?.nodeType===7,qt.set(t,e)}return e}function Sr(t,e,n){return rn(t)?t.createProcessingInstruction(e,n):t.createComment(`?${e}${n===""?"":` ${n}`}?`)}function Ke(t){if(t.nodeType===7){let n=t;return{target:n.target,attributes:Vt(n.data)}}if(t.nodeType!==8||rn(t.ownerDocument))return;let e=/^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(t.data);return e===null?void 0:{target:e[1],attributes:Vt(e[2]??"")}}function Xe(t,e=!0){let n=[],r=new Set,o=(s,c)=>{for(let l=0;l<s.length;l+=1){let f=s[l],d=Ke(f);if(d?.target==="marker"&&d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:!1,markers:[f],content:[]});continue}if(d?.target==="start"){let h=1,u=[],p;for(l+=1;l<s.length;l+=1){let m=Ke(s[l]);if(m?.target==="start")h+=1;else if(m?.target==="end"&&--h===0){p=s[l];break}u.push(s[l])}if(d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:d.attributes.has("fallback"),markers:p?[f,p]:[f],content:u});for(let m of u)r.add(m)}else o(u,c);continue}if(f instanceof Element)if(f!==t&&f.hasAttribute("data-component")){let h=Xe(f,!1);for(let u of h?.ranges??[])o(u.content,c)}else o(Array.from(f.childNodes),c)}};o(Array.from(t.childNodes),n);let i=Array.from(t.children).find(s=>s instanceof HTMLTemplateElement&&!r.has(s)&&s.previousSibling!==null&&Ke(s.previousSibling)?.target==="carrier");if(n.length===0&&i===void 0)return;let a=[];if(i!==void 0&&e){for(let s of Array.from(i.content.childNodes))a.push(t.ownerDocument.adoptNode(s));i.previousSibling.remove(),i.remove()}else i!==void 0&&a.push(...Array.from(i.content.childNodes));return{ranges:n,carried:a}}function Ee(t,e,n,r,o){if(t.kind==="text"){let i=o instanceof Text?o:n.createTextNode("");return i.data=t.value,[i]}return t.kind==="slot"?Tr(t,e,n,r):tn(t,e,n,[],r,o)}function Nr(t,e){let n=Ft.get(e.definition)??[];if(n.length===0)return;let r=Ge(e.definition.contract.tag);e.effects.push(F(e.scope.scheduler,()=>{let o=Lt(n,i=>e.scope.get(i));o===""?t.removeAttribute(r):t.getAttribute(r)!==o&&t.setAttribute(r,o)},2))}function $r(t,e){let n=e.definition.contract.props,r={},o={};for(let[f,d]of Object.entries(n)){let h=`data-${Re(f)}`;r[h]=f;let u=e.definition.template.attributes.some(p=>p.kind==="attribute"&&p.name===h);e.effects.push(F(e.scope.scheduler,()=>{let p=e.scope.get(f);if(!u&&!e.explicit.has(f))return;let m=p===void 0||p===E||p===null?null:Ae(p,d.type);o[h]=m,m===null?t.removeAttribute(h):t.setAttribute(h,m)},2))}let i=t.ownerDocument.defaultView?.MutationObserver,a=Object.keys(r);if(i===void 0||a.length===0)return;let s=new i(f=>{for(let d of f){let h=d.attributeName;if(h===null)continue;let u=r[h];if(u===void 0)continue;let p=t.getAttribute(h);if(h in o&&o[h]===p){delete o[h];continue}delete o[h];let m=n[u];p===null?e.explicit.delete(u):e.explicit.add(u),e.scope.set(u,p===null?or(u,m,void 0):Ye(m,p,!0))}}),c=()=>s.observe(t,{attributes:!0,attributeFilter:a}),l=()=>s.disconnect();e.connectCallbacks.add(c),e.disconnectCallbacks.add(l)}function Ar(t,e){for(let n of e.definition.declarations??[])n.kind==="method"&&Object.defineProperty(t,n.name,{configurable:!0,enumerable:!1,value:(...r)=>e.controllerModule===void 0?Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${e.definition.contract.tag}>.`)):e.controllerModule.then(o=>{let i=o[n.exportName];return typeof i!="function"&&y("HJ003",`Controller does not export method \`${n.exportName}\`.`),Reflect.apply(i,void 0,[et(t),...r])})})}function Hr(t,e,n,r,o=new WeakMap,i=!1){let a=n&&t.contains(t.ownerDocument.activeElement)?t.ownerDocument.activeElement:null,s=a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement?[a.selectionStart,a.selectionEnd]:void 0,{scope:c,passThrough:l,effects:f,rootName:d,explicit:h}=sr(t,e,n),u=r,p;if(n&&u===void 0){let b=Xe(t);if(b!==void 0){p=b.ranges;let w=[];for(let R of b.ranges)if(!R.fallback)for(let T of R.content)o.set(T,R.slot),w.push(T);w.push(...b.carried),u=w}else(e.slots??[]).length>0?y("HR005",`<${e.contract.tag}> has slots but its server-rendered root has no slot marks.`):u=[]}let m=n?u:Array.from(t.childNodes),v={definition:e,scope:c,refs:{},effects:f,connectCallbacks:new Set,disconnectCallbacks:new Set,connected:!1,explicit:h,frameworkOwned:i,projection:{nodes:n?u:Array.from(t.childNodes),slotNames:o}},C={definition:e,effects:f,refs:v.refs,connectCallbacks:v.connectCallbacks,disconnectCallbacks:v.disconnectCallbacks,projectedNodes:m,projectedSlotNames:o,slotInsertions:[],rootName:d,frameworkOwned:i,committed:n,hydrationRanges:p},k=tn(e.template,c,t.ownerDocument,l,C,n?t:void 0);C.hydrationRanges=void 0;let g=k[0];return n&&g!==t&&y("HR005",`Server markup for <${e.contract.tag}> has an incompatible root.`),a instanceof HTMLElement&&(a.focus({preventScroll:!0}),s!==void 0&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&typeof s[0]=="number"&&typeof s[1]=="number"&&a.setSelectionRange(s[0],s[1])),Mt(g,Z,e.contract.tag),v.element=g,{invocation:t,nativeRoot:g,context:C,definition:e,instance:v,replace:!n}}function Dr(t,e){e.sort((n,r)=>n.invocation.contains(r.invocation)?-1:r.invocation.contains(n.invocation)?1:0);for(let n of e){for(let r of n.context.slotInsertions){for(let o of r.nodes)Ce(o);r.anchor.replaceWith(...r.nodes)}n.replace&&n.invocation.replaceWith(n.nativeRoot),n.context.committed=!0,Bt.set(n.nativeRoot,n.instance),$r(n.nativeRoot,n.instance),Nr(n.nativeRoot,n.instance),Ar(n.nativeRoot,n.instance),on(n.instance)}}function Ut(t,e,n){t.nodeType===1&&t.matches(e)&&n.add(t);for(let r of t.querySelectorAll(e))n.add(r)}function Mr(t,e){let n=t.nodeType===1?t:void 0;if(n?.matches("[data-component]")===!0&&e(n),n?.childElementCount!==0)for(let r of t.querySelectorAll("[data-component]"))e(r)}function Pr(t,e,n){let r=Wt(t),o=new Set,i=nr(r);for(let u of e)Ut(u,i,o);let a=[];for(let u of o)u.localName==="template"&&u.hasAttribute("component")&&!xe.has(u)&&a.push(rr(u,a.length));let s=new Map;for(let u of a){let p=u.definition.contract.tag;(r.definitions.has(p)||s.has(p))&&y("HR001",`More than one definition declares <${p}>.`),s.set(p,u)}let c=[],l=new Set,f=(u,p,m)=>{let{definition:v}=u;return xe.has(p)||t.defaultView?.customElements.get(v.contract.tag)!==void 0||n?.(p,v,m)===!1?!1:(c.push(Hr(p,v,m)),!0)},d=(u,p)=>{for(let m of p){let v=u.get(m.localName);if(v!==void 0&&f(v,m,!1),!m.hasAttribute("data-component"))continue;let C=G(m);if(C!==void 0){C.frameworkOwned||l.add(m);continue}let k=!1;for(let g of new Set((m.getAttribute("data-component")??"").split(/\s+/))){let b=u.get(g);b!==void 0&&f(b,m,!0)&&(k=!0)}k&&l.add(m)}};if(d(r.definitions,o),s.size>0){let u=["[data-component]",...Array.from(s.keys())].join(","),p=new Set;Ut(t,u,p),d(s,p)}for(let u of a)Gt(r,u.definition.contract.tag,u),u.style!==void 0&&(u.style.textContent=Zt(u.style.textContent??"",u.definition,u.wrapper.ownerDocument),u.wrapper.ownerDocument.head.append(u.style)),u.wrapper.remove();Dr(r,c);let h=c.map(u=>u.nativeRoot);for(let u of h)l.add(u);return{lowered:h,roots:Array.from(l)}}function jr(t,e){let n=Qe(t),r=n.mutationHub;if(r===void 0){let i=t.defaultView?.MutationObserver;i===void 0&&y("HR003","Automatic component management requires a browser MutationObserver.");let a=new Set,s=new i(c=>{for(let l of Array.from(a))l(c)});r={observer:s,subscribers:a},n.mutationHub=r,s.observe(t,{childList:!0,subtree:!0})}r.subscribers.add(e);let o=!0;return()=>{o&&(o=!1,r.subscribers.delete(e),r.subscribers.size===0&&(r.observer.disconnect(),delete n.mutationHub))}}function on(t){if(!t.connected){t.connected=!0;for(let e of t.effects)e.resume();for(let e of t.connectCallbacks)e();t.element?.dispatchEvent(new Event("connect"))}}function _t(t){if(t.connected){t.element?.dispatchEvent(new Event("disconnect"));for(let e of t.disconnectCallbacks)e();t.connected=!1;for(let e of t.effects)e.pause()}}function et(t){let e=G(t);if(e===void 0)return;if(e.host!==void 0)return e.host;let n=new Set((e.definition.declarations??[]).filter(a=>a.kind==="state").map(a=>a.name)),r=new Proxy({},{get:(a,s)=>{if(typeof s!="string")return;let c=e.scope.get(s);return c===E?void 0:c},set:(a,s,c)=>{if(typeof s!="string"||!n.has(s))throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);return e.scope.set(s,c),!0},has:(a,s)=>typeof s=="string"&&e.scope.has(s)}),o=new Proxy({},{get:(a,s)=>typeof s!="string"?void 0:(t instanceof HTMLFormElement?t:t.querySelector("form"))?.elements.namedItem(s)??t.querySelector(`[name="${CSS.escape(s)}"]`)??void 0}),i={element:t,state:r,refs:e.refs,elements:o,signal(a){return $t(a)},computed(a){let s=At(e.scope.scheduler,a);return e.connected||s.pause(),e.effects.unshift(s),s},effect(a){let s=F(e.scope.scheduler,a,2,e.connected);return e.effects.push(s),()=>s.stop()},on(a,s){if(a==="connect"){let c=s;return e.connectCallbacks.add(c),e.connected&&s(),()=>e.connectCallbacks.delete(c)}if(a==="disconnect"){let c=s;return e.disconnectCallbacks.add(c),()=>e.disconnectCallbacks.delete(c)}return t.addEventListener(a,s),()=>t.removeEventListener(a,s)},dispatch(a,s){return Xt(t,a,s,Yt(e.definition,a))}};return e.host=Object.freeze(i),e.host}function sn(t,e){let n=G(t);n===void 0&&y("HJ003","A controller can attach only to a lowered component root."),n.controllerModule=e}function an(t=document,e={}){let n=Qe(t);n.observer!==void 0&&y("HR003","This document is already being observed.");let r=new Map,o=e.onError??(d=>console.error(d)),i=!1,a=d=>{let h=r.get(d);r.delete(d);let u=G(d);u!==void 0&&_t(u);try{h?.()}catch(p){o(p)}},s=d=>{let h=G(d);if(!(h===void 0||h.frameworkOwned||r.has(d)||!t.contains(d))){r.set(d,void 0);try{on(h);let u=e.onConnect?.(d,h.definition);i?u?.():r.set(d,u)}catch(u){o(u)}}},c=d=>{if(i)return;let h=[];if(d===void 0)h.push(t);else{let u=[];for(let p of d){for(let m of p.removedNodes)m.nodeType===1&&Mr(m,v=>{r.has(v)&&u.push(v)});for(let m of p.addedNodes)m.nodeType===1&&h.push(m)}for(let p of u)t.contains(p)||a(p)}if(h.length>0)try{for(let u of Pr(t,h,e.shouldLower).roots){if(i)break;s(u)}}catch(u){o(u)}};n.release=d=>{r.has(d)&&a(d)};let l=jr(t,c),f=()=>{if(!i){i=!0,l(),delete n.observer,delete n.release;for(let d of r.values())try{d?.()}catch(h){o(h)}for(let d of r.keys()){let h=G(d);h!==void 0&&_t(h)}r.clear()}};return n.observer=f,c(),f}function Lr(t){let e={};for(let n of t.querySelectorAll('script[type="importmap"]')){let r=JSON.parse(n.textContent??"{}");Object.assign(e,r.imports??{})}return{imports:e}}async function Or(t,e={}){let n=e.document??document,r=e.fetch??fetch,o=new he(e.importMap??Lr(n),n.baseURI),i=await ot(t,{resolver:o,fetchComponent:async s=>{let c=await r(s);if(!c.ok)throw new TypeError(`Component request \`${s}\` failed with ${c.status}.`);return{url:c.url||s,source:await c.text()}},parseComponentResource:(s,c)=>kt(s,c,n),isCustomElementRegistered:s=>n.defaultView?.customElements.get(s)!==void 0}),a=e.registry??new me;return a.addGraph(i,s=>Rt(s,e.importer)),Object.freeze({graph:i,registry:a})}function Ir(t=document){return Object.freeze(Array.from(t.querySelectorAll('link[rel="component"][href]'),e=>e.getAttribute("href")).filter(e=>e.trim()!==""))}function zr(t=document,e={}){return Or(Ir(t),{...e,document:t})}async function Uo(t=document,e={}){let n=await zr(t,e);Kt(n.graph,t);let r=e.onError??(i=>console.error(i)),o=an(t,{onError:r,onConnect(i,a){let s=n.registry.get(a.contract.tag)?.node;if(s?.controller===void 0)return;let c=Be(s,e.importer);sn(i,c);let l=!1,f;return c.then(d=>l?void 0:d.default(et(i))).then(d=>{typeof d=="function"&&(l?d():f=d)}).catch(r),()=>{l=!0,f?.()}}});return Object.freeze({...n,stop:o})}export{Ir as documentComponentRoots,Or as loadBrowserComponents,zr as loadDocumentComponents,Uo as startBrowserComponents};
7
+ `)}function jt(t){if(typeof t=="string")return!0;if(t===null||typeof t!="object")return!1;if("enum"in t)return!0;let e=t;return e.kind==="union"?(e.members??[]).every(jt):e.kind!=="list"&&e.kind!=="record"&&e.kind!=="object"}function nr(t,e,n){let r=new Set((t.declarations??[]).filter(o=>o.kind==="state").map(o=>o.name));for(let o of e){let i=t.contract.props[o];i===void 0&&!r.has(o)&&y("HY001",`\`:host-state()\` tests \`${o}\`, which is not a declared prop or state.`,n),i!==void 0&&!jt(i.type)&&y("HY002",`\`:host-state()\` cannot test \`${o}\`, whose type is structured.`,n)}}function Lt(t,e,n,r){let o=e.contract.tag;if(t.trim()==="")return{css:"",stateNames:[]};let i=(n.defaultView??globalThis).CSSStyleSheet,a=Gn(t),s=new Set,c=[],l=n.defaultView??globalThis,f=l.CSSStyleRule,d=l.CSSGroupingRule,h=new Map([...Object.keys(e.contract.props),...(e.declarations??[]).filter(g=>g.kind==="state").map(g=>g.name)].map(g=>[g.toLowerCase(),g])),u=g=>h.get(g.toLowerCase())??g,p=g=>{g.selectorText=er(g.selectorText,o,":scope",s,u);for(let b of Array.from(g.cssRules??[]))b instanceof f&&p(b)},m=(g,b,w)=>{let R=g.cssRules;for(let T=0;T<R.length;){let A=R[T];A instanceof f?Kn(A.selectorText)===b?(p(A),T+=1):g.deleteRule(T):A instanceof d?(m(A,b,!1),T+=1):(w&&b==="own"&&c.push(A.cssText),g.deleteRule(T))}},v=g=>{let b=new i;return b.replaceSync(a),m(b,g,!0),Array.from(b.cssRules,w=>w.cssText).join(`
8
+ `)},C=v("own"),k=v("slotted");return nr(e,s,r),{css:tr(o,C,k,c.join(`
9
+ `)),stateNames:[...s]}}function Ot(t,e){let n=[];for(let r of t){let o=e(r);(o===!0||typeof o=="string"&&o.length>0||typeof o=="number"&&o!==0&&!Number.isNaN(o))&&n.push(r),(typeof o=="string"||typeof o=="number")&&n.push(`${r}=${encodeURIComponent(String(o))}`)}return n.join(" ")}var xe=new WeakSet,Wt=new WeakMap,It=new WeakMap,rr=Symbol.for("@nextwebwg/html-next.runtime.v1");function Ye(t){return t[rr]??={}}function K(t){return Wt.get(t)}function Ft(t){let e=Ye(t),n=e.registry;return(n===void 0||n.root!==t.documentElement)&&(n={root:t.documentElement,definitions:new Map,discoverySelector:void 0},e.registry=n),n}var Zt=new WeakMap;function Gt(t,e,n){let r=Lt(t,e,n);return Zt.set(e,r.stateNames),r.css}function Kt(t,e,n){t.definitions.set(e,n),t.discoverySelector!==void 0&&(t.discoverySelector+=`,${e}`)}function or(t){return t.discoverySelector??=["template[component]","[data-component]",...Array.from(t.definitions.keys())].join(",")}function ir(t,e){let n=t.getAttribute("component")??"",r=`${t.ownerDocument.URL}#template[component="${n}"][${e+1}]`;t.hasAttribute("src")&&y("HL001","External definitions require the application-owned graph resolver.",r);let o=_e(t,r),i=Array.from(t.content.children).find(a=>a.localName==="style");return{wrapper:t,style:i,definition:o}}function Jt(t,e=document){let n=Ft(e),r=0;for(let o of t.nodes.values()){if(o.shadowedByCustomElement)continue;let i=o.definition.contract.tag;n.definitions.has(i)&&y("HR001",`More than one definition declares <${i}>.`);let a=o.definition.css===""?void 0:e.createElement("style");a!==void 0&&(a.textContent=Gt(o.definition.css,o.definition,e),e.head.append(a)),Kt(n,i,{definition:o.definition,style:a}),r+=1}return r}function Xe(t,e,n=!1){let r=t.type==="boolean"&&n&&e===""?!0:e,o=B(r,t.type);if(!o.ok){let i=o.issues.map(a=>`${a.path}: ${a.message}`).join("; ");y("HR002",`A prop invocation value does not satisfy its declared type. ${i}`)}return o.value}function sr(t,e,n){return n!==void 0?Xe(e,n):(e.required&&y("HC020",`Required prop \`${t}\` was not provided.`),e.default===void 0?E:e.default)}function ar(t,e){let n=It.get(t);if(n===void 0){let r=Object.create(null),o=Object.create(null);for(let i of Object.keys(t.contract.props)){let a=Re(i);r[a]=i,o[`data-${a}`]=i,a!==i.toLowerCase()&&(o[`data-${i.toLowerCase()}`]=i)}n=[r,o],It.set(t,n)}return n[e?1:0]}function cr(t,e,n=!1){let r=e.contract,o=ar(e,n),i=Object.create(null),a=[],s;for(let p of Array.from(t.attributes)){if(p.name.toLowerCase()==="as"&&e.root?.kind==="native"){s=p.value.toLowerCase();continue}let m=o[p.name.toLowerCase()];if(m===void 0){n||a.push(p);continue}i[m]=Xe(r.props[m],p.value,!n)}let c=e.root?.kind==="native"?n?t.localName:s??e.root.element:e.template.name;e.root?.kind==="native"&&!e.root.choices.includes(c)&&y(n?"HR005":"HR002",`<${r.tag}> cannot use root <${c}>; expected one of ${e.root.choices.join(", ")}.`);let l=new Set(Object.keys(i).filter(p=>i[p]!==void 0)),f=new we;for(let[p,m]of Object.entries(r.props))m.required&&i[p]===void 0&&y("HC020",`Required prop \`${p}\` was not provided.`),f.set(p,i[p]!==void 0?i[p]:m.default===void 0?E:m.default);let d=e.declarations??[];for(let p of d)(p.kind==="state"||p.kind==="computed"||p.kind==="data")&&f.set(p.name,null);for(let p of d)p.kind==="data"?f.set(p.name,{pending:!0,value:null,error:null,ok:!1}):p.kind==="state"&&f.set(p.name,p.expression===void 0?null:D(p.expression.source,f));let h=[];for(let p of d)p.kind!=="computed"||p.expression===void 0||h.push(f.defineComputed(p.name,()=>I(p.expression,f)));let u=(()=>{try{return new URL(e.source.file,t.ownerDocument.baseURI).href}catch{return t.ownerDocument.baseURI}})();for(let p of d){if(p.kind!=="data"||p.source===void 0)continue;let m=p,v=p.source,C=new ye({source:v,baseURL:u,...m.type===void 0?{}:{type:m.type},...m.debounce===void 0?{}:{debounce:Number(m.debounce)},...m.poll===void 0?{}:{poll:Number(m.poll)},onState:k=>f.set(m.name,k)});h.push(Z(f.scheduler,()=>{let k=Object.fromEntries(m.parameters.map(g=>[g.name,I(g.expression,f)]));return C.update(k),()=>C.disconnect()},0))}return{scope:f,passThrough:a,effects:h,rootName:c,explicit:l}}function Qe(t,e){return t.fork(Object.entries(e))}function D(t,e){try{return lt(t,e)}catch(n){throw n instanceof ee&&y("HB001",n.message),n}}var ie="http://www.w3.org/2000/svg",zt=new Map;function dr(t,e){if(t.namespaceURI!==ie)return e;let n=zt.get(e);if(n===void 0){let r=t.ownerDocument.createElement("template");r.innerHTML=`<svg ${e}>`,n=r.content.firstChild.attributes[0]?.name??e,zt.set(e,n)}return n}function Qt(t,e,n){return e==="svg"||n.namespace===ie?t.createElementNS(ie,e):t.createElement(e)}function lr(t,e){let n=t.namespaceURI===ie&&t.localName!=="foreignObject"?ie:void 0;return n===e.namespace?e:Object.create(e,{namespace:{value:n,enumerable:!0}})}function U(t,e,n,r=1){t.effects.push(Z(e.scheduler,n,r))}function Yt(t,e,n){let[r,...o]=e;if(typeof r!="string")return;if(o.length===0){t.set(r,n);return}let i=t.get(r);for(let c=0;c<o.length-1;c+=1){let l=o[c],f=typeof l=="object"?I(l.expression,t):l;if(typeof f!="string"&&typeof f!="number"||i==null)return;i=i[f]}let a=o.at(-1),s=typeof a=="object"?I(a.expression,t):a;(typeof s=="string"||typeof s=="number")&&i!=null&&(i[s]=n)}function ur(t){return t instanceof HTMLInputElement?t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?null:t.valueAsNumber:t.value:t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions,e=>e.value):t.value:t instanceof HTMLTextAreaElement?t.value:t.value??t.getAttribute("value")}function fr(t,e,n){let r=e.toLowerCase();if(r==="checked"&&t instanceof HTMLInputElement)return t.checked=L(n),!0;if(r==="value"&&t instanceof HTMLSelectElement&&t.multiple){let o=new Set(Array.isArray(n)?n.map(String):[]);for(let i of Array.from(t.options))i.selected=o.has(i.value);return!0}return r==="value"&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)?(t.value=n==null?"":String(n),!0):!1}function pr(t,e,n,r){for(let o of t.steps)if(!(o.guard!==void 0&&!L(I(o.guard,n))))if(o.kind==="set")Yt(n,o.writablePath,I(o.value,n));else if(o.kind==="dispatch"){let i=Xt(r.definition,o.event),a=o.value===void 0?void 0:I(o.value,n);i!==void 0&&a!==void 0&&(B(a,de(i.type)).ok||y("HR002",`Event \`${o.event}\` detail does not satisfy its declared type.`)),en(r.root??e,o.event,a,i)}else{let i=r.refs[o.target];o.kind==="focus"?i?.focus():i?.reportValidity?.()}}function Xt(t,e){return(t.declarations??[]).find(n=>n.kind==="event"&&n.name===e)}function en(t,e,n,r){return t.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:r?.bubbles??!0,composed:r?.composed??!0,cancelable:r?.cancelable??!1}))}function mr(t,e,n){if(n.includes("self")&&t.target!==e)return!1;if(t instanceof MouseEvent){let o=n.filter(a=>["left","middle","right"].includes(a)),i={left:0,middle:1,right:2};if(o.length>0&&!o.some(a=>t.button===i[a]))return!1}let r=["ctrl","shift","alt","meta"];for(let o of r)if(n.includes(o)&&!t[`${o}Key`])return!1;if(n.includes("exact")&&r.some(o=>!n.includes(o)&&t[`${o}Key`]))return!1;if(t instanceof KeyboardEvent){let o=n.filter(a=>["enter","escape","space","tab","up","down","left","right"].includes(a)),i={enter:"Enter",escape:"Escape",space:" ",tab:"Tab",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"};if(o.length>0&&!o.some(a=>t.key===i[a]))return!1}return!0}function Vt(t,e,n,r){for(let o of e.events??[]){let i=(r.definition.declarations??[]).find(s=>s.kind==="handler"&&s.name===o.handler),a=s=>{mr(s,t,o.modifiers)&&(o.modifiers.includes("prevent")&&s.preventDefault(),o.modifiers.includes("stop")&&s.stopPropagation(),pr(i,t,n,r))};if(o.name==="connect"||o.name==="disconnect"){(o.name==="connect"?r.connectCallbacks:r.disconnectCallbacks).add(()=>a(new Event(o.name)));continue}U(r,n,()=>(t.addEventListener(o.name,a,{capture:o.modifiers.includes("capture"),passive:o.modifiers.includes("passive"),once:o.modifiers.includes("once")}),()=>t.removeEventListener(o.name,a,{capture:o.modifiers.includes("capture")})),2)}}function hr(t,e,n){e=dr(t,e),n===null||ne(e)&&te(n)?t.removeAttribute(e):t.setAttribute(e,n)}function yr(t,e,n,r){let o=D(e.expression,n);e.name==="value"?t.textContent=P(o):t.replaceChildren(Le(P(o),r,i=>xe.add(i)))}function gr(t,e,n){let r=D(t.expression,e);return t.name==="value"?n.createTextNode(P(r)):Le(P(r),n,o=>xe.add(o))}function br(t,e){return typeof t=="number"&&typeof e=="number"?t-e:P(t).localeCompare(P(e))}function vr(t,e,n){let r=t.slice();if(e.where!==void 0){let o=e.where;r=r.filter(i=>L(D(o,Qe(n,{[e.item]:i}))))}if(e.sort!==void 0){let o=e.sort.split(",").map(a=>a.trim()).filter(a=>a!==""),i=(a,s)=>a!==null&&typeof a=="object"&&!Array.isArray(a)?D(`${e.item}.${s}`,Qe(n,{[e.item]:a})):a;r.sort((a,s)=>{for(let c of o){let l=c.startsWith("-"),f=l?c.slice(1).trim():c,d=br(i(a,f),i(s,f));if(d!==0)return l?-d:d}return 0})}if(e.limit!==void 0){let o=D(e.limit,n);typeof o=="number"&&(r=r.slice(0,Math.max(0,Math.trunc(o))))}return r}function tn(t,e){let n=e.createDocumentFragment();return n.append(...t),Array.from(n.childNodes)}function wr(t,e){let n=t.nextSibling;for(;n!==null&&n!==e;){let r=n.nextSibling;n.remove(),n=r}}function kr(t,e,n,r,o){if(t.flow?.kind==="each")return Rr(t,e,n,r,o);let i=n.createComment("html-next:start"),a=n.createComment("html-next:end"),s=n.createDocumentFragment();s.append(i,a);let c=[];return U(o,e,()=>{for(let d of c)d.stop();c=[],wr(i,a);let l=o.effects.length,f=[];if(t.flow?.kind==="if"){if(L(D(t.flow.test,e))){let{flow:d,...h}=t;f=se(h,e,n,r,o)}}else if(t.flow?.kind==="with"){let d=e.fork([[t.flow.alias,D(t.flow.expr,e)]]),{flow:h,...u}=t;f=se(u,d,n,r,o)}else t.flow?.kind==="match"&&(f=Tr(t,e,n,o));c=o.effects.slice(l),a.before(...tn(f,n))}),[s]}function Cr(t,e){if(t.end.nextSibling===e)return;let n=[],r=t.start;for(;r!==null&&(n.push(r),r!==t.end);)r=r.nextSibling;let o=e.parentNode;if(o===null)return;let i=o.moveBefore;for(let a of n)i===void 0?o.insertBefore(a,e):i.call(o,a,e)}function xr(t){for(let n of t.effects)n.stop();let e=t.start;for(;e!==null;){let n=e.nextSibling;if(e.parentNode?.removeChild(e),e===t.end)break;e=n}}function Er(t){let e=-1,n=!0;for(let s of t)s<0||(s<e&&(n=!1),e=s);if(n)return;let r=[],o=new Int32Array(t.length).fill(-1);for(let s=0;s<t.length;s+=1){let c=t[s];if(c<0)continue;let l=0,f=r.length;for(;l<f;){let d=l+f>>>1;t[r[d]]<c?l=d+1:f=d}l>0&&(o[s]=r[l-1]),r[l]=s}let i=new Uint8Array(t.length),a=r.at(-1)??-1;for(;a>=0;)i[a]=1,a=o[a];return i}function Rr(t,e,n,r,o){let i=t.flow,a=n.createComment("html-next:each-start"),s=n.createComment("html-next:each-end"),c=n.createDocumentFragment();c.append(a,s);let l=new Map;return U(o,e,()=>{let f=D(i.list,e),d=Array.isArray(f)?vr(f,i,e):[],h=new Map,u=i.key!==void 0,p=u?[]:void 0,m;if(u){m=new Map;let g=0;for(let b of l.keys())m.set(b,g++)}let v=u?[]:void 0,{flow:C,...k}=t;for(let g=0;g<d.length;g+=1){let b=d[g],w={[i.item]:b,loop:{index:g,first:g===0,last:g===d.length-1,count:d.length}};i.index!==void 0&&(w[i.index]=g);let R,T=g;i.key!==void 0&&(R=e.fork(Object.entries(w)),T=D(i.key,R)),h.has(T)&&y("HR004",`A keyed list produced duplicate key \`${P(T)}\`.`);let A=l.get(T);if(A===void 0){R??=e.fork(Object.entries(w));let M=o.effects.length,ae=tn(se(k,R,n,r,o),n),nt=n.createComment("html-next:item-start"),rt=n.createComment("html-next:item-end");s.before(nt,...ae,rt),A={start:nt,end:rt,scope:R,effects:o.effects.slice(M)}}else A.scope.set(i.item,b),i.index!==void 0&&A.scope.set(i.index,g),A.scope.set("loop",w.loop);h.set(T,A),p?.push(A),v?.push(m?.get(T)??-1)}for(let[g,b]of l)h.has(g)||xr(b);if(p!==void 0&&v!==void 0){let g=Er(v),b=s;for(let w=p.length-1;w>=0;w-=1){let R=p[w];(v[w]<0||g!==void 0&&g[w]!==1)&&Cr(R,b),b=R.start}}l=h}),[c]}function nn(t,e,n,r,o,i){return t.flow?.kind==="if"||t.flow?.kind==="each"||t.flow?.kind==="with"||t.flow?.kind==="match"?o.committed&&o.frameworkOwned&&i!==void 0?[i]:kr(t,e,n,r,o):se(t,e,n,r,o,i)}function Tr(t,e,n,r){let o=t.flow,i=o.expr!==void 0?Qe(e,{[o.alias]:D(o.expr,e)}):e,a;for(let d of t.children)if(d.kind==="element"){if(d.flow?.kind==="when"&&L(D(d.flow.test,i))){a=d;break}if(d.flow?.kind==="else"){a=d;break}}if(a===void 0)return[];let{flow:s,...c}=a,l=se(c,i,n,[],r);if(t.name==="template")return l;let f=Qt(n,t.name,r);for(let d of t.attributes)d.kind==="literal"&&f.setAttribute(d.name,d.value);return f.append(...l),[f]}function se(t,e,n,r,o,i){let a=t.attributes.find(m=>m.kind==="directive");if(t.name==="template"){if(a!==void 0){let m=n.createTextNode("");return U(o,e,()=>{let v=D(a.expression,e);a.name==="value"&&(m.data=P(v))}),a.name==="value"?[m]:[gr(a,e,n)]}return rn(t.children,e,n,o)}let s=t===o.definition.template?o.rootName:t.name;if(o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name))return[i];if(o.hydrationRanges!==void 0&&!o.frameworkOwned&&i instanceof Element&&i.localName!==s&&(i.getAttribute("data-component")??"").split(/\s+/).includes(t.name)){let m=et(i,!1),v=b=>b.kind==="element"?b.attributes.find(w=>w.kind==="literal"&&w.name==="slot")?.value??"":"",C=m?.ranges.filter(b=>!b.fallback)??[],k=(b,w)=>{let R=0;for(let T of b)R+=Ee(T,e,n,o,w[R]).length};for(let b of C)k(t.children.filter(w=>v(w)===b.slot),b.content);let g=new Set(C.map(b=>b.slot));return k(t.children.filter(b=>!g.has(v(b))),m?.carried??[]),[i]}let c=i instanceof Element&&i.localName===s,l=c?i:Qt(n,s,o);t===o.definition.template&&(o.root=l);let f=c?Array.from(l.childNodes):[],d=c&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement)?{value:l.value,focused:l.ownerDocument.activeElement===l,...l instanceof HTMLInputElement?{checked:l.checked}:{},...l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement?{selectionStart:l.selectionStart,selectionEnd:l.selectionEnd}:{}}:void 0;t.ref!==void 0&&(o.refs[t.ref]=l);for(let m of t.attributes)m.kind==="literal"&&l.setAttribute(m.name,m.value);for(let m of r){let v=m.name==="class"||m.name==="style"?l.getAttribute(m.name):null;l.setAttribute(m.name,v===null||v===""?m.value:`${v}${m.name==="class"?" ":"; "}${m.value}`)}for(let m of t.attributes)if(m.kind==="attribute"){if(U(o,e,()=>{let v=D(m.expression,e);m.target==="class"?l.classList.toggle(m.name,L(v)):m.target==="style"?l.style.setProperty(m.name,P(v)):m.twoWay===!0&&fr(l,m.name,v)||hr(l,m.name,ut(v,m.name))}),m.twoWay===!0&&m.writablePath!==void 0){let v=l instanceof HTMLSelectElement||l instanceof HTMLInputElement&&["checkbox","radio","file"].includes(l.type)?"change":"input",C=()=>{l instanceof HTMLInputElement&&l.type==="radio"&&!l.checked||Yt(e,m.writablePath,ur(l))};U(o,e,()=>(l.addEventListener(v,C),()=>l.removeEventListener(v,C)),2)}}else m.kind==="property"&&U(o,e,()=>{l[m.name]=D(m.expression,e)});if(a!==void 0)return U(o,e,()=>yr(l,a,e,n)),Vt(l,t,e,o),[l];let h=[],u=0,p=lr(l,o);for(let m of t.children){let v=u;if(o.frameworkOwned&&m.kind==="element"){let k=f.findIndex((g,b)=>b<u?!1:g instanceof Element&&(g.localName===m.name||(g.getAttribute("data-component")??"").split(/\s+/).includes(m.name)));k<0&&m.flow!==void 0&&(k=f.findIndex((g,b)=>b>=u&&g instanceof Comment)),k>=0&&(v=k)}let C=Ee(m,e,n,p,f[v]);h.push(...C),u=v+C.length}if(c&&!o.frameworkOwned){h=h.flatMap(m=>m.nodeType===11?Array.from(m.childNodes):[m]);for(let m=0;m<h.length;m+=1){let v=h[m];l.childNodes[m]!==v&&l.insertBefore(v,l.childNodes[m]??null)}for(;l.childNodes.length>h.length;)l.lastChild.remove()}else c||l.append(...h);return d!==void 0&&(l.value=d.value,l instanceof HTMLInputElement&&"checked"in d&&(l.checked=d.checked),(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&"selectionStart"in d&&typeof d.selectionStart=="number"&&typeof d.selectionEnd=="number"&&(d.focused&&l.focus({preventScroll:!0}),l.setSelectionRange(d.selectionStart,d.selectionEnd))),Vt(l,t,e,o),[l]}function rn(t,e,n,r){let o=[];for(let i of t)o.push(...Ee(i,e,n,r));return o}function Sr(t,e){return e.projectedSlotNames.get(t)??(t instanceof Element?t.getAttribute("slot")??"":"")}function Nr(t,e,n,r){let o=t.nameExpression===void 0?t.name??"":P(I(t.nameExpression,e)),i=r.projectedNodes.filter(d=>Sr(d,r)===o),a=r.hydrationRanges?.shift();if(a!==void 0){if(a.fallback){let d=[],h=0;for(let u of t.fallback??[]){let p=Ee(u,e,n,r,a.content[h]);d.push(...p),h+=p.length}return[a.markers[0],...d,...a.markers.slice(1)]}for(let d of a.content)Ce(d);return a.markers.length===1?[a.markers[0]]:[a.markers[0],...a.content,a.markers[1]]}let s=d=>`"${d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}"`,c=(d,h)=>$r(n,d,h),l=(d,h)=>{if(d.length===0)return[c("marker",`slot=${s(o)}`)];let u=`slot=${s(o)}${h?' fallback=""':""}`;return[c("start",u),...d,c("end","")]};if(i.length===0)return l(rn(t.fallback??[],e,n,r),!0);if(r.committed){for(let d of i)Ce(d);return l([...i],!1)}let f=n.createComment(`html-next:slot:${o}`);return r.slotInsertions.push({anchor:f,nodes:i}),l([f],!1)}function Ut(t){let e=new Map,n=t.trim(),r={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};for(;n!=="";){let o=/^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);if(o===null||e.has(o[1]))return new Map;let i=(o[2]??o[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g,(a,s)=>s.startsWith("#x")?String.fromCodePoint(parseInt(s.slice(2),16)):s.startsWith("#")?String.fromCodePoint(Number(s.slice(1))):r[s]);e.set(o[1],i),n=n.slice(o[0].length)}return e}var qt=new WeakMap;function on(t){let e=qt.get(t);if(e===void 0){let n=t.createElement("div");n.innerHTML='<?probe x="1"?>',e=n.firstChild?.nodeType===7,qt.set(t,e)}return e}function $r(t,e,n){return on(t)?t.createProcessingInstruction(e,n):t.createComment(`?${e}${n===""?"":` ${n}`}?`)}function Je(t){if(t.nodeType===7){let n=t;return{target:n.target,attributes:Ut(n.data)}}if(t.nodeType!==8||on(t.ownerDocument))return;let e=/^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(t.data);return e===null?void 0:{target:e[1],attributes:Ut(e[2]??"")}}function et(t,e=!0){let n=[],r=new Set,o=(s,c)=>{for(let l=0;l<s.length;l+=1){let f=s[l],d=Je(f);if(d?.target==="marker"&&d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:!1,markers:[f],content:[]});continue}if(d?.target==="start"){let h=1,u=[],p;for(l+=1;l<s.length;l+=1){let m=Je(s[l]);if(m?.target==="start")h+=1;else if(m?.target==="end"&&--h===0){p=s[l];break}u.push(s[l])}if(d.attributes.has("slot")){c.push({slot:d.attributes.get("slot"),fallback:d.attributes.has("fallback"),markers:p?[f,p]:[f],content:u});for(let m of u)r.add(m)}else o(u,c);continue}if(f instanceof Element)if(f!==t&&f.hasAttribute("data-component")){let h=et(f,!1);for(let u of h?.ranges??[])o(u.content,c)}else o(Array.from(f.childNodes),c)}};o(Array.from(t.childNodes),n);let i=Array.from(t.children).find(s=>s instanceof HTMLTemplateElement&&!r.has(s)&&s.previousSibling!==null&&Je(s.previousSibling)?.target==="carrier");if(n.length===0&&i===void 0)return;let a=[];if(i!==void 0&&e){for(let s of Array.from(i.content.childNodes))a.push(t.ownerDocument.adoptNode(s));i.previousSibling.remove(),i.remove()}else i!==void 0&&a.push(...Array.from(i.content.childNodes));return{ranges:n,carried:a}}function Ee(t,e,n,r,o){if(t.kind==="text"){let i=o instanceof Text?o:n.createTextNode("");return i.data=t.value,[i]}return t.kind==="slot"?Nr(t,e,n,r):nn(t,e,n,[],r,o)}function Ar(t,e){let n=Zt.get(e.definition)??[];if(n.length===0)return;let r=Ke(e.definition.contract.tag);e.effects.push(Z(e.scope.scheduler,()=>{let o=Ot(n,i=>e.scope.get(i));o===""?t.removeAttribute(r):t.getAttribute(r)!==o&&t.setAttribute(r,o)},2))}function Hr(t,e){let n=e.definition.contract.props,r={},o={};for(let[f,d]of Object.entries(n)){let h=`data-${Re(f)}`;r[h]=f;let u=e.definition.template.attributes.some(p=>p.kind==="attribute"&&p.name===h);e.effects.push(Z(e.scope.scheduler,()=>{let p=e.scope.get(f);if(!u&&!e.explicit.has(f))return;let m=p===void 0||p===E||p===null?null:Ae(p,d.type);o[h]=m,m===null?t.removeAttribute(h):t.setAttribute(h,m)},2))}let i=t.ownerDocument.defaultView?.MutationObserver,a=Object.keys(r);if(i===void 0||a.length===0)return;let s=new i(f=>{for(let d of f){let h=d.attributeName;if(h===null)continue;let u=r[h];if(u===void 0)continue;let p=t.getAttribute(h);if(h in o&&o[h]===p){delete o[h];continue}delete o[h];let m=n[u];p===null?e.explicit.delete(u):e.explicit.add(u),e.scope.set(u,p===null?sr(u,m,void 0):Xe(m,p,!0))}}),c=()=>s.observe(t,{attributes:!0,attributeFilter:a}),l=()=>s.disconnect();e.connectCallbacks.add(c),e.disconnectCallbacks.add(l)}function Dr(t,e){for(let n of e.definition.declarations??[])n.kind==="method"&&Object.defineProperty(t,n.name,{configurable:!0,enumerable:!1,value:(...r)=>e.controllerModule===void 0?Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${e.definition.contract.tag}>.`)):e.controllerModule.then(o=>{let i=o[n.exportName];return typeof i!="function"&&y("HJ003",`Controller does not export method \`${n.exportName}\`.`),Reflect.apply(i,void 0,[tt(t),...r])})})}function Mr(t,e,n,r,o=new WeakMap,i=!1){let a=n&&t.contains(t.ownerDocument.activeElement)?t.ownerDocument.activeElement:null,s=a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement?[a.selectionStart,a.selectionEnd]:void 0,{scope:c,passThrough:l,effects:f,rootName:d,explicit:h}=cr(t,e,n),u=r,p;if(n&&u===void 0){let b=et(t);if(b!==void 0){p=b.ranges;let w=[];for(let R of b.ranges)if(!R.fallback)for(let T of R.content)o.set(T,R.slot),w.push(T);w.push(...b.carried),u=w}else(e.slots??[]).length>0?y("HR005",`<${e.contract.tag}> has slots but its server-rendered root has no slot marks.`):u=[]}let m=n?u:Array.from(t.childNodes),v={definition:e,scope:c,refs:{},effects:f,connectCallbacks:new Set,disconnectCallbacks:new Set,connected:!1,explicit:h,frameworkOwned:i,projection:{nodes:n?u:Array.from(t.childNodes),slotNames:o}},C={definition:e,effects:f,refs:v.refs,connectCallbacks:v.connectCallbacks,disconnectCallbacks:v.disconnectCallbacks,projectedNodes:m,projectedSlotNames:o,slotInsertions:[],rootName:d,frameworkOwned:i,committed:n,hydrationRanges:p},k=nn(e.template,c,t.ownerDocument,l,C,n?t:void 0);C.hydrationRanges=void 0;let g=k[0];return n&&g!==t&&y("HR005",`Server markup for <${e.contract.tag}> has an incompatible root.`),a instanceof HTMLElement&&(a.focus({preventScroll:!0}),s!==void 0&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&typeof s[0]=="number"&&typeof s[1]=="number"&&a.setSelectionRange(s[0],s[1])),Pt(g,G,e.contract.tag),v.element=g,{invocation:t,nativeRoot:g,context:C,definition:e,instance:v,replace:!n}}function Pr(t,e){e.sort((n,r)=>n.invocation.contains(r.invocation)?-1:r.invocation.contains(n.invocation)?1:0);for(let n of e){for(let r of n.context.slotInsertions){for(let o of r.nodes)Ce(o);r.anchor.replaceWith(...r.nodes)}n.replace&&n.invocation.replaceWith(n.nativeRoot),n.context.committed=!0,Wt.set(n.nativeRoot,n.instance),Hr(n.nativeRoot,n.instance),Ar(n.nativeRoot,n.instance),Dr(n.nativeRoot,n.instance),sn(n.instance)}}function _t(t,e,n){t.nodeType===1&&t.matches(e)&&n.add(t);for(let r of t.querySelectorAll(e))n.add(r)}function jr(t,e){let n=t.nodeType===1?t:void 0;if(n?.matches("[data-component]")===!0&&e(n),n?.childElementCount!==0)for(let r of t.querySelectorAll("[data-component]"))e(r)}function Lr(t,e,n){let r=Ft(t),o=new Set,i=or(r);for(let u of e)_t(u,i,o);let a=[];for(let u of o)u.localName==="template"&&u.hasAttribute("component")&&!xe.has(u)&&a.push(ir(u,a.length));let s=new Map;for(let u of a){let p=u.definition.contract.tag;(r.definitions.has(p)||s.has(p))&&y("HR001",`More than one definition declares <${p}>.`),s.set(p,u)}let c=[],l=new Set,f=(u,p,m)=>{let{definition:v}=u;return xe.has(p)||t.defaultView?.customElements.get(v.contract.tag)!==void 0||n?.(p,v,m)===!1?!1:(c.push(Mr(p,v,m)),!0)},d=(u,p)=>{for(let m of p){let v=u.get(m.localName);if(v!==void 0&&f(v,m,!1),!m.hasAttribute("data-component"))continue;let C=K(m);if(C!==void 0){C.frameworkOwned||l.add(m);continue}let k=!1;for(let g of new Set((m.getAttribute("data-component")??"").split(/\s+/))){let b=u.get(g);b!==void 0&&f(b,m,!0)&&(k=!0)}k&&l.add(m)}};if(d(r.definitions,o),s.size>0){let u=["[data-component]",...Array.from(s.keys())].join(","),p=new Set;_t(t,u,p),d(s,p)}for(let u of a)Kt(r,u.definition.contract.tag,u),u.style!==void 0&&(u.style.textContent=Gt(u.style.textContent??"",u.definition,u.wrapper.ownerDocument),u.wrapper.ownerDocument.head.append(u.style)),u.wrapper.remove();Pr(r,c);let h=c.map(u=>u.nativeRoot);for(let u of h)l.add(u);return{lowered:h,roots:Array.from(l)}}function Or(t,e){let n=Ye(t),r=n.mutationHub;if(r===void 0){let i=t.defaultView?.MutationObserver;i===void 0&&y("HR003","Automatic component management requires a browser MutationObserver.");let a=new Set,s=new i(c=>{for(let l of Array.from(a))l(c)});r={observer:s,subscribers:a},n.mutationHub=r,s.observe(t,{childList:!0,subtree:!0})}r.subscribers.add(e);let o=!0;return()=>{o&&(o=!1,r.subscribers.delete(e),r.subscribers.size===0&&(r.observer.disconnect(),delete n.mutationHub))}}function sn(t){if(!t.connected){t.connected=!0;for(let e of t.effects)e.resume();for(let e of t.connectCallbacks)e();t.element?.dispatchEvent(new Event("connect"))}}function Bt(t){if(t.connected){t.element?.dispatchEvent(new Event("disconnect"));for(let e of t.disconnectCallbacks)e();t.connected=!1;for(let e of t.effects)e.pause()}}function tt(t){let e=K(t);if(e===void 0)return;if(e.host!==void 0)return e.host;let n=new Set((e.definition.declarations??[]).filter(a=>a.kind==="state").map(a=>a.name)),r=new Proxy({},{get:(a,s)=>{if(typeof s!="string")return;let c=e.scope.get(s);return c===E?void 0:c},set:(a,s,c)=>{if(typeof s!="string"||!n.has(s))throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);return e.scope.set(s,c),!0},has:(a,s)=>typeof s=="string"&&e.scope.has(s)}),o=new Proxy({},{get:(a,s)=>typeof s!="string"?void 0:(t instanceof HTMLFormElement?t:t.querySelector("form"))?.elements.namedItem(s)??t.querySelector(`[name="${CSS.escape(s)}"]`)??void 0}),i={element:t,state:r,refs:e.refs,elements:o,signal(a){return At(a)},computed(a){let s=Ht(e.scope.scheduler,a);return e.connected||s.pause(),e.effects.unshift(s),s},effect(a){let s=Z(e.scope.scheduler,a,2,e.connected);return e.effects.push(s),()=>s.stop()},on(a,s){if(a==="connect"){let c=s;return e.connectCallbacks.add(c),e.connected&&s(),()=>e.connectCallbacks.delete(c)}if(a==="disconnect"){let c=s;return e.disconnectCallbacks.add(c),()=>e.disconnectCallbacks.delete(c)}return t.addEventListener(a,s),()=>t.removeEventListener(a,s)},dispatch(a,s){return en(t,a,s,Xt(e.definition,a))}};return e.host=Object.freeze(i),e.host}function an(t,e){let n=K(t);n===void 0&&y("HJ003","A controller can attach only to a lowered component root."),n.controllerModule=e}function cn(t=document,e={}){let n=Ye(t);n.observer!==void 0&&y("HR003","This document is already being observed.");let r=new Map,o=e.onError??(d=>console.error(d)),i=!1,a=d=>{let h=r.get(d);r.delete(d);let u=K(d);u!==void 0&&Bt(u);try{h?.()}catch(p){o(p)}},s=d=>{let h=K(d);if(!(h===void 0||h.frameworkOwned||r.has(d)||!t.contains(d))){r.set(d,void 0);try{sn(h);let u=e.onConnect?.(d,h.definition);i?u?.():r.set(d,u)}catch(u){o(u)}}},c=d=>{if(i)return;let h=[];if(d===void 0)h.push(t);else{let u=[];for(let p of d){for(let m of p.removedNodes)m.nodeType===1&&jr(m,v=>{r.has(v)&&u.push(v)});for(let m of p.addedNodes)m.nodeType===1&&h.push(m)}for(let p of u)t.contains(p)||a(p)}if(h.length>0)try{for(let u of Lr(t,h,e.shouldLower).roots){if(i)break;s(u)}}catch(u){o(u)}};n.release=d=>{r.has(d)&&a(d)};let l=Or(t,c),f=()=>{if(!i){i=!0,l(),delete n.observer,delete n.release;for(let d of r.values())try{d?.()}catch(h){o(h)}for(let d of r.keys()){let h=K(d);h!==void 0&&Bt(h)}r.clear()}};return n.observer=f,c(),f}function Ir(t){let e={};for(let n of t.querySelectorAll('script[type="importmap"]')){let r=JSON.parse(n.textContent??"{}");Object.assign(e,r.imports??{})}return{imports:e}}async function zr(t,e={}){let n=e.document??document,r=e.fetch??fetch,o=new he(e.importMap??Ir(n),n.baseURI,n.URL),i=await it(t,{resolver:o,fetchComponent:async s=>{let c=await r(s);if(!c.ok)throw new TypeError(`Component request \`${s}\` failed with ${c.status}.`);return{url:c.url||s,source:await c.text()}},parseComponentResource:(s,c)=>Ct(s,c,n),isCustomElementRegistered:s=>n.defaultView?.customElements.get(s)!==void 0}),a=e.registry??new me;return a.addGraph(i,s=>Tt(s,e.importer)),Object.freeze({graph:i,registry:a})}function Vr(t=document){return Object.freeze(Array.from(t.querySelectorAll('link[rel="component"][href]'),e=>e.getAttribute("href")).filter(e=>e.trim()!==""))}function Ur(t=document,e={}){return zr(Vr(t),{...e,document:t})}async function Bo(t=document,e={}){let n=await Ur(t,e);Jt(n.graph,t);let r=e.onError??(i=>console.error(i)),o=cn(t,{onError:r,onConnect(i,a){let s=n.registry.get(a.contract.tag)?.node;if(s?.controller===void 0)return;let c=We(s,e.importer);an(i,c);let l=!1,f;return c.then(d=>l?void 0:d.default(tt(i))).then(d=>{typeof d=="function"&&(l?d():f=d)}).catch(r),()=>{l=!0,f?.()}}});return Object.freeze({...n,stop:o})}export{Vr as documentComponentRoots,zr as loadBrowserComponents,Ur as loadDocumentComponents,Bo as startBrowserComponents};
@@ -1 +1 @@
1
- {"version":3,"file":"browser-loader.d.ts","sourceRoot":"","sources":["../src/browser-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAWD,iGAAiG;AACjG,wBAAsB,qBAAqB,CACzC,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAkBnF;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,QAAmB,GAAG,SAAS,MAAM,EAAE,CAKnF;AAED,wBAAgB,sBAAsB,CACpC,IAAI,GAAE,QAAmB,EACzB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAM,GACnD,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAEnF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,GAAE,QAAmB,EACzB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAM,GACnD,OAAO,CAAC,wBAAwB,CAAC,CA+BnC"}
1
+ {"version":3,"file":"browser-loader.d.ts","sourceRoot":"","sources":["../src/browser-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAWD,iGAAiG;AACjG,wBAAsB,qBAAqB,CACzC,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAsBnF;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,QAAmB,GAAG,SAAS,MAAM,EAAE,CAKnF;AAED,wBAAgB,sBAAsB,CACpC,IAAI,GAAE,QAAmB,EACzB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAM,GACnD,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAEnF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,GAAE,QAAmB,EACzB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAM,GACnD,OAAO,CAAC,wBAAwB,CAAC,CA+BnC"}
@@ -16,7 +16,7 @@ function readImportMap(root) {
16
16
  export async function loadBrowserComponents(rootSpecifiers, options = {}) {
17
17
  const root = options.document ?? document;
18
18
  const request = options.fetch ?? fetch;
19
- const resolver = new ResourceResolver(options.importMap ?? readImportMap(root), root.baseURI);
19
+ const resolver = new ResourceResolver(options.importMap ?? readImportMap(root), root.baseURI, root.URL);
20
20
  const graph = await buildComponentGraph(rootSpecifiers, {
21
21
  resolver,
22
22
  fetchComponent: async (url) => {
@@ -1 +1 @@
1
- {"version":3,"file":"browser-loader.js","sourceRoot":"","sources":["../src/browser-loader.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"browser-loader.js","sourceRoot":"","sources":["../src/browser-loader.ts"],"names":[],"mappings":"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"}