tosijs-ui 1.15.1 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/bin/caddy-install.ts +1 -1
- package/bin/deploy-preview.ts +2 -2
- package/bin/docs.ts +8 -1
- package/bin/release-notes.ts +1 -1
- package/bin/tunnel.ts +1 -1
- 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 +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.15.2
|
|
4
|
+
|
|
5
|
+
### The `tjs-lang` peer admits 0.14.x (#182)
|
|
6
|
+
|
|
7
|
+
**Upgrade before, or together with, tjs-lang 0.14.0** — if you install with npm and have
|
|
8
|
+
`tjs-lang` installed.
|
|
9
|
+
|
|
10
|
+
The optional peer was `^0.13.1`, and a caret on a `0.x` version admits patches only, so it
|
|
11
|
+
could not reach 0.14.0. An optional peer is only optional when it is *absent*: when it is
|
|
12
|
+
present and out of range, npm 7+ fails the install with `ERESOLVE`. It is now
|
|
13
|
+
`^0.13.1 || ^0.14.0`. bun resolves either way, which is why nothing here surfaced it; tjs-lang's
|
|
14
|
+
own pre-release review found it (the same defect as #98, one minor later).
|
|
15
|
+
|
|
16
|
+
Verified against `tjs-lang@0.14.0-rc.0` before widening: typecheck, build, unit, Playwright on
|
|
17
|
+
all three engines (the whole doc-test tier included) and the haltija lane all pass against it.
|
|
18
|
+
The one break 0.14.0 names, runtime types becoming callable, touches nothing here: no tosijs-ui
|
|
19
|
+
code handles a tjs runtime type.
|
|
20
|
+
|
|
21
|
+
The live-example CDN pin and the dev dependency stay on 0.13.13 until 0.14.0 is final, so a
|
|
22
|
+
published doc site keeps fetching the version it was built and tested against.
|
|
23
|
+
|
|
24
|
+
### The installed `bin/docs.ts` shim resolves its import
|
|
25
|
+
|
|
26
|
+
The back-compat shim for `extractDocs` importers re-exported from `../src/…`, and `src/` is not
|
|
27
|
+
in the published package, so since the doc-site system moved into `tosijs-ui/site` (June) it
|
|
28
|
+
threw `Cannot find module` for every installed consumer. It now re-exports from `dist/`, so
|
|
29
|
+
running it with `bun` or importing it by file path works. The bare specifier
|
|
30
|
+
`'tosijs-ui/bin/docs'` still does not resolve (the `exports` map sends it to `dist/`), and never
|
|
31
|
+
has since that map was added. **Use `tosijs-ui/site`** — it was never affected.
|
|
32
|
+
|
|
33
|
+
Found by a release check that had been silently skipping; it runs now.
|
|
34
|
+
|
|
35
|
+
### `tosijs-tunnel`, `tosijs-deploy`, `tosijs-caddy-install`, `tosijs-release-notes`: import spelling only
|
|
36
|
+
|
|
37
|
+
These bins now import `./resolve-site-config.ts` with its extension instead of relying on Bun's
|
|
38
|
+
extension probing, so each relative specifier names a file that is in the package. **No
|
|
39
|
+
behaviour moved:** the same module is loaded, and nothing in argument handling, ports, hosts,
|
|
40
|
+
secrets or what they write was touched. The diff is the import line in each file. Found by the
|
|
41
|
+
same check.
|
|
42
|
+
|
|
3
43
|
## 1.15.1
|
|
4
44
|
|
|
5
45
|
### Doc-test failures reported the wrong line — the same wrong line, every time (#142)
|
package/bin/caddy-install.ts
CHANGED
package/bin/deploy-preview.ts
CHANGED
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
registerCaddyFragment,
|
|
34
34
|
resolvePreviewHost,
|
|
35
35
|
parseArgv,
|
|
36
|
-
} from './resolve-site-config'
|
|
36
|
+
} from './resolve-site-config.ts'
|
|
37
37
|
import {
|
|
38
38
|
resolveSiteConfig,
|
|
39
39
|
isSafeRemotePath,
|
|
40
40
|
safeRemoteRoots,
|
|
41
|
-
} from './resolve-site-config'
|
|
41
|
+
} from './resolve-site-config.ts'
|
|
42
42
|
|
|
43
43
|
const { has, flag } = parseArgv(process.argv.slice(2), {
|
|
44
44
|
bin: 'tosijs-deploy',
|
package/bin/docs.ts
CHANGED
|
@@ -7,4 +7,11 @@
|
|
|
7
7
|
//
|
|
8
8
|
// No `/*#` doc block here on purpose: the documented copy lives in the real
|
|
9
9
|
// module, so the doc extractor surfaces it once (avoiding a slug collision).
|
|
10
|
-
|
|
10
|
+
//
|
|
11
|
+
// It must point into dist/, not src/: src/ is not in package.json#files, so the src path
|
|
12
|
+
// resolved only inside this repo and the shim was broken for every consumer from the move
|
|
13
|
+
// (2026-06-14) until 1.15.2. Found by release-doctor's shipped-relative-specifier check.
|
|
14
|
+
// Note the bare `'tosijs-ui/bin/docs'` spelling above does NOT resolve: the exports map's
|
|
15
|
+
// `./*` wildcard sends it to dist/bin/docs.js. Only a file path or `bun bin/docs.ts` reaches
|
|
16
|
+
// this file. See TODO.md.
|
|
17
|
+
export * from '../dist/doc-system/site/docs.js'
|
package/bin/release-notes.ts
CHANGED
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
lastVersionTag,
|
|
74
74
|
} from '../dist/doc-system/release-notes.js'
|
|
75
75
|
|
|
76
|
-
import { parseArgv } from './resolve-site-config'
|
|
76
|
+
import { parseArgv } from './resolve-site-config.ts'
|
|
77
77
|
|
|
78
78
|
// ── CLI ──────────────────────────────────────────────────────────────────────
|
|
79
79
|
|
package/bin/tunnel.ts
CHANGED
package/dist/iife.js
CHANGED
|
@@ -152,7 +152,7 @@ ${e}</tr>
|
|
|
152
152
|
`+this.renderer.text(a);i?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):n+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return n}parseInline(t,i=this.renderer){let n="";for(let s=0;s<t.length;s++){let r=t[s];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=a||"";continue}}let o=r;switch(o.type){case"escape":{n+=i.text(o);break}case"html":{n+=i.html(o);break}case"link":{n+=i.link(o);break}case"image":{n+=i.image(o);break}case"strong":{n+=i.strong(o);break}case"em":{n+=i.em(o);break}case"codespan":{n+=i.codespan(o);break}case"br":{n+=i.br(o);break}case"del":{n+=i.del(o);break}case"text":{n+=i.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return n}},al=class{options;block;constructor(e){this.options=e||Cr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?cn.lex:cn.lexInline}provideParser(){return this.block?hn.parse:hn.parseInline}},mu=class{defaults=Um();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=hn;Renderer=Co;TextRenderer=sg;Lexer=cn;Tokenizer=du;Hooks=al;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let n of e)switch(i=i.concat(t.call(this,n)),n.type){case"table":{let s=n;for(let r of s.header)i=i.concat(this.walkTokens(r.tokens,t));for(let r of s.rows)for(let o of r)i=i.concat(this.walkTokens(o.tokens,t));break}case"list":{let s=n;i=i.concat(this.walkTokens(s.items,t));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach((r)=>{let o=s[r].flat(1/0);i=i.concat(this.walkTokens(o,t))}):s.tokens&&(i=i.concat(this.walkTokens(s.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((i)=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach((s)=>{if(!s.name)throw Error("extension name required");if("renderer"in s){let r=t.renderers[s.name];r?t.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let r=t[s.level];r?r.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),i.renderer){let s=this.defaults.renderer||new Co(this.defaults);for(let r in i.renderer){if(!(r in s))throw Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=i.renderer[o],l=s[o];s[o]=(...c)=>{let h=a.apply(s,c);return h===!1&&(h=l.apply(s,c)),h||""}}n.renderer=s}if(i.tokenizer){let s=this.defaults.tokenizer||new du(this.defaults);for(let r in i.tokenizer){if(!(r in s))throw Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=i.tokenizer[o],l=s[o];s[o]=(...c)=>{let h=a.apply(s,c);return h===!1&&(h=l.apply(s,c)),h}}n.tokenizer=s}if(i.hooks){let s=this.defaults.hooks||new al;for(let r in i.hooks){if(!(r in s))throw Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=i.hooks[o],l=s[o];al.passThroughHooks.has(r)?s[o]=(c)=>{if(this.defaults.async&&al.passThroughHooksRespectAsync.has(r))return(async()=>{let u=await a.call(s,c);return l.call(s,u)})();let h=a.call(s,c);return l.call(s,h)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let u=await a.apply(s,c);return u===!1&&(u=await l.apply(s,c)),u})();let h=a.apply(s,c);return h===!1&&(h=l.apply(s,c)),h}}n.hooks=s}if(i.walkTokens){let s=this.defaults.walkTokens,r=i.walkTokens;n.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return cn.lex(e,t??this.defaults)}parser(e,t){return hn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let n={...i},s={...this.defaults,...n},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return r(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return r(Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return r(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer():e?cn.lex:cn.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?hn.parse:hn.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(r);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer():e?cn.lex:cn.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():e?hn.parse:hn.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(e,t){return(i)=>{if(i.message+=`
|
|
153
153
|
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+zn(i.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}},Sr=new mu;function Le(e,t){return Sr.parse(e,t)}Le.options=Le.setOptions=function(e){return Sr.setOptions(e),Le.defaults=Sr.defaults,j2(Le.defaults),Le};Le.getDefaults=Um;Le.defaults=Cr;Le.use=function(...e){return Sr.use(...e),Le.defaults=Sr.defaults,j2(Le.defaults),Le};Le.walkTokens=function(e,t){return Sr.walkTokens(e,t)};Le.parseInline=Sr.parseInline;Le.Parser=hn;Le.parser=hn.parse;Le.Renderer=Co;Le.TextRenderer=sg;Le.Lexer=cn;Le.lexer=cn.lex;Le.Tokenizer=du;Le.Hooks=al;Le.parse=Le;var{options:JH,setOptions:eY,use:tY,walkTokens:iY,parseInline:nY}=Le;var sY=hn.parse,rY=cn.lex;function U2(e,t){if(t==null)t="";else if(typeof t!=="string")t=String(t);return t.replace(/\{\{([^}]+)\}\}/g,(i,n)=>{let s=ut[`${e}${n.startsWith("[")?n:"."+n}`];return s===void 0?i:U2(e,String(s))})}class gu extends I{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let e=await fetch(this.src);this.value=await e.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),ut[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let e=U2(this.instanceId,this.value);if(this.elements){let t=e.split(`
|
|
154
154
|
`).reduce((i,n)=>{if(n.startsWith("<")||i.length===0)i.push(n);else{let s=i[i.length-1];if(!s.startsWith("<")||!s.endsWith(">"))i[i.length-1]+=`
|
|
155
|
-
`+n;else i.push(n)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:Le(i,this.options)).join("")}else this.innerHTML=Le(e,this.options);this.didRender()}}var u6=gu,rg=gu.elementCreator(),d6=rg,f6=rg;var{div:og,span:yu,button:ag}=Q,hl=86400000,p6=[0,1,2,3,4,5,6],m6=[1,2,3,4,5,6,7,8,9,10,11,12],lg=(e,t=2,i="0")=>String(e).padStart(t,i),ul=(e,t,i)=>new Date(`${e}-${lg(t)}-${lg(i)}`);class cg extends I{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:S.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:S.monthTodayBackground("transparent"),boxShadow:S.monthTodayShadow("none"),backdropFilter:S.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:S.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:S.monthDayColor("hotpink"),background:S.monthDayBackground("white"),fontWeight:S.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:S.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:S.monthDateCheckedColor("white"),background:S.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:S.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:S.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:S.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:S.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:S.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:ul(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:ul(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(e){this.disabled=e}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return m6.map((e)=>({caption:ul(2025,e,1).toString().split(" ")[1],value:String(e)}))}get years(){let e=Number(this.minDate.split("-")[0]),t=Number(this.maxDate.split("-")[0]),i=[];for(let n=e;n<=t;n++)i.push(String(n));return i}monthChanged=(e,t)=>{};gotoMonth(e,t){if(this.month!==t||this.year!==e)this.month=t,this.year=e,this.monthChanged(e,t)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(e){this.selectedDays[1]=e,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(e){this.selectedDays[0]=e,this.selectedDays.splice(2)}clickDate=(e)=>{let t=e.target.getAttribute("title");this.selectDate(t)};keyDate=(e)=>{let t=!1;switch(e.code){case"Space":{let i=e.target.getAttribute("title");this.selectDate(i),t=!0;break}case"Tab":break;default:console.log(e)}if(t)e.preventDefault(),e.stopPropagation()};#e="";selectDate=(e)=>{if(this.#e=e,this.range){if(!this.to)this.selectedDays=[e,e];else if(this.from===e&&this.to===e)this.selectedDays=[];else if(this.from===e)this.from=this.to;else if(this.to===e)this.to=this.from;else if(e<this.from)this.from=e;else if(e>this.to)this.to=e;else this.to=e;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(e))this.selectedDays.splice(this.selectedDays.indexOf(e),1);else this.selectedDays.push(e),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(e))this.value="",this.selectedDays=[];else this.value=e,this.selectedDays=[e]};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=(e)=>{if(!this.range)return this.selectedDays.includes(e);else if(this.range)return this.from&&e>=this.from&&e<=this.to;return!1};dateMenuItem=(e,t="")=>(e=e.split("T")[0],{caption:t||e,enabled:()=>!e.startsWith(`${this.year}-${lg(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{bt({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((e)=>this.dateMenuItem(e))]})};content=()=>[og({part:"header"},ag({part:"previous",onClick:this.previousMonth},B.chevronLeft()),yu({style:{flex:"1"}}),ag({part:"jump",onClick:this.jumpMenu},B.calendar()),Ni({part:"month",options:this.months,onChange:this.setMonth}),Ni({part:"year",options:[this.year],onChange:this.setMonth}),yu({style:{flex:"1"}}),ag({part:"next",onClick:this.nextMonth},B.chevronRight())),og({part:"week"}),og({part:"days"})];gotoDate(e){let t=new Date(e);this.gotoMonth(t.getFullYear(),t.getMonth()+1)}connectedCallback(){super.connectedCallback();let e=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=e.getMonth()+1;if(isNaN(this.year))this.year=e.getFullYear()}days=[];render(){super.render();let{week:e,days:t,jump:i,month:n,year:s,previous:r,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let a=ul(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*hl),c=this.month===12?1:this.month+1,h=new Date(ul(this.year+(this.month===12?1:0),c,1).valueOf()-hl),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*hl),d=p6.map((O)=>new Date(l.valueOf()+O*hl).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let O=l.valueOf();O<=u.valueOf();O+=hl){let b=new Date(O),k=b.toISOString().split("T")[0];this.days.push({date:b,selected:!1,inMonth:b.getMonth()+1===this.month,isToday:k===f,isWeekend:b.getDay()%6===0,inRange:!!(this.from&&k>=this.from&&k<=this.to)})}n.value=String(this.month),s.value=String(this.year),n.disabled=s.disabled=i.disabled=r.disabled=o.disabled=this.disabled||this.readonly,s.options=this.years,e.textContent="",e.append(...d.map((O)=>yu({class:"day"},O))),t.textContent="";let m=null,{to:g,from:y}=this;t.append(...this.days.map((O)=>{let b=["date"];if(O.inMonth)b.push("in-month");if(O.isToday)b.push("today");let k=O.date.toISOString().split("T")[0];if(this.checkDay(k))b.push("checked");if(b.push(O.isWeekend?"weekend":"weekday"),this.range){if(g===k)b.push("range-end");if(y===k)b.push("range-start")}let C=yu({class:b.join(" "),title:k,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},O.date.getDate());if(k===this.#e)m=C;return C})),m?.focus()}}var g6=cg.elementCreator();var{div:hg,button:y6}=Q,O6={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class Fs extends I{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${v.notificationSpacing} ${v.notificationSpacing50} ${v.notificationSpacing} ${v.notificationSpacing200}`,_notificationBg:S.background("#fafafa"),_notificationAccentColor:"#aaa",_notificationTextColor:S.textColor("#444"),_notificationIconSize:v.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:v.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:v.notificationSpacing,width:v.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:v.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:v.notificationTextColor},":host .note":{display:"grid",background:v.notificationBg,padding:v.notificationPadding,gridTemplateColumns:`${v.notificationIconSize} 1fr ${v.notificationButtonSize}`,gap:v.notificationSpacing,alignItems:"center",borderRadius:v.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${v.notificationAccentColor}`,borderColor:v.notificationAccentColor,borderWidth:v.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:v.notificationButtonSize,padding:0,margin:0,height:v.notificationButtonSize,width:v.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:v.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:v.notificationBg,background:v.notificationAccentColor,padding:v.spacing50},":host .note svg":{height:v.notificationIconSize,width:v.notificationIconSize,pointerEvents:"none",color:v.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:v.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(e){e.classList.add("closing"),e.style.marginBottom=-e.offsetHeight+"px";let t=()=>{e.remove()};e.addEventListener("transitionend",t),setTimeout(t,1000)}static post(e){let{message:t,duration:i,type:n,close:s,progress:r,icon:o,color:a}=Object.assign({type:"info",duration:-1},typeof e==="string"?{message:e}:e);if(!this.singleton)this.singleton=ug();let l=this.singleton;document.body.append(l),l.style.zIndex=String(vr()+1);let c=a||O6[n],h=r||n==="progress"?Q.progress():{},u=()=>{if(s)s();Fs.removeNote(m)},d=o instanceof SVGElement?o:o?B[o]():B.info(),f=n==="error"||n==="warn",m=hg({class:`note ${n}`,role:f?"alert":"status",ariaLive:f?"assertive":"polite",style:{_notificationAccentColor:c}},d,hg({class:"message"},hg(t),h),y6({class:"close",title:"close",ariaLabel:"Close notification",apply(g){g.addEventListener("click",u)}},B.x()));if(l.shadowRoot.append(m),h instanceof HTMLProgressElement&&r instanceof Function){h.setAttribute("max",String(100)),h.value=r();let g=setInterval(()=>{if(!l.shadowRoot.contains(m)){clearInterval(g);return}let y=r();if(h.value=y,y>=100)Fs.removeNote(m)},1000)}if(i>0)setTimeout(()=>{Fs.removeNote(m)},i*1000);return m.scrollIntoView(),u}content=null}var b6=Fs,ug=Fs.elementCreator(),x6=ug;function dg(e){return Fs.post(e)}var G2=async(e,t="SHA-1")=>{let n=new TextEncoder().encode(e),s=await crypto.subtle.digest(t,n);return Array.from(new Uint8Array(s)).map((a)=>a.toString(16).padStart(2,"0")).join("")},K2=async(e)=>{let t=await G2(e),i=await fetch(`https://weakpass.com/api/v1/search/${t}`);if(i.ok){let n=await i.json();console.log("password found in weakpass database",n)}return i.status!==404},{span:fg,tosiSlot:v6}=Q;class Ou extends I{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:v.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:S.meterHeight("24px"),background:S.indicatorBg("white"),borderRadius:S.meterRadius("4px"),boxShadow:S.meterShadow(`inset 0 0 0 2px ${v.indicatorColor}`)},':host [part="level"]':{height:S.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:v.indicatorColor,margin:S.levelMargin("2px"),borderRadius:S.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:v.descriptionColor,height:S.meterHeight("24px"),lineHeight:S.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(e){return this.issues={tooShort:e.length<this.minLength,short:e.length<this.goodLength,noUpper:!e.match(/[A-Z]/),noLower:!e.match(/[a-z]/),noNumber:!e.match(/[0-9]/),noSpecial:!e.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((t)=>!t).length-1}async isBreached(){let e=this.querySelector("input")?.value;if(!e||typeof e!=="string")return!0;return await K2(e)}updateIndicator=(e)=>{let{level:t,description:i}=this.parts,n=this.indicatorColors.split(","),s=this.descriptionColors.split(","),r=this.strength(e);if(this.value!==r)this.value=r,this.dispatchEvent(new Event("change"));t.style.width=`${(r+1)*16.67}%`,this.style.setProperty("--indicator-color",n[r]),this.style.setProperty("--description-color",s[r]),i.textContent=this.strengthDescriptions[r]};update=(e)=>{let t=e.target.closest("input");this.updateIndicator(t?.value||"")};content=()=>[v6({onInput:this.update}),fg({part:"meter"},fg({part:"level"}),fg({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var k6=Ou,J2=Ou.elementCreator(),w6=J2;var{button:S6,div:C6,slot:T6}=Q;class pg extends I{static preferredTagName="tosi-pocket-bar";static initAttributes={icon:"",direction:"auto",open:!1};pinned=!1;get vertical(){return/^[ns]/.test(this.direction)}get resolvedIcon(){return this.icon||(this.vertical?"moreVertical":"moreHorizontal")}get floatPosition(){return this.direction==="auto"?"side":this.direction}reposition=()=>{if(!this.hydrated)return;Ch(this.parts.bar,this.parts.handle,this.floatPosition,"remain","remain")};setOpen(e){if(this.open!==e)this.open=e;if(e)this.reposition()}handlePointerEnter=(e)=>{if(e.pointerType==="touch")return;this.setOpen(!0)};handlePointerLeave=(e)=>{if(e.pointerType==="touch")return;if(!this.pinned)this.setOpen(!1)};handleFocusIn=()=>this.setOpen(!0);handleFocusOut=()=>{requestAnimationFrame(()=>{if(!this.pinned&&!this.matches(":focus-within"))this.setOpen(!1)})};close=()=>{this.pinned=!1,this.setOpen(!1)};toggle=(e)=>{e?.preventDefault(),this.pinned=!this.pinned,this.setOpen(this.pinned)};handleOutsidePointer=(e)=>{if(!this.pinned)return;let t=e.composedPath();if(!t.includes(this)&&!t.includes(this.parts.bar))this.pinned=!1,this.setOpen(!1)};handleScrollResize=()=>{if(this.open)this.reposition()};content=()=>[S6({part:"handle",class:"no-drag",title:"toolbar","aria-label":"toolbar","aria-expanded":"false",onClick:this.toggle},tm({part:"handleIcon",icon:this.resolvedIcon})),C6({part:"bar",role:"toolbar",style:{flexDirection:this.vertical?"column":"row"}},T6())];static shadowStyleSpec={":host":{display:"inline-flex",position:"relative",opacity:S.tosiPocketOpacity("0.75"),transition:"opacity 0.15s ease-out"},":host([open])":{opacity:"1"},':host [part="handle"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:v.spacing50,border:"0",margin:"0",cursor:"pointer",color:S.tosiPocketHandleColor("inherit"),background:S.tosiPocketHandleBg(S.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 85%, transparent)")),backdropFilter:"blur(12px)",borderRadius:S.tosiPocketHandleRadius(v.spacing),width:S.tosiPocketHandleSize("auto"),height:S.tosiPocketHandleSize("auto"),transition:"background 0.15s ease-out"},':host [part="bar"]':{position:"fixed",display:"flex",gap:v.spacing25,padding:v.spacing25,background:S.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 82%, transparent)"),backdropFilter:"blur(12px)",borderRadius:v.spacing,boxShadow:`0 ${v.spacing25} ${v.spacing} #0003`,opacity:"0",pointerEvents:"none",transform:"scale(0.9)",transition:"opacity 0.15s ease-out, transform 0.15s ease-out"},':host([open]) [part="bar"]':{opacity:"1",pointerEvents:"auto",transform:"scale(1)"},"::slotted(button), ::slotted(label)":{display:"inline-flex",alignItems:"center",gap:v.spacing25,padding:v.spacing50,margin:"0",border:"0",background:"transparent",color:"inherit",font:"inherit",cursor:"pointer",borderRadius:v.spacing25,transition:"background 0.15s ease-out, opacity 0.15s, filter 0.15s"},"::slotted(button:hover), ::slotted(label:hover)":{background:"color-mix(in srgb, currentColor 15%, transparent)"},'::slotted(label:has(input[type="checkbox"]:not(:checked)))':{opacity:"0.45",filter:"grayscale(1)"}};connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.handlePointerEnter),this.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),document.addEventListener("pointerdown",this.handleOutsidePointer,!0),window.addEventListener("scroll",this.handleScrollResize,{passive:!0,capture:!0}),window.addEventListener("resize",this.handleScrollResize,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this.handleOutsidePointer,!0),window.removeEventListener("scroll",this.handleScrollResize,!0),window.removeEventListener("resize",this.handleScrollResize)}render(){super.render(),this.parts.handleIcon.icon=this.resolvedIcon,this.parts.bar.style.flexDirection=this.vertical?"column":"row",this.parts.handle.setAttribute("aria-expanded",String(!!this.open)),this.reposition()}}var mg=pg.elementCreator();var{span:gg}=Q;class bu extends I{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(e){this.readonly=e}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=()=>gg({part:"container"},gg({part:"empty"}),gg({part:"filled"}));displayValue(e){let{empty:t,filled:i}=this.parts,s=Math.round((typeof e==="string"?0:e||0)/this.step)*this.step;i.style.width=s/this.max*t.offsetWidth+"px"}update=(e)=>{if(this.readonly)return;let{empty:t}=this.parts,i=e instanceof MouseEvent?e.pageX-t.getBoundingClientRect().x:0,n=Math.min(Math.max(this.min,Math.round(i/t.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(e.type==="click")this.value=n;else if(e.type==="mousemove")this.displayValue(n);else this.displayValue(this.value||0)};handleKey=(e)=>{let t=this.value===""?NaN:Number(this.value);if(isNaN(t))t=Math.round((this.min+this.max)*0.5*this.step)*this.step;let i=!1;switch(e.key){case"ArrowUp":case"ArrowRight":t+=this.step,i=!0;break;case"ArrowDown":case"ArrowLeft":t-=this.step,i=!0;break}if(this.value=Math.max(Math.min(t,this.max),this.min),i)e.stopPropagation(),e.preventDefault()};connectedCallback(){super.connectedCallback();let{container:e}=this.parts;e.tabIndex=0,e.addEventListener("mousemove",this.update,!0),e.addEventListener("mouseleave",this.update),e.addEventListener("blur",this.update),e.addEventListener("click",this.update),e.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let e=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",e),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:t,filled:i}=this.parts;if(t.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),t.style.setProperty("--tosi-icon-stroke",this.emptyStroke),i.style.setProperty("--tosi-icon-fill",this.ratingFill),i.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let n=0;n<this.max;n++)t.append(B[this.icon]()),i.append(B[this.icon]())}this.displayValue(this.value)}}var E6=bu,ek=bu.elementCreator(),$6=hi((...e)=>ek(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:tk,div:P6,button:A6}=Q,_6=[{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 yg(e=_6){return Ni({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var dl=()=>qm({slot:"toolbar"});function un(e,t,i){return A6({slot:"toolbar",dataCommand:t,title:e},i)}var M6=()=>[un("left-justify","justifyLeft",B.alignLeft()),un("center","justifyCenter",B.alignCenter()),un("right-justify","justifyRight",B.alignRight()),dl(),un("bullet list","insertUnorderedList",B.listBullet()),un("numbered list","insertOrderedList",B.listNumber()),dl(),un("indent","indent",B.indent()),un("indent","outdent",B.outdent())],ik=()=>[un("bold","bold",B.fontBold()),un("italic","italic",B.fontItalic()),un("underline","underline",B.fontUnderline())],R6=()=>[yg(),dl(),...ik()],nk=()=>[yg(),dl(),...M6(),dl(),...ik()];class xu extends I{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(e){if(this.isInitialized)this.parts.doc.contentEditable=e?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(e){let t=this._value;if(this._value=e,this.isInitialized){if(this.parts.doc.innerHTML!==e)this.parts.doc.innerHTML=e}if(t!==e&&this.internals)this.internals.setFormValue(e)}blockElement(e){let{doc:t}=this.parts;while(e.parentElement!==null&&e.parentElement!==t)e=e.parentElement;return e.parentElement===t?e:void 0}get selectedBlocks(){let{doc:e}=this.parts,t=window.getSelection();if(t===null)return[];let i=[];for(let n=0;n<t.rangeCount;n++){let s=t.getRangeAt(n);if(!e.contains(s.commonAncestorContainer))continue;let r=this.blockElement(s.startContainer),o=this.blockElement(s.endContainer);i.push(r);while(r!==o&&r!==null)r=r.nextElementSibling,i.push(r)}return i}get selectedText(){let e=window.getSelection();if(e===null)return"";return this.selectedBlocks.length?e.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(e)=>{if(this._updatingBlockStyle)return;let i=e.target?.closest(Nn.tagName);if(i==null)return;this.doCommand(i.value)};handleButtonClick=(e)=>{let i=e.target?.closest("button");if(i==null)return;this.doCommand(i.dataset.command)};content=[tk({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),P6({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),tk({part:"content"})];doCommand(e){if(e===void 0)return;let t=e.split(",");console.log("execCommand",t[0],!1,...t.slice(1)),document.execCommand(t[0],!1,...t.slice(1))}updateBlockStyle(){let e=this.parts.toolbar.querySelector(".block-style");if(e===null)return;let t=this.selectedBlocks.map((i)=>i.tagName);t=[...new Set(t)],this._updatingBlockStyle=!0,e.value=t.length===1?`formatBlock,${t[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:e,content:t}=this.parts;if(t.innerHTML!==""&&e.innerHTML==="")e.innerHTML=t.innerHTML,t.innerHTML="";this.isInitialized=!0,t.style.display="none",e.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(i)=>{this.updateBlockStyle(),this.selectionChange(i,this)})}render(){let{toolbar:e}=this.parts;if(super.render(),e.children.length===0)switch(this.widgets){case"minimal":e.append(...R6());break;case"default":e.append(...nk());break}}}var L6=xu,sk=xu.elementCreator(),Q6=hi((...e)=>sk(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:fl}=It({router:{path:"",hash:"",pattern:""}}),Og={};function I6(){return{...Og}}var vu=[],bg=!1,ku=new Set;function B6(e){let t=[];if(e==="")return{regex:/^\/?$/,paramNames:t};let i=e.split("/").map((s)=>{if(s.startsWith(":"))return t.push(s.slice(1)),"([^/]+)";return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+i.join("/")+"/?$"),paramNames:t}}function N6(e){let t=e.split("?")[0].split("#")[0];for(let n of vu){if(n.fallback)continue;let s=t.match(n.regex);if(s){let r={};return n.paramNames.forEach((o,a)=>{r[o]=decodeURIComponent(s[a+1])}),{route:n,params:r}}}let i=vu.find((n)=>n.fallback);if(i)return{route:i,params:{}};return null}function pl(){let e=bg?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;fl.path.value=e,fl.hash.value=window.location.hash;let t=N6(e);if(t){Og=t.params,fl.pattern.value=t.route.regex.source;let i=new Map;for(let n of t.route.targets)i.set(n.view??"default",n);for(let n of ku){let s=n.name||"default",r=i.get(s);if(r)n.replaceChildren(r.component(t.params));else n.replaceChildren()}}else{Og={},fl.pattern.value="";for(let i of ku)i.replaceChildren()}}var rk=!1;function ok(){if(rk)return;rk=!0,window.addEventListener("popstate",pl),window.addEventListener("hashchange",pl)}function j6(e,t={}){bg=t.hashRouting??!1,vu=e.map((i)=>{let{regex:n,paramNames:s}=B6(i.pattern);return{regex:n,paramNames:s,targets:i.targets,fallback:i.fallback??!1}}),ok(),pl()}function D6(e){if(ok(),bg)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));pl()}class xg extends I{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),ku.add(this),vu.length>0)pl()}disconnectedCallback(){super.disconnectedCallback(),ku.delete(this)}}var z6=xg.elementCreator();var{div:V6,slot:X6,label:F6,span:Z6,input:ak}=Q;class To extends I{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(e){if(typeof e==="string")this._choices=To.parseChoicesString(e);else this._choices=e;this.queueRender()}static parseChoicesString(e){return e.split(",").filter((t)=>t.trim()!=="").map((t)=>{let[i,n]=t.split("=").map((a)=>a.trim()),[s,r]=(n||i).split(":").map((a)=>a.trim()),o=r?B[r]():"";return{value:i,icon:o,caption:s}})}value="";formDisabledCallback(e){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((e)=>e.trim()).filter((e)=>e!=="")}content=()=>[X6(),V6({part:"options"},ak({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:S.segmentedOptionGap("8px"),alignItems:S.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:S.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:S.segmentedOptionGap("8px"),gridTemplateColumns:S.segmentedOptionGridColumns("0px 24px 1fr"),padding:S.segmentedOptionPadding("4px 12px"),font:S.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:S.segmentedFocusShadow(`inset 0 0 0 2px ${S.segmentedOptionCurrentBackground("#44a")}`),borderRadius:S.segmentedOptionsBorderRadius("8px")},":host label.current":{color:S.segmentedOptionCurrentColor("#eee"),background:S.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:S.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${S.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:S.segmentOptionIconSize("16px"),stroke:S.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:S.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:S.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:S.segmentedOptionsBorderRadius("8px"),background:S.segmentedOptionsBackground("#fff"),color:S.segmentedOptionColor("#222"),overflow:"hidden",alignItems:S.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:S.segmentedOptionPadding("4px 12px"),color:S.segmentedOptionCurrentColor("#eee"),background:S.segmentedOptionCurrentBackground("#44a"),font:S.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:S.segmentedOptionCurrentColor("#eee"),opacity:S.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:e}=this.parts,{values:t,isOtherValue:i}=this;e.querySelectorAll("label").forEach((n)=>{let s=n.querySelector("input")?.value??"";n.classList.toggle("current",t.includes(s)||s===""&&i)})}handleChange=()=>{let{options:e,custom:t}=this.parts;if(this.multiple){let i=[...e.querySelectorAll("input:checked")];this.value=i.map((n)=>n.value).join(",")}else{let i=e.querySelector("input:checked");if(!i)this.value="";else if(i.value)t.setAttribute("hidden",""),this.value=i.value;else t.removeAttribute("hidden"),t.focus(),t.select(),this.value=t.value}this.syncCurrent()};handleKey=(e)=>{let t=!1;switch(e.code){case"Space":if(e.target instanceof HTMLLabelElement)e.target.click(),t=!0;break;case"Tab":if(!(e.target instanceof HTMLLabelElement))e.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let i=e.target.closest("label");if(i.previousElementSibling instanceof HTMLLabelElement)i.previousElementSibling.focus()}t=!0;break;case"ArrowRight":case"ArrowDown":{let i=e.target.closest("label");if(i.nextElementSibling instanceof HTMLLabelElement)i.nextElementSibling.focus()}t=!0;break}if(t)e.preventDefault(),e.stopPropagation()};connectedCallback(){super.connectedCallback();let e=this.getAttribute("choices");if(e&&this._choices.length===0)this._choices=To.parseChoicesString(e);let{options:t}=this.parts;if(this.name==="")this.name=this.instanceId;if(t.addEventListener("change",this.handleChange),t.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 e=[...this.choices];if(this.other&&!this.multiple){let[t,i]=this.other.split(":");e.push({value:"",caption:t,icon:i})}return e}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((e)=>e.value===this.value))}render(){super.render();let{options:e,custom:t}=this.parts,i=this.multiple?"checkbox":"radio",{values:n,isOtherValue:s}=this,r=this._choicesWithOther,o=(c)=>n.includes(c)||c===""&&s,a=[...e.querySelectorAll("label")];if(a.length===r.length&&a.every((c,h)=>c.querySelector("input")?.value===r[h].value))a.forEach((c)=>{let h=c.querySelector("input");if(h&&h.checked!==o(h.value))h.checked=o(h.value)});else e.textContent="",e.append(...r.map((c)=>F6({tabindex:0},ak({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?on(c.caption):Z6(c.caption))));if(this.other&&!this.multiple){t.hidden=!s;let c=s?this.value:"";if(t.value!==c)t.value=c;if(t.placeholder=this.placeholder,t.parentElement!==e)e.append(t)}this.syncCurrent()}}var q6=To,lk=To.elementCreator(),W6=hi((...e)=>lk(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:ck}=Q;class Tr extends I{static preferredTagName="tosi-sidenav";static initAttributes={minSize:800,navSize:200,compact:!1,contentVisible:!1,alwaysCompact:!1};value="normal";get navVisible(){return!this.compact||!this.contentVisible}set navVisible(e){if(e){this.alwaysCompact=!1,this.contentVisible=!1;return}let t=this.offsetParent;if(!(t?t.offsetWidth<this.minSize:!1))this.alwaysCompact=!0;this.contentVisible=!0}content=[ck({name:"nav",part:"nav"}),ck({part:"content"})];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:`${S.navWidth("50%")} ${S.contentWidth("50%")}`,gridTemplateRows:"100%",position:"relative",margin:S.margin("0 0 0 -100%"),transition:S.sideNavTransition("0.25s ease-out")},":host slot":{position:"relative"},":host slot:not([name])":{display:"block"},':host slot[name="nav"]':{display:"block"}};handleResize=()=>{let{content:e}=this.parts,t=this.offsetParent;if(t===null)return;let i;if(this.compact=this.alwaysCompact||t.offsetWidth<this.minSize,[...this.childNodes].find((s)=>s instanceof Element?s.getAttribute("slot")!=="nav":!0)===void 0)i="compact/nav",this.style.setProperty("--nav-width","100%"),this.style.setProperty("--content-width","0%");else if(!this.compact)i="normal",e.classList.add("-tosi-sidenav-visible"),this.style.setProperty("--nav-width",`${this.navSize}px`),this.style.setProperty("--content-width",`calc(100% - ${this.navSize}px)`),this.style.setProperty("--margin","0");else if(e.classList.remove("-tosi-sidenav-visible"),this.style.setProperty("--nav-width","50%"),this.style.setProperty("--content-width","50%"),this.contentVisible)i="compact/content",this.style.setProperty("--margin","0 0 0 -100%");else i="compact/nav",this.style.setProperty("--margin","0 -100% 0 0");if(this.value!==i)this.value=i;this.releaseTransition()};observer;connectedCallback(){super.connectedCallback(),this.contentVisible=this.parts.content.childNodes.length===0,globalThis.addEventListener("resize",this.handleResize),this.observer=new MutationObserver(this.handleResize),this.observer.observe(this,{childList:!0}),this.style.setProperty("--side-nav-transition","0s")}releaseTransition=()=>{if(!this.transitionSuppressed)return;this.transitionSuppressed=!1,requestAnimationFrame(()=>{this.style.removeProperty("--side-nav-transition")})};transitionSuppressed=!0;disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect()}render(){super.render(),this.handleResize()}}var H6=Tr,ml=Tr.elementCreator(),Y6=ml,U6=ml;var{slot:hk}=Q;class vg extends I{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[hk({part:"normal"}),hk({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:e,small:t}=this.parts,i=this.offsetParent;if(!(i instanceof HTMLElement))return;else if(i.offsetWidth<this.minWidth||i.offsetHeight<this.minHeight)e.hidden=!0,t.hidden=!1,this.value="small";else e.hidden=!1,t.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var G6=vg.elementCreator();class wu extends I{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:v.resizeIconFill}};content=B.resize();get minSize(){let{minWidth:e,minHeight:t}=getComputedStyle(this.target);return{width:parseFloat(e)||32,height:parseFloat(t)||32}}resizeTarget=(e)=>{let{target:t}=this;if(!t)return;let{offsetWidth:i,offsetHeight:n}=t;t.style.left=t.offsetLeft+"px",t.style.top=t.offsetTop+"px",t.style.bottom="",t.style.right="";let{minSize:s}=this;ki(e,(r,o,a)=>{if(t.style.width=Math.max(s.width,i+r)+"px",t.style.height=Math.max(s.height,n+o)+"px",a.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let e={passive:!0};this.addEventListener("mousedown",this.resizeTarget),this.addEventListener("touchstart",this.resizeTarget,e)}}var K6=wu,uk=wu.elementCreator(),J6=uk;var{div:Er,slot:dk,span:e8,button:t8}=Q;class Su extends I{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(e,t,i){let n=t.getAttribute("name"),s=t.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?on(n):e8(n)),r=Er(s,{part:"tab",tabindex:0,role:"tab",ariaControls:i},t.hasAttribute("data-close")?t8({title:"close",class:"close"},B.x()):{}),o=t.dataset.tooltip;if(o)r.dataset.tooltip=o;return r}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${v.spacing50} ${v.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},":host .tabs > [aria-selected]":{"--text-color":v.tosiTabsSelectedColor,color:v.textColor},":host .elastic":{flex:"1"},":host .border":{background:v.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:v.tosiTabsBarHeight,background:v.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:v.spacing50,padding:0},":host button.close > svg":{height:"12px"}};handleCloseTab=null;get onCloseTab(){return this.handleCloseTab}set onCloseTab(e){this.handleCloseTab=e}content=[Er({role:"tabpanel",part:"tabpanel"},Er({part:"tabrow"},Er({class:"tabs",part:"tabs"}),Er({class:"elastic"}),dk({name:"after-tabs"})),Er({class:"border"},Er({class:"selected",part:"selected"}))),dk()];addTabBody(e,t=!1){if(!e.hasAttribute("name"))throw console.error("element has no name attribute",e),Error("element has no name attribute");if(this.append(e),this.setupTabs(),t)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(e){e.remove(),this.setupTabs(),this.queueRender()}keyTab=(e)=>{let{tabs:t}=this.parts,i=[...t.children].indexOf(e.target);switch(e.key){case"ArrowLeft":this.value=(i+Number(t.children.length)-1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case"ArrowRight":this.value=(i+1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case" ":this.pickTab(e),e.preventDefault();break;default:}};get bodies(){return[...this.children].filter((e)=>e.hasAttribute("name"))}pickTab=(e)=>{let{tabs:t}=this.parts,i=e.target,n=i.closest("button.close")!==null,s=i.closest(".tabs > div"),r=[...t.children].indexOf(s);if(n){let o=this.bodies[r];if(!this.handleCloseTab||this.handleCloseTab(o)!==!1)this.removeTabBody(this.bodies[r])}else if(r>-1)this.value=r};setupTabs=()=>{let{tabs:e}=this.parts,t=[...this.children].filter((i)=>!i.hasAttribute("slot")&&i.hasAttribute("name"));if(e.textContent="",this.value>=t.length)this.value=t.length-1;for(let i in t){let n=t[i],s=`${this.instanceId}-${i}`;n.id=s;let r=this.makeTab(this,n,s);e.append(r)}};connectedCallback(){super.connectedCallback();let{tabs:e}=this.parts;e.addEventListener("click",this.pickTab),e.addEventListener("keydown",this.keyTab),this.setupTabs(),jn.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),jn.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};handleResize(){this.queueRender()}render(){let{tabs:e,selected:t}=this.parts,i=this.bodies;for(let n=0;n<i.length;n++){let s=i[n],r=e.children[n],o=this.value===Number(n);if(r.toggleAttribute("aria-selected",o),s.toggleAttribute("hidden",!o),o)t.style.marginLeft=`${r.offsetLeft-e.offsetLeft}px`,t.style.width=`${r.offsetWidth}px`}}}var i8=Su,gl=Su.elementCreator(),n8=gl,s8=gl;var{div:r8,input:o8,span:a8,button:kg}=Q,fk=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),l8=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class yl extends I{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":S.brandColor("blue"),"--tag-text-color":S.brandTextColor("white"),display:"inline-flex",borderRadius:S.tagRoundedRadius(v.spacing50),color:v.tagTextColor,background:v.tagBg,padding:`0 ${v.spacing75} 0 ${v.spacing75}`,height:`calc(${v.lineHeight} + ${v.spacing50})`,lineHeight:`calc(${v.lineHeight} + ${v.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:S.fontSize("16px"),color:v.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${v.spacing_50} 0 ${v.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:v.spacing150,width:v.spacing150,color:v.tagCloseButtonColor,background:v.tagCloseButtonBg,borderRadius:S.tagCloseButtonRadius("99px"),opacity:v.tagButtonOpacity},':host [part="remove"]:hover':{background:v.tagCloseButtonBg,opacity:v.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[a8({part:"caption"},this.caption),kg(B.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var c8=yl,wg=yl.elementCreator(),h8=hi((...e)=>wg(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class Eo extends I{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:v.tagListBg,gap:v.spacing25,borderRadius:S.taglistRoundedRadius(v.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${v.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${v.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:v.inputBg,borderRadius:S.tagContainerRadius(v.spacing50),boxShadow:v.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:v.spacing25,minHeight:`calc(${v.lineHeight} + ${v.spacing})`,padding:v.spacing25},':host [part="tagMenu"]':{width:v.touchSize,height:v.touchSize,lineHeight:v.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:v.brandColor,color:v.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return fk(this.value).filter((e)=>e!=="")}set tags(e){this.value=l8(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=Eo.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return fk(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=Eo.parseAvailableTagsString(e)}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value=""}addTag=(e)=>{let t=e.trim();if(t===""||this.tags.includes(t))return;this.tags=[...this.tags,t],this.queueRender(!0)};toggleTag=(e)=>{if(this.tags.includes(e))this.tags=this.tags.filter((t)=>t!==e),this.queueRender(!0);else this.addTag(e)};enterTag=(e)=>{let{tagInput:t}=this.parts;switch(e.key){case",":{let i=t.value.split(",")[0];this.addTag(i)}break;case"Enter":{let i=t.value.split(",")[0];this.addTag(i)}e.stopPropagation(),e.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:e}=this,{tagMenu:t}=this.parts,i=[...this.availableTags],n=this.tags.filter((r)=>!i.includes(r));if(n.length)i.push(null,...n);let s=i.map((r)=>{if(r===""||r===null)return null;else if(typeof r==="object")return{checked:()=>this.tags.includes(r.value),caption:r.caption,action(){e(r.value)}};else return{checked:()=>this.tags.includes(r),caption:r,action(){e(r)}}});bt({target:t,width:"auto",menuItems:s})};content=()=>[kg({type:"button",style:{visibility:"hidden"},tabindex:-1}),r8({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),o8({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),kg({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},B.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(yl.tagName);this.tags=this.tags.filter((i)=>i!==t.caption),t.remove(),this.queueRender(!0)}e.stopPropagation(),e.preventDefault()};render(){super.render();let{tagContainer:e,tagMenu:t,tagInput:i}=this.parts;if(t.disabled=this.disabled,i.value="",i.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)t.toggleAttribute("hidden",!1),i.toggleAttribute("hidden",!this.textEntry);else t.toggleAttribute("hidden",!0),i.toggleAttribute("hidden",!0);e.textContent="";for(let n of this.tags)e.append(wg({caption:n,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var u8=Eo,pk=Eo.elementCreator(),d8=hi((...e)=>pk(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var mk="1.15.1";var{span:f8}=Q,Ol=null,Cu=null,Tu=null,Vn="tosi-tooltip",p8={[`.${Vn}`]:{pointerEvents:"none",padding:S.tosiTooltipPadding("4px 10px"),borderRadius:S.tosiTooltipRadius("6px"),background:S.tosiTooltipBg("#333"),color:S.tosiTooltipColor("#fff"),fontSize:S.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:S.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Vn} p`]:{margin:"0"},[`.${Vn} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Vn} a`]:{color:"inherit"},[`.${Vn}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Vn}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},gk=!1;function yk(){if(gk)return;gk=!0,Ft("tosi-tooltip",p8)}function $o(){if(Cu!==null)clearTimeout(Cu),Cu=null;if(Ol!==null)Ol.remove(),Ol=null;Tu=null}function m8(e){if(e.startsWith("s"))return"tt-s";if(e.startsWith("n"))return"tt-n";if(e.startsWith("e"))return"tt-e";if(e.startsWith("w"))return"tt-w";return"tt-s"}function g8(e,t,i){let n=t.getBoundingClientRect(),s=e.getBoundingClientRect(),r=n.left+n.width*0.5,o=n.top+n.height*0.5,a;if(i.startsWith("s")||i.startsWith("n"))a=Math.max(8,Math.min(s.width-8,r-s.left))-4;else a=Math.max(8,Math.min(s.height-8,o-s.top))-4;e.style.setProperty("--tosi-tooltip-arrow",a+"px")}function y8(e,t){if(t)e=me(e);let i=f8({class:Vn});return i.innerHTML=Le.parseInline(e),i}function O8(e,t,i){yk(),$o(),Tu=e;let{top:n,left:s,width:r}=e.getBoundingClientRect(),o=s+r*0.5,a=window.innerHeight,l=window.innerWidth,c=(n>a*0.5?"n":"s")+(o>l*0.5?"w":"e"),h=y8(t,i);h.classList.add(m8(c)),Ol=Xa({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(Ol&&Tu)g8(h,e,c)})}function b8(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function x8(e={}){yk();let{convertTitles:t=!0,delay:i=250,localize:n=!1}=e;document.addEventListener("pointermove",(s)=>{if(t){for(let a of s.composedPath())if(a instanceof HTMLElement&&a.title&&!a.dataset.tooltip){a.dataset.tooltip=a.title,a.removeAttribute("title");break}}let r=b8(s);if(r===Tu)return;if($o(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;Cu=setTimeout(()=>O8(r,o,n),i)}),document.addEventListener("pointerleave",$o),document.addEventListener("pointerdown",$o),document.addEventListener("keydown",$o),window.addEventListener("scroll",$o,!0)}var oO={};Mi(oO,{CodeEditor:()=>Ss,codeEditor:()=>Cs});var{div:RP}=Q,LP=new Set,Qc=(e,t)=>{if(LP.has(e))return;LP.add(e),console.warn(`<tosi-code>.${e} was removed in tosijs-ui 1.7 (the editor is now CodeMirror 6, not ACE) — ${t}. See CHANGELOG 1.7.0.`)},QP=!1,Pf=!1;class Ss extends I{static preferredTagName="tosi-code";source="";_handle;_loadPromise;_loadGeneration=0;_appliedMode="";_appliedDisabled;_tjsAutocomplete;get tjsAutocomplete(){return this._tjsAutocomplete}set tjsAutocomplete(e){if(this._tjsAutocomplete=e,this._handle&&this.isTjsMode())this.applyTjsExtension()}get value(){return this._handle?this._handle.getValue():this.source}set value(e){if(this._handle)this._handle.setValue(e);else this.source=e}_original;get original(){return this._original??this.value}set original(e){this._original=e}diffOverlay;_pendingDiff;get showingDiff(){if(!this.hydrated)return this._pendingDiff??!1;return!this.parts.diffHost.hidden}diffResolvable=!1;diffOriginalLabel="Original";diffModifiedLabel="Modified";showDiff(e){if(!this.hydrated){this._pendingDiff=e;return}let{diffHost:t}=this.parts;if(e){if(this.diffOverlay===void 0)this.diffOverlay=nl(),t.append(this.diffOverlay);this.diffOverlay.resolvable=this.diffResolvable,this.diffOverlay.originalLabel=this.diffOriginalLabel,this.diffOverlay.modifiedLabel=this.diffModifiedLabel,this.diffOverlay.original=this.original,this.diffOverlay.modified=this.value}else if(this.diffOverlay!==void 0&&this.diffResolvable){let i=this.diffOverlay.value;if(i!==this.value)this.value=i,this.dispatchEvent(new CustomEvent("change",{detail:{value:i}}))}t.hidden=!e}static initAttributes={mode:"javascript",disabled:!1};role="code editor";get editor(){if(!QP)QP=!0,console.info("<tosi-code>.editor is the CodeMirror 6 EditorView (the supported accessor; it was an ACE editor in 1.6). ACE-era `editor.session` / `getSession()` / "+"`setOption()` are gone — use undo()/redo()/canUndo()/canRedo() for history.");return this._handle?.view}get theme(){return Qc("theme","style the editor with --code-bg / --text-color instead"),""}set theme(e){Qc("theme","style the editor with --code-bg / --text-color instead")}get options(){return Qc("options","configure CodeMirror via the `editor` (EditorView) instead"),{}}set options(e){Qc("options","configure CodeMirror via the `editor` (EditorView) instead")}get ace(){Qc("ace","use `editor`, which is now a CodeMirror EditorView");return}undo(){this._handle?.undo()}redo(){this._handle?.redo()}canUndo(){return this._handle?.canUndo()??!1}canRedo(){return this._handle?.canRedo()??!1}content=()=>[RP({part:"host"}),RP({part:"diffHost",hidden:!0})];static shadowStyleSpec={":host":{display:"block",position:"relative",width:"100%",height:"100%"},'[part="host"]':{height:"100%"},'[part="diffHost"]':{position:"absolute",inset:"0",zIndex:"5",overflow:"auto",_background:S.codeBg(S.inputBg("#fdfdfd")),background:S.tosiDiffBg(S.codeBg("#fdfdfd"))},".cm-editor":{height:"100%"},".cm-scroller":{outline:"none",fontFamily:"Menlo, Monaco, Consolas, 'Courier New', monospace"}};handleResize(){this._handle?.refresh()}connectedCallback(){if(super.connectedCallback(),this.source==="")this.value=this.textContent!==null?this.textContent.trim():"";if(this._pendingDiff!==void 0){let e=this._pendingDiff;this._pendingDiff=void 0,this.showDiff(e)}if(this._loadPromise===void 0){let e=++this._loadGeneration;this._loadPromise=Promise.resolve().then(() => (rO(),sO)).then(({createCmEditor:t})=>{if(e!==this._loadGeneration||!this.isConnected)return;let i=t(this.parts.host,{value:this.source,mode:this.mode,readOnly:this.disabled,root:this.shadowRoot??void 0,onChange:(n)=>this.dispatchEvent(new CustomEvent("change",{detail:{value:n}}))});return this._handle=i,this._appliedMode=this.mode,this._appliedDisabled=this.disabled,this.applyTjsExtension(),i})}}disconnectedCallback(){if(super.disconnectedCallback(),this._handle)this.source=this._handle.getValue(),this._handle.destroy(),this._handle=void 0;this._loadPromise=void 0,this._appliedMode="",this._appliedDisabled=void 0}isTjsMode(){return this.mode==="tjs"||this.mode==="ajs"}applyTjsExtension(){let e=this._handle;if(!e||!this.isTjsMode())return;Promise.resolve().then(() => (rO(),sO)).then(({loadTjsExtension:t})=>t(this._tjsAutocomplete??{})).then((t)=>{if(t&&this._handle===e&&this.isTjsMode()){e.setLanguageExtension(t),this._tjsExtensionApplied=!0;return}if(!t&&this._handle===e&&this.isTjsMode()&&!Pf)Pf=!0,console.warn(`<tosi-code mode="${this.mode}">: tjs-lang's CodeMirror extension did not load — `+"falling back to TypeScript highlighting (no tjs autocomplete). Install the optional peer `tjs-lang`, or check that tjs-lang/editors/codemirror still exports `tjsEditorExtension`.")}).catch((t)=>{if(!Pf)Pf=!0,console.warn("<tosi-code>: failed to apply the tjs extension —",t)})}get tjsExtensionApplied(){return this._tjsExtensionApplied}_tjsExtensionApplied=!1;render(){if(super.render(),this._handle){if(this.disabled!==this._appliedDisabled)this._handle.setReadOnly(this.disabled),this._appliedDisabled=this.disabled;if(this.mode!==this._appliedMode)this._handle.setMode(this.mode),this._appliedMode=this.mode,this.applyTjsExtension()}}}var Cs=Ss.elementCreator();var dO={};Mi(dO,{HighlightBlock:()=>uO,tosiHighlight:()=>eF});var gX=new Set(["js","ts","tjs","html","css","test"]);function da(e,t,i="auto"){if(i==="none")return!1;if(!gX.has(e.toLowerCase()))return!1;if(t==="static")return!1;return i==="opt-in"?t!==void 0:!0}function Af(e){let t=String(e||"");return{lang:t.match(/^[a-z]+/)?.[0]??"",mode:t.match(/:([a-z]+)/)?.[1],id:t.match(/#([A-Za-z0-9_-]+)/)?.[1]}}var ZX=new Set(["markup","html","xml","css","clike","javascript","js"]),qX={js:"javascript",ts:"typescript",tjs:"javascript",jsx:"jsx",tsx:"tsx",html:"markup",xml:"markup",svg:"markup",vue:"markup",sh:"bash",shell:"bash",zsh:"bash",console:"bash",yml:"yaml",md:"markdown",rs:"rust",py:"python",rb:"ruby",golang:"go","c++":"cpp",cs:"csharp",scss:"scss",less:"less",json5:"json5",dockerfile:"docker",make:"makefile",test:"javascript"},aO=new Map;function pA(e){let t=e.toLowerCase();if(aO.has(t))return t;return qX[t]??t}var WX={bash:()=>Promise.resolve().then(() => (IP(),yX)),c:()=>Promise.resolve().then(() => (BP(),OX)),cpp:()=>Promise.resolve().then(() => (NP(),bX)),csharp:()=>Promise.resolve().then(() => (jP(),xX)),diff:()=>Promise.resolve().then(() => (DP(),vX)),docker:()=>Promise.resolve().then(() => (zP(),kX)),go:()=>Promise.resolve().then(() => (VP(),wX)),graphql:()=>Promise.resolve().then(() => (XP(),SX)),ini:()=>Promise.resolve().then(() => (FP(),CX)),java:()=>Promise.resolve().then(() => (ZP(),TX)),json:()=>Promise.resolve().then(() => (qP(),EX)),jsx:()=>Promise.resolve().then(() => (WP(),$X)),kotlin:()=>Promise.resolve().then(() => (HP(),PX)),less:()=>Promise.resolve().then(() => (YP(),AX)),makefile:()=>Promise.resolve().then(() => (UP(),_X)),markdown:()=>Promise.resolve().then(() => (GP(),MX)),php:()=>Promise.resolve().then(() => (KP(),RX)),python:()=>Promise.resolve().then(() => (JP(),LX)),ruby:()=>Promise.resolve().then(() => (eA(),QX)),rust:()=>Promise.resolve().then(() => (tA(),IX)),scss:()=>Promise.resolve().then(() => (iA(),BX)),sql:()=>Promise.resolve().then(() => (nA(),NX)),swift:()=>Promise.resolve().then(() => (sA(),jX)),toml:()=>Promise.resolve().then(() => (rA(),DX)),tsx:()=>Promise.resolve().then(() => (oA(),zX)),typescript:()=>Promise.resolve().then(() => (aA(),VX)),yaml:()=>Promise.resolve().then(() => (lA(),XX))};var HX=/language-([A-Za-z0-9_+#-]+)/;function hA(e){return(String(e??"").match(HX)?.[1]??"").toLowerCase()}var En,uA=!1,dA=new Map,fA=new WeakMap;function YX(e){let t=e;return!!t&&typeof t.highlight==="function"&&typeof t.languages==="object"}function UX(){for(let e of[globalThis,typeof window<"u"?window:void 0]){if(!e)continue;let t=e.Prism;if(YX(t))return t}return null}async function lO(e){let t=pA(e);if(!En){let s=UX();if(s)En=s}if(!En){for(let s of[globalThis,typeof window<"u"?window:void 0]){if(!s)continue;let r=s;fA.set(s,r.Prism),r.Prism={...r.Prism??{},manual:!0}}try{En=(await Promise.resolve().then(() => F3(cA(),1))).default}catch{for(let s of[globalThis,typeof window<"u"?window:void 0]){if(!s)continue;let r=s,o=fA.get(s);if(o===void 0)delete r.Prism;else r.Prism=o}if(!uA)uA=!0,console.warn("prismjs could not be loaded — static code blocks will not be syntax-highlighted "+"(site, ePub and print alike). It is a dependency of tosijs-ui, so this usually means a broken install: try reinstalling.");return!1}}let i=aO.get(e.toLowerCase());if(i)return En.languages[e.toLowerCase()]=i,!0;if(En.languages[t])return!0;if(ZX.has(t))return Boolean(En.languages[t]);let n=dA.get(t);if(!n)n=(async()=>{let s=WX[t];if(!s)return!1;try{await s()}catch(r){return console.warn(`prismjs grammar "${t}" failed to load — code blocks in that language `+"will not be highlighted.",r),!1}return Boolean(En.languages[t])})(),dA.set(t,n);return n}function cO(e,t){let i=t.toLowerCase(),n=aO.has(i)?i:pA(t),s=En?.languages[n];if(!En||!s)return null;return En.highlight(e,s,n)}var GX=(e)=>!e.querySelector(".token")&&!e.hasAttribute("data-highlighted");async function Mf(e,t={}){let i=t.liveExampleTag??"tosi-example",n=t.policy??"auto",s=[...e.querySelectorAll('pre > code[class*="language-"]')].filter((c)=>GX(c)).filter((c)=>!c.closest(i)).filter((c)=>{let h=c,u=h.parentElement?.getAttribute("data-example-mode")??void 0;return!da(hA(h.className),u,n)});if(s.length===0)return 0;let r=(c)=>hA(c.className),o=[...new Set(s.map(r))].filter(Boolean),a=new Set;await Promise.all(o.map(async(c)=>{if(await lO(c))a.add(c)}));let l=0;for(let c of s){let h=r(c);if(!a.has(h))continue;let u=cO(c.textContent??"",h);if(u===null)continue;c.innerHTML=u,c.setAttribute("data-highlighted",""),l+=1}return l}var hO={".token.comment, .token.prolog, .token.cdata":{fontStyle:"italic",color:S.tokenComment("#5c6f5c")},".token.punctuation":{color:S.tokenPunctuation("#666666")},".token.string, .token.char, .token.attr-value, .token.regex":{color:S.tokenString("#a03030")},".token.number, .token.boolean, .token.constant":{color:S.tokenNumber("#0b7285")},".token.keyword, .token.important, .token.atrule":{color:S.tokenKeyword("#0a5bb5")},".token.function, .token.class-name":{color:S.tokenFunction("#7a4b00")},".token.operator, .token.entity, .token.url":{color:S.tokenOperator("#444444")},".token.tag, .token.selector, .token.builtin":{color:S.tokenTag("#0a6b52")},".token.attr-name, .token.property":{color:S.tokenAttr("#2a5db0")},".token.deleted":{color:S.tokenDeleted("#b02020")},".token.inserted":{color:S.tokenInserted("#2a6b2a")},".token.bold":{fontWeight:"bold"},".token.italic":{fontStyle:"italic"},".darkmode .token.comment, .darkmode .token.prolog, .darkmode .token.cdata":{color:S.tokenCommentDark("#6a9955")},".darkmode .token.punctuation":{color:S.tokenPunctuationDark("#8a8a8a")},".darkmode .token.string, .darkmode .token.char, .darkmode .token.attr-value, .darkmode .token.regex":{color:S.tokenStringDark("#ce9178")},".darkmode .token.number, .darkmode .token.boolean, .darkmode .token.constant":{color:S.tokenNumberDark("#b5cea8")},".darkmode .token.keyword, .darkmode .token.important, .darkmode .token.atrule":{color:S.tokenKeywordDark("#569cd6")},".darkmode .token.function, .darkmode .token.class-name":{color:S.tokenFunctionDark("#dcdcaa")},".darkmode .token.operator, .darkmode .token.entity, .darkmode .token.url":{color:S.tokenOperatorDark("#d4d4d4")},".darkmode .token.tag, .darkmode .token.selector, .darkmode .token.builtin":{color:S.tokenTagDark("#4ec9b0")},".darkmode .token.attr-name, .darkmode .token.property":{color:S.tokenAttrDark("#9cdcfe")},".darkmode .token.deleted":{color:S.tokenDeletedDark("#f48771")},".darkmode .token.inserted":{color:S.tokenInsertedDark("#6a9955")}},mA=!1;function gA(){if(mA)return;mA=!0,Ft("tosi-highlight-tokens",hO)}var{pre:KX,code:JX}=Q;class uO extends I{static preferredTagName="tosi-highlight";static initAttributes={language:""};_value="";_rendered="";get value(){return this._value}set value(e){if(e===this._value)return;this._value=e,this.queueRender()}static lightStyleSpec={"tosi-highlight":{display:"block"}};content=()=>[KX({part:"pre"},JX({part:"code"}))];render(){super.render(),gA();let e=this.parts.code,t=this.language.toLowerCase(),i=this._value;if(this._rendered===`${t}\x00${i}`)return;if(this._rendered=`${t}\x00${i}`,e.className=t?`language-${t}`:"",e.textContent=i,!t||!i)return;lO(t).then((n)=>{if(!n)return;if(this._value!==i)return;let s=cO(i,t);if(s===null)return;let r=this.parts.code;if(r.textContent!==i)return;r.innerHTML=s,r.setAttribute("data-highlighted","")}).catch((n)=>{console.warn(`<tosi-highlight>: highlighting "${t}" failed`,n)})}}var eF=uO.elementCreator();var DO={};Mi(DO,{createDocBrowser:()=>jO,hasTestBlock:()=>i3});var tF=/^readme\.md$/i;function yA(e){if(tF.test(e))return"";return e.replace(/\.[^.]+$/,"")}function fa(e){let t={};for(let n of e){let s=yA(n.filename);t[s]=(t[s]||0)+1}let i={};for(let n of e){let s=yA(n.filename);i[n.filename]=s!==""&&t[s]>1?n.filename.replace(/\./g,"-"):s}return i}function fO(e){return e===""?"/":`/${e}/`}function bA(e,t){let i=e.replace(/^\?/,"");if(!i||i.includes("=")||i.includes("&"))return null;let n=decodeURIComponent(i),s=t[n];if(s===void 0)return null;return fO(s)}function iF(e){return e.replace(/^\/+/,"").replace(/\/+$/,"").replace(/\/index\.html$/i,"")}function pO(e,t){let i=iF(e);for(let[n,s]of Object.entries(t))if(s===i)return n;return""}function OA(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function mO(e,t,i){if(!e)return"";for(let s of t)if(s.filename===e)return s.filename;for(let s of t)if(i[s.filename]===e)return s.filename;let n=OA(e);for(let s of t)if(i[s.filename]===n)return s.filename;for(let s of t)if(s.title&&OA(s.title)===n)return s.filename;return""}function xA(e){return e.pin==="top"?0:e.pin==="bottom"?2:1}function nF(e,t){return xA(e)-xA(t)||(e.order??500)-(t.order??500)||(e.title||"").toLocaleLowerCase().localeCompare((t.title||"").toLocaleLowerCase())||e.filename.localeCompare(t.filename)}function Rf(e,t){let i=new Map;for(let o of e)i.set(o.filename,{doc:o,slug:t[o.filename]??"",children:[],depth:0});let n=new Map;for(let o of e){let a=o.parent?mO(o.parent,e,t):"";if(a&&(a===o.filename||!i.has(a)||sF(o.filename,a,e,t)))a="";n.set(o.filename,a)}let s=[];for(let o of e){let a=n.get(o.filename)||"",l=i.get(o.filename);if(a)i.get(a).children.push(l);else s.push(l)}let r=(o,a)=>{o.sort((l,c)=>nF(l.doc,c.doc));for(let l of o)l.depth=a,r(l.children,a+1)};return r(s,0),s}function sF(e,t,i,n){let s=new Map(i.map((a)=>[a.filename,a])),r=t,o=new Set([e]);while(r){if(o.has(r))return!0;o.add(r);let a=s.get(r);r=a?.parent?mO(a.parent,i,n):""}return!1}var rF=new Co,OO,bO=new mu;bO.use({renderer:{code(e){let t=Af(String(e.lang||"")),i=t.lang,n=t.id??"",s=t.mode??"",r=OO?.get(e.text);if(!n&&!s&&!r)return!1;let o=rF.code({...e,lang:i}),a=[n&&`data-example-id="${n}"`,s&&`data-example-mode="${s}"`].filter(Boolean).join(" ");if(a)o=o.replace(/^<pre>/,`<pre ${a}>`);if(r){let l=JSON.stringify(r.js).replace(/</g,"\\u003c");o+=`<script type="application/tosi-transpiled" data-dialect="${r.dialect}">${l}</script>`}return o}}});function gO(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function oF(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var aF=new mu,yO=new Map,pa=[];bO.use({hooks:{preprocess(e){return yO=new Map,pa=[],e},postprocess(e){if(pa.length===0)return e;let t=pa.map((i)=>{let n=aF.parseInline(yO.get(i)??""),s=gO(i);return`<li id="fn-${s}"><p>${n} <a href="#fnref-${s}" class="footnote-backref" aria-label="Back to reference">↩</a></p></li>`}).join(`
|
|
155
|
+
`+n;else i.push(n)}return i},[]);this.innerHTML=t.map((i)=>i.startsWith("<")&&i.endsWith(">")?i:Le(i,this.options)).join("")}else this.innerHTML=Le(e,this.options);this.didRender()}}var u6=gu,rg=gu.elementCreator(),d6=rg,f6=rg;var{div:og,span:yu,button:ag}=Q,hl=86400000,p6=[0,1,2,3,4,5,6],m6=[1,2,3,4,5,6,7,8,9,10,11,12],lg=(e,t=2,i="0")=>String(e).padStart(t,i),ul=(e,t,i)=>new Date(`${e}-${lg(t)}-${lg(i)}`);class cg extends I{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:S.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:S.monthTodayBackground("transparent"),boxShadow:S.monthTodayShadow("none"),backdropFilter:S.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:S.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:S.monthDayColor("hotpink"),background:S.monthDayBackground("white"),fontWeight:S.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:S.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:S.monthDateCheckedColor("white"),background:S.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:S.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:S.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:S.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:S.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:S.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:ul(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:ul(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(e){this.disabled=e}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return m6.map((e)=>({caption:ul(2025,e,1).toString().split(" ")[1],value:String(e)}))}get years(){let e=Number(this.minDate.split("-")[0]),t=Number(this.maxDate.split("-")[0]),i=[];for(let n=e;n<=t;n++)i.push(String(n));return i}monthChanged=(e,t)=>{};gotoMonth(e,t){if(this.month!==t||this.year!==e)this.month=t,this.year=e,this.monthChanged(e,t)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(e){this.selectedDays[1]=e,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(e){this.selectedDays[0]=e,this.selectedDays.splice(2)}clickDate=(e)=>{let t=e.target.getAttribute("title");this.selectDate(t)};keyDate=(e)=>{let t=!1;switch(e.code){case"Space":{let i=e.target.getAttribute("title");this.selectDate(i),t=!0;break}case"Tab":break;default:console.log(e)}if(t)e.preventDefault(),e.stopPropagation()};#e="";selectDate=(e)=>{if(this.#e=e,this.range){if(!this.to)this.selectedDays=[e,e];else if(this.from===e&&this.to===e)this.selectedDays=[];else if(this.from===e)this.from=this.to;else if(this.to===e)this.to=this.from;else if(e<this.from)this.from=e;else if(e>this.to)this.to=e;else this.to=e;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(e))this.selectedDays.splice(this.selectedDays.indexOf(e),1);else this.selectedDays.push(e),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(e))this.value="",this.selectedDays=[];else this.value=e,this.selectedDays=[e]};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=(e)=>{if(!this.range)return this.selectedDays.includes(e);else if(this.range)return this.from&&e>=this.from&&e<=this.to;return!1};dateMenuItem=(e,t="")=>(e=e.split("T")[0],{caption:t||e,enabled:()=>!e.startsWith(`${this.year}-${lg(this.month)}-`),action:()=>{this.gotoDate(e)}});jumpMenu=()=>{bt({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((e)=>this.dateMenuItem(e))]})};content=()=>[og({part:"header"},ag({part:"previous",onClick:this.previousMonth},B.chevronLeft()),yu({style:{flex:"1"}}),ag({part:"jump",onClick:this.jumpMenu},B.calendar()),Ni({part:"month",options:this.months,onChange:this.setMonth}),Ni({part:"year",options:[this.year],onChange:this.setMonth}),yu({style:{flex:"1"}}),ag({part:"next",onClick:this.nextMonth},B.chevronRight())),og({part:"week"}),og({part:"days"})];gotoDate(e){let t=new Date(e);this.gotoMonth(t.getFullYear(),t.getMonth()+1)}connectedCallback(){super.connectedCallback();let e=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=e.getMonth()+1;if(isNaN(this.year))this.year=e.getFullYear()}days=[];render(){super.render();let{week:e,days:t,jump:i,month:n,year:s,previous:r,next:o}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let a=ul(this.year,this.month,1),l=new Date(a.valueOf()-(7+a.getDay()-this.weekStart)%7*hl),c=this.month===12?1:this.month+1,h=new Date(ul(this.year+(this.month===12?1:0),c,1).valueOf()-hl),u=new Date(h.valueOf()+(this.weekStart*2+5+this.endDay-h.getDay())%7*hl),d=p6.map((O)=>new Date(l.valueOf()+O*hl).toString().split(" ")[0]);this.days=[];let f=new Date().toISOString().split("T")[0];for(let O=l.valueOf();O<=u.valueOf();O+=hl){let b=new Date(O),k=b.toISOString().split("T")[0];this.days.push({date:b,selected:!1,inMonth:b.getMonth()+1===this.month,isToday:k===f,isWeekend:b.getDay()%6===0,inRange:!!(this.from&&k>=this.from&&k<=this.to)})}n.value=String(this.month),s.value=String(this.year),n.disabled=s.disabled=i.disabled=r.disabled=o.disabled=this.disabled||this.readonly,s.options=this.years,e.textContent="",e.append(...d.map((O)=>yu({class:"day"},O))),t.textContent="";let m=null,{to:g,from:y}=this;t.append(...this.days.map((O)=>{let b=["date"];if(O.inMonth)b.push("in-month");if(O.isToday)b.push("today");let k=O.date.toISOString().split("T")[0];if(this.checkDay(k))b.push("checked");if(b.push(O.isWeekend?"weekend":"weekday"),this.range){if(g===k)b.push("range-end");if(y===k)b.push("range-start")}let C=yu({class:b.join(" "),title:k,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},O.date.getDate());if(k===this.#e)m=C;return C})),m?.focus()}}var g6=cg.elementCreator();var{div:hg,button:y6}=Q,O6={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class Fs extends I{static preferredTagName="tosi-notification";static singleton;static shadowStyleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${v.notificationSpacing} ${v.notificationSpacing50} ${v.notificationSpacing} ${v.notificationSpacing200}`,_notificationBg:S.background("#fafafa"),_notificationAccentColor:"#aaa",_notificationTextColor:S.textColor("#444"),_notificationIconSize:v.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:v.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:v.notificationSpacing,width:v.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:v.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important",color:v.notificationTextColor},":host .note":{display:"grid",background:v.notificationBg,padding:v.notificationPadding,gridTemplateColumns:`${v.notificationIconSize} 1fr ${v.notificationButtonSize}`,gap:v.notificationSpacing,alignItems:"center",borderRadius:v.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${v.notificationAccentColor}`,borderColor:v.notificationAccentColor,borderWidth:v.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note button":{display:"flex",lineHeight:v.notificationButtonSize,padding:0,margin:0,height:v.notificationButtonSize,width:v.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:v.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:v.notificationBg,background:v.notificationAccentColor,padding:v.spacing50},":host .note svg":{height:v.notificationIconSize,width:v.notificationIconSize,pointerEvents:"none",color:v.notificationAccentColor},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:v.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(e){e.classList.add("closing"),e.style.marginBottom=-e.offsetHeight+"px";let t=()=>{e.remove()};e.addEventListener("transitionend",t),setTimeout(t,1000)}static post(e){let{message:t,duration:i,type:n,close:s,progress:r,icon:o,color:a}=Object.assign({type:"info",duration:-1},typeof e==="string"?{message:e}:e);if(!this.singleton)this.singleton=ug();let l=this.singleton;document.body.append(l),l.style.zIndex=String(vr()+1);let c=a||O6[n],h=r||n==="progress"?Q.progress():{},u=()=>{if(s)s();Fs.removeNote(m)},d=o instanceof SVGElement?o:o?B[o]():B.info(),f=n==="error"||n==="warn",m=hg({class:`note ${n}`,role:f?"alert":"status",ariaLive:f?"assertive":"polite",style:{_notificationAccentColor:c}},d,hg({class:"message"},hg(t),h),y6({class:"close",title:"close",ariaLabel:"Close notification",apply(g){g.addEventListener("click",u)}},B.x()));if(l.shadowRoot.append(m),h instanceof HTMLProgressElement&&r instanceof Function){h.setAttribute("max",String(100)),h.value=r();let g=setInterval(()=>{if(!l.shadowRoot.contains(m)){clearInterval(g);return}let y=r();if(h.value=y,y>=100)Fs.removeNote(m)},1000)}if(i>0)setTimeout(()=>{Fs.removeNote(m)},i*1000);return m.scrollIntoView(),u}content=null}var b6=Fs,ug=Fs.elementCreator(),x6=ug;function dg(e){return Fs.post(e)}var G2=async(e,t="SHA-1")=>{let n=new TextEncoder().encode(e),s=await crypto.subtle.digest(t,n);return Array.from(new Uint8Array(s)).map((a)=>a.toString(16).padStart(2,"0")).join("")},K2=async(e)=>{let t=await G2(e),i=await fetch(`https://weakpass.com/api/v1/search/${t}`);if(i.ok){let n=await i.json();console.log("password found in weakpass database",n)}return i.status!==404},{span:fg,tosiSlot:v6}=Q;class Ou extends I{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:v.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:S.meterHeight("24px"),background:S.indicatorBg("white"),borderRadius:S.meterRadius("4px"),boxShadow:S.meterShadow(`inset 0 0 0 2px ${v.indicatorColor}`)},':host [part="level"]':{height:S.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:v.indicatorColor,margin:S.levelMargin("2px"),borderRadius:S.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:v.descriptionColor,height:S.meterHeight("24px"),lineHeight:S.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(e){return this.issues={tooShort:e.length<this.minLength,short:e.length<this.goodLength,noUpper:!e.match(/[A-Z]/),noLower:!e.match(/[a-z]/),noNumber:!e.match(/[0-9]/),noSpecial:!e.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((t)=>!t).length-1}async isBreached(){let e=this.querySelector("input")?.value;if(!e||typeof e!=="string")return!0;return await K2(e)}updateIndicator=(e)=>{let{level:t,description:i}=this.parts,n=this.indicatorColors.split(","),s=this.descriptionColors.split(","),r=this.strength(e);if(this.value!==r)this.value=r,this.dispatchEvent(new Event("change"));t.style.width=`${(r+1)*16.67}%`,this.style.setProperty("--indicator-color",n[r]),this.style.setProperty("--description-color",s[r]),i.textContent=this.strengthDescriptions[r]};update=(e)=>{let t=e.target.closest("input");this.updateIndicator(t?.value||"")};content=()=>[v6({onInput:this.update}),fg({part:"meter"},fg({part:"level"}),fg({part:"description"}))];render(){super.render();let e=this.querySelector("input");this.updateIndicator(e?.value)}}var k6=Ou,J2=Ou.elementCreator(),w6=J2;var{button:S6,div:C6,slot:T6}=Q;class pg extends I{static preferredTagName="tosi-pocket-bar";static initAttributes={icon:"",direction:"auto",open:!1};pinned=!1;get vertical(){return/^[ns]/.test(this.direction)}get resolvedIcon(){return this.icon||(this.vertical?"moreVertical":"moreHorizontal")}get floatPosition(){return this.direction==="auto"?"side":this.direction}reposition=()=>{if(!this.hydrated)return;Ch(this.parts.bar,this.parts.handle,this.floatPosition,"remain","remain")};setOpen(e){if(this.open!==e)this.open=e;if(e)this.reposition()}handlePointerEnter=(e)=>{if(e.pointerType==="touch")return;this.setOpen(!0)};handlePointerLeave=(e)=>{if(e.pointerType==="touch")return;if(!this.pinned)this.setOpen(!1)};handleFocusIn=()=>this.setOpen(!0);handleFocusOut=()=>{requestAnimationFrame(()=>{if(!this.pinned&&!this.matches(":focus-within"))this.setOpen(!1)})};close=()=>{this.pinned=!1,this.setOpen(!1)};toggle=(e)=>{e?.preventDefault(),this.pinned=!this.pinned,this.setOpen(this.pinned)};handleOutsidePointer=(e)=>{if(!this.pinned)return;let t=e.composedPath();if(!t.includes(this)&&!t.includes(this.parts.bar))this.pinned=!1,this.setOpen(!1)};handleScrollResize=()=>{if(this.open)this.reposition()};content=()=>[S6({part:"handle",class:"no-drag",title:"toolbar","aria-label":"toolbar","aria-expanded":"false",onClick:this.toggle},tm({part:"handleIcon",icon:this.resolvedIcon})),C6({part:"bar",role:"toolbar",style:{flexDirection:this.vertical?"column":"row"}},T6())];static shadowStyleSpec={":host":{display:"inline-flex",position:"relative",opacity:S.tosiPocketOpacity("0.75"),transition:"opacity 0.15s ease-out"},":host([open])":{opacity:"1"},':host [part="handle"]':{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:v.spacing50,border:"0",margin:"0",cursor:"pointer",color:S.tosiPocketHandleColor("inherit"),background:S.tosiPocketHandleBg(S.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 85%, transparent)")),backdropFilter:"blur(12px)",borderRadius:S.tosiPocketHandleRadius(v.spacing),width:S.tosiPocketHandleSize("auto"),height:S.tosiPocketHandleSize("auto"),transition:"background 0.15s ease-out"},':host [part="bar"]':{position:"fixed",display:"flex",gap:v.spacing25,padding:v.spacing25,background:S.tosiPocketBg("color-mix(in srgb, var(--tosi-bg, #fff) 82%, transparent)"),backdropFilter:"blur(12px)",borderRadius:v.spacing,boxShadow:`0 ${v.spacing25} ${v.spacing} #0003`,opacity:"0",pointerEvents:"none",transform:"scale(0.9)",transition:"opacity 0.15s ease-out, transform 0.15s ease-out"},':host([open]) [part="bar"]':{opacity:"1",pointerEvents:"auto",transform:"scale(1)"},"::slotted(button), ::slotted(label)":{display:"inline-flex",alignItems:"center",gap:v.spacing25,padding:v.spacing50,margin:"0",border:"0",background:"transparent",color:"inherit",font:"inherit",cursor:"pointer",borderRadius:v.spacing25,transition:"background 0.15s ease-out, opacity 0.15s, filter 0.15s"},"::slotted(button:hover), ::slotted(label:hover)":{background:"color-mix(in srgb, currentColor 15%, transparent)"},'::slotted(label:has(input[type="checkbox"]:not(:checked)))':{opacity:"0.45",filter:"grayscale(1)"}};connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.handlePointerEnter),this.addEventListener("pointerleave",this.handlePointerLeave),this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),document.addEventListener("pointerdown",this.handleOutsidePointer,!0),window.addEventListener("scroll",this.handleScrollResize,{passive:!0,capture:!0}),window.addEventListener("resize",this.handleScrollResize,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",this.handleOutsidePointer,!0),window.removeEventListener("scroll",this.handleScrollResize,!0),window.removeEventListener("resize",this.handleScrollResize)}render(){super.render(),this.parts.handleIcon.icon=this.resolvedIcon,this.parts.bar.style.flexDirection=this.vertical?"column":"row",this.parts.handle.setAttribute("aria-expanded",String(!!this.open)),this.reposition()}}var mg=pg.elementCreator();var{span:gg}=Q;class bu extends I{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(e){this.readonly=e}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=()=>gg({part:"container"},gg({part:"empty"}),gg({part:"filled"}));displayValue(e){let{empty:t,filled:i}=this.parts,s=Math.round((typeof e==="string"?0:e||0)/this.step)*this.step;i.style.width=s/this.max*t.offsetWidth+"px"}update=(e)=>{if(this.readonly)return;let{empty:t}=this.parts,i=e instanceof MouseEvent?e.pageX-t.getBoundingClientRect().x:0,n=Math.min(Math.max(this.min,Math.round(i/t.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(e.type==="click")this.value=n;else if(e.type==="mousemove")this.displayValue(n);else this.displayValue(this.value||0)};handleKey=(e)=>{let t=this.value===""?NaN:Number(this.value);if(isNaN(t))t=Math.round((this.min+this.max)*0.5*this.step)*this.step;let i=!1;switch(e.key){case"ArrowUp":case"ArrowRight":t+=this.step,i=!0;break;case"ArrowDown":case"ArrowLeft":t-=this.step,i=!0;break}if(this.value=Math.max(Math.min(t,this.max),this.min),i)e.stopPropagation(),e.preventDefault()};connectedCallback(){super.connectedCallback();let{container:e}=this.parts;e.tabIndex=0,e.addEventListener("mousemove",this.update,!0),e.addEventListener("mouseleave",this.update),e.addEventListener("blur",this.update),e.addEventListener("click",this.update),e.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let e=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",e),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:t,filled:i}=this.parts;if(t.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),t.style.setProperty("--tosi-icon-stroke",this.emptyStroke),i.style.setProperty("--tosi-icon-fill",this.ratingFill),i.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let n=0;n<this.max;n++)t.append(B[this.icon]()),i.append(B[this.icon]())}this.displayValue(this.value)}}var E6=bu,ek=bu.elementCreator(),$6=hi((...e)=>ek(...e),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:tk,div:P6,button:A6}=Q,_6=[{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 yg(e=_6){return Ni({title:"paragraph style",slot:"toolbar",class:"block-style",options:e.map(({caption:t,tagType:i})=>({caption:t,value:`formatBlock,${i}`}))})}var dl=()=>qm({slot:"toolbar"});function un(e,t,i){return A6({slot:"toolbar",dataCommand:t,title:e},i)}var M6=()=>[un("left-justify","justifyLeft",B.alignLeft()),un("center","justifyCenter",B.alignCenter()),un("right-justify","justifyRight",B.alignRight()),dl(),un("bullet list","insertUnorderedList",B.listBullet()),un("numbered list","insertOrderedList",B.listNumber()),dl(),un("indent","indent",B.indent()),un("indent","outdent",B.outdent())],ik=()=>[un("bold","bold",B.fontBold()),un("italic","italic",B.fontItalic()),un("underline","underline",B.fontUnderline())],R6=()=>[yg(),dl(),...ik()],nk=()=>[yg(),dl(),...M6(),dl(),...ik()];class xu extends I{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(e){if(this.isInitialized)this.parts.doc.contentEditable=e?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(e){let t=this._value;if(this._value=e,this.isInitialized){if(this.parts.doc.innerHTML!==e)this.parts.doc.innerHTML=e}if(t!==e&&this.internals)this.internals.setFormValue(e)}blockElement(e){let{doc:t}=this.parts;while(e.parentElement!==null&&e.parentElement!==t)e=e.parentElement;return e.parentElement===t?e:void 0}get selectedBlocks(){let{doc:e}=this.parts,t=window.getSelection();if(t===null)return[];let i=[];for(let n=0;n<t.rangeCount;n++){let s=t.getRangeAt(n);if(!e.contains(s.commonAncestorContainer))continue;let r=this.blockElement(s.startContainer),o=this.blockElement(s.endContainer);i.push(r);while(r!==o&&r!==null)r=r.nextElementSibling,i.push(r)}return i}get selectedText(){let e=window.getSelection();if(e===null)return"";return this.selectedBlocks.length?e.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(e)=>{if(this._updatingBlockStyle)return;let i=e.target?.closest(Nn.tagName);if(i==null)return;this.doCommand(i.value)};handleButtonClick=(e)=>{let i=e.target?.closest("button");if(i==null)return;this.doCommand(i.dataset.command)};content=[tk({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),P6({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),tk({part:"content"})];doCommand(e){if(e===void 0)return;let t=e.split(",");console.log("execCommand",t[0],!1,...t.slice(1)),document.execCommand(t[0],!1,...t.slice(1))}updateBlockStyle(){let e=this.parts.toolbar.querySelector(".block-style");if(e===null)return;let t=this.selectedBlocks.map((i)=>i.tagName);t=[...new Set(t)],this._updatingBlockStyle=!0,e.value=t.length===1?`formatBlock,${t[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:e,content:t}=this.parts;if(t.innerHTML!==""&&e.innerHTML==="")e.innerHTML=t.innerHTML,t.innerHTML="";this.isInitialized=!0,t.style.display="none",e.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(i)=>{this.updateBlockStyle(),this.selectionChange(i,this)})}render(){let{toolbar:e}=this.parts;if(super.render(),e.children.length===0)switch(this.widgets){case"minimal":e.append(...R6());break;case"default":e.append(...nk());break}}}var L6=xu,sk=xu.elementCreator(),Q6=hi((...e)=>sk(...e),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:fl}=It({router:{path:"",hash:"",pattern:""}}),Og={};function I6(){return{...Og}}var vu=[],bg=!1,ku=new Set;function B6(e){let t=[];if(e==="")return{regex:/^\/?$/,paramNames:t};let i=e.split("/").map((s)=>{if(s.startsWith(":"))return t.push(s.slice(1)),"([^/]+)";return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+i.join("/")+"/?$"),paramNames:t}}function N6(e){let t=e.split("?")[0].split("#")[0];for(let n of vu){if(n.fallback)continue;let s=t.match(n.regex);if(s){let r={};return n.paramNames.forEach((o,a)=>{r[o]=decodeURIComponent(s[a+1])}),{route:n,params:r}}}let i=vu.find((n)=>n.fallback);if(i)return{route:i,params:{}};return null}function pl(){let e=bg?window.location.hash.replace(/^#\/?/,"").split("?")[0]:window.location.pathname;fl.path.value=e,fl.hash.value=window.location.hash;let t=N6(e);if(t){Og=t.params,fl.pattern.value=t.route.regex.source;let i=new Map;for(let n of t.route.targets)i.set(n.view??"default",n);for(let n of ku){let s=n.name||"default",r=i.get(s);if(r)n.replaceChildren(r.component(t.params));else n.replaceChildren()}}else{Og={},fl.pattern.value="";for(let i of ku)i.replaceChildren()}}var rk=!1;function ok(){if(rk)return;rk=!0,window.addEventListener("popstate",pl),window.addEventListener("hashchange",pl)}function j6(e,t={}){bg=t.hashRouting??!1,vu=e.map((i)=>{let{regex:n,paramNames:s}=B6(i.pattern);return{regex:n,paramNames:s,targets:i.targets,fallback:i.fallback??!1}}),ok(),pl()}function D6(e){if(ok(),bg)window.location.hash="#/"+e.replace(/^\//,"");else window.history.pushState({},"","/"+e.replace(/^\//,""));pl()}class xg extends I{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),ku.add(this),vu.length>0)pl()}disconnectedCallback(){super.disconnectedCallback(),ku.delete(this)}}var z6=xg.elementCreator();var{div:V6,slot:X6,label:F6,span:Z6,input:ak}=Q;class To extends I{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(e){if(typeof e==="string")this._choices=To.parseChoicesString(e);else this._choices=e;this.queueRender()}static parseChoicesString(e){return e.split(",").filter((t)=>t.trim()!=="").map((t)=>{let[i,n]=t.split("=").map((a)=>a.trim()),[s,r]=(n||i).split(":").map((a)=>a.trim()),o=r?B[r]():"";return{value:i,icon:o,caption:s}})}value="";formDisabledCallback(e){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((e)=>e.trim()).filter((e)=>e!=="")}content=()=>[X6(),V6({part:"options"},ak({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:S.segmentedOptionGap("8px"),alignItems:S.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:S.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:S.segmentedOptionGap("8px"),gridTemplateColumns:S.segmentedOptionGridColumns("0px 24px 1fr"),padding:S.segmentedOptionPadding("4px 12px"),font:S.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:S.segmentedFocusShadow(`inset 0 0 0 2px ${S.segmentedOptionCurrentBackground("#44a")}`),borderRadius:S.segmentedOptionsBorderRadius("8px")},":host label.current":{color:S.segmentedOptionCurrentColor("#eee"),background:S.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:S.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${S.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:S.segmentOptionIconSize("16px"),stroke:S.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:S.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:S.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:S.segmentedOptionsBorderRadius("8px"),background:S.segmentedOptionsBackground("#fff"),color:S.segmentedOptionColor("#222"),overflow:"hidden",alignItems:S.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:S.segmentedOptionPadding("4px 12px"),color:S.segmentedOptionCurrentColor("#eee"),background:S.segmentedOptionCurrentBackground("#44a"),font:S.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:S.segmentedOptionCurrentColor("#eee"),opacity:S.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:e}=this.parts,{values:t,isOtherValue:i}=this;e.querySelectorAll("label").forEach((n)=>{let s=n.querySelector("input")?.value??"";n.classList.toggle("current",t.includes(s)||s===""&&i)})}handleChange=()=>{let{options:e,custom:t}=this.parts;if(this.multiple){let i=[...e.querySelectorAll("input:checked")];this.value=i.map((n)=>n.value).join(",")}else{let i=e.querySelector("input:checked");if(!i)this.value="";else if(i.value)t.setAttribute("hidden",""),this.value=i.value;else t.removeAttribute("hidden"),t.focus(),t.select(),this.value=t.value}this.syncCurrent()};handleKey=(e)=>{let t=!1;switch(e.code){case"Space":if(e.target instanceof HTMLLabelElement)e.target.click(),t=!0;break;case"Tab":if(!(e.target instanceof HTMLLabelElement))e.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let i=e.target.closest("label");if(i.previousElementSibling instanceof HTMLLabelElement)i.previousElementSibling.focus()}t=!0;break;case"ArrowRight":case"ArrowDown":{let i=e.target.closest("label");if(i.nextElementSibling instanceof HTMLLabelElement)i.nextElementSibling.focus()}t=!0;break}if(t)e.preventDefault(),e.stopPropagation()};connectedCallback(){super.connectedCallback();let e=this.getAttribute("choices");if(e&&this._choices.length===0)this._choices=To.parseChoicesString(e);let{options:t}=this.parts;if(this.name==="")this.name=this.instanceId;if(t.addEventListener("change",this.handleChange),t.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 e=[...this.choices];if(this.other&&!this.multiple){let[t,i]=this.other.split(":");e.push({value:"",caption:t,icon:i})}return e}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((e)=>e.value===this.value))}render(){super.render();let{options:e,custom:t}=this.parts,i=this.multiple?"checkbox":"radio",{values:n,isOtherValue:s}=this,r=this._choicesWithOther,o=(c)=>n.includes(c)||c===""&&s,a=[...e.querySelectorAll("label")];if(a.length===r.length&&a.every((c,h)=>c.querySelector("input")?.value===r[h].value))a.forEach((c)=>{let h=c.querySelector("input");if(h&&h.checked!==o(h.value))h.checked=o(h.value)});else e.textContent="",e.append(...r.map((c)=>F6({tabindex:0},ak({type:i,name:this.name,value:c.value,checked:o(c.value),tabIndex:-1}),c.icon||{class:"no-icon"},this.localized?on(c.caption):Z6(c.caption))));if(this.other&&!this.multiple){t.hidden=!s;let c=s?this.value:"";if(t.value!==c)t.value=c;if(t.placeholder=this.placeholder,t.parentElement!==e)e.append(t)}this.syncCurrent()}}var q6=To,lk=To.elementCreator(),W6=hi((...e)=>lk(...e),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:ck}=Q;class Tr extends I{static preferredTagName="tosi-sidenav";static initAttributes={minSize:800,navSize:200,compact:!1,contentVisible:!1,alwaysCompact:!1};value="normal";get navVisible(){return!this.compact||!this.contentVisible}set navVisible(e){if(e){this.alwaysCompact=!1,this.contentVisible=!1;return}let t=this.offsetParent;if(!(t?t.offsetWidth<this.minSize:!1))this.alwaysCompact=!0;this.contentVisible=!0}content=[ck({name:"nav",part:"nav"}),ck({part:"content"})];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:`${S.navWidth("50%")} ${S.contentWidth("50%")}`,gridTemplateRows:"100%",position:"relative",margin:S.margin("0 0 0 -100%"),transition:S.sideNavTransition("0.25s ease-out")},":host slot":{position:"relative"},":host slot:not([name])":{display:"block"},':host slot[name="nav"]':{display:"block"}};handleResize=()=>{let{content:e}=this.parts,t=this.offsetParent;if(t===null)return;let i;if(this.compact=this.alwaysCompact||t.offsetWidth<this.minSize,[...this.childNodes].find((s)=>s instanceof Element?s.getAttribute("slot")!=="nav":!0)===void 0)i="compact/nav",this.style.setProperty("--nav-width","100%"),this.style.setProperty("--content-width","0%");else if(!this.compact)i="normal",e.classList.add("-tosi-sidenav-visible"),this.style.setProperty("--nav-width",`${this.navSize}px`),this.style.setProperty("--content-width",`calc(100% - ${this.navSize}px)`),this.style.setProperty("--margin","0");else if(e.classList.remove("-tosi-sidenav-visible"),this.style.setProperty("--nav-width","50%"),this.style.setProperty("--content-width","50%"),this.contentVisible)i="compact/content",this.style.setProperty("--margin","0 0 0 -100%");else i="compact/nav",this.style.setProperty("--margin","0 -100% 0 0");if(this.value!==i)this.value=i;this.releaseTransition()};observer;connectedCallback(){super.connectedCallback(),this.contentVisible=this.parts.content.childNodes.length===0,globalThis.addEventListener("resize",this.handleResize),this.observer=new MutationObserver(this.handleResize),this.observer.observe(this,{childList:!0}),this.style.setProperty("--side-nav-transition","0s")}releaseTransition=()=>{if(!this.transitionSuppressed)return;this.transitionSuppressed=!1,requestAnimationFrame(()=>{this.style.removeProperty("--side-nav-transition")})};transitionSuppressed=!0;disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect()}render(){super.render(),this.handleResize()}}var H6=Tr,ml=Tr.elementCreator(),Y6=ml,U6=ml;var{slot:hk}=Q;class vg extends I{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[hk({part:"normal"}),hk({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:e,small:t}=this.parts,i=this.offsetParent;if(!(i instanceof HTMLElement))return;else if(i.offsetWidth<this.minWidth||i.offsetHeight<this.minHeight)e.hidden=!0,t.hidden=!1,this.value="small";else e.hidden=!1,t.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var G6=vg.elementCreator();class wu extends I{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:v.resizeIconFill}};content=B.resize();get minSize(){let{minWidth:e,minHeight:t}=getComputedStyle(this.target);return{width:parseFloat(e)||32,height:parseFloat(t)||32}}resizeTarget=(e)=>{let{target:t}=this;if(!t)return;let{offsetWidth:i,offsetHeight:n}=t;t.style.left=t.offsetLeft+"px",t.style.top=t.offsetTop+"px",t.style.bottom="",t.style.right="";let{minSize:s}=this;ki(e,(r,o,a)=>{if(t.style.width=Math.max(s.width,i+r)+"px",t.style.height=Math.max(s.height,n+o)+"px",a.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let e={passive:!0};this.addEventListener("mousedown",this.resizeTarget),this.addEventListener("touchstart",this.resizeTarget,e)}}var K6=wu,uk=wu.elementCreator(),J6=uk;var{div:Er,slot:dk,span:e8,button:t8}=Q;class Su extends I{static preferredTagName="tosi-tabs";static initAttributes={localized:!1};value=0;makeTab(e,t,i){let n=t.getAttribute("name"),s=t.querySelector('template[role="tab"]')?.content.cloneNode(!0)||(this.localized?on(n):e8(n)),r=Er(s,{part:"tab",tabindex:0,role:"tab",ariaControls:i},t.hasAttribute("data-close")?t8({title:"close",class:"close"},B.x()):{}),o=t.dataset.tooltip;if(o)r.dataset.tooltip=o;return r}static shadowStyleSpec={":host":{"--tosi-tabs-selected-color":"var(--xin-tabs-selected-color, var(--tosi-accent, currentColor))","--tosi-tabs-bar-color":"var(--xin-tabs-bar-color, #ccc)","--tosi-tabs-bar-height":"var(--xin-tabs-bar-height, 2px)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",boxShadow:"none !important"},slot:{position:"relative",display:"block",flex:"1",overflow:"hidden",overflowY:"auto"},'slot[name="after-tabs"]':{flex:"0 0 auto"},"::slotted([hidden])":{display:"none !important"},":host::part(tabpanel)":{display:"flex",flexDirection:"column",overflowX:"auto"},":host::part(tabrow)":{display:"flex"},":host .tabs":{display:"flex",userSelect:"none",whiteSpace:"nowrap"},":host .tabs > div":{padding:`${v.spacing50} ${v.spacing}`,cursor:"default",display:"flex",alignItems:"baseline"},":host .tabs > [aria-selected]":{"--text-color":v.tosiTabsSelectedColor,color:v.textColor},":host .elastic":{flex:"1"},":host .border":{background:v.tosiTabsBarColor},":host .border > .selected":{content:" ",width:0,height:v.tosiTabsBarHeight,background:v.tosiTabsSelectedColor,transition:"ease-out 0.2s"},":host button.close":{border:0,background:"transparent",textAlign:"center",marginLeft:v.spacing50,padding:0},":host button.close > svg":{height:"12px"}};handleCloseTab=null;get onCloseTab(){return this.handleCloseTab}set onCloseTab(e){this.handleCloseTab=e}content=[Er({role:"tabpanel",part:"tabpanel"},Er({part:"tabrow"},Er({class:"tabs",part:"tabs"}),Er({class:"elastic"}),dk({name:"after-tabs"})),Er({class:"border"},Er({class:"selected",part:"selected"}))),dk()];addTabBody(e,t=!1){if(!e.hasAttribute("name"))throw console.error("element has no name attribute",e),Error("element has no name attribute");if(this.append(e),this.setupTabs(),t)this.value=this.bodies.length-1;this.queueRender()}removeTabBody(e){e.remove(),this.setupTabs(),this.queueRender()}keyTab=(e)=>{let{tabs:t}=this.parts,i=[...t.children].indexOf(e.target);switch(e.key){case"ArrowLeft":this.value=(i+Number(t.children.length)-1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case"ArrowRight":this.value=(i+1)%t.children.length,t.children[this.value].focus(),e.preventDefault();break;case" ":this.pickTab(e),e.preventDefault();break;default:}};get bodies(){return[...this.children].filter((e)=>e.hasAttribute("name"))}pickTab=(e)=>{let{tabs:t}=this.parts,i=e.target,n=i.closest("button.close")!==null,s=i.closest(".tabs > div"),r=[...t.children].indexOf(s);if(n){let o=this.bodies[r];if(!this.handleCloseTab||this.handleCloseTab(o)!==!1)this.removeTabBody(this.bodies[r])}else if(r>-1)this.value=r};setupTabs=()=>{let{tabs:e}=this.parts,t=[...this.children].filter((i)=>!i.hasAttribute("slot")&&i.hasAttribute("name"));if(e.textContent="",this.value>=t.length)this.value=t.length-1;for(let i in t){let n=t[i],s=`${this.instanceId}-${i}`;n.id=s;let r=this.makeTab(this,n,s);e.append(r)}};connectedCallback(){super.connectedCallback();let{tabs:e}=this.parts;e.addEventListener("click",this.pickTab),e.addEventListener("keydown",this.keyTab),this.setupTabs(),jn.allInstances.add(this)}disconnectedCallback(){super.disconnectedCallback(),jn.allInstances.delete(this)}localeChanged=()=>{this.queueRender()};handleResize(){this.queueRender()}render(){let{tabs:e,selected:t}=this.parts,i=this.bodies;for(let n=0;n<i.length;n++){let s=i[n],r=e.children[n],o=this.value===Number(n);if(r.toggleAttribute("aria-selected",o),s.toggleAttribute("hidden",!o),o)t.style.marginLeft=`${r.offsetLeft-e.offsetLeft}px`,t.style.width=`${r.offsetWidth}px`}}}var i8=Su,gl=Su.elementCreator(),n8=gl,s8=gl;var{div:r8,input:o8,span:a8,button:kg}=Q,fk=(e)=>e.split(/(?<!\\),/).map((t)=>t.trim().replace(/\\,/g,",")),l8=(e)=>e.map((t)=>t.replace(/,/g,"\\,")).join(",");class yl extends I{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":S.brandColor("blue"),"--tag-text-color":S.brandTextColor("white"),display:"inline-flex",borderRadius:S.tagRoundedRadius(v.spacing50),color:v.tagTextColor,background:v.tagBg,padding:`0 ${v.spacing75} 0 ${v.spacing75}`,height:`calc(${v.lineHeight} + ${v.spacing50})`,lineHeight:`calc(${v.lineHeight} + ${v.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:S.fontSize("16px"),color:v.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${v.spacing_50} 0 ${v.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:v.spacing150,width:v.spacing150,color:v.tagCloseButtonColor,background:v.tagCloseButtonBg,borderRadius:S.tagCloseButtonRadius("99px"),opacity:v.tagButtonOpacity},':host [part="remove"]:hover':{background:v.tagCloseButtonBg,opacity:v.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[a8({part:"caption"},this.caption),kg(B.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var c8=yl,wg=yl.elementCreator(),h8=hi((...e)=>wg(...e),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class Eo extends I{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:v.tagListBg,gap:v.spacing25,borderRadius:S.taglistRoundedRadius(v.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${v.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${v.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:v.inputBg,borderRadius:S.tagContainerRadius(v.spacing50),boxShadow:v.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:v.spacing25,minHeight:`calc(${v.lineHeight} + ${v.spacing})`,padding:v.spacing25},':host [part="tagMenu"]':{width:v.touchSize,height:v.touchSize,lineHeight:v.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:v.brandColor,color:v.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return fk(this.value).filter((e)=>e!=="")}set tags(e){this.value=l8(e)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(e){if(typeof e==="string")this._availableTags=Eo.parseAvailableTagsString(e);else this._availableTags=e;this.queueRender()}static parseAvailableTagsString(e){return fk(e).map((t)=>t===""?null:t)}connectedCallback(){super.connectedCallback();let e=this.getAttribute("available-tags");if(e&&this._availableTags.length===0)this._availableTags=Eo.parseAvailableTagsString(e)}formDisabledCallback(e){this.disabled=e}formResetCallback(){this.value=""}addTag=(e)=>{let t=e.trim();if(t===""||this.tags.includes(t))return;this.tags=[...this.tags,t],this.queueRender(!0)};toggleTag=(e)=>{if(this.tags.includes(e))this.tags=this.tags.filter((t)=>t!==e),this.queueRender(!0);else this.addTag(e)};enterTag=(e)=>{let{tagInput:t}=this.parts;switch(e.key){case",":{let i=t.value.split(",")[0];this.addTag(i)}break;case"Enter":{let i=t.value.split(",")[0];this.addTag(i)}e.stopPropagation(),e.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:e}=this,{tagMenu:t}=this.parts,i=[...this.availableTags],n=this.tags.filter((r)=>!i.includes(r));if(n.length)i.push(null,...n);let s=i.map((r)=>{if(r===""||r===null)return null;else if(typeof r==="object")return{checked:()=>this.tags.includes(r.value),caption:r.caption,action(){e(r.value)}};else return{checked:()=>this.tags.includes(r),caption:r,action(){e(r)}}});bt({target:t,width:"auto",menuItems:s})};content=()=>[kg({type:"button",style:{visibility:"hidden"},tabindex:-1}),r8({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),o8({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),kg({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},B.chevronDown())];removeTag=(e)=>{if(this.editable&&!this.disabled){let t=e.target.closest(yl.tagName);this.tags=this.tags.filter((i)=>i!==t.caption),t.remove(),this.queueRender(!0)}e.stopPropagation(),e.preventDefault()};render(){super.render();let{tagContainer:e,tagMenu:t,tagInput:i}=this.parts;if(t.disabled=this.disabled,i.value="",i.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)t.toggleAttribute("hidden",!1),i.toggleAttribute("hidden",!this.textEntry);else t.toggleAttribute("hidden",!0),i.toggleAttribute("hidden",!0);e.textContent="";for(let n of this.tags)e.append(wg({caption:n,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var u8=Eo,pk=Eo.elementCreator(),d8=hi((...e)=>pk(...e),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var mk="1.15.2";var{span:f8}=Q,Ol=null,Cu=null,Tu=null,Vn="tosi-tooltip",p8={[`.${Vn}`]:{pointerEvents:"none",padding:S.tosiTooltipPadding("4px 10px"),borderRadius:S.tosiTooltipRadius("6px"),background:S.tosiTooltipBg("#333"),color:S.tosiTooltipColor("#fff"),fontSize:S.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:S.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${Vn} p`]:{margin:"0"},[`.${Vn} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${Vn} a`]:{color:"inherit"},[`.${Vn}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${Vn}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${Vn}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},gk=!1;function yk(){if(gk)return;gk=!0,Ft("tosi-tooltip",p8)}function $o(){if(Cu!==null)clearTimeout(Cu),Cu=null;if(Ol!==null)Ol.remove(),Ol=null;Tu=null}function m8(e){if(e.startsWith("s"))return"tt-s";if(e.startsWith("n"))return"tt-n";if(e.startsWith("e"))return"tt-e";if(e.startsWith("w"))return"tt-w";return"tt-s"}function g8(e,t,i){let n=t.getBoundingClientRect(),s=e.getBoundingClientRect(),r=n.left+n.width*0.5,o=n.top+n.height*0.5,a;if(i.startsWith("s")||i.startsWith("n"))a=Math.max(8,Math.min(s.width-8,r-s.left))-4;else a=Math.max(8,Math.min(s.height-8,o-s.top))-4;e.style.setProperty("--tosi-tooltip-arrow",a+"px")}function y8(e,t){if(t)e=me(e);let i=f8({class:Vn});return i.innerHTML=Le.parseInline(e),i}function O8(e,t,i){yk(),$o(),Tu=e;let{top:n,left:s,width:r}=e.getBoundingClientRect(),o=s+r*0.5,a=window.innerHeight,l=window.innerWidth,c=(n>a*0.5?"n":"s")+(o>l*0.5?"w":"e"),h=y8(t,i);h.classList.add(m8(c)),Ol=Xa({content:h,target:e,position:c,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(Ol&&Tu)g8(h,e,c)})}function b8(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.tooltip)return t;return null}function x8(e={}){yk();let{convertTitles:t=!0,delay:i=250,localize:n=!1}=e;document.addEventListener("pointermove",(s)=>{if(t){for(let a of s.composedPath())if(a instanceof HTMLElement&&a.title&&!a.dataset.tooltip){a.dataset.tooltip=a.title,a.removeAttribute("title");break}}let r=b8(s);if(r===Tu)return;if($o(),!r)return;let o=r.dataset.tooltip||null;if(!o)return;Cu=setTimeout(()=>O8(r,o,n),i)}),document.addEventListener("pointerleave",$o),document.addEventListener("pointerdown",$o),document.addEventListener("keydown",$o),window.addEventListener("scroll",$o,!0)}var oO={};Mi(oO,{CodeEditor:()=>Ss,codeEditor:()=>Cs});var{div:RP}=Q,LP=new Set,Qc=(e,t)=>{if(LP.has(e))return;LP.add(e),console.warn(`<tosi-code>.${e} was removed in tosijs-ui 1.7 (the editor is now CodeMirror 6, not ACE) — ${t}. See CHANGELOG 1.7.0.`)},QP=!1,Pf=!1;class Ss extends I{static preferredTagName="tosi-code";source="";_handle;_loadPromise;_loadGeneration=0;_appliedMode="";_appliedDisabled;_tjsAutocomplete;get tjsAutocomplete(){return this._tjsAutocomplete}set tjsAutocomplete(e){if(this._tjsAutocomplete=e,this._handle&&this.isTjsMode())this.applyTjsExtension()}get value(){return this._handle?this._handle.getValue():this.source}set value(e){if(this._handle)this._handle.setValue(e);else this.source=e}_original;get original(){return this._original??this.value}set original(e){this._original=e}diffOverlay;_pendingDiff;get showingDiff(){if(!this.hydrated)return this._pendingDiff??!1;return!this.parts.diffHost.hidden}diffResolvable=!1;diffOriginalLabel="Original";diffModifiedLabel="Modified";showDiff(e){if(!this.hydrated){this._pendingDiff=e;return}let{diffHost:t}=this.parts;if(e){if(this.diffOverlay===void 0)this.diffOverlay=nl(),t.append(this.diffOverlay);this.diffOverlay.resolvable=this.diffResolvable,this.diffOverlay.originalLabel=this.diffOriginalLabel,this.diffOverlay.modifiedLabel=this.diffModifiedLabel,this.diffOverlay.original=this.original,this.diffOverlay.modified=this.value}else if(this.diffOverlay!==void 0&&this.diffResolvable){let i=this.diffOverlay.value;if(i!==this.value)this.value=i,this.dispatchEvent(new CustomEvent("change",{detail:{value:i}}))}t.hidden=!e}static initAttributes={mode:"javascript",disabled:!1};role="code editor";get editor(){if(!QP)QP=!0,console.info("<tosi-code>.editor is the CodeMirror 6 EditorView (the supported accessor; it was an ACE editor in 1.6). ACE-era `editor.session` / `getSession()` / "+"`setOption()` are gone — use undo()/redo()/canUndo()/canRedo() for history.");return this._handle?.view}get theme(){return Qc("theme","style the editor with --code-bg / --text-color instead"),""}set theme(e){Qc("theme","style the editor with --code-bg / --text-color instead")}get options(){return Qc("options","configure CodeMirror via the `editor` (EditorView) instead"),{}}set options(e){Qc("options","configure CodeMirror via the `editor` (EditorView) instead")}get ace(){Qc("ace","use `editor`, which is now a CodeMirror EditorView");return}undo(){this._handle?.undo()}redo(){this._handle?.redo()}canUndo(){return this._handle?.canUndo()??!1}canRedo(){return this._handle?.canRedo()??!1}content=()=>[RP({part:"host"}),RP({part:"diffHost",hidden:!0})];static shadowStyleSpec={":host":{display:"block",position:"relative",width:"100%",height:"100%"},'[part="host"]':{height:"100%"},'[part="diffHost"]':{position:"absolute",inset:"0",zIndex:"5",overflow:"auto",_background:S.codeBg(S.inputBg("#fdfdfd")),background:S.tosiDiffBg(S.codeBg("#fdfdfd"))},".cm-editor":{height:"100%"},".cm-scroller":{outline:"none",fontFamily:"Menlo, Monaco, Consolas, 'Courier New', monospace"}};handleResize(){this._handle?.refresh()}connectedCallback(){if(super.connectedCallback(),this.source==="")this.value=this.textContent!==null?this.textContent.trim():"";if(this._pendingDiff!==void 0){let e=this._pendingDiff;this._pendingDiff=void 0,this.showDiff(e)}if(this._loadPromise===void 0){let e=++this._loadGeneration;this._loadPromise=Promise.resolve().then(() => (rO(),sO)).then(({createCmEditor:t})=>{if(e!==this._loadGeneration||!this.isConnected)return;let i=t(this.parts.host,{value:this.source,mode:this.mode,readOnly:this.disabled,root:this.shadowRoot??void 0,onChange:(n)=>this.dispatchEvent(new CustomEvent("change",{detail:{value:n}}))});return this._handle=i,this._appliedMode=this.mode,this._appliedDisabled=this.disabled,this.applyTjsExtension(),i})}}disconnectedCallback(){if(super.disconnectedCallback(),this._handle)this.source=this._handle.getValue(),this._handle.destroy(),this._handle=void 0;this._loadPromise=void 0,this._appliedMode="",this._appliedDisabled=void 0}isTjsMode(){return this.mode==="tjs"||this.mode==="ajs"}applyTjsExtension(){let e=this._handle;if(!e||!this.isTjsMode())return;Promise.resolve().then(() => (rO(),sO)).then(({loadTjsExtension:t})=>t(this._tjsAutocomplete??{})).then((t)=>{if(t&&this._handle===e&&this.isTjsMode()){e.setLanguageExtension(t),this._tjsExtensionApplied=!0;return}if(!t&&this._handle===e&&this.isTjsMode()&&!Pf)Pf=!0,console.warn(`<tosi-code mode="${this.mode}">: tjs-lang's CodeMirror extension did not load — `+"falling back to TypeScript highlighting (no tjs autocomplete). Install the optional peer `tjs-lang`, or check that tjs-lang/editors/codemirror still exports `tjsEditorExtension`.")}).catch((t)=>{if(!Pf)Pf=!0,console.warn("<tosi-code>: failed to apply the tjs extension —",t)})}get tjsExtensionApplied(){return this._tjsExtensionApplied}_tjsExtensionApplied=!1;render(){if(super.render(),this._handle){if(this.disabled!==this._appliedDisabled)this._handle.setReadOnly(this.disabled),this._appliedDisabled=this.disabled;if(this.mode!==this._appliedMode)this._handle.setMode(this.mode),this._appliedMode=this.mode,this.applyTjsExtension()}}}var Cs=Ss.elementCreator();var dO={};Mi(dO,{HighlightBlock:()=>uO,tosiHighlight:()=>eF});var gX=new Set(["js","ts","tjs","html","css","test"]);function da(e,t,i="auto"){if(i==="none")return!1;if(!gX.has(e.toLowerCase()))return!1;if(t==="static")return!1;return i==="opt-in"?t!==void 0:!0}function Af(e){let t=String(e||"");return{lang:t.match(/^[a-z]+/)?.[0]??"",mode:t.match(/:([a-z]+)/)?.[1],id:t.match(/#([A-Za-z0-9_-]+)/)?.[1]}}var ZX=new Set(["markup","html","xml","css","clike","javascript","js"]),qX={js:"javascript",ts:"typescript",tjs:"javascript",jsx:"jsx",tsx:"tsx",html:"markup",xml:"markup",svg:"markup",vue:"markup",sh:"bash",shell:"bash",zsh:"bash",console:"bash",yml:"yaml",md:"markdown",rs:"rust",py:"python",rb:"ruby",golang:"go","c++":"cpp",cs:"csharp",scss:"scss",less:"less",json5:"json5",dockerfile:"docker",make:"makefile",test:"javascript"},aO=new Map;function pA(e){let t=e.toLowerCase();if(aO.has(t))return t;return qX[t]??t}var WX={bash:()=>Promise.resolve().then(() => (IP(),yX)),c:()=>Promise.resolve().then(() => (BP(),OX)),cpp:()=>Promise.resolve().then(() => (NP(),bX)),csharp:()=>Promise.resolve().then(() => (jP(),xX)),diff:()=>Promise.resolve().then(() => (DP(),vX)),docker:()=>Promise.resolve().then(() => (zP(),kX)),go:()=>Promise.resolve().then(() => (VP(),wX)),graphql:()=>Promise.resolve().then(() => (XP(),SX)),ini:()=>Promise.resolve().then(() => (FP(),CX)),java:()=>Promise.resolve().then(() => (ZP(),TX)),json:()=>Promise.resolve().then(() => (qP(),EX)),jsx:()=>Promise.resolve().then(() => (WP(),$X)),kotlin:()=>Promise.resolve().then(() => (HP(),PX)),less:()=>Promise.resolve().then(() => (YP(),AX)),makefile:()=>Promise.resolve().then(() => (UP(),_X)),markdown:()=>Promise.resolve().then(() => (GP(),MX)),php:()=>Promise.resolve().then(() => (KP(),RX)),python:()=>Promise.resolve().then(() => (JP(),LX)),ruby:()=>Promise.resolve().then(() => (eA(),QX)),rust:()=>Promise.resolve().then(() => (tA(),IX)),scss:()=>Promise.resolve().then(() => (iA(),BX)),sql:()=>Promise.resolve().then(() => (nA(),NX)),swift:()=>Promise.resolve().then(() => (sA(),jX)),toml:()=>Promise.resolve().then(() => (rA(),DX)),tsx:()=>Promise.resolve().then(() => (oA(),zX)),typescript:()=>Promise.resolve().then(() => (aA(),VX)),yaml:()=>Promise.resolve().then(() => (lA(),XX))};var HX=/language-([A-Za-z0-9_+#-]+)/;function hA(e){return(String(e??"").match(HX)?.[1]??"").toLowerCase()}var En,uA=!1,dA=new Map,fA=new WeakMap;function YX(e){let t=e;return!!t&&typeof t.highlight==="function"&&typeof t.languages==="object"}function UX(){for(let e of[globalThis,typeof window<"u"?window:void 0]){if(!e)continue;let t=e.Prism;if(YX(t))return t}return null}async function lO(e){let t=pA(e);if(!En){let s=UX();if(s)En=s}if(!En){for(let s of[globalThis,typeof window<"u"?window:void 0]){if(!s)continue;let r=s;fA.set(s,r.Prism),r.Prism={...r.Prism??{},manual:!0}}try{En=(await Promise.resolve().then(() => F3(cA(),1))).default}catch{for(let s of[globalThis,typeof window<"u"?window:void 0]){if(!s)continue;let r=s,o=fA.get(s);if(o===void 0)delete r.Prism;else r.Prism=o}if(!uA)uA=!0,console.warn("prismjs could not be loaded — static code blocks will not be syntax-highlighted "+"(site, ePub and print alike). It is a dependency of tosijs-ui, so this usually means a broken install: try reinstalling.");return!1}}let i=aO.get(e.toLowerCase());if(i)return En.languages[e.toLowerCase()]=i,!0;if(En.languages[t])return!0;if(ZX.has(t))return Boolean(En.languages[t]);let n=dA.get(t);if(!n)n=(async()=>{let s=WX[t];if(!s)return!1;try{await s()}catch(r){return console.warn(`prismjs grammar "${t}" failed to load — code blocks in that language `+"will not be highlighted.",r),!1}return Boolean(En.languages[t])})(),dA.set(t,n);return n}function cO(e,t){let i=t.toLowerCase(),n=aO.has(i)?i:pA(t),s=En?.languages[n];if(!En||!s)return null;return En.highlight(e,s,n)}var GX=(e)=>!e.querySelector(".token")&&!e.hasAttribute("data-highlighted");async function Mf(e,t={}){let i=t.liveExampleTag??"tosi-example",n=t.policy??"auto",s=[...e.querySelectorAll('pre > code[class*="language-"]')].filter((c)=>GX(c)).filter((c)=>!c.closest(i)).filter((c)=>{let h=c,u=h.parentElement?.getAttribute("data-example-mode")??void 0;return!da(hA(h.className),u,n)});if(s.length===0)return 0;let r=(c)=>hA(c.className),o=[...new Set(s.map(r))].filter(Boolean),a=new Set;await Promise.all(o.map(async(c)=>{if(await lO(c))a.add(c)}));let l=0;for(let c of s){let h=r(c);if(!a.has(h))continue;let u=cO(c.textContent??"",h);if(u===null)continue;c.innerHTML=u,c.setAttribute("data-highlighted",""),l+=1}return l}var hO={".token.comment, .token.prolog, .token.cdata":{fontStyle:"italic",color:S.tokenComment("#5c6f5c")},".token.punctuation":{color:S.tokenPunctuation("#666666")},".token.string, .token.char, .token.attr-value, .token.regex":{color:S.tokenString("#a03030")},".token.number, .token.boolean, .token.constant":{color:S.tokenNumber("#0b7285")},".token.keyword, .token.important, .token.atrule":{color:S.tokenKeyword("#0a5bb5")},".token.function, .token.class-name":{color:S.tokenFunction("#7a4b00")},".token.operator, .token.entity, .token.url":{color:S.tokenOperator("#444444")},".token.tag, .token.selector, .token.builtin":{color:S.tokenTag("#0a6b52")},".token.attr-name, .token.property":{color:S.tokenAttr("#2a5db0")},".token.deleted":{color:S.tokenDeleted("#b02020")},".token.inserted":{color:S.tokenInserted("#2a6b2a")},".token.bold":{fontWeight:"bold"},".token.italic":{fontStyle:"italic"},".darkmode .token.comment, .darkmode .token.prolog, .darkmode .token.cdata":{color:S.tokenCommentDark("#6a9955")},".darkmode .token.punctuation":{color:S.tokenPunctuationDark("#8a8a8a")},".darkmode .token.string, .darkmode .token.char, .darkmode .token.attr-value, .darkmode .token.regex":{color:S.tokenStringDark("#ce9178")},".darkmode .token.number, .darkmode .token.boolean, .darkmode .token.constant":{color:S.tokenNumberDark("#b5cea8")},".darkmode .token.keyword, .darkmode .token.important, .darkmode .token.atrule":{color:S.tokenKeywordDark("#569cd6")},".darkmode .token.function, .darkmode .token.class-name":{color:S.tokenFunctionDark("#dcdcaa")},".darkmode .token.operator, .darkmode .token.entity, .darkmode .token.url":{color:S.tokenOperatorDark("#d4d4d4")},".darkmode .token.tag, .darkmode .token.selector, .darkmode .token.builtin":{color:S.tokenTagDark("#4ec9b0")},".darkmode .token.attr-name, .darkmode .token.property":{color:S.tokenAttrDark("#9cdcfe")},".darkmode .token.deleted":{color:S.tokenDeletedDark("#f48771")},".darkmode .token.inserted":{color:S.tokenInsertedDark("#6a9955")}},mA=!1;function gA(){if(mA)return;mA=!0,Ft("tosi-highlight-tokens",hO)}var{pre:KX,code:JX}=Q;class uO extends I{static preferredTagName="tosi-highlight";static initAttributes={language:""};_value="";_rendered="";get value(){return this._value}set value(e){if(e===this._value)return;this._value=e,this.queueRender()}static lightStyleSpec={"tosi-highlight":{display:"block"}};content=()=>[KX({part:"pre"},JX({part:"code"}))];render(){super.render(),gA();let e=this.parts.code,t=this.language.toLowerCase(),i=this._value;if(this._rendered===`${t}\x00${i}`)return;if(this._rendered=`${t}\x00${i}`,e.className=t?`language-${t}`:"",e.textContent=i,!t||!i)return;lO(t).then((n)=>{if(!n)return;if(this._value!==i)return;let s=cO(i,t);if(s===null)return;let r=this.parts.code;if(r.textContent!==i)return;r.innerHTML=s,r.setAttribute("data-highlighted","")}).catch((n)=>{console.warn(`<tosi-highlight>: highlighting "${t}" failed`,n)})}}var eF=uO.elementCreator();var DO={};Mi(DO,{createDocBrowser:()=>jO,hasTestBlock:()=>i3});var tF=/^readme\.md$/i;function yA(e){if(tF.test(e))return"";return e.replace(/\.[^.]+$/,"")}function fa(e){let t={};for(let n of e){let s=yA(n.filename);t[s]=(t[s]||0)+1}let i={};for(let n of e){let s=yA(n.filename);i[n.filename]=s!==""&&t[s]>1?n.filename.replace(/\./g,"-"):s}return i}function fO(e){return e===""?"/":`/${e}/`}function bA(e,t){let i=e.replace(/^\?/,"");if(!i||i.includes("=")||i.includes("&"))return null;let n=decodeURIComponent(i),s=t[n];if(s===void 0)return null;return fO(s)}function iF(e){return e.replace(/^\/+/,"").replace(/\/+$/,"").replace(/\/index\.html$/i,"")}function pO(e,t){let i=iF(e);for(let[n,s]of Object.entries(t))if(s===i)return n;return""}function OA(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function mO(e,t,i){if(!e)return"";for(let s of t)if(s.filename===e)return s.filename;for(let s of t)if(i[s.filename]===e)return s.filename;let n=OA(e);for(let s of t)if(i[s.filename]===n)return s.filename;for(let s of t)if(s.title&&OA(s.title)===n)return s.filename;return""}function xA(e){return e.pin==="top"?0:e.pin==="bottom"?2:1}function nF(e,t){return xA(e)-xA(t)||(e.order??500)-(t.order??500)||(e.title||"").toLocaleLowerCase().localeCompare((t.title||"").toLocaleLowerCase())||e.filename.localeCompare(t.filename)}function Rf(e,t){let i=new Map;for(let o of e)i.set(o.filename,{doc:o,slug:t[o.filename]??"",children:[],depth:0});let n=new Map;for(let o of e){let a=o.parent?mO(o.parent,e,t):"";if(a&&(a===o.filename||!i.has(a)||sF(o.filename,a,e,t)))a="";n.set(o.filename,a)}let s=[];for(let o of e){let a=n.get(o.filename)||"",l=i.get(o.filename);if(a)i.get(a).children.push(l);else s.push(l)}let r=(o,a)=>{o.sort((l,c)=>nF(l.doc,c.doc));for(let l of o)l.depth=a,r(l.children,a+1)};return r(s,0),s}function sF(e,t,i,n){let s=new Map(i.map((a)=>[a.filename,a])),r=t,o=new Set([e]);while(r){if(o.has(r))return!0;o.add(r);let a=s.get(r);r=a?.parent?mO(a.parent,i,n):""}return!1}var rF=new Co,OO,bO=new mu;bO.use({renderer:{code(e){let t=Af(String(e.lang||"")),i=t.lang,n=t.id??"",s=t.mode??"",r=OO?.get(e.text);if(!n&&!s&&!r)return!1;let o=rF.code({...e,lang:i}),a=[n&&`data-example-id="${n}"`,s&&`data-example-mode="${s}"`].filter(Boolean).join(" ");if(a)o=o.replace(/^<pre>/,`<pre ${a}>`);if(r){let l=JSON.stringify(r.js).replace(/</g,"\\u003c");o+=`<script type="application/tosi-transpiled" data-dialect="${r.dialect}">${l}</script>`}return o}}});function gO(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function oF(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var aF=new mu,yO=new Map,pa=[];bO.use({hooks:{preprocess(e){return yO=new Map,pa=[],e},postprocess(e){if(pa.length===0)return e;let t=pa.map((i)=>{let n=aF.parseInline(yO.get(i)??""),s=gO(i);return`<li id="fn-${s}"><p>${n} <a href="#fnref-${s}" class="footnote-backref" aria-label="Back to reference">↩</a></p></li>`}).join(`
|
|
156
156
|
`);return`${e}
|
|
157
157
|
<section class="footnotes" role="doc-endnotes">
|
|
158
158
|
<hr />
|
|
@@ -329,5 +329,5 @@ ${t.autoPrint?'<script>addEventListener("load",function(){setTimeout(function(){
|
|
|
329
329
|
</body>
|
|
330
330
|
</html>`}function o3(e,t,i={}){let{delayMs:n=300,setTimeoutFn:s=setTimeout}=i;return new Promise((r)=>{let o=()=>{t().catch(()=>{}).then(()=>{s(()=>e.print(),n),r()})};if(e.document.readyState==="complete")o();else e.addEventListener("load",o,{once:!0})})}var a3=200,hZ=600;function uZ(e={}){let t=K.fromCss(e.accent??"#d92270");return{_textColor:e.text??"#222",_brandColor:t,_background:e.background??"#fafafa",_buttonBg:e.buttonBg??"#fdfdfd",_inputBg:e.inputBg??"#fdfdfd",_backgroundShaded:"#f5f5f5",_navBg:t.rotate(30).desaturate(0.5).brighten(0.9),_barColor:t.opacity(0.4),_focusColor:t.opacity(0.7),_placeholderColor:t.opacity(0.4),_brandTextColor:t.contrasting(),_insetBg:t.rotate(45).brighten(0.8),_codeBg:e.codeBg??"#fdfdfd",_linkColor:t.rotate(-30).darken(0.5),_shadowColor:"#0004",_menuBg:"#fafafa",_menuItemActiveColor:"#000",_menuItemIconActiveColor:"#000",_menuItemActiveBg:"#aaa",_menuItemHoverBg:"#eee",_menuItemColor:"#222",_menuSeparatorColor:"#2224",_menuShadow:"0 4px 8px #0004",_scrollThumbColor:"#0006",_scrollBarColor:"#0001",_inputBorderShadow:"inset 0 0 2px #0006"}}function l3(e={}){let t=uZ(e),i=K.fromCss(e.accent??"#d92270");return{"@import":"https://fonts.googleapis.com/css2?family=Aleo:ital,wght@0,100..900;1,100..900&famiSpline+Sans+Mono:ital,wght@0,300..700;1,300..700&display=swap",":root":{_fontFamily:"'Aleo', sans-serif",_codeFontFamily:"'Spline Sans Mono', monospace",_fontSize:"16px",_codeFontSize:"14px",...t,_tosiAccent:v.brandColor,_tosiBg:v.background,_tosiText:v.textColor,_tosiBgInset:v.insetBg,_spacing:"10px",_lineHeight:"calc(var(--font-size) * 1.6)",_h1Scale:"2",_h2Scale:"1.5",_h3Scale:"1.25",_touchSize:"32px",_headerHeight:"calc( var(--line-height) * var(--h2-scale) + var(--spacing) * 2 )",_docContentMaxWidth:"44em"},'tosi-doc-system[data-layout="full-width"]':{_docContentMaxWidth:"none"},'tosi-doc-system[data-layout="full-screen"]':{_docContentMaxWidth:"none"},'tosi-doc-system[data-layout="full-screen"] .doc-content':{height:"100%",_docContentPadding:"0",_docContentOverflow:"auto"},'tosi-doc-system[data-layout="full-screen"] > .doc-nav.doc-nav, tosi-doc-system[data-layout="full-screen"] > .doc-navbar.doc-navbar':{display:"none"},".darkmode":{...ja(t),_brandColor:i.brighten(0.18),_shadowColor:i.opacity(0.5),_menuShadow:`0 0 0 2px ${i.opacity(0.75)}`,_menuSeparatorColor:i.opacity(0.5)},".high-contrast":{filter:"contrast(2)"},"*":{boxSizing:"border-box",scrollbarColor:`${v.scrollThumbColor} ${v.scrollBarColor}`,scrollbarWidth:"thin"},body:{fontFamily:v.fontFamily,fontSize:v.fontSize,margin:"0",lineHeight:v.lineHeight,background:v.background,_tosiTabsSelectedColor:v.brandColor,_tosiTabsBarColor:v.brandTextColor,_menuItemIconColor:v.brandColor,color:v.textColor},"tosi-doc-system":{display:"block"},"tosi-doc-system tosi-sidenav::part(nav)":{background:v.navBg},"tosi-doc-system:not(:defined)":{display:"block",position:"fixed",inset:`${v.headerHeight} 0 0 0`,overflow:"auto"},"tosi-doc-system:not(:defined)::before":{content:'""',position:"fixed",top:"0",left:"0",right:"0",height:v.headerHeight,background:v.brandColor},"tosi-doc-system:not(:defined) .doc-content":{display:"block",maxWidth:v.docContentMaxWidth,margin:"auto",padding:"var(--doc-content-padding, 0 1em)",overflow:"var(--doc-content-overflow, hidden)"},"tosi-doc-system:not(:defined) .doc-navbar":{display:"none"},"tosi-doc-system:not(:defined) pre:has(> code.language-test)":{display:"none"},"tosi-doc-system:not(:defined) .doc-nav":{display:"none"},[`@media (min-width: ${hZ}px)`]:{"tosi-doc-system:not(:defined)":{left:`${a3}px`},"tosi-doc-system:not(:defined) .doc-nav":{display:"block",position:"fixed",left:"0",top:v.headerHeight,bottom:"0",width:`${a3}px`,overflow:"auto",background:v.navBg,padding:"0"},"tosi-doc-system:not(:defined) .doc-nav summary":{cursor:"pointer"}},".center":{display:"flex",alignItems:"center",justifyContent:"center"},"input, button, select, textarea":{fontFamily:v.fontFamily,fontSize:v.fontSize,color:"currentColor",background:v.inputBg},select:{WebkitAppearance:"none",appearance:"none"},header:{background:v.brandColor,color:v.brandTextColor,_textColor:v.brandTextColor,_linkColor:v.brandTextColor,display:"flex",alignItems:"center",padding:"0 var(--spacing)",lineHeight:"calc(var(--line-height) * var(--h1-scale))",height:v.headerHeight,whiteSpace:"nowrap"},h1:{color:v.brandColor,fontSize:"calc(var(--font-size) * var(--h1-scale))",lineHeight:"calc(var(--line-height) * var(--h1-scale))",fontWeight:"400",borderBottom:`4px solid ${v.barColor}`,margin:`${v.spacing} 0 ${v.spacing200}`,padding:0},"header h2":{color:v.brandTextColor,whiteSpace:"nowrap"},h2:{color:v.brandColor,fontSize:"calc(var(--font-size) * var(--h2-scale))",lineHeight:"calc(var(--line-height) * var(--h2-scale))",margin:"calc(var(--spacing) * var(--h2-scale)) 0"},h3:{fontSize:"calc(var(--font-size) * var(--h3-scale))",lineHeight:"calc(var(--line-height) * var(--h3-scale))",margin:"calc(var(--spacing) * var(--h3-scale)) 0"},"input[type=search]":{borderRadius:99},blockquote:{position:"relative",background:v.insetBg,margin:"0 48px 56px 0",borderRadius:v.spacing,padding:"var(--spacing) calc(var(--spacing) * 2)",filter:`drop-shadow(0px 1px 1px ${v.shadowColor})`},"blockquote > :first-child":{marginTop:"0"},"blockquote > :last-child":{marginBottom:"0"},"blockquote::before":{content:'" "',display:"block",width:1,height:1,border:"10px solid transparent",borderTopColor:v.insetBg,borderRightColor:v.insetBg,position:"absolute",bottom:-20,right:24},"blockquote::after":{content:'" "',width:48,height:48,display:"block",bottom:-48,right:-24,position:"absolute",background:za(B.tosi(),void 0,void 0,2)},a:{textDecoration:"none",color:v.linkColor,opacity:"0.9",borderBottom:"1px solid var(--brand-color)"},"button, select, .clickable":{display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"ease-out 0.2s",color:v.brandColor,textDecoration:"none",background:v.buttonBg,padding:"0 calc(var(--spacing) * 1.25)",border:"none",borderRadius:"calc(var(--spacing) * 0.5)"},"button, select, .clickable, input":{lineHeight:"calc(var(--line-height) + var(--spacing))"},"input, textarea":{border:"none",outline:"none",borderRadius:"calc(var(--spacing) * 0.5)",boxShadow:v.inputBorderShadow},input:{padding:"0 calc(var(--spacing) * 1.5)"},"::placeholder":{color:v.placeholderColor},img:{verticalAlign:"middle"},"button:hover, .clickable:hover":{boxShadow:"inset 0 0 0 2px var(--brand-color)"},"button:active, .clickable:active":{background:v.brandColor,color:v.brandTextColor},label:{display:"inline-flex",gap:"calc(var(--spacing) * 0.5)",alignItems:"center"},".elastic":{flex:"1 1 auto",overflow:"hidden",position:"relative"},"svg.tosi-icon, button svg":{fill:"currentColor",pointerEvents:"none"},"[aria-selected]":{background:"#08835820"},":disabled":{opacity:"0.5",filter:"saturate(0)",pointerEvents:"none"},pre:{background:v.codeBg,padding:v.spacing,borderRadius:"calc(var(--spacing) * 0.25)",overflow:"auto",fontSize:v.codeFontSize,lineHeight:"calc(var(--font-size) * 1.2)"},"pre, code":{fontFamily:v.codeFontFamily,color:v.brandColor},...hO,".transparent, .iconic":{background:"none"},".iconic":{padding:"0",fontSize:"150%",height:"calc(var(--line-height) + var(--spacing))",lineHeight:"calc(var(--line-height) + var(--spacing))",width:"calc(var(--line-height) + var(--spacing))",textAlign:"center"},".transparent:hover, .iconic:hover":{background:"#0002",boxShadow:"none",color:v.textColor},".transparent:active, .iconic:active":{background:"#0004",boxShadow:"none",color:v.textColor},".current, summary:has(.current)":{background:v.background},".doc-link":{cursor:"pointer",borderBottom:"none",transition:"0.15s ease-out",marginLeft:"10px",padding:"calc(var(--spacing) * 0.5) calc(var(--spacing) * 1.5)"},".doc-link:not(.current):hover":{background:v.background},".doc-link:not(.current)":{opacity:"0.8",marginLeft:0},"tosi-example":{margin:"var(--spacing) 0"},"tosi-example [part=editors]":{background:v.insetBg},"[class*='icon-'], tosi-icon":{color:"currentcolor",pointerEvents:"none"},"[class*='icon-']":{verticalAlign:"middle"},table:{borderCollapse:"collapse"},thead:{background:v.brandColor,color:v.brandTextColor},tbody:{background:v.background},"tr:nth-child(2n)":{background:v.backgroundShaded},"th, td":{padding:"calc(var(--spacing) * 0.5) var(--spacing)"},".doc-nav ul, .doc-nav li":{listStyle:"none",margin:0,padding:0},".doc-nav li":{display:"flex",flexDirection:"column"},".doc-nav":{display:"flex",flexDirection:"column"},".doc-nav details > ul":{paddingLeft:v.spacing},".doc-nav details:not([open]) > ul":{display:"none"},".doc-nav summary":{cursor:"pointer",paddingLeft:"calc(var(--spacing) * 0.5)"},".doc-nav summary::marker":{color:v.brandColor},".doc-nav summary > .doc-link":{display:"inline-block",paddingLeft:"calc(var(--spacing) * 0.5)"},".doc-navbar":{listStyle:"none",display:"flex",flexWrap:"wrap",gap:v.spacing,margin:0,padding:v.spacing}}}var{h2:dZ,code:fZ}=Q,pZ=/^(#[0-9a-f]{3,8}|(?:rgb|hsl)a?\([^)]*\))$/i;class c3 extends I{static preferredTagName="tosi-css-var-editor";static initAttributes={elementSelector:"",targetSelector:""};content=()=>[dZ({part:"title"},"CSS variables"),ru({part:"variables",changeCallback:this.update})];retryTimer;retries=0;loadVars=()=>{let{title:e,variables:t}=this.parts;if(t.textContent="",!this.elementSelector)return;e.textContent=`CSS variables for ${this.elementSelector}`;let i=document.querySelector(this.elementSelector);if(!i){if(this.retries++<40)this.retryTimer=setTimeout(this.loadVars,250);return}let n=i.shadowRoot?i.shadowRoot.querySelector("style"):document.querySelector(`style#${this.elementSelector}-component`);if(!n||!n.textContent)return;let s=getComputedStyle(i),r=[...new Set(n.textContent.match(/--[\w-]+/g)??[])];for(let o of r){let a=s.getPropertyValue(o).trim(),l=pZ.test(a)?"color":"string";if(l==="color")a=K.fromCss(a).html;t.append(su(fZ(o),{key:o,value:a,type:l}))}};update=()=>{let e=this.targetSelector||this.elementSelector;if(!e)return;let t=[...document.querySelectorAll(e)],{value:i}=this.parts.variables;for(let n of t)for(let s of Object.keys(i))n.style.setProperty(s,i[s])};connectedCallback(){super.connectedCallback(),this.retries=0,this.loadVars(),this.parts.variables.addEventListener("change",this.update)}disconnectedCallback(){if(super.disconnectedCallback(),this.retryTimer)clearTimeout(this.retryTimer)}}var Hte=c3.elementCreator();var{button:kZ,div:wZ}=Q,g3="tosi-doc-system-prefs",O3=3,SZ=250,y3=4000;function CZ(e){return e===429||e>=500}async function b3(e){let t;for(let i=0;i<O3;i++){if(i>0){let n=Math.min(y3,SZ*2**(i-1));await new Promise((s)=>setTimeout(s,Math.random()*n))}try{let n=await fetch(e);if(!n.ok){let s=Error(`${n.status} ${n.statusText}`);if(!CZ(n.status))return Promise.reject(s);t=s;let r=Number(n.headers.get("retry-after"));if(Number.isFinite(r)&&r>0)await new Promise((o)=>setTimeout(o,Math.min(r*1000,y3)));continue}return await n.json()}catch(n){if(n instanceof SyntaxError)throw n;t=n}}throw t}class FO extends I{static preferredTagName="tosi-doc-system";static initAttributes={docs:"/docs.json",config:"",localized:"",routing:"",route:"",accent:"",background:"",text:""};context;content=null;corpus;browser;appliedRoute="";suppressed=!1;nestingDepth(){let e=0,t=this.parentNode;while(t){if(t.nodeType===Node.ELEMENT_NODE&&t.tagName==="TOSI-DOC-SYSTEM")e++;t=t.parentNode||t.host||null}return e}prefs;stylesApplied=!1;applyStyles(){if(this.stylesApplied)return;if(this.stylesApplied=!0,!document.querySelector("link[data-tosi-doc-system]"))Ft("tosi-doc-system",l3({accent:this.accent||void 0,background:this.background||void 0,text:this.text||void 0}))}applyThemePrefs=()=>{let e=this.prefs.theme.value,t=e==="dark"||e==="system"&&matchMedia("(prefers-color-scheme: dark)").matches,i=this.prefs.highContrast.value;document.body.classList.toggle("darkmode",t),document.body.classList.toggle("high-contrast",i),document.documentElement.classList.toggle("darkmode",t),document.documentElement.classList.toggle("high-contrast",i)};persistPrefs(){try{localStorage.setItem(g3,JSON.stringify({theme:this.prefs.theme.value,highContrast:this.prefs.highContrast.value,locale:this.prefs.locale.value}))}catch{}}initPrefs(){let e={};try{e=JSON.parse(localStorage.getItem(g3)||"{}")}catch{}this.prefs=It({prefs:{theme:e.theme||"system",highContrast:e.highContrast||!1,locale:e.locale||""}}).prefs,this.applyThemePrefs(),matchMedia("(prefers-color-scheme: dark)").addEventListener("change",this.applyThemePrefs),this.prefs.theme.observe(()=>{this.applyThemePrefs(),this.persistPrefs()}),this.prefs.highContrast.observe(()=>{this.applyThemePrefs(),this.persistPrefs()}),this.prefs.locale.observe(()=>this.persistPrefs())}async initLocale(){if(!this.localized)return;try{let e=await(await fetch(this.localized)).text();if(gm(e),this.prefs.locale.value)Mh(this.prefs.locale.value)}catch(e){console.warn("<tosi-doc-system> could not load localization from",this.localized,e)}}settingsButton(){return kZ({class:"iconic",style:{color:v.linkColor},title:"settings",onClick:(e)=>{let t=[],i="";try{i=JSON.parse(this.config||"{}").projectName||""}catch{}let n=i||document.title||"Documentation";t.push({caption:"Print as PDF",icon:"printer",action:()=>{let a=window.open("","_blank");if(!a){window.alert("Allow pop-ups to print the documentation as a book.");return}a.document.open(),a.document.write(r3(this.corpus,{title:n,autoPrint:!1})),a.document.close(),o3(a,()=>Mf(a.document,{policy:"none"}))}}),t.push({caption:"Download ePub",icon:"book",action:()=>{let a=document.createElement("a");a.href=`/${Wf(n)}.epub`,a.download="",a.click()}}),t.push(null);let s=Fe.localeOptions.value||[];if(s.length>1)t.push({caption:"Language",icon:"globe",menuItems:s.map((a)=>({caption:a.caption,icon:a.icon,checked:()=>a.value===Fe.locale.value,action:()=>{this.prefs.locale.value=a.value,Mh(a.value)}}))});let r=this.browser?.sourceMenuItems?.()??[];if(r.length>0)t.push({caption:"Source",icon:"code",menuItems:r}),t.push(null);let o=this.browser?.testsMenuItem?.()??null;if(o)t.push(o),t.push(null);t.push({caption:"Color Theme",icon:"rgb",menuItems:[{caption:"System",checked:()=>this.prefs.theme.value==="system",action:()=>this.prefs.theme.value="system"},{caption:"Dark",checked:()=>this.prefs.theme.value==="dark",action:()=>this.prefs.theme.value="dark"},{caption:"Light",checked:()=>this.prefs.theme.value==="light",action:()=>this.prefs.theme.value="light"},null,{caption:"High Contrast",checked:()=>this.prefs.highContrast.value,action:()=>this.prefs.highContrast.value=!this.prefs.highContrast.value}]}),bt({target:e.target,localized:!0,menuItems:t})}},B.moreVertical())}parseLinks(e){let t=this.querySelector(e);if(!t)return[];return[...t.querySelectorAll("a")].map((i)=>({href:i.getAttribute("href")||"",label:(i.textContent||"").trim(),icon:i.dataset.icon||void 0}))}connectedCallback(){if(super.connectedCallback(),this.nestingDepth()>=2){this.suppressed=!0,this.replaceChildren(wZ({class:"doc-system-nested"},"\uD83D\uDCD6 nested doc-system preview (suppressed)"));return}if(this.applyStyles(),this.initPrefs(),this.initLocale(),this.corpus===void 0){let e=this.docs||"/docs.json";b3(e).then((t)=>{this.corpus=t;let i=bA(location.search,fa(t));if(i){if(i!==location.pathname){location.replace(i+location.hash);return}history.replaceState(null,"",i+location.hash)}this.queueRender()}).catch((t)=>console.error("<tosi-doc-system> could not load docs from",e,t))}}render(){if(super.render(),this.suppressed||this.corpus===void 0)return;if(this.browser!==void 0){let r=this.browser.navigate;if(r&&this.route&&this.route!==this.appliedRoute)this.appliedRoute=this.route,r(this.route);return}let e={};if(this.config)try{e=JSON.parse(this.config)}catch{console.warn("<tosi-doc-system> ignoring invalid config attribute")}let t=this.nestingDepth()>=1,i=t||this.routing==="memory"||this.routing==="internal",n=this.querySelector(".doc-content")||void 0,s=this.parseLinks(".doc-navbar");if(this.appliedRoute=this.route,this.browser=jO({docs:this.corpus,routing:i?"memory":"path",initialRoute:i?this.route||void 0:void 0,onRouteChange:i?(r)=>{this.appliedRoute=r,this.route=r}:void 0,context:this.context||{tosijs:globalThis.xinjs,"tosijs-ui":globalThis.xinjsui},projectName:e.projectName,projectLinks:e.projectLinks,logo:e.logo,navbarLinks:s.length?s:void 0,contentElement:n}),!t){let r=this.browser.querySelector("header");if(r)r.append(this.settingsButton())}this.replaceChildren(this.browser)}}var TZ=FO.elementCreator();function EZ(){if(typeof document>"u")return;let e=globalThis.__TOSI_IMPORT_RESOLVER;if(!e)return;Promise.resolve().then(() => (m3(),p3)).then(({registerImportResolver:t})=>t(e)).catch((t)=>console.warn("import-resolver: registration failed",t))}EZ();var C3="\\p{Extended_Pictographic}",$Z=/^(\d{4})-(\d{2})-(\d{2})$/,PZ=[31,28,31,30,31,30,31,31,30,31,30,31],x3=(e)=>{let t=$Z.exec(e);if(!t)return!1;let i=+t[1],n=+t[2],s=+t[3];if(n<1||n>12||s<1)return!1;let r=n===2&&i%4===0&&(i%100!==0||i%400===0)?29:PZ[n-1];return s<=r},AZ=/^(\d{4}-\d{2}-\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/,Uf={email:(e)=>/^\S+@\S+\.\S+$/.test(e),uuid:(e)=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),uri:(e)=>{try{return new URL(e),!0}catch{return!1}},ipv4:(e)=>/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e),date:x3,"date-time":(e)=>{let t=AZ.exec(e);if(!t||!x3(t[1]))return!1;let i=+t[2],n=+t[3],s=+t[4];if(i>23||n>59)return!1;return s<=59||s===60&&i===23&&n===59},emoji:(e)=>new RegExp("\\p{Extended_Pictographic}","u").test(e)},_Z=new Set(Object.keys(Uf)),Hf=new Map,T3=(e,t)=>{let i=t?"u":"",n=i+"\x00"+e,s=Hf.get(n);if(s===void 0){if(s=new RegExp(e,i),Hf.size>=500)Hf.clear();Hf.set(n,s)}return s},fe=(e,t=!1)=>({schema:e,_type:null,_optional:t,validate:(i,n)=>Wc(i,e,n),get optional(){let i={...e};if(e.type!==void 0){let n=Array.isArray(e.type)?e.type:[e.type];i.type=n.includes("null")?n:[...n,"null"]}if(i.const!==void 0){let n=i.const===null?"null":typeof i.const;if(i.enum=[i.const,null],delete i.const,i.type===void 0&&n!=="null")i.type=[n,"null"]}if(Array.isArray(i.enum)&&!i.enum.includes(null))i.enum=[...i.enum,null];if(i.type===void 0&&i.enum===void 0&&Array.isArray(i.anyOf)&&!i.anyOf.some((n)=>n===!0||n?.type==="null"||Array.isArray(n?.type)&&n.type.includes("null")))i.anyOf=[...i.anyOf,{type:"null"}];return fe(i,!0)},get open(){return fe({...e,additionalProperties:!0},t)},title:(i)=>fe({...e,title:i},t),describe:(i)=>fe({...e,description:i},t),default:(i)=>fe({...e,default:i},t),meta:(i)=>fe({...i,...e,...i},t),min:(i)=>{let n=e.type==="string"?"minLength":e.type==="array"?"minItems":e.type==="object"?"minProperties":"minimum";return fe({...e,[n]:i},t)},max:(i)=>{let n=e.type==="string"?"maxLength":e.type==="array"?"maxItems":e.type==="object"?"maxProperties":"maximum";return fe({...e,[n]:i},t)},pattern:(i)=>fe({...e,pattern:typeof i==="string"?i:i.source},t),get email(){return fe({...e,format:"email"},t)},get uuid(){return fe({...e,format:"uuid"},t)},get ipv4(){return fe({...e,format:"ipv4"},t)},get url(){return fe({...e,format:"uri"},t)},get datetime(){return fe({...e,format:"date-time"},t)},get date(){return fe({...e,format:"date"},t)},get emoji(){return fe({...e,pattern:`^${C3}+$`,format:"emoji"},t)},get int(){return fe({...e,type:"integer"},t)},step:(i)=>fe({...e,multipleOf:i},t)}),v3=null;var qO={get email(){return fe({type:"string",format:"email"})},get uuid(){return fe({type:"string",format:"uuid"})},get ipv4(){return fe({type:"string",format:"ipv4"})},get url(){return fe({type:"string",format:"uri"})},get datetime(){return fe({type:"string",format:"date-time"})},get date(){return fe({type:"string",format:"date"})},get emoji(){return fe({type:"string",pattern:`^${C3}+$`,format:"emoji"})},get null(){return fe({type:"null"})},get undefined(){return fe({type:"null","x-tjs-undefined":!0})},get any(){return fe({})},pattern:(e)=>fe({type:"string",pattern:typeof e==="string"?e:e.source}),union:(e)=>fe({anyOf:e.map((t)=>t.schema)}),enum:(e)=>fe({type:typeof e[0],enum:e}),const:(e)=>fe({const:e}),array:(e)=>fe({type:"array",items:e.schema}),tuple:(e)=>fe({type:"array",items:e.map((t)=>t.schema),minItems:e.length,maxItems:e.length}),object:(e,t)=>{let i={},n=[];for(let s in e){i[s]=e[s].schema;let r=i[s];if(e[s]._optional!==!0&&(!Array.isArray(r.type)||!r.type.includes("null")))n.push(s)}return fe({type:"object",properties:i,required:n,additionalProperties:t?.additionalProperties===!0})},record:(e)=>{if(e==null)throw Error("s.record(valueSchema) requires a value schema — use s.record(s.any) for unconstrained values");return fe({type:"object",additionalProperties:e.schema})},infer:(e)=>{if(e===null)return fe({type:"null"});if(e===void 0)return fe({type:"null","x-tjs-undefined":!0});let t=typeof e;if(t==="string")return fe({type:"string"});if(t==="number")return fe({type:Number.isInteger(e)?"integer":"number"});if(t==="boolean")return fe({type:"boolean"});if(Array.isArray(e)){if(e.length===0)return fe({type:"array"});return fe({type:"array",items:qO.infer(e[0]).schema})}if(t==="object"){let i={},n=[];for(let s in e)i[s]=qO.infer(e[s]).schema,n.push(s);return fe({type:"object",properties:i,required:n,additionalProperties:!1})}return fe({})}},uie=new Proxy(qO,{get(e,t){if(t in e)return e[t];if(t==="string"||t==="number"||t==="boolean"||t==="integer"){let i=fe({type:t});return e[t]=i,i}return}}),io=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),E3=!0,WO=!1;function $3(e){if(E3=e,e)WO=!1}var MZ=()=>{if(!E3||WO)return;WO=!0,console.warn("[tosijs-schema] `oneOf` is validated by trying every branch (no short-circuit, unlike `anyOf`) — for a discriminated union, `anyOf` is cheaper. Silence with setWarnings(false). This warns once per process.")},k3=(e,t)=>t==="integer"?typeof e==="number"&&Number.isInteger(e):t==="array"?Array.isArray(e):t==="object"?typeof e==="object"&&!Array.isArray(e):t==="number"?typeof e==="number":typeof e===t;var Yf=97,RZ=new Set(["type","properties","required","items","enum","const","anyOf","oneOf","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","minItems","maxItems","minProperties","maxProperties","additionalProperties","$predicate","x-tjs-undefined"]),LZ=(e)=>e.properties!==void 0||e.required!==void 0||e.additionalProperties!==void 0||e.minProperties!==void 0||e.maxProperties!==void 0,QZ=(e)=>e.items!==void 0||e.minItems!==void 0||e.maxItems!==void 0;function Wc(e,t,i){let n=t?.schema||t,s=typeof i==="function"?i:i?.onError,r=typeof i==="object"?i?.strict??i?.fullScan??!1:!1,o=[],a=(c)=>{if(s)s(o.join(".")||"root",c);return!1},l=(c,h)=>{if(h===!0)return!0;if(h===!1)return a("Schema forbids value");if(Array.isArray(h.anyOf)){let d=!1;for(let f of h.anyOf)if(Wc(c,f,{strict:r})){d=!0;break}if(!d)return a("Union mismatch")}if(Array.isArray(h.oneOf)){MZ();let d=0;for(let f of h.oneOf)if(Wc(c,f,{strict:r})){if(d++,d>1)break}if(d!==1)return a(`oneOf: matched ${d} branches, need exactly 1`)}if(h.const!==void 0){if(c!==h.const)return a("Const mismatch")}if(Array.isArray(h.enum)&&c!==void 0&&!h.enum.includes(c))return a("Enum mismatch");if(c===null){let d=h.type==="null"&&!h["x-tjs-undefined"],f=Array.isArray(h.type)&&h.type.includes("null");return d||f||!h.type||a("Expected value, got null")}if(c===void 0){let d=h.type==="null"&&h["x-tjs-undefined"],f=Array.isArray(h.type)&&h.type.includes("null");return d||f||!h.type||a("Expected value, got undefined")}let u;if(typeof h.type==="string"){if(h.type==="null")return a("Expected null");if(!k3(c,h.type))return a(`Expected ${h.type}`);u=h.type}else if(Array.isArray(h.type)){let d=!1;for(let f of h.type){if(typeof f!=="string"||f==="null")continue;if(d=!0,k3(c,f)){u=f;break}}if(d&&u===void 0)return a(`Expected ${h.type.filter((f)=>typeof f==="string"&&f!=="null").join(" | ")}`);if(!d&&h.type.includes("null"))return a("Expected null")}if(h.$predicate&&v3){if(!v3(h.$predicate,c))return a("Predicate mismatch")}if(typeof c==="number"){if(!Number.isFinite(c))return a("Expected finite number");if(h.minimum!==void 0&&c<h.minimum)return a("Value < min");if(h.maximum!==void 0&&c>h.maximum)return a("Value > max");if(h.exclusiveMinimum!==void 0&&c<=h.exclusiveMinimum)return a("Value <= exclusive min");if(h.exclusiveMaximum!==void 0&&c>=h.exclusiveMaximum)return a("Value >= exclusive max");if(h.multipleOf!==void 0){let d=Math.abs(c%h.multipleOf),f=0.0000000001;if(d>0.0000000001&&Math.abs(d-Math.abs(h.multipleOf))>0.0000000001)return a("Value not step")}}if(typeof c==="string"){if(h.minLength!==void 0&&c.length<h.minLength)return a("Len < min");if(h.maxLength!==void 0&&c.length>h.maxLength)return a("Len > max");if(h.pattern)try{if(!T3(h.pattern,h.format==="emoji").test(c))return a("Pattern mismatch")}catch{return a("Invalid pattern")}if(h.format&&Uf[h.format]&&!Uf[h.format](c))return a("Format invalid")}if(u==="object"||!u&&typeof c==="object"&&!Array.isArray(c)&&LZ(h)){let d=h.minProperties!==void 0,f=r&&h.maxProperties!==void 0;if(d||f){let m=0;for(let g in c)if(io(c,g))m++;if(d&&m<h.minProperties)return a("Too few props");if(f&&m>h.maxProperties)return a("Too many props")}if(h.required){for(let m of h.required)if(!io(c,m))return a(`Missing ${m}`)}if(h.additionalProperties===!1)for(let m in c){if(!io(c,m))continue;if(h.properties&&io(h.properties,m))continue;return a(`Unexpected ${m}`)}if(h.properties){for(let m in h.properties)if(io(c,m)){o.push(m);let g=l(c[m],h.properties[m]);if(o.pop(),!g)return!1}}if(h.additionalProperties){let m=[];for(let O in c){if(!io(c,O))continue;if(h.properties&&io(h.properties,O))continue;m.push(O)}let g=m.length,y=r||g<=Yf?1:Math.floor(g/Yf);for(let O=0;O<g;O+=y){let b=y>1&&O>g-1-y?g-1:O,k=m[b];o.push(k);let C=l(c[k],h.additionalProperties);if(o.pop(),!C)return!1;if(b===g-1)break}}return!0}if(u==="array"||!u&&Array.isArray(c)&&QZ(h)){let d=c.length;if(h.minItems!==void 0&&d<h.minItems)return a("Array too short");if(h.maxItems!==void 0&&d>h.maxItems)return a("Array too long");if(h.items===void 0)return!0;if(Array.isArray(h.items)){for(let m=0;m<h.items.length;m++){if(o.push(String(m)),!l(c[m],h.items[m]))return o.pop(),!1;o.pop()}return!0}let f=r||d<=Yf?1:Math.floor(d/Yf);for(let m=0;m<d;m+=f){let g=f>1&&m>d-1-f?d-1:m;o.push(String(g));let y=l(c[g],h.items);if(o.pop(),!y)return!1;if(g===d-1)break}return!0}return!0};return l(e,n)}var IZ=(e)=>e?.schema??e,BZ=new Set(["title","description","default","examples","$counterexamples","$inferred","$schema","$id","$comment","deprecated","readOnly","writeOnly"]),NZ=(e)=>{let t=[];if(e.properties&&typeof e.properties==="object")for(let i of Object.keys(e.properties))t.push([`properties.${i}`,e.properties[i]]);if(e.items!==void 0)if(Array.isArray(e.items))e.items.forEach((i,n)=>t.push([`items.${n}`,i]));else t.push(["items",e.items]);if(e.additionalProperties!==void 0&&typeof e.additionalProperties==="object")t.push(["additionalProperties",e.additionalProperties]);for(let i of["anyOf","oneOf"])if(Array.isArray(e[i]))e[i].forEach((n,s)=>t.push([`${i}.${s}`,n]));return t},w3=(e)=>e!==null&&typeof e==="object",jZ=[["type",(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string"),"a string or array of strings"],["anyOf",Array.isArray,"an array"],["oneOf",Array.isArray,"an array"],["required",(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string"),"an array of strings"],["enum",Array.isArray,"an array"],["properties",(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),"an object"],["items",(e)=>e!==null&&typeof e==="object","a schema or array"],["additionalProperties",(e)=>typeof e==="boolean"||e!==null&&typeof e==="object","a boolean or schema"],["pattern",(e)=>typeof e==="string","a string"],["format",(e)=>typeof e==="string","a string"],["$predicate",(e)=>typeof e==="string","a string"],...["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","minItems","maxItems","minProperties","maxProperties"].map((e)=>[e,(t)=>typeof t==="number","a number"])],P3=[["minLength",["string"]],["maxLength",["string"]],["pattern",["string"]],["format",["string"]],["minimum",["number","integer"]],["maximum",["number","integer"]],["exclusiveMinimum",["number","integer"]],["exclusiveMaximum",["number","integer"]],["multipleOf",["number","integer"]],["items",["array"]],["minItems",["array"]],["maxItems",["array"]],["properties",["object"]],["required",["object"]],["additionalProperties",["object"]],["minProperties",["object"]],["maxProperties",["object"]]],DZ=[...P3.map(([e])=>e),"enum","$predicate"],A3=(e,t="root")=>{if(e===!0||e===!1)return[];if(e==null||typeof e!=="object"||Array.isArray(e))return[`${t} (not a schema)`];let i=[];for(let s of Object.keys(e))if(!RZ.has(s)&&!BZ.has(s)&&!s.startsWith("x-"))i.push(`${t}.${s}`);for(let[s,r,o]of jZ)if(e[s]!==void 0&&!r(e[s]))i.push(`${t}.${s} (must be ${o})`);if(e.type===void 0&&e.const===void 0&&e.anyOf===void 0&&e.oneOf===void 0){let s=DZ.filter((r)=>e[r]!==void 0);if(s.length>0)i.push(`${t} (constraints without a type — null/undefined and mismatched `+`primitives bypass ${s.join("/")}; add an explicit type)`)}let n=typeof e.type==="string"?[e.type]:Array.isArray(e.type)&&e.type.every((s)=>typeof s==="string")?e.type:null;if(n){for(let[s,r]of P3)if(e[s]!==void 0&&!n.some((o)=>r.includes(o)))i.push(`${t}.${s} (never applies to type ${JSON.stringify(e.type)})`)}if(typeof e.format==="string"&&!_Z.has(e.format))i.push(`${t}.format:'${e.format}'`);if(typeof e.pattern==="string")try{T3(e.pattern,e.format==="emoji")}catch{i.push(`${t}.pattern (invalid regex)`)}if(Array.isArray(e.items)&&e.maxItems!==e.items.length)i.push(`${t}.items (tuple without maxItems: ${e.items.length})`);if(w3(e.const))i.push(`${t}.const (non-primitive; === comparison never matches)`);if(Array.isArray(e.enum)&&e.enum.some(w3))i.push(`${t}.enum (non-primitive member never matches)`);for(let[s,r]of NZ(e))i.push(...A3(r,`${t}.${s}`));return i};function _3(e){let t=IZ(e);if(t===!0||t===!1)return[];return A3(t)}var S3={maxDistinct:12,minCoverage:0.5},zZ=["date","date-time","email","uri"],VZ=(e)=>{if(e===null)return"null";if(typeof e==="number")return Number.isInteger(e)?"integer":"number";return typeof e},HO=(e)=>Array.from(new Set(e)).sort();function YO(e,t,i){let n=e.filter((c)=>c!==null&&c!==void 0),s=n.length<e.length;if(n.length===0)return e.some((c)=>c===void 0)||e.length===0?{}:{type:"null"};let r=n.filter((c)=>typeof c==="object"&&c!==null&&!Array.isArray(c)),o=n.filter(Array.isArray),a=n.filter((c)=>typeof c!=="object"||c===null),l=[];if(r.length)l.push(ZZ(r,t,i));if(o.length)l.push(qZ(o,t,i));if(a.length)l.push(XZ(a,t));if(l.length===1)return FZ(l[0],s);return{anyOf:s?[...l,{type:"null"}]:l}}function XZ(e,t){let i=HO(e.map(VZ)),n={};if(i.length===1)n.type=i[0];else if(i.length>1)n.type=i;let s=WZ(e,i,t);if(s)n.enum=s;else HZ(n,e,i,t);return n}function FZ(e,t){if(!t)return e;if(e.type!==void 0){let i=Array.isArray(e.type)?e.type:[e.type];if(!i.includes("null"))e.type=HO([...i,"null"])}if(Array.isArray(e.enum)&&!e.enum.includes(null))e.enum=[...e.enum,null];return e}function ZZ(e,t,i){let n=HO(e.flatMap((o)=>Object.keys(o))),s={},r=[];for(let o of n){let a=e.filter((l)=>Object.prototype.hasOwnProperty.call(l,o));if(s[o]=YO(a.map((l)=>l[o]),t,i?`${i}.${o}`:o),a.length===e.length)r.push(o)}return{type:"object",properties:s,required:r,additionalProperties:!0}}function qZ(e,t,i){let n=e.reduce((r,o)=>r+o.length,0),s;if(t.sampleSize!==void 0&&n>t.sampleSize){s=[];for(let r of e){for(let o of r)if(s.push(o),s.length>=t.sampleSize)break;if(s.length>=t.sampleSize)break}t.onTruncate?.({path:i||"(root)",sampled:s.length,total:n})}else s=e.flat();if(s.length===0)return{type:"array"};return{type:"array",items:YO(s,t,`${i}[]`)}}function WZ(e,t,i){if(!i.enums||e.length===0)return null;let n=t.length>0&&t.every((l)=>l==="integer"||l==="number"),s=t.length===1&&t[0]==="string";if(!n&&!s)return null;let r=i.enums===!0?S3:{...S3,...i.enums},o=Array.from(new Set(e)),a=1-o.length/e.length;if(o.length>r.maxDistinct||a<r.minCoverage)return null;return n?o.slice().sort((l,c)=>l-c):o.slice().sort()}function HZ(e,t,i,n){if(!n.formats||!(i.length===1&&i[0]==="string"))return;let s=t;if(s.length===0)return;for(let r of zZ){let o=Uf[r];if(s.every(o)){e.format=r;return}}}function M3(e,t={}){let i=YO([e],t,"");if(t.marker!==!1)i.$inferred=!0;return i}var YZ={...Sg,...oO,...dO,...DO,...ZO,...NO};$3(!1);Qh({validate:Wc,inferSchema:M3,unenforcedKeywords:_3});Object.assign(globalThis,{xinjs:Da,xinjsui:YZ});})();
|
|
331
331
|
|
|
332
|
-
//# debugId=
|
|
332
|
+
//# debugId=5E396A5E8FB7E59564756E2164756E21
|
|
333
333
|
//# sourceMappingURL=iife.js.map
|