mancha 0.17.0 → 0.17.4

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.
Files changed (86) hide show
  1. package/.github/workflows/ci.yml +11 -10
  2. package/.prettierrc +2 -2
  3. package/.vscode/extensions.json +1 -1
  4. package/.vscode/launch.json +33 -43
  5. package/README.md +144 -84
  6. package/dist/browser.d.ts +2 -0
  7. package/dist/browser.js +1 -1
  8. package/dist/browser.js.map +1 -1
  9. package/dist/cli.js.map +1 -1
  10. package/dist/css_gen_basic.js.map +1 -1
  11. package/dist/css_gen_utils.d.ts +786 -0
  12. package/dist/css_gen_utils.js +350 -399
  13. package/dist/css_gen_utils.js.map +1 -1
  14. package/dist/dome.d.ts +1 -0
  15. package/dist/dome.js +15 -0
  16. package/dist/dome.js.map +1 -1
  17. package/dist/expressions/ast.d.ts +16 -16
  18. package/dist/expressions/ast.test.js +89 -64
  19. package/dist/expressions/ast.test.js.map +1 -1
  20. package/dist/expressions/ast_factory.d.ts +1 -1
  21. package/dist/expressions/ast_factory.js +17 -17
  22. package/dist/expressions/ast_factory.js.map +1 -1
  23. package/dist/expressions/ast_factory.test.js +42 -36
  24. package/dist/expressions/ast_factory.test.js.map +1 -1
  25. package/dist/expressions/constants.js +56 -56
  26. package/dist/expressions/constants.js.map +1 -1
  27. package/dist/expressions/constants.test.js +57 -57
  28. package/dist/expressions/constants.test.js.map +1 -1
  29. package/dist/expressions/eval.d.ts +17 -17
  30. package/dist/expressions/eval.js +58 -60
  31. package/dist/expressions/eval.js.map +1 -1
  32. package/dist/expressions/eval.test.js +11 -8
  33. package/dist/expressions/eval.test.js.map +1 -1
  34. package/dist/expressions/expressions.test.d.ts +6 -6
  35. package/dist/expressions/expressions.test.js +6 -6
  36. package/dist/expressions/index.d.ts +6 -6
  37. package/dist/expressions/index.js +6 -6
  38. package/dist/expressions/parser.d.ts +3 -3
  39. package/dist/expressions/parser.js +45 -45
  40. package/dist/expressions/parser.js.map +1 -1
  41. package/dist/expressions/parser.test.js +43 -2
  42. package/dist/expressions/parser.test.js.map +1 -1
  43. package/dist/expressions/tokenizer.js +22 -25
  44. package/dist/expressions/tokenizer.js.map +1 -1
  45. package/dist/expressions/tokenizer.test.js +40 -15
  46. package/dist/expressions/tokenizer.test.js.map +1 -1
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +1 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/interfaces.d.ts +1 -1
  51. package/dist/iterator.js.map +1 -1
  52. package/dist/mancha.js +1 -1
  53. package/dist/mancha.js.map +1 -1
  54. package/dist/plugins.js +96 -25
  55. package/dist/plugins.js.map +1 -1
  56. package/dist/query.js.map +1 -1
  57. package/dist/renderer.js +4 -2
  58. package/dist/renderer.js.map +1 -1
  59. package/dist/safe_browser.js +1 -1
  60. package/dist/safe_browser.js.map +1 -1
  61. package/dist/store.d.ts +10 -4
  62. package/dist/store.js +26 -10
  63. package/dist/store.js.map +1 -1
  64. package/dist/test_utils.d.ts +2 -0
  65. package/dist/test_utils.js +14 -1
  66. package/dist/test_utils.js.map +1 -1
  67. package/dist/trusted_attributes.js +2 -0
  68. package/dist/trusted_attributes.js.map +1 -1
  69. package/dist/type_checker.js +57 -22
  70. package/dist/type_checker.js.map +1 -1
  71. package/dist/worker.d.ts +2 -0
  72. package/dist/worker.js +1 -0
  73. package/dist/worker.js.map +1 -1
  74. package/docs/css.md +309 -0
  75. package/docs/quickstart.md +414 -241
  76. package/global.d.ts +2 -2
  77. package/gulpfile.ts +44 -0
  78. package/package.json +86 -84
  79. package/scripts/generate-css-docs.ts +263 -0
  80. package/tsconfig.json +42 -19
  81. package/tsec_exemptions.json +8 -3
  82. package/webpack.config.esmodule.ts +26 -0
  83. package/webpack.config.ts +21 -0
  84. package/gulpfile.js +0 -44
  85. package/webpack.config.esmodule.js +0 -23
  86. package/webpack.config.js +0 -18
