@hyperfixi/engine 7.5.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/README.md +109 -30
- package/dist/additions.d.ts +11 -4
- package/dist/common.js +247 -201
- package/dist/common.min.js +9 -9
- package/dist/core.js +55 -3
- package/dist/core.min.js +9 -9
- package/dist/engine.d.ts +9 -1
- package/dist/ext/socket.d.ts +32 -0
- package/dist/ext/socket.dev.js +139 -0
- package/dist/ext/socket.esm.js +127 -0
- package/dist/ext/socket.js +1 -0
- package/dist/ext/tailwind.d.ts +16 -0
- package/dist/ext/tailwind.dev.js +30 -0
- package/dist/ext/tailwind.esm.js +16 -0
- package/dist/ext/tailwind.js +1 -0
- package/dist/full.js +82 -12
- package/dist/full.min.js +15 -15
- package/dist/hyperfixi-hs.dev.js +82 -12
- package/dist/hyperfixi-hs.js +15 -15
- package/dist/index.d.ts +1 -2
- package/dist/index.js +68 -12
- package/dist/kit.d.ts +13 -0
- package/dist/minimal.js +56 -10
- package/dist/minimal.min.js +8 -8
- package/dist/parser.d.ts +15 -2
- package/dist/statements.d.ts +1 -1
- package/package.json +8 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ export type { Module, Parsed, SourceTransform } from './engine';
|
|
|
10
10
|
export { everything } from './everything';
|
|
11
11
|
export { ParseError, Parser, createGrammar, formatError } from './parser';
|
|
12
12
|
export type { ChainRule, CommandRule, FeatureRule, Grammar, LeafRule } from './parser';
|
|
13
|
-
export
|
|
13
|
+
export * from './kit';
|
|
14
14
|
export { tokenize } from './tokenizer';
|
|
15
15
|
export type { Token } from './tokenizer';
|
|
16
|
-
export { config } from './runtime';
|
|
17
16
|
export type { Config } from './runtime';
|
|
18
17
|
export type * from './ast';
|
|
19
18
|
export { on } from './on';
|
package/dist/index.js
CHANGED
|
@@ -1731,6 +1731,7 @@ var ParseError = class extends Error {
|
|
|
1731
1731
|
};
|
|
1732
1732
|
var createGrammar = () => ({
|
|
1733
1733
|
commands: /* @__PURE__ */ Object.create(null),
|
|
1734
|
+
fallbacks: /* @__PURE__ */ Object.create(null),
|
|
1734
1735
|
features: /* @__PURE__ */ Object.create(null),
|
|
1735
1736
|
leaves: [],
|
|
1736
1737
|
indirects: [],
|
|
@@ -1776,6 +1777,15 @@ var Parser = class _Parser {
|
|
|
1776
1777
|
pos() {
|
|
1777
1778
|
return this.cur().start;
|
|
1778
1779
|
}
|
|
1780
|
+
/** Where the parser is, for `reset`: a command's fallback reads again from here. */
|
|
1781
|
+
mark() {
|
|
1782
|
+
return { i: this.i, last: this.last, follows: this.follows.length };
|
|
1783
|
+
}
|
|
1784
|
+
reset(mark2) {
|
|
1785
|
+
this.i = mark2.i;
|
|
1786
|
+
this.last = mark2.last;
|
|
1787
|
+
this.follows.length = mark2.follows;
|
|
1788
|
+
}
|
|
1779
1789
|
/** End offset of the last consumed token — a node's `end`. */
|
|
1780
1790
|
endPos() {
|
|
1781
1791
|
return this.last.end;
|
|
@@ -1910,6 +1920,28 @@ function formatError(e) {
|
|
|
1910
1920
|
}
|
|
1911
1921
|
|
|
1912
1922
|
// src/statements.ts
|
|
1923
|
+
function withFallbacks(p, rule, keyword, start) {
|
|
1924
|
+
const fallbacks = p.g.fallbacks[keyword];
|
|
1925
|
+
if (!fallbacks) return rule(p, keyword, start);
|
|
1926
|
+
const mark2 = p.mark();
|
|
1927
|
+
try {
|
|
1928
|
+
return rule(p, keyword, start);
|
|
1929
|
+
} catch (e) {
|
|
1930
|
+
if (!(e instanceof ParseError)) throw e;
|
|
1931
|
+
let error = e;
|
|
1932
|
+
for (const fallback of fallbacks) {
|
|
1933
|
+
p.reset(mark2);
|
|
1934
|
+
try {
|
|
1935
|
+
const cmd = fallback(p, keyword, start);
|
|
1936
|
+
if (cmd && p.pos() >= e.token.start) return cmd;
|
|
1937
|
+
} catch (f) {
|
|
1938
|
+
if (!(f instanceof ParseError)) throw f;
|
|
1939
|
+
if (f.token.start > error.token.start) error = f;
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
throw error;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1913
1945
|
function command(p) {
|
|
1914
1946
|
const start = p.pos();
|
|
1915
1947
|
if (p.matchOp("(")) {
|
|
@@ -1920,7 +1952,7 @@ function command(p) {
|
|
|
1920
1952
|
const t = p.cur();
|
|
1921
1953
|
const rule = p.g.commands[t.value];
|
|
1922
1954
|
let cmd;
|
|
1923
|
-
if (rule) cmd = p.match(t.value) &&
|
|
1955
|
+
if (rule) cmd = p.match(t.value) && withFallbacks(p, rule, t.value, start);
|
|
1924
1956
|
else if (t.type === "IDENTIFIER") cmd = p.g.pseudo?.(p, start);
|
|
1925
1957
|
if (!cmd || !p.match("unless")) return cmd;
|
|
1926
1958
|
const inner = cmd;
|
|
@@ -1995,8 +2027,21 @@ function eventArgs(p) {
|
|
|
1995
2027
|
|
|
1996
2028
|
// src/engine.ts
|
|
1997
2029
|
var grammar = createGrammar();
|
|
2030
|
+
var registered = /* @__PURE__ */ new Set();
|
|
2031
|
+
var unread = /* @__PURE__ */ new Set();
|
|
1998
2032
|
function register(...modules) {
|
|
1999
|
-
|
|
2033
|
+
const added = modules.filter((module) => !registered.has(module));
|
|
2034
|
+
for (const module of added) {
|
|
2035
|
+
registered.add(module);
|
|
2036
|
+
module(grammar);
|
|
2037
|
+
}
|
|
2038
|
+
if (!added.length) return;
|
|
2039
|
+
for (const elt of [...unread]) {
|
|
2040
|
+
unread.delete(elt);
|
|
2041
|
+
if (!elt.isConnected) continue;
|
|
2042
|
+
dropData(elt);
|
|
2043
|
+
initElement(elt);
|
|
2044
|
+
}
|
|
2000
2045
|
}
|
|
2001
2046
|
var parser = (src) => new Parser(grammar, tokenize(src), src);
|
|
2002
2047
|
function parseProgram(src) {
|
|
@@ -2069,6 +2114,7 @@ function initElement(elt) {
|
|
|
2069
2114
|
setTimeout(() => triggerEvent(target, "load", { hyperscript: true }), 1);
|
|
2070
2115
|
} catch (e) {
|
|
2071
2116
|
if (e instanceof ParseError) {
|
|
2117
|
+
unread.add(elt);
|
|
2072
2118
|
if (src !== written) e.written = written;
|
|
2073
2119
|
triggerEvent(elt, "hyperscript:parse-error", { errors: [e] });
|
|
2074
2120
|
const from = e.written ? `
|
|
@@ -2135,6 +2181,12 @@ var api = Object.assign(evaluate, {
|
|
|
2135
2181
|
addAfterProcessHook: (hook) => void afterProcess.push(hook),
|
|
2136
2182
|
/** Not in upstream: rewrite a script as it is read, leaving the attribute as written. */
|
|
2137
2183
|
addSourceTransform: (transform) => void transforms.push(transform),
|
|
2184
|
+
/** Not in upstream: add grammar modules, from a script tag (`dist/ext/<name>.js`) or a page. */
|
|
2185
|
+
register,
|
|
2186
|
+
// `kit` (what a module may call) is added by the script-tag bundle (`bundles/full.ts`) only,
|
|
2187
|
+
// so a bundle of the user's own keeps only the parts of the engine it uses.
|
|
2188
|
+
/** Not in upstream: the extension files (`dist/ext/<name>.js`) this page has loaded. */
|
|
2189
|
+
extensions: /* @__PURE__ */ new Set(),
|
|
2138
2190
|
evaluate,
|
|
2139
2191
|
parse: hostParse,
|
|
2140
2192
|
process: processNode,
|
|
@@ -2143,7 +2195,7 @@ var api = Object.assign(evaluate, {
|
|
|
2143
2195
|
cleanup,
|
|
2144
2196
|
/** The part of upstream's `internals` that pages and tests reach for. */
|
|
2145
2197
|
internals: { runtime: { cleanup, processNode } },
|
|
2146
|
-
version: false ? "dev" : "7.
|
|
2198
|
+
version: false ? "dev" : "7.6.0"
|
|
2147
2199
|
});
|
|
2148
2200
|
function boot() {
|
|
2149
2201
|
Object.assign(globalThis, { _hyperscript: api });
|
|
@@ -2213,7 +2265,10 @@ function flip(elt, modal) {
|
|
|
2213
2265
|
else throw new Error("toggle needs a dialog, details, select or popover element");
|
|
2214
2266
|
}
|
|
2215
2267
|
function toggleElement(g) {
|
|
2216
|
-
g.
|
|
2268
|
+
(g.fallbacks.toggle ??= []).push((p, _keyword, start) => {
|
|
2269
|
+
p.matchAny("the", "my");
|
|
2270
|
+
const target = p.withFollow(["between", "as"], () => unary(p));
|
|
2271
|
+
if (p.peek("between")) return;
|
|
2217
2272
|
const modal = p.match("as") ? !!p.req("modal") : !!p.match("modal");
|
|
2218
2273
|
const text = p.text(target);
|
|
2219
2274
|
const node = {
|
|
@@ -2228,7 +2283,7 @@ function toggleElement(g) {
|
|
|
2228
2283
|
})
|
|
2229
2284
|
};
|
|
2230
2285
|
return node;
|
|
2231
|
-
};
|
|
2286
|
+
});
|
|
2232
2287
|
}
|
|
2233
2288
|
|
|
2234
2289
|
// src/commands/animation.ts
|
|
@@ -2685,13 +2740,7 @@ function toggle(g) {
|
|
|
2685
2740
|
node.between = [attribute2, attributeRef(p) ?? p.err("Expected attributeRef")];
|
|
2686
2741
|
}
|
|
2687
2742
|
} else if (!(node.classRefs = classRefs(p)) && !(node.attributeRef = attributeRef(p))) {
|
|
2688
|
-
|
|
2689
|
-
if (!element) node.target = p.withFollow(["between"], () => assignable(p));
|
|
2690
|
-
else {
|
|
2691
|
-
const target2 = p.withFollow(["between", "as"], () => unary(p));
|
|
2692
|
-
if (!p.peek("between")) return element(p, target2, start);
|
|
2693
|
-
node.target = writable(p, target2);
|
|
2694
|
-
}
|
|
2743
|
+
node.target = p.withFollow(["between"], () => assignable(p));
|
|
2695
2744
|
}
|
|
2696
2745
|
if (!node.styleProp && !node.target) node.on = p.match("on") ? expr(p) : implicitMe(p);
|
|
2697
2746
|
if (p.match("between")) {
|
|
@@ -5810,10 +5859,12 @@ export {
|
|
|
5810
5859
|
api,
|
|
5811
5860
|
append,
|
|
5812
5861
|
askAnswer,
|
|
5862
|
+
assignToNamespace,
|
|
5813
5863
|
behavior,
|
|
5814
5864
|
boot,
|
|
5815
5865
|
breakpoint,
|
|
5816
5866
|
cleanup,
|
|
5867
|
+
commandList,
|
|
5817
5868
|
config,
|
|
5818
5869
|
construct,
|
|
5819
5870
|
conversions2 as conversions,
|
|
@@ -5822,6 +5873,8 @@ export {
|
|
|
5822
5873
|
createGrammar,
|
|
5823
5874
|
def,
|
|
5824
5875
|
defaultCommand,
|
|
5876
|
+
dotOrColonPath,
|
|
5877
|
+
evalStatic,
|
|
5825
5878
|
evaluate,
|
|
5826
5879
|
everything,
|
|
5827
5880
|
expr,
|
|
@@ -5842,6 +5895,7 @@ export {
|
|
|
5842
5895
|
log,
|
|
5843
5896
|
loopControl,
|
|
5844
5897
|
make,
|
|
5898
|
+
makeContext,
|
|
5845
5899
|
measure,
|
|
5846
5900
|
morph,
|
|
5847
5901
|
on,
|
|
@@ -5858,6 +5912,7 @@ export {
|
|
|
5858
5912
|
render,
|
|
5859
5913
|
repeat,
|
|
5860
5914
|
returnCommand,
|
|
5915
|
+
runList,
|
|
5861
5916
|
scroll,
|
|
5862
5917
|
send,
|
|
5863
5918
|
set2 as set,
|
|
@@ -5872,6 +5927,7 @@ export {
|
|
|
5872
5927
|
toggleElement,
|
|
5873
5928
|
tokenize,
|
|
5874
5929
|
transition,
|
|
5930
|
+
urlOrExpression,
|
|
5875
5931
|
viewTransition,
|
|
5876
5932
|
wait
|
|
5877
5933
|
};
|
package/dist/kit.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an extension module may call: the one surface for module authors, in-tree (`src/ext/`)
|
|
3
|
+
* or not (`@hyperfixi/speech`). `index.ts` exports it for ESM. The script-tag bundle
|
|
4
|
+
* (`bundles/full.ts`, so `hyperfixi-hs.js`) carries it as `_hyperscript.kit`, and an extension
|
|
5
|
+
* loaded by a script tag (`dist/ext/<name>.js`) reads it there, so it calls the page's engine
|
|
6
|
+
* instead of carrying a copy. Only that bundle carries it: a bundle built from ESM keeps only
|
|
7
|
+
* the parts of the engine its modules use, and registers extensions from ESM. An extension's value imports
|
|
8
|
+
* come from here only (its types may come from anywhere); the build fails on any other. Adding
|
|
9
|
+
* a name here changes the public API, so a name is added when an extension needs it.
|
|
10
|
+
*/
|
|
11
|
+
export { dotOrColonPath, evalStatic, expr, urlOrExpression } from './expressions';
|
|
12
|
+
export { commandList } from './statements';
|
|
13
|
+
export { assignToNamespace, config, makeContext, runList } from './runtime';
|
package/dist/minimal.js
CHANGED
|
@@ -1770,13 +1770,7 @@
|
|
|
1770
1770
|
node.between = [attribute2, attributeRef(p) ?? p.err("Expected attributeRef")];
|
|
1771
1771
|
}
|
|
1772
1772
|
} else if (!(node.classRefs = classRefs(p)) && !(node.attributeRef = attributeRef(p))) {
|
|
1773
|
-
|
|
1774
|
-
if (!element) node.target = p.withFollow(["between"], () => assignable(p));
|
|
1775
|
-
else {
|
|
1776
|
-
const target2 = p.withFollow(["between", "as"], () => unary(p));
|
|
1777
|
-
if (!p.peek("between")) return element(p, target2, start);
|
|
1778
|
-
node.target = writable(p, target2);
|
|
1779
|
-
}
|
|
1773
|
+
node.target = p.withFollow(["between"], () => assignable(p));
|
|
1780
1774
|
}
|
|
1781
1775
|
if (!node.styleProp && !node.target) node.on = p.match("on") ? expr(p) : implicitMe(p);
|
|
1782
1776
|
if (p.match("between")) {
|
|
@@ -2000,6 +1994,7 @@
|
|
|
2000
1994
|
};
|
|
2001
1995
|
var createGrammar = () => ({
|
|
2002
1996
|
commands: /* @__PURE__ */ Object.create(null),
|
|
1997
|
+
fallbacks: /* @__PURE__ */ Object.create(null),
|
|
2003
1998
|
features: /* @__PURE__ */ Object.create(null),
|
|
2004
1999
|
leaves: [],
|
|
2005
2000
|
indirects: [],
|
|
@@ -2045,6 +2040,15 @@
|
|
|
2045
2040
|
pos() {
|
|
2046
2041
|
return this.cur().start;
|
|
2047
2042
|
}
|
|
2043
|
+
/** Where the parser is, for `reset`: a command's fallback reads again from here. */
|
|
2044
|
+
mark() {
|
|
2045
|
+
return { i: this.i, last: this.last, follows: this.follows.length };
|
|
2046
|
+
}
|
|
2047
|
+
reset(mark2) {
|
|
2048
|
+
this.i = mark2.i;
|
|
2049
|
+
this.last = mark2.last;
|
|
2050
|
+
this.follows.length = mark2.follows;
|
|
2051
|
+
}
|
|
2048
2052
|
/** End offset of the last consumed token — a node's `end`. */
|
|
2049
2053
|
endPos() {
|
|
2050
2054
|
return this.last.end;
|
|
@@ -2179,6 +2183,28 @@
|
|
|
2179
2183
|
}
|
|
2180
2184
|
|
|
2181
2185
|
// src/statements.ts
|
|
2186
|
+
function withFallbacks(p, rule, keyword, start) {
|
|
2187
|
+
const fallbacks = p.g.fallbacks[keyword];
|
|
2188
|
+
if (!fallbacks) return rule(p, keyword, start);
|
|
2189
|
+
const mark2 = p.mark();
|
|
2190
|
+
try {
|
|
2191
|
+
return rule(p, keyword, start);
|
|
2192
|
+
} catch (e) {
|
|
2193
|
+
if (!(e instanceof ParseError)) throw e;
|
|
2194
|
+
let error = e;
|
|
2195
|
+
for (const fallback of fallbacks) {
|
|
2196
|
+
p.reset(mark2);
|
|
2197
|
+
try {
|
|
2198
|
+
const cmd = fallback(p, keyword, start);
|
|
2199
|
+
if (cmd && p.pos() >= e.token.start) return cmd;
|
|
2200
|
+
} catch (f) {
|
|
2201
|
+
if (!(f instanceof ParseError)) throw f;
|
|
2202
|
+
if (f.token.start > error.token.start) error = f;
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
throw error;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2182
2208
|
function command(p) {
|
|
2183
2209
|
const start = p.pos();
|
|
2184
2210
|
if (p.matchOp("(")) {
|
|
@@ -2189,7 +2215,7 @@
|
|
|
2189
2215
|
const t = p.cur();
|
|
2190
2216
|
const rule = p.g.commands[t.value];
|
|
2191
2217
|
let cmd;
|
|
2192
|
-
if (rule) cmd = p.match(t.value) &&
|
|
2218
|
+
if (rule) cmd = p.match(t.value) && withFallbacks(p, rule, t.value, start);
|
|
2193
2219
|
else if (t.type === "IDENTIFIER") cmd = p.g.pseudo?.(p, start);
|
|
2194
2220
|
if (!cmd || !p.match("unless")) return cmd;
|
|
2195
2221
|
const inner = cmd;
|
|
@@ -2264,8 +2290,21 @@
|
|
|
2264
2290
|
|
|
2265
2291
|
// src/engine.ts
|
|
2266
2292
|
var grammar = createGrammar();
|
|
2293
|
+
var registered = /* @__PURE__ */ new Set();
|
|
2294
|
+
var unread = /* @__PURE__ */ new Set();
|
|
2267
2295
|
function register(...modules) {
|
|
2268
|
-
|
|
2296
|
+
const added = modules.filter((module) => !registered.has(module));
|
|
2297
|
+
for (const module of added) {
|
|
2298
|
+
registered.add(module);
|
|
2299
|
+
module(grammar);
|
|
2300
|
+
}
|
|
2301
|
+
if (!added.length) return;
|
|
2302
|
+
for (const elt of [...unread]) {
|
|
2303
|
+
unread.delete(elt);
|
|
2304
|
+
if (!elt.isConnected) continue;
|
|
2305
|
+
dropData(elt);
|
|
2306
|
+
initElement(elt);
|
|
2307
|
+
}
|
|
2269
2308
|
}
|
|
2270
2309
|
var parser = (src) => new Parser(grammar, tokenize(src), src);
|
|
2271
2310
|
function parseProgram(src) {
|
|
@@ -2338,6 +2377,7 @@
|
|
|
2338
2377
|
setTimeout(() => triggerEvent(target, "load", { hyperscript: true }), 1);
|
|
2339
2378
|
} catch (e) {
|
|
2340
2379
|
if (e instanceof ParseError) {
|
|
2380
|
+
unread.add(elt);
|
|
2341
2381
|
if (src !== written) e.written = written;
|
|
2342
2382
|
triggerEvent(elt, "hyperscript:parse-error", { errors: [e] });
|
|
2343
2383
|
const from = e.written ? `
|
|
@@ -2404,6 +2444,12 @@
|
|
|
2404
2444
|
addAfterProcessHook: (hook) => void afterProcess.push(hook),
|
|
2405
2445
|
/** Not in upstream: rewrite a script as it is read, leaving the attribute as written. */
|
|
2406
2446
|
addSourceTransform: (transform) => void transforms.push(transform),
|
|
2447
|
+
/** Not in upstream: add grammar modules, from a script tag (`dist/ext/<name>.js`) or a page. */
|
|
2448
|
+
register,
|
|
2449
|
+
// `kit` (what a module may call) is added by the script-tag bundle (`bundles/full.ts`) only,
|
|
2450
|
+
// so a bundle of the user's own keeps only the parts of the engine it uses.
|
|
2451
|
+
/** Not in upstream: the extension files (`dist/ext/<name>.js`) this page has loaded. */
|
|
2452
|
+
extensions: /* @__PURE__ */ new Set(),
|
|
2407
2453
|
evaluate,
|
|
2408
2454
|
parse: hostParse,
|
|
2409
2455
|
process: processNode,
|
|
@@ -2412,7 +2458,7 @@
|
|
|
2412
2458
|
cleanup,
|
|
2413
2459
|
/** The part of upstream's `internals` that pages and tests reach for. */
|
|
2414
2460
|
internals: { runtime: { cleanup, processNode } },
|
|
2415
|
-
version: false ? "dev" : "7.
|
|
2461
|
+
version: false ? "dev" : "7.6.0"
|
|
2416
2462
|
});
|
|
2417
2463
|
function boot() {
|
|
2418
2464
|
Object.assign(globalThis, { _hyperscript: api });
|
package/dist/minimal.min.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";(()=>{var K=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",T=(e,t)=>K(e)?e.then(t):t(e),I=(e,t)=>e.some(K)?Promise.all(e).then(t):t(e),M=e=>e!=null
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"}
|
|
3
|
-
`,
|
|
4
|
-
`?(i++,o=0):o++,s),d=p=>({type:p,value:"",start:r,end:r+1,line:i,column:o}),m=(p,g)=>(p.value=g,p.end=r,p),f=p=>{let g="";for(;a()&&p(a());)g+=c();return g},h=()=>t&&u===0,y=()
|
|
5
|
-
`),c();else if(_e(p))n.push(m(d("WHITESPACE"),f(_e)));else if(!y()&&p==="."&&($(g)||g==="{"||g==="-"))n.push(w("CLASS_REF",!0));else if(!y()&&p==="#"&&($(g)||g==="{"))n.push(w("ID_REF",!1));else if(p==="@"||p==="["&&g==="@")n.push(_());else if(p==="*"&&$(g)){let P=d("STYLE_REF");n.push(m(P,c()+f(F=>$(F)||F==="-")))}else if(h()&&($(p)||p==="\\"))n.push(N());else if(!h()&&($(p)||p==="_"||p==="$"))n.push(q());else if(U(p))n.push(C());else if(!h()&&(p==='"'||p==="`"))n.push(k());else if(!h()&&p==="'")n.push(Z()?k():O());else if(dt.has(p))s==="$"&&p==="{"&&u++,p==="}"&&u--,n.push(O());else if(h()||p==="`"){let P=d("RESERVED");n.push(m(P,c()))}else throw new Error("Unknown token: "+p+" ")}return n}function E(e){return e.match("the"),cn(e)}function cn(e){let t=ht(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=ln(o.value,t,ht(e));return t}function ln(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>T(t.ev(o),i=>!!i===r?i:n.ev(o))}}var fn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function He(e){let t=$e(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=$e(e),u=fn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>I([i.ev(l),s.ev(l)],([c,d])=>u(c,d))}}return t}function $e(e){let t=G(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function G(e){e.match("the");let t=e.pos();if(e.match("not"))return Ue(e,"logicalNot",t,G(e),n=>!n);if(e.match("no"))return Ue(e,"noExpression",t,$e(e),qe);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return mn(e)}function Ue(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>T(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var dn="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function mn(e){let t=vt(e),n=e.matchAny(...dn)??e.matchOp("%");if(n)return pt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return pt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function pt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>T(n.ev(s),o)};return n.stat&&(i.stat=()=>o(de(n))),i}function vt(e){let t=e.pos();return e.matchOp("-")?Ue(e,"negativeNumber",t,vt(e),n=>-b(n)):bt(e)}function bt(e){let t=wn(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function Et(e){return e.match("the"),We(e,bt(e))}function We(e,t){let n=pn(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function pn(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&hn(t.expr);)t=t.expr;return t}var hn=e=>j(v(e,"ev"));function de(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function gn(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function ht(e){let t=He(e),n=gn(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=He(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=He(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=f=>l&&typeof f=="string"?f.toLowerCase():f,d=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:f=>I([t.ev(f),u??s?.ev(f),a?.ev(f)],([h,y,w])=>{if(o){let k=rt(h,o,i);return r==="a"?k:!k}if(d&&y===void 0&&(r==="is"||r==="is not")){let k=!!ie(h,d);return r==="is"?k:!k}return xt(r,c(h),c(y),w)})}}function gt(e,t){let n=v(e,"contains")??v(e,"includes");if(!j(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function yn(e,t){let n=v(e,"match")??v(e,"matches");if(!j(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var yt=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function xt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!xt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&yn(t,n);case"in":return n!=null&>(n,t);case"contain":case"include":return t!=null&>(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return yt(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return yt(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return qe(t);case"exist":return nt(t)}throw new Error("Unknown comparison : "+e)}function wn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),je("number",parseFloat(t.value),t);case"STRING":return En(e);case"ID_REF":return Nn(e);case"CLASS_REF":return Y(e);case"ATTRIBUTE_REF":return z(e);case"STYLE_REF":return Pt(e)}if(t.op){if(t.value==="(")return vn(e);if(t.value==="[")return xn(e);if(t.value==="{")return kn(e);if(t.value==="<")return Pn(e)}let n=e.match("true")??e.match("false");if(n)return je("boolean",n.value==="true",n);let r=e.match("null");if(r)return je("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return Tn(e)}function je(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function vn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>E(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var bn=(e,t)=>I(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function kt(e,t){let n=e.child(fe(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,E(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function En(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=kt(e,n);r.ev=i=>bn(o,i)}else r.stat=()=>n;return r}function xn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(E(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>I(n.map(o=>o.ev(r)),o=>o)}}function kn(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(E(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(E(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>I([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function Tt(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Tn(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>E(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>ut(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,d,m)=>ct(s,c,a,m,l?.ev(c))}}var Nt=(e,t)=>{let n=t.value.substring(2);return E(e.child(fe(n),n))};function Nn(e){let t=e.consume(),n=(o,i)=>Ae(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>u&&ce(u,s))};if(t.template){let o=r.expr=Nt(e,t);r.ev=i=>T(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Y(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>T(n.ev(r),s=>ce(Array.from(s instanceof H?s:[]),i))};if(t.template){let r=n.expr=Nt(e,t);n.ev=o=>T(r.ev(o),i=>new H("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new H(r,o.me,!0)}return n}var Ge=class extends H{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Pn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new H(n,o.me),lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>ce(Array.from(u instanceof H?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=kt(e,n);r.ev=i=>I(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new Ge(i.me,s))}return r}function z(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>ae(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>ue(s.you||s.me,r,a)}}function Pt(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?be:ve)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ee(o.you||o.me,r,s)}}function Rt(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(E(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>I(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function me(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function St(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function ke(e,t="Expected event name"){return e.matchType("STRING")?.value??St(e)??e.err(t)}function D(e,t){return Sn(e,t)??Cn(e,t)??Ln(e,t)??On(e,t)??In(e,t)??An(e,t)??Fn(e,t)??_n(e,t)??Rn(e,t)??t}function Rn(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Sn(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ie(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),xe(s,n,u)},del:(i,s)=>{A(s,r),S(s,u=>{M(u)&&delete u[n],x.wroteProperty(u)})}};return D(e,o)}function Cn(e,t){if(!e.match("of"))return;let n=G(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ie,attribute:ae,style:ve,computed:be}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:d=>T(c.root.ev(d),m=>l(m,u)),lhs:d=>c.root.ev(d),put:(d,m,f)=>{A(m,a),s==="attribute"?ue(m,u,f):s==="property"?xe(m,u,f):Ee(m,u,f)},del:(d,m)=>{A(m,a),S(m,f=>{s==="attribute"?R(f)&&f.removeAttribute(u):s==="property"?(M(f)&&delete f[u],x.wroteProperty(f)):f instanceof HTMLElement&&f.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function On(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=z(e)??Pt(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ie(l,i):o?.type==="attributeRef"?ae(l,o.name):o?.type==="computedStyleRef"?be(l,o.name):o&&ve(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>T(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,d)=>{A(c,s),i!==void 0?xe(c,i,d):o?.type==="attributeRef"?ue(c,o.name,d):o&&Ee(c,o.name,d)}};return D(e,a)}function In(e,t){if(!e.match("in"))return;let n=G(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")S(u,c=>R(c)&&a.push(...Fe(c,l)));else if(R(s)){let c=!1;if(S(u,d=>{d instanceof Node&&d.contains(s)&&(c=!0)}),c)return s}else S(s,c=>S(u,d=>c===d&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>I([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>ce(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function An(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=St(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>T(s.root.ev(u),a=>ot(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Fn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(E(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return I([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...d])=>{if(!l||a===void 0)return wt(c,void 0,d,s,r);A(c,o);let m=wt(v(c,a),c,d,s,r);return tt(c,a),m})}};return D(e,i)}function wt(e,t,n,r,o){if(!j(e))throw A(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Ln(e,t){let n=z(e);return n&&qn(e,t,n)}function qn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ae(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),ue(s,n.name,u)}};return o}function _n(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=E(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=E(e))),e.reqOp("]");let s=e.text(t),u=(c,d)=>b(d)<0?b(v(c,"length"))+b(d):b(d),a=(c,d,m)=>{let f=v(c,"slice");return j(f)?Reflect.apply(f,c,[d,m]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>I([l.root.ev(c),r.ev(c),i?.ev(c)],([d,m,f])=>d==null?null:n?a(d,0,u(d,m)+1):o?f==null?a(d,b(m)):a(d,b(m),u(d,f)+1):v(d,String(m))),lhs:c=>I([l.root.ev(c),r.ev(c)],d=>d),put:(c,d,m)=>{let[f,h]=Array.isArray(d)?d:[];A(f,s),M(f)&&(f[String(h)]=m)},del:(c,d)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[m,f]=Array.isArray(d)?d:[];A(m,s),Array.isArray(m)?m.splice(u(m,f),1):M(m)&&delete m[String(f)],x.wroteProperty(m)}};return D(e,l)}function It(e){let t=Y(e);if(!t)return;let n=[t];for(let r=Y(e);r;r=Y(e))n.push(r);return n}var Ve=(e,t)=>(e??[]).map(n=>T(n.ev(t),r=>String(v(r,"className")))),Dn=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),ze=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,Ct=(e,t,n,r,o)=>t?ft(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):S(e,i=>R(i)&&r(i)),pe=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),At=(e,t,n,r,o,i)=>i?Ct(t,n,r,s=>pe(s,i,e),s=>pe(s,i,!e)):I(o.map(s=>Ct(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function Ft(e){let t=It(e),n=t?void 0:z(e);return{refs:t,attribute:n,css:t||n?void 0:Rt(e)}}function Lt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ft(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>E(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?E(t):me(t),l=t.match("when")?E(t):void 0,c=o||i?l:void 0,d=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:f=>I([a.ev(f),s?.ev(f),u?.ev(f),...Ve(o,f)],([h,y,w,...k])=>{if(A(h,d),u){if(Array.isArray(h))h.push(w);else if(h instanceof Set)h.add(w);else throw h instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof h);x.wroteProperty(h)}else if(s)S(h,q=>{let N=ze(q);N&&(N.cssText+=y)});else return At(!0,h,c,f,k,i)})}}}var Mn=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function qt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ft(t),u=o||i||s?void 0:E(t),a=t.match("from")?E(t):u?void 0:me(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=E(t));let c=a?t.text(a):"",d=u?t.text(u):"",m=(h,y,w)=>{if(w==null&&u?.del&&u.lhs&&!Mn(y)){let k=u;return T(u.lhs(h),q=>k.del?.(h,q))}if(A(y,d),Array.isArray(w)){let k=w.indexOf(y);k>-1&&w.splice(k,1),x.wroteProperty(w)}else w instanceof Set||w instanceof Map?(w.delete(y),x.wroteProperty(w)):S(y,k=>{R(k)&&k.parentElement&&(w==null||w instanceof Node&&w.contains(k))&&k.parentElement.removeChild(k)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:h=>I([a?.ev(h),s?.ev(h),u?.ev(h),...Ve(o,h)],([y,w,k,...q])=>{if(u)return m(h,k,y);if(A(y,c),s){let N=Dn(String(w));S(y,C=>N.forEach(O=>ze(C)?.removeProperty(O)))}else return At(!1,y,l,h,q,i)})}}}var Ot=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},_t={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=V(t);n?t.style.display=n:e==="toggle"?_t.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Ot("visibility","hidden","visible"),opacity:Ot("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function Hn(e,t){let n=t??Q.defaultHideShowStrategy??"display";return Q.hideShowStrategies[n]??_t[n]??e.err("Unknown show/hide strategy : "+n)}function Dt(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let y=o.styleProp=t.consume().value.slice(1);i=Hn(t,y),o.on=t.match("of")?t.withFollow(["with","between"],()=>E(t)):me(t)}else if(t.match("between")){let y=Y(t);if(y)t.req("and"),o.between=[y,Y(t)??t.err("Expected classRef")];else{let w=z(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[w,z(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=It(t))&&!(o.attributeRef=z(t))){let y=t.g.toggleElement;if(!y)o.target=t.withFollow(["between"],()=>Et(t));else{let w=t.withFollow(["between","as"],()=>G(t));if(!t.peek("between"))return y(t,w,r);o.target=We(t,w)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?E(t):me(t)),t.match("between")){let y=o.betweenValues=t.withFollow(["and"],()=>{let w=[E(t)];for(;t.matchOp(",");)w.push(E(t));return w});t.req("and"),y.push(E(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=E(t)):t.match("until")&&(o.until=ke(t),t.match("from")&&(o.from=E(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:d}=o,m=s?t.text(s):"",f=(y,w)=>y[(y.findIndex(k=>k==w)+1)%y.length],h=(y,w,k,q)=>{if(a&&u?.lhs&&u.put){let N=u;return I([u.ev(y),u.lhs(y)],([C,O])=>N.put?.(y,O,f(k,C)))}if(a&&d)return S(w,N=>{let C=ze(N);if(!C||!R(N))return;let O=C.getPropertyValue(d)||getComputedStyle(N).getPropertyValue(d);C.setProperty(d,String(f(k,O)))});A(w,m),S(w,N=>{if(R(N))if(i)N instanceof HTMLElement&&i("toggle",N);else if(l){let[C,O]=l;if(C.type==="classRef"&&O.type==="classRef"){let[_,Z]=[String(C.className),String(O.className)],X=N.classList.contains(_);N.classList.toggle(_,!X),N.classList.toggle(Z,X)}else if(C.type==="attributeRef"&&O.type==="attributeRef"){let _=N.getAttribute(C.name)===String(C.value);pe(N,_?C:O,!1),pe(N,_?O:C,!0)}}else c?pe(N,c,!N.hasAttribute(c.name)):q.forEach(C=>N.classList.toggle(String(C)))})};return o.run=y=>I([s?.ev(y),o.time?.ev(y),o.from?.ev(y),I((a??[]).map(w=>w.ev(y)),w=>w),...Ve(o.classRefs,y)],([w,k,q,N,...C])=>{let O=()=>h(y,w,Array.isArray(N)?N:[],C);if(o.time)return new Promise(_=>{O(),setTimeout(()=>{O(),_()},b(k))});if(o.until){let _=o.until,Z=q||y.me;return new Promise(X=>{B(Z)&&Z.addEventListener(_,()=>{O(),X()},{once:!0}),O()})}return T(O(),()=>{})}),o}}var Mt=new WeakSet;function Ht(e){if(Mt.has(e))return;Mt.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let u=jn(s.sourceElement||o);if(!u)return;let a=Un(u.value,u.scopeElt),l=s.request?.body;if(l instanceof FormData)for(let c in a)l.set(c,a[c])}}))}function jn(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var Ne=e=>e&&W(e)?.scopes?.elementScope||{};function Te(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function $n(e,t){for(let n=t;n;n=n.parentElement){let r=Ne(n);if(e in r)return r[e]}}function Un(e,t){let n={},r=e.trim();if(r==="*"){let o=Ne(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Te(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=Ne(t);o in i&&(n[o.slice(1)]=Te(i[o]))}else if(o[0]==="^"){let i=$n(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Te(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=Ne(document.querySelector(o.slice(0,i))),u=o.slice(i+1);":"+u in s&&(n[u]=Te(s[":"+u]))}}}return n}var J=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},jt=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Pe=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new J(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function Be(e){let t=e.source.split(`
|
|
1
|
+
"use strict";(()=>{var K=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",T=(e,t)=>K(e)?e.then(t):t(e),I=(e,t)=>e.some(K)?Promise.all(e).then(t):t(e),M=e=>e!=null,$=e=>typeof e=="function",w=(e,t)=>M(e)?e[t]:void 0,ne=(e,t,n)=>{M(e)&&(e[t]=n)},P=e=>e instanceof Element,B=e=>$(w(e,"addEventListener"));var b=e=>e;var Q={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},fetchThrowsOn:[/^4/,/^5/]},Ce=Object.assign(Object.create(null),{String:e=>String(e),Int:e=>parseInt(String(e)),Float:e=>parseFloat(String(e)),Number:e=>Number(e),Fragment:e=>at(e)}),Oe=[],se={process(e){},enter(e){}},tt=new WeakMap;function Ie(e){if(e.window!==e)return e;let t=tt.get(e);return t||tt.set(e,t={}),t}var W=e=>Ie(e)._hyperscript;function Ae(e){let t=Ie(e),n=t._hyperscript!==void 0;return delete t._hyperscript,n}function V(e){return Ie(e)._hyperscript??={}}var x={tracking:!1,readGlobal(e){},readElement(e,t){},readProperty(e,t){},readAttribute(e,t){},readQuery(e){},wroteGlobal(e){},wroteElement(e,t){},wroteProperty(e){},stop(e){}},ye=e=>(x.tracking&&typeof e=="object"&&e!==null&&x.readProperty(e,"__mutation__"),e),an={Array:["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"],Set:["add","delete","clear"],Map:["set","delete","clear"]};function rt(e,t){let n=w(w(e,"constructor"),"name");typeof n=="string"&&an[n]?.includes(t)&&x.wroteProperty(e)}var Fe=e=>{if(e instanceof Node){let t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document},un=e=>e.replace(/[:&()[\]/]/g,t=>"\\"+t);function Le(e,t){return x.tracking&&x.readQuery(e),e.querySelectorAll(t)}var H=class{constructor(t,n,r=!1){this.raw=t;this.relativeTo=n;this.escape=r}get css(){return this.escape?un(this.raw):this.raw}get className(){return this.raw.slice(1)}get length(){return this.select().length}contains(t){for(let n of this)if(n.contains(t))return!0;return!1}select(){return Le(Fe(this.relativeTo),this.css)}[Symbol.iterator](){return this.select()[Symbol.iterator]()}},qe=e=>e instanceof H||Array.isArray(e)||e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList;function S(e,t){if(qe(e))for(let n of e)t(n);else t(e)}var we=(e,t)=>{if(e==null)return;let n=t(e);if(n!==void 0)return n;if(qe(e))return Array.from(e,t)},ie=(e,t)=>(x.tracking&&x.readProperty(e,t),we(e,n=>w(n,t))),ae=(e,t)=>(x.tracking&&x.readAttribute(e,t),we(e,n=>P(n)?n.getAttribute(t):void 0)),ve=(e,t)=>we(e,n=>w(w(n,"style"),t)),be=(e,t)=>we(e,n=>P(n)?getComputedStyle(n).getPropertyValue(t):void 0),ue=(e,t,n)=>S(e,r=>{P(r)&&(n==null?r.removeAttribute(t):r.setAttribute(t,String(n)))}),Ee=(e,t,n)=>S(e,r=>ne(w(r,"style"),t,n)),xe=(e,t,n)=>S(e,r=>{ne(r,t,n),x.wroteProperty(r)});function A(e,t){if(e==null)throw new Error(`'${t}' is null`)}var _e=e=>e==null||w(e,"length")===0;function ot(e){if(e==null)return!1;if(qe(e)){for(let t of e)return!0;return!1}return!0}function st(e,t,n){if(e==null&&n||Object.prototype.toString.call(e).slice(8,-1)===t)return!0;let r=w(globalThis,t);return $(r)&&e instanceof r}function it(e,t){for(let r of Oe){let o=r(t,e);if(o!==void 0)return o}if(e==null)return null;let n=Ce[t];if(n)return n(e);throw new Error("Unknown conversion : "+t)}function at(e){let t=document.createDocumentFragment();return e==null?t.append("null"):S(e,n=>{if(n instanceof Node)t.append(n);else{let r=document.createElement("template");r.innerHTML=n===null?"":String(n),t.append(r.content)}}),t}function ce(e,t){S(e,n=>{if(!P(n))return;let r=n.parentElement;n.replaceWith(t instanceof Node?t.cloneNode(!0):at(t)),r&&se.process(r)})}function L(e,t,n={},r){if(!B(e))return!0;n.sender=r;let o=Object.assign(new Event(t,{bubbles:!0,cancelable:!0,composed:!0}),{detail:n});return e.dispatchEvent(o)}var ut=(e,t="elementScope")=>(V(e).scopes??={})[t]??={},cn=Object.create(null,{selection:{get:()=>getSelection()?.toString(),enumerable:!0},clipboard:{get:()=>navigator.clipboard.readText(),set:e=>void navigator.clipboard.writeText(String(e))}});function le(e,t,n,r){let o=w(r,"detail"),i=Object.create(cn);for(let s=P(e)?e:null;s;s=s.parentElement)Object.assign(i,W(s)?.features);return{meta:{owner:e,feature:t},locals:i,me:n,you:void 0,result:void 0,beingTested:null,event:r,target:w(r,"target")??null,detail:o??null,sender:w(o,"sender")??null,body:typeof document>"u"?null:document.body}}var Se=["meta","it","result","locals","event","target","detail","sender","body"],re=e=>{let t=e.meta.owner,n=e.meta.feature?.behavior;return M(t)?ut(t,n?n+"Scope":void 0):{}};function ct(e,t,n){let r=P(n)?n:P(t.meta.owner)?t.meta.owner:null;for(;r;){let o=W(r)?.scopes?.elementScope;if(o&&e in o)return{value:o[e],element:r};let i=r.getAttribute("dom-scope");if(i==="isolated")break;let s=i?.match(/^closest\s+(.+)/),u=i?.match(/^parent\s+of\s+(.+)/);s?r=r.parentElement?.closest(s[1])??null:u?r=r.closest(u[1])?.parentElement??null:r=r.parentElement}return{value:void 0,element:null}}function lt(e,t,n,r){if(e==="me"||e==="my"||e==="I")return t.me;if(e==="it"||e==="its")return t.beingTested??t.result;if(e==="result")return t.result;if(e==="you"||e==="your"||e==="yourself")return t.you;let o=t.meta.owner,i=()=>(x.tracking&&x.readGlobal(e),ye(w(globalThis,e)));if(n==="global")return i();if(n==="element")return x.tracking&&x.readElement(e,o),ye(re(t)[e]);if(n==="inherited"){let l=ct(e,t,r);return x.tracking&&x.readElement(e,l.element??(P(r)?r:o)),ye(l.value)}let s=t.meta.context;if(s!=null){let l=w(s,e);if(l!==void 0)return l;let c=w(w(s,"detail"),e);if(c!==void 0)return c}let u=Se.includes(e)?w(t,e):t.locals[e];if(u!==void 0)return u;let a=re(t)[e];return a!==void 0?(x.tracking&&x.readElement(e,o),ye(a)):i()}function ft(e,t,n,r,o){if(n==="global")ne(globalThis,e,r),x.wroteGlobal(e);else if(n==="element")re(t)[e]=r,x.wroteElement(e,t.meta.owner);else if(n==="inherited"){let s=ct(e,t,o).element??(P(o)?o:t.meta.owner);M(s)&&(ut(s)[e]=r),x.wroteElement(e,s)}else!Se.includes(e)&&t.locals[e]!==void 0?t.locals[e]=r:re(t)[e]!==void 0?(re(t)[e]=r,x.wroteElement(e,t.meta.owner)):Se.includes(e)?ne(t,e,r):t.locals[e]=r}function ee(e,t,n=0){for(let r=n;r<e.length;r++){let o=e[r].run(t);if(K(o))return o.then(i=>i||ee(e,t,r+1));if(o)return o}}function oe(e,t){try{let n=e();return K(n)?n.then(void 0,t):n}catch(n){return t(n)}}function dt(e,t,n){let{errorSymbol:r,errorHandler:o,finallyHandler:i}=n,s=()=>oe(()=>T(ee(t,e),a=>{let l=w(a,"k");if(l==="break"||l==="continue")throw new Error(`Command \`${l}\` cannot be used outside of a \`repeat\` loop.`);return nt(a)}),a=>{if(!o||!r)throw a;return e.locals[r]=a,ee(o,e)});if(!i)return s();let u=()=>oe(()=>T(ee(i,e),()=>{}),a=>console.error(" Exception in finally block: ",a));return oe(()=>T(s(),a=>T(u(),()=>nt(a))),a=>T(u(),()=>{throw a}))}var nt=e=>{let t=w(e,"k");if(t==="return")return{k:"return",value:w(e,"value")};if(t==="break"||t==="continue")return{k:t}};function mt(e,t,n,r,o){let i=[];S(e,a=>i.push(a));let s=i.map(a=>(n.beingTested=a,t.ev(n)));n.beingTested=null;let u=a=>{n.result=i.filter((l,c)=>((a[c]?r:o)(l),a[c]))};return s.some(K)?Promise.all(s).then(u):u(s)}var pt=new Set("+ - * / . .. \\ : % | ! ? # & $ ; , ( ) < > <= >= == === != !== { } [ ] = ~ ^".split(" ")),ht={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},U=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",G=e=>e>="0"&&e<="9",De=e=>e===" "||e===" "||e==="\r"||e===`
|
|
3
|
+
`,Me=e=>U(e)||G(e)||e==="-"||e==="_"||e===":",He=e=>U(e)||G(e)||e==="_"||e==="$";function fe(e,t=!1){let n=[],r=0,o=0,i=1,s="<START>",u=0,a=()=>e.charAt(r),l=p=>e.charAt(r+p),c=()=>(s=e.charAt(r++),s===`
|
|
4
|
+
`?(i++,o=0):o++,s),d=p=>({type:p,value:"",start:r,end:r+1,line:i,column:o}),m=(p,g)=>(p.value=g,p.end=r,p),f=p=>{let g="";for(;a()&&p(a());)g+=c();return g},h=()=>t&&u===0,y=()=>U(s)||G(s)||")\"'`}]".includes(s),v=(p,g)=>{let N=d(p),F=c();if(a()==="{"){if(N.template=!0,F+=c(),F+=f(sn=>sn!=="}"),a()!=="}")throw new Error("Unterminated "+(g?"class":"id")+" reference");let ge=c();g&&(F+=ge)}else if(g)for(;Me(a())||a()==="\\";)a()==="\\"&&c(),F+=c();else F+=f(Me);return m(N,F)},k=()=>{let p=d("STRING"),g=c();p.template=g==="`";let N="";for(;a()&&a()!==g;)if(a()==="\\"){c();let F=c();if(F in ht)N+=ht[F];else if(p.template&&F==="$")N+="\\$";else if(F==="x"){let ge=a()&&l(1)?parseInt(c()+c(),16):NaN;if(Number.isNaN(ge))throw new Error(`Invalid hexadecimal escape at [Line: ${p.line}, Column: ${p.column}]`);N+=String.fromCharCode(ge)}else N+=F}else N+=c();if(a()!==g)throw new Error(`Unterminated string at [Line: ${p.line}, Column: ${p.column}]`);return c(),m(p,N)},q=()=>{let p=d("IDENTIFIER"),g=c()+f(He);return a()==="!"&&g==="beep"&&(g+=c()),m(p,g)},R=()=>{let p=d("IDENTIFIER"),g=c(),N=g==="\\";for(N&&(g="");(He(a())||"\\{}".includes(a()||" "))&&!(a()==="$"&&!N);)a()==="\\"?(N=!0,c()):(N=!1,g+=c());return m(p,g)},C=()=>{let p=d("NUMBER"),g=c()+f(G);return a()==="."&&G(l(1))&&(g+=c()),g+=f(G),(a()==="e"||a()==="E")&&(G(l(1))?g+=c():l(1)==="-"&&(g+=c()+c())),m(p,g+f(G))},O=()=>{let p=d("OP");p.op=!0;let g=c();for(;a()&&pt.has(g+a());)g+=c();return m(p,g)},_=()=>{let p=d("ATTRIBUTE_REF"),g=c();return g==="["?(g+=f(N=>N!=="]"),a()==="]"&&(g+=c())):(g+=f(Me),a()==="="&&(g+=c(),a()==='"'||a()==="'"?g+=k().value:He(a())&&(g+=q().value))),m(p,g)},Z=()=>{let p=n.at(-1);return p?p.type==="IDENTIFIER"||p.type==="CLASS_REF"||p.type==="ID_REF"?!1:!(p.op&&(p.value===">"||p.value===")")):!0},X=()=>{let p=a(),g=l(2);return(p==="-"||p==="/")&&l(1)===p&&(De(g)||g===""||g===p)};for(;r<e.length;){let p=a(),g=l(1);if(X())f(N=>N!=="\r"&&N!==`
|
|
5
|
+
`),c();else if(De(p))n.push(m(d("WHITESPACE"),f(De)));else if(!y()&&p==="."&&(U(g)||g==="{"||g==="-"))n.push(v("CLASS_REF",!0));else if(!y()&&p==="#"&&(U(g)||g==="{"))n.push(v("ID_REF",!1));else if(p==="@"||p==="["&&g==="@")n.push(_());else if(p==="*"&&U(g)){let N=d("STYLE_REF");n.push(m(N,c()+f(F=>U(F)||F==="-")))}else if(h()&&(U(p)||p==="\\"))n.push(R());else if(!h()&&(U(p)||p==="_"||p==="$"))n.push(q());else if(G(p))n.push(C());else if(!h()&&(p==='"'||p==="`"))n.push(k());else if(!h()&&p==="'")n.push(Z()?k():O());else if(pt.has(p))s==="$"&&p==="{"&&u++,p==="}"&&u--,n.push(O());else if(h()||p==="`"){let N=d("RESERVED");n.push(m(N,c()))}else throw new Error("Unknown token: "+p+" ")}return n}function E(e){return e.match("the"),ln(e)}function ln(e){let t=yt(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=fn(o.value,t,yt(e));return t}function fn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>T(t.ev(o),i=>!!i===r?i:n.ev(o))}}var dn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function je(e){let t=Ue(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=Ue(e),u=dn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>I([i.ev(l),s.ev(l)],([c,d])=>u(c,d))}}return t}function Ue(e){let t=Y(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function Y(e){e.match("the");let t=e.pos();if(e.match("not"))return Ge(e,"logicalNot",t,Y(e),n=>!n);if(e.match("no"))return Ge(e,"noExpression",t,Ue(e),_e);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return pn(e)}function Ge(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>T(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var mn="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function pn(e){let t=Et(e),n=e.matchAny(...mn)??e.matchOp("%");if(n)return gt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return gt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function gt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>T(n.ev(s),o)};return n.stat&&(i.stat=()=>o(de(n))),i}function Et(e){let t=e.pos();return e.matchOp("-")?Ge(e,"negativeNumber",t,Et(e),n=>-b(n)):xt(e)}function xt(e){let t=bn(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function kt(e){return e.match("the"),hn(e,xt(e))}function hn(e,t){let n=gn(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function gn(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&yn(t.expr);)t=t.expr;return t}var yn=e=>$(w(e,"ev"));function de(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function wn(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function yt(e){let t=je(e),n=wn(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=je(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=je(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=f=>l&&typeof f=="string"?f.toLowerCase():f,d=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:f=>I([t.ev(f),u??s?.ev(f),a?.ev(f)],([h,y,v])=>{if(o){let k=st(h,o,i);return r==="a"?k:!k}if(d&&y===void 0&&(r==="is"||r==="is not")){let k=!!ie(h,d);return r==="is"?k:!k}return Tt(r,c(h),c(y),v)})}}function wt(e,t){let n=w(e,"contains")??w(e,"includes");if(!$(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function vn(e,t){let n=w(e,"match")??w(e,"matches");if(!$(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var vt=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function Tt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!Tt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&vn(t,n);case"in":return n!=null&&wt(n,t);case"contain":case"include":return t!=null&&wt(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return vt(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return vt(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return _e(t);case"exist":return ot(t)}throw new Error("Unknown comparison : "+e)}function bn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),$e("number",parseFloat(t.value),t);case"STRING":return kn(e);case"ID_REF":return Pn(e);case"CLASS_REF":return J(e);case"ATTRIBUTE_REF":return z(e);case"STYLE_REF":return St(e)}if(t.op){if(t.value==="(")return En(e);if(t.value==="[")return Tn(e);if(t.value==="{")return Rn(e);if(t.value==="<")return Sn(e)}let n=e.match("true")??e.match("false");if(n)return $e("boolean",n.value==="true",n);let r=e.match("null");if(r)return $e("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return Nn(e)}function $e(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function En(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>E(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var xn=(e,t)=>I(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function Rt(e,t){let n=e.child(fe(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,E(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function kn(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=Rt(e,n);r.ev=i=>xn(o,i)}else r.stat=()=>n;return r}function Tn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(E(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>I(n.map(o=>o.ev(r)),o=>o)}}function Rn(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(E(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(E(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>I([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function Nt(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Nn(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>E(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>lt(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,d,m)=>ft(s,c,a,m,l?.ev(c))}}var Pt=(e,t)=>{let n=t.value.substring(2);return E(e.child(fe(n),n))};function Pn(e){let t=e.consume(),n=(o,i)=>Fe(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>u&&ce(u,s))};if(t.template){let o=r.expr=Pt(e,t);r.ev=i=>T(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function J(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>T(n.ev(r),s=>ce(Array.from(s instanceof H?s:[]),i))};if(t.template){let r=n.expr=Pt(e,t);n.ev=o=>T(r.ev(o),i=>new H("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new H(r,o.me,!0)}return n}var We=class extends H{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>P(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(P);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Sn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new H(n,o.me),lhs:()=>{},put:(o,i,s)=>T(r.ev(o),u=>ce(Array.from(u instanceof H?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=Rt(e,n);r.ev=i=>I(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new We(i.me,s))}return r}function z(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>ae(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>ue(s.you||s.me,r,a)}}function St(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?be:ve)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ee(o.you||o.me,r,s)}}function Ct(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(E(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>I(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function me(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function Ot(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function ke(e,t="Expected event name"){return e.matchType("STRING")?.value??Ot(e)??e.err(t)}function D(e,t){return On(e,t)??In(e,t)??_n(e,t)??An(e,t)??Fn(e,t)??Ln(e,t)??qn(e,t)??Mn(e,t)??Cn(e,t)??t}function Cn(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function On(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ie(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),xe(s,n,u)},del:(i,s)=>{A(s,r),S(s,u=>{M(u)&&delete u[n],x.wroteProperty(u)})}};return D(e,o)}function In(e,t){if(!e.match("of"))return;let n=Y(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ie,attribute:ae,style:ve,computed:be}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:d=>T(c.root.ev(d),m=>l(m,u)),lhs:d=>c.root.ev(d),put:(d,m,f)=>{A(m,a),s==="attribute"?ue(m,u,f):s==="property"?xe(m,u,f):Ee(m,u,f)},del:(d,m)=>{A(m,a),S(m,f=>{s==="attribute"?P(f)&&f.removeAttribute(u):s==="property"?(M(f)&&delete f[u],x.wroteProperty(f)):f instanceof HTMLElement&&f.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function An(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=z(e)??St(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ie(l,i):o?.type==="attributeRef"?ae(l,o.name):o?.type==="computedStyleRef"?be(l,o.name):o&&ve(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>T(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,d)=>{A(c,s),i!==void 0?xe(c,i,d):o?.type==="attributeRef"?ue(c,o.name,d):o&&Ee(c,o.name,d)}};return D(e,a)}function Fn(e,t){if(!e.match("in"))return;let n=Y(e),r=(s,u)=>{if(s==null)return[];let a=[],l=w(s,"css");if(typeof l=="string")S(u,c=>P(c)&&a.push(...Le(c,l)));else if(P(s)){let c=!1;if(S(u,d=>{d instanceof Node&&d.contains(s)&&(c=!0)}),c)return s}else S(s,c=>S(u,d=>c===d&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>I([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>ce(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function Ln(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=Ot(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>T(s.root.ev(u),a=>it(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function qn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(E(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return I([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...d])=>{if(!l||a===void 0)return bt(c,void 0,d,s,r);A(c,o);let m=bt(w(c,a),c,d,s,r);return rt(c,a),m})}};return D(e,i)}function bt(e,t,n,r,o){if(!$(e))throw A(e,o),new Error(`'${o}' is not a function`);return w(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function _n(e,t){let n=z(e);return n&&Dn(e,t,n)}function Dn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>T(o.root.ev(i),s=>ae(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{A(s,r),ue(s,n.name,u)}};return o}function Mn(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=E(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=E(e))),e.reqOp("]");let s=e.text(t),u=(c,d)=>b(d)<0?b(w(c,"length"))+b(d):b(d),a=(c,d,m)=>{let f=w(c,"slice");return $(f)?Reflect.apply(f,c,[d,m]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>I([l.root.ev(c),r.ev(c),i?.ev(c)],([d,m,f])=>d==null?null:n?a(d,0,u(d,m)+1):o?f==null?a(d,b(m)):a(d,b(m),u(d,f)+1):w(d,String(m))),lhs:c=>I([l.root.ev(c),r.ev(c)],d=>d),put:(c,d,m)=>{let[f,h]=Array.isArray(d)?d:[];A(f,s),M(f)&&(f[String(h)]=m)},del:(c,d)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[m,f]=Array.isArray(d)?d:[];A(m,s),Array.isArray(m)?m.splice(u(m,f),1):M(m)&&delete m[String(f)],x.wroteProperty(m)}};return D(e,l)}function Ft(e){let t=J(e);if(!t)return;let n=[t];for(let r=J(e);r;r=J(e))n.push(r);return n}var Ve=(e,t)=>(e??[]).map(n=>T(n.ev(t),r=>String(w(r,"className")))),Hn=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),ze=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,It=(e,t,n,r,o)=>t?mt(e,t,n,i=>P(i)&&r(i),i=>P(i)&&o(i)):S(e,i=>P(i)&&r(i)),pe=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),Lt=(e,t,n,r,o,i)=>i?It(t,n,r,s=>pe(s,i,e),s=>pe(s,i,!e)):I(o.map(s=>It(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function qt(e){let t=Ft(e),n=t?void 0:z(e);return{refs:t,attribute:n,css:t||n?void 0:Ct(e)}}function _t(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=qt(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>E(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?E(t):me(t),l=t.match("when")?E(t):void 0,c=o||i?l:void 0,d=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:f=>I([a.ev(f),s?.ev(f),u?.ev(f),...Ve(o,f)],([h,y,v,...k])=>{if(A(h,d),u){if(Array.isArray(h))h.push(v);else if(h instanceof Set)h.add(v);else throw h instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof h);x.wroteProperty(h)}else if(s)S(h,q=>{let R=ze(q);R&&(R.cssText+=y)});else return Lt(!0,h,c,f,k,i)})}}}var jn=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Dt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=qt(t),u=o||i||s?void 0:E(t),a=t.match("from")?E(t):u?void 0:me(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=E(t));let c=a?t.text(a):"",d=u?t.text(u):"",m=(h,y,v)=>{if(v==null&&u?.del&&u.lhs&&!jn(y)){let k=u;return T(u.lhs(h),q=>k.del?.(h,q))}if(A(y,d),Array.isArray(v)){let k=v.indexOf(y);k>-1&&v.splice(k,1),x.wroteProperty(v)}else v instanceof Set||v instanceof Map?(v.delete(y),x.wroteProperty(v)):S(y,k=>{P(k)&&k.parentElement&&(v==null||v instanceof Node&&v.contains(k))&&k.parentElement.removeChild(k)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:h=>I([a?.ev(h),s?.ev(h),u?.ev(h),...Ve(o,h)],([y,v,k,...q])=>{if(u)return m(h,k,y);if(A(y,c),s){let R=Hn(String(v));S(y,C=>R.forEach(O=>ze(C)?.removeProperty(O)))}else return Lt(!1,y,l,h,q,i)})}}}var At=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},Mt={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=V(t);n?t.style.display=n:e==="toggle"?Mt.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:At("visibility","hidden","visible"),opacity:At("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function $n(e,t){let n=t??Q.defaultHideShowStrategy??"display";return Q.hideShowStrategies[n]??Mt[n]??e.err("Unknown show/hide strategy : "+n)}function Ht(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let y=o.styleProp=t.consume().value.slice(1);i=$n(t,y),o.on=t.match("of")?t.withFollow(["with","between"],()=>E(t)):me(t)}else if(t.match("between")){let y=J(t);if(y)t.req("and"),o.between=[y,J(t)??t.err("Expected classRef")];else{let v=z(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[v,z(t)??t.err("Expected attributeRef")]}}else!(o.classRefs=Ft(t))&&!(o.attributeRef=z(t))&&(o.target=t.withFollow(["between"],()=>kt(t)));if(!o.styleProp&&!o.target&&(o.on=t.match("on")?E(t):me(t)),t.match("between")){let y=o.betweenValues=t.withFollow(["and"],()=>{let v=[E(t)];for(;t.matchOp(",");)v.push(E(t));return v});t.req("and"),y.push(E(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=E(t)):t.match("until")&&(o.until=ke(t),t.match("from")&&(o.from=E(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:d}=o,m=s?t.text(s):"",f=(y,v)=>y[(y.findIndex(k=>k==v)+1)%y.length],h=(y,v,k,q)=>{if(a&&u?.lhs&&u.put){let R=u;return I([u.ev(y),u.lhs(y)],([C,O])=>R.put?.(y,O,f(k,C)))}if(a&&d)return S(v,R=>{let C=ze(R);if(!C||!P(R))return;let O=C.getPropertyValue(d)||getComputedStyle(R).getPropertyValue(d);C.setProperty(d,String(f(k,O)))});A(v,m),S(v,R=>{if(P(R))if(i)R instanceof HTMLElement&&i("toggle",R);else if(l){let[C,O]=l;if(C.type==="classRef"&&O.type==="classRef"){let[_,Z]=[String(C.className),String(O.className)],X=R.classList.contains(_);R.classList.toggle(_,!X),R.classList.toggle(Z,X)}else if(C.type==="attributeRef"&&O.type==="attributeRef"){let _=R.getAttribute(C.name)===String(C.value);pe(R,_?C:O,!1),pe(R,_?O:C,!0)}}else c?pe(R,c,!R.hasAttribute(c.name)):q.forEach(C=>R.classList.toggle(String(C)))})};return o.run=y=>I([s?.ev(y),o.time?.ev(y),o.from?.ev(y),I((a??[]).map(v=>v.ev(y)),v=>v),...Ve(o.classRefs,y)],([v,k,q,R,...C])=>{let O=()=>h(y,v,Array.isArray(R)?R:[],C);if(o.time)return new Promise(_=>{O(),setTimeout(()=>{O(),_()},b(k))});if(o.until){let _=o.until,Z=q||y.me;return new Promise(X=>{B(Z)&&Z.addEventListener(_,()=>{O(),X()},{once:!0}),O()})}return T(O(),()=>{})}),o}}var jt=new WeakSet;function $t(e){if(jt.has(e))return;jt.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let u=Un(s.sourceElement||o);if(!u)return;let a=Wn(u.value,u.scopeElt),l=s.request?.body;if(l instanceof FormData)for(let c in a)l.set(c,a[c])}}))}function Un(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var Re=e=>e&&W(e)?.scopes?.elementScope||{};function Te(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function Gn(e,t){for(let n=t;n;n=n.parentElement){let r=Re(n);if(e in r)return r[e]}}function Wn(e,t){let n={},r=e.trim();if(r==="*"){let o=Re(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Te(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=Re(t);o in i&&(n[o.slice(1)]=Te(i[o]))}else if(o[0]==="^"){let i=Gn(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Te(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=Re(document.querySelector(o.slice(0,i))),u=o.slice(i+1);":"+u in s&&(n[u]=Te(s[":"+u]))}}}return n}var j=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},Ut=()=>({commands:Object.create(null),fallbacks:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Ne=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}mark(){return{i:this.i,last:this.last,follows:this.follows.length}}reset(t){this.i=t.i,this.last=t.last,this.follows.length=t.follows}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new j(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function Be(e){let t=e.source.split(`
|
|
6
6
|
`),n=e.token.line?e.token.line-1:t.length-1,r=t[n]??"",o=e.token.line?e.token.column:Math.max(0,r.length-1),i=String(n+1).length,s=" ".repeat(i+5+o);return` ${n+1} | ${r}
|
|
7
7
|
`+s+"^".repeat(Math.max(1,e.token.value.length))+`
|
|
8
8
|
`+s+e.message+`
|
|
9
|
-
`}function
|
|
9
|
+
`}function Vn(e,t,n,r){let o=e.g.fallbacks[n];if(!o)return t(e,n,r);let i=e.mark();try{return t(e,n,r)}catch(s){if(!(s instanceof j))throw s;let u=s;for(let a of o){e.reset(i);try{let l=a(e,n,r);if(l&&e.pos()>=s.token.start)return l}catch(l){if(!(l instanceof j))throw l;l.token.start>u.token.start&&(u=l)}}throw u}}function Gt(e){let t=e.pos();if(e.matchOp("(")){let a=Gt(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&Vn(e,r,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=E(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>T(s.ev(a),l=>l?void 0:i.run(a))}}function te(e){let t=[];for(;e.hasMore();){let n=Gt(e);if(!n)break;t.push(n),e.match("then")}return t}function Wt(e){let t=e.pos();if(e.matchOp("(")){let o=Wt(e);return e.reqOp(")"),o}let n=e.cur(),r=e.g.features[n.value];return!r||!e.match(n.value)?e.err("Expected feature"):r(e,t)}function Qe(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Wt(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function Vt(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=te(e)),e.match("finally")&&(t.finallyHandler=te(e)),t}function zt(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}var Yt=Ut(),Bt=new Set,Je=new Set;function Ke(...e){let t=e.filter(n=>!Bt.has(n));for(let n of t)Bt.add(n),n(Yt);if(t.length)for(let n of[...Je])Je.delete(n),n.isConnected&&(Ae(n),Ze(n))}var Jt=e=>new Ne(Yt,fe(e),e);function zn(e){let t=Jt(e),n=Qe(t);return t.hasMore()&&t.err(),n}function Zt(e){let t=Jt(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:te(t)}:t.featureStart(n)?{kind:"features",program:Qe(t)}:{kind:"expression",expression:E(t)};return t.hasMore()&&t.err(),r}function Qt(e,t){let n;try{n=Zt(e)}catch(i){throw i instanceof j?new Error(i.message+`
|
|
10
10
|
|
|
11
|
-
`+Be(i)):i}let r=document.body;if(n.kind==="features"){for(let i of n.program.features)i.install(r,r);return}let o=Object.assign(le(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):T(ee(n.commands,o),i=>{let s=
|
|
11
|
+
`+Be(i)):i}let r=document.body;if(n.kind==="features"){for(let i of n.program.features)i.install(r,r);return}let o=Object.assign(le(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):T(ee(n.commands,o),i=>{let s=w(i,"k")==="return"?w(i,"value"):void 0;return s!==void 0?s:o.result})}var Xt=()=>Q.attributes.replaceAll(" ","").split(","),Kt=e=>e instanceof HTMLScriptElement&&e.type==="text/hyperscript";function Bn(e){for(let t of Xt())if(e.hasAttribute(t))return e.getAttribute(t);return Kt(e)?e.innerText:null}var Qn=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t},en=[];function Ze(e){if(e.closest(Q.disableSelector))return;let t=Bn(e);if(!t)return;let n=Qn(t);if(W(e)?.initialized){if(W(e)?.scriptHash===n)return se.enter(e);Pe(e)}if(!L(e,"hyperscript:before:init"))return;Object.assign(V(e),{initialized:!0,scriptHash:n});let r=Kt(e)?document.body:e,o=t;try{for(let s of en)o=s(o,e)??o;let{features:i}=zn(o);se.enter(e);for(let s of i)s.install(r,e);e.setAttribute("data-hyperscript-powered","true"),L(e,"hyperscript:after:init"),setTimeout(()=>L(r,"load",{hyperscript:!0}),1)}catch(i){if(i instanceof j){Je.add(e),o!==t&&(i.written=t),L(e,"hyperscript:parse-error",{errors:[i]});let s=i.written?`
|
|
12
12
|
rewritten from: ${i.written}
|
|
13
13
|
`:"";console.error("hyperscript: 1 parse error(s) on:",e,`
|
|
14
14
|
|
|
15
15
|
`+Be(i)+s)}else L(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
|
|
16
16
|
|
|
17
|
-
`,i)}}var
|
|
17
|
+
`,i)}}var tn=[],nn=[],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 tn)n(e);let t=Xt().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&Ze(e),e.querySelectorAll(t).forEach(Ze);for(let n of nn)n(e)}finally{Ye.delete(e)}}}function Pe(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(Pe),L(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),Ae(e)}}se.process=he;function Yn(e){try{let t=Zt(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 Xe=Object.assign(Qt,{config:Object.assign(Q,{conversions:Object.assign(Ce,{dynamicResolvers:Oe})}),use(e){e(Xe)},addBeforeProcessHook:e=>void tn.push(e),addAfterProcessHook:e=>void nn.push(e),addSourceTransform:e=>void en.push(e),register:Ke,extensions:new Set,evaluate:Qt,parse:Yn,process:he,processNode:he,cleanup:Pe,internals:{runtime:{cleanup:Pe,processNode:he}},version:"7.6.0"});function rn(){if(Object.assign(globalThis,{_hyperscript:Xe}),typeof document>"u")return;let e=()=>{he(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),$t(Xe)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function Jn(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 et(e,t){let n=Jn(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(()=>et(i,t),1),o){let{error:s}=o;console.error(w(s,"message")??s),console.error(w(s,"stack")),L(e.me,"exception",{error:s})}};oe(()=>T(dt(e,t.body,t),()=>r()),o=>r({error:o}))}function Zn(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:v}=h.contentRect;L(l,c,{width:y,height:v,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=w(m,h);y!==void 0?f.locals[h]=y:f.detail!=null&&(f.locals[h]=w(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(()=>et(f,e),s.debounceTime));return}if(s.throttleTime){if(u.lastExec&&Date.now()<u.lastExec+s.throttleTime)return;u.lastExec=Date.now()}et(f,e)}};l.addEventListener(c,d),r.push({target:l,event:c,handler:d})})}}function Xn(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 Kn(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=Nt(e):e.match("threshold")?t.threshold=Number(de(E(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function er(e,t){let n=ke(e),r=zt(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=Kn(e):n==="mutation"&&(a.mutationSpec=Xn(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=Y(e));let l=()=>(e.req("at"),Number(de(Y(e))));return e.match("debounced")?a.debounceTime=l():e.match("throttled")&&(a.throttleTime=l()),a}function on(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(er(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,...Vt(t),start:n,end:t.endPos(),install:l=>Zn(a,l)};return a}}Ke(on,_t,Dt,Ht);rn();})();
|