@hyperfixi/engine 7.4.0 → 7.5.1

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 CHANGED
@@ -7,6 +7,117 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.5.1] - 2026-10-23
11
+
12
+ The last two silent misreads of hand-written non-English hyperscript that the 7.3.0 live test
13
+ found: one is now refused, the other reads right.
14
+
15
+ ### Fixed
16
+
17
+ - **ko: an event word followed by its object particle is the verb's object, not a handler.** At
18
+ top level, hand-written `로드 를 대기` (wait for load) read as `on load wait 를`: a handler on
19
+ `load` waiting on a variable named `를`, and translate() did not refuse it. Top level is now
20
+ refused, as ja `ロード を 待つ` and tr `yükleme i bekle` already were; inside a handler,
21
+ `클릭 할 때 로드 를 대기` still reads `wait for load`. ko's own render of
22
+ `trigger click on #btn …` (`#btn에 클릭을 트리거 …`) had been refused for the same reason and now
23
+ translates.
24
+ - **es `eso`, `esto` and a detached `lo` read as `it`, as do pt `isto` and fr `cela`/`ceci`.**
25
+ `poner eso en #o` read `put eso into #o`, a variable nobody set, with no error. Most profiles
26
+ already write `it` as a demonstrative (pt `isso`, fr `ça`, ru `это`, he `זה`, ja `それ`). What
27
+ `it` renders to is unchanged. A variable spelled like one of these words now reads as `it` in
28
+ that language, as one named `isso` already did in pt; MCP `translate_code` reports it
29
+ (`NAME_COLLISION`) with a rename.
30
+
31
+ ## [7.5.0] - 2026-10-22
32
+
33
+ What a live test of 7.3.0 found users hitting. The Vite plugin loads in a CommonJS project and
34
+ ships types. MCP `diff_behaviors` compares whole handlers, and `npx` installs the engine.
35
+ Hand-written non-English hyperscript that ran wrong in silence now reads right or says so. A
36
+ minor: `@lokascript/htmx-adapter`'s `hx-on` change restores what its README always documented
37
+ (bodies are JavaScript by default), and a page that relied on the engine switching them adds
38
+ `<meta name="htmx-i18n-hx-on" content="hyperscript">`.
39
+
40
+ ### Changed
41
+
42
+ - **`@lokascript/htmx-adapter`: `hx-on` bodies stay JavaScript unless the page opts in to
43
+ hyperscript bodies.** The adapter used to switch every `hx-on` body on the page to hyperscript
44
+ whenever a hyperscript engine (`window._hyperscript`) was loaded, and the documented stack (the
45
+ engine, htmx 4 and this adapter) always has one. So a plain-JavaScript
46
+ `hx-on:click="document.getElementById('o').textContent = 'ran'"` failed with a hyperscript parse
47
+ error, although the README says bodies are JavaScript by default. The opt-in is now explicit:
48
+ `<meta name="htmx-i18n-hx-on" content="hyperscript">`, or `setBodyExecutor()` as before. A page
49
+ that wrote hyperscript `hx-on` bodies and relied on the engine alone adds the `<meta>` tag. With
50
+ the tag and no engine on the page, the adapter warns and the bodies stay JavaScript.
51
+
52
+ ### Fixed
53
+
54
+ - **`@hyperfixi/vite-plugin` loads in a CommonJS project.** `npm init -y` writes
55
+ `"type": "commonjs"`, and there the plugin's `require` build failed with
56
+ `ERR_PACKAGE_PATH_NOT_EXPORTED`: it requires `@hyperfixi/engine`, whose `exports` had only an
57
+ `import` condition. The engine's `exports` now name its ES module as the `default` too, which
58
+ Node 20.19+ and 22.12+ (what Vite 8 needs) can `require`.
59
+ - **`@hyperfixi/vite-plugin` ships types for the app side** (`@hyperfixi/vite-plugin/client`):
60
+ the virtual module and `window.hyperfixi` / `window._hyperscript`. A TypeScript 6 project
61
+ rejected `import 'hyperfixi'` (`TS2882`). The README has a TypeScript section, with JSX's
62
+ `data-script` and an augmentation for `_`.
63
+ - **The Vite plugin's scanner reads a `<script type="text/hyperscript">` block that contains
64
+ `<`** (`if n < 10`, a `<div/>` query). It skipped the whole block, so its commands were not
65
+ bundled and the page failed to parse. It also reads the `script` and `data-script` attributes,
66
+ which the engine runs as it runs `_`, and a production build scans Vite's `root` rather than the
67
+ working directory (`vite build app` from a parent directory bundled the siblings' modules).
68
+ - **MCP `diff_behaviors` no longer calls any two multi-command or `if` handlers identical.** It
69
+ compared the operations it could extract, and it extracted single commands only: a `then` chain
70
+ (a `compound` node), an `if`, a loop and every command it had no extractor for gave nothing, so
71
+ `remove .b then wait 2s` and `remove .c then wait 5s` were "No semantic change", and so were an
72
+ English handler and an unrelated Spanish one. It now compares every command of a chain, both
73
+ branches of an `if`, a loop's body, and any other command with all its written roles (a
74
+ `fetch`'s `with` options included), and `this` is no longer read as `me`. Faithful translations
75
+ still compare identical (checked on chains, branches, loops and `wait for` in ja, es and ar).
76
+ - **`npx @hyperfixi/mcp-server` installs the engine.** `@hyperfixi/engine`, `@hyperfixi/core` and
77
+ `@hyperfixi/server-bridge` were optional peers, which `npx` leaves out, so the documented
78
+ install checked nothing on the engine: every error only the engine catches came back `ok`, and
79
+ only stderr said so. They are dependencies now, and a validation whose engine check could not
80
+ run says so in the result (`ENGINE_CHECK_SKIPPED`, `info`; `get_diagnostics`:
81
+ `engine-check-skipped`). release-smoke installs the server alone and checks for the three.
82
+ - **Validation warns on `this`** (`THIS_IS_NOT_ME`): hyperscript has no `this`, so
83
+ `toggle .a on this` or `put this.value.length into #n` reads a variable nobody set and does
84
+ nothing. These validated clean (6 of 10 clean-validating snippets that did nothing, in the 7.3.0
85
+ live test). The inert-shape warnings also reach commands after a `then` and inside an `if`'s
86
+ branches; they read only a block's `body` before.
87
+ - **The IR `validate_and_compile` returns has the commands of a chain, a branch or a loop**: a
88
+ `then` chain is `compound` with each command in `body`, an `if` has `body` and `else`. A chain
89
+ came back as `compound` with no commands, so it could not be checked against an intent.
90
+ - **AGENTS.md** said `this`, `and` or a comma between commands, and `put … in` work; all four fail
91
+ on both engines. Its worked example showed output the server no longer gives, and it quoted a
92
+ fidelity figure ("~76%") from before the renderer reached 100% on the corpus. Rewritten from the
93
+ server's real output.
94
+ - **Multilingual: a native time unit after the event is a duration.** ko `클릭할 때 1초 대기`,
95
+ tr `tıklamada 1 saniye bekle` and ja `クリックで 1 秒 待つ` came back `on click 1 wait s`: the
96
+ number became a click count (the handler ran on the first click only) and the wait waited for
97
+ nothing, with no error. A number and the language's word for a unit after it, glued or spaced,
98
+ are one duration now (`wait 1s`, `wait 150ms`).
99
+ - **Multilingual: a bare URL with a number in it translates.** `fetch /api/items/42` and
100
+ `fetch /api/slow?ms=300` were refused in every language, both ways ("would lose 42"): the check
101
+ counted the URL's numbers alone, and the translation writes the URL quoted. A bare URL is one
102
+ value now, the same as quoted.
103
+ - **Multilingual: es and pt `esperar a <event>` waits for the event.** es `esperar a continue`
104
+ came back `wait continue`, a timed wait on a variable, which waits for nothing. `esperar a`
105
+ (es, pt) and `esperar por` (pt) read as `wait for`, as `esperar evento` already did.
106
+ - **Multilingual: a hover word is `mouseenter`.** Eighteen languages' hover word (es `sobrevolar`,
107
+ fr `survol`, ko `호버`, …) read as `on hover`, which is not a DOM event, so the handler never ran.
108
+ They read as `on mouseenter` now; what `on mouseenter` is written as does not change.
109
+ - **Multilingual: a dropped word with content of its own is refused, not dropped.** es
110
+ `al hacer clic fuera quitar .open de mí` came back `on click remove .open from me` (the dropdown
111
+ closed on every click): a particle the language maps to a word with meaning (`fuera`, `out`) was
112
+ skipped like a role marker. Such a translation is refused now (`LossyTranslationError`).
113
+ - **`@lokascript/hyperscript-adapter` warns when a handler listens for a word nothing fires.**
114
+ A word the language does not know as an event (es `al pulsar …`, de `beim Tippen …`) runs as a
115
+ custom event of that name, and the handler never ran, silently. The adapter now warns once per
116
+ language and word. A name written as code (`miEvento`, `draggable:start`) stays quiet. No event
117
+ words were added: loka-js and our dictionaries ship the noun (`clic`), not the verbs. MCP
118
+ `validate_and_compile` reports the same, as an `UNKNOWN_EVENT_WORD` warning on non-English
119
+ input (`get_code_fixes` has its fix).
120
+
10
121
  ## [7.4.0] - 2026-10-21
11
122
 
12
123
  Content htmx or fixi swaps in runs its hyperscript, as it does on upstream `_hyperscript`: the
package/dist/common.js CHANGED
@@ -2852,7 +2852,7 @@
2852
2852
  cleanup,
2853
2853
  /** The part of upstream's `internals` that pages and tests reach for. */
2854
2854
  internals: { runtime: { cleanup, processNode } },
2855
- version: false ? "dev" : "7.4.0"
2855
+ version: false ? "dev" : "7.5.1"
2856
2856
  });
