tosijs-ui 1.9.2 → 1.9.4

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.
@@ -13,6 +13,7 @@ cause an endless rebuild loop.
13
13
  */
14
14
  import * as path from 'path';
15
15
  import { namedBooks, partitionByBook, DEFAULT_BOOK } from '../book-target.js';
16
+ import { listEpubVolumes, renderEpubDownloads, } from './epub-volumes.js';
16
17
  import { buildSlugMap } from '../routing.js';
17
18
  import { existsSync, mkdirSync, unlinkSync } from 'fs';
18
19
  import { tmpdir } from 'os';
@@ -288,6 +289,39 @@ export async function buildSite(config, opts = {}) {
288
289
  output: DOCS_JSON,
289
290
  });
290
291
  extract();
292
+ /*
293
+ Fill `<!-- epub-downloads -->` and publish a manifest of the volumes this build makes.
294
+
295
+ Substituted into the corpus HERE, before pages are generated, so the static page and
296
+ the hydrated SPA render the same list and the client needs no new data source. The
297
+ volume set is computed from the corpus itself, so it is known before the ePubs are
298
+ built — the links and the files derive from one function and cannot disagree.
299
+
300
+ Why this exists: the build produced a valid ePub and linked to nothing, so a reader had
301
+ no route to it. A build that makes an artifact should be able to say where it is
302
+ (tosijs-ui#46).
303
+ */
304
+ const publishVolumeLinks = async () => {
305
+ if (!config.epub)
306
+ return;
307
+ const corpus = JSON.parse(await Bun.file(DOCS_JSON).text());
308
+ const volumes = listEpubVolumes(corpus, config);
309
+ if (!volumes.length)
310
+ return;
311
+ let touched = 0;
312
+ for (const doc of corpus) {
313
+ const filled = renderEpubDownloads(doc.text ?? '', volumes);
314
+ if (filled !== doc.text) {
315
+ doc.text = filled;
316
+ touched++;
317
+ }
318
+ }
319
+ if (touched)
320
+ await Bun.write(DOCS_JSON, JSON.stringify(corpus, null, 2));
321
+ // A stable, machine-readable list so a consumer can link the books without
322
+ // re-deriving the filename — the "documented helper" half of #46.
323
+ await Bun.write(`${PUBLIC}/epub-volumes.json`, JSON.stringify(volumes, null, 2));
324
+ };
291
325
  // Auto-create missing section docs + regenerate their TOC blocks, then
292
326
  // re-extract so the corpus reflects the on-disk changes.
