tosijs-ui 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iife.js +2 -2
- package/dist/iife.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/iife.js
CHANGED
|
@@ -90,7 +90,7 @@ ${r}
|
|
|
90
90
|
${h}`}).join(`
|
|
91
91
|
`)}function u9(i){let l={};return i.input.onControllerAddedObservable.add((s)=>{s.onMotionControllerInitObservable.add((t)=>{let r={};t.getComponentIds().forEach((a)=>{let o=t.getComponent(a);if(r[a]={pressed:o.pressed},o.onButtonStateChangedObservable.add(()=>{r[a].pressed=o.pressed}),o.onAxisValueChangedObservable)r[a].axes=[],o.onAxisValueChangedObservable.add((x)=>{r[a].axes=x})}),l[t.handedness]=r})}),l}function j9(i){if(i===void 0||Object.keys(i).length===0)return"no xr inputs";return Object.keys(i).map((l)=>{let s=i[l],t=Object.keys(s).filter((r)=>s[r].pressed).join(" ");return`${l}
|
|
92
92
|
${t}`}).join(`
|
|
93
|
-
`)}var{div:L9}=g;class N1 extends v{static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(i){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=L9({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static styleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(N1.mapboxCSSAvailable===void 0)N1.mapboxCSSAvailable=Y2("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((i)=>{console.error("failed to load mapbox-gl.css",i)}),N1.mapboxAvailable=Y("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((i)=>{console.error("failed to load mapbox-gl.js",i)})}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[r,h,a]=this.coords.split(",").map((o)=>Number(o));this._map.setCenter([h,r]),this._map.setZoom(a),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:i}=this.parts,[l,s,t]=this.coords.split(",").map((r)=>Number(r));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,N1.mapboxAvailable.then(({mapboxgl:r})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),r.accessToken=this.token,this._map=new r.Map({container:i,style:this.mapStyle,zoom:t,center:[s,l]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let h=this._map.getCenter(),a=this._map.getZoom(),o=`${h.lat.toFixed(6)},${h.lng.toFixed(6)},${a.toFixed(1)}`;if(o!==this.value){if(this.internals)this.internals.setFormValue(o)}})})}}var _9=N1.elementCreator({tag:"xin-map"});var{div:Ei,span:w0,button:Ri}=g,m2=86400000,V9=[0,1,2,3,4,5,6],q9=[1,2,3,4,5,6,7,8,9,10,11,12],Di=(i,l=2,s="0")=>String(i).padStart(l,s),u2=(i,l,s)=>new Date(`${i}-${Di(l)}-${Di(s)}`);class Ii extends v{static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:u2(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:u2(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(i){this.disabled=i}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return q9.map((i)=>({caption:u2(2025,i,1).toString().split(" ")[1],value:String(i)}))}get years(){let i=Number(this.minDate.split("-")[0]),l=Number(this.maxDate.split("-")[0]),s=[];for(let t=i;t<=l;t++)s.push(String(t));return s}monthChanged=(i,l)=>{};gotoMonth(i,l){if(this.month!==l||this.year!==i)this.month=l,this.year=i,this.monthChanged(i,l)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(i){this.selectedDays[1]=i,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(i){this.selectedDays[0]=i,this.selectedDays.splice(2)}clickDate=(i)=>{let l=i.target.getAttribute("title");this.selectDate(l)};keyDate=(i)=>{let l=!1;switch(i.code){case"Space":{let s=i.target.getAttribute("title");this.selectDate(s),l=!0;break}case"Tab":break;default:console.log(i)}if(l)i.preventDefault(),i.stopPropagation()};#i="";selectDate=(i)=>{if(this.#i=i,this.range){if(!this.to)this.selectedDays=[i,i];else if(this.from===i&&this.to===i)this.selectedDays=[];else if(this.from===i)this.from=this.to;else if(this.to===i)this.to=this.from;else if(i<this.from)this.from=i;else if(i>this.to)this.to=i;else this.to=i;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(i))this.selectedDays.splice(this.selectedDays.indexOf(i),1);else this.selectedDays.push(i),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(i))this.value="",this.selectedDays=[];else this.value=i,this.selectedDays=[i]};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=(i)=>{if(!this.range)return this.selectedDays.includes(i);else if(this.range)return this.from&&i>=this.from&&i<=this.to;return!1};dateMenuItem=(i,l="")=>{return i=i.split("T")[0],{caption:l||i,enabled:()=>!i.startsWith(`${this.year}-${Di(this.month)}-`),action:()=>{this.gotoDate(i)}}};jumpMenu=()=>{J({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((i)=>this.dateMenuItem(i))]})};content=()=>[Ei({part:"header"},Ri({part:"previous",onClick:this.previousMonth},f.chevronLeft()),w0({style:{flex:"1"}}),Ri({part:"jump",onClick:this.jumpMenu},f.calendar()),o1({part:"month",options:this.months,onChange:this.setMonth}),o1({part:"year",options:[this.year],onChange:this.setMonth}),w0({style:{flex:"1"}}),Ri({part:"next",onClick:this.nextMonth},f.chevronRight())),Ei({part:"week"}),Ei({part:"days"})];gotoDate(i){let l=new Date(i);this.gotoMonth(l.getFullYear(),l.getMonth()+1)}connectedCallback(){super.connectedCallback();let i=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=i.getMonth()+1;if(isNaN(this.year))this.year=i.getFullYear()}days=[];render(){super.render();let{week:i,days:l,jump:s,month:t,year:r,previous:h,next:a}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let o=u2(this.year,this.month,1),x=new Date(o.valueOf()-(7+o.getDay()-this.weekStart)%7*m2),y=this.month===12?1:this.month+1,c=new Date(u2(this.year+(this.month===12?1:0),y,1).valueOf()-m2),e=new Date(c.valueOf()+(this.weekStart*2+5+this.endDay-c.getDay())%7*m2),d=V9.map((z)=>new Date(x.valueOf()+z*m2).toString().split(" ")[0]);this.days=[];let w=new Date().toISOString().split("T")[0];for(let z=x.valueOf();z<=e.valueOf();z+=m2){let H=new Date(z),m=H.toISOString().split("T")[0];this.days.push({date:H,selected:!1,inMonth:H.getMonth()+1===this.month,isToday:m===w,isWeekend:H.getDay()%6===0,inRange:!!(this.from&&m>=this.from&&m<=this.to)})}t.value=String(this.month),r.value=String(this.year),t.disabled=r.disabled=s.disabled=h.disabled=a.disabled=this.disabled||this.readonly,r.options=this.years,i.textContent="",i.append(...d.map((z)=>w0({class:"day"},z))),l.textContent="";let k=null,{to:b,from:L}=this;l.append(...this.days.map((z)=>{let H=["date"];if(z.inMonth)H.push("in-month");if(z.isToday)H.push("today");let m=z.date.toISOString().split("T")[0];if(this.checkDay(m))H.push("checked");if(H.push(z.isWeekend?"weekend":"weekday"),this.range){if(b===m)H.push("range-end");if(L===m)H.push("range-start")}let Z=w0({class:H.join(" "),title:m,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},z.date.getDate());if(m===this.#i)k=Z;return Z})),k?.focus()}}var O9=Ii.elementCreator({tag:"tosi-month",styleSpec:{":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:p.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:p.monthTodayBackground("transparent"),boxShadow:p.monthTodayShadow("none"),backdropFilter:p.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:p.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:p.monthDayColor("hotpink"),background:p.monthDayBackground("white"),fontWeight:p.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:p.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:p.monthDateCheckedColor("white"),background:p.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:p.monthDateCheckedBorderRadius("10px")}}});var{div:Ti,button:$9}=g,U9={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class Y1 extends v{static singleton;static styleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${n.notificationSpacing} ${n.notificationSpacing50} ${n.notificationSpacing} ${n.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:n.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:n.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:n.notificationSpacing,width:n.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:n.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important"},":host *":{color:n.notificationTextColor},":host .note":{display:"grid",background:n.notificationBg,padding:n.notificationPadding,gridTemplateColumns:`${n.notificationIconSize} 1fr ${n.notificationButtonSize}`,gap:n.notificationSpacing,alignItems:"center",borderRadius:n.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${n.notificationAccentColor}`,borderColor:n.notificationAccentColor,borderWidth:n.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note .icon":{stroke:n.notificationAccentColor},":host .note button":{display:"flex",lineHeight:n.notificationButtonSize,padding:0,margin:0,height:n.notificationButtonSize,width:n.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:n.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:n.notificationBg,background:n.notificationAccentColor,padding:n.spacing50},":host .note svg":{height:n.notificationIconSize,width:n.notificationIconSize,pointerEvents:"none"},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:n.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(i){i.classList.add("closing"),i.style.marginBottom=-i.offsetHeight+"px";let l=()=>{i.remove()};i.addEventListener("transitionend",l),setTimeout(l,1000)}static post(i){let{message:l,duration:s,type:t,close:r,progress:h,icon:a,color:o}=Object.assign({type:"info",duration:-1},typeof i==="string"?{message:i}:i);if(!this.singleton)this.singleton=o5();let x=this.singleton;document.body.append(x),x.style.zIndex=String(J1()+1);let y=o||U9[t],c=h||t==="progress"?g.progress():{},e=()=>{if(r)r();Y1.removeNote(k)},d=a instanceof SVGElement?a:a?f[a]({class:"icon"}):f.info({class:"icon"}),w=t==="error"||t==="warn",k=Ti({class:`note ${t}`,role:w?"alert":"status",ariaLive:w?"assertive":"polite",style:{_notificationAccentColor:y}},d,Ti({class:"message"},Ti(l),c),$9({class:"close",title:"close",ariaLabel:"Close notification",apply(b){b.addEventListener("click",e)}},f.x()));if(x.shadowRoot.append(k),c instanceof HTMLProgressElement&&h instanceof Function){c.setAttribute("max",String(100)),c.value=h();let b=setInterval(()=>{if(!x.shadowRoot.contains(k)){clearInterval(b);return}let L=h();if(c.value=L,L>=100)Y1.removeNote(k)},1000)}if(s>0)setTimeout(()=>{Y1.removeNote(k)},s*1000);return k.scrollIntoView(),e}content=null}var o5=Y1.elementCreator({tag:"xin-notification"});function J9(i){return Y1.post(i)}var x5=async(i,l="SHA-1")=>{let t=new TextEncoder().encode(i),r=await crypto.subtle.digest(l,t);return Array.from(new Uint8Array(r)).map((o)=>o.toString(16).padStart(2,"0")).join("")},y5=async(i)=>{let l=await x5(i),s=await fetch(`https://weakpass.com/api/v1/search/${l}`);if(s.ok){let t=await s.json();console.log("password found in weakpass database",t)}return s.status!==404},{span:Si,xinSlot:Q9}=g;class il extends v{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(i){return this.issues={tooShort:i.length<this.minLength,short:i.length<this.goodLength,noUpper:!i.match(/[A-Z]/),noLower:!i.match(/[a-z]/),noNumber:!i.match(/[0-9]/),noSpecial:!i.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((l)=>!l).length-1}async isBreached(){let i=this.querySelector("input")?.value;if(!i||typeof i!=="string")return!0;return await y5(i)}updateIndicator=(i)=>{let{level:l,description:s}=this.parts,t=this.indicatorColors.split(","),r=this.descriptionColors.split(","),h=this.strength(i);if(this.value!==h)this.value=h,this.dispatchEvent(new Event("change"));l.style.width=`${(h+1)*16.67}%`,this.style.setProperty("--indicator-color",t[h]),this.style.setProperty("--description-color",r[h]),s.textContent=this.strengthDescriptions[h]};update=(i)=>{let l=i.target.closest("input");this.updateIndicator(l?.value||"")};content=()=>[Q9({onInput:this.update}),Si({part:"meter"},Si({part:"level"}),Si({part:"description"}))];render(){super.render();let i=this.querySelector("input");this.updateIndicator(i?.value)}}var G9=il.elementCreator({tag:"xin-password-strength",styleSpec:{":host":{display:"inline-flex",flexDirection:"column",gap:n.spacing50,position:"relative"},":host xin-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:p.meterHeight("24px"),background:p.indicatorBg("white"),borderRadius:p.meterRadius("4px"),boxShadow:p.meterShadow(`inset 0 0 0 2px ${n.indicatorColor}`)},':host [part="level"]':{height:p.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:n.indicatorColor,margin:p.levelMargin("2px"),borderRadius:p.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:n.descriptionColor,height:p.meterHeight("24px"),lineHeight:p.meterHeight("24px"),textAlign:"center"}}});var{span:ll}=g;class M0 extends v{static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"none",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(i){this.readonly=i}formResetCallback(){this.value=""}static styleSpec={":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=()=>ll({part:"container"},ll({part:"empty"}),ll({part:"filled"}));displayValue(i){let{empty:l,filled:s}=this.parts,r=Math.round((typeof i==="string"?0:i||0)/this.step)*this.step;s.style.width=r/this.max*l.offsetWidth+"px"}update=(i)=>{if(this.readonly)return;let{empty:l}=this.parts,s=i instanceof MouseEvent?i.pageX-l.getBoundingClientRect().x:0,t=Math.min(Math.max(this.min,Math.round(s/l.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(i.type==="click")this.value=t;else if(i.type==="mousemove")this.displayValue(t);else this.displayValue(this.value||0)};handleKey=(i)=>{let l=this.value===""?NaN:Number(this.value);if(isNaN(l))l=Math.round((this.min+this.max)*0.5*this.step)*this.step;let s=!1;switch(i.key){case"ArrowUp":case"ArrowRight":l+=this.step,s=!0;break;case"ArrowDown":case"ArrowLeft":l-=this.step,s=!0;break}if(this.value=Math.max(Math.min(l,this.max),this.min),s)i.stopPropagation(),i.preventDefault()};connectedCallback(){super.connectedCallback();let{container:i}=this.parts;i.tabIndex=0,i.addEventListener("mousemove",this.update,!0),i.addEventListener("mouseleave",this.update),i.addEventListener("blur",this.update),i.addEventListener("click",this.update),i.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let i=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",i),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:l,filled:s}=this.parts;if(l.classList.toggle("hollow",this.hollow),l.style.setProperty("--tosi-icon-fill",this.emptyFill),l.style.setProperty("--tosi-icon-stroke",this.emptyStroke),s.style.setProperty("--tosi-icon-fill",this.ratingFill),s.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let t=0;t<this.max;t++)l.append(f[this.icon]()),s.append(f[this.icon]())}this.displayValue(this.value)}}var Z9=M0,n5=M0.elementCreator({tag:"tosi-rating"}),K9=$((...i)=>n5(...i),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{xinSlot:c5,div:X9,button:N9,span:e5}=g,Y9=[{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 sl(i=Y9){return o1({title:"paragraph style",slot:"toolbar",class:"block-style",options:i.map(({caption:l,tagType:s})=>({caption:l,value:`formatBlock,${s}`}))})}function a2(i="10px"){return e5({slot:"toolbar",style:{flex:`0 0 ${i}`,content:" "}})}function W9(i="10px"){return e5({slot:"toolbar",style:{flex:`0 0 ${i}`,content:" "}})}function s1(i,l,s){return N9({slot:"toolbar",dataCommand:l,title:i},s)}var E9=()=>[s1("left-justify","justifyLeft",f.alignLeft()),s1("center","justifyCenter",f.alignCenter()),s1("right-justify","justifyRight",f.alignRight()),a2(),s1("bullet list","insertUnorderedList",f.listBullet()),s1("numbered list","insertOrderedList",f.listNumber()),a2(),s1("indent","indent",f.indent()),s1("indent","outdent",f.outdent())],p5=()=>[s1("bold","bold",f.fontBold()),s1("italic","italic",f.fontItalic()),s1("underline","underline",f.fontUnderline())],R9=()=>[sl(),a2(),...p5()],d5=()=>[sl(),a2(),...E9(),a2(),...p5()];class B0 extends v{static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(i){if(this.isInitialized)this.parts.doc.contentEditable=i?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(i){let l=this._value;if(this._value=i,this.isInitialized){if(this.parts.doc.innerHTML!==i)this.parts.doc.innerHTML=i}if(l!==i&&this.internals)this.internals.setFormValue(i)}blockElement(i){let{doc:l}=this.parts;while(i.parentElement!==null&&i.parentElement!==l)i=i.parentElement;return i.parentElement===l?i:void 0}get selectedBlocks(){let{doc:i}=this.parts,l=window.getSelection();if(l===null)return[];let s=[];for(let t=0;t<l.rangeCount;t++){let r=l.getRangeAt(t);if(!i.contains(r.commonAncestorContainer))continue;let h=this.blockElement(r.startContainer),a=this.blockElement(r.endContainer);s.push(h);while(h!==a&&h!==null)h=h.nextElementSibling,s.push(h)}return s}get selectedText(){let i=window.getSelection();if(i===null)return"";return this.selectedBlocks.length?i.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(i)=>{if(this._updatingBlockStyle)return;let s=i.target?.closest(B1.tagName);if(s==null)return;this.doCommand(s.value)};handleButtonClick=(i)=>{let s=i.target?.closest("button");if(s==null)return;this.doCommand(s.dataset.command)};content=[c5({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),X9({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),c5({part:"content"})];doCommand(i){if(i===void 0)return;let l=i.split(",");console.log("execCommand",l[0],!1,...l.slice(1)),document.execCommand(l[0],!1,...l.slice(1))}updateBlockStyle(){let i=this.parts.toolbar.querySelector(".block-style");if(i===null)return;let l=this.selectedBlocks.map((s)=>s.tagName);l=[...new Set(l)],this._updatingBlockStyle=!0,i.value=l.length===1?`formatBlock,${l[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:i,content:l}=this.parts;if(l.innerHTML!==""&&i.innerHTML==="")i.innerHTML=l.innerHTML,l.innerHTML="";this.isInitialized=!0,l.style.display="none",i.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(s)=>{this.updateBlockStyle(),this.selectionChange(s,this)})}render(){let{toolbar:i}=this.parts;if(super.render(),i.children.length===0)switch(this.widgets){case"minimal":i.append(...R9());break;case"default":i.append(...d5());break}}}var D9=B0,g5=B0.elementCreator({tag:"tosi-rich-text",styleSpec:{":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}}}),I9=$((...i)=>g5(...i),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{div:T9,slot:S9,label:i6,span:l6,input:f5}=g;class o2 extends v{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(i){if(typeof i==="string")this._choices=o2.parseChoicesString(i);else this._choices=i;this.queueRender()}static parseChoicesString(i){return i.split(",").filter((l)=>l.trim()!=="").map((l)=>{let[s,t]=l.split("=").map((o)=>o.trim()),[r,h]=(t||s).split(":").map((o)=>o.trim()),a=h?f[h]():"";return{value:s,icon:a,caption:r}})}value="";formDisabledCallback(i){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((i)=>i.trim()).filter((i)=>i!=="")}content=()=>[S9(),T9({part:"options"},f5({part:"custom",hidden:!0}))];static styleSpec={":host":{display:"inline-flex",gap:p.segmentedOptionGap("8px"),alignItems:p.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:p.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:p.segmentedOptionGap("8px"),gridTemplateColumns:p.segmentedOptionGridColumns("0px 24px 1fr"),padding:p.segmentedOptionPadding("4px 12px"),font:p.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:p.segmentedFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentBackground("#44a")}`),borderRadius:p.segmentedOptionsBorderRadius("8px")},":host label:has(:checked)":{color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a")},":host label:has(:checked):focus":{boxShadow:p.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:p.segmentOptionIconSize("16px"),stroke:p.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:p.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:p.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:p.segmentedOptionsBorderRadius("8px"),background:p.segmentedOptionsBackground("#fff"),color:p.segmentedOptionColor("#222"),overflow:"hidden",alignItems:p.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:p.segmentedOptionPadding("4px 12px"),color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a"),font:p.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:p.segmentedOptionCurrentColor("#eee"),opacity:p.segmentedPlaceholderOpacity(0.75)}};valueChanged=!1;handleChange=()=>{let{options:i,custom:l}=this.parts;if(this.multiple){let s=[...i.querySelectorAll("input:checked")];this.value=s.map((t)=>t.value).join(",")}else{let s=i.querySelector("input:checked");if(!s)this.value="";else if(s.value)l.setAttribute("hidden",""),this.value=s.value;else l.removeAttribute("hidden"),l.focus(),l.select(),this.value=l.value}this.valueChanged=!0};handleKey=(i)=>{let l=!1;switch(i.code){case"Space":if(i.target instanceof HTMLLabelElement)i.target.click(),l=!0;break;case"Tab":if(!(i.target instanceof HTMLLabelElement))i.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let s=i.target.closest("label");if(s.previousElementSibling instanceof HTMLLabelElement)s.previousElementSibling.focus()}l=!0;break;case"ArrowRight":case"ArrowDown":{let s=i.target.closest("label");if(s.nextElementSibling instanceof HTMLLabelElement)s.nextElementSibling.focus()}l=!0;break}if(l)i.preventDefault(),i.stopPropagation()};connectedCallback(){super.connectedCallback();let i=this.getAttribute("choices");if(i&&this._choices.length===0)this._choices=o2.parseChoicesString(i);let{options:l}=this.parts;if(this.name==="")this.name=this.instanceId;if(l.addEventListener("change",this.handleChange),l.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 i=[...this.choices];if(this.other&&!this.multiple){let[l,s]=this.other.split(":");i.push({value:"",caption:l,icon:s})}return i}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((i)=>i.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:i,custom:l}=this.parts;i.textContent="";let s=this.multiple?"checkbox":"radio",{values:t,isOtherValue:r}=this;if(i.append(...this._choicesWithOther.map((h)=>{return i6({tabindex:0},f5({type:s,name:this.name,value:h.value,checked:t.includes(h.value)||h.value===""&&r,tabIndex:-1}),h.icon||{class:"no-icon"},this.localized?d1(h.caption):l6(h.caption))})),this.other&&!this.multiple)l.hidden=!r,l.value=r?this.value:"",l.placeholder=this.placeholder,i.append(l)}}var s6=o2,C5=o2.elementCreator({tag:"tosi-segmented"}),t6=$((...i)=>C5(...i),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:v5}=g;class tl extends v{static initAttributes={minWidth:0,minHeight:0};value="normal";content=[v5({part:"normal"}),v5({part:"small",name:"small"})];static styleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:i,small:l}=this.parts,s=this.offsetParent;if(!(s instanceof HTMLElement))return;else if(s.offsetWidth<this.minWidth||s.offsetHeight<this.minHeight)i.hidden=!0,l.hidden=!1,this.value="small";else i.hidden=!1,l.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var r6=tl.elementCreator({tag:"xin-sizebreak"});class rl extends v{target=null;static styleSpec={":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:n.resizeIconFill}};content=f.resize();get minSize(){let{minWidth:i,minHeight:l}=getComputedStyle(this.target);return{width:parseFloat(i)||32,height:parseFloat(l)||32}}resizeTarget=(i)=>{let{target:l}=this;if(!l)return;let{offsetWidth:s,offsetHeight:t}=l;l.style.left=l.offsetLeft+"px",l.style.top=l.offsetTop+"px",l.style.bottom="",l.style.right="";let{minSize:r}=this;K(i,(h,a,o)=>{if(l.style.width=Math.max(r.width,s+h)+"px",l.style.height=Math.max(r.height,t+a)+"px",o.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let i={passive:!0};this.addEventListener("mousedown",this.resizeTarget,i),this.addEventListener("touchstart",this.resizeTarget,i)}}var h6=rl.elementCreator({tag:"xin-sizer"});var{div:a6,input:o6,span:x6,button:hl}=g;class j2 extends v{static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[x6({part:"caption"},this.caption),hl(f.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var y6=j2,al=j2.elementCreator({tag:"tosi-tag",styleSpec:{":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":p.brandColor("blue"),"--tag-text-color":p.brandTextColor("white"),display:"inline-flex",borderRadius:p.tagRoundedRadius(n.spacing50),color:n.tagTextColor,background:n.tagBg,padding:`0 ${n.spacing75} 0 ${n.spacing75}`,height:`calc(${n.lineHeight} + ${n.spacing50})`,lineHeight:`calc(${n.lineHeight} + ${n.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:p.fontSize("16px"),color:n.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${n.spacing_50} 0 ${n.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:n.spacing150,width:n.spacing150,color:n.tagCloseButtonColor,background:n.tagCloseButtonBg,borderRadius:p.tagCloseButtonRadius("99px"),opacity:n.tagButtonOpacity},':host [part="remove"]:hover':{background:n.tagCloseButtonBg,opacity:n.tagButtonHoverOpacity}}}),n6=$((...i)=>al(...i),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class x2 extends v{static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return this.value.split(",").map((i)=>i.trim()).filter((i)=>i!=="")}set tags(i){this.value=i.join(",")}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(i){if(typeof i==="string")this._availableTags=x2.parseAvailableTagsString(i);else this._availableTags=i;this.queueRender()}static parseAvailableTagsString(i){return i.split(",").map((l)=>{let s=l.trim();return s===""?null:s})}connectedCallback(){super.connectedCallback();let i=this.getAttribute("available-tags");if(i&&this._availableTags.length===0)this._availableTags=x2.parseAvailableTagsString(i)}formDisabledCallback(i){this.disabled=i}formResetCallback(){this.value=""}addTag=(i)=>{let l=i.trim();if(l===""||this.tags.includes(l))return;this.tags=[...this.tags,l],this.queueRender(!0)};toggleTag=(i)=>{if(this.tags.includes(i))this.tags=this.tags.filter((l)=>l!==i),this.queueRender(!0);else this.addTag(i)};enterTag=(i)=>{let{tagInput:l}=this.parts;switch(i.key){case",":{let s=l.value.split(",")[0];this.addTag(s)}break;case"Enter":{let s=l.value.split(",")[0];this.addTag(s)}i.stopPropagation(),i.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:i}=this,{tagMenu:l}=this.parts,s=[...this.availableTags],t=this.tags.filter((h)=>!s.includes(h));if(t.length)s.push(null,...t);let r=s.map((h)=>{if(h===""||h===null)return null;else if(typeof h==="object")return{checked:()=>this.tags.includes(h.value),caption:h.caption,action(){i(h.value)}};else return{checked:()=>this.tags.includes(h),caption:h,action(){i(h)}}});J({target:l,width:"auto",menuItems:r})};content=()=>[hl({type:"button",style:{visibility:"hidden"},tabindex:-1}),a6({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),o6({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),hl({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},f.chevronDown())];removeTag=(i)=>{if(this.editable&&!this.disabled){let l=i.target.closest(j2.tagName);this.tags=this.tags.filter((s)=>s!==l.caption),l.remove(),this.queueRender(!0)}i.stopPropagation(),i.preventDefault()};render(){super.render();let{tagContainer:i,tagMenu:l,tagInput:s}=this.parts;if(l.disabled=this.disabled,s.value="",s.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)l.toggleAttribute("hidden",!1),s.toggleAttribute("hidden",!this.textEntry);else l.toggleAttribute("hidden",!0),s.toggleAttribute("hidden",!0);i.textContent="";for(let t of this.tags)i.append(al({caption:t,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var c6=x2,k5=x2.elementCreator({tag:"tosi-tag-list",styleSpec:{":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:n.tagListBg,gap:n.spacing25,borderRadius:p.taglistRoundedRadius(n.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${n.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${n.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:n.inputBg,borderRadius:p.tagContainerRadius(n.spacing50),boxShadow:n.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:n.spacing25,minHeight:`calc(${n.lineHeight} + ${n.spacing})`,padding:n.spacing25},':host [part="tagMenu"]':{width:n.touchSize,height:n.touchSize,lineHeight:n.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:n.brandColor,color:n.brandTextColor}}}),e6=$((...i)=>k5(...i),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var w5="1.2.0";var ol={accent:B.fromCss("#EE257B"),background:B.fromCss("#fafafa"),text:B.fromCss("#222222")},M5={_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 p6(i){let{accent:l,background:s,text:t}=i,r=i.accentText??l.contrasting(),h=i.backgroundInset??s.darken(0.03),a=i.border??t.opacity(0.15),o=i.shadow??t.opacity(0.1),x=i.focus??l.opacity(0.5);return{_tosiAccent:l,_tosiAccentLight:l.brighten(0.15),_tosiAccentDark:l.darken(0.15),_tosiAccentText:r,_tosiBg:s,_tosiBgInset:h,_tosiBgHover:s.darken(0.05),_tosiBgActive:s.darken(0.1),_tosiText:t,_tosiTextMuted:t.opacity(0.6),_tosiTextDisabled:t.opacity(0.4),_tosiBorder:a,_tosiBorderFocus:l,_tosiShadow:o,_tosiShadowColor:o,_tosiFocusRing:`0 0 0 2px ${x}`,_tosiInputBg:s,_tosiInputBorder:a,_tosiInputBorderFocus:l,_tosiButtonBg:s,_tosiButtonText:t,_tosiButtonBorder:a,_tosiButtonHoverBg:s.darken(0.05),_tosiButtonActiveBg:l,_tosiButtonActiveText:r}}function z0(i){return{":root":{...M5,...p6(i)}}}function B5(i){let s=z0(i)[":root"];return{":root":K0(s)}}function d6(i,l="tosi-theme"){O1(l,i)}var g6=z0(ol),f6=B5(ol),z5={"--xin-icon-size":n.tosiIconSize,"--xin-icon-fill":n.tosiIconFill,"--xin-icon-stroke":n.tosiIconStroke,"--xin-tabs-bar-color":n.tosiTabsBarColor,"--xin-tabs-bar-height":n.tosiTabsBarHeight,"--xin-tabs-selected-color":n.tosiTabsSelectedColor,"--spacing":n.tosiSpacing,"--gap":n.tosiSpacingSm,"--touch-size":n.tosiTouchSize,"--background":n.tosiBg,"--text-color":n.tosiText,"--brand-color":n.tosiAccent,"--brand-text-color":n.tosiAccentText};function C6(i){return{":root":{...z0(i)[":root"],...z5}}}function v6(i,l){let s={};for(let[t,r]of Object.entries(l)){let h=`--tosi-${i}-${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`;s[t]=`var(${h}, ${r})`}return s}Object.assign(globalThis,{xinjs:v2,xinjsui:xl});})();
|
|
93
|
+
`)}var{div:L9}=g;class N1 extends v{static formAssociated=!0;static initAttributes={coords:"65.01715565258993,25.48081004203459,12",token:"",mapStyle:"mapbox://styles/mapbox/streets-v12",name:""};value="";formDisabledCallback(i){}formResetCallback(){this.value="",this.coords="65.01715565258993,25.48081004203459,12"}content=L9({style:{width:"100%",height:"100%"}});get map(){return this._map}static mapboxCSSAvailable;static mapboxAvailable;_map;static styleSpec={":host":{display:"inline-block",position:"relative",width:"400px",height:"400px",textAlign:"left"}};constructor(){super();if(N1.mapboxCSSAvailable===void 0)N1.mapboxCSSAvailable=Y2("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.css").catch((i)=>{console.error("failed to load mapbox-gl.css",i)}),N1.mapboxAvailable=Y("https://api.mapbox.com/mapbox-gl-js/v3.15.0/mapbox-gl.js").catch((i)=>{console.error("failed to load mapbox-gl.js",i)})}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[r,h,a]=this.coords.split(",").map((o)=>Number(o));this._map.setCenter([h,r]),this._map.setZoom(a),this._lastCoords=this.coords}if(this.mapStyle!==this._lastStyle)this._map.setStyle(this.mapStyle),this._lastStyle=this.mapStyle;return}let{div:i}=this.parts,[l,s,t]=this.coords.split(",").map((r)=>Number(r));this._lastCoords=this.coords,this._lastStyle=this.mapStyle,N1.mapboxAvailable.then(({mapboxgl:r})=>{console.log("%cmapbox may complain about missing css -- don't panic!","background: orange; color: black; padding: 0 5px;"),r.accessToken=this.token,this._map=new r.Map({container:i,style:this.mapStyle,zoom:t,center:[s,l]}),this._map.on("render",()=>this._map.resize()),this._map.on("moveend",()=>{let h=this._map.getCenter(),a=this._map.getZoom(),o=`${h.lat.toFixed(6)},${h.lng.toFixed(6)},${a.toFixed(1)}`;if(o!==this.value){if(this.internals)this.internals.setFormValue(o)}})})}}var _9=N1.elementCreator({tag:"xin-map"});var{div:Ei,span:w0,button:Ri}=g,m2=86400000,V9=[0,1,2,3,4,5,6],q9=[1,2,3,4,5,6,7,8,9,10,11,12],Di=(i,l=2,s="0")=>String(i).padStart(l,s),u2=(i,l,s)=>new Date(`${i}-${Di(l)}-${Di(s)}`);class Ii extends v{static formAssociated=!0;static initAttributes={month:NaN,year:NaN,weekStart:0,minDate:u2(new Date().getFullYear()-100,1,1).toISOString().split("T")[0],maxDate:u2(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(i){this.disabled=i}formResetCallback(){this.value="",this.selectedDays=[]}get endDay(){return 1-this.weekStart}get months(){return q9.map((i)=>({caption:u2(2025,i,1).toString().split(" ")[1],value:String(i)}))}get years(){let i=Number(this.minDate.split("-")[0]),l=Number(this.maxDate.split("-")[0]),s=[];for(let t=i;t<=l;t++)s.push(String(t));return s}monthChanged=(i,l)=>{};gotoMonth(i,l){if(this.month!==l||this.year!==i)this.month=l,this.year=i,this.monthChanged(i,l)}setMonth=()=>{this.gotoMonth(Number(this.parts.year.value),Number(this.parts.month.value))};get to(){return this.selectedDays[1]||""}set to(i){this.selectedDays[1]=i,this.selectedDays.splice(2)}get from(){return this.selectedDays[0]||""}set from(i){this.selectedDays[0]=i,this.selectedDays.splice(2)}clickDate=(i)=>{let l=i.target.getAttribute("title");this.selectDate(l)};keyDate=(i)=>{let l=!1;switch(i.code){case"Space":{let s=i.target.getAttribute("title");this.selectDate(s),l=!0;break}case"Tab":break;default:console.log(i)}if(l)i.preventDefault(),i.stopPropagation()};#i="";selectDate=(i)=>{if(this.#i=i,this.range){if(!this.to)this.selectedDays=[i,i];else if(this.from===i&&this.to===i)this.selectedDays=[];else if(this.from===i)this.from=this.to;else if(this.to===i)this.to=this.from;else if(i<this.from)this.from=i;else if(i>this.to)this.to=i;else this.to=i;this.value=`${this.from},${this.to}`}else if(this.multiple){if(this.selectedDays.includes(i))this.selectedDays.splice(this.selectedDays.indexOf(i),1);else this.selectedDays.push(i),this.selectedDays.sort();this.value=this.selectedDays.join(",")}else if(this.selectable)if(this.selectedDays.includes(i))this.value="",this.selectedDays=[];else this.value=i,this.selectedDays=[i]};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=(i)=>{if(!this.range)return this.selectedDays.includes(i);else if(this.range)return this.from&&i>=this.from&&i<=this.to;return!1};dateMenuItem=(i,l="")=>{return i=i.split("T")[0],{caption:l||i,enabled:()=>!i.startsWith(`${this.year}-${Di(this.month)}-`),action:()=>{this.gotoDate(i)}}};jumpMenu=()=>{J({target:this.parts.jump,menuItems:[this.dateMenuItem(new Date().toISOString(),"This Month"),...this.selectedDays.length===0?[]:[null],...this.selectedDays.map((i)=>this.dateMenuItem(i))]})};content=()=>[Ei({part:"header"},Ri({part:"previous",onClick:this.previousMonth},f.chevronLeft()),w0({style:{flex:"1"}}),Ri({part:"jump",onClick:this.jumpMenu},f.calendar()),o1({part:"month",options:this.months,onChange:this.setMonth}),o1({part:"year",options:[this.year],onChange:this.setMonth}),w0({style:{flex:"1"}}),Ri({part:"next",onClick:this.nextMonth},f.chevronRight())),Ei({part:"week"}),Ei({part:"days"})];gotoDate(i){let l=new Date(i);this.gotoMonth(l.getFullYear(),l.getMonth()+1)}connectedCallback(){super.connectedCallback();let i=new Date(this.value.split(",").pop()||Date.now());if(isNaN(this.month))this.month=i.getMonth()+1;if(isNaN(this.year))this.year=i.getFullYear()}days=[];render(){super.render();let{week:i,days:l,jump:s,month:t,year:r,previous:h,next:a}=this.parts;this.selectedDays=this.value?this.value.split(","):[];let o=u2(this.year,this.month,1),x=new Date(o.valueOf()-(7+o.getDay()-this.weekStart)%7*m2),y=this.month===12?1:this.month+1,c=new Date(u2(this.year+(this.month===12?1:0),y,1).valueOf()-m2),e=new Date(c.valueOf()+(this.weekStart*2+5+this.endDay-c.getDay())%7*m2),d=V9.map((z)=>new Date(x.valueOf()+z*m2).toString().split(" ")[0]);this.days=[];let w=new Date().toISOString().split("T")[0];for(let z=x.valueOf();z<=e.valueOf();z+=m2){let H=new Date(z),m=H.toISOString().split("T")[0];this.days.push({date:H,selected:!1,inMonth:H.getMonth()+1===this.month,isToday:m===w,isWeekend:H.getDay()%6===0,inRange:!!(this.from&&m>=this.from&&m<=this.to)})}t.value=String(this.month),r.value=String(this.year),t.disabled=r.disabled=s.disabled=h.disabled=a.disabled=this.disabled||this.readonly,r.options=this.years,i.textContent="",i.append(...d.map((z)=>w0({class:"day"},z))),l.textContent="";let k=null,{to:b,from:L}=this;l.append(...this.days.map((z)=>{let H=["date"];if(z.inMonth)H.push("in-month");if(z.isToday)H.push("today");let m=z.date.toISOString().split("T")[0];if(this.checkDay(m))H.push("checked");if(H.push(z.isWeekend?"weekend":"weekday"),this.range){if(b===m)H.push("range-end");if(L===m)H.push("range-start")}let Z=w0({class:H.join(" "),title:m,onClick:this.clickDate,onKeydown:this.keyDate,tabindex:"0"},z.date.getDate());if(m===this.#i)k=Z;return Z})),k?.focus()}}var O9=Ii.elementCreator({tag:"tosi-month",styleSpec:{":host":{display:"block"},":host [part=header]":{display:"flex",alignItems:"stretch",justifyContent:"stretch"},":host[disabled]":{pointerEvents:"none",opacity:p.disabledOpacity(0.6)},':host [part="month"], :host [part="year"]':{_fieldWidth:"4em",flex:"1"},":host [part=week], :host [part=days]":{display:"grid",gridTemplateColumns:"auto auto auto auto auto auto auto",justifyItems:"stretch"},":host .today":{background:p.monthTodayBackground("transparent"),boxShadow:p.monthTodayShadow("none"),backdropFilter:p.monthTodayBackdropFilter("brightness(0.9)"),fontWeight:p.monthTodayFontWeight("800")},":host .day, :host .date":{padding:5,display:"flex",justifyContent:"center",userSelect:"none"},":host .day":{color:p.monthDayColor("hotpink"),background:p.monthDayBackground("white"),fontWeight:p.monthDayFontWeight("800")},":host .date":{cursor:"default"},":host .weekend":{background:p.monthWeekendBackground("#eee")},":host .date:not(.in-month)":{opacity:0.5},":host .date.checked":{color:p.monthDateCheckedColor("white"),background:p.monthDateCheckedBackground("hotpink")},":host:not([range]) .date.checked":{borderRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-start":{borderTopLeftRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomLeftRadius:p.monthDateCheckedBorderRadius("10px")},":host .range-end":{borderTopRightRadius:p.monthDateCheckedBorderRadius("10px"),borderBottomRightRadius:p.monthDateCheckedBorderRadius("10px")}}});var{div:Ti,button:$9}=g,U9={error:"red",warn:"orange",info:"royalblue",log:"gray",success:"green",progress:"royalblue"};class Y1 extends v{static singleton;static styleSpec={":host":{_notificationSpacing:8,_notificationWidth:360,_notificationPadding:`${n.notificationSpacing} ${n.notificationSpacing50} ${n.notificationSpacing} ${n.notificationSpacing200}`,_notificationBg:"#fafafa",_notificationAccentColor:"#aaa",_notificationTextColor:"#444",_notificationIconSize:n.notificationSpacing300,_notificationButtonSize:48,_notificationBorderWidth:"3px 0 0",_notificationBorderRadius:n.notificationSpacing50,position:"fixed",left:0,right:0,bottom:0,paddingBottom:n.notificationSpacing,width:n.notificationWidth,display:"flex",flexDirection:"column-reverse",margin:"0 auto",gap:n.notificationSpacing,maxHeight:"50vh",overflow:"hidden auto",boxShadow:"none !important"},":host *":{color:n.notificationTextColor},":host .note":{display:"grid",background:n.notificationBg,padding:n.notificationPadding,gridTemplateColumns:`${n.notificationIconSize} 1fr ${n.notificationButtonSize}`,gap:n.notificationSpacing,alignItems:"center",borderRadius:n.notificationBorderRadius,boxShadow:`0 2px 8px #0006, inset 0 0 0 2px ${n.notificationAccentColor}`,borderColor:n.notificationAccentColor,borderWidth:n.notificationBorderWidth,borderStyle:"solid",transition:"0.5s ease-in",transitionProperty:"margin, opacity",zIndex:1},":host .note .icon":{stroke:n.notificationAccentColor},":host .note button":{display:"flex",lineHeight:n.notificationButtonSize,padding:0,margin:0,height:n.notificationButtonSize,width:n.notificationButtonSize,background:"transparent",alignItems:"center",justifyContent:"center",boxShadow:"none",border:"none",position:"relative"},":host .note button:hover svg":{stroke:n.notificationAccentColor},":host .note button:active svg":{borderRadius:99,stroke:n.notificationBg,background:n.notificationAccentColor,padding:n.spacing50},":host .note svg":{height:n.notificationIconSize,width:n.notificationIconSize,pointerEvents:"none"},":host .message":{display:"flex",flexDirection:"column",alignItems:"center",gap:n.notificationSpacing},":host .note.closing":{opacity:0,zIndex:0}};static removeNote(i){i.classList.add("closing"),i.style.marginBottom=-i.offsetHeight+"px";let l=()=>{i.remove()};i.addEventListener("transitionend",l),setTimeout(l,1000)}static post(i){let{message:l,duration:s,type:t,close:r,progress:h,icon:a,color:o}=Object.assign({type:"info",duration:-1},typeof i==="string"?{message:i}:i);if(!this.singleton)this.singleton=o5();let x=this.singleton;document.body.append(x),x.style.zIndex=String(J1()+1);let y=o||U9[t],c=h||t==="progress"?g.progress():{},e=()=>{if(r)r();Y1.removeNote(k)},d=a instanceof SVGElement?a:a?f[a]({class:"icon"}):f.info({class:"icon"}),w=t==="error"||t==="warn",k=Ti({class:`note ${t}`,role:w?"alert":"status",ariaLive:w?"assertive":"polite",style:{_notificationAccentColor:y}},d,Ti({class:"message"},Ti(l),c),$9({class:"close",title:"close",ariaLabel:"Close notification",apply(b){b.addEventListener("click",e)}},f.x()));if(x.shadowRoot.append(k),c instanceof HTMLProgressElement&&h instanceof Function){c.setAttribute("max",String(100)),c.value=h();let b=setInterval(()=>{if(!x.shadowRoot.contains(k)){clearInterval(b);return}let L=h();if(c.value=L,L>=100)Y1.removeNote(k)},1000)}if(s>0)setTimeout(()=>{Y1.removeNote(k)},s*1000);return k.scrollIntoView(),e}content=null}var o5=Y1.elementCreator({tag:"xin-notification"});function J9(i){return Y1.post(i)}var x5=async(i,l="SHA-1")=>{let t=new TextEncoder().encode(i),r=await crypto.subtle.digest(l,t);return Array.from(new Uint8Array(r)).map((o)=>o.toString(16).padStart(2,"0")).join("")},y5=async(i)=>{let l=await x5(i),s=await fetch(`https://weakpass.com/api/v1/search/${l}`);if(s.ok){let t=await s.json();console.log("password found in weakpass database",t)}return s.status!==404},{span:Si,xinSlot:Q9}=g;class il extends v{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(i){return this.issues={tooShort:i.length<this.minLength,short:i.length<this.goodLength,noUpper:!i.match(/[A-Z]/),noLower:!i.match(/[a-z]/),noNumber:!i.match(/[0-9]/),noSpecial:!i.match(/[^a-zA-Z0-9]/)},this.issues.tooShort?0:Object.values(this.issues).filter((l)=>!l).length-1}async isBreached(){let i=this.querySelector("input")?.value;if(!i||typeof i!=="string")return!0;return await y5(i)}updateIndicator=(i)=>{let{level:l,description:s}=this.parts,t=this.indicatorColors.split(","),r=this.descriptionColors.split(","),h=this.strength(i);if(this.value!==h)this.value=h,this.dispatchEvent(new Event("change"));l.style.width=`${(h+1)*16.67}%`,this.style.setProperty("--indicator-color",t[h]),this.style.setProperty("--description-color",r[h]),s.textContent=this.strengthDescriptions[h]};update=(i)=>{let l=i.target.closest("input");this.updateIndicator(l?.value||"")};content=()=>[Q9({onInput:this.update}),Si({part:"meter"},Si({part:"level"}),Si({part:"description"}))];render(){super.render();let i=this.querySelector("input");this.updateIndicator(i?.value)}}var G9=il.elementCreator({tag:"xin-password-strength",styleSpec:{":host":{display:"inline-flex",flexDirection:"column",gap:n.spacing50,position:"relative"},":host xin-slot":{display:"flex"},':host [part="meter"]':{display:"block",position:"relative",height:p.meterHeight("24px"),background:p.indicatorBg("white"),borderRadius:p.meterRadius("4px"),boxShadow:p.meterShadow(`inset 0 0 0 2px ${n.indicatorColor}`)},':host [part="level"]':{height:p.levelHeight("20px"),content:'" "',display:"inline-block",width:0,transition:"0.15s ease-out",background:n.indicatorColor,margin:p.levelMargin("2px"),borderRadius:p.levelRadius("2px")},':host [part="description"]':{position:"absolute",inset:"0",color:n.descriptionColor,height:p.meterHeight("24px"),lineHeight:p.meterHeight("24px"),textAlign:"center"}}});var{span:ll}=g;class M0 extends v{static formAssociated=!0;static initAttributes={max:5,min:1,icon:"star",step:1,ratingStroke:"#e81",ratingFill:"#f91",emptyStroke:"none",emptyFill:"#ccc",readonly:!1,iconSize:24,hollow:!1,required:!1,name:""};value="";formDisabledCallback(i){this.readonly=i}formResetCallback(){this.value=""}static styleSpec={":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=()=>ll({part:"container"},ll({part:"empty"}),ll({part:"filled"}));displayValue(i){let{empty:l,filled:s}=this.parts,r=Math.round((typeof i==="string"?0:i||0)/this.step)*this.step;s.style.width=r/this.max*l.offsetWidth+"px"}update=(i)=>{if(this.readonly)return;let{empty:l}=this.parts,s=i instanceof MouseEvent?i.pageX-l.getBoundingClientRect().x:0,t=Math.min(Math.max(this.min,Math.round(s/l.offsetWidth*this.max/this.step+this.step*0.5)*this.step),this.max);if(i.type==="click")this.value=t;else if(i.type==="mousemove")this.displayValue(t);else this.displayValue(this.value||0)};handleKey=(i)=>{let l=this.value===""?NaN:Number(this.value);if(isNaN(l))l=Math.round((this.min+this.max)*0.5*this.step)*this.step;let s=!1;switch(i.key){case"ArrowUp":case"ArrowRight":l+=this.step,s=!0;break;case"ArrowDown":case"ArrowLeft":l-=this.step,s=!0;break}if(this.value=Math.max(Math.min(l,this.max),this.min),s)i.stopPropagation(),i.preventDefault()};connectedCallback(){super.connectedCallback();let{container:i}=this.parts;i.tabIndex=0,i.addEventListener("mousemove",this.update,!0),i.addEventListener("mouseleave",this.update),i.addEventListener("blur",this.update),i.addEventListener("click",this.update),i.addEventListener("keydown",this.handleKey)}_renderedIcon="";render(){super.render();let i=this.iconSize+"px";if(this.style.setProperty("--tosi-icon-size",i),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:l,filled:s}=this.parts;if(l.classList.toggle("hollow",this.hollow),l.style.setProperty("--tosi-icon-fill",this.emptyFill),l.style.setProperty("--tosi-icon-stroke",this.emptyStroke),s.style.setProperty("--tosi-icon-fill",this.ratingFill),s.style.setProperty("--tosi-icon-stroke",this.ratingStroke),this._renderedIcon!==this.icon){this._renderedIcon=this.icon;for(let t=0;t<this.max;t++)l.append(f[this.icon]()),s.append(f[this.icon]())}this.displayValue(this.value)}}var Z9=M0,n5=M0.elementCreator({tag:"tosi-rating"}),K9=$((...i)=>n5(...i),"xinRating is deprecated, use tosiRating instead (tag is now <tosi-rating>)");var{xinSlot:c5,div:X9,button:N9,span:e5}=g,Y9=[{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 sl(i=Y9){return o1({title:"paragraph style",slot:"toolbar",class:"block-style",options:i.map(({caption:l,tagType:s})=>({caption:l,value:`formatBlock,${s}`}))})}function a2(i="10px"){return e5({slot:"toolbar",style:{flex:`0 0 ${i}`,content:" "}})}function W9(i="10px"){return e5({slot:"toolbar",style:{flex:`0 0 ${i}`,content:" "}})}function s1(i,l,s){return N9({slot:"toolbar",dataCommand:l,title:i},s)}var E9=()=>[s1("left-justify","justifyLeft",f.alignLeft()),s1("center","justifyCenter",f.alignCenter()),s1("right-justify","justifyRight",f.alignRight()),a2(),s1("bullet list","insertUnorderedList",f.listBullet()),s1("numbered list","insertOrderedList",f.listNumber()),a2(),s1("indent","indent",f.indent()),s1("indent","outdent",f.outdent())],p5=()=>[s1("bold","bold",f.fontBold()),s1("italic","italic",f.fontItalic()),s1("underline","underline",f.fontUnderline())],R9=()=>[sl(),a2(),...p5()],d5=()=>[sl(),a2(),...E9(),a2(),...p5()];class B0 extends v{static formAssociated=!0;static initAttributes={widgets:"default",name:"",required:!1};isInitialized=!1;savedValue="";formDisabledCallback(i){if(this.isInitialized)this.parts.doc.contentEditable=i?"false":"true"}formResetCallback(){this.value=""}_value="";get value(){return this.isInitialized?this.parts.doc.innerHTML:this._value}set value(i){let l=this._value;if(this._value=i,this.isInitialized){if(this.parts.doc.innerHTML!==i)this.parts.doc.innerHTML=i}if(l!==i&&this.internals)this.internals.setFormValue(i)}blockElement(i){let{doc:l}=this.parts;while(i.parentElement!==null&&i.parentElement!==l)i=i.parentElement;return i.parentElement===l?i:void 0}get selectedBlocks(){let{doc:i}=this.parts,l=window.getSelection();if(l===null)return[];let s=[];for(let t=0;t<l.rangeCount;t++){let r=l.getRangeAt(t);if(!i.contains(r.commonAncestorContainer))continue;let h=this.blockElement(r.startContainer),a=this.blockElement(r.endContainer);s.push(h);while(h!==a&&h!==null)h=h.nextElementSibling,s.push(h)}return s}get selectedText(){let i=window.getSelection();if(i===null)return"";return this.selectedBlocks.length?i.toString():""}selectionChange=()=>{};_updatingBlockStyle=!1;handleSelectChange=(i)=>{if(this._updatingBlockStyle)return;let s=i.target?.closest(B1.tagName);if(s==null)return;this.doCommand(s.value)};handleButtonClick=(i)=>{let s=i.target?.closest("button");if(s==null)return;this.doCommand(s.dataset.command)};content=[c5({name:"toolbar",part:"toolbar",onClick:this.handleButtonClick,onChange:this.handleSelectChange}),X9({part:"doc",contenteditable:!0,style:{flex:"1 1 auto",outline:"none"}}),c5({part:"content"})];doCommand(i){if(i===void 0)return;let l=i.split(",");console.log("execCommand",l[0],!1,...l.slice(1)),document.execCommand(l[0],!1,...l.slice(1))}updateBlockStyle(){let i=this.parts.toolbar.querySelector(".block-style");if(i===null)return;let l=this.selectedBlocks.map((s)=>s.tagName);l=[...new Set(l)],this._updatingBlockStyle=!0,i.value=l.length===1?`formatBlock,${l[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:i,content:l}=this.parts;if(l.innerHTML!==""&&i.innerHTML==="")i.innerHTML=l.innerHTML,l.innerHTML="";this.isInitialized=!0,l.style.display="none",i.addEventListener("input",this.handleInput),this.updateValidity(),document.addEventListener("selectionchange",(s)=>{this.updateBlockStyle(),this.selectionChange(s,this)})}render(){let{toolbar:i}=this.parts;if(super.render(),i.children.length===0)switch(this.widgets){case"minimal":i.append(...R9());break;case"default":i.append(...d5());break}}}var D9=B0,g5=B0.elementCreator({tag:"tosi-rich-text",styleSpec:{":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}}}),I9=$((...i)=>g5(...i),"richText is deprecated, use tosiRichText instead (tag is now <tosi-rich-text>)");var{div:T9,slot:S9,label:i6,span:l6,input:f5}=g;class o2 extends v{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(i){if(typeof i==="string")this._choices=o2.parseChoicesString(i);else this._choices=i;this.queueRender()}static parseChoicesString(i){return i.split(",").filter((l)=>l.trim()!=="").map((l)=>{let[s,t]=l.split("=").map((o)=>o.trim()),[r,h]=(t||s).split(":").map((o)=>o.trim()),a=h?f[h]():"";return{value:s,icon:a,caption:r}})}value="";formDisabledCallback(i){}formResetCallback(){this.value=""}get values(){return(this.value||"").split(",").map((i)=>i.trim()).filter((i)=>i!=="")}content=()=>[S9(),T9({part:"options"},f5({part:"custom",hidden:!0}))];static styleSpec={":host":{display:"inline-flex",gap:p.segmentedOptionGap("8px"),alignItems:p.segmentedAlignItems("center")},":host, :host::part(options)":{flexDirection:p.segmentedDirection("row")},":host label":{display:"inline-grid",alignItems:"center",gap:p.segmentedOptionGap("8px"),gridTemplateColumns:p.segmentedOptionGridColumns("0px 24px 1fr"),padding:p.segmentedOptionPadding("4px 12px"),font:p.segmentedOptionFont("16px")},":host label:focus":{outline:"none",boxShadow:p.segmentedFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentBackground("#44a")}`),borderRadius:p.segmentedOptionsBorderRadius("8px")},":host label:has(:checked)":{color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a")},":host label:has(:checked):focus":{boxShadow:p.segmentedCurrentFocusShadow(`inset 0 0 0 2px ${p.segmentedOptionCurrentColor("#eee")}`)},":host svg":{height:p.segmentOptionIconSize("16px"),stroke:p.segmentedOptionIconColor("currentColor")},":host label.no-icon":{gap:0,gridTemplateColumns:p.segmentedOptionGridColumns("0px 1fr")},':host input[type="radio"], :host input[type="checkbox"]':{visibility:p.segmentedInputVisibility("hidden")},":host::part(options)":{display:"flex",borderRadius:p.segmentedOptionsBorderRadius("8px"),background:p.segmentedOptionsBackground("#fff"),color:p.segmentedOptionColor("#222"),overflow:"hidden",alignItems:p.segmentedOptionAlignItems("stretch")},":host::part(custom)":{padding:p.segmentedOptionPadding("4px 12px"),color:p.segmentedOptionCurrentColor("#eee"),background:p.segmentedOptionCurrentBackground("#44a"),font:p.segmentedOptionFont("16px"),border:"0",outline:"none"},":host::part(custom)::placeholder":{color:p.segmentedOptionCurrentColor("#eee"),opacity:p.segmentedPlaceholderOpacity(0.75)}};valueChanged=!1;handleChange=()=>{let{options:i,custom:l}=this.parts;if(this.multiple){let s=[...i.querySelectorAll("input:checked")];this.value=s.map((t)=>t.value).join(",")}else{let s=i.querySelector("input:checked");if(!s)this.value="";else if(s.value)l.setAttribute("hidden",""),this.value=s.value;else l.removeAttribute("hidden"),l.focus(),l.select(),this.value=l.value}this.valueChanged=!0};handleKey=(i)=>{let l=!1;switch(i.code){case"Space":if(i.target instanceof HTMLLabelElement)i.target.click(),l=!0;break;case"Tab":if(!(i.target instanceof HTMLLabelElement))i.target.closest("label").focus();break;case"ArrowLeft":case"ArrowUp":{let s=i.target.closest("label");if(s.previousElementSibling instanceof HTMLLabelElement)s.previousElementSibling.focus()}l=!0;break;case"ArrowRight":case"ArrowDown":{let s=i.target.closest("label");if(s.nextElementSibling instanceof HTMLLabelElement)s.nextElementSibling.focus()}l=!0;break}if(l)i.preventDefault(),i.stopPropagation()};connectedCallback(){super.connectedCallback();let i=this.getAttribute("choices");if(i&&this._choices.length===0)this._choices=o2.parseChoicesString(i);let{options:l}=this.parts;if(this.name==="")this.name=this.instanceId;if(l.addEventListener("change",this.handleChange),l.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 i=[...this.choices];if(this.other&&!this.multiple){let[l,s]=this.other.split(":");i.push({value:"",caption:l,icon:s})}return i}get isOtherValue(){return Boolean(this.value===""||this.value&&!this._choicesWithOther.find((i)=>i.value===this.value))}render(){if(super.render(),this.valueChanged){this.valueChanged=!1;return}let{options:i,custom:l}=this.parts;i.textContent="";let s=this.multiple?"checkbox":"radio",{values:t,isOtherValue:r}=this;if(i.append(...this._choicesWithOther.map((h)=>{return i6({tabindex:0},f5({type:s,name:this.name,value:h.value,checked:t.includes(h.value)||h.value===""&&r,tabIndex:-1}),h.icon||{class:"no-icon"},this.localized?d1(h.caption):l6(h.caption))})),this.other&&!this.multiple)l.hidden=!r,l.value=r?this.value:"",l.placeholder=this.placeholder,i.append(l)}}var s6=o2,C5=o2.elementCreator({tag:"tosi-segmented"}),t6=$((...i)=>C5(...i),"xinSegmented is deprecated, use tosiSegmented instead (tag is now <tosi-segmented>)");var{slot:v5}=g;class tl extends v{static initAttributes={minWidth:0,minHeight:0};value="normal";content=[v5({part:"normal"}),v5({part:"small",name:"small"})];static styleSpec={":host":{display:"inline-block",position:"relative"}};onResize=()=>{let{normal:i,small:l}=this.parts,s=this.offsetParent;if(!(s instanceof HTMLElement))return;else if(s.offsetWidth<this.minWidth||s.offsetHeight<this.minHeight)i.hidden=!0,l.hidden=!1,this.value="small";else i.hidden=!1,l.hidden=!0,this.value="normal"};connectedCallback(){super.connectedCallback(),globalThis.addEventListener("resize",this.onResize)}disconnectedCallback(){super.disconnectedCallback(),globalThis.removeEventListener("resize",this.onResize)}}var r6=tl.elementCreator({tag:"xin-sizebreak"});class rl extends v{target=null;static styleSpec={":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:n.resizeIconFill}};content=f.resize();get minSize(){let{minWidth:i,minHeight:l}=getComputedStyle(this.target);return{width:parseFloat(i)||32,height:parseFloat(l)||32}}resizeTarget=(i)=>{let{target:l}=this;if(!l)return;let{offsetWidth:s,offsetHeight:t}=l;l.style.left=l.offsetLeft+"px",l.style.top=l.offsetTop+"px",l.style.bottom="",l.style.right="";let{minSize:r}=this;K(i,(h,a,o)=>{if(l.style.width=Math.max(r.width,s+h)+"px",l.style.height=Math.max(r.height,t+a)+"px",o.type==="mouseup")return!0},"nwse-resize")};connectedCallback(){if(super.connectedCallback(),!this.target)this.target=this.parentElement;let i={passive:!0};this.addEventListener("mousedown",this.resizeTarget,i),this.addEventListener("touchstart",this.resizeTarget,i)}}var h6=rl.elementCreator({tag:"xin-sizer"});var{div:a6,input:o6,span:x6,button:hl}=g;class j2 extends v{static initAttributes={caption:"",removeable:!1};removeCallback=()=>{this.remove()};content=()=>[x6({part:"caption"},this.caption),hl(f.x(),{type:"button",part:"remove",hidden:!this.removeable,ariaLabel:`Remove ${this.caption}`,onClick:this.removeCallback})]}var y6=j2,al=j2.elementCreator({tag:"tosi-tag",styleSpec:{":host":{"--tag-close-button-color":"#000c","--tag-close-button-bg":"#fffc","--tag-button-opacity":"0.5","--tag-button-hover-opacity":"0.75","--tag-bg":p.brandColor("blue"),"--tag-text-color":p.brandTextColor("white"),display:"inline-flex",borderRadius:p.tagRoundedRadius(n.spacing50),color:n.tagTextColor,background:n.tagBg,padding:`0 ${n.spacing75} 0 ${n.spacing75}`,height:`calc(${n.lineHeight} + ${n.spacing50})`,lineHeight:`calc(${n.lineHeight} + ${n.spacing50})`},':host > [part="caption"]':{position:"relative",whiteSpace:"nowrap",overflow:"hidden",flex:"1 1 auto",fontSize:p.fontSize("16px"),color:n.tagTextColor,textOverflow:"ellipsis"},':host [part="remove"]':{boxShadow:"none",margin:`0 ${n.spacing_50} 0 ${n.spacing25}`,padding:0,display:"inline-flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:n.spacing150,width:n.spacing150,color:n.tagCloseButtonColor,background:n.tagCloseButtonBg,borderRadius:p.tagCloseButtonRadius("99px"),opacity:n.tagButtonOpacity},':host [part="remove"]:hover':{background:n.tagCloseButtonBg,opacity:n.tagButtonHoverOpacity}}}),n6=$((...i)=>al(...i),"xinTag is deprecated, use tosiTag instead (tag is now <tosi-tag>)");class x2 extends v{static formAssociated=!0;static initAttributes={name:"",textEntry:!1,editable:!1,placeholder:"enter tags",disabled:!1,required:!1};value="";get tags(){return this.value.split(",").map((i)=>i.trim()).filter((i)=>i!=="")}set tags(i){this.value=i.join(",")}_availableTags=[];get availableTags(){return this._availableTags}set availableTags(i){if(typeof i==="string")this._availableTags=x2.parseAvailableTagsString(i);else this._availableTags=i;this.queueRender()}static parseAvailableTagsString(i){return i.split(",").map((l)=>{let s=l.trim();return s===""?null:s})}connectedCallback(){super.connectedCallback();let i=this.getAttribute("available-tags");if(i&&this._availableTags.length===0)this._availableTags=x2.parseAvailableTagsString(i)}formDisabledCallback(i){this.disabled=i}formResetCallback(){this.value=""}addTag=(i)=>{let l=i.trim();if(l===""||this.tags.includes(l))return;this.tags=[...this.tags,l],this.queueRender(!0)};toggleTag=(i)=>{if(this.tags.includes(i))this.tags=this.tags.filter((l)=>l!==i),this.queueRender(!0);else this.addTag(i)};enterTag=(i)=>{let{tagInput:l}=this.parts;switch(i.key){case",":{let s=l.value.split(",")[0];this.addTag(s)}break;case"Enter":{let s=l.value.split(",")[0];this.addTag(s)}i.stopPropagation(),i.preventDefault();break;default:}};popSelectMenu=()=>{let{toggleTag:i}=this,{tagMenu:l}=this.parts,s=[...this.availableTags],t=this.tags.filter((h)=>!s.includes(h));if(t.length)s.push(null,...t);let r=s.map((h)=>{if(h===""||h===null)return null;else if(typeof h==="object")return{checked:()=>this.tags.includes(h.value),caption:h.caption,action(){i(h.value)}};else return{checked:()=>this.tags.includes(h),caption:h,action(){i(h)}}});J({target:l,width:"auto",menuItems:r})};content=()=>[hl({type:"button",style:{visibility:"hidden"},tabindex:-1}),a6({part:"tagContainer",class:"row",role:"list",ariaLabel:"Selected tags"}),o6({part:"tagInput",class:"elastic",ariaLabel:"Enter new tag",onKeydown:this.enterTag}),hl({type:"button",title:"add tag",ariaLabel:"Select tags from list",ariaHaspopup:"listbox",part:"tagMenu",onClick:this.popSelectMenu},f.chevronDown())];removeTag=(i)=>{if(this.editable&&!this.disabled){let l=i.target.closest(j2.tagName);this.tags=this.tags.filter((s)=>s!==l.caption),l.remove(),this.queueRender(!0)}i.stopPropagation(),i.preventDefault()};render(){super.render();let{tagContainer:i,tagMenu:l,tagInput:s}=this.parts;if(l.disabled=this.disabled,s.value="",s.setAttribute("placeholder",this.placeholder),this.editable&&!this.disabled)l.toggleAttribute("hidden",!1),s.toggleAttribute("hidden",!this.textEntry);else l.toggleAttribute("hidden",!0),s.toggleAttribute("hidden",!0);i.textContent="";for(let t of this.tags)i.append(al({caption:t,removeable:this.editable&&!this.disabled,removeCallback:this.removeTag}))}}var c6=x2,k5=x2.elementCreator({tag:"tosi-tag-list",styleSpec:{":host":{"--tag-list-bg":"#f8f8f8","--touch-size":"44px","--spacing":"16px",display:"grid",gridTemplateColumns:"auto",alignItems:"center",background:n.tagListBg,gap:n.spacing25,borderRadius:p.taglistRoundedRadius(n.spacing50),overflow:"hidden"},":host[editable]":{gridTemplateColumns:`0px auto ${n.touchSize}`},":host[editable][text-entry]":{gridTemplateColumns:`0px 2fr 1fr ${n.touchSize}`},':host [part="tagContainer"]':{display:"flex",content:'" "',alignItems:"center",background:n.inputBg,borderRadius:p.tagContainerRadius(n.spacing50),boxShadow:n.borderShadow,flexWrap:"nowrap",overflow:"auto hidden",gap:n.spacing25,minHeight:`calc(${n.lineHeight} + ${n.spacing})`,padding:n.spacing25},':host [part="tagMenu"]':{width:n.touchSize,height:n.touchSize,lineHeight:n.touchSize,textAlign:"center",padding:0,margin:0},":host [hidden]":{display:"none !important"},':host button[part="tagMenu"]':{background:n.brandColor,color:n.brandTextColor}}}),e6=$((...i)=>k5(...i),"xinTagList is deprecated, use tosiTagList instead (tag is now <tosi-tag-list>)");var w5="1.2.1";var ol={accent:B.fromCss("#EE257B"),background:B.fromCss("#fafafa"),text:B.fromCss("#222222")},M5={_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 p6(i){let{accent:l,background:s,text:t}=i,r=i.accentText??l.contrasting(),h=i.backgroundInset??s.darken(0.03),a=i.border??t.opacity(0.15),o=i.shadow??t.opacity(0.1),x=i.focus??l.opacity(0.5);return{_tosiAccent:l,_tosiAccentLight:l.brighten(0.15),_tosiAccentDark:l.darken(0.15),_tosiAccentText:r,_tosiBg:s,_tosiBgInset:h,_tosiBgHover:s.darken(0.05),_tosiBgActive:s.darken(0.1),_tosiText:t,_tosiTextMuted:t.opacity(0.6),_tosiTextDisabled:t.opacity(0.4),_tosiBorder:a,_tosiBorderFocus:l,_tosiShadow:o,_tosiShadowColor:o,_tosiFocusRing:`0 0 0 2px ${x}`,_tosiInputBg:s,_tosiInputBorder:a,_tosiInputBorderFocus:l,_tosiButtonBg:s,_tosiButtonText:t,_tosiButtonBorder:a,_tosiButtonHoverBg:s.darken(0.05),_tosiButtonActiveBg:l,_tosiButtonActiveText:r}}function z0(i){return{":root":{...M5,...p6(i)}}}function B5(i){let s=z0(i)[":root"];return{":root":K0(s)}}function d6(i,l="tosi-theme"){O1(l,i)}var g6=z0(ol),f6=B5(ol),z5={"--xin-icon-size":n.tosiIconSize,"--xin-icon-fill":n.tosiIconFill,"--xin-icon-stroke":n.tosiIconStroke,"--xin-tabs-bar-color":n.tosiTabsBarColor,"--xin-tabs-bar-height":n.tosiTabsBarHeight,"--xin-tabs-selected-color":n.tosiTabsSelectedColor,"--spacing":n.tosiSpacing,"--gap":n.tosiSpacingSm,"--touch-size":n.tosiTouchSize,"--background":n.tosiBg,"--text-color":n.tosiText,"--brand-color":n.tosiAccent,"--brand-text-color":n.tosiAccentText};function C6(i){return{":root":{...z0(i)[":root"],...z5}}}function v6(i,l){let s={};for(let[t,r]of Object.entries(l)){let h=`--tosi-${i}-${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`;s[t]=`var(${h}, ${r})`}return s}Object.assign(globalThis,{xinjs:v2,xinjsui:xl});})();
|
|
94
94
|
|
|
95
|
-
//# debugId=
|
|
95
|
+
//# debugId=B2302CAABEF88F8F64756E2164756E21
|
|
96
96
|
//# sourceMappingURL=iife.js.map
|