2857
2857
  function boot() {
2858
2858
  Object.assign(globalThis, { _hyperscript: api });
@@ -14,4 +14,4 @@
14
14
 
15
15
  `+at(i)+s)}else F(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
16
16
 
17
- `,i)}}var wn=[],vn=[],ut=new Set;function we(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!ut.has(e)){ut.add(e);try{for(let n of wn)n(e);let t=hn().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&ln(e),e.querySelectorAll(t).forEach(ln);for(let n of vn)n(e)}finally{ut.delete(e)}}}function Me(e){let t=J(e);if(t){F(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);k.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Me),F(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),mt(e)}}U.process=we;function fr(e){try{let t=pn(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof te)return{errors:[t]};throw t}}var ct=Object.assign(cn,{config:Object.assign(K,{conversions:Object.assign(He,{dynamicResolvers:De})}),use(e){e(ct)},addBeforeProcessHook:e=>void wn.push(e),addAfterProcessHook:e=>void vn.push(e),addSourceTransform:e=>void gn.push(e),evaluate:cn,parse:fr,process:we,processNode:we,cleanup:Me,internals:{runtime:{cleanup:Me,processNode:we}},version:"7.4.0"});function En(){if(Object.assign(globalThis,{_hyperscript:ct}),typeof document>"u")return;let e=()=>{we(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),an(ct)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function mr(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=X(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function lt(e,t){let n=mr(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(()=>lt(i,t),1),o){let{error:s}=o;console.error(v(s,"message")??s),console.error(v(s,"stack")),F(e.me,"exception",{error:s})}};ue(()=>x(vt(e,t.body,t),()=>r()),o=>r({error:o}))}function pr(e,t){if(!W(t))return;let n=X(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(pe(t,e,t,null)):[t];T(a,l=>{if(!W(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 f=new MutationObserver(d=>F(l,c,{mutationList:d,observer:f}));f.observe(l,s.mutationSpec),o.push(f)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let f=new IntersectionObserver(d=>{for(let m of d)F(l,c,{observer:f,entry:m,intersecting:m.isIntersecting,isIntersecting:m.isIntersecting,intersectionRatio:m.intersectionRatio})},s.intersectionSpec);f.observe(l),o.push(f)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let f=new ResizeObserver(d=>{for(let m of d){let{width:h,height:E}=m.contentRect;F(l,c,{width:h,height:E,contentRect:m.contentRect,entry:m})}});f.observe(l),o.push(f)}let p=f=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,p);return}let d=pe(t,e,t,f);if(!(s.elsewhere&&t instanceof Node&&f.target instanceof Node&&t.contains(f.target))){s.from&&(d.result=l);for(let m of s.args){let h=v(f,m);h!==void 0?d.locals[m]=h:d.detail!=null&&(d.locals[m]=v(d.detail,m))}if(s.filter){d.meta.context=f;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let m=f.target instanceof Element?f.target:null;for(;m&&!m.matches(s.inExpr.css);)m=m.parentElement;if(!m)return;d.result=m}if(u.execCount++,s.startCount){let m=u.execCount;if(s.endCount?m<s.startCount||m>s.endCount:s.unbounded?m<s.startCount:m!==s.startCount)return}if(s.debounceTime){u.debounced&&(clearTimeout(u.debounced),i.delete(u.debounced)),i.add(u.debounced=setTimeout(()=>lt(d,e),s.debounceTime));return}if(s.throttleTime){if(u.lastExec&&Date.now()<u.lastExec+s.throttleTime)return;u.lastExec=Date.now()}lt(d,e)}};l.addEventListener(c,p),r.push({target:l,event:c,handler:p})})}}function hr(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 yr(e){let t={};if(e.match("with")){let n=ye(g(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=At(e):e.match("threshold")?t.threshold=Number(ye(g(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function gr(e,t){let n=ee(e),r=Oe(e),o;e.matchOp("[")&&(o=g(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=yr(e):n==="mutation"&&(a.mutationSpec=hr(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>g(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=z(e));let l=()=>(e.req("at"),Number(ye(z(e))));return e.match("debounced")?a.debounceTime=l():e.match("throttled")&&(a.throttleTime=l()),a}function xn(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(gr(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=Y(t),a={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:u,every:r,queue:s,...qt(t),start:n,end:t.endPos(),install:l=>pr(a,l)};return a}}fn(xn,Vt,Bt,Qt,Yt,nn,on,rn,Ht,Dt,Jt,Xt,Zt,Kt,en);En();})();
17
+ `,i)}}var wn=[],vn=[],ut=new Set;function we(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!ut.has(e)){ut.add(e);try{for(let n of wn)n(e);let t=hn().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&ln(e),e.querySelectorAll(t).forEach(ln);for(let n of vn)n(e)}finally{ut.delete(e)}}}function Me(e){let t=J(e);if(t){F(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);k.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Me),F(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),mt(e)}}U.process=we;function fr(e){try{let t=pn(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof te)return{errors:[t]};throw t}}var ct=Object.assign(cn,{config:Object.assign(K,{conversions:Object.assign(He,{dynamicResolvers:De})}),use(e){e(ct)},addBeforeProcessHook:e=>void wn.push(e),addAfterProcessHook:e=>void vn.push(e),addSourceTransform:e=>void gn.push(e),evaluate:cn,parse:fr,process:we,processNode:we,cleanup:Me,internals:{runtime:{cleanup:Me,processNode:we}},version:"7.5.1"});function En(){if(Object.assign(globalThis,{_hyperscript:ct}),typeof document>"u")return;let e=()=>{we(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),an(ct)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function mr(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=X(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function lt(e,t){let n=mr(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(()=>lt(i,t),1),o){let{error:s}=o;console.error(v(s,"message")??s),console.error(v(s,"stack")),F(e.me,"exception",{error:s})}};ue(()=>x(vt(e,t.body,t),()=>r()),o=>r({error:o}))}function pr(e,t){if(!W(t))return;let n=X(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(pe(t,e,t,null)):[t];T(a,l=>{if(!W(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 f=new MutationObserver(d=>F(l,c,{mutationList:d,observer:f}));f.observe(l,s.mutationSpec),o.push(f)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let f=new IntersectionObserver(d=>{for(let m of d)F(l,c,{observer:f,entry:m,intersecting:m.isIntersecting,isIntersecting:m.isIntersecting,intersectionRatio:m.intersectionRatio})},s.intersectionSpec);f.observe(l),o.push(f)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let f=new ResizeObserver(d=>{for(let m of d){let{width:h,height:E}=m.contentRect;F(l,c,{width:h,height:E,contentRect:m.contentRect,entry:m})}});f.observe(l),o.push(f)}let p=f=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,p);return}let d=pe(t,e,t,f);if(!(s.elsewhere&&t instanceof Node&&f.target instanceof Node&&t.contains(f.target))){s.from&&(d.result=l);for(let m of s.args){let h=v(f,m);h!==void 0?d.locals[m]=h:d.detail!=null&&(d.locals[m]=v(d.detail,m))}if(s.filter){d.meta.context=f;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let m=f.target instanceof Element?f.target:null;for(;m&&!m.matches(s.inExpr.css);)m=m.parentElement;if(!m)return;d.result=m}if(u.execCount++,s.startCount){let m=u.execCount;if(s.endCount?m<s.startCount||m>s.endCount:s.unbounded?m<s.startCount:m!==s.startCount)return}if(s.debounceTime){u.debounced&&(clearTimeout(u.debounced),i.delete(u.debounced)),i.add(u.debounced=setTimeout(()=>lt(d,e),s.debounceTime));return}if(s.throttleTime){if(u.lastExec&&Date.now()<u.lastExec+s.throttleTime)return;u.lastExec=Date.now()}lt(d,e)}};l.addEventListener(c,p),r.push({target:l,event:c,handler:p})})}}function hr(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 yr(e){let t={};if(e.match("with")){let n=ye(g(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=At(e):e.match("threshold")?t.threshold=Number(ye(g(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function gr(e,t){let n=ee(e),r=Oe(e),o;e.matchOp("[")&&(o=g(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=yr(e):n==="mutation"&&(a.mutationSpec=hr(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>g(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=z(e));let l=()=>(e.req("at"),Number(ye(z(e))));return e.match("debounced")?a.debounceTime=l():e.match("throttled")&&(a.throttleTime=l()),a}function xn(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(gr(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=Y(t),a={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:u,every:r,queue:s,...qt(t),start:n,end:t.endPos(),install:l=>pr(a,l)};return a}}fn(xn,Vt,Bt,Qt,Yt,nn,on,rn,Ht,Dt,Jt,Xt,Zt,Kt,en);En();})();
package/dist/core.js CHANGED
@@ -2022,7 +2022,7 @@
2022
2022
  cleanup,
2023
2023
  /** The part of upstream's `internals` that pages and tests reach for. */
2024
2024
  internals: { runtime: { cleanup, processNode } },
2025
- version: false ? "dev" : "7.4.0"
2025
+ version: false ? "dev" : "7.5.1"
2026
2026
  });
2027
2027
  function boot() {
2028
2028
  Object.assign(globalThis, { _hyperscript: api });
package/dist/core.min.js CHANGED
@@ -14,4 +14,4 @@
14
14
 
15
15
  `+Fe(i)+s)}else N(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
16
16
 
17
- `,i)}}var It=[],Ct=[],_e=new Set;function re(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!_e.has(e)){_e.add(e);try{for(let n of It)n(e);let t=St().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&bt(e),e.querySelectorAll(t).forEach(bt);for(let n of Ct)n(e)}finally{_e.delete(e)}}}function he(e){let t=D(e);if(t){N(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);w.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(he),N(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),Ue(e)}}Y.process=re;function Tn(e){try{let t=Nt(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof H)return{errors:[t]};throw t}}var Le=Object.assign(xt,{config:Object.assign(ie,{conversions:Object.assign(ye,{dynamicResolvers:ve})}),use(e){e(Le)},addBeforeProcessHook:e=>void It.push(e),addAfterProcessHook:e=>void Ct.push(e),addSourceTransform:e=>void Ot.push(e),evaluate:xt,parse:Tn,process:re,processNode:re,cleanup:he,internals:{runtime:{cleanup:he,processNode:re}},version:"7.4.0"});function At(){if(Object.assign(globalThis,{_hyperscript:Le}),typeof document>"u")return;let e=()=>{re(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),ht(Le)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function Pn(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=U(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function De(e,t){let n=Pn(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(()=>De(i,t),1),o){let{error:s}=o;console.error(g(s,"message")??s),console.error(g(s,"stack")),N(e.me,"exception",{error:s})}};V(()=>E(Xe(e,t.body,t),()=>r()),o=>r({error:o}))}function Nn(e,t){if(!B(t))return;let n=U(t),r=n.listeners??=[],o=n.observers??=[],i=n.timers??=new Set;for(let s of e.events){let a={execCount:0},u=s.elsewhere?[document]:s.from?s.from.ev(ee(t,e,t,null)):[t];P(u,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(d=>N(l,c,{mutationList:d,observer:m}));m.observe(l,s.mutationSpec),o.push(m)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let m=new IntersectionObserver(d=>{for(let y of d)N(l,c,{observer:m,entry:y,intersecting:y.isIntersecting,isIntersecting:y.isIntersecting,intersectionRatio:y.intersectionRatio})},s.intersectionSpec);m.observe(l),o.push(m)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let m=new ResizeObserver(d=>{for(let y of d){let{width:I,height:j}=y.contentRect;N(l,c,{width:I,height:j,contentRect:y.contentRect,entry:y})}});m.observe(l),o.push(m)}let p=m=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,p);return}let d=ee(t,e,t,m);if(!(s.elsewhere&&t instanceof Node&&m.target instanceof Node&&t.contains(m.target))){s.from&&(d.result=l);for(let y of s.args){let I=g(m,y);I!==void 0?d.locals[y]=I:d.detail!=null&&(d.locals[y]=g(d.detail,y))}if(s.filter){d.meta.context=m;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let y=m.target instanceof Element?m.target:null;for(;y&&!y.matches(s.inExpr.css);)y=y.parentElement;if(!y)return;d.result=y}if(a.execCount++,s.startCount){let y=a.execCount;if(s.endCount?y<s.startCount||y>s.endCount:s.unbounded?y<s.startCount:y!==s.startCount)return}if(s.debounceTime){a.debounced&&(clearTimeout(a.debounced),i.delete(a.debounced)),i.add(a.debounced=setTimeout(()=>De(d,e),s.debounceTime));return}if(s.throttleTime){if(a.lastExec&&Date.now()<a.lastExec+s.throttleTime)return;a.lastExec=Date.now()}De(d,e)}};l.addEventListener(c,p),r.push({target:l,event:c,handler:p})})}}function Sn(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 Rn(e){let t={};if(e.match("with")){let n=ne(b(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=ct(e):e.match("threshold")?t.threshold=Number(ne(b(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function On(e,t){let n=mt(e),r=Et(e),o;e.matchOp("[")&&(o=b(e),e.reqOp("]"));let i,s,a=!1;t?i=1:e.cur().type==="NUMBER"&&(i=parseInt(e.consume().value),e.match("to")?s=parseInt(e.consume().value):e.match("and")&&(a=!0,e.req("on")));let u={on:n,args:r,filter:o,startCount:i,endCount:s,unbounded:a,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?u.intersectionSpec=Rn(e):n==="mutation"&&(u.mutationSpec=Sn(e)),e.match("from")&&(e.match("elsewhere")?u.elsewhere=!0:u.from=e.withFollow(["or"],()=>b(e))),!u.from&&!u.elsewhere&&e.match("elsewhere")&&(u.elsewhere=!0),e.match("in")&&(u.inExpr=M(e));let l=()=>(e.req("at"),Number(ne(M(e))));return e.match("debounced")?u.debounceTime=l():e.match("throttled")&&(u.throttleTime=l()),u}function Ft(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(On(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 a=W(t),u={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:a,every:r,queue:s,...wt(t),start:n,end:t.endPos(),install:l=>Nn(u,l)};return u}}Tt(Ft);At();})();
17
+ `,i)}}var It=[],Ct=[],_e=new Set;function re(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!_e.has(e)){_e.add(e);try{for(let n of It)n(e);let t=St().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&bt(e),e.querySelectorAll(t).forEach(bt);for(let n of Ct)n(e)}finally{_e.delete(e)}}}function he(e){let t=D(e);if(t){N(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);w.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(he),N(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),Ue(e)}}Y.process=re;function Tn(e){try{let t=Nt(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof H)return{errors:[t]};throw t}}var Le=Object.assign(xt,{config:Object.assign(ie,{conversions:Object.assign(ye,{dynamicResolvers:ve})}),use(e){e(Le)},addBeforeProcessHook:e=>void It.push(e),addAfterProcessHook:e=>void Ct.push(e),addSourceTransform:e=>void Ot.push(e),evaluate:xt,parse:Tn,process:re,processNode:re,cleanup:he,internals:{runtime:{cleanup:he,processNode:re}},version:"7.5.1"});function At(){if(Object.assign(globalThis,{_hyperscript:Le}),typeof document>"u")return;let e=()=>{re(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),ht(Le)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function Pn(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=U(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function De(e,t){let n=Pn(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(()=>De(i,t),1),o){let{error:s}=o;console.error(g(s,"message")??s),console.error(g(s,"stack")),N(e.me,"exception",{error:s})}};V(()=>E(Xe(e,t.body,t),()=>r()),o=>r({error:o}))}function Nn(e,t){if(!B(t))return;let n=U(t),r=n.listeners??=[],o=n.observers??=[],i=n.timers??=new Set;for(let s of e.events){let a={execCount:0},u=s.elsewhere?[document]:s.from?s.from.ev(ee(t,e,t,null)):[t];P(u,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(d=>N(l,c,{mutationList:d,observer:m}));m.observe(l,s.mutationSpec),o.push(m)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let m=new IntersectionObserver(d=>{for(let y of d)N(l,c,{observer:m,entry:y,intersecting:y.isIntersecting,isIntersecting:y.isIntersecting,intersectionRatio:y.intersectionRatio})},s.intersectionSpec);m.observe(l),o.push(m)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let m=new ResizeObserver(d=>{for(let y of d){let{width:I,height:j}=y.contentRect;N(l,c,{width:I,height:j,contentRect:y.contentRect,entry:y})}});m.observe(l),o.push(m)}let p=m=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,p);return}let d=ee(t,e,t,m);if(!(s.elsewhere&&t instanceof Node&&m.target instanceof Node&&t.contains(m.target))){s.from&&(d.result=l);for(let y of s.args){let I=g(m,y);I!==void 0?d.locals[y]=I:d.detail!=null&&(d.locals[y]=g(d.detail,y))}if(s.filter){d.meta.context=m;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let y=m.target instanceof Element?m.target:null;for(;y&&!y.matches(s.inExpr.css);)y=y.parentElement;if(!y)return;d.result=y}if(a.execCount++,s.startCount){let y=a.execCount;if(s.endCount?y<s.startCount||y>s.endCount:s.unbounded?y<s.startCount:y!==s.startCount)return}if(s.debounceTime){a.debounced&&(clearTimeout(a.debounced),i.delete(a.debounced)),i.add(a.debounced=setTimeout(()=>De(d,e),s.debounceTime));return}if(s.throttleTime){if(a.lastExec&&Date.now()<a.lastExec+s.throttleTime)return;a.lastExec=Date.now()}De(d,e)}};l.addEventListener(c,p),r.push({target:l,event:c,handler:p})})}}function Sn(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 Rn(e){let t={};if(e.match("with")){let n=ne(b(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=ct(e):e.match("threshold")?t.threshold=Number(ne(b(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function On(e,t){let n=mt(e),r=Et(e),o;e.matchOp("[")&&(o=b(e),e.reqOp("]"));let i,s,a=!1;t?i=1:e.cur().type==="NUMBER"&&(i=parseInt(e.consume().value),e.match("to")?s=parseInt(e.consume().value):e.match("and")&&(a=!0,e.req("on")));let u={on:n,args:r,filter:o,startCount:i,endCount:s,unbounded:a,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?u.intersectionSpec=Rn(e):n==="mutation"&&(u.mutationSpec=Sn(e)),e.match("from")&&(e.match("elsewhere")?u.elsewhere=!0:u.from=e.withFollow(["or"],()=>b(e))),!u.from&&!u.elsewhere&&e.match("elsewhere")&&(u.elsewhere=!0),e.match("in")&&(u.inExpr=M(e));let l=()=>(e.req("at"),Number(ne(M(e))));return e.match("debounced")?u.debounceTime=l():e.match("throttled")&&(u.throttleTime=l()),u}function Ft(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(On(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 a=W(t),u={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:a,every:r,queue:s,...wt(t),start:n,end:t.endPos(),install:l=>Nn(u,l)};return u}}Tt(Ft);At();})();
package/dist/full.js CHANGED
@@ -2145,7 +2145,7 @@
2145
2145
  cleanup,
2146
2146
  /** The part of upstream's `internals` that pages and tests reach for. */
2147
2147
  internals: { runtime: { cleanup, processNode } },
2148
- version: false ? "dev" : "7.4.0"
2148
+ version: false ? "dev" : "7.5.1"
2149
2149
  });
2150
2150
  function boot() {
2151
2151
  Object.assign(globalThis, { _hyperscript: api });
package/dist/full.min.js CHANGED
@@ -14,6 +14,6 @@
14
14
 
15
15
  `+jt(s)+i)}else _(t,"exception",{error:s}),console.error("hyperscript errors were found on the following element:",t,`
16
16
 
17
- `,s)}}var Fn=[],Mn=[],Dt=new Set;function fe(t){if((t instanceof Element||t instanceof Document||t instanceof DocumentFragment)&&!Dt.has(t)){Dt.add(t);try{for(let n of Fn)n(t);let e=On().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";t instanceof Element&&t.matches(e)&&Cn(t),t.querySelectorAll(e).forEach(Cn);for(let n of Mn)n(t)}finally{Dt.delete(t)}}}function xe(t){let e=oe(t);if(e){_(t,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of e.listeners??[])n.removeEventListener(r,o);for(let n of e.observers??[])n.disconnect();for(let n of e.timers??[])clearTimeout(n);P.stop(t),t.querySelectorAll("[data-hyperscript-powered]").forEach(xe),_(t,"hyperscript:after:cleanup"),t.removeAttribute("data-hyperscript-powered"),sn(t)}}z.process=fe;function Jo(t){try{let e=In(t);return e.kind==="features"?{...e.program,errors:[]}:{...e.kind==="commands"?e.commands[0]:e.expression,errors:[]}}catch(e){if(e instanceof be)return{errors:[e]};throw e}}var We=Object.assign(Tn,{config:Object.assign(Z,{conversions:Object.assign(ge,{dynamicResolvers:Fe})}),use(t){t(We)},addBeforeProcessHook:t=>void Fn.push(t),addAfterProcessHook:t=>void Mn.push(t),addSourceTransform:t=>void Ln.push(t),evaluate:Tn,parse:Jo,process:fe,processNode:fe,cleanup:xe,internals:{runtime:{cleanup:xe,processNode:fe}},version:"7.4.0"});function qn(){if(Object.assign(globalThis,{_hyperscript:We}),typeof document>"u")return;let t=()=>{fe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),xn(We)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}function _n(t){t.unaries.push(e=>{let n=1;for(;e.tok(n).type==="IDENTIFIER"&&e.tok(n+1).op&&e.tok(n+1).value===".";)n+=2;let r=e.tok(n+1);if(!e.peek("new")||e.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=e.pos();e.consume();let s=[e.consume().value];for(;e.matchOp(".");)s.push(e.consume().value);e.reqOp("(");let i=[];if(!e.matchOp(")")){do i.push(h(e));while(e.matchOp(","));e.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:e.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),le(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function Yo(t,e){let n=t instanceof HTMLElement&&t.tagName==="SUMMARY"?t.parentElement:t;if(n instanceof HTMLDialogElement)n.open?n.close():e?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function jn(t){t.toggleElement=(e,n,r)=>{let o=e.match("as")?!!e.req("modal"):!!e.match("modal"),s=e.text(n);return{type:"toggleElementCommand",target:n,modal:o,start:r,end:e.endPos(),run:c=>E(n.ev(c),a=>{F(a,s),O(a,u=>Yo(u,o))})}}}var Dn=(t,e,n)=>new Promise(r=>{let o=!1;t.addEventListener("transitionstart",()=>o=!0,{once:!0}),t.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),e),n?.()});function Hn(t){t.commands.settle=(e,n,r)=>{let o=e.commandBoundary(e.cur())?U(e):h(e),s=e.text(o);return{type:"settleCommand",target:o,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{F(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Dn(l,500))).then(()=>{})})}}}function Gn(t){t.commands.transition=(e,n,r)=>{let o=[],s=[],i=[];do o.push(e.withFollow(["from","to"],()=>h(e))),s.push(e.match("from")?h(e):void 0),e.req("to"),i.push(e.match("initial")?"initial":h(e));while(!e.commandBoundary(e.cur())&&e.cur().value!=="over"&&e.cur().value!=="using");let c=e.match("over")?h(e):void 0,a=!c&&e.match("using")?h(e):void 0,u=o[0].root,l=u?e.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:e.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&F(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):Z.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let M=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Dn(R,100,()=>setTimeout(()=>m(p,M),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function $n(t){t.commands.start=(e,n,r)=>{e.match("a"),e.req("view"),e.req("transition"),e.match("using");let o=e.matchType("STRING")?.value,s=D(e);e.hasMore()&&e.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:e.endPos(),run:a=>{if(!document.startViewTransition)return j(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>j(s,a)).then(d=>p(re(d)))}}}}function Wn(t){t.commands.if=(e,n,r)=>{let o=h(e);e.match("then");let s=D(e),i,c=!1,a=e.match("else")??e.match("otherwise");if(a)if(c=e.peek("if")?.line===a.line,c){let l=ft(e);i=l?[l]:[]}else i=D(e);return e.hasMore()&&!c&&e.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:e.endPos(),run:l=>E(o.ev(l),m=>m?j(s,l):i&&j(i,l))}}}var Bn={k:"return",value:null};function Un(t){t.commands.halt=(e,n,r)=>{let o=!1;e.match("the")&&(e.req("event"),e.matchOp("'")&&e.req("s"),o=!0);let s=!!e.match("bubbling"),i=!s&&!!e.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:e.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Bn}}}}function Vn(t){t.commands.return=(e,n,r)=>{let o=e.commandBoundary(e.cur())?void 0:h(e);return{type:"returnCommand",value:o,start:r,end:e.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},t.commands.exit=(e,n,r)=>({type:"exitCommand",start:r,end:e.endPos(),run:()=>Bn})}function zn(t){t.commands.throw=(e,n,r)=>{let o=h(e);return{type:"throwCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Yn(t){let e=te(t);if(!e)return;let n=[e];for(let r=te(t);r;r=te(t))n.push(r);return n}var Ht=(t,e)=>(t??[]).map(n=>E(n.ev(e),r=>String(w(r,"className")))),Ko=t=>t.split(";").map(e=>e.split(":")[0].trim()).filter(Boolean),Gt=t=>t instanceof HTMLElement||t instanceof SVGElement?t.style:void 0,Qn=(t,e,n,r,o)=>e?it(t,e,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(t,s=>x(s)&&r(s)),Be=(t,{name:e,value:n},r)=>r?t.setAttribute(e,String(n)):t.removeAttribute(e),Kn=(t,e,n,r,o,s)=>s?Qn(e,n,r,i=>Be(i,s,t),i=>Be(i,s,!t)):N(o.map(i=>Qn(e,n,r,c=>c.classList.toggle(String(i),t),c=>c.classList.toggle(String(i),!t))),()=>{});function Xn(t){let e=Yn(t),n=e?void 0:K(t);return{refs:e,attribute:n,css:e||n?void 0:En(t)}}function Zn(t){t.commands.add=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c;!o&&!s&&!i&&(c=e.withFollow(["to"],()=>h(e)),e.cur().value!=="to"&&e.err("Expected either a class reference or attribute expression"));let a=e.match("to")?h(e):U(e),u=e.match("when")?h(e):void 0,l=o||s?u:void 0,m=e.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:e.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Ht(o,p)],([d,y,g,...v])=>{if(F(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Gt(C);S&&(S.cssText+=y)});else return Kn(!0,d,l,p,v,s)})}}}var Xo=t=>t instanceof Node||t instanceof NodeList||t instanceof HTMLCollection;function er(t){t.commands.remove=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c=o||s||i?void 0:h(e),a=e.match("from")?h(e):c?void 0:U(e),u;e.match("when")&&(c&&e.err("'when' clause is not supported when removing elements"),u=h(e));let l=a?e.text(a):"",m=c?e.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!Xo(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(F(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:e.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Ht(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(F(y,l),i){let S=Ko(String(g));O(y,R=>S.forEach(I=>Gt(R)?.removeProperty(I)))}else return Kn(!1,y,u,d,C,s)})}}}var Jn=(t,e,n)=>(r,o,s)=>{s?o.style[t]=s:r==="toggle"?o.style[t]=getComputedStyle(o)[t]===e?n:e:o.style[t]=r==="hide"?e:n},tr={display(t,e,n){if(!n&&e instanceof HTMLDialogElement){t==="hide"||t==="toggle"&&e.open?e.close():e.open||e.show();return}let r=V(e);n?e.style.display=n:t==="toggle"?tr.display(getComputedStyle(e).display==="none"?"show":"hide",e):t==="hide"?(r.originalDisplay??=e.style.display,e.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?e.style.display=r.originalDisplay:e.style.removeProperty("display")},visibility:Jn("visibility","hidden","visible"),opacity:Jn("opacity","0","1"),hidden(t,e){(t==="toggle"?!e.hasAttribute("hidden"):t==="hide")?e.setAttribute("hidden",""):e.removeAttribute("hidden")}};function $t(t,e){let n=e??Z.defaultHideShowStrategy??"display";return Z.hideShowStrategies[n]??tr[n]??t.err("Unknown show/hide strategy : "+n)}function nr(t){t.commands.toggle=(e,n,r)=>{e.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(e.cur().type==="STYLE_REF"){let y=o.styleProp=e.consume().value.slice(1);s=$t(e,y),o.on=e.match("of")?e.withFollow(["with","between"],()=>h(e)):U(e)}else if(e.match("between")){let y=te(e);if(y)e.req("and"),o.between=[y,te(e)??e.err("Expected classRef")];else{let g=K(e)??e.err("Expected either a class reference or attribute expression");e.req("and"),o.between=[g,K(e)??e.err("Expected attributeRef")]}}else if(!(o.classRefs=Yn(e))&&!(o.attributeRef=K(e))){let y=e.g.toggleElement;if(!y)o.target=e.withFollow(["between"],()=>ae(e));else{let g=e.withFollow(["between","as"],()=>$(e));if(!e.peek("between"))return y(e,g,r);o.target=Lt(e,g)}}if(!o.styleProp&&!o.target&&(o.on=e.match("on")?h(e):U(e)),e.match("between")){let y=o.betweenValues=e.withFollow(["and"],()=>{let g=[h(e)];for(;e.matchOp(",");)g.push(h(e));return g});e.req("and"),y.push(h(e))}o.target&&!o.betweenValues&&e.err("toggle <expression> requires 'between' with values"),e.peek("for")&&!e.peek("in",2)?(e.match("for"),o.time=h(e)):e.match("until")&&(o.until=ce(e),e.match("from")&&(o.from=h(e))),o.end=e.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?e.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Gt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});F(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,M]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(M,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Be(S,A?R:I,!1),Be(S,A?I:R,!0)}}else l?Be(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Ht(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,M=C||y.me;return new Promise(q=>{Q(M)&&M.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function sr(t){for(let e of["hide","show"])t.commands[e]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;e==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=$t(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${e}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(F(y,m),u)return it(y,u,d,f(e),f(e==="hide"?"show":"hide"));O(y,f(e))})}}}function ir(t){t.commands.take=(e,n,r)=>{let o=[];for(let v=te(e);v;v=te(e))o.push(v);let s=o.length>0,i=s?void 0:K(e)??e.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&e.err(`\`${v}\` cannot be combined with multiple class refs`),te(e)??e.err("Expected classRef"));e.match("with")&&(s?c=u("with"):a=h(e));let l;e.match("from")&&(l=h(e),e.match("giving")&&((c||a)&&e.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(e)));let m=e.match("for")?h(e):U(e),f=e.text(m),p=l?e.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:e.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(F(S,f),i){F(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,M)=>{let q=String(A.className);y(l?C:I[M],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var Zo="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ar(t){t.commands.measure=(e,n,r)=>{let o=U(e),s=[];if(!e.commandBoundary(e.cur())){let a=h(e);a.type==="symbol"&&a.name&&Zo.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;e.matchOp(",");)s.push(e.reqType("IDENTIFIER").value);let i=e.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{F(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function Ue(t,e,n){for(let r of e)t.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${e[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var ht=t=>e=>{let n=w(e,t);G(n)&&Reflect.apply(n,e,[])},rr=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,cr=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),or=(t,e)=>{if(rr(t))e(t);else if(t instanceof HTMLFormElement)t.querySelectorAll("input, textarea, select").forEach(n=>rr(n)&&e(n));else return!1;return!0},es=t=>{t instanceof HTMLSelectElement?t.selectedIndex=-1:cr(t)?t.checked=!1:t.value=""},ts=t=>{if(t instanceof HTMLSelectElement)for(let e of t.options)e.selected=e.defaultSelected;else cr(t)?t.checked=t.defaultChecked:t.value=t.defaultValue},ns=t=>e=>O(e,n=>{n instanceof HTMLDialogElement?t?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=t:n instanceof HTMLElement&&n.hasAttribute("popover")?n[t?"showPopover":"hidePopover"]():ht(t?"open":"close")(n)});function ur(t){Ue(t,["focus"],ht("focus")),Ue(t,["blur"],ht("blur")),Ue(t,["select"],ht("select")),Ue(t,["empty","clear"],e=>{Array.isArray(e)||e instanceof Set||e instanceof Map?(Array.isArray(e)?e.splice(0):e.clear(),P.wroteProperty(e)):O(e,n=>or(n,es)||x(n)&&n.replaceChildren())}),Ue(t,["reset"],e=>O(e,n=>n instanceof HTMLFormElement?n.reset():or(n,ts)))}function lr(t){for(let e of[!0,!1]){let n=e?"open":"close";t.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?e?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():ns(e)(l||u.me))}}}}function dr(t){t.commands.make=(e,n,r)=>{e.match("a")||e.match("an");let o=h(e),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&e.match("from"))do s.push(h(e));while(e.matchOp(","));let c=e.match("called")?qt(e)??e.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:e.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function fr(t){t.commands.append=(e,n,r)=>{let o=h(e),s=e.match("to")?_e(h(e)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:e.endPos(),run:c=>N([s?s.ev(c):le("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)ot("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function mr(t){t.commands.swap=(e,n,r)=>{let o=e.withFollow(["with"],()=>ae(e));e.req("with");let s=ae(e);return{type:"swapCommand",first:o,second:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function pr(t){t.commands.send=t.commands.trigger=(e,n,r)=>{let o=ce(e),s=ut(e),i=e.match(n==="trigger"?"on":"to")?h(e):U(e),c=e.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:e.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{F(l,c),O(l,f=>_(f,o,W(m)?m:{},u.me))})}}}function hr(t){t.commands.wait=(e,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(e.match("for")){e.match("a");let s=o.events=[];do{let a=e.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(e)):s.push({event:ce(e),args:pt(e)})}while(e.match("or"));let i=o.from=e.match("from")?h(e):void 0,c=i?e.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;e.match("a")?e.req("tick"):s=o.time=h(e),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=e.endPos(),o}}function yr(t){let e=t.pos(),n=t.cur(),r=[],o="",s=!1;for(;t.hasMore();){n=t.consume();let i=t.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:t.src.substring(e,n.end+1),functions:r}}function gr(t){t.commands.js=(e,n,r)=>{let o=[];if(e.matchOp("(")&&!e.matchOp(")")){do o.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let{source:s}=yr(e);e.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:e.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>le(u,a))),u=>{a.result=u})}},t.features.js=(e,n)=>{let{source:r,functions:o}=yr(e),s=new Function(`${r}
17
+ `,s)}}var Fn=[],Mn=[],Dt=new Set;function fe(t){if((t instanceof Element||t instanceof Document||t instanceof DocumentFragment)&&!Dt.has(t)){Dt.add(t);try{for(let n of Fn)n(t);let e=On().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";t instanceof Element&&t.matches(e)&&Cn(t),t.querySelectorAll(e).forEach(Cn);for(let n of Mn)n(t)}finally{Dt.delete(t)}}}function xe(t){let e=oe(t);if(e){_(t,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of e.listeners??[])n.removeEventListener(r,o);for(let n of e.observers??[])n.disconnect();for(let n of e.timers??[])clearTimeout(n);P.stop(t),t.querySelectorAll("[data-hyperscript-powered]").forEach(xe),_(t,"hyperscript:after:cleanup"),t.removeAttribute("data-hyperscript-powered"),sn(t)}}z.process=fe;function Jo(t){try{let e=In(t);return e.kind==="features"?{...e.program,errors:[]}:{...e.kind==="commands"?e.commands[0]:e.expression,errors:[]}}catch(e){if(e instanceof be)return{errors:[e]};throw e}}var We=Object.assign(Tn,{config:Object.assign(Z,{conversions:Object.assign(ge,{dynamicResolvers:Fe})}),use(t){t(We)},addBeforeProcessHook:t=>void Fn.push(t),addAfterProcessHook:t=>void Mn.push(t),addSourceTransform:t=>void Ln.push(t),evaluate:Tn,parse:Jo,process:fe,processNode:fe,cleanup:xe,internals:{runtime:{cleanup:xe,processNode:fe}},version:"7.5.1"});function qn(){if(Object.assign(globalThis,{_hyperscript:We}),typeof document>"u")return;let t=()=>{fe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),xn(We)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}function _n(t){t.unaries.push(e=>{let n=1;for(;e.tok(n).type==="IDENTIFIER"&&e.tok(n+1).op&&e.tok(n+1).value===".";)n+=2;let r=e.tok(n+1);if(!e.peek("new")||e.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=e.pos();e.consume();let s=[e.consume().value];for(;e.matchOp(".");)s.push(e.consume().value);e.reqOp("(");let i=[];if(!e.matchOp(")")){do i.push(h(e));while(e.matchOp(","));e.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:e.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),le(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function Yo(t,e){let n=t instanceof HTMLElement&&t.tagName==="SUMMARY"?t.parentElement:t;if(n instanceof HTMLDialogElement)n.open?n.close():e?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function jn(t){t.toggleElement=(e,n,r)=>{let o=e.match("as")?!!e.req("modal"):!!e.match("modal"),s=e.text(n);return{type:"toggleElementCommand",target:n,modal:o,start:r,end:e.endPos(),run:c=>E(n.ev(c),a=>{F(a,s),O(a,u=>Yo(u,o))})}}}var Dn=(t,e,n)=>new Promise(r=>{let o=!1;t.addEventListener("transitionstart",()=>o=!0,{once:!0}),t.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),e),n?.()});function Hn(t){t.commands.settle=(e,n,r)=>{let o=e.commandBoundary(e.cur())?U(e):h(e),s=e.text(o);return{type:"settleCommand",target:o,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{F(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Dn(l,500))).then(()=>{})})}}}function Gn(t){t.commands.transition=(e,n,r)=>{let o=[],s=[],i=[];do o.push(e.withFollow(["from","to"],()=>h(e))),s.push(e.match("from")?h(e):void 0),e.req("to"),i.push(e.match("initial")?"initial":h(e));while(!e.commandBoundary(e.cur())&&e.cur().value!=="over"&&e.cur().value!=="using");let c=e.match("over")?h(e):void 0,a=!c&&e.match("using")?h(e):void 0,u=o[0].root,l=u?e.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:e.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&F(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):Z.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let M=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Dn(R,100,()=>setTimeout(()=>m(p,M),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function $n(t){t.commands.start=(e,n,r)=>{e.match("a"),e.req("view"),e.req("transition"),e.match("using");let o=e.matchType("STRING")?.value,s=D(e);e.hasMore()&&e.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:e.endPos(),run:a=>{if(!document.startViewTransition)return j(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>j(s,a)).then(d=>p(re(d)))}}}}function Wn(t){t.commands.if=(e,n,r)=>{let o=h(e);e.match("then");let s=D(e),i,c=!1,a=e.match("else")??e.match("otherwise");if(a)if(c=e.peek("if")?.line===a.line,c){let l=ft(e);i=l?[l]:[]}else i=D(e);return e.hasMore()&&!c&&e.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:e.endPos(),run:l=>E(o.ev(l),m=>m?j(s,l):i&&j(i,l))}}}var Bn={k:"return",value:null};function Un(t){t.commands.halt=(e,n,r)=>{let o=!1;e.match("the")&&(e.req("event"),e.matchOp("'")&&e.req("s"),o=!0);let s=!!e.match("bubbling"),i=!s&&!!e.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:e.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Bn}}}}function Vn(t){t.commands.return=(e,n,r)=>{let o=e.commandBoundary(e.cur())?void 0:h(e);return{type:"returnCommand",value:o,start:r,end:e.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},t.commands.exit=(e,n,r)=>({type:"exitCommand",start:r,end:e.endPos(),run:()=>Bn})}function zn(t){t.commands.throw=(e,n,r)=>{let o=h(e);return{type:"throwCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Yn(t){let e=te(t);if(!e)return;let n=[e];for(let r=te(t);r;r=te(t))n.push(r);return n}var Ht=(t,e)=>(t??[]).map(n=>E(n.ev(e),r=>String(w(r,"className")))),Ko=t=>t.split(";").map(e=>e.split(":")[0].trim()).filter(Boolean),Gt=t=>t instanceof HTMLElement||t instanceof SVGElement?t.style:void 0,Qn=(t,e,n,r,o)=>e?it(t,e,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(t,s=>x(s)&&r(s)),Be=(t,{name:e,value:n},r)=>r?t.setAttribute(e,String(n)):t.removeAttribute(e),Kn=(t,e,n,r,o,s)=>s?Qn(e,n,r,i=>Be(i,s,t),i=>Be(i,s,!t)):N(o.map(i=>Qn(e,n,r,c=>c.classList.toggle(String(i),t),c=>c.classList.toggle(String(i),!t))),()=>{});function Xn(t){let e=Yn(t),n=e?void 0:K(t);return{refs:e,attribute:n,css:e||n?void 0:En(t)}}function Zn(t){t.commands.add=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c;!o&&!s&&!i&&(c=e.withFollow(["to"],()=>h(e)),e.cur().value!=="to"&&e.err("Expected either a class reference or attribute expression"));let a=e.match("to")?h(e):U(e),u=e.match("when")?h(e):void 0,l=o||s?u:void 0,m=e.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:e.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Ht(o,p)],([d,y,g,...v])=>{if(F(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Gt(C);S&&(S.cssText+=y)});else return Kn(!0,d,l,p,v,s)})}}}var Xo=t=>t instanceof Node||t instanceof NodeList||t instanceof HTMLCollection;function er(t){t.commands.remove=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c=o||s||i?void 0:h(e),a=e.match("from")?h(e):c?void 0:U(e),u;e.match("when")&&(c&&e.err("'when' clause is not supported when removing elements"),u=h(e));let l=a?e.text(a):"",m=c?e.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!Xo(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(F(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:e.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Ht(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(F(y,l),i){let S=Ko(String(g));O(y,R=>S.forEach(I=>Gt(R)?.removeProperty(I)))}else return Kn(!1,y,u,d,C,s)})}}}var Jn=(t,e,n)=>(r,o,s)=>{s?o.style[t]=s:r==="toggle"?o.style[t]=getComputedStyle(o)[t]===e?n:e:o.style[t]=r==="hide"?e:n},tr={display(t,e,n){if(!n&&e instanceof HTMLDialogElement){t==="hide"||t==="toggle"&&e.open?e.close():e.open||e.show();return}let r=V(e);n?e.style.display=n:t==="toggle"?tr.display(getComputedStyle(e).display==="none"?"show":"hide",e):t==="hide"?(r.originalDisplay??=e.style.display,e.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?e.style.display=r.originalDisplay:e.style.removeProperty("display")},visibility:Jn("visibility","hidden","visible"),opacity:Jn("opacity","0","1"),hidden(t,e){(t==="toggle"?!e.hasAttribute("hidden"):t==="hide")?e.setAttribute("hidden",""):e.removeAttribute("hidden")}};function $t(t,e){let n=e??Z.defaultHideShowStrategy??"display";return Z.hideShowStrategies[n]??tr[n]??t.err("Unknown show/hide strategy : "+n)}function nr(t){t.commands.toggle=(e,n,r)=>{e.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(e.cur().type==="STYLE_REF"){let y=o.styleProp=e.consume().value.slice(1);s=$t(e,y),o.on=e.match("of")?e.withFollow(["with","between"],()=>h(e)):U(e)}else if(e.match("between")){let y=te(e);if(y)e.req("and"),o.between=[y,te(e)??e.err("Expected classRef")];else{let g=K(e)??e.err("Expected either a class reference or attribute expression");e.req("and"),o.between=[g,K(e)??e.err("Expected attributeRef")]}}else if(!(o.classRefs=Yn(e))&&!(o.attributeRef=K(e))){let y=e.g.toggleElement;if(!y)o.target=e.withFollow(["between"],()=>ae(e));else{let g=e.withFollow(["between","as"],()=>$(e));if(!e.peek("between"))return y(e,g,r);o.target=Lt(e,g)}}if(!o.styleProp&&!o.target&&(o.on=e.match("on")?h(e):U(e)),e.match("between")){let y=o.betweenValues=e.withFollow(["and"],()=>{let g=[h(e)];for(;e.matchOp(",");)g.push(h(e));return g});e.req("and"),y.push(h(e))}o.target&&!o.betweenValues&&e.err("toggle <expression> requires 'between' with values"),e.peek("for")&&!e.peek("in",2)?(e.match("for"),o.time=h(e)):e.match("until")&&(o.until=ce(e),e.match("from")&&(o.from=h(e))),o.end=e.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?e.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Gt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});F(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,M]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(M,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Be(S,A?R:I,!1),Be(S,A?I:R,!0)}}else l?Be(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Ht(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,M=C||y.me;return new Promise(q=>{Q(M)&&M.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function sr(t){for(let e of["hide","show"])t.commands[e]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;e==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=$t(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${e}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(F(y,m),u)return it(y,u,d,f(e),f(e==="hide"?"show":"hide"));O(y,f(e))})}}}function ir(t){t.commands.take=(e,n,r)=>{let o=[];for(let v=te(e);v;v=te(e))o.push(v);let s=o.length>0,i=s?void 0:K(e)??e.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&e.err(`\`${v}\` cannot be combined with multiple class refs`),te(e)??e.err("Expected classRef"));e.match("with")&&(s?c=u("with"):a=h(e));let l;e.match("from")&&(l=h(e),e.match("giving")&&((c||a)&&e.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(e)));let m=e.match("for")?h(e):U(e),f=e.text(m),p=l?e.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:e.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(F(S,f),i){F(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,M)=>{let q=String(A.className);y(l?C:I[M],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var Zo="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ar(t){t.commands.measure=(e,n,r)=>{let o=U(e),s=[];if(!e.commandBoundary(e.cur())){let a=h(e);a.type==="symbol"&&a.name&&Zo.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;e.matchOp(",");)s.push(e.reqType("IDENTIFIER").value);let i=e.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{F(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function Ue(t,e,n){for(let r of e)t.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${e[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var ht=t=>e=>{let n=w(e,t);G(n)&&Reflect.apply(n,e,[])},rr=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,cr=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),or=(t,e)=>{if(rr(t))e(t);else if(t instanceof HTMLFormElement)t.querySelectorAll("input, textarea, select").forEach(n=>rr(n)&&e(n));else return!1;return!0},es=t=>{t instanceof HTMLSelectElement?t.selectedIndex=-1:cr(t)?t.checked=!1:t.value=""},ts=t=>{if(t instanceof HTMLSelectElement)for(let e of t.options)e.selected=e.defaultSelected;else cr(t)?t.checked=t.defaultChecked:t.value=t.defaultValue},ns=t=>e=>O(e,n=>{n instanceof HTMLDialogElement?t?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=t:n instanceof HTMLElement&&n.hasAttribute("popover")?n[t?"showPopover":"hidePopover"]():ht(t?"open":"close")(n)});function ur(t){Ue(t,["focus"],ht("focus")),Ue(t,["blur"],ht("blur")),Ue(t,["select"],ht("select")),Ue(t,["empty","clear"],e=>{Array.isArray(e)||e instanceof Set||e instanceof Map?(Array.isArray(e)?e.splice(0):e.clear(),P.wroteProperty(e)):O(e,n=>or(n,es)||x(n)&&n.replaceChildren())}),Ue(t,["reset"],e=>O(e,n=>n instanceof HTMLFormElement?n.reset():or(n,ts)))}function lr(t){for(let e of[!0,!1]){let n=e?"open":"close";t.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?e?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():ns(e)(l||u.me))}}}}function dr(t){t.commands.make=(e,n,r)=>{e.match("a")||e.match("an");let o=h(e),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&e.match("from"))do s.push(h(e));while(e.matchOp(","));let c=e.match("called")?qt(e)??e.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:e.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function fr(t){t.commands.append=(e,n,r)=>{let o=h(e),s=e.match("to")?_e(h(e)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:e.endPos(),run:c=>N([s?s.ev(c):le("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)ot("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function mr(t){t.commands.swap=(e,n,r)=>{let o=e.withFollow(["with"],()=>ae(e));e.req("with");let s=ae(e);return{type:"swapCommand",first:o,second:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function pr(t){t.commands.send=t.commands.trigger=(e,n,r)=>{let o=ce(e),s=ut(e),i=e.match(n==="trigger"?"on":"to")?h(e):U(e),c=e.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:e.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{F(l,c),O(l,f=>_(f,o,W(m)?m:{},u.me))})}}}function hr(t){t.commands.wait=(e,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(e.match("for")){e.match("a");let s=o.events=[];do{let a=e.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(e)):s.push({event:ce(e),args:pt(e)})}while(e.match("or"));let i=o.from=e.match("from")?h(e):void 0,c=i?e.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;e.match("a")?e.req("tick"):s=o.time=h(e),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=e.endPos(),o}}function yr(t){let e=t.pos(),n=t.cur(),r=[],o="",s=!1;for(;t.hasMore();){n=t.consume();let i=t.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:t.src.substring(e,n.end+1),functions:r}}function gr(t){t.commands.js=(e,n,r)=>{let o=[];if(e.matchOp("(")&&!e.matchOp(")")){do o.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let{source:s}=yr(e);e.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:e.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>le(u,a))),u=>{a.result=u})}},t.features.js=(e,n)=>{let{source:r,functions:o}=yr(e),s=new Function(`${r}
18
18
  return { ${o.map(c=>`${c}:${c}`).join(",")} } `);return{type:"jsFeature",source:r,functions:o,start:n,end:e.endPos(),install:()=>void Object.assign(globalThis,s())}}}function wr(t){for(;;){let e=t();if(J(e))return e.then(n=>n??wr(t));if(e)return e}}var rs=t=>{if(t){if(W(t)&&Symbol.asyncIterator in Object(t)){let e=Reflect.get(Object(t),Symbol.asyncIterator);return typeof e=="function"?Reflect.apply(e,t,[]):void 0}return(Y(t)?t:Object.keys(Object(t)))[Symbol.iterator]()}};function vr(t){t.commands.repeat=t.commands.for=(e,n,r)=>{let o={type:"repeatCommand",until:!1,bottomTested:!1,forever:!1,body:[],start:r,end:r,run:()=>{}};if(n==="for"||e.match("for")){let v=o.identifier=e.reqType("IDENTIFIER").value;e.req("in"),o.expression=h(e);for(let C=o.expression;C;C=C.root)C.type==="collectionExpression"&&(C.varName=v)}else e.match("in")?(o.identifier="it",o.expression=h(e)):e.match("while")?o.condition=h(e):e.match("until")?(o.until=!0,e.match("event")?(o.event=ce(e),e.match("from")&&(o.from=h(e))):o.condition=h(e)):!e.commandBoundary(e.cur())&&e.cur().value!=="forever"?(o.times=h(e),e.req("times")):(e.match("forever"),o.forever=!0);e.match("index")?o.indexIdentifier=e.reqType("IDENTIFIER").value:e.match("indexed")&&(e.req("by"),o.indexIdentifier=e.reqType("IDENTIFIER").value);let s=o.body=D(e);if(o.forever&&e.hasMore()){let v=e.match("until")??e.match("while");v&&(o.forever=!1,o.bottomTested=!0,o.until=v.value==="until",o.condition=h(e))}e.match("else")&&(o.elseBranch=D(e)),e.hasMore()&&e.req("end"),o.end=e.endPos();let{identifier:i,indexIdentifier:c,expression:a,times:u,condition:l,until:m,bottomTested:f,forever:p,event:d,from:y,elseBranch:g}=o;return o.run=v=>N([a?.ev(v),y?.ev(v)],([C,S])=>{let R=rs(C)??(g?[][Symbol.iterator]():void 0),I=0,A=!1,M=!1;if(d){let L=S||v.me;Q(L)&&L.addEventListener(d,()=>M=!0,{once:!0})}let q=()=>!A&&g?E(j(g,v),L=>({signal:re(L)})):{signal:void 0},b=L=>{let H=I++;A=!0,C&&i?v.result=v.locals[i]=L:v.result=H,c&&(v.locals[c]=H);let X=v.meta.template;if(X&&C){let pe=`${i}_${r}`;X.loops[pe]??={identifier:i,indexIdentifier:c,source:C},X.out.push(`<!--hs-scope:${pe}:${H}-->`)}return E(j(s,v),pe=>{let rn=w(pe,"k");if(rn==="break")return{signal:void 0};if(rn==="return")return{signal:re(pe)};if(d)return new Promise(go=>setTimeout(go,0))})};return E(wr(()=>N([l?.ev(v),u?.ev(v)],([L,H])=>f&&I===0||p?b(void 0):m?(d?!M:L!==!0)?b(void 0):q():l?L?b(void 0):q():H?I<T(H)?b(void 0):q():R?E(R.next(),X=>w(X,"done")?q():b(w(X,"value"))):q())),L=>re(w(L,"signal")))}),o}}function Er(t){for(let e of["break","continue"]){let n={k:e};t.commands[e]=(r,o,s)=>({type:`${e}Command`,start:s,end:r.endPos(),run:()=>n})}}function br(t){t.commands.tell=(e,n,r)=>{let o=h(e),s=D(e);e.hasMore()&&!e.featureStart(e.cur())&&e.req("end");let i=(a,u,l)=>{for(;l<u.length;l++){a.you=u[l];let m=j(s,a);if(J(m))return m.then(f=>re(f)??i(a,u,l+1));if(m)return m}};return{type:"tellCommand",value:o,body:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{let l=u==null?[]:Array.isArray(u)?u:u instanceof NodeList?Array.from(u):[u],m=a.you;return E(i(a,l,0),f=>(a.you=m,re(f)))})}}}function Bt(t,e){let n;if(typeof e=="string"){let u=document.createElement("template");u.innerHTML=e,n=u.content}else if(e instanceof DocumentFragment)n=e;else if(e instanceof Element)n=document.createDocumentFragment(),n.append(e.cloneNode(!0));else throw new Error("morph requires an HTML string, element, or document fragment");let r=n.firstElementChild;r&&!r.nextElementSibling&&r.tagName===t.tagName&&(Sr(t,r),n=r);let o=[...t.matches("[id]")?[t]:[],...t.querySelectorAll("[id]")],s=[...n.querySelectorAll("[id]")],i=is(o,s),c=new Map;Nr(c,i,t.parentElement,o),Nr(c,i,n,s);let a=document.createElement("div");a.hidden=!0,(document.body??t.parentElement)?.after(a),Tr({target:t,ids:c,persistent:i,pantry:a,futureMatches:new WeakSet},t,n),xe(a),a.remove()}function Tr(t,e,n){e instanceof HTMLTemplateElement&&n instanceof HTMLTemplateElement&&(e=e.content,n=n.content);let r=e.firstChild,o=n.firstChild;for(;o;){let s=o,i=r&&os(t,s,r);if(i&&i!==r)for(let c=r;c&&c!==i;){let a=c;c=c.nextSibling,a instanceof Element&&(t.ids.has(a)||Cr(t,a,s))?Wt(e,a,null):kr(t,a)}if(!i&&s instanceof Element&&t.persistent.has(s.id)){let c=`[id="${CSS.escape(s.id)}"]`,a=t.target.id===s.id?t.target:t.target.querySelector(c)??t.pantry.querySelector(c);if(a){for(let u=a.parentNode;u;u=u.parentNode){let l=t.ids.get(u);l?.delete(a.id),l?.size===0&&t.ids.delete(u)}Wt(e,a,r),i=a}}if(o=s.nextSibling,i&&s instanceof Element)xr(t,i,s),r=i.nextSibling;else if(s instanceof Element&&t.ids.has(s)){let c=document.createElement(s.tagName);e.insertBefore(c,r),xr(t,c,s),r=c.nextSibling}else e.insertBefore(s,r),s instanceof Element&&fe(s),r=s.nextSibling}for(;r;){let s=r;r=r.nextSibling,kr(t,s)}}function xr(t,e,n){e instanceof Element&&(Sr(e,n),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.defaultValue!==n.defaultValue&&(e.value=n.value),(!e.isEqualNode(n)||n.tagName==="TEMPLATE"||n.querySelector("template"))&&Tr(t,e,n),fe(e))}function os(t,e,n){if(!(e instanceof Element))return null;let r=t.ids.get(e),o=r?.size??0;if(e.id&&!r)return null;let s=null,i=0,c=10;for(let a=n;a;a=a.nextSibling){let u=t.ids.get(a);if(ss(a,e)){if(u&&r&&[...u].some(l=>r.has(l)))return a;if(!u){if(c>0&&a.isEqualNode(e))return a;s??=a}}if(i+=u?.size??0,i>o||a.contains(document.activeElement)||--c<1&&o===0)break}return s&&Cr(t,s,e)?null:s}function Cr(t,e,n){if(t.futureMatches.has(e))return!0;let r=n.nextSibling;for(let o=0;r&&o<10;r=r.nextSibling,o++)if(r instanceof Element&&e.isEqualNode(r))return t.futureMatches.add(e),!0;return!1}function kr(t,e){t.ids.has(e)?Wt(t.pantry,e,null):(e instanceof Element&&xe(e),e.remove())}function Wt(t,e,n){let r=w(t,"moveBefore");if(G(r))try{Reflect.apply(r,t,[e,n]);return}catch{}t.insertBefore(e,n)}function Sr(t,e){for(let{name:n,value:r}of e.attributes)t.getAttribute(n)!==r&&(t.setAttribute(n,r),n==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=r));for(let{name:n}of[...t.attributes])e.hasAttribute(n)||t.removeAttribute(n)}function ss(t,e){return!(t instanceof Element)||t.tagName!==e.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(e)?!1:!t.id||t.id===e.id}function is(t,e){let n=new Set,r=new Map;for(let{id:s,tagName:i}of t)r.has(s)?n.add(s):s&&r.set(s,i);let o=new Set;for(let{id:s,tagName:i}of e)o.has(s)?n.add(s):r.get(s)===i&&o.add(s);for(let s of n)o.delete(s);return o}function Nr(t,e,n,r){for(let o of r)if(e.has(o.id))for(let s=o;s&&s!==n;s=s.parentElement){let i=t.get(s);i||t.set(s,i=new Set),i.add(o.id)}}function Pr(t){t.commands.morph=(e,n,r)=>{let o=h(e);e.req("to");let s=h(e);return{type:"morphCommand",target:o,content:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c)],([a,u])=>{O(a,l=>{l instanceof Element&&Bt(l,u)})})}}}function Rr(t){t.commands.log=(e,n,r)=>{let o=[h(e)];for(;e.matchOp(",");)o.push(h(e));let s=e.match("with")?h(e):void 0;return{type:"logCommand",values:o,logger:s,start:r,end:e.endPos(),run:c=>N([s?.ev(c),...o.map(a=>a.ev(c))],([a,...u])=>{G(a)?a(...u):console.log(...u)})}}}function Ir(t){t.commands.get=t.commands.call=(e,n,r)=>{let o=h(e);return n==="call"&&o.type!=="functionCall"&&e.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=c})}}}function Or(t){t.pseudo=(e,n)=>{let r=e.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=ct(e);o.type!=="functionCall"&&e.err("Pseudo-commands must be function calls");let s=o.root,i="args"in o&&Array.isArray(o.args)?o.args:[],c;s&&!s.root&&(e.matchAny("the","to","on","with","into","from","at")?c=h(e):e.match("me")&&(c=U(e)));let a=s?.name??"",u=c?e.text(c):"",l=e.text(o),m=c;return{type:"pseudoCommand",value:o,target:c,start:n,end:e.endPos(),run:p=>m?N([m.ev(p),...i.map(d=>d.ev(p))],([d,...y])=>{F(d,u),p.result=at(w(d,a),d,y,p,l),Ye(d,a)}):E(o.ev(p),d=>{p.result=d})}}}function Ar(t){t.commands.ask=(e,n,r)=>{let o=h(e);return{type:"askCommand",message:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=prompt(String(c))})}},t.commands.answer=(e,n,r)=>{let o=h(e),s;if(e.match("with")){let c=e.withFollow(["or"],()=>h(e));e.req("or"),s=[c,h(e)]}return{type:"answerCommand",message:o,choices:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s?.[0].ev(c),s?.[1].ev(c)],([a,u,l])=>{s?c.result=confirm(String(a))?u:l:alert(String(a))})}}}function Lr(t){t.commands.breakpoint=(e,n,r)=>({type:"breakpointCommand",start:r,end:e.endPos(),run:()=>{debugger}})}var Ut=(t,e,n)=>{let r=w(t,"slice");return G(r)?Reflect.apply(r,t,[e,n]):void 0},as=(t,e,n)=>({*[Symbol.iterator](){let r=new RegExp(t instanceof RegExp?t:String(t),e);for(let o=r.exec(n);o;o=r.exec(n))o[0].length===0&&r.lastIndex++,yield o}});function Fr(t){t.commands.pick=(e,n,r)=>{e.match("the");let o=e.matchAny("first","last","random","match","matches")??e.matchAny("item","items","character","characters");if(!o)return;let s=o.value==="first"||o.value==="last"||o.value==="random"||o.value==="match"||o.value==="matches"?o.value:"range",i={};(s==="match"||s==="matches")&&e.match("of"),e.withFollow(["of","from"],()=>{if(s==="first"||s==="last")i.count=h(e);else if(s==="random")e.cur().type==="NUMBER"&&(i.count=h(e));else if(s==="range")e.match("at")||e.match("from"),e.match("start")||(i.from=h(e)),(e.match("to")||e.matchOp(".."))&&(e.match("end")?i.toEnd=!0:i.to=h(e)),e.match("inclusive")?i.bounds="inclusive":e.match("exclusive")&&(i.bounds="exclusive");else{i.re=h(e);let g=e.matchOp("|")?e.reqType("IDENTIFIER").value:void 0;i.flags=s==="match"?g??"":g===void 0?"gu":"g"+g.replace("g","")}}),e.matchAny("of","from")||e.expected("of","from");let c=h(e),{count:a,from:u,to:l,toEnd:m,bounds:f,re:p,flags:d=""}=i;return{type:"pickCommand",variant:s,root:c,...i,start:r,end:e.endPos(),run:g=>N([c.ev(g),a?.ev(g),u?.ev(g),l?.ev(g),p?.ev(g)],([v,C,S,R,I])=>{if(v==null)g.result=v;else if(s==="first")g.result=Ut(v,0,T(C));else if(s==="last")g.result=Ut(v,-T(C));else if(s==="random"){let A=Y(v)?Array.from(v):[],M=()=>A.splice(Math.floor(Math.random()*A.length),1)[0];g.result=C==null?M():Array.from({length:Math.min(T(C),A.length)},M)}else if(s==="range"){let A=T(S??0)+(f==="exclusive"?1:0),M=m?T(w(v,"length")):R==null?void 0:T(R),q=M===void 0?A+1:M+(f==="inclusive"?1:0);g.result=Ut(v,A,q)}else s==="match"?g.result=new RegExp(I instanceof RegExp?I:String(I),d).exec(String(v)):g.result=as(I,d,String(v))})}}}var cs={json:"json",JSON:"json",Object:"json",response:"response",Response:"response",html:"html",HTML:"html",text:"text",Text:"text",String:"text"};function Mr(t){t.commands.fetch=(e,n,r)=>{let o=e.withFollow(["as"],()=>Mt(e)),s=()=>{if(!e.match("as"))return;e.match("a")||e.match("an");let m=Se(e)??e.err("Expected dotOrColonPath");return cs[m]??":"+m},i=s(),c;e.match("with")&&e.cur().value!=="{"?c=He(e):e.cur().op&&e.cur().value==="{"&&(c=De(e)),i??=s()??"text";let a=!1;e.match("do")?(e.req("not"),e.req("throw"),a=!0):e.cur().value==="don"&&e.tok(1,!0).value==="'"&&e.tok(2,!0).value==="t"&&(e.consume(),e.consume(),e.consume(),e.req("throw"),a=!0);let u=i;return{type:"fetchCommand",url:o,options:c,as:u,dontThrow:a,start:r,end:e.endPos(),run:m=>N([o.ev(m),c?.ev(m)],([f,p])=>{let d=m.me,y=W(p)?p:{};y.headers||={},y.conversion=u.startsWith(":")?u.slice(1):u;let g=new AbortController,v=()=>g.abort();Q(d)&&d.addEventListener("fetch:abort",v,{once:!0}),y.signal=g.signal,_(d,"hyperscript:beforeFetch",y,d),_(d,"fetch:beforeRequest",y,d);let C=!1;y.timeout&&setTimeout(()=>C||v(),T(y.timeout));let S=I=>{m.result=I,_(d,"fetch:afterRequest",{result:I}),C=!0},R=Reflect.apply(fetch,globalThis,[f,y]);return Promise.resolve(R).then(I=>{let A={response:I};_(d,"fetch:afterResponse",A);let M=A.response;if(!(M instanceof Response))throw new Error("fetch did not return a Response");if(!a&&u!=="response"&&Z.fetchThrowsOn.some(k=>k.test(String(M.status))))throw Object.assign(new Error(`fetch failed: ${M.status} ${M.statusText} (${f})`),{response:M,status:M.status});if(u==="response")return S(M);if(u==="json")return M.json().then(S);let q=u.startsWith(":")?u.slice(1):void 0,b=q?ge[q]:void 0;return b&&w(b,"_rawResponse")?S(b(M)):M.text().then(k=>S(u==="html"?ve(k):q?rt(k,q):k))}).catch(I=>{throw _(d,"fetch:error",{reason:I}),I}).finally(()=>Q(d)&&d.removeEventListener("fetch:abort",v))})}}}var us={top:"start",middle:"center",bottom:"end"},ls={left:"start",center:"center",right:"end"},qr=t=>{let e=t.matchAny("smoothly","instantly");return e?e.value==="smoothly"?"smooth":"instant":void 0};function _r(t){t.match("the");let e=t.matchAny("top","middle","bottom"),n=t.matchAny("left","center","right");(e||n)&&t.req("of");let r=$(t),o=t.matchAnyOp("+","-"),s=o?t.withFollow(["px"],()=>h(t)):void 0;t.match("px");let i=t.match("in")?$(t):void 0,c={block:e?us[e.value]:"start",inline:n?ls[n.value]:"nearest"},a=qr(t);return a&&(c.behavior=a),{target:r,offset:s,sign:o?.value==="-"?-1:o?1:0,options:c,container:i}}function jr(t,e){return N([t.target.ev(e),t.offset?.ev(e),t.container?.ev(e)],([n,r,o])=>{let s=t.sign*T(r??0);O(n,i=>{let c=i===window?document.body:i;c instanceof HTMLElement&&(o instanceof HTMLElement?o.scrollTo({top:c.offsetTop-o.offsetTop+s,left:c.offsetLeft-o.offsetLeft,behavior:t.options.behavior??"auto"}):(t.sign?ds(c,s,t.options):c).scrollIntoView(t.options))})})}function ds(t,e,n){let r=t.getBoundingClientRect(),o=i=>i==="start"||i==="end"?e:0,s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:r.top+window.scrollY+o(n.block)+"px",left:r.left+window.scrollX+o(n.inline)+"px",height:r.height+"px",width:r.width+"px",zIndex:String(Number.MIN_SAFE_INTEGER),opacity:"0"}),document.body.appendChild(s),setTimeout(()=>s.remove(),100),s}function Dr(t){t.commands.scroll=(e,n,r)=>{let o={type:"scrollCommand",start:r,end:r,run:()=>{}};if(e.match("to")){let s=o.to=_r(e);o.run=i=>jr(s,i)}else{let s=["up","down","left","right"],i=e.matchAny(...s),c;!i&&e.cur().value!=="by"&&(c=o.target=$(e),i=e.matchAny(...s)),e.req("by");let a=o.by=e.withFollow(["px"],()=>h(e));e.match("px");let u=o.behavior=qr(e),l=o.direction=i?.value??"down";o.run=m=>N([c?.ev(m),a.ev(m)],([f,p])=>{let d=T(p)*(l==="up"||l==="left"?-1:1),y=l==="left"||l==="right",g={top:y?0:d,left:y?d:0};u&&(g.behavior=u),(x(f)?f:document.documentElement).scrollBy(g)})}return o.end=e.endPos(),o}}function Hr(t){t.commands.go=(e,n,r)=>{let o={type:"goCommand",back:!1,newWindow:!1,start:r,end:r,run:()=>{}},s=()=>e.match("in")?(e.req("new"),e.req("window"),!0):!1,i=c=>{if(c==null)return;if(x(c))return c.scrollIntoView({block:"start",inline:"nearest"});let a=String(c);a.startsWith("#")?window.location.hash=a:o.newWindow?window.open(a):window.location.href=a};if(e.match("back"))o.back=!0,o.run=()=>window.history.back();else if(e.match("to"),e.match("url")){let c=o.url=Ge(e);o.newWindow=s(),o.run=()=>i(c)}else if(["the","top","middle","bottom","left","center","right"].includes(e.cur().value)){let c=o.scroll=_r(e);o.run=a=>jr(c,a)}else{let c=o.target=Mt(e);o.newWindow=s(),o.run=a=>E(c.ev(a),i)}return o.end=e.endPos(),o}}function $r(t){t.commands.set=(e,n,r)=>Vt(e,r)}function Vt(t,e){{if(t.cur().op&&t.cur().value==="{"){let s=De(t);t.req("on");let i=h(t);return{type:"setCommand",target:i,object:s,start:e,end:t.endPos(),run:a=>N([s.ev(a),i.ev(a)],([u,l])=>void Object.assign(Object(l),u))}}let n=t.withFollow(["to"],()=>ae(t));t.req("to");let r=h(t);return{type:"setCommand",target:n,value:r,start:e,end:t.endPos(),run:s=>N([n.lhs?.(s),r.ev(s)],([i,c])=>n.put?.(s,i,c))}}}function Wr(t){t.commands.default=(e,n,r)=>{let o=e.withFollow(["to"],()=>ae(e));e.req("to");let s=h(e);return{type:"defaultCommand",target:o,value:s,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{if(!(a!=null&&a!==""))return N([o.lhs?.(c),s.ev(c)],([u,l])=>o.put?.(c,u,l))})}}}function Br(t){for(let e of["increment","decrement"]){let n=e==="increment"?1:-1;t.commands[e]=(r,o,s)=>{let i=r.withFollow(n<0?["by"]:[],()=>ae(r)),c=r.match("by")?h(r):void 0;return{type:`${e}Command`,target:i,amount:c,start:s,end:r.endPos(),run:u=>N([i.ev(u),c?.ev(u),i.lhs?.(u)],([l,m,f])=>{let p=(l?parseFloat(String(l)):0)+n*(c?parseFloat(String(m)):1);u.result=p,i.put?.(u,f,p)})}}}}function Gr(t,e){t.replaceChildren(ve(e)),z.process(t)}var fs=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],ms={into:"into",before:"before",after:"after",start:"start",end:"end"},ps={before:"before",after:"after",start:"prepend",end:"append"};function Ur(t){t.commands.put=(e,n,r)=>{let o=h(e),s=e.matchAny("into","before","after");!s&&e.match("at")&&(e.match("the"),s=e.matchAny("start","end"),e.req("of"));let i=ms[(s??e.expected("into","before","at start of","at end of","after")).value],c=_e(h(e)),a=e.text(c),u=(f,p)=>c.type==="symbol"?E(c.ev(f),d=>{x(d)||d instanceof Document?Gr(d,p):c.put?.(f,void 0,p)}):fs.includes(c.type)?E(c.lhs?.(f),d=>c.put?.(f,d,p)):E(c.ev(f),d=>{F(d,a),O(d,y=>{(x(y)||y instanceof Document)&&Gr(y,p)})}),l=(f,p,d)=>E(c.ev(f),y=>{if(F(y,a),Array.isArray(y)){d==="prepend"?y.unshift(p):y.push(p),P.wroteProperty(y);return}O(y,g=>{x(g)&&(g[d](p instanceof Node?p:ve(p)),z.process(g.parentElement??g))})});return{type:"putCommand",value:o,operation:i,target:c,start:r,end:e.endPos(),run:f=>E(o.ev(f),p=>i==="into"?u(f,p):l(f,p,ps[i]))}}}var Re=t=>Y(t)?Array.from(t):Array.from(Object(t)),Vr=t=>Array.isArray(t)||t instanceof NodeList?Re(t).map(Vr).join(""):t instanceof HTMLElement?t.outerHTML:t instanceof Node?"":String(t);function hs(t){let e={},n=r=>{let o=w(r,"name"),s=w(r,"value"),i=w(r,"type");if(typeof o!="string"||s==null||i==="radio"&&!w(r,"checked")||(i==="checkbox"?s=w(r,"checked")?[s]:void 0:r instanceof HTMLSelectElement&&r.multiple&&(s=Array.from(r.selectedOptions,a=>a.value)),s===void 0))return;let c=e[o];e[o]=c===void 0?s:(Array.isArray(c)?c:[c]).concat(s)};return O(t,r=>{w(r,"name")!=null&&w(r,"value")!=null?n(r):r instanceof Element&&r.querySelectorAll("input,select,textarea").forEach(n)}),e}function zr(t){Object.assign(ge,{Boolean:e=>!!e,Date:e=>typeof e=="number"||e instanceof Date?new Date(e):new Date(String(e)),Array:Re,JSON:e=>e instanceof Response?e.json():JSON.parse(String(e)),JSONString:e=>JSON.stringify(e),Object:e=>typeof e=="string"||e instanceof String?JSON.parse(String(e)):{...Object(e)},FormEncoded:e=>new URLSearchParams(Object(e)).toString(),Set:e=>new Set(Re(e)),Map:e=>new Map(Object.entries(Object(e))),Keys:e=>e instanceof Map?Array.from(e.keys()):Object.keys(Object(e)),Entries:e=>e instanceof Map?Array.from(e.entries()):Object.entries(Object(e)),Reversed:e=>Re(e).reverse(),Unique:e=>[...new Set(Re(e))],Flat:e=>Re(e).flat(),HTML:Vr}),Fe.push((e,n)=>{if(e==="Fixed"||e.startsWith("Fixed:"))return Number(n).toFixed(parseInt(e.split(":")[1])||0)},(e,n)=>e==="Values"?hs(n):void 0)}var Qr="=;expires=Thu, 01 Jan 1970 00:00:00 GMT",Ve=()=>document.cookie?document.cookie.split("; ").map(t=>{let e=t.indexOf("=");return{name:t.slice(0,e),value:decodeURIComponent(t.slice(e+1))}}):[],ys=new Proxy({},{get(t,e){if(e===Symbol.iterator){let n=Ve();return n[Symbol.iterator].bind(n)}if(!(typeof e!="string"||e==="then"))return e==="length"?Ve().length:e==="clear"?n=>void(document.cookie=n+Qr):e==="clearAll"?()=>Ve().forEach(n=>document.cookie=n.name+Qr):e!==""&&!Number.isNaN(Number(e))?Ve()[parseInt(e)]:Ve().find(n=>n.name===e)?.value},set(t,e,n){let r=[];if(typeof n=="string")r.push(encodeURIComponent(n),"samesite=lax");else{r.push(encodeURIComponent(String(w(n,"value"))));let o=(s,i)=>{let c=w(n,s);c&&r.push(`${i}=${c}`)};o("expires","expires"),o("maxAge","max-age"),o("partitioned","partitioned"),o("path","path"),o("samesite","samesite"),w(n,"secure")&&r.push("secure")}return document.cookie=String(e)+"="+r.join(";"),!0}});function Jr(t){Nt.cookies=ys}var zt=t=>Y(t)?Array.from(t):[];function gs(t){let e=t.pos(),n=t.matchAny("first","last","random");if(!n)return;t.matchAny("in","from","of");let r=$(t),o=n.value;return{type:"positionalExpression",operator:o,root:r,start:e,end:t.endPos(),ev:i=>E(r.ev(i),c=>{if(!c)return;let a=Array.isArray(c)?c:zt(w(c,"children")??c),u=o==="first"?0:o==="last"?a.length-1:Math.floor(Math.random()*a.length);return a[u]})}}function ws(t){let e=t.pos(),n=t.matchAny("next","previous");if(!n)return;let r=n.value==="next",o=Ft(t)??t.err("Expected leaf"),s=t.match("from")?t.withFollow(["in"],()=>$(t)):U(t),i=t.match("in")?$(t):void 0,c=!i&&t.match("within")?$(t):void 0,a=!!t.match("with");a&&t.req("wrapping");let u=t.text(o),l=(p,d,y)=>{let g=d instanceof Element||d instanceof Document?d:document.body,v=Array.from(g.querySelectorAll(y));if(!(p instanceof Node))return;let C=r?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING,S=r?v:v.reverse();return S.find(R=>R.compareDocumentPosition(p)===C)??(a?S[0]:void 0)},m=(p,d,y)=>{let g=zt(d).filter(R=>R===p||x(R)&&R.matches(y)),v=r?g:g.reverse(),C=v[v.indexOf(p)+1];if(v.includes(p)&&C!==void 0)return C;let S=v[0];return a&&x(S)&&S.matches(y)?S:void 0};return{type:"relativePositionalExpression",operator:n.value,thing:o,from:s,inElt:i,withinElt:c,wrapping:a,start:e,end:t.endPos(),ev:p=>N([o.ev(p),s.ev(p),i?.ev(p),c?.ev(p)],([d,y,g,v])=>{let C=w(d,"css");if(typeof C!="string")throw new Error("Expected a CSS value to be returned by "+u);return i?g&&m(y,g,C):l(y,v,C)})}}function vs(t){let e=t.pos();if(!t.match("closest"))return;let n=!!t.match("parent"),r=t.cur().type==="ATTRIBUTE_REF"?K(t):void 0,o=r?`[${r.name}]`:$(t).css??t.err("Expected a CSS expression"),s=t.match("to")?h(t):U(t),i={type:"closestExpr",css:o,parentSearch:n,to:s,start:e,end:t.endPos(),ev:c=>E(s.ev(c),a=>{if(a==null)return null;let u=[];return O(a,l=>{let m=n?w(l,"parentElement"):l;u.push(x(m)?m.closest(o):null)}),Ne(a)?u:u[0]}),lhs:c=>i.ev(c),put:(c,a,u)=>{a&&Ee(a,u)}};return r?_t(t,i,r):i}var Yr=["where","sorted","mapped","split","joined"];function Es(t,e){let n=t.matchAny(...Yr);if(!n)return;let r=n.value;r==="mapped"?t.req("to"):r!=="where"&&t.req("by");let o=t.withFollow(Yr,()=>h(t)),s=r==="sorted"&&!!t.match("descending"),i=(u,l)=>{let m=l.map(f=>(u.beingTested=f,a.varName&&(u.locals[a.varName]=f),o.ev(u)));return u.beingTested=null,m},c=(u,l)=>{if(!l)return l;if(r==="split")return E(o.ev(u),d=>String(l).split(String(d)));let m=zt(l);if(r==="joined")return E(o.ev(u),d=>m.join(String(d)));let f=i(u,m);if(r==="where")return m.filter((d,y)=>f[y]);if(r==="mapped")return f;let p=s?-1:1;return m.map((d,y)=>y).sort((d,y)=>f[d]==f[y]?0:(T(f[d])<T(f[y])?-1:1)*p).map(d=>m[d])},a={type:"collectionExpression",operator:r==="where"||r==="sorted"||r==="mapped"||r==="split"?r:"joined",root:e,operand:o,descending:s,start:e.start,end:t.endPos(),ev:u=>E(e.ev(u),l=>c(u,l))};return a}function bs(t){let e=t.pos();if(!t.matchOp("\\"))return;let n=[],r=t.matchType("IDENTIFIER");if(r)for(n.push(r.value);t.matchOp(",");)n.push(t.reqType("IDENTIFIER").value);t.reqOp("-"),t.reqOp(">");let o=h(t);return{type:"blockLiteral",params:n,expr:o,start:e,end:t.endPos(),ev:i=>(...c)=>(n.forEach((a,u)=>i.locals[a]=c[u]),o.ev(i))}}function xs(t){let e=t.pos();if(t.match("some"))return Ce(t,"some",e,h(t),n=>!qe(n),!1)}function ks(t,e){if(!t.matchOp(":"))return;let n=t.reqType("IDENTIFIER").value,r=!t.matchOp("!");return{type:"typeCheckExpression",root:e,suffix:n,start:e.start,end:t.endPos(),ev:s=>E(e.ev(s),i=>{if(nt(i,n,r))return i;throw new Error("Typecheck failed! Expected: "+n)})}}function Kr(t,e,n,r){if(_(t.me,"hyperscript:beep",{element:t.me,expression:e,value:r})){let o=r==null?"object (null)":w(w(r,"constructor"),"name")??"unknown",s=typeof r=="string"?`"${r}"`:Ne(r)?Array.from(r):r;console.log(`///_ BEEP! The expression (${n}) evaluates to:`,s,"of type "+o)}}function Ns(t){let e=t.pos();if(!t.match("beep!"))return;let n=$(t),r=t.text(n);return Ce(t,"beepExpression",e,n,(o,s)=>(Kr(s,n,r,o),o),!1)}function Ts(t,e,n){let r=[h(t)];for(;t.matchOp(",");)r.push(h(t));let o=r.map(s=>t.text(s));return{type:"beepCommand",values:r,start:n,end:t.endPos(),run:s=>N(r.map(i=>i.ev(s)),i=>i.forEach((c,a)=>Kr(s,r[a],o[a],c)))}}function Xr(t){t.leaves.push(vs,xs,bs),t.unaries.push(Ns,ws,gs),t.commands["beep!"]=Ts,t.postfixes.push(ks),t.collections.push(Es)}var Qt=t=>Se(t)??t.err("Expected dotOrColonPath");function Zr(t){t.features.def=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=D(e),a={type:"defFeature",name:r,displayName:`${s}(${i.join(", ")})`,params:i,body:c,...mt(e),start:n,end:e.endPos(),install:(u,l)=>{Tt(u,o,s,Object.assign((...f)=>{let p=B(l,a,u,null);i.forEach((y,g)=>p.locals[y]=f[g]);let d=E(st(p,c,a),y=>w(y,"value"));return J(d)&&a.finallyHandler?d.then(void 0,()=>{}):d},{hyperfunc:!0,hypername:r}))}};return a}}function eo(t){t.features.init=(e,n)=>{let r=!!e.match("immediately"),o=D(e),s={type:"initFeature",body:o,immediately:r,start:n,end:e.endPos(),install:i=>{let c=()=>void j(o,B(i,s,i,null));r?c():queueMicrotask(c)}};return s}}function to(t){t.features.behavior=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=$e(e).features;for(let u of c)u.behavior=r;return{type:"behaviorFeature",name:r,params:i,features:c,start:n,end:e.endPos(),install:()=>Tt(null,o,s,(u,l,m)=>{if(W(u))for(let f of i)Te(u,r+"Scope")[f]=w(m,f);for(let f of c)f.install(u,l)})}}}function no(t){t.features.install=(e,n)=>{let r=Qt(e),o=ut(e),s={type:"installFeature",name:r,args:o,start:n,end:e.endPos(),install:(i,c)=>{let a=globalThis;for(let u of r.split("."))if(a=w(a,u),typeof a!="object"&&typeof a!="function")throw new Error("No such behavior defined as "+r);if(!G(a))throw new Error(r+" is not a behavior");a(i,c,o?.ev(B(i,s,i,null)))}};return s}}function ro(t){t.features.set=(e,n)=>{let r=Vt(e,n);"scope"in r.target&&r.target.scope==="local"&&e.err("variables declared at the feature level cannot be locally scoped (use :foo, ^foo, $foo, or an @attribute target instead).");let o={type:"setFeature",command:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>void r.run(B(s,o,s,null)))};return o}}function Cs(t,e){if(typeof t!="object"||t===null)return{queue:[],executing:!1};let n=V(t).eventQueues??=new Map,r=n.get(e);return r||n.set(e,r={queue:[],executing:!1}),r}function Jt(t,e){let n=Cs(t.me,e);if(n.executing&&!e.every){if(e.queue==="none"||e.queue==="first"&&n.queue.length>0)return;e.queue!=="all"&&(n.queue.length=0),n.queue.push(t);return}n.executing=!0;let r=o=>{n.executing=!1;let s=n.queue.shift();if(s&&setTimeout(()=>Jt(s,e),1),o){let{error:i}=o;console.error(w(i,"message")??i),console.error(w(i,"stack")),_(t.me,"exception",{error:i})}};ye(()=>E(st(t,e.body,e),()=>r()),o=>r({error:o}))}function Ss(t,e){if(!Q(e))return;let n=V(e),r=n.listeners??=[],o=n.observers??=[],s=n.timers??=new Set;for(let i of t.events){let c={execCount:0},a=i.elsewhere?[document]:i.from?i.from.ev(B(e,t,e,null)):[e];O(a,u=>{if(!Q(u)){console.warn("'%s' feature ignored because target does not exists:",t.displayName,e);return}let l=i.on;if(i.mutationSpec&&u instanceof Node){l="hyperscript:mutation";let f=new MutationObserver(p=>_(u,l,{mutationList:p,observer:f}));f.observe(u,i.mutationSpec),o.push(f)}if(i.intersectionSpec&&u instanceof Element){l="hyperscript:intersection";let f=new IntersectionObserver(p=>{for(let d of p)_(u,l,{observer:f,entry:d,intersecting:d.isIntersecting,isIntersecting:d.isIntersecting,intersectionRatio:d.intersectionRatio})},i.intersectionSpec);f.observe(u),o.push(f)}if(i.resizeSpec&&u instanceof Element){l="hyperscript:resize";let f=new ResizeObserver(p=>{for(let d of p){let{width:y,height:g}=d.contentRect;_(u,l,{width:y,height:g,contentRect:d.contentRect,entry:d})}});f.observe(u),o.push(f)}let m=f=>{if(e instanceof Node&&u!==e&&!e.isConnected){u.removeEventListener(l,m);return}let p=B(e,t,e,f);if(!(i.elsewhere&&e instanceof Node&&f.target instanceof Node&&e.contains(f.target))){i.from&&(p.result=u);for(let d of i.args){let y=w(f,d);y!==void 0?p.locals[d]=y:p.detail!=null&&(p.locals[d]=w(p.detail,d))}if(i.filter){p.meta.context=f;try{if(!i.filter.ev(p))return}finally{p.meta.context=void 0}}if(i.inExpr?.css){let d=f.target instanceof Element?f.target:null;for(;d&&!d.matches(i.inExpr.css);)d=d.parentElement;if(!d)return;p.result=d}if(c.execCount++,i.startCount){let d=c.execCount;if(i.endCount?d<i.startCount||d>i.endCount:i.unbounded?d<i.startCount:d!==i.startCount)return}if(i.debounceTime){c.debounced&&(clearTimeout(c.debounced),s.delete(c.debounced)),s.add(c.debounced=setTimeout(()=>Jt(p,t),i.debounceTime));return}if(i.throttleTime){if(c.lastExec&&Date.now()<c.lastExec+i.throttleTime)return;c.lastExec=Date.now()}Jt(p,t)}};u.addEventListener(l,m),r.push({target:u,event:l,handler:m})})}}function Ps(t){if(!t.match("of"))return{attributes:!0,characterData:!0,childList:!0,attributeOldValue:!0,characterDataOldValue:!0};let e={};do if(t.match("anything"))Object.assign(e,{attributes:!0,subtree:!0,characterData:!0,childList:!0});else if(t.match("childList"))e.childList=!0;else if(t.match("attributes"))e.attributes=!0;else if(t.match("subtree"))e.subtree=!0;else if(t.match("characterData"))e.characterData=!0;else if(t.cur().type==="ATTRIBUTE_REF"){let n=t.consume().value;n.startsWith("@")||t.err("Only shorthand attribute references are allowed here"),(e.attributeFilter??=[]).push(n.substring(1))}else t.err("Unknown mutation config specification");while(t.match("or"));return(e.attributes||e.attributeFilter)&&(e.attributeOldValue=!0),e.characterData&&(e.characterDataOldValue=!0),e}function Rs(t){let e={};if(t.match("with")){let n=je(h(t));n instanceof Element&&(e.root=n)}if(t.match("having"))do t.match("margin")?e.rootMargin=Ge(t):t.match("threshold")?e.threshold=Number(je(h(t))):t.err("Unknown intersection config specification");while(t.match("and"));return e}function Is(t,e){let n=ce(t),r=pt(t),o;t.matchOp("[")&&(o=h(t),t.reqOp("]"));let s,i,c=!1;e?s=1:t.cur().type==="NUMBER"&&(s=parseInt(t.consume().value),t.match("to")?i=parseInt(t.consume().value):t.match("and")&&(c=!0,t.req("on")));let a={on:n,args:r,filter:o,startCount:s,endCount:i,unbounded:c,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=Rs(t):n==="mutation"&&(a.mutationSpec=Ps(t)),t.match("from")&&(t.match("elsewhere")?a.elsewhere=!0:a.from=t.withFollow(["or"],()=>h(t))),!a.from&&!a.elsewhere&&t.match("elsewhere")&&(a.elsewhere=!0),t.match("in")&&(a.inExpr=$(t));let u=()=>(t.req("at"),Number(je($(t))));return t.match("debounced")?a.debounceTime=u():t.match("throttled")&&(a.throttleTime=u()),a}function oo(t){t.features.on=(e,n)=>{let r=!!e.match("every"),o=!r&&!!e.match("first"),s=[];do s.push(Is(e,o));while(e.match("or"));let i="last";!r&&e.match("queue")&&(e.match("all")?i="all":e.match("first")?i="first":e.match("none")?i="none":e.req("last"));let c=D(e),a={type:"onFeature",displayName:"on "+s.map(u=>u.on).join(" or "),events:s,body:c,every:r,queue:i,...mt(e),start:n,end:e.endPos(),install:u=>Ss(a,u)};return a}}var Oe=new WeakMap,ao=new Map,Xt=new Map,vt=new Map,Zt=new Map,ze=new Set,Qe=new WeakMap,Os=0,me,Yt=!1;function ke(t){let e=Oe.get(t);return e||Oe.set(t,e={id:++Os}),e}var yt=t=>typeof t=="object"&&t!==null;function As(t,e){let n=me;me=t,P.tracking=!0;try{return e()}finally{me=n,P.tracking=n!==void 0}}var Kt=class{constructor(e,n,r){this.expression=e;this.handler=n;this.element=r}dependencies=new Map;stopped=!1;last;triggers=0;evaluate(){try{return this.next=As(this,this.expression),!0}catch(e){return console.error("Error in reactive expression:",e),!1}}next;handle(e){try{this.handler(e)}catch(n){console.error("Error in reactive handler:",n)}}initialize(){this.evaluate()&&(this.last=this.next),so(this),this.last!=null&&this.handle(this.last)}run(){if(++this.triggers>100){console.error("Reactivity loop detected: an effect triggered 100 consecutive times without settling. This usually means an effect is modifying a variable it also depends on.",this.element??this);return}io(this);let e=this.dependencies;this.dependencies=new Map;let n=this.evaluate();n||(this.dependencies=e),so(this),n&&!Object.is(this.next,this.last)&&(this.last=this.next,this.handle(this.next))}settled(){this.triggers=0}stop(){this.stopped||(this.stopped=!0,io(this),ze.delete(this))}};function Ls(t){t.stopped||(ze.add(t),!Yt&&(Yt=!0,queueMicrotask(()=>{Yt=!1;let e=Array.from(ze);ze.clear();for(let n of e)n.stopped||(n.element&&!n.element.isConnected?n.stop():n.run());if(ze.size===0)for(let n of e)n.settled()})))}var Ie=t=>t?.forEach(Ls);function co(t){for(let[e,n]of Zt)for(let r of t)if(e.contains(r)){Ie(n);break}}var gt;function Fs(){gt??=new MutationObserver(t=>{let e=new Set;for(let n of t){if(n.type==="attributes"){let r=Oe.get(n.target);r&&Ie(Xt.get(`${n.attributeName}:${r.id}`))}e.add(n.target)}co(e)}),gt.observe(document,{attributes:!0,childList:!0,subtree:!0}),document.addEventListener("input",wt,!0),document.addEventListener("change",wt,!0)}function wt(t){let e=t.target;if(!(e instanceof Element))return;let n=Oe.get(e);n&&Ie(vt.get(n.id)),co([e])}function Ms(t,e,n){let r=t.get(e);r||t.set(e,r=new Set),r.add(n)}function qs(t,e,n){let r=t.get(e);r?.delete(n),r?.size===0&&t.delete(e)}function uo(t,e){let n=!1;for(let r of t.dependencies.values())r.type==="global"?e(ao,r.name,t):r.type==="element"?e(ke(r.element).symbols??=new Map,r.name,t):(n=!0,r.type==="query"?e(Zt,r.root,t):r.type==="property"?e(vt,ke(r.object).id,t):e(Xt,`${r.name}:${ke(r.element).id}`,t));return n}function so(t){uo(t,Ms)&&Fs()}function io(t){uo(t,qs),gt&&!Xt.size&&!vt.size&&!Zt.size&&(gt.disconnect(),document.removeEventListener("input",wt,!0),document.removeEventListener("change",wt,!0))}function Ae(t,e,n){let r=new Kt(t,e,n);return r.initialize(),n&&(Qe.has(n)||Qe.set(n,new Set),Qe.get(n)?.add(r)),()=>r.stop()}function _s(){P.readGlobal=t=>void me?.dependencies.set("symbol:global:"+t,{type:"global",name:t}),P.readElement=(t,e)=>{yt(e)&&me?.dependencies.set(`symbol:element:${t}:${ke(e).id}`,{type:"element",name:t,element:e})},P.readProperty=t=>{yt(t)&&!w(t,"_hsSkipTracking")&&me?.dependencies.set("property:"+ke(t).id,{type:"property",object:t})},P.readAttribute=(t,e)=>{x(t)&&me?.dependencies.set(`attribute:${e}:${ke(t).id}`,{type:"attribute",name:e,element:t})},P.wroteGlobal=t=>Ie(ao.get(t)),P.wroteElement=(t,e)=>{yt(e)&&Ie(Oe.get(e)?.symbols?.get(t))},P.readQuery=t=>void me?.dependencies.set("query:"+ke(t).id,{type:"query",root:t}),P.wroteProperty=t=>{let e=yt(t)&&!w(t,"_hsSkipTracking")&&Oe.get(t);e&&Ie(vt.get(e.id))},P.stop=t=>{Qe.get(t)?.forEach(e=>e.stop()),Qe.delete(t)}}var js=t=>e=>{console.error(w(e,"message")??e),_(t,"exception",{error:e})};function Ds(t){t.features.when=(e,n)=>{let r=[];do r.push(e.withFollow(["or"],()=>h(e)));while(e.match("or"));for(let i of r)i.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name&&e.err(`Cannot watch local variable '${i.name}'. Local variables are not reactive. Use '$${i.name}' (global) or ':${i.name}' (element-scoped) instead.`);e.req("changes");let o=D(e),s={type:"whenFeature",displayName:"when ... changes",watched:r,body:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=()=>B(i,s,i,null);for(let a of r)Ae(()=>a.ev(c()),u=>{let l=c();l.result=u,ye(()=>E(j(o,l),()=>{}),js(i))},x(i)?i:void 0)})};return s}}function Hs(t){t.features.live=(e,n)=>{let r=D(e),o={type:"liveFeature",displayName:"live",body:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>Ae(()=>void j(r,B(s,o,s,null)),()=>{},x(s)?s:void 0))};return o}}function Gs(t){if(t instanceof HTMLInputElement){let n=t.getAttribute("type")??"text";return n==="checkbox"?"checked":n==="number"||n==="range"?"valueAsNumber":"value"}if(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return"value";let e=t.getAttribute("contenteditable");if(e!==null&&e!=="false")return"textContent";if(t.tagName.includes("-")&&"value"in t)return"value";throw new Error(`bind cannot auto-detect a property for <${t.tagName.toLowerCase()}>. Use an explicit property (e.g. 'bind $var to #el's value').`)}function $s(t){if(t instanceof HTMLInputElement&&t.type==="radio")return{element:t,writable:!0,read:()=>ue(t,"checked")?t.value:void 0,write:n=>t.checked=n===t.value};let e=Gs(t);return{element:t,writable:!0,read:()=>{let n=ue(t,e);return e==="valueAsNumber"&&Number.isNaN(n)?null:n},write:n=>void Reflect.set(t,e,n)}}function Ws(t,e,n){let r=e.you||e.me;if(t.type==="classRef"&&"className"in t&&typeof t.className=="string")x(r)&&r.classList.toggle(t.className,!!n);else if(t.type==="attributeRef"&&typeof n=="boolean"&&t.name){if(!x(r))return;t.name.startsWith("aria-")?r.setAttribute(t.name,String(n)):r.toggleAttribute(t.name,n)}else E(t.lhs?.(e),o=>t.put?.(e,o,n))}function Bs(t,e,n){let r=()=>B(e,n,e,null);if(t.type==="classRef"&&"className"in t&&typeof t.className=="string"){let o=t.className;return{writable:!0,read:()=>(we(e,"class"),x(e)&&e.classList.contains(o)),write:s=>void(x(e)&&e.classList.toggle(o,!!s))}}return{writable:t.type==="attributeRef"||!!t.put,read:()=>t.ev(r()),write:o=>Ws(t,r(),o)}}function Us(t){t.features.bind=(e,n)=>{let r=e.withFollow(["and","with","to"],()=>h(e));e.matchAny("and","with","to")||e.expected("and","with","to");let o=h(e),s={type:"bindFeature",displayName:"bind",left:r,right:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=x(i)?i:void 0,a=u=>{let l=u.ev(B(i,s,i,null));return x(l)?$s(l):Bs(u,i,s)};try{let u=a(r),l=a(o);if(!u.writable&&!l.writable)throw new Error("bind requires at least one writable side");u.writable&&Ae(l.read,u.write,c),l.writable&&Ae(u.read,l.write,c);for(let[m,f]of[[u,l],[l,u]]){let p=m.element?.closest("form");if(!p||!c)continue;let d=()=>setTimeout(()=>c.isConnected&&f.write(m.read()),0);p.addEventListener("reset",d),(V(c).listeners??=[]).push({target:p,event:"reset",handler:d})}}catch(u){console.error(w(u,"message")??u)}})};return s}}function lo(t){_s(),Ds(t),Hs(t),Us(t)}var fo="#text";function Vs(t){let e=[],n=0,r=0;for(let o of t.split(/(?<=\n)/)){n++;let s=o.trimStart(),i=r+o.length-s.length;if(r+=o.length,!s||/^(--|\/\/)(\s|$|[-/])/.test(s))continue;let c=i-(r-o.length);if(/^#[a-zA-Z]/.test(s))for(let a of de(s.slice(1)))a.start+=i+1,a.end+=i+1,a.line=n,a.column+=c+1,e.push(a);else{let a=s.replace(/\r?\n$/,`
19
19
  `);e.push({type:"IDENTIFIER",value:fo,content:a,start:i,end:r,line:n,column:c})}}return e}var en=[];function tn(t,e){let n=en=[],r=new Pe(t,Vs(e),e),o=D(r);return r.hasMore()&&r.err(),{commands:o,errors:n}}var mo=t=>String(t).replace(/[&<>"']/g,e=>`&${zs[e]};`),zs={"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#039"};function Qs(t,e){let n=t.child(de(e),e),r=!n.match("unescaped"),o=h(n);if(!n.match("if"))return{value:o,escape:r};let s=h(n);return{value:o,condition:s,otherwise:n.match("else")?h(n):void 0,escape:r}}function Js(t,e){let{content:n="",line:r}=t.last,o=[];for(let c=0;c<n.length;){let a=n.indexOf("${",c);if(a===-1){o.push(n.slice(c));break}a>c&&o.push(n.slice(c,a));let u=1,l=a+2;for(;l<n.length&&u>0;l++)n[l]==="{"?u++:n[l]==="}"&&u--;if(u>0){let f=n.slice(a);en.push({line:r,message:"Unterminated ${} expression",expr:f});break}let m=n.slice(a+2,l-1);try{o.push(Qs(t,m))}catch(f){en.push({line:r,message:f instanceof Error?f.message:String(f),expr:m})}c=l}let s=(c,a)=>typeof c=="string"?c:c.condition?E(c.condition.ev(a),u=>u?c.value.ev(a):c.otherwise?.ev(a)):c.value.ev(a),i=(c,a)=>typeof c=="string"?c:a==null?"":c.escape?mo(a):String(a);return{type:"templateText",parts:o,start:e,end:t.endPos(),run:c=>N(o.map(a=>s(a,c)),a=>{c.meta.template?.out.push(a.map((u,l)=>i(o[l],u)).join(""))})}}var Ys=/<!--hs-scope:[^>]*-->/g;function nn(t,e,n){let r=[],o={};return e.meta.template={out:r,loops:o},E(j(t,e),()=>n(r.join(""),o))}function Ks(t){let e=t.closest('[data-live-template], [dom-scope="isolated"]'),n=e&&oe(e)?.loops;if(n)for(let r=t;r&&r!==e;r=r.parentElement)for(let o=r.previousSibling;o;o=o.previousSibling){if(!(o instanceof Comment)||!o.data.startsWith("hs-scope:"))continue;let[,s,i]=o.data.split(":"),c=n[s];if(c){let a=parseInt(i),u=Te(t);c.identifier&&(u[c.identifier]=Reflect.get(Object(c.source),a)),c.indexIdentifier&&(u[c.indexIdentifier]=a)}break}}function po(t){z.enter=Ks,t.commands[fo]=(e,n,r)=>Js(e,r),t.commands.render=(e,n,r)=>{let o=h(e),s=e.match("with")?He(e):void 0,i=!!e.match("here"),c=!i&&e.match("into")?h(e):void 0,a=e.text(o);return{type:"renderCommand",template:o,args:s,here:i,target:c,start:r,end:e.endPos(),run:l=>N([o.ev(l),s?.ev(l),c?.ev(l)],([m,f,p])=>{if(!x(m))throw new Error(a+" is not an element");let d;try{d=tn(t,m.textContent??"")}catch(g){console.error("hyperscript template parse error:",g instanceof Error?g.message:g),l.result="";return}for(let g of d.errors)console.error(`hyperscript template error (line ${g.line}): ${g.message}`+(g.expr?" in ${"+g.expr+"}":""));let y=B(l.me,void 0,l.me,null);return Object.assign(y.locals,l.locals,f),nn(d.commands,y,(g,v)=>{l.result=g.replace(Ys,"");for(let C of[i?l.me:void 0,p])x(C)&&(V(C).loops=v,C.innerHTML=g)})})}},t.leaves.push(e=>{let n=e.pos();if(!e.match("escape"))return;let r=e.reqType("IDENTIFIER").value,o=!!e.match("unescaped"),s=h(e);return{type:"escapeExpression",value:s,start:n,end:e.endPos(),ev:c=>E(s.ev(c),a=>{if(o)return a;if(a==null)return"";if(r!=="html")throw new Error("Unknown escape: "+r);return mo(a)})}})}function ho(t){let e=new WeakSet;We.addBeforeProcessHook(n=>{for(let r of n.querySelectorAll('script[type="text/hyperscript-template"][live]')){if(e.has(r))continue;e.add(r);let o=r.textContent??"",s=r.getAttribute("_")||r.getAttribute("data-script");r.removeAttribute("_"),r.removeAttribute("data-script");let i=document.createElement("div");i.style.display="contents",i.setAttribute("data-live-template",""),r.after(i),s&&(i.setAttribute("_",s),z.process(i));let c=()=>{let l;try{l=tn(t,o).commands}catch(f){return console.error("live-template parse error:",f instanceof Error?f.message:f),""}let m=B(i,void 0,i,null);return nn(l,m,(f,p)=>(V(i).loops=p,f))},a=!1,u=l=>{if(J(l))return void l.then(u);if(a)return Bt(i,l);i.innerHTML=String(l),z.process(i),a=!0};queueMicrotask(()=>E(c(),l=>{u(l),Ae(c,u,i)}))}})}var yo=[oo,Zr,eo,to,no,ro,gr,lo,ho,zr,Xr,Jr,Zn,er,nr,sr,ir,ar,ur,lr,dr,fr,mr,$r,Wr,Br,Ur,Fr,Wn,vr,Er,br,Un,Vn,zn,pr,hr,Mr,Hr,Dr,Gn,Hn,$n,Rr,Ir,Or,Ar,Lr,po,Pr,_n,jn];Pn(...yo);qn();})();
@@ -2145,7 +2145,7 @@
2145
2145
  cleanup,
2146
2146
  /** The part of upstream's `internals` that pages and tests reach for. */
2147
2147
  internals: { runtime: { cleanup, processNode } },
2148
- version: false ? "dev" : "7.4.0"
2148
+ version: false ? "dev" : "7.5.1"
2149
2149
  });
2150
2150
  function boot() {
2151
2151
  Object.assign(globalThis, { _hyperscript: api });
@@ -14,6 +14,6 @@
14
14
 
15
15
  `+jt(s)+i)}else _(t,"exception",{error:s}),console.error("hyperscript errors were found on the following element:",t,`
16
16
 
17
- `,s)}}var Fn=[],Mn=[],Dt=new Set;function fe(t){if((t instanceof Element||t instanceof Document||t instanceof DocumentFragment)&&!Dt.has(t)){Dt.add(t);try{for(let n of Fn)n(t);let e=On().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";t instanceof Element&&t.matches(e)&&Cn(t),t.querySelectorAll(e).forEach(Cn);for(let n of Mn)n(t)}finally{Dt.delete(t)}}}function xe(t){let e=oe(t);if(e){_(t,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of e.listeners??[])n.removeEventListener(r,o);for(let n of e.observers??[])n.disconnect();for(let n of e.timers??[])clearTimeout(n);P.stop(t),t.querySelectorAll("[data-hyperscript-powered]").forEach(xe),_(t,"hyperscript:after:cleanup"),t.removeAttribute("data-hyperscript-powered"),sn(t)}}z.process=fe;function Jo(t){try{let e=In(t);return e.kind==="features"?{...e.program,errors:[]}:{...e.kind==="commands"?e.commands[0]:e.expression,errors:[]}}catch(e){if(e instanceof be)return{errors:[e]};throw e}}var ke=Object.assign(Tn,{config:Object.assign(Z,{conversions:Object.assign(ge,{dynamicResolvers:Me})}),use(t){t(ke)},addBeforeProcessHook:t=>void Fn.push(t),addAfterProcessHook:t=>void Mn.push(t),addSourceTransform:t=>void Ln.push(t),evaluate:Tn,parse:Jo,process:fe,processNode:fe,cleanup:xe,internals:{runtime:{cleanup:xe,processNode:fe}},version:"7.4.0"});function qn(){if(Object.assign(globalThis,{_hyperscript:ke}),typeof document>"u")return;let t=()=>{fe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),xn(ke)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}function _n(t){t.unaries.push(e=>{let n=1;for(;e.tok(n).type==="IDENTIFIER"&&e.tok(n+1).op&&e.tok(n+1).value===".";)n+=2;let r=e.tok(n+1);if(!e.peek("new")||e.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=e.pos();e.consume();let s=[e.consume().value];for(;e.matchOp(".");)s.push(e.consume().value);e.reqOp("(");let i=[];if(!e.matchOp(")")){do i.push(h(e));while(e.matchOp(","));e.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:e.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),le(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function Yo(t,e){let n=t instanceof HTMLElement&&t.tagName==="SUMMARY"?t.parentElement:t;if(n instanceof HTMLDialogElement)n.open?n.close():e?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function jn(t){t.toggleElement=(e,n,r)=>{let o=e.match("as")?!!e.req("modal"):!!e.match("modal"),s=e.text(n);return{type:"toggleElementCommand",target:n,modal:o,start:r,end:e.endPos(),run:c=>E(n.ev(c),a=>{F(a,s),O(a,u=>Yo(u,o))})}}}var Dn=(t,e,n)=>new Promise(r=>{let o=!1;t.addEventListener("transitionstart",()=>o=!0,{once:!0}),t.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),e),n?.()});function Hn(t){t.commands.settle=(e,n,r)=>{let o=e.commandBoundary(e.cur())?U(e):h(e),s=e.text(o);return{type:"settleCommand",target:o,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{F(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Dn(l,500))).then(()=>{})})}}}function Gn(t){t.commands.transition=(e,n,r)=>{let o=[],s=[],i=[];do o.push(e.withFollow(["from","to"],()=>h(e))),s.push(e.match("from")?h(e):void 0),e.req("to"),i.push(e.match("initial")?"initial":h(e));while(!e.commandBoundary(e.cur())&&e.cur().value!=="over"&&e.cur().value!=="using");let c=e.match("over")?h(e):void 0,a=!c&&e.match("using")?h(e):void 0,u=o[0].root,l=u?e.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:e.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&F(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):Z.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let M=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Dn(R,100,()=>setTimeout(()=>m(p,M),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function $n(t){t.commands.start=(e,n,r)=>{e.match("a"),e.req("view"),e.req("transition"),e.match("using");let o=e.matchType("STRING")?.value,s=D(e);e.hasMore()&&e.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:e.endPos(),run:a=>{if(!document.startViewTransition)return j(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>j(s,a)).then(d=>p(re(d)))}}}}function Wn(t){t.commands.if=(e,n,r)=>{let o=h(e);e.match("then");let s=D(e),i,c=!1,a=e.match("else")??e.match("otherwise");if(a)if(c=e.peek("if")?.line===a.line,c){let l=ft(e);i=l?[l]:[]}else i=D(e);return e.hasMore()&&!c&&e.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:e.endPos(),run:l=>E(o.ev(l),m=>m?j(s,l):i&&j(i,l))}}}var Bn={k:"return",value:null};function Un(t){t.commands.halt=(e,n,r)=>{let o=!1;e.match("the")&&(e.req("event"),e.matchOp("'")&&e.req("s"),o=!0);let s=!!e.match("bubbling"),i=!s&&!!e.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:e.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Bn}}}}function Vn(t){t.commands.return=(e,n,r)=>{let o=e.commandBoundary(e.cur())?void 0:h(e);return{type:"returnCommand",value:o,start:r,end:e.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},t.commands.exit=(e,n,r)=>({type:"exitCommand",start:r,end:e.endPos(),run:()=>Bn})}function zn(t){t.commands.throw=(e,n,r)=>{let o=h(e);return{type:"throwCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Yn(t){let e=te(t);if(!e)return;let n=[e];for(let r=te(t);r;r=te(t))n.push(r);return n}var Ht=(t,e)=>(t??[]).map(n=>E(n.ev(e),r=>String(w(r,"className")))),Ko=t=>t.split(";").map(e=>e.split(":")[0].trim()).filter(Boolean),Gt=t=>t instanceof HTMLElement||t instanceof SVGElement?t.style:void 0,Qn=(t,e,n,r,o)=>e?it(t,e,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(t,s=>x(s)&&r(s)),Be=(t,{name:e,value:n},r)=>r?t.setAttribute(e,String(n)):t.removeAttribute(e),Kn=(t,e,n,r,o,s)=>s?Qn(e,n,r,i=>Be(i,s,t),i=>Be(i,s,!t)):N(o.map(i=>Qn(e,n,r,c=>c.classList.toggle(String(i),t),c=>c.classList.toggle(String(i),!t))),()=>{});function Xn(t){let e=Yn(t),n=e?void 0:K(t);return{refs:e,attribute:n,css:e||n?void 0:En(t)}}function Zn(t){t.commands.add=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c;!o&&!s&&!i&&(c=e.withFollow(["to"],()=>h(e)),e.cur().value!=="to"&&e.err("Expected either a class reference or attribute expression"));let a=e.match("to")?h(e):U(e),u=e.match("when")?h(e):void 0,l=o||s?u:void 0,m=e.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:e.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Ht(o,p)],([d,y,g,...v])=>{if(F(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Gt(C);S&&(S.cssText+=y)});else return Kn(!0,d,l,p,v,s)})}}}var Xo=t=>t instanceof Node||t instanceof NodeList||t instanceof HTMLCollection;function er(t){t.commands.remove=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c=o||s||i?void 0:h(e),a=e.match("from")?h(e):c?void 0:U(e),u;e.match("when")&&(c&&e.err("'when' clause is not supported when removing elements"),u=h(e));let l=a?e.text(a):"",m=c?e.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!Xo(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(F(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:e.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Ht(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(F(y,l),i){let S=Ko(String(g));O(y,R=>S.forEach(I=>Gt(R)?.removeProperty(I)))}else return Kn(!1,y,u,d,C,s)})}}}var Jn=(t,e,n)=>(r,o,s)=>{s?o.style[t]=s:r==="toggle"?o.style[t]=getComputedStyle(o)[t]===e?n:e:o.style[t]=r==="hide"?e:n},tr={display(t,e,n){if(!n&&e instanceof HTMLDialogElement){t==="hide"||t==="toggle"&&e.open?e.close():e.open||e.show();return}let r=V(e);n?e.style.display=n:t==="toggle"?tr.display(getComputedStyle(e).display==="none"?"show":"hide",e):t==="hide"?(r.originalDisplay??=e.style.display,e.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?e.style.display=r.originalDisplay:e.style.removeProperty("display")},visibility:Jn("visibility","hidden","visible"),opacity:Jn("opacity","0","1"),hidden(t,e){(t==="toggle"?!e.hasAttribute("hidden"):t==="hide")?e.setAttribute("hidden",""):e.removeAttribute("hidden")}};function $t(t,e){let n=e??Z.defaultHideShowStrategy??"display";return Z.hideShowStrategies[n]??tr[n]??t.err("Unknown show/hide strategy : "+n)}function nr(t){t.commands.toggle=(e,n,r)=>{e.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(e.cur().type==="STYLE_REF"){let y=o.styleProp=e.consume().value.slice(1);s=$t(e,y),o.on=e.match("of")?e.withFollow(["with","between"],()=>h(e)):U(e)}else if(e.match("between")){let y=te(e);if(y)e.req("and"),o.between=[y,te(e)??e.err("Expected classRef")];else{let g=K(e)??e.err("Expected either a class reference or attribute expression");e.req("and"),o.between=[g,K(e)??e.err("Expected attributeRef")]}}else if(!(o.classRefs=Yn(e))&&!(o.attributeRef=K(e))){let y=e.g.toggleElement;if(!y)o.target=e.withFollow(["between"],()=>ae(e));else{let g=e.withFollow(["between","as"],()=>$(e));if(!e.peek("between"))return y(e,g,r);o.target=Lt(e,g)}}if(!o.styleProp&&!o.target&&(o.on=e.match("on")?h(e):U(e)),e.match("between")){let y=o.betweenValues=e.withFollow(["and"],()=>{let g=[h(e)];for(;e.matchOp(",");)g.push(h(e));return g});e.req("and"),y.push(h(e))}o.target&&!o.betweenValues&&e.err("toggle <expression> requires 'between' with values"),e.peek("for")&&!e.peek("in",2)?(e.match("for"),o.time=h(e)):e.match("until")&&(o.until=ce(e),e.match("from")&&(o.from=h(e))),o.end=e.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?e.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Gt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});F(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,M]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(M,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Be(S,A?R:I,!1),Be(S,A?I:R,!0)}}else l?Be(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Ht(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,M=C||y.me;return new Promise(q=>{Q(M)&&M.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function sr(t){for(let e of["hide","show"])t.commands[e]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;e==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=$t(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${e}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(F(y,m),u)return it(y,u,d,f(e),f(e==="hide"?"show":"hide"));O(y,f(e))})}}}function ir(t){t.commands.take=(e,n,r)=>{let o=[];for(let v=te(e);v;v=te(e))o.push(v);let s=o.length>0,i=s?void 0:K(e)??e.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&e.err(`\`${v}\` cannot be combined with multiple class refs`),te(e)??e.err("Expected classRef"));e.match("with")&&(s?c=u("with"):a=h(e));let l;e.match("from")&&(l=h(e),e.match("giving")&&((c||a)&&e.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(e)));let m=e.match("for")?h(e):U(e),f=e.text(m),p=l?e.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:e.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(F(S,f),i){F(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,M)=>{let q=String(A.className);y(l?C:I[M],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var Zo="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ar(t){t.commands.measure=(e,n,r)=>{let o=U(e),s=[];if(!e.commandBoundary(e.cur())){let a=h(e);a.type==="symbol"&&a.name&&Zo.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;e.matchOp(",");)s.push(e.reqType("IDENTIFIER").value);let i=e.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{F(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function Ue(t,e,n){for(let r of e)t.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${e[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var ht=t=>e=>{let n=w(e,t);G(n)&&Reflect.apply(n,e,[])},rr=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,cr=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),or=(t,e)=>{if(rr(t))e(t);else if(t instanceof HTMLFormElement)t.querySelectorAll("input, textarea, select").forEach(n=>rr(n)&&e(n));else return!1;return!0},es=t=>{t instanceof HTMLSelectElement?t.selectedIndex=-1:cr(t)?t.checked=!1:t.value=""},ts=t=>{if(t instanceof HTMLSelectElement)for(let e of t.options)e.selected=e.defaultSelected;else cr(t)?t.checked=t.defaultChecked:t.value=t.defaultValue},ns=t=>e=>O(e,n=>{n instanceof HTMLDialogElement?t?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=t:n instanceof HTMLElement&&n.hasAttribute("popover")?n[t?"showPopover":"hidePopover"]():ht(t?"open":"close")(n)});function ur(t){Ue(t,["focus"],ht("focus")),Ue(t,["blur"],ht("blur")),Ue(t,["select"],ht("select")),Ue(t,["empty","clear"],e=>{Array.isArray(e)||e instanceof Set||e instanceof Map?(Array.isArray(e)?e.splice(0):e.clear(),P.wroteProperty(e)):O(e,n=>or(n,es)||x(n)&&n.replaceChildren())}),Ue(t,["reset"],e=>O(e,n=>n instanceof HTMLFormElement?n.reset():or(n,ts)))}function lr(t){for(let e of[!0,!1]){let n=e?"open":"close";t.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?e?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():ns(e)(l||u.me))}}}}function dr(t){t.commands.make=(e,n,r)=>{e.match("a")||e.match("an");let o=h(e),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&e.match("from"))do s.push(h(e));while(e.matchOp(","));let c=e.match("called")?qt(e)??e.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:e.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function fr(t){t.commands.append=(e,n,r)=>{let o=h(e),s=e.match("to")?je(h(e)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:e.endPos(),run:c=>N([s?s.ev(c):le("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)ot("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function mr(t){t.commands.swap=(e,n,r)=>{let o=e.withFollow(["with"],()=>ae(e));e.req("with");let s=ae(e);return{type:"swapCommand",first:o,second:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function pr(t){t.commands.send=t.commands.trigger=(e,n,r)=>{let o=ce(e),s=ut(e),i=e.match(n==="trigger"?"on":"to")?h(e):U(e),c=e.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:e.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{F(l,c),O(l,f=>_(f,o,W(m)?m:{},u.me))})}}}function hr(t){t.commands.wait=(e,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(e.match("for")){e.match("a");let s=o.events=[];do{let a=e.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(e)):s.push({event:ce(e),args:pt(e)})}while(e.match("or"));let i=o.from=e.match("from")?h(e):void 0,c=i?e.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;e.match("a")?e.req("tick"):s=o.time=h(e),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=e.endPos(),o}}function yr(t){let e=t.pos(),n=t.cur(),r=[],o="",s=!1;for(;t.hasMore();){n=t.consume();let i=t.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:t.src.substring(e,n.end+1),functions:r}}function gr(t){t.commands.js=(e,n,r)=>{let o=[];if(e.matchOp("(")&&!e.matchOp(")")){do o.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let{source:s}=yr(e);e.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:e.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>le(u,a))),u=>{a.result=u})}},t.features.js=(e,n)=>{let{source:r,functions:o}=yr(e),s=new Function(`${r}
17
+ `,s)}}var Fn=[],Mn=[],Dt=new Set;function fe(t){if((t instanceof Element||t instanceof Document||t instanceof DocumentFragment)&&!Dt.has(t)){Dt.add(t);try{for(let n of Fn)n(t);let e=On().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";t instanceof Element&&t.matches(e)&&Cn(t),t.querySelectorAll(e).forEach(Cn);for(let n of Mn)n(t)}finally{Dt.delete(t)}}}function xe(t){let e=oe(t);if(e){_(t,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of e.listeners??[])n.removeEventListener(r,o);for(let n of e.observers??[])n.disconnect();for(let n of e.timers??[])clearTimeout(n);P.stop(t),t.querySelectorAll("[data-hyperscript-powered]").forEach(xe),_(t,"hyperscript:after:cleanup"),t.removeAttribute("data-hyperscript-powered"),sn(t)}}z.process=fe;function Jo(t){try{let e=In(t);return e.kind==="features"?{...e.program,errors:[]}:{...e.kind==="commands"?e.commands[0]:e.expression,errors:[]}}catch(e){if(e instanceof be)return{errors:[e]};throw e}}var ke=Object.assign(Tn,{config:Object.assign(Z,{conversions:Object.assign(ge,{dynamicResolvers:Me})}),use(t){t(ke)},addBeforeProcessHook:t=>void Fn.push(t),addAfterProcessHook:t=>void Mn.push(t),addSourceTransform:t=>void Ln.push(t),evaluate:Tn,parse:Jo,process:fe,processNode:fe,cleanup:xe,internals:{runtime:{cleanup:xe,processNode:fe}},version:"7.5.1"});function qn(){if(Object.assign(globalThis,{_hyperscript:ke}),typeof document>"u")return;let t=()=>{fe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),xn(ke)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}function _n(t){t.unaries.push(e=>{let n=1;for(;e.tok(n).type==="IDENTIFIER"&&e.tok(n+1).op&&e.tok(n+1).value===".";)n+=2;let r=e.tok(n+1);if(!e.peek("new")||e.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=e.pos();e.consume();let s=[e.consume().value];for(;e.matchOp(".");)s.push(e.consume().value);e.reqOp("(");let i=[];if(!e.matchOp(")")){do i.push(h(e));while(e.matchOp(","));e.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:e.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),le(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function Yo(t,e){let n=t instanceof HTMLElement&&t.tagName==="SUMMARY"?t.parentElement:t;if(n instanceof HTMLDialogElement)n.open?n.close():e?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function jn(t){t.toggleElement=(e,n,r)=>{let o=e.match("as")?!!e.req("modal"):!!e.match("modal"),s=e.text(n);return{type:"toggleElementCommand",target:n,modal:o,start:r,end:e.endPos(),run:c=>E(n.ev(c),a=>{F(a,s),O(a,u=>Yo(u,o))})}}}var Dn=(t,e,n)=>new Promise(r=>{let o=!1;t.addEventListener("transitionstart",()=>o=!0,{once:!0}),t.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),e),n?.()});function Hn(t){t.commands.settle=(e,n,r)=>{let o=e.commandBoundary(e.cur())?U(e):h(e),s=e.text(o);return{type:"settleCommand",target:o,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{F(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Dn(l,500))).then(()=>{})})}}}function Gn(t){t.commands.transition=(e,n,r)=>{let o=[],s=[],i=[];do o.push(e.withFollow(["from","to"],()=>h(e))),s.push(e.match("from")?h(e):void 0),e.req("to"),i.push(e.match("initial")?"initial":h(e));while(!e.commandBoundary(e.cur())&&e.cur().value!=="over"&&e.cur().value!=="using");let c=e.match("over")?h(e):void 0,a=!c&&e.match("using")?h(e):void 0,u=o[0].root,l=u?e.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:e.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&F(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):Z.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let M=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Dn(R,100,()=>setTimeout(()=>m(p,M),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function $n(t){t.commands.start=(e,n,r)=>{e.match("a"),e.req("view"),e.req("transition"),e.match("using");let o=e.matchType("STRING")?.value,s=D(e);e.hasMore()&&e.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:e.endPos(),run:a=>{if(!document.startViewTransition)return j(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>j(s,a)).then(d=>p(re(d)))}}}}function Wn(t){t.commands.if=(e,n,r)=>{let o=h(e);e.match("then");let s=D(e),i,c=!1,a=e.match("else")??e.match("otherwise");if(a)if(c=e.peek("if")?.line===a.line,c){let l=ft(e);i=l?[l]:[]}else i=D(e);return e.hasMore()&&!c&&e.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:e.endPos(),run:l=>E(o.ev(l),m=>m?j(s,l):i&&j(i,l))}}}var Bn={k:"return",value:null};function Un(t){t.commands.halt=(e,n,r)=>{let o=!1;e.match("the")&&(e.req("event"),e.matchOp("'")&&e.req("s"),o=!0);let s=!!e.match("bubbling"),i=!s&&!!e.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:e.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Bn}}}}function Vn(t){t.commands.return=(e,n,r)=>{let o=e.commandBoundary(e.cur())?void 0:h(e);return{type:"returnCommand",value:o,start:r,end:e.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},t.commands.exit=(e,n,r)=>({type:"exitCommand",start:r,end:e.endPos(),run:()=>Bn})}function zn(t){t.commands.throw=(e,n,r)=>{let o=h(e);return{type:"throwCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Yn(t){let e=te(t);if(!e)return;let n=[e];for(let r=te(t);r;r=te(t))n.push(r);return n}var Ht=(t,e)=>(t??[]).map(n=>E(n.ev(e),r=>String(w(r,"className")))),Ko=t=>t.split(";").map(e=>e.split(":")[0].trim()).filter(Boolean),Gt=t=>t instanceof HTMLElement||t instanceof SVGElement?t.style:void 0,Qn=(t,e,n,r,o)=>e?it(t,e,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(t,s=>x(s)&&r(s)),Be=(t,{name:e,value:n},r)=>r?t.setAttribute(e,String(n)):t.removeAttribute(e),Kn=(t,e,n,r,o,s)=>s?Qn(e,n,r,i=>Be(i,s,t),i=>Be(i,s,!t)):N(o.map(i=>Qn(e,n,r,c=>c.classList.toggle(String(i),t),c=>c.classList.toggle(String(i),!t))),()=>{});function Xn(t){let e=Yn(t),n=e?void 0:K(t);return{refs:e,attribute:n,css:e||n?void 0:En(t)}}function Zn(t){t.commands.add=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c;!o&&!s&&!i&&(c=e.withFollow(["to"],()=>h(e)),e.cur().value!=="to"&&e.err("Expected either a class reference or attribute expression"));let a=e.match("to")?h(e):U(e),u=e.match("when")?h(e):void 0,l=o||s?u:void 0,m=e.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:e.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Ht(o,p)],([d,y,g,...v])=>{if(F(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Gt(C);S&&(S.cssText+=y)});else return Kn(!0,d,l,p,v,s)})}}}var Xo=t=>t instanceof Node||t instanceof NodeList||t instanceof HTMLCollection;function er(t){t.commands.remove=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c=o||s||i?void 0:h(e),a=e.match("from")?h(e):c?void 0:U(e),u;e.match("when")&&(c&&e.err("'when' clause is not supported when removing elements"),u=h(e));let l=a?e.text(a):"",m=c?e.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!Xo(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(F(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:e.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Ht(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(F(y,l),i){let S=Ko(String(g));O(y,R=>S.forEach(I=>Gt(R)?.removeProperty(I)))}else return Kn(!1,y,u,d,C,s)})}}}var Jn=(t,e,n)=>(r,o,s)=>{s?o.style[t]=s:r==="toggle"?o.style[t]=getComputedStyle(o)[t]===e?n:e:o.style[t]=r==="hide"?e:n},tr={display(t,e,n){if(!n&&e instanceof HTMLDialogElement){t==="hide"||t==="toggle"&&e.open?e.close():e.open||e.show();return}let r=V(e);n?e.style.display=n:t==="toggle"?tr.display(getComputedStyle(e).display==="none"?"show":"hide",e):t==="hide"?(r.originalDisplay??=e.style.display,e.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?e.style.display=r.originalDisplay:e.style.removeProperty("display")},visibility:Jn("visibility","hidden","visible"),opacity:Jn("opacity","0","1"),hidden(t,e){(t==="toggle"?!e.hasAttribute("hidden"):t==="hide")?e.setAttribute("hidden",""):e.removeAttribute("hidden")}};function $t(t,e){let n=e??Z.defaultHideShowStrategy??"display";return Z.hideShowStrategies[n]??tr[n]??t.err("Unknown show/hide strategy : "+n)}function nr(t){t.commands.toggle=(e,n,r)=>{e.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(e.cur().type==="STYLE_REF"){let y=o.styleProp=e.consume().value.slice(1);s=$t(e,y),o.on=e.match("of")?e.withFollow(["with","between"],()=>h(e)):U(e)}else if(e.match("between")){let y=te(e);if(y)e.req("and"),o.between=[y,te(e)??e.err("Expected classRef")];else{let g=K(e)??e.err("Expected either a class reference or attribute expression");e.req("and"),o.between=[g,K(e)??e.err("Expected attributeRef")]}}else if(!(o.classRefs=Yn(e))&&!(o.attributeRef=K(e))){let y=e.g.toggleElement;if(!y)o.target=e.withFollow(["between"],()=>ae(e));else{let g=e.withFollow(["between","as"],()=>$(e));if(!e.peek("between"))return y(e,g,r);o.target=Lt(e,g)}}if(!o.styleProp&&!o.target&&(o.on=e.match("on")?h(e):U(e)),e.match("between")){let y=o.betweenValues=e.withFollow(["and"],()=>{let g=[h(e)];for(;e.matchOp(",");)g.push(h(e));return g});e.req("and"),y.push(h(e))}o.target&&!o.betweenValues&&e.err("toggle <expression> requires 'between' with values"),e.peek("for")&&!e.peek("in",2)?(e.match("for"),o.time=h(e)):e.match("until")&&(o.until=ce(e),e.match("from")&&(o.from=h(e))),o.end=e.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?e.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Gt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});F(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,M]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(M,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Be(S,A?R:I,!1),Be(S,A?I:R,!0)}}else l?Be(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Ht(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,M=C||y.me;return new Promise(q=>{Q(M)&&M.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function sr(t){for(let e of["hide","show"])t.commands[e]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;e==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=$t(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${e}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(F(y,m),u)return it(y,u,d,f(e),f(e==="hide"?"show":"hide"));O(y,f(e))})}}}function ir(t){t.commands.take=(e,n,r)=>{let o=[];for(let v=te(e);v;v=te(e))o.push(v);let s=o.length>0,i=s?void 0:K(e)??e.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&e.err(`\`${v}\` cannot be combined with multiple class refs`),te(e)??e.err("Expected classRef"));e.match("with")&&(s?c=u("with"):a=h(e));let l;e.match("from")&&(l=h(e),e.match("giving")&&((c||a)&&e.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(e)));let m=e.match("for")?h(e):U(e),f=e.text(m),p=l?e.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:e.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(F(S,f),i){F(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,M)=>{let q=String(A.className);y(l?C:I[M],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var Zo="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ar(t){t.commands.measure=(e,n,r)=>{let o=U(e),s=[];if(!e.commandBoundary(e.cur())){let a=h(e);a.type==="symbol"&&a.name&&Zo.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;e.matchOp(",");)s.push(e.reqType("IDENTIFIER").value);let i=e.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{F(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function Ue(t,e,n){for(let r of e)t.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${e[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var ht=t=>e=>{let n=w(e,t);G(n)&&Reflect.apply(n,e,[])},rr=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,cr=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),or=(t,e)=>{if(rr(t))e(t);else if(t instanceof HTMLFormElement)t.querySelectorAll("input, textarea, select").forEach(n=>rr(n)&&e(n));else return!1;return!0},es=t=>{t instanceof HTMLSelectElement?t.selectedIndex=-1:cr(t)?t.checked=!1:t.value=""},ts=t=>{if(t instanceof HTMLSelectElement)for(let e of t.options)e.selected=e.defaultSelected;else cr(t)?t.checked=t.defaultChecked:t.value=t.defaultValue},ns=t=>e=>O(e,n=>{n instanceof HTMLDialogElement?t?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=t:n instanceof HTMLElement&&n.hasAttribute("popover")?n[t?"showPopover":"hidePopover"]():ht(t?"open":"close")(n)});function ur(t){Ue(t,["focus"],ht("focus")),Ue(t,["blur"],ht("blur")),Ue(t,["select"],ht("select")),Ue(t,["empty","clear"],e=>{Array.isArray(e)||e instanceof Set||e instanceof Map?(Array.isArray(e)?e.splice(0):e.clear(),P.wroteProperty(e)):O(e,n=>or(n,es)||x(n)&&n.replaceChildren())}),Ue(t,["reset"],e=>O(e,n=>n instanceof HTMLFormElement?n.reset():or(n,ts)))}function lr(t){for(let e of[!0,!1]){let n=e?"open":"close";t.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?e?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():ns(e)(l||u.me))}}}}function dr(t){t.commands.make=(e,n,r)=>{e.match("a")||e.match("an");let o=h(e),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&e.match("from"))do s.push(h(e));while(e.matchOp(","));let c=e.match("called")?qt(e)??e.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:e.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function fr(t){t.commands.append=(e,n,r)=>{let o=h(e),s=e.match("to")?je(h(e)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:e.endPos(),run:c=>N([s?s.ev(c):le("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)ot("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function mr(t){t.commands.swap=(e,n,r)=>{let o=e.withFollow(["with"],()=>ae(e));e.req("with");let s=ae(e);return{type:"swapCommand",first:o,second:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function pr(t){t.commands.send=t.commands.trigger=(e,n,r)=>{let o=ce(e),s=ut(e),i=e.match(n==="trigger"?"on":"to")?h(e):U(e),c=e.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:e.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{F(l,c),O(l,f=>_(f,o,W(m)?m:{},u.me))})}}}function hr(t){t.commands.wait=(e,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(e.match("for")){e.match("a");let s=o.events=[];do{let a=e.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(e)):s.push({event:ce(e),args:pt(e)})}while(e.match("or"));let i=o.from=e.match("from")?h(e):void 0,c=i?e.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;e.match("a")?e.req("tick"):s=o.time=h(e),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=e.endPos(),o}}function yr(t){let e=t.pos(),n=t.cur(),r=[],o="",s=!1;for(;t.hasMore();){n=t.consume();let i=t.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:t.src.substring(e,n.end+1),functions:r}}function gr(t){t.commands.js=(e,n,r)=>{let o=[];if(e.matchOp("(")&&!e.matchOp(")")){do o.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let{source:s}=yr(e);e.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:e.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>le(u,a))),u=>{a.result=u})}},t.features.js=(e,n)=>{let{source:r,functions:o}=yr(e),s=new Function(`${r}
18
18
  return { ${o.map(c=>`${c}:${c}`).join(",")} } `);return{type:"jsFeature",source:r,functions:o,start:n,end:e.endPos(),install:()=>void Object.assign(globalThis,s())}}}function wr(t){for(;;){let e=t();if(J(e))return e.then(n=>n??wr(t));if(e)return e}}var rs=t=>{if(t){if(W(t)&&Symbol.asyncIterator in Object(t)){let e=Reflect.get(Object(t),Symbol.asyncIterator);return typeof e=="function"?Reflect.apply(e,t,[]):void 0}return(Y(t)?t:Object.keys(Object(t)))[Symbol.iterator]()}};function vr(t){t.commands.repeat=t.commands.for=(e,n,r)=>{let o={type:"repeatCommand",until:!1,bottomTested:!1,forever:!1,body:[],start:r,end:r,run:()=>{}};if(n==="for"||e.match("for")){let v=o.identifier=e.reqType("IDENTIFIER").value;e.req("in"),o.expression=h(e);for(let C=o.expression;C;C=C.root)C.type==="collectionExpression"&&(C.varName=v)}else e.match("in")?(o.identifier="it",o.expression=h(e)):e.match("while")?o.condition=h(e):e.match("until")?(o.until=!0,e.match("event")?(o.event=ce(e),e.match("from")&&(o.from=h(e))):o.condition=h(e)):!e.commandBoundary(e.cur())&&e.cur().value!=="forever"?(o.times=h(e),e.req("times")):(e.match("forever"),o.forever=!0);e.match("index")?o.indexIdentifier=e.reqType("IDENTIFIER").value:e.match("indexed")&&(e.req("by"),o.indexIdentifier=e.reqType("IDENTIFIER").value);let s=o.body=D(e);if(o.forever&&e.hasMore()){let v=e.match("until")??e.match("while");v&&(o.forever=!1,o.bottomTested=!0,o.until=v.value==="until",o.condition=h(e))}e.match("else")&&(o.elseBranch=D(e)),e.hasMore()&&e.req("end"),o.end=e.endPos();let{identifier:i,indexIdentifier:c,expression:a,times:u,condition:l,until:m,bottomTested:f,forever:p,event:d,from:y,elseBranch:g}=o;return o.run=v=>N([a?.ev(v),y?.ev(v)],([C,S])=>{let R=rs(C)??(g?[][Symbol.iterator]():void 0),I=0,A=!1,M=!1;if(d){let L=S||v.me;Q(L)&&L.addEventListener(d,()=>M=!0,{once:!0})}let q=()=>!A&&g?E(j(g,v),L=>({signal:re(L)})):{signal:void 0},b=L=>{let H=I++;A=!0,C&&i?v.result=v.locals[i]=L:v.result=H,c&&(v.locals[c]=H);let X=v.meta.template;if(X&&C){let pe=`${i}_${r}`;X.loops[pe]??={identifier:i,indexIdentifier:c,source:C},X.out.push(`<!--hs-scope:${pe}:${H}-->`)}return E(j(s,v),pe=>{let rn=w(pe,"k");if(rn==="break")return{signal:void 0};if(rn==="return")return{signal:re(pe)};if(d)return new Promise(go=>setTimeout(go,0))})};return E(wr(()=>N([l?.ev(v),u?.ev(v)],([L,H])=>f&&I===0||p?b(void 0):m?(d?!M:L!==!0)?b(void 0):q():l?L?b(void 0):q():H?I<T(H)?b(void 0):q():R?E(R.next(),X=>w(X,"done")?q():b(w(X,"value"))):q())),L=>re(w(L,"signal")))}),o}}function Er(t){for(let e of["break","continue"]){let n={k:e};t.commands[e]=(r,o,s)=>({type:`${e}Command`,start:s,end:r.endPos(),run:()=>n})}}function br(t){t.commands.tell=(e,n,r)=>{let o=h(e),s=D(e);e.hasMore()&&!e.featureStart(e.cur())&&e.req("end");let i=(a,u,l)=>{for(;l<u.length;l++){a.you=u[l];let m=j(s,a);if(J(m))return m.then(f=>re(f)??i(a,u,l+1));if(m)return m}};return{type:"tellCommand",value:o,body:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{let l=u==null?[]:Array.isArray(u)?u:u instanceof NodeList?Array.from(u):[u],m=a.you;return E(i(a,l,0),f=>(a.you=m,re(f)))})}}}function Bt(t,e){let n;if(typeof e=="string"){let u=document.createElement("template");u.innerHTML=e,n=u.content}else if(e instanceof DocumentFragment)n=e;else if(e instanceof Element)n=document.createDocumentFragment(),n.append(e.cloneNode(!0));else throw new Error("morph requires an HTML string, element, or document fragment");let r=n.firstElementChild;r&&!r.nextElementSibling&&r.tagName===t.tagName&&(Sr(t,r),n=r);let o=[...t.matches("[id]")?[t]:[],...t.querySelectorAll("[id]")],s=[...n.querySelectorAll("[id]")],i=is(o,s),c=new Map;Nr(c,i,t.parentElement,o),Nr(c,i,n,s);let a=document.createElement("div");a.hidden=!0,(document.body??t.parentElement)?.after(a),Tr({target:t,ids:c,persistent:i,pantry:a,futureMatches:new WeakSet},t,n),xe(a),a.remove()}function Tr(t,e,n){e instanceof HTMLTemplateElement&&n instanceof HTMLTemplateElement&&(e=e.content,n=n.content);let r=e.firstChild,o=n.firstChild;for(;o;){let s=o,i=r&&os(t,s,r);if(i&&i!==r)for(let c=r;c&&c!==i;){let a=c;c=c.nextSibling,a instanceof Element&&(t.ids.has(a)||Cr(t,a,s))?Wt(e,a,null):kr(t,a)}if(!i&&s instanceof Element&&t.persistent.has(s.id)){let c=`[id="${CSS.escape(s.id)}"]`,a=t.target.id===s.id?t.target:t.target.querySelector(c)??t.pantry.querySelector(c);if(a){for(let u=a.parentNode;u;u=u.parentNode){let l=t.ids.get(u);l?.delete(a.id),l?.size===0&&t.ids.delete(u)}Wt(e,a,r),i=a}}if(o=s.nextSibling,i&&s instanceof Element)xr(t,i,s),r=i.nextSibling;else if(s instanceof Element&&t.ids.has(s)){let c=document.createElement(s.tagName);e.insertBefore(c,r),xr(t,c,s),r=c.nextSibling}else e.insertBefore(s,r),s instanceof Element&&fe(s),r=s.nextSibling}for(;r;){let s=r;r=r.nextSibling,kr(t,s)}}function xr(t,e,n){e instanceof Element&&(Sr(e,n),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.defaultValue!==n.defaultValue&&(e.value=n.value),(!e.isEqualNode(n)||n.tagName==="TEMPLATE"||n.querySelector("template"))&&Tr(t,e,n),fe(e))}function os(t,e,n){if(!(e instanceof Element))return null;let r=t.ids.get(e),o=r?.size??0;if(e.id&&!r)return null;let s=null,i=0,c=10;for(let a=n;a;a=a.nextSibling){let u=t.ids.get(a);if(ss(a,e)){if(u&&r&&[...u].some(l=>r.has(l)))return a;if(!u){if(c>0&&a.isEqualNode(e))return a;s??=a}}if(i+=u?.size??0,i>o||a.contains(document.activeElement)||--c<1&&o===0)break}return s&&Cr(t,s,e)?null:s}function Cr(t,e,n){if(t.futureMatches.has(e))return!0;let r=n.nextSibling;for(let o=0;r&&o<10;r=r.nextSibling,o++)if(r instanceof Element&&e.isEqualNode(r))return t.futureMatches.add(e),!0;return!1}function kr(t,e){t.ids.has(e)?Wt(t.pantry,e,null):(e instanceof Element&&xe(e),e.remove())}function Wt(t,e,n){let r=w(t,"moveBefore");if(G(r))try{Reflect.apply(r,t,[e,n]);return}catch{}t.insertBefore(e,n)}function Sr(t,e){for(let{name:n,value:r}of e.attributes)t.getAttribute(n)!==r&&(t.setAttribute(n,r),n==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=r));for(let{name:n}of[...t.attributes])e.hasAttribute(n)||t.removeAttribute(n)}function ss(t,e){return!(t instanceof Element)||t.tagName!==e.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(e)?!1:!t.id||t.id===e.id}function is(t,e){let n=new Set,r=new Map;for(let{id:s,tagName:i}of t)r.has(s)?n.add(s):s&&r.set(s,i);let o=new Set;for(let{id:s,tagName:i}of e)o.has(s)?n.add(s):r.get(s)===i&&o.add(s);for(let s of n)o.delete(s);return o}function Nr(t,e,n,r){for(let o of r)if(e.has(o.id))for(let s=o;s&&s!==n;s=s.parentElement){let i=t.get(s);i||t.set(s,i=new Set),i.add(o.id)}}function Pr(t){t.commands.morph=(e,n,r)=>{let o=h(e);e.req("to");let s=h(e);return{type:"morphCommand",target:o,content:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c)],([a,u])=>{O(a,l=>{l instanceof Element&&Bt(l,u)})})}}}function Rr(t){t.commands.log=(e,n,r)=>{let o=[h(e)];for(;e.matchOp(",");)o.push(h(e));let s=e.match("with")?h(e):void 0;return{type:"logCommand",values:o,logger:s,start:r,end:e.endPos(),run:c=>N([s?.ev(c),...o.map(a=>a.ev(c))],([a,...u])=>{G(a)?a(...u):console.log(...u)})}}}function Ir(t){t.commands.get=t.commands.call=(e,n,r)=>{let o=h(e);return n==="call"&&o.type!=="functionCall"&&e.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=c})}}}function Or(t){t.pseudo=(e,n)=>{let r=e.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=ct(e);o.type!=="functionCall"&&e.err("Pseudo-commands must be function calls");let s=o.root,i="args"in o&&Array.isArray(o.args)?o.args:[],c;s&&!s.root&&(e.matchAny("the","to","on","with","into","from","at")?c=h(e):e.match("me")&&(c=U(e)));let a=s?.name??"",u=c?e.text(c):"",l=e.text(o),m=c;return{type:"pseudoCommand",value:o,target:c,start:n,end:e.endPos(),run:p=>m?N([m.ev(p),...i.map(d=>d.ev(p))],([d,...y])=>{F(d,u),p.result=at(w(d,a),d,y,p,l),Ye(d,a)}):E(o.ev(p),d=>{p.result=d})}}}function Ar(t){t.commands.ask=(e,n,r)=>{let o=h(e);return{type:"askCommand",message:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=prompt(String(c))})}},t.commands.answer=(e,n,r)=>{let o=h(e),s;if(e.match("with")){let c=e.withFollow(["or"],()=>h(e));e.req("or"),s=[c,h(e)]}return{type:"answerCommand",message:o,choices:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s?.[0].ev(c),s?.[1].ev(c)],([a,u,l])=>{s?c.result=confirm(String(a))?u:l:alert(String(a))})}}}function Lr(t){t.commands.breakpoint=(e,n,r)=>({type:"breakpointCommand",start:r,end:e.endPos(),run:()=>{debugger}})}var Ut=(t,e,n)=>{let r=w(t,"slice");return G(r)?Reflect.apply(r,t,[e,n]):void 0},as=(t,e,n)=>({*[Symbol.iterator](){let r=new RegExp(t instanceof RegExp?t:String(t),e);for(let o=r.exec(n);o;o=r.exec(n))o[0].length===0&&r.lastIndex++,yield o}});function Fr(t){t.commands.pick=(e,n,r)=>{e.match("the");let o=e.matchAny("first","last","random","match","matches")??e.matchAny("item","items","character","characters");if(!o)return;let s=o.value==="first"||o.value==="last"||o.value==="random"||o.value==="match"||o.value==="matches"?o.value:"range",i={};(s==="match"||s==="matches")&&e.match("of"),e.withFollow(["of","from"],()=>{if(s==="first"||s==="last")i.count=h(e);else if(s==="random")e.cur().type==="NUMBER"&&(i.count=h(e));else if(s==="range")e.match("at")||e.match("from"),e.match("start")||(i.from=h(e)),(e.match("to")||e.matchOp(".."))&&(e.match("end")?i.toEnd=!0:i.to=h(e)),e.match("inclusive")?i.bounds="inclusive":e.match("exclusive")&&(i.bounds="exclusive");else{i.re=h(e);let g=e.matchOp("|")?e.reqType("IDENTIFIER").value:void 0;i.flags=s==="match"?g??"":g===void 0?"gu":"g"+g.replace("g","")}}),e.matchAny("of","from")||e.expected("of","from");let c=h(e),{count:a,from:u,to:l,toEnd:m,bounds:f,re:p,flags:d=""}=i;return{type:"pickCommand",variant:s,root:c,...i,start:r,end:e.endPos(),run:g=>N([c.ev(g),a?.ev(g),u?.ev(g),l?.ev(g),p?.ev(g)],([v,C,S,R,I])=>{if(v==null)g.result=v;else if(s==="first")g.result=Ut(v,0,T(C));else if(s==="last")g.result=Ut(v,-T(C));else if(s==="random"){let A=Y(v)?Array.from(v):[],M=()=>A.splice(Math.floor(Math.random()*A.length),1)[0];g.result=C==null?M():Array.from({length:Math.min(T(C),A.length)},M)}else if(s==="range"){let A=T(S??0)+(f==="exclusive"?1:0),M=m?T(w(v,"length")):R==null?void 0:T(R),q=M===void 0?A+1:M+(f==="inclusive"?1:0);g.result=Ut(v,A,q)}else s==="match"?g.result=new RegExp(I instanceof RegExp?I:String(I),d).exec(String(v)):g.result=as(I,d,String(v))})}}}var cs={json:"json",JSON:"json",Object:"json",response:"response",Response:"response",html:"html",HTML:"html",text:"text",Text:"text",String:"text"};function Mr(t){t.commands.fetch=(e,n,r)=>{let o=e.withFollow(["as"],()=>Mt(e)),s=()=>{if(!e.match("as"))return;e.match("a")||e.match("an");let m=Pe(e)??e.err("Expected dotOrColonPath");return cs[m]??":"+m},i=s(),c;e.match("with")&&e.cur().value!=="{"?c=Ge(e):e.cur().op&&e.cur().value==="{"&&(c=He(e)),i??=s()??"text";let a=!1;e.match("do")?(e.req("not"),e.req("throw"),a=!0):e.cur().value==="don"&&e.tok(1,!0).value==="'"&&e.tok(2,!0).value==="t"&&(e.consume(),e.consume(),e.consume(),e.req("throw"),a=!0);let u=i;return{type:"fetchCommand",url:o,options:c,as:u,dontThrow:a,start:r,end:e.endPos(),run:m=>N([o.ev(m),c?.ev(m)],([f,p])=>{let d=m.me,y=W(p)?p:{};y.headers||={},y.conversion=u.startsWith(":")?u.slice(1):u;let g=new AbortController,v=()=>g.abort();Q(d)&&d.addEventListener("fetch:abort",v,{once:!0}),y.signal=g.signal,_(d,"hyperscript:beforeFetch",y,d),_(d,"fetch:beforeRequest",y,d);let C=!1;y.timeout&&setTimeout(()=>C||v(),T(y.timeout));let S=I=>{m.result=I,_(d,"fetch:afterRequest",{result:I}),C=!0},R=Reflect.apply(fetch,globalThis,[f,y]);return Promise.resolve(R).then(I=>{let A={response:I};_(d,"fetch:afterResponse",A);let M=A.response;if(!(M instanceof Response))throw new Error("fetch did not return a Response");if(!a&&u!=="response"&&Z.fetchThrowsOn.some(k=>k.test(String(M.status))))throw Object.assign(new Error(`fetch failed: ${M.status} ${M.statusText} (${f})`),{response:M,status:M.status});if(u==="response")return S(M);if(u==="json")return M.json().then(S);let q=u.startsWith(":")?u.slice(1):void 0,b=q?ge[q]:void 0;return b&&w(b,"_rawResponse")?S(b(M)):M.text().then(k=>S(u==="html"?ve(k):q?rt(k,q):k))}).catch(I=>{throw _(d,"fetch:error",{reason:I}),I}).finally(()=>Q(d)&&d.removeEventListener("fetch:abort",v))})}}}var us={top:"start",middle:"center",bottom:"end"},ls={left:"start",center:"center",right:"end"},qr=t=>{let e=t.matchAny("smoothly","instantly");return e?e.value==="smoothly"?"smooth":"instant":void 0};function _r(t){t.match("the");let e=t.matchAny("top","middle","bottom"),n=t.matchAny("left","center","right");(e||n)&&t.req("of");let r=$(t),o=t.matchAnyOp("+","-"),s=o?t.withFollow(["px"],()=>h(t)):void 0;t.match("px");let i=t.match("in")?$(t):void 0,c={block:e?us[e.value]:"start",inline:n?ls[n.value]:"nearest"},a=qr(t);return a&&(c.behavior=a),{target:r,offset:s,sign:o?.value==="-"?-1:o?1:0,options:c,container:i}}function jr(t,e){return N([t.target.ev(e),t.offset?.ev(e),t.container?.ev(e)],([n,r,o])=>{let s=t.sign*T(r??0);O(n,i=>{let c=i===window?document.body:i;c instanceof HTMLElement&&(o instanceof HTMLElement?o.scrollTo({top:c.offsetTop-o.offsetTop+s,left:c.offsetLeft-o.offsetLeft,behavior:t.options.behavior??"auto"}):(t.sign?ds(c,s,t.options):c).scrollIntoView(t.options))})})}function ds(t,e,n){let r=t.getBoundingClientRect(),o=i=>i==="start"||i==="end"?e:0,s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:r.top+window.scrollY+o(n.block)+"px",left:r.left+window.scrollX+o(n.inline)+"px",height:r.height+"px",width:r.width+"px",zIndex:String(Number.MIN_SAFE_INTEGER),opacity:"0"}),document.body.appendChild(s),setTimeout(()=>s.remove(),100),s}function Dr(t){t.commands.scroll=(e,n,r)=>{let o={type:"scrollCommand",start:r,end:r,run:()=>{}};if(e.match("to")){let s=o.to=_r(e);o.run=i=>jr(s,i)}else{let s=["up","down","left","right"],i=e.matchAny(...s),c;!i&&e.cur().value!=="by"&&(c=o.target=$(e),i=e.matchAny(...s)),e.req("by");let a=o.by=e.withFollow(["px"],()=>h(e));e.match("px");let u=o.behavior=qr(e),l=o.direction=i?.value??"down";o.run=m=>N([c?.ev(m),a.ev(m)],([f,p])=>{let d=T(p)*(l==="up"||l==="left"?-1:1),y=l==="left"||l==="right",g={top:y?0:d,left:y?d:0};u&&(g.behavior=u),(x(f)?f:document.documentElement).scrollBy(g)})}return o.end=e.endPos(),o}}function Hr(t){t.commands.go=(e,n,r)=>{let o={type:"goCommand",back:!1,newWindow:!1,start:r,end:r,run:()=>{}},s=()=>e.match("in")?(e.req("new"),e.req("window"),!0):!1,i=c=>{if(c==null)return;if(x(c))return c.scrollIntoView({block:"start",inline:"nearest"});let a=String(c);a.startsWith("#")?window.location.hash=a:o.newWindow?window.open(a):window.location.href=a};if(e.match("back"))o.back=!0,o.run=()=>window.history.back();else if(e.match("to"),e.match("url")){let c=o.url=$e(e);o.newWindow=s(),o.run=()=>i(c)}else if(["the","top","middle","bottom","left","center","right"].includes(e.cur().value)){let c=o.scroll=_r(e);o.run=a=>jr(c,a)}else{let c=o.target=Mt(e);o.newWindow=s(),o.run=a=>E(c.ev(a),i)}return o.end=e.endPos(),o}}function $r(t){t.commands.set=(e,n,r)=>Vt(e,r)}function Vt(t,e){{if(t.cur().op&&t.cur().value==="{"){let s=He(t);t.req("on");let i=h(t);return{type:"setCommand",target:i,object:s,start:e,end:t.endPos(),run:a=>N([s.ev(a),i.ev(a)],([u,l])=>void Object.assign(Object(l),u))}}let n=t.withFollow(["to"],()=>ae(t));t.req("to");let r=h(t);return{type:"setCommand",target:n,value:r,start:e,end:t.endPos(),run:s=>N([n.lhs?.(s),r.ev(s)],([i,c])=>n.put?.(s,i,c))}}}function Wr(t){t.commands.default=(e,n,r)=>{let o=e.withFollow(["to"],()=>ae(e));e.req("to");let s=h(e);return{type:"defaultCommand",target:o,value:s,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{if(!(a!=null&&a!==""))return N([o.lhs?.(c),s.ev(c)],([u,l])=>o.put?.(c,u,l))})}}}function Br(t){for(let e of["increment","decrement"]){let n=e==="increment"?1:-1;t.commands[e]=(r,o,s)=>{let i=r.withFollow(n<0?["by"]:[],()=>ae(r)),c=r.match("by")?h(r):void 0;return{type:`${e}Command`,target:i,amount:c,start:s,end:r.endPos(),run:u=>N([i.ev(u),c?.ev(u),i.lhs?.(u)],([l,m,f])=>{let p=(l?parseFloat(String(l)):0)+n*(c?parseFloat(String(m)):1);u.result=p,i.put?.(u,f,p)})}}}}function Gr(t,e){t.replaceChildren(ve(e)),z.process(t)}var fs=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],ms={into:"into",before:"before",after:"after",start:"start",end:"end"},ps={before:"before",after:"after",start:"prepend",end:"append"};function Ur(t){t.commands.put=(e,n,r)=>{let o=h(e),s=e.matchAny("into","before","after");!s&&e.match("at")&&(e.match("the"),s=e.matchAny("start","end"),e.req("of"));let i=ms[(s??e.expected("into","before","at start of","at end of","after")).value],c=je(h(e)),a=e.text(c),u=(f,p)=>c.type==="symbol"?E(c.ev(f),d=>{x(d)||d instanceof Document?Gr(d,p):c.put?.(f,void 0,p)}):fs.includes(c.type)?E(c.lhs?.(f),d=>c.put?.(f,d,p)):E(c.ev(f),d=>{F(d,a),O(d,y=>{(x(y)||y instanceof Document)&&Gr(y,p)})}),l=(f,p,d)=>E(c.ev(f),y=>{if(F(y,a),Array.isArray(y)){d==="prepend"?y.unshift(p):y.push(p),P.wroteProperty(y);return}O(y,g=>{x(g)&&(g[d](p instanceof Node?p:ve(p)),z.process(g.parentElement??g))})});return{type:"putCommand",value:o,operation:i,target:c,start:r,end:e.endPos(),run:f=>E(o.ev(f),p=>i==="into"?u(f,p):l(f,p,ps[i]))}}}var Ie=t=>Y(t)?Array.from(t):Array.from(Object(t)),Vr=t=>Array.isArray(t)||t instanceof NodeList?Ie(t).map(Vr).join(""):t instanceof HTMLElement?t.outerHTML:t instanceof Node?"":String(t);function hs(t){let e={},n=r=>{let o=w(r,"name"),s=w(r,"value"),i=w(r,"type");if(typeof o!="string"||s==null||i==="radio"&&!w(r,"checked")||(i==="checkbox"?s=w(r,"checked")?[s]:void 0:r instanceof HTMLSelectElement&&r.multiple&&(s=Array.from(r.selectedOptions,a=>a.value)),s===void 0))return;let c=e[o];e[o]=c===void 0?s:(Array.isArray(c)?c:[c]).concat(s)};return O(t,r=>{w(r,"name")!=null&&w(r,"value")!=null?n(r):r instanceof Element&&r.querySelectorAll("input,select,textarea").forEach(n)}),e}function zr(t){Object.assign(ge,{Boolean:e=>!!e,Date:e=>typeof e=="number"||e instanceof Date?new Date(e):new Date(String(e)),Array:Ie,JSON:e=>e instanceof Response?e.json():JSON.parse(String(e)),JSONString:e=>JSON.stringify(e),Object:e=>typeof e=="string"||e instanceof String?JSON.parse(String(e)):{...Object(e)},FormEncoded:e=>new URLSearchParams(Object(e)).toString(),Set:e=>new Set(Ie(e)),Map:e=>new Map(Object.entries(Object(e))),Keys:e=>e instanceof Map?Array.from(e.keys()):Object.keys(Object(e)),Entries:e=>e instanceof Map?Array.from(e.entries()):Object.entries(Object(e)),Reversed:e=>Ie(e).reverse(),Unique:e=>[...new Set(Ie(e))],Flat:e=>Ie(e).flat(),HTML:Vr}),Me.push((e,n)=>{if(e==="Fixed"||e.startsWith("Fixed:"))return Number(n).toFixed(parseInt(e.split(":")[1])||0)},(e,n)=>e==="Values"?hs(n):void 0)}var Qr="=;expires=Thu, 01 Jan 1970 00:00:00 GMT",Ve=()=>document.cookie?document.cookie.split("; ").map(t=>{let e=t.indexOf("=");return{name:t.slice(0,e),value:decodeURIComponent(t.slice(e+1))}}):[],ys=new Proxy({},{get(t,e){if(e===Symbol.iterator){let n=Ve();return n[Symbol.iterator].bind(n)}if(!(typeof e!="string"||e==="then"))return e==="length"?Ve().length:e==="clear"?n=>void(document.cookie=n+Qr):e==="clearAll"?()=>Ve().forEach(n=>document.cookie=n.name+Qr):e!==""&&!Number.isNaN(Number(e))?Ve()[parseInt(e)]:Ve().find(n=>n.name===e)?.value},set(t,e,n){let r=[];if(typeof n=="string")r.push(encodeURIComponent(n),"samesite=lax");else{r.push(encodeURIComponent(String(w(n,"value"))));let o=(s,i)=>{let c=w(n,s);c&&r.push(`${i}=${c}`)};o("expires","expires"),o("maxAge","max-age"),o("partitioned","partitioned"),o("path","path"),o("samesite","samesite"),w(n,"secure")&&r.push("secure")}return document.cookie=String(e)+"="+r.join(";"),!0}});function Jr(t){Nt.cookies=ys}var zt=t=>Y(t)?Array.from(t):[];function gs(t){let e=t.pos(),n=t.matchAny("first","last","random");if(!n)return;t.matchAny("in","from","of");let r=$(t),o=n.value;return{type:"positionalExpression",operator:o,root:r,start:e,end:t.endPos(),ev:i=>E(r.ev(i),c=>{if(!c)return;let a=Array.isArray(c)?c:zt(w(c,"children")??c),u=o==="first"?0:o==="last"?a.length-1:Math.floor(Math.random()*a.length);return a[u]})}}function ws(t){let e=t.pos(),n=t.matchAny("next","previous");if(!n)return;let r=n.value==="next",o=Ft(t)??t.err("Expected leaf"),s=t.match("from")?t.withFollow(["in"],()=>$(t)):U(t),i=t.match("in")?$(t):void 0,c=!i&&t.match("within")?$(t):void 0,a=!!t.match("with");a&&t.req("wrapping");let u=t.text(o),l=(p,d,y)=>{let g=d instanceof Element||d instanceof Document?d:document.body,v=Array.from(g.querySelectorAll(y));if(!(p instanceof Node))return;let C=r?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING,S=r?v:v.reverse();return S.find(R=>R.compareDocumentPosition(p)===C)??(a?S[0]:void 0)},m=(p,d,y)=>{let g=zt(d).filter(R=>R===p||x(R)&&R.matches(y)),v=r?g:g.reverse(),C=v[v.indexOf(p)+1];if(v.includes(p)&&C!==void 0)return C;let S=v[0];return a&&x(S)&&S.matches(y)?S:void 0};return{type:"relativePositionalExpression",operator:n.value,thing:o,from:s,inElt:i,withinElt:c,wrapping:a,start:e,end:t.endPos(),ev:p=>N([o.ev(p),s.ev(p),i?.ev(p),c?.ev(p)],([d,y,g,v])=>{let C=w(d,"css");if(typeof C!="string")throw new Error("Expected a CSS value to be returned by "+u);return i?g&&m(y,g,C):l(y,v,C)})}}function vs(t){let e=t.pos();if(!t.match("closest"))return;let n=!!t.match("parent"),r=t.cur().type==="ATTRIBUTE_REF"?K(t):void 0,o=r?`[${r.name}]`:$(t).css??t.err("Expected a CSS expression"),s=t.match("to")?h(t):U(t),i={type:"closestExpr",css:o,parentSearch:n,to:s,start:e,end:t.endPos(),ev:c=>E(s.ev(c),a=>{if(a==null)return null;let u=[];return O(a,l=>{let m=n?w(l,"parentElement"):l;u.push(x(m)?m.closest(o):null)}),Te(a)?u:u[0]}),lhs:c=>i.ev(c),put:(c,a,u)=>{a&&Ee(a,u)}};return r?_t(t,i,r):i}var Yr=["where","sorted","mapped","split","joined"];function Es(t,e){let n=t.matchAny(...Yr);if(!n)return;let r=n.value;r==="mapped"?t.req("to"):r!=="where"&&t.req("by");let o=t.withFollow(Yr,()=>h(t)),s=r==="sorted"&&!!t.match("descending"),i=(u,l)=>{let m=l.map(f=>(u.beingTested=f,a.varName&&(u.locals[a.varName]=f),o.ev(u)));return u.beingTested=null,m},c=(u,l)=>{if(!l)return l;if(r==="split")return E(o.ev(u),d=>String(l).split(String(d)));let m=zt(l);if(r==="joined")return E(o.ev(u),d=>m.join(String(d)));let f=i(u,m);if(r==="where")return m.filter((d,y)=>f[y]);if(r==="mapped")return f;let p=s?-1:1;return m.map((d,y)=>y).sort((d,y)=>f[d]==f[y]?0:(T(f[d])<T(f[y])?-1:1)*p).map(d=>m[d])},a={type:"collectionExpression",operator:r==="where"||r==="sorted"||r==="mapped"||r==="split"?r:"joined",root:e,operand:o,descending:s,start:e.start,end:t.endPos(),ev:u=>E(e.ev(u),l=>c(u,l))};return a}function bs(t){let e=t.pos();if(!t.matchOp("\\"))return;let n=[],r=t.matchType("IDENTIFIER");if(r)for(n.push(r.value);t.matchOp(",");)n.push(t.reqType("IDENTIFIER").value);t.reqOp("-"),t.reqOp(">");let o=h(t);return{type:"blockLiteral",params:n,expr:o,start:e,end:t.endPos(),ev:i=>(...c)=>(n.forEach((a,u)=>i.locals[a]=c[u]),o.ev(i))}}function xs(t){let e=t.pos();if(t.match("some"))return Se(t,"some",e,h(t),n=>!_e(n),!1)}function ks(t,e){if(!t.matchOp(":"))return;let n=t.reqType("IDENTIFIER").value,r=!t.matchOp("!");return{type:"typeCheckExpression",root:e,suffix:n,start:e.start,end:t.endPos(),ev:s=>E(e.ev(s),i=>{if(nt(i,n,r))return i;throw new Error("Typecheck failed! Expected: "+n)})}}function Kr(t,e,n,r){if(_(t.me,"hyperscript:beep",{element:t.me,expression:e,value:r})){let o=r==null?"object (null)":w(w(r,"constructor"),"name")??"unknown",s=typeof r=="string"?`"${r}"`:Te(r)?Array.from(r):r;console.log(`///_ BEEP! The expression (${n}) evaluates to:`,s,"of type "+o)}}function Ns(t){let e=t.pos();if(!t.match("beep!"))return;let n=$(t),r=t.text(n);return Se(t,"beepExpression",e,n,(o,s)=>(Kr(s,n,r,o),o),!1)}function Ts(t,e,n){let r=[h(t)];for(;t.matchOp(",");)r.push(h(t));let o=r.map(s=>t.text(s));return{type:"beepCommand",values:r,start:n,end:t.endPos(),run:s=>N(r.map(i=>i.ev(s)),i=>i.forEach((c,a)=>Kr(s,r[a],o[a],c)))}}function Xr(t){t.leaves.push(vs,xs,bs),t.unaries.push(Ns,ws,gs),t.commands["beep!"]=Ts,t.postfixes.push(ks),t.collections.push(Es)}var Qt=t=>Pe(t)??t.err("Expected dotOrColonPath");function Zr(t){t.features.def=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=D(e),a={type:"defFeature",name:r,displayName:`${s}(${i.join(", ")})`,params:i,body:c,...mt(e),start:n,end:e.endPos(),install:(u,l)=>{Tt(u,o,s,Object.assign((...f)=>{let p=B(l,a,u,null);i.forEach((y,g)=>p.locals[y]=f[g]);let d=E(st(p,c,a),y=>w(y,"value"));return J(d)&&a.finallyHandler?d.then(void 0,()=>{}):d},{hyperfunc:!0,hypername:r}))}};return a}}function eo(t){t.features.init=(e,n)=>{let r=!!e.match("immediately"),o=D(e),s={type:"initFeature",body:o,immediately:r,start:n,end:e.endPos(),install:i=>{let c=()=>void j(o,B(i,s,i,null));r?c():queueMicrotask(c)}};return s}}function to(t){t.features.behavior=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=We(e).features;for(let u of c)u.behavior=r;return{type:"behaviorFeature",name:r,params:i,features:c,start:n,end:e.endPos(),install:()=>Tt(null,o,s,(u,l,m)=>{if(W(u))for(let f of i)Ce(u,r+"Scope")[f]=w(m,f);for(let f of c)f.install(u,l)})}}}function no(t){t.features.install=(e,n)=>{let r=Qt(e),o=ut(e),s={type:"installFeature",name:r,args:o,start:n,end:e.endPos(),install:(i,c)=>{let a=globalThis;for(let u of r.split("."))if(a=w(a,u),typeof a!="object"&&typeof a!="function")throw new Error("No such behavior defined as "+r);if(!G(a))throw new Error(r+" is not a behavior");a(i,c,o?.ev(B(i,s,i,null)))}};return s}}function ro(t){t.features.set=(e,n)=>{let r=Vt(e,n);"scope"in r.target&&r.target.scope==="local"&&e.err("variables declared at the feature level cannot be locally scoped (use :foo, ^foo, $foo, or an @attribute target instead).");let o={type:"setFeature",command:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>void r.run(B(s,o,s,null)))};return o}}function Cs(t,e){if(typeof t!="object"||t===null)return{queue:[],executing:!1};let n=V(t).eventQueues??=new Map,r=n.get(e);return r||n.set(e,r={queue:[],executing:!1}),r}function Jt(t,e){let n=Cs(t.me,e);if(n.executing&&!e.every){if(e.queue==="none"||e.queue==="first"&&n.queue.length>0)return;e.queue!=="all"&&(n.queue.length=0),n.queue.push(t);return}n.executing=!0;let r=o=>{n.executing=!1;let s=n.queue.shift();if(s&&setTimeout(()=>Jt(s,e),1),o){let{error:i}=o;console.error(w(i,"message")??i),console.error(w(i,"stack")),_(t.me,"exception",{error:i})}};ye(()=>E(st(t,e.body,e),()=>r()),o=>r({error:o}))}function Ss(t,e){if(!Q(e))return;let n=V(e),r=n.listeners??=[],o=n.observers??=[],s=n.timers??=new Set;for(let i of t.events){let c={execCount:0},a=i.elsewhere?[document]:i.from?i.from.ev(B(e,t,e,null)):[e];O(a,u=>{if(!Q(u)){console.warn("'%s' feature ignored because target does not exists:",t.displayName,e);return}let l=i.on;if(i.mutationSpec&&u instanceof Node){l="hyperscript:mutation";let f=new MutationObserver(p=>_(u,l,{mutationList:p,observer:f}));f.observe(u,i.mutationSpec),o.push(f)}if(i.intersectionSpec&&u instanceof Element){l="hyperscript:intersection";let f=new IntersectionObserver(p=>{for(let d of p)_(u,l,{observer:f,entry:d,intersecting:d.isIntersecting,isIntersecting:d.isIntersecting,intersectionRatio:d.intersectionRatio})},i.intersectionSpec);f.observe(u),o.push(f)}if(i.resizeSpec&&u instanceof Element){l="hyperscript:resize";let f=new ResizeObserver(p=>{for(let d of p){let{width:y,height:g}=d.contentRect;_(u,l,{width:y,height:g,contentRect:d.contentRect,entry:d})}});f.observe(u),o.push(f)}let m=f=>{if(e instanceof Node&&u!==e&&!e.isConnected){u.removeEventListener(l,m);return}let p=B(e,t,e,f);if(!(i.elsewhere&&e instanceof Node&&f.target instanceof Node&&e.contains(f.target))){i.from&&(p.result=u);for(let d of i.args){let y=w(f,d);y!==void 0?p.locals[d]=y:p.detail!=null&&(p.locals[d]=w(p.detail,d))}if(i.filter){p.meta.context=f;try{if(!i.filter.ev(p))return}finally{p.meta.context=void 0}}if(i.inExpr?.css){let d=f.target instanceof Element?f.target:null;for(;d&&!d.matches(i.inExpr.css);)d=d.parentElement;if(!d)return;p.result=d}if(c.execCount++,i.startCount){let d=c.execCount;if(i.endCount?d<i.startCount||d>i.endCount:i.unbounded?d<i.startCount:d!==i.startCount)return}if(i.debounceTime){c.debounced&&(clearTimeout(c.debounced),s.delete(c.debounced)),s.add(c.debounced=setTimeout(()=>Jt(p,t),i.debounceTime));return}if(i.throttleTime){if(c.lastExec&&Date.now()<c.lastExec+i.throttleTime)return;c.lastExec=Date.now()}Jt(p,t)}};u.addEventListener(l,m),r.push({target:u,event:l,handler:m})})}}function Ps(t){if(!t.match("of"))return{attributes:!0,characterData:!0,childList:!0,attributeOldValue:!0,characterDataOldValue:!0};let e={};do if(t.match("anything"))Object.assign(e,{attributes:!0,subtree:!0,characterData:!0,childList:!0});else if(t.match("childList"))e.childList=!0;else if(t.match("attributes"))e.attributes=!0;else if(t.match("subtree"))e.subtree=!0;else if(t.match("characterData"))e.characterData=!0;else if(t.cur().type==="ATTRIBUTE_REF"){let n=t.consume().value;n.startsWith("@")||t.err("Only shorthand attribute references are allowed here"),(e.attributeFilter??=[]).push(n.substring(1))}else t.err("Unknown mutation config specification");while(t.match("or"));return(e.attributes||e.attributeFilter)&&(e.attributeOldValue=!0),e.characterData&&(e.characterDataOldValue=!0),e}function Rs(t){let e={};if(t.match("with")){let n=De(h(t));n instanceof Element&&(e.root=n)}if(t.match("having"))do t.match("margin")?e.rootMargin=$e(t):t.match("threshold")?e.threshold=Number(De(h(t))):t.err("Unknown intersection config specification");while(t.match("and"));return e}function Is(t,e){let n=ce(t),r=pt(t),o;t.matchOp("[")&&(o=h(t),t.reqOp("]"));let s,i,c=!1;e?s=1:t.cur().type==="NUMBER"&&(s=parseInt(t.consume().value),t.match("to")?i=parseInt(t.consume().value):t.match("and")&&(c=!0,t.req("on")));let a={on:n,args:r,filter:o,startCount:s,endCount:i,unbounded:c,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=Rs(t):n==="mutation"&&(a.mutationSpec=Ps(t)),t.match("from")&&(t.match("elsewhere")?a.elsewhere=!0:a.from=t.withFollow(["or"],()=>h(t))),!a.from&&!a.elsewhere&&t.match("elsewhere")&&(a.elsewhere=!0),t.match("in")&&(a.inExpr=$(t));let u=()=>(t.req("at"),Number(De($(t))));return t.match("debounced")?a.debounceTime=u():t.match("throttled")&&(a.throttleTime=u()),a}function oo(t){t.features.on=(e,n)=>{let r=!!e.match("every"),o=!r&&!!e.match("first"),s=[];do s.push(Is(e,o));while(e.match("or"));let i="last";!r&&e.match("queue")&&(e.match("all")?i="all":e.match("first")?i="first":e.match("none")?i="none":e.req("last"));let c=D(e),a={type:"onFeature",displayName:"on "+s.map(u=>u.on).join(" or "),events:s,body:c,every:r,queue:i,...mt(e),start:n,end:e.endPos(),install:u=>Ss(a,u)};return a}}var Ae=new WeakMap,ao=new Map,Xt=new Map,vt=new Map,Zt=new Map,ze=new Set,Qe=new WeakMap,Os=0,me,Yt=!1;function Ne(t){let e=Ae.get(t);return e||Ae.set(t,e={id:++Os}),e}var yt=t=>typeof t=="object"&&t!==null;function As(t,e){let n=me;me=t,P.tracking=!0;try{return e()}finally{me=n,P.tracking=n!==void 0}}var Kt=class{constructor(e,n,r){this.expression=e;this.handler=n;this.element=r}dependencies=new Map;stopped=!1;last;triggers=0;evaluate(){try{return this.next=As(this,this.expression),!0}catch(e){return console.error("Error in reactive expression:",e),!1}}next;handle(e){try{this.handler(e)}catch(n){console.error("Error in reactive handler:",n)}}initialize(){this.evaluate()&&(this.last=this.next),so(this),this.last!=null&&this.handle(this.last)}run(){if(++this.triggers>100){console.error("Reactivity loop detected: an effect triggered 100 consecutive times without settling. This usually means an effect is modifying a variable it also depends on.",this.element??this);return}io(this);let e=this.dependencies;this.dependencies=new Map;let n=this.evaluate();n||(this.dependencies=e),so(this),n&&!Object.is(this.next,this.last)&&(this.last=this.next,this.handle(this.next))}settled(){this.triggers=0}stop(){this.stopped||(this.stopped=!0,io(this),ze.delete(this))}};function Ls(t){t.stopped||(ze.add(t),!Yt&&(Yt=!0,queueMicrotask(()=>{Yt=!1;let e=Array.from(ze);ze.clear();for(let n of e)n.stopped||(n.element&&!n.element.isConnected?n.stop():n.run());if(ze.size===0)for(let n of e)n.settled()})))}var Oe=t=>t?.forEach(Ls);function co(t){for(let[e,n]of Zt)for(let r of t)if(e.contains(r)){Oe(n);break}}var gt;function Fs(){gt??=new MutationObserver(t=>{let e=new Set;for(let n of t){if(n.type==="attributes"){let r=Ae.get(n.target);r&&Oe(Xt.get(`${n.attributeName}:${r.id}`))}e.add(n.target)}co(e)}),gt.observe(document,{attributes:!0,childList:!0,subtree:!0}),document.addEventListener("input",wt,!0),document.addEventListener("change",wt,!0)}function wt(t){let e=t.target;if(!(e instanceof Element))return;let n=Ae.get(e);n&&Oe(vt.get(n.id)),co([e])}function Ms(t,e,n){let r=t.get(e);r||t.set(e,r=new Set),r.add(n)}function qs(t,e,n){let r=t.get(e);r?.delete(n),r?.size===0&&t.delete(e)}function uo(t,e){let n=!1;for(let r of t.dependencies.values())r.type==="global"?e(ao,r.name,t):r.type==="element"?e(Ne(r.element).symbols??=new Map,r.name,t):(n=!0,r.type==="query"?e(Zt,r.root,t):r.type==="property"?e(vt,Ne(r.object).id,t):e(Xt,`${r.name}:${Ne(r.element).id}`,t));return n}function so(t){uo(t,Ms)&&Fs()}function io(t){uo(t,qs),gt&&!Xt.size&&!vt.size&&!Zt.size&&(gt.disconnect(),document.removeEventListener("input",wt,!0),document.removeEventListener("change",wt,!0))}function Le(t,e,n){let r=new Kt(t,e,n);return r.initialize(),n&&(Qe.has(n)||Qe.set(n,new Set),Qe.get(n)?.add(r)),()=>r.stop()}function _s(){P.readGlobal=t=>void me?.dependencies.set("symbol:global:"+t,{type:"global",name:t}),P.readElement=(t,e)=>{yt(e)&&me?.dependencies.set(`symbol:element:${t}:${Ne(e).id}`,{type:"element",name:t,element:e})},P.readProperty=t=>{yt(t)&&!w(t,"_hsSkipTracking")&&me?.dependencies.set("property:"+Ne(t).id,{type:"property",object:t})},P.readAttribute=(t,e)=>{x(t)&&me?.dependencies.set(`attribute:${e}:${Ne(t).id}`,{type:"attribute",name:e,element:t})},P.wroteGlobal=t=>Oe(ao.get(t)),P.wroteElement=(t,e)=>{yt(e)&&Oe(Ae.get(e)?.symbols?.get(t))},P.readQuery=t=>void me?.dependencies.set("query:"+Ne(t).id,{type:"query",root:t}),P.wroteProperty=t=>{let e=yt(t)&&!w(t,"_hsSkipTracking")&&Ae.get(t);e&&Oe(vt.get(e.id))},P.stop=t=>{Qe.get(t)?.forEach(e=>e.stop()),Qe.delete(t)}}var js=t=>e=>{console.error(w(e,"message")??e),_(t,"exception",{error:e})};function Ds(t){t.features.when=(e,n)=>{let r=[];do r.push(e.withFollow(["or"],()=>h(e)));while(e.match("or"));for(let i of r)i.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name&&e.err(`Cannot watch local variable '${i.name}'. Local variables are not reactive. Use '$${i.name}' (global) or ':${i.name}' (element-scoped) instead.`);e.req("changes");let o=D(e),s={type:"whenFeature",displayName:"when ... changes",watched:r,body:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=()=>B(i,s,i,null);for(let a of r)Le(()=>a.ev(c()),u=>{let l=c();l.result=u,ye(()=>E(j(o,l),()=>{}),js(i))},x(i)?i:void 0)})};return s}}function Hs(t){t.features.live=(e,n)=>{let r=D(e),o={type:"liveFeature",displayName:"live",body:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>Le(()=>void j(r,B(s,o,s,null)),()=>{},x(s)?s:void 0))};return o}}function Gs(t){if(t instanceof HTMLInputElement){let n=t.getAttribute("type")??"text";return n==="checkbox"?"checked":n==="number"||n==="range"?"valueAsNumber":"value"}if(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return"value";let e=t.getAttribute("contenteditable");if(e!==null&&e!=="false")return"textContent";if(t.tagName.includes("-")&&"value"in t)return"value";throw new Error(`bind cannot auto-detect a property for <${t.tagName.toLowerCase()}>. Use an explicit property (e.g. 'bind $var to #el's value').`)}function $s(t){if(t instanceof HTMLInputElement&&t.type==="radio")return{element:t,writable:!0,read:()=>ue(t,"checked")?t.value:void 0,write:n=>t.checked=n===t.value};let e=Gs(t);return{element:t,writable:!0,read:()=>{let n=ue(t,e);return e==="valueAsNumber"&&Number.isNaN(n)?null:n},write:n=>void Reflect.set(t,e,n)}}function Ws(t,e,n){let r=e.you||e.me;if(t.type==="classRef"&&"className"in t&&typeof t.className=="string")x(r)&&r.classList.toggle(t.className,!!n);else if(t.type==="attributeRef"&&typeof n=="boolean"&&t.name){if(!x(r))return;t.name.startsWith("aria-")?r.setAttribute(t.name,String(n)):r.toggleAttribute(t.name,n)}else E(t.lhs?.(e),o=>t.put?.(e,o,n))}function Bs(t,e,n){let r=()=>B(e,n,e,null);if(t.type==="classRef"&&"className"in t&&typeof t.className=="string"){let o=t.className;return{writable:!0,read:()=>(we(e,"class"),x(e)&&e.classList.contains(o)),write:s=>void(x(e)&&e.classList.toggle(o,!!s))}}return{writable:t.type==="attributeRef"||!!t.put,read:()=>t.ev(r()),write:o=>Ws(t,r(),o)}}function Us(t){t.features.bind=(e,n)=>{let r=e.withFollow(["and","with","to"],()=>h(e));e.matchAny("and","with","to")||e.expected("and","with","to");let o=h(e),s={type:"bindFeature",displayName:"bind",left:r,right:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=x(i)?i:void 0,a=u=>{let l=u.ev(B(i,s,i,null));return x(l)?$s(l):Bs(u,i,s)};try{let u=a(r),l=a(o);if(!u.writable&&!l.writable)throw new Error("bind requires at least one writable side");u.writable&&Le(l.read,u.write,c),l.writable&&Le(u.read,l.write,c);for(let[m,f]of[[u,l],[l,u]]){let p=m.element?.closest("form");if(!p||!c)continue;let d=()=>setTimeout(()=>c.isConnected&&f.write(m.read()),0);p.addEventListener("reset",d),(V(c).listeners??=[]).push({target:p,event:"reset",handler:d})}}catch(u){console.error(w(u,"message")??u)}})};return s}}function lo(t){_s(),Ds(t),Hs(t),Us(t)}var fo="#text";function Vs(t){let e=[],n=0,r=0;for(let o of t.split(/(?<=\n)/)){n++;let s=o.trimStart(),i=r+o.length-s.length;if(r+=o.length,!s||/^(--|\/\/)(\s|$|[-/])/.test(s))continue;let c=i-(r-o.length);if(/^#[a-zA-Z]/.test(s))for(let a of de(s.slice(1)))a.start+=i+1,a.end+=i+1,a.line=n,a.column+=c+1,e.push(a);else{let a=s.replace(/\r?\n$/,`
19
19
  `);e.push({type:"IDENTIFIER",value:fo,content:a,start:i,end:r,line:n,column:c})}}return e}var en=[];function tn(t,e){let n=en=[],r=new Re(t,Vs(e),e),o=D(r);return r.hasMore()&&r.err(),{commands:o,errors:n}}var mo=t=>String(t).replace(/[&<>"']/g,e=>`&${zs[e]};`),zs={"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#039"};function Qs(t,e){let n=t.child(de(e),e),r=!n.match("unescaped"),o=h(n);if(!n.match("if"))return{value:o,escape:r};let s=h(n);return{value:o,condition:s,otherwise:n.match("else")?h(n):void 0,escape:r}}function Js(t,e){let{content:n="",line:r}=t.last,o=[];for(let c=0;c<n.length;){let a=n.indexOf("${",c);if(a===-1){o.push(n.slice(c));break}a>c&&o.push(n.slice(c,a));let u=1,l=a+2;for(;l<n.length&&u>0;l++)n[l]==="{"?u++:n[l]==="}"&&u--;if(u>0){let f=n.slice(a);en.push({line:r,message:"Unterminated ${} expression",expr:f});break}let m=n.slice(a+2,l-1);try{o.push(Qs(t,m))}catch(f){en.push({line:r,message:f instanceof Error?f.message:String(f),expr:m})}c=l}let s=(c,a)=>typeof c=="string"?c:c.condition?E(c.condition.ev(a),u=>u?c.value.ev(a):c.otherwise?.ev(a)):c.value.ev(a),i=(c,a)=>typeof c=="string"?c:a==null?"":c.escape?mo(a):String(a);return{type:"templateText",parts:o,start:e,end:t.endPos(),run:c=>N(o.map(a=>s(a,c)),a=>{c.meta.template?.out.push(a.map((u,l)=>i(o[l],u)).join(""))})}}var Ys=/<!--hs-scope:[^>]*-->/g;function nn(t,e,n){let r=[],o={};return e.meta.template={out:r,loops:o},E(j(t,e),()=>n(r.join(""),o))}function Ks(t){let e=t.closest('[data-live-template], [dom-scope="isolated"]'),n=e&&oe(e)?.loops;if(n)for(let r=t;r&&r!==e;r=r.parentElement)for(let o=r.previousSibling;o;o=o.previousSibling){if(!(o instanceof Comment)||!o.data.startsWith("hs-scope:"))continue;let[,s,i]=o.data.split(":"),c=n[s];if(c){let a=parseInt(i),u=Ce(t);c.identifier&&(u[c.identifier]=Reflect.get(Object(c.source),a)),c.indexIdentifier&&(u[c.indexIdentifier]=a)}break}}function po(t){z.enter=Ks,t.commands[fo]=(e,n,r)=>Js(e,r),t.commands.render=(e,n,r)=>{let o=h(e),s=e.match("with")?Ge(e):void 0,i=!!e.match("here"),c=!i&&e.match("into")?h(e):void 0,a=e.text(o);return{type:"renderCommand",template:o,args:s,here:i,target:c,start:r,end:e.endPos(),run:l=>N([o.ev(l),s?.ev(l),c?.ev(l)],([m,f,p])=>{if(!x(m))throw new Error(a+" is not an element");let d;try{d=tn(t,m.textContent??"")}catch(g){console.error("hyperscript template parse error:",g instanceof Error?g.message:g),l.result="";return}for(let g of d.errors)console.error(`hyperscript template error (line ${g.line}): ${g.message}`+(g.expr?" in ${"+g.expr+"}":""));let y=B(l.me,void 0,l.me,null);return Object.assign(y.locals,l.locals,f),nn(d.commands,y,(g,v)=>{l.result=g.replace(Ys,"");for(let C of[i?l.me:void 0,p])x(C)&&(V(C).loops=v,C.innerHTML=g)})})}},t.leaves.push(e=>{let n=e.pos();if(!e.match("escape"))return;let r=e.reqType("IDENTIFIER").value,o=!!e.match("unescaped"),s=h(e);return{type:"escapeExpression",value:s,start:n,end:e.endPos(),ev:c=>E(s.ev(c),a=>{if(o)return a;if(a==null)return"";if(r!=="html")throw new Error("Unknown escape: "+r);return mo(a)})}})}function ho(t){let e=new WeakSet;ke.addBeforeProcessHook(n=>{for(let r of n.querySelectorAll('script[type="text/hyperscript-template"][live]')){if(e.has(r))continue;e.add(r);let o=r.textContent??"",s=r.getAttribute("_")||r.getAttribute("data-script");r.removeAttribute("_"),r.removeAttribute("data-script");let i=document.createElement("div");i.style.display="contents",i.setAttribute("data-live-template",""),r.after(i),s&&(i.setAttribute("_",s),z.process(i));let c=()=>{let l;try{l=tn(t,o).commands}catch(f){return console.error("live-template parse error:",f instanceof Error?f.message:f),""}let m=B(i,void 0,i,null);return nn(l,m,(f,p)=>(V(i).loops=p,f))},a=!1,u=l=>{if(J(l))return void l.then(u);if(a)return Bt(i,l);i.innerHTML=String(l),z.process(i),a=!0};queueMicrotask(()=>E(c(),l=>{u(l),Le(c,u,i)}))}})}var yo=[oo,Zr,eo,to,no,ro,gr,lo,ho,zr,Xr,Jr,Zn,er,nr,sr,ir,ar,ur,lr,dr,fr,mr,$r,Wr,Br,Ur,Fr,Wn,vr,Er,br,Un,Vn,zn,pr,hr,Mr,Hr,Dr,Gn,Hn,$n,Rr,Ir,Or,Ar,Lr,po,Pr,_n,jn];Pn(...yo);qn();Reflect.set(globalThis,"hyperfixi",Reflect.get(globalThis,"hyperfixi")??ke);})();
package/dist/index.js CHANGED
@@ -2143,7 +2143,7 @@ var api = Object.assign(evaluate, {
2143
2143
  cleanup,
2144
2144
  /** The part of upstream's `internals` that pages and tests reach for. */
2145
2145
  internals: { runtime: { cleanup, processNode } },
2146
- version: false ? "dev" : "7.4.0"
2146
+ version: false ? "dev" : "7.5.1"
2147
2147
  });
2148
2148
  function boot() {
2149
2149
  Object.assign(globalThis, { _hyperscript: api });
package/dist/minimal.js CHANGED
@@ -2412,7 +2412,7 @@
2412
2412
  cleanup,
2413
2413
  /** The part of upstream's `internals` that pages and tests reach for. */
2414
2414
  internals: { runtime: { cleanup, processNode } },
2415
- version: false ? "dev" : "7.4.0"
2415
+ version: false ? "dev" : "7.5.1"
2416
2416
  });
2417
2417
  function boot() {
2418
2418
  Object.assign(globalThis, { _hyperscript: api });
@@ -14,4 +14,4 @@
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 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();})();
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.5.1"});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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperfixi/engine",
3
- "version": "7.4.0",
3
+ "version": "7.5.1",
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",
@@ -8,7 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
12
13
  },
13
14
  "./browser": "./dist/hyperfixi-hs.js",
14
15
  "./dist/hyperfixi-hs.js": "./dist/hyperfixi-hs.js",