@@ -1 +1 @@
1
- const e={};function t(e){0}class s{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const r=s;function i(e){if(function(e){return e instanceof s}(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}function n(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function a(e){return-1===e.toString().indexOf("`")}a(e=>e``)||a(e=>e`\0`)||a(e=>e`\n`)||a(e=>e`\u0000`),n``&&n`\0`&&n`\n`&&n`\u0000`;function o(t){const s=t[0].toLowerCase();return new r(e,s)}let l,c="google#safe";function h(){var e;return""!==c&&null!==(e=function(){if("undefined"!=typeof window)return window.trustedTypes}())&&void 0!==e?e:null}class u{constructor(e,s){t(),this.privateDoNotAccessOrElseWrappedHtml=e}toString(){return this.privateDoNotAccessOrElseWrappedHtml.toString()}}function d(t,s){return null!=s?s:new u(t,e)}"undefined"!=typeof window&&window.TrustedHTML;function p(e){var t;const s=e;return d(s,null===(t=function(){var e,t;if(void 0===l)try{l=null!==(t=null===(e=h())||void 0===e?void 0:e.createPolicy(c,{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e}))&&void 0!==t?t:null}catch(e){l=null}return l}())||void 0===t?void 0:t.createHTML(s))}function f(e){var t;if(null===(t=h())||void 0===t?void 0:t.isHTML(e))return e;if(e instanceof u)return e.privateDoNotAccessOrElseWrappedHtml;throw new Error("")}"undefined"!=typeof window&&window.TrustedScriptURL;"undefined"!=typeof window&&window.TrustedScript;function _(e,t){t.appendChild(e);let s=(new XMLSerializer).serializeToString(t);return s=s.slice(s.indexOf(">")+1,s.lastIndexOf("</")),p(s)}const m=["data:","http:","https:","mailto:","ftp:"],E=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function v(e){if(!function(e){const t=!E.test(e);return t}(e))return e}function w(e){return v(e)}function b(e){const t=function(e){let t;try{t=new URL(e)}catch(e){return"https:"}return t.protocol}(e);return void 0!==t&&-1!==m.indexOf(t.toLowerCase())?e:"about:invalid#zClosurez"}function g(e,t){const s=t.createRange();s.selectNode(t.body);return function(e,t){return e.createContextualFragment(f(t))}(s,p(e))}function y(e){const t=e.nodeName;return"string"==typeof t?t:"FORM"}function A(e){return 3===e.nodeType}function T(e){const t=e.nodeType;return 1===t||"number"!=typeof t}var R,O;function P(e){try{return new URL(e,window.document.baseURI)}catch(e){return new URL("about:invalid")}}function I(e){return{valueOf:e}.valueOf()}!function(e){e[e.STYLE_TAG=0]="STYLE_TAG",e[e.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",e[e.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(R||(R={}));class N{constructor(e,t,s,r,i){this.allowedElements=e,this.elementPolicies=t,this.allowedGlobalAttributes=s,this.globalAttributePolicies=r,this.globallyAllowedAttributePrefixes=i}isAllowedElement(e){return"FORM"!==e&&(this.allowedElements.has(e)||this.elementPolicies.has(e))}getAttributePolicy(e,t){const s=this.elementPolicies.get(t);if(null==s?void 0:s.has(e))return s.get(e);if(this.allowedGlobalAttributes.has(e))return{policyAction:O.KEEP};const r=this.globalAttributePolicies.get(e);return r||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some(t=>0===e.indexOf(t))?{policyAction:O.KEEP}:{policyAction:O.DROP})}}!function(e){e[e.DROP=0]="DROP",e[e.KEEP=1]="KEEP",e[e.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",e[e.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",e[e.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(O||(O={}));const S=new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const x=["ARTICLE","SECTION","NAV","ASIDE","H1","H2","H3","H4","H5","H6","HEADER","FOOTER","ADDRESS","P","HR","PRE","BLOCKQUOTE","OL","UL","LH","LI","DL","DT","DD","FIGURE","FIGCAPTION","MAIN","DIV","EM","STRONG","SMALL","S","CITE","Q","DFN","ABBR","RUBY","RB","RT","RTC","RP","DATA","TIME","CODE","VAR","SAMP","KBD","SUB","SUP","I","B","U","MARK","BDI","BDO","SPAN","BR","WBR","INS","DEL","PICTURE","PARAM","TRACK","MAP","TABLE","CAPTION","COLGROUP","COL","TBODY","THEAD","TFOOT","TR","TD","TH","SELECT","DATALIST","OPTGROUP","OPTION","OUTPUT","PROGRESS","METER","FIELDSET","LEGEND","DETAILS","SUMMARY","MENU","DIALOG","SLOT","CANVAS","FONT","CENTER","ACRONYM","BASEFONT","BIG","DIR","HGROUP","STRIKE","TT"],L=[["A",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY,conditions:new Map([["rel",new Set(["alternate","author","bookmark","canonical","cite","help","icon","license","next","prefetch","dns-prefetch","prerender","preconnect","preload","prev","search","subresource"])]])}]])],["SOURCE",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],k=["title","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-current","aria-disabled","aria-dropeffect","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-live","aria-multiline","aria-multiselectable","aria-orientation","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","alt","align","autocapitalize","autocomplete","autocorrect","autofocus","autoplay","bgcolor","border","cellpadding","cellspacing","checked","color","cols","colspan","controls","datetime","disabled","download","draggable","enctype","face","formenctype","frameborder","height","hreflang","hidden","ismap","label","lang","loop","max","maxlength","media","minlength","min","multiple","muted","nonce","open","placeholder","preload","rel","required","reversed","role","rows","rowspan","selected","shape","size","sizes","slot","span","spellcheck","start","step","summary","translate","type","valign","value","width","wrap","itemscope","itemtype","itemid","itemprop","itemref"],C=[["dir",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["dir",new Set(["auto","ltr","rtl"])]]))}],["async",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["async",new Set(["async"])]]))}],["cite",{policyAction:O.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["loading",new Set(["eager","lazy"])]]))}],["poster",{policyAction:O.KEEP_AND_SANITIZE_URL}],["target",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["target",new Set(["_self","_blank"])]]))}]],D=new N(new Set(x),new Map(L),new Set(k),new Map(C));new N(new Set(I(()=>x.concat(["STYLE"]))),new Map(L),new Set(I(()=>k.concat(["id","name","class"]))),new Map(I(()=>C.concat([["style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}]]))));class U{constructor(e,s,r,i,n){this.sanitizerTable=e,this.styleElementSanitizer=r,this.styleAttributeSanitizer=i,this.resourceUrlPolicy=n,this.changes=[],t()}sanitizeAssertUnchanged(e){return this.sanitize(e)}sanitize(e){const t=document.implementation.createHTMLDocument("");return _(this.sanitizeToFragmentInternal(e,t),t.body)}sanitizeToFragment(e){const t=document.implementation.createHTMLDocument("");return this.sanitizeToFragmentInternal(e,t)}sanitizeToFragmentInternal(e,t){const s=g(e,t),r=document.createTreeWalker(s,5,e=>this.nodeFilter(e));let i=r.nextNode();const n=t.createDocumentFragment();let a=n;for(;null!==i;){let e;if(A(i))if(this.styleElementSanitizer&&"STYLE"===a.nodeName){const t=this.styleElementSanitizer(i.data);e=this.createTextNode(t)}else e=this.sanitizeTextNode(i);else{if(!T(i)){throw new Error("")}e=this.sanitizeElementNode(i,t)}if(a.appendChild(e),i=r.firstChild(),i)a=e;else for(;!(i=r.nextSibling())&&(i=r.parentNode());)a=a.parentNode}return n}createTextNode(e){return document.createTextNode(e)}sanitizeTextNode(e){return this.createTextNode(e.data)}sanitizeElementNode(e,t){const s=y(e),r=t.createElement(s),i=e.attributes;for(const{name:e,value:t}of i){const n=this.sanitizerTable.getAttributePolicy(e,s);if(this.satisfiesAllConditions(n.conditions,i))switch(n.policyAction){case O.KEEP:$(r,e,t);break;case O.KEEP_AND_SANITIZE_URL:const i=b(t);i!==t&&this.recordChange(`Url in attribute ${e} was modified during sanitization. Original url:"${t}" was sanitized to: "${i}"`),$(r,e,i);break;case O.KEEP_AND_NORMALIZE:$(r,e,t.toLowerCase());break;case O.KEEP_AND_SANITIZE_STYLE:if(this.styleAttributeSanitizer){$(r,e,this.styleAttributeSanitizer(t))}else $(r,e,t);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY:if(this.resourceUrlPolicy){const i={type:R.HTML_ATTRIBUTE,attributeName:e,tagName:s},n=P(t),a=this.resourceUrlPolicy(n,i);a&&$(r,e,a.toString())}else $(r,e,t);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET:if(this.resourceUrlPolicy){const i={type:R.HTML_ATTRIBUTE,attributeName:e,tagName:s},n=z(t),a={parts:[]};for(const e of n.parts){const t=P(e.url),s=this.resourceUrlPolicy(t,i);s&&a.parts.push({url:s.toString(),descriptor:e.descriptor})}$(r,e,M(a))}else $(r,e,t);break;case O.DROP:this.recordChange(`Attribute: ${e} was dropped`)}else this.recordChange(`Not all conditions satisfied for attribute: ${e}.`)}return r}nodeFilter(e){if(A(e))return 1;if(!T(e))return 2;const t=y(e);return null===t?(this.recordChange(`Node name was null for node: ${e}`),2):this.sanitizerTable.isAllowedElement(t)?1:(this.recordChange(`Element: ${t} was dropped`),2)}recordChange(e){0}satisfiesAllConditions(e,t){var s;if(!e)return!0;for(const[r,i]of e){const e=null===(s=t.getNamedItem(r))||void 0===s?void 0:s.value;if(e&&!i.has(e))return!1}return!0}}function $(e,t,s){e.setAttribute(t,s)}function z(e){const t=[];for(const s of e.split(",")){const[e,r]=s.trim().split(/\s+/,2);t.push({url:e,descriptor:r})}return{parts:t}}function M(e){return e.parts.map(e=>{const{url:t,descriptor:s}=e;return`${t}${s?` ${s}`:""}`}).join(" , ")}class F{constructor(){this.calledBuild=!1,this.sanitizerTable=D}onlyAllowElements(e){const t=new Set,s=new Map;for(let r of e){if(r=r.toUpperCase(),!this.sanitizerTable.isAllowedElement(r))throw new Error(`Element: ${r}, is not allowed by html5_contract.textpb`);const e=this.sanitizerTable.elementPolicies.get(r);void 0!==e?s.set(r,e):t.add(r)}return this.sanitizerTable=new N(t,s,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}allowCustomElement(e,t){const s=new Set(this.sanitizerTable.allowedElements),r=new Map(this.sanitizerTable.elementPolicies);if(e=e.toUpperCase(),i=e,S.has(i.toUpperCase())||!/^[a-z][-_.a-z0-9]*-[-_.a-z0-9]*$/i.test(i))throw new Error(`Element: ${e} is not a custom element`);var i;if(t){const s=new Map;for(const e of t)s.set(e,{policyAction:O.KEEP});r.set(e,s)}else s.add(e);return this.sanitizerTable=new N(s,r,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}onlyAllowAttributes(e){const t=new Set,s=new Map,r=new Map;for(const r of e)this.sanitizerTable.allowedGlobalAttributes.has(r)&&t.add(r),this.sanitizerTable.globalAttributePolicies.has(r)&&s.set(r,this.sanitizerTable.globalAttributePolicies.get(r));for(const[t,s]of this.sanitizerTable.elementPolicies.entries()){const i=new Map;for(const[t,r]of s.entries())e.has(t)&&i.set(t,r);r.set(t,i)}return this.sanitizerTable=new N(this.sanitizerTable.allowedElements,r,t,s),this}allowDataAttributes(e){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);for(const s of e){if(0!==s.indexOf("data-"))throw new Error(`data attribute: ${s} does not begin with the prefix "data-"`);t.add(s)}return this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowStyleAttributes(){const e=new Map(this.sanitizerTable.globalAttributePolicies);return e.set("style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,this.sanitizerTable.allowedGlobalAttributes,e),this}allowClassAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("class"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowIdAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("id"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowIdReferenceAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("aria-activedescendant").add("aria-controls").add("aria-labelledby").add("aria-owns").add("for").add("list"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}withResourceUrlPolicy(e){return this.resourceUrlPolicy=e,this}build(){if(this.calledBuild)throw new Error("this sanitizer has already called build");return this.calledBuild=!0,new U(this.sanitizerTable,e,void 0,void 0,this.resourceUrlPolicy)}}function G(e,t,s,r){if(0===e.length){throw new Error("")}const n=e.map(e=>i(e)),a=s.toLowerCase();if(n.every(e=>0!==a.indexOf(e)))throw new Error(`Attribute "${s}" does not match any of the allowed prefixes.`);t.setAttribute(s,r)}function K(e,t,s){return e.parseFromString(f(t),s)}Error;const H=[o`:`,o`style`,o`class`];function*W(e,t=new Set){const s=new Set,r=Array.from(e.childNodes).filter(e=>!t.has(e));for(yield e;r.length;){const e=r.shift();s.has(e)||(s.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter(e=>!t.has(e)).forEach(e=>r.push(e))}}function Y(e,t){return void 0!==e?.[t]}function B(e,t){return"function"==typeof e?.[t]}function V(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function Z(e,t){return Y(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function j(e,t,s=""){return Z(e,s+t)||(e.dataset?.[V(t)]??null)}function q(e,t,s){Y(e,"attribs")?e.attribs[t]=s:e.setAttribute?.(t,s)}function X(e,t,s){Y(e,"attribs")?e.attribs[t]=s:G(H,e,t,s)}function Q(e,t,s){switch(t){case"disabled":return void(e.disabled=s);case"selected":return void(e.selected=s);case"checked":return void(e.checked=s);default:e[t]=s}}function J(e,t){Y(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function ee(e,t,s=""){J(e,`${s}${t}`),J(e,`data-${t}`)}function te(e,t,s){if(Y(e,"attribs")&&Y(t,"attribs"))t.attribs[s]=e.attribs[s];else if(s.startsWith("data-")){const r=V(s.slice(5));t.dataset[r]=e.dataset?.[r]}else{const r=e?.getAttribute?.(s);X(t,s,r||"")}}function se(e){if(Y(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find(e=>1===e.nodeType)}function re(e,...t){if(B(e,"replaceWith"))return e.replaceWith(...t);{const s=e,r=s.parentNode,i=Array.from(r.childNodes).indexOf(s);t.forEach(e=>e.parentNode=r),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i)).concat(t).concat(Array.from(r.childNodes).slice(i+1))}}function ie(e,...t){B(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach(t=>t.parentNode=e))}function ne(e,t){return B(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function ae(e,t){return B(t,"removeChild")?e.removeChild(t):(ie(e,...Array.from(e.childNodes).filter(e=>e!==t)),t)}function oe(e,t,s){return s?B(e,"insertBefore")?e.insertBefore(t,s):(re(s,t,s),t):ne(e,t)}function le(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function ce(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map(e=>ce(e,t)).join(""):le(e.outerHTML||e.nodeValue||String(e),t)}function he(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}class ue{iterable;constructor(e){this.iterable=e}filter(e){return new ue(ue.filterGenerator(e,this.iterable))}map(e){return new ue(ue.mapGenerator(e,this.iterable))}find(e){for(const t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(const e of this.iterable)yield e}static*filterGenerator(e,t){for(const s of t)e(s)&&(yield s)}static*mapGenerator(e,t){for(const s of t)yield e(s)}static equals(e,t){const s=e[Symbol.iterator](),r=t[Symbol.iterator]();let i=s.next(),n=r.next();for(;!i.done&&!n.done;){if(i.value!==n.value)return!1;i=s.next(),n=r.next()}return i.done===n.done}}var de;!function(e){e.resolveIncludes=async function(e,t){const s=e,r=s.tagName?.toLowerCase();if(!["include","link"].includes(r))return;if("link"===r&&"subresource"!==Z(s,"rel"))return;this.log("include directive found in:\n",ce(e,128)),this.log("include params:",t);const i="link"===s.tagName.toLocaleLowerCase()?"href":"src",n=Z(s,i);if(!n)throw new Error(`"${i}" attribute missing from ${ce(e,128)}.`);const a=[];"include"===r&&a.push("src"),"link"===r&&a.push("rel","href");const o=t=>{const r=se(t);for(const e of Array.from(s.attributes))r&&!a.includes(e.name)&&te(s,r,e.name);re(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(n.includes("://")||n.startsWith("//"))this.log("Including remote file from absolute path:",n),await this.preprocessRemote(n,l).then(o);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=n.startsWith("/")?n:`${t.dirpath}/${n}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(o)}else if("/"===n.charAt(0))this.log("Including local file from absolute path:",n),await this.preprocessLocal(n,l).then(o);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${n}`:n;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(o)}},e.rebaseRelativePaths=async function(e,t){const s=e,r=s.tagName?.toLowerCase();if(!t?.dirpath)return;const i=Z(s,"src"),n=Z(s,"href"),a=i||n;if(!a||((o=a).includes("://")||o.startsWith("/")||o.startsWith("#")||o.startsWith("data:")))return;var o;const l=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",l),Y(s,"attribs")?X(s,i?"src":"href",l):"img"===r?s.src=l:"a"===r?function(e,t){const s=w(t);void 0!==s&&(e.href=s)}(s,l):"source"===r||"audio"===r||"video"===r||"track"===r||"input"===r?s.src=l:"area"===r?function(e,t){const s=w(t);void 0!==s&&(e.href=s)}(s,l):this.log("Unable to rebase relative path for element:",r)},e.registerCustomElements=async function(e,t){const s=e,r=s.tagName?.toLowerCase(),i=(Z(s,"is")||Z(s,"alt"))?.toLowerCase();if(["template","div"].includes(r)&&i){if("div"===r&&"template"!==Z(s,"role"))return;this._customElements.has(i)||(this.log(`Registering custom element: ${i}\n`,ce(s,128)),this._customElements.set(i,s),ae(s.parentNode,s))}},e.resolveCustomElements=async function(e,t){const s=e,r=s.tagName?.toLowerCase();let i=r;if("div"===i&&(i=Z(s,"role")?.toLowerCase()||i),i&&this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,ce(s,128));const t=this._customElements.get(i),n=(t.content||t).cloneNode(!0),a=se(n);if(a)for(const e of Array.from(s.attributes))"div"===r&&"role"===e.name||te(s,a,e.name);const o=new ue(W(n)).find(e=>"slot"===e.tagName?.toLowerCase());o&&re(o,...s.childNodes),re(e,...n.childNodes)}},e.resolveTextNodeExpressions=async function(e,t){const s=e.nodeValue||"";if(3!==e.nodeType||!s?.trim())return;this.log("Processing node content value:\n",le(s,128));const r=new RegExp(/{{ ([^}]+) }}/gm),i=Array.from(s.matchAll(r)).map(e=>e[1]);return this.effect(function(){let t=s;for(const s of i){const r=this.eval(s,{$elem:e});t=t.replace(`{{ ${s} }}`,String(r))}e.nodeValue=t})},e.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"data",":");if(r){this.log(":data attribute found in:\n",ce(e,128)),ee(s,"data",":");const i=t?.rootNode===e?this:this.subrenderer();e.renderer=i;const n=i.eval(r,{$elem:e});if(await Promise.all(Object.entries(n).map(([e,t])=>i._store.set(e,t))),i!==this)for(const t of W(e,this._skipNodes))this._skipNodes.add(t);await i.mount(e,t)}},e.resolveClassAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"class",":");if(r){this.log(":class attribute found in:\n",ce(e,128)),ee(s,"class",":");const t=Z(s,"class")||"";return this.effect(function(){const i=this.eval(r,{$elem:e});X(s,"class",(i?`${t} ${i}`:t).trim())})}},e.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"text",":");if(r){this.log(":text attribute found in:\n",ce(e,128)),ee(s,"text",":");const t=t=>this.textContent(e,t);return this.effect(function(){t(this.eval(r,{$elem:e}))})}},e.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"html",":");return r?(this.log(":html attribute found in:\n",ce(e,128)),ee(s,"html",":"),this.effect(function(){const i=this.eval(r,{$elem:e});return new Promise(async e=>{const r=await this.preprocessString(i,t);await this.renderNode(r),ie(s,r),e()})})):void 0},e.resolveEventAttributes=async function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[]))if(t.name.startsWith(":on:")||t.name.startsWith("data-on-")){let r="",i=[];if(t.name.startsWith(":on:")?[r,...i]=t.name.substring(4).split("."):t.name.startsWith("data-on-")&&([r,...i]=t.name.substring(8).split(".")),!r)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",ce(e,128)),ee(s,t.name);const n="submit"===r&&"FORM"===s.tagName.toUpperCase();e.addEventListener?.(r,s=>((i.includes("prevent")||n)&&s.preventDefault(),this.eval(t.value,{$elem:e,$event:s})))}},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"for",":")?.trim();if(r){this.log(":for attribute found in:\n",ce(e,128)),ee(s,"for",":");for(const t of W(e,this._skipNodes))this._skipNodes.add(t);const i=Z(s,"style")||"";q(s,"style","display: none;");const n=e.parentNode,a=this.createElement("template",e.ownerDocument);oe(n,a,e),ae(n,e),ne(a,e),this.log(":for template:\n",ce(a,128));const o=r.split(" in ",2);if(2!==o.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const l=[],[c,h]=o;await this.effect(function(){const s=this.eval(h,{$elem:e});if(this.log(":for list items:",s),l.splice(0,l.length).forEach(e=>{ae(n,e),this._skipNodes.delete(e)}),!Array.isArray(s))return console.error(`Expression did not yield a list: \`${h}\` => \`${s}\``),Promise.resolve();const r=[];for(const n of s){const s=this.subrenderer();s._store.set(c,n);const a=e.cloneNode(!0);q(a,"style",i),l.push(a),this._skipNodes.add(a),r.push(s.mount(a,t)),this.log("Rendered list child:\n",ce(a,128))}const o=a.nextSibling;for(const e of l)oe(n,e,o);return Promise.all(r)})}},e.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"bind",":");if(r){this.log(":bind attribute found in:\n",ce(e,128));const t=["change","input"],i=Z(s,":bind:on")?.split(",")||s.dataset?.bindOn?.split(",")||t;ee(s,"bind",":"),J(s,":bind:on"),J(s,"data-bind-on");const n="checkbox"===Z(s,"type")?"checked":"value";r.includes(".")||this.has(r)||this.set(r,""),this.effect(function(){const t=this.eval(r,{$elem:e});"checked"===n?s.checked=!!t:s.value=t});const a=`${r} = $elem.${n}`;for(const t of i)e.addEventListener(t,()=>this.eval(a,{$elem:e}))}},e.resolveShowAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=j(s,"show",":");if(r){this.log(":show attribute found in:\n",ce(e,128)),ee(s,"show",":");const t="none"===s.style?.display?"":s.style?.display??Z(s,"style")?.split(";")?.find(e=>"display"===e.split(":")[0])?.split(":")?.at(1)?.trim();this.effect(function(){const i=this.eval(r,{$elem:e});s.style?s.style.display=i?t:"none":X(s,"style",`display: ${i?t:"none"};`)})}},e.resolveCustomAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[])){const r=":attr:",i="data-attr-";if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,"attribute found in:\n",ce(e,128)),J(s,t.name);const n=t.name.split(r,2).at(-1)?.split(i,2).at(-1);this.effect(function(){const r=this.eval(t.value,{$elem:e});q(s,n,r)})}}},e.resolveCustomProperty=async function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[])){const r=":prop:",i="data-prop-";if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,"property found in:\n",ce(e,128)),J(s,t.name);const n=t.name.split(r,2).at(-1)?.split(i,2).at(-1),a=V(n);this.effect(function(){const r=this.eval(t.value,{$elem:e});Q(s,a,r)})}}},e.stripTypes=async function(e,t){const s=e;Z(s,":types")&&J(s,":types"),Z(s,"data-types")&&J(s,"data-types")}}(de||(de={}));const pe=new Set(["this","typeof"]),fe=new Set(["in"]),_e=new Set(["+","-","!","typeof"]),me=new Set(["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","in"]),Ee={"!":0,":":0,",":0,")":0,"]":0,"}":0,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,in:10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"?.":13,"{":13},ve={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),in:(e,t)=>e in t},we={"+":e=>e,"-":e=>-e,"!":e=>!e,typeof:e=>typeof e};const be=new Set(["==","!=","<=",">=","||","&&","??","?."]),ge=new Set(["===","!=="]);var ye;!function(e){e[e.STRING=1]="STRING",e[e.IDENTIFIER=2]="IDENTIFIER",e[e.DOT=3]="DOT",e[e.COMMA=4]="COMMA",e[e.COLON=5]="COLON",e[e.INTEGER=6]="INTEGER",e[e.DECIMAL=7]="DECIMAL",e[e.OPERATOR=8]="OPERATOR",e[e.GROUPER=9]="GROUPER",e[e.KEYWORD=10]="KEYWORD",e[e.ARROW=11]="ARROW",e[e.OPTIONAL_DOT=12]="OPTIONAL_DOT",e[e.SPREAD=13]="SPREAD"}(ye||(ye={}));const Ae=(e,t,s=0)=>({kind:e,value:t,precedence:s}),Te=e=>9===e||10===e||13===e||32===e,Re=e=>95===e||36===e||65<=(e&=-33)&&e<=90,Oe=e=>Re(e)||Pe(e),Pe=e=>48<=e&&e<=57;class Ie{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;Te(this._next);)this._advance(!0);if(34===(e=this._next)||39===e)return this._tokenizeString();var e;if(Re(this._next))return this._tokenizeIdentOrKeyword();if(Pe(this._next))return this._tokenizeNumber();if(46===this._next)return this._tokenizeDot();if(44===this._next)return this._tokenizeComma();if(58===this._next)return this._tokenizeColon();if((e=>43===e||45===e||42===e||47===e||33===e||38===e||37===e||60===e||61===e||62===e||63===e||94===e||124===e)(this._next))return this._tokenizeOperator();if((e=>40===e||41===e||91===e||93===e||123===e||125===e)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===e&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){const t=this._input.substring(this._tokenStart,this._index+e);return 0===e&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const e="unterminated string",t=this._next;for(this._advance(!0);this._next!==t;){if(void 0===this._next)throw new Error(e);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(e);this._advance()}const s=Ae(ye.STRING,this._getValue().replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return t}}));return this._advance(),s}_tokenizeIdentOrKeyword(){do{this._advance()}while(Oe(this._next));const e=this._getValue(),t=(s=e,pe.has(s)?ye.KEYWORD:fe.has(e)?ye.OPERATOR:ye.IDENTIFIER);var s;return Ae(t,e,Ee[e]??0)}_tokenizeNumber(){do{this._advance()}while(Pe(this._next));return 46===this._next?this._tokenizeDot():Ae(ye.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),Pe(this._next))return this._tokenizeFraction();if(46===this._next){if(this._advance(),46===this._next)return this._advance(),this._clearValue(),Ae(ye.SPREAD,"...");throw new Error("Unexpected token ..")}return this._clearValue(),Ae(ye.DOT,".",13)}_tokenizeComma(){return this._advance(!0),Ae(ye.COMMA,",")}_tokenizeColon(){return this._advance(!0),Ae(ye.COLON,":")}_tokenizeFraction(){do{this._advance()}while(Pe(this._next));return Ae(ye.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(ge.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),Ae(ye.ARROW,e);be.has(e)&&this._advance()}return e=this._getValue(),"?."===e?Ae(ye.OPTIONAL_DOT,e,13):Ae(ye.OPERATOR,e,Ee[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=Ae(ye.GROUPER,e,Ee[e]);return this._advance(!0),t}}class Ne{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new Ie(e),this._ast=t}parse(){this._advance();const e=this._parseExpression();if(this._token)throw new Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);const s=this._tokenizer.nextToken();this._token=s,this._kind=s?.kind,this._value=s?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();const e=this._parseUnary();return void 0===e?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(void 0===e)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(ye.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(ye.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(ye.DOT)||this._matches(ye.OPTIONAL_DOT)){const t=this._kind===ye.OPTIONAL_DOT;if(this._advance(),t&&this._matches(ye.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(ye.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{const s=this._parseUnary();e=this._makeInvokeOrGetter(e,s,t)}}else{if(this._matches(ye.KEYWORD))break;if(!(this._matches(ye.OPERATOR)&&this._token.precedence>=t))break;e="?"===this._value?this._parseTernary(e):this._parseBinary(e,this._token)}return e}_makeInvokeOrGetter(e,t,s){if(void 0===t)throw new Error("expected identifier");if("ID"===t.type)return this._ast.getter(e,t.value,s);if("Invoke"===t.type&&"ID"===t.receiver.type){const r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,s)}throw new Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!me.has(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let s=this._parseUnary();for(;(this._kind===ye.OPERATOR||this._kind===ye.DOT||this._kind===ye.GROUPER)&&this._token.precedence>t.precedence;)s=this._parsePrecedence(s,this._token.precedence);if(void 0===s)throw new Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,s)}_parseUnary(){if(this._matches(ye.KEYWORD,"typeof")){this._advance();const e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary("typeof",e)}if(this._matches(ye.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(ye.INTEGER))return this._parseInteger(e);if(this._matches(ye.DECIMAL))return this._parseDecimal(e)}if(!_e.has(e))throw new Error(`unexpected token: ${e}`);const t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(ye.OPERATOR,"?");const t=this._parseExpression();this._advance(ye.COLON);const s=this._parseExpression();return this._ast.ternary(e,t,s)}_parsePrimary(){switch(this._kind){case ye.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(pe.has(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case ye.IDENTIFIER:return this._parseInvokeOrIdentifier();case ye.STRING:return this._parseString();case ye.INTEGER:return this._parseInteger();case ye.DECIMAL:return this._parseDecimal();case ye.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case ye.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(ye.GROUPER,"]"))break;if(this._matches(ye.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(ye.COMMA));return this._advance(ye.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e=[];do{if(this._advance(),this._matches(ye.GROUPER,"}"))break;if(this._matches(ye.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{const t=this._value;(this._matches(ye.STRING)||this._matches(ye.IDENTIFIER))&&this._advance(),this._advance(ye.COLON);const s=this._parseExpression();s&&e.push(this._ast.property(t,s))}}while(this._matches(ye.COMMA));return this._advance(ye.GROUPER,"}"),this._ast.map(e)}_parseInvokeOrIdentifier(){const e=this._value;if("true"===e)return this._advance(),this._ast.literal(!0);if("false"===e)return this._advance(),this._ast.literal(!1);if("null"===e)return this._advance(),this._ast.literal(null);if("undefined"===e)return this._advance(),this._ast.literal(void 0);const t=this._parseIdentifier(),s=this._parseArguments();return s?this._ast.invoke(t,void 0,s):t}_parseIdentifier(){if(!this._matches(ye.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(ye.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(ye.GROUPER,")"))break;if(this._matches(ye.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{const t=this._parseExpression();e.push(t)}}while(this._matches(ye.COMMA));return this._advance(ye.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(ye.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(ye.ARROW)){this._advance();const t=this._parseExpression(),s=e?.map(e=>e.value)??[];return this._ast.arrowFunction(s,t)}return this._ast.paren(e[0])}_parseString(){const e=this._ast.literal(this._value);return this._advance(),e}_parseInteger(e=""){const t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=""){const t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}}class Se{timeouts=new Map;debounce(e,t){return new Promise((s,r)=>{const i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{s(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}}const xe=new class{empty(){return{type:"Empty",evaluate:e=>e,getIds:e=>e}}literal(e){return{type:"Literal",value:e,evaluate(e){return this.value},getIds:e=>e}}id(e){return{type:"ID",value:e,evaluate(e){return"this"===this.value?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){const s=we[e];return{type:"Unary",operator:e,child:t,evaluate(e){return s(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,s){const r=ve[t];return{type:"Binary",operator:t,left:e,right:s,evaluate(e){if("="===this.operator){if("ID"!==this.left.type&&"Getter"!==this.left.type&&"Index"!==this.left.type)throw new Error(`Invalid assignment target: ${this.left}`);const t=this.right.evaluate(e);let s,r;return"Getter"===this.left.type?(s=this.left.receiver.evaluate(e),r=this.left.name):"Index"===this.left.type?(s=this.left.receiver.evaluate(e),r=String(this.left.argument.evaluate(e))):"ID"===this.left.type&&(s=e,r=this.left.value),void 0===s?void 0:s[r]=t}return r(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t,s){return{type:"Getter",receiver:e,name:t,optional:s,evaluate(e){const t=this.receiver.evaluate(e);if(!this.optional||null!=t)return t?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,s,r){if(null!=t&&"string"!=typeof t)throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:s,optional:r,evaluate(e){const t=this.receiver.evaluate(e);if(this.optional&&null==t)return;const s=this.method?t:e?.this??e,r=this.method?t?.[this.method]:t,i=this.arguments??[],n=[];for(const t of i)if("SpreadElement"===t?.type){const s=t.evaluate(e);s&&"function"==typeof s[Symbol.iterator]&&n.push(...s)}else n.push(t?.evaluate(e));return r?.apply?.(s,n)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach(t=>t?.getIds(e)),e}}}paren(e){return e}index(e,t,s){return{type:"Index",receiver:e,argument:t,optional:s,evaluate(e){const t=this.receiver.evaluate(e);if(this.optional&&null==t)return;const s=this.argument.evaluate(e);return t?.[s]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,s){return{type:"Ternary",condition:e,trueExpr:t,falseExpr:s,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:"Map",properties:e,evaluate(t){const s={};if(e&&this.properties)for(const e of this.properties)"SpreadProperty"===e.type?Object.assign(s,e.evaluate(t)):s[e.key]=e.value.evaluate(t);return s},getIds(t){if(e&&this.properties)for(const e of this.properties)"SpreadProperty"===e.type?e.expression.getIds(t):e.value.getIds(t);return t}}}property(e,t){return{type:"Property",key:e,value:t,evaluate(e){return this.value.evaluate(e)},getIds(e){return this.value.getIds(e)}}}list(e){return{type:"List",items:e,evaluate(e){if(!this.items)return[];const t=[];for(const s of this.items)if("SpreadElement"===s?.type){const r=s.evaluate(e);r&&"function"==typeof r[Symbol.iterator]&&t.push(...r)}else t.push(s?.evaluate(e));return t},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(e){const t=this.params,s=this.body;return function(...r){const i=Object.fromEntries(t.map((e,t)=>[e,r[t]])),n=new Proxy(e??{},{set:(e,t,s)=>(i.hasOwnProperty(t)&&(i[t]=s),e[t]=s),get:(e,t)=>i.hasOwnProperty(t)?i[t]:e[t]});return s.evaluate(n)}},getIds(e){return this.body.getIds(e).filter(e=>!this.params.includes(e))}}}spreadProperty(e){return{type:"SpreadProperty",expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}spreadElement(e){return{type:"SpreadElement",expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}},Le="__is_proxy__";function ke(e,t){const s=e?._store;return s?.has(t)?s.get(t):s?.has("$parent")?ke(s.get("$parent"),t):null}function Ce(e,t){const s=e?._store;return s?.has(t)?e:s?.has("$parent")?Ce(s.get("$parent"),t):null}class De extends Se{evalkeys=["$elem","$event"];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_observer=null;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(const[t,s]of Object.entries(e||{}))this.set(t,s)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return null==e||((s=e)instanceof De||!0===s[Le])||e.constructor!==Object&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,s)=>"string"==typeof s&&s in e&&(delete e[s],t(),!0),set:(e,s,r,i)=>{"object"==typeof r&&null!==r&&(r=this.wrapObject(r,t));const n=Reflect.set(e,s,r,i);return t(),n},get:(e,t,s)=>t===Le||Reflect.get(e,t,s)});var s}watch(e,t){const s=Ce(this,e);if(!s)throw new Error(`Cannot watch key "${e}" as it does not exist in the store.`);s.observers.has(e)||s.observers.set(e,new Set),s.observers.get(e)?.has(t)||s.observers.get(e)?.add(t)}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e).add(t)}async notify(e,t=10){const s=Ce(this,e),r=Array.from(s?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.call(this.proxify(e)))))}get(e,t){return t&&this.watch(e,t),ke(this,e)}async set(e,t){if(t===this._store.get(e))return;const s=()=>this.notify(e);t&&"function"==typeof t&&(t=this.wrapFunction(t)),t&&"object"==typeof t&&(t=this.wrapObject(t,s)),function(e,t,s){const r=Ce(e,t);r?r._store.set(t,s):e._store.set(t,s)}(this,e,t);for(const[s,r]of this.keyHandlers.entries())if(s.test(e))for(const s of r)await Promise.resolve(s.call(this.$,e,t));await s()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}effect(e){return e.call(this.proxify(e))}proxify(e){const t=Array.from(this._store.entries()).map(([e])=>e),s=Object.fromEntries(t.map(e=>[e,null]));return new Proxy(s,{has:(e,t)=>{if("string"==typeof t){if(Ce(this,t))return!0;if(Reflect.has(this,t))return!0}return Reflect.has(s,t)},get:(t,s,r)=>"string"==typeof s&&Ce(this,s)?this.get(s,e):"$"===s?this.proxify(e):Reflect.get(this,s,r),set:(e,t,s,r)=>("string"!=typeof t||t in this?Reflect.set(this,t,s,r):this.set(t,s),!0)})}get $(){return this.proxify()}makeEvalFunction(e){if(e.includes(";"))throw new Error("Complex expressions are not supported.");return(t,s)=>{const r=((e,t)=>new Ne(e,t).parse())(e,xe),i=new Proxy(s,{has:(e,s)=>s in e||s in t||s in globalThis,get(e,s){if("string"==typeof s)return s in e?e[s]:s in t?t[s]:globalThis[s]},set:(e,s,r)=>"string"==typeof s&&(s in e?(e[s]=r,!0):(t[s]=r,!0))});return r?.evaluate(i)}}cachedExpressionFunction(e){return e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e)),this.expressionCache.get(e)}eval(e,t={}){const s=this._observer?this:this.$;if(this._store.has(e))return s[e];{const r=this.cachedExpressionFunction(e);try{return r(s,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){const s={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{s.$result=e}).catch(e=>{s.$error=e instanceof Error?e:new Error(String(e))}).finally(()=>{s.$pending=!1}),s}}const Ue="$$";function $e(){return new URL(globalThis.window?.location?.href||"http://localhost/")}function ze(e){return`${Ue}${e}`}function Me(e){return e.keys().filter(e=>e.startsWith(Ue))}function Fe(e,t,s){const r=function(e){return e.substring(2)}(t);let i=!1;if(s){const t=String(s);e.searchParams.get(r)!==t&&(e.searchParams.set(r,t),i=!0)}else e.searchParams.has(r)&&(e.searchParams.delete(r),i=!0);return i}async function Ge(e){const t=$e();await async function(e,t){for(const[s,r]of t.searchParams.entries()){const t=ze(s);e.get(t)!==r&&await e.set(t,r)}}(e,t),function(e,t){let s=!1;for(const r of Me(t))Fe(e,r,t.get(r))&&(s=!0);s&&globalThis.window?.history?.replaceState({},"",e.toString())}(t,e),e.addKeyHandler(new RegExp("^\\$\\$"),(e,t)=>{const s=$e();Fe(s,e,t)&&globalThis.window?.history?.replaceState({},"",s.toString())}),globalThis.window?.addEventListener("popstate",function(e){return async()=>{const t=$e(),s=new Set;for(const[r,i]of t.searchParams.entries()){const t=ze(r);s.add(t),e.get(t)!==i&&e.set(t,i)}const r=Me(e);for(const t of r)s.has(t)||e.del(t)}}(e))}class Ke extends De{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(e){return this.debugging=e,this}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??"default"}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log("Preprocessing string content with params:\n",t);const s=this.parseHTML(e,t);return await this.preprocessNode(s,t),s}async preprocessRemote(e,t){const s={};t?.cache&&(s.cache=t.cache);const r=await fetch(e,s).then(e=>e.text());return this.preprocessString(r,{...t,dirpath:he(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}async preprocessLocal(e,t){const s=await this.fetchLocal(e,t);return this.preprocessString(s,{...t,dirpath:he(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e._store.set("$parent",this),e._store.set("$rootRenderer",this.get("$rootRenderer")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const s=new ue(W(e,this._skipNodes)).map(async e=>{this.log("Preprocessing node:\n",ce(e,128)),await de.resolveIncludes.call(this,e,t),await de.rebaseRelativePaths.call(this,e,t),await de.registerCustomElements.call(this,e,t),await de.resolveCustomElements.call(this,e,t)});return await Promise.all(s.generator()),e}async renderNode(e,t){for(const s of W(e,this._skipNodes))this.log("Rendering node:\n",ce(s,128)),await de.resolveForAttribute.call(this,s,t),await de.resolveDataAttribute.call(this,s,t),await de.resolveTextAttributes.call(this,s,t),await de.resolveHtmlAttribute.call(this,s,t),await de.resolveShowAttribute.call(this,s,t),await de.resolveClassAttribute.call(this,s,t),await de.resolveBindAttribute.call(this,s,t),await de.resolveEventAttributes.call(this,s,t),await de.resolveTextNodeExpressions.call(this,s,t),await de.resolveCustomAttribute.call(this,s,t),await de.resolveCustomProperty.call(this,s,t),await de.stripTypes.call(this,s,t);return e}async mount(e,t){t={...t,rootNode:e},Q(e,"renderer",this),this._store.set("$rootNode",e),this.has("$rootRenderer")||this._store.set("$rootRenderer",this),this.get("$rootRenderer")===this&&await Ge(this),await this.preprocessNode(e,t),await this.renderNode(e,t)}}const He=[":data",":for",":text",":html",":show",":class",":bind",":on:click",":on:click.prevent",":on:input",":on:input.prevent",":on:change",":on:change.prevent",":on:submit",":on:submit.prevent",":attr:src",":attr:href",":attr:title",":prop:checked",":prop:selected",":prop:disabled"],We=[...He.map(e=>(e=>`data-${e.slice(1).replace(":","-")}`)(e)),"data-testid"];class Ye extends Ke{impl="safe_browser";dirpath=he(globalThis.location?.href??"http://localhost/");parseHTML(e,t={rootDocument:!1}){for(const t of He)e=e.replace(new RegExp(`\\s:${t.slice(1)}=`,"g"),` data-${t.slice(1).replace(":","-")}=`);e=(e=(e=e.replace(/<include(.*) src="([^"]+)"(.*)><\/include>/g,'<link $1 rel="subresource" href="$2" $3>')).replace(/<template is="([^"]+)">([\s\S]*)<\/template>/g,'<div role="template" alt="$1">$2</div>')).replace(/<(\w+)-(\w+)(.*)>([\s\S]*)<\/(\w+)-(\w+)>/g,'<div role="$1-$2" $3>$4</div>');const s=(new F).allowDataAttributes(We).allowClassAttributes().allowStyleAttributes().build();if(this.log("parseHTML",e),this.log("sanitized",String(s.sanitize(e))),t.rootDocument){return K(new DOMParser,s.sanitize(e),"text/html")}return s.sanitizeToFragment(e)}serializeHTML(e){return(new XMLSerializer).serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}textContent(e,t){e.textContent=t}}const Be=new Ye;export{Be as Mancha,Ye as Renderer};
1
+ const e={};function t(e){0}class s{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const r=s;function i(e){if(function(e){return e instanceof s}(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}function n(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function a(e){return-1===e.toString().indexOf("`")}a(e=>e``)||a(e=>e`\0`)||a(e=>e`\n`)||a(e=>e`\u0000`),n``&&n`\0`&&n`\n`&&n`\u0000`;function o(t){const s=t[0].toLowerCase();return new r(e,s)}let l,c="google#safe";function h(){var e;return""!==c&&null!==(e=function(){if("undefined"!=typeof window)return window.trustedTypes}())&&void 0!==e?e:null}class u{constructor(e,s){t(),this.privateDoNotAccessOrElseWrappedHtml=e}toString(){return this.privateDoNotAccessOrElseWrappedHtml.toString()}}function d(t,s){return null!=s?s:new u(t,e)}"undefined"!=typeof window&&window.TrustedHTML;function p(e){var t;const s=e;return d(s,null===(t=function(){var e,t;if(void 0===l)try{l=null!==(t=null===(e=h())||void 0===e?void 0:e.createPolicy(c,{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e}))&&void 0!==t?t:null}catch(e){l=null}return l}())||void 0===t?void 0:t.createHTML(s))}function f(e){var t;if(null===(t=h())||void 0===t?void 0:t.isHTML(e))return e;if(e instanceof u)return e.privateDoNotAccessOrElseWrappedHtml;throw new Error("")}"undefined"!=typeof window&&window.TrustedScriptURL;"undefined"!=typeof window&&window.TrustedScript;function _(e,t){t.appendChild(e);let s=(new XMLSerializer).serializeToString(t);return s=s.slice(s.indexOf(">")+1,s.lastIndexOf("</")),p(s)}const m=["data:","http:","https:","mailto:","ftp:"],E=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function v(e){if(!function(e){const t=!E.test(e);return t}(e))return e}function w(e){return v(e)}function b(e){const t=function(e){let t;try{t=new URL(e)}catch(e){return"https:"}return t.protocol}(e);return void 0!==t&&-1!==m.indexOf(t.toLowerCase())?e:"about:invalid#zClosurez"}function g(e,t){const s=t.createRange();s.selectNode(t.body);return function(e,t){return e.createContextualFragment(f(t))}(s,p(e))}function y(e){const t=e.nodeName;return"string"==typeof t?t:"FORM"}function A(e){return 3===e.nodeType}function R(e){const t=e.nodeType;return 1===t||"number"!=typeof t}var T,O;function P(e){try{return new URL(e,window.document.baseURI)}catch(e){return new URL("about:invalid")}}function I(e){return{valueOf:e}.valueOf()}!function(e){e[e.STYLE_TAG=0]="STYLE_TAG",e[e.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",e[e.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(T||(T={}));class N{constructor(e,t,s,r,i){this.allowedElements=e,this.elementPolicies=t,this.allowedGlobalAttributes=s,this.globalAttributePolicies=r,this.globallyAllowedAttributePrefixes=i}isAllowedElement(e){return"FORM"!==e&&(this.allowedElements.has(e)||this.elementPolicies.has(e))}getAttributePolicy(e,t){const s=this.elementPolicies.get(t);if(null==s?void 0:s.has(e))return s.get(e);if(this.allowedGlobalAttributes.has(e))return{policyAction:O.KEEP};const r=this.globalAttributePolicies.get(e);return r||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some(t=>0===e.indexOf(t))?{policyAction:O.KEEP}:{policyAction:O.DROP})}}!function(e){e[e.DROP=0]="DROP",e[e.KEEP=1]="KEEP",e[e.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",e[e.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",e[e.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(O||(O={}));const S=new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const x=["ARTICLE","SECTION","NAV","ASIDE","H1","H2","H3","H4","H5","H6","HEADER","FOOTER","ADDRESS","P","HR","PRE","BLOCKQUOTE","OL","UL","LH","LI","DL","DT","DD","FIGURE","FIGCAPTION","MAIN","DIV","EM","STRONG","SMALL","S","CITE","Q","DFN","ABBR","RUBY","RB","RT","RTC","RP","DATA","TIME","CODE","VAR","SAMP","KBD","SUB","SUP","I","B","U","MARK","BDI","BDO","SPAN","BR","WBR","INS","DEL","PICTURE","PARAM","TRACK","MAP","TABLE","CAPTION","COLGROUP","COL","TBODY","THEAD","TFOOT","TR","TD","TH","SELECT","DATALIST","OPTGROUP","OPTION","OUTPUT","PROGRESS","METER","FIELDSET","LEGEND","DETAILS","SUMMARY","MENU","DIALOG","SLOT","CANVAS","FONT","CENTER","ACRONYM","BASEFONT","BIG","DIR","HGROUP","STRIKE","TT"],k=[["A",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY,conditions:new Map([["rel",new Set(["alternate","author","bookmark","canonical","cite","help","icon","license","next","prefetch","dns-prefetch","prerender","preconnect","preload","prev","search","subresource"])]])}]])],["SOURCE",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],L=["title","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-current","aria-disabled","aria-dropeffect","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-live","aria-multiline","aria-multiselectable","aria-orientation","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","alt","align","autocapitalize","autocomplete","autocorrect","autofocus","autoplay","bgcolor","border","cellpadding","cellspacing","checked","color","cols","colspan","controls","datetime","disabled","download","draggable","enctype","face","formenctype","frameborder","height","hreflang","hidden","ismap","label","lang","loop","max","maxlength","media","minlength","min","multiple","muted","nonce","open","placeholder","preload","rel","required","reversed","role","rows","rowspan","selected","shape","size","sizes","slot","span","spellcheck","start","step","summary","translate","type","valign","value","width","wrap","itemscope","itemtype","itemid","itemprop","itemref"],C=[["dir",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["dir",new Set(["auto","ltr","rtl"])]]))}],["async",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["async",new Set(["async"])]]))}],["cite",{policyAction:O.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["loading",new Set(["eager","lazy"])]]))}],["poster",{policyAction:O.KEEP_AND_SANITIZE_URL}],["target",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I(()=>new Map([["target",new Set(["_self","_blank"])]]))}]],D=new N(new Set(x),new Map(k),new Set(L),new Map(C));new N(new Set(I(()=>x.concat(["STYLE"]))),new Map(k),new Set(I(()=>L.concat(["id","name","class"]))),new Map(I(()=>C.concat([["style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}]]))));class ${constructor(e,s,r,i,n){this.sanitizerTable=e,this.styleElementSanitizer=r,this.styleAttributeSanitizer=i,this.resourceUrlPolicy=n,this.changes=[],t()}sanitizeAssertUnchanged(e){return this.sanitize(e)}sanitize(e){const t=document.implementation.createHTMLDocument("");return _(this.sanitizeToFragmentInternal(e,t),t.body)}sanitizeToFragment(e){const t=document.implementation.createHTMLDocument("");return this.sanitizeToFragmentInternal(e,t)}sanitizeToFragmentInternal(e,t){const s=g(e,t),r=document.createTreeWalker(s,5,e=>this.nodeFilter(e));let i=r.nextNode();const n=t.createDocumentFragment();let a=n;for(;null!==i;){let e;if(A(i))if(this.styleElementSanitizer&&"STYLE"===a.nodeName){const t=this.styleElementSanitizer(i.data);e=this.createTextNode(t)}else e=this.sanitizeTextNode(i);else{if(!R(i)){throw new Error("")}e=this.sanitizeElementNode(i,t)}if(a.appendChild(e),i=r.firstChild(),i)a=e;else for(;!(i=r.nextSibling())&&(i=r.parentNode());)a=a.parentNode}return n}createTextNode(e){return document.createTextNode(e)}sanitizeTextNode(e){return this.createTextNode(e.data)}sanitizeElementNode(e,t){const s=y(e),r=t.createElement(s),i=e.attributes;for(const{name:e,value:t}of i){const n=this.sanitizerTable.getAttributePolicy(e,s);if(this.satisfiesAllConditions(n.conditions,i))switch(n.policyAction){case O.KEEP:U(r,e,t);break;case O.KEEP_AND_SANITIZE_URL:const i=b(t);i!==t&&this.recordChange(`Url in attribute ${e} was modified during sanitization. Original url:"${t}" was sanitized to: "${i}"`),U(r,e,i);break;case O.KEEP_AND_NORMALIZE:U(r,e,t.toLowerCase());break;case O.KEEP_AND_SANITIZE_STYLE:if(this.styleAttributeSanitizer){U(r,e,this.styleAttributeSanitizer(t))}else U(r,e,t);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY:if(this.resourceUrlPolicy){const i={type:T.HTML_ATTRIBUTE,attributeName:e,tagName:s},n=P(t),a=this.resourceUrlPolicy(n,i);a&&U(r,e,a.toString())}else U(r,e,t);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET:if(this.resourceUrlPolicy){const i={type:T.HTML_ATTRIBUTE,attributeName:e,tagName:s},n=z(t),a={parts:[]};for(const e of n.parts){const t=P(e.url),s=this.resourceUrlPolicy(t,i);s&&a.parts.push({url:s.toString(),descriptor:e.descriptor})}U(r,e,M(a))}else U(r,e,t);break;case O.DROP:this.recordChange(`Attribute: ${e} was dropped`)}else this.recordChange(`Not all conditions satisfied for attribute: ${e}.`)}return r}nodeFilter(e){if(A(e))return 1;if(!R(e))return 2;const t=y(e);return null===t?(this.recordChange(`Node name was null for node: ${e}`),2):this.sanitizerTable.isAllowedElement(t)?1:(this.recordChange(`Element: ${t} was dropped`),2)}recordChange(e){0}satisfiesAllConditions(e,t){var s;if(!e)return!0;for(const[r,i]of e){const e=null===(s=t.getNamedItem(r))||void 0===s?void 0:s.value;if(e&&!i.has(e))return!1}return!0}}function U(e,t,s){e.setAttribute(t,s)}function z(e){const t=[];for(const s of e.split(",")){const[e,r]=s.trim().split(/\s+/,2);t.push({url:e,descriptor:r})}return{parts:t}}function M(e){return e.parts.map(e=>{const{url:t,descriptor:s}=e;return`${t}${s?` ${s}`:""}`}).join(" , ")}class F{constructor(){this.calledBuild=!1,this.sanitizerTable=D}onlyAllowElements(e){const t=new Set,s=new Map;for(let r of e){if(r=r.toUpperCase(),!this.sanitizerTable.isAllowedElement(r))throw new Error(`Element: ${r}, is not allowed by html5_contract.textpb`);const e=this.sanitizerTable.elementPolicies.get(r);void 0!==e?s.set(r,e):t.add(r)}return this.sanitizerTable=new N(t,s,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}allowCustomElement(e,t){const s=new Set(this.sanitizerTable.allowedElements),r=new Map(this.sanitizerTable.elementPolicies);if(e=e.toUpperCase(),i=e,S.has(i.toUpperCase())||!/^[a-z][-_.a-z0-9]*-[-_.a-z0-9]*$/i.test(i))throw new Error(`Element: ${e} is not a custom element`);var i;if(t){const s=new Map;for(const e of t)s.set(e,{policyAction:O.KEEP});r.set(e,s)}else s.add(e);return this.sanitizerTable=new N(s,r,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}onlyAllowAttributes(e){const t=new Set,s=new Map,r=new Map;for(const r of e)this.sanitizerTable.allowedGlobalAttributes.has(r)&&t.add(r),this.sanitizerTable.globalAttributePolicies.has(r)&&s.set(r,this.sanitizerTable.globalAttributePolicies.get(r));for(const[t,s]of this.sanitizerTable.elementPolicies.entries()){const i=new Map;for(const[t,r]of s.entries())e.has(t)&&i.set(t,r);r.set(t,i)}return this.sanitizerTable=new N(this.sanitizerTable.allowedElements,r,t,s),this}allowDataAttributes(e){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);for(const s of e){if(0!==s.indexOf("data-"))throw new Error(`data attribute: ${s} does not begin with the prefix "data-"`);t.add(s)}return this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowStyleAttributes(){const e=new Map(this.sanitizerTable.globalAttributePolicies);return e.set("style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,this.sanitizerTable.allowedGlobalAttributes,e),this}allowClassAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("class"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowIdAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("id"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowIdReferenceAttributes(){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);return e.add("aria-activedescendant").add("aria-controls").add("aria-labelledby").add("aria-owns").add("for").add("list"),this.sanitizerTable=new N(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}withResourceUrlPolicy(e){return this.resourceUrlPolicy=e,this}build(){if(this.calledBuild)throw new Error("this sanitizer has already called build");return this.calledBuild=!0,new $(this.sanitizerTable,e,void 0,void 0,this.resourceUrlPolicy)}}function G(e,t,s,r){if(0===e.length){throw new Error("")}const n=e.map(e=>i(e)),a=s.toLowerCase();if(n.every(e=>0!==a.indexOf(e)))throw new Error(`Attribute "${s}" does not match any of the allowed prefixes.`);t.setAttribute(s,r)}function K(e,t,s){return e.parseFromString(f(t),s)}Error;const H=[o`:`,o`style`,o`class`];function*W(e,t=new Set){const s=new Set,r=Array.from(e.childNodes).filter(e=>!t.has(e));for(yield e;r.length;){const e=r.shift();s.has(e)||(s.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter(e=>!t.has(e)).forEach(e=>r.push(e))}}function Y(e,t){return void 0!==e?.[t]}function B(e,t){return"function"==typeof e?.[t]}function V(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function Z(e,t){return Y(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function j(e,t){return Y(e,"attribs")?t in(e.attribs||{}):e.hasAttribute?.(t)??!1}function q(e,t,s=""){return Z(e,s+t)||Z(e,`data-${t}`)||(e.dataset?.[V(t)]??null)}function X(e,t,s){Y(e,"attribs")?e.attribs[t]=s:e.setAttribute?.(t,s)}function Q(e,t,s){Y(e,"attribs")?e.attribs[t]=s:G(H,e,t,s)}function J(e,t,s){switch(t){case"disabled":return void(e.disabled=s);case"selected":return void(e.selected=s);case"checked":return void(e.checked=s);default:e[t]=s}}function ee(e,t){Y(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function te(e,t,s=""){ee(e,`${s}${t}`),ee(e,`data-${t}`)}function se(e,t,s){if(Y(e,"attribs")&&Y(t,"attribs"))t.attribs[s]=e.attribs[s];else if(s.startsWith("data-")){const r=V(s.slice(5));t.dataset[r]=e.dataset?.[r]}else{const r=e?.getAttribute?.(s);Q(t,s,r||"")}}function re(e){if(Y(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find(e=>1===e.nodeType)}function ie(e,...t){if(B(e,"replaceWith"))return e.replaceWith(...t);{const s=e,r=s.parentNode,i=Array.from(r.childNodes).indexOf(s);t.forEach(e=>e.parentNode=r),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i)).concat(t).concat(Array.from(r.childNodes).slice(i+1))}}function ne(e,...t){B(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach(t=>t.parentNode=e))}function ae(e,t){return B(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function oe(e,t){return B(t,"removeChild")?e.removeChild(t):(ne(e,...Array.from(e.childNodes).filter(e=>e!==t)),t)}function le(e,t,s){return s?B(e,"insertBefore")?e.insertBefore(t,s):(ie(s,t,s),t):ae(e,t)}function ce(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function he(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map(e=>he(e,t)).join(""):ce(e.outerHTML||e.nodeValue||String(e),t)}function ue(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}class de{iterable;constructor(e){this.iterable=e}filter(e){return new de(de.filterGenerator(e,this.iterable))}map(e){return new de(de.mapGenerator(e,this.iterable))}find(e){for(const t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(const e of this.iterable)yield e}static*filterGenerator(e,t){for(const s of t)e(s)&&(yield s)}static*mapGenerator(e,t){for(const s of t)yield e(s)}static equals(e,t){const s=e[Symbol.iterator](),r=t[Symbol.iterator]();let i=s.next(),n=r.next();for(;!i.done&&!n.done;){if(i.value!==n.value)return!1;i=s.next(),n=r.next()}return i.done===n.done}}var pe;!function(e){e.resolveIncludes=async function(e,t){const s=e,r=s.tagName?.toLowerCase();if(!["include","link"].includes(r))return;if("link"===r&&"subresource"!==Z(s,"rel"))return;this.log("include directive found in:\n",he(e,128)),this.log("include params:",t);const i="link"===s.tagName.toLocaleLowerCase()?"href":"src",n=Z(s,i);if(!n)throw new Error(`"${i}" attribute missing from ${he(e,128)}.`);const a=[];"include"===r&&a.push("src"),"link"===r&&a.push("rel","href");const o=t=>{const r=re(t);for(const e of Array.from(s.attributes))r&&!a.includes(e.name)&&se(s,r,e.name);ie(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(n.includes("://")||n.startsWith("//"))this.log("Including remote file from absolute path:",n),await this.preprocessRemote(n,l).then(o);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=n.startsWith("/")?n:`${t.dirpath}/${n}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(o)}else if("/"===n.charAt(0))this.log("Including local file from absolute path:",n),await this.preprocessLocal(n,l).then(o);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${n}`:n;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(o)}},e.rebaseRelativePaths=function(e,t){const s=e,r=s.tagName?.toLowerCase();if(!t?.dirpath)return;const i=Z(s,"src"),n=Z(s,"href"),a=q(s,"render",":"),o=i||n||a;if(!o||((l=o).includes("://")||l.startsWith("/")||l.startsWith("#")||l.startsWith("data:")))return;var l;const c=`${t.dirpath}/${o}`;this.log("Rebasing relative path as:",c),a?function(e,t,s,r=""){j(e,`${r}${t}`)?X(e,`${r}${t}`,s):j(e,`data-${t}`)?X(e,`data-${t}`,s):X(e,`${r}${t}`,s)}(s,"render",c,":"):Y(s,"attribs")?Q(s,i?"src":"href",c):"img"===r?s.src=c:"a"===r?function(e,t){const s=w(t);void 0!==s&&(e.href=s)}(s,c):"source"===r||"audio"===r||"video"===r||"track"===r||"input"===r?s.src=c:"area"===r?function(e,t){const s=w(t);void 0!==s&&(e.href=s)}(s,c):this.log("Unable to rebase relative path for element:",r)},e.registerCustomElements=function(t,s){const r=t,i=r.tagName?.toLowerCase(),n=(Z(r,"is")||Z(r,"alt"))?.toLowerCase();if(["template","div"].includes(i)&&n){if("div"===i&&"template"!==Z(r,"role"))return;if(!this._customElements.has(n)){this.log(`Registering custom element: ${n}\n`,he(r,128));const t=r.content||r,i=Array.from(W(t));for(let t=1;t<i.length;t++)e.rebaseRelativePaths.call(this,i[t],s);this._customElements.set(n,r),oe(r.parentNode,r)}}},e.resolveCustomElements=function(e,t){const s=e,r=s.tagName?.toLowerCase();let i=r;if("div"===i&&(i=Z(s,"role")?.toLowerCase()||i),i&&this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,he(s,128));const t=this._customElements.get(i),n=(t.content||t).cloneNode(!0),a=re(n);if(a)for(const e of Array.from(s.attributes))"div"===r&&"role"===e.name||se(s,a,e.name);const o=new de(W(n)).find(e=>"slot"===e.tagName?.toLowerCase());o&&ie(o,...s.childNodes),ie(e,...n.childNodes)}},e.resolveTextNodeExpressions=function(e,t){const s=e.nodeValue||"";if(3!==e.nodeType||!s?.trim())return;this.log("Processing node content value:\n",ce(s,128));const r=new RegExp(/{{ ([^}]+) }}/gm),i=Array.from(s.matchAll(r)).map(e=>e[1]);return this.effect(function(){let t=s;for(const s of i){const r=this.eval(s,{$elem:e});t=t.replace(`{{ ${s} }}`,String(r))}e.nodeValue=t})},e.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"data",":");if(r){let i;this.log(":data attribute found in:\n",he(e,128)),te(s,"data",":"),Y(e,"renderer")?(i=e.renderer,this.log("Reusing existing subrenderer for node:",he(e,64))):(i=this.subrenderer(),J(e,"renderer",i),this.log("Created and attached new subrenderer for node:",he(e,64)));const n=i.eval(r,{$elem:e});if(await Promise.all(Object.entries(n).map(([e,t])=>i._store.set(e,t))),i===this)return;for(const t of W(e,this._skipNodes))this._skipNodes.add(t);await i.mount(e,t)}},e.resolveClassAttribute=function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"class",":");if(r){this.log(":class attribute found in:\n",he(e,128)),te(s,"class",":");const t=Z(s,"class")||"";return this.effect(function(){const i=this.eval(r,{$elem:e});Q(s,"class",(i?`${t} ${i}`:t).trim())})}},e.resolveTextAttributes=function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"text",":");if(r){this.log(":text attribute found in:\n",he(e,128)),te(s,"text",":");const t=t=>this.textContent(e,t);return this.effect(function(){t(this.eval(r,{$elem:e}))})}},e.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"html",":");return r?(this.log(":html attribute found in:\n",he(e,128)),te(s,"html",":"),this.effect(function(){const i=this.eval(r,{$elem:e});return new Promise(async e=>{const r=await this.preprocessString(i,t);await this.renderNode(r),ne(s,r),e()})})):void 0},e.resolveEventAttributes=function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[]))if(t.name.startsWith(":on:")||t.name.startsWith("data-on-")){let r="",i=[];if(t.name.startsWith(":on:")?[r,...i]=t.name.substring(4).split("."):t.name.startsWith("data-on-")&&([r,...i]=t.name.substring(8).split(".")),!r)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",he(e,128)),te(s,t.name);const n="submit"===r&&"FORM"===s.tagName.toUpperCase();e.addEventListener?.(r,s=>((i.includes("prevent")||n)&&s.preventDefault(),this.eval(t.value,{$elem:e,$event:s})))}},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"for",":")?.trim();if(r){this.log(":for attribute found in:\n",he(e,128)),te(s,"for",":");for(const t of W(e,this._skipNodes))this._skipNodes.add(t);const i=Z(s,"style")||"";X(s,"style","display: none;");const n=e.parentNode,a=this.createElement("template",e.ownerDocument);le(n,a,e),oe(n,e),ae(a,e),this.log(":for template:\n",he(a,128));const o=r.split(" in ",2);if(2!==o.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const l=[],[c,h]=o;await this.effect(function(){const s=this.eval(h,{$elem:e});if(this.log(":for list items:",s),l.splice(0,l.length).forEach(e=>{oe(n,e),this._skipNodes.delete(e)}),!Array.isArray(s))return console.error(`Expression did not yield a list: \`${h}\` => \`${s}\``),Promise.resolve();const r=[];for(const n of s){const s=this.subrenderer();s._store.set(c,n);const a=e.cloneNode(!0);X(a,"style",i),l.push(a),this._skipNodes.add(a),r.push(s.mount(a,t)),this.log("Rendered list child:\n",he(a,128))}const o=a.nextSibling;for(const e of l)le(n,e,o);return Promise.all(r)})}},e.resolveBindAttribute=function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"bind",":");if(r){this.log(":bind attribute found in:\n",he(e,128));const t=["change","input"],i=Z(s,":bind:on")?.split(",")||s.dataset?.bindOn?.split(",")||t;te(s,"bind",":"),ee(s,":bind:on"),ee(s,"data-bind-on");const n="checkbox"===Z(s,"type")?"checked":"value";r.includes(".")||this.has(r)||this.set(r,""),this.effect(function(){const t=this.eval(r,{$elem:e});"checked"===n?s.checked=!!t:s.value=t});const a=`${r} = $elem.${n}`;for(const t of i)e.addEventListener(t,()=>this.eval(a,{$elem:e}))}},e.resolveShowAttribute=function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"show",":");if(r){this.log(":show attribute found in:\n",he(e,128)),te(s,"show",":");const t="none"===s.style?.display?"":s.style?.display??Z(s,"style")?.split(";")?.find(e=>"display"===e.split(":")[0])?.split(":")?.at(1)?.trim();this.effect(function(){const i=this.eval(r,{$elem:e});s.style?s.style.display=i?t:"none":Q(s,"style",`display: ${i?t:"none"};`)})}},e.resolveCustomAttribute=function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[])){const r=":attr:",i="data-attr-";if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,"attribute found in:\n",he(e,128)),ee(s,t.name);const n=t.name.split(r,2).at(-1)?.split(i,2).at(-1);this.effect(function(){const r=this.eval(t.value,{$elem:e});X(s,n,r)})}}},e.resolveCustomProperty=function(e,t){if(this._skipNodes.has(e))return;const s=e;for(const t of Array.from(s.attributes||[])){const r=":prop:",i="data-prop-";if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,"property found in:\n",he(e,128)),ee(s,t.name);const n=t.name.split(r,2).at(-1)?.split(i,2).at(-1),a=V(n);this.effect(function(){const r=this.eval(t.value,{$elem:e});J(s,a,r)})}}},e.stripTypes=function(e,t){const s=e;Z(s,":types")&&ee(s,":types"),Z(s,"data-types")&&ee(s,"data-types")},e.resolveRenderAttribute=async function(e,t){if(this._skipNodes.has(e))return;const s=e,r=q(s,"render",":");if(!r)return;let i;this.log(`:render attribute found: ${r}`),te(s,"render",":"),Y(e,"renderer")?(i=e.renderer,this.log("Reusing existing subrenderer for :render:",he(e,64))):(i=this.subrenderer(),J(s,"renderer",i)),await i.mount(e,t);for(const t of W(e,this._skipNodes))this._skipNodes.add(t);try{const e=await import(r);"function"==typeof e.default?await e.default(s,i):void 0!==e.default&&console.warn(`Module ${r} default export is not a function`)}catch(e){console.error(`Failed to execute render init from ${r}:`,e)}}}(pe||(pe={}));const fe=new Set(["this","typeof"]),_e=new Set(["in"]),me=new Set(["+","-","!","typeof"]),Ee=new Set(["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","in"]),ve={"!":0,":":0,",":0,")":0,"]":0,"}":0,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,in:10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"?.":13,"{":13},we={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),in:(e,t)=>e in t},be={"+":e=>e,"-":e=>-e,"!":e=>!e,typeof:e=>typeof e};const ge=new Set(["==","!=","<=",">=","||","&&","??","?."]),ye=new Set(["===","!=="]);var Ae;!function(e){e[e.STRING=1]="STRING",e[e.IDENTIFIER=2]="IDENTIFIER",e[e.DOT=3]="DOT",e[e.COMMA=4]="COMMA",e[e.COLON=5]="COLON",e[e.INTEGER=6]="INTEGER",e[e.DECIMAL=7]="DECIMAL",e[e.OPERATOR=8]="OPERATOR",e[e.GROUPER=9]="GROUPER",e[e.KEYWORD=10]="KEYWORD",e[e.ARROW=11]="ARROW",e[e.OPTIONAL_DOT=12]="OPTIONAL_DOT",e[e.SPREAD=13]="SPREAD"}(Ae||(Ae={}));const Re=(e,t,s=0)=>({kind:e,value:t,precedence:s}),Te=e=>9===e||10===e||13===e||32===e,Oe=e=>95===e||36===e||65<=(e&=-33)&&e<=90,Pe=e=>Oe(e)||Ie(e),Ie=e=>48<=e&&e<=57;class Ne{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;Te(this._next);)this._advance(!0);if(34===(e=this._next)||39===e)return this._tokenizeString();var e;if(Oe(this._next))return this._tokenizeIdentOrKeyword();if(Ie(this._next))return this._tokenizeNumber();if(46===this._next)return this._tokenizeDot();if(44===this._next)return this._tokenizeComma();if(58===this._next)return this._tokenizeColon();if((e=>43===e||45===e||42===e||47===e||33===e||38===e||37===e||60===e||61===e||62===e||63===e||94===e||124===e)(this._next))return this._tokenizeOperator();if((e=>40===e||41===e||91===e||93===e||123===e||125===e)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===e&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){const t=this._input.substring(this._tokenStart,this._index+e);return 0===e&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const e="unterminated string",t=this._next;for(this._advance(!0);this._next!==t;){if(void 0===this._next)throw new Error(e);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(e);this._advance()}const s=Re(Ae.STRING,this._getValue().replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return t}}));return this._advance(),s}_tokenizeIdentOrKeyword(){do{this._advance()}while(Pe(this._next));const e=this._getValue(),t=(s=e,fe.has(s)?Ae.KEYWORD:_e.has(e)?Ae.OPERATOR:Ae.IDENTIFIER);var s;return Re(t,e,ve[e]??0)}_tokenizeNumber(){do{this._advance()}while(Ie(this._next));return 46===this._next?this._tokenizeDot():Re(Ae.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),Ie(this._next))return this._tokenizeFraction();if(46===this._next){if(this._advance(),46===this._next)return this._advance(),this._clearValue(),Re(Ae.SPREAD,"...");throw new Error("Unexpected token ..")}return this._clearValue(),Re(Ae.DOT,".",13)}_tokenizeComma(){return this._advance(!0),Re(Ae.COMMA,",")}_tokenizeColon(){return this._advance(!0),Re(Ae.COLON,":")}_tokenizeFraction(){do{this._advance()}while(Ie(this._next));return Re(Ae.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(ye.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),Re(Ae.ARROW,e);ge.has(e)&&this._advance()}return e=this._getValue(),"?."===e?Re(Ae.OPTIONAL_DOT,e,13):Re(Ae.OPERATOR,e,ve[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=Re(Ae.GROUPER,e,ve[e]);return this._advance(!0),t}}class Se{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new Ne(e),this._ast=t}parse(){this._advance();const e=this._parseExpression();if(this._token)throw new Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);const s=this._tokenizer.nextToken();this._token=s,this._kind=s?.kind,this._value=s?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();const e=this._parseUnary();return void 0===e?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(void 0===e)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(Ae.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(Ae.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(Ae.DOT)||this._matches(Ae.OPTIONAL_DOT)){const t=this._kind===Ae.OPTIONAL_DOT;if(this._advance(),t&&this._matches(Ae.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(Ae.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{const s=this._parseUnary();e=this._makeInvokeOrGetter(e,s,t)}}else{if(this._matches(Ae.KEYWORD))break;if(!(this._matches(Ae.OPERATOR)&&this._token.precedence>=t))break;e="?"===this._value?this._parseTernary(e):this._parseBinary(e,this._token)}return e}_makeInvokeOrGetter(e,t,s){if(void 0===t)throw new Error("expected identifier");if("ID"===t.type)return this._ast.getter(e,t.value,s);if("Invoke"===t.type&&"ID"===t.receiver.type){const r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,s)}throw new Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!Ee.has(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let s=this._parseUnary();for(;(this._kind===Ae.OPERATOR||this._kind===Ae.DOT||this._kind===Ae.GROUPER)&&this._token.precedence>t.precedence;)s=this._parsePrecedence(s,this._token.precedence);if(void 0===s)throw new Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,s)}_parseUnary(){if(this._matches(Ae.KEYWORD,"typeof")){this._advance();const e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary("typeof",e)}if(this._matches(Ae.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(Ae.INTEGER))return this._parseInteger(e);if(this._matches(Ae.DECIMAL))return this._parseDecimal(e)}if(!me.has(e))throw new Error(`unexpected token: ${e}`);const t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(Ae.OPERATOR,"?");const t=this._parseExpression();this._advance(Ae.COLON);const s=this._parseExpression();return this._ast.ternary(e,t,s)}_parsePrimary(){switch(this._kind){case Ae.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(fe.has(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case Ae.IDENTIFIER:return this._parseInvokeOrIdentifier();case Ae.STRING:return this._parseString();case Ae.INTEGER:return this._parseInteger();case Ae.DECIMAL:return this._parseDecimal();case Ae.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case Ae.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(Ae.GROUPER,"]"))break;if(this._matches(Ae.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(Ae.COMMA));return this._advance(Ae.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e=[];do{if(this._advance(),this._matches(Ae.GROUPER,"}"))break;if(this._matches(Ae.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{const t=this._value;if((this._matches(Ae.STRING)||this._matches(Ae.IDENTIFIER))&&this._advance(),this._matches(Ae.COLON)){this._advance(Ae.COLON);const s=this._parseExpression();s&&e.push(this._ast.property(t,s))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(Ae.COMMA));return this._advance(Ae.GROUPER,"}"),this._ast.map(e)}_parseInvokeOrIdentifier(){const e=this._value;if("true"===e)return this._advance(),this._ast.literal(!0);if("false"===e)return this._advance(),this._ast.literal(!1);if("null"===e)return this._advance(),this._ast.literal(null);if("undefined"===e)return this._advance(),this._ast.literal(void 0);const t=this._parseIdentifier(),s=this._parseArguments();return s?this._ast.invoke(t,void 0,s):t}_parseIdentifier(){if(!this._matches(Ae.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(Ae.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(Ae.GROUPER,")"))break;if(this._matches(Ae.SPREAD)){this._advance();const t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{const t=this._parseExpression();e.push(t)}}while(this._matches(Ae.COMMA));return this._advance(Ae.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(Ae.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(Ae.ARROW)){this._advance();const t=this._parseExpression(),s=e?.map(e=>e.value)??[];return this._ast.arrowFunction(s,t)}return this._ast.paren(e[0])}_parseString(){const e=this._ast.literal(this._value);return this._advance(),e}_parseInteger(e=""){const t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=""){const t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}}class xe{timeouts=new Map;debounce(e,t){return new Promise((s,r)=>{const i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{s(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}}const ke=new class{empty(){return{type:"Empty",evaluate:e=>e,getIds:e=>e}}literal(e){return{type:"Literal",value:e,evaluate(e){return this.value},getIds:e=>e}}id(e){return{type:"ID",value:e,evaluate(e){return"this"===this.value?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){const s=be[e];return{type:"Unary",operator:e,child:t,evaluate(e){return s(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,s){const r=we[t];return{type:"Binary",operator:t,left:e,right:s,evaluate(e){if("="===this.operator){if("ID"!==this.left.type&&"Getter"!==this.left.type&&"Index"!==this.left.type)throw new Error(`Invalid assignment target: ${this.left}`);const t=this.right.evaluate(e);let s,r;return"Getter"===this.left.type?(s=this.left.receiver.evaluate(e),r=this.left.name):"Index"===this.left.type?(s=this.left.receiver.evaluate(e),r=String(this.left.argument.evaluate(e))):"ID"===this.left.type&&(s=e,r=this.left.value),void 0===s?void 0:s[r]=t}return r(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t,s){return{type:"Getter",receiver:e,name:t,optional:s,evaluate(e){const t=this.receiver.evaluate(e);if(!this.optional||null!=t)return t?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,s,r){if(null!=t&&"string"!=typeof t)throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:s,optional:r,evaluate(e){const t=this.receiver.evaluate(e);if(this.optional&&null==t)return;const s=this.method?t:e?.this??e,r=this.method?t?.[this.method]:t,i=this.arguments??[],n=[];for(const t of i)if("SpreadElement"===t?.type){const s=t.evaluate(e);s&&"function"==typeof s[Symbol.iterator]&&n.push(...s)}else n.push(t?.evaluate(e));return r?.apply?.(s,n)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach(t=>t?.getIds(e)),e}}}paren(e){return e}index(e,t,s){return{type:"Index",receiver:e,argument:t,optional:s,evaluate(e){const t=this.receiver.evaluate(e);if(this.optional&&null==t)return;const s=this.argument.evaluate(e);return t?.[s]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,s){return{type:"Ternary",condition:e,trueExpr:t,falseExpr:s,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:"Map",properties:e,evaluate(t){const s={};if(e&&this.properties)for(const e of this.properties)"SpreadProperty"===e.type?Object.assign(s,e.evaluate(t)):s[e.key]=e.value.evaluate(t);return s},getIds(t){if(e&&this.properties)for(const e of this.properties)"SpreadProperty"===e.type?e.expression.getIds(t):e.value.getIds(t);return t}}}property(e,t){return{type:"Property",key:e,value:t,evaluate(e){return this.value.evaluate(e)},getIds(e){return this.value.getIds(e)}}}list(e){return{type:"List",items:e,evaluate(e){if(!this.items)return[];const t=[];for(const s of this.items)if("SpreadElement"===s?.type){const r=s.evaluate(e);r&&"function"==typeof r[Symbol.iterator]&&t.push(...r)}else t.push(s?.evaluate(e));return t},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(e){const t=this.params,s=this.body;return function(...r){const i=Object.fromEntries(t.map((e,t)=>[e,r[t]])),n=new Proxy(e??{},{set:(e,t,s)=>(i.hasOwnProperty(t)&&(i[t]=s),e[t]=s),get:(e,t)=>i.hasOwnProperty(t)?i[t]:e[t]});return s.evaluate(n)}},getIds(e){return this.body.getIds(e).filter(e=>!this.params.includes(e))}}}spreadProperty(e){return{type:"SpreadProperty",expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}spreadElement(e){return{type:"SpreadElement",expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}},Le="__is_proxy__";function Ce(e,t){const s=e?._store;return s?.has(t)?s.get(t):s?.has("$parent")?Ce(s.get("$parent"),t):void 0}function De(e,t){const s=e?._store;return s?.has(t)?e:s?.has("$parent")?De(s.get("$parent"),t):null}class $e extends xe{evalkeys=["$elem","$event"];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_observer=null;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(const[t,s]of Object.entries(e||{}))this.set(t,s)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return null==e||((s=e)instanceof $e||!0===s[Le])||e.constructor!==Object&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,s)=>"string"==typeof s&&s in e&&(delete e[s],t(),!0),set:(e,s,r,i)=>{"object"==typeof r&&null!==r&&(r=this.wrapObject(r,t));const n=Reflect.set(e,s,r,i);return t(),n},get:(e,t,s)=>t===Le||Reflect.get(e,t,s)});var s}watch(e,t){const s=De(this,e);if(!s)throw new Error(`Cannot watch key "${e}" as it does not exist in the store.`);s.observers.has(e)||s.observers.set(e,new Set),s.observers.get(e)?.has(t)||s.observers.get(e)?.add(t)}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e).add(t)}async notify(e,t=10){const s=De(this,e),r=Array.from(s?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.call(this.proxify(e)))))}get(e,t){return t&&this.watch(e,t),Ce(this,e)}async set(e,t){if(this._store.has(e)&&t===this._store.get(e))return;const s=()=>this.notify(e);t&&"function"==typeof t&&(t=this.wrapFunction(t)),t&&"object"==typeof t&&(t=this.wrapObject(t,s)),function(e,t,s){const r=De(e,t);r?r._store.set(t,s):e._store.set(t,s)}(this,e,t);for(const[s,r]of this.keyHandlers.entries())if(s.test(e))for(const s of r)await Promise.resolve(s.call(this.$,e,t));await s()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}effect(e){return e.call(this.proxify(e))}proxify(e){const t=Array.from(this._store.entries()).map(([e])=>e),s=Object.fromEntries(t.map(e=>[e,null]));return new Proxy(s,{has:(e,t)=>{if("string"==typeof t){if(De(this,t))return!0;if(Reflect.has(this,t))return!0}return Reflect.has(s,t)},get:(t,s,r)=>{if("string"==typeof s){if(De(this,s))return this.get(s,e);if(e&&s!==Le&&!Reflect.has(this,s))return this.set(s,void 0),this.get(s,e)}return"$"===s?this.proxify(e):Reflect.get(this,s,r)},set:(e,t,s,r)=>("string"!=typeof t||t in this?Reflect.set(this,t,s,r):this.set(t,s),!0)})}get $(){return this.proxify()}makeEvalFunction(e){if(e.includes(";"))throw new Error("Complex expressions are not supported.");return(t,s)=>{const r=((e,t)=>new Se(e,t).parse())(e,ke),i=new Proxy(s,{has:(e,s)=>s in e||s in t||s in globalThis,get(e,s){if("string"==typeof s)return s in e?e[s]:s in t?t[s]:s in globalThis?globalThis[s]:t[s]},set:(e,s,r)=>"string"==typeof s&&(s in e?(e[s]=r,!0):(t[s]=r,!0))});return r?.evaluate(i)}}cachedExpressionFunction(e){return e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e)),this.expressionCache.get(e)}eval(e,t={}){const s=this._observer?this:this.$;if(this._store.has(e))return s[e];{const r=this.cachedExpressionFunction(e);try{return r(s,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){const s={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{s.$result=e}).catch(e=>{s.$error=e instanceof Error?e:new Error(String(e))}).finally(()=>{s.$pending=!1}),s}}const Ue="$$";function ze(){return new URL(globalThis.window?.location?.href||"http://localhost/")}function Me(e){return`${Ue}${e}`}function Fe(e){return e.keys().filter(e=>e.startsWith(Ue))}function Ge(e,t,s){const r=function(e){return e.substring(2)}(t);let i=!1;if(s){const t=String(s);e.searchParams.get(r)!==t&&(e.searchParams.set(r,t),i=!0)}else e.searchParams.has(r)&&(e.searchParams.delete(r),i=!0);return i}async function Ke(e){const t=ze();await async function(e,t){for(const[s,r]of t.searchParams.entries()){const t=Me(s);e.get(t)!==r&&await e.set(t,r)}}(e,t),function(e,t){let s=!1;for(const r of Fe(t))Ge(e,r,t.get(r))&&(s=!0);s&&globalThis.window?.history?.replaceState({},"",e.toString())}(t,e),e.addKeyHandler(new RegExp("^\\$\\$"),(e,t)=>{const s=ze();Ge(s,e,t)&&globalThis.window?.history?.replaceState({},"",s.toString())}),globalThis.window?.addEventListener("popstate",function(e){return async()=>{const t=ze(),s=new Set;for(const[r,i]of t.searchParams.entries()){const t=Me(r);s.add(t),e.get(t)!==i&&e.set(t,i)}const r=Fe(e);for(const t of r)s.has(t)||e.del(t)}}(e))}class He extends $e{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(e){return this.debugging=e,this}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??"default"}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log("Preprocessing string content with params:\n",t);const s=this.parseHTML(e,t);return await this.preprocessNode(s,t),s}async preprocessRemote(e,t){const s={};t?.cache&&(s.cache=t.cache);const r=await fetch(e,s).then(e=>e.text());return this.preprocessString(r,{...t,dirpath:ue(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}async preprocessLocal(e,t){const s=await this.fetchLocal(e,t);return this.preprocessString(s,{...t,dirpath:ue(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e._store.set("$parent",this),e._store.set("$rootRenderer",this.get("$rootRenderer")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const s=new de(W(e,this._skipNodes)).map(async e=>{this.log("Preprocessing node:\n",he(e,128)),await pe.resolveIncludes.call(this,e,t),await pe.rebaseRelativePaths.call(this,e,t),await pe.registerCustomElements.call(this,e,t),await pe.resolveCustomElements.call(this,e,t)});return await Promise.all(s.generator()),e}async renderNode(e,t){for(const s of W(e,this._skipNodes))this.log("Rendering node:\n",he(s,128)),await pe.resolveForAttribute.call(this,s,t),await pe.resolveRenderAttribute.call(this,s,t),await pe.resolveDataAttribute.call(this,s,t),await pe.resolveTextAttributes.call(this,s,t),await pe.resolveHtmlAttribute.call(this,s,t),await pe.resolveShowAttribute.call(this,s,t),await pe.resolveClassAttribute.call(this,s,t),await pe.resolveBindAttribute.call(this,s,t),await pe.resolveEventAttributes.call(this,s,t),await pe.resolveTextNodeExpressions.call(this,s,t),await pe.resolveCustomAttribute.call(this,s,t),await pe.resolveCustomProperty.call(this,s,t),await pe.stripTypes.call(this,s,t);return e}async mount(e,t){t={...t,rootNode:e},J(e,"renderer",this),this._store.set("$rootNode",e),this.has("$rootRenderer")||this._store.set("$rootRenderer",this),this.get("$rootRenderer")===this&&await Ke(this),await this.preprocessNode(e,t),await this.renderNode(e,t)}}const We=[":data",":for",":text",":html",":show",":class",":bind",":render",":on:click",":on:click.prevent",":on:input",":on:input.prevent",":on:change",":on:change.prevent",":on:submit",":on:submit.prevent",":attr:src",":attr:href",":attr:title",":attr:data-testid",":prop:checked",":prop:selected",":prop:disabled"],Ye=[...We.map(e=>(e=>`data-${e.slice(1).replace(":","-")}`)(e)),"data-testid"];class Be extends He{impl="safe_browser";dirpath=ue(globalThis.location?.href??"http://localhost/");parseHTML(e,t={rootDocument:!1}){for(const t of We)e=e.replace(new RegExp(`\\s:${t.slice(1)}=`,"g"),` data-${t.slice(1).replace(":","-")}=`);e=(e=(e=e.replace(/<include(.*) src="([^"]+)"(.*)><\/include>/g,'<link $1 rel="subresource" href="$2" $3>')).replace(/<template is="([^"]+)">([\s\S]*)<\/template>/g,'<div role="template" alt="$1">$2</div>')).replace(/<(\w+)-(\w+)(.*)>([\s\S]*)<\/(\w+)-(\w+)>/g,'<div role="$1-$2" $3>$4</div>');const s=(new F).allowDataAttributes(Ye).allowClassAttributes().allowStyleAttributes().build();if(this.log("parseHTML",e),this.log("sanitized",String(s.sanitize(e))),t.rootDocument){return K(new DOMParser,s.sanitize(e),"text/html")}return s.sanitizeToFragment(e)}serializeHTML(e){return(new XMLSerializer).serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}textContent(e,t){e.textContent=t}}const Ve=new Be;export{Ve as Mancha,Be as Renderer};
@@ -1 +1 @@
1
- {"version":3,"file":"safe_browser.js","sourceRoot":"","sources":["../src/safe_browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE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OAAO,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;YAC/B,OAAO,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;QACxF,CAAC;aAAM,CAAC;YACP,OAAO,SAAS,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IACD,aAAa,CAAC,IAA6B;QAC1C,OAAO,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,eAAe,CACd,KAAa,EACb,MAAoC;QAEpC,6EAA6E;QAC7E,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IACD,aAAa,CAAC,GAAW,EAAE,KAAuB;QACjD,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,WAAW,CAAC,IAAU,EAAE,OAAe;QACtC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC"}
package/dist/store.d.ts CHANGED
@@ -2,14 +2,16 @@
2
2
  * Internal store properties that are always present. These are managed by the framework
3
3
  * and should not be set directly by users.
4
4
  */
5
- export interface InternalStoreState {
5
+ export type InternalStoreState = {
6
6
  /** Reference to the parent store in a hierarchy. */
7
7
  $parent?: SignalStore;
8
8
  /** Reference to the root renderer instance. */
9
9
  $rootRenderer?: SignalStore;
10
10
  /** Reference to the root DOM node. */
11
11
  $rootNode?: Node;
12
- }
12
+ } & {
13
+ [key: `$$${string}`]: string | null;
14
+ };
13
15
  /**
14
16
  * Base type for user-defined store state. Uses `any` intentionally to allow flexible
15
17
  * user-defined state types without requiring explicit index signatures.
@@ -31,7 +33,7 @@ declare abstract class IDebouncer {
31
33
  }
32
34
  /** Default debouncer time in millis. */
33
35
  export declare const REACTIVE_DEBOUNCE_MILLIS = 10;
34
- export declare function getAncestorValue(store: SignalStore | null, key: string): unknown | null;
36
+ export declare function getAncestorValue(store: SignalStore | null, key: string): unknown;
35
37
  export declare function getAncestorKeyStore(store: SignalStore | null, key: string): SignalStore | null;
36
38
  export declare function setAncestorValue(store: SignalStore, key: string, value: unknown): void;
37
39
  export declare function setNestedProperty(obj: Record<string, unknown>, path: string, value: unknown): void;
@@ -49,10 +51,14 @@ export declare class SignalStore<T extends StoreState = StoreState> extends IDeb
49
51
  watch<T>(key: string, observer: Observer<T>): void;
50
52
  addKeyHandler(pattern: RegExp, handler: KeyValueHandler): void;
51
53
  notify(key: string, debounceMillis?: number): Promise<void>;
52
- get<T>(key: string, observer?: Observer<T>): unknown | null;
54
+ get<T>(key: string, observer?: Observer<T>): unknown;
53
55
  set(key: string, value: unknown): Promise<void>;
54
56
  del(key: string): Promise<void>;
55
57
  keys(): string[];
58
+ /**
59
+ * Checks if a key exists in THIS store only (not ancestors).
60
+ * Use `get(key) !== null` to check if a key exists anywhere in the chain.
61
+ */
56
62
  has(key: string): boolean;
57
63
  effect<T>(observer: Observer<T>): T;
58
64
  private proxify;
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as jexpr from "./expressions/index.js";
1
+ import * as expressions from "./expressions/index.js";
2
2
  class IDebouncer {
3
3
  timeouts = new Map();
4
4
  debounce(millis, callback) {
@@ -21,7 +21,7 @@ class IDebouncer {
21
21
  /** Default debouncer time in millis. */
22
22
  export const REACTIVE_DEBOUNCE_MILLIS = 10;
23
23
  /** Shared AST factory. */
24
- const AST_FACTORY = new jexpr.EvalAstFactory();
24
+ const AST_FACTORY = new expressions.EvalAstFactory();
25
25
  /** Symbol used to identify proxified objects. */
26
26
  const PROXY_MARKER = "__is_proxy__";
27
27
  function isProxified(object) {
@@ -36,7 +36,7 @@ export function getAncestorValue(store, key) {
36
36
  return getAncestorValue(map.get("$parent"), key);
37
37
  }
38
38
  else {
39
- return null;
39
+ return undefined;
40
40
  }
41
41
  }
42
42
  export function getAncestorKeyStore(store, key) {
@@ -148,7 +148,8 @@ export class SignalStore extends IDebouncer {
148
148
  return getAncestorValue(this, key);
149
149
  }
150
150
  async set(key, value) {
151
- if (value === this._store.get(key))
151
+ // Early return if the key exists in this store and has the same value.
152
+ if (this._store.has(key) && value === this._store.get(key))
152
153
  return;
153
154
  const callback = () => this.notify(key);
154
155
  if (value && typeof value === "function") {
@@ -178,6 +179,10 @@ export class SignalStore extends IDebouncer {
178
179
  keys() {
179
180
  return Array.from(this._store.keys());
180
181
  }
182
+ /**
183
+ * Checks if a key exists in THIS store only (not ancestors).
184
+ * Use `get(key) !== null` to check if a key exists anywhere in the chain.
185
+ */
181
186
  has(key) {
182
187
  return this._store.has(key);
183
188
  }
@@ -199,10 +204,19 @@ export class SignalStore extends IDebouncer {
199
204
  return Reflect.has(keyval, prop);
200
205
  },
201
206
  get: (_, prop, receiver) => {
202
- if (typeof prop === "string" && getAncestorKeyStore(this, prop)) {
203
- return this.get(prop, observer);
207
+ if (typeof prop === "string") {
208
+ if (getAncestorKeyStore(this, prop)) {
209
+ return this.get(prop, observer);
210
+ }
211
+ // If the property is not found, but we are observing, we assume it's a
212
+ // state variable that hasn't been initialized yet. We initialize it to
213
+ // undefined so that we can watch it.
214
+ if (observer && prop !== PROXY_MARKER && !Reflect.has(this, prop)) {
215
+ this.set(prop, undefined);
216
+ return this.get(prop, observer);
217
+ }
204
218
  }
205
- else if (prop === "$") {
219
+ if (prop === "$") {
206
220
  return this.proxify(observer);
207
221
  }
208
222
  else {
@@ -234,7 +248,7 @@ export class SignalStore extends IDebouncer {
234
248
  throw new Error("Complex expressions are not supported.");
235
249
  }
236
250
  return (thisArg, args) => {
237
- const ast = jexpr.parse(expr, AST_FACTORY);
251
+ const ast = expressions.parse(expr, AST_FACTORY);
238
252
  const scope = new Proxy(args, {
239
253
  has(target, prop) {
240
254
  return prop in target || prop in thisArg || prop in globalThis;
@@ -246,7 +260,9 @@ export class SignalStore extends IDebouncer {
246
260
  return target[prop];
247
261
  if (prop in thisArg)
248
262
  return thisArg[prop];
249
- return globalThis[prop];
263
+ if (prop in globalThis)
264
+ return globalThis[prop];
265
+ return thisArg[prop];
250
266
  },
251
267
  set(target, prop, value) {
252
268
  if (typeof prop !== "string")
@@ -257,7 +273,7 @@ export class SignalStore extends IDebouncer {
257
273
  }
258
274
  thisArg[prop] = value;
259
275
  return true;
260
- }
276
+ },
261
277
  });
262
278
  return ast?.evaluate(scope);
263
279
  };
package/dist/store.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,wBAAwB,CAAC;AAkChD,MAAe,UAAU;IACvB,QAAQ,GAAiD,IAAI,GAAG,EAAE,CAAC;IAEnE,QAAQ,CAAI,MAAc,EAAE,QAA8B;QACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,OAAO;gBAAE,YAAY,CAAC,OAAO,CAAC,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,QAAQ,EACR,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC;oBACH,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACpB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC;YACH,CAAC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;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;gBACxD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CACP,EAA+B,EAC/B,OAAW;QAEX,2BAA2B;QAC3B,MAAM,KAAK,GAAG;YACb,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAgB;YACzB,MAAM,EAAE,IAAoB;SAC5B,CAAC;QAEF,uFAAuF;QACvF,OAAO,CAAC,OAAO,EAAE;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;aACvB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACd,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACd,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACb,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;QAEJ,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
@@ -1,6 +1,8 @@
1
1
  export declare function innerHTML(elem: Element): string;
2
2
  export declare function getTextContent(elem: Element): string | null;
3
+ export declare const isNode: boolean;
3
4
  export declare function setupGlobalTestEnvironment(): Promise<void>;
5
+ export declare function createFragment(html: string): DocumentFragment;
4
6
  export declare const assert: {
5
7
  equal: (actual: any, expected: any, message?: string) => void;
6
8
  deepEqual: (actual: any, expected: any, message?: string) => void;
@@ -14,12 +14,14 @@ export function getTextContent(elem) {
14
14
  else
15
15
  return DomUtils.textContent(elem);
16
16
  }
17
+ export const isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
17
18
  export async function setupGlobalTestEnvironment() {
18
19
  // Set up global test environment for DOM manipulation.
19
20
  // Fall back to JSDOM for DOM manipulation during testing.
20
21
  if (!globalThis.window) {
21
22
  // Import JSDOM dynamically, because it's not available in browser context.
22
- const { JSDOM } = await import("jsdom");
23
+ const jsdomName = "jsdom";
24
+ const { JSDOM } = await import(jsdomName);
23
25
  const dom = new JSDOM(``, { url: "http://localhost/" });
24
26
  // Types.
25
27
  globalThis.Document = globalThis.Document || dom.window.Document;
@@ -32,6 +34,17 @@ export async function setupGlobalTestEnvironment() {
32
34
  globalThis.PopStateEvent = globalThis.PopStateEvent || dom.window.PopStateEvent;
33
35
  }
34
36
  }
37
+ export function createFragment(html) {
38
+ // Use DOMParser to avoid tsec innerHTML violation and unify Node/Browser behavior.
39
+ const parser = new DOMParser();
40
+ const doc = parser.parseFromString(html, "text/html");
41
+ const fragment = document.createDocumentFragment();
42
+ // Move nodes to fragment
43
+ while (doc.body.firstChild) {
44
+ fragment.appendChild(doc.body.firstChild);
45
+ }
46
+ return fragment;
47
+ }
35
48
  // Map the assert methods using Chai.
36
49
  chai.use(chaiAsPromised);
37
50
  export const assert = {
@@ -1 +1 @@
1
- {"version":3,"file":"test_utils.js","sourceRoot":"","sources":["../src/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,IAAI,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC;;QACrD,OAAO,QAAQ,CAAC,YAAY,CAAC,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AAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAe,EAAE,OAAgB,EAAE,EAAE;QACpD,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC;IACzD,CAAC;CACD,CAAC"}
@@ -6,6 +6,7 @@ export const TRUSTED_ATTRIBS = [
6
6
  ":show",
7
7
  ":class",
8
8
  ":bind",
9
+ ":render",
9
10
  ":on:click",
10
11
  ":on:click.prevent",
11
12
  ":on:input",
@@ -17,6 +18,7 @@ export const TRUSTED_ATTRIBS = [
17
18
  ":attr:src",
18
19
  ":attr:href",
19
20
  ":attr:title",
21
+ ":attr:data-testid",
20
22
  ":prop:checked",
21
23
  ":prop:selected",
22
24
  ":prop:disabled",
@@ -1 +1 @@
1
- {"version":3,"file":"trusted_attributes.js","sourceRoot":"","sources":["../src/trusted_attributes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,mBAAmB;IACnB,YAAY;IACZ,oBAAoB;IACpB,YAAY;IACZ,oBAAoB;IACpB,WAAW;IACX,YAAY;IACZ,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,gBAAgB;CACjB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,C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