@bigmistqke/workpad 0.0.0-stage → 0.18.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/LICENSE +21 -0
- package/README.md +781 -2
- package/bin/workpad.ts +1509 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/workpad.js +1190 -0
- package/dist/client/runtime.js +1194 -0
- package/dist/define.js +27 -0
- package/dist/plugins/alert/README.md +18 -0
- package/dist/plugins/alert/index.js +40 -0
- package/dist/plugins/alert/public/style.css +40 -0
- package/dist/plugins/ansi/README.md +36 -0
- package/dist/plugins/ansi/index.js +63 -0
- package/dist/plugins/ansi/public/style.css +28 -0
- package/dist/plugins/badge/README.md +32 -0
- package/dist/plugins/badge/index.js +28 -0
- package/dist/plugins/badge/public/style.css +30 -0
- package/dist/plugins/chat/README.md +81 -0
- package/dist/plugins/chat/index.js +96 -0
- package/dist/plugins/chat/public/client.js +3 -0
- package/dist/plugins/chat/public/style.css +143 -0
- package/dist/plugins/claude/README.md +116 -0
- package/dist/plugins/claude/channel.js +130 -0
- package/dist/plugins/claude/doctor.js +316 -0
- package/dist/plugins/claude/index.js +199 -0
- package/dist/plugins/claude/session.js +68 -0
- package/dist/plugins/code/README.md +54 -0
- package/dist/plugins/code/diff.js +75 -0
- package/dist/plugins/code/index.js +105 -0
- package/dist/plugins/code/public/client.js +1 -0
- package/dist/plugins/code/public/style.css +99 -0
- package/dist/plugins/comments/README.md +30 -0
- package/dist/plugins/comments/index.js +39 -0
- package/dist/plugins/comments/public/client.js +24 -0
- package/dist/plugins/comments/public/style.css +224 -0
- package/dist/plugins/details/README.md +24 -0
- package/dist/plugins/details/index.js +28 -0
- package/dist/plugins/details/public/style.css +7 -0
- package/dist/plugins/draft/README.md +14 -0
- package/dist/plugins/draft/index.js +27 -0
- package/dist/plugins/draft/public/style.css +21 -0
- package/dist/plugins/forge/README.md +22 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +126 -0
- package/dist/plugins/form/index.js +179 -0
- package/dist/plugins/form/public/style.css +172 -0
- package/dist/plugins/grid/README.md +45 -0
- package/dist/plugins/grid/index.js +35 -0
- package/dist/plugins/grid/public/style.css +98 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/index.js +49 -0
- package/dist/plugins/iframe/public/style.css +28 -0
- package/dist/plugins/index.js +44 -0
- package/dist/plugins/lightbox/README.md +24 -0
- package/dist/plugins/lightbox/index.js +20 -0
- package/dist/plugins/lightbox/public/client.js +4 -0
- package/dist/plugins/lightbox/public/style.css +66 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +42 -0
- package/dist/plugins/mermaid/public/style.css +21 -0
- package/dist/plugins/opencode/README.md +48 -0
- package/dist/plugins/opencode/channel.js +92 -0
- package/dist/plugins/opencode/index.js +64 -0
- package/dist/plugins/opencode/shim.js +150 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +23 -0
- package/dist/plugins/tabs/README.md +44 -0
- package/dist/plugins/tabs/index.js +75 -0
- package/dist/plugins/tabs/public/client.js +1 -0
- package/dist/plugins/tabs/public/style.css +98 -0
- package/dist/plugins/terminal/README.md +63 -0
- package/dist/plugins/terminal/host.js +338 -0
- package/dist/plugins/terminal/index.js +170 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/public/client.js +41 -0
- package/dist/plugins/terminal/public/style.css +511 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +58 -0
- package/dist/plugins/timeline/README.md +48 -0
- package/dist/plugins/timeline/index.js +83 -0
- package/dist/plugins/timeline/public/style.css +138 -0
- package/dist/plugins/toc/README.md +40 -0
- package/dist/plugins/toc/index.js +29 -0
- package/dist/plugins/toc/public/client.js +1 -0
- package/dist/plugins/toc/public/style.css +117 -0
- package/dist/plugins/window/README.md +51 -0
- package/dist/plugins/window/index.js +91 -0
- package/dist/solid/index.js +41 -0
- package/dist/src/agents.js +81 -0
- package/dist/src/anchors.js +52 -0
- package/dist/src/api.js +282 -0
- package/dist/src/archive.js +49 -0
- package/dist/src/auth.js +67 -0
- package/dist/src/build.js +159 -0
- package/dist/src/client/page/base.css +1762 -0
- package/dist/src/client/page/main.js +2098 -0
- package/dist/src/config.js +76 -0
- package/dist/src/document.js +93 -0
- package/dist/src/entries.js +264 -0
- package/dist/src/events.js +322 -0
- package/dist/src/files.js +47 -0
- package/dist/src/formstate.js +65 -0
- package/dist/src/help.js +211 -0
- package/dist/src/html.js +34 -0
- package/dist/src/hub.js +341 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/listen.js +132 -0
- package/dist/src/listeners.js +64 -0
- package/dist/src/load.js +81 -0
- package/dist/src/loader.js +179 -0
- package/dist/src/migrate.js +314 -0
- package/dist/src/package.js +52 -0
- package/dist/src/pages/blocks.js +67 -0
- package/dist/src/pages/board.js +59 -0
- package/dist/src/pages/index.js +27 -0
- package/dist/src/pages/markdown.js +863 -0
- package/dist/src/pages/render.js +665 -0
- package/dist/src/pages/window.js +29 -0
- package/dist/src/plugins.js +283 -0
- package/dist/src/public.js +24 -0
- package/dist/src/rename.js +130 -0
- package/dist/src/running.js +146 -0
- package/dist/src/serve.js +188 -0
- package/dist/src/server.js +1105 -0
- package/dist/src/site.js +179 -0
- package/dist/src/state.js +155 -0
- package/dist/src/status.js +323 -0
- package/dist/src/thread.js +68 -0
- package/dist/src/watchdog.js +38 -0
- package/dist/src/ws.js +128 -0
- package/package.json +154 -4
- package/plugins/README.md +304 -0
- package/plugins/alert/README.md +18 -0
- package/plugins/alert/index.ts +50 -0
- package/plugins/alert/public/style.css +40 -0
- package/plugins/ansi/README.md +36 -0
- package/plugins/ansi/index.ts +95 -0
- package/plugins/ansi/public/style.css +28 -0
- package/plugins/badge/README.md +32 -0
- package/plugins/badge/index.ts +36 -0
- package/plugins/badge/public/style.css +30 -0
- package/plugins/chat/README.md +81 -0
- package/plugins/chat/autosize.ts +139 -0
- package/plugins/chat/client.tsx +187 -0
- package/plugins/chat/index.ts +146 -0
- package/plugins/chat/public/style.css +143 -0
- package/plugins/claude/README.md +116 -0
- package/plugins/claude/channel.ts +136 -0
- package/plugins/claude/doctor.ts +274 -0
- package/plugins/claude/index.ts +248 -0
- package/plugins/claude/session.ts +70 -0
- package/plugins/code/README.md +54 -0
- package/plugins/code/client.ts +73 -0
- package/plugins/code/diff.ts +96 -0
- package/plugins/code/index.ts +136 -0
- package/plugins/code/public/style.css +99 -0
- package/plugins/comments/README.md +30 -0
- package/plugins/comments/client.ts +723 -0
- package/plugins/comments/index.ts +48 -0
- package/plugins/comments/public/style.css +224 -0
- package/plugins/details/README.md +24 -0
- package/plugins/details/index.ts +30 -0
- package/plugins/details/public/style.css +7 -0
- package/plugins/draft/README.md +14 -0
- package/plugins/draft/index.ts +23 -0
- package/plugins/draft/public/style.css +21 -0
- package/plugins/forge/README.md +22 -0
- package/plugins/forge/index.ts +84 -0
- package/plugins/form/README.md +126 -0
- package/plugins/form/index.ts +199 -0
- package/plugins/form/public/style.css +172 -0
- package/plugins/grid/README.md +45 -0
- package/plugins/grid/index.ts +41 -0
- package/plugins/grid/public/style.css +98 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/index.ts +53 -0
- package/plugins/iframe/public/style.css +28 -0
- package/plugins/index.ts +49 -0
- package/plugins/lightbox/README.md +24 -0
- package/plugins/lightbox/client.ts +109 -0
- package/plugins/lightbox/index.ts +25 -0
- package/plugins/lightbox/public/style.css +66 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +46 -0
- package/plugins/mermaid/public/style.css +21 -0
- package/plugins/opencode/README.md +48 -0
- package/plugins/opencode/channel.ts +112 -0
- package/plugins/opencode/index.ts +91 -0
- package/plugins/opencode/shim.ts +166 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +28 -0
- package/plugins/tabs/README.md +44 -0
- package/plugins/tabs/client.ts +96 -0
- package/plugins/tabs/index.ts +103 -0
- package/plugins/tabs/public/style.css +98 -0
- package/plugins/terminal/README.md +63 -0
- package/plugins/terminal/client.ts +391 -0
- package/plugins/terminal/host.ts +434 -0
- package/plugins/terminal/index.ts +199 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/public/style.css +225 -0
- package/plugins/terminal/server.ts +266 -0
- package/plugins/terminal/sizes.ts +72 -0
- package/plugins/timeline/README.md +48 -0
- package/plugins/timeline/index.ts +82 -0
- package/plugins/timeline/public/style.css +138 -0
- package/plugins/toc/README.md +40 -0
- package/plugins/toc/client.ts +236 -0
- package/plugins/toc/index.ts +55 -0
- package/plugins/toc/public/style.css +117 -0
- package/plugins/window/README.md +51 -0
- package/plugins/window/index.ts +92 -0
- package/skills/workpad/SKILL.md +588 -0
- package/solid/index.tsx +80 -0
- package/src/agents.ts +133 -0
- package/src/anchors.ts +85 -0
- package/src/api.ts +444 -0
- package/src/archive.ts +75 -0
- package/src/auth.ts +99 -0
- package/src/build.ts +213 -0
- package/src/client/base.ts +19 -0
- package/src/client/forms.ts +420 -0
- package/src/client/markdown.ts +147 -0
- package/src/client/page/base.css +1762 -0
- package/src/client/page/board.ts +137 -0
- package/src/client/page/elsewhere.ts +153 -0
- package/src/client/page/fresh.ts +343 -0
- package/src/client/page/heading-link.ts +32 -0
- package/src/client/page/live.ts +134 -0
- package/src/client/page/main.ts +398 -0
- package/src/client/page/orphans.ts +64 -0
- package/src/client/page/place.ts +260 -0
- package/src/client/page/sort.ts +49 -0
- package/src/client/page/sticky.ts +58 -0
- package/src/client/page/theme.ts +36 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +278 -0
- package/src/client/page/window.ts +40 -0
- package/src/client/reactive.ts +19 -0
- package/src/client/read.ts +111 -0
- package/src/client/runtime.ts +499 -0
- package/src/client/scroll.ts +90 -0
- package/src/client/toast.ts +99 -0
- package/src/config.ts +111 -0
- package/src/define.ts +997 -0
- package/src/document.ts +191 -0
- package/src/entries.ts +352 -0
- package/src/events.ts +463 -0
- package/src/files.ts +74 -0
- package/src/formstate.ts +72 -0
- package/src/help.ts +238 -0
- package/src/html.ts +44 -0
- package/src/hub.ts +426 -0
- package/src/icons.ts +18 -0
- package/src/listen.ts +171 -0
- package/src/listeners.ts +89 -0
- package/src/load.ts +113 -0
- package/src/loader.ts +227 -0
- package/src/migrate.ts +352 -0
- package/src/package.ts +62 -0
- package/src/pages/blocks.ts +106 -0
- package/src/pages/board.ts +89 -0
- package/src/pages/index.ts +79 -0
- package/src/pages/markdown.ts +976 -0
- package/src/pages/render.ts +748 -0
- package/src/pages/window.ts +69 -0
- package/src/plugins.ts +319 -0
- package/src/public.ts +39 -0
- package/src/rename.ts +147 -0
- package/src/running.ts +171 -0
- package/src/serve.ts +221 -0
- package/src/server.ts +1385 -0
- package/src/site.ts +170 -0
- package/src/state.ts +327 -0
- package/src/status.ts +466 -0
- package/src/thread.ts +98 -0
- package/src/watchdog.ts +53 -0
- package/src/ws.ts +155 -0
package/dist/define.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Html, escape, html, raw } from "./src/html.js";
|
|
2
|
+
import { windowFrame } from "./src/pages/window.js";
|
|
3
|
+
import { anchorTaken, slugText } from "./src/anchors.js";
|
|
4
|
+
// src/define.ts
|
|
5
|
+
const defineConfig = (config) => config;
|
|
6
|
+
/**
|
|
7
|
+
* A plugin, with its public folder defaulted to `public/` next to the module that calls this
|
|
8
|
+
* (found from the call stack), when it doesn't say one.
|
|
9
|
+
*/
|
|
10
|
+
const definePlugin = (plugin) => plugin.public != null ? plugin : {
|
|
11
|
+
...plugin,
|
|
12
|
+
public: callerPublic()
|
|
13
|
+
};
|
|
14
|
+
/** `public/` next to the module that called definePlugin: the first frame of the stack in another file. */
|
|
15
|
+
function callerPublic() {
|
|
16
|
+
const own = import.meta.url;
|
|
17
|
+
for (const line of ((/* @__PURE__ */ new Error()).stack ?? "").split("\n").slice(1)) {
|
|
18
|
+
const m = /(file:\/\/[^\s)]+?|\/[^\s():]+?):\d+:\d+/.exec(line);
|
|
19
|
+
if (!m) continue;
|
|
20
|
+
const url = m[1].startsWith("file:") ? m[1] : `file://${m[1]}`;
|
|
21
|
+
if (url === own) continue;
|
|
22
|
+
return new URL("./public/", url);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** A block with typed props, for one written apart from its plugin. */
|
|
26
|
+
const defineBlock = (block) => block;
|
|
27
|
+
export { Html, anchorTaken, defineBlock, defineConfig, definePlugin, escape, html, raw, slugText, windowFrame };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
A highlighted box, written the way GitHub, Obsidian and most markdown tools
|
|
2
|
+
already write it: a quote that starts with its type. A title can follow the
|
|
3
|
+
type (as in Obsidian); without one, the box is named after its type.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
> [!WARNING] Heads up
|
|
7
|
+
> Solid 2 is a release candidate; APIs can still move.
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
> [!WARNING] Heads up
|
|
11
|
+
> Solid 2 is a release candidate; APIs can still move.
|
|
12
|
+
|
|
13
|
+
The types: GitHub's `NOTE`, `TIP`, `IMPORTANT`, `WARNING` and `CAUTION`, and
|
|
14
|
+
Obsidian's `SUCCESS`, `DANGER` and `QUESTION`, in any case (`[!tip]`). Any
|
|
15
|
+
other type is a quote like any other, as on GitHub.
|
|
16
|
+
|
|
17
|
+
The quote's lines are any markdown: a list, code, a diagram, other blocks,
|
|
18
|
+
each line behind `> `.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { builtinPublic } from "../../src/package.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { definePlugin, html, raw } from "@bigmistqke/workpad";
|
|
4
|
+
// plugins/alert/index.ts
|
|
5
|
+
/** The types, and what a box without a title of its own is called. */
|
|
6
|
+
const TYPES = {
|
|
7
|
+
note: "Note",
|
|
8
|
+
tip: "Tip",
|
|
9
|
+
important: "Important",
|
|
10
|
+
warning: "Warning",
|
|
11
|
+
caution: "Caution",
|
|
12
|
+
success: "Success",
|
|
13
|
+
danger: "Danger",
|
|
14
|
+
question: "Question"
|
|
15
|
+
};
|
|
16
|
+
async function render(ctx) {
|
|
17
|
+
const type = String(ctx.attrs.type ?? "");
|
|
18
|
+
const content = raw(await ctx.toHtml(ctx.children));
|
|
19
|
+
if (!TYPES[type]) return html`<blockquote><p>[!${type.toUpperCase()}]${ctx.label ? html` ${raw(ctx.label)}` : ""}</p>${content}</blockquote>`;
|
|
20
|
+
const title = ctx.label ? raw(ctx.label) : TYPES[type];
|
|
21
|
+
return html`<aside class="wp-alert" data-type="${type}"><div class="wp-alert-title">${title}</div>${content}</aside>`;
|
|
22
|
+
}
|
|
23
|
+
function alert() {
|
|
24
|
+
return definePlugin({
|
|
25
|
+
name: "alert",
|
|
26
|
+
public: builtinPublic("alert"),
|
|
27
|
+
blocks: { alert: {
|
|
28
|
+
menu: {
|
|
29
|
+
group: "mark",
|
|
30
|
+
summary: "a box that stands out: > [!NOTE], [!TIP], [!WARNING]"
|
|
31
|
+
},
|
|
32
|
+
attrs: ["type"],
|
|
33
|
+
alert: true,
|
|
34
|
+
html: render,
|
|
35
|
+
style: "style.css"
|
|
36
|
+
} },
|
|
37
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8")
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { alert as default, render };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* an alert (index.ts): a coloured rule and a light tint, set in the body face */
|
|
2
|
+
.wp-alert {
|
|
3
|
+
--c: var(--info);
|
|
4
|
+
margin: var(--gap-block) 0;
|
|
5
|
+
padding: 1em 1.3em;
|
|
6
|
+
border-left: 3px solid var(--c);
|
|
7
|
+
background: color-mix(in srgb, var(--c) var(--tint-faint), var(--bg));
|
|
8
|
+
border-radius: 0 var(--radius) var(--radius) 0;
|
|
9
|
+
}
|
|
10
|
+
/* alerts in a row read as a group */
|
|
11
|
+
.wp-alert:has(+ .wp-alert) {
|
|
12
|
+
margin-bottom: var(--gap-group);
|
|
13
|
+
}
|
|
14
|
+
.wp-alert + .wp-alert {
|
|
15
|
+
margin-top: var(--gap-group);
|
|
16
|
+
}
|
|
17
|
+
.wp-alert > :first-child {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
.wp-alert > :last-child {
|
|
21
|
+
margin-bottom: 0;
|
|
22
|
+
}
|
|
23
|
+
.wp-alert-title {
|
|
24
|
+
font: var(--weight-strong) var(--ui-small)/var(--ui-line-height) var(--sans);
|
|
25
|
+
color: var(--c);
|
|
26
|
+
margin-bottom: var(--gap-attach);
|
|
27
|
+
letter-spacing: 0.01em;
|
|
28
|
+
}
|
|
29
|
+
.wp-alert:is([data-type='tip'], [data-type='success']) {
|
|
30
|
+
--c: var(--ok);
|
|
31
|
+
}
|
|
32
|
+
.wp-alert[data-type='important'] {
|
|
33
|
+
--c: var(--accent);
|
|
34
|
+
}
|
|
35
|
+
.wp-alert:is([data-type='warning'], [data-type='question']) {
|
|
36
|
+
--c: var(--warn);
|
|
37
|
+
}
|
|
38
|
+
.wp-alert:is([data-type='caution'], [data-type='danger']) {
|
|
39
|
+
--c: var(--bad);
|
|
40
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
What a program printed, as its terminal showed it: an `ansi` fence holds the
|
|
2
|
+
output with its escape codes, and the page draws it dark, in its colours, as a
|
|
3
|
+
terminal does. It goes through a terminal emulator on the server, so colours
|
|
4
|
+
(16, 256 and true colour, foreground and background), bold, dim and underline
|
|
5
|
+
show, and a progress line that a carriage return writes over shows as it
|
|
6
|
+
ended. It is plain HTML: nothing runs on the page, and `workpad build` keeps
|
|
7
|
+
it. Wide output scrolls sideways (a line wraps at 240 columns, as a terminal
|
|
8
|
+
that wide would).
|
|
9
|
+
|
|
10
|
+
````markdown
|
|
11
|
+
```ansi
|
|
12
|
+
\e[32m✔\e[0m parses a page
|
|
13
|
+
\e[31m✖\e[0m renders a diff \e[2m(12ms)\e[0m
|
|
14
|
+
```
|
|
15
|
+
````
|
|
16
|
+
|
|
17
|
+
```ansi
|
|
18
|
+
\e[32m✔\e[0m parses a page
|
|
19
|
+
\e[31m✖\e[0m renders a diff \e[2m(12ms)\e[0m
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The escape byte itself works, and so does any way of writing it out: `\e`,
|
|
23
|
+
`\x1b`, `\033`, `\u001b` or `^[`. A carriage return has to be the byte itself,
|
|
24
|
+
as a program prints it: `\r` written out stays as written, since it is as
|
|
25
|
+
likely a path (`C:\repo`). To capture a command's colours, have it colour
|
|
26
|
+
output that isn't a terminal (`--color=always`, `FORCE_COLOR=1`) and paste
|
|
27
|
+
what it printed.
|
|
28
|
+
|
|
29
|
+
In a window, as any block: `compose=window`, with `title` its label; its
|
|
30
|
+
button fills the browser window with it:
|
|
31
|
+
|
|
32
|
+
````markdown
|
|
33
|
+
```ansi {compose=window title="npm test"}
|
|
34
|
+
…
|
|
35
|
+
```
|
|
36
|
+
````
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { builtinPublic } from "../../src/package.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { definePlugin, html, raw } from "@bigmistqke/workpad";
|
|
4
|
+
import xtermHeadless from "@xterm/headless";
|
|
5
|
+
import xtermSerialize from "@xterm/addon-serialize";
|
|
6
|
+
// plugins/ansi/index.ts
|
|
7
|
+
const { Terminal } = xtermHeadless;
|
|
8
|
+
const { SerializeAddon } = xtermSerialize;
|
|
9
|
+
/** The widest a line is laid out before it wraps, as a terminal would. */
|
|
10
|
+
const MAX_COLS = 240;
|
|
11
|
+
const ESC = "\x1B";
|
|
12
|
+
/**
|
|
13
|
+
* Escapes written out as text count as escapes: an agent writing a page often can't put the ESC
|
|
14
|
+
* byte itself in a file, so `\e[31m`, `\x1b[31m`, `\033[31m`, `\u001b[31m` and `^[[31m` are one.
|
|
15
|
+
*/
|
|
16
|
+
const unescape = (text) => text.replace(/\\e(?=\[)|\\x1b|\\033|\\u001b|\^\[(?=\[)/gi, ESC);
|
|
17
|
+
/** How wide a line shows: its characters, without its escape sequences. */
|
|
18
|
+
const shown = (line) => [...line.replace(/\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-_]/g, "").split("\r").at(-1)].length;
|
|
19
|
+
/**
|
|
20
|
+
* What the text shows in a terminal as wide as its widest line (up to MAX_COLS), as HTML rows: the
|
|
21
|
+
* serializer's spans, colours inline, text escaped; trailing blank space and blank rows left out.
|
|
22
|
+
*/
|
|
23
|
+
async function toHtml(text) {
|
|
24
|
+
const input = unescape(text).replace(/\r?\n$/, "");
|
|
25
|
+
const lines = input.split(/\r?\n/);
|
|
26
|
+
const cols = Math.min(MAX_COLS, Math.max(20, ...lines.map(shown)));
|
|
27
|
+
const term = new Terminal({
|
|
28
|
+
cols,
|
|
29
|
+
rows: Math.max(1, lines.length),
|
|
30
|
+
scrollback: 1e5,
|
|
31
|
+
allowProposedApi: true,
|
|
32
|
+
convertEol: true
|
|
33
|
+
});
|
|
34
|
+
const serializer = new SerializeAddon();
|
|
35
|
+
term.loadAddon(serializer);
|
|
36
|
+
await new Promise((resolve) => term.write(input, resolve));
|
|
37
|
+
const out = serializer.serializeAsHTML({ includeGlobalBackground: false });
|
|
38
|
+
term.dispose();
|
|
39
|
+
const rows = [...(/<pre><div style='[^']*'>([\s\S]*)<\/div><\/pre>/.exec(out)?.[1] ?? "").matchAll(/<div>([\s\S]*?)<\/div>/g)].map((m) => m[1].replace(/<span><\/span>/g, "").replace(/<span> +<\/span>$/, "").replace(/(<span>[^<]*?) +(<\/span>)$/, "$1$2"));
|
|
40
|
+
while (rows.length && !rows.at(-1).replace(/<[^>]+>/g, "").trim()) rows.pop();
|
|
41
|
+
return rows.map((r) => `<span class="wp-ansi-row">${r}</span>`).join("\n");
|
|
42
|
+
}
|
|
43
|
+
async function render(ctx) {
|
|
44
|
+
return html`<pre class="wp-ansi"><code>${raw(await toHtml(ctx.text))}</code></pre>`;
|
|
45
|
+
}
|
|
46
|
+
function ansi() {
|
|
47
|
+
return definePlugin({
|
|
48
|
+
name: "ansi",
|
|
49
|
+
public: builtinPublic("ansi"),
|
|
50
|
+
blocks: { ansi: {
|
|
51
|
+
menu: {
|
|
52
|
+
group: "show",
|
|
53
|
+
summary: "a program's output, in its colours"
|
|
54
|
+
},
|
|
55
|
+
attrs: [],
|
|
56
|
+
fence: true,
|
|
57
|
+
html: render,
|
|
58
|
+
style: "style.css"
|
|
59
|
+
} },
|
|
60
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8")
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export { ansi as default, render, toHtml, unescape };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* Terminal output: dark as a terminal in either theme, since the colours in it are a terminal's
|
|
2
|
+
palette, written inline. Wide output scrolls sideways rather than wrapping. */
|
|
3
|
+
.wp-ansi {
|
|
4
|
+
margin: var(--gap-block) 0;
|
|
5
|
+
padding: 12px 16px;
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
background: #0f1115;
|
|
8
|
+
color: #d7dae0;
|
|
9
|
+
border-radius: var(--radius, 6px);
|
|
10
|
+
font: 0.82rem/1.45 var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
11
|
+
white-space: pre;
|
|
12
|
+
tab-size: 8;
|
|
13
|
+
}
|
|
14
|
+
.wp-ansi code {
|
|
15
|
+
font: inherit;
|
|
16
|
+
background: none;
|
|
17
|
+
padding: 0;
|
|
18
|
+
color: inherit;
|
|
19
|
+
}
|
|
20
|
+
/* in a window (title=, or compose=window) the terminal fills it, the frame its edge */
|
|
21
|
+
.wp-window-body:has(> .wp-ansi:only-child) {
|
|
22
|
+
padding: 0;
|
|
23
|
+
background: #0f1115;
|
|
24
|
+
}
|
|
25
|
+
.wp-window-body > .wp-ansi {
|
|
26
|
+
margin: 0;
|
|
27
|
+
border-radius: 0;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
A status as a coloured dot and a word, inline wherever text goes: in a
|
|
2
|
+
heading, a table cell, a list item, a sentence. `done ok yes good` are
|
|
3
|
+
green, `active new info` blue, `open todo maybe warning` amber,
|
|
4
|
+
`blocked no bad error` red; any other word is grey.
|
|
5
|
+
|
|
6
|
+
```markdown
|
|
7
|
+
### Parser :badge[done]
|
|
8
|
+
|
|
9
|
+
| step | state |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| parse | :badge[done] |
|
|
12
|
+
| render | :badge[active] |
|
|
13
|
+
| docs | :badge[todo] |
|
|
14
|
+
|
|
15
|
+
The release is :badge[blocked] on review.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
A badge that ends a heading sits at its right edge: a page's heading, a grid
|
|
19
|
+
card's, a timeline step's. A block of your own can have the same for a title
|
|
20
|
+
that isn't a heading, with a `data-wp-title` attribute on it. A badge is not
|
|
21
|
+
in a heading's anchor, nor in an item's: `### Parser :badge[done]` is
|
|
22
|
+
`#parser`, so a link to it holds while the badge changes.
|
|
23
|
+
|
|
24
|
+
### Parser :badge[done]
|
|
25
|
+
|
|
26
|
+
| step | state |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| parse | :badge[done] |
|
|
29
|
+
| render | :badge[active] |
|
|
30
|
+
| docs | :badge[todo] |
|
|
31
|
+
|
|
32
|
+
The release is :badge[blocked] on review.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { builtinPublic } from "../../src/package.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { definePlugin, html, raw } from "@bigmistqke/workpad";
|
|
4
|
+
// plugins/badge/index.ts
|
|
5
|
+
/** The word a badge's colour is chosen by: its text, lowercased, runs of other characters a `-`. */
|
|
6
|
+
const tone = (s) => s.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
7
|
+
/** `:badge[done]`: a coloured dot and a word, inline wherever text goes. */
|
|
8
|
+
function render(ctx) {
|
|
9
|
+
const text = ctx.labelText?.trim();
|
|
10
|
+
if (!text) return html``;
|
|
11
|
+
return html`<span class="wp-badge" data-badge="${tone(text)}">${raw(ctx.label ?? "")}</span>`;
|
|
12
|
+
}
|
|
13
|
+
function badge() {
|
|
14
|
+
return definePlugin({
|
|
15
|
+
name: "badge",
|
|
16
|
+
public: builtinPublic("badge"),
|
|
17
|
+
blocks: { badge: {
|
|
18
|
+
menu: {
|
|
19
|
+
group: "mark",
|
|
20
|
+
summary: "a status in a word: done, todo, waiting"
|
|
21
|
+
},
|
|
22
|
+
html: render,
|
|
23
|
+
style: "style.css"
|
|
24
|
+
} },
|
|
25
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8")
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { badge as default, render, tone };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* a coloured dot and a word, not a pill */
|
|
2
|
+
.wp-badge {
|
|
3
|
+
--c: var(--muted);
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--space-sm);
|
|
7
|
+
font: 500 var(--ui-tiny)/1 var(--sans);
|
|
8
|
+
color: var(--muted);
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
vertical-align: 0.1em;
|
|
11
|
+
}
|
|
12
|
+
.wp-badge::before {
|
|
13
|
+
content: '';
|
|
14
|
+
width: 7px;
|
|
15
|
+
height: 7px;
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
background: var(--c);
|
|
18
|
+
}
|
|
19
|
+
.wp-badge:is([data-badge='done'], [data-badge='ok'], [data-badge='yes'], [data-badge='good']) {
|
|
20
|
+
--c: var(--ok);
|
|
21
|
+
}
|
|
22
|
+
.wp-badge:is([data-badge='active'], [data-badge='new'], [data-badge='info']) {
|
|
23
|
+
--c: var(--info);
|
|
24
|
+
}
|
|
25
|
+
.wp-badge:is([data-badge='open'], [data-badge='todo'], [data-badge='maybe'], [data-badge='warning']) {
|
|
26
|
+
--c: var(--warn);
|
|
27
|
+
}
|
|
28
|
+
.wp-badge:is([data-badge='blocked'], [data-badge='no'], [data-badge='bad'], [data-badge='error']) {
|
|
29
|
+
--c: var(--bad);
|
|
30
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
A chat between the reader and you: the reader types (Enter sends,
|
|
2
|
+
Shift+Enter starts a new line), you answer, the reader's messages on one side
|
|
3
|
+
and yours on the other. Every form has one under it, for questions about the
|
|
4
|
+
question; a `chat` block puts one anywhere, for talk that isn't about a form;
|
|
5
|
+
and every page ends with one, the chat `page`, for whatever is about none of
|
|
6
|
+
its questions. A page turns that one off with `plugins: { chat: false }` in
|
|
7
|
+
its frontmatter, a project with `chat({ page: false })` in its config, and a
|
|
8
|
+
page with a chat named `page` of its own keeps just that.
|
|
9
|
+
|
|
10
|
+
Your messages are small pages: write them as you write a page, with any
|
|
11
|
+
block (a form, a details, tabs, a diagram). The reader's are plain markdown:
|
|
12
|
+
what they type as `:::…` or `:button` shows as written.
|
|
13
|
+
|
|
14
|
+
A form in your message is a question like one on the page, named in its
|
|
15
|
+
chat: `:::form{name=scope}` in the chat `logger` is the form `logger/scope`,
|
|
16
|
+
its answers are events of that type, and a link to it is
|
|
17
|
+
`#form:logger/scope`. One without a name is numbered in the chat:
|
|
18
|
+
`logger/1`, `logger/2`. It has no chat of its own: the chat it is in is its
|
|
19
|
+
chat. A form on the page can't have a `/` in its name.
|
|
20
|
+
|
|
21
|
+
To rework a message (an option more, a typo), edit it in place:
|
|
22
|
+
`workpad edit <its id> --data '{"text":"…"}'`. It updates in the reader's
|
|
23
|
+
tab, marked new until they've seen it, and a form in it that keeps its name
|
|
24
|
+
keeps its answers.
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
:::chat{name=notes}
|
|
28
|
+
Anything about the plan that isn't a decision: write it here.
|
|
29
|
+
:::
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
:::chat{name=notes}
|
|
33
|
+
Anything about the plan that isn't a decision: write it here.
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
What the block says above the chat is ordinary markdown, and optional:
|
|
37
|
+
`::chat{name=page}` alone is a bare chat. Give each chat on a page its own
|
|
38
|
+
name, other than the page's forms' names: a form's chat has the form's name.
|
|
39
|
+
A link to a chat is `#chat:<name>`, to a form's chat `#chat:<form name>`, and to one
|
|
40
|
+
message `#message:<its event id>`; a folded form's chat opens for it.
|
|
41
|
+
|
|
42
|
+
A message is a `chat:message` event, `{ "chat": "<name>", "text": "…" }`,
|
|
43
|
+
never an answer: under a form it never makes a choice (only the reader can,
|
|
44
|
+
with a message of yours marked `answer`, below). Answer in the same chat:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
workpad append --page <file> --type chat:message --data '{"chat":"<name>","text":"your answer"}'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Two more fields, both optional:
|
|
51
|
+
|
|
52
|
+
- `replaces`: the id of an earlier message of yours. Yours takes its place,
|
|
53
|
+
to correct it; the log itself only grows.
|
|
54
|
+
- `replyTo` (in a form's chat): the id of a submit of the form whose written
|
|
55
|
+
text you answer (a remark typed into one of its text fields). That text
|
|
56
|
+
shows as the reader's message, right before yours.
|
|
57
|
+
|
|
58
|
+
When you settle on an answer in a chat that is none of the form's options,
|
|
59
|
+
put it to the reader as a form in your message: one with a single
|
|
60
|
+
`:button[…]` is a choice they can make with one press, and it is a question
|
|
61
|
+
of the page like any other.
|
|
62
|
+
|
|
63
|
+
Your messages show as the agent's, and your own `listen` skips what you
|
|
64
|
+
append, while other agents listening on the page get it. A listen on the
|
|
65
|
+
whole page (no `--type`) hands out chat messages too; one with `--type
|
|
66
|
+
<form name>` does not. So don't add a free-text field
|
|
67
|
+
for questions or remarks to a decision form: its chat is for that, and a
|
|
68
|
+
submit stays a choice.
|
|
69
|
+
|
|
70
|
+
A chat is found by its name. Remove or rename a form or a chat block and its
|
|
71
|
+
chat moves to the end of the page, read-only, folded under "n chats no longer
|
|
72
|
+
on this page" (you can still answer there); bring it back under its name and
|
|
73
|
+
the chat is in its place again. So rework a question in its form rather than
|
|
74
|
+
replacing the form.
|
|
75
|
+
|
|
76
|
+
When you take a question or a chat off a page for good, remove its talk too,
|
|
77
|
+
so it doesn't stay behind in that list:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
workpad chat prune <file> <name>
|
|
81
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { builtinPublic } from "../../src/package.js";
|
|
2
|
+
import { isQuestionName } from "../../src/status.js";
|
|
3
|
+
import { chatNames } from "../../src/pages/markdown.js";
|
|
4
|
+
import { item, when } from "../../src/archive.js";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import { anchorTaken, definePlugin, html, raw } from "@bigmistqke/workpad";
|
|
7
|
+
import { prune } from "@bigmistqke/workpad/log";
|
|
8
|
+
// plugins/chat/index.ts
|
|
9
|
+
const style = "style.css";
|
|
10
|
+
/** The chat itself: a client island, so the server renders nothing for it. */
|
|
11
|
+
const thread = {
|
|
12
|
+
style,
|
|
13
|
+
props: (ctx) => ({
|
|
14
|
+
chat: ctx.attrs.chat ?? "",
|
|
15
|
+
form: ctx.attrs.form || null,
|
|
16
|
+
choices: (ctx.attrs.choices ?? "").split(" ").filter(Boolean)
|
|
17
|
+
}),
|
|
18
|
+
html: () => "",
|
|
19
|
+
client: "client.js"
|
|
20
|
+
};
|
|
21
|
+
const quote = (s) => s.replace(/"/g, """);
|
|
22
|
+
/**
|
|
23
|
+
* The chat thread for `chat`, as markup: for the chat block, and for the form plugin under a form,
|
|
24
|
+
* which gives it its id (`anchor`: `chat:<name>`, so `#chat:<name>` reaches a form's chat too).
|
|
25
|
+
*/
|
|
26
|
+
const chatThread = (c, chat, form) => c.markdown(`::chat-thread{chat="${quote(chat)}"${form ? ` form="${quote(chat)}" choices="${form.choices.join(" ")}"` : ""}${form?.anchor ? ` anchor="${quote(form.anchor)}"` : ""}}`);
|
|
27
|
+
/** `:::chat{name=…}`: a chat on its own, after whatever the block says above it. */
|
|
28
|
+
const chat = {
|
|
29
|
+
style,
|
|
30
|
+
async html(ctx) {
|
|
31
|
+
const c = ctx;
|
|
32
|
+
const name = c.attrs.name || c.attrs.id || "chat";
|
|
33
|
+
if (!isQuestionName(name)) throw new Error(`chat name "${name}" has a colon: those names are reserved for events of workpad and plugins`);
|
|
34
|
+
const body = c.children.length ? await c.toHtml(c.children) : "";
|
|
35
|
+
const id = c.anchor("chat", name);
|
|
36
|
+
return html`<section class="wp-chat-block" data-chat="${name}" ${id ? html` id="${id}"` : ""}>
|
|
37
|
+
${!id ? anchorTaken("chat", name) : ""}${raw(body)}${raw(await chatThread(c, name))}
|
|
38
|
+
</section>`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** The chat at the bottom of every page (see `end`): for what is about none of its questions. */
|
|
42
|
+
const PAGE_CHAT = "page";
|
|
43
|
+
function chatPlugin({ page: pageChat = true } = {}) {
|
|
44
|
+
return definePlugin({
|
|
45
|
+
name: "chat",
|
|
46
|
+
end(page) {
|
|
47
|
+
if (!pageChat || page.id.startsWith("-/")) return null;
|
|
48
|
+
if (page.frontmatter.plugins?.chat === false || chatNames(page.body).includes("page")) return null;
|
|
49
|
+
return `:::chat{name=${PAGE_CHAT}}\nQuestions or remarks about this page:\n:::`;
|
|
50
|
+
},
|
|
51
|
+
public: builtinPublic("chat"),
|
|
52
|
+
blocks: {
|
|
53
|
+
chat: {
|
|
54
|
+
...chat,
|
|
55
|
+
menu: {
|
|
56
|
+
group: "ask",
|
|
57
|
+
summary: "a conversation, on the page or under a form"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"chat-thread": thread
|
|
61
|
+
},
|
|
62
|
+
events: { "chat:message": {
|
|
63
|
+
handOut: true,
|
|
64
|
+
forReader: true,
|
|
65
|
+
description: "a message in a chat: `{ chat, text }`, and `replaces` or `replyTo` (see below)"
|
|
66
|
+
} },
|
|
67
|
+
commands: { prune: {
|
|
68
|
+
description: "remove one chat's messages from the log, and the answers to the forms in them, the page kept: for a question taken off a page, so its talk doesn't stay behind",
|
|
69
|
+
args: "<page|file> <chat>",
|
|
70
|
+
run(ctx) {
|
|
71
|
+
const [target, chat] = ctx.positionals;
|
|
72
|
+
if (!target || !chat) throw new Error("usage: workpad chat prune <page|file> <chat>");
|
|
73
|
+
const page = ctx.page(target);
|
|
74
|
+
const removed = prune(ctx.eventsFile, page, (e) => e.type === "chat:message" && e.data?.chat === chat);
|
|
75
|
+
const answers = prune(ctx.eventsFile, page, (e) => e.type.startsWith(`${chat}/`));
|
|
76
|
+
console.log(`pruned ${removed} message${removed === 1 ? "" : "s"} of chat ${chat} on ${page}${answers ? `, and ${answers} answer${answers === 1 ? "" : "s"} to the forms in them` : ""}`);
|
|
77
|
+
}
|
|
78
|
+
} },
|
|
79
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8"),
|
|
80
|
+
archive: archiveChats
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** An archived page's chats: each one's messages as the page showed them, a correction in its place. */
|
|
84
|
+
function archiveChats(events) {
|
|
85
|
+
const messages = events.filter((e) => e.type === "chat:message");
|
|
86
|
+
const replaced = new Set(messages.map((e) => e.data.replaces).filter(Boolean).map(String));
|
|
87
|
+
const byChat = /* @__PURE__ */ new Map();
|
|
88
|
+
for (const e of messages) {
|
|
89
|
+
if (replaced.has(e.id)) continue;
|
|
90
|
+
const chat = String(e.data.chat ?? "");
|
|
91
|
+
byChat.set(chat, [...byChat.get(chat) ?? [], e]);
|
|
92
|
+
}
|
|
93
|
+
if (!byChat.size) return;
|
|
94
|
+
return ["## Chats", ...[...byChat].map(([chat, list]) => `### ${chat}\n\n${list.map((e) => item(`${e.from === "cli" ? "agent" : "you"}, ${when(e)}`, String(e.data.text ?? ""))).join("\n")}`)].join("\n\n");
|
|
95
|
+
}
|
|
96
|
+
export { PAGE_CHAT, chatThread, chatPlugin as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=class extends Error{constructor(e){let t=Error,n=t.stackTraceLimit;n!==void 0&&(t.stackTraceLimit=0),super(),n!==void 0&&(t.stackTraceLimit=n),this.source=e}},t=class extends Error{constructor(e,t){try{var n=String(t instanceof Error?t.message:t)}catch{}super(n,{cause:t}),this.source=e}};function n(e){return e instanceof t?e.cause:e}var r=class extends Error{constructor(){super(``)}},i=class extends Error{constructor(){super(``)}};const a=4096,o=1<<22,s=1<<21,c=16384,l=1<<23,u={},d={},f=Symbol(`refresh`),p=Set;function m(e){let t=e.pe;for(;t;)t.R|=32,m(t),t=t.Ge}function h(e){e.l&=-33,gt(e)}let g;function _(e){try{e()}catch(e){g||=[e],M()}}function v(e){let t=g;if(g=void 0,t&&!e)throw t[0]}function y(e,t=!1,n){let r=e.R;if(r&64)return;t&&(n||e.T===null||e.T.me===null&&e.T.Le===null||y(e,!1,!0),e.R=r|64,e.X&&(St(e),(e.m&1&&e.T?.Re!=null||r&2048||F.length)&&M()));let i=n?e.T.me:e.pe;for(n?e.T.me=null:e.pe=null;i;){let e=i;e.l&=-33,at(e,A),pt(e),i.Me=i,y(i,!0),i=i.Ge}if(n||(e.be=0),t&&!n&&!(r&32)&&e._parent!==null&&!(e._parent.R&64)){let t=e.Me,n=e.Ge;t===null?e._parent.pe=n:t.Ge=n,n!==null&&(n.Me=t),e.Me=null}if(ee(e,n),t&&e.ze){let t=e.ze;e.ze=void 0,_(t)}}function b(e,t){let n=e.pe;t.Me=null,t.Ge=n,n!==null&&(n.Me=t),e.pe=t}function ee(e,t){let n=t?e.T.Le:e.ke;if(n){if(t?e.T.Le=null:e.ke=null,Array.isArray(n))for(let e=n.length-1;e>=0;e--)_(n[e]);else _(n)}}function te(e,t){let n=e;for(;n.l&4&&n._parent;)n=n._parent;if(n.id!=null)return ie(n.id,t?n.be++:n.be);throw Error()}function ne(e){return te(e,!0)}function re(e,t,n){return e?.id??(t?n?.id:n?.id==null?void 0:ne(n))}function ie(e,t){let n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):``)+n}function x(){return V}function ae(e,t=V){return t&&(t.ke?Array.isArray(t.ke)?t.ke.push(e):t.ke=[t.ke,e]:t.ke=e),e}function oe(e=!0){y(this,e),g&&!I.Y&&v()}function se(e){let t=V,n=e?.transparent??!1,r={id:re(e,n,t),l:n?4:0,R:0,Qe:!0,Ke:t?.Qe?t.Ke:t,pe:null,Ge:null,Me:null,ke:null,A:t?.A||d,be:0,T:null,_parent:t,dispose:oe};return t&&b(t,r),r}function ce(e,t){let n=se(t);return K(n,()=>e(oe.bind(n,!0)))}let le=null,S=null,ue=null,de=null,fe=null;function pe(e,t,n,r,i){le=e,S=t,ue=n,de=r,fe=i}const C=[];function me(e,t=null){let n={ln:[],rn:[[],[]],fn:[],eo:null,_parent:t,P:e,Pe:null,tt:0,nt:!1,nn:null,Ue:!1,un:!1,I:null};return e||C.push(n),n}let w=null;function he(e){w=e}let T=null,E=null;function ge(e,t){if(I.Y&&!t||T!==null)return k(e);E===null?E=O(e):ve(O(e),E),M()}function D(e){return e.T.Re=O(e.T.Re)}function _e(e){return e=O(e),C.indexOf(e)===-1?null:e}function O(e){for(;e.eo!==null;)e=e.eo;return e}function k(e){let t=T;t===null?T=e===null?me(!1):O(e):e!==null&&ve(O(e),t),I.Y||M()}function ve(e,t){e=O(e),t=O(t),e===t||e.P||t.P||(e.eo=t,t.tt+=e.tt,t.nt||=e.nt,P(t.ln,e.ln),P(t.rn[0],e.rn[0]),P(t.rn[1],e.rn[1]),P(t.fn,e.fn),e.I!==null&&P(t.I??=[],e.I),C.splice(C.indexOf(e),1))}function ye(e){let t=be;be??=e;let n=e.tt!==0||Se(e.ln,e)||!1;return be=t,n}let be=null;function xe(e,t){let n=e.T?.se;if(n===void 0)return!0;for(let e of n){let n=e.T?.Re;if(n==null||O(n)===t)return!0}return!1}function Se(e,t,n=!1){for(let r=0;r<e.length;r++){let i=e[r];if(!(!(i.m&1)||i.R&64||i.l&8192||i.T.Re!==null&&D(i)!==t||n&&!xe(i,t))){if(i.i===1){if(Ce(i,be??t))return!0}else for(let e=i.o;e!==null;e=e.t){let n=e.u;if((n.i===1&&n.m&1||n.R&2048||n.l&16384&&n.m===1)&&(e.Ne===n.de||n.T?.U!=null)&&!(n.R&64)&&Ce(n,be??t))return!0}}}return!1}function Ce(e,t){return!(e.R&32&&we(e,t))&&!ue?.(e)}function we(e,t){let n=e;for(;n?.R&32;)n=n._parent;return n?.l&256&&n.T?.Re!=null&&D(n)===O(t)}const Te=[];function Ee(e){Te.push(e)}const De=[];function Oe(e){at(e,A),e.R&=-4,De.push(e)}function ke(e,t){e.l|=256,Ae(e,t)}function Ae(e,t){let n=W(e);n.Re!==t&&(n.Re=t,t.ln.push(e))}function je(e,t){for(let n=e.pe;n!==null;n=n.Ge)n.T?.Re?.P||(n.X!==void 0&&(n.l&256||ke(n,t),n.l|=1048576),je(n,t))}function Me(e,t,n){for(let r=e.pe;r!==null;r=r.Ge)(r.l&2304)==256&&D(r)!==t&&n(r),Me(r,t,n)}function Ne(e){e.T.Re=null,e.l&=-257}const A={et:Array(2e3).fill(void 0),p:!1,Fe:0,Et:0};let j=0,Pe=!1,Fe=!1,Ie=!1,Le=0;function M(){Fe?Ve():Pe||(Pe=!0,!Le&&!I.Y&&queueMicrotask(et))}const Re=Symbol.for(`solid-js/root-error-hook`),ze=`[REACTIVITY_HALTED]`;function Be(e){if(Fe)return;Fe=!0,v(!0);let t=ze,n=e!==void 0&&globalThis.reportError;n||e===void 0?console.error(t):console.error(t,e),n&&n(e)}function Ve(){Ie||(Ie=!0,console.error(ze))}var N=class e{rn=[[],[]];Y=!1;flush(){if(!this.Y){this.Y=!0,ln(),w=null,E=null;try{vt(),ct(A,e._e),this.settle(),j++,Pe=A.Et>=A.Fe||F.length!==0,this.run(1),this.run(2)}finally{this.Y=!1,E=null}}}settle(){let e=T;T=null;let t=e!==null&&!e.P?O(e):null;if(t!==null){let e=F.length;for(let n=0;n<e;n++){let e=F[n];if(!(e.l&2304)&&(e.T===null||e.T.Re===null||!e.T.Re.P)){if(e.ue===u&&e.m&4&&e.i!==1)continue;if(e.ue!==u&&!(e.m&5)&&e.T?.me==null&&e.T?.Le==null&&gn(e,e.le,e.ue)){e.ue=u,e.l&=-129;continue}ke(e,t)}e.l&128&&je(e,t)}F.length=0,De.splice(0)}else{$e();for(let e=0;e<Te.length;e++){let t=Te[e];t.T?.U==null&&!t.Ae&&ft(t)}}Te.length&&=0;let n=this.rn;this.rn=[[],[]];for(let e=C.length-1;e>=0;e--){let t=C[e];ye(t)||(C.splice(e,1),Ue(t),e=C.length)}let r=t&&_e(t),i=r!==null;for(let e=0;e<2;e++)i&&P(r.rn[e],n[e]),this.rn[e]=i||this.rn[e].length?[].concat(i?[]:n[e],this.rn[e]):n[e];if(De.length!==0){let e=De.splice(0).sort((e,t)=>e.he-t.he);for(let t=0;t<e.length;t++)e[t].R&64||H(e[t])}de?.()}run(e){let t=this.rn[e-1];t.length&&(this.rn[e-1]=[],tt(t,e))}enqueue(e,t,n=w){e&&(n?.P?n:this).rn[e-1].push(t),M()}notify(e,t,n,r){return le?.(e,n&t,r)?!0:t&1?(n&1&&w===null&&k(null),!0):!1}};function He(e){let t;for(let n=0;n<e.fn.length;n++){let r=e.fn[n],i=r.T?.U?.source;if(!(r.R&64||r.m&2&&(r.i||!(r.l&8388608))&&i!==r&&(i?.m??2)&2)&&r.R&2048){t||=r.i||i===r||r.l&256,e.P||(r.R&=-2049),r.Ae=!1;for(let e=r.pe;e!==null;e=e.Ge)e.i&&(e.Ae=!1);L(r)}}return e.fn.length=0,t}function Ue(e){let t=He(e);for(let t=0;t<e.ln.length;t++){let n=e.ln[t];n.T.Re!==null&&D(n)===e&&(n.T.Re=null,Qe(n))}T===e&&(T=null),t?I.rn[1].push(()=>We(e)):We(e)}function We(e){for(let t=0;t<2;t++)P(I.rn[t],e.rn[t]),e.rn[t]=[]}function P(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const F=[];function Ge(e,t){e.R&2048||(e.R|=2048,t.fn.push(e))}function Ke(e){F.push(e),I.Y||rn()}let qe=0;function Je(){qe++}function Ye(e){e.we=qe;let t=!!(e.l&512)&&e.T?.De!==void 0;for(let n=e.o;n!==null;n=n.t){let e=n.u;e.R&4&&n.Ne===e.de&&n!==e._&&(e.R|=a),t&&e.l&8?e.R|=256:L(e)}}function Xe(e){e.Ae=!0,I.enqueue(e.i,e.W??=N.q.bind(null,e))}function Ze(e){return e.ue!==u&&(e.le=e.ue,e.ue=u)}function Qe(e){let t=e;if(!t.X){e.l&=-385,Ze(e);return}let n=e.ue===u&&!!(t.m&1),r=e.l&s;if(!n&&t.T&&(t.T.Te=null),e.l=n?e.l&-1048833|1024:e.l&-3147137,r){let n=e.ue;e.ue=u,e.ie=j+1,Lt(t,2,n)}else Ze(e)&&(t.m&=-5,t.T!=null&&(t.T.Ve=!1,t.T.je=u),e.i&&e.i!==3&&Xe(e));t.Ie=!1,t.R&=-1025,t.T?.U??ft(t),t.m&1||(t.m&=-5),n||t.T==null||t.T.me===null&&t.T.Le===null||N.Ce(t,!1,!0)}function $e(){for(let e=0;e<F.length;e++){let t=F[e];t.l&2304||Qe(t)}F.length=0}const I=new N;function et(e){if(e){Le++;try{return e()}finally{try{et()}finally{Le--}}}if(!I.Y&&!Fe){for(;Pe;)I.flush();v()}}function tt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function L(e){A.Fe>e.he&&(A.Fe=e.he),rt(e,A)}function nt(e,t){let n=(e._parent?.Qe?e._parent.Ke?.he:e._parent?.he)??-1;n>=e.he&&(e.he=n+1);let r=e.he,i=t.et[r];if(i===void 0)t.et[r]=e;else{let t=i.We;t.ve=e,e.We=t,i.We=e}r>t.Et&&(t.Et=r)}function rt(e,t){let n=e.R;n&12||(n&1?e.R=n&-4|10:(e.R=n|8,t.p&&st(e)),n&16||nt(e,t))}function it(e,t){let n=e.R;n&28||(e.R=n|16,nt(e,t))}function at(e,t){let n=e.R;if(!(n&24))return;e.R=n&-25;let r=e.he;if(e.We===e)t.et[r]=void 0;else{let n=e.ve,i=t.et[r],a=n??i;e===i?t.et[r]=n:e.We.ve=n,a.We=e.We}e.We=e,e.ve=void 0}function ot(e){if(!e.p){e.p=!0;for(let t=0;t<=e.Et;t++)for(let n=e.et[t];n!==void 0;n=n.ve)n.R&8&&st(n)}}function st(e,t=2){let n=e.R;if(!((n&3)>=t)){e.R=n&-4|t;for(let t=e.o;t!==null;t=t.t)st(t.u,1)}}function ct(e,t){for(e.p=!1,e.Fe=0;e.Fe<=e.Et;e.Fe++){let n=e.et[e.Fe];for(;n!==void 0;)n.R&8?t(n):lt(n,e),n=e.et[e.Fe]}e.Et=0}function lt(e,t){at(e,t);let n=e.he;for(let t=e.C;t;t=t.G){let e=t.S;e.X&&e.he>=n&&(n=e.he+1)}if(e.he!==n){e.he=n;for(let n=e.o;n!==null;n=n.t)it(n.u,t)}}let ut;function dt(e){let t=e.S,n=e.G,r=e.t,i=e.en;if(r===null?t.Ze=i:r.en=i,i!==null)i.t=r;else if(t.o=r,r===null){t.l&4096?ut(t):t.T?.Ye&&_(t.T.Ye);let e=t;e.X&&e.l&32&&!(e.R&32)&&!(e.m&1)&&(mt?mt.push(e):gt(e))}return n}function ft(e){let t=e._,n=t===null?e.C:t.G;if(n!==null){do n=dt(n);while(n!==null);t===null?e.C=null:t.G=null}}function pt(e){e.C&&(e._=null,ft(e))}let mt=null;const ht=e=>mt=e;function gt(e){at(e,A),pt(e),y(e,!0)}const _t=new p;function vt(){if(_t.size!==0){for(let e of _t)!e.o&&e.l&32&&!(e.m&1)&&!(e.R&96)&>(e);_t.clear()}}function yt(e,t){let n=t._;if(n!==null&&n.S===e)return;let r=null,i=t.R&4;if(i&&(r=n===null?t.C:n.G,r!==null&&r.S===e)){r.Ne=t.de,t._=r;return}let a=e.Ze;if(a!==null&&a.u===t&&(!i||a.Ne===t.de))return;let o=t._=e.Ze={S:e,u:t,G:r,en:a,t:null,Ne:t.de};n===null?t.C=o:n.G=o,a===null?e.o=o:a.t=o,Je()}function bt(e,t){return!e.T?.se?.has(t)&&((W(e).se??=new p).add(t),!0)}function xt(e,t){let n=e.T?.se;return n?.delete(t)?(n.size||(e.T.se=void 0),!0):!1}function St(e){e.T!==null&&(e.T.Ee=null)}function Ct(e){e.T!==null&&(e.T.se=void 0)}function wt(e,t){for(let n=e.C;n;n=n.G){let e=n.S;if(e===t||e.T?.se?.has(t))return!0}return!1}function Tt(e,t){W(e).fe=!0,t.source&&bt(e,t.source),e.m&2||R(e,t.source,t)}function R(t,n,r){if(!n){t.T!==null&&(t.T.U=null);return}let i=r instanceof e&&r.source===n?r:t.T?.U;W(t).U=i instanceof e&&i.source===n?i:new e(n)}function Et(e,t){for(let n=e.o;n!==null;n=n.t)t(n.u,n)}function Dt(e,t){let n=new p,r=e=>{let i=n.has(e);t(e,i)!==!1&&!i&&(n.add(e),Et(e,r))};Et(e,r)}function Ot(e){e.X&&e.l&32&&!e.o&&!(e.R&32)&&!(e.m&1)&&(e.R&8?e.R|=o:gt(e))}function kt(e){let t;if(Dt(e,(e,n)=>{!n&&!e.o&&e.l&32&&(t??=[]).push(e)}),t)for(let e of t)Ot(e)}function At(e,n,r){return!(e.l&256||r&&e.R&16384&&I.Y&&!e.rr)||w?!1:(Ct(e),e.T&&(e.T.fe=!1),(e.m&=6)&2||R(e),e.ue=n instanceof t?n:new t(e,n),e.l|=2097280,z(e),M(),!0)}function jt(e,t){let n=!1;Dt(e,(e,r)=>{!r&&e.T?.U===t&&(L(e),n=!0)}),n&&M()}function z(e,t=e){xt(e,t);let n=!1,r;if(Dt(e,(i,a)=>{if(a||t!==e&&wt(i,t)||!xt(i,t))return!1;i.ie=j;let o=i.T?.se?.values().next().value,s=i.m&2;o?s||R(i,o):(i.m&=-2,s||R(i),i.l&256&&k(D(i)),i.T?.fe&&(L(i),n=!0),i.T!==null&&(i.T.fe=!1),!i.o&&i.l&32&&(r??=[]).push(i))}),r)for(let e of r)Ot(e);n&&M()}function Mt(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function Nt(e){let t=e.T?.Se;t!=null&&(e.T.Se=null,t())}function Pt(t,n,r,i){let a=!1,o=!1;if(typeof n==`object`&&n&&$t(()=>{a=n[Symbol.asyncIterator],o=!a&&Mt(n)}),!o&&!a)return t.T!==null&&(t.T.Ee=null),t.Ie=!1,n;W(t).Ee=n,t.T.ce=2147483647,t.T.se=void 0;let s,c=r=>{if(t.T?.Ee!==n)return;let a=r instanceof e;a&&t.Ie?(St(t),Tt(t,r),t.ie=j):((a||!At(t,r))&&(Lt(t,a?1:2,r),a||y(t,!1,!0)),a&&z(t),t.ie=j,a||kt(t),i?.(r,a))},l=(e,i)=>{if(t.T?.Ee!==n||t.R&2)return;let a=t.m&4;if(It(t),r){try{r(e)}catch(e){c(e);return}t.l&256||(t.T.Te=null,t.l&=-1025),a&&It(t,!0)}else G(t,()=>e);t.ue===u&&(t.Ie=!1,ft(t)),z(t),M(),et(),i?.()},d=()=>t.l&32&&!t.o&&!(t.m&1)?(gt(t),!0):!1,f=(e,r)=>{let i=e[Symbol.asyncIterator](),a=!1,o=!1,u=!r,f=()=>{if(!o){o=!0;try{let e=i.return?.();Mt(e)&&e.then(void 0,()=>{})}catch{}}};ae(f,r),W(t).Se=f;let p=()=>{try{d()||m()}catch(e){c(e)}},m=()=>{let e,r,f=!1,h=!1,g=!0,_=i.next();if((Mt(_)?_:{then:e=>void e(_)}).then(r=>{if(g&&u)e=r,f=!0,r.done&&(o=!0);else if(t.T?.Ee!==n)return;else r.done?(o=!0,a?(M(),et()):l(void 0),d()):(a=!0,l(r.value,p))},e=>{g&&u?(r=e,h=!0):t.T?.Ee===n&&(o=!0,c(e),d())}),g=!1,h){if(o=!0,c(r),u)throw r;return!0}return f&&!e.done?(s=e.value,a=!0,m()):f&&e.done},h=m();return u=!1,a||h},p=null,m=(e,t)=>{let n=!1;if(typeof e==`object`&&e&&$t(()=>{n=e[Symbol.asyncIterator]}),!n)return!1;s=void 0;let r=f(e,t);return t||(p=r),!0};if(o){let e=!1,r=!1,i,a=!0;if(n.then(r=>{if(a)s=r,e=!0;else{try{if(t.T?.Ee===n&&!(t.R&64)&&m(r,t))return;l(r)}catch(e){c(e)}d()}},e=>{a?(i=e,r=!0):(c(e),d())}),a=!1,r)throw c(i),i;e?m(s)||(t.Ie=!1):p=!1}if(a&&m(n),p!==null){if(!p){if(t.Ie)return t.le;throw new e(V)}t.Ie=!1}return s}function Ft(e,t=!1){e.T?.se&&Ct(e),e.T?.fe&&(e.T.fe=!1),e.m=t?0:e.m&4,e.T?.U&&R(e);let n=Jt(e);n&&n.call(e)}function It(e,t=!1){let n=e.T?.se;n&&(n.delete(e),n.size)?(e.T.fe=!1,t&&(e.m=1),R(e,n.values().next().value)):Ft(e,t)}function Lt(n,r,i){r===2&&!(i instanceof t)&&!(i instanceof e)&&(i=new t(n,i));let a=r===1&&i instanceof e&&i.source;a?(n.m&2&&(n.T.Te=n.T.U),bt(n,a)):Ct(n),n.m=r|(r===2?n.m&12?8:0:r===1&&n.m&8?4:n.m&4),a?R(n,a,i):W(n).U=i;let o=Jt(n);o?o.call(n):Rt(n,r,i)}function Rt(t,n,r){let i=n===1&&r instanceof e&&r.source;Et(t,(e,a)=>{e.ie=j,e.l&16384||n===1&&a.Ne!==e.de?(n!==1&&xt(e,t),L(e),M()):i&&e.T?.se?.has(i)?w===null&&(e.l&2304)==256&&I.Y&&!S?.(e,i.ie===j)&&k(D(e)):(i||n!==1&&(e.T?.U!==r||e.T?.se))&&(Ke(e),n===1&&(e.l&2304)==256&&!e.i&&k(D(e)),Lt(e,n,r),e.rr?.st(n,r))})}N._e=e=>{e.i===3?(at(e,A),e.Ae=!0,I.enqueue(2,e.Z)):e.R&32&&!(e.R&65536)?Oe(e):H(e)},N.Ce=y;let B=!1,V=null;function H(t,n=!1){Je();let r=t.i,i,c=t.l&s;if(!n){if(at(t,A),t.T!==null&&(t.T.Ee=null,Nt(t)),t.l&256){let e=D(t);e.P||t.l&524288||(t.l&8421376?e!==T&&!(t.m&4||t.l&1048576)&&(t.ue!==u&&Ye(t),t.ue=u,t.l&=-257):ge(e,S?.(t,t.m&4)))}if(r===3||t.l&128){let e=mt;ht(i=[]),y(t),ht(e)}else(t.pe!==null||t.ke!==null)&&Wt(t);t.l&2097152&&(t.ue=u,t.l^=s)}let l=t.m&4,d=t.m&2&&t.T?.U,f=!!(t.m&1)&&t.T?.se,p=t.T?.se?.has(t),m=!1,h=!!(t.R&8192)&&!(t.m&1&&t.T!==null&&!t.T.Ve),g=V;V=t,t._=null,t.de++;let _=t.R&o;t.R=4|t.R&8224,t.ie=j;let v=t.ue===u?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,b=t.he,ee=!1,te=!1,ne=B;B=!0;try{if(t.l&64)v=t.X(v),t.T!==null&&(t.T.Ee=null),t.Ie=!1;else{let e=t.T?.Ee,n=t.X(v),r=typeof n==`object`&&!!n,i=t.T?.Ee!==e;v=i||!r?n:Pt(t,n),!i&&!r&&(t.T!==null&&(t.T.Ee=null),t.Ie=!1)}(t.m!==0||t.T!==null)&&Ft(t,n)}catch(n){let r=n instanceof e;if(r&&t.Ie)Tt(t,n);else if((r||!(m=At(t,n,!0)))&&(r&&(W(t).fe=!0),Lt(t,r?1:2,n),r&&p&&!t.T?.Ee&&z(t)),(r||m)&&f)for(let e of f)e!==t&&!(t.T?.se?.has(e)&&(e.m&1||wt(t,e)))&&z(t,e)}finally{if(B=ne,ee=!!(t.R&a),te=!!(t.R&128),t.R=t.R&936032|(n?t.R&256:0),V=g,i)for(let e of i)Ot(e);t.T!==null&&(t.T.Ve=h&&!!(t.m&1))}if(t.R&64){pt(t),St(t);return}let re=!!t.T?.U||m;if(!re){let e=t.ue===u,i=e?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,a=e&&l&&!r||!!t.T?.Te||!!c||!gn(t,i,v);if(r&&a&&!(t.R&262144&&!t.Ae&&Object.is(t.ge,v))&&e&&(t.Ae=!t.T?.U,n||I.enqueue(r,t.W??=N.q.bind(null,t),null)),!re){if(a)(n?!((T!==null||E!==null)&&(te||Ut(g)?.R&128)):r&&t.ue===u)?t.le=v:(t.ue=v,d&&(t.T.Te=d),n&&(ke(t,T??E),t.m|=4,S?.(t,T))),t.o!==null&&Ye(t);else if(t.he!=b)for(let e=t.o;e!==null;e=e.t)it(e.u,A)}if(!a&&!t.T?.U&&(d&&jt(t,d),f))for(let e of f)e!==t&&z(t,e);p&&!(t.m&5)&&z(t)}if(n&&te&&t.m&1){let e=T??E;e&&!e.P&&(r&&S?.(t)===2||ke(t,e))}!t.T?.U&&t.ue===u&&!(r&&t.Ae)&&(n||r===3?ft(t):Ee(t)),(t.ue!==u||t.T!==null&&(t.T.me!==null||t.T.Le!==null)||t.m&5&&(!n||t.m&1))&&(t.l|=128,Ke(t)),ee&&(L(t),M()),_&&Ot(t)}function zt(e){if(!(e.R&68)){if(e.R&1)for(let t=e.C;t;t=t.G){let n=t.S;if(n.X&&zt(n),e.R&2)break}(e.R&2||e.T?.U&&e.ie<j&&!e.T?.Ee)&&H(e),e.R&=937336}}function U(e,t){let n=t?.transparent??!1,r=typeof t==`object`&&!!t&&`loadingValue`in t,i={id:re(t,n,V),l:(n?4:0)|!!t?.ownedWrite|(!V||t?.lazy?32:0)|(t?.sync?64:0)|(t?.ae?2:0)|(t?.xe??0),ye:t?.equals??Qt,ke:null,A:V?.A??d,be:0,X:e,le:r?t.loadingValue:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:V,Ge:null,Me:null,pe:null,R:t?.lazy?512:0,m:r?0:4,ie:j,ue:u,we:-1,Ie:r,T:null};return t?.unobserved&&(W(i).Ye=t.unobserved),Xt(i,t),i}function W(e){return e.T??={Ee:null,Se:null,U:void 0,fe:void 0,se:void 0,Ye:void 0,De:void 0,me:null,Le:null,Re:null,Ve:!1,je:u,Be:-1,ce:0,P:u,I:0,Te:null}}function Bt(e,t){e.R|=128,(t.m&4||e.i!==1)&&ge(D(t),!e.i&&e.m&4||S?.(e))}function Vt(e,t){if(!(!(e.l&1<<23)||t.l&1024)){let n=D(t);if(!(n===T||Ht(e,n)))return Ge(e,n),!0}return Bt(e,t),!1}function Ht(e,t){return(e.m&4||e.l&1048576)&&e.l&256&&D(e)===t}function Ut(e){return e!==null&&e.Qe?e.Ke:e}function Wt(e){m(e);let t=W(e);t.Le=e.ke,t.me=e.pe,e.ke=null,e.pe=null,e.be=0}function Gt(e,t,n,r,i){let a=i?.transparent??!1,o={id:re(i,a,V),l:r<<23|(a?4:0)|!!i?.ownedWrite|(i?.sync?64:0)|(i?.xe??0),ye:!1,ke:null,A:V?.A??d,be:0,X:e,le:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:V,Ge:null,Me:null,pe:null,R:512,m:4,ie:j,ue:u,we:-1,Ie:!1,Ae:!1,ge:void 0,qe:t,Je:n,ze:void 0,i:r,T:null};return i?.unobserved&&(W(o).Ye=i.unobserved),Xt(o,Yt),o}let Kt=null;function qt(e){Kt=e}function Jt(e){return e.i?Kt:null}const Yt={lazy:!0};function Xt(e,t){e.We=e;let n=V?.Qe?V.Ke:V;V&&b(V,e),n&&(e.he=n.he+1),!t?.lazy&&H(e,!0)}function Zt(e,t){let n={ye:t?.equals??Qt,l:+!!t?.ownedWrite|(t?.ae?2:0),le:e,o:null,Ze:null,ie:j,ue:u,we:-1,T:null};return t?.unobserved&&(W(n).Ye=t.unobserved),n}function Qt(e,t){return e===t}function $t(e,t){let n=B;B=!1;try{return e()}finally{B=n}}function en(e,t){if(e.R&512)e.R&=-513,H(e,!0);else if(e.R&64&&e.l&32){let t=e._parent;if(t!==null){if(t.R&64){e.l&=-33;return}e.R&32||b(t,e)}H(e,!0)}}function tn(e,t){return!t||e.ue===u||t.l&16}let nn=!1;function rn(){nn=!0}function an(e){return I.Y||e.ue===u||e.l&4194304?u:e.l&256?e.T.Be===j?e.T.je:u:e.le}function on(e){let t=e.T;t.Be!==j&&(t.je=e.ue,t.Be=j,nn=!0)}const sn=[];function cn(e){return e.R|=a,!0}function ln(){if(nn=!1,sn.length!==0){for(let e of sn)e.l&=-4194305;sn.length=0}}function un(e,t){e.he>=A.Fe?(st(t),ot(A),zt(e)):t.l&65536&&zt(e);let n=e.he;n>=t.he&&e._parent!==t&&(t.he=n+1)}function dn(e){let t=V;t?.Qe&&(t=t.Ke);let n=e,r=e;if(typeof n.X==`function`&&en(e),!n.X&&e.T?.De===void 0&&(!nn||e.ue===u)&&!(e.l&2048))return t&&(B&&yt(e,t),e.l&256&&!(t.l&16)&&Vt(t,e))||!t||e.ue===u||t.l&16||e.ue===e.le&&Object.is(e.ue,e.le)?e.le:(mn(t),e.ue);let i=!1;if(t&&(B&&(yt(e,t),r.X&&un(r,t)),e.l&256&&!(e.l&2048)&&!(t.l&16)&&(r.m&4?Bt(t,e):i=Vt(t,e))),r.m&1&&!i){if(t){if(!(t.l&16)||r.m&4)throw!B&&e!==t&&yt(e,t),r.T?.U}else if(r.m&4)throw r.T?.U}if(r.X&&r.m&2){if(B&&r.ie<j)return H(r),dn(e);throw!i&&e.l&2097152&&pn(e,t),r.T?.U}(i||!t)&&fn(e);let a=pn(e,i?null:t);return!t&&typeof n.X==`function`&&e.l&32&&!(r.m&1)&&!e.o&&(_t.add(e),M()),a}function fn(e){if(e.T?.Te)throw e.T.Te}function pn(t,n){if(t.ue!==u&&t.m&4&&(!n||n.l&16))throw new e(null);let r=n&&nn?an(t):u;if(r!==u)return cn(n),r;if(tn(t,n))return t.le;if(mn(n,t),t.l&2097152)throw t.ue;return t.ue}function mn(e,t){t?.m&4||(e.R|=16384)}function hn(e){I.Y||e.l&4194304||(e.l|=4194304,sn.push(e))}function gn(t,n,r){if(t.ye===Qt)return n===r;try{return t.ye&&t.ye(n,r)}catch(n){if(!(n instanceof e))return Lt(t,2,n),!0}}function G(e,t){let n=e.ue===u?e.le:e.ue;if(typeof t==`function`&&(t=t(n)),e.l&256&&k(D(e)),!(e.m&4||e.T?.Te||!gn(e,n,t)))return t;let r=e.ue!==u;return r?e.l&256&&!I.Y&&on(e):Ke(e),e.ue=t,V!==null&&hn(e),e.X!==void 0&&(e.ie=j),r&&e.we===qe||(Ye(e),M()),t}function _n(e,t){let n=e.l&256&&!(e.R&1024)&&D(e)!==T;if(n&&typeof t==`function`){let n=t(e.le);t=()=>n}return e.m&2&&(e.T.Te=e.T.U,Lt(e,0)),t=G(e,t),e.l&=-2097153,n?(e.R=e.R&-2|2,rt(e,A),M()):e.ue!==u&&(e.R|=1024),t}function K(e,t){let n=V,r=B;V=e,B=!1;try{return t()}finally{V=n,B=r}}function vn(e,t=!0){try{return e()}finally{}}function yn(e,t=x()){let n;if(t&&(n=t.A[e.id]),n===void 0&&(n=e.defaultValue),n===void 0)throw new i;return n}function bn(e,t,n=x()){if(!n)throw new r;n.A={...n.A,[e.id]:t===void 0?e.defaultValue:t}}function xn(e,t,n,r){let i=Gt(e,t,n,r?.user?2:1,r);H(i,!0),r?.defer?Ze(i):i.ue===u&&(i.T?.Re?.P||i.i===2||r?.schedule?I.enqueue(i.i,wn.bind(null,i),i.T?.Re):wn(i,0))}function Sn(){let e=this.m,t=this.T?.U;if(e&2){if(I.notify(this,1,0),this.i===2){this.m&2&&Xe(this);return}Cn(this,n(t))}else this.i===1&&I.notify(this,3,e,t)}function Cn(e,t,n){if(!I.notify(e,2,2))throw Be(t),t}function wn(e,r){if(!e.Ae||e.R&64||r&&fe?.(e))return;if(e.m&2&&e.i===2){let t=n(e.T?.U);e.ge=e.le,e.Ae=!1;try{e.Je?e.Je(t,()=>{let t=e.ze;e.ze=void 0,t?.()}):console.error(t)}catch(t){Cn(e,t)}return}let i=e.T?.U==null,a=e.ze;e.ze=void 0;try{a?.(),e.ze=e.qe(e.le,e.ge)}catch(n){W(e).U=new t(e,n),e.m|=2,Cn(e,n)}finally{e.ge=e.le,e.Ae=!1,i&&ft(e)}}N.q=wn;function Tn(e,t){let n=!1,r,i=()=>{if(!a.Ae||a.R&64||fe?.(a))return;let e=qe;n=!1;try{a.Ae=!1,H(a)}finally{}for(let t=a.C;t!==null;t=t.G){let o=t.S;if(o.ue!==u&&!(o.l&2048)&&(o.ue!==o.le||!Object.is(o.ue,o.le))){if(o.l&256)n||(n=!0,D(o).rn[1].push(r||=()=>{n&&(a.Ae=!0,i())}));else if(o.we<=e||o.X){L(a),M();break}}}},a=U(()=>{let t=a.ze;a.ze=void 0,t?.();let n=vn(e);a.ze=n},{...t,lazy:!0});a.ze=void 0,a.l=a.l&-33|16,a.Ae=!0,a.i=3,a.Z=i,L(a),M()}qt(Sn);const En=/* @__PURE__ */ new WeakSet;function Dn(e){for(let t=e;t;t=t._parent){let e=t[Re];if(e!==void 0)return e}}function On(e){let t=[];for(let n=e;n;n=n._parent){let e=n._name;typeof e==`string`&&e.length&&t.push(e)}return t.length?t.reverse():void 0}function kn(e,t,n){if(e!==null&&(typeof e==`object`||typeof e==`function`)){if(En.has(e))return;En.add(e)}let r=Dn(t);if(r===void 0)return;let i={},a=On(t),o=On(n)??a;o!==void 0&&(i.ownerPath=o),a!==void 0&&(i.boundaryPath=a);try{r(e,i)}catch(e){console.error(e)}}const An=Symbol(0);function q(e){let t=dn.bind(null,e);return t[f]=e,t}function jn(e,t){if(typeof e==`function`){let n=U(e,t);return n.l&=-33,[q(n),_n.bind(null,n)]}let n=Zt(e,t);return[q(n),G.bind(null,n)]}function Mn(e,t){return q(U(e,t))}function Nn(e,t,n){xn(e,t.effect||t,t.error,{user:!0,...n})}function Pn(e,t,n){xn(e,t,void 0,n)}function Fn(e){let t=x();t&&!(t.l&16)?Tn(()=>$t(e),void 0):I.enqueue(2,function t(){if(A.Et>=A.Fe)return I.enqueue(2,t);e()})}function In(e,t,n){let r=typeof n?.keyed==`function`?n.keyed:void 0,i=t.length>1,a=t,o={H:se(),it:0,st:e,ot:[],ft:a,ht:[],ln:[],Xe:r,ct:r||n?.keyed===!1?[]:void 0,lt:i&&n?.keyed!==!1?[]:void 0,ut:n?.keyed===!1,L:n?.fallback},s=U(Un.bind(o),void 0);return s.l&=-33,q(s)}const Ln={ownedWrite:!0};function Rn(e,t,n,r){let i=e.ot,a=e.it-1,o=[],s=[],c=[],l=256,u=r,d=r,f=!1;for(;u<=a&&d<=n-1;){let e=i[u],r=t[d];if(e===r){f||=(c.push(u,d,0),!0),c[c.length-1]++,u++,d++;continue}f=!1;let p=-1,m=Math.min(32-o.length,a-u,l);for(let e=1;e<=m;e++)if(i[u+e]===r){p=e;break}l-=p===-1?m:p;let h=-1;m=Math.min(32-s.length,n-1-d,l);for(let n=1;n<=m;n++)if(t[d+n]===e){h=n;break}if(l-=h===-1?m:h,p!==-1&&(h===-1||p<=h))for(;p-->0;)o.push(u++);else if(h!==-1)for(;h-->0;)s.push(d++);else{if(l<=0||o.length===32||s.length===32)return!1;o.push(u++),s.push(d++)}}for(;u<=a;u++){if(o.length===32)return!1;o.push(u)}for(;d<=n-1;d++){if(s.length===32)return!1;s.push(d)}return zn(e,t,n,o,s,c)}function zn(e,t,n,r,i,a){let o=e.ot,s,c,l;if(i.length!==0)for(l=Array(r.length),c=0;c<i.length;c++){let e=-1;for(s=0;s<r.length;s++)if(!l[s]&&o[r[s]]===t[i[c]]){e=s;break}if(e===-1)return!1;l[e]=!0,i[c]=i[c]<<6|e}if(r.length!==0||i.length!==0){let e=/* @__PURE__ */ new Set;for(s=0;s<r.length;s++)e.add(o[r[s]]);for(c=0;c<i.length;c++)e.add(t[i[c]>>6]);for(let t=0;t<a.length;t+=3){let n=a[t];for(let r=0,i=a[t+2];r<i;r++)if(e.has(o[n+r]))return!1}}let u=e.ht,d=e.ln,f=u.slice(0,n),p=d.slice(0,n);for(let e=0;e<a.length;e+=3){let t=a[e],n=a[e+1];if(t!==n)for(let r=0;r<a[e+2];r++)f[n+r]=u[t+r],p[n+r]=d[t+r]}for(c=0;c<i.length;c++){let e=i[c]>>6,t=r[i[c]&63];f[e]=u[t],p[e]=d[t]}for(e.ht=f,e.ln=p,e.it=n,e.ot=t.slice(0),s=0;s<r.length;s++)l!==void 0&&l[s]||d[r[s]].dispose();return!0}function Bn(e,t,n,r,i,a,o,s,c){let l=e.Xe,u=e.ot,d=e.ln,f=[],p=n;for(let m=n;m<=i;p++,m++){let i=l?l(t[m]):t[m];for(;p<=r&&(l?l(u[p]):u[p])!==i;)f.push(d[p++]);if(p>r)return o.fill(void 0),null;a[m]=e.ht[p],o[m-n]=d[p],s&&(s[m-n]=e.ct[p]),c&&(c[m-n]=e.lt[p])}for(;p<=r;p++)f.push(d[p]);return f}function Vn(e,t,n,r,i,a,o,s,c){let l=e.ln,u=e.ct,d=e.lt,f=e.it,p=n-f,m,h;if(p>0)for(l.length=n,u&&(u.length=n),d&&(d.length=n),m=f-1,h=n-1;m>i;m--,h--)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);else if(p<0){for(m=i+1,h=a+1;m<f;m++,h++)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);l.length=n,u&&(u.length=n),d&&(d.length=n)}for(h=r;h<=a;h++)l[h]=o[h-r],u&&Hn(u[h]=s[h-r],t[h]),d&&G(d[h]=c[h-r],h);for(h=a+1;h<n;h++)u&&Hn(u[h],t[h]),d&&p!==0&&G(d[h],h)}const Hn=(e,t)=>e.le===t&&e.ue===u||G(e,t);function Un(){this.H.Ke=x();let e=this.st()||[];e[An],e=e;let t=e.length;return K(this.H,()=>{let n,r,i,a,o,s=this.ct?this.ut?()=>(a[i]=Zt(e[r],Ln),this.ft(q(a[i]),r)):()=>(a[i]=Zt(e[r],Ln),o&&(o[i]=Zt(r,Ln)),this.ft(q(a[i]),o?q(o[i]):void 0)):this.lt?()=>{let t=e[r];return o[i]=Zt(r,Ln),this.ft(t,q(o[i]))}:()=>{let t=e[r];return this.ft(t)};if(t===0)this.it!==0&&(this.H.dispose(!1),this.ln=[],this.ot=[],this.ht=[],this.it=0,this.ct&&=[],this.lt&&=[]),this.L&&!this.ht.length&&(this.ln[0]?.dispose(),this.ht[0]=K(this.ln[0]=se(),this.L));else if(this.it===0){let c=Array(t),l=Array(t);a=this.ct&&Array(t),o=this.lt&&Array(t);try{for(r=0;r<t;r++)i=r,c[r]=K(l[r]=se(),s)}catch(e){for(n=0;n<=r;n++)l[n]?.dispose();throw e}this.ln[0]&&this.ln[0].dispose(),this.ht=c,this.ln=l,a&&(this.ct=a),o&&(this.lt=o),this.ot=e.slice(0),this.it=t}else{let c,l,u,d,f,p,m,h,g;for(c=0,l=Math.min(this.it,t);c<l&&(this.ot[c]===e[c]||this.ct&&Wn(this.Xe,this.ot[c],e[c]));c++)this.ct&&Hn(this.ct[c],e[c]);for(l=this.it-1,u=t-1;l>=c&&u>=c&&(this.ot[l]===e[u]||this.ct&&Wn(this.Xe,this.ot[l],e[u]));l--,u--);if(c===t&&this.it===t){this.ot=e.slice(0);return}if(t<=this.it&&l-c>64&&this.ct===void 0&&this.lt===void 0){let n=c+(u-c>>1),r=e[n],i=Math.min(l,n+32),a=Math.max(c,n-32);for(;a<=i&&this.ot[a]!==r;)a++;if(a<=i&&Rn(this,e,t,c))return}let _=t-this.it,v=u-c+1,y=Array(t),b=Array(v);a=this.ct?Array(v):void 0,o=this.lt?Array(v):void 0;let ee=_<0?Bn(this,e,c,l,u,y,b,a,o):null;if(ee!==null)ee.length!==0&&(h=ee);else{for(p=/* @__PURE__ */ new Map,m=Array(v),r=u;r>=c;r--)d=e[r],f=this.Xe?this.Xe(d):d,n=p.get(f),m[r-c]=n===void 0?-1:n,p.set(f,r);for(n=c;n<=l;n++)d=this.ot[n],f=this.Xe?this.Xe(d):d,r=p.get(f),r!==void 0&&r!==-1?(y[r]=this.ht[n],b[r-c]=this.ln[n],a&&(a[r-c]=this.ct[n]),o&&(o[r-c]=this.lt[n]),r=m[r-c],p.set(f,r)):(h??=[]).push(this.ln[n]);try{for(r=c;r<=u;r++)b[r-c]===void 0&&((g??=[]).push(b[r-c]=se()),i=r-c,y[r]=K(b[r-c],s))}catch(e){if(g)for(n=0;n<g.length;n++)g[n].dispose();throw e}}for(n=0;n<c;n++)y[n]=this.ht[n];for(r=u+1;r<t;r++)y[r]=this.ht[r-_];if(Vn(this,e,t,c,l,u,b,a,o),this.ht=y,this.it=t,this.ot=e.slice(0),h)for(n=0;n<h.length;n++)h[n].dispose()}}),this.ht}function Wn(e,t,n){return!e||e(t)===e(n)}function Gn(e,t){if(typeof e==`function`&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e==`function`&&!e.length)}if(!t?.skipNonRendered||e!=null&&e!==!0&&e!==!1&&e!==``){if(Array.isArray(e)){let n=[];return Kn(e,n,t)?()=>{let e=[];return Kn(n,e,{...t,doNotUnwrap:!1}),e}:n}return e}}function Kn(t,n=[],r){let i=null,a=!1;for(let o=0;o<t.length;o++)try{let e=t[o];if(typeof e==`function`&&!e.length){if(r?.doNotUnwrap){n.push(e),a=!0;continue}do e=e();while(typeof e==`function`&&!e.length)}Array.isArray(e)?a=Kn(e,n,r)||a:r?.skipNonRendered&&(e==null||e===!0||e===!1||e===``)||n.push(e)}catch(t){if(!(t instanceof e))throw t;i=t}if(i)throw i;return a}const qn=Symbol(``),Jn=Symbol(``),J=/* @__PURE__ */ new Set,Yn=e=>e.A[qn],Xn=e=>!!e&&(e.i===2&&e.L||Xn(e._parent)),Y=e=>e.i===2||!e.D||e.h||Xn(e._parent);function X(e,t,n=t){e.F.set(t,n),J.add(e)}function Zn(e,t,r,i=t){if(e.i===2){r??=t.T?.U,i=r?.source??t,i.R&64&&(i=t);let a=n(r);G(e.U,a),kn(a,e.H,i)}else e.D=!1;X(e,t,i),e.h&&Qn(e),e.L||$n(e)}function Qn(e){e.D=!1,e.P=e.B;let t=e.j;!e.P&&t.l&256&&D(t)!==T&&Ne(t)}function $n(e){e.j!==null&&!(e.j.R&96)&&(L(e.j),M())}function er(e,t,n){if(t===0){if(J.size)for(let t=Yn(e);t;t=t._parent)!(t.F.get(e)?.m&(t.i|1))&&t.F.delete(e)&&!sr(t,0)&&t.L&&$n(t);return!1}for(let r=Yn(e);r;r=r._parent)if(!(r.i&t))r.L&&r.i>t&&X(r,e);else{if(Y(r))return Zn(r,e,n),!r.h||2;X(r,e)}return!1}function tr(e){for(let t=Yn(e);t;t=t._parent)if(t.i&1&&Y(t))return t.h}function nr(e,t){for(let t=Yn(e);t;t=t._parent)if(t.L)return t;let n,r=e.o;if(t||e.l&16384)for(t||=/* @__PURE__ */ new Set,n=e.i!=1;r&&(n=t.size==t.add(r.u).size||nr(r.u,t));)r=r.t;return n}function rr(e){let t=nr(e);return t!==void 0&&((t.M??=/* @__PURE__ */ new Set).add(e),!0)}function ir(e){if(e.M!==null){for(let t of e.M){let e=t.i;I.enqueue(e===3?2:e,e===3?t.Z:t.W??=N.q.bind(null,t))}e.M=null}}function ar(e,t,n){if(!(n.m&3||t.m&2)){for(let n=Yn(t);n&&n!==e;n=n._parent)if(n.i&1&&Y(n))return!(n.j.l&256)}return!1}function or(e,t,n){for(let r=e.C,i;r;r=r.G)if((i=r.S)===t||(n||=/* @__PURE__ */ new Set).size<n.add(i).size&&or(i,t,n))return 1}function sr(e,t){let n=e.i|1;for(let[r,i]of e.F){if(!((r.R|i.R)&64)){if((r.m&n||i.m&n&&or(r,i))&&!(n&2&&ar(e,r,i))||n&2&&i.l&2097152||r.l&32768&&r.R&8){if(t===0)break;continue}if((i!==e.K||e.h)&&(i.l&2304)==256){if(!t||!e.D)continue;k(D(i))}}e.F.delete(r)}return e.F.size}function cr(){for(let e of J){let t=e.j.R;if(t&64){J.delete(e);continue}if(t&32)continue;if(!e.D){for(let[t]of e.F)for(let n of t.m&1?t.T?.se||[]:[t])if(!(n.l&256))for(let r=n.C;r;r=r.G){let i=r.S;i.l&256&&(n===t||!D(i).tt)&&X(e,i)}}sr(e);let n=e.j;e.i&1&&!e.D&&n.l&256&&[...e.F].every(([,e])=>!(e.m&1)&&e.l&256&&D(e)===D(n))&&(e.F.clear(),e.D=!0),e.h=!1,e.F.size===0&&(J.delete(e),e.L&&$n(e))}}function lr(e){if(!e.D){e.L&&e.P===null&&e.B===null&&w!==null&&(e.B=w,Qn(e),$n(e));return}e.h=!0,e.j.l&=-8388609;let t=w;t===null&&I.Y&&x().l&32768&&(k(null),t=N.J(T)),e.B=t,J.add(e);let n=e.F.size;Me(e.H,T,t=>X(e,t));for(let[t]of e.F)if(e.F.size!==n||t.m&1&&!(t.R&64)){for(let t=e._parent;t!==null;t=t._parent)if(t.i&1)for(let[n]of e.F)t.F.delete(n);Qn(e),$n(e);return}}function ur(t,n,r,i){let a=se(),o={i:t,_parent:Yn(a)??null,H:a,K:null,j:null,F:/* @__PURE__ */ new Map,D:t===2,h:!1,B:null,P:null,L:!1,M:null,v:null,$:!1,ee:!1,U:t===2?Zt(void 0,fr):null,ne:r,re:null};if(t===1&&a.A[Jn],x()&&ae(()=>{J.delete(o)}),i){let t=!1;K(a,()=>U(()=>{try{i()}catch(t){if(!(t instanceof e)){if(!I.notify(x(),2,2,t))throw Be(t),t;return}}t?lr(o):t=!0})).l|=c}a.A={...a.A,[qn]:o};let s=K(a,()=>{let e=U(n);return U(()=>Gn(dn(e)))});o.K=s;let u=U(()=>{let n=x();if(!o.h&&!(n.l&256)&&(n.l|=l),o.$&&(yt(s,n),o.$)){if(o.ee){o.L=!0;return}return dr(o)}let r=s.m&3;if(r!==0){if(yt(s,n),r&t){if(Y(o))return Zn(o,s,void 0),dr(o);X(o,s)}throw s.T.U}if(Y(o)&&(o.F.size!==0&&n.m&4&&!(n.l&256)||sr(o,!0)!==0))return dr(o);let i;try{i=dn(s)}catch(n){if(n instanceof e?t===1:t===2){if(Y(o))return Zn(o,s,n),dr(o);X(o,s)}throw n}if(Y(o)&&o.F.size!==0)return dr(o);o.D=!0,o.L=!1;let a=o.re,c=()=>{!o.L&&o.re===a&&(a.m&2&&M(),h(a),o.re=null)};return a!==null&&(o.j.le===a.le?I.enqueue(1,c):c()),ir(o),i},{ae:!0});return u.l|=c,s.l|=l,o.j=u,q(u)}function dr(e){let t=x();e.P!==null&&(he(e.P),t.R|=131072,e.P=null),e.L=!0,e.re===null&&(e.re=K(t._parent,()=>U(()=>e.ne(e),{id:t.id,lazy:1})));let n=w,r=t.R,i=dn(e.re);return he(n),t.R^=(t.R^r)&163840,i}const fr={ownedWrite:!0,ae:!0};function pr(e,t,n){return ur(1,e,()=>t(),n?.on)}pe(er,(e,t)=>!t&&(e.m&4?er(e,1):tr(e)),nr,cr,rr);function mr(e,t){let n=Symbol(t&&t.name||``);function r(e){return ce(()=>(bn(r,e.value),gr(()=>e.children)))}return r.id=n,r.defaultValue=e,r}function hr(e){return yn(e)}function gr(e){let t=Mn(e,{lazy:!0}),n=Mn(()=>Gn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}const _r={hydrating:!1,registry:void 0,done:!1},vr=(...e)=>Mn(...e),yr=(...e)=>jn(...e),br=(...e)=>ce(...e),xr=(...e)=>Pn(...e),Sr=(...e)=>Nn(...e),Cr=(e,t,n)=>pr(e,t,n);function wr(e,t,n,r){return $t(()=>e(t||{}))}function Tr(e){let t=`fallback`in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed},n=x(),r,i=()=>K(n,()=>In(()=>e.each,e.children,t));return _r.hydrating&&(r=i()),()=>(r??=i())()}function Er(e){let t=`on`in e?{on:()=>e.on}:void 0;return Cr(()=>e.children,()=>e.fallback,t)}const Dr=_r,Z=/*#__PURE__*/ Symbol(`slot`),Or=/*#__PURE__*/ Symbol(`host`),kr={transparent:!0,sync:!0};function Ar(e,t,n){let r=n?{sync:!0,...n,transparent:!n.scope}:kr;xr(e,t,r)}function jr(e,t,n,r){let i=e.moveBefore&&e.isConnected&&document.activeElement;i===document.body&&(i=null);let a=r||e,o=(t,n)=>{i&&t.isConnected&&t.contains(i)?e.moveBefore(t,n):e.insertBefore(t,n),(r||t[Z])&&(t[Z]=a)};if(!t.length){for(let e of n)o(e,r);return}let s=t=>{if(!t)return!1;let n=t[Z];return t.parentNode===e&&(!n||n===a)},c=n.length,l=t.length,u=c,d=0,f=0,p=t[l-1],m=s(p)?p.nextSibling:r||null,h=null,g,_;for(;d<l||f<u;)if(t[d]===n[f])d++,f++;else{for(;l>d&&u>f&&t[l-1]===n[u-1];)l--,u--;if(l===d){let e=u;for(;e<c&&!s(n[e]);)e++;let t=e<c?n[e]:m;for(;f<u;)o(n[f++],t)}else if(u===f)for(;d<l;){let e=t[d++];h&&h.has(e)||!s(e)||e.remove()}else if((g=t[d])===n[u-1]&&n[f]===t[l-1]&&g.parentNode===e&&(!(_=g[Z])||_===a))do if(o(t[--l],g),f++,d>=l-1||f>=u)break;while(t[d]===n[u-1]&&n[f]===t[l-1]);else{if(!s(t[d])){d++;continue}if(!h){h=/* @__PURE__ */ new Map;let e=f;for(;e<u;)h.set(n[e],e++)}let c=h.get(t[d]);if(c!=null){if(f<c&&c<u){let s=d,p=1,m;for(;++s<l&&s<u&&(m=h.get(t[s]))!=null&&m===c+p;)p++;if(p>c-f){let e=t[d];for(;f<c;)o(n[f++],e)}else{let s=n[f++],c=t[d++];i&&e.contains(i)?o(s,c):e.replaceChild(s,c),(r||s[Z])&&(s[Z]=a)}}else d++}else t[d++].remove()}}}const Mr=`_$SOLID_EVENT_OWNER`,Nr={},Pr=/* @__PURE__ */ new Set,Fr=/* @__PURE__ */ new Map;function Ir(e,t,n,r={}){let i;Br(t);try{br(a=>{i=a,r.onError&&(x()[Re]=r.onError);let o=e();t===document?Ar(()=>Gn(o),()=>{}):Q(t,()=>o,t.firstChild?null:void 0,n,{...r.insertOptions,schedule:!0})},{id:r.renderId}),et()}catch(e){throw i&&i(),Vr(t),e}return()=>{i(),Vr(t),t.textContent=``}}function Lr(e,t,n){let r=document.createElement(`template`);r.innerHTML=e;let i=r.content.firstChild;return n===2?i.firstChild:i}function Rr(e,t){let n;return t===1?r=>document.importNode(n||=Lr(e,r,t),!0):r=>(n||=Lr(e,r,t)).cloneNode(!0)}function zr(e){for(let t of e)Pr.has(t)||(Pr.add(t),Fr.forEach((e,n)=>Wr(t,n,e)))}function Br(e){let t=Hr(e,e);t&&(t.roots=(t.roots||0)+1)}function Vr(e){let t=Fr.get(e);t&&(t.roots>1?t.roots--:delete t.roots),Ur(e,e)}function Hr(e,t=e){if(!e||!t)return;let n=Fr.get(e);return n||Fr.set(e,n={owners:/* @__PURE__ */ new Map,handlers:/* @__PURE__ */ new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),Pr.forEach(t=>Wr(t,e,n)),n}function Ur(e,t=e){let n=Fr.get(e);if(!n)return;let r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),n.owners.size||(n.handlers.forEach((t,n)=>e.removeEventListener(n,t)),Fr.delete(e))}function Wr(e,t,n){if(n.handlers.has(e))return;let r=e=>$r(e,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}const Gr=e=>e._$host||e.parentNode||e.host;function Kr(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=Gr(n)}}function qr(e,t,n){if(Zr(e))return;let r=t===`multiple`&&e.localName===`select`;if(n==null||n===!1)e.removeAttribute(t);else if(e.setAttribute(t,n===!0?``:n),r&&!e._$multiple){let t=e.options;for(let e=0;e<t.length;e++)t[e].defaultSelected&&(t[e].selected=!0)}r&&(e._$multiple=!0)}function Jr(e,t){Array.isArray(e)?e.flat(1/0).forEach(e=>e&&e(t)):e(t)}function Yr(e,t){let n=$t(e);K(null,()=>Jr(n,t))}const Xr={scope:!0};function Q(e,t,n,r,i){let a=n!==void 0,o=i&&i.host;if(a&&!r&&(r=[]),typeof t!=`function`&&(t=ti(t,r,a,!0),typeof t!=`function`)){ei(e,t,r,n),o&&ni(t,o);return}if(a&&r.length===0){let t=document.createTextNode(``);e.insertBefore(t,n),r=[t]}let s=r,c=!1;Ar(()=>{let r=ti(t(),s,a,!0),l=c;return c=!0,typeof r==`function`?(Ar(()=>ti(r,s,a),t=>{s=ei(e,t,s,n),o&&ni(s,o)},l&&!(i&&i.schedule)?{...i,schedule:!0}:i),Nr):r},t=>{t!==Nr&&(s=ei(e,t,s,n),o&&ni(s,o))},t.$s?i?{...i,scope:!0}:Xr:i)}function Zr(e){return!Dr.hydrating||Dr.isClaiming&&!Dr.isClaiming()?!1:!e||e.isConnected?!0:Qr!==null&&Qr.claimed(e)}let Qr=null;function $r(e,t,n){let r=e[Mr],i;if(r){if(r===!0||r===t||!t.contains(r))return;i=r}let a=n.owners.size===1&&n.owners.has(t)?t:Kr(e.target,n)?.owner;if(!a||a===i)return;e[Mr]=a;let o=i||e.target,s=`_$$`+e.type,c=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),l=()=>{let t=o[s];if(t&&!o.disabled){let n=o[`${s}Data`];if(n===void 0?typeof t==`function`?t.call(o,e):t.handleEvent(e):t.call(o,n,e),e.cancelBubble)return}return o.host&&typeof o.host!=`string`&&!o.host._$host&&o.contains(e.target)&&c(o.host),!0},u=()=>o===a||o.parentNode===a,d=()=>{for(;o&&l()&&!u();)o=Gr(o)};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return o||a}}),i)i===e.target&&(o=Gr(i)),o&&o!==a&&d();else if(e.composedPath){let t=e.composedPath();if(t.length){c(t[0]);for(let e=0;e<t.length&&(o=t[e],l());e++){if(o._$host){o=o._$host,d();break}if(u())break}}else d()}else d();delete e.target,delete e.currentTarget}function ei(e,t,n,r){if(t===n)return t;let i=typeof t,a=r!==void 0;if(i===`string`||i===`number`){let r=typeof n;r===`string`||r===`number`?e.firstChild.data=t:ri(e,n)?e.textContent=t:(ii(e,n),e.insertBefore(document.createTextNode(t),e.firstChild))}else if(t===void 0)ai(e,n,r);else if(t.nodeType)Array.isArray(n)?ai(e,n,a?r:null,t):n!=null&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n!=null&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),(r||t[Z])&&(t[Z]=r||e);else if(Array.isArray(t)){let i=Array.isArray(n);for(let e=0,r=t.length;e<r;e++){let r=t[e],a=typeof r;if(a===`string`||a===`number`){let a=i?n[e]:void 0;a&&a.nodeType===3?(a.data!==``+r&&(a.data=r),t[e]=a):t[e]=document.createTextNode(r)}}t.length===0?ai(e,n,r):i?jr(e,n,t,r):(n!=null&&ai(e,n),jr(e,[],t))}return t}function ti(e,t,n,r){return e=Gn(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e==`function`||n&&!Array.isArray(e)&&(e=[e??``]),e}function ni(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)ni(e[n],t);else e&&e.nodeType&&e[Or]!==t&&(e[Or]=t,Object.defineProperty(e,"_$host",{get:t,configurable:!0}))}function ri(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length?e.firstChild===t[0]&&e.lastChild===t[t.length-1]:e.firstChild===null;if(t===``)return e.firstChild===null;if(t.nodeType)return e.firstChild===t&&e.lastChild===t;let n=e.firstChild;return n!==null&&n.nodeType===3&&e.lastChild===n}function ii(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];r.parentNode===e&&r.remove()}else if(t.nodeType)t.parentNode===e&&t.remove();else{let t=e.firstChild;t&&t.nodeType===3&&t.remove()}}function ai(e,t,n,r){if(n===void 0)return ri(e,t)?e.textContent=``:ii(e,t);if(t.length){let i=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(r!==o){let t=o[Z],s=o.parentNode===e&&(!t||t===(n||e));r&&!i&&!a?s?e.replaceChild(r,o):e.insertBefore(r,n):s&&o.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&(n||r[Z])&&(r[Z]=n||e)}const oi=mr(),si=()=>hr(oi);function ci(e){return(t,n,r)=>Ir(()=>{let t=e=>{let[t,n]=yr({v:e()});return Fn(()=>e.on(e=>n({v:e}))),()=>t().v},i=t(r.events),a=t(r.theme),o=t(r.listeners),s=t(r.forms),c=t(r.unread),l={page:r.page,events:i,last:e=>i().findLast(t=>t.type===e),append:r.append,theme:a,listeners:o,forms:s,unread:c,markdown:r.markdown,message:r.message,toast:r.toast};return wr(oi,{value:l,get children(){return wr(e,n)}})},t)}const li=[`border-bottom-width`,`border-left-width`,`border-right-width`,`border-top-width`,`box-sizing`,`font-family`,`font-size`,`font-style`,`font-weight`,`letter-spacing`,`line-height`,`padding-bottom`,`padding-left`,`padding-right`,`padding-top`,`tab-size`,`text-indent`,`text-rendering`,`text-transform`,`width`,`word-break`],ui={"min-height":`0`,"max-height":`none`,"min-width":`0`,"max-width":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`};function di(e){let t=getComputedStyle(e),n={};for(let e of li)n[e]=t.getPropertyValue(e);return n[`box-sizing`]?{style:n,padding:parseFloat(n[`padding-bottom`])+parseFloat(n[`padding-top`]),border:parseFloat(n[`border-bottom-width`])+parseFloat(n[`border-top-width`])}:null}let $=null;function fi(e,t,n,r){$||($=document.createElement(`textarea`),$.setAttribute(`tabindex`,`-1`),$.setAttribute(`aria-hidden`,`true`)),$.isConnected||document.body.append($);for(let[t,n]of Object.entries(e.style))$.style.setProperty(t,n);for(let[e,t]of Object.entries(ui))$.style.setProperty(e,t,`important`);let i=e.style[`box-sizing`]===`border-box`,a=t=>i?t+e.padding+e.border:t;$.value=t;let o=i?$.scrollHeight+e.border:$.scrollHeight-e.padding;$.value=`x`;let s=$.scrollHeight-e.padding,c=a(s*r);return{height:Math.min(c,Math.max(a(s*n),o)),full:o>=c}}function pi(e={}){let t,n=0,r=()=>{if(!t)return;let r=di(t);if(!r)return;let{height:i,full:a}=fi(r,t.value||t.placeholder||`x`,e.minRows??1,e.maxRows??1/0);t.style.setProperty(`overflow-y`,a?`auto`:`hidden`,`important`),i!==n&&(n=i,t.style.setProperty(`height`,`${i}px`,`important`))};return Fn(()=>{let e=t;if(!e)return;r(),e.addEventListener(`input`,r);let n=new ResizeObserver(()=>r());return n.observe(e),()=>{e.removeEventListener(`input`,r),n.disconnect()}}),e=>{t=e}}var mi=/* @__PURE__ */ Rr(`<div class=wp-chat><div class=wp-chat-new><textarea rows=1></textarea><button type=button>`),hi=/* @__PURE__ */ Rr(`<div class=wp-chat-message><span class=wp-chat-who>`),gi=/* @__PURE__ */ Rr(`<div class=wp-chat-bubble data-md>`),_i=/* @__PURE__ */ Rr(`<div class=wp-chat-bubble>`);const vi=`chat:message`;function yi(e,t){let n=new Set(t);return Object.entries(e.data).filter(([e,t])=>!n.has(e)&&typeof t==`string`&&t.trim()).map(([,e])=>String(e).trim()).join(`
|
|
2
|
+
|
|
3
|
+
`)}function bi(e){let t=si(),n=vr(()=>{let n=t.events(),r=n.filter(t=>t.type===vi&&t.data.chat===e.chat),i=new Set(r.map(e=>e.data.replaces).filter(Boolean).map(String)),a=[];for(let t of r){if(i.has(t.id))continue;let r=e.form&&t.data.replyTo?n.find(n=>n.id===t.data.replyTo&&n.type===e.form):void 0,o=r?yi(r,e.choices):``;r&&o&&!a.some(e=>e.id===r.id)&&a.push({id:r.id,from:`you`,text:o}),a.push({id:t.id,from:t.from===`cli`?`agent`:`you`,text:String(t.data.text??``),sending:!!t.sending,event:t.from===`cli`?t:void 0})}return a}),r,i=`wp-chat-draft:${location.pathname}|${e.chat}`,a=e=>{try{e.trim()?localStorage.setItem(i,e):localStorage.removeItem(i)}catch{}},o=e=>{e.addEventListener(`input`,()=>a(e.value));try{let t=localStorage.getItem(i);t&&!e.value&&(e.value=t,queueMicrotask(()=>e.dispatchEvent(new Event(`input`))))}catch{}},s=async()=>{let n=r?.value.trim();if(!n)return;let i=e=>{r.value=e,r.dispatchEvent(new Event(`input`))};i(``);try{await t.append(vi,{chat:e.chat,text:n})}catch(e){console.error(e),r.value.trim()||i(n),t.toast(`Couldn't send the message`,{kind:`alert`,name:`chat-failed`,details:`It's back in the box: send it again.`})}};var c=mi(),l=c.firstChild,u=l.firstChild,d=u.nextSibling;return Q(c,wr(Tr,{get each(){return n()},keyed:e=>e.id,children:e=>(()=>{var t=hi(),n=t.firstChild;return Q(n,()=>e().from),Q(t,wr(xi,{get text(){return e().text},get event(){return e().event}}),null),Ar(()=>({e:e().sending?void 0:`message:${e().id}`,t:e().from,a:e().sending?``:void 0,o:e().from===`agent`?e().id:void 0}),({e,t:n,a:r,o:i},a)=>{e!==a?.e&&qr(t,`id`,e),n!==a?.t&&qr(t,`data-from`,n),r!==a?.a&&qr(t,`data-sending`,r),i!==a?.o&&qr(t,`data-wp-message`,i)}),t})()}),l),u._$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),s())},Yr(()=>[e=>r=e,pi({maxRows:10}),o],u),d._$$click=s,Q(d,()=>e.form?`Ask`:`Send`),Ar(()=>({e:e.form?``:void 0,t:e.form?`Ask about this question (doesn't choose anything)`:`Write a message`}),({e,t},n)=>{e!==n?.e&&qr(c,`data-under-form`,e),t!==n?.t&&qr(u,`placeholder`,t)}),c}function xi(e){let t=si(),n=vr(()=>e.event?t.message(e.event):t.markdown(e.text)),r,i;return Sr(()=>e.text,e=>{i!==void 0&&e!==i&&r?.dispatchEvent(new CustomEvent(`wp-changed`,{bubbles:!0})),i=e}),wr(Er,{get fallback(){var t=_i();return Q(t,()=>e.text),t},get children(){var e=gi();return Yr(()=>e=>r=e,e),Ar(()=>n(),t=>{e.innerHTML=t}),e}})}var Si=ci(bi);zr([`keydown`,`click`]);export{Si as default};
|