tosijs-ui 1.6.18 → 1.6.19
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 +27 -0
- package/dist/doc-browser.js +5 -1
- package/dist/doc-system/site/check-examples.d.ts +14 -0
- package/dist/doc-system/site/check-examples.js +97 -0
- package/dist/doc-system/site/orchestrator.js +16 -0
- package/dist/doc-system/site/site-config.d.ts +9 -0
- package/dist/iife.js +3 -3
- package/dist/iife.js.map +5 -5
- package/dist/live-example/component.js +10 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.19
|
|
4
|
+
|
|
5
|
+
Doc-system tooling; no component API changes.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Build-time example transpile check.** Every executable live-example block
|
|
10
|
+
(`js` / `tjs` / `ts` / `test`) across the whole corpus is run through the front
|
|
11
|
+
half of the runtime pipeline — `rewriteImports` → transform → `new
|
|
12
|
+
AsyncFunction` — at build time, **without executing it**, so a block that can't
|
|
13
|
+
build (a syntax/import error, or illustrative code mistakenly tagged with an
|
|
14
|
+
executable language instead of the display-only `typescript`) **fails the build**
|
|
15
|
+
with the offending doc/block named, on every page — including fences hidden in
|
|
16
|
+
blockquotes and lists. TypeScript is transpiled with bun's own transpiler
|
|
17
|
+
(network-free). Opt out with `checkExamples: false`.
|
|
18
|
+
- **"One Source, Every Artifact"** doc page — how one corpus of doc-comments +
|
|
19
|
+
markdown projects into a static SEO site, a self-testing live playground with
|
|
20
|
+
in-browser TypeScript, an ePub/PDF, and an agent-debuggable page. Embeds a live
|
|
21
|
+
`<tosi-doc-system>` (the whole system running inside its own page).
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **A live example's build/exec failure is now a test failure whether or not it
|
|
26
|
+
defines `test` blocks.** So on any page the browser test runner loads, *all* of
|
|
27
|
+
its examples are checked for explosions — a no-test example that throws is
|
|
28
|
+
reported as a failed test — not just blocks with explicit assertions.
|
|
29
|
+
|
|
3
30
|
## 1.6.18
|
|
4
31
|
|
|
5
32
|
Doc-site tooling; no component API changes.
|
package/dist/doc-browser.js
CHANGED
|
@@ -1250,7 +1250,11 @@ export function createDocBrowser(options) {
|
|
|
1250
1250
|
if (isTestFrame)
|
|
1251
1251
|
return; // Don't run background tests in test iframe
|
|
1252
1252
|
backgroundTestsStarted = true;
|
|
1253
|
-
// Find all docs that have test blocks
|
|
1253
|
+
// Find all docs that have test blocks. (Pages with examples but no explicit
|
|
1254
|
+
// tests are covered cheaply at BUILD time by the transpile check —
|
|
1255
|
+
// src/doc-system/site/check-examples.ts — without loading them in a browser,
|
|
1256
|
+
// so the runner doesn't have to render every heavy page just to notice a
|
|
1257
|
+
// build error.)
|
|
1254
1258
|
const docsWithTests = docs.filter((doc) => doc.text.includes('```test'));
|
|
1255
1259
|
pagesWithTests = docsWithTests.length;
|
|
1256
1260
|
if (pagesWithTests > 0) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Doc } from './docs';
|
|
2
|
+
export interface ExampleProblem {
|
|
3
|
+
filename: string;
|
|
4
|
+
title: string;
|
|
5
|
+
lang: string;
|
|
6
|
+
error: string;
|
|
7
|
+
snippet: string;
|
|
8
|
+
}
|
|
9
|
+
/** Transpile-check every executable block in the corpus. Returns the problems. */
|
|
10
|
+
export declare function checkExamples(docs: Doc[], opts?: {
|
|
11
|
+
contextKeys?: string[];
|
|
12
|
+
}): Promise<ExampleProblem[]>;
|
|
13
|
+
/** Format problems for a build log. */
|
|
14
|
+
export declare function formatExampleProblems(problems: ExampleProblem[]): string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Build-time transpile check for live examples.
|
|
3
|
+
|
|
4
|
+
Every executable code block in the corpus (`js` / `tjs` / `ts` / `test`) is put
|
|
5
|
+
through the SAME front half of the runtime pipeline the live-example component
|
|
6
|
+
uses — `rewriteImports` → the tjs-lang transform → `new AsyncFunction(...)` — so a
|
|
7
|
+
block that can't build (a tjs/TS syntax error, an unsupported import, or
|
|
8
|
+
illustrative config mistakenly tagged with an executable language like `ts`
|
|
9
|
+
instead of the display-only `typescript`) fails the build *at authoring time*,
|
|
10
|
+
on every page, instead of silently rendering an error only when someone opens
|
|
11
|
+
that page. `html` / `css` and display-only languages (`typescript`, `json`, …)
|
|
12
|
+
are not executed, so they're skipped.
|
|
13
|
+
|
|
14
|
+
Build-time only (bun). Never import from browser code.
|
|
15
|
+
*/
|
|
16
|
+
import { marked } from 'marked';
|
|
17
|
+
import { rewriteImports, AsyncFunction, loadTransform } from '../../live-example/code-transform';
|
|
18
|
+
// The default live-example context (matches the IIFE globals the pages provide).
|
|
19
|
+
// A project that sets a custom `context` on its <tosi-doc-system> can pass its
|
|
20
|
+
// own keys; these are the tosijs-ui defaults.
|
|
21
|
+
const DEFAULT_CONTEXT_KEYS = ['tosijs', 'tosijs-ui'];
|
|
22
|
+
const EXECUTABLE = new Set(['js', 'tjs', 'ts', 'test']);
|
|
23
|
+
/** The bare dialect from a fence info string ('js#my-id' → 'js'); '' if none. */
|
|
24
|
+
function dialectOf(info) {
|
|
25
|
+
return (info ?? '').match(/^[a-z]+/)?.[0] ?? '';
|
|
26
|
+
}
|
|
27
|
+
/** Collect every fenced code block in a doc (recursing into lists/quotes). */
|
|
28
|
+
function collectCodeTokens(text) {
|
|
29
|
+
const out = [];
|
|
30
|
+
const walk = (tokens) => {
|
|
31
|
+
for (const t of tokens) {
|
|
32
|
+
if (t.type === 'code')
|
|
33
|
+
out.push({ lang: dialectOf(t.lang), text: t.text });
|
|
34
|
+
if (Array.isArray(t.tokens))
|
|
35
|
+
walk(t.tokens);
|
|
36
|
+
if (Array.isArray(t.items))
|
|
37
|
+
walk(t.items); // list items
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
walk(marked.lexer(text));
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/** Transpile-check every executable block in the corpus. Returns the problems. */
|
|
44
|
+
export async function checkExamples(docs, opts = {}) {
|
|
45
|
+
const contextKeys = opts.contextKeys ?? DEFAULT_CONTEXT_KEYS;
|
|
46
|
+
const problems = [];
|
|
47
|
+
for (const doc of docs) {
|
|
48
|
+
for (const block of collectCodeTokens(doc.text)) {
|
|
49
|
+
if (!EXECUTABLE.has(block.lang))
|
|
50
|
+
continue;
|
|
51
|
+
// `test` blocks are conventional JS/TS, transpiled as plain js.
|
|
52
|
+
const dialect = block.lang === 'test' ? 'js' : block.lang;
|
|
53
|
+
try {
|
|
54
|
+
const rewritten = rewriteImports(block.text, contextKeys);
|
|
55
|
+
let js;
|
|
56
|
+
if (dialect === 'ts') {
|
|
57
|
+
// Use bun's own transpiler — network-free (the runtime `ts` path
|
|
58
|
+
// fetches the TypeScript compiler from a CDN, which can't run here).
|
|
59
|
+
// We only need to validate that the source builds, not reproduce tjs
|
|
60
|
+
// lowering exactly.
|
|
61
|
+
js = new Bun.Transpiler({ loader: 'ts' }).transformSync(rewritten);
|
|
62
|
+
}
|
|
63
|
+
else if (dialect === 'tjs') {
|
|
64
|
+
const transform = await loadTransform('tjs');
|
|
65
|
+
js = (await transform(rewritten, { transforms: ['typescript'] })).code;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
js = rewritten; // `js` / `test` are already JS
|
|
69
|
+
}
|
|
70
|
+
// Syntax-validate the way the component does before running it.
|
|
71
|
+
// eslint-disable-next-line no-new
|
|
72
|
+
new AsyncFunction(js);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
problems.push({
|
|
76
|
+
filename: doc.filename,
|
|
77
|
+
title: doc.title,
|
|
78
|
+
lang: block.lang,
|
|
79
|
+
error: err.message || String(err),
|
|
80
|
+
snippet: block.text.split('\n').slice(0, 3).join('\n'),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return problems;
|
|
86
|
+
}
|
|
87
|
+
/** Format problems for a build log. */
|
|
88
|
+
export function formatExampleProblems(problems) {
|
|
89
|
+
return problems
|
|
90
|
+
.map((p) => ` ✗ ${p.filename} (${p.lang}) — ${p.title}\n` +
|
|
91
|
+
` ${p.error}\n` +
|
|
92
|
+
p.snippet
|
|
93
|
+
.split('\n')
|
|
94
|
+
.map((l) => ` | ${l}`)
|
|
95
|
+
.join('\n'))
|
|
96
|
+
.join('\n\n');
|
|
97
|
+
}
|
|
@@ -16,6 +16,7 @@ import { existsSync, mkdirSync } from 'fs';
|
|
|
16
16
|
import { gzipSync } from 'zlib';
|
|
17
17
|
import { $ } from 'bun';
|
|
18
18
|
import { extractDocs } from './docs';
|
|
19
|
+
import { checkExamples, formatExampleProblems } from './check-examples';
|
|
19
20
|
import { ensureSections } from './sections';
|
|
20
21
|
import { generateLlmsTxt } from './make-llms-txt';
|
|
21
22
|
import { generateSite } from './generate-site';
|
|
@@ -68,6 +69,21 @@ export async function buildSite(config) {
|
|
|
68
69
|
sectionsDir: config.sectionsDir ?? 'src/docs',
|
|
69
70
|
reExtract: extract,
|
|
70
71
|
});
|
|
72
|
+
// Fail fast on any live example that can't build — a real syntax/import error,
|
|
73
|
+
// or illustrative code mistakenly tagged executable (`js`/`ts`/…) instead of
|
|
74
|
+
// display-only `typescript`. Runs on the whole corpus, so it catches breakage
|
|
75
|
+
// on pages the browser test never navigates to.
|
|
76
|
+
if (config.checkExamples !== false) {
|
|
77
|
+
const corpus = JSON.parse(await Bun.file(DOCS_JSON).text());
|
|
78
|
+
const problems = await checkExamples(corpus);
|
|
79
|
+
if (problems.length) {
|
|
80
|
+
throw new Error(`doc-site build: ${problems.length} live example(s) failed to build:\n\n` +
|
|
81
|
+
formatExampleProblems(problems) +
|
|
82
|
+
`\n\nFix the code, or — if a block is illustrative and not meant to run —` +
|
|
83
|
+
` tag it with a display-only language like \`typescript\` instead of` +
|
|
84
|
+
` \`js\`/\`ts\`. (Disable with checkExamples: false.)`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
71
87
|
// Copy static-asset dirs into the web root.
|
|
72
88
|
const staticDirs = config.staticDirs ?? (existsSync('demo/static') ? ['demo/static'] : ['static']);
|
|
73
89
|
for (const dir of staticDirs) {
|
|
@@ -143,6 +143,15 @@ export interface SiteConfig {
|
|
|
143
143
|
* `sort: 'filename'` gives a folder of chapters natural order with no metadata.
|
|
144
144
|
*/
|
|
145
145
|
book?: BookManifest;
|
|
146
|
+
/**
|
|
147
|
+
* Fail the build when a live example can't transpile — a real syntax/import
|
|
148
|
+
* error, or illustrative code mistakenly tagged with an executable language
|
|
149
|
+
* (`js`/`ts`/`tjs`/`test`) instead of the display-only `typescript`. Catches it
|
|
150
|
+
* at build time, on every page, instead of only when someone opens that page.
|
|
151
|
+
* Default true; assumes the default `tosijs` / `tosijs-ui` example context —
|
|
152
|
+
* set false if your examples import from a custom `context` the check can't see.
|
|
153
|
+
*/
|
|
154
|
+
checkExamples?: boolean;
|
|
146
155
|
/** served web-root output dir, default 'docs' */
|
|
147
156
|
outputDir?: string;
|
|
148
157
|
/** dev-server port, default 8787 */
|
package/dist/iife.js
CHANGED
|
@@ -105,7 +105,7 @@ ${x}
|
|
|
105
105
|
${x.testUtils}
|
|
106
106
|
return ${h.testRunner}`,C={preview:Y1({class:"preview"}),...this.context},k=Object.keys(C).map(q2),g=Object.values(C),w=new j2(...k,i);this.lastTjsTests=await w(...g)}catch(l){this.lastTjsTests={passed:0,failed:1,results:[{description:"inline tests failed to run",passed:!1,error:String(l)}]}}this.renderTjsTests()}renderTjsTests(){let y=this.tjsTestsView;if(!y)return;let x=this.lastTjsTests;if(!x||x.results.length===0){y.replaceChildren(Y1({class:"tjs-test-empty"},"No inline tjs tests."));return}y.replaceChildren(Y1({class:"tjs-test-summary"},`${x.passed}/${x.results.length} passed`),...x.results.map((h)=>Y1({class:h.passed?"test-pass":"test-fail"},`${h.passed?"✓":"✗"} ${h.description}`,h.error?f3({class:"tjs-test-error"},` — ${h.error}`):"")))}async computeGeneratedJs(y){if(this.dialect==="js")return"";try{return(await y(X1(this.js,Object.keys(this.context)))).code}catch(x){return`// transpile error:
|
|
107
107
|
// ${x.message}`}}ensureProductTabs(){if(this.productTabsReady||this.dialect==="js"||!this.hydrated)return;this.productTabsReady=!0;let{editors:y}=this.parts;if(this.parts.js.setAttribute("name",this.dialect),this.jsOutEditor=L1({name:"JS",mode:"javascript",disabled:!0}),y.append(this.jsOutEditor),this.inlineTjsTestCount>0)this.tjsTestsView=Y1({name:"tjs tests",class:"tjs-test-results"}),y.append(this.tjsTestsView);y.setupTabs(),this.jsOutEditor.value=this.lastGeneratedJs,this.renderTjsTests()}updateUndo=()=>{let{activeTab:y}=this,{undo:x,redo:h}=this.parts;if(y instanceof r1&&y.editor!==void 0){let l=y.editor.session.getUndoManager();x.disabled=!l.hasUndo(),h.disabled=!l.hasRedo()}else x.disabled=!0,h.disabled=!0;this.updateEditedIndicator(),this.updateTestResultsVisibility()};updateTestResultsVisibility(){let{testResults:y}=this.parts,x=this.testResults,h=this.activeTab===this.parts.test,l=x&&x.failed>0;y.hidden=!x||x.tests.length===0||!h&&!l}undo=()=>{let{activeTab:y}=this;if(y instanceof r1)y.editor.undo()};redo=()=>{let{activeTab:y}=this;if(y instanceof r1)y.editor.redo()};get isMaximized(){return this.classList.contains("-maximize")}flipLayout=()=>{this.classList.toggle("-vertical")};saveToSource=async()=>{let y=this.getAttribute("data-source-file"),x=this.getAttribute("data-example-ordinal");if(!y||x===null){window.alert("No source mapping for this example.");return}let h;try{let i=await fetch(`/__docstore/source?file=${encodeURIComponent(y)}`);if(!i.ok)throw Error(String(i.status));h=await i.text()}catch{window.alert("Source endpoint unavailable — saving to source works in dev only.");return}let l=u6(h,Number(x),{js:this.js,html:this.html,css:this.css,test:this.test});if(l===null){let i=Number(x),C=J3(h,c3(h));if(i>=C.length)window.alert(`Couldn't locate this example in ${y}: it's example #${i+1} on the page, but a raw scan of the file finds only ${C.length} fenced example group(s). The page↔source ordinals `+"disagree — likely multiple docs in one file, or indented fences. "+"(File a report with the source structure.)");else window.alert("No changes to save.");return}try{let i=await fetch("/__docstore/source",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:y,content:l})});if(!i.ok)throw Error(String(i.status));window.alert(`Saved to ${y}`)}catch{window.alert("Save failed.")}};exampleMenu=()=>{let y=U1.enabled.value;o({target:this.parts.exampleWidgets,width:"auto",menuItems:[{icon:"edit2",caption:"view/edit code",action:this.showCode},{icon:"edit",caption:"view/edit code in a new window",action:this.openEditorWindow},null,{icon:this.isMaximized?"minimize":"maximize",caption:this.isMaximized?"restore preview":"maximize preview",action:this.toggleMaximize},null,{icon:y?"check":"",caption:"Run tests",action:()=>{if(y)T3();else I3()}}]})};handleShortcuts=(y)=>{if(y.metaKey||y.ctrlKey){let x=!1;switch(y.key){case"s":case"r":this.doRefresh(),x=!0;break;case"/":this.flipLayout();break;case"c":if(y.shiftKey)this.copy(),x=!0;break}if(x)y.preventDefault(),y.stopPropagation()}};content=()=>[Y1({part:"example"},Vi({part:"style"}),Y1({part:"testIndicator",title:"test status"}),l7({part:"testResults",hidden:!0}),W0({title:"example menu",part:"exampleWidgets",onClick:this.exampleMenu},p.code())),Y1({class:"code-editors",part:"codeEditors",onKeydown:this.handleShortcuts,hidden:!0},U0({part:"editors",onChange:this.updateUndo},L1({name:"js",mode:"javascript",part:"js"}),L1({name:"html",mode:"html",part:"html"}),L1({name:"css",mode:"css",part:"css"}),L1({name:"DOM tests",mode:"javascript",part:"test"}),Y1({slot:"after-tabs",class:"row"},W0({title:"undo",part:"undo",class:"transparent",onClick:this.undo},p.cornerUpLeft()),W0({title:"redo",part:"redo",class:"transparent",onClick:this.redo},p.cornerUpRight()),W0({title:"example menu — refresh, flip, undo, copy, save/revert edits",class:"transparent source-menu",onClick:this.sourceMenu},p.moreVertical()),W0({title:"close code",class:"transparent",onClick:this.closeCode},p.x())))),qi({part:"sources",hidden:!0})];connectedCallback(){super.connectedCallback(),this.flushPendingValues();let{sources:y}=this.parts;this.initFromElements([...y.children]),this.remoteSync=new Q0(this.storageKey,this.remoteKey,(h)=>{if(h.close){if(this.remoteId!=="")window.close();else this.classList.remove("-maximize"),this.parts.codeEditors.hidden=!0;return}if(this.css=h.css,this.html=h.html,this.js=h.js,h.test)this.test=h.test;if(this.remoteId!==""&&h.original&&!this.originalCode)this.originalCode={...h.original};this.refresh()}),this.remoteSync.startListening();let x=Math.random()*100;this.undoInterval=setInterval(()=>{if(!document.hidden)this.updateUndo()},250+x),this.beforeUnloadHandler=()=>this.remoteSync?.sendClose(),addEventListener("beforeunload",this.beforeUnloadHandler)}disconnectedCallback(){if(super.disconnectedCallback(),this.remoteSync?.sendClose(),this.remoteSync?.stopListening(),this.undoInterval)clearInterval(this.undoInterval),this.undoInterval=void 0;if(this.beforeUnloadHandler)removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=void 0}exampleMarkdown(){let y=(x,h)=>h!==""?"```"+x+`
|
|
108
|
-
`+h.trim()+"\n```\n":"";return y(this.dialect,this.js)+y("html",this.html)+y("css",this.css)+y("test",this.test)}copy=()=>{navigator.clipboard.writeText(this.exampleMarkdown())};downloadExample=()=>{let y=this.getAttribute("data-source-file")||"example",x=this.getAttribute("data-example-ordinal"),h=(y.split("/").pop()||"example").replace(/\.\w+$/,"")+(x!==null?`-example-${x}`:"")+".md",l=URL.createObjectURL(new Blob([this.exampleMarkdown()],{type:"text/markdown"})),i=document.createElement("a");i.href=l,i.download=h,i.click(),setTimeout(()=>URL.revokeObjectURL(l),1000)};originalCode=null;localEditKey(){let y=this.getAttribute("data-source-file"),x=this.getAttribute("data-example-ordinal");return y&&x!==null?a6(y,x):""}applyEdit(y){if(y.js!==void 0)this.js=y.js;if(y.html!==void 0)this.html=y.html;if(y.css!==void 0)this.css=y.css;if(y.test!==void 0)this.test=y.test}hasLocalEdits(){if(!this.originalCode)return!1;let y=this.originalCode,x=(h)=>(h??"").replace(/\s+$/,"");return x(this.js)!==x(y.js)||x(this.html)!==x(y.html)||x(this.css)!==x(y.css)||x(this.test)!==x(y.test)}updateEditedIndicator(){this.classList.toggle("-locally-edited",this.hasLocalEdits())}canUndo(){let y=this.activeTab;return y instanceof r1&&y.editor!==void 0&&y.editor.session.getUndoManager().hasUndo()}canRedo(){let y=this.activeTab;return y instanceof r1&&y.editor!==void 0&&y.editor.session.getUndoManager().hasRedo()}saveLocalEdit=()=>{let y=this.localEditKey();if(!y){window.alert("This example has no source mapping to key a local save.");return}m6(y,{js:this.js,html:this.html,css:this.css,test:this.test}),this.updateEditedIndicator()};revertLocalEdit=()=>{let y=this.localEditKey();if(y)E6(y);if(this.originalCode)this.applyEdit(this.originalCode);if(this.viewingChanges)this.viewChanges();this.updateEditedIndicator(),this.refresh()};snapshotAndRestoreLocalEdit=()=>{this.originalCode={js:this.js,html:this.html,css:this.css,test:this.test};let y=this.localEditKey();if(!y||!e6(y))return;let x=t6(y);if(x)this.applyEdit(x),this.updateEditedIndicator(),this.refresh()};viewingChanges=!1;viewChanges=()=>{if(!this.hydrated)return;if(this.viewingChanges=!this.viewingChanges,this.viewingChanges)this.showCode();let y=this.originalCode??{};for(let x of["js","html","css","test"])this.parts[x].original=y[x]??"",this.parts[x].showDiff(this.viewingChanges)};doRefresh=()=>{if(this.remoteId!=="")this.refreshRemote();else this.refresh()};sourceMenu=(y)=>{let x=this.localEditKey(),h=()=>this.hasLocalEdits(),l=this.originalCode!=null;o({target:y.target.closest("button"),width:"auto",menuItems:[{icon:"refreshCw",caption:"Refresh",shortcut:"⌘R",action:this.doRefresh},{icon:"columns",caption:"Flip layout",shortcut:"⌘/",action:this.flipLayout},{icon:"cornerUpLeft",caption:"Undo",shortcut:"⌘Z",action:this.undo,enabled:()=>this.canUndo()},{icon:"cornerUpRight",caption:"Redo",shortcut:"⌘⇧Z",action:this.redo,enabled:()=>this.canRedo()},null,{icon:"copy",caption:"Copy as markdown",shortcut:"⌘⇧C",action:this.copy},{icon:"download",caption:"Download",action:this.downloadExample},null,...l?[this.viewingChanges?{icon:"edit",caption:"Back to editing",action:this.viewChanges}:{icon:"code",caption:"View changes",action:this.viewChanges,enabled:h}]:[],...x?[{icon:"save",caption:"Save changes (local)",action:this.saveLocalEdit,enabled:h}]:[],...x&&C7?[{icon:"upload",caption:"Save to source",action:()=>{this.saveToSource()},enabled:h}]:[],...l?[{icon:"rotateCcw",caption:"Revert to original",action:this.revertLocalEdit,enabled:h}]:[]]})};toggleMaximize=()=>{this.classList.toggle("-maximize")};showCode=()=>{this.classList.add("-maximize"),this.classList.toggle("-vertical",this.offsetHeight>this.offsetWidth),this.parts.codeEditors.hidden=!1,this.ensureProductTabs()};closeCode=()=>{if(this.remoteId!=="")this.remoteSync?.sendClose(),window.close();else this.remoteSync?.sendClose(),this.classList.remove("-maximize"),this.parts.codeEditors.hidden=!0};openEditorWindow=()=>{let{css:y,html:x,js:h,test:l}=this;o6(this.prefix,this.uuid,this.storageKey,this.remoteKey,{css:y,html:x,js:h,test:l},{sourceFile:this.getAttribute("data-source-file"),ordinal:this.getAttribute("data-example-ordinal"),original:this.originalCode??void 0}),this.classList.add("-maximize"),this.parts.codeEditors.hidden=!0};refreshRemote=()=>{this.remoteSync?.send({css:this.css,html:this.html,js:this.js,test:this.test})};updateSources=()=>{if(this.persistToDom){let{sources:y}=this.parts;y.innerText="";for(let x of["js","css","html","test"])if(this[x])y.append(l7({class:`language-${x}`,innerHTML:this[x]}))}};refresh=async()=>{if(this.remoteId!=="")return;let y=await p0(this.dialect),{example:x,style:h,exampleWidgets:l}=this.parts;if(this.dialect!=="js"){if(this.lastGeneratedJs=await this.computeGeneratedJs(y),this.jsOutEditor)this.jsOutEditor.value=this.lastGeneratedJs;await this.runInlineTjsTests(y)}let i,C,k=(g)=>{C=g};if(this.iframe)i=await Y4({html:this.html,css:this.css,js:this.js,context:this.context,transform:y,exampleElement:x,widgetsElement:l,onError:k});else i=await X4({html:this.html,css:this.css,js:this.js,context:this.context,transform:y,exampleElement:x,styleElement:h,widgetsElement:l,onError:k});if(this.persistToDom)this.updateSources();if((this.test||C)&&
|
|
108
|
+
`+h.trim()+"\n```\n":"";return y(this.dialect,this.js)+y("html",this.html)+y("css",this.css)+y("test",this.test)}copy=()=>{navigator.clipboard.writeText(this.exampleMarkdown())};downloadExample=()=>{let y=this.getAttribute("data-source-file")||"example",x=this.getAttribute("data-example-ordinal"),h=(y.split("/").pop()||"example").replace(/\.\w+$/,"")+(x!==null?`-example-${x}`:"")+".md",l=URL.createObjectURL(new Blob([this.exampleMarkdown()],{type:"text/markdown"})),i=document.createElement("a");i.href=l,i.download=h,i.click(),setTimeout(()=>URL.revokeObjectURL(l),1000)};originalCode=null;localEditKey(){let y=this.getAttribute("data-source-file"),x=this.getAttribute("data-example-ordinal");return y&&x!==null?a6(y,x):""}applyEdit(y){if(y.js!==void 0)this.js=y.js;if(y.html!==void 0)this.html=y.html;if(y.css!==void 0)this.css=y.css;if(y.test!==void 0)this.test=y.test}hasLocalEdits(){if(!this.originalCode)return!1;let y=this.originalCode,x=(h)=>(h??"").replace(/\s+$/,"");return x(this.js)!==x(y.js)||x(this.html)!==x(y.html)||x(this.css)!==x(y.css)||x(this.test)!==x(y.test)}updateEditedIndicator(){this.classList.toggle("-locally-edited",this.hasLocalEdits())}canUndo(){let y=this.activeTab;return y instanceof r1&&y.editor!==void 0&&y.editor.session.getUndoManager().hasUndo()}canRedo(){let y=this.activeTab;return y instanceof r1&&y.editor!==void 0&&y.editor.session.getUndoManager().hasRedo()}saveLocalEdit=()=>{let y=this.localEditKey();if(!y){window.alert("This example has no source mapping to key a local save.");return}m6(y,{js:this.js,html:this.html,css:this.css,test:this.test}),this.updateEditedIndicator()};revertLocalEdit=()=>{let y=this.localEditKey();if(y)E6(y);if(this.originalCode)this.applyEdit(this.originalCode);if(this.viewingChanges)this.viewChanges();this.updateEditedIndicator(),this.refresh()};snapshotAndRestoreLocalEdit=()=>{this.originalCode={js:this.js,html:this.html,css:this.css,test:this.test};let y=this.localEditKey();if(!y||!e6(y))return;let x=t6(y);if(x)this.applyEdit(x),this.updateEditedIndicator(),this.refresh()};viewingChanges=!1;viewChanges=()=>{if(!this.hydrated)return;if(this.viewingChanges=!this.viewingChanges,this.viewingChanges)this.showCode();let y=this.originalCode??{};for(let x of["js","html","css","test"])this.parts[x].original=y[x]??"",this.parts[x].showDiff(this.viewingChanges)};doRefresh=()=>{if(this.remoteId!=="")this.refreshRemote();else this.refresh()};sourceMenu=(y)=>{let x=this.localEditKey(),h=()=>this.hasLocalEdits(),l=this.originalCode!=null;o({target:y.target.closest("button"),width:"auto",menuItems:[{icon:"refreshCw",caption:"Refresh",shortcut:"⌘R",action:this.doRefresh},{icon:"columns",caption:"Flip layout",shortcut:"⌘/",action:this.flipLayout},{icon:"cornerUpLeft",caption:"Undo",shortcut:"⌘Z",action:this.undo,enabled:()=>this.canUndo()},{icon:"cornerUpRight",caption:"Redo",shortcut:"⌘⇧Z",action:this.redo,enabled:()=>this.canRedo()},null,{icon:"copy",caption:"Copy as markdown",shortcut:"⌘⇧C",action:this.copy},{icon:"download",caption:"Download",action:this.downloadExample},null,...l?[this.viewingChanges?{icon:"edit",caption:"Back to editing",action:this.viewChanges}:{icon:"code",caption:"View changes",action:this.viewChanges,enabled:h}]:[],...x?[{icon:"save",caption:"Save changes (local)",action:this.saveLocalEdit,enabled:h}]:[],...x&&C7?[{icon:"upload",caption:"Save to source",action:()=>{this.saveToSource()},enabled:h}]:[],...l?[{icon:"rotateCcw",caption:"Revert to original",action:this.revertLocalEdit,enabled:h}]:[]]})};toggleMaximize=()=>{this.classList.toggle("-maximize")};showCode=()=>{this.classList.add("-maximize"),this.classList.toggle("-vertical",this.offsetHeight>this.offsetWidth),this.parts.codeEditors.hidden=!1,this.ensureProductTabs()};closeCode=()=>{if(this.remoteId!=="")this.remoteSync?.sendClose(),window.close();else this.remoteSync?.sendClose(),this.classList.remove("-maximize"),this.parts.codeEditors.hidden=!0};openEditorWindow=()=>{let{css:y,html:x,js:h,test:l}=this;o6(this.prefix,this.uuid,this.storageKey,this.remoteKey,{css:y,html:x,js:h,test:l},{sourceFile:this.getAttribute("data-source-file"),ordinal:this.getAttribute("data-example-ordinal"),original:this.originalCode??void 0}),this.classList.add("-maximize"),this.parts.codeEditors.hidden=!0};refreshRemote=()=>{this.remoteSync?.send({css:this.css,html:this.html,js:this.js,test:this.test})};updateSources=()=>{if(this.persistToDom){let{sources:y}=this.parts;y.innerText="";for(let x of["js","css","html","test"])if(this[x])y.append(l7({class:`language-${x}`,innerHTML:this[x]}))}};refresh=async()=>{if(this.remoteId!=="")return;let y=await p0(this.dialect),{example:x,style:h,exampleWidgets:l}=this.parts;if(this.dialect!=="js"){if(this.lastGeneratedJs=await this.computeGeneratedJs(y),this.jsOutEditor)this.jsOutEditor.value=this.lastGeneratedJs;await this.runInlineTjsTests(y)}let i,C,k=(g)=>{C=g};if(this.iframe)i=await Y4({html:this.html,css:this.css,js:this.js,context:this.context,transform:y,exampleElement:x,widgetsElement:l,onError:k});else i=await X4({html:this.html,css:this.css,js:this.js,context:this.context,transform:y,exampleElement:x,styleElement:h,widgetsElement:l,onError:k});if(this.persistToDom)this.updateSources();if((this.test||C)&&U1.enabled.value){await new Promise((w)=>requestAnimationFrame(w)),this.classList.add("-has-tests","-test-running"),this.classList.remove("-test-passed","-test-failed");let g=this.dialect==="js"?y:await p0("js");if(this.testResults=this.test&&i?await N4(this.test,i,this.context,g):{passed:0,failed:0,tests:[]},C)this.testResults.failed+=1,this.testResults.tests.unshift({name:"example loads without error",passed:!1,error:String(C)});this.classList.remove("-test-running"),this.displayTestResults()}else this.classList.remove("-has-tests","-test-running","-test-passed","-test-failed")};displayTestResults(){let{testResults:y,testIndicator:x}=this.parts,h=this.testResults;if(!h||h.tests.length===0){y.hidden=!0,this.classList.remove("-test-passed","-test-failed"),x.title="no tests";return}y.innerHTML="";let l=Y1({style:{marginBottom:"8px",fontWeight:"bold"}},`${h.passed}/${h.tests.length} tests passed`);y.append(l);for(let i of h.tests){let C=i.passed?"✓":"✗",k=i.passed?"test-pass":"test-fail",g=Y1({class:k},f3(C+" "),i.name,i.error?f3({style:{opacity:"0.7"}},` - ${i.error}`):"");y.append(g)}this.classList.toggle("-test-passed",h.failed===0),this.classList.toggle("-test-failed",h.failed>0),x.title=h.failed===0?`${h.passed} tests passed`:`${h.failed}/${h.tests.length} tests failed`,this.updateTestResultsVisibility(),this.dispatchEvent(new CustomEvent("testcomplete",{bubbles:!0,detail:{results:h,element:this}}))}initFromElements(y){for(let x of y){x.hidden=!0;let[h,...l]=x.innerHTML.split(`
|
|
109
109
|
`);if(["js","html","css","test"].includes(h)){let i=l.filter((k)=>k.trim()!=="").map((k)=>k.match(/^\s*/)[0].length).sort()[0],C=(i>0?l.map((k)=>k.substring(i)):l).join(`
|
|
110
110
|
`);this.setEditorValue(h,C)}else{let i=["js","html","css","test"].find((C)=>x.matches(`.language-${C}`));if(i)this.setEditorValue(i,i==="html"?x.innerHTML:x.innerText)}}}showDefaultTab(){if(!this.hydrated){this.pendingShowDefaultTab=!0;return}let{editors:y}=this.parts;if(this.js!=="")y.value=0;else if(this.html!=="")y.value=1;else if(this.css!=="")y.value=2;else if(this.test!=="")y.value=3}render(){if(super.render(),this.remoteId!==""){let y=localStorage.getItem(this.storageKey);if(y!==null){let x=JSON.parse(y);if(this.remoteKey!==x.remoteKey)return;if(this.css=x.css,this.html=x.html,this.js=x.js,x.test)this.test=x.test;this.parts.example.hidden=!0,this.parts.codeEditors.hidden=!1,this.classList.add("-maximize"),this.updateUndo()}}else this.refresh()}}var s4=e1.elementCreator(),S3=new URL(window.location.href).searchParams,i7=S3.get("lx");if(i7){document.title+=" [code editor]",document.body.textContent="";let y=s4({remoteId:i7}),x=S3.get("sf"),h=S3.get("ord");if(x&&h!==null)y.setAttribute("data-source-file",x),y.setAttribute("data-example-ordinal",h);document.body.append(y)}var{slot:k7}=K;class V2 extends U{static preferredTagName="tosi-sidenav";static initAttributes={minSize:800,navSize:200,compact:!1,contentVisible:!1};value="normal";content=[k7({name:"nav",part:"nav"}),k7({part:"content"})];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:`${P.navWidth("50%")} ${P.contentWidth("50%")}`,gridTemplateRows:"100%",position:"relative",margin:P.margin("0 0 0 -100%"),transition:P.sideNavTransition("0.25s ease-out")},":host slot":{position:"relative"},":host slot:not([name])":{display:"block"},':host slot[name="nav"]':{display:"block"}};onResize=()=>{let{content:y}=this.parts,x=this.offsetParent;if(x===null)return;let h;if(this.compact=x.offsetWidth<this.minSize,[...this.childNodes].find((i)=>i instanceof Element?i.getAttribute("slot")!=="nav":!0)===void 0)h="compact/nav",this.style.setProperty("--nav-width","100%"),this.style.setProperty("--content-width","0%");else if(!this.compact)h="normal",y.classList.add("-tosi-sidenav-visible"),this.style.setProperty("--nav-width",`${this.navSize}px`),this.style.setProperty("--content-width",`calc(100% - ${this.navSize}px)`),this.style.setProperty("--margin","0");else if(y.classList.remove("-tosi-sidenav-visible"),this.style.setProperty("--nav-width","50%"),this.style.setProperty("--content-width","50%"),this.contentVisible)h="compact/content",this.style.setProperty("--margin","0 0 0 -100%");else h="compact/nav",this.style.setProperty("--margin","0 -100% 0 0");if(this.value!==h)this.value=h};observer;connectedCallback(){super.connectedCallback(),this.contentVisible=this.parts.content.childNodes.length===0,globalThis.addEventListener("resize",this.onResize),this.observer=new MutationObserver(this.onResize),this.observer.observe(this,{childList:!0}),this.style.setProperty("--side-nav-transition","0s"),setTimeout(()=>{this.style.removeProperty("--side-nav-transition")},250)}disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect()}render(){super.render(),this.onResize()}}var _i=V2,O0=V2.elementCreator(),Gi=O0,Ai=O0;var{div:F0,span:X0,a:Y0,header:Ki,button:r3,template:Ui,input:pi,h2:Qi,details:Wi,summary:Oi,ul:g7,li:w7}=K,J2={pass:P.testColorPass("#0a0"),fail:P.testColorFail("#c00"),running:P.testColorRunning("#fa0")},Fi={".view-source":{opacity:"0.9"},".view-source:hover":{opacity:"1"},"@keyframes test-pulse":{"0%, 100%":{opacity:"1"},"50%":{opacity:"0.7"}},"@keyframes test-appear":{from:{opacity:"0",transform:"scale(0.8)"},to:{opacity:"1",transform:"scale(1)"}},"@keyframes test-fade":{"0%, 20%":{opacity:"1",transform:"scale(1)"},"70%":{opacity:"1",transform:"scale(1.1)"},"100%":{opacity:"0",transform:"scale(0.9)",pointerEvents:"none"}},"body:not(.tests-enabled) .doc-link::after, body:not(.tests-enabled) .test-widget":{display:"none !important"},".doc-link.-test-passed::after, .doc-link.-test-failed::after":{content:"''",width:z.fontSize50,height:z.fontSize50,borderRadius:"50%",marginLeft:z.spacing50,display:"inline-block",verticalAlign:"middle"},".doc-link.-test-passed::after":{background:J2.pass},".doc-link.-test-failed::after":{background:J2.fail,animation:"test-pulse 2s ease-in-out infinite"},".test-widget":{_testBg:J2.running,position:"fixed",bottom:z.spacing,right:z.spacing,zIndex:"1000",background:z.testBg,color:"white",gap:z.spacing50},".test-widget[hidden]":{display:"none"},".test-widget.-running":{_testBg:J2.running,animation:"test-appear 0.3s ease-out, test-pulse 2s ease-in-out 0.3s infinite"},".test-widget.-passed":{_testBg:J2.pass,animation:"test-fade 3s ease-out forwards"},".test-widget.-failed":{_testBg:J2.fail,animation:"test-pulse 2s ease-in-out infinite"},".test-widget .count":{background:"white",color:z.testBg,borderRadius:"50%",width:z.lineHeight,height:z.lineHeight,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold"},"@keyframes example-target-pulse":{from:{boxShadow:`0 0 0 3px ${P.accent("#007aff")}`},to:{boxShadow:"0 0 0 3px transparent"}},".example-target":{animation:"example-target-pulse 1.5s ease-out",borderRadius:z.roundedRadius}};function L3(y){let{docs:x,context:h={},projectName:l="",projectLinks:i={},navSize:C=200,minSize:k=600,routing:g="query",initialRoute:w,onRouteChange:B,navbarLinks:j,contentElement:V}=y,_=g==="memory";for(let q of x)q.testStatus=void 0;let Q=g==="query"?{}:s2(x),A=(q)=>Q[q]??q,F=(q)=>{for(let G of x)if(A(G.filename)===q)return G.filename;return""},Y=(q)=>g==="query"?`?${q}`:V3(A(q)),X=()=>{if(_)return w?F(w):"";return g==="path"?P3(document.location.pathname,Q):document.location.search!==""?document.location.search.substring(1).split("&")[0]:""},s=(q)=>{let G=q.getAttribute("href")||"";if(G===""||G.startsWith("#"))return null;let W;try{W=new URL(G,document.location.href)}catch{return null}if(W.origin!==document.location.origin)return null;let D=(I)=>x.some((t)=>t.filename===I)?I:null,N=W.search.replace(/^\?/,"");if(N!==""&&!N.includes("=")&&!N.includes("&")){let I=D(decodeURIComponent(N));if(I)return I}if(!_&&g!=="query"){let I=D(P3(W.pathname,Q));if(I)return I}return null},c=X()||x[0]?.filename||"README.md",T=x.find((q)=>q.filename===c)||x[0],{app:v}=e({app:{docs:x,currentDoc:T,compact:!1}}),$=()=>{},Z={},S,d=!1,y1=0,d2=0;if(!_)window.__docTestResults=new Promise((q)=>{S=q});let F9=(q)=>{let G=Z[q],W=v.docs.find((D)=>D.filename===q);if(W)W.testStatus=G?G.passed?"passed":"failed":void 0;$()},a7=()=>{if(d2>=y1&&S){let q={passed:0,failed:0,pages:Z};for(let G of Object.values(Z))q.passed+=G.totalPassed,q.failed+=G.totalFailed;if(S(q),S=void 0,X9&&!r2)fetch("/report",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)}).catch(()=>{})}},X9=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",m7=(q)=>{let{results:G}=q.detail,W=String(v.currentDoc.filename);Z[W]={passed:G.failed===0,tests:[...G.tests],totalPassed:G.passed,totalFailed:G.failed},F9(W)},m4=(q)=>{d2++,a7(),y5()};T1.docLink={toDOM(q,G){q.setAttribute("href",Y(G)),q.dataset.filename=G}},T1.current={toDOM(q,G){q.classList.toggle("current",G===q.dataset.filename)}},T1.testStatus={toDOM(q,G){if(q.classList.remove("-test-passed","-test-failed"),G==="passed")q.classList.add("-test-passed");else if(G==="failed")q.classList.add("-test-failed")}};let t7=y0(()=>{let q=t4.value.toLocaleLowerCase();v.docs.forEach((G)=>{G.hidden=!G.title.toLocaleLowerCase().includes(q)&&!G.text.toLocaleLowerCase().includes(q)}),_1(v.docs),$(!0)}),t4=pi({slot:"nav",placeholder:"search",type:"search",style:{width:"calc(100% - 10px)",margin:"5px"},onInput:t7});if(!_)window.addEventListener("popstate",()=>{if(f){if(b0()&&!window.confirm("Discard unsaved changes to the source?")){let q=Y(String(f.doc.filename));window.history.pushState({href:q},"",q);return}e4()}H0(X())}),window.addEventListener("beforeunload",(q)=>{if(b0())q.preventDefault(),q.returnValue=""});let I2=[r3({class:"iconic",style:{color:z.linkColor},title:"navigation",bind:{value:v.compact,binding:{toDOM(q,G){q.style.display=G?"":"none",q.nextSibling.style.display=G?"":"none"}}},onClick(){let q=document.querySelector(V2.tagName);q.contentVisible=!q.contentVisible}},p.menu()),X0({style:{flex:"0 0 10px"}})];if(l)I2.push(Y0({href:"/",style:{display:"flex",alignItems:"center",borderBottom:"none"}},i.tosijs?p.tosiUi({style:{_xinIconSize:40,marginRight:10}}):X0(),Qi(l)));I2.push(X0({class:"elastic"}));let Y9=(q)=>{let G=q.icon?p[q.icon]:void 0;return Y0({class:G?"iconic":"",title:q.label,target:"_blank",href:q.href},G?G():q.label)};if(j)j.forEach((q)=>I2.push(Y9(q)));else{let q=[[i.tosijs,"tosi","tosijs"],[i.discord,"discord","discord"],[i.blog,"blog","blog"],[i.github,"github","github"],[i.npm,"npm","npmjs"]];for(let[G,W,D]of q)if(G)I2.push(Y9({href:G,label:D,icon:W}))}let g1=V||F0();g1.classList.add("doc-content"),Object.assign(g1.style,{display:"block",maxWidth:"44em",margin:"auto",padding:"0 1em",overflow:"hidden"});let Z9=()=>{for(let q of g1.querySelectorAll("a")){let G=s(q);if(G!==null)q.setAttribute("href",Y(G)),q.dataset.docLink=G}},E7=()=>{if(_)return;let q=location.hash.replace(/^#/,"");if(!q)return;requestAnimationFrame(()=>{let G=null;try{G=g1.querySelector(`#${CSS.escape(q)}`)}catch{G=null}if(!G)return;G.scrollIntoView({block:"center",behavior:"smooth"}),G.classList.add("example-target"),setTimeout(()=>G&&G.classList.remove("example-target"),1600)})},v9=V!==void 0&&!_,N9=(q)=>{if(v9)v9=!1;else g1.innerHTML=K0(q.text);if(Z9(),e1.insertExamples(g1,h,q.path||void 0),E7(),g==="path")document.title=l?`${q.title} — ${l}`:q.title},H0=(q)=>{let G=x.find((W)=>W.filename===q)||x[0];v.currentDoc=G,N9(G),$(!0)},D0=(q)=>{if(!ly())return;if(_)B?.(A(q));else{let G=Y(q);window.history.pushState({href:G},"",G)}H0(q)};g1.addEventListener("click",(q)=>{if(q.defaultPrevented||q.button!==0||q.metaKey||q.ctrlKey||q.shiftKey||q.altKey)return;let G=q.target.closest("a");if(!G||G.target==="_blank"||G.hasAttribute("download"))return;let W=s(G);if(W===null)return;q.preventDefault(),D0(W)});let e7=(q)=>q.endsWith(".md")?"markdown":q.endsWith(".css")?"css":q.endsWith(".ts")||q.endsWith(".tjs")?"typescript":"javascript",yy=(q,G)=>{if(G.endsWith(".md"))return q;return(q.match(/\/\*#[\s\S]+?\*\//g)||[]).map((D)=>D.substring(3,D.length-2).trim()).join(`
|
|
111
111
|
|
|
@@ -208,7 +208,7 @@ ${l.join(`
|
|
|
208
208
|
`)||"(idle)"}`}).join(`
|
|
209
209
|
`)}var{slot:y9}=K;class x9 extends U{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[y9()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:P.tosiRowGap("0"),alignItems:P.tosiRowAlign("stretch"),justifyContent:P.tosiRowJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-row-gap",this.gap);else this.style.removeProperty("--tosi-row-gap");if(this.align)this.style.setProperty("--tosi-row-align",this.align);else this.style.removeProperty("--tosi-row-align");if(this.justify)this.style.setProperty("--tosi-row-justify",this.justify);else this.style.removeProperty("--tosi-row-justify");this.style.flexWrap=this.wrap?"wrap":""}}var yC=x9.elementCreator();class h9 extends U{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[y9()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:P.tosiColumnGap("0"),alignItems:P.tosiColumnAlign("stretch"),justifyContent:P.tosiColumnJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-column-gap",this.gap);else this.style.removeProperty("--tosi-column-gap");if(this.align)this.style.setProperty("--tosi-column-align",this.align);else this.style.removeProperty("--tosi-column-align");if(this.justify)this.style.setProperty("--tosi-column-justify",this.justify);else this.style.removeProperty("--tosi-column-justify");this.style.flexWrap=this.wrap?"wrap":""}}var xC=h9.elementCreator();class l9 extends U{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[y9()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:P.tosiGridColumns("1fr"),gridTemplateRows:P.tosiGridRows("auto"),gap:P.tosiGridGap("0")}};render(){if(super.render(),this.columns)this.style.setProperty("--tosi-grid-columns",this.columns);else this.style.removeProperty("--tosi-grid-columns");if(this.rows)this.style.setProperty("--tosi-grid-rows",this.rows);else this.style.removeProperty("--tosi-grid-rows");if(this.gap)this.style.setProperty("--tosi-grid-gap",this.gap);else this.style.removeProperty("--tosi-grid-gap")}}var hC=l9.elementCreator(),{span:O7}=K,lC=(...y)=>O7({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...y),i9=(...y)=>O7({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...y);var b1={accent:O.fromCss("#EE257B"),background:O.fromCss("#fafafa"),text:O.fromCss("#222222")},F7={_tosiSpacingXs:"4px",_tosiSpacingSm:"8px",_tosiSpacing:"12px",_tosiSpacingLg:"16px",_tosiSpacingXl:"24px",_tosiFontFamily:"system-ui, -apple-system, sans-serif",_tosiFontSize:"16px",_tosiLineHeight:"1.5",_tosiCodeFontFamily:"ui-monospace, monospace",_tosiCodeFontSize:"14px",_tosiTouchSize:"44px",_tosiBorderRadius:"4px",_tosiBorderRadiusLg:"8px",_tosiTransition:"0.15s ease-out"};function X7(y){let{accent:x,background:h,text:l}=y,i=y.accentText??x.contrasting(),C=y.backgroundInset??h.darken(0.03),k=y.border??l.opacity(0.15),g=y.shadow??l.opacity(0.1),w=y.focus??x.opacity(0.5);return{_tosiAccent:x,_tosiAccentLight:x.brighten(0.15),_tosiAccentDark:x.darken(0.15),_tosiAccentText:i,_tosiBg:h,_tosiBgInset:C,_tosiBgHover:h.darken(0.05),_tosiBgActive:h.darken(0.1),_tosiText:l,_tosiTextMuted:l.opacity(0.6),_tosiTextDisabled:l.opacity(0.4),_tosiBorder:k,_tosiBorderFocus:x,_tosiShadow:g,_tosiShadowColor:g,_tosiFocusRing:`0 0 0 2px ${w}`,_tosiInputBg:h,_tosiInputBorder:k,_tosiInputBorderFocus:x,_tosiButtonBg:h,_tosiButtonText:l,_tosiButtonBorder:k,_tosiButtonHoverBg:h.darken(0.05),_tosiButtonActiveBg:x,_tosiButtonActiveText:i}}function H2(y){return{":root":{...F7,...X7(y)}}}function D4(y){let h=H2(y)[":root"];return{":root":x0(h)}}function C9(y,x="tosi-theme"){Q1(x,y)}var iC=H2(b1),CC=D4(b1),Y7={"--xin-icon-size":z.tosiIconSize,"--xin-icon-fill":z.tosiIconFill,"--xin-icon-stroke":z.tosiIconStroke,"--xin-tabs-bar-color":z.tosiTabsBarColor,"--xin-tabs-bar-height":z.tosiTabsBarHeight,"--xin-tabs-selected-color":z.tosiTabsSelectedColor,"--spacing":z.tosiSpacing,"--gap":z.tosiSpacingSm,"--touch-size":z.tosiTouchSize,"--background":z.tosiBg,"--text-color":z.tosiText,"--brand-color":z.tosiAccent,"--brand-text-color":z.tosiAccentText};function kC(y){return{":root":{...H2(y)[":root"],...Y7}}}function gC(y,x){let h={};for(let[l,i]of Object.entries(x)){let C=`--tosi-${y}-${l.replace(/([A-Z])/g,"-$1").toLowerCase()}`;h[l]=`var(${C}, ${i})`}return h}var{div:D2,label:b4,input:f4,span:wC,button:Z7}=K,{liveTheme:r}=e({liveTheme:{accent:String(b1.accent),background:String(b1.background),text:String(b1.text),dark:!1}}),S4=!1;function Z0(){if(!S4)return;let y={accent:O.fromCss(r.accent.value),background:O.fromCss(r.background.value),text:O.fromCss(r.text.value)},x=r.dark.value?D4(y):H2(y);C9(x,"tosi-live-theme")}function v7(){if(S4)return;S4=!0,r.accent.observe(Z0),r.background.observe(Z0),r.text.observe(Z0),r.dark.observe(Z0),Z0()}function BC(){S4=!1}class k9 extends U{static preferredTagName="tosi-theme-editor";static shadowStyleSpec={":host":{display:"block",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"1.5",background:"#ffffff",color:"#222222",padding:"16px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"320px"},":host .field":{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},":host label":{flex:"1",fontWeight:"500"},':host input[type="color"]':{width:"48px",height:"32px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",padding:"2px"},':host input[type="checkbox"]':{width:"18px",height:"18px",cursor:"pointer"},":host .preview":{marginTop:"12px",padding:"12px",borderRadius:"4px",transition:"all 0.15s ease-out"},":host .preview-button":{border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions":{marginTop:"8px",display:"flex",gap:"8px"},":host .actions button":{flex:"1",padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",background:"#f5f5f5",color:"#222",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions button:hover":{background:"#e8e8e8"}};content=()=>[D2({class:"field"},b4("Accent"),f4({type:"color",part:"accent"})),D2({class:"field"},b4("Background"),f4({type:"color",part:"background"})),D2({class:"field"},b4("Text"),f4({type:"color",part:"text"})),D2({class:"field"},b4("Dark mode"),f4({type:"checkbox",part:"dark"})),D2({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},wC("Preview "),Z7({class:"preview-button",style:{background:"var(--tosi-accent, #EE257B)",color:"var(--tosi-accent-text, white)"}},"Button")),D2({class:"actions"},Z7({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),v7();let y=()=>{this.parts.accent.value=r.accent.value,this.parts.background.value=r.background.value,this.parts.text.value=r.text.value,this.parts.dark.checked=r.dark.value};y(),r.accent.observe(y),r.background.observe(y),r.text.observe(y),r.dark.observe(y),this.parts.accent.addEventListener("input",()=>{r.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{r.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{r.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{r.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{r.accent.value=String(b1.accent),r.background.value=String(b1.background),r.text.value=String(b1.text),r.dark.value=!1})}}var zC=k9.elementCreator();var{div:jC}=K;class P2 extends U{static preferredTagName="tosi-map";static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(y){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=jC({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(P2.mapboxCSSAvailable===void 0)P2.mapboxCSSAvailable=y4("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((y)=>{console.error("failed to load mapbox-gl.css",y)}),P2.mapboxAvailable=G1("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((y)=>{console.error("failed to load mapbox-gl.js",y)})}connectedCallback(){if(super.connectedCallback(),!this.token)console.error("mapbox requires an access token which you can provide via the token attribute")}_lastCoords="";_lastStyle="";render(){if(super.render(),!this.token)return;if(this._map){if(this.coords!==this._lastCoords){let[i,C,k]=this.coords.split(",").map((g)=>Number(g));this._map.setCenter([C,i]),this._map.setZoom(k),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:y}=this.parts,[x,h,l]=this.coords.split(",").map((i)=>Number(i));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,P2.mapboxAvailable.then(({mapboxgl:i})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),i.accessToken=this.token,this._map=new i.Map({container:y,style:this.mapStyle,zoom:l,center:[h,x]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let C=this._map.getCenter(),k=this._map.getZoom(),g=`${C.lat.toFixed(6)},${C.lng.toFixed(6)},${k.toFixed(1)}`;if(g!==this.value){if(this.internals)this.internals.setFormValue(g)}})})}}var qC=P2.elementCreator();function N7(y,x){if(x==null)x="";else if(typeof x!=="string")x=String(x);return x.replace(/\{\{([^}]+)\}\}/g,(h,l)=>{let i=E[`${y}${l.startsWith("[")?l:"."+l}`];return i===void 0?h:N7(y,String(i))})}class d4 extends U{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let y=await fetch(this.src);this.value=await y.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),E[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let y=N7(this.instanceId,this.value);if(this.elements){let x=y.split(`
|
|
210
210
|
`).reduce((h,l)=>{if(l.startsWith("<")||h.length===0)h.push(l);else{let i=h[h.length-1];if(!i.startsWith("<")||!i.endsWith(">"))h[h.length-1]+=`
|
|
211
|
-
`+l;else h.push(l)}return h},[]);this.innerHTML=x.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:R(h,this.options)).join("")}else this.innerHTML=R(y,this.options);this.didRender()}}var VC=d4,g9=d4.elementCreator(),PC=g9,_C=g9;var{div:w9,span:I4,button:B9}=K,v0=86400000,GC=[0,1,2,3,4,5,6],AC=[1,2,3,4,5,6,7,8,9,10,11,12],z9=(y,x=2,h="0")=>String(y).padStart(x,h),N0=(y,x,h)=>new Date(`${y}-${z9(x)}-${z9(h)}`);class j9 extends U{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:P.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:P.monthTodayBackground("transparent"),boxShadow:P.monthTodayShadow("none"),backdropFilter:P.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:P.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:P.monthDayColor("hotpink"),background:P.monthDayBackground("white"),fontWeight:P.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:P.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:P.monthDateCheckedColor("white"),background:P.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:P.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:N0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:N0(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return AC.map((y)=>({caption:N0(2025,y,1).toString().split(" ")[1],value:String(y)}))}get years(){let y=Number(this.minDate.split("-")[0]),x=Number(this.maxDate.split("-")[0]),h=[];for(let l=y;l<=x;l++)h.push(String(l));return h}monthChanged=(y,x)=>{};gotoMonth(y,x){if(this.month!==x||this.year!==y)this.month=x,this.year=y,this.monthChanged(y,x)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(y){this.selectedDays[1]=y,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(y){this.selectedDays[0]=y,this.selectedDays.splice(2)}clickDate=(y)=>{let x=y.target.getAttribute("title");this.selectDate(x)};keyDate=(y)=>{let x=!1;switch(y.code){case"Space":{let h=y.target.getAttribute("title");this.selectDate(h),x=!0;break}case"Tab":break;default:console.log(y)}if(x)y.preventDefault(),y.stopPropagation()};#y="";selectDate=(y)=>{if(this.#y=y,this.range){if(!this.to)this.selectedDays=[y,y];else if(this.from===y&&this.to===y)this.selectedDays=[];else if(this.from===y)this.from=this.to;else if(this.to===y)this.to=this.from;else if(y<this.from)this.from=y;else if(y>this.to)this.to=y;else this.to=y;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(y))this.selectedDays.splice(this.selectedDays.indexOf(y),1);else this.selectedDays.push(y),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(y))this.value="",this.selectedDays=[];else this.value=y,this.selectedDays=[y]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(y)=>{if(!this.range)return this.selectedDays.includes(y);else if(this.range)return this.from&&y>=this.from&&y<=this.to;return!1};dateMenuItem=(y,x="")=>{return y=y.split("T")[0],{caption:x||y,enabled:()=>!y.startsWith(`${this.year}-${z9(this.month)}-`),action:()=>{this.gotoDate(y)}}};jumpMenu=()=>{o({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((y)=>this.dateMenuItem(y))]})};content=()=>[w9({part:"header"},B9({part:"previous",onClick:this.previousMonth},p.chevronLeft()),I4({style:{flex:"1"}}),B9({part:"jump",onClick:this.jumpMenu},p.calendar()),A1({part:"month",options:this.months,onChange:this.setMonth}),A1({part:"year",options:[this.year],onChange:this.setMonth}),I4({style:{flex:"1"}}),B9({part:"next",onClick:this.nextMonth},p.chevronRight())),w9({part:"week"}),w9({part:"days"})];gotoDate(y){let x=new Date(y);this.gotoMonth(x.getFullYear(),x.getMonth()+1)}connectedCallback(){super.connectedCallback();let y=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=y.getMonth()+1;if(isNaN(this.year))this.year=y.getFullYear()}days=[];render(){super.render();let{week:y,days:x,jump:h,month:l,year:i,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=N0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*v0),B=this.month===12?1:this.month+1,j=new Date(N0(this.year+(this.month===12?1:0),B,1).valueOf()-v0),V=new Date(j.valueOf()+(this.weekStart*2+5+this.endDay-j.getDay())%7*v0),_=GC.map((X)=>new Date(w.valueOf()+X*v0).toString().split(" ")[0]);this.days=[];let Q=new Date().toISOString().split("T")[0];for(let X=w.valueOf();X<=V.valueOf();X+=v0){let s=new Date(X),c=s.toISOString().split("T")[0];this.days.push({date:s,selected:!1,inMonth:s.getMonth()+1===this.month,isToday:c===Q,isWeekend:s.getDay()%6===0,inRange:!!(this.from&&c>=this.from&&c<=this.to)})}l.value=String(this.month),i.value=String(this.year),l.disabled=i.disabled=h.disabled=C.disabled=k.disabled=this.disabled||this.readonly,i.options=this.years,y.textContent="",y.append(..._.map((X)=>I4({class:"day"},X))),x.textContent="";let A=null,{to:F,from:Y}=this;x.append(...this.days.map((X)=>{let s=["date"];if(X.inMonth)s.push("in-month");if(X.isToday)s.push("today");let c=X.date.toISOString().split("T")[0];if(this.checkDay(c))s.push("checked");if(s.push(X.isWeekend?"weekend":"weekday"),this.range){if(F===c)s.push("range-end");if(Y===c)s.push("range-start")}let T=I4({class:s.join(" "),title:c,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},X.date.getDate());if(c===this.#y)A=T;return T})),A?.focus()}}var KC=j9.elementCreator();var{div:q9,button:UC}=K,pC={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class x2 extends U{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${z.notificationSpacing} ${z.notificationSpacing50} ${z.notificationSpacing} ${z.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:z.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:z.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:z.notificationSpacing,width:z.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:z.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:z.notificationTextColor},":host .note":{display:"grid",background:z.notificationBg,padding:z.notificationPadding,gridTemplateColumns:`${z.notificationIconSize} 1fr ${z.notificationButtonSize}`,gap:z.notificationSpacing,alignItems:"center",borderRadius:z.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${z.notificationAccentColor}`,borderColor:z.notificationAccentColor,borderWidth:z.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:z.notificationButtonSize,padding:0,margin:0,height:z.notificationButtonSize,width:z.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:z.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:z.notificationBg,background:z.notificationAccentColor,padding:z.spacing50},":host .note svg":{height:z.notificationIconSize,width:z.notificationIconSize,pointerEvents:"none",color:z.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:z.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(y){y.classList.add("closing"),y.style.marginBottom=-y.offsetHeight+"px";let x=()=>{y.remove()};y.addEventListener("transitionend",x),setTimeout(x,1000)}static post(y){let{message:x,duration:h,type:l,close:i,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof y==="string"?{message:y}:y);if(!this.singleton)this.singleton=V9();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||pC[l],j=C||l==="progress"?K.progress():{},V=()=>{if(i)i();x2.removeNote(A)},_=k instanceof SVGElement?k:k?p[k]():p.info(),Q=l==="error"||l==="warn",A=q9({class:`note ${l}`,role:Q?"alert":"status",ariaLive:Q?"assertive":"polite",style:{_notificationAccentColor:B}},_,q9({class:"message"},q9(x),j),UC({class:"close",title:"close",ariaLabel:"Close notification",apply(F){F.addEventListener("click",V)}},p.x()));if(w.shadowRoot.append(A),j instanceof HTMLProgressElement&&C instanceof Function){j.setAttribute("max",String(100)),j.value=C();let F=setInterval(()=>{if(!w.shadowRoot.contains(A)){clearInterval(F);return}let Y=C();if(j.value=Y,Y>=100)x2.removeNote(A)},1000)}if(h>0)setTimeout(()=>{x2.removeNote(A)},h*1000);return A.scrollIntoView(),V}content=null}var QC=x2,V9=x2.elementCreator(),WC=V9;function OC(y){return x2.post(y)}var $7=async(y,x="SHA-1")=>{let l=new TextEncoder().encode(y),i=await crypto.subtle.digest(x,l);return Array.from(new Uint8Array(i)).map((g)=>g.toString(16).padStart(2,"0")).join("")},s7=async(y)=>{let x=await $7(y),h=await fetch(`https://weakpass.com/api/v1/search/${x}`);if(h.ok){let l=await h.json();console.log("password found in weakpass database",l)}return h.status!==404},{span:P9,tosiSlot:FC}=K;class T4 extends U{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:z.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:P.meterHeight("24px"),background:P.indicatorBg("white"),borderRadius:P.meterRadius("4px"),boxShadow:P.meterShadow(`inset 0 0 0 2px ${z.indicatorColor}`)},':host [part="level"]':{height:P.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:z.indicatorColor,margin:P.levelMargin("2px"),borderRadius:P.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:z.descriptionColor,height:P.meterHeight("24px"),lineHeight:P.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(y){return this.issues={tooShort:y.length<this.minLength,short:y.length<this.goodLength,noUpper:!y.match(/[A-Z]/),noLower:!y.match(/[a-z]/),noNumber:!y.match(/[0-9]/),noSpecial:!y.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((x)=>!x).length-1}async isBreached(){let y=this.querySelector("input")?.value;if(!y||typeof y!=="string")return!0;return await s7(y)}updateIndicator=(y)=>{let{level:x,description:h}=this.parts,l=this.indicatorColors.split(","),i=this.descriptionColors.split(","),C=this.strength(y);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));x.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",l[C]),this.style.setProperty("--description-color",i[C]),h.textContent=this.strengthDescriptions[C]};update=(y)=>{let x=y.target.closest("input");this.updateIndicator(x?.value||"")};content=()=>[FC({onInput:this.update}),P9({part:"meter"},P9({part:"level"}),P9({part:"description"}))];render(){super.render();let y=this.querySelector("input");this.updateIndicator(y?.value)}}var XC=T4,R7=T4.elementCreator(),YC=R7;var{span:_9}=K;class r4 extends U{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(y){this.readonly=y}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>_9({part:"container"},_9({part:"empty"}),_9({part:"filled"}));displayValue(y){let{empty:x,filled:h}=this.parts,i=Math.round((typeof y==="string"?0:y||0)/this.step)*this.step;h.style.width=i/this.max*x.offsetWidth+"px"}update=(y)=>{if(this.readonly)return;let{empty:x}=this.parts,h=y instanceof MouseEvent?y.pageX-x.getBoundingClientRect().x:0,l=Math.min(Math.max(this.min,Math.round(h/x.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(y.type==="click")this.value=l;else if(y.type==="mousemove")this.displayValue(l);else this.displayValue(this.value||0)};handleKey=(y)=>{let x=this.value===""?NaN:Number(this.value);if(isNaN(x))x=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(y.key){case"ArrowUp":case"ArrowRight":x+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":x-=this.step,h=!0;break}if(this.value=Math.max(Math.min(x,this.max),this.min),h)y.stopPropagation(),y.preventDefault()};connectedCallback(){super.connectedCallback();let{container:y}=this.parts;y.tabIndex=0,y.addEventListener("mousemove",this.update,!0),y.addEventListener("mouseleave",this.update),y.addEventListener("blur",this.update),y.addEventListener("click",this.update),y.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let y=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",y),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:x,filled:h}=this.parts;if(x.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),x.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let l=0;l<this.max;l++)x.append(p[this.icon]()),h.append(p[this.icon]())}this.displayValue(this.value)}}var ZC=r4,c7=r4.elementCreator(),vC=B1((...y)=>c7(...y),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:J7,div:NC,button:$C}=K,sC=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function G9(y=sC){return A1({title:"paragraph style",slot:"toolbar",class:"block-style",options:y.map(({caption:x,tagType:h})=>({caption:x,value:`formatBlock,${h}`}))})}var $0=()=>i9({slot:"toolbar"});function N1(y,x,h){return $C({slot:"toolbar",dataCommand:x,title:y},h)}var RC=()=>[N1("left-justify","justifyLeft",p.alignLeft()),N1("center","justifyCenter",p.alignCenter()),N1("right-justify","justifyRight",p.alignRight()),$0(),N1("bullet list","insertUnorderedList",p.listBullet()),N1("numbered list","insertOrderedList",p.listNumber()),$0(),N1("indent","indent",p.indent()),N1("indent","outdent",p.outdent())],H7=()=>[N1("bold","bold",p.fontBold()),N1("italic","italic",p.fontItalic()),N1("underline","underline",p.fontUnderline())],cC=()=>[G9(),$0(),...H7()],D7=()=>[G9(),$0(),...RC(),$0(),...H7()];class L4 extends U{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(y){if(this.isInitialized)this.parts.doc.contentEditable=y?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(y){let x=this._value;if(this._value=y,this.isInitialized){if(this.parts.doc.innerHTML!==y)this.parts.doc.innerHTML=y}if(x!==y&&this.internals)this.internals.setFormValue(y)}blockElement(y){let{doc:x}=this.parts;while(y.parentElement!==null&&y.parentElement!==x)y=y.parentElement;return y.parentElement===x?y:void 0}get selectedBlocks(){let{doc:y}=this.parts,x=window.getSelection();if(x===null)return[];let h=[];for(let l=0;l<x.rangeCount;l++){let i=x.getRangeAt(l);if(!y.contains(i.commonAncestorContainer))continue;let C=this.blockElement(i.startContainer),k=this.blockElement(i.endContainer);h.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let y=window.getSelection();if(y===null)return"";return this.selectedBlocks.length?y.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(y)=>{if(this._updatingBlockStyle)return;let h=y.target?.closest(c1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(y)=>{let h=y.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[J7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),NC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),J7({part:"content"})];doCommand(y){if(y===void 0)return;let x=y.split(",");console.log("execCommand",x[0],!1,...x.slice(1)),document.execCommand(x[0],!1,...x.slice(1))}updateBlockStyle(){let y=this.parts.toolbar.querySelector(".block-style");if(y===null)return;let x=this.selectedBlocks.map((h)=>h.tagName);x=[...new Set(x)],this._updatingBlockStyle=!0,y.value=x.length===1?`formatBlock,${x[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:y,content:x}=this.parts;if(x.innerHTML!==""&&y.innerHTML==="")y.innerHTML=x.innerHTML,x.innerHTML="";this.isInitialized=!0,x.style.display="none",y.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:y}=this.parts;if(super.render(),y.children.length===0)switch(this.widgets){case"minimal":y.append(...cC());break;case"default":y.append(...D7());break}}}var JC=L4,b7=L4.elementCreator(),HC=B1((...y)=>b7(...y),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:s0}=e({router:{path:"",hash:"",pattern:""}}),A9={};function DC(){return{...A9}}var o4=[],K9=!1,M4=new Set;function bC(y){let x=[];if(y==="")return{regex:/^\/?$/,paramNames:x};let h=y.split("/").map((i)=>{if(i.startsWith(":"))return x.push(i.slice(1)),"([^/]+)";return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:x}}function fC(y){let x=y.split("?")[0].split("#")[0];for(let l of o4){if(l.fallback)continue;let i=x.match(l.regex);if(i){let C={};return l.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(i[g+1])}),{route:l,params:C}}}let h=o4.find((l)=>l.fallback);if(h)return{route:h,params:{}};return null}function R0(){let y=K9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;s0.path.value=y,s0.hash.value=window.location.hash;let x=fC(y);if(x){A9=x.params,s0.pattern.value=x.route.regex.source;let h=new Map;for(let l of x.route.targets)h.set(l.view??"default",l);for(let l of M4){let i=l.name||"default",C=h.get(i);if(C)l.replaceChildren(C.component(x.params));else l.replaceChildren()}}else{A9={},s0.pattern.value="";for(let h of M4)h.replaceChildren()}}var f7=!1;function S7(){if(f7)return;f7=!0,window.addEventListener("popstate",R0),window.addEventListener("hashchange",R0)}function SC(y,x={}){K9=x.hashRouting??!1,o4=y.map((h)=>{let{regex:l,paramNames:i}=bC(h.pattern);return{regex:l,paramNames:i,targets:h.targets,fallback:h.fallback??!1}}),S7(),R0()}function dC(y){if(S7(),K9)window.location.hash="#/"+y.replace(/^\//,"");else window.history.pushState({},"","/"+y.replace(/^\//,""));R0()}class U9 extends U{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),M4.add(this),o4.length>0)R0()}disconnectedCallback(){super.disconnectedCallback(),M4.delete(this)}}var IC=U9.elementCreator();var{div:TC,slot:rC,label:LC,span:oC,input:d7}=K;class b2 extends U{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(y){if(typeof y==="string")this._choices=b2.parseChoicesString(y);else this._choices=y;this.queueRender()}static parseChoicesString(y){return y.split(",").filter((x)=>x.trim()!=="").map((x)=>{let[h,l]=x.split("=").map((g)=>g.trim()),[i,C]=(l||h).split(":").map((g)=>g.trim()),k=C?p[C]():"";return{value:h,icon:k,caption:i}})}value="";formDisabledCallback(y){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((y)=>y.trim()).filter((y)=>y!=="")}content=()=>[rC(),TC({part:"options"},d7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:P.segmentedOptionGap("8px"),alignItems:P.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:P.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:P.segmentedOptionGap("8px"),gridTemplateColumns:P.segmentedOptionGridColumns("0px 24px 1fr"),padding:P.segmentedOptionPadding("4px 12px"),font:P.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:P.segmentedFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentBackground("#44a")}`),borderRadius:P.segmentedOptionsBorderRadius("8px")},":host label.current":{color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:P.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:P.segmentOptionIconSize("16px"),stroke:P.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:P.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:P.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:P.segmentedOptionsBorderRadius("8px"),background:P.segmentedOptionsBackground("#fff"),color:P.segmentedOptionColor("#222"),overflow:"hidden",alignItems:P.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:P.segmentedOptionPadding("4px 12px"),color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a"),font:P.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:P.segmentedOptionCurrentColor("#eee"),opacity:P.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:y}=this.parts;y.querySelectorAll("label").forEach((x)=>{let h=x.querySelector("input");x.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:y,custom:x}=this.parts;if(this.multiple){let h=[...y.querySelectorAll("input:checked")];this.value=h.map((l)=>l.value).join(",")}else{let h=y.querySelector("input:checked");if(!h)this.value="";else if(h.value)x.setAttribute("hidden",""),this.value=h.value;else x.removeAttribute("hidden"),x.focus(),x.select(),this.value=x.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(y)=>{let x=!1;switch(y.code){case"Space":if(y.target instanceof HTMLLabelElement)y.target.click(),x=!0;break;case"Tab":if(!(y.target instanceof HTMLLabelElement))y.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=y.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}x=!0;break;case"ArrowRight":case"ArrowDown":{let h=y.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}x=!0;break}if(x)y.preventDefault(),y.stopPropagation()};connectedCallback(){super.connectedCallback();let y=this.getAttribute("choices");if(y&&this._choices.length===0)this._choices=b2.parseChoicesString(y);let{options:x}=this.parts;if(this.name==="")this.name=this.instanceId;if(x.addEventListener("change",this.handleChange),x.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let y=[...this.choices];if(this.other&&!this.multiple){let[x,h]=this.other.split(":");y.push({value:"",caption:x,icon:h})}return y}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((y)=>y.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:y,custom:x}=this.parts;y.textContent="";let h=this.multiple?"checkbox":"radio",{values:l,isOtherValue:i}=this;if(y.append(...this._choicesWithOther.map((C)=>{return LC({tabindex:0},d7({type:h,name:this.name,value:C.value,checked:l.includes(C.value)||C.value===""&&i,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?W1(C.caption):oC(C.caption))})),this.other&&!this.multiple)x.hidden=!i,x.value=i?this.value:"",x.placeholder=this.placeholder,y.append(x);this.syncCurrent()}}var MC=b2,I7=b2.elementCreator(),nC=B1((...y)=>I7(...y),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:T7}=K;class p9 extends U{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[T7({part:"normal"}),T7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:y,small:x}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)y.hidden=!0,x.hidden=!1,this.value="small";else y.hidden=!1,x.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var uC=p9.elementCreator();class n4 extends U{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:z.resizeIconFill}};content=p.resize();get minSize(){let{minWidth:y,minHeight:x}=getComputedStyle(this.target);return{width:parseFloat(y)||32,height:parseFloat(x)||32}}resizeTarget=(y)=>{let{target:x}=this;if(!x)return;let{offsetWidth:h,offsetHeight:l}=x;x.style.left=x.offsetLeft+"px",x.style.top=x.offsetTop+"px",x.style.bottom="",x.style.right="";let{minSize:i}=this;V1(y,(C,k,g)=>{if(x.style.width=Math.max(i.width,h+C)+"px",x.style.height=Math.max(i.height,l+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let y={passive:!0};this.addEventListener("mousedown",this.resizeTarget,y),this.addEventListener("touchstart",this.resizeTarget,y)}}var aC=n4,r7=n4.elementCreator(),mC=r7;var{div:tC,input:EC,span:eC,button:Q9}=K,L7=(y)=>y.split(/(?<!\\),/).map((x)=>x.trim().replace(/\\,/g,",")),yk=(y)=>y.map((x)=>x.replace(/,/g,"\\,")).join(",");class c0 extends U{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":P.brandColor("blue"),"--tag-text-color":P.brandTextColor("white"),display:"inline-flex",borderRadius:P.tagRoundedRadius(z.spacing50),color:z.tagTextColor,background:z.tagBg,padding:`0 ${z.spacing75} 0 ${z.spacing75}`,height:`calc(${z.lineHeight} + ${z.spacing50})`,lineHeight:`calc(${z.lineHeight} + ${z.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:P.fontSize("16px"),color:z.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${z.spacing_50} 0 ${z.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:z.spacing150,width:z.spacing150,color:z.tagCloseButtonColor,background:z.tagCloseButtonBg,borderRadius:P.tagCloseButtonRadius("99px"),opacity:z.tagButtonOpacity},':host [part="remove"]:hover':{background:z.tagCloseButtonBg,opacity:z.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[eC({part:"caption"},this.caption),Q9(p.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var xk=c0,W9=c0.elementCreator(),hk=B1((...y)=>W9(...y),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends U{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:z.tagListBg,gap:z.spacing25,borderRadius:P.taglistRoundedRadius(z.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${z.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${z.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:z.inputBg,borderRadius:P.tagContainerRadius(z.spacing50),boxShadow:z.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:z.spacing25,minHeight:`calc(${z.lineHeight} + ${z.spacing})`,padding:z.spacing25},':host [part="tagMenu"]':{width:z.touchSize,height:z.touchSize,lineHeight:z.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:z.brandColor,color:z.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L7(this.value).filter((y)=>y!=="")}set tags(y){this.value=yk(y)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(y){if(typeof y==="string")this._availableTags=f2.parseAvailableTagsString(y);else this._availableTags=y;this.queueRender()}static parseAvailableTagsString(y){return L7(y).map((x)=>x===""?null:x)}connectedCallback(){super.connectedCallback();let y=this.getAttribute("available-tags");if(y&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(y)}formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value=""}addTag=(y)=>{let x=y.trim();if(x===""||this.tags.includes(x))return;this.tags=[...this.tags,x],this.queueRender(!0)};toggleTag=(y)=>{if(this.tags.includes(y))this.tags=this.tags.filter((x)=>x!==y),this.queueRender(!0);else this.addTag(y)};enterTag=(y)=>{let{tagInput:x}=this.parts;switch(y.key){case",":{let h=x.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=x.value.split(",")[0];this.addTag(h)}y.stopPropagation(),y.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:y}=this,{tagMenu:x}=this.parts,h=[...this.availableTags],l=this.tags.filter((C)=>!h.includes(C));if(l.length)h.push(null,...l);let i=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){y(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){y(C)}}});o({target:x,width:"auto",menuItems:i})};content=()=>[Q9({type:"button",style:{visibility:"hidden"},tabindex:-1}),tC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),EC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),Q9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},p.chevronDown())];removeTag=(y)=>{if(this.editable&&!this.disabled){let x=y.target.closest(c0.tagName);this.tags=this.tags.filter((h)=>h!==x.caption),x.remove(),this.queueRender(!0)}y.stopPropagation(),y.preventDefault()};render(){super.render();let{tagContainer:y,tagMenu:x,tagInput:h}=this.parts;if(x.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)x.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else x.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);y.textContent="";for(let l of this.tags)y.append(W9({caption:l,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var lk=f2,o7=f2.elementCreator(),ik=B1((...y)=>o7(...y),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var M7="1.6.18";var{span:Ck}=K,J0=null,u4=null,a4=null,f1="tosi-tooltip",kk={[`.${f1}`]:{pointerEvents:"none",padding:P.tosiTooltipPadding("4px 10px"),borderRadius:P.tosiTooltipRadius("6px"),background:P.tosiTooltipBg("#333"),color:P.tosiTooltipColor("#fff"),fontSize:P.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:P.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${f1} p`]:{margin:"0"},[`.${f1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${f1} a`]:{color:"inherit"},[`.${f1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${f1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},n7=!1;function u7(){if(n7)return;n7=!0,Q1("tosi-tooltip",kk)}function S2(){if(u4!==null)clearTimeout(u4),u4=null;if(J0!==null)J0.remove(),J0=null;a4=null}function gk(y){if(y.startsWith("s"))return"tt-s";if(y.startsWith("n"))return"tt-n";if(y.startsWith("e"))return"tt-e";if(y.startsWith("w"))return"tt-w";return"tt-s"}function wk(y,x,h){let l=x.getBoundingClientRect(),i=y.getBoundingClientRect(),C=l.left+l.width*0.5,k=l.top+l.height*0.5,g;if(h.startsWith("s")||h.startsWith("n"))g=Math.max(8,Math.min(i.width-8,C-i.left))-4;else g=Math.max(8,Math.min(i.height-8,k-i.top))-4;y.style.setProperty("--tosi-tooltip-arrow",g+"px")}function Bk(y,x){if(x)y=b(y);let h=Ck({class:f1});return h.innerHTML=R.parseInline(y),h}function zk(y,x,h){u7(),S2(),a4=y;let{top:l,left:i,width:C}=y.getBoundingClientRect(),k=i+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(l>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),j=Bk(x,h);j.classList.add(gk(B)),J0=k0({content:j,target:y,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(J0&&a4)wk(j,y,B)})}function jk(y){for(let x of y.composedPath())if(x instanceof HTMLElement&&x.dataset.tooltip)return x;return null}function qk(y={}){u7();let{convertTitles:x=!0,delay:h=250,localize:l=!1}=y;document.addEventListener("pointermove",(i)=>{if(x){for(let g of i.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=jk(i);if(C===a4)return;if(S2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;u4=setTimeout(()=>zk(C,k,l),h)}),document.addEventListener("pointerleave",S2),document.addEventListener("pointerdown",S2),document.addEventListener("keydown",S2),window.addEventListener("scroll",S2,!0)}Object.assign(globalThis,{xinjs:h0,xinjsui:O9});})();
|
|
211
|
+
`+l;else h.push(l)}return h},[]);this.innerHTML=x.map((h)=>h.startsWith("<")&&h.endsWith(">")?h:R(h,this.options)).join("")}else this.innerHTML=R(y,this.options);this.didRender()}}var VC=d4,g9=d4.elementCreator(),PC=g9,_C=g9;var{div:w9,span:I4,button:B9}=K,v0=86400000,GC=[0,1,2,3,4,5,6],AC=[1,2,3,4,5,6,7,8,9,10,11,12],z9=(y,x=2,h="0")=>String(y).padStart(x,h),N0=(y,x,h)=>new Date(`${y}-${z9(x)}-${z9(h)}`);class j9 extends U{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:P.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:P.monthTodayBackground("transparent"),boxShadow:P.monthTodayShadow("none"),backdropFilter:P.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:P.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:P.monthDayColor("hotpink"),background:P.monthDayBackground("white"),fontWeight:P.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:P.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:P.monthDateCheckedColor("white"),background:P.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:P.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:P.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:P.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:N0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:N0(new Date().getFullYear()+10,12,31).toISOString().split("T")[0],selectable:!1,multiple:!1,range:!1,disabled:!1,readonly:!1,required:!1,name:""};selectedDays=[];value="";formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return AC.map((y)=>({caption:N0(2025,y,1).toString().split(" ")[1],value:String(y)}))}get years(){let y=Number(this.minDate.split("-")[0]),x=Number(this.maxDate.split("-")[0]),h=[];for(let l=y;l<=x;l++)h.push(String(l));return h}monthChanged=(y,x)=>{};gotoMonth(y,x){if(this.month!==x||this.year!==y)this.month=x,this.year=y,this.monthChanged(y,x)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(y){this.selectedDays[1]=y,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(y){this.selectedDays[0]=y,this.selectedDays.splice(2)}clickDate=(y)=>{let x=y.target.getAttribute("title");this.selectDate(x)};keyDate=(y)=>{let x=!1;switch(y.code){case"Space":{let h=y.target.getAttribute("title");this.selectDate(h),x=!0;break}case"Tab":break;default:console.log(y)}if(x)y.preventDefault(),y.stopPropagation()};#y="";selectDate=(y)=>{if(this.#y=y,this.range){if(!this.to)this.selectedDays=[y,y];else if(this.from===y&&this.to===y)this.selectedDays=[];else if(this.from===y)this.from=this.to;else if(this.to===y)this.to=this.from;else if(y<this.from)this.from=y;else if(y>this.to)this.to=y;else this.to=y;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(y))this.selectedDays.splice(this.selectedDays.indexOf(y),1);else this.selectedDays.push(y),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(y))this.value="",this.selectedDays=[];else this.value=y,this.selectedDays=[y]};nextMonth=()=>{if(this.month<12)this.gotoMonth(this.year,this.month+1);else this.gotoMonth(this.year+1,1)};previousMonth=()=>{if(this.month>1)this.gotoMonth(this.year,this.month-1);else this.gotoMonth(this.year-1,12)};checkDay=(y)=>{if(!this.range)return this.selectedDays.includes(y);else if(this.range)return this.from&&y>=this.from&&y<=this.to;return!1};dateMenuItem=(y,x="")=>{return y=y.split("T")[0],{caption:x||y,enabled:()=>!y.startsWith(`${this.year}-${z9(this.month)}-`),action:()=>{this.gotoDate(y)}}};jumpMenu=()=>{o({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((y)=>this.dateMenuItem(y))]})};content=()=>[w9({part:"header"},B9({part:"previous",onClick:this.previousMonth},p.chevronLeft()),I4({style:{flex:"1"}}),B9({part:"jump",onClick:this.jumpMenu},p.calendar()),A1({part:"month",options:this.months,onChange:this.setMonth}),A1({part:"year",options:[this.year],onChange:this.setMonth}),I4({style:{flex:"1"}}),B9({part:"next",onClick:this.nextMonth},p.chevronRight())),w9({part:"week"}),w9({part:"days"})];gotoDate(y){let x=new Date(y);this.gotoMonth(x.getFullYear(),x.getMonth()+1)}connectedCallback(){super.connectedCallback();let y=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=y.getMonth()+1;if(isNaN(this.year))this.year=y.getFullYear()}days=[];render(){super.render();let{week:y,days:x,jump:h,month:l,year:i,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=N0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*v0),B=this.month===12?1:this.month+1,j=new Date(N0(this.year+(this.month===12?1:0),B,1).valueOf()-v0),V=new Date(j.valueOf()+(this.weekStart*2+5+this.endDay-j.getDay())%7*v0),_=GC.map((X)=>new Date(w.valueOf()+X*v0).toString().split(" ")[0]);this.days=[];let Q=new Date().toISOString().split("T")[0];for(let X=w.valueOf();X<=V.valueOf();X+=v0){let s=new Date(X),c=s.toISOString().split("T")[0];this.days.push({date:s,selected:!1,inMonth:s.getMonth()+1===this.month,isToday:c===Q,isWeekend:s.getDay()%6===0,inRange:!!(this.from&&c>=this.from&&c<=this.to)})}l.value=String(this.month),i.value=String(this.year),l.disabled=i.disabled=h.disabled=C.disabled=k.disabled=this.disabled||this.readonly,i.options=this.years,y.textContent="",y.append(..._.map((X)=>I4({class:"day"},X))),x.textContent="";let A=null,{to:F,from:Y}=this;x.append(...this.days.map((X)=>{let s=["date"];if(X.inMonth)s.push("in-month");if(X.isToday)s.push("today");let c=X.date.toISOString().split("T")[0];if(this.checkDay(c))s.push("checked");if(s.push(X.isWeekend?"weekend":"weekday"),this.range){if(F===c)s.push("range-end");if(Y===c)s.push("range-start")}let T=I4({class:s.join(" "),title:c,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},X.date.getDate());if(c===this.#y)A=T;return T})),A?.focus()}}var KC=j9.elementCreator();var{div:q9,button:UC}=K,pC={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class x2 extends U{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${z.notificationSpacing} ${z.notificationSpacing50} ${z.notificationSpacing} ${z.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:z.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:z.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:z.notificationSpacing,width:z.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:z.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:z.notificationTextColor},":host .note":{display:"grid",background:z.notificationBg,padding:z.notificationPadding,gridTemplateColumns:`${z.notificationIconSize} 1fr ${z.notificationButtonSize}`,gap:z.notificationSpacing,alignItems:"center",borderRadius:z.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${z.notificationAccentColor}`,borderColor:z.notificationAccentColor,borderWidth:z.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:z.notificationButtonSize,padding:0,margin:0,height:z.notificationButtonSize,width:z.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:z.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:z.notificationBg,background:z.notificationAccentColor,padding:z.spacing50},":host .note svg":{height:z.notificationIconSize,width:z.notificationIconSize,pointerEvents:"none",color:z.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:z.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(y){y.classList.add("closing"),y.style.marginBottom=-y.offsetHeight+"px";let x=()=>{y.remove()};y.addEventListener("transitionend",x),setTimeout(x,1000)}static post(y){let{message:x,duration:h,type:l,close:i,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof y==="string"?{message:y}:y);if(!this.singleton)this.singleton=V9();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||pC[l],j=C||l==="progress"?K.progress():{},V=()=>{if(i)i();x2.removeNote(A)},_=k instanceof SVGElement?k:k?p[k]():p.info(),Q=l==="error"||l==="warn",A=q9({class:`note ${l}`,role:Q?"alert":"status",ariaLive:Q?"assertive":"polite",style:{_notificationAccentColor:B}},_,q9({class:"message"},q9(x),j),UC({class:"close",title:"close",ariaLabel:"Close notification",apply(F){F.addEventListener("click",V)}},p.x()));if(w.shadowRoot.append(A),j instanceof HTMLProgressElement&&C instanceof Function){j.setAttribute("max",String(100)),j.value=C();let F=setInterval(()=>{if(!w.shadowRoot.contains(A)){clearInterval(F);return}let Y=C();if(j.value=Y,Y>=100)x2.removeNote(A)},1000)}if(h>0)setTimeout(()=>{x2.removeNote(A)},h*1000);return A.scrollIntoView(),V}content=null}var QC=x2,V9=x2.elementCreator(),WC=V9;function OC(y){return x2.post(y)}var $7=async(y,x="SHA-1")=>{let l=new TextEncoder().encode(y),i=await crypto.subtle.digest(x,l);return Array.from(new Uint8Array(i)).map((g)=>g.toString(16).padStart(2,"0")).join("")},s7=async(y)=>{let x=await $7(y),h=await fetch(`https://weakpass.com/api/v1/search/${x}`);if(h.ok){let l=await h.json();console.log("password found in weakpass database",l)}return h.status!==404},{span:P9,tosiSlot:FC}=K;class T4 extends U{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:z.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:P.meterHeight("24px"),background:P.indicatorBg("white"),borderRadius:P.meterRadius("4px"),boxShadow:P.meterShadow(`inset 0 0 0 2px ${z.indicatorColor}`)},':host [part="level"]':{height:P.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:z.indicatorColor,margin:P.levelMargin("2px"),borderRadius:P.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:z.descriptionColor,height:P.meterHeight("24px"),lineHeight:P.meterHeight("24px"),textAlign:"center"}};static initAttributes={minLength:8,goodLength:12,indicatorColors:"#f00,#f40,#f80,#ef0,#8f0,#0a2"};descriptionColors="#000,#000,#000,#000,#000,#fff";issues={tooShort:!0,short:!0,noUpper:!0,noLower:!0,noNumber:!0,noSpecial:!0};issueDescriptions={tooShort:"too short",short:"short",noUpper:"no upper case",noLower:"no lower case",noNumber:"no digits",noSpecial:"no unusual characters"};value=0;strengthDescriptions=["unacceptable","very weak","weak","moderate","strong","very strong"];strength(y){return this.issues={tooShort:y.length<this.minLength,short:y.length<this.goodLength,noUpper:!y.match(/[A-Z]/),noLower:!y.match(/[a-z]/),noNumber:!y.match(/[0-9]/),noSpecial:!y.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((x)=>!x).length-1}async isBreached(){let y=this.querySelector("input")?.value;if(!y||typeof y!=="string")return!0;return await s7(y)}updateIndicator=(y)=>{let{level:x,description:h}=this.parts,l=this.indicatorColors.split(","),i=this.descriptionColors.split(","),C=this.strength(y);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));x.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",l[C]),this.style.setProperty("--description-color",i[C]),h.textContent=this.strengthDescriptions[C]};update=(y)=>{let x=y.target.closest("input");this.updateIndicator(x?.value||"")};content=()=>[FC({onInput:this.update}),P9({part:"meter"},P9({part:"level"}),P9({part:"description"}))];render(){super.render();let y=this.querySelector("input");this.updateIndicator(y?.value)}}var XC=T4,R7=T4.elementCreator(),YC=R7;var{span:_9}=K;class r4 extends U{static preferredTagName="tosi-rating";static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"#ccc",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(y){this.readonly=y}formResetCallback(){this.value=""}static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"fit-content"},":host::part(container)":{position:"relative",display:"inline-block"},":host::part(empty), :host::part(filled)":{height:"100%",whiteSpace:"nowrap",overflow:"hidden"},":host::part(empty)":{pointerEvents:"none"},":host::part(filled)":{position:"absolute",left:0,transition:"width 0.15s ease-out"},":host svg":{transform:"scale(0.9)",pointerEvents:"all !important",transition:"0.25s ease-in-out"},":host svg:hover":{transform:"scale(1)"},":host svg:active":{transform:"scale(1.1)"}};content=()=>_9({part:"container"},_9({part:"empty"}),_9({part:"filled"}));displayValue(y){let{empty:x,filled:h}=this.parts,i=Math.round((typeof y==="string"?0:y||0)/this.step)*this.step;h.style.width=i/this.max*x.offsetWidth+"px"}update=(y)=>{if(this.readonly)return;let{empty:x}=this.parts,h=y instanceof MouseEvent?y.pageX-x.getBoundingClientRect().x:0,l=Math.min(Math.max(this.min,Math.round(h/x.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(y.type==="click")this.value=l;else if(y.type==="mousemove")this.displayValue(l);else this.displayValue(this.value||0)};handleKey=(y)=>{let x=this.value===""?NaN:Number(this.value);if(isNaN(x))x=Math.round((this.min+this.max)*0.5*this.step)*this.step;let h=!1;switch(y.key){case"ArrowUp":case"ArrowRight":x+=this.step,h=!0;break;case"ArrowDown":case"ArrowLeft":x-=this.step,h=!0;break}if(this.value=Math.max(Math.min(x,this.max),this.min),h)y.stopPropagation(),y.preventDefault()};connectedCallback(){super.connectedCallback();let{container:y}=this.parts;y.tabIndex=0,y.addEventListener("mousemove",this.update,!0),y.addEventListener("mouseleave",this.update),y.addEventListener("blur",this.update),y.addEventListener("click",this.update),y.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let y=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",y),this.readonly)this.role="image";else this.role="slider";this.ariaLabel=`rating ${this.value} out of ${this.max}`,this.ariaValueMax=String(this.max),this.ariaValueMin=String(this.min),this.ariaValueNow=this.value===""?String(-1):String(this.value);let{empty:x,filled:h}=this.parts;if(x.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),x.style.setProperty("--tosi-icon-stroke",this.emptyStroke),h.style.setProperty("--tosi-icon-fill",this.ratingFill),h.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let l=0;l<this.max;l++)x.append(p[this.icon]()),h.append(p[this.icon]())}this.displayValue(this.value)}}var ZC=r4,c7=r4.elementCreator(),vC=B1((...y)=>c7(...y),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:J7,div:NC,button:$C}=K,sC=[{caption:"Title",tagType:"H1"},{caption:"Heading",tagType:"H2"},{caption:"Subheading",tagType:"H3"},{caption:"Minor heading",tagType:"H4"},{caption:"Body",tagType:"P"},{caption:"Code Block",tagType:"PRE"}];function G9(y=sC){return A1({title:"paragraph style",slot:"toolbar",class:"block-style",options:y.map(({caption:x,tagType:h})=>({caption:x,value:`formatBlock,${h}`}))})}var $0=()=>i9({slot:"toolbar"});function N1(y,x,h){return $C({slot:"toolbar",dataCommand:x,title:y},h)}var RC=()=>[N1("left-justify","justifyLeft",p.alignLeft()),N1("center","justifyCenter",p.alignCenter()),N1("right-justify","justifyRight",p.alignRight()),$0(),N1("bullet list","insertUnorderedList",p.listBullet()),N1("numbered list","insertOrderedList",p.listNumber()),$0(),N1("indent","indent",p.indent()),N1("indent","outdent",p.outdent())],H7=()=>[N1("bold","bold",p.fontBold()),N1("italic","italic",p.fontItalic()),N1("underline","underline",p.fontUnderline())],cC=()=>[G9(),$0(),...H7()],D7=()=>[G9(),$0(),...RC(),$0(),...H7()];class L4 extends U{static preferredTagName="tosi-rich-text";static lightStyleSpec={":host":{display:"flex",flexDirection:"column",height:"100%"},':host [part="toolbar"]':{padding:4,display:"flex",gap:"0px",flex:"0 0 auto",flexWrap:"wrap"},':host [part="toolbar"] > button':{_xinIconSize:18}};static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(y){if(this.isInitialized)this.parts.doc.contentEditable=y?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(y){let x=this._value;if(this._value=y,this.isInitialized){if(this.parts.doc.innerHTML!==y)this.parts.doc.innerHTML=y}if(x!==y&&this.internals)this.internals.setFormValue(y)}blockElement(y){let{doc:x}=this.parts;while(y.parentElement!==null&&y.parentElement!==x)y=y.parentElement;return y.parentElement===x?y:void 0}get selectedBlocks(){let{doc:y}=this.parts,x=window.getSelection();if(x===null)return[];let h=[];for(let l=0;l<x.rangeCount;l++){let i=x.getRangeAt(l);if(!y.contains(i.commonAncestorContainer))continue;let C=this.blockElement(i.startContainer),k=this.blockElement(i.endContainer);h.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,h.push(C)}return h}get selectedText(){let y=window.getSelection();if(y===null)return"";return this.selectedBlocks.length?y.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(y)=>{if(this._updatingBlockStyle)return;let h=y.target?.closest(c1.tagName);if(h==null)return;this.doCommand(h.value)};handleButtonClick=(y)=>{let h=y.target?.closest("button");if(h==null)return;this.doCommand(h.dataset.command)};content=[J7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),NC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),J7({part:"content"})];doCommand(y){if(y===void 0)return;let x=y.split(",");console.log("execCommand",x[0],!1,...x.slice(1)),document.execCommand(x[0],!1,...x.slice(1))}updateBlockStyle(){let y=this.parts.toolbar.querySelector(".block-style");if(y===null)return;let x=this.selectedBlocks.map((h)=>h.tagName);x=[...new Set(x)],this._updatingBlockStyle=!0,y.value=x.length===1?`formatBlock,${x[0]}`:"",this._updatingBlockStyle=!1}hasContent(){return(this.parts.doc.textContent||"").trim().length>0}handleInput=()=>{if(this.internals)this.internals.setFormValue(this.parts.doc.innerHTML),this.updateValidity()};updateValidity(){if(this.internals)if(this.required&&!this.hasContent())this.internals.setValidity({valueMissing:!0},"Please enter some content",this.parts.doc);else this.internals.setValidity({})}connectedCallback(){super.connectedCallback();let{doc:y,content:x}=this.parts;if(x.innerHTML!==""&&y.innerHTML==="")y.innerHTML=x.innerHTML,x.innerHTML="";this.isInitialized=!0,x.style.display="none",y.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(h)=>{this.updateBlockStyle(),this.selectionChange(h,this)})}render(){let{toolbar:y}=this.parts;if(super.render(),y.children.length===0)switch(this.widgets){case"minimal":y.append(...cC());break;case"default":y.append(...D7());break}}}var JC=L4,b7=L4.elementCreator(),HC=B1((...y)=>b7(...y),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:s0}=e({router:{path:"",hash:"",pattern:""}}),A9={};function DC(){return{...A9}}var o4=[],K9=!1,M4=new Set;function bC(y){let x=[];if(y==="")return{regex:/^\/?$/,paramNames:x};let h=y.split("/").map((i)=>{if(i.startsWith(":"))return x.push(i.slice(1)),"([^/]+)";return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+h.join("/")+"/?$"),paramNames:x}}function fC(y){let x=y.split("?")[0].split("#")[0];for(let l of o4){if(l.fallback)continue;let i=x.match(l.regex);if(i){let C={};return l.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(i[g+1])}),{route:l,params:C}}}let h=o4.find((l)=>l.fallback);if(h)return{route:h,params:{}};return null}function R0(){let y=K9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;s0.path.value=y,s0.hash.value=window.location.hash;let x=fC(y);if(x){A9=x.params,s0.pattern.value=x.route.regex.source;let h=new Map;for(let l of x.route.targets)h.set(l.view??"default",l);for(let l of M4){let i=l.name||"default",C=h.get(i);if(C)l.replaceChildren(C.component(x.params));else l.replaceChildren()}}else{A9={},s0.pattern.value="";for(let h of M4)h.replaceChildren()}}var f7=!1;function S7(){if(f7)return;f7=!0,window.addEventListener("popstate",R0),window.addEventListener("hashchange",R0)}function SC(y,x={}){K9=x.hashRouting??!1,o4=y.map((h)=>{let{regex:l,paramNames:i}=bC(h.pattern);return{regex:l,paramNames:i,targets:h.targets,fallback:h.fallback??!1}}),S7(),R0()}function dC(y){if(S7(),K9)window.location.hash="#/"+y.replace(/^\//,"");else window.history.pushState({},"","/"+y.replace(/^\//,""));R0()}class U9 extends U{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),M4.add(this),o4.length>0)R0()}disconnectedCallback(){super.disconnectedCallback(),M4.delete(this)}}var IC=U9.elementCreator();var{div:TC,slot:rC,label:LC,span:oC,input:d7}=K;class b2 extends U{static preferredTagName="tosi-segmented";static formAssociated=!0;static initAttributes={direction:"row",other:"",multiple:!1,name:"",placeholder:"Please specify…",localized:!1,required:!1};_choices=[];get choices(){return this._choices}set choices(y){if(typeof y==="string")this._choices=b2.parseChoicesString(y);else this._choices=y;this.queueRender()}static parseChoicesString(y){return y.split(",").filter((x)=>x.trim()!=="").map((x)=>{let[h,l]=x.split("=").map((g)=>g.trim()),[i,C]=(l||h).split(":").map((g)=>g.trim()),k=C?p[C]():"";return{value:h,icon:k,caption:i}})}value="";formDisabledCallback(y){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((y)=>y.trim()).filter((y)=>y!=="")}content=()=>[rC(),TC({part:"options"},d7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:P.segmentedOptionGap("8px"),alignItems:P.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:P.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:P.segmentedOptionGap("8px"),gridTemplateColumns:P.segmentedOptionGridColumns("0px 24px 1fr"),padding:P.segmentedOptionPadding("4px 12px"),font:P.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:P.segmentedFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentBackground("#44a")}`),borderRadius:P.segmentedOptionsBorderRadius("8px")},":host label.current":{color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:P.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${P.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:P.segmentOptionIconSize("16px"),stroke:P.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:P.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:P.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:P.segmentedOptionsBorderRadius("8px"),background:P.segmentedOptionsBackground("#fff"),color:P.segmentedOptionColor("#222"),overflow:"hidden",alignItems:P.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:P.segmentedOptionPadding("4px 12px"),color:P.segmentedOptionCurrentColor("#eee"),background:P.segmentedOptionCurrentBackground("#44a"),font:P.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:P.segmentedOptionCurrentColor("#eee"),opacity:P.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:y}=this.parts;y.querySelectorAll("label").forEach((x)=>{let h=x.querySelector("input");x.classList.toggle("current",Boolean(h&&h.checked))})}valueChanged=!1;handleChange=()=>{let{options:y,custom:x}=this.parts;if(this.multiple){let h=[...y.querySelectorAll("input:checked")];this.value=h.map((l)=>l.value).join(",")}else{let h=y.querySelector("input:checked");if(!h)this.value="";else if(h.value)x.setAttribute("hidden",""),this.value=h.value;else x.removeAttribute("hidden"),x.focus(),x.select(),this.value=x.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(y)=>{let x=!1;switch(y.code){case"Space":if(y.target instanceof HTMLLabelElement)y.target.click(),x=!0;break;case"Tab":if(!(y.target instanceof HTMLLabelElement))y.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let h=y.target.closest("label");if(h.previousElementSibling instanceof HTMLLabelElement)h.previousElementSibling.focus()}x=!0;break;case"ArrowRight":case"ArrowDown":{let h=y.target.closest("label");if(h.nextElementSibling instanceof HTMLLabelElement)h.nextElementSibling.focus()}x=!0;break}if(x)y.preventDefault(),y.stopPropagation()};connectedCallback(){super.connectedCallback();let y=this.getAttribute("choices");if(y&&this._choices.length===0)this._choices=b2.parseChoicesString(y);let{options:x}=this.parts;if(this.name==="")this.name=this.instanceId;if(x.addEventListener("change",this.handleChange),x.addEventListener("keydown",this.handleKey),this.other&&this.multiple)console.warn(this,"is set to [other] and [multiple]; [other] will be ignored"),this.other=""}get _choicesWithOther(){let y=[...this.choices];if(this.other&&!this.multiple){let[x,h]=this.other.split(":");y.push({value:"",caption:x,icon:h})}return y}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((y)=>y.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:y,custom:x}=this.parts;y.textContent="";let h=this.multiple?"checkbox":"radio",{values:l,isOtherValue:i}=this;if(y.append(...this._choicesWithOther.map((C)=>{return LC({tabindex:0},d7({type:h,name:this.name,value:C.value,checked:l.includes(C.value)||C.value===""&&i,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?W1(C.caption):oC(C.caption))})),this.other&&!this.multiple)x.hidden=!i,x.value=i?this.value:"",x.placeholder=this.placeholder,y.append(x);this.syncCurrent()}}var MC=b2,I7=b2.elementCreator(),nC=B1((...y)=>I7(...y),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:T7}=K;class p9 extends U{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[T7({part:"normal"}),T7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:y,small:x}=this.parts,h=this.offsetParent;if(!(h instanceof HTMLElement))return;else if(h.offsetWidth<this.minWidth||h.offsetHeight<this.minHeight)y.hidden=!0,x.hidden=!1,this.value="small";else y.hidden=!1,x.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var uC=p9.elementCreator();class n4 extends U{static preferredTagName="tosi-sizer";target=null;static shadowStyleSpec={":host":{_resizeIconFill:"#222",display:"block",position:"absolute",bottom:-7,right:-7,padding:14,width:44,height:44,opacity:0.25,transition:"opacity 0.25s ease-out"},":host(:hover)":{opacity:0.5},":host svg":{width:16,height:16,stroke:z.resizeIconFill}};content=p.resize();get minSize(){let{minWidth:y,minHeight:x}=getComputedStyle(this.target);return{width:parseFloat(y)||32,height:parseFloat(x)||32}}resizeTarget=(y)=>{let{target:x}=this;if(!x)return;let{offsetWidth:h,offsetHeight:l}=x;x.style.left=x.offsetLeft+"px",x.style.top=x.offsetTop+"px",x.style.bottom="",x.style.right="";let{minSize:i}=this;V1(y,(C,k,g)=>{if(x.style.width=Math.max(i.width,h+C)+"px",x.style.height=Math.max(i.height,l+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let y={passive:!0};this.addEventListener("mousedown",this.resizeTarget,y),this.addEventListener("touchstart",this.resizeTarget,y)}}var aC=n4,r7=n4.elementCreator(),mC=r7;var{div:tC,input:EC,span:eC,button:Q9}=K,L7=(y)=>y.split(/(?<!\\),/).map((x)=>x.trim().replace(/\\,/g,",")),yk=(y)=>y.map((x)=>x.replace(/,/g,"\\,")).join(",");class c0 extends U{static preferredTagName="tosi-tag";static lightStyleSpec={":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":P.brandColor("blue"),"--tag-text-color":P.brandTextColor("white"),display:"inline-flex",borderRadius:P.tagRoundedRadius(z.spacing50),color:z.tagTextColor,background:z.tagBg,padding:`0 ${z.spacing75} 0 ${z.spacing75}`,height:`calc(${z.lineHeight} + ${z.spacing50})`,lineHeight:`calc(${z.lineHeight} + ${z.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:P.fontSize("16px"),color:z.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${z.spacing_50} 0 ${z.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:z.spacing150,width:z.spacing150,color:z.tagCloseButtonColor,background:z.tagCloseButtonBg,borderRadius:P.tagCloseButtonRadius("99px"),opacity:z.tagButtonOpacity},':host [part="remove"]:hover':{background:z.tagCloseButtonBg,opacity:z.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[eC({part:"caption"},this.caption),Q9(p.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var xk=c0,W9=c0.elementCreator(),hk=B1((...y)=>W9(...y),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends U{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:z.tagListBg,gap:z.spacing25,borderRadius:P.taglistRoundedRadius(z.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${z.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${z.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:z.inputBg,borderRadius:P.tagContainerRadius(z.spacing50),boxShadow:z.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:z.spacing25,minHeight:`calc(${z.lineHeight} + ${z.spacing})`,padding:z.spacing25},':host [part="tagMenu"]':{width:z.touchSize,height:z.touchSize,lineHeight:z.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:z.brandColor,color:z.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return L7(this.value).filter((y)=>y!=="")}set tags(y){this.value=yk(y)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(y){if(typeof y==="string")this._availableTags=f2.parseAvailableTagsString(y);else this._availableTags=y;this.queueRender()}static parseAvailableTagsString(y){return L7(y).map((x)=>x===""?null:x)}connectedCallback(){super.connectedCallback();let y=this.getAttribute("available-tags");if(y&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(y)}formDisabledCallback(y){this.disabled=y}formResetCallback(){this.value=""}addTag=(y)=>{let x=y.trim();if(x===""||this.tags.includes(x))return;this.tags=[...this.tags,x],this.queueRender(!0)};toggleTag=(y)=>{if(this.tags.includes(y))this.tags=this.tags.filter((x)=>x!==y),this.queueRender(!0);else this.addTag(y)};enterTag=(y)=>{let{tagInput:x}=this.parts;switch(y.key){case",":{let h=x.value.split(",")[0];this.addTag(h)}break;case"Enter":{let h=x.value.split(",")[0];this.addTag(h)}y.stopPropagation(),y.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:y}=this,{tagMenu:x}=this.parts,h=[...this.availableTags],l=this.tags.filter((C)=>!h.includes(C));if(l.length)h.push(null,...l);let i=h.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){y(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){y(C)}}});o({target:x,width:"auto",menuItems:i})};content=()=>[Q9({type:"button",style:{visibility:"hidden"},tabindex:-1}),tC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),EC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),Q9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},p.chevronDown())];removeTag=(y)=>{if(this.editable&&!this.disabled){let x=y.target.closest(c0.tagName);this.tags=this.tags.filter((h)=>h!==x.caption),x.remove(),this.queueRender(!0)}y.stopPropagation(),y.preventDefault()};render(){super.render();let{tagContainer:y,tagMenu:x,tagInput:h}=this.parts;if(x.disabled=this.disabled,h.value="",h.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)x.toggleAttribute("hidden",!1),h.toggleAttribute("hidden",!this.textEntry);else x.toggleAttribute("hidden",!0),h.toggleAttribute("hidden",!0);y.textContent="";for(let l of this.tags)y.append(W9({caption:l,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var lk=f2,o7=f2.elementCreator(),ik=B1((...y)=>o7(...y),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var M7="1.6.19";var{span:Ck}=K,J0=null,u4=null,a4=null,f1="tosi-tooltip",kk={[`.${f1}`]:{pointerEvents:"none",padding:P.tosiTooltipPadding("4px 10px"),borderRadius:P.tosiTooltipRadius("6px"),background:P.tosiTooltipBg("#333"),color:P.tosiTooltipColor("#fff"),fontSize:P.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:P.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${f1} p`]:{margin:"0"},[`.${f1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${f1} a`]:{color:"inherit"},[`.${f1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${f1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${f1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},n7=!1;function u7(){if(n7)return;n7=!0,Q1("tosi-tooltip",kk)}function S2(){if(u4!==null)clearTimeout(u4),u4=null;if(J0!==null)J0.remove(),J0=null;a4=null}function gk(y){if(y.startsWith("s"))return"tt-s";if(y.startsWith("n"))return"tt-n";if(y.startsWith("e"))return"tt-e";if(y.startsWith("w"))return"tt-w";return"tt-s"}function wk(y,x,h){let l=x.getBoundingClientRect(),i=y.getBoundingClientRect(),C=l.left+l.width*0.5,k=l.top+l.height*0.5,g;if(h.startsWith("s")||h.startsWith("n"))g=Math.max(8,Math.min(i.width-8,C-i.left))-4;else g=Math.max(8,Math.min(i.height-8,k-i.top))-4;y.style.setProperty("--tosi-tooltip-arrow",g+"px")}function Bk(y,x){if(x)y=b(y);let h=Ck({class:f1});return h.innerHTML=R.parseInline(y),h}function zk(y,x,h){u7(),S2(),a4=y;let{top:l,left:i,width:C}=y.getBoundingClientRect(),k=i+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(l>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),j=Bk(x,h);j.classList.add(gk(B)),J0=k0({content:j,target:y,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(J0&&a4)wk(j,y,B)})}function jk(y){for(let x of y.composedPath())if(x instanceof HTMLElement&&x.dataset.tooltip)return x;return null}function qk(y={}){u7();let{convertTitles:x=!0,delay:h=250,localize:l=!1}=y;document.addEventListener("pointermove",(i)=>{if(x){for(let g of i.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=jk(i);if(C===a4)return;if(S2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;u4=setTimeout(()=>zk(C,k,l),h)}),document.addEventListener("pointerleave",S2),document.addEventListener("pointerdown",S2),document.addEventListener("keydown",S2),window.addEventListener("scroll",S2,!0)}Object.assign(globalThis,{xinjs:h0,xinjsui:O9});})();
|
|
212
212
|
|
|
213
|
-
//# debugId=
|
|
213
|
+
//# debugId=85A1D277880F71B564756E2164756E21
|
|
214
214
|
//# sourceMappingURL=iife.js.map
|