293
327
  ensureSections({
@@ -676,6 +710,9 @@ export async function buildSite(config, opts = {}) {
676
710
  console.warn(`import-resolver: could not set it up (${String(e)}) — skipping`);
677
711
  }
678
712
  }
713
+ // Fill the download marker and write the volume manifest before pages are rendered,
714
+ // so the static HTML and the SPA agree. PUBLIC exists by now (static assets copied).
715
+ await publishVolumeLinks();
679
716
  // Generate the static, pre-rendered doc site (one /slug/index.html per doc).
680
717
  // Runs after the static-asset copy so the generated index.html (README) wins,
681
718
  // and after the bundle copy so every page's <script src> resolves.
package/dist/iife.js CHANGED
@@ -269,7 +269,7 @@ ${Z.join(`
269
269
  `)||"(idle)"}`}).join(`
270
270
  `)}var{slot:az}=S;class nz extends x{static preferredTagName="tosi-row";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[az()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"row",gap:M.tosiRowGap("0"),alignItems:M.tosiRowAlign("stretch"),justifyContent:M.tosiRowJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-row-gap",this.gap);else this.style.removeProperty("--tosi-row-gap");if(this.align)this.style.setProperty("--tosi-row-align",this.align);else this.style.removeProperty("--tosi-row-align");if(this.justify)this.style.setProperty("--tosi-row-justify",this.justify);else this.style.removeProperty("--tosi-row-justify");this.style.flexWrap=this.wrap?"wrap":""}}var Hv=nz.elementCreator();class oz extends x{static preferredTagName="tosi-column";static initAttributes={gap:"",wrap:!1,align:"",justify:""};content=[az()];static shadowStyleSpec={":host":{display:"flex",flexDirection:"column",gap:M.tosiColumnGap("0"),alignItems:M.tosiColumnAlign("stretch"),justifyContent:M.tosiColumnJustify("flex-start")}};render(){if(super.render(),this.gap)this.style.setProperty("--tosi-column-gap",this.gap);else this.style.removeProperty("--tosi-column-gap");if(this.align)this.style.setProperty("--tosi-column-align",this.align);else this.style.removeProperty("--tosi-column-align");if(this.justify)this.style.setProperty("--tosi-column-justify",this.justify);else this.style.removeProperty("--tosi-column-justify");this.style.flexWrap=this.wrap?"wrap":""}}var Fv=oz.elementCreator();class tz extends x{static preferredTagName="tosi-grid";static initAttributes={columns:"",rows:"",gap:""};content=[az()];static shadowStyleSpec={":host":{display:"grid",gridTemplateColumns:M.tosiGridColumns("1fr"),gridTemplateRows:M.tosiGridRows("auto"),gap:M.tosiGridGap("0")}};render(){if(super.render(),this.columns)this.style.setProperty("--tosi-grid-columns",this.columns);else this.style.removeProperty("--tosi-grid-columns");if(this.rows)this.style.setProperty("--tosi-grid-rows",this.rows);else this.style.removeProperty("--tosi-grid-rows");if(this.gap)this.style.setProperty("--tosi-grid-gap",this.gap);else this.style.removeProperty("--tosi-grid-gap")}}var Rv=tz.elementCreator(),{span:qA}=S,Bv=(...X)=>qA({style:{flex:"1 1 var(--tosi-space, 0.5em)"}},...X),ez=(...X)=>qA({style:{flex:"0 0 var(--tosi-space, 0.5em)"}},...X);var C4={accent:p.fromCss("#d92270"),background:p.fromCss("#fafafa"),text:p.fromCss("#222222")},JA={_tosiSpacingXs:"4px",_tosiSpacingSm:"8px",_tosiSpacing:"12px",_tosiSpacingLg:"16px",_tosiSpacingXl:"24px",_tosiFontFamily:"system-ui, -apple-system, sans-serif",_tosiFontSize:"16px",_tosiLineHeight:"1.5",_tosiCodeFontFamily:"ui-monospace, monospace",_tosiCodeFontSize:"14px",_tosiTouchSize:"44px",_tosiBorderRadius:"4px",_tosiBorderRadiusLg:"8px",_tosiTransition:"0.15s ease-out"};function YA(X){let{accent:K,background:Q,text:Z}=X,q=X.accentText??K.contrasting(),J=X.backgroundInset??Q.darken(0.03),Y=X.border??Z.opacity(0.15),z=X.shadow??Z.opacity(0.1),U=X.focus??K.opacity(0.5);return{_tosiAccent:K,_tosiAccentLight:K.brighten(0.15),_tosiAccentDark:K.darken(0.15),_tosiAccentText:q,_tosiBg:Q,_tosiBgInset:J,_tosiBgHover:Q.darken(0.05),_tosiBgActive:Q.darken(0.1),_tosiText:Z,_tosiTextMuted:Z.opacity(0.6),_tosiTextDisabled:Z.opacity(0.4),_tosiBorder:Y,_tosiBorderFocus:K,_tosiShadow:z,_tosiShadowColor:z,_tosiFocusRing:`0 0 0 2px ${U}`,_tosiInputBg:Q,_tosiInputBorder:Y,_tosiInputBorderFocus:K,_tosiButtonBg:Q,_tosiButtonText:Z,_tosiButtonBorder:Y,_tosiButtonHoverBg:Q.darken(0.05),_tosiButtonActiveBg:K,_tosiButtonActiveText:q}}function O9(X){return{":root":{...JA,...YA(X)}}}function uK(X){let Q=O9(X)[":root"];return{":root":E9(Q)}}function XU(X,K="tosi-theme"){z0(K,X)}var Nv=O9(C4),Av=uK(C4),zA={"--xin-icon-size":R.tosiIconSize,"--xin-icon-fill":R.tosiIconFill,"--xin-icon-stroke":R.tosiIconStroke,"--xin-tabs-bar-color":R.tosiTabsBarColor,"--xin-tabs-bar-height":R.tosiTabsBarHeight,"--xin-tabs-selected-color":R.tosiTabsSelectedColor,"--spacing":R.tosiSpacing,"--gap":R.tosiSpacingSm,"--touch-size":R.tosiTouchSize,"--background":R.tosiBg,"--text-color":R.tosiText,"--brand-color":R.tosiAccent,"--brand-text-color":R.tosiAccentText};function Cv(X){return{":root":{...O9(X)[":root"],...zA}}}function Mv(X,K){let Q={};for(let[Z,q]of Object.entries(K)){let J=`--tosi-${X}-${Z.replace(/([A-Z])/g,"-$1").toLowerCase()}`;Q[Z]=`var(${J}, ${q})`}return Q}var{div:H9,label:fK,input:lK,span:Dv,button:UA}=S,{liveTheme:w1}=Y2({liveTheme:{accent:String(C4.accent),background:String(C4.background),text:String(C4.text),dark:!1}}),pK=!1;function N6(){if(!pK)return;let X={accent:p.fromCss(w1.accent.value),background:p.fromCss(w1.background.value),text:p.fromCss(w1.text.value)},K=w1.dark.value?uK(X):O9(X);XU(K,"tosi-live-theme")}function GA(){if(pK)return;pK=!0,w1.accent.observe(N6),w1.background.observe(N6),w1.text.observe(N6),w1.dark.observe(N6),N6()}function Iv(){pK=!1}class KU extends x{static preferredTagName="tosi-theme-editor";static shadowStyleSpec={":host":{display:"block",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"1.5",background:"#ffffff",color:"#222222",padding:"16px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"320px"},":host .field":{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},":host label":{flex:"1",fontWeight:"500"},':host input[type="color"]':{width:"48px",height:"32px",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",padding:"2px"},':host input[type="checkbox"]':{width:"18px",height:"18px",cursor:"pointer"},":host .preview":{marginTop:"12px",padding:"12px",borderRadius:"4px",transition:"all 0.15s ease-out"},":host .preview-button":{border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions":{marginTop:"8px",display:"flex",gap:"8px"},":host .actions button":{flex:"1",padding:"6px 12px",border:"1px solid #ccc",borderRadius:"4px",background:"#f5f5f5",color:"#222",cursor:"pointer",fontFamily:"inherit",fontSize:"13px"},":host .actions button:hover":{background:"#e8e8e8"}};content=()=>[H9({class:"field"},fK("Accent"),lK({type:"color",part:"accent"})),H9({class:"field"},fK("Background"),lK({type:"color",part:"background"})),H9({class:"field"},fK("Text"),lK({type:"color",part:"text"})),H9({class:"field"},fK("Dark mode"),lK({type:"checkbox",part:"dark"})),H9({class:"preview",part:"preview",style:{background:"var(--tosi-bg, #fafafa)",color:"var(--tosi-text, #222)"}},Dv("Preview "),UA({class:"preview-button",style:{background:"var(--tosi-accent, #d92270)",color:"var(--tosi-accent-text, white)"}},"Button")),H9({class:"actions"},UA({part:"reset"},"Reset"))];connectedCallback(){super.connectedCallback(),GA();let X=()=>{this.parts.accent.value=w1.accent.value,this.parts.background.value=w1.background.value,this.parts.text.value=w1.text.value,this.parts.dark.checked=w1.dark.value};X(),w1.accent.observe(X),w1.background.observe(X),w1.text.observe(X),w1.dark.observe(X),this.parts.accent.addEventListener("input",()=>{w1.accent.value=this.parts.accent.value}),this.parts.background.addEventListener("input",()=>{w1.background.value=this.parts.background.value}),this.parts.text.addEventListener("input",()=>{w1.text.value=this.parts.text.value}),this.parts.dark.addEventListener("change",()=>{w1.dark.value=this.parts.dark.checked}),this.parts.reset.addEventListener("click",()=>{w1.accent.value=String(C4.accent),w1.background.value=String(C4.background),w1.text.value=String(C4.text),w1.dark.value=!1})}}var Pv=KU.elementCreator();var{div:Lv}=S;class G3 extends x{static preferredTagName="tosi-map";static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(X){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=Lv({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;_mapPending=!1;static shadowStyleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(G3.mapboxCSSAvailable===void 0)G3.mapboxCSSAvailable=o6("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((X)=>{console.error("failed to load mapbox-gl.css",X)}),G3.mapboxAvailable=t0("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((X)=>{console.error("failed to load mapbox-gl.js",X)})}connectedCallback(){if(super.connectedCallback(),!this.token)console.error("mapbox requires an access token which you can provide via the token attribute")}_lastCoords="";_lastStyle="";render(){if(super.render(),!this.token)return;if(this._map){if(this.coords!==this._lastCoords){let[K,Q,Z]=this.coords.split(",").map((q)=>Number(q));this._map.setCenter([Q,K]),this._map.setZoom(Z),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}if(this._mapPending)return;this._mapPending=!0;let{div:X}=this.parts;G3.mapboxAvailable.then(({mapboxgl:K})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;");let[Q,Z,q]=this.coords.split(",").map((J)=>Number(J));K.accessToken=this.token,this._map=new K.Map({container:X,style:this.mapStyle,zoom:q,center:[Z,Q]}),this._lastCoords=this.coords,this._lastStyle=this.mapStyle,this._mapPending=!1,this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let J=this._map.getCenter(),Y=this._map.getZoom(),z=`${J.lat.toFixed(6)},${J.lng.toFixed(6)},${Y.toFixed(1)}`;if(z!==this.value){if(this.internals)this.internals.setFormValue(z)}})}).catch((K)=>{this._mapPending=!1,console.error("tosi-map: mapbox failed to load",K)})}}var yv=G3.elementCreator();function WA(X,K){if(K==null)K="";else if(typeof K!=="string")K=String(K);return K.replace(/\{\{([^}]+)\}\}/g,(Q,Z)=>{let q=I2[`${X}${Z.startsWith("[")?Z:"."+Z}`];return q===void 0?Q:WA(X,String(q))})}class dK extends x{static preferredTagName="tosi-md";static initAttributes={src:"",elements:!1};context={};value="";content=null;options={};connectedCallback(){if(super.connectedCallback(),this.src!=="")(async()=>{let X=await fetch(this.src);this.value=await X.text()})();else if(this.value==="")if(this.elements)this.value=this.innerHTML;else this.value=this.textContent!=null?this.textContent:""}didRender=()=>{};render(){super.render(),I2[this.instanceId]=typeof this.context==="string"?JSON.parse(this.context):this.context;let X=WA(this.instanceId,this.value);if(this.elements){let K=X.split(`
271
271
  `).reduce((Q,Z)=>{if(Z.startsWith("<")||Q.length===0)Q.push(Z);else{let q=Q[Q.length-1];if(!q.startsWith("<")||!q.endsWith(">"))Q[Q.length-1]+=`
272
- `+Z;else Q.push(Z)}return Q},[]);this.innerHTML=K.map((Q)=>Q.startsWith("<")&&Q.endsWith(">")?Q:O1(Q,this.options)).join("")}else this.innerHTML=O1(X,this.options);this.didRender()}}var kv=dK,QU=dK.elementCreator(),Tv=QU,Sv=QU;var{div:ZU,span:cK,button:qU}=S,A6=86400000,Ev=[0,1,2,3,4,5,6],xv=[1,2,3,4,5,6,7,8,9,10,11,12],JU=(X,K=2,Q="0")=>String(X).padStart(K,Q),C6=(X,K,Q)=>new Date(`${X}-${JU(K)}-${JU(Q)}`);class YU extends x{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:M.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:M.monthTodayBackground("transparent"),boxShadow:M.monthTodayShadow("none"),backdropFilter:M.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:M.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:M.monthDayColor("hotpink"),background:M.monthDayBackground("white"),fontWeight:M.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:M.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:M.monthDateCheckedColor("white"),background:M.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:M.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:M.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:M.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:M.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:M.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:C6(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:C6(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(X){this.disabled=X}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return xv.map((X)=>({caption:C6(2025,X,1).toString().split(" ")[1],value:String(X)}))}get years(){let X=Number(this.minDate.split("-")[0]),K=Number(this.maxDate.split("-")[0]),Q=[];for(let Z=X;Z<=K;Z++)Q.push(String(Z));return Q}monthChanged=(X,K)=>{};gotoMonth(X,K){if(this.month!==K||this.year!==X)this.month=K,this.year=X,this.monthChanged(X,K)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(X){this.selectedDays[1]=X,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(X){this.selectedDays[0]=X,this.selectedDays.splice(2)}clickDate=(X)=>{let K=X.target.getAttribute("title");this.selectDate(K)};keyDate=(X)=>{let K=!1;switch(X.code){case"Space":{let Q=X.target.getAttribute("title");this.selectDate(Q),K=!0;break}case"Tab":break;default:console.log(X)}if(K)X.preventDefault(),X.stopPropagation()};#X="";selectDate=(X)=>{if(this.#X=X,this.range){if(!this.to)this.selectedDays=[X,X];else if(this.from===X&&this.to===X)this.selectedDays=[];else if(this.from===X)this.from=this.to;else if(this.to===X)this.to=this.from;else if(X<this.from)this.from=X;else if(X>this.to)this.to=X;else this.to=X;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(X))this.selectedDays.splice(this.selectedDays.indexOf(X),1);else this.selectedDays.push(X),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(X))this.value="",this.selectedDays=[];else this.value=X,this.selectedDays=[X]};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=(X)=>{if(!this.range)return this.selectedDays.includes(X);else if(this.range)return this.from&&X>=this.from&&X<=this.to;return!1};dateMenuItem=(X,K="")=>{return X=X.split("T")[0],{caption:K||X,enabled:()=>!X.startsWith(`${this.year}-${JU(this.month)}-`),action:()=>{this.gotoDate(X)}}};jumpMenu=()=>{f1({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((X)=>this.dateMenuItem(X))]})};content=()=>[ZU({part:"header"},qU({part:"previous",onClick:this.previousMonth},E.chevronLeft()),cK({style:{flex:"1"}}),qU({part:"jump",onClick:this.jumpMenu},E.calendar()),C0({part:"month",options:this.months,onChange:this.setMonth}),C0({part:"year",options:[this.year],onChange:this.setMonth}),cK({style:{flex:"1"}}),qU({part:"next",onClick:this.nextMonth},E.chevronRight())),ZU({part:"week"}),ZU({part:"days"})];gotoDate(X){let K=new Date(X);this.gotoMonth(K.getFullYear(),K.getMonth()+1)}connectedCallback(){super.connectedCallback();let X=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=X.getMonth()+1;if(isNaN(this.year))this.year=X.getFullYear()}days=[];render(){super.render();let{week:X,days:K,jump:Q,month:Z,year:q,previous:J,next:Y}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let z=C6(this.year,this.month,1),U=new Date(z.valueOf()-(7+z.getDay()-this.weekStart)%7*A6),G=this.month===12?1:this.month+1,W=new Date(C6(this.year+(this.month===12?1:0),G,1).valueOf()-A6),$=new Date(W.valueOf()+(this.weekStart*2+5+this.endDay-W.getDay())%7*A6),_=Ev.map((N)=>new Date(U.valueOf()+N*A6).toString().split(" ")[0]);this.days=[];let V=new Date().toISOString().split("T")[0];for(let N=U.valueOf();N<=$.valueOf();N+=A6){let A=new Date(N),D=A.toISOString().split("T")[0];this.days.push({date:A,selected:!1,inMonth:A.getMonth()+1===this.month,isToday:D===V,isWeekend:A.getDay()%6===0,inRange:!!(this.from&&D>=this.from&&D<=this.to)})}Z.value=String(this.month),q.value=String(this.year),Z.disabled=q.disabled=Q.disabled=J.disabled=Y.disabled=this.disabled||this.readonly,q.options=this.years,X.textContent="",X.append(..._.map((N)=>cK({class:"day"},N))),K.textContent="";let O=null,{to:H,from:B}=this;K.append(...this.days.map((N)=>{let A=["date"];if(N.inMonth)A.push("in-month");if(N.isToday)A.push("today");let D=N.date.toISOString().split("T")[0];if(this.checkDay(D))A.push("checked");if(A.push(N.isWeekend?"weekend":"weekday"),this.range){if(H===D)A.push("range-end");if(B===D)A.push("range-start")}let L=cK({class:A.join(" "),title:D,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},N.date.getDate());if(D===this.#X)O=L;return L})),O?.focus()}}var bv=YU.elementCreator();var $A=async(X,K="SHA-1")=>{let Z=new TextEncoder().encode(X),q=await crypto.subtle.digest(K,Z);return Array.from(new Uint8Array(q)).map((z)=>z.toString(16).padStart(2,"0")).join("")},_A=async(X)=>{let K=await $A(X),Q=await fetch(`https://weakpass.com/api/v1/search/${K}`);if(Q.ok){let Z=await Q.json();console.log("password found in weakpass database",Z)}return Q.status!==404},{span:zU,tosiSlot:wv}=S;class iK extends x{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:R.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:M.meterHeight("24px"),background:M.indicatorBg("white"),borderRadius:M.meterRadius("4px"),boxShadow:M.meterShadow(`inset 0 0 0 2px ${R.indicatorColor}`)},':host [part="level"]':{height:M.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:R.indicatorColor,margin:M.levelMargin("2px"),borderRadius:M.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:R.descriptionColor,height:M.meterHeight("24px"),lineHeight:M.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(X){return this.issues={tooShort:X.length<this.minLength,short:X.length<this.goodLength,noUpper:!X.match(/[A-Z]/),noLower:!X.match(/[a-z]/),noNumber:!X.match(/[0-9]/),noSpecial:!X.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((K)=>!K).length-1}async isBreached(){let X=this.querySelector("input")?.value;if(!X||typeof X!=="string")return!0;return await _A(X)}updateIndicator=(X)=>{let{level:K,description:Q}=this.parts,Z=this.indicatorColors.split(","),q=this.descriptionColors.split(","),J=this.strength(X);if(this.value!==J)this.value=J,this.dispatchEvent(new Event("change"));K.style.width=`${(J+1)*16.67}%`,this.style.setProperty("--indicator-color",Z[J]),this.style.setProperty("--description-color",q[J]),Q.textContent=this.strengthDescriptions[J]};update=(X)=>{let K=X.target.closest("input");this.updateIndicator(K?.value||"")};content=()=>[wv({onInput:this.update}),zU({part:"meter"},zU({part:"level"}),zU({part:"description"}))];render(){super.render();let X=this.querySelector("input");this.updateIndicator(X?.value)}}var hv=iK,jA=iK.elementCreator(),vv=jA;var{span:UU}=S;class sK extends x{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(X){this.readonly=X}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=()=>UU({part:"container"},UU({part:"empty"}),UU({part:"filled"}));displayValue(X){let{empty:K,filled:Q}=this.parts,q=Math.round((typeof X==="string"?0:X||0)/this.step)*this.step;Q.style.width=q/this.max*K.offsetWidth+"px"}update=(X)=>{if(this.readonly)return;let{empty:K}=this.parts,Q=X instanceof MouseEvent?X.pageX-K.getBoundingClientRect().x:0,Z=Math.min(Math.max(this.min,Math.round(Q/K.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(X.type==="click")this.value=Z;else if(X.type==="mousemove")this.displayValue(Z);else this.displayValue(this.value||0)};handleKey=(X)=>{let K=this.value===""?NaN:Number(this.value);if(isNaN(K))K=Math.round((this.min+this.max)*0.5*this.step)*this.step;let Q=!1;switch(X.key){case"ArrowUp":case"ArrowRight":K+=this.step,Q=!0;break;case"ArrowDown":case"ArrowLeft":K-=this.step,Q=!0;break}if(this.value=Math.max(Math.min(K,this.max),this.min),Q)X.stopPropagation(),X.preventDefault()};connectedCallback(){super.connectedCallback();let{container:X}=this.parts;X.tabIndex=0,X.addEventListener("mousemove",this.update,!0),X.addEventListener("mouseleave",this.update),X.addEventListener("blur",this.update),X.addEventListener("click",this.update),X.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let X=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",X),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:K,filled:Q}=this.parts;if(K.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),K.style.setProperty("--tosi-icon-stroke",this.emptyStroke),Q.style.setProperty("--tosi-icon-fill",this.ratingFill),Q.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let Z=0;Z<this.max;Z++)K.append(E[this.icon]()),Q.append(E[this.icon]())}this.displayValue(this.value)}}var gv=sK,VA=sK.elementCreator(),mv=w2((...X)=>VA(...X),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:OA,div:uv,button:fv}=S,lv=[{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 GU(X=lv){return C0({title:"paragraph style",slot:"toolbar",class:"block-style",options:X.map(({caption:K,tagType:Q})=>({caption:K,value:`formatBlock,${Q}`}))})}var M6=()=>ez({slot:"toolbar"});function i0(X,K,Q){return fv({slot:"toolbar",dataCommand:K,title:X},Q)}var pv=()=>[i0("left-justify","justifyLeft",E.alignLeft()),i0("center","justifyCenter",E.alignCenter()),i0("right-justify","justifyRight",E.alignRight()),M6(),i0("bullet list","insertUnorderedList",E.listBullet()),i0("numbered list","insertOrderedList",E.listNumber()),M6(),i0("indent","indent",E.indent()),i0("indent","outdent",E.outdent())],HA=()=>[i0("bold","bold",E.fontBold()),i0("italic","italic",E.fontItalic()),i0("underline","underline",E.fontUnderline())],dv=()=>[GU(),M6(),...HA()],FA=()=>[GU(),M6(),...pv(),M6(),...HA()];class rK extends x{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(X){if(this.isInitialized)this.parts.doc.contentEditable=X?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(X){let K=this._value;if(this._value=X,this.isInitialized){if(this.parts.doc.innerHTML!==X)this.parts.doc.innerHTML=X}if(K!==X&&this.internals)this.internals.setFormValue(X)}blockElement(X){let{doc:K}=this.parts;while(X.parentElement!==null&&X.parentElement!==K)X=X.parentElement;return X.parentElement===K?X:void 0}get selectedBlocks(){let{doc:X}=this.parts,K=window.getSelection();if(K===null)return[];let Q=[];for(let Z=0;Z<K.rangeCount;Z++){let q=K.getRangeAt(Z);if(!X.contains(q.commonAncestorContainer))continue;let J=this.blockElement(q.startContainer),Y=this.blockElement(q.endContainer);Q.push(J);while(J!==Y&&J!==null)J=J.nextElementSibling,Q.push(J)}return Q}get selectedText(){let X=window.getSelection();if(X===null)return"";return this.selectedBlocks.length?X.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(X)=>{if(this._updatingBlockStyle)return;let Q=X.target?.closest(F4.tagName);if(Q==null)return;this.doCommand(Q.value)};handleButtonClick=(X)=>{let Q=X.target?.closest("button");if(Q==null)return;this.doCommand(Q.dataset.command)};content=[OA({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),uv({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),OA({part:"content"})];doCommand(X){if(X===void 0)return;let K=X.split(",");console.log("execCommand",K[0],!1,...K.slice(1)),document.execCommand(K[0],!1,...K.slice(1))}updateBlockStyle(){let X=this.parts.toolbar.querySelector(".block-style");if(X===null)return;let K=this.selectedBlocks.map((Q)=>Q.tagName);K=[...new Set(K)],this._updatingBlockStyle=!0,X.value=K.length===1?`formatBlock,${K[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:X,content:K}=this.parts;if(K.innerHTML!==""&&X.innerHTML==="")X.innerHTML=K.innerHTML,K.innerHTML="";this.isInitialized=!0,K.style.display="none",X.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(Q)=>{this.updateBlockStyle(),this.selectionChange(Q,this)})}render(){let{toolbar:X}=this.parts;if(super.render(),X.children.length===0)switch(this.widgets){case"minimal":X.append(...dv());break;case"default":X.append(...FA());break}}}var cv=rK,RA=rK.elementCreator(),iv=w2((...X)=>RA(...X),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:D6}=Y2({router:{path:"",hash:"",pattern:""}}),WU={};function sv(){return{...WU}}var aK=[],$U=!1,nK=new Set;function rv(X){let K=[];if(X==="")return{regex:/^\/?$/,paramNames:K};let Q=X.split("/").map((q)=>{if(q.startsWith(":"))return K.push(q.slice(1)),"([^/]+)";return q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+Q.join("/")+"/?$"),paramNames:K}}function av(X){let K=X.split("?")[0].split("#")[0];for(let Z of aK){if(Z.fallback)continue;let q=K.match(Z.regex);if(q){let J={};return Z.paramNames.forEach((Y,z)=>{J[Y]=decodeURIComponent(q[z+1])}),{route:Z,params:J}}}let Q=aK.find((Z)=>Z.fallback);if(Q)return{route:Q,params:{}};return null}function I6(){let X=$U?window.location.hash.replace(/^#\/?/,""):window.location.pathname;D6.path.value=X,D6.hash.value=window.location.hash;let K=av(X);if(K){WU=K.params,D6.pattern.value=K.route.regex.source;let Q=new Map;for(let Z of K.route.targets)Q.set(Z.view??"default",Z);for(let Z of nK){let q=Z.name||"default",J=Q.get(q);if(J)Z.replaceChildren(J.component(K.params));else Z.replaceChildren()}}else{WU={},D6.pattern.value="";for(let Q of nK)Q.replaceChildren()}}var BA=!1;function NA(){if(BA)return;BA=!0,window.addEventListener("popstate",I6),window.addEventListener("hashchange",I6)}function nv(X,K={}){$U=K.hashRouting??!1,aK=X.map((Q)=>{let{regex:Z,paramNames:q}=rv(Q.pattern);return{regex:Z,paramNames:q,targets:Q.targets,fallback:Q.fallback??!1}}),NA(),I6()}function ov(X){if(NA(),$U)window.location.hash="#/"+X.replace(/^\//,"");else window.history.pushState({},"","/"+X.replace(/^\//,""));I6()}class _U extends x{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),nK.add(this),aK.length>0)I6()}disconnectedCallback(){super.disconnectedCallback(),nK.delete(this)}}var tv=_U.elementCreator();var{div:ev,slot:Xg,label:Kg,span:Qg,input:AA}=S;class F9 extends x{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(X){if(typeof X==="string")this._choices=F9.parseChoicesString(X);else this._choices=X;this.queueRender()}static parseChoicesString(X){return X.split(",").filter((K)=>K.trim()!=="").map((K)=>{let[Q,Z]=K.split("=").map((z)=>z.trim()),[q,J]=(Z||Q).split(":").map((z)=>z.trim()),Y=J?E[J]():"";return{value:Q,icon:Y,caption:q}})}value="";formDisabledCallback(X){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((X)=>X.trim()).filter((X)=>X!=="")}content=()=>[Xg(),ev({part:"options"},AA({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:M.segmentedOptionGap("8px"),alignItems:M.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:M.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:M.segmentedOptionGap("8px"),gridTemplateColumns:M.segmentedOptionGridColumns("0px 24px 1fr"),padding:M.segmentedOptionPadding("4px 12px"),font:M.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:M.segmentedFocusShadow(`inset 0 0 0 2px ${M.segmentedOptionCurrentBackground("#44a")}`),borderRadius:M.segmentedOptionsBorderRadius("8px")},":host label.current":{color:M.segmentedOptionCurrentColor("#eee"),background:M.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:M.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${M.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:M.segmentOptionIconSize("16px"),stroke:M.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:M.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:M.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:M.segmentedOptionsBorderRadius("8px"),background:M.segmentedOptionsBackground("#fff"),color:M.segmentedOptionColor("#222"),overflow:"hidden",alignItems:M.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:M.segmentedOptionPadding("4px 12px"),color:M.segmentedOptionCurrentColor("#eee"),background:M.segmentedOptionCurrentBackground("#44a"),font:M.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:M.segmentedOptionCurrentColor("#eee"),opacity:M.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:X}=this.parts,{values:K,isOtherValue:Q}=this;X.querySelectorAll("label").forEach((Z)=>{let q=Z.querySelector("input")?.value??"";Z.classList.toggle("current",K.includes(q)||q===""&&Q)})}handleChange=()=>{let{options:X,custom:K}=this.parts;if(this.multiple){let Q=[...X.querySelectorAll("input:checked")];this.value=Q.map((Z)=>Z.value).join(",")}else{let Q=X.querySelector("input:checked");if(!Q)this.value="";else if(Q.value)K.setAttribute("hidden",""),this.value=Q.value;else K.removeAttribute("hidden"),K.focus(),K.select(),this.value=K.value}this.syncCurrent()};handleKey=(X)=>{let K=!1;switch(X.code){case"Space":if(X.target instanceof HTMLLabelElement)X.target.click(),K=!0;break;case"Tab":if(!(X.target instanceof HTMLLabelElement))X.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let Q=X.target.closest("label");if(Q.previousElementSibling instanceof HTMLLabelElement)Q.previousElementSibling.focus()}K=!0;break;case"ArrowRight":case"ArrowDown":{let Q=X.target.closest("label");if(Q.nextElementSibling instanceof HTMLLabelElement)Q.nextElementSibling.focus()}K=!0;break}if(K)X.preventDefault(),X.stopPropagation()};connectedCallback(){super.connectedCallback();let X=this.getAttribute("choices");if(X&&this._choices.length===0)this._choices=F9.parseChoicesString(X);let{options:K}=this.parts;if(this.name==="")this.name=this.instanceId;if(K.addEventListener("change",this.handleChange),K.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 X=[...this.choices];if(this.other&&!this.multiple){let[K,Q]=this.other.split(":");X.push({value:"",caption:K,icon:Q})}return X}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((X)=>X.value===this.value))}render(){super.render();let{options:X,custom:K}=this.parts,Q=this.multiple?"checkbox":"radio",{values:Z,isOtherValue:q}=this,J=this._choicesWithOther,Y=(G)=>Z.includes(G)||G===""&&q,z=[...X.querySelectorAll("label")];if(z.length===J.length&&z.every((G,W)=>G.querySelector("input")?.value===J[W].value))z.forEach((G)=>{let W=G.querySelector("input");if(W&&W.checked!==Y(W.value))W.checked=Y(W.value)});else X.textContent="",X.append(...J.map((G)=>Kg({tabindex:0},AA({type:Q,name:this.name,value:G.value,checked:Y(G.value),tabIndex:-1}),G.icon||{class:"no-icon"},this.localized?u0(G.caption):Qg(G.caption))));if(this.other&&!this.multiple){K.hidden=!q;let G=q?this.value:"";if(K.value!==G)K.value=G;if(K.placeholder=this.placeholder,K.parentElement!==X)X.append(K)}this.syncCurrent()}}var Zg=F9,CA=F9.elementCreator(),qg=w2((...X)=>CA(...X),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:MA}=S;class jU extends x{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[MA({part:"normal"}),MA({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:X,small:K}=this.parts,Q=this.offsetParent;if(!(Q instanceof HTMLElement))return;else if(Q.offsetWidth<this.minWidth||Q.offsetHeight<this.minHeight)X.hidden=!0,K.hidden=!1,this.value="small";else X.hidden=!1,K.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var Jg=jU.elementCreator();class oK extends x{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:R.resizeIconFill}};content=E.resize();get minSize(){let{minWidth:X,minHeight:K}=getComputedStyle(this.target);return{width:parseFloat(X)||32,height:parseFloat(K)||32}}resizeTarget=(X)=>{let{target:K}=this;if(!K)return;let{offsetWidth:Q,offsetHeight:Z}=K;K.style.left=K.offsetLeft+"px",K.style.top=K.offsetTop+"px",K.style.bottom="",K.style.right="";let{minSize:q}=this;Q0(X,(J,Y,z)=>{if(K.style.width=Math.max(q.width,Q+J)+"px",K.style.height=Math.max(q.height,Z+Y)+"px",z.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let X={passive:!0};this.addEventListener("mousedown",this.resizeTarget,X),this.addEventListener("touchstart",this.resizeTarget,X)}}var Yg=oK,DA=oK.elementCreator(),zg=DA;var{div:Ug,input:Gg,span:Wg,button:VU}=S,IA=(X)=>X.split(/(?<!\\),/).map((K)=>K.trim().replace(/\\,/g,",")),$g=(X)=>X.map((K)=>K.replace(/,/g,"\\,")).join(",");class P6 extends x{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":M.brandColor("blue"),"--tag-text-color":M.brandTextColor("white"),display:"inline-flex",borderRadius:M.tagRoundedRadius(R.spacing50),color:R.tagTextColor,background:R.tagBg,padding:`0 ${R.spacing75} 0 ${R.spacing75}`,height:`calc(${R.lineHeight} + ${R.spacing50})`,lineHeight:`calc(${R.lineHeight} + ${R.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:M.fontSize("16px"),color:R.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${R.spacing_50} 0 ${R.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:R.spacing150,width:R.spacing150,color:R.tagCloseButtonColor,background:R.tagCloseButtonBg,borderRadius:M.tagCloseButtonRadius("99px"),opacity:R.tagButtonOpacity},':host [part="remove"]:hover':{background:R.tagCloseButtonBg,opacity:R.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[Wg({part:"caption"},this.caption),VU(E.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var _g=P6,OU=P6.elementCreator(),jg=w2((...X)=>OU(...X),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class R9 extends x{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:R.tagListBg,gap:R.spacing25,borderRadius:M.taglistRoundedRadius(R.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${R.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${R.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:R.inputBg,borderRadius:M.tagContainerRadius(R.spacing50),boxShadow:R.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:R.spacing25,minHeight:`calc(${R.lineHeight} + ${R.spacing})`,padding:R.spacing25},':host [part="tagMenu"]':{width:R.touchSize,height:R.touchSize,lineHeight:R.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:R.brandColor,color:R.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return IA(this.value).filter((X)=>X!=="")}set tags(X){this.value=$g(X)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(X){if(typeof X==="string")this._availableTags=R9.parseAvailableTagsString(X);else this._availableTags=X;this.queueRender()}static parseAvailableTagsString(X){return IA(X).map((K)=>K===""?null:K)}connectedCallback(){super.connectedCallback();let X=this.getAttribute("available-tags");if(X&&this._availableTags.length===0)this._availableTags=R9.parseAvailableTagsString(X)}formDisabledCallback(X){this.disabled=X}formResetCallback(){this.value=""}addTag=(X)=>{let K=X.trim();if(K===""||this.tags.includes(K))return;this.tags=[...this.tags,K],this.queueRender(!0)};toggleTag=(X)=>{if(this.tags.includes(X))this.tags=this.tags.filter((K)=>K!==X),this.queueRender(!0);else this.addTag(X)};enterTag=(X)=>{let{tagInput:K}=this.parts;switch(X.key){case",":{let Q=K.value.split(",")[0];this.addTag(Q)}break;case"Enter":{let Q=K.value.split(",")[0];this.addTag(Q)}X.stopPropagation(),X.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:X}=this,{tagMenu:K}=this.parts,Q=[...this.availableTags],Z=this.tags.filter((J)=>!Q.includes(J));if(Z.length)Q.push(null,...Z);let q=Q.map((J)=>{if(J===""||J===null)return null;else if(typeof J==="object")return{checked:()=>this.tags.includes(J.value),caption:J.caption,action(){X(J.value)}};else return{checked:()=>this.tags.includes(J),caption:J,action(){X(J)}}});f1({target:K,width:"auto",menuItems:q})};content=()=>[VU({type:"button",style:{visibility:"hidden"},tabindex:-1}),Ug({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),Gg({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),VU({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},E.chevronDown())];removeTag=(X)=>{if(this.editable&&!this.disabled){let K=X.target.closest(P6.tagName);this.tags=this.tags.filter((Q)=>Q!==K.caption),K.remove(),this.queueRender(!0)}X.stopPropagation(),X.preventDefault()};render(){super.render();let{tagContainer:X,tagMenu:K,tagInput:Q}=this.parts;if(K.disabled=this.disabled,Q.value="",Q.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)K.toggleAttribute("hidden",!1),Q.toggleAttribute("hidden",!this.textEntry);else K.toggleAttribute("hidden",!0),Q.toggleAttribute("hidden",!0);X.textContent="";for(let Z of this.tags)X.append(OU({caption:Z,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var Vg=R9,PA=R9.elementCreator(),Og=w2((...X)=>PA(...X),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var LA="1.9.2";var{span:Hg}=S,L6=null,tK=null,eK=null,M4="tosi-tooltip",Fg={[`.${M4}`]:{pointerEvents:"none",padding:M.tosiTooltipPadding("4px 10px"),borderRadius:M.tosiTooltipRadius("6px"),background:M.tosiTooltipBg("#333"),color:M.tosiTooltipColor("#fff"),fontSize:M.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:M.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${M4} p`]:{margin:"0"},[`.${M4} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${M4} a`]:{color:"inherit"},[`.${M4}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${M4}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},yA=!1;function kA(){if(yA)return;yA=!0,z0("tosi-tooltip",Fg)}function B9(){if(tK!==null)clearTimeout(tK),tK=null;if(L6!==null)L6.remove(),L6=null;eK=null}function Rg(X){if(X.startsWith("s"))return"tt-s";if(X.startsWith("n"))return"tt-n";if(X.startsWith("e"))return"tt-e";if(X.startsWith("w"))return"tt-w";return"tt-s"}function Bg(X,K,Q){let Z=K.getBoundingClientRect(),q=X.getBoundingClientRect(),J=Z.left+Z.width*0.5,Y=Z.top+Z.height*0.5,z;if(Q.startsWith("s")||Q.startsWith("n"))z=Math.max(8,Math.min(q.width-8,J-q.left))-4;else z=Math.max(8,Math.min(q.height-8,Y-q.top))-4;X.style.setProperty("--tosi-tooltip-arrow",z+"px")}function Ng(X,K){if(K)X=C1(X);let Q=Hg({class:M4});return Q.innerHTML=O1.parseInline(X),Q}function Ag(X,K,Q){kA(),B9(),eK=X;let{top:Z,left:q,width:J}=X.getBoundingClientRect(),Y=q+J*0.5,z=window.innerHeight,U=window.innerWidth,G=(Z>z*0.5?"n":"s")+(Y>U*0.5?"w":"e"),W=Ng(K,Q);W.classList.add(Rg(G)),L6=X6({content:W,target:X,position:G,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(L6&&eK)Bg(W,X,G)})}function Cg(X){for(let K of X.composedPath())if(K instanceof HTMLElement&&K.dataset.tooltip)return K;return null}function Mg(X={}){kA();let{convertTitles:K=!0,delay:Q=250,localize:Z=!1}=X;document.addEventListener("pointermove",(q)=>{if(K){for(let z of q.composedPath())if(z instanceof HTMLElement&&z.title&&!z.dataset.tooltip){z.dataset.tooltip=z.title,z.removeAttribute("title");break}}let J=Cg(q);if(J===eK)return;if(B9(),!J)return;let Y=J.dataset.tooltip||null;if(!Y)return;tK=setTimeout(()=>Ag(J,Y,Z),Q)}),document.addEventListener("pointerleave",B9),document.addEventListener("pointerdown",B9),document.addEventListener("keydown",B9),window.addEventListener("scroll",B9,!0)}Object.assign(globalThis,{xinjs:x9,xinjsui:HU});})();
272
+ `+Z;else Q.push(Z)}return Q},[]);this.innerHTML=K.map((Q)=>Q.startsWith("<")&&Q.endsWith(">")?Q:O1(Q,this.options)).join("")}else this.innerHTML=O1(X,this.options);this.didRender()}}var kv=dK,QU=dK.elementCreator(),Tv=QU,Sv=QU;var{div:ZU,span:cK,button:qU}=S,A6=86400000,Ev=[0,1,2,3,4,5,6],xv=[1,2,3,4,5,6,7,8,9,10,11,12],JU=(X,K=2,Q="0")=>String(X).padStart(K,Q),C6=(X,K,Q)=>new Date(`${X}-${JU(K)}-${JU(Q)}`);class YU extends x{static preferredTagName="tosi-month";static lightStyleSpec={":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:M.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:M.monthTodayBackground("transparent"),boxShadow:M.monthTodayShadow("none"),backdropFilter:M.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:M.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:M.monthDayColor("hotpink"),background:M.monthDayBackground("white"),fontWeight:M.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:M.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:M.monthDateCheckedColor("white"),background:M.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:M.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:M.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:M.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:M.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:M.monthDateCheckedBorderRadius("10px")}};static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:C6(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:C6(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(X){this.disabled=X}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return xv.map((X)=>({caption:C6(2025,X,1).toString().split(" ")[1],value:String(X)}))}get years(){let X=Number(this.minDate.split("-")[0]),K=Number(this.maxDate.split("-")[0]),Q=[];for(let Z=X;Z<=K;Z++)Q.push(String(Z));return Q}monthChanged=(X,K)=>{};gotoMonth(X,K){if(this.month!==K||this.year!==X)this.month=K,this.year=X,this.monthChanged(X,K)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(X){this.selectedDays[1]=X,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(X){this.selectedDays[0]=X,this.selectedDays.splice(2)}clickDate=(X)=>{let K=X.target.getAttribute("title");this.selectDate(K)};keyDate=(X)=>{let K=!1;switch(X.code){case"Space":{let Q=X.target.getAttribute("title");this.selectDate(Q),K=!0;break}case"Tab":break;default:console.log(X)}if(K)X.preventDefault(),X.stopPropagation()};#X="";selectDate=(X)=>{if(this.#X=X,this.range){if(!this.to)this.selectedDays=[X,X];else if(this.from===X&&this.to===X)this.selectedDays=[];else if(this.from===X)this.from=this.to;else if(this.to===X)this.to=this.from;else if(X<this.from)this.from=X;else if(X>this.to)this.to=X;else this.to=X;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(X))this.selectedDays.splice(this.selectedDays.indexOf(X),1);else this.selectedDays.push(X),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(X))this.value="",this.selectedDays=[];else this.value=X,this.selectedDays=[X]};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=(X)=>{if(!this.range)return this.selectedDays.includes(X);else if(this.range)return this.from&&X>=this.from&&X<=this.to;return!1};dateMenuItem=(X,K="")=>{return X=X.split("T")[0],{caption:K||X,enabled:()=>!X.startsWith(`${this.year}-${JU(this.month)}-`),action:()=>{this.gotoDate(X)}}};jumpMenu=()=>{f1({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((X)=>this.dateMenuItem(X))]})};content=()=>[ZU({part:"header"},qU({part:"previous",onClick:this.previousMonth},E.chevronLeft()),cK({style:{flex:"1"}}),qU({part:"jump",onClick:this.jumpMenu},E.calendar()),C0({part:"month",options:this.months,onChange:this.setMonth}),C0({part:"year",options:[this.year],onChange:this.setMonth}),cK({style:{flex:"1"}}),qU({part:"next",onClick:this.nextMonth},E.chevronRight())),ZU({part:"week"}),ZU({part:"days"})];gotoDate(X){let K=new Date(X);this.gotoMonth(K.getFullYear(),K.getMonth()+1)}connectedCallback(){super.connectedCallback();let X=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=X.getMonth()+1;if(isNaN(this.year))this.year=X.getFullYear()}days=[];render(){super.render();let{week:X,days:K,jump:Q,month:Z,year:q,previous:J,next:Y}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let z=C6(this.year,this.month,1),U=new Date(z.valueOf()-(7+z.getDay()-this.weekStart)%7*A6),G=this.month===12?1:this.month+1,W=new Date(C6(this.year+(this.month===12?1:0),G,1).valueOf()-A6),$=new Date(W.valueOf()+(this.weekStart*2+5+this.endDay-W.getDay())%7*A6),_=Ev.map((N)=>new Date(U.valueOf()+N*A6).toString().split(" ")[0]);this.days=[];let V=new Date().toISOString().split("T")[0];for(let N=U.valueOf();N<=$.valueOf();N+=A6){let A=new Date(N),D=A.toISOString().split("T")[0];this.days.push({date:A,selected:!1,inMonth:A.getMonth()+1===this.month,isToday:D===V,isWeekend:A.getDay()%6===0,inRange:!!(this.from&&D>=this.from&&D<=this.to)})}Z.value=String(this.month),q.value=String(this.year),Z.disabled=q.disabled=Q.disabled=J.disabled=Y.disabled=this.disabled||this.readonly,q.options=this.years,X.textContent="",X.append(..._.map((N)=>cK({class:"day"},N))),K.textContent="";let O=null,{to:H,from:B}=this;K.append(...this.days.map((N)=>{let A=["date"];if(N.inMonth)A.push("in-month");if(N.isToday)A.push("today");let D=N.date.toISOString().split("T")[0];if(this.checkDay(D))A.push("checked");if(A.push(N.isWeekend?"weekend":"weekday"),this.range){if(H===D)A.push("range-end");if(B===D)A.push("range-start")}let L=cK({class:A.join(" "),title:D,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},N.date.getDate());if(D===this.#X)O=L;return L})),O?.focus()}}var bv=YU.elementCreator();var $A=async(X,K="SHA-1")=>{let Z=new TextEncoder().encode(X),q=await crypto.subtle.digest(K,Z);return Array.from(new Uint8Array(q)).map((z)=>z.toString(16).padStart(2,"0")).join("")},_A=async(X)=>{let K=await $A(X),Q=await fetch(`https://weakpass.com/api/v1/search/${K}`);if(Q.ok){let Z=await Q.json();console.log("password found in weakpass database",Z)}return Q.status!==404},{span:zU,tosiSlot:wv}=S;class iK extends x{static preferredTagName="tosi-password-strength";static lightStyleSpec={":host":{display:"inline-flex",flexDirection:"column",gap:R.spacing50,position:"relative"},":host tosi-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:M.meterHeight("24px"),background:M.indicatorBg("white"),borderRadius:M.meterRadius("4px"),boxShadow:M.meterShadow(`inset 0 0 0 2px ${R.indicatorColor}`)},':host [part="level"]':{height:M.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:R.indicatorColor,margin:M.levelMargin("2px"),borderRadius:M.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:R.descriptionColor,height:M.meterHeight("24px"),lineHeight:M.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(X){return this.issues={tooShort:X.length<this.minLength,short:X.length<this.goodLength,noUpper:!X.match(/[A-Z]/),noLower:!X.match(/[a-z]/),noNumber:!X.match(/[0-9]/),noSpecial:!X.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((K)=>!K).length-1}async isBreached(){let X=this.querySelector("input")?.value;if(!X||typeof X!=="string")return!0;return await _A(X)}updateIndicator=(X)=>{let{level:K,description:Q}=this.parts,Z=this.indicatorColors.split(","),q=this.descriptionColors.split(","),J=this.strength(X);if(this.value!==J)this.value=J,this.dispatchEvent(new Event("change"));K.style.width=`${(J+1)*16.67}%`,this.style.setProperty("--indicator-color",Z[J]),this.style.setProperty("--description-color",q[J]),Q.textContent=this.strengthDescriptions[J]};update=(X)=>{let K=X.target.closest("input");this.updateIndicator(K?.value||"")};content=()=>[wv({onInput:this.update}),zU({part:"meter"},zU({part:"level"}),zU({part:"description"}))];render(){super.render();let X=this.querySelector("input");this.updateIndicator(X?.value)}}var hv=iK,jA=iK.elementCreator(),vv=jA;var{span:UU}=S;class sK extends x{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(X){this.readonly=X}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=()=>UU({part:"container"},UU({part:"empty"}),UU({part:"filled"}));displayValue(X){let{empty:K,filled:Q}=this.parts,q=Math.round((typeof X==="string"?0:X||0)/this.step)*this.step;Q.style.width=q/this.max*K.offsetWidth+"px"}update=(X)=>{if(this.readonly)return;let{empty:K}=this.parts,Q=X instanceof MouseEvent?X.pageX-K.getBoundingClientRect().x:0,Z=Math.min(Math.max(this.min,Math.round(Q/K.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(X.type==="click")this.value=Z;else if(X.type==="mousemove")this.displayValue(Z);else this.displayValue(this.value||0)};handleKey=(X)=>{let K=this.value===""?NaN:Number(this.value);if(isNaN(K))K=Math.round((this.min+this.max)*0.5*this.step)*this.step;let Q=!1;switch(X.key){case"ArrowUp":case"ArrowRight":K+=this.step,Q=!0;break;case"ArrowDown":case"ArrowLeft":K-=this.step,Q=!0;break}if(this.value=Math.max(Math.min(K,this.max),this.min),Q)X.stopPropagation(),X.preventDefault()};connectedCallback(){super.connectedCallback();let{container:X}=this.parts;X.tabIndex=0,X.addEventListener("mousemove",this.update,!0),X.addEventListener("mouseleave",this.update),X.addEventListener("blur",this.update),X.addEventListener("click",this.update),X.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let X=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",X),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:K,filled:Q}=this.parts;if(K.style.setProperty("--tosi-icon-fill",this.hollow?"none":this.emptyFill),K.style.setProperty("--tosi-icon-stroke",this.emptyStroke),Q.style.setProperty("--tosi-icon-fill",this.ratingFill),Q.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let Z=0;Z<this.max;Z++)K.append(E[this.icon]()),Q.append(E[this.icon]())}this.displayValue(this.value)}}var gv=sK,VA=sK.elementCreator(),mv=w2((...X)=>VA(...X),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{tosiSlot:OA,div:uv,button:fv}=S,lv=[{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 GU(X=lv){return C0({title:"paragraph style",slot:"toolbar",class:"block-style",options:X.map(({caption:K,tagType:Q})=>({caption:K,value:`formatBlock,${Q}`}))})}var M6=()=>ez({slot:"toolbar"});function i0(X,K,Q){return fv({slot:"toolbar",dataCommand:K,title:X},Q)}var pv=()=>[i0("left-justify","justifyLeft",E.alignLeft()),i0("center","justifyCenter",E.alignCenter()),i0("right-justify","justifyRight",E.alignRight()),M6(),i0("bullet list","insertUnorderedList",E.listBullet()),i0("numbered list","insertOrderedList",E.listNumber()),M6(),i0("indent","indent",E.indent()),i0("indent","outdent",E.outdent())],HA=()=>[i0("bold","bold",E.fontBold()),i0("italic","italic",E.fontItalic()),i0("underline","underline",E.fontUnderline())],dv=()=>[GU(),M6(),...HA()],FA=()=>[GU(),M6(),...pv(),M6(),...HA()];class rK extends x{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(X){if(this.isInitialized)this.parts.doc.contentEditable=X?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(X){let K=this._value;if(this._value=X,this.isInitialized){if(this.parts.doc.innerHTML!==X)this.parts.doc.innerHTML=X}if(K!==X&&this.internals)this.internals.setFormValue(X)}blockElement(X){let{doc:K}=this.parts;while(X.parentElement!==null&&X.parentElement!==K)X=X.parentElement;return X.parentElement===K?X:void 0}get selectedBlocks(){let{doc:X}=this.parts,K=window.getSelection();if(K===null)return[];let Q=[];for(let Z=0;Z<K.rangeCount;Z++){let q=K.getRangeAt(Z);if(!X.contains(q.commonAncestorContainer))continue;let J=this.blockElement(q.startContainer),Y=this.blockElement(q.endContainer);Q.push(J);while(J!==Y&&J!==null)J=J.nextElementSibling,Q.push(J)}return Q}get selectedText(){let X=window.getSelection();if(X===null)return"";return this.selectedBlocks.length?X.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(X)=>{if(this._updatingBlockStyle)return;let Q=X.target?.closest(F4.tagName);if(Q==null)return;this.doCommand(Q.value)};handleButtonClick=(X)=>{let Q=X.target?.closest("button");if(Q==null)return;this.doCommand(Q.dataset.command)};content=[OA({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),uv({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),OA({part:"content"})];doCommand(X){if(X===void 0)return;let K=X.split(",");console.log("execCommand",K[0],!1,...K.slice(1)),document.execCommand(K[0],!1,...K.slice(1))}updateBlockStyle(){let X=this.parts.toolbar.querySelector(".block-style");if(X===null)return;let K=this.selectedBlocks.map((Q)=>Q.tagName);K=[...new Set(K)],this._updatingBlockStyle=!0,X.value=K.length===1?`formatBlock,${K[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:X,content:K}=this.parts;if(K.innerHTML!==""&&X.innerHTML==="")X.innerHTML=K.innerHTML,K.innerHTML="";this.isInitialized=!0,K.style.display="none",X.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(Q)=>{this.updateBlockStyle(),this.selectionChange(Q,this)})}render(){let{toolbar:X}=this.parts;if(super.render(),X.children.length===0)switch(this.widgets){case"minimal":X.append(...dv());break;case"default":X.append(...FA());break}}}var cv=rK,RA=rK.elementCreator(),iv=w2((...X)=>RA(...X),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{router:D6}=Y2({router:{path:"",hash:"",pattern:""}}),WU={};function sv(){return{...WU}}var aK=[],$U=!1,nK=new Set;function rv(X){let K=[];if(X==="")return{regex:/^\/?$/,paramNames:K};let Q=X.split("/").map((q)=>{if(q.startsWith(":"))return K.push(q.slice(1)),"([^/]+)";return q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});return{regex:new RegExp("^/?"+Q.join("/")+"/?$"),paramNames:K}}function av(X){let K=X.split("?")[0].split("#")[0];for(let Z of aK){if(Z.fallback)continue;let q=K.match(Z.regex);if(q){let J={};return Z.paramNames.forEach((Y,z)=>{J[Y]=decodeURIComponent(q[z+1])}),{route:Z,params:J}}}let Q=aK.find((Z)=>Z.fallback);if(Q)return{route:Q,params:{}};return null}function I6(){let X=$U?window.location.hash.replace(/^#\/?/,""):window.location.pathname;D6.path.value=X,D6.hash.value=window.location.hash;let K=av(X);if(K){WU=K.params,D6.pattern.value=K.route.regex.source;let Q=new Map;for(let Z of K.route.targets)Q.set(Z.view??"default",Z);for(let Z of nK){let q=Z.name||"default",J=Q.get(q);if(J)Z.replaceChildren(J.component(K.params));else Z.replaceChildren()}}else{WU={},D6.pattern.value="";for(let Q of nK)Q.replaceChildren()}}var BA=!1;function NA(){if(BA)return;BA=!0,window.addEventListener("popstate",I6),window.addEventListener("hashchange",I6)}function nv(X,K={}){$U=K.hashRouting??!1,aK=X.map((Q)=>{let{regex:Z,paramNames:q}=rv(Q.pattern);return{regex:Z,paramNames:q,targets:Q.targets,fallback:Q.fallback??!1}}),NA(),I6()}function ov(X){if(NA(),$U)window.location.hash="#/"+X.replace(/^\//,"");else window.history.pushState({},"","/"+X.replace(/^\//,""));I6()}class _U extends x{static preferredTagName="tosi-route-view";static initAttributes={name:"default"};content=null;connectedCallback(){if(super.connectedCallback(),nK.add(this),aK.length>0)I6()}disconnectedCallback(){super.disconnectedCallback(),nK.delete(this)}}var tv=_U.elementCreator();var{div:ev,slot:Xg,label:Kg,span:Qg,input:AA}=S;class F9 extends x{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(X){if(typeof X==="string")this._choices=F9.parseChoicesString(X);else this._choices=X;this.queueRender()}static parseChoicesString(X){return X.split(",").filter((K)=>K.trim()!=="").map((K)=>{let[Q,Z]=K.split("=").map((z)=>z.trim()),[q,J]=(Z||Q).split(":").map((z)=>z.trim()),Y=J?E[J]():"";return{value:Q,icon:Y,caption:q}})}value="";formDisabledCallback(X){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((X)=>X.trim()).filter((X)=>X!=="")}content=()=>[Xg(),ev({part:"options"},AA({part:"custom",hidden:!0}))];static shadowStyleSpec={":host":{display:"inline-flex",gap:M.segmentedOptionGap("8px"),alignItems:M.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:M.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:M.segmentedOptionGap("8px"),gridTemplateColumns:M.segmentedOptionGridColumns("0px 24px 1fr"),padding:M.segmentedOptionPadding("4px 12px"),font:M.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:M.segmentedFocusShadow(`inset 0 0 0 2px ${M.segmentedOptionCurrentBackground("#44a")}`),borderRadius:M.segmentedOptionsBorderRadius("8px")},":host label.current":{color:M.segmentedOptionCurrentColor("#eee"),background:M.segmentedOptionCurrentBackground("#44a")},":host label.current:focus":{boxShadow:M.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${M.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:M.segmentOptionIconSize("16px"),stroke:M.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:M.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:M.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:M.segmentedOptionsBorderRadius("8px"),background:M.segmentedOptionsBackground("#fff"),color:M.segmentedOptionColor("#222"),overflow:"hidden",alignItems:M.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:M.segmentedOptionPadding("4px 12px"),color:M.segmentedOptionCurrentColor("#eee"),background:M.segmentedOptionCurrentBackground("#44a"),font:M.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:M.segmentedOptionCurrentColor("#eee"),opacity:M.segmentedPlaceholderOpacity(0.75)}};syncCurrent(){let{options:X}=this.parts,{values:K,isOtherValue:Q}=this;X.querySelectorAll("label").forEach((Z)=>{let q=Z.querySelector("input")?.value??"";Z.classList.toggle("current",K.includes(q)||q===""&&Q)})}handleChange=()=>{let{options:X,custom:K}=this.parts;if(this.multiple){let Q=[...X.querySelectorAll("input:checked")];this.value=Q.map((Z)=>Z.value).join(",")}else{let Q=X.querySelector("input:checked");if(!Q)this.value="";else if(Q.value)K.setAttribute("hidden",""),this.value=Q.value;else K.removeAttribute("hidden"),K.focus(),K.select(),this.value=K.value}this.syncCurrent()};handleKey=(X)=>{let K=!1;switch(X.code){case"Space":if(X.target instanceof HTMLLabelElement)X.target.click(),K=!0;break;case"Tab":if(!(X.target instanceof HTMLLabelElement))X.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let Q=X.target.closest("label");if(Q.previousElementSibling instanceof HTMLLabelElement)Q.previousElementSibling.focus()}K=!0;break;case"ArrowRight":case"ArrowDown":{let Q=X.target.closest("label");if(Q.nextElementSibling instanceof HTMLLabelElement)Q.nextElementSibling.focus()}K=!0;break}if(K)X.preventDefault(),X.stopPropagation()};connectedCallback(){super.connectedCallback();let X=this.getAttribute("choices");if(X&&this._choices.length===0)this._choices=F9.parseChoicesString(X);let{options:K}=this.parts;if(this.name==="")this.name=this.instanceId;if(K.addEventListener("change",this.handleChange),K.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 X=[...this.choices];if(this.other&&!this.multiple){let[K,Q]=this.other.split(":");X.push({value:"",caption:K,icon:Q})}return X}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((X)=>X.value===this.value))}render(){super.render();let{options:X,custom:K}=this.parts,Q=this.multiple?"checkbox":"radio",{values:Z,isOtherValue:q}=this,J=this._choicesWithOther,Y=(G)=>Z.includes(G)||G===""&&q,z=[...X.querySelectorAll("label")];if(z.length===J.length&&z.every((G,W)=>G.querySelector("input")?.value===J[W].value))z.forEach((G)=>{let W=G.querySelector("input");if(W&&W.checked!==Y(W.value))W.checked=Y(W.value)});else X.textContent="",X.append(...J.map((G)=>Kg({tabindex:0},AA({type:Q,name:this.name,value:G.value,checked:Y(G.value),tabIndex:-1}),G.icon||{class:"no-icon"},this.localized?u0(G.caption):Qg(G.caption))));if(this.other&&!this.multiple){K.hidden=!q;let G=q?this.value:"";if(K.value!==G)K.value=G;if(K.placeholder=this.placeholder,K.parentElement!==X)X.append(K)}this.syncCurrent()}}var Zg=F9,CA=F9.elementCreator(),qg=w2((...X)=>CA(...X),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:MA}=S;class jU extends x{static preferredTagName="tosi-sizebreak";static initAttributes={minWidth:0,minHeight:0};value="normal";content=[MA({part:"normal"}),MA({part:"small",name:"small"})];static shadowStyleSpec={":host":{display:"inline-block",position:"relative"}};handleResize=()=>{let{normal:X,small:K}=this.parts,Q=this.offsetParent;if(!(Q instanceof HTMLElement))return;else if(Q.offsetWidth<this.minWidth||Q.offsetHeight<this.minHeight)X.hidden=!0,K.hidden=!1,this.value="small";else X.hidden=!1,K.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.handleResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.handleResize)}}var Jg=jU.elementCreator();class oK extends x{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:R.resizeIconFill}};content=E.resize();get minSize(){let{minWidth:X,minHeight:K}=getComputedStyle(this.target);return{width:parseFloat(X)||32,height:parseFloat(K)||32}}resizeTarget=(X)=>{let{target:K}=this;if(!K)return;let{offsetWidth:Q,offsetHeight:Z}=K;K.style.left=K.offsetLeft+"px",K.style.top=K.offsetTop+"px",K.style.bottom="",K.style.right="";let{minSize:q}=this;Q0(X,(J,Y,z)=>{if(K.style.width=Math.max(q.width,Q+J)+"px",K.style.height=Math.max(q.height,Z+Y)+"px",z.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let X={passive:!0};this.addEventListener("mousedown",this.resizeTarget,X),this.addEventListener("touchstart",this.resizeTarget,X)}}var Yg=oK,DA=oK.elementCreator(),zg=DA;var{div:Ug,input:Gg,span:Wg,button:VU}=S,IA=(X)=>X.split(/(?<!\\),/).map((K)=>K.trim().replace(/\\,/g,",")),$g=(X)=>X.map((K)=>K.replace(/,/g,"\\,")).join(",");class P6 extends x{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":M.brandColor("blue"),"--tag-text-color":M.brandTextColor("white"),display:"inline-flex",borderRadius:M.tagRoundedRadius(R.spacing50),color:R.tagTextColor,background:R.tagBg,padding:`0 ${R.spacing75} 0 ${R.spacing75}`,height:`calc(${R.lineHeight} + ${R.spacing50})`,lineHeight:`calc(${R.lineHeight} + ${R.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:M.fontSize("16px"),color:R.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${R.spacing_50} 0 ${R.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:R.spacing150,width:R.spacing150,color:R.tagCloseButtonColor,background:R.tagCloseButtonBg,borderRadius:M.tagCloseButtonRadius("99px"),opacity:R.tagButtonOpacity},':host [part="remove"]:hover':{background:R.tagCloseButtonBg,opacity:R.tagButtonHoverOpacity}};static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[Wg({part:"caption"},this.caption),VU(E.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var _g=P6,OU=P6.elementCreator(),jg=w2((...X)=>OU(...X),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class R9 extends x{static preferredTagName="tosi-tag-list";static lightStyleSpec={":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:R.tagListBg,gap:R.spacing25,borderRadius:M.taglistRoundedRadius(R.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${R.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${R.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:R.inputBg,borderRadius:M.tagContainerRadius(R.spacing50),boxShadow:R.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:R.spacing25,minHeight:`calc(${R.lineHeight} + ${R.spacing})`,padding:R.spacing25},':host [part="tagMenu"]':{width:R.touchSize,height:R.touchSize,lineHeight:R.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:R.brandColor,color:R.brandTextColor}};static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return IA(this.value).filter((X)=>X!=="")}set tags(X){this.value=$g(X)}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(X){if(typeof X==="string")this._availableTags=R9.parseAvailableTagsString(X);else this._availableTags=X;this.queueRender()}static parseAvailableTagsString(X){return IA(X).map((K)=>K===""?null:K)}connectedCallback(){super.connectedCallback();let X=this.getAttribute("available-tags");if(X&&this._availableTags.length===0)this._availableTags=R9.parseAvailableTagsString(X)}formDisabledCallback(X){this.disabled=X}formResetCallback(){this.value=""}addTag=(X)=>{let K=X.trim();if(K===""||this.tags.includes(K))return;this.tags=[...this.tags,K],this.queueRender(!0)};toggleTag=(X)=>{if(this.tags.includes(X))this.tags=this.tags.filter((K)=>K!==X),this.queueRender(!0);else this.addTag(X)};enterTag=(X)=>{let{tagInput:K}=this.parts;switch(X.key){case",":{let Q=K.value.split(",")[0];this.addTag(Q)}break;case"Enter":{let Q=K.value.split(",")[0];this.addTag(Q)}X.stopPropagation(),X.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:X}=this,{tagMenu:K}=this.parts,Q=[...this.availableTags],Z=this.tags.filter((J)=>!Q.includes(J));if(Z.length)Q.push(null,...Z);let q=Q.map((J)=>{if(J===""||J===null)return null;else if(typeof J==="object")return{checked:()=>this.tags.includes(J.value),caption:J.caption,action(){X(J.value)}};else return{checked:()=>this.tags.includes(J),caption:J,action(){X(J)}}});f1({target:K,width:"auto",menuItems:q})};content=()=>[VU({type:"button",style:{visibility:"hidden"},tabindex:-1}),Ug({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),Gg({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),VU({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},E.chevronDown())];removeTag=(X)=>{if(this.editable&&!this.disabled){let K=X.target.closest(P6.tagName);this.tags=this.tags.filter((Q)=>Q!==K.caption),K.remove(),this.queueRender(!0)}X.stopPropagation(),X.preventDefault()};render(){super.render();let{tagContainer:X,tagMenu:K,tagInput:Q}=this.parts;if(K.disabled=this.disabled,Q.value="",Q.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)K.toggleAttribute("hidden",!1),Q.toggleAttribute("hidden",!this.textEntry);else K.toggleAttribute("hidden",!0),Q.toggleAttribute("hidden",!0);X.textContent="";for(let Z of this.tags)X.append(OU({caption:Z,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var Vg=R9,PA=R9.elementCreator(),Og=w2((...X)=>PA(...X),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var LA="1.9.4";var{span:Hg}=S,L6=null,tK=null,eK=null,M4="tosi-tooltip",Fg={[`.${M4}`]:{pointerEvents:"none",padding:M.tosiTooltipPadding("4px 10px"),borderRadius:M.tosiTooltipRadius("6px"),background:M.tosiTooltipBg("#333"),color:M.tosiTooltipColor("#fff"),fontSize:M.tosiTooltipFontSize("13px"),lineHeight:"1.4",maxWidth:M.tosiTooltipMaxWidth("280px"),whiteSpace:"pre-line",boxShadow:"0 2px 8px #0003",position:"relative"},[`.${M4} p`]:{margin:"0"},[`.${M4} code`]:{background:"#fff2",padding:"0 4px",borderRadius:"3px",fontSize:"0.9em"},[`.${M4} a`]:{color:"inherit"},[`.${M4}::before`]:{content:'""',position:"absolute",width:"8px",height:"8px",background:"inherit",transform:"rotate(45deg)"},[`.${M4}.tt-s::before`]:{top:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-n::before`]:{bottom:"-4px",left:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-e::before`]:{left:"-4px",top:"var(--tosi-tooltip-arrow)"},[`.${M4}.tt-w::before`]:{right:"-4px",top:"var(--tosi-tooltip-arrow)"}},yA=!1;function kA(){if(yA)return;yA=!0,z0("tosi-tooltip",Fg)}function B9(){if(tK!==null)clearTimeout(tK),tK=null;if(L6!==null)L6.remove(),L6=null;eK=null}function Rg(X){if(X.startsWith("s"))return"tt-s";if(X.startsWith("n"))return"tt-n";if(X.startsWith("e"))return"tt-e";if(X.startsWith("w"))return"tt-w";return"tt-s"}function Bg(X,K,Q){let Z=K.getBoundingClientRect(),q=X.getBoundingClientRect(),J=Z.left+Z.width*0.5,Y=Z.top+Z.height*0.5,z;if(Q.startsWith("s")||Q.startsWith("n"))z=Math.max(8,Math.min(q.width-8,J-q.left))-4;else z=Math.max(8,Math.min(q.height-8,Y-q.top))-4;X.style.setProperty("--tosi-tooltip-arrow",z+"px")}function Ng(X,K){if(K)X=C1(X);let Q=Hg({class:M4});return Q.innerHTML=O1.parseInline(X),Q}function Ag(X,K,Q){kA(),B9(),eK=X;let{top:Z,left:q,width:J}=X.getBoundingClientRect(),Y=q+J*0.5,z=window.innerHeight,U=window.innerWidth,G=(Z>z*0.5?"n":"s")+(Y>U*0.5?"w":"e"),W=Ng(K,Q);W.classList.add(Rg(G)),L6=X6({content:W,target:X,position:G,remainOnScroll:"remove",remainOnResize:"remove"}),requestAnimationFrame(()=>{if(L6&&eK)Bg(W,X,G)})}function Cg(X){for(let K of X.composedPath())if(K instanceof HTMLElement&&K.dataset.tooltip)return K;return null}function Mg(X={}){kA();let{convertTitles:K=!0,delay:Q=250,localize:Z=!1}=X;document.addEventListener("pointermove",(q)=>{if(K){for(let z of q.composedPath())if(z instanceof HTMLElement&&z.title&&!z.dataset.tooltip){z.dataset.tooltip=z.title,z.removeAttribute("title");break}}let J=Cg(q);if(J===eK)return;if(B9(),!J)return;let Y=J.dataset.tooltip||null;if(!Y)return;tK=setTimeout(()=>Ag(J,Y,Z),Q)}),document.addEventListener("pointerleave",B9),document.addEventListener("pointerdown",B9),document.addEventListener("keydown",B9),window.addEventListener("scroll",B9,!0)}Object.assign(globalThis,{xinjs:x9,xinjsui:HU});})();
273
273
 
274
- //# debugId=E4DAD652DB1603D664756E2164756E21
274
+ //# debugId=BED79E573BF3230C64756E2164756E21
275
275
  //# sourceMappingURL=iife.js.map