lecodes-cli 2.2.10 → 2.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var Wn=Object.defineProperty;var zn=(e,t,n)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var He=(e,t,n)=>zn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const Gn=e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack?`${String(e)}
2
- ${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},jn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const s=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(s,2500)};setTimeout(s,2500);const i=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let f={};try{f=JSON.parse(String(l.data))}catch{return}f.type==="reload"&&typeof f.v=="number"&&t(f.v)},o.onclose=()=>{setTimeout(i,2e3)}};return i(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const f=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(f)?f:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Gn).join(" ")}),error:o=>n({type:"error",text:o})}},Hn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Kn="modulepreload",Yn=function(e,t){return new URL(e,t).href},Et={},ue=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(v){return Promise.all(v.map(b=>Promise.resolve(b).then(L=>({status:"fulfilled",value:L}),L=>({status:"rejected",reason:L}))))};const l=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=o(n.map(v=>{if(v=Yn(v,r),v in Et)return;Et[v]=!0;const b=v.endsWith(".css"),L=b?'[rel="stylesheet"]':"";if(!!r)for(let y=l.length-1;y>=0;y--){const E=l[y];if(E.href===v&&(!b||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${v}"]${L}`))return;const p=document.createElement("link");if(p.rel=b?"stylesheet":Kn,b||(p.as="script"),p.crossOrigin="",p.href=v,d&&p.setAttribute("nonce",d),document.head.appendChild(p),b)return new Promise((y,E)=>{p.addEventListener("load",y),p.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${v}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},wt="2.2.10",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},qn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Xn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const s of n[1].split(";")){const i=s.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(s.slice(0,i));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:s.slice(i+1).replace("{fmt}",t)})}return r},Jn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const s=[];for(const i of e)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});r.fonts.add(o),s.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(s),new Promise(i=>setTimeout(i,n))])},Qn=e=>{var f,d,v,b;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const L of r[1].split(";"))n.add(L);const s=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((f=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:f[1])??null,o=((v=(d=t.match(/^\/\/ name: (.+)$/m))==null?void 0:d[1])==null?void 0:v.trim())??null,l=new Set((((b=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:b[1])??"").split(";").map(L=>L.trim()).filter(Boolean));return{sdk:i,name:o,preloads:n,gl:s,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Xn(t)}},Zn=1,er=2,tr=3,nr=4,rr=5,or=6,St=7,sr=8,_t=9,ir=10,ar=11,lr=12,cr=13,ur=14,fr=15,dr=16,kt=17,pr=18,hr=19,Oe=20,hi=21,mi=22,gi=23,bi=24,yi=25,mr=26,gr=27,br=28,yr=29,Lt=30,Tt=31,vr=32,Er=33,xt=34,Rt=35,At=36,Pe=1,wr=2,Sr=4,pe=8,_r=16,Ye=32,kr=64,qe=128,Lr=256,Tr=512,xr=1024,Rr=2048,Ar=4096,Ct=8192,vi=16384,Cr=32768,$r=1<<18,Or=255,$t=256,Ot=512,Ur=1024,Z=0,Mr=1,Nr=2,Fr=3,De=4,ye=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Mt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Pr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,f=n;f.type!==l.type&&(f.type=l.type),oe(n,"inputmode",l.mode??null);const d=t("enterKey");oe(n,"enterkeyhint",d==null?null:String(d))}const s=t("autocapitalize");oe(n,"autocapitalize",s==null?null:String(s));const i=t("autocorrect");i==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Mt(i,!0)?"on":"off"),oe(n,"spellcheck",Mt(i,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",textWrap:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Ir={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},Dr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Br={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",textWrap:"wrap",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},Vr=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const s of n)r+=String.fromCharCode(s);return`data:image/svg+xml;base64,${btoa(r)}`}function Wr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const zr=/\b(?:calc|min|max|clamp)\(/,Gr=e=>{if(!zr.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let s=0;const i=n;for(;n<e.length;n++)if(e[n]==="(")s++;else if(e[n]===")"&&--s===0)break;t+=e.slice(i,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const s=t[t.length-1]??"";if(!(r==="-"&&(s==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(s)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,s)=>{const i=s.slice(0,r).trimEnd(),o=s.slice(r+n.length).trimStart();return/[\w.%]$/.test(i)||/^[\w.%]/.test(o)||/[*/]$/.test(i)||/^[*/]/.test(o)?n:n+"px"})},jr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${jr[e]})))`,Hr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Gr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Hr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},Ae=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Kr=/^(rotate|skew)/,Yr=/^translate/,qr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,s)=>{const i=Yr.test(r)?"px":Kr.test(r)?"deg":null;return i===null?n:`${r}(${s.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+i:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),Q=0,re=1,_e=2,Ie=["top","right","bottom","left"],Xr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(s,i)=>({rank:i,to:o=>s.map(l=>[t(l),Xr(o,l)])}),r=s=>({rank:re,to:i=>[[t(s),se(i)]]});return{[e]:n(Ie,Q),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},Jr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const s of e.trim()){if(s==="("&&n++,s===")"&&n--,/\s/.test(s)&&n===0){r&&t.push(r),r="";continue}r+=s}return r&&t.push(r),t},Qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Zr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,s=null,i=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))Qr.has(l)?i=l:Zr.test(l)?r=se(l):s=Ae(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(s?"1px":"0px")]),o.push([`border-${l}-color`,s??"transparent"]),i&&o.push([`border-${l}-style`,i]);return o}}),eo=e=>{const t=String(e).trim(),n=(i,o,l)=>[["flex-grow",i],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),s=i=>i!==void 0&&/^-?\d*\.?\d+$/.test(i);return s(r[0])?r.length===1?n(r[0],"1","0%"):s(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},to=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(to(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},no=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},ro=(e,t)=>{const n=typeof e=="string"&&no.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ae(e)]]},oo=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,s=n,i=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",s??"0px"],["border-bottom-left-radius",i??"0px"]]},so=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),io=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||so.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},ao=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",lo=e=>t=>e[String(t)]??String(t),Ce={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:Q},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:Q},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:Q,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...Jr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:Q},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to:oo,rank:Q},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",qr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",io(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:Q,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},textWrap:{rank:Q,to:e=>e==="nowrap"?[["white-space","pre"],["max-width","none"],["overflow-x","hidden"],["overflow-y","hidden"],["text-overflow","ellipsis"]]:[["white-space","pre-wrap"],["max-width","100%"],["text-wrap",String(e)]]},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",ao(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",lo({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:ro,rank:Q},border:we(Ie,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:eo,rank:Q}},Xe=e=>Ir[e]??e,co=e=>e in Ce,bn=e=>{const t=Ce[e];return!!t&&"attr"in t},uo={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",textWrap:"text-wrap",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},fo=e=>{const t=Ce[e];return t&&"css"in t&&typeof t.css=="string"?t.css:uo[e]??null},po={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ae},ho={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Nt=e=>{const t=Ce[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,i])=>i!=null);r.sort((i,o)=>Nt(i[0])-Nt(o[0]));const s=new Map;for(const[i,o]of r){const l=Ce[i];if(!l){n==null||n(i);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[v,b]of l.to(o,t))s.set(v,b);continue}const f=po[l.as??ho[Be[i]??"layout"]],d=f(o);if(typeof l.css=="string")s.set(l.css,d);else for(const v of l.css)s.set(v,d)}return s},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Te=2,xe=3,En=4,ge=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=2*Math.PI/4.5,Me=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-Me(1-e)],["outBounce",Me],["inOutBounce",e=>e<.5?(1-Me(1-2*e))/2:(1+Me(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],mo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},go=e=>{const t=mo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},bo=[.25,.1,.25,1],Ne={kind:yn,p:[0,0,0,0]},yo=e=>{const t=new Float32Array(ge);for(let n=0;n<ge;n++)t[n]=e(n/(ge-1));return t[0]=0,t[ge-1]=1,t},vo=e=>{if(e===void 0)return Ne;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:yo(e)};if(Array.isArray(e)){const[s,i,o,l]=e;return{kind:Te,p:[s,i,o,l]}}const t=e.trim();if(t==="linear")return Ne;if(t==="ease")return{kind:Te,p:bo};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Te,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=go(t);return r===0?Ne:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Ne)},Eo=(e,t,n,r,s)=>{const i=1-3*r+3*t,o=3*r-6*t,l=3*t,f=1-3*s+3*n,d=3*s-6*n,v=3*n;let b=e;for(let L=0;L<8;L++){const _=((i*b+o)*b+l)*b-e,p=(3*i*b+2*o)*b+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;b-=_/p}return b=Math.min(1,Math.max(0,b)),((f*b+d)*b+v)*b},wo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Te:return Eo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(ge-1),s=Math.floor(r),i=n[s],o=n[Math.min(s+1,ge-1)];return i+(o-i)*(r-s)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),So="cubic-bezier(0.3333, 0, 0.6667, 1)",_o=e=>{switch(e.kind){case yn:return"linear";case Te:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(wo(e,n/Bt)));return`linear(${t.join(", ")})`},ko=e=>e===void 0||e==="smoothstep"?So:_o(vo(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],Lo=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",To=`
3
- @layer ${wn.join(", ")};
1
+ var Hn=Object.defineProperty;var Kn=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ke=(e,t,n)=>Kn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const Yn=e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack?`${String(e)}
2
+ ${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},qn=(e,t)=>{const n=o=>{fetch(`${e}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let r=-1;const s=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(s,2500)};setTimeout(s,2500);const i=()=>{let o;try{o=new WebSocket(e.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:r})),o.onmessage=l=>{let f={};try{f=JSON.parse(String(l.data))}catch{return}f.type==="reload"&&typeof f.v=="number"&&t(f.v)},o.onclose=()=>{setTimeout(i,2e3)}};return i(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const f=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(f)?f:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Yn).join(" ")}),error:o=>n({type:"error",text:o})}},Xn=(e,t)=>{try{const n=new URL(e,t);return n.origin===new URL(t).origin&&(n.protocol==="http:"||n.protocol==="https:")?n.href:null}catch{return null}},Jn="modulepreload",Qn=function(e,t){return new URL(e,t).href},wt={},fe=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(v){return Promise.all(v.map(b=>Promise.resolve(b).then(L=>({status:"fulfilled",value:L}),L=>({status:"rejected",reason:L}))))};const l=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=o(n.map(v=>{if(v=Qn(v,r),v in wt)return;wt[v]=!0;const b=v.endsWith(".css"),L=b?'[rel="stylesheet"]':"";if(!!r)for(let y=l.length-1;y>=0;y--){const E=l[y];if(E.href===v&&(!b||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${v}"]${L}`))return;const p=document.createElement("link");if(p.rel=b?"stylesheet":Jn,b||(p.as="script"),p.crossOrigin="",p.href=v,d&&p.setAttribute("nonce",d),document.head.appendChild(p),b)return new Promise((y,E)=>{p.addEventListener("load",y),p.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${v}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},St="2.2.11",Ye=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},Zn=(e,t)=>Ye(e)!==null&&Ye(e)===Ye(t),er=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const s of n[1].split(";")){const i=s.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(s.slice(0,i));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:s.slice(i+1).replace("{fmt}",t)})}return r},tr=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const s=[];for(const i of e)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});r.fonts.add(o),s.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(s),new Promise(i=>setTimeout(i,n))])},nr=e=>{var f,d,v,b;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const L of r[1].split(";"))n.add(L);const s=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((f=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:f[1])??null,o=((v=(d=t.match(/^\/\/ name: (.+)$/m))==null?void 0:d[1])==null?void 0:v.trim())??null,l=new Set((((b=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:b[1])??"").split(";").map(L=>L.trim()).filter(Boolean));return{sdk:i,name:o,preloads:n,gl:s,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:er(t)}},rr=1,or=2,sr=3,ir=4,ar=5,lr=6,_t=7,cr=8,kt=9,ur=10,fr=11,dr=12,pr=13,hr=14,mr=15,gr=16,Lt=17,br=18,yr=19,Ue=20,bi=21,yi=22,vi=23,Ei=24,wi=25,vr=26,Er=27,wr=28,Sr=29,Tt=30,xt=31,_r=32,kr=33,Rt=34,At=35,Ct=36,Ie=1,Lr=2,Tr=4,pe=8,xr=16,qe=32,Rr=64,Xe=128,Ar=256,Cr=512,$r=1024,Or=2048,Ur=4096,$t=8192,Si=16384,Mr=32768,Nr=1<<18,Fr=255,Ot=256,Ut=512,Pr=1024,Z=0,Ir=1,Dr=2,Br=3,Be=4,ye=255,fn=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Mt={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},Nt=(e,t)=>e==null?t:e===!0||e==="true"||e==="1"||typeof e=="number"&&e>.5,oe=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},Vr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Mt[String(t("type")??"text")]??Mt.text,f=n;f.type!==l.type&&(f.type=l.type),oe(n,"inputmode",l.mode??null);const d=t("enterKey");oe(n,"enterkeyhint",d==null?null:String(d))}const s=t("autocapitalize");oe(n,"autocapitalize",s==null?null:String(s));const i=t("autocorrect");i==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(i,!0)?"on":"off"),oe(n,"spellcheck",Nt(i,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Ve={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",textWrap:"enum",objectFit:"enum",placeholder:"str",type:"enum",enterKey:"enum",autocapitalize:"enum",autocorrect:"num",maxLength:"num",keyboardShrink:"num",keyboardDismiss:"num",showScrollbar:"num",overscrollMode:"enum",keyboardDismissMode:"enum",snap:"enum",sheetDetents:"str",sheetDetent:"num",sheetDismissible:"num",dim:"num"},Wr={p:"padding",pt:"paddingTop",pr:"paddingRight",pb:"paddingBottom",pl:"paddingLeft",px:"paddingHorizontal",py:"paddingVertical",m:"margin",mt:"marginTop",mr:"marginRight",mb:"marginBottom",ml:"marginLeft",mx:"marginHorizontal",my:"marginVertical",bgColor:"backgroundColor",bgImage:"backgroundImage",bgSize:"backgroundSize",bgGradient:"backgroundGradient"},zr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Gr={display:"flex",overflow:"visible",scrollDirection:"vertical",borderWidth:0,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftWidth:0,borderHorizontalWidth:0,borderVerticalWidth:0,borderStartWidth:0,borderEndWidth:0,backgroundColor:0,borderColor:0,borderTopColor:0,borderRightColor:0,borderBottomColor:0,borderLeftColor:0,backgroundImage:"",backgroundSize:"cover",borderRadius:0,borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,opacity:1,transform:"identity",transformOrigin:"50% 50%",pointerEvents:"all",fontSize:14,fontWeight:400,fontStyle:"normal",lineHeight:"normal",letterSpacing:0,textAlign:"start",textDecoration:"none",lineClamp:0,textOverflow:"ellipsis",textWrap:"wrap",objectFit:"cover",placeholder:"",type:"text",enterKey:"done",autocapitalize:"sentences",autocorrect:1,maxLength:0,keyboardShrink:1,keyboardDismiss:1,showScrollbar:1,overscrollMode:"default",keyboardDismissMode:"interactive",snap:"none",sheetDetents:"",sheetDetent:0,sheetDismissible:1,dim:0},jr=["duration","delay","layer","commit","loop","loopMode","name"];function dn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const s of n)r+=String.fromCharCode(s);return`data:image/svg+xml;base64,${btoa(r)}`}function Hr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Kr=/\b(?:calc|min|max|clamp)\(/,Yr=e=>{if(!Kr.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let s=0;const i=n;for(;n<e.length;n++)if(e[n]==="(")s++;else if(e[n]===")"&&--s===0)break;t+=e.slice(i,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const s=t[t.length-1]??"";if(!(r==="-"&&(s==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(s)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,s)=>{const i=s.slice(0,r).trimEnd(),o=s.slice(r+n.length).trimStart();return/[\w.%]$/.test(i)||/^[\w.%]/.test(o)||/[*/]$/.test(i)||/^[*/]/.test(o)?n:n+"px"})},qr={top:"12px",bottom:"4px",left:"16px",right:"16px"},pn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${qr[e]})))`,Xr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Ae=e=>Yr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>pn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Xr[r]),ht=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return ht.test(t)?t+"px":Ae(t)},Ce=e=>{if(typeof e=="number")return"#"+(e>>>0).toString(16).padStart(e<=16777215?6:8,"0");const t=String(e);return t==="clear"?"transparent":t},Jr=/^(rotate|skew)/,Qr=/^translate/,Zr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,s)=>{const i=Qr.test(r)?"px":Jr.test(r)?"deg":null;return i===null?n:`${r}(${s.split(",").map(o=>{const l=o.trim();return ht.test(l)?l+i:Ae(l)}).join(", ")})`})},hn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>ht.test(t)?t+"px":Ae(t)).join(" "),Q=0,re=1,_e=2,De=["top","right","bottom","left"],eo=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?pn(t):se(e),lt=(e,t)=>{const n=(s,i)=>({rank:i,to:o=>s.map(l=>[t(l),eo(o,l)])}),r=s=>({rank:re,to:i=>[[t(s),se(i)]]});return{[e]:n(De,Q),[`${e}Horizontal`]:n(["left","right"],re),[`${e}Vertical`]:n(["top","bottom"],re),[`${e}Start`]:r("inline-start"),[`${e}End`]:r("inline-end"),[`${e}Top`]:n(["top"],_e),[`${e}Right`]:n(["right"],_e),[`${e}Bottom`]:n(["bottom"],_e),[`${e}Left`]:n(["left"],_e)}},to=()=>{const e=lt("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},mt=e=>{const t=[];let n=0,r="";for(const s of e.trim()){if(s==="("&&n++,s===")"&&n--,/\s/.test(s)&&n===0){r&&t.push(r),r="";continue}r+=s}return r&&t.push(r),t},no=new Set(["none","solid","dashed","dotted","double","hidden"]),ro=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,s=null,i=null;if(typeof n=="number")r=n+"px";else for(const l of mt(String(n)))no.has(l)?i=l:ro.test(l)?r=se(l):s=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(s?"1px":"0px")]),o.push([`border-${l}-color`,s??"transparent"]),i&&o.push([`border-${l}-style`,i]);return o}}),oo=e=>{const t=String(e).trim(),n=(i,o,l)=>[["flex-grow",i],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=mt(t),s=i=>i!==void 0&&/^-?\d*\.?\d+$/.test(i);return s(r[0])?r.length===1?n(r[0],"1","0%"):s(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},mn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},so=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),gn=(e,t)=>{if(mn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${dn(so(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},io=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,bn=e=>{const t=String(e??"").trim();return t===""?"none":Ae(t)},ao=(e,t)=>{const n=typeof e=="string"&&io.test(e),r=mn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?bn(e):"none"],["--lc-bg-img",r?gn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},lo=e=>{const t=typeof e=="number"?[e+"px"]:mt(String(e)).map(o=>hn(o)),[n,r=n,s=n,i=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",s??"0px"],["border-bottom-left-radius",i??"0px"]]},co=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),uo=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||co.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},fo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",po=e=>t=>e[String(t)]??String(t),$e={width:{css:"width",as:"len"},height:{css:"height",as:"len"},minWidth:{css:"min-width",as:"len"},minHeight:{css:"min-height",as:"len"},maxWidth:{css:"max-width",as:"len"},maxHeight:{css:"max-height",as:"len"},flexBasis:{css:"flex-basis",as:"len"},flexGrow:{css:"flex-grow",as:"num"},flexShrink:{css:"flex-shrink",as:"num"},aspectRatio:{css:"aspect-ratio",as:"num"},gap:{css:["row-gap","column-gap"],as:"len",rank:Q},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...lt("padding",e=>`padding-${e}`),...lt("margin",e=>`margin-${e}`),inset:{css:De,as:"len",rank:Q},top:{css:"top",as:"len"},right:{css:"right",as:"len"},bottom:{css:"bottom",as:"len"},left:{css:"left",as:"len"},start:{css:"inset-inline-start",as:"len",rank:re},end:{css:"inset-inline-end",as:"len",rank:re},flexDirection:{css:"flex-direction",as:"raw"},justifyContent:{css:"justify-content",as:"raw"},alignItems:{css:"align-items",as:"raw"},alignSelf:{css:"align-self",as:"raw"},position:{css:"position",as:"raw"},flexWrap:{css:"flex-wrap",as:"raw"},boxSizing:{css:"box-sizing",as:"raw"},display:{css:"display",as:"raw"},overflow:{rank:Q,to:e=>{const t=e==="scroll"?"auto":String(e);return[["overflow-x",t],["overflow-y",t]]}},scrollDirection:{to:e=>e==="horizontal"?[["overflow-x","auto"],["overflow-y","hidden"],["flex-direction","row"]]:e==="all"?[["overflow-x","auto"],["overflow-y","auto"]]:[["overflow-x","hidden"],["overflow-y","auto"],["flex-direction","column"]],rank:re},...to(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:De.map(e=>`border-${e}-color`),rank:Q},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",gn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",bn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to:lo,rank:Q},borderTopLeftRadius:{css:"border-top-left-radius"},borderTopRightRadius:{css:"border-top-right-radius"},borderBottomRightRadius:{css:"border-bottom-right-radius"},borderBottomLeftRadius:{css:"border-bottom-left-radius"},opacity:{css:"opacity"},transform:{to:e=>[["transform",Zr(e)]]},transformOrigin:{css:"transform-origin",as:"lens"},pointerEvents:{to:e=>[["pointer-events",e==="none"?"none":"auto"]]},dim:{css:"--lc-dim"},fontSize:{css:"font-size"},fontWeight:{css:"font-weight",as:"raw"},fontStyle:{to:e=>[["font-style",e===2?"italic":e===0?"normal":String(e)]]},fontFamily:{to:e=>[["font-family",uo(e)]]},lineHeight:{to:e=>[["line-height",e==="normal"?"1.2":se(e)]]},letterSpacing:{css:"letter-spacing"},textAlign:{css:"text-align"},textDecoration:{css:"text-decoration-line"},lineClamp:{rank:Q,to:e=>Number(e)>0?[["display","-webkit-box"],["-webkit-box-orient","vertical"],["-webkit-line-clamp",String(Math.round(Number(e)))],["overflow-x","hidden"],["overflow-y","hidden"]]:[["-webkit-line-clamp","none"]]},textOverflow:{css:"text-overflow"},textWrap:{rank:Q,to:e=>e==="nowrap"?[["white-space","pre"],["max-width","none"],["overflow-x","hidden"],["overflow-y","hidden"],["text-overflow","ellipsis"]]:[["white-space","pre-wrap"],["max-width","100%"],["text-wrap",String(e)]]},objectFit:{to:e=>[["object-fit",String(e)],["--lc-fit",e==="fill"?"100% 100%":String(e)]]},placeholder:{attr:!0},type:{attr:!0},enterKey:{attr:!0},autocapitalize:{attr:!0},autocorrect:{attr:!0},maxLength:{attr:!0},keyboardShrink:{attr:!0},keyboardDismiss:{attr:!0},showScrollbar:{to:e=>[["scrollbar-width",fo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",po({default:"auto",none:"none",absorb:"contain"})(e)]]},keyboardDismissMode:{attr:!0},snap:{to:e=>e==="none"?[["scroll-snap-type","none"],["--lc-snap","none"]]:[["scroll-snap-type","both mandatory"],["--lc-snap",String(e)]]},sheetDetents:{attr:!0},sheetDetent:{attr:!0},sheetDismissible:{attr:!0},background:{to:ao,rank:Q},border:we(De,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:oo,rank:Q}},Je=e=>Wr[e]??e,ho=e=>e in $e,yn=e=>{const t=$e[e];return!!t&&"attr"in t},mo={overflow:"overflow-x",pointerEvents:"pointer-events",fontFamily:"font-family",fontStyle:"font-style",lineHeight:"line-height",objectFit:"object-fit",transform:"transform",borderRadius:"border-top-left-radius",borderWidth:"border-top-width",borderColor:"border-top-color",backgroundImage:"--lc-bg-img",backgroundGradient:"--lc-bg-grad",backgroundSize:"background-size",showScrollbar:"scrollbar-width",overscrollMode:"overscroll-behavior",snap:"--lc-snap",lineClamp:"-webkit-line-clamp",textWrap:"text-wrap",borderTopWidth:"border-top-width",borderRightWidth:"border-right-width",borderBottomWidth:"border-bottom-width",borderLeftWidth:"border-left-width",borderHorizontalWidth:"border-left-width",borderVerticalWidth:"border-top-width",borderStartWidth:"border-inline-start-width",borderEndWidth:"border-inline-end-width"},go=e=>{const t=$e[e];return t&&"css"in t&&typeof t.css=="string"?t.css:mo[e]??null},bo={len:se,lens:hn,num:e=>String(e),raw:e=>String(e),color:Ce},yo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Ft=e=>{const t=$e[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Qe=(e,t,n)=>{const r=[...e].filter(([,i])=>i!=null);r.sort((i,o)=>Ft(i[0])-Ft(o[0]));const s=new Map;for(const[i,o]of r){const l=$e[i];if(!l){n==null||n(i);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[v,b]of l.to(o,t))s.set(v,b);continue}const f=bo[l.as??yo[Ve[i]??"layout"]],d=f(o);if(typeof l.css=="string")s.set(l.css,d);else for(const v of l.css)s.set(v,d)}return s},Pt=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),vn=0,En=1,Te=2,xe=3,wn=4,ge=65,We=1.70158,Me=We*1.525,It=We+1,Dt=2*Math.PI/3,Bt=2*Math.PI/4.5,Ne=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,ct=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>It*e*e*e-We*e*e],["outBack",e=>1+It*(e-1)**3+We*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Me+1)*2*e-Me)/2:((2*e-2)**2*((Me+1)*(e*2-2)+Me)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*Dt)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*Dt)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Bt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Bt)/2+1],["inBounce",e=>1-Ne(1-e)],["outBounce",Ne],["inOutBounce",e=>e<.5?(1-Ne(1-2*e))/2:(1+Ne(2*e-1))/2],["smoothstep",e=>e*e*(3-2*e)]],vo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},Eo=e=>{const t=vo[e]??e;for(let n=0;n<ct.length;n++)if(ct[n][0]===t)return n;return-1},wo=[.25,.1,.25,1],Fe={kind:vn,p:[0,0,0,0]},So=e=>{const t=new Float32Array(ge);for(let n=0;n<ge;n++)t[n]=e(n/(ge-1));return t[0]=0,t[ge-1]=1,t},_o=e=>{if(e===void 0)return Fe;if(typeof e=="function")return{kind:wn,p:[0,0,0,0],table:So(e)};if(Array.isArray(e)){const[s,i,o,l]=e;return{kind:Te,p:[s,i,o,l]}}const t=e.trim();if(t==="linear")return Fe;if(t==="ease")return{kind:Te,p:wo};if(t==="steps")return{kind:xe,p:[1,0,0,0]};let n=/^steps\(\s*(\d+)\s*(?:,\s*(start|end|jump-start|jump-end)\s*)?\)$/.exec(t);if(n)return{kind:xe,p:[Math.max(1,parseInt(n[1],10)),n[2]==="start"||n[2]==="jump-start"?1:0,0,0]};if(n=/^cubic-bezier\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)$/.exec(t),n)return{kind:Te,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=Eo(t);return r===0?Fe:r>0?{kind:En,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Fe)},ko=(e,t,n,r,s)=>{const i=1-3*r+3*t,o=3*r-6*t,l=3*t,f=1-3*s+3*n,d=3*s-6*n,v=3*n;let b=e;for(let L=0;L<8;L++){const _=((i*b+o)*b+l)*b-e,p=(3*i*b+2*o)*b+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;b-=_/p}return b=Math.min(1,Math.max(0,b)),((f*b+d)*b+v)*b},Lo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case En:return ct[e.p[0]][1](t);case Te:return ko(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case wn:{const n=e.table,r=t*(ge-1),s=Math.floor(r),i=n[s],o=n[Math.min(s+1,ge-1)];return i+(o-i)*(r-s)}default:return t}},Vt=24,Wt=e=>String(Math.round(e*1e4)/1e4),To="cubic-bezier(0.3333, 0, 0.6667, 1)",xo=e=>{switch(e.kind){case vn:return"linear";case Te:return`cubic-bezier(${e.p.map(Wt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Vt;n++)t.push(Wt(Lo(e,n/Vt)));return`linear(${t.join(", ")})`},Ro=e=>e===void 0||e==="smoothstep"?To:xo(_o(e)),Sn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],Ao=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],_n="lc-app",Co=`
3
+ @layer ${Sn.join(", ")};
4
4
 
5
5
  @layer lc-base {
6
6
  .lc-root {
7
7
  position: relative;
8
8
  overflow: hidden;
9
9
  container-type: size;
10
- container-name: ${Sn};
10
+ container-name: ${_n};
11
11
  color: var(--text, #fff);
12
12
  font-family: var(--fontFamily, "Roboto"), system-ui, sans-serif;
13
13
  font-size: 14px;
@@ -282,8 +282,8 @@ ${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},jn=(
282
282
  }
283
283
  .lc-toast.lc-on { opacity: 1; transform: none; }
284
284
  }
285
- `,xo=e=>{const t=e.defaultView??window;try{t.CSS.registerProperty({name:"--lc-dim",syntax:"<number>",inherits:!0,initialValue:"0"})}catch{}for(const f of Lo)try{t.CSS.registerProperty({name:f,syntax:"*",inherits:!1})}catch{}const n=e.createElement("style");n.setAttribute("data-lecodes-lite",""),n.textContent=To,e.head.appendChild(n);const r=n.sheet,s=(f,d)=>{const v=f.insertRule(d,f.cssRules.length);return f.cssRules[v]},i=(f,d)=>{const v=f.cssRules;for(let b=v.length-1;b>=0;b--)if(v[b]===d){f.deleteRule(b);return}},o=new Map,l=(f,d)=>{const v=d===void 0?f:`${f}.${d}`;let b=o.get(v);return b||(b=d===void 0?s(r,`@layer ${f} {}`):s(l(f),`@layer ${d} {}`),o.set(v,b)),b};for(const f of wn)f!=="lc-base"&&l(f);return{insert(f,d,v){const b=l(f,v),L=s(b,d);return{remove:()=>i(b,L)}},own(f){const d=l("lc-own"),v=s(d,`${f} {}`);return{set:(b,L)=>v.style.setProperty(b,L),unset:b=>{v.style.removeProperty(b)},remove:()=>i(d,v)}},destroy(){n.remove()}}},ct="lc-i";let Ro=1;const Qe=new Map,_n=e=>{let t=Qe.get(e);return t||Qe.set(e,t=`lc-c${Qe.size+1}`),t},Ao=(e,t)=>{const n=`{${t.text}}`,r=s=>`${s} .${e}, .${e}${s}`;switch(t.name){case"pressed":return{layer:"lc-press",text:`${r(`.${ct}:active`)} ${n}`};case"hovered":return{layer:"lc-hover",text:`@media (hover: hover) { ${r(`.${ct}:hover`)} ${n} }`};case"focused":return{layer:"lc-focus",text:`${r(".lc:focus-visible")} ${n}`};case"landscape":case"portrait":return{layer:"lc-orient",text:`@container ${Sn} (orientation: ${t.name}) { .${e} ${n} }`};default:{const s=_n(t.name);return{layer:"lc-class",sub:s,text:`${r(`.${s}`)} ${n}`}}}},Co=e=>e.base+""+e.transition+e.blocks.map(t=>`${t.name}${t.text}`).join(""),$o=256,Oo=e=>{const t=new Map,n=new Set,r=()=>{let s=n.size>>1;for(const i of n){if(s--<=0)break;for(const o of i.rules)o.remove();n.delete(i),t.delete(i.key)}};return{acquire(s){const i=Co(s);let o=t.get(i);if(o)return o.refs===0&&n.delete(o),o.refs++,o;const l=`lc-s${Ro++}`,f=[],d=s.transition?`${s.base?";":""}transition:${s.transition}`:"";f.push(e.insert("lc-bag",`.${l} {${s.base}${d}}`));for(const v of s.blocks){const b=Ao(l,v);f.push(e.insert(b.layer,b.text,b.sub))}return t.set(i,o={name:l,key:i,refs:1,rules:f}),o},release(s){--s.refs>0||(n.add(s),n.size>$o&&r())},count:()=>({live:t.size-n.size,idle:n.size})}},Uo=()=>({base:new Map,own:new Map,blocks:new Map,cls:null,rule:null,applied:new Map,dirty:!1}),Wt=new Set([...Vr,"easing"]),Mo=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("_h"in e),No=(e,t,n,r)=>{const s=new Set;let i=!1;const o=new Set,l=E=>{o.has(E)||(o.add(E),r(`style: "${E}" is not a style property — ignored`))};let f=null,d=null;const v=E=>{E.style.dirty=!0,s.add(E),!i&&(i=!0,queueMicrotask(p))},b=E=>{const k=E.style,C=Je(k.own,n,l);if(!(C.size===0&&!k.rule)){k.rule||(k.rule=e.own(`.lc-n${E.id}`),E.el.classList.add(`lc-n${E.id}`));for(const N of k.applied.keys())C.has(N)||k.rule.unset(N);for(const[N,U]of C)k.applied.get(N)!==U&&k.rule.set(N,U);k.applied=C}},L=(E,k)=>{const C=new Map;for(const[N,U]of E){if(!(U.duration>0))continue;const D=`${U.duration}ms ${ko(U.easing)} ${U.delay}ms`;for(const F of k.get(N).keys())F.startsWith("--")||C.set(F,`${F} ${D}`)}return[...C.values()].join(", ")},_=E=>{const k=E.style;k.dirty=!1;const C=Ft(Je(k.base,n,l)),N=new Map,U=[];for(const[F,B]of k.blocks){const m=Je(B.props,n,l);N.set(F,m),m.size>0&&U.push({name:F,text:Ft(m)})}const D=k.cls;C===""&&U.length===0?k.cls=null:k.cls=t.acquire({base:C,blocks:U,transition:L(k.blocks,N)}),D!==k.cls&&(D&&E.el.classList.remove(D.name),k.cls&&E.el.classList.add(k.cls.name)),D&&t.release(D),f==null||f(E)};function p(){if(i=!1,s.size===0)return;const E=[...s];s.clear();for(const k of E)k.style.dirty&&_(k)}const y=(E,k,C)=>{if(C==null){E.blocks.delete(k);return}if(!Mo(C))return;let N=E.blocks.get(k);N||E.blocks.set(k,N={props:new Map,duration:0,delay:0,easing:void 0});for(const U of Object.keys(C)){const D=C[U];if(U==="duration"){N.duration=Number(D)||0;continue}if(U==="delay"){N.delay=Number(D)||0;continue}if(U==="easing"){N.easing=D;continue}if(Wt.has(U)||U[0]==="$")continue;const F=Xe(U);N.props.delete(F),D!=null&&N.props.set(F,D)}};return{flush:p,set onChange(E){f=E},set onWrite(E){d=E},merge(E,k){const C=E.style;let N=!1;for(const U of Object.keys(k)){const D=k[U];if(U[0]==="$"){y(C,U.slice(1),D);continue}if(Wt.has(U))continue;const F=Xe(U);C.base.delete(F),D!=null&&C.base.set(F,D),C.own.delete(F)&&(N=!0),d==null||d(E,F)}N&&b(E),v(E)},set(E,k,C){const N=E.style;if(k[0]==="$"){y(N,k.slice(1),C),v(E);return}const U=Xe(k);if(!co(U)){l(U);return}d==null||d(E,U),C==null?(N.own.delete(U),N.base.delete(U)&&v(E)):N.own.set(U,C),b(E),(bn(U)||U==="tintColor")&&(f==null||f(E))},setClass(E,k,C){E.el.classList.toggle(_n(k),C)},value(E,k){const C=E.style;return C.own.has(k)?C.own.get(k):C.base.get(k)},owns(E,k){return E.style.own.has(k)||E.style.base.has(k)},names(E,k){const C=E.style;if(C.own.has(k)||C.base.has(k))return!0;for(const N of C.blocks.values())if(N.props.has(k))return!0;return!1},drop(E){const k=E.style;s.delete(E),k.cls&&(t.release(k.cls),k.cls=null),k.rule&&(k.rule.remove(),k.rule=null)}}},Fo={button:"button",input:"input",textarea:"textarea",image:"img"},Po=(e,t)=>{const n=e.createElement(Fo[t]??"div");if(n.className=`lc lc-${t}`,t==="button"&&(n.type="button"),t==="image"){const r=n;r.alt="",r.decoding="async",r.draggable=!1}return n},Io=(e,t,n)=>({id:t,type:n,el:Po(e,n),parent:null,flags:0,held:!0,rooted:!1,token:{},style:Uo(),strings:new Map}),kn=Symbol("lecodes.node"),be=e=>e==null?void 0:e[kn],Ln=e=>{e.el[kn]=e,e.el.setAttribute("data-node",String(e.id))},ke=e=>{const t=[];for(let n=e.el.firstElementChild;n;n=n.nextElementSibling){const r=be(n);r&&r.parent===e&&t.push(r)}return t},Ze=(e,t=",")=>{const n=[];let r=0,s="";for(const i of e){if(i==="("&&r++,i===")"&&r--,i===t&&r===0){n.push(s.trim()),s="";continue}s+=i}return s.trim()!==""&&n.push(s.trim()),n},zt={"to top":0,"to right":90,"to bottom":180,"to left":270,"to top right":45,"to right top":45,"to bottom right":135,"to right bottom":135,"to bottom left":225,"to left bottom":225,"to top left":315,"to left top":315},Do=e=>{if(e in zt)return zt[e];const t=/^(-?[\d.]+)(deg|rad|turn|grad)$/.exec(e);if(!t)return null;const n=parseFloat(t[1]);return t[2]==="deg"?n:t[2]==="rad"?n*180/Math.PI:t[2]==="turn"?n*360:n*.9},Bo=(e,t)=>{const n=[];for(const r of Ze(e.trim())){const s=/^(?:repeating-)?(linear|radial)-gradient\((.*)\)$/s.exec(r);if(!s)return null;const i=s[1],o=Ze(s[2]);let l=i==="linear"?180:0;if(o.length>0){const d=o[0],v=i==="linear"?Do(d):null;v!==null?(l=v,o.shift()):i==="radial"&&/\b(circle|ellipse|at|closest|farthest)\b/.test(d)&&o.shift()}const f=[];for(const d of o){const v=Ze(d," "),b=v[v.length-1],L=v.length>1&&/^-?[\d.]+%$/.test(b),_=L?v.slice(0,-1).join(" "):d;f.push({color:t(_)??"#00000000",position:L?parseFloat(b)/100:null})}if(f.length===0)return null;f[0].position===null&&(f[0].position=0),f[f.length-1].position===null&&(f[f.length-1].position=1);for(let d=1;d<f.length-1;d++){if(f[d].position!==null)continue;let v=d;for(;f[v].position===null;)v++;const b=f[d-1].position,L=f[v].position;for(let _=d;_<v;_++)f[_].position=b+(L-b)*(_-d+1)/(v-d+1);d=v}n.push({type:i,angle:l,stops:f.map(d=>({color:d.color,position:d.position}))})}return n.length>0?n:null},Vo=Object.keys(Be).filter(e=>Be[e]!=="layout"),le=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0"),Gt=e=>{const t=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/.exec(e.trim());if(t){const r=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return`#${le(+t[1])}${le(+t[2])}${le(+t[3])}${le(r*255)}`}const n=/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+))?\)$/.exec(e.trim());return n?`#${le(+n[1]*255)}${le(+n[2]*255)}${le(+n[3]*255)}${le((n[4]===void 0?1:+n[4])*255)}`:null},Wo=e=>{if(e==="none")return[1,0,0,0,1,0,0,0,1];const t=/^matrix\(([^)]+)\)$/.exec(e);if(!t)return null;const[n,r,s,i,o,l]=t[1].split(",").map(f=>parseFloat(f));return[n,r,0,s,i,0,o,l,1]},jt={pointerEvents:{auto:"all"},overflow:{auto:"scroll"},display:{"-webkit-box":"flex",block:"flex"},showScrollbar:{none:"0",thin:"1",auto:"1"},overscrollMode:{auto:"default",contain:"absorb"},textAlign:{"-webkit-auto":"start"}},zo=e=>{const t=e.root.ownerDocument,n=t.defaultView??window;let r=null;const s=d=>{r||(r=t.createElement("span"),r.style.cssText="position:absolute;visibility:hidden;pointer-events:none"),r.isConnected||e.root.appendChild(r),r.style.color="",r.style.color=d;const v=r.style.color===""?null:Gt(n.getComputedStyle(r).color);return r.remove(),v},i=(d,v,b,L)=>{var y,E;if(bn(v)){const k=e.value(d,v);return k==null?null:b==="num"?Number(k===!0?1:k===!1?0:k):String(k)}const _=fo(v);if(_===null)return null;const p=L.getPropertyValue(_).trim();if(p===""&&!d.el.isConnected)return o(d,v,b);if(p==="")return null;switch(b){case"color":return _.startsWith("--")?s(p):Gt(p);case"len":{const k=parseFloat(p);return Number.isFinite(k)?k:v==="lineHeight"?parseFloat(L.fontSize)*1.2:null}case"num":{if(v==="lineClamp")return p==="none"?0:parseFloat(p)||0;const k=parseFloat(((y=jt[v])==null?void 0:y[p])??p);return Number.isFinite(k)?k:null}case"enum":return((E=jt[v])==null?void 0:E[p])??p;default:return v==="backgroundGradient"?p==="none"?null:Bo(p,s):v==="transform"?Wo(p):v==="transformOrigin"?null:v==="fontFamily"?p.split(",")[0].trim().replace(/^["']|["']$/g,""):v==="backgroundImage"&&p==="none"?"":p}},o=(d,v,b)=>{const L=e.value(d,v)??Br[v];if(L==null)return null;if(v==="transform")return L==="identity"||L==="none"?[1,0,0,0,1,0,0,0,1]:null;if(b==="color")return typeof L=="number"?`#${(L>>>0).toString(16).padStart(8,"0")}`:s(String(L));if(b==="len"||b==="num"){const _=typeof L=="number"?L:parseFloat(String(L));return Number.isFinite(_)?_:null}return String(L)},l=d=>{const v=n.getComputedStyle(d.el),b=[],L=[],_={};for(const p of Vo){const y=e.owns(d,p);y&&b.push(p);const E=i(d,p,Be[p],v);if(Dr.includes(p)&&!y&&(E===null||E==="none")){_[p]=null;continue}L.push(p),_[p]=E}return{present:L,dirty:[],own:b,..._}},f=d=>{const v=d.el,b={id:d.id,type:d.type},L=d.strings.get("name");L&&(b.name=L);const _=d.strings.get("text");return d.type==="text"&&_&&(b.text=_),(d.type==="input"||d.type==="textarea")&&(b.value=v.value),b.flags=d.flags,b.layout=[v.offsetLeft,v.offsetTop,v.offsetWidth,v.offsetHeight],b.paint=l(d),e.extend(d,b,f),b.children=e.held(d)?[]:ke(d).map(f),b};return{dump(){return e.flush(),JSON.stringify({roots:e.roots().map(d=>({kind:d.kind,node:f(d.node)}))})},paint(d){return d?(e.flush(),JSON.stringify(l(d))):"null"}}},et=10,Go=500,jo=e=>{const{root:t,emit:n}=e,r=t.ownerDocument,s=r.defaultView??window,i=g=>{const h=t.getBoundingClientRect(),$=un(t)||1;return[(g.clientX-h.left)/$,(g.clientY-h.top)/$]},o=(g,h)=>{for(let $=g instanceof Element?g:null;$&&$!==t;$=$.parentElement){if(e.boundary($))return null;const T=be($);if(T&&(T.flags&h)!==0)return T}return null},l=new Map;let f=!1,d=null;const v=(g,h)=>{const $=typeof h=="number"?h:0;($&$t)!==0&&(g.tracked=!0,g.wantsMove=($&Ot)!==0,g.claim=$&Or)},b=g=>{s.clearTimeout(g.timer),l.delete(g.pointerId)},L=g=>{if(g.pointerType==="mouse"&&g.button!==0)return;const h=o(g.target,Pe),[$,T]=i(g);d=[$,T],f=!1;const O={pointerId:g.pointerId,node:h,startX:$,startY:T,moved:!1,tracked:!1,wantsMove:!1,claim:0,handled:!1,timer:0};if(l.set(g.pointerId,O),!h){const P=g.target instanceof Element?e.hit(g.target,$,T):null;P!==null&&v(O,n(0,br,g.pointerId,$,T,P));return}v(O,n(h.id,er,g.pointerId,$,T)),(h.flags&Sr)!==0&&(O.timer=s.setTimeout(()=>{if(l.get(O.pointerId)!==O||O.moved)return;const P=n(h.id,nr,O.pointerId,O.startX,O.startY),V=typeof P=="number"?P:0;(V&Ur)!==0&&(O.handled=!0),v(O,V)},Go))},_=g=>{const h=l.get(g.pointerId);if(h){const[$,T]=i(g);!h.moved&&Math.hypot($-h.startX,T-h.startY)>et&&(h.moved=!0,s.clearTimeout(h.timer)),h.tracked&&h.wantsMove&&n(0,rr,g.pointerId,$,T,$-h.startX,T-h.startY)}g.pointerType==="mouse"&&B(g)},p=g=>{const h=l.get(g.pointerId);if(!h)return;const[$,T]=i(g);h.tracked&&n(0,or,g.pointerId,$,T,$-h.startX,T-h.startY),(h.moved||h.handled)&&(f=!0),b(h)},y=g=>{const h=l.get(g.pointerId);h&&(h.tracked&&n(0,St,g.pointerId),f=!0,b(h))},E=g=>{if(g.cancelable){for(const h of l.values())if(h.tracked&&h.claim!==0){g.preventDefault();return}}},k=g=>{if(f){f=!1;return}const h=o(g.target,Pe);if(!h&&g.target instanceof Element){const[O,P]=i(g);if(d&&Math.hypot(O-d[0],P-d[1])>et)return;const V=e.hit(g.target,O,P);V!==null&&n(0,yr,g.pointerId??0,O,P,V);return}if(!h||(h.flags&wr)===0)return;let $,T;if(g.detail===0&&g.clientX===0&&g.clientY===0){const O=h.el.getBoundingClientRect();[$,T]=i({clientX:O.left+O.width/2,clientY:O.top+O.height/2})}else if([$,T]=i(g),d&&Math.hypot($-d[0],T-d[1])>et)return;n(h.id,tr,g.pointerId??0,$,T)};let C=null,N=!1,U=!1,D=[0,0];const F=(g,h)=>{C&&N&&(g===Rt?n(0,g):n(0,g,h[0],h[1],h[0]-D[0],h[1]-D[1])),C=null,N=!1,U=!1};function B(g){const h=i(g),$=t.contains(g.target)?o(g.target,Pe):null;if($!==C){if(F(xt,h),C=$,$&&($.flags&$r)!==0){D=h;const T=n($.id,vr,h[0],h[1]),O=typeof T=="number"?T:0;N=(O&$t)!==0,U=(O&Ot)!==0}return}C&&N&&U&&n(0,Er,h[0],h[1],h[0]-D[0],h[1]-D[1])}const m=g=>{g.pointerType==="mouse"&&F(xt,i(g))},S=g=>{const h=be(g instanceof Element?g:null);return h&&(h.type==="input"||h.type==="textarea")?h:null},M=g=>{const h=S(g.target);h&&(h.flags&Lr)!==0&&n(h.id,lr,h.el.value)},W=g=>{const h=S(g.target);h&&(h.flags&Tr)!==0&&n(h.id,cr)},I=g=>{const h=S(g.target);h&&(h.flags&xr)!==0&&n(h.id,ur)},z=g=>{if(g.key!=="Enter"||g.isComposing)return;const h=S(g.target);if(!h||h.type!=="input")return;g.preventDefault();const $=h.el;(h.flags&Rr)!==0&&n(h.id,fr,$.value),e.value(h,"enterKey")!=="next"&&r.activeElement===$&&$.blur()},u=g=>{const h=s.getComputedStyle(g);return h.overflowX!=="hidden"&&h.overflowY==="hidden"},A=g=>{const h=be(g.target instanceof Element?g.target:null);!h||(h.flags&_r)===0||n(h.id,sr,u(h.el)?h.el.scrollLeft:h.el.scrollTop)},x=g=>{const h=be(g.target instanceof Element?g.target:null);h&&(h.flags&kr)!==0&&n(h.id,ir)};return t.addEventListener("pointerdown",L),t.addEventListener("click",k),t.addEventListener("pointerleave",m),t.addEventListener("touchmove",E,{passive:!1}),t.addEventListener("input",M),t.addEventListener("focusin",W),t.addEventListener("focusout",I),t.addEventListener("keydown",z),t.addEventListener("scroll",A,!0),t.addEventListener("scrollend",x,!0),r.addEventListener("pointermove",_),r.addEventListener("pointerup",p),r.addEventListener("pointercancel",y),{isPressed(g){for(const h of l.values())if(h.node===g)return!0;return!1},isHovered:g=>C===g,forget(g){for(const h of[...l.values()])h.node===g&&(h.tracked&&n(0,St,h.pointerId),b(h));C===g&&F(Rt,[0,0])},destroy(){for(const g of l.values())s.clearTimeout(g.timer);l.clear(),t.removeEventListener("pointerdown",L),t.removeEventListener("click",k),t.removeEventListener("pointerleave",m),t.removeEventListener("touchmove",E),t.removeEventListener("input",M),t.removeEventListener("focusin",W),t.removeEventListener("focusout",I),t.removeEventListener("keydown",z),t.removeEventListener("scroll",A,!0),t.removeEventListener("scrollend",x,!0),r.removeEventListener("pointermove",_),r.removeEventListener("pointerup",p),r.removeEventListener("pointercancel",y)}}},Ho=e=>`url("${e.replace(/["\\\n]/g,t=>"\\"+t)}")`,Ko=e=>{const t=_=>_.image??(_.image={src:"",srcTint:null,rect:null,form:"img",probe:0}),n=_=>_.src.startsWith("svg:")?_.src.slice(4):null,r=new Map,s=(_,p)=>{const y=r.get(p);y!=null&&y.delete(_)&&y.size===0&&r.delete(p)},i=_=>{const p=_.src,y=n(_);return y!==null?fn(y):p.startsWith("id:")?e.bufferUrl(Number(p.slice(3))):p.startsWith("canvas:")||p.startsWith("scene2d:")?"":p},o=(_,p)=>p.src.startsWith("canvas:")?"canvas":p.rect?"crop":n(p)!==null&&(p.srcTint!==null||e.hasTint(_))?"mask":"img",l=(_,p)=>{const y=_.el;if(y.tagName.toLowerCase()===p)return;const E=e.doc.createElement(p);if(E.className=y.className,p==="img"){const C=E;C.alt="",C.decoding="async",C.draggable=!1}const k=y.getAttribute("data-name");k!==null&&E.setAttribute("data-name",k),_.el=E,Ln(_),y.replaceWith(E),e.swapped(_,y)},f=_=>{for(const p of["--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"])_.style.removeProperty(p)},d=(_,p,y)=>{const[E,k,C,N]=p,[U,D]=y;_.style.setProperty("--lc-crop-size",`${U/C*100}% ${D/N*100}%`),_.style.setProperty("--lc-crop-pos",`${U===C?0:E/(U-C)*100}% ${D===N?0:k/(D-N)*100}%`)},v=new WeakMap,b=(_,p)=>{const y=_.el,E=e.drawable(p);if(!E){y.width=0,y.height=0;return}y.width!==E.pixelWidth&&(y.width=E.pixelWidth),y.height!==E.pixelHeight&&(y.height=E.pixelHeight);const k=y.getContext("2d");k&&(k.clearRect(0,0,y.width,y.height),y.width>0&&y.height>0&&k.drawImage(E.image,0,0),y.style.setProperty("--lc-iw",`${E.width}px`),E.height>0&&y.style.setProperty("--lc-ir",`${E.width} / ${E.height}`))},L=_=>{var F;const p=t(_),y=o(_,p);p.form=y,l(_,y==="img"?"img":y==="canvas"?"canvas":"div");const E=_.el;if(E.classList.toggle("lc-image-mask",y==="mask"),E.classList.toggle("lc-image-crop",y==="crop"),E.classList.toggle("lc-image-canvas",y==="canvas"),f(E),y==="canvas"){b(_,p.src);return}const k=i(p);if(y==="img"){const B=E;k===""?B.removeAttribute("src"):B.getAttribute("src")!==k&&(B.src=k);return}if(E.style.setProperty("--lc-src",k===""?"none":Ho(k)),y==="mask"){p.srcTint!==null&&E.style.setProperty("--lc-src-tint",Ae(p.srcTint));const B=(F=Wr(n(p)??""))==null?void 0:F.trim().split(/[\s,]+/).map(Number),m=B==null?void 0:B[2],S=B==null?void 0:B[3];m&&S&&(E.style.setProperty("--lc-iw",`${m}px`),E.style.setProperty("--lc-ir",`${m} / ${S}`));return}const C=p.rect;E.style.setProperty("--lc-iw",`${C[2]}px`),E.style.setProperty("--lc-ih",`${C[3]}px`);const N=v.get(_);if(N&&N.url===k){d(E,C,N.size);return}if(k==="")return;const U=++p.probe,D=new Image;D.addEventListener("load",()=>{if(p.probe!==U||!p.rect)return;const B=[D.naturalWidth,D.naturalHeight];v.set(_,{url:k,size:B}),d(_.el,p.rect,B)},{once:!0}),D.src=k};return{setSrc(_,p){const y=t(_);if(y.src.startsWith("canvas:")&&s(_,y.src),y.src=p??"",y.srcTint=null,y.src.startsWith("canvas:")){let E=r.get(y.src);E||r.set(y.src,E=new Set),E.add(_)}L(_)},setSrcTint(_,p){t(_).srcTint=p,L(_)},setSourceRect(_,p){const y=t(_),E=p==null?void 0:p.trim().split(/\s+/).map(Number),k=E&&E.length===4&&E.every(U=>Number.isFinite(U))&&E[2]>0&&E[3]>0?E:null,C=!!y.rect&&!!k&&y.form==="crop"&&y.rect[2]===k[2]&&y.rect[3]===k[3];y.rect=k;const N=v.get(_);if(C&&N){d(_.el,k,N.size);return}L(_)},sourceChanged(_){var p;for(const y of r.get(_)??[])((p=y.image)==null?void 0:p.form)==="canvas"&&b(y,_)},forget(_){var p;(p=_.image)!=null&&p.src.startsWith("canvas:")&&s(_,_.image.src)},restyle(_){const p=_.image;p&&o(_,p)!==p.form&&L(_)}}},Yo=.5,qo=64,Ht=48,Xo=e=>{const{root:t,emit:n}=e,r=t.ownerDocument,s=r.defaultView??window,i=new Map;let o=null;const l=p=>{let y=i.get(p);if(!y||!y.isConnected){y=r.createElement("div"),y.className="lc-refresh",y.style.setProperty("--lc-refresh-color",s.getComputedStyle(p.el).getPropertyValue("--lc-refresh").trim()||"#8e8e93");const E=p.el.parentElement;E&&(E.appendChild(y),y.style.top=`${p.el.offsetTop-36}px`,y.style.left=`${p.el.offsetLeft+p.el.offsetWidth/2}px`),i.set(p,y)}return y},f=(p,y,E)=>{const k=l(p);k.classList.toggle("lc-settling",E),k.style.translate=`0 ${y}px`,k.style.transform=`rotate(${y*3}deg)`,k.style.opacity=String(Math.min(1,y/Ht))},d=p=>{const y=i.get(p);y&&(y.classList.remove("lc-spinning"),f(p,0,!0),s.setTimeout(()=>{i.get(p)===y&&(y.remove(),i.delete(p))},220))},v=p=>{for(let y=p instanceof Element?p:null;y&&y!==t;y=y.parentElement){const E=be(y);if(E&&(E.flags&(qe|Ye))!==0)return E}return null},b=p=>{if(o||p.touches.length!==1)return;const y=v(p.target);if(!y)return;const E=p.changedTouches[0];o={node:y,touch:E.identifier,startY:E.clientY,pulling:!1,distance:0}},L=p=>{if(!o)return;const y=[...p.changedTouches].find(k=>k.identifier===o.touch);if(!y)return;const E=y.clientY-o.startY;if(!o.pulling){if(o.node.el.scrollTop>0||E<=0){(E<0||o.node.el.scrollTop>0)&&(o.startY=y.clientY);return}o.pulling=!0}p.cancelable&&p.preventDefault(),o.distance=Math.max(0,E*Yo),(o.node.flags&Ye)!==0&&n(o.node.id,_t,o.distance),(o.node.flags&qe)!==0&&f(o.node,o.distance,!1)},_=p=>{if(!o||![...p.changedTouches].some(N=>N.identifier===o.touch))return;const{node:y,pulling:E,distance:k}=o;if(o=null,!E||((y.flags&Ye)!==0&&n(y.id,_t,0),(y.flags&qe)===0))return;if(k<qo||p.type==="touchcancel"){d(y);return}f(y,Ht,!0),l(y).classList.add("lc-spinning");const C=n(y.id,ar);Promise.resolve(C).then(()=>d(y),()=>d(y))};return t.addEventListener("touchstart",b,{passive:!0}),t.addEventListener("touchmove",L,{passive:!1}),t.addEventListener("touchend",_),t.addEventListener("touchcancel",_),{forget(p){var y;(o==null?void 0:o.node)===p&&(o=null),(y=i.get(p))==null||y.remove(),i.delete(p)},destroy(){t.removeEventListener("touchstart",b),t.removeEventListener("touchmove",L),t.removeEventListener("touchend",_),t.removeEventListener("touchcancel",_);for(const p of i.values())p.remove();i.clear(),o=null}}},Kt=".lc-scrollable, .lc-vlist, .lc-pager-track, textarea.lc, input.lc",We=new WeakMap,mt=e=>{if(!e.isConnected)return;const t=[],n=r=>{(r.scrollLeft!==0||r.scrollTop!==0)&&t.push({el:r,left:r.scrollLeft,top:r.scrollTop})};e.matches(Kt)&&n(e);for(const r of e.querySelectorAll(Kt))n(r);t.length>0?We.set(e,t):We.delete(e)},Tn=e=>{const t=We.get(e);if(t){We.delete(e);for(const{el:n,left:r,top:s}of t)!n.isConnected||!e.contains(n)||(n.scrollLeft=r,n.scrollTop=s)}},ut=e=>{mt(e),e.remove()},xn=(e,t,n=null)=>{t.parentElement===e&&(n===null||t.nextElementSibling===n)||(t.isConnected&&mt(t),e.insertBefore(t,n),Tn(t))},Se=0,me=-1,Rn={run:(e,t,n,r)=>r(),settle:()=>{},enterOnTop:()=>!0,holds:()=>!1},Jo={[Mr]:"a 3D scene",[Nr]:"a 2D scene",[Fr]:"a native view",[De]:"a video"},Qo=e=>{const t=e.transitions??Rn;let n=null,r=[],s=[];const i=new Map,o=(m,S)=>`${m}:${S}`,l=new Set,f=m=>r.includes(m),d=m=>r.some(S=>S.node===m),v=m=>m&&m.kind===Z?m.node:null,b=(m,S)=>{e.emit(m.kind===Z||m.kind===De?m.id:0,S,m.kind,m.id)},L=(m,S,M,W)=>{let I=null;return(m===Z||m===De)&&(I=e.node(S)??null,!I||m===Z&&I.type!=="screen")?(e.warn(`navigation: ${S} is not a live ${m===Z?"screen":"video"} node`),null):{kind:m,id:S,node:I,viewName:M,paramsJson:W||"{}",back:Se,retired:!1}},_=(m,S)=>{var W;const M=v(m);if(!M){if((W=e.surface)!=null&&W.call(e,m,!0)){m.node&&e.rootOwned(m.node,!0);return}l.has(m.kind)||(l.add(m.kind),e.warn(`${Jo[m.kind]??"this destination"} as a destination is not built yet (docs/plans/web-lite-plan.md) — nothing is shown for it`));return}e.rootOwned(M,!0),M.el.classList.remove("lc-covered"),M.el.classList.toggle("lc-above",S),xn(e.root,M.el)},p=m=>{var M;const S=v(m);!S&&m!==n&&((M=e.surface)==null||M.call(e,m,!1)),!(!S||m===n)&&(n&&n.node===S||(S.el.classList.remove("lc-above"),d(S)?S.el.classList.add("lc-covered"):ut(S.el)))},y=m=>{const S=v(m);!S&&m.node&&!(n&&n.node===m.node)&&!d(m.node)&&(e.rootOwned(m.node,!1),m.node.parent===null&&e.emit(m.node.id,Lt)),S&&(n&&n.node===S||d(S)||(S.el.classList.remove("lc-above"),ut(S.el),e.rootOwned(S,!1),e.emit(S.id,Lt)))},E=()=>{const m=s;s=[];for(const S of m)S.node&&t.holds(S.node)?s.push(S):y(S)},k=m=>{!m||m.retired||(m.retired=!0,s.push(m),e.post(E))},C=(m,S,M)=>{const W=M===me?Se:M,I=v(m),z=v(S);I&&z&&z.el.classList.toggle("lc-above",!I.el.classList.contains("lc-above")),t.run(I,z,W,()=>{var u;I==null||I.el.classList.remove("lc-above"),z==null||z.el.classList.remove("lc-above"),S&&p(S),s.length>0&&e.post(E),(u=e.settled)==null||u.call(e)})},N=m=>{var S;m.kind===Z&&m.node&&((S=e.active)==null||S.call(e,m.node,!1)),b(m,hr)},U=(m,S)=>{var I,z;const M=n;if(!m||M===m)return;t.settle(),M&&N(M),n=m;const W=!!v(m)&&!!v(M);_(m,!!v(m)&&(!W||t.enterOnTop(S))),b(m,pr),m.kind===Z&&m.node&&((I=e.active)==null||I.call(e,m.node,!0)),M&&!f(M)&&k(M),C(m,M,S),(z=e.changed)==null||z.call(e)},D=m=>{var M;t.settle();const S=n;S&&(N(S),n=null,f(S)||k(S),C(null,S,m),(M=e.changed)==null||M.call(e))},F=(m,S)=>{U(m,S),e.emit(0,gr,m.kind,m.id)},B=m=>{const S=r.length;return m===-1?S-2:m<-1?Math.max(S-1+m,0):m===0?0:Math.min(m,S-1)};return{current:()=>n,stack:()=>r,setUrl(m,S,M){var I;M===null||M===""?i.delete(o(m,S)):i.set(o(m,S),M.startsWith("/")?M:`/${M}`),(n&&n.kind===m&&n.id===S||r.some(z=>z.kind===m&&z.id===S))&&((I=e.changed)==null||I.call(e))},address(){if(n){const S=i.get(o(n.kind,n.id));if(S!==void 0)return S}const m=n?r.lastIndexOf(n):r.length-1;for(let S=m<0?r.length-1:m;S>=0;S--){const M=i.get(o(r[S].kind,r[S].id));if(M!==void 0)return M}return null},forgetUrl(m,S){i.delete(o(m,S))},open(m,S,M,W,I){U(L(m,S,M,W),I)},close(m,S,M){!n||n.kind!==m||n.id!==S||D(M)},routerOpen(m,S,M,W){const I=L(m,S,M,W);if(!I)return;const z=r;r=[I];for(const u of z)u!==n&&k(u);U(I,Se)},routerPush(m,S,M,W,I,z){const u=L(m,S,M,W);u&&(u.back=z===me?Se:z,r.push(u),F(u,I))},routerReplace(m,S,M,W,I,z){const u=L(m,S,M,W);if(!u)return;const A=r[r.length-1];if(!A){u.back=z===me?Se:z,r.push(u),F(u,I);return}u.back=z===me?A.back:z,r[r.length-1]=u,F(u,I),k(A)},routerPop(m,S){if(r.length<=1)return!1;const M=B(m);if(M<0||M>=r.length)return!1;const W=S===me?r[r.length-1].back:S,I=r.splice(M+1);F(r[r.length-1],W);for(const z of I)k(z);return I.length>0},routerHide(m){D(m)},routerRestore(m){const S=r[r.length-1];S&&U(S,m)},reset(){var m;t.settle();for(const S of[n,...r,...s])(m=S==null?void 0:S.node)==null||m.el.remove();n=null,r=[],s=[],i.clear()}}},Zo=250,es="cubic-bezier(0.2, 0.8, 0.2, 1)",ts=6,ns=e=>{const{root:t}=e,n=t.ownerDocument,r=n.defaultView??window,s=new Map,i=new Map,o=new Map,l=[],f=(u,A)=>`${u}:${A}`,d=u=>u.type==="layer",v=u=>{var x;const A=e.value(u.node,"overlayColor");if(A==null){(x=u.scrim)==null||x.remove(),u.scrim=null,u.frame.classList.remove("lc-scrimmed");return}u.scrim||(u.scrim=n.createElement("div"),u.scrim.className="lc-scrim",u.scrim.addEventListener("click",()=>{(u.node.flags&Ar)!==0&&e.emit(u.node.id,dr)}),u.frame.insertBefore(u.scrim,u.frame.firstChild),u.frame.classList.add("lc-scrimmed")),u.scrim.style.backgroundColor=Ae(A)},b=u=>{const A=e.value(u,"sheetDetents");if(A==null||A==="")return null;const x=String(A).split(",").map(Number).filter(g=>Number.isFinite(g)&&g>0).sort((g,h)=>g-h);return x.length>0?x:null},L=(u,A)=>{const x=u.sheet,g=u.node.el.offsetHeight;if(A<0)return g;const h=x.detents[x.detents.length-1],$=x.detents[Math.max(0,Math.min(A,x.detents.length-1))];return g*(1-$/h)},_=(u,A,x)=>{const g=u.sheet.holder;g.style.transition=x?`transform ${Zo}ms ${es}`:"none",g.style.transform=`translateY(${Math.max(0,A)}px)`},p=(u,A)=>{const x=b(u.node);if(!x||!u.sheet)return;const g=u.sheet;g.detents=x;const h=e.value(u.node,"sheetDismissible");g.dismissible=h==null||Number(h)>.5||h===!0;const $=Number(e.value(u.node,"sheetDetent")??0);if(A){_(u,L(u,-1),!1),g.holder.offsetHeight,g.detent=$,_(u,L(u,$),!0);return}$!==g.detent&&(g.detent=$,_(u,L(u,$),!0))},y=u=>{const A=u.node.el;A.addEventListener("pointerdown",x=>{const g=u.sheet;if(!g||x.pointerType==="mouse"&&x.button!==0)return;for(let V=x.target instanceof Element?x.target:null;V&&V!==A;V=V.parentElement)if(V.scrollTop>0)return;const h=L(u,g.detent);let $=!1,T=h;const O=V=>{if(V.pointerId!==x.pointerId)return;const H=V.clientY-x.clientY;if(!$){if(Math.abs(H)<ts||Math.abs(H)<Math.abs(V.clientX-x.clientX))return;$=!0}T=Math.max(0,h+H),_(u,T,!1)},P=V=>{if(V.pointerId!==x.pointerId||(n.removeEventListener("pointermove",O),n.removeEventListener("pointerup",P),n.removeEventListener("pointercancel",P),!$||!u.sheet))return;let H=0,X=1/0;for(let ae=0;ae<g.detents.length;ae++){const J=Math.abs(L(u,ae)-T);J<X&&(X=J,H=ae)}const te=L(u,0),ie=A.offsetHeight;if(g.dismissible&&T>te+(ie-te)/2){_(u,ie,!0),(u.node.flags&Ct)!==0&&e.emit(u.node.id,kt,-1);return}g.detent=H,_(u,L(u,H),!0),(u.node.flags&Ct)!==0&&e.emit(u.node.id,kt,H)};n.addEventListener("pointermove",O),n.addEventListener("pointerup",P),n.addEventListener("pointercancel",P)})},E=u=>{let A=!0,x=0,g=u.parent;for(;g;){let h=g;for(;h.parent;)h=h.parent;const $=e.ownerOf(h);if($){e.pageShown(h)||(A=!1),x++,g=$;continue}const T=s.get(h);if(T){T.mountedIn||(A=!1),x++,g=T.parent;continue}const O=d(h)?l.includes(h):e.screenShown(h);return{outer:h,visible:A&&O,depth:x}}return{outer:null,visible:!1,depth:x}},k=u=>{const A=u.node.el;if(!A.isConnected)return e.value(u.node,"display")!=="none";const x=A.classList.contains("lc-leaving");x&&A.classList.remove("lc-leaving");const g=r.getComputedStyle(A).display!=="none";return x&&A.classList.add("lc-leaving"),g},C=u=>{const A=["lc-widget-frame",u.scrim?"lc-scrimmed":""].filter(Boolean),x=Array.from(u.parent.el.classList).filter(h=>!h.startsWith("lc"));u.frame.className=[...A,...x].join(" ");const g=u.parent.el.style;for(let h=0;h<g.length;h++){const $=g[h];$.startsWith("--")&&u.frame.style.setProperty($,g.getPropertyValue($))}for(const h of["data-theme-text","data-theme-font"])u.parent.el.hasAttribute(h)?u.frame.setAttribute(h,""):u.frame.removeAttribute(h)},N=u=>u.stage??(u.stage=e.stage()),U=u=>{u.leaving&&(u.leaving=!1,u.node.el.classList.remove("lc-leaving"))},D=u=>{u.pose&&N(u).run(u.node,null,u.pose,()=>{})},F=u=>{if(!u.pose){m(u,!1);return}u.leaving=!0,u.node.el.classList.add("lc-leaving"),N(u).run(null,u.node,u.pose,()=>{U(u),m(u,!1),M()})},B=u=>{u.mountedIn&&(m(u,!1),mt(u.node.el),u.frame.remove(),u.mountedIn=null)},m=(u,A)=>{u.onShow!==A&&(u.onShow=A,e.rootActive(u.node,A))};let S=!1;const M=()=>{if(S)return;S=!0,e.flush();const u=new Map;for(const x of s.values())u.set(x,E(x));const A=new Map;for(const[x,g]of u){if(!g.visible||!g.outer){x.leaving&&(N(x).settle(),U(x)),m(x,!1),B(x);continue}const h=A.get(g.outer)??[];h.push(x),A.set(g.outer,h)}for(const[x,g]of A){g.sort(($,T)=>u.get($).depth-u.get(T).depth);let h=null;for(const $ of g)C($),$.mountedIn!==x?($.mountedIn&&B($),x.el.appendChild($.frame),$.mountedIn=x,e.rootOwned($.node,!0),Tn($.node.el),$.sheet&&p($,!0)):h&&$.frame.previousElementSibling!==h&&x.el.appendChild($.frame),h=$.frame}for(const[x,g]of u){if(!x.mountedIn){x.intent===-1&&(x.intent=e.value(x.node,"display")!=="none"?1:0);continue}const h=k(x),$=x.intent!==-1&&(h?1:0)!==x.intent;if(x.intent===-1?(x.intent=h?1:0,h!==(e.value(x.node,"display")!=="none")&&e.emitLater(x.node.id,At,h?1:0)):(h?1:0)!==x.intent&&(x.intent=h?1:0,e.emitLater(x.node.id,At,h?1:0)),h)if(x.leaving)N(x).settle(),U(x),m(x,!0),$&&D(x);else{const T=x.onShow;m(x,!0),$&&!T&&D(x)}else x.leaving||($&&x.onShow?F(x):m(x,!1))}S=!1};return{attach(u,A,x){if(A.type!=="screen"&&!d(A))return console.error(`[web-lite] a widget can only be a child of a screen or a layer (it belongs to the window, not to a box: a floating element of a ${A.type} is an absolute child, not a widget)`),!1;if(s.has(u))return!1;const g=n.createElement("div");g.className="lc-widget-frame";const h={node:u,parent:A,frame:g,scrim:null,sheet:null,mountedIn:null,intent:-1,pose:tt.get(u)??0,stage:null,leaving:!1,onShow:!1};if(b(u)){const T=n.createElement("div");T.className="lc-sheet",T.appendChild(u.el),g.appendChild(T),h.sheet={holder:T,detents:[1],detent:-1,dismissible:!0},y(h)}else g.appendChild(u.el);s.set(u,h);const $=i.get(A)??[];return $.splice(Math.max(0,Math.min(x,$.length)),0,u),i.set(A,$),u.parent=A,v(h),M(),!0},detach(u){const A=s.get(u);if(!A)return!1;N(A).settle(),U(A),B(A),s.delete(u);const x=i.get(A.parent);if(x){const g=x.indexOf(u);g>=0&&x.splice(g,1),x.length===0&&i.delete(A.parent)}return u.parent=null,u.el.remove(),A.frame.remove(),e.rootOwned(u,!1),!0},childrenOf:u=>i.get(u)??[],isWidget:u=>s.has(u),setPose(u,A){const x=s.get(u);x?x.pose=A:tt.set(u,A)},setLayer(u,A,x){const g=f(u,A),h=o.get(g)??null;h!==x&&(h&&W(h),x?(o.set(g,x),x.el.classList.add("lc-layer")):o.delete(g),z())},refresh(){z(),M()},scrim:u=>{var A;return((A=s.get(u))==null?void 0:A.scrim)??null},restyle(u){const A=s.get(u);A&&(v(A),C(A),A.sheet&&p(A,!1),M(),queueMicrotask(M))},forget(u){const A=s.get(u);if(A){N(A).settle(),U(A),B(A),s.delete(u);const g=i.get(A.parent);if(g){const h=g.indexOf(u);h>=0&&g.splice(h,1)}A.frame.remove()}const x=i.get(u);if(x){for(const g of x.slice())this.forget(g);i.delete(u)}for(const[g,h]of o)h===u&&(W(h),o.delete(g));tt.delete(u)},shown:()=>Array.from(s.values()).filter(u=>u.onShow).map(u=>u.node),isShown:u=>{var A;return!!((A=s.get(u))!=null&&A.onShow)},backTargets(){const u=[],A=x=>{if(!x)return;const g=Array.from(x.el.children).filter(h=>h.classList.contains("lc-widget-frame"));for(let h=g.length-1;h>=0;h--){const $=Array.from(s.values()).find(T=>T.frame===g[h]);$&&$.onShow&&!$.leaving&&($.node.flags&Cr)!==0&&u.push($.node)}};return A(o.get(f(ye,0))??null),A(e.currentRoot()),u},layers:()=>l.slice(),layerOf:(u,A)=>o.get(f(u,A))??null,isFrame:u=>u.classList.contains("lc-widget-frame"),toast(u,A){(!ne||!ne.isConnected)&&(ne=n.createElement("div"),ne.className="lc-toasts",t.appendChild(ne));const x=n.createElement("div");x.className="lc-toast",x.setAttribute("role","status"),x.textContent=u,ne.appendChild(x),x.offsetHeight,x.classList.add("lc-on"),r.setTimeout(()=>{x.classList.remove("lc-on"),r.setTimeout(()=>x.remove(),200)},Math.max(500,A))},destroy(){for(const u of s.values())u.frame.remove();s.clear(),i.clear();for(const u of l)u.el.remove();l.length=0,o.clear(),ne==null||ne.remove(),ne=null}};function W(u){const A=l.indexOf(u);A<0||(l.splice(A,1),e.rootActive(u,!1),u.el.remove(),e.rootOwned(u,!1))}function I(u){l.includes(u)||(l.push(u),t.appendChild(u.el),e.rootOwned(u,!0),e.rootActive(u,!0))}function z(){const u=e.current();for(const[x,g]of o)x===f(ye,0)||!!u&&x===f(u.kind,u.id)?I(g):W(g);const A=o.get(f(ye,0));A&&A.el.parentElement===t&&t.lastElementChild!==A.el&&t.appendChild(A.el)}};let ne=null;const tt=new WeakMap,Yt={pager:["pagerSetContent","pagerSelect","pagerPush","pagerPop","pagerPopToRoot","pagerReplace"],vlist:["vlistInit","vlistSetKeys","vlistInsertKeys","vlistRemoveKeys","vlistInvalidate","vlistMount","vlistScrollTo","vlistScrollToKey","vlistScrollToEnd"],plugins:["viewCall"],tween:["tweenCreate","tweenControl","tweenSeek","tweenSetRate","tweenGetTime","tweenGetElapsed","registerTweenEvent","defineTransition"]},rs=e=>{const t=e.root,n=t.ownerDocument,r=(a,c,w)=>{for(const R of Object.keys(c)){const G=c[R],j=G==null?null:typeof G=="number"?se(G):Re(G);for(const ce of w?[`--${R}`,`--lc-app-${R}`]:[`--${R}`])j===null?a.style.removeProperty(ce):a.style.setProperty(ce,j)}},s=n.defaultView??window,i=new Set,o=a=>console.warn(`[web-lite] ${a}`),l=[],f=a=>{var c;for(const w of l){const R=(c=w.ownerOf)==null?void 0:c.call(w,a);if(R)return R}return null},d=a=>{var c;for(const w of l){const R=(c=w.roots)==null?void 0:c.call(w,a);if(R)return R}return null},v=(a,c)=>{var w;for(const R of l)(w=R.rootActive)==null||w.call(R,a,c)},b=a=>{var c;for(const w of l)(c=w.subtreeMoved)==null||c.call(w,a)},L=()=>{for(const a of l)if(a.stage)return a.stage();return Rn};let _=null;const p=()=>_??(_=e.transitions??L()),y={run:(a,c,w,R)=>p().run(a,c,w,R),settle:()=>p().settle(),enterOnTop:a=>p().enterOnTop(a),holds:a=>p().holds(a)};let E=[],k=!1;const C=a=>{E.push(a),!k&&(k=!0,queueMicrotask(()=>{k=!1;const c=E;E=[];for(const w of c)w()}))};let N=null;const U=(a,c,...w)=>{if(N)try{return N(a,c,...w)}catch(R){s.setTimeout(()=>{throw R},0);return}},D=(a,c,...w)=>C(()=>{U(a,c,...w)});t.classList.add("lc-root");const F=e.sink??xo(n),B=Oo(F),m=No(F,B,{bufferUrl:e.bufferUrl},o),S=new Map;let M=1;const W=new ResizeObserver(a=>{for(const c of a){const w=c.target,R=S.get(Number(w.getAttribute("data-node")));!R||R.el!==w||!(R.flags&pe)||U(R.id,Zn,w.offsetLeft,w.offsetTop,w.offsetWidth,w.offsetHeight)}}),I=Ko({doc:n,bufferUrl:e.bufferUrl,drawable:a=>{var c;for(const w of l){const R=(c=w.drawable)==null?void 0:c.call(w,a);if(R)return R}return null},hasTint:a=>m.names(a,"tintColor"),swapped:(a,c)=>{W.unobserve(c),a.flags&pe&&W.observe(a.el)},warn:o});m.onChange=a=>{const c=a;Pr(c,w=>m.value(c,w)),c.type==="image"&&I.restyle(c),c.type==="widget"?P.restyle(c):(c.type==="screen"||c.type==="layer")&&P.refresh()};const z=jo({root:t,emit:U,value:(a,c)=>m.value(a,c),boundary:a=>P.isFrame(a)||l.some(c=>{var w;return((w=c.boundary)==null?void 0:w.call(c,a))===!0}),hit:(a,c,w)=>{var R;for(const G of l){const j=(R=G.hit)==null?void 0:R.call(G,a,c,w);if(j!=null)return j}return null}}),u=Xo({root:t,emit:U}),A=new ResizeObserver(()=>{U(0,mr,t.clientWidth,t.clientHeight)});A.observe(t),m.onWrite=(a,c)=>{var w;for(const R of l)(w=R.styled)==null||w.call(R,a,c)};const x=a=>a.parent===null&&!a.rooted,g=(a,c,w=!0)=>{var R;for(const G of l)(R=G.forget)==null||R.call(G,a);for(const G of ke(a))g(G,c,!1);w||c.push(a.id),z.forget(a),u.forget(a),I.forget(a),O.forgetUrl(Z,a.id),P.forget(a),m.drop(a),W.unobserve(a.el),$.unregister(a.token),S.delete(a.id),a.parent=null,a.held=!1,w&&a.el.remove()},h=a=>{if(!S.has(a.id)||a.held||!x(a))return;const c=[];g(a,c),c.length>0&&U(0,Tt,c)},$=new FinalizationRegistry(a=>{const c=S.get(a);c&&(c.held=!1,x(c)&&C(()=>h(c)))}),T=a=>{a.held||C(()=>h(a))},O=Qo({root:t,emit:D,post:C,warn:o,node:a=>S.get(a),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},changed:e.onNavigation,settled:()=>{P.refresh()},active:v,surface:(a,c)=>l.some(w=>{var R;return((R=w.destination)==null?void 0:R.call(w,a,c))===!0}),transitions:y}),P=ns({root:t,emit:U,emitLater:D,node:a=>S.get(a),value:(a,c)=>m.value(a,c),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},rootActive:v,flush:()=>m.flush(),ownerOf:f,pageShown:a=>{var c;for(const w of l){const R=(c=w.pageShown)==null?void 0:c.call(w,a);if(R!=null)return R}return!1},screenShown:a=>{var c;return((c=O.current())==null?void 0:c.node)===a||y.holds(a)},currentRoot:()=>{const a=O.current();return a?a.kind===Z?a.node??null:P.layerOf(a.kind,a.id):null},current:()=>{const a=O.current();return a?{kind:a.kind,id:a.id}:null},stage:L}),V=e.onNavigation;e.onNavigation=()=>{P.refresh(),V==null||V()};const H=()=>{var c;for(const w of P.backTargets())if(U(w.id,Oe,ye,0)===!0)return"widget";const a=O.current();if(a){const w=a.kind===Z||a.kind===De?a.id:0;if(U(w,Oe,a.kind,a.id)===!0)return"destination"}for(const w of l)if(((c=w.back)==null?void 0:c.call(w))===!0)return"feature";return O.routerPop(-1,me)?"router":U(0,Oe,ye,0)===!0?"app":"none"},X=a=>{if(!(a.key!=="Escape"||a.defaultPrevented)){for(const c of P.backTargets())if(U(c.id,Oe,ye,0)===!0){a.preventDefault();return}}};n.addEventListener("keydown",X);const te=zo({root:t,roots:()=>{const a=O.current();return[...a!=null&&a.node&&a.kind===Z?[{kind:"screen",node:a.node}]:[],...P.layers().map(w=>({kind:"layer",node:w})),...P.shown().map(w=>({kind:"widget",node:w}))]},held:a=>d(a),extend:(a,c,w)=>{var R;for(const G of l)(R=G.dump)==null||R.call(G,a,c,w)},value:(a,c)=>m.value(a,c),owns:(a,c)=>m.owns(a,c),flush:()=>m.flush()}),ie=a=>{if(!a.isConnected)return null;m.flush();const c=un(t)||1,w=t.getBoundingClientRect(),R=a.getBoundingClientRect();return R.width===0&&R.height===0&&a.offsetParent===null?null:[(R.left-w.left)/c,(R.top-w.top)/c,R.width/c,R.height/c]},$e=()=>{const a={};for(const c of Object.keys(Yt))for(const w of Yt[c])a[w]=()=>(i.has(w)||(i.add(w),o(`${w}: this tree was made without the "${c}" feature`)),w==="tweenCreate"?null:0);return a},ae={create(a){const c=Io(n,M++,a);Ln(c),S.set(c.id,c);const w={id:c.id};return $.register(w,c.id,c.token),w},destroy(a){const c=S.get(a);if(!c)return;if(!x(c)){console.error(`[web-lite] destroy: node ${a} is attached — remove / hide / close it first`);return}c.held=!1;const w=[];g(c,w),w.length>0&&U(0,Tt,w)},insert(a,c,w){var yt;const R=S.get(a),G=S.get(c);if(!R||!G||G===R)return;if(d(R)){o(`insert() on a ${R.type} — what it holds goes through its own calls`);return}if(!x(G)){o(`insert: node ${c} is not a root — remove it from where it is first`);return}if(G.type==="widget"){const vt=ke(R).length;P.attach(G,R,w<vt?0:w-vt);return}const j=ke(R),ce=Math.max(0,Math.min(w,j.length));G.parent=R,xn(R.el,G.el,((yt=j[ce])==null?void 0:yt.el)??null),b(G)},remove(a,c){const w=S.get(a),R=S.get(c);if(!(!w||!R||R.parent!==w)){if(P.isWidget(R)){P.detach(R);return}R.parent=null,ut(R.el),b(R),T(R)}},parent(a){var w,R;const c=S.get(a);return c?((w=c.parent)==null?void 0:w.id)??((R=f(c))==null?void 0:R.id)??0:0},children(a){const c=S.get(a);return c?[...d(c)??ke(c),...P.childrenOf(c)].map(w=>w.id):[]},setString(a,c,w){var G;const R=S.get(a);if(R){w===null?R.strings.delete(c):R.strings.set(c,w);for(const j of l)(G=j.content)==null||G.call(j,R,c,w);switch(c){case"text":R.type==="text"&&(R.el.textContent=w??"");return;case"name":w===null?R.el.removeAttribute("data-name"):R.el.setAttribute("data-name",w);return;case"src":R.type==="image"&&I.setSrc(R,w);return;case"srcTintColor":R.type==="image"&&I.setSrcTint(R,w);return;case"sourceRect":R.type==="image"&&I.setSourceRect(R,w);return;case"value":if(R.type==="input"||R.type==="textarea"){const j=R.el;j.value!==(w??"")&&(j.value=w??"")}return;case"focus":w==="1"?R.el.focus({preventScroll:!0}):R.el.blur();return}}},setInt(a,c,w){var G;const R=S.get(a);if(R){R.strings.set(c,String(w));for(const j of l)(G=j.content)==null||G.call(j,R,c,w)}},setFlags(a,c){const w=S.get(a);if(!w)return;const R=w.flags;w.flags=c,w.el.classList.toggle(ct,(c&Pe)!==0),c&pe&&!(R&pe)?W.observe(w.el):!(c&pe)&&R&pe&&W.unobserve(w.el)},getTextValue(a){const c=S.get(a);return c&&(c.type==="input"||c.type==="textarea")?c.el.value:""},setStyle(a,c,w){const R=S.get(a);R&&m.set(R,c,w)},mergeStyle(a,c){const w=S.get(a);w&&m.merge(w,c)},setClass(a,c,w){const R=S.get(a);R&&(m.setClass(R,c,w),P.refresh())},setTheme(a){r(t,a,!0)},setNodeTheme(a,c){const w=S.get(a);w&&(r(w.el,c,!1),"text"in c&&w.el.toggleAttribute("data-theme-text",c.text!=null),"fontFamily"in c&&w.el.toggleAttribute("data-theme-font",c.fontFamily!=null),P.refresh())},open:O.open,close:O.close,routerOpen:(a,c,w,R)=>O.routerOpen(a,c,w,R),routerPush:O.routerPush,routerReplace:O.routerReplace,routerPop:(a,c)=>{O.routerPop(a,c)},routerHide:O.routerHide,routerRestore:O.routerRestore,setDestUrl:O.setUrl,isViewSupported:()=>!1,viewVersion:()=>0,setLayer(a,c,w){const R=w?S.get(w)??null:null;if(w&&(!R||R.type!=="layer")){o("setLayer: not a layer node");return}P.setLayer(a,c,R)},setWidgetPose(a,c){const w=S.get(a);w&&P.setPose(w,c>0?c:0)},registerFont(a,c,w,R,G,j){try{const ce=new s.FontFace(a,`url("${c}")`,{weight:String(w),style:R===2?"italic":"normal"});n.fonts.add(ce),ce.load().then(()=>G(),()=>j())}catch{j()}},fontFormat:"woff2",toast:(a,c)=>P.toast(a,c),isButtonPressed(a){const c=S.get(a);return!!c&&z.isPressed(c)},isHovered(a){const c=S.get(a);return!!c&&z.isHovered(c)},getBoundingClientRect(a){const c=S.get(a);return c?ie(c.el):null},getDisplaySize:()=>[t.clientWidth,t.clientHeight],debugDump:()=>te.dump(),debugPaint:a=>te.paint(S.get(a)),setEmitter(a){N=a}},J={...$e(),...ae};for(const a of["open","close","routerOpen","routerPush","routerReplace","routerPop","routerHide","routerRestore"]){const c=J[a];J[a]=(...w)=>{const R=c(...w);return C(()=>P.refresh()),R}}const q={root:t,emit:U,emitLater:D,post:C,warn:o,node:a=>S.get(a),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},flush:()=>m.flush(),value:(a,c)=>m.value(a,c),setStyle:(a,c,w)=>m.set(a,c,w),setString:(a,c,w)=>J.setString(a,c,w),style:{bufferUrl:e.bufferUrl},shown:a=>{var c;return((c=O.current())==null?void 0:c.node)===a||P.isShown(a)||P.layers().includes(a)},scrim:a=>P.scrim(a),stage:L,sourceChanged:a=>I.sourceChanged(a),plugins:e.plugins??null,rootsChanged:()=>C(()=>P.refresh()),rootHolds:a=>y.holds(a)},de={};for(const a of e.features??[]){const c=a.install(q);l.push(c),Object.assign(J,c.bridge),Object.assign(de,c.globals)}return{bridge:J,globals:de,presentation:O,back:H,setSafeArea(a,c=[]){for(const w of["top","right","bottom","left"])t.style.setProperty(`--safe-${w}`,`${a[w]}px`),c.includes(w)?t.style.setProperty(`--safe-${w}-bar`,`${a[w]}px`):t.style.removeProperty(`--safe-${w}-bar`)},flush:()=>m.flush(),stats:()=>Object.assign({nodes:S.size,classes:B.count(),tweens:0},...l.map(a=>{var c;return((c=a.stats)==null?void 0:c.call(a))??{}})),destroy(){var a;N=null,O.reset();for(const c of l)(a=c.destroy)==null||a.call(c);P.destroy(),n.removeEventListener("keydown",X),z.destroy(),u.destroy(),A.disconnect(),W.disconnect();for(const c of S.values())$.unregister(c.token),c.el.remove();S.clear(),e.sink||F.destroy(),t.classList.remove("lc-root");for(const c of Array.from(t.style))c.startsWith("--")&&t.style.removeProperty(c)}}},An=()=>({setMatrix(){},setVisible(){},setCameraMatrix(){},setProjection(){},clearProjection(){},setBackground(){},createExternalTexture:()=>null,onFrame:()=>()=>{},readPixels:(e,t)=>t(null,0,0),viewport:()=>({width:0,height:0,rotation:0})}),os=e=>{var r,s;const t=((s=(r=e.screen)==null?void 0:r.orientation)==null?void 0:s.angle)??e.orientation??0;return(Math.round(t/90)%4+4)%4*90},ss=(e,t)=>({width:(e==null?void 0:e.clientWidth)??0,height:(e==null?void 0:e.clientHeight)??0,rotation:os(t)}),K=[null],gt=new TextDecoder("utf-8"),Ei=async(e,t,n,r)=>{var _;let s;if(t.body)if(typeof t.body=="object"&&Array.isArray(t.body._entries)){const p=new FormData;for(let[y,E,k]of t.body._entries)typeof E=="object"?p.append(y,new Blob([fe(E._id)]),k):p.append(y,E);s=p}else typeof t.body=="string"?s=t.body:r(new Error("Invalid body"));const i=await fetch(e,{method:t.method,body:s,headers:t.headers,mode:"cors",credentials:"omit"}),o=typeof t.onProgress=="function"?t.onProgress:null;if(!o){const p=await i.arrayBuffer();K.push(p),n(K.length-1,i.status);return}const l=(_=i.body)==null?void 0:_.getReader();if(!l){const p=await i.arrayBuffer();K.push(p),n(K.length-1,i.status);return}const f=Number(i.headers.get("content-length"))||void 0;let d=0;const v=[];for(;;){const{done:p,value:y}=await l.read();if(p)break;y&&(v.push(y),d+=y.length,o({loaded:d,total:f}))}const b=new Uint8Array(d);let L=0;for(const p of v)b.set(p,L),L+=p.length;K.push(b.buffer),n(K.length-1,i.status)},is=e=>JSON.parse(gt.decode(fe(e))),Cn=e=>gt.decode(fe(e)),as=e=>new Uint8Array(fe(e)).slice(),ls=(e,t,n)=>gt.decode(fe(e).slice(t,n)),cs=e=>{const t=new Blob([K[e]]);return URL.createObjectURL(t)},$n=e=>new Blob([K[e]]),fe=e=>K[e],qt=e=>{K[e]=null},ze=e=>(K.push(e),K.length-1),bt=new Map,wi=(e,t)=>{bt.set(e,t);const n=Ge.get(e);n!==void 0&&(K[n]=t)},Si=e=>bt.has(e),Ge=new Map,_i=e=>{for(const[t,n]of Ge)if(n===e)return t},us=e=>{const t=Ge.get(e);if(t!==void 0)return t;const n=bt.get(e);if(!n)return-1;K.push(n);const r=K.length-1;return Ge.set(e,r),r},fs=(e=An())=>{const t=new Map,n=new Map,r=new Set;let s=!1;const i={registerView(o,l,f=1){t.set(o,{factory:l,version:f})},registerService(o,l,f=1){n.set(o,{factory:l,version:f})},putBuffer:ze,getBuffer:fe,get gl(){return s=!0,e}};return{views:t,services:n,drives3d:()=>s,has:o=>r.has(o),register(o,l){if(!r.has(o)){r.add(o);try{l(i)}catch(f){console.warn(`[web-lite] the "${o}" plugin did not register: ${f instanceof Error?f.message:f}`)}}}}},Xt={pager:["pagerSetContent"],vlist:["vlistInit"],tween:["tweenCreate","defineTransition"],canvas:["_creatorCanvas."],video:["createVideo"],plugins:["viewCall","isViewSupported","_creatorService."]},ds={pager:()=>ue(()=>import("./assets/pager-DpGa2uaE.js"),[],import.meta.url).then(e=>e.pager),vlist:()=>ue(()=>import("./assets/vlist-CwSYpLz-.js"),[],import.meta.url).then(e=>e.vlist),tween:()=>ue(()=>import("./assets/tween-BnWYhJ7P.js"),[],import.meta.url).then(e=>e.tween),canvas:()=>ue(()=>import("./assets/canvas-WxiusXCB.js"),[],import.meta.url).then(e=>e.canvas),video:()=>ue(()=>import("./assets/video-BLj61nDx.js"),[],import.meta.url).then(e=>e.video),plugins:()=>ue(()=>import("./assets/plugins-CuEPHbHL.js"),[],import.meta.url).then(e=>e.plugins)},On=Object.keys(Xt).map(e=>({name:e,uses:Xt[e],load:ds[e]})),ps=e=>On.filter(t=>t.uses.some(n=>e.includes(n))).map(t=>t.name),hs=async e=>{const t=ps(e);return(await Promise.all(On.filter(r=>t.includes(r.name)).map(r=>r.load().catch(s=>(console.warn(`[web-lite] the "${r.name}" feature did not load: ${s instanceof Error?s.message:s}`),null))))).filter(r=>r!==null)},ms=e=>{let t=null,n=null;const r=(f,d)=>{t==null||t(f,d)},s=()=>r(document.hidden?"pause":"resume"),i=()=>r("online"),o=()=>r("offline");return document.addEventListener("visibilitychange",s),window.addEventListener("online",i),window.addEventListener("offline",o),{bridge:{run(f,d,v,b){let L;try{L=Cn(f)}catch{d("run: no such buffer");return}e.rerun(L,b,d)},restart(f){e.rerun(void 0,f)},quit(){},launchUrl:()=>e.launchUrl(),registerEvent(f){t=f},setFreedEmitter(f){n=f},ownedStats:()=>e.stats(),state:()=>document.hidden?"background":"active",isOnline:()=>navigator.onLine,openUrl(f){window.open(f,"_blank","noopener")},setOrientation(f){var b,L,_,p;const d=f==="landscape"||f==="portrait"?f:"auto";if(e.onOrientation){e.onOrientation(d);return}const v=typeof screen<"u"?screen.orientation:void 0;if(v)try{d==="auto"?(b=v.unlock)==null||b.call(v):(p=(_=(L=v.lock)==null?void 0:L.call(v,d))==null?void 0:_.catch)==null||p.call(_,()=>{})}catch{}}},emit:r,freed:(f,d)=>{n==null||n(f,d)},dispose(){t=null,n=null,document.removeEventListener("visibilitychange",s),window.removeEventListener("online",i),window.removeEventListener("offline",o)}}},gs=(e,t,n,r)=>{try{const s=document.createElement("input");s.type="file",s.multiple=n,r&&(s.accept=r),s.onchange=async()=>{const{files:i}=s;if(n){const o=[];if(!i)return e([]);for(let l of i)o.push([ze(await l.arrayBuffer()),l.name,l.size]);e(o)}else{if(!i||i.length===0)return e(null);e([[ze(await i[0].arrayBuffer()),i[0].name,i[0].size]])}},window.addEventListener("focus",()=>{setTimeout(()=>{(!s.files||s.files.length===0)&&e(n?[]:null)},300)},{once:!0}),s.click()}catch(s){t(s)}},Un=e=>e==="camera"?"camera":e==="microphone"||e==="speech"?"microphone":e==="location"?"geolocation":null,Mn=(e,t,n)=>{const r=Un(e);if(!r){n(`${e}: not a permission this host asks for`);return}const s=navigator.permissions;if(!(s!=null&&s.query)){t("prompt");return}s.query({name:r}).then(i=>t(i.state),()=>t("prompt"))},bs=(e,t,n)=>{if(!Un(e)){n(`${e}: not a permission this host asks for`);return}const r=()=>Mn(e,t,n);if(e==="location"){if(!navigator.geolocation){t("denied");return}navigator.geolocation.getCurrentPosition(()=>t("granted"),i=>i.code===i.PERMISSION_DENIED?t("denied"):r(),{timeout:15e3,maximumAge:1/0});return}const s=navigator.mediaDevices;if(!(s!=null&&s.getUserMedia)){t("denied");return}s.getUserMedia(e==="camera"?{video:!0}:{audio:!0}).then(i=>{for(const o of i.getTracks())o.stop();t("granted")},i=>{const o=i instanceof Error?i.name:"";o==="NotAllowedError"||o==="SecurityError"?t("denied"):r()})},ys=e=>({get platform(){return"web"},get language(){return e()},get pixelRatio(){return window.devicePixelRatio||1},vibrate(){var t;try{(t=navigator.vibrate)==null||t.call(navigator,30)}catch{}},clipboardWrite(t){var n;(n=navigator.clipboard)==null||n.writeText(t).catch(()=>{})},clipboardRead(t,n){const r=navigator.clipboard;if(!(r!=null&&r.readText)){n("Clipboard is not available");return}r.readText().then(t,s=>n(s instanceof Error?s.message:"Clipboard read failed"))},share(t,n){var l;const r=$n(t),s=new File([r],"image.png",{type:"image/png"});if((l=navigator.canShare)!=null&&l.call(navigator,{files:[s]})){navigator.share({files:[s],text:n}).catch(()=>{});return}const i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=s.name,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i)},openFilePicker:(t,n,r,s)=>gs(t,n,r,s??void 0),queryPermission:Mn,requestPermission:bs}),vs=e=>{const t=e==null?void 0:e._h;return typeof e=="object"&&e!==null&&typeof(t==null?void 0:t.id)=="number"?t.id:null},Es=e=>{if(e==null)return;if(typeof e=="string")return e;const t=e._entries;if(!Array.isArray(t))throw new Error("fetch: the body is a string or a FormData");const n=new FormData;for(const[r,s,i]of t){const o=vs(s);o!==null?n.append(r,$n(o),i):n.append(r,String(s))}return n},ws=()=>{const e=new Set,t=new FinalizationRegistry(i=>{e.delete(i)&&qt(i)}),n=i=>{const o={id:i};return e.add(i),t.register(o,i),o};let r=!1;return{bridge:{fetch(i,o,l,f,d){const v=typeof(o==null?void 0:o.onProgress)=="function"?o.onProgress:d;if(i.startsWith("id:")){const b=Number(i.slice(3));l({id:b},fe(b)?200:404);return}(async()=>{var b;try{const L=await fetch(i,{method:o==null?void 0:o.method,headers:o==null?void 0:o.headers,body:Es(o==null?void 0:o.body),mode:"cors",credentials:"omit"}),_=v?(b=L.body)==null?void 0:b.getReader():void 0;let p;if(!_)p=await L.arrayBuffer();else{const y=Number(L.headers.get("content-length"))||void 0,E=[];let k=0;for(;;){const{done:U,value:D}=await _.read();if(U)break;D&&(E.push(D),k+=D.length,r||v({loaded:k,total:y}))}const C=new Uint8Array(k);let N=0;for(const U of E)C.set(U,N),N+=U.length;p=C.buffer}if(r)return;l(n(ze(p)),L.status)}catch(L){r||f(L instanceof Error?L:String(L))}})()},local:i=>us(i),toJson:i=>is(i),slice:(i,o,l)=>ls(i,o,l),toText:i=>Cn(i),toBytes:i=>as(i)},live:()=>e.size,dispose(){r=!0;for(const i of e)qt(i);e.clear()}}},Jt=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],nt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],Fe=4,rt=16,Qt=16,Ss=.5,_s=e=>{const t=new Set;let n=null;const r=(T,O,P=-1,V=0)=>{n==null||n(T,O,P,V)},s=T=>{if(!T.code)return;const O=t.has(T.code);t.add(T.code),r(0,T.code,-1,O||T.repeat?1:0)},i=T=>{T.code&&t.delete(T.code)&&r(1,T.code)},o=()=>{for(const T of[...t])T.startsWith("Gamepad")||(t.delete(T),r(1,T))},{root:l}=e;let f=0,d=0,v=0,b=0,L=0,_=0,p=0,y=0,E=0,k=0;const C=T=>{if(T.pointerType&&T.pointerType!=="mouse")return;const O=l.getBoundingClientRect();f=T.clientX-O.left,d=T.clientY-O.top,v+=T.movementX||0,b+=T.movementY||0},N=T=>{const O=Jt[T.button];O&&(t.add(O),r(0,O))},U=T=>{const O=Jt[T.button];O&&t.delete(O)&&r(1,O)},D=T=>{const O=T.deltaMode===0?.01:1;L+=T.deltaX*O,_+=T.deltaY*O},F=T=>{document.pointerLockElement===l&&T.preventDefault()},B=[],m=[],S=[],M=()=>{var O,P;const T=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let V=0;V<Fe;V++){const H=T[V]??null,X=!!H&&H.connected;if(X!==!!B[V]){if(B[V]=X,!X){for(const q of nt)t.delete(q+"@"+V)&&(r(1,q,V),W(q));S[V]=[],m[V]=[0,0,0,0,0,0]}r(X?2:3,"",V)}if(!H||!X)continue;const te=H.axes,ie=H.buttons,$e=((O=ie[6])==null?void 0:O.value)??0,ae=((P=ie[7])==null?void 0:P.value)??0;m[V]=[te[0]??0,te[1]??0,te[2]??0,te[3]??0,$e,ae];const J=S[V]??(S[V]=[]);for(let q=0;q<nt.length;q++){const de=ie[q],a=!!de&&(de.pressed||de.value>Ss);if(a===!!J[q])continue;J[q]=a;const c=nt[q];a?t.add(c+"@"+V):t.delete(c+"@"+V),W(c),r(a?0:1,c,V)}}},W=T=>{let O=!1;for(let P=0;P<Fe&&!O;P++)t.has(T+"@"+P)&&(O=!0);O?t.add(T):t.delete(T)};let I=0;const z=()=>{p=v,y=b,E=L,k=_,v=b=L=_=0,M(),I=requestAnimationFrame(z)},u=e.windows.filter((T,O,P)=>T&&P.indexOf(T)===O);for(const T of u)e.keyboard!==!1&&(T.addEventListener("keydown",s),T.addEventListener("keyup",i)),T.addEventListener("blur",o);return l.addEventListener("pointermove",C,!0),l.addEventListener("mousedown",N,!0),window.addEventListener("mouseup",U,!0),l.addEventListener("wheel",D,{passive:!0,capture:!0}),l.addEventListener("contextmenu",F,!0),typeof requestAnimationFrame=="function"&&(I=requestAnimationFrame(z)),{inputKey:(T,O)=>O>=0&&T.startsWith("Gamepad")?t.has(T+"@"+O):t.has(T),inputRead:T=>{var O;switch(T){case 0:return f;case 1:return d;case 2:return p;case 3:return y;case 4:return E;case 5:return k;case 6:return document.pointerLockElement===l?1:0;case 7:{let P=0;for(let V=0;V<Fe;V++)B[V]&&P++;return P}}if(T>=rt){const P=Math.floor((T-rt)/Qt),V=(T-rt)%Qt;return P>=Fe||!B[P]?0:V===0?1:((O=m[P])==null?void 0:O[V-1])??0}return 0},inputSetPointerLock:T=>{if(!T)return document.pointerLockElement===l&&document.exitPointerLock(),!0;if(document.pointerLockElement===l)return!0;if(typeof l.requestPointerLock!="function")return!1;try{const O=l.requestPointerLock({unadjustedMovement:!0});return O&&typeof O.catch=="function"&&O.catch(()=>{try{l.requestPointerLock()}catch{}}),!0}catch{return!1}},registerInputEvent:T=>{n=T},dispose:()=>{for(const T of u)T.removeEventListener("keydown",s),T.removeEventListener("keyup",i),T.removeEventListener("blur",o);l.removeEventListener("pointermove",C,!0),l.removeEventListener("mousedown",N,!0),window.removeEventListener("mouseup",U,!0),l.removeEventListener("wheel",D,!0),l.removeEventListener("contextmenu",F,!0),I&&cancelAnimationFrame(I),document.pointerLockElement===l&&document.exitPointerLock(),t.clear(),n=null}}},ks=e=>{const t=e.ownerDocument.defaultView??window,n=_s({windows:[t],root:e}),r=t.visualViewport,s=()=>r?Math.max(0,Math.round(t.innerHeight-r.height-r.offsetTop)):0;let i=null,o=0;const l=()=>{const d=s();d!==o&&(o=d,i==null||i(d,0))};return r==null||r.addEventListener("resize",l),{bridge:{key:n.inputKey,read:n.inputRead,setPointerLock:n.inputSetPointerLock,registerEvent(d){n.registerInputEvent(d)},keyboardHeight:s,registerKeyboardEvent(d){i=d}},dispose(){i=null,r==null||r.removeEventListener("resize",l),n.dispose()}}},Y=[null],Ee=[!1],Nn=(e,t,n)=>{e.addEventListener("ended",()=>{n(),Ee[t]&&(e.currentTime=0,e.play())})},Ls=(e,t)=>{const n=document.createElement("video");document.body.appendChild(n),n.crossOrigin="anonymous",n.style="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",n.src=e,n.playsInline=!0,n.controls=!1;const r=Y.length;return Y.push(n),Ee.push(!1),Nn(n,r,t),r},Ts=(e,t)=>{const n=document.createElement("audio");document.body.appendChild(n),n.style="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",n.src=e;const r=Y.length;return Y.push(n),Ee.push(!1),Nn(n,r,t),r},xs=(e,t)=>{const n=Y[e];n&&(t===0?n.muted=!0:(n.muted&&(n.muted=!1),n.volume=t))},Rs=(e,t)=>{const n=Y[e];n&&(t?n.play():n.pause())},As=(e,t)=>{Ee[e]=t},Cs=e=>{var t;return((t=Y[e])==null?void 0:t.currentTime)??0},$s=(e,t)=>{const n=Y[e];n&&(n.currentTime=t)},Os=e=>{var n;const t=((n=Y[e])==null?void 0:n.duration)??0;return isNaN(t)?0:t},ki=e=>Y[e],Fn=e=>{e.pause(),e.removeAttribute("src"),e.load(),e.remove()},Us=e=>{const t=Y[e];t&&(Fn(t),Y[e]=null,Ee[e]=!1)},Li=()=>{for(let e of Y)e&&Fn(e);Y.length=1,Ee.length=1},Ms=()=>{const e=new Map;let t=null;const n=o=>{e.delete(o)&&Us(o)},r=new FinalizationRegistry(o=>{const l=e.get(o);l&&(l.held=!1,l.playing||n(o))}),s=(o,l)=>{let f=-1;if(f=o(l,()=>{const b=e.get(f);b&&(t==null||t(f),!b.loop&&(b.playing=!1,b.held||n(f)))}),f<0)return null;e.set(f,{held:!0,playing:!1,loop:!1});const v={id:f};return r.register(v,f),v};return{bridge:{createAudio:o=>s(Ts,o),createVideo:o=>s(Ls,o),setVolume:xs,setLoop(o,l){const f=e.get(o);f&&(f.loop=l),As(o,l)},setPlaying(o,l){const f=e.get(o);f&&(f.playing=l,Rs(o,l),!l&&!f.held&&n(o))},time:Cs,setTime:$s,duration:Os,setEmitter(o){t=o}},live:()=>e.size,dispose(){t=null;for(const o of[...e.keys()])n(o)}}},Ns=()=>{const e=[];return{bridge:{open(n,r){const s=e.length;let i;try{i=new WebSocket(n)}catch{return e.push(null),queueMicrotask(()=>r("error")),s}return i.addEventListener("open",()=>r("open")),i.addEventListener("message",o=>r("message",o.data)),i.addEventListener("close",o=>{e[s]=null,r("close",o.code)}),i.addEventListener("error",()=>r("error")),e.push(i),s},send(n,r){const s=e[n];s&&s.readyState===WebSocket.OPEN&&s.send(r)},close(n){var r;(r=e[n])==null||r.close()}},dispose(){for(const n of e)n==null||n.close();e.length=0}}},Fs=e=>{let t="default",n=null,r=!1;const s=()=>`lecodes:${e}:${t}`,i=()=>{if(n)return n;n={};try{const d=window.localStorage.getItem(s()),v=d?JSON.parse(d):null;if(v&&typeof v=="object")for(const[b,L]of Object.entries(v))typeof L=="string"&&(n[b]=L)}catch{}return n},o=()=>{if(r=!1,!!n)try{window.localStorage.setItem(s(),JSON.stringify(n))}catch{}},l=()=>{r||(r=!0,queueMicrotask(o))};return{bridge:{get:d=>i()[d]??null,set(d,v){i()[d]=String(v),l()},remove(d){delete i()[d],l()},select(d){r&&o(),t=d,n=null}},dispose(){r&&o()}}},Ps=e=>{const t=e.ownerDocument,n=t.defaultView??window;let r=null;const s=new Map;let i=0,o=0,l=null;const f=()=>{o=s.size?n.requestAnimationFrame(f):0;for(const b of[...s.values()])b()},d=b=>{b!==l&&(l==null||l.remove(),l=b,r&&(b&&(b.classList.add("lc-background"),b.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: #000",e.insertBefore(b,r.canvas)),r.engine._setTransparent(!!b)))};return{facade:{...An(),setMatrix(b,L){r==null||r.engine.setWorldMatrix(b,Float32Array.from(L))},setVisible(b,L){r==null||r.engine.setVisible(b,L)},setCameraMatrix(b,L){r==null||r.engine.setCameraMatrix(b,Float32Array.from(L))},setProjection(b,L,_,p){r==null||r.engine.setCameraProjectionMatrix(b,Float32Array.from(L),_,p)},clearProjection(b){r==null||r.engine.clearCameraProjectionMatrix(b)},setBackground(b,L){d(L)},onFrame(b){const L=i++;return s.set(L,b),o||(o=n.requestAnimationFrame(f)),()=>{s.delete(L)}},readPixels(b,L){if(!r||r.opened()!==b){L(null,0,0);return}const _=r.canvas;r.engine._renderNow();const p=t.createElement("canvas");p.width=_.width,p.height=_.height;const y=p.getContext("2d");if(!y||_.width===0||_.height===0){L(null,0,0);return}y.drawImage(_,0,0);const E=y.getImageData(0,0,_.width,_.height);L(new Uint8Array(E.data.buffer),_.width,_.height)},viewport:()=>ss(r==null?void 0:r.canvas,n)},attach(b){b!==r&&(d(null),s.clear(),r=b)}}},Zt={scene3d:{uses:["_creator.createScene","_creator.createEntity"],module:"/web-lite/src/engines/scene3d.ts"},anim:{uses:["_creator.animator","_creator.getGlbClipSet","_creator.loadClips","_creator.createClipFromTracks"],module:"/creator-anim/dist/creatorAnim.js"},physics:{uses:["_creator.physicsBuild","_creator.physicsCreate","_creator.physicsConfigure","_creator.physicsRaycast","_creator.characterCreate","_creator.vehicleCreate","_creator.ragdollCreate"],module:"/creator-physics/dist/creatorPhysics.js"},particles:{uses:["_creator.createParticleSystem","_creator.createNoise"],module:"/creator-particles/dist/creatorParticles.js"}},Is=e=>{const t=Object.keys(Zt).filter(n=>Zt[n].uses.some(r=>e.includes(r)));return new Set(t)},en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pn={};for(let e=0;e<en.length;e++)Pn[en[e]]=e;const Ds=e=>{const t=[];let n=0,r=0;for(const s of e){const i=Pn[s];if(i===void 0)break;const o=i&32;if(r+=(i&31)<<n,o)n+=5;else{const l=r&1;r>>=1,t.push(l?-r:r),r=0,n=0}}return t};class Bs{constructor(t){He(this,"sources");He(this,"lines");this.sources=t.sources,this.lines=[];let n=0,r=0,s=0;for(const i of t.mappings.split(";")){const o=[];let l=0;if(i)for(const f of i.split(",")){const d=Ds(f);d.length!==0&&(l+=d[0],d.length>=4&&(n+=d[1],r+=d[2],s+=d[3],o.push([l,n,r,s])))}this.lines.push(o)}}originalPositionFor(t,n){const r=this.lines[t-1];if(!r||r.length===0)return null;let s=null;for(const o of r)if(o[0]<=n)s=o;else break;s??(s=r[0]);const i=this.sources[s[1]];return i===void 0?null:{source:i,line:s[2]+1,column:s[3]}}}const Vs=e=>{const t=e.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const n=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new Bs(JSON.parse(n))}catch{return null}};let he=null;const Ws=()=>{if(he!==null)return he;try{new Function("throw new Error('chisel-calibrate')")()}catch(e){const n=(e.stack??"").match(/<anonymous>:(\d+):\d+/);return he=n?parseInt(n[1],10)-1:2,he}return he=2,he},tn=(e,t)=>{const n=(e instanceof Error?e.stack:"")??"",r=Ws(),s=[];for(const i of n.split(`
286
- `)){const o=i.match(/<anonymous>:(\d+):(\d+)/);if(!o)continue;const l=parseInt(o[1],10)-r,f=parseInt(o[2],10)-1;if(l<1)continue;const d=t.originalPositionFor(l,f<0?0:f);if(!d)continue;const v=i.match(/at\s+([^\s(]+)\s*\(/);s.push({fn:v?v[1]:null,source:d.source,line:d.line,column:d.column})}return s},zs=e=>{const t=[],n=(o,l,f)=>{var b;const d=l instanceof Error?l.message:String(l),v=f[0];console.error(v?`[lecodes] ${d}
287
- at ${v.source}:${v.line}:${v.column}${v.fn?` (${v.fn})`:""}`:`[lecodes] ${d}`),(b=o.onError)==null||b.call(o,{message:d,frames:f,stack:l instanceof Error?l.stack:void 0})},r=o=>{for(let l=t.length-1;l>=0;l--){const f=t[l];if(!f.sourceMap)continue;const d=tn(o,f.sourceMap);if(d.length>0)return n(f,o,d),!0}return!1},s=o=>{r(o.error??o.message)},i=o=>{r(o.reason)};return e.addEventListener("error",s),e.addEventListener("unhandledrejection",i),{track(o,l){const f={sourceMap:Vs(o),onError:l};return t.push(f),{thrown(d){n(f,d,f.sourceMap?tn(d,f.sourceMap):[])},drop(){const d=t.indexOf(f);d>=0&&t.splice(d,1)}}},dispose(){e.removeEventListener("error",s),e.removeEventListener("unhandledrejection",i),t.length=0}}},Gs=""+new URL("assets/roboto-cyrillic-ext-1gPz9dK9.woff2",import.meta.url).href,js=""+new URL("assets/roboto-cyrillic-DVBNKCCH.woff2",import.meta.url).href,Hs=""+new URL("assets/roboto-greek-ext-D98D44EL.woff2",import.meta.url).href,Ks=""+new URL("assets/roboto-greek-DVLYEgdx.woff2",import.meta.url).href,Ys=""+new URL("assets/roboto-latin-ext-t610Sqxq.woff2",import.meta.url).href,qs=""+new URL("assets/roboto-latin-cAJwcdBQ.woff2",import.meta.url).href,Xs=""+new URL("assets/roboto-rest-C7JkyNHT.woff2",import.meta.url).href,Js=""+new URL("assets/roboto-vietnamese-w-p-nKZZ.woff2",import.meta.url).href,Qs="Roboto",Zs="100 900",ei=[{name:"rest",file:"roboto-rest.woff2",range:"U+02D8-02D9, U+02DB, U+030F, U+2070, U+2074-208E, U+20C1, U+2105, U+2126, U+212E, U+215B-215E, U+2202, U+2206, U+220F, U+2211, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25A0, U+25CA-25CB, U+25CF, U+EE01-EE02, U+F6C3, U+FB01-FB04, U+FFFC",bytes:13324},{name:"cyrillic-ext",file:"roboto-cyrillic-ext.woff2",range:"U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",bytes:36720},{name:"cyrillic",file:"roboto-cyrillic.woff2",range:"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",bytes:23696},{name:"greek-ext",file:"roboto-greek-ext.woff2",range:"U+1F00-1FFF",bytes:4380},{name:"greek",file:"roboto-greek.woff2",range:"U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF",bytes:17588},{name:"vietnamese",file:"roboto-vietnamese.woff2",range:"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",bytes:14340},{name:"latin-ext",file:"roboto-latin-ext.woff2",range:"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",bytes:26388},{name:"latin",file:"roboto-latin.woff2",range:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",bytes:36600}],ot={family:Qs,weight:Zs,parts:ei},ti=Object.assign({"./assets/fonts/roboto-cyrillic-ext.woff2":Gs,"./assets/fonts/roboto-cyrillic.woff2":js,"./assets/fonts/roboto-greek-ext.woff2":Hs,"./assets/fonts/roboto-greek.woff2":Ks,"./assets/fonts/roboto-latin-ext.woff2":Ys,"./assets/fonts/roboto-latin.woff2":qs,"./assets/fonts/roboto-rest.woff2":Xs,"./assets/fonts/roboto-vietnamese.woff2":Js}),nn="data-lecodes-lite-fonts",ni=1500,ri=e=>{if(e.head.querySelector(`style[${nn}]`))return;const t=ot.parts.map(r=>{const s=ti[`./assets/fonts/${r.file}`];if(!s)return"";const i=new URL(s,e.baseURI).href;return`@font-face{font-family:"${ot.family}";src:url("${i}") format("woff2");font-weight:${ot.weight};font-style:normal;font-display:swap;unicode-range:${r.range}}`}),n=e.createElement("style");n.setAttribute(nn,""),n.textContent=t.join(`
288
- `),e.head.appendChild(n)},oi=(e,t=[],n=ni)=>{const r=e.defaultView??window,s=e.fonts?e.fonts.ready.then(()=>{},()=>{}):Promise.resolve();return new Promise(i=>{const o=r.setTimeout(i,n);Promise.all([s,...t.map(l=>l.then(()=>{},()=>{}))]).then(()=>{r.clearTimeout(o),i()})})},rn=e=>typeof e=="object"&&e!==null&&e.lecodes===!0&&typeof e.level=="number",ft=(e,t={})=>{let n;if((t.mode??"hash")==="hash")n=e.hash.replace(/^#/,"");else{const r=t.base??"/";n=(e.pathname.startsWith(r)?e.pathname.slice(r.length-1):e.pathname).replace(/\/index\.html$/,"/")+e.search}return n===""||n==="/"?null:n.startsWith("/")?n:`/${n}`},si=(e,t,n={})=>{if((n.mode??"hash")==="hash")return`${t.pathname}${t.search}${e===null?"":`#${e}`}`;const r=n.base??"/";return e===null?r:r.replace(/\/$/,"")+e},ii=(e,t,n={})=>{const r=e.history,s=e.location;let i=0,o=!1,l=0,f=!1;const d=(_,p)=>{const y={lecodes:!0,level:p},E=si(t.address(),s,n);_==="push"?r.pushState(y,"",E):r.replaceState(y,"",E)},v=_=>{_!==0&&(l++,r.go(_))},b=()=>{if(l>0){f=!0;return}const _=t.level();if(o){i=_,d("replace",_);return}if(_>i){for(let p=i+1;p<=_;p++)d("push",p);i=_}else if(_<i){const p=_-i;i=_,v(p)}else d("replace",_)},L=_=>{if(l>0){if(l--,l>0)return;f?(f=!1,b()):d("replace",i);return}const p=_.state;if(!rn(p)){const C=ft(s,n);r.replaceState({lecodes:!0,level:i},"",s.href),C!==null&&t.link(C);return}const y=p.level,E=i;o=!0;try{if(y<E)for(;t.level()>y;){const C=t.level();if(t.back(),t.level()>=C)break}else if(y>E){const C=ft(s,n);C!==null&&t.link(C)}}finally{o=!1}const k=Math.max(0,t.level());if(i=y,k===y){d("replace",y);return}if(y>E&&k>E){i=k,d("replace",k);return}i=k,v(k-y)};return e.addEventListener("popstate",L),rn(r.state)?i=r.state.level:r.replaceState({lecodes:!0,level:0},"",s.href),{sync:b,reset(){const _=-i;i=0,v(_)},destroy(){e.removeEventListener("popstate",L)}}},ai=.1,li=e=>{const t=new Set,n=new Set,r=new Map;let s=1,i=0,o=0;const l=f=>{i=0;const d=Math.min(ai,Math.max(0,(f-o)/1e3));o=f;for(const v of[...r.values()])v(d);r.size>0&&(i=e.requestAnimationFrame(l))};return{globals:{setTimeout(f,d,...v){const b=e.setTimeout(()=>{t.delete(b),f(...v)},d);return t.add(b),b},clearTimeout(f){t.delete(f),e.clearTimeout(f)},setInterval(f,d,...v){const b=e.setInterval(()=>f(...v),d);return n.add(b),b},clearInterval(f){n.delete(f),e.clearInterval(f)},setLoop(f){const d=s++;return r.set(d,f),i===0&&(o=e.performance.now(),i=e.requestAnimationFrame(l)),d},clearLoop(f){r.delete(f)}},dispose(){for(const f of t)e.clearTimeout(f);for(const f of n)e.clearInterval(f);t.clear(),n.clear(),r.clear(),i!==0&&e.cancelAnimationFrame(i),i=0}}},ci=["_creator","_creator2d","_creatorNav","_creatorNet","_creatorAudio","_creatorCanvas","_creatorFiles","_creatorService"],on=new Map,ui=e=>{let t=on.get(e);return t||on.set(e,t=cs(e)),t},fi=(e,t={})=>{const n=e.ownerDocument,r=n.defaultView??window,s=zs(r),i=t.language??(()=>(navigator.language||"en").slice(0,2));let o=null;const l=Ps(e),f=fs(l.facade),d=new Set,v=F=>Promise.all([...F].map(async B=>{if(!(!t.loadPlugin||d.has(B))){d.add(B);try{const m=await t.loadPlugin(B);m&&f.register(B,m)}catch(m){console.warn(`[web-lite] the "${B}" plugin did not load: ${m instanceof Error?m.message:m}`)}}})),b=async(F,B,m)=>{const S=Is(F);if(!S.has("scene3d"))return{features:[],scene:null,dispose(){}};try{const{createScene3d:M}=await ue(async()=>{const{createScene3d:I}=await import("./assets/scene3d-D5R7Vq3f.js").then(z=>z.s);return{createScene3d:I}},[],import.meta.url),W=await M(e,{preloads:B,twins:{anim:S.has("anim"),physics:S.has("physics"),particles:S.has("particles")},alpha:m});return{features:[W.feature],scene:W,dispose:W.dispose}}catch(M){return console.warn(`[web-lite] the 3D engine did not start: ${M instanceof Error?M.message:M}`),{features:[],scene:null,dispose(){}}}};let L=t.launchRoute!==void 0?t.launchRoute:t.history?ft(r.location,t.history):null,_=t.safeArea??null,p=0;const y=n.createElement("div");y.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);";const E=()=>{y.isConnected||n.body.appendChild(y);const F=r.getComputedStyle(y),B=m=>Math.round(parseFloat(m)||0);return{top:B(F.paddingTop),right:B(F.paddingRight),bottom:B(F.paddingBottom),left:B(F.paddingLeft)}},k=()=>{const F=_??E();o==null||o.tree.setSafeArea(F,F.bars??[])};r.addEventListener("resize",k);const C=t.history?ii(r,{level:()=>Math.max(0,((o==null?void 0:o.tree.presentation.stack().length)??0)-1),address:()=>(o==null?void 0:o.tree.presentation.address())??null,back:()=>{o==null||o.tree.back()},link:F=>{L=F,o==null||o.emitApp("url",F)}},t.history):null,N=()=>{l.attach(null),o==null||o.dispose(),o=null},U=(F,B,m)=>{const S=rs({root:e,bufferUrl:ui,features:m,plugins:f,onNavigation:()=>{var T;C==null||C.sync(),(T=t.onNavigation)==null||T.call(t,S)}}),M=li(r),W=ws(),I=Fs(t.project??"app"),z=Ns(),u=ks(e),A=Ms(),x=s.track(F,B.onError),g=ms({launchUrl:()=>L,rerun:(T,O,P)=>{O!==void 0&&(L=O);const V=T??F;r.setTimeout(()=>{D(V,B).catch(H=>P==null?void 0:P(H instanceof Error?H.message:String(H)))},0)},stats:()=>JSON.stringify({live:{tree:S.stats().nodes,fetch:W.live(),media:A.live(),tween:S.stats().tweens},pending:0}),onOrientation:t.onOrientation}),h={_creatorTree:S.bridge,_creatorApp:g.bridge,_creatorDevice:ys(i),_creatorFetch:W.bridge,_creatorStorage:I.bridge,_creatorSocket:z.bridge,_creatorInput:u.bridge,_creatorMedia:A.bridge,...M.globals};for(const T of ci)h[T]=void 0;Object.assign(h,S.globals),o={code:F,tree:S,emitApp:g.emit,dispose(){x.drop(),M.dispose(),z.dispose(),A.dispose(),u.dispose(),I.dispose(),W.dispose(),g.dispose(),S.destroy()}},k();const $=Object.keys(h);try{new Function(...$,F)(...$.map(T=>h[T]))}catch(T){x.thrown(T)}};async function D(F,B={}){const m=Qn(F);if(!qn(m.sdk,wt))throw new Error(`This app was built with LeCodes SDK ${m.sdk??"older than 2.0"}; this host runs SDK ${wt}. It needs a new build.`);m.is2d&&console.warn("[web-lite] this app uses 2D scenes, which Web Lite does not show yet (docs/plans/web-lite-plan.md): its UI runs, a scene's calls fail");const S=++p;o&&(C==null||C.reset()),N(),t.defaultFont!=="system"&&ri(n);const M=Jn(m.bootFonts,n),[W,I]=await Promise.all([hs(F),v(m.plugins).then(()=>b(F,m.preloads,f.drives3d()))]);if(S!==p){I.dispose();return}W.push(...I.features),l.attach(I.scene),e.style.visibility="hidden";try{U(F,B,W),o==null||o.tree.flush(),e.offsetHeight,await oi(n,[M])}finally{S===p&&(e.style.visibility="")}}return{run:D,restart(F){return o?(F!==void 0&&(L=F),D(o.code)):Promise.resolve()},tree:()=>(o==null?void 0:o.tree)??null,setSafeArea(F){_=F,k()},openRoute(F){L=F,o==null||o.emitApp("url",F)},emitAppEvent(F,B){o==null||o.emitApp(F,B)},destroy(){p++,N(),r.removeEventListener("resize",k),C==null||C.destroy(),y.remove(),s.dispose()}}},Le=document.getElementById("app"),sn=document.getElementById("error"),ve=new URLSearchParams(location.search),In=e=>{sn&&(sn.textContent=e)},an=ve.has("dev")?new URL(ve.get("dev")||"..",location.href).href.replace(/\/$/,""):null,ln=e=>{const t=e.frames[0];return t?`${e.message}
289
- at ${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:e.message},Dn=e=>{In(ln(e)),ee==null||ee.error(ln(e))},Bn=e=>Dn({message:e instanceof Error?e.message:String(e),frames:[]});let cn=null;const di=async e=>{cn??(cn=fetch(new URL("plugins.json",document.baseURI)).then(r=>r.ok?r.json():{plugins:{}}).then(r=>r.plugins??{},()=>({})));const t=(await cn)[e];if(!t)return null;const n=await import(new URL(t,document.baseURI).href);return typeof n.register=="function"?n.register:null},Vn=fi(Le,{loadPlugin:di,history:{mode:Le.dataset.urls==="path"?"path":"hash",base:Le.dataset.base??"/"},project:ve.get("project")??location.pathname,defaultFont:Le.dataset.font==="system"?"system":"roboto"});ve.has("test")&&(window.lecodesTest={ready:!1,dump:()=>{var e;return((e=Vn.tree())==null?void 0:e.bridge.debugDump())??'{"roots":[]}'},rect:e=>{const t=document.querySelector(`[data-node="${e}"]`);if(!t)return null;const n=t.getBoundingClientRect();return[n.left,n.top,n.width,n.height]}});let st=!1,it=null,dt=-1;const je=async e=>{if(st){it=e;return}st=!0,In("");try{const t=await fetch(e.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${e.src} → HTTP ${t.status}`);const n=await t.text();await Vn.run(n,{onError:Dn});const r=window.lecodesTest;r&&(r.ready=!0),ee&&e.version!==void 0&&(dt=ee.versionOf(t,e.version),ee.ran(dt))}catch(t){Bn(t)}finally{st=!1;const t=it;it=null,t&&je(t)}},ee=an?jn(an,e=>{e!==dt&&je({src:ee.bundleUrl(e),version:e})}):null;if(ee)for(const e of["log","info","warn","error"]){const t=console[e].bind(console);console[e]=(...n)=>{t(...n),ee.log(e,n)}}if(ee)je({src:ee.bundleUrl(0),version:0});else{const e=Hn(ve.get("src")??Le.dataset.src??"app.js",document.baseURI);e?je({src:e}):Bn(`The page runs bundles of its own origin only: ${ve.get("src")}`)}export{Xe as A,Ae as B,Je as C,fn as D,ge as E,De as F,Fr as G,yi as H,Mr as T,Ei as _,fe as a,_i as b,wi as c,ki as d,ue as e,mi as f,$n as g,Si as h,Se as i,me as j,xn as k,vi as l,Lt as m,Z as n,hi as o,ze as p,hr as q,Li as r,pr as s,ut as t,bi as u,un as v,gi as w,wo as x,En as y,_o as z};
285
+ `,$o=e=>{const t=e.defaultView??window;try{t.CSS.registerProperty({name:"--lc-dim",syntax:"<number>",inherits:!0,initialValue:"0"})}catch{}for(const f of Ao)try{t.CSS.registerProperty({name:f,syntax:"*",inherits:!1})}catch{}const n=e.createElement("style");n.setAttribute("data-lecodes-lite",""),n.textContent=Co,e.head.appendChild(n);const r=n.sheet,s=(f,d)=>{const v=f.insertRule(d,f.cssRules.length);return f.cssRules[v]},i=(f,d)=>{const v=f.cssRules;for(let b=v.length-1;b>=0;b--)if(v[b]===d){f.deleteRule(b);return}},o=new Map,l=(f,d)=>{const v=d===void 0?f:`${f}.${d}`;let b=o.get(v);return b||(b=d===void 0?s(r,`@layer ${f} {}`):s(l(f),`@layer ${d} {}`),o.set(v,b)),b};for(const f of Sn)f!=="lc-base"&&l(f);return{insert(f,d,v){const b=l(f,v),L=s(b,d);return{remove:()=>i(b,L)}},own(f){const d=l("lc-own"),v=s(d,`${f} {}`);return{set:(b,L)=>v.style.setProperty(b,L),unset:b=>{v.style.removeProperty(b)},remove:()=>i(d,v)}},destroy(){n.remove()}}},ut="lc-i";let Oo=1;const Ze=new Map,kn=e=>{let t=Ze.get(e);return t||Ze.set(e,t=`lc-c${Ze.size+1}`),t},Uo=(e,t)=>{const n=`{${t.text}}`,r=s=>`${s} .${e}, .${e}${s}`;switch(t.name){case"pressed":return{layer:"lc-press",text:`${r(`.${ut}:active`)} ${n}`};case"hovered":return{layer:"lc-hover",text:`@media (hover: hover) { ${r(`.${ut}:hover`)} ${n} }`};case"focused":return{layer:"lc-focus",text:`${r(".lc:focus-visible")} ${n}`};case"landscape":case"portrait":return{layer:"lc-orient",text:`@container ${_n} (orientation: ${t.name}) { .${e} ${n} }`};default:{const s=kn(t.name);return{layer:"lc-class",sub:s,text:`${r(`.${s}`)} ${n}`}}}},Mo=e=>e.base+""+e.transition+e.blocks.map(t=>`${t.name}${t.text}`).join(""),No=256,Fo=e=>{const t=new Map,n=new Set,r=()=>{let s=n.size>>1;for(const i of n){if(s--<=0)break;for(const o of i.rules)o.remove();n.delete(i),t.delete(i.key)}};return{acquire(s){const i=Mo(s);let o=t.get(i);if(o)return o.refs===0&&n.delete(o),o.refs++,o;const l=`lc-s${Oo++}`,f=[],d=s.transition?`${s.base?";":""}transition:${s.transition}`:"";f.push(e.insert("lc-bag",`.${l} {${s.base}${d}}`));for(const v of s.blocks){const b=Uo(l,v);f.push(e.insert(b.layer,b.text,b.sub))}return t.set(i,o={name:l,key:i,refs:1,rules:f}),o},release(s){--s.refs>0||(n.add(s),n.size>No&&r())},count:()=>({live:t.size-n.size,idle:n.size})}},Po=()=>({base:new Map,own:new Map,blocks:new Map,cls:null,rule:null,applied:new Map,dirty:!1}),zt=new Set([...jr,"easing"]),Io=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("_h"in e),Do=(e,t,n,r)=>{const s=new Set;let i=!1;const o=new Set,l=E=>{o.has(E)||(o.add(E),r(`style: "${E}" is not a style property — ignored`))};let f=null,d=null;const v=E=>{E.style.dirty=!0,s.add(E),!i&&(i=!0,queueMicrotask(p))},b=E=>{const k=E.style,C=Qe(k.own,n,l);if(!(C.size===0&&!k.rule)){k.rule||(k.rule=e.own(`.lc-n${E.id}`),E.el.classList.add(`lc-n${E.id}`));for(const N of k.applied.keys())C.has(N)||k.rule.unset(N);for(const[N,U]of C)k.applied.get(N)!==U&&k.rule.set(N,U);k.applied=C}},L=(E,k)=>{const C=new Map;for(const[N,U]of E){if(!(U.duration>0))continue;const D=`${U.duration}ms ${Ro(U.easing)} ${U.delay}ms`;for(const F of k.get(N).keys())F.startsWith("--")||C.set(F,`${F} ${D}`)}return[...C.values()].join(", ")},_=E=>{const k=E.style;k.dirty=!1;const C=Pt(Qe(k.base,n,l)),N=new Map,U=[];for(const[F,B]of k.blocks){const m=Qe(B.props,n,l);N.set(F,m),m.size>0&&U.push({name:F,text:Pt(m)})}const D=k.cls;C===""&&U.length===0?k.cls=null:k.cls=t.acquire({base:C,blocks:U,transition:L(k.blocks,N)}),D!==k.cls&&(D&&E.el.classList.remove(D.name),k.cls&&E.el.classList.add(k.cls.name)),D&&t.release(D),f==null||f(E)};function p(){if(i=!1,s.size===0)return;const E=[...s];s.clear();for(const k of E)k.style.dirty&&_(k)}const y=(E,k,C)=>{if(C==null){E.blocks.delete(k);return}if(!Io(C))return;let N=E.blocks.get(k);N||E.blocks.set(k,N={props:new Map,duration:0,delay:0,easing:void 0});for(const U of Object.keys(C)){const D=C[U];if(U==="duration"){N.duration=Number(D)||0;continue}if(U==="delay"){N.delay=Number(D)||0;continue}if(U==="easing"){N.easing=D;continue}if(zt.has(U)||U[0]==="$")continue;const F=Je(U);N.props.delete(F),D!=null&&N.props.set(F,D)}};return{flush:p,set onChange(E){f=E},set onWrite(E){d=E},merge(E,k){const C=E.style;let N=!1;for(const U of Object.keys(k)){const D=k[U];if(U[0]==="$"){y(C,U.slice(1),D);continue}if(zt.has(U))continue;const F=Je(U);C.base.delete(F),D!=null&&C.base.set(F,D),C.own.delete(F)&&(N=!0),d==null||d(E,F)}N&&b(E),v(E)},set(E,k,C){const N=E.style;if(k[0]==="$"){y(N,k.slice(1),C),v(E);return}const U=Je(k);if(!ho(U)){l(U);return}d==null||d(E,U),C==null?(N.own.delete(U),N.base.delete(U)&&v(E)):N.own.set(U,C),b(E),(yn(U)||U==="tintColor")&&(f==null||f(E))},setClass(E,k,C){E.el.classList.toggle(kn(k),C)},value(E,k){const C=E.style;return C.own.has(k)?C.own.get(k):C.base.get(k)},owns(E,k){return E.style.own.has(k)||E.style.base.has(k)},names(E,k){const C=E.style;if(C.own.has(k)||C.base.has(k))return!0;for(const N of C.blocks.values())if(N.props.has(k))return!0;return!1},drop(E){const k=E.style;s.delete(E),k.cls&&(t.release(k.cls),k.cls=null),k.rule&&(k.rule.remove(),k.rule=null)}}},Bo={button:"button",input:"input",textarea:"textarea",image:"img"},Vo=(e,t)=>{const n=e.createElement(Bo[t]??"div");if(n.className=`lc lc-${t}`,t==="button"&&(n.type="button"),t==="image"){const r=n;r.alt="",r.decoding="async",r.draggable=!1}return n},Wo=(e,t,n)=>({id:t,type:n,el:Vo(e,n),parent:null,flags:0,held:!0,rooted:!1,token:{},style:Po(),strings:new Map}),Ln=Symbol("lecodes.node"),be=e=>e==null?void 0:e[Ln],Tn=e=>{e.el[Ln]=e,e.el.setAttribute("data-node",String(e.id))},ke=e=>{const t=[];for(let n=e.el.firstElementChild;n;n=n.nextElementSibling){const r=be(n);r&&r.parent===e&&t.push(r)}return t},et=(e,t=",")=>{const n=[];let r=0,s="";for(const i of e){if(i==="("&&r++,i===")"&&r--,i===t&&r===0){n.push(s.trim()),s="";continue}s+=i}return s.trim()!==""&&n.push(s.trim()),n},Gt={"to top":0,"to right":90,"to bottom":180,"to left":270,"to top right":45,"to right top":45,"to bottom right":135,"to right bottom":135,"to bottom left":225,"to left bottom":225,"to top left":315,"to left top":315},zo=e=>{if(e in Gt)return Gt[e];const t=/^(-?[\d.]+)(deg|rad|turn|grad)$/.exec(e);if(!t)return null;const n=parseFloat(t[1]);return t[2]==="deg"?n:t[2]==="rad"?n*180/Math.PI:t[2]==="turn"?n*360:n*.9},Go=(e,t)=>{const n=[];for(const r of et(e.trim())){const s=/^(?:repeating-)?(linear|radial)-gradient\((.*)\)$/s.exec(r);if(!s)return null;const i=s[1],o=et(s[2]);let l=i==="linear"?180:0;if(o.length>0){const d=o[0],v=i==="linear"?zo(d):null;v!==null?(l=v,o.shift()):i==="radial"&&/\b(circle|ellipse|at|closest|farthest)\b/.test(d)&&o.shift()}const f=[];for(const d of o){const v=et(d," "),b=v[v.length-1],L=v.length>1&&/^-?[\d.]+%$/.test(b),_=L?v.slice(0,-1).join(" "):d;f.push({color:t(_)??"#00000000",position:L?parseFloat(b)/100:null})}if(f.length===0)return null;f[0].position===null&&(f[0].position=0),f[f.length-1].position===null&&(f[f.length-1].position=1);for(let d=1;d<f.length-1;d++){if(f[d].position!==null)continue;let v=d;for(;f[v].position===null;)v++;const b=f[d-1].position,L=f[v].position;for(let _=d;_<v;_++)f[_].position=b+(L-b)*(_-d+1)/(v-d+1);d=v}n.push({type:i,angle:l,stops:f.map(d=>({color:d.color,position:d.position}))})}return n.length>0?n:null},jo=Object.keys(Ve).filter(e=>Ve[e]!=="layout"),le=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0"),jt=e=>{const t=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/.exec(e.trim());if(t){const r=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return`#${le(+t[1])}${le(+t[2])}${le(+t[3])}${le(r*255)}`}const n=/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+))?\)$/.exec(e.trim());return n?`#${le(+n[1]*255)}${le(+n[2]*255)}${le(+n[3]*255)}${le((n[4]===void 0?1:+n[4])*255)}`:null},Ho=e=>{if(e==="none")return[1,0,0,0,1,0,0,0,1];const t=/^matrix\(([^)]+)\)$/.exec(e);if(!t)return null;const[n,r,s,i,o,l]=t[1].split(",").map(f=>parseFloat(f));return[n,r,0,s,i,0,o,l,1]},Ht={pointerEvents:{auto:"all"},overflow:{auto:"scroll"},display:{"-webkit-box":"flex",block:"flex"},showScrollbar:{none:"0",thin:"1",auto:"1"},overscrollMode:{auto:"default",contain:"absorb"},textAlign:{"-webkit-auto":"start"}},Ko=e=>{const t=e.root.ownerDocument,n=t.defaultView??window;let r=null;const s=d=>{r||(r=t.createElement("span"),r.style.cssText="position:absolute;visibility:hidden;pointer-events:none"),r.isConnected||e.root.appendChild(r),r.style.color="",r.style.color=d;const v=r.style.color===""?null:jt(n.getComputedStyle(r).color);return r.remove(),v},i=(d,v,b,L)=>{var y,E;if(yn(v)){const k=e.value(d,v);return k==null?null:b==="num"?Number(k===!0?1:k===!1?0:k):String(k)}const _=go(v);if(_===null)return null;const p=L.getPropertyValue(_).trim();if(p===""&&!d.el.isConnected)return o(d,v,b);if(p==="")return null;switch(b){case"color":return _.startsWith("--")?s(p):jt(p);case"len":{const k=parseFloat(p);return Number.isFinite(k)?k:v==="lineHeight"?parseFloat(L.fontSize)*1.2:null}case"num":{if(v==="lineClamp")return p==="none"?0:parseFloat(p)||0;const k=parseFloat(((y=Ht[v])==null?void 0:y[p])??p);return Number.isFinite(k)?k:null}case"enum":return((E=Ht[v])==null?void 0:E[p])??p;default:return v==="backgroundGradient"?p==="none"?null:Go(p,s):v==="transform"?Ho(p):v==="transformOrigin"?null:v==="fontFamily"?p.split(",")[0].trim().replace(/^["']|["']$/g,""):v==="backgroundImage"&&p==="none"?"":p}},o=(d,v,b)=>{const L=e.value(d,v)??Gr[v];if(L==null)return null;if(v==="transform")return L==="identity"||L==="none"?[1,0,0,0,1,0,0,0,1]:null;if(b==="color")return typeof L=="number"?`#${(L>>>0).toString(16).padStart(8,"0")}`:s(String(L));if(b==="len"||b==="num"){const _=typeof L=="number"?L:parseFloat(String(L));return Number.isFinite(_)?_:null}return String(L)},l=d=>{const v=n.getComputedStyle(d.el),b=[],L=[],_={};for(const p of jo){const y=e.owns(d,p);y&&b.push(p);const E=i(d,p,Ve[p],v);if(zr.includes(p)&&!y&&(E===null||E==="none")){_[p]=null;continue}L.push(p),_[p]=E}return{present:L,dirty:[],own:b,..._}},f=d=>{const v=d.el,b={id:d.id,type:d.type},L=d.strings.get("name");L&&(b.name=L);const _=d.strings.get("text");return d.type==="text"&&_&&(b.text=_),(d.type==="input"||d.type==="textarea")&&(b.value=v.value),b.flags=d.flags,b.layout=[v.offsetLeft,v.offsetTop,v.offsetWidth,v.offsetHeight],b.paint=l(d),e.extend(d,b,f),b.children=e.held(d)?[]:ke(d).map(f),b};return{dump(){return e.flush(),JSON.stringify({roots:e.roots().map(d=>({kind:d.kind,node:f(d.node)}))})},paint(d){return d?(e.flush(),JSON.stringify(l(d))):"null"}}},tt=10,Yo=500,qo=e=>{const{root:t,emit:n}=e,r=t.ownerDocument,s=r.defaultView??window,i=g=>{const h=t.getBoundingClientRect(),$=fn(t)||1;return[(g.clientX-h.left)/$,(g.clientY-h.top)/$]},o=(g,h)=>{for(let $=g instanceof Element?g:null;$&&$!==t;$=$.parentElement){if(e.boundary($))return null;const T=be($);if(T&&(T.flags&h)!==0)return T}return null},l=new Map;let f=!1,d=null;const v=(g,h)=>{const $=typeof h=="number"?h:0;($&Ot)!==0&&(g.tracked=!0,g.wantsMove=($&Ut)!==0,g.claim=$&Fr)},b=g=>{s.clearTimeout(g.timer),l.delete(g.pointerId)},L=g=>{if(g.pointerType==="mouse"&&g.button!==0)return;const h=o(g.target,Ie),[$,T]=i(g);d=[$,T],f=!1;const O={pointerId:g.pointerId,node:h,startX:$,startY:T,moved:!1,tracked:!1,wantsMove:!1,claim:0,handled:!1,timer:0};if(l.set(g.pointerId,O),!h){const P=g.target instanceof Element?e.hit(g.target,$,T):null;P!==null&&v(O,n(0,wr,g.pointerId,$,T,P));return}v(O,n(h.id,or,g.pointerId,$,T)),(h.flags&Tr)!==0&&(O.timer=s.setTimeout(()=>{if(l.get(O.pointerId)!==O||O.moved)return;const P=n(h.id,ir,O.pointerId,O.startX,O.startY),V=typeof P=="number"?P:0;(V&Pr)!==0&&(O.handled=!0),v(O,V)},Yo))},_=g=>{const h=l.get(g.pointerId);if(h){const[$,T]=i(g);!h.moved&&Math.hypot($-h.startX,T-h.startY)>tt&&(h.moved=!0,s.clearTimeout(h.timer)),h.tracked&&h.wantsMove&&n(0,ar,g.pointerId,$,T,$-h.startX,T-h.startY)}g.pointerType==="mouse"&&B(g)},p=g=>{const h=l.get(g.pointerId);if(!h)return;const[$,T]=i(g);h.tracked&&n(0,lr,g.pointerId,$,T,$-h.startX,T-h.startY),(h.moved||h.handled)&&(f=!0),b(h)},y=g=>{const h=l.get(g.pointerId);h&&(h.tracked&&n(0,_t,g.pointerId),f=!0,b(h))},E=g=>{if(g.cancelable){for(const h of l.values())if(h.tracked&&h.claim!==0){g.preventDefault();return}}},k=g=>{if(f){f=!1;return}const h=o(g.target,Ie);if(!h&&g.target instanceof Element){const[O,P]=i(g);if(d&&Math.hypot(O-d[0],P-d[1])>tt)return;const V=e.hit(g.target,O,P);V!==null&&n(0,Sr,g.pointerId??0,O,P,V);return}if(!h||(h.flags&Lr)===0)return;let $,T;if(g.detail===0&&g.clientX===0&&g.clientY===0){const O=h.el.getBoundingClientRect();[$,T]=i({clientX:O.left+O.width/2,clientY:O.top+O.height/2})}else if([$,T]=i(g),d&&Math.hypot($-d[0],T-d[1])>tt)return;n(h.id,sr,g.pointerId??0,$,T)};let C=null,N=!1,U=!1,D=[0,0];const F=(g,h)=>{C&&N&&(g===At?n(0,g):n(0,g,h[0],h[1],h[0]-D[0],h[1]-D[1])),C=null,N=!1,U=!1};function B(g){const h=i(g),$=t.contains(g.target)?o(g.target,Ie):null;if($!==C){if(F(Rt,h),C=$,$&&($.flags&Nr)!==0){D=h;const T=n($.id,_r,h[0],h[1]),O=typeof T=="number"?T:0;N=(O&Ot)!==0,U=(O&Ut)!==0}return}C&&N&&U&&n(0,kr,h[0],h[1],h[0]-D[0],h[1]-D[1])}const m=g=>{g.pointerType==="mouse"&&F(Rt,i(g))},S=g=>{const h=be(g instanceof Element?g:null);return h&&(h.type==="input"||h.type==="textarea")?h:null},M=g=>{const h=S(g.target);h&&(h.flags&Ar)!==0&&n(h.id,dr,h.el.value)},W=g=>{const h=S(g.target);h&&(h.flags&Cr)!==0&&n(h.id,pr)},I=g=>{const h=S(g.target);h&&(h.flags&$r)!==0&&n(h.id,hr)},z=g=>{if(g.key!=="Enter"||g.isComposing)return;const h=S(g.target);if(!h||h.type!=="input")return;g.preventDefault();const $=h.el;(h.flags&Or)!==0&&n(h.id,mr,$.value),e.value(h,"enterKey")!=="next"&&r.activeElement===$&&$.blur()},u=g=>{const h=s.getComputedStyle(g);return h.overflowX!=="hidden"&&h.overflowY==="hidden"},A=g=>{const h=be(g.target instanceof Element?g.target:null);!h||(h.flags&xr)===0||n(h.id,cr,u(h.el)?h.el.scrollLeft:h.el.scrollTop)},x=g=>{const h=be(g.target instanceof Element?g.target:null);h&&(h.flags&Rr)!==0&&n(h.id,ur)};return t.addEventListener("pointerdown",L),t.addEventListener("click",k),t.addEventListener("pointerleave",m),t.addEventListener("touchmove",E,{passive:!1}),t.addEventListener("input",M),t.addEventListener("focusin",W),t.addEventListener("focusout",I),t.addEventListener("keydown",z),t.addEventListener("scroll",A,!0),t.addEventListener("scrollend",x,!0),r.addEventListener("pointermove",_),r.addEventListener("pointerup",p),r.addEventListener("pointercancel",y),{isPressed(g){for(const h of l.values())if(h.node===g)return!0;return!1},isHovered:g=>C===g,forget(g){for(const h of[...l.values()])h.node===g&&(h.tracked&&n(0,_t,h.pointerId),b(h));C===g&&F(At,[0,0])},destroy(){for(const g of l.values())s.clearTimeout(g.timer);l.clear(),t.removeEventListener("pointerdown",L),t.removeEventListener("click",k),t.removeEventListener("pointerleave",m),t.removeEventListener("touchmove",E),t.removeEventListener("input",M),t.removeEventListener("focusin",W),t.removeEventListener("focusout",I),t.removeEventListener("keydown",z),t.removeEventListener("scroll",A,!0),t.removeEventListener("scrollend",x,!0),r.removeEventListener("pointermove",_),r.removeEventListener("pointerup",p),r.removeEventListener("pointercancel",y)}}},Xo=e=>`url("${e.replace(/["\\\n]/g,t=>"\\"+t)}")`,Jo=e=>{const t=_=>_.image??(_.image={src:"",srcTint:null,rect:null,form:"img",probe:0}),n=_=>_.src.startsWith("svg:")?_.src.slice(4):null,r=new Map,s=(_,p)=>{const y=r.get(p);y!=null&&y.delete(_)&&y.size===0&&r.delete(p)},i=_=>{const p=_.src,y=n(_);return y!==null?dn(y):p.startsWith("id:")?e.bufferUrl(Number(p.slice(3))):p.startsWith("canvas:")||p.startsWith("scene2d:")?"":p},o=(_,p)=>p.src.startsWith("canvas:")?"canvas":p.rect?"crop":n(p)!==null&&(p.srcTint!==null||e.hasTint(_))?"mask":"img",l=(_,p)=>{const y=_.el;if(y.tagName.toLowerCase()===p)return;const E=e.doc.createElement(p);if(E.className=y.className,p==="img"){const C=E;C.alt="",C.decoding="async",C.draggable=!1}const k=y.getAttribute("data-name");k!==null&&E.setAttribute("data-name",k),_.el=E,Tn(_),y.replaceWith(E),e.swapped(_,y)},f=_=>{for(const p of["--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"])_.style.removeProperty(p)},d=(_,p,y)=>{const[E,k,C,N]=p,[U,D]=y;_.style.setProperty("--lc-crop-size",`${U/C*100}% ${D/N*100}%`),_.style.setProperty("--lc-crop-pos",`${U===C?0:E/(U-C)*100}% ${D===N?0:k/(D-N)*100}%`)},v=new WeakMap,b=(_,p)=>{const y=_.el,E=e.drawable(p);if(!E){y.width=0,y.height=0;return}y.width!==E.pixelWidth&&(y.width=E.pixelWidth),y.height!==E.pixelHeight&&(y.height=E.pixelHeight);const k=y.getContext("2d");k&&(k.clearRect(0,0,y.width,y.height),y.width>0&&y.height>0&&k.drawImage(E.image,0,0),y.style.setProperty("--lc-iw",`${E.width}px`),E.height>0&&y.style.setProperty("--lc-ir",`${E.width} / ${E.height}`))},L=_=>{var F;const p=t(_),y=o(_,p);p.form=y,l(_,y==="img"?"img":y==="canvas"?"canvas":"div");const E=_.el;if(E.classList.toggle("lc-image-mask",y==="mask"),E.classList.toggle("lc-image-crop",y==="crop"),E.classList.toggle("lc-image-canvas",y==="canvas"),f(E),y==="canvas"){b(_,p.src);return}const k=i(p);if(y==="img"){const B=E;k===""?B.removeAttribute("src"):B.getAttribute("src")!==k&&(B.src=k);return}if(E.style.setProperty("--lc-src",k===""?"none":Xo(k)),y==="mask"){p.srcTint!==null&&E.style.setProperty("--lc-src-tint",Ce(p.srcTint));const B=(F=Hr(n(p)??""))==null?void 0:F.trim().split(/[\s,]+/).map(Number),m=B==null?void 0:B[2],S=B==null?void 0:B[3];m&&S&&(E.style.setProperty("--lc-iw",`${m}px`),E.style.setProperty("--lc-ir",`${m} / ${S}`));return}const C=p.rect;E.style.setProperty("--lc-iw",`${C[2]}px`),E.style.setProperty("--lc-ih",`${C[3]}px`);const N=v.get(_);if(N&&N.url===k){d(E,C,N.size);return}if(k==="")return;const U=++p.probe,D=new Image;D.addEventListener("load",()=>{if(p.probe!==U||!p.rect)return;const B=[D.naturalWidth,D.naturalHeight];v.set(_,{url:k,size:B}),d(_.el,p.rect,B)},{once:!0}),D.src=k};return{setSrc(_,p){const y=t(_);if(y.src.startsWith("canvas:")&&s(_,y.src),y.src=p??"",y.srcTint=null,y.src.startsWith("canvas:")){let E=r.get(y.src);E||r.set(y.src,E=new Set),E.add(_)}L(_)},setSrcTint(_,p){t(_).srcTint=p,L(_)},setSourceRect(_,p){const y=t(_),E=p==null?void 0:p.trim().split(/\s+/).map(Number),k=E&&E.length===4&&E.every(U=>Number.isFinite(U))&&E[2]>0&&E[3]>0?E:null,C=!!y.rect&&!!k&&y.form==="crop"&&y.rect[2]===k[2]&&y.rect[3]===k[3];y.rect=k;const N=v.get(_);if(C&&N){d(_.el,k,N.size);return}L(_)},sourceChanged(_){var p;for(const y of r.get(_)??[])((p=y.image)==null?void 0:p.form)==="canvas"&&b(y,_)},forget(_){var p;(p=_.image)!=null&&p.src.startsWith("canvas:")&&s(_,_.image.src)},restyle(_){const p=_.image;p&&o(_,p)!==p.form&&L(_)}}},Qo=.5,Zo=64,Kt=48,es=e=>{const{root:t,emit:n}=e,r=t.ownerDocument,s=r.defaultView??window,i=new Map;let o=null;const l=p=>{let y=i.get(p);if(!y||!y.isConnected){y=r.createElement("div"),y.className="lc-refresh",y.style.setProperty("--lc-refresh-color",s.getComputedStyle(p.el).getPropertyValue("--lc-refresh").trim()||"#8e8e93");const E=p.el.parentElement;E&&(E.appendChild(y),y.style.top=`${p.el.offsetTop-36}px`,y.style.left=`${p.el.offsetLeft+p.el.offsetWidth/2}px`),i.set(p,y)}return y},f=(p,y,E)=>{const k=l(p);k.classList.toggle("lc-settling",E),k.style.translate=`0 ${y}px`,k.style.transform=`rotate(${y*3}deg)`,k.style.opacity=String(Math.min(1,y/Kt))},d=p=>{const y=i.get(p);y&&(y.classList.remove("lc-spinning"),f(p,0,!0),s.setTimeout(()=>{i.get(p)===y&&(y.remove(),i.delete(p))},220))},v=p=>{for(let y=p instanceof Element?p:null;y&&y!==t;y=y.parentElement){const E=be(y);if(E&&(E.flags&(Xe|qe))!==0)return E}return null},b=p=>{if(o||p.touches.length!==1)return;const y=v(p.target);if(!y)return;const E=p.changedTouches[0];o={node:y,touch:E.identifier,startY:E.clientY,pulling:!1,distance:0}},L=p=>{if(!o)return;const y=[...p.changedTouches].find(k=>k.identifier===o.touch);if(!y)return;const E=y.clientY-o.startY;if(!o.pulling){if(o.node.el.scrollTop>0||E<=0){(E<0||o.node.el.scrollTop>0)&&(o.startY=y.clientY);return}o.pulling=!0}p.cancelable&&p.preventDefault(),o.distance=Math.max(0,E*Qo),(o.node.flags&qe)!==0&&n(o.node.id,kt,o.distance),(o.node.flags&Xe)!==0&&f(o.node,o.distance,!1)},_=p=>{if(!o||![...p.changedTouches].some(N=>N.identifier===o.touch))return;const{node:y,pulling:E,distance:k}=o;if(o=null,!E||((y.flags&qe)!==0&&n(y.id,kt,0),(y.flags&Xe)===0))return;if(k<Zo||p.type==="touchcancel"){d(y);return}f(y,Kt,!0),l(y).classList.add("lc-spinning");const C=n(y.id,fr);Promise.resolve(C).then(()=>d(y),()=>d(y))};return t.addEventListener("touchstart",b,{passive:!0}),t.addEventListener("touchmove",L,{passive:!1}),t.addEventListener("touchend",_),t.addEventListener("touchcancel",_),{forget(p){var y;(o==null?void 0:o.node)===p&&(o=null),(y=i.get(p))==null||y.remove(),i.delete(p)},destroy(){t.removeEventListener("touchstart",b),t.removeEventListener("touchmove",L),t.removeEventListener("touchend",_),t.removeEventListener("touchcancel",_);for(const p of i.values())p.remove();i.clear(),o=null}}},Yt=".lc-scrollable, .lc-vlist, .lc-pager-track, textarea.lc, input.lc",ze=new WeakMap,gt=e=>{if(!e.isConnected)return;const t=[],n=r=>{(r.scrollLeft!==0||r.scrollTop!==0)&&t.push({el:r,left:r.scrollLeft,top:r.scrollTop})};e.matches(Yt)&&n(e);for(const r of e.querySelectorAll(Yt))n(r);t.length>0?ze.set(e,t):ze.delete(e)},xn=e=>{const t=ze.get(e);if(t){ze.delete(e);for(const{el:n,left:r,top:s}of t)!n.isConnected||!e.contains(n)||(n.scrollLeft=r,n.scrollTop=s)}},ft=e=>{gt(e),e.remove()},Rn=(e,t,n=null)=>{t.parentElement===e&&(n===null||t.nextElementSibling===n)||(t.isConnected&&gt(t),e.insertBefore(t,n),xn(t))},Se=0,me=-1,An={run:(e,t,n,r)=>r(),settle:()=>{},enterOnTop:()=>!0,holds:()=>!1},ts={[Ir]:"a 3D scene",[Dr]:"a 2D scene",[Br]:"a native view",[Be]:"a video"},ns=e=>{const t=e.transitions??An;let n=null,r=[],s=[];const i=new Map,o=(m,S)=>`${m}:${S}`,l=new Set,f=m=>r.includes(m),d=m=>r.some(S=>S.node===m),v=m=>m&&m.kind===Z?m.node:null,b=(m,S)=>{e.emit(m.kind===Z||m.kind===Be?m.id:0,S,m.kind,m.id)},L=(m,S,M,W)=>{let I=null;return(m===Z||m===Be)&&(I=e.node(S)??null,!I||m===Z&&I.type!=="screen")?(e.warn(`navigation: ${S} is not a live ${m===Z?"screen":"video"} node`),null):{kind:m,id:S,node:I,viewName:M,paramsJson:W||"{}",back:Se,retired:!1}},_=(m,S)=>{var W;const M=v(m);if(!M){if((W=e.surface)!=null&&W.call(e,m,!0)){m.node&&e.rootOwned(m.node,!0);return}l.has(m.kind)||(l.add(m.kind),e.warn(`${ts[m.kind]??"this destination"} as a destination is not built yet (docs/plans/web-lite-plan.md) — nothing is shown for it`));return}e.rootOwned(M,!0),M.el.classList.remove("lc-covered"),M.el.classList.toggle("lc-above",S),Rn(e.root,M.el)},p=m=>{var M;const S=v(m);!S&&m!==n&&((M=e.surface)==null||M.call(e,m,!1)),!(!S||m===n)&&(n&&n.node===S||(S.el.classList.remove("lc-above"),d(S)?S.el.classList.add("lc-covered"):ft(S.el)))},y=m=>{const S=v(m);!S&&m.node&&!(n&&n.node===m.node)&&!d(m.node)&&(e.rootOwned(m.node,!1),m.node.parent===null&&e.emit(m.node.id,Tt)),S&&(n&&n.node===S||d(S)||(S.el.classList.remove("lc-above"),ft(S.el),e.rootOwned(S,!1),e.emit(S.id,Tt)))},E=()=>{const m=s;s=[];for(const S of m)S.node&&t.holds(S.node)?s.push(S):y(S)},k=m=>{!m||m.retired||(m.retired=!0,s.push(m),e.post(E))},C=(m,S,M)=>{const W=M===me?Se:M,I=v(m),z=v(S);I&&z&&z.el.classList.toggle("lc-above",!I.el.classList.contains("lc-above")),t.run(I,z,W,()=>{var u;I==null||I.el.classList.remove("lc-above"),z==null||z.el.classList.remove("lc-above"),S&&p(S),s.length>0&&e.post(E),(u=e.settled)==null||u.call(e)})},N=m=>{var S;m.kind===Z&&m.node&&((S=e.active)==null||S.call(e,m.node,!1)),b(m,yr)},U=(m,S)=>{var I,z;const M=n;if(!m||M===m)return;t.settle(),M&&N(M),n=m;const W=!!v(m)&&!!v(M);_(m,!!v(m)&&(!W||t.enterOnTop(S))),b(m,br),m.kind===Z&&m.node&&((I=e.active)==null||I.call(e,m.node,!0)),M&&!f(M)&&k(M),C(m,M,S),(z=e.changed)==null||z.call(e)},D=m=>{var M;t.settle();const S=n;S&&(N(S),n=null,f(S)||k(S),C(null,S,m),(M=e.changed)==null||M.call(e))},F=(m,S)=>{U(m,S),e.emit(0,Er,m.kind,m.id)},B=m=>{const S=r.length;return m===-1?S-2:m<-1?Math.max(S-1+m,0):m===0?0:Math.min(m,S-1)};return{current:()=>n,stack:()=>r,setUrl(m,S,M){var I;M===null||M===""?i.delete(o(m,S)):i.set(o(m,S),M.startsWith("/")?M:`/${M}`),(n&&n.kind===m&&n.id===S||r.some(z=>z.kind===m&&z.id===S))&&((I=e.changed)==null||I.call(e))},address(){if(n){const S=i.get(o(n.kind,n.id));if(S!==void 0)return S}const m=n?r.lastIndexOf(n):r.length-1;for(let S=m<0?r.length-1:m;S>=0;S--){const M=i.get(o(r[S].kind,r[S].id));if(M!==void 0)return M}return null},forgetUrl(m,S){i.delete(o(m,S))},open(m,S,M,W,I){U(L(m,S,M,W),I)},close(m,S,M){!n||n.kind!==m||n.id!==S||D(M)},routerOpen(m,S,M,W){const I=L(m,S,M,W);if(!I)return;const z=r;r=[I];for(const u of z)u!==n&&k(u);U(I,Se)},routerPush(m,S,M,W,I,z){const u=L(m,S,M,W);u&&(u.back=z===me?Se:z,r.push(u),F(u,I))},routerReplace(m,S,M,W,I,z){const u=L(m,S,M,W);if(!u)return;const A=r[r.length-1];if(!A){u.back=z===me?Se:z,r.push(u),F(u,I);return}u.back=z===me?A.back:z,r[r.length-1]=u,F(u,I),k(A)},routerPop(m,S){if(r.length<=1)return!1;const M=B(m);if(M<0||M>=r.length)return!1;const W=S===me?r[r.length-1].back:S,I=r.splice(M+1);F(r[r.length-1],W);for(const z of I)k(z);return I.length>0},routerHide(m){D(m)},routerRestore(m){const S=r[r.length-1];S&&U(S,m)},reset(){var m;t.settle();for(const S of[n,...r,...s])(m=S==null?void 0:S.node)==null||m.el.remove();n=null,r=[],s=[],i.clear()}}},rs=250,os="cubic-bezier(0.2, 0.8, 0.2, 1)",ss=6,is=e=>{const{root:t}=e,n=t.ownerDocument,r=n.defaultView??window,s=new Map,i=new Map,o=new Map,l=[],f=(u,A)=>`${u}:${A}`,d=u=>u.type==="layer",v=u=>{var x;const A=e.value(u.node,"overlayColor");if(A==null){(x=u.scrim)==null||x.remove(),u.scrim=null,u.frame.classList.remove("lc-scrimmed");return}u.scrim||(u.scrim=n.createElement("div"),u.scrim.className="lc-scrim",u.scrim.addEventListener("click",()=>{(u.node.flags&Ur)!==0&&e.emit(u.node.id,gr)}),u.frame.insertBefore(u.scrim,u.frame.firstChild),u.frame.classList.add("lc-scrimmed")),u.scrim.style.backgroundColor=Ce(A)},b=u=>{const A=e.value(u,"sheetDetents");if(A==null||A==="")return null;const x=String(A).split(",").map(Number).filter(g=>Number.isFinite(g)&&g>0).sort((g,h)=>g-h);return x.length>0?x:null},L=(u,A)=>{const x=u.sheet,g=u.node.el.offsetHeight;if(A<0)return g;const h=x.detents[x.detents.length-1],$=x.detents[Math.max(0,Math.min(A,x.detents.length-1))];return g*(1-$/h)},_=(u,A,x)=>{const g=u.sheet.holder;g.style.transition=x?`transform ${rs}ms ${os}`:"none",g.style.transform=`translateY(${Math.max(0,A)}px)`},p=(u,A)=>{const x=b(u.node);if(!x||!u.sheet)return;const g=u.sheet;g.detents=x;const h=e.value(u.node,"sheetDismissible");g.dismissible=h==null||Number(h)>.5||h===!0;const $=Number(e.value(u.node,"sheetDetent")??0);if(A){_(u,L(u,-1),!1),g.holder.offsetHeight,g.detent=$,_(u,L(u,$),!0);return}$!==g.detent&&(g.detent=$,_(u,L(u,$),!0))},y=u=>{const A=u.node.el;A.addEventListener("pointerdown",x=>{const g=u.sheet;if(!g||x.pointerType==="mouse"&&x.button!==0)return;for(let V=x.target instanceof Element?x.target:null;V&&V!==A;V=V.parentElement)if(V.scrollTop>0)return;const h=L(u,g.detent);let $=!1,T=h;const O=V=>{if(V.pointerId!==x.pointerId)return;const H=V.clientY-x.clientY;if(!$){if(Math.abs(H)<ss||Math.abs(H)<Math.abs(V.clientX-x.clientX))return;$=!0}T=Math.max(0,h+H),_(u,T,!1)},P=V=>{if(V.pointerId!==x.pointerId||(n.removeEventListener("pointermove",O),n.removeEventListener("pointerup",P),n.removeEventListener("pointercancel",P),!$||!u.sheet))return;let H=0,X=1/0;for(let ae=0;ae<g.detents.length;ae++){const J=Math.abs(L(u,ae)-T);J<X&&(X=J,H=ae)}const te=L(u,0),ie=A.offsetHeight;if(g.dismissible&&T>te+(ie-te)/2){_(u,ie,!0),(u.node.flags&$t)!==0&&e.emit(u.node.id,Lt,-1);return}g.detent=H,_(u,L(u,H),!0),(u.node.flags&$t)!==0&&e.emit(u.node.id,Lt,H)};n.addEventListener("pointermove",O),n.addEventListener("pointerup",P),n.addEventListener("pointercancel",P)})},E=u=>{let A=!0,x=0,g=u.parent;for(;g;){let h=g;for(;h.parent;)h=h.parent;const $=e.ownerOf(h);if($){e.pageShown(h)||(A=!1),x++,g=$;continue}const T=s.get(h);if(T){T.mountedIn||(A=!1),x++,g=T.parent;continue}const O=d(h)?l.includes(h):e.screenShown(h);return{outer:h,visible:A&&O,depth:x}}return{outer:null,visible:!1,depth:x}},k=u=>{const A=u.node.el;if(!A.isConnected)return e.value(u.node,"display")!=="none";const x=A.classList.contains("lc-leaving");x&&A.classList.remove("lc-leaving");const g=r.getComputedStyle(A).display!=="none";return x&&A.classList.add("lc-leaving"),g},C=u=>{const A=["lc-widget-frame",u.scrim?"lc-scrimmed":""].filter(Boolean),x=Array.from(u.parent.el.classList).filter(h=>!h.startsWith("lc"));u.frame.className=[...A,...x].join(" ");const g=u.parent.el.style;for(let h=0;h<g.length;h++){const $=g[h];$.startsWith("--")&&u.frame.style.setProperty($,g.getPropertyValue($))}for(const h of["data-theme-text","data-theme-font"])u.parent.el.hasAttribute(h)?u.frame.setAttribute(h,""):u.frame.removeAttribute(h)},N=u=>u.stage??(u.stage=e.stage()),U=u=>{u.leaving&&(u.leaving=!1,u.node.el.classList.remove("lc-leaving"))},D=u=>{u.pose&&N(u).run(u.node,null,u.pose,()=>{})},F=u=>{if(!u.pose){m(u,!1);return}u.leaving=!0,u.node.el.classList.add("lc-leaving"),N(u).run(null,u.node,u.pose,()=>{U(u),m(u,!1),M()})},B=u=>{u.mountedIn&&(m(u,!1),gt(u.node.el),u.frame.remove(),u.mountedIn=null)},m=(u,A)=>{u.onShow!==A&&(u.onShow=A,e.rootActive(u.node,A))};let S=!1;const M=()=>{if(S)return;S=!0,e.flush();const u=new Map;for(const x of s.values())u.set(x,E(x));const A=new Map;for(const[x,g]of u){if(!g.visible||!g.outer){x.leaving&&(N(x).settle(),U(x)),m(x,!1),B(x);continue}const h=A.get(g.outer)??[];h.push(x),A.set(g.outer,h)}for(const[x,g]of A){g.sort(($,T)=>u.get($).depth-u.get(T).depth);let h=null;for(const $ of g)C($),$.mountedIn!==x?($.mountedIn&&B($),x.el.appendChild($.frame),$.mountedIn=x,e.rootOwned($.node,!0),xn($.node.el),$.sheet&&p($,!0)):h&&$.frame.previousElementSibling!==h&&x.el.appendChild($.frame),h=$.frame}for(const[x,g]of u){if(!x.mountedIn){x.intent===-1&&(x.intent=e.value(x.node,"display")!=="none"?1:0);continue}const h=k(x),$=x.intent!==-1&&(h?1:0)!==x.intent;if(x.intent===-1?(x.intent=h?1:0,h!==(e.value(x.node,"display")!=="none")&&e.emitLater(x.node.id,Ct,h?1:0)):(h?1:0)!==x.intent&&(x.intent=h?1:0,e.emitLater(x.node.id,Ct,h?1:0)),h)if(x.leaving)N(x).settle(),U(x),m(x,!0),$&&D(x);else{const T=x.onShow;m(x,!0),$&&!T&&D(x)}else x.leaving||($&&x.onShow?F(x):m(x,!1))}S=!1};return{attach(u,A,x){if(A.type!=="screen"&&!d(A))return console.error(`[web-lite] a widget can only be a child of a screen or a layer (it belongs to the window, not to a box: a floating element of a ${A.type} is an absolute child, not a widget)`),!1;if(s.has(u))return!1;const g=n.createElement("div");g.className="lc-widget-frame";const h={node:u,parent:A,frame:g,scrim:null,sheet:null,mountedIn:null,intent:-1,pose:nt.get(u)??0,stage:null,leaving:!1,onShow:!1};if(b(u)){const T=n.createElement("div");T.className="lc-sheet",T.appendChild(u.el),g.appendChild(T),h.sheet={holder:T,detents:[1],detent:-1,dismissible:!0},y(h)}else g.appendChild(u.el);s.set(u,h);const $=i.get(A)??[];return $.splice(Math.max(0,Math.min(x,$.length)),0,u),i.set(A,$),u.parent=A,v(h),M(),!0},detach(u){const A=s.get(u);if(!A)return!1;N(A).settle(),U(A),B(A),s.delete(u);const x=i.get(A.parent);if(x){const g=x.indexOf(u);g>=0&&x.splice(g,1),x.length===0&&i.delete(A.parent)}return u.parent=null,u.el.remove(),A.frame.remove(),e.rootOwned(u,!1),!0},childrenOf:u=>i.get(u)??[],isWidget:u=>s.has(u),setPose(u,A){const x=s.get(u);x?x.pose=A:nt.set(u,A)},setLayer(u,A,x){const g=f(u,A),h=o.get(g)??null;h!==x&&(h&&W(h),x?(o.set(g,x),x.el.classList.add("lc-layer")):o.delete(g),z())},refresh(){z(),M()},scrim:u=>{var A;return((A=s.get(u))==null?void 0:A.scrim)??null},restyle(u){const A=s.get(u);A&&(v(A),C(A),A.sheet&&p(A,!1),M(),queueMicrotask(M))},forget(u){const A=s.get(u);if(A){N(A).settle(),U(A),B(A),s.delete(u);const g=i.get(A.parent);if(g){const h=g.indexOf(u);h>=0&&g.splice(h,1)}A.frame.remove()}const x=i.get(u);if(x){for(const g of x.slice())this.forget(g);i.delete(u)}for(const[g,h]of o)h===u&&(W(h),o.delete(g));nt.delete(u)},shown:()=>Array.from(s.values()).filter(u=>u.onShow).map(u=>u.node),isShown:u=>{var A;return!!((A=s.get(u))!=null&&A.onShow)},backTargets(){const u=[],A=x=>{if(!x)return;const g=Array.from(x.el.children).filter(h=>h.classList.contains("lc-widget-frame"));for(let h=g.length-1;h>=0;h--){const $=Array.from(s.values()).find(T=>T.frame===g[h]);$&&$.onShow&&!$.leaving&&($.node.flags&Mr)!==0&&u.push($.node)}};return A(o.get(f(ye,0))??null),A(e.currentRoot()),u},layers:()=>l.slice(),layerOf:(u,A)=>o.get(f(u,A))??null,isFrame:u=>u.classList.contains("lc-widget-frame"),toast(u,A){(!ne||!ne.isConnected)&&(ne=n.createElement("div"),ne.className="lc-toasts",t.appendChild(ne));const x=n.createElement("div");x.className="lc-toast",x.setAttribute("role","status"),x.textContent=u,ne.appendChild(x),x.offsetHeight,x.classList.add("lc-on"),r.setTimeout(()=>{x.classList.remove("lc-on"),r.setTimeout(()=>x.remove(),200)},Math.max(500,A))},destroy(){for(const u of s.values())u.frame.remove();s.clear(),i.clear();for(const u of l)u.el.remove();l.length=0,o.clear(),ne==null||ne.remove(),ne=null}};function W(u){const A=l.indexOf(u);A<0||(l.splice(A,1),e.rootActive(u,!1),u.el.remove(),e.rootOwned(u,!1))}function I(u){l.includes(u)||(l.push(u),t.appendChild(u.el),e.rootOwned(u,!0),e.rootActive(u,!0))}function z(){const u=e.current();for(const[x,g]of o)x===f(ye,0)||!!u&&x===f(u.kind,u.id)?I(g):W(g);const A=o.get(f(ye,0));A&&A.el.parentElement===t&&t.lastElementChild!==A.el&&t.appendChild(A.el)}};let ne=null;const nt=new WeakMap,qt={pager:["pagerSetContent","pagerSelect","pagerPush","pagerPop","pagerPopToRoot","pagerReplace"],vlist:["vlistInit","vlistSetKeys","vlistInsertKeys","vlistRemoveKeys","vlistInvalidate","vlistMount","vlistScrollTo","vlistScrollToKey","vlistScrollToEnd"],plugins:["viewCall"],tween:["tweenCreate","tweenControl","tweenSeek","tweenSetRate","tweenGetTime","tweenGetElapsed","registerTweenEvent","defineTransition"]},as=e=>{const t=e.root,n=t.ownerDocument,r=(a,c,w)=>{for(const R of Object.keys(c)){const G=c[R],j=G==null?null:typeof G=="number"?se(G):Ae(G);for(const ue of w?[`--${R}`,`--lc-app-${R}`]:[`--${R}`])j===null?a.style.removeProperty(ue):a.style.setProperty(ue,j)}},s=n.defaultView??window,i=new Set,o=a=>console.warn(`[web-lite] ${a}`),l=[],f=a=>{var c;for(const w of l){const R=(c=w.ownerOf)==null?void 0:c.call(w,a);if(R)return R}return null},d=a=>{var c;for(const w of l){const R=(c=w.roots)==null?void 0:c.call(w,a);if(R)return R}return null},v=(a,c)=>{var w;for(const R of l)(w=R.rootActive)==null||w.call(R,a,c)},b=a=>{var c;for(const w of l)(c=w.subtreeMoved)==null||c.call(w,a)},L=()=>{for(const a of l)if(a.stage)return a.stage();return An};let _=null;const p=()=>_??(_=e.transitions??L()),y={run:(a,c,w,R)=>p().run(a,c,w,R),settle:()=>p().settle(),enterOnTop:a=>p().enterOnTop(a),holds:a=>p().holds(a)};let E=[],k=!1;const C=a=>{E.push(a),!k&&(k=!0,queueMicrotask(()=>{k=!1;const c=E;E=[];for(const w of c)w()}))};let N=null;const U=(a,c,...w)=>{if(N)try{return N(a,c,...w)}catch(R){s.setTimeout(()=>{throw R},0);return}},D=(a,c,...w)=>C(()=>{U(a,c,...w)});t.classList.add("lc-root");const F=e.sink??$o(n),B=Fo(F),m=Do(F,B,{bufferUrl:e.bufferUrl},o),S=new Map;let M=1;const W=new ResizeObserver(a=>{for(const c of a){const w=c.target,R=S.get(Number(w.getAttribute("data-node")));!R||R.el!==w||!(R.flags&pe)||U(R.id,rr,w.offsetLeft,w.offsetTop,w.offsetWidth,w.offsetHeight)}}),I=Jo({doc:n,bufferUrl:e.bufferUrl,drawable:a=>{var c;for(const w of l){const R=(c=w.drawable)==null?void 0:c.call(w,a);if(R)return R}return null},hasTint:a=>m.names(a,"tintColor"),swapped:(a,c)=>{W.unobserve(c),a.flags&pe&&W.observe(a.el)},warn:o});m.onChange=a=>{const c=a;Vr(c,w=>m.value(c,w)),c.type==="image"&&I.restyle(c),c.type==="widget"?P.restyle(c):(c.type==="screen"||c.type==="layer")&&P.refresh()};const z=qo({root:t,emit:U,value:(a,c)=>m.value(a,c),boundary:a=>P.isFrame(a)||l.some(c=>{var w;return((w=c.boundary)==null?void 0:w.call(c,a))===!0}),hit:(a,c,w)=>{var R;for(const G of l){const j=(R=G.hit)==null?void 0:R.call(G,a,c,w);if(j!=null)return j}return null}}),u=es({root:t,emit:U}),A=new ResizeObserver(()=>{U(0,vr,t.clientWidth,t.clientHeight)});A.observe(t),m.onWrite=(a,c)=>{var w;for(const R of l)(w=R.styled)==null||w.call(R,a,c)};const x=a=>a.parent===null&&!a.rooted,g=(a,c,w=!0)=>{var R;for(const G of l)(R=G.forget)==null||R.call(G,a);for(const G of ke(a))g(G,c,!1);w||c.push(a.id),z.forget(a),u.forget(a),I.forget(a),O.forgetUrl(Z,a.id),P.forget(a),m.drop(a),W.unobserve(a.el),$.unregister(a.token),S.delete(a.id),a.parent=null,a.held=!1,w&&a.el.remove()},h=a=>{if(!S.has(a.id)||a.held||!x(a))return;const c=[];g(a,c),c.length>0&&U(0,xt,c)},$=new FinalizationRegistry(a=>{const c=S.get(a);c&&(c.held=!1,x(c)&&C(()=>h(c)))}),T=a=>{a.held||C(()=>h(a))},O=ns({root:t,emit:D,post:C,warn:o,node:a=>S.get(a),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},changed:e.onNavigation,settled:()=>{P.refresh()},active:v,surface:(a,c)=>l.some(w=>{var R;return((R=w.destination)==null?void 0:R.call(w,a,c))===!0}),transitions:y}),P=is({root:t,emit:U,emitLater:D,node:a=>S.get(a),value:(a,c)=>m.value(a,c),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},rootActive:v,flush:()=>m.flush(),ownerOf:f,pageShown:a=>{var c;for(const w of l){const R=(c=w.pageShown)==null?void 0:c.call(w,a);if(R!=null)return R}return!1},screenShown:a=>{var c;return((c=O.current())==null?void 0:c.node)===a||y.holds(a)},currentRoot:()=>{const a=O.current();return a?a.kind===Z?a.node??null:P.layerOf(a.kind,a.id):null},current:()=>{const a=O.current();return a?{kind:a.kind,id:a.id}:null},stage:L}),V=e.onNavigation;e.onNavigation=()=>{P.refresh(),V==null||V()};const H=()=>{var c;for(const w of P.backTargets())if(U(w.id,Ue,ye,0)===!0)return"widget";const a=O.current();if(a){const w=a.kind===Z||a.kind===Be?a.id:0;if(U(w,Ue,a.kind,a.id)===!0)return"destination"}for(const w of l)if(((c=w.back)==null?void 0:c.call(w))===!0)return"feature";return O.routerPop(-1,me)?"router":U(0,Ue,ye,0)===!0?"app":"none"},X=a=>{if(!(a.key!=="Escape"||a.defaultPrevented)){for(const c of P.backTargets())if(U(c.id,Ue,ye,0)===!0){a.preventDefault();return}}};n.addEventListener("keydown",X);const te=Ko({root:t,roots:()=>{const a=O.current();return[...a!=null&&a.node&&a.kind===Z?[{kind:"screen",node:a.node}]:[],...P.layers().map(w=>({kind:"layer",node:w})),...P.shown().map(w=>({kind:"widget",node:w}))]},held:a=>d(a),extend:(a,c,w)=>{var R;for(const G of l)(R=G.dump)==null||R.call(G,a,c,w)},value:(a,c)=>m.value(a,c),owns:(a,c)=>m.owns(a,c),flush:()=>m.flush()}),ie=a=>{if(!a.isConnected)return null;m.flush();const c=fn(t)||1,w=t.getBoundingClientRect(),R=a.getBoundingClientRect();return R.width===0&&R.height===0&&a.offsetParent===null?null:[(R.left-w.left)/c,(R.top-w.top)/c,R.width/c,R.height/c]},Oe=()=>{const a={};for(const c of Object.keys(qt))for(const w of qt[c])a[w]=()=>(i.has(w)||(i.add(w),o(`${w}: this tree was made without the "${c}" feature`)),w==="tweenCreate"?null:0);return a},ae={create(a){const c=Wo(n,M++,a);Tn(c),S.set(c.id,c);const w={id:c.id};return $.register(w,c.id,c.token),w},destroy(a){const c=S.get(a);if(!c)return;if(!x(c)){console.error(`[web-lite] destroy: node ${a} is attached — remove / hide / close it first`);return}c.held=!1;const w=[];g(c,w),w.length>0&&U(0,xt,w)},insert(a,c,w){var vt;const R=S.get(a),G=S.get(c);if(!R||!G||G===R)return;if(d(R)){o(`insert() on a ${R.type} — what it holds goes through its own calls`);return}if(!x(G)){o(`insert: node ${c} is not a root — remove it from where it is first`);return}if(G.type==="widget"){const Et=ke(R).length;P.attach(G,R,w<Et?0:w-Et);return}const j=ke(R),ue=Math.max(0,Math.min(w,j.length));G.parent=R,Rn(R.el,G.el,((vt=j[ue])==null?void 0:vt.el)??null),b(G)},remove(a,c){const w=S.get(a),R=S.get(c);if(!(!w||!R||R.parent!==w)){if(P.isWidget(R)){P.detach(R);return}R.parent=null,ft(R.el),b(R),T(R)}},parent(a){var w,R;const c=S.get(a);return c?((w=c.parent)==null?void 0:w.id)??((R=f(c))==null?void 0:R.id)??0:0},children(a){const c=S.get(a);return c?[...d(c)??ke(c),...P.childrenOf(c)].map(w=>w.id):[]},setString(a,c,w){var G;const R=S.get(a);if(R){w===null?R.strings.delete(c):R.strings.set(c,w);for(const j of l)(G=j.content)==null||G.call(j,R,c,w);switch(c){case"text":R.type==="text"&&(R.el.textContent=w??"");return;case"name":w===null?R.el.removeAttribute("data-name"):R.el.setAttribute("data-name",w);return;case"src":R.type==="image"&&I.setSrc(R,w);return;case"srcTintColor":R.type==="image"&&I.setSrcTint(R,w);return;case"sourceRect":R.type==="image"&&I.setSourceRect(R,w);return;case"value":if(R.type==="input"||R.type==="textarea"){const j=R.el;j.value!==(w??"")&&(j.value=w??"")}return;case"focus":w==="1"?R.el.focus({preventScroll:!0}):R.el.blur();return}}},setInt(a,c,w){var G;const R=S.get(a);if(R){R.strings.set(c,String(w));for(const j of l)(G=j.content)==null||G.call(j,R,c,w)}},setFlags(a,c){const w=S.get(a);if(!w)return;const R=w.flags;w.flags=c,w.el.classList.toggle(ut,(c&Ie)!==0),c&pe&&!(R&pe)?W.observe(w.el):!(c&pe)&&R&pe&&W.unobserve(w.el)},getTextValue(a){const c=S.get(a);return c&&(c.type==="input"||c.type==="textarea")?c.el.value:""},setStyle(a,c,w){const R=S.get(a);R&&m.set(R,c,w)},mergeStyle(a,c){const w=S.get(a);w&&m.merge(w,c)},setClass(a,c,w){const R=S.get(a);R&&(m.setClass(R,c,w),P.refresh())},setTheme(a){r(t,a,!0)},setNodeTheme(a,c){const w=S.get(a);w&&(r(w.el,c,!1),"text"in c&&w.el.toggleAttribute("data-theme-text",c.text!=null),"fontFamily"in c&&w.el.toggleAttribute("data-theme-font",c.fontFamily!=null),P.refresh())},open:O.open,close:O.close,routerOpen:(a,c,w,R)=>O.routerOpen(a,c,w,R),routerPush:O.routerPush,routerReplace:O.routerReplace,routerPop:(a,c)=>{O.routerPop(a,c)},routerHide:O.routerHide,routerRestore:O.routerRestore,setDestUrl:O.setUrl,isViewSupported:()=>!1,viewVersion:()=>0,setLayer(a,c,w){const R=w?S.get(w)??null:null;if(w&&(!R||R.type!=="layer")){o("setLayer: not a layer node");return}P.setLayer(a,c,R)},setWidgetPose(a,c){const w=S.get(a);w&&P.setPose(w,c>0?c:0)},registerFont(a,c,w,R,G,j){try{const ue=new s.FontFace(a,`url("${c}")`,{weight:String(w),style:R===2?"italic":"normal"});n.fonts.add(ue),ue.load().then(()=>G(),()=>j())}catch{j()}},fontFormat:"woff2",toast:(a,c)=>P.toast(a,c),isButtonPressed(a){const c=S.get(a);return!!c&&z.isPressed(c)},isHovered(a){const c=S.get(a);return!!c&&z.isHovered(c)},getBoundingClientRect(a){const c=S.get(a);return c?ie(c.el):null},getDisplaySize:()=>[t.clientWidth,t.clientHeight],debugDump:()=>te.dump(),debugPaint:a=>te.paint(S.get(a)),setEmitter(a){N=a}},J={...Oe(),...ae};for(const a of["open","close","routerOpen","routerPush","routerReplace","routerPop","routerHide","routerRestore"]){const c=J[a];J[a]=(...w)=>{const R=c(...w);return C(()=>P.refresh()),R}}const q={root:t,emit:U,emitLater:D,post:C,warn:o,node:a=>S.get(a),rootOwned:(a,c)=>{a.rooted=c,c||T(a)},flush:()=>m.flush(),value:(a,c)=>m.value(a,c),setStyle:(a,c,w)=>m.set(a,c,w),setString:(a,c,w)=>J.setString(a,c,w),style:{bufferUrl:e.bufferUrl},shown:a=>{var c;return((c=O.current())==null?void 0:c.node)===a||P.isShown(a)||P.layers().includes(a)},scrim:a=>P.scrim(a),stage:L,sourceChanged:a=>I.sourceChanged(a),plugins:e.plugins??null,rootsChanged:()=>C(()=>P.refresh()),rootHolds:a=>y.holds(a)},de={};for(const a of e.features??[]){const c=a.install(q);l.push(c),Object.assign(J,c.bridge),Object.assign(de,c.globals)}return{bridge:J,globals:de,presentation:O,back:H,setSafeArea(a,c=[]){for(const w of["top","right","bottom","left"])t.style.setProperty(`--safe-${w}`,`${a[w]}px`),c.includes(w)?t.style.setProperty(`--safe-${w}-bar`,`${a[w]}px`):t.style.removeProperty(`--safe-${w}-bar`)},flush:()=>m.flush(),stats:()=>Object.assign({nodes:S.size,classes:B.count(),tweens:0},...l.map(a=>{var c;return((c=a.stats)==null?void 0:c.call(a))??{}})),destroy(){var a;N=null,O.reset();for(const c of l)(a=c.destroy)==null||a.call(c);P.destroy(),n.removeEventListener("keydown",X),z.destroy(),u.destroy(),A.disconnect(),W.disconnect();for(const c of S.values())$.unregister(c.token),c.el.remove();S.clear(),e.sink||F.destroy(),t.classList.remove("lc-root");for(const c of Array.from(t.style))c.startsWith("--")&&t.style.removeProperty(c)}}},Cn=()=>({setMatrix(){},setVisible(){},setCameraMatrix(){},setProjection(){},clearProjection(){},setBackground(){},createExternalTexture:()=>null,onFrame:()=>()=>{},readPixels:(e,t)=>t(null,0,0),viewport:()=>({width:0,height:0,rotation:0})}),ls=e=>{var r,s;const t=((s=(r=e.screen)==null?void 0:r.orientation)==null?void 0:s.angle)??e.orientation??0;return(Math.round(t/90)%4+4)%4*90},cs=(e,t)=>({width:(e==null?void 0:e.clientWidth)??0,height:(e==null?void 0:e.clientHeight)??0,rotation:ls(t)}),K=[null],bt=new TextDecoder("utf-8"),_i=async(e,t,n,r)=>{var _;let s;if(t.body)if(typeof t.body=="object"&&Array.isArray(t.body._entries)){const p=new FormData;for(let[y,E,k]of t.body._entries)typeof E=="object"?p.append(y,new Blob([ce(E._id)]),k):p.append(y,E);s=p}else typeof t.body=="string"?s=t.body:r(new Error("Invalid body"));const i=await fetch(e,{method:t.method,body:s,headers:t.headers,mode:"cors",credentials:"omit"}),o=typeof t.onProgress=="function"?t.onProgress:null;if(!o){const p=await i.arrayBuffer();K.push(p),n(K.length-1,i.status);return}const l=(_=i.body)==null?void 0:_.getReader();if(!l){const p=await i.arrayBuffer();K.push(p),n(K.length-1,i.status);return}const f=Number(i.headers.get("content-length"))||void 0;let d=0;const v=[];for(;;){const{done:p,value:y}=await l.read();if(p)break;y&&(v.push(y),d+=y.length,o({loaded:d,total:f}))}const b=new Uint8Array(d);let L=0;for(const p of v)b.set(p,L),L+=p.length;K.push(b.buffer),n(K.length-1,i.status)},us=e=>JSON.parse(bt.decode(ce(e))),$n=e=>bt.decode(ce(e)),fs=e=>new Uint8Array(ce(e)).slice(),ds=(e,t,n)=>bt.decode(ce(e).slice(t,n)),On=e=>{const t=new Blob([K[e]]);return URL.createObjectURL(t)},Un=e=>new Blob([K[e]]),ce=e=>K[e],Xt=e=>{K[e]=null},Ge=e=>(K.push(e),K.length-1),yt=new Map,ki=(e,t)=>{yt.set(e,t);const n=je.get(e);n!==void 0&&(K[n]=t)},Li=e=>yt.has(e),je=new Map,Ti=e=>{for(const[t,n]of je)if(n===e)return t},ps=e=>{const t=je.get(e);if(t!==void 0)return t;const n=yt.get(e);if(!n)return-1;K.push(n);const r=K.length-1;return je.set(e,r),r},hs=(e=Cn())=>{const t=new Map,n=new Map,r=new Set;let s=!1;const i={registerView(o,l,f=1){t.set(o,{factory:l,version:f})},registerService(o,l,f=1){n.set(o,{factory:l,version:f})},putBuffer:Ge,getBuffer:ce,get gl(){return s=!0,e}};return{views:t,services:n,drives3d:()=>s,has:o=>r.has(o),register(o,l){if(!r.has(o)){r.add(o);try{l(i)}catch(f){console.warn(`[web-lite] the "${o}" plugin did not register: ${f instanceof Error?f.message:f}`)}}}}},Jt={pager:["pagerSetContent"],vlist:["vlistInit"],tween:["tweenCreate","defineTransition"],canvas:["_creatorCanvas."],video:["createVideo"],plugins:["viewCall","isViewSupported","_creatorService."]},ms={pager:()=>fe(()=>import("./assets/pager-DpGa2uaE.js"),[],import.meta.url).then(e=>e.pager),vlist:()=>fe(()=>import("./assets/vlist-CwSYpLz-.js"),[],import.meta.url).then(e=>e.vlist),tween:()=>fe(()=>import("./assets/tween-BnWYhJ7P.js"),[],import.meta.url).then(e=>e.tween),canvas:()=>fe(()=>import("./assets/canvas-WxiusXCB.js"),[],import.meta.url).then(e=>e.canvas),video:()=>fe(()=>import("./assets/video-BLj61nDx.js"),[],import.meta.url).then(e=>e.video),plugins:()=>fe(()=>import("./assets/plugins-CuEPHbHL.js"),[],import.meta.url).then(e=>e.plugins)},Mn=Object.keys(Jt).map(e=>({name:e,uses:Jt[e],load:ms[e]})),gs=e=>Mn.filter(t=>t.uses.some(n=>e.includes(n))).map(t=>t.name),bs=async e=>{const t=gs(e);return(await Promise.all(Mn.filter(r=>t.includes(r.name)).map(r=>r.load().catch(s=>(console.warn(`[web-lite] the "${r.name}" feature did not load: ${s instanceof Error?s.message:s}`),null))))).filter(r=>r!==null)},ys=e=>{let t=null,n=null;const r=(f,d)=>{t==null||t(f,d)},s=()=>r(document.hidden?"pause":"resume"),i=()=>r("online"),o=()=>r("offline");return document.addEventListener("visibilitychange",s),window.addEventListener("online",i),window.addEventListener("offline",o),{bridge:{run(f,d,v,b){let L;try{L=$n(f)}catch{d("run: no such buffer");return}e.rerun(L,b,d)},restart(f){e.rerun(void 0,f)},quit(){},launchUrl:()=>e.launchUrl(),registerEvent(f){t=f},setFreedEmitter(f){n=f},ownedStats:()=>e.stats(),state:()=>document.hidden?"background":"active",isOnline:()=>navigator.onLine,openUrl(f){window.open(f,"_blank","noopener")},setOrientation(f){var b,L,_,p;const d=f==="landscape"||f==="portrait"?f:"auto";if(e.onOrientation){e.onOrientation(d);return}const v=typeof screen<"u"?screen.orientation:void 0;if(v)try{d==="auto"?(b=v.unlock)==null||b.call(v):(p=(_=(L=v.lock)==null?void 0:L.call(v,d))==null?void 0:_.catch)==null||p.call(_,()=>{})}catch{}}},emit:r,freed:(f,d)=>{n==null||n(f,d)},dispose(){t=null,n=null,document.removeEventListener("visibilitychange",s),window.removeEventListener("online",i),window.removeEventListener("offline",o)}}},vs=(e,t,n,r)=>{try{const s=document.createElement("input");s.type="file",s.multiple=n,r&&(s.accept=r),s.onchange=async()=>{const{files:i}=s;if(n){const o=[];if(!i)return e([]);for(let l of i)o.push([Ge(await l.arrayBuffer()),l.name,l.size]);e(o)}else{if(!i||i.length===0)return e(null);e([[Ge(await i[0].arrayBuffer()),i[0].name,i[0].size]])}},window.addEventListener("focus",()=>{setTimeout(()=>{(!s.files||s.files.length===0)&&e(n?[]:null)},300)},{once:!0}),s.click()}catch(s){t(s)}},Nn=e=>e==="camera"?"camera":e==="microphone"||e==="speech"?"microphone":e==="location"?"geolocation":null,Fn=(e,t,n)=>{const r=Nn(e);if(!r){n(`${e}: not a permission this host asks for`);return}const s=navigator.permissions;if(!(s!=null&&s.query)){t("prompt");return}s.query({name:r}).then(i=>t(i.state),()=>t("prompt"))},Es=(e,t,n)=>{if(!Nn(e)){n(`${e}: not a permission this host asks for`);return}const r=()=>Fn(e,t,n);if(e==="location"){if(!navigator.geolocation){t("denied");return}navigator.geolocation.getCurrentPosition(()=>t("granted"),i=>i.code===i.PERMISSION_DENIED?t("denied"):r(),{timeout:15e3,maximumAge:1/0});return}const s=navigator.mediaDevices;if(!(s!=null&&s.getUserMedia)){t("denied");return}s.getUserMedia(e==="camera"?{video:!0}:{audio:!0}).then(i=>{for(const o of i.getTracks())o.stop();t("granted")},i=>{const o=i instanceof Error?i.name:"";o==="NotAllowedError"||o==="SecurityError"?t("denied"):r()})},ws=e=>({get platform(){return"web"},get language(){return e()},get pixelRatio(){return window.devicePixelRatio||1},vibrate(){var t;try{(t=navigator.vibrate)==null||t.call(navigator,30)}catch{}},clipboardWrite(t){var n;(n=navigator.clipboard)==null||n.writeText(t).catch(()=>{})},clipboardRead(t,n){const r=navigator.clipboard;if(!(r!=null&&r.readText)){n("Clipboard is not available");return}r.readText().then(t,s=>n(s instanceof Error?s.message:"Clipboard read failed"))},share(t,n){var l;const r=Un(t),s=new File([r],"image.png",{type:"image/png"});if((l=navigator.canShare)!=null&&l.call(navigator,{files:[s]})){navigator.share({files:[s],text:n}).catch(()=>{});return}const i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=s.name,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i)},openFilePicker:(t,n,r,s)=>vs(t,n,r,s??void 0),queryPermission:Fn,requestPermission:Es}),Ss=e=>{const t=e==null?void 0:e._h;return typeof e=="object"&&e!==null&&typeof(t==null?void 0:t.id)=="number"?t.id:null},_s=e=>{if(e==null)return;if(typeof e=="string")return e;const t=e._entries;if(!Array.isArray(t))throw new Error("fetch: the body is a string or a FormData");const n=new FormData;for(const[r,s,i]of t){const o=Ss(s);o!==null?n.append(r,Un(o),i):n.append(r,String(s))}return n},ks=()=>{const e=new Set,t=new FinalizationRegistry(i=>{e.delete(i)&&Xt(i)}),n=i=>{const o={id:i};return e.add(i),t.register(o,i),o};let r=!1;return{bridge:{fetch(i,o,l,f,d){const v=typeof(o==null?void 0:o.onProgress)=="function"?o.onProgress:d;if(i.startsWith("id:")){const b=Number(i.slice(3));l({id:b},ce(b)?200:404);return}(async()=>{var b;try{const L=await fetch(i,{method:o==null?void 0:o.method,headers:o==null?void 0:o.headers,body:_s(o==null?void 0:o.body),mode:"cors",credentials:"omit"}),_=v?(b=L.body)==null?void 0:b.getReader():void 0;let p;if(!_)p=await L.arrayBuffer();else{const y=Number(L.headers.get("content-length"))||void 0,E=[];let k=0;for(;;){const{done:U,value:D}=await _.read();if(U)break;D&&(E.push(D),k+=D.length,r||v({loaded:k,total:y}))}const C=new Uint8Array(k);let N=0;for(const U of E)C.set(U,N),N+=U.length;p=C.buffer}if(r)return;l(n(Ge(p)),L.status)}catch(L){r||f(L instanceof Error?L:String(L))}})()},local:i=>ps(i),toJson:i=>us(i),slice:(i,o,l)=>ds(i,o,l),toText:i=>$n(i),toBytes:i=>fs(i)},live:()=>e.size,dispose(){r=!0;for(const i of e)Xt(i);e.clear()}}},Qt=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],rt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],Pe=4,ot=16,Zt=16,Ls=.5,Ts=e=>{const t=new Set;let n=null;const r=(T,O,P=-1,V=0)=>{n==null||n(T,O,P,V)},s=T=>{if(!T.code)return;const O=t.has(T.code);t.add(T.code),r(0,T.code,-1,O||T.repeat?1:0)},i=T=>{T.code&&t.delete(T.code)&&r(1,T.code)},o=()=>{for(const T of[...t])T.startsWith("Gamepad")||(t.delete(T),r(1,T))},{root:l}=e;let f=0,d=0,v=0,b=0,L=0,_=0,p=0,y=0,E=0,k=0;const C=T=>{if(T.pointerType&&T.pointerType!=="mouse")return;const O=l.getBoundingClientRect();f=T.clientX-O.left,d=T.clientY-O.top,v+=T.movementX||0,b+=T.movementY||0},N=T=>{const O=Qt[T.button];O&&(t.add(O),r(0,O))},U=T=>{const O=Qt[T.button];O&&t.delete(O)&&r(1,O)},D=T=>{const O=T.deltaMode===0?.01:1;L+=T.deltaX*O,_+=T.deltaY*O},F=T=>{document.pointerLockElement===l&&T.preventDefault()},B=[],m=[],S=[],M=()=>{var O,P;const T=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let V=0;V<Pe;V++){const H=T[V]??null,X=!!H&&H.connected;if(X!==!!B[V]){if(B[V]=X,!X){for(const q of rt)t.delete(q+"@"+V)&&(r(1,q,V),W(q));S[V]=[],m[V]=[0,0,0,0,0,0]}r(X?2:3,"",V)}if(!H||!X)continue;const te=H.axes,ie=H.buttons,Oe=((O=ie[6])==null?void 0:O.value)??0,ae=((P=ie[7])==null?void 0:P.value)??0;m[V]=[te[0]??0,te[1]??0,te[2]??0,te[3]??0,Oe,ae];const J=S[V]??(S[V]=[]);for(let q=0;q<rt.length;q++){const de=ie[q],a=!!de&&(de.pressed||de.value>Ls);if(a===!!J[q])continue;J[q]=a;const c=rt[q];a?t.add(c+"@"+V):t.delete(c+"@"+V),W(c),r(a?0:1,c,V)}}},W=T=>{let O=!1;for(let P=0;P<Pe&&!O;P++)t.has(T+"@"+P)&&(O=!0);O?t.add(T):t.delete(T)};let I=0;const z=()=>{p=v,y=b,E=L,k=_,v=b=L=_=0,M(),I=requestAnimationFrame(z)},u=e.windows.filter((T,O,P)=>T&&P.indexOf(T)===O);for(const T of u)e.keyboard!==!1&&(T.addEventListener("keydown",s),T.addEventListener("keyup",i)),T.addEventListener("blur",o);return l.addEventListener("pointermove",C,!0),l.addEventListener("mousedown",N,!0),window.addEventListener("mouseup",U,!0),l.addEventListener("wheel",D,{passive:!0,capture:!0}),l.addEventListener("contextmenu",F,!0),typeof requestAnimationFrame=="function"&&(I=requestAnimationFrame(z)),{inputKey:(T,O)=>O>=0&&T.startsWith("Gamepad")?t.has(T+"@"+O):t.has(T),inputRead:T=>{var O;switch(T){case 0:return f;case 1:return d;case 2:return p;case 3:return y;case 4:return E;case 5:return k;case 6:return document.pointerLockElement===l?1:0;case 7:{let P=0;for(let V=0;V<Pe;V++)B[V]&&P++;return P}}if(T>=ot){const P=Math.floor((T-ot)/Zt),V=(T-ot)%Zt;return P>=Pe||!B[P]?0:V===0?1:((O=m[P])==null?void 0:O[V-1])??0}return 0},inputSetPointerLock:T=>{if(!T)return document.pointerLockElement===l&&document.exitPointerLock(),!0;if(document.pointerLockElement===l)return!0;if(typeof l.requestPointerLock!="function")return!1;try{const O=l.requestPointerLock({unadjustedMovement:!0});return O&&typeof O.catch=="function"&&O.catch(()=>{try{l.requestPointerLock()}catch{}}),!0}catch{return!1}},registerInputEvent:T=>{n=T},dispose:()=>{for(const T of u)T.removeEventListener("keydown",s),T.removeEventListener("keyup",i),T.removeEventListener("blur",o);l.removeEventListener("pointermove",C,!0),l.removeEventListener("mousedown",N,!0),window.removeEventListener("mouseup",U,!0),l.removeEventListener("wheel",D,!0),l.removeEventListener("contextmenu",F,!0),I&&cancelAnimationFrame(I),document.pointerLockElement===l&&document.exitPointerLock(),t.clear(),n=null}}},xs=e=>{const t=e.ownerDocument.defaultView??window,n=Ts({windows:[t],root:e}),r=t.visualViewport,s=()=>r?Math.max(0,Math.round(t.innerHeight-r.height-r.offsetTop)):0;let i=null,o=0;const l=()=>{const d=s();d!==o&&(o=d,i==null||i(d,0))};return r==null||r.addEventListener("resize",l),{bridge:{key:n.inputKey,read:n.inputRead,setPointerLock:n.inputSetPointerLock,registerEvent(d){n.registerInputEvent(d)},keyboardHeight:s,registerKeyboardEvent(d){i=d}},dispose(){i=null,r==null||r.removeEventListener("resize",l),n.dispose()}}},Y=[null],Re=new Map,Pn=e=>{if(!e.startsWith("id:"))return e;const t=Number(e.slice(3));return ce(t)?On(t):null},In=e=>{const t=Re.get(e);t!==void 0&&(URL.revokeObjectURL(t),Re.delete(e))},Ee=[!1],Dn=(e,t,n)=>{e.addEventListener("ended",()=>{n(),Ee[t]&&(e.currentTime=0,e.play())})},Rs=(e,t)=>{const n=Pn(e);if(n===null)return-1;const r=document.createElement("video");document.body.appendChild(r),r.crossOrigin="anonymous",r.style="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",r.src=n,r.playsInline=!0,r.controls=!1;const s=Y.length;return n!==e&&Re.set(s,n),Y.push(r),Ee.push(!1),Dn(r,s,t),s},As=(e,t)=>{const n=Pn(e);if(n===null)return-1;const r=document.createElement("audio");document.body.appendChild(r),r.style="opacity: 0; position: absolute; top: 0; left: 0; width: 1px; height: 1px",r.src=n;const s=Y.length;return n!==e&&Re.set(s,n),Y.push(r),Ee.push(!1),Dn(r,s,t),s},Cs=(e,t)=>{const n=Y[e];n&&(t===0?n.muted=!0:(n.muted&&(n.muted=!1),n.volume=t))},$s=(e,t)=>{const n=Y[e];n&&(t?n.play():n.pause())},Os=(e,t)=>{Ee[e]=t},Us=e=>{var t;return((t=Y[e])==null?void 0:t.currentTime)??0},Ms=(e,t)=>{const n=Y[e];n&&(n.currentTime=t)},Ns=e=>{var n;const t=((n=Y[e])==null?void 0:n.duration)??0;return isNaN(t)?0:t},xi=e=>Y[e],Bn=e=>{e.pause(),e.removeAttribute("src"),e.load(),e.remove()},Fs=e=>{const t=Y[e];t&&(Bn(t),In(e),Y[e]=null,Ee[e]=!1)},Ri=()=>{for(let e of Y)e&&Bn(e);for(const e of[...Re.keys()])In(e);Y.length=1,Ee.length=1},Ps=()=>{const e=new Map;let t=null;const n=o=>{e.delete(o)&&Fs(o)},r=new FinalizationRegistry(o=>{const l=e.get(o);l&&(l.held=!1,l.playing||n(o))}),s=(o,l)=>{let f=-1;if(f=o(l,()=>{const b=e.get(f);b&&(t==null||t(f),!b.loop&&(b.playing=!1,b.held||n(f)))}),f<0)return null;e.set(f,{held:!0,playing:!1,loop:!1});const v={id:f};return r.register(v,f),v};return{bridge:{createAudio:o=>s(As,o),createVideo:o=>s(Rs,o),setVolume:Cs,setLoop(o,l){const f=e.get(o);f&&(f.loop=l),Os(o,l)},setPlaying(o,l){const f=e.get(o);f&&(f.playing=l,$s(o,l),!l&&!f.held&&n(o))},time:Us,setTime:Ms,duration:Ns,setEmitter(o){t=o}},live:()=>e.size,dispose(){t=null;for(const o of[...e.keys()])n(o)}}},Is=()=>{const e=[];return{bridge:{open(n,r){const s=e.length;let i;try{i=new WebSocket(n)}catch{return e.push(null),queueMicrotask(()=>r("error")),s}return i.addEventListener("open",()=>r("open")),i.addEventListener("message",o=>r("message",o.data)),i.addEventListener("close",o=>{e[s]=null,r("close",o.code)}),i.addEventListener("error",()=>r("error")),e.push(i),s},send(n,r){const s=e[n];s&&s.readyState===WebSocket.OPEN&&s.send(r)},close(n){var r;(r=e[n])==null||r.close()}},dispose(){for(const n of e)n==null||n.close();e.length=0}}},Ds=e=>{let t="default",n=null,r=!1;const s=()=>`lecodes:${e}:${t}`,i=()=>{if(n)return n;n={};try{const d=window.localStorage.getItem(s()),v=d?JSON.parse(d):null;if(v&&typeof v=="object")for(const[b,L]of Object.entries(v))typeof L=="string"&&(n[b]=L)}catch{}return n},o=()=>{if(r=!1,!!n)try{window.localStorage.setItem(s(),JSON.stringify(n))}catch{}},l=()=>{r||(r=!0,queueMicrotask(o))};return{bridge:{get:d=>i()[d]??null,set(d,v){i()[d]=String(v),l()},remove(d){delete i()[d],l()},select(d){r&&o(),t=d,n=null}},dispose(){r&&o()}}},Bs=e=>{const t=e.ownerDocument,n=t.defaultView??window;let r=null;const s=new Map;let i=0,o=0,l=null;const f=()=>{o=s.size?n.requestAnimationFrame(f):0;for(const b of[...s.values()])b()},d=b=>{b!==l&&(l==null||l.remove(),l=b,r&&(b&&(b.classList.add("lc-background"),b.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: #000",e.insertBefore(b,r.canvas)),r.engine._setTransparent(!!b)))};return{facade:{...Cn(),setMatrix(b,L){r==null||r.engine.setWorldMatrix(b,Float32Array.from(L))},setVisible(b,L){r==null||r.engine.setVisible(b,L)},setCameraMatrix(b,L){r==null||r.engine.setCameraMatrix(b,Float32Array.from(L))},setProjection(b,L,_,p){r==null||r.engine.setCameraProjectionMatrix(b,Float32Array.from(L),_,p)},clearProjection(b){r==null||r.engine.clearCameraProjectionMatrix(b)},setBackground(b,L){d(L)},onFrame(b){const L=i++;return s.set(L,b),o||(o=n.requestAnimationFrame(f)),()=>{s.delete(L)}},readPixels(b,L){if(!r||r.opened()!==b){L(null,0,0);return}const _=r.canvas;r.engine._renderNow();const p=t.createElement("canvas");p.width=_.width,p.height=_.height;const y=p.getContext("2d");if(!y||_.width===0||_.height===0){L(null,0,0);return}y.drawImage(_,0,0);const E=y.getImageData(0,0,_.width,_.height);L(new Uint8Array(E.data.buffer),_.width,_.height)},viewport:()=>cs(r==null?void 0:r.canvas,n)},attach(b){b!==r&&(d(null),s.clear(),r=b)}}},en={scene3d:{uses:["_creator.createScene","_creator.createEntity"],module:"/web-lite/src/engines/scene3d.ts"},anim:{uses:["_creator.animator","_creator.getGlbClipSet","_creator.loadClips","_creator.createClipFromTracks"],module:"/creator-anim/dist/creatorAnim.js"},physics:{uses:["_creator.physicsBuild","_creator.physicsCreate","_creator.physicsConfigure","_creator.physicsRaycast","_creator.characterCreate","_creator.vehicleCreate","_creator.ragdollCreate"],module:"/creator-physics/dist/creatorPhysics.js"},particles:{uses:["_creator.createParticleSystem","_creator.createNoise"],module:"/creator-particles/dist/creatorParticles.js"}},Vs=e=>{const t=Object.keys(en).filter(n=>en[n].uses.some(r=>e.includes(r)));return new Set(t)},tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vn={};for(let e=0;e<tn.length;e++)Vn[tn[e]]=e;const Ws=e=>{const t=[];let n=0,r=0;for(const s of e){const i=Vn[s];if(i===void 0)break;const o=i&32;if(r+=(i&31)<<n,o)n+=5;else{const l=r&1;r>>=1,t.push(l?-r:r),r=0,n=0}}return t};class zs{constructor(t){Ke(this,"sources");Ke(this,"lines");this.sources=t.sources,this.lines=[];let n=0,r=0,s=0;for(const i of t.mappings.split(";")){const o=[];let l=0;if(i)for(const f of i.split(",")){const d=Ws(f);d.length!==0&&(l+=d[0],d.length>=4&&(n+=d[1],r+=d[2],s+=d[3],o.push([l,n,r,s])))}this.lines.push(o)}}originalPositionFor(t,n){const r=this.lines[t-1];if(!r||r.length===0)return null;let s=null;for(const o of r)if(o[0]<=n)s=o;else break;s??(s=r[0]);const i=this.sources[s[1]];return i===void 0?null:{source:i,line:s[2]+1,column:s[3]}}}const Gs=e=>{const t=e.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const n=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new zs(JSON.parse(n))}catch{return null}};let he=null;const js=()=>{if(he!==null)return he;try{new Function("throw new Error('chisel-calibrate')")()}catch(e){const n=(e.stack??"").match(/<anonymous>:(\d+):\d+/);return he=n?parseInt(n[1],10)-1:2,he}return he=2,he},nn=(e,t)=>{const n=(e instanceof Error?e.stack:"")??"",r=js(),s=[];for(const i of n.split(`
286
+ `)){const o=i.match(/<anonymous>:(\d+):(\d+)/);if(!o)continue;const l=parseInt(o[1],10)-r,f=parseInt(o[2],10)-1;if(l<1)continue;const d=t.originalPositionFor(l,f<0?0:f);if(!d)continue;const v=i.match(/at\s+([^\s(]+)\s*\(/);s.push({fn:v?v[1]:null,source:d.source,line:d.line,column:d.column})}return s},Hs=e=>{const t=[],n=(o,l,f)=>{var b;const d=l instanceof Error?l.message:String(l),v=f[0];console.error(v?`[lecodes] ${d}
287
+ at ${v.source}:${v.line}:${v.column}${v.fn?` (${v.fn})`:""}`:`[lecodes] ${d}`),(b=o.onError)==null||b.call(o,{message:d,frames:f,stack:l instanceof Error?l.stack:void 0})},r=o=>{for(let l=t.length-1;l>=0;l--){const f=t[l];if(!f.sourceMap)continue;const d=nn(o,f.sourceMap);if(d.length>0)return n(f,o,d),!0}return!1},s=o=>{r(o.error??o.message)},i=o=>{r(o.reason)};return e.addEventListener("error",s),e.addEventListener("unhandledrejection",i),{track(o,l){const f={sourceMap:Gs(o),onError:l};return t.push(f),{thrown(d){n(f,d,f.sourceMap?nn(d,f.sourceMap):[])},drop(){const d=t.indexOf(f);d>=0&&t.splice(d,1)}}},dispose(){e.removeEventListener("error",s),e.removeEventListener("unhandledrejection",i),t.length=0}}},Ks=""+new URL("assets/roboto-cyrillic-ext-1gPz9dK9.woff2",import.meta.url).href,Ys=""+new URL("assets/roboto-cyrillic-DVBNKCCH.woff2",import.meta.url).href,qs=""+new URL("assets/roboto-greek-ext-D98D44EL.woff2",import.meta.url).href,Xs=""+new URL("assets/roboto-greek-DVLYEgdx.woff2",import.meta.url).href,Js=""+new URL("assets/roboto-latin-ext-t610Sqxq.woff2",import.meta.url).href,Qs=""+new URL("assets/roboto-latin-cAJwcdBQ.woff2",import.meta.url).href,Zs=""+new URL("assets/roboto-rest-C7JkyNHT.woff2",import.meta.url).href,ei=""+new URL("assets/roboto-vietnamese-w-p-nKZZ.woff2",import.meta.url).href,ti="Roboto",ni="100 900",ri=[{name:"rest",file:"roboto-rest.woff2",range:"U+02D8-02D9, U+02DB, U+030F, U+2070, U+2074-208E, U+20C1, U+2105, U+2126, U+212E, U+215B-215E, U+2202, U+2206, U+220F, U+2211, U+221A, U+221E, U+222B, U+2248, U+2260, U+2264-2265, U+25A0, U+25CA-25CB, U+25CF, U+EE01-EE02, U+F6C3, U+FB01-FB04, U+FFFC",bytes:13324},{name:"cyrillic-ext",file:"roboto-cyrillic-ext.woff2",range:"U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",bytes:36720},{name:"cyrillic",file:"roboto-cyrillic.woff2",range:"U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",bytes:23696},{name:"greek-ext",file:"roboto-greek-ext.woff2",range:"U+1F00-1FFF",bytes:4380},{name:"greek",file:"roboto-greek.woff2",range:"U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF",bytes:17588},{name:"vietnamese",file:"roboto-vietnamese.woff2",range:"U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",bytes:14340},{name:"latin-ext",file:"roboto-latin-ext.woff2",range:"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",bytes:26388},{name:"latin",file:"roboto-latin.woff2",range:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD",bytes:36600}],st={family:ti,weight:ni,parts:ri},oi=Object.assign({"./assets/fonts/roboto-cyrillic-ext.woff2":Ks,"./assets/fonts/roboto-cyrillic.woff2":Ys,"./assets/fonts/roboto-greek-ext.woff2":qs,"./assets/fonts/roboto-greek.woff2":Xs,"./assets/fonts/roboto-latin-ext.woff2":Js,"./assets/fonts/roboto-latin.woff2":Qs,"./assets/fonts/roboto-rest.woff2":Zs,"./assets/fonts/roboto-vietnamese.woff2":ei}),rn="data-lecodes-lite-fonts",si=1500,ii=e=>{if(e.head.querySelector(`style[${rn}]`))return;const t=st.parts.map(r=>{const s=oi[`./assets/fonts/${r.file}`];if(!s)return"";const i=new URL(s,e.baseURI).href;return`@font-face{font-family:"${st.family}";src:url("${i}") format("woff2");font-weight:${st.weight};font-style:normal;font-display:swap;unicode-range:${r.range}}`}),n=e.createElement("style");n.setAttribute(rn,""),n.textContent=t.join(`
288
+ `),e.head.appendChild(n)},ai=(e,t=[],n=si)=>{const r=e.defaultView??window,s=e.fonts?e.fonts.ready.then(()=>{},()=>{}):Promise.resolve();return new Promise(i=>{const o=r.setTimeout(i,n);Promise.all([s,...t.map(l=>l.then(()=>{},()=>{}))]).then(()=>{r.clearTimeout(o),i()})})},on=e=>typeof e=="object"&&e!==null&&e.lecodes===!0&&typeof e.level=="number",dt=(e,t={})=>{let n;if((t.mode??"hash")==="hash")n=e.hash.replace(/^#/,"");else{const r=t.base??"/";n=(e.pathname.startsWith(r)?e.pathname.slice(r.length-1):e.pathname).replace(/\/index\.html$/,"/")+e.search}return n===""||n==="/"?null:n.startsWith("/")?n:`/${n}`},li=(e,t,n={})=>{if((n.mode??"hash")==="hash")return`${t.pathname}${t.search}${e===null?"":`#${e}`}`;const r=n.base??"/";return e===null?r:r.replace(/\/$/,"")+e},ci=(e,t,n={})=>{const r=e.history,s=e.location;let i=0,o=!1,l=0,f=!1;const d=(_,p)=>{const y={lecodes:!0,level:p},E=li(t.address(),s,n);_==="push"?r.pushState(y,"",E):r.replaceState(y,"",E)},v=_=>{_!==0&&(l++,r.go(_))},b=()=>{if(l>0){f=!0;return}const _=t.level();if(o){i=_,d("replace",_);return}if(_>i){for(let p=i+1;p<=_;p++)d("push",p);i=_}else if(_<i){const p=_-i;i=_,v(p)}else d("replace",_)},L=_=>{if(l>0){if(l--,l>0)return;f?(f=!1,b()):d("replace",i);return}const p=_.state;if(!on(p)){const C=dt(s,n);r.replaceState({lecodes:!0,level:i},"",s.href),C!==null&&t.link(C);return}const y=p.level,E=i;o=!0;try{if(y<E)for(;t.level()>y;){const C=t.level();if(t.back(),t.level()>=C)break}else if(y>E){const C=dt(s,n);C!==null&&t.link(C)}}finally{o=!1}const k=Math.max(0,t.level());if(i=y,k===y){d("replace",y);return}if(y>E&&k>E){i=k,d("replace",k);return}i=k,v(k-y)};return e.addEventListener("popstate",L),on(r.state)?i=r.state.level:r.replaceState({lecodes:!0,level:0},"",s.href),{sync:b,reset(){const _=-i;i=0,v(_)},destroy(){e.removeEventListener("popstate",L)}}},ui=.1,fi=e=>{const t=new Set,n=new Set,r=new Map;let s=1,i=0,o=0;const l=f=>{i=0;const d=Math.min(ui,Math.max(0,(f-o)/1e3));o=f;for(const v of[...r.values()])v(d);r.size>0&&(i=e.requestAnimationFrame(l))};return{globals:{setTimeout(f,d,...v){const b=e.setTimeout(()=>{t.delete(b),f(...v)},d);return t.add(b),b},clearTimeout(f){t.delete(f),e.clearTimeout(f)},setInterval(f,d,...v){const b=e.setInterval(()=>f(...v),d);return n.add(b),b},clearInterval(f){n.delete(f),e.clearInterval(f)},setLoop(f){const d=s++;return r.set(d,f),i===0&&(o=e.performance.now(),i=e.requestAnimationFrame(l)),d},clearLoop(f){r.delete(f)}},dispose(){for(const f of t)e.clearTimeout(f);for(const f of n)e.clearInterval(f);t.clear(),n.clear(),r.clear(),i!==0&&e.cancelAnimationFrame(i),i=0}}},di=["_creator","_creator2d","_creatorNav","_creatorNet","_creatorAudio","_creatorCanvas","_creatorFiles","_creatorService"],sn=new Map,pi=e=>{let t=sn.get(e);return t||sn.set(e,t=On(e)),t},hi=(e,t={})=>{const n=e.ownerDocument,r=n.defaultView??window,s=Hs(r),i=t.language??(()=>(navigator.language||"en").slice(0,2));let o=null;const l=Bs(e),f=hs(l.facade),d=new Set,v=F=>Promise.all([...F].map(async B=>{if(!(!t.loadPlugin||d.has(B))){d.add(B);try{const m=await t.loadPlugin(B);m&&f.register(B,m)}catch(m){console.warn(`[web-lite] the "${B}" plugin did not load: ${m instanceof Error?m.message:m}`)}}})),b=async(F,B,m)=>{const S=Vs(F);if(!S.has("scene3d"))return{features:[],scene:null,dispose(){}};try{const{createScene3d:M}=await fe(async()=>{const{createScene3d:I}=await import("./assets/scene3d-D5R7Vq3f.js").then(z=>z.s);return{createScene3d:I}},[],import.meta.url),W=await M(e,{preloads:B,twins:{anim:S.has("anim"),physics:S.has("physics"),particles:S.has("particles")},alpha:m});return{features:[W.feature],scene:W,dispose:W.dispose}}catch(M){return console.warn(`[web-lite] the 3D engine did not start: ${M instanceof Error?M.message:M}`),{features:[],scene:null,dispose(){}}}};let L=t.launchRoute!==void 0?t.launchRoute:t.history?dt(r.location,t.history):null,_=t.safeArea??null,p=0;const y=n.createElement("div");y.style.cssText="position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);";const E=()=>{y.isConnected||n.body.appendChild(y);const F=r.getComputedStyle(y),B=m=>Math.round(parseFloat(m)||0);return{top:B(F.paddingTop),right:B(F.paddingRight),bottom:B(F.paddingBottom),left:B(F.paddingLeft)}},k=()=>{const F=_??E();o==null||o.tree.setSafeArea(F,F.bars??[])};r.addEventListener("resize",k);const C=t.history?ci(r,{level:()=>Math.max(0,((o==null?void 0:o.tree.presentation.stack().length)??0)-1),address:()=>(o==null?void 0:o.tree.presentation.address())??null,back:()=>{o==null||o.tree.back()},link:F=>{L=F,o==null||o.emitApp("url",F)}},t.history):null,N=()=>{l.attach(null),o==null||o.dispose(),o=null},U=(F,B,m)=>{const S=as({root:e,bufferUrl:pi,features:m,plugins:f,onNavigation:()=>{var T;C==null||C.sync(),(T=t.onNavigation)==null||T.call(t,S)}}),M=fi(r),W=ks(),I=Ds(t.project??"app"),z=Is(),u=xs(e),A=Ps(),x=s.track(F,B.onError),g=ys({launchUrl:()=>L,rerun:(T,O,P)=>{O!==void 0&&(L=O);const V=T??F;r.setTimeout(()=>{D(V,B).catch(H=>P==null?void 0:P(H instanceof Error?H.message:String(H)))},0)},stats:()=>JSON.stringify({live:{tree:S.stats().nodes,fetch:W.live(),media:A.live(),tween:S.stats().tweens},pending:0}),onOrientation:t.onOrientation}),h={_creatorTree:S.bridge,_creatorApp:g.bridge,_creatorDevice:ws(i),_creatorFetch:W.bridge,_creatorStorage:I.bridge,_creatorSocket:z.bridge,_creatorInput:u.bridge,_creatorMedia:A.bridge,...M.globals};for(const T of di)h[T]=void 0;Object.assign(h,S.globals),o={code:F,tree:S,emitApp:g.emit,dispose(){x.drop(),M.dispose(),z.dispose(),A.dispose(),u.dispose(),I.dispose(),W.dispose(),g.dispose(),S.destroy()}},k();const $=Object.keys(h);try{new Function(...$,F)(...$.map(T=>h[T]))}catch(T){x.thrown(T)}};async function D(F,B={}){const m=nr(F);if(!Zn(m.sdk,St))throw new Error(`This app was built with LeCodes SDK ${m.sdk??"older than 2.0"}; this host runs SDK ${St}. It needs a new build.`);m.is2d&&console.warn("[web-lite] this app uses 2D scenes, which Web Lite does not show yet (docs/plans/web-lite-plan.md): its UI runs, a scene's calls fail");const S=++p;o&&(C==null||C.reset()),N(),t.defaultFont!=="system"&&ii(n);const M=tr(m.bootFonts,n),[W,I]=await Promise.all([bs(F),v(m.plugins).then(()=>b(F,m.preloads,f.drives3d()))]);if(S!==p){I.dispose();return}W.push(...I.features),l.attach(I.scene),e.style.visibility="hidden";try{U(F,B,W),o==null||o.tree.flush(),e.offsetHeight,await ai(n,[M])}finally{S===p&&(e.style.visibility="")}}return{run:D,restart(F){return o?(F!==void 0&&(L=F),D(o.code)):Promise.resolve()},tree:()=>(o==null?void 0:o.tree)??null,setSafeArea(F){_=F,k()},openRoute(F){L=F,o==null||o.emitApp("url",F)},emitAppEvent(F,B){o==null||o.emitApp(F,B)},destroy(){p++,N(),r.removeEventListener("resize",k),C==null||C.destroy(),y.remove(),s.dispose()}}},Le=document.getElementById("app"),an=document.getElementById("error"),ve=new URLSearchParams(location.search),Wn=e=>{an&&(an.textContent=e)},ln=ve.has("dev")?new URL(ve.get("dev")||"..",location.href).href.replace(/\/$/,""):null,cn=e=>{const t=e.frames[0];return t?`${e.message}
289
+ at ${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:e.message},zn=e=>{Wn(cn(e)),ee==null||ee.error(cn(e))},Gn=e=>zn({message:e instanceof Error?e.message:String(e),frames:[]});let un=null;const mi=async e=>{un??(un=fetch(new URL("plugins.json",document.baseURI)).then(r=>r.ok?r.json():{plugins:{}}).then(r=>r.plugins??{},()=>({})));const t=(await un)[e];if(!t)return null;const n=await import(new URL(t,document.baseURI).href);return typeof n.register=="function"?n.register:null},jn=hi(Le,{loadPlugin:mi,history:{mode:Le.dataset.urls==="path"?"path":"hash",base:Le.dataset.base??"/"},project:ve.get("project")??location.pathname,defaultFont:Le.dataset.font==="system"?"system":"roboto"});ve.has("test")&&(window.lecodesTest={ready:!1,dump:()=>{var e;return((e=jn.tree())==null?void 0:e.bridge.debugDump())??'{"roots":[]}'},rect:e=>{const t=document.querySelector(`[data-node="${e}"]`);if(!t)return null;const n=t.getBoundingClientRect();return[n.left,n.top,n.width,n.height]}});let it=!1,at=null,pt=-1;const He=async e=>{if(it){at=e;return}it=!0,Wn("");try{const t=await fetch(e.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${e.src} → HTTP ${t.status}`);const n=await t.text();await jn.run(n,{onError:zn});const r=window.lecodesTest;r&&(r.ready=!0),ee&&e.version!==void 0&&(pt=ee.versionOf(t,e.version),ee.ran(pt))}catch(t){Gn(t)}finally{it=!1;const t=at;at=null,t&&He(t)}},ee=ln?qn(ln,e=>{e!==pt&&He({src:ee.bundleUrl(e),version:e})}):null;if(ee)for(const e of["log","info","warn","error"]){const t=console[e].bind(console);console[e]=(...n)=>{t(...n),ee.log(e,n)}}if(ee)He({src:ee.bundleUrl(0),version:0});else{const e=Xn(ve.get("src")??Le.dataset.src??"app.js",document.baseURI);e?He({src:e}):Gn(`The page runs bundles of its own origin only: ${ve.get("src")}`)}export{Je as A,Ce as B,Qe as C,dn as D,ge as E,Be as F,Br as G,wi as H,Ir as T,_i as _,ce as a,Ti as b,ki as c,xi as d,fe as e,yi as f,Un as g,Li as h,Se as i,me as j,Rn as k,Si as l,Tt as m,Z as n,bi as o,Ge as p,yr as q,Ri as r,br as s,ft as t,Ei as u,fn as v,vi as w,Lo as x,wn as y,xo as z};