@hyperfixi/engine 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +22 -4
- package/dist/common.js +131 -12
- package/dist/common.min.js +9 -9
- package/dist/core.js +131 -12
- package/dist/core.min.js +9 -9
- package/dist/full.js +134 -15
- package/dist/full.min.js +11 -11
- package/dist/htmx-compat.d.ts +6 -0
- package/dist/hyperfixi-hs.dev.js +134 -15
- package/dist/hyperfixi-hs.js +11 -11
- package/dist/index.js +134 -15
- package/dist/minimal.js +131 -12
- package/dist/minimal.min.js +9 -9
- package/dist/runtime.d.ts +2 -1
- package/package.json +1 -1
package/dist/minimal.min.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";(()=>{var K=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",T=(e,t)=>K(e)?e.then(t):t(e),I=(e,t)=>e.some(K)?Promise.all(e).then(t):t(e),M=e=>e!=null,
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"},$=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",U=e=>e>="0"&&e<="9",
|
|
3
|
-
`,
|
|
4
|
-
`?(i++,o=0):o++,s),d=
|
|
5
|
-
`),c();else if(Le(h))n.push(m(d("WHITESPACE"),f(Le)));else if(!g()&&h==="."&&($(y)||y==="{"||y==="-"))n.push(w("CLASS_REF",!0));else if(!g()&&h==="#"&&($(y)||y==="{"))n.push(w("ID_REF",!1));else if(h==="@"||h==="["&&y==="@")n.push(_());else if(h==="*"&&$(y)){let P=d("STYLE_REF");n.push(m(P,c()+f(F=>$(F)||F==="-")))}else if(p()&&($(h)||h==="\\"))n.push(N());else if(!p()&&($(h)||h==="_"||h==="$"))n.push(q());else if(U(h))n.push(C());else if(!p()&&(h==='"'||h==="`"))n.push(k());else if(!p()&&h==="'")n.push(Z()?k():O());else if(at.has(h))s==="$"&&h==="{"&&u++,h==="}"&&u--,n.push(O());else if(p()||h==="`"){let P=d("RESERVED");n.push(m(P,c()))}else throw new Error("Unknown token: "+h+" ")}return n}function E(e){return e.match("the"),nn(e)}function nn(e){let t=lt(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=rn(o.value,t,lt(e));return t}function rn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>T(t.ev(o),i=>!!i===r?i:n.ev(o))}}var on={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function De(e){let t=je(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=je(e),u=on[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>I([i.ev(l),s.ev(l)],([c,d])=>u(c,d))}}return t}function je(e){let t=G(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function G(e){e.match("the");let t=e.pos();if(e.match("not"))return He(e,"logicalNot",t,G(e),n=>!n);if(e.match("no"))return He(e,"noExpression",t,je(e),Fe);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return an(e)}function He(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>T(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var sn="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function an(e){let t=ht(e),n=e.matchAny(...sn)??e.matchOp("%");if(n)return ct(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return ct(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function ct(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>T(n.ev(s),o)};return n.stat&&(i.stat=()=>o(de(n))),i}function ht(e){let t=e.pos();return e.matchOp("-")?He(e,"negativeNumber",t,ht(e),n=>-b(n)):pt(e)}function pt(e){let t=dn(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function yt(e){return e.match("the"),Ue(e,pt(e))}function Ue(e,t){let n=un(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function un(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&cn(t.expr);)t=t.expr;return t}var cn=e=>H(v(e,"ev"));function de(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function ln(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function lt(e){let t=De(e),n=ln(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=De(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=De(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=f=>l&&typeof f=="string"?f.toLowerCase():f,d=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:f=>I([t.ev(f),u??s?.ev(f),a?.ev(f)],([p,g,w])=>{if(o){let k=Ke(p,o,i);return r==="a"?k:!k}if(d&&g===void 0&&(r==="is"||r==="is not")){let k=!!ie(p,d);return r==="is"?k:!k}return gt(r,c(p),c(g),w)})}}function ft(e,t){let n=v(e,"contains")??v(e,"includes");if(!H(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function fn(e,t){let n=v(e,"match")??v(e,"matches");if(!H(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var dt=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function gt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!gt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&fn(t,n);case"in":return n!=null&&ft(n,t);case"contain":case"include":return t!=null&&ft(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return dt(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return dt(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return Fe(t);case"exist":return Je(t)}throw new Error("Unknown comparison : "+e)}function dn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),Me("number",parseFloat(t.value),t);case"STRING":return pn(e);case"ID_REF":return vn(e);case"CLASS_REF":return Q(e);case"ATTRIBUTE_REF":return V(e);case"STYLE_REF":return Et(e)}if(t.op){if(t.value==="(")return mn(e);if(t.value==="[")return yn(e);if(t.value==="{")return gn(e);if(t.value==="<")return bn(e)}let n=e.match("true")??e.match("false");if(n)return Me("boolean",n.value==="true",n);let r=e.match("null");if(r)return Me("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return wn(e)}function Me(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function mn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>E(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var hn=(e,t)=>I(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function wt(e,t){let n=e.child(fe(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,E(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function pn(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=wt(e,n);r.ev=i=>hn(o,i)}else r.stat=()=>n;return r}function yn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(E(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>I(n.map(o=>o.ev(r)),o=>o)}}function gn(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(E(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(E(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>I([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function vt(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function wn(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>E(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>rt(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,d,m)=>ot(s,c,a,m,l?.ev(c))}}var bt=(e,t)=>{let n=t.value.substring(2);return E(e.child(fe(n),n))};function vn(e){let t=e.consume(),n=(o,i)=>Oe(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>u&&ce(u,s))};if(t.template){let o=r.expr=bt(e,t);r.ev=i=>T(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Q(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>T(n.ev(r),s=>ce(Array.from(s instanceof j?s:[]),i))};if(t.template){let r=n.expr=bt(e,t);n.ev=o=>T(r.ev(o),i=>new j("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new j(r,o.me,!0)}return n}var $e=class extends j{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function bn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new j(n,o.me),lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>ce(Array.from(u instanceof j?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=wt(e,n);r.ev=i=>I(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new $e(i.me,s))}return r}function V(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>ae(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>ue(s.you||s.me,r,a)}}function Et(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?Ee:be)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>xe(o.you||o.me,r,s)}}function xt(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(E(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>I(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function me(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function kt(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function Te(e,t="Expected event name"){return e.matchType("STRING")?.value??kt(e)??e.err(t)}function D(e,t){return xn(e,t)??kn(e,t)??Sn(e,t)??Tn(e,t)??Nn(e,t)??Pn(e,t)??Rn(e,t)??On(e,t)??En(e,t)??t}function En(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function xn(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ie(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),ke(s,n,u)},del:(i,s)=>{A(s,r),S(s,u=>{M(u)&&delete u[n],x.wroteProperty(u)})}};return D(e,o)}function kn(e,t){if(!e.match("of"))return;let n=G(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ie,attribute:ae,style:be,computed:Ee}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:d=>T(c.root.ev(d),m=>l(m,u)),lhs:d=>c.root.ev(d),put:(d,m,f)=>{A(m,a),s==="attribute"?ue(m,u,f):s==="property"?ke(m,u,f):xe(m,u,f)},del:(d,m)=>{A(m,a),S(m,f=>{s==="attribute"?R(f)&&f.removeAttribute(u):s==="property"?(M(f)&&delete f[u],x.wroteProperty(f)):f instanceof HTMLElement&&f.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function Tn(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=V(e)??Et(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ie(l,i):o?.type==="attributeRef"?ae(l,o.name):o?.type==="computedStyleRef"?Ee(l,o.name):o&&be(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>T(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,d)=>{A(c,s),i!==void 0?ke(c,i,d):o?.type==="attributeRef"?ue(c,o.name,d):o&&xe(c,o.name,d)}};return D(e,a)}function Nn(e,t){if(!e.match("in"))return;let n=G(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")S(u,c=>R(c)&&a.push(...Ie(c,l)));else if(R(s)){let c=!1;if(S(u,d=>{d instanceof Node&&d.contains(s)&&(c=!0)}),c)return s}else S(s,c=>S(u,d=>c===d&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>I([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>ce(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function Pn(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=kt(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>T(s.root.ev(u),a=>Xe(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Rn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(E(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return I([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...d])=>{if(!l||a===void 0)return mt(c,void 0,d,s,r);A(c,o);let m=mt(v(c,a),c,d,s,r);return Ze(c,a),m})}};return D(e,i)}function mt(e,t,n,r,o){if(!H(e))throw A(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Sn(e,t){let n=V(e);return n&&Cn(e,t,n)}function Cn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ae(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),ue(s,n.name,u)}};return o}function On(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=E(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=E(e))),e.reqOp("]");let s=e.text(t),u=(c,d)=>b(d)<0?b(v(c,"length"))+b(d):b(d),a=(c,d,m)=>{let f=v(c,"slice");return H(f)?Reflect.apply(f,c,[d,m]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>I([l.root.ev(c),r.ev(c),i?.ev(c)],([d,m,f])=>d==null?null:n?a(d,0,u(d,m)+1):o?f==null?a(d,b(m)):a(d,b(m),u(d,f)+1):v(d,String(m))),lhs:c=>I([l.root.ev(c),r.ev(c)],d=>d),put:(c,d,m)=>{let[f,p]=Array.isArray(d)?d:[];A(f,s),M(f)&&(f[String(p)]=m)},del:(c,d)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[m,f]=Array.isArray(d)?d:[];A(m,s),Array.isArray(m)?m.splice(u(m,f),1):M(m)&&delete m[String(f)],x.wroteProperty(m)}};return D(e,l)}function Pt(e){let t=Q(e);if(!t)return;let n=[t];for(let r=Q(e);r;r=Q(e))n.push(r);return n}var Ge=(e,t)=>(e??[]).map(n=>T(n.ev(t),r=>String(v(r,"className")))),In=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),We=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,Tt=(e,t,n,r,o)=>t?it(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):S(e,i=>R(i)&&r(i)),he=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),Rt=(e,t,n,r,o,i)=>i?Tt(t,n,r,s=>he(s,i,e),s=>he(s,i,!e)):I(o.map(s=>Tt(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function St(e){let t=Pt(e),n=t?void 0:V(e);return{refs:t,attribute:n,css:t||n?void 0:xt(e)}}function Ct(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=St(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>E(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?E(t):me(t),l=t.match("when")?E(t):void 0,c=o||i?l:void 0,d=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:f=>I([a.ev(f),s?.ev(f),u?.ev(f),...Ge(o,f)],([p,g,w,...k])=>{if(A(p,d),u){if(Array.isArray(p))p.push(w);else if(p instanceof Set)p.add(w);else throw p instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof p);x.wroteProperty(p)}else if(s)S(p,q=>{let N=We(q);N&&(N.cssText+=g)});else return Rt(!0,p,c,f,k,i)})}}}var An=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Ot(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=St(t),u=o||i||s?void 0:E(t),a=t.match("from")?E(t):u?void 0:me(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=E(t));let c=a?t.text(a):"",d=u?t.text(u):"",m=(p,g,w)=>{if(w==null&&u?.del&&u.lhs&&!An(g)){let k=u;return T(u.lhs(p),q=>k.del?.(p,q))}if(A(g,d),Array.isArray(w)){let k=w.indexOf(g);k>-1&&w.splice(k,1),x.wroteProperty(w)}else w instanceof Set||w instanceof Map?(w.delete(g),x.wroteProperty(w)):S(g,k=>{R(k)&&k.parentElement&&(w==null||w instanceof Node&&w.contains(k))&&k.parentElement.removeChild(k)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:p=>I([a?.ev(p),s?.ev(p),u?.ev(p),...Ge(o,p)],([g,w,k,...q])=>{if(u)return m(p,k,g);if(A(g,c),s){let N=In(String(w));S(g,C=>N.forEach(O=>We(C)?.removeProperty(O)))}else return Rt(!1,g,l,p,q,i)})}}}var Nt=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},It={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=W(t);n?t.style.display=n:e==="toggle"?It.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Nt("visibility","hidden","visible"),opacity:Nt("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function Fn(e,t){let n=t??B.defaultHideShowStrategy??"display";return B.hideShowStrategies[n]??It[n]??e.err("Unknown show/hide strategy : "+n)}function At(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let g=o.styleProp=t.consume().value.slice(1);i=Fn(t,g),o.on=t.match("of")?t.withFollow(["with","between"],()=>E(t)):me(t)}else if(t.match("between")){let g=Q(t);if(g)t.req("and"),o.between=[g,Q(t)??t.err("Expected classRef")];else{let w=V(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[w,V(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=Pt(t))&&!(o.attributeRef=V(t))){let g=t.g.toggleElement;if(!g)o.target=t.withFollow(["between"],()=>yt(t));else{let w=t.withFollow(["between","as"],()=>G(t));if(!t.peek("between"))return g(t,w,r);o.target=Ue(t,w)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?E(t):me(t)),t.match("between")){let g=o.betweenValues=t.withFollow(["and"],()=>{let w=[E(t)];for(;t.matchOp(",");)w.push(E(t));return w});t.req("and"),g.push(E(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=E(t)):t.match("until")&&(o.until=Te(t),t.match("from")&&(o.from=E(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:d}=o,m=s?t.text(s):"",f=(g,w)=>g[(g.findIndex(k=>k==w)+1)%g.length],p=(g,w,k,q)=>{if(a&&u?.lhs&&u.put){let N=u;return I([u.ev(g),u.lhs(g)],([C,O])=>N.put?.(g,O,f(k,C)))}if(a&&d)return S(w,N=>{let C=We(N);if(!C||!R(N))return;let O=C.getPropertyValue(d)||getComputedStyle(N).getPropertyValue(d);C.setProperty(d,String(f(k,O)))});A(w,m),S(w,N=>{if(R(N))if(i)N instanceof HTMLElement&&i("toggle",N);else if(l){let[C,O]=l;if(C.type==="classRef"&&O.type==="classRef"){let[_,Z]=[String(C.className),String(O.className)],J=N.classList.contains(_);N.classList.toggle(_,!J),N.classList.toggle(Z,J)}else if(C.type==="attributeRef"&&O.type==="attributeRef"){let _=N.getAttribute(C.name)===String(C.value);he(N,_?C:O,!1),he(N,_?O:C,!0)}}else c?he(N,c,!N.hasAttribute(c.name)):q.forEach(C=>N.classList.toggle(String(C)))})};return o.run=g=>I([s?.ev(g),o.time?.ev(g),o.from?.ev(g),I((a??[]).map(w=>w.ev(g)),w=>w),...Ge(o.classRefs,g)],([w,k,q,N,...C])=>{let O=()=>p(g,w,Array.isArray(N)?N:[],C);if(o.time)return new Promise(_=>{O(),setTimeout(()=>{O(),_()},b(k))});if(o.until){let _=o.until,Z=q||g.me;return new Promise(J=>{z(Z)&&Z.addEventListener(_,()=>{O(),J()},{once:!0}),O()})}return T(O(),()=>{})}),o}}var Y=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},Ft=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Ne=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new Y(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function Ve(e){let t=e.source.split(`
|
|
1
|
+
"use strict";(()=>{var K=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",T=(e,t)=>K(e)?e.then(t):t(e),I=(e,t)=>e.some(K)?Promise.all(e).then(t):t(e),M=e=>e!=null,j=e=>typeof e=="function",v=(e,t)=>M(e)?e[t]:void 0,ne=(e,t,n)=>{M(e)&&(e[t]=n)},R=e=>e instanceof Element,B=e=>j(v(e,"addEventListener"));var b=e=>e;var Q={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},fetchThrowsOn:[/^4/,/^5/]},Ce=Object.assign(Object.create(null),{String:e=>String(e),Int:e=>parseInt(String(e)),Float:e=>parseFloat(String(e)),Number:e=>Number(e),Fragment:e=>st(e)}),Oe=[],se={process(e){},enter(e){}},Xe=new WeakMap;function Ie(e){if(e.window!==e)return e;let t=Xe.get(e);return t||Xe.set(e,t={}),t}var W=e=>Ie(e)._hyperscript;function et(e){let t=Ie(e),n=t._hyperscript!==void 0;return delete t._hyperscript,n}function V(e){return Ie(e)._hyperscript??={}}var x={tracking:!1,readGlobal(e){},readElement(e,t){},readProperty(e,t){},readAttribute(e,t){},readQuery(e){},wroteGlobal(e){},wroteElement(e,t){},wroteProperty(e){},stop(e){}},ye=e=>(x.tracking&&typeof e=="object"&&e!==null&&x.readProperty(e,"__mutation__"),e),sn={Array:["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"],Set:["add","delete","clear"],Map:["set","delete","clear"]};function tt(e,t){let n=v(v(e,"constructor"),"name");typeof n=="string"&&sn[n]?.includes(t)&&x.wroteProperty(e)}var Ae=e=>{if(e instanceof Node){let t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document},an=e=>e.replace(/[:&()[\]/]/g,t=>"\\"+t);function Fe(e,t){return x.tracking&&x.readQuery(e),e.querySelectorAll(t)}var H=class{constructor(t,n,r=!1){this.raw=t;this.relativeTo=n;this.escape=r}get css(){return this.escape?an(this.raw):this.raw}get className(){return this.raw.slice(1)}get length(){return this.select().length}contains(t){for(let n of this)if(n.contains(t))return!0;return!1}select(){return Fe(Ae(this.relativeTo),this.css)}[Symbol.iterator](){return this.select()[Symbol.iterator]()}},Le=e=>e instanceof H||Array.isArray(e)||e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList;function S(e,t){if(Le(e))for(let n of e)t(n);else t(e)}var we=(e,t)=>{if(e==null)return;let n=t(e);if(n!==void 0)return n;if(Le(e))return Array.from(e,t)},ie=(e,t)=>(x.tracking&&x.readProperty(e,t),we(e,n=>v(n,t))),ae=(e,t)=>(x.tracking&&x.readAttribute(e,t),we(e,n=>R(n)?n.getAttribute(t):void 0)),ve=(e,t)=>we(e,n=>v(v(n,"style"),t)),be=(e,t)=>we(e,n=>R(n)?getComputedStyle(n).getPropertyValue(t):void 0),ue=(e,t,n)=>S(e,r=>{R(r)&&(n==null?r.removeAttribute(t):r.setAttribute(t,String(n)))}),Ee=(e,t,n)=>S(e,r=>ne(v(r,"style"),t,n)),xe=(e,t,n)=>S(e,r=>{ne(r,t,n),x.wroteProperty(r)});function A(e,t){if(e==null)throw new Error(`'${t}' is null`)}var qe=e=>e==null||v(e,"length")===0;function nt(e){if(e==null)return!1;if(Le(e)){for(let t of e)return!0;return!1}return!0}function rt(e,t,n){if(e==null&&n||Object.prototype.toString.call(e).slice(8,-1)===t)return!0;let r=v(globalThis,t);return j(r)&&e instanceof r}function ot(e,t){for(let r of Oe){let o=r(t,e);if(o!==void 0)return o}if(e==null)return null;let n=Ce[t];if(n)return n(e);throw new Error("Unknown conversion : "+t)}function st(e){let t=document.createDocumentFragment();return e==null?t.append("null"):S(e,n=>{if(n instanceof Node)t.append(n);else{let r=document.createElement("template");r.innerHTML=n===null?"":String(n),t.append(r.content)}}),t}function ce(e,t){S(e,n=>{if(!R(n))return;let r=n.parentElement;n.replaceWith(t instanceof Node?t.cloneNode(!0):st(t)),r&&se.process(r)})}function L(e,t,n={},r){if(!B(e))return!0;n.sender=r;let o=Object.assign(new Event(t,{bubbles:!0,cancelable:!0,composed:!0}),{detail:n});return e.dispatchEvent(o)}var it=(e,t="elementScope")=>(V(e).scopes??={})[t]??={},un=Object.create(null,{selection:{get:()=>getSelection()?.toString(),enumerable:!0},clipboard:{get:()=>navigator.clipboard.readText(),set:e=>void navigator.clipboard.writeText(String(e))}});function le(e,t,n,r){let o=v(r,"detail"),i=Object.create(un);for(let s=R(e)?e:null;s;s=s.parentElement)Object.assign(i,W(s)?.features);return{meta:{owner:e,feature:t},locals:i,me:n,you:void 0,result:void 0,beingTested:null,event:r,target:v(r,"target")??null,detail:o??null,sender:v(o,"sender")??null,body:typeof document>"u"?null:document.body}}var Se=["meta","it","result","locals","event","target","detail","sender","body"],re=e=>{let t=e.meta.owner,n=e.meta.feature?.behavior;return M(t)?it(t,n?n+"Scope":void 0):{}};function at(e,t,n){let r=R(n)?n:R(t.meta.owner)?t.meta.owner:null;for(;r;){let o=W(r)?.scopes?.elementScope;if(o&&e in o)return{value:o[e],element:r};let i=r.getAttribute("dom-scope");if(i==="isolated")break;let s=i?.match(/^closest\s+(.+)/),u=i?.match(/^parent\s+of\s+(.+)/);s?r=r.parentElement?.closest(s[1])??null:u?r=r.closest(u[1])?.parentElement??null:r=r.parentElement}return{value:void 0,element:null}}function ut(e,t,n,r){if(e==="me"||e==="my"||e==="I")return t.me;if(e==="it"||e==="its")return t.beingTested??t.result;if(e==="result")return t.result;if(e==="you"||e==="your"||e==="yourself")return t.you;let o=t.meta.owner,i=()=>(x.tracking&&x.readGlobal(e),ye(v(globalThis,e)));if(n==="global")return i();if(n==="element")return x.tracking&&x.readElement(e,o),ye(re(t)[e]);if(n==="inherited"){let l=at(e,t,r);return x.tracking&&x.readElement(e,l.element??(R(r)?r:o)),ye(l.value)}let s=t.meta.context;if(s!=null){let l=v(s,e);if(l!==void 0)return l;let c=v(v(s,"detail"),e);if(c!==void 0)return c}let u=Se.includes(e)?v(t,e):t.locals[e];if(u!==void 0)return u;let a=re(t)[e];return a!==void 0?(x.tracking&&x.readElement(e,o),ye(a)):i()}function ct(e,t,n,r,o){if(n==="global")ne(globalThis,e,r),x.wroteGlobal(e);else if(n==="element")re(t)[e]=r,x.wroteElement(e,t.meta.owner);else if(n==="inherited"){let s=at(e,t,o).element??(R(o)?o:t.meta.owner);M(s)&&(it(s)[e]=r),x.wroteElement(e,s)}else!Se.includes(e)&&t.locals[e]!==void 0?t.locals[e]=r:re(t)[e]!==void 0?(re(t)[e]=r,x.wroteElement(e,t.meta.owner)):Se.includes(e)?ne(t,e,r):t.locals[e]=r}function ee(e,t,n=0){for(let r=n;r<e.length;r++){let o=e[r].run(t);if(K(o))return o.then(i=>i||ee(e,t,r+1));if(o)return o}}function oe(e,t){try{let n=e();return K(n)?n.then(void 0,t):n}catch(n){return t(n)}}function lt(e,t,n){let{errorSymbol:r,errorHandler:o,finallyHandler:i}=n,s=()=>oe(()=>T(ee(t,e),a=>{let l=v(a,"k");if(l==="break"||l==="continue")throw new Error(`Command \`${l}\` cannot be used outside of a \`repeat\` loop.`);return Ke(a)}),a=>{if(!o||!r)throw a;return e.locals[r]=a,ee(o,e)});if(!i)return s();let u=()=>oe(()=>T(ee(i,e),()=>{}),a=>console.error(" Exception in finally block: ",a));return oe(()=>T(s(),a=>T(u(),()=>Ke(a))),a=>T(u(),()=>{throw a}))}var Ke=e=>{let t=v(e,"k");if(t==="return")return{k:"return",value:v(e,"value")};if(t==="break"||t==="continue")return{k:t}};function ft(e,t,n,r,o){let i=[];S(e,a=>i.push(a));let s=i.map(a=>(n.beingTested=a,t.ev(n)));n.beingTested=null;let u=a=>{n.result=i.filter((l,c)=>((a[c]?r:o)(l),a[c]))};return s.some(K)?Promise.all(s).then(u):u(s)}var dt=new Set("+ - * / . .. \\ : % | ! ? # & $ ; , ( ) < > <= >= == === != !== { } [ ] = ~ ^".split(" ")),mt={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},$=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",U=e=>e>="0"&&e<="9",_e=e=>e===" "||e===" "||e==="\r"||e===`
|
|
3
|
+
`,De=e=>$(e)||U(e)||e==="-"||e==="_"||e===":",Me=e=>$(e)||U(e)||e==="_"||e==="$";function fe(e,t=!1){let n=[],r=0,o=0,i=1,s="<START>",u=0,a=()=>e.charAt(r),l=p=>e.charAt(r+p),c=()=>(s=e.charAt(r++),s===`
|
|
4
|
+
`?(i++,o=0):o++,s),d=p=>({type:p,value:"",start:r,end:r+1,line:i,column:o}),m=(p,g)=>(p.value=g,p.end=r,p),f=p=>{let g="";for(;a()&&p(a());)g+=c();return g},h=()=>t&&u===0,y=()=>$(s)||U(s)||")\"'`}]".includes(s),w=(p,g)=>{let P=d(p),F=c();if(a()==="{"){if(P.template=!0,F+=c(),F+=f(on=>on!=="}"),a()!=="}")throw new Error("Unterminated "+(g?"class":"id")+" reference");let ge=c();g&&(F+=ge)}else if(g)for(;De(a())||a()==="\\";)a()==="\\"&&c(),F+=c();else F+=f(De);return m(P,F)},k=()=>{let p=d("STRING"),g=c();p.template=g==="`";let P="";for(;a()&&a()!==g;)if(a()==="\\"){c();let F=c();if(F in mt)P+=mt[F];else if(p.template&&F==="$")P+="\\$";else if(F==="x"){let ge=a()&&l(1)?parseInt(c()+c(),16):NaN;if(Number.isNaN(ge))throw new Error(`Invalid hexadecimal escape at [Line: ${p.line}, Column: ${p.column}]`);P+=String.fromCharCode(ge)}else P+=F}else P+=c();if(a()!==g)throw new Error(`Unterminated string at [Line: ${p.line}, Column: ${p.column}]`);return c(),m(p,P)},q=()=>{let p=d("IDENTIFIER"),g=c()+f(Me);return a()==="!"&&g==="beep"&&(g+=c()),m(p,g)},N=()=>{let p=d("IDENTIFIER"),g=c(),P=g==="\\";for(P&&(g="");(Me(a())||"\\{}".includes(a()||" "))&&!(a()==="$"&&!P);)a()==="\\"?(P=!0,c()):(P=!1,g+=c());return m(p,g)},C=()=>{let p=d("NUMBER"),g=c()+f(U);return a()==="."&&U(l(1))&&(g+=c()),g+=f(U),(a()==="e"||a()==="E")&&(U(l(1))?g+=c():l(1)==="-"&&(g+=c()+c())),m(p,g+f(U))},O=()=>{let p=d("OP");p.op=!0;let g=c();for(;a()&&dt.has(g+a());)g+=c();return m(p,g)},_=()=>{let p=d("ATTRIBUTE_REF"),g=c();return g==="["?(g+=f(P=>P!=="]"),a()==="]"&&(g+=c())):(g+=f(De),a()==="="&&(g+=c(),a()==='"'||a()==="'"?g+=k().value:Me(a())&&(g+=q().value))),m(p,g)},Z=()=>{let p=n.at(-1);return p?p.type==="IDENTIFIER"||p.type==="CLASS_REF"||p.type==="ID_REF"?!1:!(p.op&&(p.value===">"||p.value===")")):!0},X=()=>{let p=a(),g=l(2);return(p==="-"||p==="/")&&l(1)===p&&(_e(g)||g===""||g===p)};for(;r<e.length;){let p=a(),g=l(1);if(X())f(P=>P!=="\r"&&P!==`
|
|
5
|
+
`),c();else if(_e(p))n.push(m(d("WHITESPACE"),f(_e)));else if(!y()&&p==="."&&($(g)||g==="{"||g==="-"))n.push(w("CLASS_REF",!0));else if(!y()&&p==="#"&&($(g)||g==="{"))n.push(w("ID_REF",!1));else if(p==="@"||p==="["&&g==="@")n.push(_());else if(p==="*"&&$(g)){let P=d("STYLE_REF");n.push(m(P,c()+f(F=>$(F)||F==="-")))}else if(h()&&($(p)||p==="\\"))n.push(N());else if(!h()&&($(p)||p==="_"||p==="$"))n.push(q());else if(U(p))n.push(C());else if(!h()&&(p==='"'||p==="`"))n.push(k());else if(!h()&&p==="'")n.push(Z()?k():O());else if(dt.has(p))s==="$"&&p==="{"&&u++,p==="}"&&u--,n.push(O());else if(h()||p==="`"){let P=d("RESERVED");n.push(m(P,c()))}else throw new Error("Unknown token: "+p+" ")}return n}function E(e){return e.match("the"),cn(e)}function cn(e){let t=ht(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=ln(o.value,t,ht(e));return t}function ln(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>T(t.ev(o),i=>!!i===r?i:n.ev(o))}}var fn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function He(e){let t=$e(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=$e(e),u=fn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>I([i.ev(l),s.ev(l)],([c,d])=>u(c,d))}}return t}function $e(e){let t=G(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function G(e){e.match("the");let t=e.pos();if(e.match("not"))return Ue(e,"logicalNot",t,G(e),n=>!n);if(e.match("no"))return Ue(e,"noExpression",t,$e(e),qe);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return mn(e)}function Ue(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>T(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var dn="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function mn(e){let t=vt(e),n=e.matchAny(...dn)??e.matchOp("%");if(n)return pt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return pt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function pt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>T(n.ev(s),o)};return n.stat&&(i.stat=()=>o(de(n))),i}function vt(e){let t=e.pos();return e.matchOp("-")?Ue(e,"negativeNumber",t,vt(e),n=>-b(n)):bt(e)}function bt(e){let t=wn(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function Et(e){return e.match("the"),We(e,bt(e))}function We(e,t){let n=pn(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function pn(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&hn(t.expr);)t=t.expr;return t}var hn=e=>j(v(e,"ev"));function de(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function gn(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function ht(e){let t=He(e),n=gn(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=He(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=He(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=f=>l&&typeof f=="string"?f.toLowerCase():f,d=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:f=>I([t.ev(f),u??s?.ev(f),a?.ev(f)],([h,y,w])=>{if(o){let k=rt(h,o,i);return r==="a"?k:!k}if(d&&y===void 0&&(r==="is"||r==="is not")){let k=!!ie(h,d);return r==="is"?k:!k}return xt(r,c(h),c(y),w)})}}function gt(e,t){let n=v(e,"contains")??v(e,"includes");if(!j(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function yn(e,t){let n=v(e,"match")??v(e,"matches");if(!j(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var yt=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function xt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!xt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&yn(t,n);case"in":return n!=null&>(n,t);case"contain":case"include":return t!=null&>(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return yt(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return yt(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return qe(t);case"exist":return nt(t)}throw new Error("Unknown comparison : "+e)}function wn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),je("number",parseFloat(t.value),t);case"STRING":return En(e);case"ID_REF":return Nn(e);case"CLASS_REF":return Y(e);case"ATTRIBUTE_REF":return z(e);case"STYLE_REF":return Pt(e)}if(t.op){if(t.value==="(")return vn(e);if(t.value==="[")return xn(e);if(t.value==="{")return kn(e);if(t.value==="<")return Pn(e)}let n=e.match("true")??e.match("false");if(n)return je("boolean",n.value==="true",n);let r=e.match("null");if(r)return je("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return Tn(e)}function je(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function vn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>E(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var bn=(e,t)=>I(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function kt(e,t){let n=e.child(fe(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,E(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function En(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=kt(e,n);r.ev=i=>bn(o,i)}else r.stat=()=>n;return r}function xn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(E(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>I(n.map(o=>o.ev(r)),o=>o)}}function kn(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(E(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(E(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>I([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function Tt(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Tn(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>E(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>ut(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,d,m)=>ct(s,c,a,m,l?.ev(c))}}var Nt=(e,t)=>{let n=t.value.substring(2);return E(e.child(fe(n),n))};function Nn(e){let t=e.consume(),n=(o,i)=>Ae(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>u&&ce(u,s))};if(t.template){let o=r.expr=Nt(e,t);r.ev=i=>T(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Y(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>T(n.ev(r),s=>ce(Array.from(s instanceof H?s:[]),i))};if(t.template){let r=n.expr=Nt(e,t);n.ev=o=>T(r.ev(o),i=>new H("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new H(r,o.me,!0)}return n}var Ge=class extends H{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Pn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new H(n,o.me),lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>ce(Array.from(u instanceof H?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=kt(e,n);r.ev=i=>I(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new Ge(i.me,s))}return r}function z(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>ae(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>ue(s.you||s.me,r,a)}}function Pt(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?be:ve)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ee(o.you||o.me,r,s)}}function Rt(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(E(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>I(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function me(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function St(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function ke(e,t="Expected event name"){return e.matchType("STRING")?.value??St(e)??e.err(t)}function D(e,t){return Sn(e,t)??Cn(e,t)??Ln(e,t)??On(e,t)??In(e,t)??An(e,t)??Fn(e,t)??_n(e,t)??Rn(e,t)??t}function Rn(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Sn(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ie(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),xe(s,n,u)},del:(i,s)=>{A(s,r),S(s,u=>{M(u)&&delete u[n],x.wroteProperty(u)})}};return D(e,o)}function Cn(e,t){if(!e.match("of"))return;let n=G(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ie,attribute:ae,style:ve,computed:be}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:d=>T(c.root.ev(d),m=>l(m,u)),lhs:d=>c.root.ev(d),put:(d,m,f)=>{A(m,a),s==="attribute"?ue(m,u,f):s==="property"?xe(m,u,f):Ee(m,u,f)},del:(d,m)=>{A(m,a),S(m,f=>{s==="attribute"?R(f)&&f.removeAttribute(u):s==="property"?(M(f)&&delete f[u],x.wroteProperty(f)):f instanceof HTMLElement&&f.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function On(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=z(e)??Pt(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ie(l,i):o?.type==="attributeRef"?ae(l,o.name):o?.type==="computedStyleRef"?be(l,o.name):o&&ve(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>T(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,d)=>{A(c,s),i!==void 0?xe(c,i,d):o?.type==="attributeRef"?ue(c,o.name,d):o&&Ee(c,o.name,d)}};return D(e,a)}function In(e,t){if(!e.match("in"))return;let n=G(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")S(u,c=>R(c)&&a.push(...Fe(c,l)));else if(R(s)){let c=!1;if(S(u,d=>{d instanceof Node&&d.contains(s)&&(c=!0)}),c)return s}else S(s,c=>S(u,d=>c===d&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>I([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>ce(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function An(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=St(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>T(s.root.ev(u),a=>ot(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Fn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(E(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return I([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...d])=>{if(!l||a===void 0)return wt(c,void 0,d,s,r);A(c,o);let m=wt(v(c,a),c,d,s,r);return tt(c,a),m})}};return D(e,i)}function wt(e,t,n,r,o){if(!j(e))throw A(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Ln(e,t){let n=z(e);return n&&qn(e,t,n)}function qn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ae(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),ue(s,n.name,u)}};return o}function _n(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=E(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=E(e))),e.reqOp("]");let s=e.text(t),u=(c,d)=>b(d)<0?b(v(c,"length"))+b(d):b(d),a=(c,d,m)=>{let f=v(c,"slice");return j(f)?Reflect.apply(f,c,[d,m]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>I([l.root.ev(c),r.ev(c),i?.ev(c)],([d,m,f])=>d==null?null:n?a(d,0,u(d,m)+1):o?f==null?a(d,b(m)):a(d,b(m),u(d,f)+1):v(d,String(m))),lhs:c=>I([l.root.ev(c),r.ev(c)],d=>d),put:(c,d,m)=>{let[f,h]=Array.isArray(d)?d:[];A(f,s),M(f)&&(f[String(h)]=m)},del:(c,d)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[m,f]=Array.isArray(d)?d:[];A(m,s),Array.isArray(m)?m.splice(u(m,f),1):M(m)&&delete m[String(f)],x.wroteProperty(m)}};return D(e,l)}function It(e){let t=Y(e);if(!t)return;let n=[t];for(let r=Y(e);r;r=Y(e))n.push(r);return n}var Ve=(e,t)=>(e??[]).map(n=>T(n.ev(t),r=>String(v(r,"className")))),Dn=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),ze=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,Ct=(e,t,n,r,o)=>t?ft(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):S(e,i=>R(i)&&r(i)),pe=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),At=(e,t,n,r,o,i)=>i?Ct(t,n,r,s=>pe(s,i,e),s=>pe(s,i,!e)):I(o.map(s=>Ct(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function Ft(e){let t=It(e),n=t?void 0:z(e);return{refs:t,attribute:n,css:t||n?void 0:Rt(e)}}function Lt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ft(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>E(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?E(t):me(t),l=t.match("when")?E(t):void 0,c=o||i?l:void 0,d=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:f=>I([a.ev(f),s?.ev(f),u?.ev(f),...Ve(o,f)],([h,y,w,...k])=>{if(A(h,d),u){if(Array.isArray(h))h.push(w);else if(h instanceof Set)h.add(w);else throw h instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof h);x.wroteProperty(h)}else if(s)S(h,q=>{let N=ze(q);N&&(N.cssText+=y)});else return At(!0,h,c,f,k,i)})}}}var Mn=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function qt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ft(t),u=o||i||s?void 0:E(t),a=t.match("from")?E(t):u?void 0:me(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=E(t));let c=a?t.text(a):"",d=u?t.text(u):"",m=(h,y,w)=>{if(w==null&&u?.del&&u.lhs&&!Mn(y)){let k=u;return T(u.lhs(h),q=>k.del?.(h,q))}if(A(y,d),Array.isArray(w)){let k=w.indexOf(y);k>-1&&w.splice(k,1),x.wroteProperty(w)}else w instanceof Set||w instanceof Map?(w.delete(y),x.wroteProperty(w)):S(y,k=>{R(k)&&k.parentElement&&(w==null||w instanceof Node&&w.contains(k))&&k.parentElement.removeChild(k)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:h=>I([a?.ev(h),s?.ev(h),u?.ev(h),...Ve(o,h)],([y,w,k,...q])=>{if(u)return m(h,k,y);if(A(y,c),s){let N=Dn(String(w));S(y,C=>N.forEach(O=>ze(C)?.removeProperty(O)))}else return At(!1,y,l,h,q,i)})}}}var Ot=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},_t={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=V(t);n?t.style.display=n:e==="toggle"?_t.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Ot("visibility","hidden","visible"),opacity:Ot("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function Hn(e,t){let n=t??Q.defaultHideShowStrategy??"display";return Q.hideShowStrategies[n]??_t[n]??e.err("Unknown show/hide strategy : "+n)}function Dt(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let y=o.styleProp=t.consume().value.slice(1);i=Hn(t,y),o.on=t.match("of")?t.withFollow(["with","between"],()=>E(t)):me(t)}else if(t.match("between")){let y=Y(t);if(y)t.req("and"),o.between=[y,Y(t)??t.err("Expected classRef")];else{let w=z(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[w,z(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=It(t))&&!(o.attributeRef=z(t))){let y=t.g.toggleElement;if(!y)o.target=t.withFollow(["between"],()=>Et(t));else{let w=t.withFollow(["between","as"],()=>G(t));if(!t.peek("between"))return y(t,w,r);o.target=We(t,w)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?E(t):me(t)),t.match("between")){let y=o.betweenValues=t.withFollow(["and"],()=>{let w=[E(t)];for(;t.matchOp(",");)w.push(E(t));return w});t.req("and"),y.push(E(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=E(t)):t.match("until")&&(o.until=ke(t),t.match("from")&&(o.from=E(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:d}=o,m=s?t.text(s):"",f=(y,w)=>y[(y.findIndex(k=>k==w)+1)%y.length],h=(y,w,k,q)=>{if(a&&u?.lhs&&u.put){let N=u;return I([u.ev(y),u.lhs(y)],([C,O])=>N.put?.(y,O,f(k,C)))}if(a&&d)return S(w,N=>{let C=ze(N);if(!C||!R(N))return;let O=C.getPropertyValue(d)||getComputedStyle(N).getPropertyValue(d);C.setProperty(d,String(f(k,O)))});A(w,m),S(w,N=>{if(R(N))if(i)N instanceof HTMLElement&&i("toggle",N);else if(l){let[C,O]=l;if(C.type==="classRef"&&O.type==="classRef"){let[_,Z]=[String(C.className),String(O.className)],X=N.classList.contains(_);N.classList.toggle(_,!X),N.classList.toggle(Z,X)}else if(C.type==="attributeRef"&&O.type==="attributeRef"){let _=N.getAttribute(C.name)===String(C.value);pe(N,_?C:O,!1),pe(N,_?O:C,!0)}}else c?pe(N,c,!N.hasAttribute(c.name)):q.forEach(C=>N.classList.toggle(String(C)))})};return o.run=y=>I([s?.ev(y),o.time?.ev(y),o.from?.ev(y),I((a??[]).map(w=>w.ev(y)),w=>w),...Ve(o.classRefs,y)],([w,k,q,N,...C])=>{let O=()=>h(y,w,Array.isArray(N)?N:[],C);if(o.time)return new Promise(_=>{O(),setTimeout(()=>{O(),_()},b(k))});if(o.until){let _=o.until,Z=q||y.me;return new Promise(X=>{B(Z)&&Z.addEventListener(_,()=>{O(),X()},{once:!0}),O()})}return T(O(),()=>{})}),o}}var Mt=new WeakSet;function Ht(e){if(Mt.has(e))return;Mt.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let u=jn(s.sourceElement||o);if(!u)return;let a=Un(u.value,u.scopeElt),l=s.request?.body;if(l instanceof FormData)for(let c in a)l.set(c,a[c])}}))}function jn(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var Ne=e=>e&&W(e)?.scopes?.elementScope||{};function Te(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function $n(e,t){for(let n=t;n;n=n.parentElement){let r=Ne(n);if(e in r)return r[e]}}function Un(e,t){let n={},r=e.trim();if(r==="*"){let o=Ne(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Te(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=Ne(t);o in i&&(n[o.slice(1)]=Te(i[o]))}else if(o[0]==="^"){let i=$n(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Te(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=Ne(document.querySelector(o.slice(0,i))),u=o.slice(i+1);":"+u in s&&(n[u]=Te(s[":"+u]))}}}return n}var J=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},jt=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Pe=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new J(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function Be(e){let t=e.source.split(`
|
|
6
6
|
`),n=e.token.line?e.token.line-1:t.length-1,r=t[n]??"",o=e.token.line?e.token.column:Math.max(0,r.length-1),i=String(n+1).length,s=" ".repeat(i+5+o);return` ${n+1} | ${r}
|
|
7
7
|
`+s+"^".repeat(Math.max(1,e.token.value.length))+`
|
|
8
8
|
`+s+e.message+`
|
|
9
|
-
`}function
|
|
9
|
+
`}function $t(e){let t=e.pos();if(e.matchOp("(")){let a=$t(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&r(e,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=E(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>T(s.ev(a),l=>l?void 0:i.run(a))}}function te(e){let t=[];for(;e.hasMore();){let n=$t(e);if(!n)break;t.push(n),e.match("then")}return t}function Ut(e){let t=e.pos();if(e.matchOp("(")){let o=Ut(e);return e.reqOp(")"),o}let n=e.cur(),r=e.g.features[n.value];return!r||!e.match(n.value)?e.err("Expected feature"):r(e,t)}function Qe(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Ut(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function Gt(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=te(e)),e.match("finally")&&(t.finallyHandler=te(e)),t}function Wt(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}var Bt=jt();function Qt(...e){for(let t of e)t(Bt)}var Yt=e=>new Pe(Bt,fe(e),e);function Gn(e){let t=Yt(e),n=Qe(t);return t.hasMore()&&t.err(),n}function Jt(e){let t=Yt(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:te(t)}:t.featureStart(n)?{kind:"features",program:Qe(t)}:{kind:"expression",expression:E(t)};return t.hasMore()&&t.err(),r}function Vt(e,t){let n;try{n=Jt(e)}catch(i){throw i instanceof J?new Error(i.message+`
|
|
10
10
|
|
|
11
|
-
`+
|
|
11
|
+
`+Be(i)):i}let r=document.body;if(n.kind==="features"){for(let i of n.program.features)i.install(r,r);return}let o=Object.assign(le(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):T(ee(n.commands,o),i=>{let s=v(i,"k")==="return"?v(i,"value"):void 0;return s!==void 0?s:o.result})}var Zt=()=>Q.attributes.replaceAll(" ","").split(","),Xt=e=>e instanceof HTMLScriptElement&&e.type==="text/hyperscript";function Wn(e){for(let t of Zt())if(e.hasAttribute(t))return e.getAttribute(t);return Xt(e)?e.innerText:null}var Vn=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t},Kt=[];function zt(e){if(e.closest(Q.disableSelector))return;let t=Wn(e);if(!t)return;let n=Vn(t);if(W(e)?.initialized){if(W(e)?.scriptHash===n)return se.enter(e);Re(e)}if(!L(e,"hyperscript:before:init"))return;Object.assign(V(e),{initialized:!0,scriptHash:n});let r=Xt(e)?document.body:e,o=t;try{for(let s of Kt)o=s(o,e)??o;let{features:i}=Gn(o);se.enter(e);for(let s of i)s.install(r,e);e.setAttribute("data-hyperscript-powered","true"),L(e,"hyperscript:after:init"),setTimeout(()=>L(r,"load",{hyperscript:!0}),1)}catch(i){if(i instanceof J){o!==t&&(i.written=t),L(e,"hyperscript:parse-error",{errors:[i]});let s=i.written?`
|
|
12
12
|
rewritten from: ${i.written}
|
|
13
13
|
`:"";console.error("hyperscript: 1 parse error(s) on:",e,`
|
|
14
14
|
|
|
15
|
-
`+
|
|
15
|
+
`+Be(i)+s)}else L(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
|
|
16
16
|
|
|
17
|
-
`,i)}}var
|
|
17
|
+
`,i)}}var en=[],tn=[],Ye=new Set;function he(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!Ye.has(e)){Ye.add(e);try{for(let n of en)n(e);let t=Zt().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&zt(e),e.querySelectorAll(t).forEach(zt);for(let n of tn)n(e)}finally{Ye.delete(e)}}}function Re(e){let t=W(e);if(t){L(e,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of t.listeners??[])n.removeEventListener(r,o);for(let n of t.observers??[])n.disconnect();for(let n of t.timers??[])clearTimeout(n);x.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Re),L(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),et(e)}}se.process=he;function zn(e){try{let t=Jt(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof J)return{errors:[t]};throw t}}var Je=Object.assign(Vt,{config:Object.assign(Q,{conversions:Object.assign(Ce,{dynamicResolvers:Oe})}),use(e){e(Je)},addBeforeProcessHook:e=>void en.push(e),addAfterProcessHook:e=>void tn.push(e),addSourceTransform:e=>void Kt.push(e),evaluate:Vt,parse:zn,process:he,processNode:he,cleanup:Re,internals:{runtime:{cleanup:Re,processNode:he}},version:"7.4.0"});function nn(){if(Object.assign(globalThis,{_hyperscript:Je}),typeof document>"u")return;let e=()=>{he(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),Ht(Je)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function Bn(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=V(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function Ze(e,t){let n=Bn(e.me,t);if(n.executing&&!t.every){if(t.queue==="none"||t.queue==="first"&&n.queue.length>0)return;t.queue!=="all"&&(n.queue.length=0),n.queue.push(e);return}n.executing=!0;let r=o=>{n.executing=!1;let i=n.queue.shift();if(i&&setTimeout(()=>Ze(i,t),1),o){let{error:s}=o;console.error(v(s,"message")??s),console.error(v(s,"stack")),L(e.me,"exception",{error:s})}};oe(()=>T(lt(e,t.body,t),()=>r()),o=>r({error:o}))}function Qn(e,t){if(!B(t))return;let n=V(t),r=n.listeners??=[],o=n.observers??=[],i=n.timers??=new Set;for(let s of e.events){let u={execCount:0},a=s.elsewhere?[document]:s.from?s.from.ev(le(t,e,t,null)):[t];S(a,l=>{if(!B(l)){console.warn("'%s' feature ignored because target does not exists:",e.displayName,t);return}let c=s.on;if(s.mutationSpec&&l instanceof Node){c="hyperscript:mutation";let m=new MutationObserver(f=>L(l,c,{mutationList:f,observer:m}));m.observe(l,s.mutationSpec),o.push(m)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let m=new IntersectionObserver(f=>{for(let h of f)L(l,c,{observer:m,entry:h,intersecting:h.isIntersecting,isIntersecting:h.isIntersecting,intersectionRatio:h.intersectionRatio})},s.intersectionSpec);m.observe(l),o.push(m)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let m=new ResizeObserver(f=>{for(let h of f){let{width:y,height:w}=h.contentRect;L(l,c,{width:y,height:w,contentRect:h.contentRect,entry:h})}});m.observe(l),o.push(m)}let d=m=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,d);return}let f=le(t,e,t,m);if(!(s.elsewhere&&t instanceof Node&&m.target instanceof Node&&t.contains(m.target))){s.from&&(f.result=l);for(let h of s.args){let y=v(m,h);y!==void 0?f.locals[h]=y:f.detail!=null&&(f.locals[h]=v(f.detail,h))}if(s.filter){f.meta.context=m;try{if(!s.filter.ev(f))return}finally{f.meta.context=void 0}}if(s.inExpr?.css){let h=m.target instanceof Element?m.target:null;for(;h&&!h.matches(s.inExpr.css);)h=h.parentElement;if(!h)return;f.result=h}if(u.execCount++,s.startCount){let h=u.execCount;if(s.endCount?h<s.startCount||h>s.endCount:s.unbounded?h<s.startCount:h!==s.startCount)return}if(s.debounceTime){u.debounced&&(clearTimeout(u.debounced),i.delete(u.debounced)),i.add(u.debounced=setTimeout(()=>Ze(f,e),s.debounceTime));return}if(s.throttleTime){if(u.lastExec&&Date.now()<u.lastExec+s.throttleTime)return;u.lastExec=Date.now()}Ze(f,e)}};l.addEventListener(c,d),r.push({target:l,event:c,handler:d})})}}function Yn(e){if(!e.match("of"))return{attributes:!0,characterData:!0,childList:!0,attributeOldValue:!0,characterDataOldValue:!0};let t={};do if(e.match("anything"))Object.assign(t,{attributes:!0,subtree:!0,characterData:!0,childList:!0});else if(e.match("childList"))t.childList=!0;else if(e.match("attributes"))t.attributes=!0;else if(e.match("subtree"))t.subtree=!0;else if(e.match("characterData"))t.characterData=!0;else if(e.cur().type==="ATTRIBUTE_REF"){let n=e.consume().value;n.startsWith("@")||e.err("Only shorthand attribute references are allowed here"),(t.attributeFilter??=[]).push(n.substring(1))}else e.err("Unknown mutation config specification");while(e.match("or"));return(t.attributes||t.attributeFilter)&&(t.attributeOldValue=!0),t.characterData&&(t.characterDataOldValue=!0),t}function Jn(e){let t={};if(e.match("with")){let n=de(E(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=Tt(e):e.match("threshold")?t.threshold=Number(de(E(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function Zn(e,t){let n=ke(e),r=Wt(e),o;e.matchOp("[")&&(o=E(e),e.reqOp("]"));let i,s,u=!1;t?i=1:e.cur().type==="NUMBER"&&(i=parseInt(e.consume().value),e.match("to")?s=parseInt(e.consume().value):e.match("and")&&(u=!0,e.req("on")));let a={on:n,args:r,filter:o,startCount:i,endCount:s,unbounded:u,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=Jn(e):n==="mutation"&&(a.mutationSpec=Yn(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>E(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=G(e));let l=()=>(e.req("at"),Number(de(G(e))));return e.match("debounced")?a.debounceTime=l():e.match("throttled")&&(a.throttleTime=l()),a}function rn(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(Zn(t,o));while(t.match("or"));let s="last";!r&&t.match("queue")&&(t.match("all")?s="all":t.match("first")?s="first":t.match("none")?s="none":t.req("last"));let u=te(t),a={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:u,every:r,queue:s,...Gt(t),start:n,end:t.endPos(),install:l=>Qn(a,l)};return a}}Qt(rn,Lt,qt,Dt);nn();})();
|
package/dist/runtime.d.ts
CHANGED
|
@@ -58,7 +58,8 @@ export interface ElementData {
|
|
|
58
58
|
loops?: Record<string, LoopScope>;
|
|
59
59
|
}
|
|
60
60
|
export declare const peekData: (elt: object) => ElementData | undefined;
|
|
61
|
-
|
|
61
|
+
/** Forget an element's state; true when it had some. */
|
|
62
|
+
export declare function dropData(elt: object): boolean;
|
|
62
63
|
export declare function dataOf(elt: object): ElementData;
|
|
63
64
|
/**
|
|
64
65
|
* Where reads and writes report to the reactivity module. Every member is a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixi/engine",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "A small, typed hyperscript engine, faithful to upstream _hyperscript: its test suite is the acceptance oracle. Ships hyperfixi-hs.js, the script-tag bundle",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|