tosijs-ui 1.6.10 → 1.6.11
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/dist/doc-system/site/make-llms-txt.d.ts +29 -2
- package/dist/doc-system/site/make-llms-txt.js +59 -27
- package/dist/doc-system/site/orchestrator.js +17 -3
- package/dist/doc-system/site/output-guard.d.ts +9 -0
- package/dist/doc-system/site/output-guard.js +22 -0
- package/dist/iife.js +2 -2
- package/dist/iife.js.map +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +71 -49
- package/package.json +1 -1
|
@@ -1,11 +1,38 @@
|
|
|
1
|
+
/** A doc as it appears in the extracted corpus (docs.json). */
|
|
2
|
+
interface CorpusDoc {
|
|
3
|
+
title?: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface LlmsEntry {
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
/** rendered-doc URL (corpus mode) or dist/*.js path (legacy scan) */
|
|
13
|
+
link: string;
|
|
14
|
+
}
|
|
1
15
|
export interface LlmsTxtMeta {
|
|
2
16
|
name?: string;
|
|
3
17
|
description?: string;
|
|
4
|
-
/** site origin, used for the Docs link */
|
|
18
|
+
/** site origin, used for the Docs link and to make page links absolute */
|
|
5
19
|
baseUrl?: string;
|
|
6
20
|
/** project links — `github` / `npm` (or any) become Source/npm links */
|
|
7
21
|
projectLinks?: Record<string, string | undefined>;
|
|
8
22
|
/** optional framing line(s) under the description */
|
|
9
23
|
tagline?: string;
|
|
10
24
|
}
|
|
11
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Build entries from the extracted corpus — every doc that was actually
|
|
27
|
+
* extracted (`.md`, `.ts`/`.js`/`.css` doc comments, auto-created sections),
|
|
28
|
+
* linking to its rendered URL. This is what the build uses: it reflects the real
|
|
29
|
+
* docs and needs no `dist/` library output.
|
|
30
|
+
*/
|
|
31
|
+
export declare function entriesFromCorpus(corpus: CorpusDoc[], meta: LlmsTxtMeta): LlmsEntry[];
|
|
32
|
+
/**
|
|
33
|
+
* Write an `llms.txt` index. Pass the extracted `corpus` (the build does) to
|
|
34
|
+
* index every doc by its rendered URL; omit it to fall back to the legacy
|
|
35
|
+
* `src/*.ts`-with-`dist/*.js` scan.
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateLlmsTxt(outputPath: string, meta?: LlmsTxtMeta, corpus?: CorpusDoc[]): void;
|
|
38
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import { buildSlugMap, pathForSlug } from '../routing';
|
|
3
4
|
const SRC = 'src';
|
|
4
5
|
const DIST = 'dist';
|
|
5
6
|
function extractTitle(text) {
|
|
@@ -33,19 +34,37 @@ function extractDescription(text) {
|
|
|
33
34
|
}
|
|
34
35
|
return '';
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Build entries from the extracted corpus — every doc that was actually
|
|
39
|
+
* extracted (`.md`, `.ts`/`.js`/`.css` doc comments, auto-created sections),
|
|
40
|
+
* linking to its rendered URL. This is what the build uses: it reflects the real
|
|
41
|
+
* docs and needs no `dist/` library output.
|
|
42
|
+
*/
|
|
43
|
+
export function entriesFromCorpus(corpus, meta) {
|
|
44
|
+
const slugMap = buildSlugMap(corpus);
|
|
45
|
+
const base = (meta.baseUrl ?? '').replace(/\/$/, '');
|
|
46
|
+
return corpus
|
|
47
|
+
.filter((doc) => doc.title && !doc.hidden)
|
|
48
|
+
.map((doc) => ({
|
|
49
|
+
title: doc.title,
|
|
50
|
+
description: doc.description?.trim() || extractDescription(doc.text ?? ''),
|
|
51
|
+
link: base + pathForSlug(slugMap[doc.filename]),
|
|
52
|
+
}))
|
|
53
|
+
.sort((a, b) => a.title.localeCompare(b.title));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Legacy fallback when no corpus is passed (e.g. running this file directly):
|
|
57
|
+
* scan `src/*.ts` for doc-comment blocks that have a built `dist/*.js` sibling.
|
|
58
|
+
*/
|
|
59
|
+
function entriesFromSrcScan() {
|
|
60
|
+
const entries = [];
|
|
61
|
+
let files = [];
|
|
41
62
|
try {
|
|
42
|
-
|
|
63
|
+
files = fs.readdirSync(SRC).filter((f) => f.endsWith('.ts'));
|
|
43
64
|
}
|
|
44
65
|
catch {
|
|
45
|
-
|
|
66
|
+
return entries;
|
|
46
67
|
}
|
|
47
|
-
const docs = [];
|
|
48
|
-
const files = fs.readdirSync(SRC).filter((f) => f.endsWith('.ts'));
|
|
49
68
|
for (const file of files) {
|
|
50
69
|
const content = fs.readFileSync(path.join(SRC, file), 'utf8');
|
|
51
70
|
const match = content.match(/\/\*#([\s\S]+?)\*\//);
|
|
@@ -53,21 +72,36 @@ export function generateLlmsTxt(outputPath, meta = {}) {
|
|
|
53
72
|
continue;
|
|
54
73
|
const markdown = match[1].trim();
|
|
55
74
|
const title = extractTitle(markdown);
|
|
56
|
-
const description = extractDescription(markdown);
|
|
57
75
|
if (!title)
|
|
58
76
|
continue;
|
|
59
77
|
const distFile = file.replace(/\.ts$/, '.js');
|
|
60
|
-
|
|
61
|
-
if (!fs.existsSync(distPath))
|
|
78
|
+
if (!fs.existsSync(path.join(DIST, distFile)))
|
|
62
79
|
continue;
|
|
63
|
-
|
|
80
|
+
entries.push({
|
|
64
81
|
title,
|
|
65
|
-
description,
|
|
66
|
-
|
|
67
|
-
distFile: `dist/${distFile}`,
|
|
82
|
+
description: extractDescription(markdown),
|
|
83
|
+
link: `dist/${distFile}`,
|
|
68
84
|
});
|
|
69
85
|
}
|
|
70
|
-
|
|
86
|
+
return entries.sort((a, b) => a.title.localeCompare(b.title));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Write an `llms.txt` index. Pass the extracted `corpus` (the build does) to
|
|
90
|
+
* index every doc by its rendered URL; omit it to fall back to the legacy
|
|
91
|
+
* `src/*.ts`-with-`dist/*.js` scan.
|
|
92
|
+
*/
|
|
93
|
+
export function generateLlmsTxt(outputPath, meta = {}, corpus) {
|
|
94
|
+
// package.json supplies fallback name/version/description, but a doc site
|
|
95
|
+
// isn't guaranteed to have one (or it may be unreadable) — degrade gracefully
|
|
96
|
+
// rather than aborting the whole build.
|
|
97
|
+
let pkg = {};
|
|
98
|
+
try {
|
|
99
|
+
pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
console.warn('llms.txt: no readable package.json — using config values only');
|
|
103
|
+
}
|
|
104
|
+
const entries = corpus ? entriesFromCorpus(corpus, meta) : entriesFromSrcScan();
|
|
71
105
|
const name = meta.name ?? pkg.name ?? '';
|
|
72
106
|
const description = meta.description ?? pkg.description ?? '';
|
|
73
107
|
const links = [];
|
|
@@ -89,24 +123,22 @@ export function generateLlmsTxt(outputPath, meta = {}) {
|
|
|
89
123
|
'',
|
|
90
124
|
'## Documentation',
|
|
91
125
|
'',
|
|
92
|
-
'
|
|
93
|
-
'embedded in its distributed JS file as inline comments. Read the',
|
|
94
|
-
'relevant dist/*.js file for complete docs, usage examples, and API.',
|
|
126
|
+
'Full documentation, with live code examples, is at the links below.',
|
|
95
127
|
'',
|
|
96
|
-
'##
|
|
128
|
+
'## Pages',
|
|
97
129
|
'',
|
|
98
130
|
];
|
|
99
|
-
for (const
|
|
100
|
-
lines.push(`- ${
|
|
101
|
-
if (
|
|
102
|
-
lines.push(` ${
|
|
131
|
+
for (const entry of entries) {
|
|
132
|
+
lines.push(`- ${entry.link} — ${entry.title}`);
|
|
133
|
+
if (entry.description) {
|
|
134
|
+
lines.push(` ${entry.description}`);
|
|
103
135
|
}
|
|
104
136
|
}
|
|
105
137
|
lines.push('');
|
|
106
138
|
fs.writeFileSync(outputPath, lines.join('\n'), 'utf8');
|
|
107
|
-
console.log(`llms.txt generated (${
|
|
139
|
+
console.log(`llms.txt generated (${entries.length} entries)`);
|
|
108
140
|
}
|
|
109
|
-
// Allow running directly
|
|
141
|
+
// Allow running directly (no corpus — uses the legacy src/*.ts scan)
|
|
110
142
|
if (import.meta.main) {
|
|
111
143
|
generateLlmsTxt('dist/llms.txt');
|
|
112
144
|
}
|
|
@@ -19,6 +19,7 @@ import { extractDocs } from './docs';
|
|
|
19
19
|
import { ensureSections } from './sections';
|
|
20
20
|
import { generateLlmsTxt } from './make-llms-txt';
|
|
21
21
|
import { generateSite } from './generate-site';
|
|
22
|
+
import { findOutputDirOverlap } from './output-guard';
|
|
22
23
|
// Module specifiers contain regex metacharacters (`/`, `.`, `@`, …), so escape
|
|
23
24
|
// before interpolating into the require-shim detector below.
|
|
24
25
|
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -39,10 +40,20 @@ export async function buildSite(config) {
|
|
|
39
40
|
console.time('prebuild');
|
|
40
41
|
// Project-specific codegen (version stamp, icon data, …) before anything else.
|
|
41
42
|
await config.prebuild?.();
|
|
43
|
+
// Guard before the destructive `rm -rf`: if a docPath overlaps the output dir,
|
|
44
|
+
// wiping the output would delete the source docs we're about to extract.
|
|
45
|
+
const docPaths = config.docPaths ?? ['src', 'README.md'];
|
|
46
|
+
const overlap = findOutputDirOverlap(docPaths, config.outputDir ?? 'docs', PROJECT_ROOT);
|
|
47
|
+
if (overlap) {
|
|
48
|
+
throw new Error(`doc-site build: docPath "${overlap}" overlaps outputDir "${config.outputDir ?? 'docs'}". ` +
|
|
49
|
+
'buildSite() runs `rm -rf <outputDir>` before extracting docs, so this would ' +
|
|
50
|
+
'delete your source docs first (producing an empty site with no error). Move the ' +
|
|
51
|
+
"source docs out of the output dir, or set a different outputDir (e.g. outputDir: 'site').");
|
|
52
|
+
}
|
|
42
53
|
await $ `rm -rf ${PUBLIC}`.text();
|
|
43
54
|
await $ `mkdir ${PUBLIC}`.text();
|
|
44
55
|
const extract = () => extractDocs({
|
|
45
|
-
paths:
|
|
56
|
+
paths: docPaths,
|
|
46
57
|
// Skip the build's own output dir by path (not by the name 'docs', so a
|
|
47
58
|
// source dir like src/docs is still scanned).
|
|
48
59
|
ignore: ['node_modules', 'dist', 'build', PUBLIC],
|
|
@@ -139,8 +150,11 @@ export async function buildSite(config) {
|
|
|
139
150
|
console.log(`${scriptName}: ${(bundleFile.byteLength / 1024).toFixed(1)}kb (${(bundleGzip.length / 1024).toFixed(1)}kb gzip)`);
|
|
140
151
|
}
|
|
141
152
|
if (config.llmsTxt !== false) {
|
|
153
|
+
// Drive llms.txt from the extracted corpus (every doc, by rendered URL) — not
|
|
154
|
+
// a re-scan of src/*.ts — so it works regardless of doc source (.md, etc.)
|
|
155
|
+
// and whether the project emits a dist/ library.
|
|
156
|
+
const corpus = JSON.parse(await Bun.file(DOCS_JSON).text());
|
|
142
157
|
if (typeof config.llmsTxt === 'function') {
|
|
143
|
-
const corpus = JSON.parse(await Bun.file(DOCS_JSON).text());
|
|
144
158
|
await Bun.write('llms.txt', config.llmsTxt(corpus));
|
|
145
159
|
}
|
|
146
160
|
else {
|
|
@@ -149,7 +163,7 @@ export async function buildSite(config) {
|
|
|
149
163
|
description: config.description,
|
|
150
164
|
baseUrl: config.baseUrl,
|
|
151
165
|
projectLinks: config.projectLinks,
|
|
152
|
-
});
|
|
166
|
+
}, corpus);
|
|
153
167
|
}
|
|
154
168
|
// Also place it at the served web root so {baseUrl}/llms.txt resolves (the
|
|
155
169
|
// root copy stays for the npm package's `files`).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the first `docPaths` entry that overlaps `outputDir` (the same
|
|
3
|
+
* directory, or either nested inside the other), or null if none overlap.
|
|
4
|
+
*
|
|
5
|
+
* `buildSite()` runs `rm -rf <outputDir>` before it extracts docs, so an overlap
|
|
6
|
+
* means the source docs get deleted *before* they're read — silently producing
|
|
7
|
+
* an empty site with no error. Callers throw an actionable message instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findOutputDirOverlap(docPaths: string[], outputDir: string, root?: string): string | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Return the first `docPaths` entry that overlaps `outputDir` (the same
|
|
4
|
+
* directory, or either nested inside the other), or null if none overlap.
|
|
5
|
+
*
|
|
6
|
+
* `buildSite()` runs `rm -rf <outputDir>` before it extracts docs, so an overlap
|
|
7
|
+
* means the source docs get deleted *before* they're read — silently producing
|
|
8
|
+
* an empty site with no error. Callers throw an actionable message instead.
|
|
9
|
+
*/
|
|
10
|
+
export function findOutputDirOverlap(docPaths, outputDir, root = '.') {
|
|
11
|
+
// Compare as directory prefixes (trailing separator) so '/docs' doesn't
|
|
12
|
+
// falsely match '/docs-site', while genuine nesting ('/docs' vs '/docs/api')
|
|
13
|
+
// and exact matches still do.
|
|
14
|
+
const withSep = (p) => (p.endsWith(path.sep) ? p : p + path.sep);
|
|
15
|
+
const out = withSep(path.resolve(root, outputDir));
|
|
16
|
+
for (const docPath of docPaths) {
|
|
17
|
+
const resolved = withSep(path.resolve(root, docPath));
|
|
18
|
+
if (resolved.startsWith(out) || out.startsWith(resolved))
|
|
19
|
+
return docPath;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
package/dist/iife.js
CHANGED
|
@@ -106,7 +106,7 @@ ${h.join(`
|
|
|
106
106
|
`)||"(idle)"}`}).join(`
|
|
107
107
|
`)}var{slot:n3}=A;class b3 extends _{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[n3()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:j.tosiRowGap("0"),alignItems:j.tosiRowAlign("stretch"),justifyContent:j.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 Qx=b3.elementCreator();class J3 extends _{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[n3()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:j.tosiColumnGap("0"),alignItems:j.tosiColumnAlign("stretch"),justifyContent:j.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 Yx=J3.elementCreator();class H3 extends _{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[n3()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:j.tosiGridColumns("1fr"),gridTemplateRows:j.tosiGridRows("auto"),gap:j.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 dx=H3.elementCreator(),{span:C7}=A,rx=(...l)=>C7({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...l),D3=(...l)=>C7({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...l);var R1={accent:v.fromCss("#EE257B"),background:v.fromCss("#fafafa"),text:v.fromCss("#222222")},k7={_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 g7(l){let{accent:i,background:y,text:h}=l,x=l.accentText??i.contrasting(),C=l.backgroundInset??y.darken(0.03),k=l.border??h.opacity(0.15),g=l.shadow??h.opacity(0.1),w=l.focus??i.opacity(0.5);return{_tosiAccent:i,_tosiAccentLight:i.brighten(0.15),_tosiAccentDark:i.darken(0.15),_tosiAccentText:x,_tosiBg:y,_tosiBgInset:C,_tosiBgHover:y.darken(0.05),_tosiBgActive:y.darken(0.1),_tosiText:h,_tosiTextMuted:h.opacity(0.6),_tosiTextDisabled:h.opacity(0.4),_tosiBorder:k,_tosiBorderFocus:i,_tosiShadow:g,_tosiShadowColor:g,_tosiFocusRing:`0 0 0 2px ${w}`,_tosiInputBg:y,_tosiInputBorder:k,_tosiInputBorderFocus:i,_tosiButtonBg:y,_tosiButtonText:h,_tosiButtonBorder:k,_tosiButtonHoverBg:y.darken(0.05),_tosiButtonActiveBg:i,_tosiButtonActiveText:x}}function X2(l){return{":root":{...k7,...g7(l)}}}function d4(l){let y=X2(l)[":root"];return{":root":E2(y)}}function S3(l,i="tosi-theme"){O1(i,l)}var Xx=X2(R1),Nx=d4(R1),w7={"--xin-icon-size":s.tosiIconSize,"--xin-icon-fill":s.tosiIconFill,"--xin-icon-stroke":s.tosiIconStroke,"--xin-tabs-bar-color":s.tosiTabsBarColor,"--xin-tabs-bar-height":s.tosiTabsBarHeight,"--xin-tabs-selected-color":s.tosiTabsSelectedColor,"--spacing":s.tosiSpacing,"--gap":s.tosiSpacingSm,"--touch-size":s.tosiTouchSize,"--background":s.tosiBg,"--text-color":s.tosiText,"--brand-color":s.tosiAccent,"--brand-text-color":s.tosiAccentText};function Zx(l){return{":root":{...X2(l)[":root"],...w7}}}function fx(l,i){let y={};for(let[h,x]of Object.entries(i)){let C=`--tosi-${l}-${h.replace(/([A-Z])/g,"-$1").toLowerCase()}`;y[h]=`var(${C}, ${x})`}return y}var{div:N2,label:r4,input:X4,span:$x,button:B7}=A,{liveTheme:S}=e({liveTheme:{accent:String(R1.accent),background:String(R1.background),text:String(R1.text),dark:!1}}),N4=!1;function v0(){if(!N4)return;let l={accent:v.fromCss(S.accent.value),background:v.fromCss(S.background.value),text:v.fromCss(S.text.value)},i=S.dark.value?d4(l):X2(l);S3(i,"tosi-live-theme")}function s7(){if(N4)return;N4=!0,S.accent.observe(v0),S.background.observe(v0),S.text.observe(v0),S.dark.observe(v0),v0()}function Rx(){N4=!1}class I3 extends _{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=()=>[N2({class:"field"},r4("Accent"),X4({type:"color",part:"accent"})),N2({class:"field"},r4("Background"),X4({type:"color",part:"background"})),N2({class:"field"},r4("Text"),X4({type:"color",part:"text"})),N2({class:"field"},r4("Dark mode"),X4({type:"checkbox",part:"dark"})),N2({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},$x("Preview "),B7({class:"preview-button",style:{background:"var(--tosi-accent, #EE257B)",color:"var(--tosi-accent-text, white)"}},"Button")),N2({class:"actions"},B7({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),s7();let l=()=>{this.parts.accent.value=S.accent.value,this.parts.background.value=S.background.value,this.parts.text.value=S.text.value,this.parts.dark.checked=S.dark.value};l(),S.accent.observe(l),S.background.observe(l),S.text.observe(l),S.dark.observe(l),this.parts.accent.addEventListener("input",()=>{S.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{S.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{S.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{S.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{S.accent.value=String(R1.accent),S.background.value=String(R1.background),S.text.value=String(R1.text),S.dark.value=!1})}}var nx=I3.elementCreator();var{div:bx}=A;class j2 extends _{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(l){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=bx({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(j2.mapboxCSSAvailable===void 0)j2.mapboxCSSAvailable=u0("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((l)=>{console.error("failed to load mapbox-gl.css",l)}),j2.mapboxAvailable=P1("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((l)=>{console.error("failed to load mapbox-gl.js",l)})}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[x,C,k]=this.coords.split(",").map((g)=>Number(g));this._map.setCenter([C,x]),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:l}=this.parts,[i,y,h]=this.coords.split(",").map((x)=>Number(x));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,j2.mapboxAvailable.then(({mapboxgl:x})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),x.accessToken=this.token,this._map=new x.Map({container:l,style:this.mapStyle,zoom:h,center:[y,i]}),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 Jx=j2.elementCreator();function p7(l,i){if(i==null)i="";else if(typeof i!=="string")i=String(i);return i.replace(/\{\{([^}]+)\}\}/g,(y,h)=>{let x=E[`${l}${h.startsWith("[")?h:"."+h}`];return x===void 0?y:p7(l,String(x))})}class Z4 extends _{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let l=await fetch(this.src);this.value=await l.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 l=p7(this.instanceId,this.value);if(this.elements){let i=l.split(`
|
|
108
108
|
`).reduce((y,h)=>{if(h.startsWith("<")||y.length===0)y.push(h);else{let x=y[y.length-1];if(!x.startsWith("<")||!x.endsWith(">"))y[y.length-1]+=`
|
|
109
|
-
`+h;else y.push(h)}return y},[]);this.innerHTML=i.map((y)=>y.startsWith("<")&&y.endsWith(">")?y:r(y,this.options)).join("")}else this.innerHTML=r(l,this.options);this.didRender()}}var Hx=Z4,T3=Z4.elementCreator(),Dx=T3,Sx=T3;var{div:L3,span:f4,button:M3}=A,K0=86400000,Ix=[0,1,2,3,4,5,6],Tx=[1,2,3,4,5,6,7,8,9,10,11,12],t3=(l,i=2,y="0")=>String(l).padStart(i,y),U0=(l,i,y)=>new Date(`${l}-${t3(i)}-${t3(y)}`);class a3 extends _{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:j.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:j.monthTodayBackground("transparent"),boxShadow:j.monthTodayShadow("none"),backdropFilter:j.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:j.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:j.monthDayColor("hotpink"),background:j.monthDayBackground("white"),fontWeight:j.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:j.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:j.monthDateCheckedColor("white"),background:j.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:j.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:j.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:j.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:j.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:j.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:U0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:U0(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(l){this.disabled=l}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return Tx.map((l)=>({caption:U0(2025,l,1).toString().split(" ")[1],value:String(l)}))}get years(){let l=Number(this.minDate.split("-")[0]),i=Number(this.maxDate.split("-")[0]),y=[];for(let h=l;h<=i;h++)y.push(String(h));return y}monthChanged=(l,i)=>{};gotoMonth(l,i){if(this.month!==i||this.year!==l)this.month=i,this.year=l,this.monthChanged(l,i)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(l){this.selectedDays[1]=l,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(l){this.selectedDays[0]=l,this.selectedDays.splice(2)}clickDate=(l)=>{let i=l.target.getAttribute("title");this.selectDate(i)};keyDate=(l)=>{let i=!1;switch(l.code){case"Space":{let y=l.target.getAttribute("title");this.selectDate(y),i=!0;break}case"Tab":break;default:console.log(l)}if(i)l.preventDefault(),l.stopPropagation()};#l="";selectDate=(l)=>{if(this.#l=l,this.range){if(!this.to)this.selectedDays=[l,l];else if(this.from===l&&this.to===l)this.selectedDays=[];else if(this.from===l)this.from=this.to;else if(this.to===l)this.to=this.from;else if(l<this.from)this.from=l;else if(l>this.to)this.to=l;else this.to=l;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(l))this.selectedDays.splice(this.selectedDays.indexOf(l),1);else this.selectedDays.push(l),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(l))this.value="",this.selectedDays=[];else this.value=l,this.selectedDays=[l]};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=(l)=>{if(!this.range)return this.selectedDays.includes(l);else if(this.range)return this.from&&l>=this.from&&l<=this.to;return!1};dateMenuItem=(l,i="")=>{return l=l.split("T")[0],{caption:i||l,enabled:()=>!l.startsWith(`${this.year}-${t3(this.month)}-`),action:()=>{this.gotoDate(l)}}};jumpMenu=()=>{T({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((l)=>this.dateMenuItem(l))]})};content=()=>[L3({part:"header"},M3({part:"previous",onClick:this.previousMonth},V.chevronLeft()),f4({style:{flex:"1"}}),M3({part:"jump",onClick:this.jumpMenu},V.calendar()),c1({part:"month",options:this.months,onChange:this.setMonth}),c1({part:"year",options:[this.year],onChange:this.setMonth}),f4({style:{flex:"1"}}),M3({part:"next",onClick:this.nextMonth},V.chevronRight())),L3({part:"week"}),L3({part:"days"})];gotoDate(l){let i=new Date(l);this.gotoMonth(i.getFullYear(),i.getMonth()+1)}connectedCallback(){super.connectedCallback();let l=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=l.getMonth()+1;if(isNaN(this.year))this.year=l.getFullYear()}days=[];render(){super.render();let{week:l,days:i,jump:y,month:h,year:x,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=U0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*K0),B=this.month===12?1:this.month+1,p=new Date(U0(this.year+(this.month===12?1:0),B,1).valueOf()-K0),z=new Date(p.valueOf()+(this.weekStart*2+5+this.endDay-p.getDay())%7*K0),q=Ix.map((U)=>new Date(w.valueOf()+U*K0).toString().split(" ")[0]);this.days=[];let O=new Date().toISOString().split("T")[0];for(let U=w.valueOf();U<=z.valueOf();U+=K0){let X=new Date(U),N=X.toISOString().split("T")[0];this.days.push({date:X,selected:!1,inMonth:X.getMonth()+1===this.month,isToday:N===O,isWeekend:X.getDay()%6===0,inRange:!!(this.from&&N>=this.from&&N<=this.to)})}h.value=String(this.month),x.value=String(this.year),h.disabled=x.disabled=y.disabled=C.disabled=k.disabled=this.disabled||this.readonly,x.options=this.years,l.textContent="",l.append(...q.map((U)=>f4({class:"day"},U))),i.textContent="";let c=null,{to:K,from:F}=this;i.append(...this.days.map((U)=>{let X=["date"];if(U.inMonth)X.push("in-month");if(U.isToday)X.push("today");let N=U.date.toISOString().split("T")[0];if(this.checkDay(N))X.push("checked");if(X.push(U.isWeekend?"weekend":"weekday"),this.range){if(K===N)X.push("range-end");if(F===N)X.push("range-start")}let D=f4({class:X.join(" "),title:N,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},U.date.getDate());if(N===this.#l)c=D;return D})),c?.focus()}}var Lx=a3.elementCreator();var{div:u3,button:Mx}=A,tx={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class i2 extends _{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${s.notificationSpacing} ${s.notificationSpacing50} ${s.notificationSpacing} ${s.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:s.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:s.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:s.notificationSpacing,width:s.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:s.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:s.notificationTextColor},":host .note":{display:"grid",background:s.notificationBg,padding:s.notificationPadding,gridTemplateColumns:`${s.notificationIconSize} 1fr ${s.notificationButtonSize}`,gap:s.notificationSpacing,alignItems:"center",borderRadius:s.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${s.notificationAccentColor}`,borderColor:s.notificationAccentColor,borderWidth:s.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:s.notificationButtonSize,padding:0,margin:0,height:s.notificationButtonSize,width:s.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:s.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:s.notificationBg,background:s.notificationAccentColor,padding:s.spacing50},":host .note svg":{height:s.notificationIconSize,width:s.notificationIconSize,pointerEvents:"none",color:s.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:s.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(l){l.classList.add("closing"),l.style.marginBottom=-l.offsetHeight+"px";let i=()=>{l.remove()};l.addEventListener("transitionend",i),setTimeout(i,1000)}static post(l){let{message:i,duration:y,type:h,close:x,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof l==="string"?{message:l}:l);if(!this.singleton)this.singleton=m3();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||tx[h],p=C||h==="progress"?A.progress():{},z=()=>{if(x)x();i2.removeNote(c)},q=k instanceof SVGElement?k:k?V[k]():V.info(),O=h==="error"||h==="warn",c=u3({class:`note ${h}`,role:O?"alert":"status",ariaLive:O?"assertive":"polite",style:{_notificationAccentColor:B}},q,u3({class:"message"},u3(i),p),Mx({class:"close",title:"close",ariaLabel:"Close notification",apply(K){K.addEventListener("click",z)}},V.x()));if(w.shadowRoot.append(c),p instanceof HTMLProgressElement&&C instanceof Function){p.setAttribute("max",String(100)),p.value=C();let K=setInterval(()=>{if(!w.shadowRoot.contains(c)){clearInterval(K);return}let F=C();if(p.value=F,F>=100)i2.removeNote(c)},1000)}if(y>0)setTimeout(()=>{i2.removeNote(c)},y*1000);return c.scrollIntoView(),z}content=null}var ax=i2,m3=i2.elementCreator(),ux=m3;function mx(l){return i2.post(l)}var z7=async(l,i="SHA-1")=>{let h=new TextEncoder().encode(l),x=await crypto.subtle.digest(i,h);return Array.from(new Uint8Array(x)).map((g)=>g.toString(16).padStart(2,"0")).join("")},o7=async(l)=>{let i=await z7(l),y=await fetch(`https://weakpass.com/api/v1/search/${i}`);if(y.ok){let h=await y.json();console.log("password found in weakpass database",h)}return y.status!==404},{span:E3,tosiSlot:Ex}=A;class $4 extends _{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:s.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:j.meterHeight("24px"),background:j.indicatorBg("white"),borderRadius:j.meterRadius("4px"),boxShadow:j.meterShadow(`inset 0 0 0 2px ${s.indicatorColor}`)},':host [part="level"]':{height:j.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:s.indicatorColor,margin:j.levelMargin("2px"),borderRadius:j.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:s.descriptionColor,height:j.meterHeight("24px"),lineHeight:j.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(l){return this.issues={tooShort:l.length<this.minLength,short:l.length<this.goodLength,noUpper:!l.match(/[A-Z]/),noLower:!l.match(/[a-z]/),noNumber:!l.match(/[0-9]/),noSpecial:!l.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((i)=>!i).length-1}async isBreached(){let l=this.querySelector("input")?.value;if(!l||typeof l!=="string")return!0;return await o7(l)}updateIndicator=(l)=>{let{level:i,description:y}=this.parts,h=this.indicatorColors.split(","),x=this.descriptionColors.split(","),C=this.strength(l);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));i.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",h[C]),this.style.setProperty("--description-color",x[C]),y.textContent=this.strengthDescriptions[C]};update=(l)=>{let i=l.target.closest("input");this.updateIndicator(i?.value||"")};content=()=>[Ex({onInput:this.update}),E3({part:"meter"},E3({part:"level"}),E3({part:"description"}))];render(){super.render();let l=this.querySelector("input");this.updateIndicator(l?.value)}}var ex=$4,j7=$4.elementCreator(),lC=j7;var{span:e3}=A;class R4 extends _{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(l){this.readonly=l}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=()=>e3({part:"container"},e3({part:"empty"}),e3({part:"filled"}));displayValue(l){let{empty:i,filled:y}=this.parts,x=Math.round((typeof l==="string"?0:l||0)/this.step)*this.step;y.style.width=x/this.max*i.offsetWidth+"px"}update=(l)=>{if(this.readonly)return;let{empty:i}=this.parts,y=l instanceof MouseEvent?l.pageX-i.getBoundingClientRect().x:0,h=Math.min(Math.max(this.min,Math.round(y/i.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(l.type==="click")this.value=h;else if(l.type==="mousemove")this.displayValue(h);else this.displayValue(this.value||0)};handleKey=(l)=>{let i=this.value===""?NaN:Number(this.value);if(isNaN(i))i=Math.round((this.min+this.max)*0.5*this.step)*this.step;let y=!1;switch(l.key){case"ArrowUp":case"ArrowRight":i+=this.step,y=!0;break;case"ArrowDown":case"ArrowLeft":i-=this.step,y=!0;break}if(this.value=Math.max(Math.min(i,this.max),this.min),y)l.stopPropagation(),l.preventDefault()};connectedCallback(){super.connectedCallback();let{container:l}=this.parts;l.tabIndex=0,l.addEventListener("mousemove",this.update,!0),l.addEventListener("mouseleave",this.update),l.addEventListener("blur",this.update),l.addEventListener("click",this.update),l.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let l=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",l),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:i,filled:y}=this.parts;if(i.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),i.style.setProperty("--tosi-icon-stroke",this.emptyStroke),y.style.setProperty("--tosi-icon-fill",this.ratingFill),y.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let h=0;h<this.max;h++)i.append(V[this.icon]()),y.append(V[this.icon]())}this.displayValue(this.value)}}var iC=R4,q7=R4.elementCreator(),yC=w1((...l)=>q7(...l),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:P7,div:hC,button:xC}=A,CC=[{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 l9(l=CC){return c1({title:"paragraph style",slot:"toolbar",class:"block-style",options:l.map(({caption:i,tagType:y})=>({caption:i,value:`formatBlock,${y}`}))})}var F0=()=>D3({slot:"toolbar"});function Y1(l,i,y){return xC({slot:"toolbar",dataCommand:i,title:l},y)}var kC=()=>[Y1("left-justify","justifyLeft",V.alignLeft()),Y1("center","justifyCenter",V.alignCenter()),Y1("right-justify","justifyRight",V.alignRight()),F0(),Y1("bullet list","insertUnorderedList",V.listBullet()),Y1("numbered list","insertOrderedList",V.listNumber()),F0(),Y1("indent","indent",V.indent()),Y1("indent","outdent",V.outdent())],c7=()=>[Y1("bold","bold",V.fontBold()),Y1("italic","italic",V.fontItalic()),Y1("underline","underline",V.fontUnderline())],gC=()=>[l9(),F0(),...c7()],A7=()=>[l9(),F0(),...kC(),F0(),...c7()];class n4 extends _{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(l){if(this.isInitialized)this.parts.doc.contentEditable=l?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(l){let i=this._value;if(this._value=l,this.isInitialized){if(this.parts.doc.innerHTML!==l)this.parts.doc.innerHTML=l}if(i!==l&&this.internals)this.internals.setFormValue(l)}blockElement(l){let{doc:i}=this.parts;while(l.parentElement!==null&&l.parentElement!==i)l=l.parentElement;return l.parentElement===i?l:void 0}get selectedBlocks(){let{doc:l}=this.parts,i=window.getSelection();if(i===null)return[];let y=[];for(let h=0;h<i.rangeCount;h++){let x=i.getRangeAt(h);if(!l.contains(x.commonAncestorContainer))continue;let C=this.blockElement(x.startContainer),k=this.blockElement(x.endContainer);y.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,y.push(C)}return y}get selectedText(){let l=window.getSelection();if(l===null)return"";return this.selectedBlocks.length?l.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(l)=>{if(this._updatingBlockStyle)return;let y=l.target?.closest(N1.tagName);if(y==null)return;this.doCommand(y.value)};handleButtonClick=(l)=>{let y=l.target?.closest("button");if(y==null)return;this.doCommand(y.dataset.command)};content=[P7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),hC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),P7({part:"content"})];doCommand(l){if(l===void 0)return;let i=l.split(",");console.log("execCommand",i[0],!1,...i.slice(1)),document.execCommand(i[0],!1,...i.slice(1))}updateBlockStyle(){let l=this.parts.toolbar.querySelector(".block-style");if(l===null)return;let i=this.selectedBlocks.map((y)=>y.tagName);i=[...new Set(i)],this._updatingBlockStyle=!0,l.value=i.length===1?`formatBlock,${i[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:l,content:i}=this.parts;if(i.innerHTML!==""&&l.innerHTML==="")l.innerHTML=i.innerHTML,i.innerHTML="";this.isInitialized=!0,i.style.display="none",l.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(y)=>{this.updateBlockStyle(),this.selectionChange(y,this)})}render(){let{toolbar:l}=this.parts;if(super.render(),l.children.length===0)switch(this.widgets){case"minimal":l.append(...gC());break;case"default":l.append(...A7());break}}}var wC=n4,_7=n4.elementCreator(),BC=w1((...l)=>_7(...l),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:W0}=e({router:{path:"",hash:"",pattern:""}}),i9={};function sC(){return{...i9}}var b4=[],y9=!1,J4=new Set;function pC(l){let i=[];if(l==="")return{regex:/^\/?$/,paramNames:i};let y=l.split("/").map((x)=>{if(x.startsWith(":"))return i.push(x.slice(1)),"([^/]+)";return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+y.join("/")+"/?$"),paramNames:i}}function zC(l){let i=l.split("?")[0].split("#")[0];for(let h of b4){if(h.fallback)continue;let x=i.match(h.regex);if(x){let C={};return h.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(x[g+1])}),{route:h,params:C}}}let y=b4.find((h)=>h.fallback);if(y)return{route:y,params:{}};return null}function Q0(){let l=y9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;W0.path.value=l,W0.hash.value=window.location.hash;let i=zC(l);if(i){i9=i.params,W0.pattern.value=i.route.regex.source;let y=new Map;for(let h of i.route.targets)y.set(h.view??"default",h);for(let h of J4){let x=h.name||"default",C=y.get(x);if(C)h.replaceChildren(C.component(i.params));else h.replaceChildren()}}else{i9={},W0.pattern.value="";for(let y of J4)y.replaceChildren()}}var V7=!1;function O7(){if(V7)return;V7=!0,window.addEventListener("popstate",Q0),window.addEventListener("hashchange",Q0)}function oC(l,i={}){y9=i.hashRouting??!1,b4=l.map((y)=>{let{regex:h,paramNames:x}=pC(y.pattern);return{regex:h,paramNames:x,targets:y.targets,fallback:y.fallback??!1}}),O7(),Q0()}function jC(l){if(O7(),y9)window.location.hash="#/"+l.replace(/^\//,"");else window.history.pushState({},"","/"+l.replace(/^\//,""));Q0()}class h9 extends _{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),J4.add(this),b4.length>0)Q0()}disconnectedCallback(){super.disconnectedCallback(),J4.delete(this)}}var qC=h9.elementCreator();var{div:PC,slot:cC,label:AC,span:_C,input:G7}=A;class Z2 extends _{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(l){if(typeof l==="string")this._choices=Z2.parseChoicesString(l);else this._choices=l;this.queueRender()}static parseChoicesString(l){return l.split(",").filter((i)=>i.trim()!=="").map((i)=>{let[y,h]=i.split("=").map((g)=>g.trim()),[x,C]=(h||y).split(":").map((g)=>g.trim()),k=C?V[C]():"";return{value:y,icon:k,caption:x}})}value="";formDisabledCallback(l){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((l)=>l.trim()).filter((l)=>l!=="")}content=()=>[cC(),PC({part:"options"},G7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:j.segmentedOptionGap("8px"),alignItems:j.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:j.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:j.segmentedOptionGap("8px"),gridTemplateColumns:j.segmentedOptionGridColumns("0px 24px 1fr"),padding:j.segmentedOptionPadding("4px 12px"),font:j.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:j.segmentedFocusShadow(`inset 0 0 0 2px ${j.segmentedOptionCurrentBackground("#44a")}`),borderRadius:j.segmentedOptionsBorderRadius("8px")},":host label.current":{color:j.segmentedOptionCurrentColor("#eee"),background:j.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:j.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${j.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:j.segmentOptionIconSize("16px"),stroke:j.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:j.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:j.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:j.segmentedOptionsBorderRadius("8px"),background:j.segmentedOptionsBackground("#fff"),color:j.segmentedOptionColor("#222"),overflow:"hidden",alignItems:j.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:j.segmentedOptionPadding("4px 12px"),color:j.segmentedOptionCurrentColor("#eee"),background:j.segmentedOptionCurrentBackground("#44a"),font:j.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:j.segmentedOptionCurrentColor("#eee"),opacity:j.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:l}=this.parts;l.querySelectorAll("label").forEach((i)=>{let y=i.querySelector("input");i.classList.toggle("current",Boolean(y&&y.checked))})}valueChanged=!1;handleChange=()=>{let{options:l,custom:i}=this.parts;if(this.multiple){let y=[...l.querySelectorAll("input:checked")];this.value=y.map((h)=>h.value).join(",")}else{let y=l.querySelector("input:checked");if(!y)this.value="";else if(y.value)i.setAttribute("hidden",""),this.value=y.value;else i.removeAttribute("hidden"),i.focus(),i.select(),this.value=i.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(l)=>{let i=!1;switch(l.code){case"Space":if(l.target instanceof HTMLLabelElement)l.target.click(),i=!0;break;case"Tab":if(!(l.target instanceof HTMLLabelElement))l.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let y=l.target.closest("label");if(y.previousElementSibling instanceof HTMLLabelElement)y.previousElementSibling.focus()}i=!0;break;case"ArrowRight":case"ArrowDown":{let y=l.target.closest("label");if(y.nextElementSibling instanceof HTMLLabelElement)y.nextElementSibling.focus()}i=!0;break}if(i)l.preventDefault(),l.stopPropagation()};connectedCallback(){super.connectedCallback();let l=this.getAttribute("choices");if(l&&this._choices.length===0)this._choices=Z2.parseChoicesString(l);let{options:i}=this.parts;if(this.name==="")this.name=this.instanceId;if(i.addEventListener("change",this.handleChange),i.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 l=[...this.choices];if(this.other&&!this.multiple){let[i,y]=this.other.split(":");l.push({value:"",caption:i,icon:y})}return l}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((l)=>l.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:l,custom:i}=this.parts;l.textContent="";let y=this.multiple?"checkbox":"radio",{values:h,isOtherValue:x}=this;if(l.append(...this._choicesWithOther.map((C)=>{return AC({tabindex:0},G7({type:y,name:this.name,value:C.value,checked:h.includes(C.value)||C.value===""&&x,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?G1(C.caption):_C(C.caption))})),this.other&&!this.multiple)i.hidden=!x,i.value=x?this.value:"",i.placeholder=this.placeholder,l.append(i);this.syncCurrent()}}var VC=Z2,v7=Z2.elementCreator(),OC=w1((...l)=>v7(...l),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:K7}=A;class x9 extends _{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[K7({part:"normal"}),K7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:l,small:i}=this.parts,y=this.offsetParent;if(!(y instanceof HTMLElement))return;else if(y.offsetWidth<this.minWidth||y.offsetHeight<this.minHeight)l.hidden=!0,i.hidden=!1,this.value="small";else l.hidden=!1,i.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var GC=x9.elementCreator();class H4 extends _{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:s.resizeIconFill}};content=V.resize();get minSize(){let{minWidth:l,minHeight:i}=getComputedStyle(this.target);return{width:parseFloat(l)||32,height:parseFloat(i)||32}}resizeTarget=(l)=>{let{target:i}=this;if(!i)return;let{offsetWidth:y,offsetHeight:h}=i;i.style.left=i.offsetLeft+"px",i.style.top=i.offsetTop+"px",i.style.bottom="",i.style.right="";let{minSize:x}=this;o1(l,(C,k,g)=>{if(i.style.width=Math.max(x.width,y+C)+"px",i.style.height=Math.max(x.height,h+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let l={passive:!0};this.addEventListener("mousedown",this.resizeTarget,l),this.addEventListener("touchstart",this.resizeTarget,l)}}var vC=H4,U7=H4.elementCreator(),KC=U7;var{div:UC,input:FC,span:WC,button:C9}=A,F7=(l)=>l.split(/(?<!\\),/).map((i)=>i.trim().replace(/\\,/g,",")),QC=(l)=>l.map((i)=>i.replace(/,/g,"\\,")).join(",");class Y0 extends _{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":j.brandColor("blue"),"--tag-text-color":j.brandTextColor("white"),display:"inline-flex",borderRadius:j.tagRoundedRadius(s.spacing50),color:s.tagTextColor,background:s.tagBg,padding:`0 ${s.spacing75} 0 ${s.spacing75}`,height:`calc(${s.lineHeight} + ${s.spacing50})`,lineHeight:`calc(${s.lineHeight} + ${s.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:j.fontSize("16px"),color:s.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${s.spacing_50} 0 ${s.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:s.spacing150,width:s.spacing150,color:s.tagCloseButtonColor,background:s.tagCloseButtonBg,borderRadius:j.tagCloseButtonRadius("99px"),opacity:s.tagButtonOpacity},':host [part="remove"]:hover':{background:s.tagCloseButtonBg,opacity:s.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[WC({part:"caption"},this.caption),C9(V.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var YC=Y0,k9=Y0.elementCreator(),dC=w1((...l)=>k9(...l),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends _{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:s.tagListBg,gap:s.spacing25,borderRadius:j.taglistRoundedRadius(s.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${s.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${s.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:s.inputBg,borderRadius:j.tagContainerRadius(s.spacing50),boxShadow:s.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:s.spacing25,minHeight:`calc(${s.lineHeight} + ${s.spacing})`,padding:s.spacing25},':host [part="tagMenu"]':{width:s.touchSize,height:s.touchSize,lineHeight:s.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:s.brandColor,color:s.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return F7(this.value).filter((l)=>l!=="")}set tags(l){this.value=QC(l)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(l){if(typeof l==="string")this._availableTags=f2.parseAvailableTagsString(l);else this._availableTags=l;this.queueRender()}static parseAvailableTagsString(l){return F7(l).map((i)=>i===""?null:i)}connectedCallback(){super.connectedCallback();let l=this.getAttribute("available-tags");if(l&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(l)}formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value=""}addTag=(l)=>{let i=l.trim();if(i===""||this.tags.includes(i))return;this.tags=[...this.tags,i],this.queueRender(!0)};toggleTag=(l)=>{if(this.tags.includes(l))this.tags=this.tags.filter((i)=>i!==l),this.queueRender(!0);else this.addTag(l)};enterTag=(l)=>{let{tagInput:i}=this.parts;switch(l.key){case",":{let y=i.value.split(",")[0];this.addTag(y)}break;case"Enter":{let y=i.value.split(",")[0];this.addTag(y)}l.stopPropagation(),l.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:l}=this,{tagMenu:i}=this.parts,y=[...this.availableTags],h=this.tags.filter((C)=>!y.includes(C));if(h.length)y.push(null,...h);let x=y.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){l(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){l(C)}}});T({target:i,width:"auto",menuItems:x})};content=()=>[C9({type:"button",style:{visibility:"hidden"},tabindex:-1}),UC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),FC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),C9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},V.chevronDown())];removeTag=(l)=>{if(this.editable&&!this.disabled){let i=l.target.closest(Y0.tagName);this.tags=this.tags.filter((y)=>y!==i.caption),i.remove(),this.queueRender(!0)}l.stopPropagation(),l.preventDefault()};render(){super.render();let{tagContainer:l,tagMenu:i,tagInput:y}=this.parts;if(i.disabled=this.disabled,y.value="",y.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)i.toggleAttribute("hidden",!1),y.toggleAttribute("hidden",!this.textEntry);else i.toggleAttribute("hidden",!0),y.toggleAttribute("hidden",!0);l.textContent="";for(let h of this.tags)l.append(k9({caption:h,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var rC=f2,W7=f2.elementCreator(),XC=w1((...l)=>W7(...l),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var Q7="1.6.10";var{span:NC}=A,d0=null,D4=null,S4=null,n1="tosi-tooltip";O1("tosi-tooltip",{[`.${n1}`]:{pointerEvents:"none",padding:j.tosiTooltipPadding("4px 10px"),borderRadius:j.tosiTooltipRadius("6px"),background:j.tosiTooltipBg("#333"),color:j.tosiTooltipColor("#fff"),fontSize:j.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:j.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${n1} p`]:{margin:"0"},[`.${n1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${n1} a`]:{color:"inherit"},[`.${n1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${n1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}});function $2(){if(D4!==null)clearTimeout(D4),D4=null;if(d0!==null)d0.remove(),d0=null;S4=null}function ZC(l){if(l.startsWith("s"))return"tt-s";if(l.startsWith("n"))return"tt-n";if(l.startsWith("e"))return"tt-e";if(l.startsWith("w"))return"tt-w";return"tt-s"}function fC(l,i,y){let h=i.getBoundingClientRect(),x=l.getBoundingClientRect(),C=h.left+h.width*0.5,k=h.top+h.height*0.5,g;if(y.startsWith("s")||y.startsWith("n"))g=Math.max(8,Math.min(x.width-8,C-x.left))-4;else g=Math.max(8,Math.min(x.height-8,k-x.top))-4;l.style.setProperty("--tosi-tooltip-arrow",g+"px")}function $C(l,i){if(i)l=R(l);let y=NC({class:n1});return y.innerHTML=r.parseInline(l),y}function RC(l,i,y){$2(),S4=l;let{top:h,left:x,width:C}=l.getBoundingClientRect(),k=x+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(h>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),p=$C(i,y);p.classList.add(ZC(B)),d0=h0({content:p,target:l,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(d0&&S4)fC(p,l,B)})}function nC(l){for(let i of l.composedPath())if(i instanceof HTMLElement&&i.dataset.tooltip)return i;return null}function bC(l={}){let{convertTitles:i=!0,delay:y=250,localize:h=!1}=l;document.addEventListener("pointermove",(x)=>{if(i){for(let g of x.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=nC(x);if(C===S4)return;if($2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;D4=setTimeout(()=>RC(C,k,h),y)}),document.addEventListener("pointerleave",$2),document.addEventListener("pointerdown",$2),document.addEventListener("keydown",$2),window.addEventListener("scroll",$2,!0)}Object.assign(globalThis,{xinjs:e2,xinjsui:g9});})();
|
|
109
|
+
`+h;else y.push(h)}return y},[]);this.innerHTML=i.map((y)=>y.startsWith("<")&&y.endsWith(">")?y:r(y,this.options)).join("")}else this.innerHTML=r(l,this.options);this.didRender()}}var Hx=Z4,T3=Z4.elementCreator(),Dx=T3,Sx=T3;var{div:L3,span:f4,button:M3}=A,K0=86400000,Ix=[0,1,2,3,4,5,6],Tx=[1,2,3,4,5,6,7,8,9,10,11,12],t3=(l,i=2,y="0")=>String(l).padStart(i,y),U0=(l,i,y)=>new Date(`${l}-${t3(i)}-${t3(y)}`);class a3 extends _{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:j.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:j.monthTodayBackground("transparent"),boxShadow:j.monthTodayShadow("none"),backdropFilter:j.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:j.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:j.monthDayColor("hotpink"),background:j.monthDayBackground("white"),fontWeight:j.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:j.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:j.monthDateCheckedColor("white"),background:j.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:j.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:j.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:j.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:j.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:j.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:U0(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:U0(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(l){this.disabled=l}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return Tx.map((l)=>({caption:U0(2025,l,1).toString().split(" ")[1],value:String(l)}))}get years(){let l=Number(this.minDate.split("-")[0]),i=Number(this.maxDate.split("-")[0]),y=[];for(let h=l;h<=i;h++)y.push(String(h));return y}monthChanged=(l,i)=>{};gotoMonth(l,i){if(this.month!==i||this.year!==l)this.month=i,this.year=l,this.monthChanged(l,i)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(l){this.selectedDays[1]=l,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(l){this.selectedDays[0]=l,this.selectedDays.splice(2)}clickDate=(l)=>{let i=l.target.getAttribute("title");this.selectDate(i)};keyDate=(l)=>{let i=!1;switch(l.code){case"Space":{let y=l.target.getAttribute("title");this.selectDate(y),i=!0;break}case"Tab":break;default:console.log(l)}if(i)l.preventDefault(),l.stopPropagation()};#l="";selectDate=(l)=>{if(this.#l=l,this.range){if(!this.to)this.selectedDays=[l,l];else if(this.from===l&&this.to===l)this.selectedDays=[];else if(this.from===l)this.from=this.to;else if(this.to===l)this.to=this.from;else if(l<this.from)this.from=l;else if(l>this.to)this.to=l;else this.to=l;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(l))this.selectedDays.splice(this.selectedDays.indexOf(l),1);else this.selectedDays.push(l),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(l))this.value="",this.selectedDays=[];else this.value=l,this.selectedDays=[l]};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=(l)=>{if(!this.range)return this.selectedDays.includes(l);else if(this.range)return this.from&&l>=this.from&&l<=this.to;return!1};dateMenuItem=(l,i="")=>{return l=l.split("T")[0],{caption:i||l,enabled:()=>!l.startsWith(`${this.year}-${t3(this.month)}-`),action:()=>{this.gotoDate(l)}}};jumpMenu=()=>{T({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((l)=>this.dateMenuItem(l))]})};content=()=>[L3({part:"header"},M3({part:"previous",onClick:this.previousMonth},V.chevronLeft()),f4({style:{flex:"1"}}),M3({part:"jump",onClick:this.jumpMenu},V.calendar()),c1({part:"month",options:this.months,onChange:this.setMonth}),c1({part:"year",options:[this.year],onChange:this.setMonth}),f4({style:{flex:"1"}}),M3({part:"next",onClick:this.nextMonth},V.chevronRight())),L3({part:"week"}),L3({part:"days"})];gotoDate(l){let i=new Date(l);this.gotoMonth(i.getFullYear(),i.getMonth()+1)}connectedCallback(){super.connectedCallback();let l=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=l.getMonth()+1;if(isNaN(this.year))this.year=l.getFullYear()}days=[];render(){super.render();let{week:l,days:i,jump:y,month:h,year:x,previous:C,next:k}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let g=U0(this.year,this.month,1),w=new Date(g.valueOf()-(7+g.getDay()-this.weekStart)%7*K0),B=this.month===12?1:this.month+1,p=new Date(U0(this.year+(this.month===12?1:0),B,1).valueOf()-K0),z=new Date(p.valueOf()+(this.weekStart*2+5+this.endDay-p.getDay())%7*K0),q=Ix.map((U)=>new Date(w.valueOf()+U*K0).toString().split(" ")[0]);this.days=[];let O=new Date().toISOString().split("T")[0];for(let U=w.valueOf();U<=z.valueOf();U+=K0){let X=new Date(U),N=X.toISOString().split("T")[0];this.days.push({date:X,selected:!1,inMonth:X.getMonth()+1===this.month,isToday:N===O,isWeekend:X.getDay()%6===0,inRange:!!(this.from&&N>=this.from&&N<=this.to)})}h.value=String(this.month),x.value=String(this.year),h.disabled=x.disabled=y.disabled=C.disabled=k.disabled=this.disabled||this.readonly,x.options=this.years,l.textContent="",l.append(...q.map((U)=>f4({class:"day"},U))),i.textContent="";let c=null,{to:K,from:F}=this;i.append(...this.days.map((U)=>{let X=["date"];if(U.inMonth)X.push("in-month");if(U.isToday)X.push("today");let N=U.date.toISOString().split("T")[0];if(this.checkDay(N))X.push("checked");if(X.push(U.isWeekend?"weekend":"weekday"),this.range){if(K===N)X.push("range-end");if(F===N)X.push("range-start")}let D=f4({class:X.join(" "),title:N,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},U.date.getDate());if(N===this.#l)c=D;return D})),c?.focus()}}var Lx=a3.elementCreator();var{div:u3,button:Mx}=A,tx={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class i2 extends _{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${s.notificationSpacing} ${s.notificationSpacing50} ${s.notificationSpacing} ${s.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:s.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:s.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:s.notificationSpacing,width:s.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:s.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:s.notificationTextColor},":host .note":{display:"grid",background:s.notificationBg,padding:s.notificationPadding,gridTemplateColumns:`${s.notificationIconSize} 1fr ${s.notificationButtonSize}`,gap:s.notificationSpacing,alignItems:"center",borderRadius:s.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${s.notificationAccentColor}`,borderColor:s.notificationAccentColor,borderWidth:s.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:s.notificationButtonSize,padding:0,margin:0,height:s.notificationButtonSize,width:s.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:s.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:s.notificationBg,background:s.notificationAccentColor,padding:s.spacing50},":host .note svg":{height:s.notificationIconSize,width:s.notificationIconSize,pointerEvents:"none",color:s.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:s.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(l){l.classList.add("closing"),l.style.marginBottom=-l.offsetHeight+"px";let i=()=>{l.remove()};l.addEventListener("transitionend",i),setTimeout(i,1000)}static post(l){let{message:i,duration:y,type:h,close:x,progress:C,icon:k,color:g}=Object.assign({type:"info",duration:-1},typeof l==="string"?{message:l}:l);if(!this.singleton)this.singleton=m3();let w=this.singleton;document.body.append(w),w.style.zIndex=String(g2()+1);let B=g||tx[h],p=C||h==="progress"?A.progress():{},z=()=>{if(x)x();i2.removeNote(c)},q=k instanceof SVGElement?k:k?V[k]():V.info(),O=h==="error"||h==="warn",c=u3({class:`note ${h}`,role:O?"alert":"status",ariaLive:O?"assertive":"polite",style:{_notificationAccentColor:B}},q,u3({class:"message"},u3(i),p),Mx({class:"close",title:"close",ariaLabel:"Close notification",apply(K){K.addEventListener("click",z)}},V.x()));if(w.shadowRoot.append(c),p instanceof HTMLProgressElement&&C instanceof Function){p.setAttribute("max",String(100)),p.value=C();let K=setInterval(()=>{if(!w.shadowRoot.contains(c)){clearInterval(K);return}let F=C();if(p.value=F,F>=100)i2.removeNote(c)},1000)}if(y>0)setTimeout(()=>{i2.removeNote(c)},y*1000);return c.scrollIntoView(),z}content=null}var ax=i2,m3=i2.elementCreator(),ux=m3;function mx(l){return i2.post(l)}var z7=async(l,i="SHA-1")=>{let h=new TextEncoder().encode(l),x=await crypto.subtle.digest(i,h);return Array.from(new Uint8Array(x)).map((g)=>g.toString(16).padStart(2,"0")).join("")},o7=async(l)=>{let i=await z7(l),y=await fetch(`https://weakpass.com/api/v1/search/${i}`);if(y.ok){let h=await y.json();console.log("password found in weakpass database",h)}return y.status!==404},{span:E3,tosiSlot:Ex}=A;class $4 extends _{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:s.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:j.meterHeight("24px"),background:j.indicatorBg("white"),borderRadius:j.meterRadius("4px"),boxShadow:j.meterShadow(`inset 0 0 0 2px ${s.indicatorColor}`)},':host [part="level"]':{height:j.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:s.indicatorColor,margin:j.levelMargin("2px"),borderRadius:j.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:s.descriptionColor,height:j.meterHeight("24px"),lineHeight:j.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(l){return this.issues={tooShort:l.length<this.minLength,short:l.length<this.goodLength,noUpper:!l.match(/[A-Z]/),noLower:!l.match(/[a-z]/),noNumber:!l.match(/[0-9]/),noSpecial:!l.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((i)=>!i).length-1}async isBreached(){let l=this.querySelector("input")?.value;if(!l||typeof l!=="string")return!0;return await o7(l)}updateIndicator=(l)=>{let{level:i,description:y}=this.parts,h=this.indicatorColors.split(","),x=this.descriptionColors.split(","),C=this.strength(l);if(this.value!==C)this.value=C,this.dispatchEvent(new Event("change"));i.style.width=`${(C+1)*16.67}%`,this.style.setProperty("--indicator-color",h[C]),this.style.setProperty("--description-color",x[C]),y.textContent=this.strengthDescriptions[C]};update=(l)=>{let i=l.target.closest("input");this.updateIndicator(i?.value||"")};content=()=>[Ex({onInput:this.update}),E3({part:"meter"},E3({part:"level"}),E3({part:"description"}))];render(){super.render();let l=this.querySelector("input");this.updateIndicator(l?.value)}}var ex=$4,j7=$4.elementCreator(),lC=j7;var{span:e3}=A;class R4 extends _{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(l){this.readonly=l}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=()=>e3({part:"container"},e3({part:"empty"}),e3({part:"filled"}));displayValue(l){let{empty:i,filled:y}=this.parts,x=Math.round((typeof l==="string"?0:l||0)/this.step)*this.step;y.style.width=x/this.max*i.offsetWidth+"px"}update=(l)=>{if(this.readonly)return;let{empty:i}=this.parts,y=l instanceof MouseEvent?l.pageX-i.getBoundingClientRect().x:0,h=Math.min(Math.max(this.min,Math.round(y/i.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(l.type==="click")this.value=h;else if(l.type==="mousemove")this.displayValue(h);else this.displayValue(this.value||0)};handleKey=(l)=>{let i=this.value===""?NaN:Number(this.value);if(isNaN(i))i=Math.round((this.min+this.max)*0.5*this.step)*this.step;let y=!1;switch(l.key){case"ArrowUp":case"ArrowRight":i+=this.step,y=!0;break;case"ArrowDown":case"ArrowLeft":i-=this.step,y=!0;break}if(this.value=Math.max(Math.min(i,this.max),this.min),y)l.stopPropagation(),l.preventDefault()};connectedCallback(){super.connectedCallback();let{container:l}=this.parts;l.tabIndex=0,l.addEventListener("mousemove",this.update,!0),l.addEventListener("mouseleave",this.update),l.addEventListener("blur",this.update),l.addEventListener("click",this.update),l.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let l=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",l),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:i,filled:y}=this.parts;if(i.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),i.style.setProperty("--tosi-icon-stroke",this.emptyStroke),y.style.setProperty("--tosi-icon-fill",this.ratingFill),y.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let h=0;h<this.max;h++)i.append(V[this.icon]()),y.append(V[this.icon]())}this.displayValue(this.value)}}var iC=R4,q7=R4.elementCreator(),yC=w1((...l)=>q7(...l),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:P7,div:hC,button:xC}=A,CC=[{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 l9(l=CC){return c1({title:"paragraph style",slot:"toolbar",class:"block-style",options:l.map(({caption:i,tagType:y})=>({caption:i,value:`formatBlock,${y}`}))})}var F0=()=>D3({slot:"toolbar"});function Y1(l,i,y){return xC({slot:"toolbar",dataCommand:i,title:l},y)}var kC=()=>[Y1("left-justify","justifyLeft",V.alignLeft()),Y1("center","justifyCenter",V.alignCenter()),Y1("right-justify","justifyRight",V.alignRight()),F0(),Y1("bullet list","insertUnorderedList",V.listBullet()),Y1("numbered list","insertOrderedList",V.listNumber()),F0(),Y1("indent","indent",V.indent()),Y1("indent","outdent",V.outdent())],c7=()=>[Y1("bold","bold",V.fontBold()),Y1("italic","italic",V.fontItalic()),Y1("underline","underline",V.fontUnderline())],gC=()=>[l9(),F0(),...c7()],A7=()=>[l9(),F0(),...kC(),F0(),...c7()];class n4 extends _{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(l){if(this.isInitialized)this.parts.doc.contentEditable=l?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(l){let i=this._value;if(this._value=l,this.isInitialized){if(this.parts.doc.innerHTML!==l)this.parts.doc.innerHTML=l}if(i!==l&&this.internals)this.internals.setFormValue(l)}blockElement(l){let{doc:i}=this.parts;while(l.parentElement!==null&&l.parentElement!==i)l=l.parentElement;return l.parentElement===i?l:void 0}get selectedBlocks(){let{doc:l}=this.parts,i=window.getSelection();if(i===null)return[];let y=[];for(let h=0;h<i.rangeCount;h++){let x=i.getRangeAt(h);if(!l.contains(x.commonAncestorContainer))continue;let C=this.blockElement(x.startContainer),k=this.blockElement(x.endContainer);y.push(C);while(C!==k&&C!==null)C=C.nextElementSibling,y.push(C)}return y}get selectedText(){let l=window.getSelection();if(l===null)return"";return this.selectedBlocks.length?l.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(l)=>{if(this._updatingBlockStyle)return;let y=l.target?.closest(N1.tagName);if(y==null)return;this.doCommand(y.value)};handleButtonClick=(l)=>{let y=l.target?.closest("button");if(y==null)return;this.doCommand(y.dataset.command)};content=[P7({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),hC({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),P7({part:"content"})];doCommand(l){if(l===void 0)return;let i=l.split(",");console.log("execCommand",i[0],!1,...i.slice(1)),document.execCommand(i[0],!1,...i.slice(1))}updateBlockStyle(){let l=this.parts.toolbar.querySelector(".block-style");if(l===null)return;let i=this.selectedBlocks.map((y)=>y.tagName);i=[...new Set(i)],this._updatingBlockStyle=!0,l.value=i.length===1?`formatBlock,${i[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:l,content:i}=this.parts;if(i.innerHTML!==""&&l.innerHTML==="")l.innerHTML=i.innerHTML,i.innerHTML="";this.isInitialized=!0,i.style.display="none",l.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(y)=>{this.updateBlockStyle(),this.selectionChange(y,this)})}render(){let{toolbar:l}=this.parts;if(super.render(),l.children.length===0)switch(this.widgets){case"minimal":l.append(...gC());break;case"default":l.append(...A7());break}}}var wC=n4,_7=n4.elementCreator(),BC=w1((...l)=>_7(...l),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:W0}=e({router:{path:"",hash:"",pattern:""}}),i9={};function sC(){return{...i9}}var b4=[],y9=!1,J4=new Set;function pC(l){let i=[];if(l==="")return{regex:/^\/?$/,paramNames:i};let y=l.split("/").map((x)=>{if(x.startsWith(":"))return i.push(x.slice(1)),"([^/]+)";return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+y.join("/")+"/?$"),paramNames:i}}function zC(l){let i=l.split("?")[0].split("#")[0];for(let h of b4){if(h.fallback)continue;let x=i.match(h.regex);if(x){let C={};return h.paramNames.forEach((k,g)=>{C[k]=decodeURIComponent(x[g+1])}),{route:h,params:C}}}let y=b4.find((h)=>h.fallback);if(y)return{route:y,params:{}};return null}function Q0(){let l=y9?window.location.hash.replace(/^#\/?/,""):window.location.pathname;W0.path.value=l,W0.hash.value=window.location.hash;let i=zC(l);if(i){i9=i.params,W0.pattern.value=i.route.regex.source;let y=new Map;for(let h of i.route.targets)y.set(h.view??"default",h);for(let h of J4){let x=h.name||"default",C=y.get(x);if(C)h.replaceChildren(C.component(i.params));else h.replaceChildren()}}else{i9={},W0.pattern.value="";for(let y of J4)y.replaceChildren()}}var V7=!1;function O7(){if(V7)return;V7=!0,window.addEventListener("popstate",Q0),window.addEventListener("hashchange",Q0)}function oC(l,i={}){y9=i.hashRouting??!1,b4=l.map((y)=>{let{regex:h,paramNames:x}=pC(y.pattern);return{regex:h,paramNames:x,targets:y.targets,fallback:y.fallback??!1}}),O7(),Q0()}function jC(l){if(O7(),y9)window.location.hash="#/"+l.replace(/^\//,"");else window.history.pushState({},"","/"+l.replace(/^\//,""));Q0()}class h9 extends _{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),J4.add(this),b4.length>0)Q0()}disconnectedCallback(){super.disconnectedCallback(),J4.delete(this)}}var qC=h9.elementCreator();var{div:PC,slot:cC,label:AC,span:_C,input:G7}=A;class Z2 extends _{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(l){if(typeof l==="string")this._choices=Z2.parseChoicesString(l);else this._choices=l;this.queueRender()}static parseChoicesString(l){return l.split(",").filter((i)=>i.trim()!=="").map((i)=>{let[y,h]=i.split("=").map((g)=>g.trim()),[x,C]=(h||y).split(":").map((g)=>g.trim()),k=C?V[C]():"";return{value:y,icon:k,caption:x}})}value="";formDisabledCallback(l){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((l)=>l.trim()).filter((l)=>l!=="")}content=()=>[cC(),PC({part:"options"},G7({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:j.segmentedOptionGap("8px"),alignItems:j.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:j.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:j.segmentedOptionGap("8px"),gridTemplateColumns:j.segmentedOptionGridColumns("0px 24px 1fr"),padding:j.segmentedOptionPadding("4px 12px"),font:j.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:j.segmentedFocusShadow(`inset 0 0 0 2px ${j.segmentedOptionCurrentBackground("#44a")}`),borderRadius:j.segmentedOptionsBorderRadius("8px")},":host label.current":{color:j.segmentedOptionCurrentColor("#eee"),background:j.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:j.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${j.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:j.segmentOptionIconSize("16px"),stroke:j.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:j.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:j.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:j.segmentedOptionsBorderRadius("8px"),background:j.segmentedOptionsBackground("#fff"),color:j.segmentedOptionColor("#222"),overflow:"hidden",alignItems:j.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:j.segmentedOptionPadding("4px 12px"),color:j.segmentedOptionCurrentColor("#eee"),background:j.segmentedOptionCurrentBackground("#44a"),font:j.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:j.segmentedOptionCurrentColor("#eee"),opacity:j.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:l}=this.parts;l.querySelectorAll("label").forEach((i)=>{let y=i.querySelector("input");i.classList.toggle("current",Boolean(y&&y.checked))})}valueChanged=!1;handleChange=()=>{let{options:l,custom:i}=this.parts;if(this.multiple){let y=[...l.querySelectorAll("input:checked")];this.value=y.map((h)=>h.value).join(",")}else{let y=l.querySelector("input:checked");if(!y)this.value="";else if(y.value)i.setAttribute("hidden",""),this.value=y.value;else i.removeAttribute("hidden"),i.focus(),i.select(),this.value=i.value}this.syncCurrent(),this.valueChanged=!0};handleKey=(l)=>{let i=!1;switch(l.code){case"Space":if(l.target instanceof HTMLLabelElement)l.target.click(),i=!0;break;case"Tab":if(!(l.target instanceof HTMLLabelElement))l.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let y=l.target.closest("label");if(y.previousElementSibling instanceof HTMLLabelElement)y.previousElementSibling.focus()}i=!0;break;case"ArrowRight":case"ArrowDown":{let y=l.target.closest("label");if(y.nextElementSibling instanceof HTMLLabelElement)y.nextElementSibling.focus()}i=!0;break}if(i)l.preventDefault(),l.stopPropagation()};connectedCallback(){super.connectedCallback();let l=this.getAttribute("choices");if(l&&this._choices.length===0)this._choices=Z2.parseChoicesString(l);let{options:i}=this.parts;if(this.name==="")this.name=this.instanceId;if(i.addEventListener("change",this.handleChange),i.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 l=[...this.choices];if(this.other&&!this.multiple){let[i,y]=this.other.split(":");l.push({value:"",caption:i,icon:y})}return l}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((l)=>l.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:l,custom:i}=this.parts;l.textContent="";let y=this.multiple?"checkbox":"radio",{values:h,isOtherValue:x}=this;if(l.append(...this._choicesWithOther.map((C)=>{return AC({tabindex:0},G7({type:y,name:this.name,value:C.value,checked:h.includes(C.value)||C.value===""&&x,tabIndex:-1}),C.icon||{class:"no-icon"},this.localized?G1(C.caption):_C(C.caption))})),this.other&&!this.multiple)i.hidden=!x,i.value=x?this.value:"",i.placeholder=this.placeholder,l.append(i);this.syncCurrent()}}var VC=Z2,v7=Z2.elementCreator(),OC=w1((...l)=>v7(...l),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:K7}=A;class x9 extends _{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[K7({part:"normal"}),K7({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:l,small:i}=this.parts,y=this.offsetParent;if(!(y instanceof HTMLElement))return;else if(y.offsetWidth<this.minWidth||y.offsetHeight<this.minHeight)l.hidden=!0,i.hidden=!1,this.value="small";else l.hidden=!1,i.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var GC=x9.elementCreator();class H4 extends _{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:s.resizeIconFill}};content=V.resize();get minSize(){let{minWidth:l,minHeight:i}=getComputedStyle(this.target);return{width:parseFloat(l)||32,height:parseFloat(i)||32}}resizeTarget=(l)=>{let{target:i}=this;if(!i)return;let{offsetWidth:y,offsetHeight:h}=i;i.style.left=i.offsetLeft+"px",i.style.top=i.offsetTop+"px",i.style.bottom="",i.style.right="";let{minSize:x}=this;o1(l,(C,k,g)=>{if(i.style.width=Math.max(x.width,y+C)+"px",i.style.height=Math.max(x.height,h+k)+"px",g.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let l={passive:!0};this.addEventListener("mousedown",this.resizeTarget,l),this.addEventListener("touchstart",this.resizeTarget,l)}}var vC=H4,U7=H4.elementCreator(),KC=U7;var{div:UC,input:FC,span:WC,button:C9}=A,F7=(l)=>l.split(/(?<!\\),/).map((i)=>i.trim().replace(/\\,/g,",")),QC=(l)=>l.map((i)=>i.replace(/,/g,"\\,")).join(",");class Y0 extends _{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":j.brandColor("blue"),"--tag-text-color":j.brandTextColor("white"),display:"inline-flex",borderRadius:j.tagRoundedRadius(s.spacing50),color:s.tagTextColor,background:s.tagBg,padding:`0 ${s.spacing75} 0 ${s.spacing75}`,height:`calc(${s.lineHeight} + ${s.spacing50})`,lineHeight:`calc(${s.lineHeight} + ${s.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:j.fontSize("16px"),color:s.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${s.spacing_50} 0 ${s.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:s.spacing150,width:s.spacing150,color:s.tagCloseButtonColor,background:s.tagCloseButtonBg,borderRadius:j.tagCloseButtonRadius("99px"),opacity:s.tagButtonOpacity},':host [part="remove"]:hover':{background:s.tagCloseButtonBg,opacity:s.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[WC({part:"caption"},this.caption),C9(V.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var YC=Y0,k9=Y0.elementCreator(),dC=w1((...l)=>k9(...l),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class f2 extends _{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:s.tagListBg,gap:s.spacing25,borderRadius:j.taglistRoundedRadius(s.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${s.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${s.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:s.inputBg,borderRadius:j.tagContainerRadius(s.spacing50),boxShadow:s.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:s.spacing25,minHeight:`calc(${s.lineHeight} + ${s.spacing})`,padding:s.spacing25},':host [part="tagMenu"]':{width:s.touchSize,height:s.touchSize,lineHeight:s.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:s.brandColor,color:s.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return F7(this.value).filter((l)=>l!=="")}set tags(l){this.value=QC(l)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(l){if(typeof l==="string")this._availableTags=f2.parseAvailableTagsString(l);else this._availableTags=l;this.queueRender()}static parseAvailableTagsString(l){return F7(l).map((i)=>i===""?null:i)}connectedCallback(){super.connectedCallback();let l=this.getAttribute("available-tags");if(l&&this._availableTags.length===0)this._availableTags=f2.parseAvailableTagsString(l)}formDisabledCallback(l){this.disabled=l}formResetCallback(){this.value=""}addTag=(l)=>{let i=l.trim();if(i===""||this.tags.includes(i))return;this.tags=[...this.tags,i],this.queueRender(!0)};toggleTag=(l)=>{if(this.tags.includes(l))this.tags=this.tags.filter((i)=>i!==l),this.queueRender(!0);else this.addTag(l)};enterTag=(l)=>{let{tagInput:i}=this.parts;switch(l.key){case",":{let y=i.value.split(",")[0];this.addTag(y)}break;case"Enter":{let y=i.value.split(",")[0];this.addTag(y)}l.stopPropagation(),l.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:l}=this,{tagMenu:i}=this.parts,y=[...this.availableTags],h=this.tags.filter((C)=>!y.includes(C));if(h.length)y.push(null,...h);let x=y.map((C)=>{if(C===""||C===null)return null;else if(typeof C==="object")return{checked:()=>this.tags.includes(C.value),caption:C.caption,action(){l(C.value)}};else return{checked:()=>this.tags.includes(C),caption:C,action(){l(C)}}});T({target:i,width:"auto",menuItems:x})};content=()=>[C9({type:"button",style:{visibility:"hidden"},tabindex:-1}),UC({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),FC({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),C9({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},V.chevronDown())];removeTag=(l)=>{if(this.editable&&!this.disabled){let i=l.target.closest(Y0.tagName);this.tags=this.tags.filter((y)=>y!==i.caption),i.remove(),this.queueRender(!0)}l.stopPropagation(),l.preventDefault()};render(){super.render();let{tagContainer:l,tagMenu:i,tagInput:y}=this.parts;if(i.disabled=this.disabled,y.value="",y.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)i.toggleAttribute("hidden",!1),y.toggleAttribute("hidden",!this.textEntry);else i.toggleAttribute("hidden",!0),y.toggleAttribute("hidden",!0);l.textContent="";for(let h of this.tags)l.append(k9({caption:h,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var rC=f2,W7=f2.elementCreator(),XC=w1((...l)=>W7(...l),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var Q7="1.6.11";var{span:NC}=A,d0=null,D4=null,S4=null,n1="tosi-tooltip";O1("tosi-tooltip",{[`.${n1}`]:{pointerEvents:"none",padding:j.tosiTooltipPadding("4px 10px"),borderRadius:j.tosiTooltipRadius("6px"),background:j.tosiTooltipBg("#333"),color:j.tosiTooltipColor("#fff"),fontSize:j.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:j.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${n1} p`]:{margin:"0"},[`.${n1} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${n1} a`]:{color:"inherit"},[`.${n1}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${n1}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${n1}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}});function $2(){if(D4!==null)clearTimeout(D4),D4=null;if(d0!==null)d0.remove(),d0=null;S4=null}function ZC(l){if(l.startsWith("s"))return"tt-s";if(l.startsWith("n"))return"tt-n";if(l.startsWith("e"))return"tt-e";if(l.startsWith("w"))return"tt-w";return"tt-s"}function fC(l,i,y){let h=i.getBoundingClientRect(),x=l.getBoundingClientRect(),C=h.left+h.width*0.5,k=h.top+h.height*0.5,g;if(y.startsWith("s")||y.startsWith("n"))g=Math.max(8,Math.min(x.width-8,C-x.left))-4;else g=Math.max(8,Math.min(x.height-8,k-x.top))-4;l.style.setProperty("--tosi-tooltip-arrow",g+"px")}function $C(l,i){if(i)l=R(l);let y=NC({class:n1});return y.innerHTML=r.parseInline(l),y}function RC(l,i,y){$2(),S4=l;let{top:h,left:x,width:C}=l.getBoundingClientRect(),k=x+C*0.5,g=window.innerHeight,w=window.innerWidth,B=(h>g*0.5?"n":"s")+(k>w*0.5?"w":"e"),p=$C(i,y);p.classList.add(ZC(B)),d0=h0({content:p,target:l,position:B,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(d0&&S4)fC(p,l,B)})}function nC(l){for(let i of l.composedPath())if(i instanceof HTMLElement&&i.dataset.tooltip)return i;return null}function bC(l={}){let{convertTitles:i=!0,delay:y=250,localize:h=!1}=l;document.addEventListener("pointermove",(x)=>{if(i){for(let g of x.composedPath())if(g instanceof HTMLElement&&g.title&&!g.dataset.tooltip){g.dataset.tooltip=g.title,g.removeAttribute("title");break}}let C=nC(x);if(C===S4)return;if($2(),!C)return;let k=C.dataset.tooltip||null;if(!k)return;D4=setTimeout(()=>RC(C,k,h),y)}),document.addEventListener("pointerleave",$2),document.addEventListener("pointerdown",$2),document.addEventListener("keydown",$2),window.addEventListener("scroll",$2,!0)}Object.assign(globalThis,{xinjs:e2,xinjsui:g9});})();
|
|
110
110
|
|
|
111
|
-
//# debugId=
|
|
111
|
+
//# debugId=6D1585FBE28922D664756E2164756E21
|
|
112
112
|
//# sourceMappingURL=iife.js.map
|