lecodes-cli 2.3.1 → 2.4.0

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,5 +1,5 @@
1
1
  {
2
- "version": "4e996da5-2026-10-17",
3
- "commit": "4e996da5",
4
- "date": "2026-10-17T08:27:32.824Z"
2
+ "version": "096c2377-2026-10-19",
3
+ "commit": "096c2377",
4
+ "date": "2026-10-19T06:35:44.556Z"
5
5
  }
@@ -10,12 +10,12 @@ var Un=Object.defineProperty;var Bn=(n,t,e)=>t in n?Un(n,t,{enumerable:!0,config
10
10
  `)){let h=oe(c,o,e);a&&(r>0&&i.length+h.length>r?a=!1:s==="balance"?h=Qr(c,o,h,e):h=Zr(o,h,e));for(const u of h)i.push(u)}let l=0;for(const c of i)l=Math.max(l,e(c));return{lines:i,maxWidth:l}}function yn(n,t,e,s,r){const i=t.textWrap??"wrap",o=Ot(n,e,s,i,t.lineClamp??0),a=i==="nowrap"&&!r?1/0:e,l=ts(o.lines,t,a,s);return i!=="nowrap"||!r||t.textOverflow==="clip"||!isFinite(e)?l:l.map(c=>s(c)>e?wn(c,e,s):c)}const Vt="…";function ts(n,t,e,s){const r=t.lineClamp??0;if(r<=0||n.length<=r)return n;const i=n.slice(0,r);return t.textOverflow==="clip"||(i[r-1]=wn(i[r-1],e,s)),i}function wn(n,t,e){if(!isFinite(t))return n+Vt;const s=[...n];let r=s.length;for(;r>0&&e(s.slice(0,r).join("")+Vt)>t;)r--;return s.slice(0,r).join("").trimEnd()+Vt}function es(n,t,e){const s=ie(n),r=mn(s),i=isNaN(e)?1/0:e,o=c=>t.measureText(c,r),a=yn(n.text??"",n.style,i,o,!1);let l=0;for(const c of a)l=Math.max(l,o(c));return{width:Math.ceil(l),height:Math.ceil(a.length*s.lineHeight)}}function ns(n,t,e){const s=n.style,r={family:s.fontFamily??"Roboto",size:s.fontSize??14,weight:s.fontWeight??400,italic:s.fontStyle==="italic",letterSpacing:s.letterSpacing??0},i=s.lineHeight,o=n.value??"";if(n.type==="input")return{width:Math.ceil(t.measureText(o,r)),height:Math.ceil(i)};const a=isNaN(e)?1/0:e,l=Ot(o,a,c=>t.measureText(c,r));return{width:Math.ceil(l.maxWidth),height:Math.ceil(Math.max(1,l.lines.length)*i)}}function rs(n,t,e,s){const r=n.imageSrcRaw;let i=0,o=0;if(n.sourceRect)i=n.sourceRect[2],o=n.sourceRect[3];else if(cn(r)){const c=ne(r.svg);if(c)i=c.width,o=c.height;else{const h=t.getImage(t.resolveSrc(r)??"");i=(h==null?void 0:h.naturalWidth)??0,o=(h==null?void 0:h.naturalHeight)??0}}else{const c=t.resolveSrc(r),h=c?t.getImage(c):void 0;i=(h==null?void 0:h.naturalWidth)??0,o=(h==null?void 0:h.naturalHeight)??0}if(i===0||o===0)return{width:0,height:0};const a=Math.min(e/i,s/o),l=isNaN(e)&&isNaN(s)?1:isNaN(e)?s/o:isNaN(s)?e/i:Math.min(a,1);return{width:i*l,height:o*l}}const bn=(n,t,e,s)=>t?[n[0],n[1],n[2],n[3],n[4]+e*t[0]+s*t[2],n[5]+e*t[1]+s*t[3]]:n;function ss(n,t,e,s,r,i,o={}){t.beginFrame(s,r);for(const a of n)vn(a.tree,t,e,o);t.endFrame()}function vn(n,t,e,s){var h;const{style:r,rect:i}=n;t.save();const o=r.opacity!==void 0&&r.opacity<1?r.opacity:void 0,a=o!==void 0&&n.children.length>0;if(a?t.beginGroup(o):o!==void 0&&t.setAlpha(o),r.transform){const[u,f,d,p,y,b]=bn(r.transform,r.transformBox,i.width,i.height),x=r.transformOrigin,m=i.x+(x?x.xPercent?i.width*x.x/100:x.x:i.width/2),v=i.y+(x?x.yPercent?i.height*x.y/100:x.y:i.height/2);t.translate(m,v),t.transform(u,f,d,p,y,b),t.translate(-m,-v)}const l=se(r.borderRadius,i);if(re(r.backgroundColor)||t.fillRoundRect(i,l,r.backgroundColor),r.backgroundImage){const u=e.getImage(r.backgroundImage);u&&u.naturalWidth>0&&u.naturalHeight>0&&(t.save(),Te(l)&&t.clipRoundRect(i,l),t.drawImage(u,null,i,{fit:is(r.backgroundSize),tile:r.backgroundSize==="tile"}),t.restore())}if(r.backgroundGradients)for(let u=r.backgroundGradients.length-1;u>=0;u--){const f=r.backgroundGradients[u];f.stops.length>0&&t.fillGradient(i,l,f)}if(n.image&&n.image.naturalWidth>0&&n.image.naturalHeight>0){const u=n.sourceRect;t.save(),Te(l)&&t.clipRoundRect(i,l),t.drawImage(n.image,u?{x:u[0],y:u[1],width:u[2],height:u[3]}:null,i,{fit:u?"fill":r.objectFit??"contain",tint:Dt(n.image.src)?r.tintColor:void 0,radius:l}),t.restore()}n.type==="text"&&n.lines&&n.lines.length>0&&as(n,t,e),(n.type==="input"||n.type==="textarea")&&n.id!==s.editing&&ds(n,t,e,l),(n.type==="video"||n.type==="native")&&(s.surfaces?t.clearRoundRect(i,l):n.type==="video"?cs(n,t,e,l):((h=n.view)==null?void 0:h.label)!==void 0&&fs(n,n.view.name,n.view.label,t,e,l)),n.clip&&t.clipRoundRect(i,l);for(const u of n.children)u.overlay!==void 0&&!re(u.overlay)&&t.fillRoundRect(i,void 0,u.overlay),vn(u,t,e,s);r.dim!==void 0&&r.dim>0&&t.fillRoundRect(i,l,Math.round(Math.min(1,r.dim)*255)>>>0);const c=os(r.border);c&&t.strokeBorder(i,l,c),a&&t.endGroup(),t.restore()}function is(n){return n==="contain"||n==="fill"?n:"cover"}function os(n){if(!n)return null;const t={};let e=!1;for(const s of["top","right","bottom","left"]){const r=n[s];r&&r.width>0&&(r.color>>>0)%256!==0&&(t[s]=r,e=!0)}return e?t:null}const pe=(n,t)=>{var s;const e=t??"Roboto";return((s=n.resolveFontFamily)==null?void 0:s.call(n,e))??e};function as(n,t,e){var b,x,m;const s=n.style,r={family:pe(e,s.fontFamily),size:s.fontSize??14,weight:s.fontWeight??400,italic:s.fontStyle==="italic",letterSpacing:s.letterSpacing??0},i=s.color??255,o=s.lineHeight,a=s.textAlign??"start",l=e.fontMetrics(r),{rect:c,lines:h}=n,u=((b=n.padding)==null?void 0:b[0])??0,f=((x=n.padding)==null?void 0:x[1])??0,d=((m=n.padding)==null?void 0:m[2])??0,p=c.x+u,y=c.width-u-d;for(let v=0;v<h.length;v++){const _=h[v],P=c.y+f+v*o+(o-(l.ascent+l.descent))/2+l.ascent,O=e.measureText(_,r),I=a==="center"?p+(y-O)/2:a==="end"?p+y-O:p;if(t.fillText(_,I,P,r,i),s.textDecoration==="underline"||s.textDecoration==="line-through"){const F=Math.max(1,r.size/14),$=s.textDecoration==="underline"?P+F:P-r.size*.3;t.fillRoundRect({x:I,y:$,width:O,height:F},void 0,i)}}}function cs(n,t,e,s){const{rect:r}=n;re(n.style.backgroundColor)&&t.fillRoundRect(r,s,286463999);const i=Math.min(r.width,r.height)*.3;if(i>=6){const o={family:"Roboto",size:i,weight:400,italic:!1,letterSpacing:0},a=e.fontMetrics(o),l=e.measureText("▶",o),c=r.x+(r.width-l)/2,h=r.y+(r.height-(a.ascent+a.descent))/2+a.ascent;t.fillText("▶",c,h,o,4294967244)}}const ls=3722701567,hs=1263887359,us=2324997119;function fs(n,t,e,s,r,i){const{rect:o}=n;s.fillRoundRect(o,i,ls);const a=pe(r,void 0),l={family:a,size:17,weight:600,italic:!1,letterSpacing:0},c={family:a,size:13,weight:400,italic:!1,letterSpacing:0},h=[];if(e&&h.push([e,l,hs]),t&&t!==e&&h.push([t,c,us]),h.length===0)return;const u=4,f=h.map(([,p])=>{const y=r.fontMetrics(p);return y.ascent+y.descent});let d=o.y+(o.height-f.reduce((p,y)=>p+y,0)-u*(h.length-1))/2;s.save(),s.clipRoundRect(o,i),h.forEach(([p,y,b],x)=>{const m=o.x+(o.width-r.measureText(p,y))/2;s.fillText(p,m,d+r.fontMetrics(y).ascent,y,b),d+=f[x]+u}),s.restore()}function ds(n,t,e,s){var z,G,Y,g,M;const r=n.style,i={family:pe(e,r.fontFamily),size:r.fontSize??14,weight:r.fontWeight??400,italic:r.fontStyle==="italic",letterSpacing:r.letterSpacing??0},o=n.value??"",a=o.length===0,l=r.inputType==="password"&&!a,c=a?r.placeholder??"":l?"•".repeat(o.length):o,h=a?r.placeholderColor??2576980479:r.color??255,{rect:u}=n,f=((z=n.padding)==null?void 0:z[0])??0,d=((G=n.padding)==null?void 0:G[1])??0,p=((Y=n.padding)==null?void 0:Y[2])??0,y=((g=n.padding)==null?void 0:g[3])??0,b=u.x+f,x=u.width-f-p,m=u.y+d,v=u.height-d-y,_=e.fontMetrics(i),T=r.lineHeight,P=r.textAlign??"start",O=n.type==="textarea",I=O?Ot(c,x,A=>e.measureText(A,i)).lines:[c],F=A=>P==="center"?b+(x-A)/2:P==="end"?b+x-A:b,$=A=>O?m+A*T+(T-(_.ascent+_.descent))/2+_.ascent:m+(v-(_.ascent+_.descent))/2+_.ascent;t.save(),t.clipRoundRect(u,s);for(let A=0;A<I.length;A++){const W=I[A];W.length>0&&t.fillText(W,F(e.measureText(W,i)),$(A),i,h)}if((M=n.state)!=null&&M.focused){const A=a?[""]:O?Ot(l?"•".repeat(o.length):o,x,U=>e.measureText(U,i)).lines:[c],W=A.length-1,q=e.measureText(A[W],i),_t=a?F(0):F(q)+q,E=$(W),R=Math.max(1,i.size/14);t.fillRoundRect({x:_t,y:E-_.ascent,width:R,height:_.ascent+_.descent},void 0,r.color??255)}t.restore()}const ps=84,gs={display:{word:4},overflow:{word:5},scrollDirection:{word:6},borderTopWidth:{word:8},borderRightWidth:{word:9},borderBottomWidth:{word:10},borderLeftWidth:{word:11},color:{bit:12,word:16},backgroundColor:{word:17},borderTopColor:{word:19},borderRightColor:{word:20},borderBottomColor:{word:21},borderLeftColor:{word:22},placeholderColor:{bit:19,word:23},tintColor:{bit:21,word:25},overlayColor:{bit:23,word:27},backgroundImage:{word:28},backgroundSize:{word:29},backgroundGradient:{word:30},borderTopLeftRadius:{word:32},borderTopRightRadius:{word:33},borderBottomRightRadius:{word:34},borderBottomLeftRadius:{word:35},opacity:{word:36},transform:{word:37},transformOrigin:{word:50},fontSize:{word:55},fontWeight:{word:56},fontStyle:{word:57},fontFamily:{bit:39,word:58},lineHeight:{word:59},letterSpacing:{word:60},textAlign:{word:61},textDecoration:{word:62},lineClamp:{word:63},textOverflow:{word:64},textWrap:{word:65},objectFit:{word:66},placeholder:{word:67},type:{word:68},dim:{word:82}},ms={hidden:1},ys={horizontal:1},ws={italic:1},at={display:["flex","none"],backgroundSize:["cover","contain","fill","tile"],textDecoration:["underline","line-through","none"],textOverflow:["ellipsis","clip"],textWrap:["wrap","nowrap","balance","pretty"],objectFit:["cover","contain","fill"],type:["text","password","tel","email","number","decimal","url","search","date","time"]},bs=(n,t,e)=>e<32?(n>>>e&1)===1:(t>>>e-32&1)===1,vs=["farthest-corner","closest-side","closest-corner","farthest-side"],xs=52;function Es(n,t,e,s){const r=[];for(let i=0;i<s;i++)r.push(Ss(n,t,e+i*xs));return r}function Ss(n,t,e){const s=e>>2,r=n[s],i=t[s+1],o=t[s+2],a=t[s+4],l=[];for(let c=0;c<o;c++){const h=a+c*8>>2;l.push({color:t[h]>>>0,position:n[h+1]})}if(i===1){const c=t[s+6],h={type:"radial",shape:t[s+5]===1?"circle":"ellipse",cx:n[s+7],cy:n[s+8],stops:l};return c===4?{...h,extent:"explicit",rx:n[s+9],ry:n[s+10],rxUnit:t[s+11]===1?"fraction":"px",ryUnit:t[s+12]===1?"fraction":"px"}:{...h,extent:vs[c]??"farthest-corner"}}return{type:"linear",angle:r,stops:l}}const k=gs,_s=["start","center","end","start","end"];let At=0;function xn(n,t,e){const s=n.HEAPU32,r=n.HEAPF32,i=t>>>2,o=s[i],a=s[i+1],l=I=>bs(o,a,I),c=I=>{const F=s[i+I];return F===0?void 0:n.UTF8ToString(n._cuiStringOf(F))};e.backgroundColor=s[i+k.backgroundColor.word]>>>0,e.opacity=r[i+k.opacity.word],e.dim=r[i+k.dim.word],e.display=at.display[s[i+k.display.word]],e.overflow=s[i+k.overflow.word]===ms.hidden?"hidden":"visible",e.scrollAxis=s[i+k.scrollDirection.word]===ys.horizontal?"x":"y",e.border={top:{width:r[i+k.borderTopWidth.word],color:s[i+k.borderTopColor.word]>>>0},right:{width:r[i+k.borderRightWidth.word],color:s[i+k.borderRightColor.word]>>>0},bottom:{width:r[i+k.borderBottomWidth.word],color:s[i+k.borderBottomColor.word]>>>0},left:{width:r[i+k.borderLeftWidth.word],color:s[i+k.borderLeftColor.word]>>>0}},e.borderRadius={tl:r[i+k.borderTopLeftRadius.word],tr:r[i+k.borderTopRightRadius.word],br:r[i+k.borderBottomRightRadius.word],bl:r[i+k.borderBottomLeftRadius.word]},e.backgroundImage=c(k.backgroundImage.word),e.backgroundSize=at.backgroundSize[s[i+k.backgroundSize.word]];const h=s[i+k.backgroundGradient.word];if(h===0)e.backgroundGradients=void 0;else{At===0&&(At=n._malloc(4));const I=n._cuiGradientOf(h,At),F=n.HEAPU32[At>>>2];e.backgroundGradients=I!==0&&F>0?Es(n.HEAPF32,n.HEAPU32,I,F):void 0}const u=i+k.transform.word,f=r[u],d=r[u+1],p=r[u+3],y=r[u+4],b=r[u+6],x=r[u+7],m=r[u+9],v=r[u+10],_=r[u+11],T=r[u+12],P=m===0&&v===0&&_===0&&T===0;e.transform=f===1&&d===0&&p===0&&y===1&&b===0&&x===0&&P?void 0:[f,d,p,y,b,x],e.transformBox=P?void 0:[m,v,_,T];const O=i+k.transformOrigin.word;e.transformOrigin={x:r[O],y:r[O+1],xPercent:s[O+2]!==0,yPercent:s[O+3]!==0},e.color=l(k.color.bit)?s[i+k.color.word]>>>0:void 0,e.fontFamily=l(k.fontFamily.bit)?c(k.fontFamily.word):void 0,e.fontSize=r[i+k.fontSize.word],e.fontWeight=r[i+k.fontWeight.word],e.fontStyle=s[i+k.fontStyle.word]===ws.italic?"italic":"normal",e.lineHeight=r[i+k.lineHeight.word],e.letterSpacing=r[i+k.letterSpacing.word],e.textAlign=_s[s[i+k.textAlign.word]]??"start",e.textDecoration=at.textDecoration[s[i+k.textDecoration.word]],e.lineClamp=r[i+k.lineClamp.word],e.textOverflow=at.textOverflow[s[i+k.textOverflow.word]],e.textWrap=at.textWrap[s[i+k.textWrap.word]],e.objectFit=at.objectFit[s[i+k.objectFit.word]],e.tintColor=l(k.tintColor.bit)?s[i+k.tintColor.word]>>>0:void 0,e.placeholder=c(k.placeholder.word),e.placeholderColor=l(k.placeholderColor.bit)?s[i+k.placeholderColor.word]>>>0:void 0,e.inputType=at.type[s[i+k.type.word]],e.overlayColor=l(k.overlayColor.bit)?s[i+k.overlayColor.word]>>>0:void 0}function ks(n,t){const e=n._cuiPaintOf(t);if(e===0)return!1;const s=e>>>2;return n.HEAPU32[s+2]!==0||n.HEAPU32[s+3]!==0}function Rs(n,t,e){const s=n._cuiPaintOf(t);return s===0?!1:(xn(n,s,e),!0)}function Ts(n,t){const e=n._paintCollect();if(e===0)return 0;const s=n._paintNodes()>>>2,r=n._paintRecords();for(let i=0;i<e;i++){const o=n.HEAPU32[s+i],a=r+i*ps*4;t(o,l=>xn(n,a,l))}return e}function En(n,t=[],e={}){const s=e.precision??2,r=e.includeIds??!1,i=n?ae(n,s,r):null;if(t.length===0)return i;const o=t.map(a=>ae(a,s,r));return i?(i.overlays=o,i):{type:"frame",overlays:o}}function As(n,t=[],e){return JSON.stringify(En(n,t,e),null,2)}function gt(n,t){const e=10**t;return Math.round(n*e)/e}function ae(n,t,e){var o,a;const s=n.rect,r={type:n.type};n.name&&(r.name=n.name),n.view&&(r.view=n.view.name),r.rect=[gt(s.x,t),gt(s.y,t),gt(s.width,t),gt(s.height,t)],e&&(r.id=n.id);const i=Ls(n.style);return i&&(r.style=i),n.text!==void 0&&(r.text=n.text),n.lines&&(n.lines.length!==1||n.lines[0]!==n.text)&&(r.lines=n.lines),n.value!==void 0&&n.value!==""&&(r.value=n.value),n.style.placeholder!==void 0&&(r.placeholder=n.style.placeholder),n.image&&(r.image={src:n.image.src,natural:[n.image.naturalWidth,n.image.naturalHeight]}),n.sourceRect&&(r.sourceRect=n.sourceRect),n.state&&(n.state.pressed||(o=n.state.classes)!=null&&o.length)&&(r.state={...n.state.pressed?{pressed:!0}:{},...(a=n.state.classes)!=null&&a.length?{classes:n.state.classes}:{}}),n.scroll&&(r.scroll={offset:gt(n.scroll.offset,t),content:gt(n.scroll.content,t)}),n.children.length>0&&(r.children=n.children.map(l=>ae(l,t,e))),r}function Ms(n){return n.tl===n.tr&&n.tr===n.br&&n.br===n.bl?n.tl:[n.tl,n.tr,n.br,n.bl]}function Ls(n){const t={};if(n.backgroundColor!==void 0&&(t.backgroundColor=pt(n.backgroundColor)),n.opacity!==void 0&&(t.opacity=n.opacity),n.color!==void 0&&(t.color=pt(n.color)),n.fontSize!==void 0&&(t.fontSize=n.fontSize),n.fontFamily!==void 0&&(t.fontFamily=n.fontFamily),n.fontWeight!==void 0&&(t.fontWeight=n.fontWeight),n.fontStyle!==void 0&&n.fontStyle!=="normal"&&(t.fontStyle=n.fontStyle),n.lineHeight!==void 0&&(t.lineHeight=n.lineHeight),n.letterSpacing&&(t.letterSpacing=n.letterSpacing),n.textAlign!==void 0&&n.textAlign!=="start"&&(t.textAlign=n.textAlign),n.textDecoration!==void 0&&n.textDecoration!=="none"&&(t.textDecoration=n.textDecoration),n.lineClamp&&(t.lineClamp=n.lineClamp,n.textOverflow==="clip"&&(t.textOverflow=n.textOverflow)),n.textWrap!==void 0&&n.textWrap!=="wrap"&&(t.textWrap=n.textWrap),n.objectFit!==void 0&&(t.objectFit=n.objectFit),n.tintColor!==void 0&&(t.tintColor=pt(n.tintColor)),n.overlayColor!==void 0&&(t.overlayColor=pt(n.overlayColor)),n.backgroundImage!==void 0&&(t.backgroundImage=n.backgroundImage),n.backgroundSize!==void 0&&(t.backgroundSize=n.backgroundSize),n.backgroundGradients!==void 0&&n.backgroundGradients.length>0&&(t.backgroundGradients=n.backgroundGradients.map(e=>{const s=e.stops.map(r=>({color:pt(r.color),position:r.position}));if(e.type==="radial"){const r={type:"radial",shape:e.shape,extent:e.extent,cx:e.cx,cy:e.cy,stops:s};return e.extent==="explicit"&&(r.rx=e.rx,r.ry=e.ry,r.rxUnit=e.rxUnit,r.ryUnit=e.ryUnit),r}return{angle:e.angle,stops:s}})),n.borderRadius&&(n.borderRadius.tl||n.borderRadius.tr||n.borderRadius.br||n.borderRadius.bl)&&(t.borderRadius=Ms(n.borderRadius)),n.border){const e={};for(const s of["top","right","bottom","left"]){const r=n.border[s];r&&r.width>0&&(e[s]={width:r.width,color:pt(r.color)})}Object.keys(e).length>0&&(t.border=e)}return Object.keys(t).length>0?t:void 0}const Ps=.32,Cs=4,Os={},Oe=new Map;function ce(n){if(!n)return n;if(n.startsWith("canvas:"))return`lecodes-canvas://${n.slice(7)}`;if(n.startsWith("svg:")){let t=Oe.get(n);return t===void 0&&(t=ln(n.slice(4)),Oe.set(n,t)),t}return n}class Is{constructor(t,e){w(this,"parent",null);w(this,"children",[]);w(this,"style",{lineHeight:14*1.2});w(this,"name");w(this,"text","");w(this,"src");w(this,"value","");w(this,"sourceRect");w(this,"viewName");w(this,"viewParams");w(this,"playerId",0);w(this,"viewId",0);w(this,"flags",0);w(this,"layoutRect",null);w(this,"scrollOffset",0);w(this,"wrapCache");w(this,"jsNode");w(this,"bgRaw");w(this,"bgSrc");this.id=t,this.type=e,this.jsNode={type:e,_id:t}}get measured(){return this.type==="text"||this.type==="image"||this.editable}get editable(){return this.type==="input"||this.type==="textarea"}get scrollable(){return this.type==="scrollable"||this.type==="scrollableScreen"||this.type==="vlist"}get scrollAxis(){return this.style.scrollAxis==="x"?"x":"y"}get interactive(){return(this.flags&Wr)!==0}get imageSrcRaw(){return this.type==="image"?ce(this.src):void 0}has(t){return(this.flags&t)!==0}}class Fs{constructor(t,e,s={}){w(this,"nodes",new Map);w(this,"root",null);w(this,"leaving",null);w(this,"leavingAbove",!1);w(this,"pagerShown",new Map);w(this,"pagerLeaving",new Map);w(this,"destKind",-1);w(this,"layerRoots",[]);w(this,"width",0);w(this,"height",0);w(this,"focused",null);w(this,"safeBottom",0);w(this,"shrunkRoot",0);w(this,"shrunkInset",0);w(this,"pressed",new Set);w(this,"gestures",new Map);w(this,"vlists",new Set);w(this,"frameCache",null);w(this,"painted",null);w(this,"fontsPending",0);w(this,"lastToast",null);w(this,"dirty",!0);w(this,"onDestination",null);w(this,"onDropped",null);w(this,"placeholders");w(this,"viewNames",new Map);w(this,"nativeDest",null);w(this,"layoutPtr",0);w(this,"padPtr",0);w(this,"lastCreated",0);w(this,"hoverX",0);w(this,"hoverY",0);w(this,"hoverInside",!1);w(this,"hoverMoved",!1);this.M=t,this.host=e,this.options=s,this.placeholders=new Map(Object.entries(s.nativeViews??{}))}install(){const t=new DataView(new ArrayBuffer(8)),e=(s,r,i,o,a,l)=>{const c=this.measure(r,i,a);return t.setFloat32(4,c.width,!0),t.setFloat32(0,c.height,!0),t.getBigUint64(0,!0)};this.M._setMeasureFunc(this.M.addFunction(e,"jiififi"))}measure(t,e,s){const r=this.nodes.get(t);if(!r)return{width:0,height:0};const i=this.M;ks(i,t)&&(Rs(i,t,r.style),this.resolveBackground(r));const o=r;return r.type==="text"?es(o,this.host,e):r.type==="image"?rs(o,this.host,e,s):r.editable?ns(o,this.host,e):{width:0,height:0}}resize(t,e){this.width=t,this.height=e,this.M._creatorWebResize(t,e),this.M._setConditionValue(t,e),this.dirty=!0}setSafeArea(t,e=[]){const[s,r,i,o]=t??(this.width>this.height?[0,8,0,20]:[20,0,8,0]),a={top:1,right:2,bottom:4,left:8};this.M._setSafeAreaBars(e.reduce((l,c)=>l|a[c],0)),this.M._setSafePaddings(s,r,i,o,0),this.safeBottom=i,this.shrunkRoot&&this.nodes.has(this.shrunkRoot)&&(this.shrunkInset=Math.max(0,i-this.keyboardHeight()),this.M._overrideRootSafeBottom(this.shrunkRoot,this.shrunkInset)),this.dirty=!0}layoutFrame(){const t=this.M;Ts(t,(r,i)=>{const o=this.nodes.get(r);o&&(i(o.style),this.resolveBackground(o))})>0&&(this.dirty=!0);const s=t._creatorWebLayoutFrame(this.width,this.height);s>0&&this.readLayoutBatch(s);for(const r of this.vlists)if(t._vlistExists(r.id)){t._vlistUpdateLayout(r.id);for(const i of r.children)this.deliverSubtree(i)}}needsPaint(){return this.dirty||this.frameCache===null||this.frameCache!==this.painted}deliverSubtree(t){const e=this.M;if(this.layoutPtr||(this.layoutPtr=e._malloc(16)),e._getLayoutPointer(t.id,this.layoutPtr)){const s=this.layoutPtr>>2,r={x:e.HEAPF32[s],y:e.HEAPF32[s+1],width:e.HEAPF32[s+2],height:e.HEAPF32[s+3]},i=t.layoutRect,o=!i||i.x!==r.x||i.y!==r.y||i.width!==r.width||i.height!==r.height;t.layoutRect=r,o&&(this.dirty=!0),o&&t.has(Me)&&e._creatorWebNodeLayout(t.id,r.x,r.y,r.width,r.height)}for(const s of t.children)this.deliverSubtree(s)}readLayoutBatch(t){const e=this.M,s=e._collectNodes()>>>2,r=e._collectRects()>>>2,i=e.HEAPU32,o=e.HEAPF32;for(let a=0;a<t;a++){const l=i[s+a],c=this.nodes.get(l);if(!c)continue;const h=o[r+a*4],u=o[r+a*4+1],f=o[r+a*4+2],d=o[r+a*4+3],p={x:h,y:u,width:f-h,height:d-u},y=c.layoutRect,b=!y||y.x!==p.x||y.y!==p.y||y.width!==p.width||y.height!==p.height;c.layoutRect=p,b&&(this.dirty=!0),b&&c.has(Me)&&e._creatorWebNodeLayout(l,h,u,p.width,p.height)}}frame(){if(this.frameCache&&!this.dirty)return this.frameCache;const t=[],e={x:0,y:0,width:this.width,height:this.height},s=this.nativeDest;if(s){const i={id:0,type:"native",rect:e,style:Os,children:[],view:{name:s.view,label:this.placeholders.get(s.view)}};s.name&&(i.name=s.name),t.push(this.destKind===ct?{tree:i}:{tree:i,leaving:!0})}const r=this.leaving?this.build(this.leaving,e):null;if(r&&!this.leavingAbove&&t.push({tree:r,leaving:!0}),this.root){const i=this.build(this.root,e);i&&t.push({tree:i})}r&&this.leavingAbove&&t.push({tree:r,leaving:!0});for(const i of this.layerRoots){const o=this.build(i,e);o&&t.push({tree:o,widget:!0})}return this.frameCache=t,this.dirty=!1,t}renderTree(){var t;return((t=this.frame().find(e=>!e.widget&&!e.leaving))==null?void 0:t.tree)??null}widgetTrees(){return this.frame().filter(t=>t.widget).map(t=>t.tree)}widgets(){return this.widgetTrees()}serialize(){return En(this.renderTree(),this.widgetTrees())}toText(){return As(this.renderTree(),this.widgetTrees())}paint(t,e){const s=this.frame();ss(s,t,this.host,this.width,this.height,void 0,e),this.painted=s}build(t,e){const s=this.M,r=(i,o,a,l)=>{var x;if(i.style.display==="none")return null;let c,h,u,f;if(l)c=e.x,h=e.y,u=e.width,f=e.height;else{const m=i.layoutRect;if(!m)return null;c=o+m.x,h=a+m.y,u=m.width,f=m.height}const d={id:i.id,type:i.type,rect:{x:c,y:h,width:u,height:f},style:i.style,children:[]};i.name&&(d.name=i.name);const p=i;if(i.type==="text"){const m=ie(p),v=mn(m);d.text=i.text;const _=this.padding(i.id);(_[0]||_[1]||_[2]||_[3])&&(d.padding=_);const T=u-_[0]-_[2],P=`${T}|${v.size}|${v.weight}|${v.italic?1:0}|${v.letterSpacing}|${v.family}|${i.style.lineClamp??0}|${i.style.textOverflow??""}|${i.style.textWrap??""}|${i.text}`;if(((x=i.wrapCache)==null?void 0:x.key)===P)d.lines=i.wrapCache.lines;else{const O=F=>this.host.measureText(F,v),I=yn(i.text,i.style,T,O,!0);i.wrapCache={key:P,lines:I},d.lines=I}d.style={...i.style,color:m.color,fontSize:m.fontSize,fontFamily:m.fontFamily,fontWeight:m.fontWeight,fontStyle:m.fontStyle,lineHeight:m.lineHeight,letterSpacing:m.letterSpacing,textAlign:m.textAlign,textDecoration:m.textDecoration}}else if(i.type==="image"){const m=this.host.resolveSrc(i.imageSrcRaw),v=m?this.host.getImage(m):void 0;d.image=v??(m?{src:m,naturalWidth:0,naturalHeight:0}:void 0),i.sourceRect&&(d.sourceRect=i.sourceRect)}else if(i.editable){d.value=i.value;const m=this.padding(i.id);(m[0]||m[1]||m[2]||m[3])&&(d.padding=m);const v=ie(p);d.style={...i.style,color:v.color,fontSize:v.fontSize,fontFamily:v.fontFamily,fontWeight:v.fontWeight,fontStyle:v.fontStyle,lineHeight:v.lineHeight,letterSpacing:v.letterSpacing,textAlign:v.textAlign,textDecoration:v.textDecoration}}else if(i.type==="native"){const m=i.viewName??"";d.view={name:m,label:this.placeholders.get(m)}}i.type==="widget"&&i.style.overlayColor!==void 0&&(d.overlay=i.style.overlayColor),i.interactive&&(d.state={pressed:this.pressed.has(i.id)}),i.editable&&this.focused===i&&(d.state={...d.state,focused:!0}),i.style.overflow==="hidden"&&(d.clip=!0);let y=c,b=h;if(i.scrollable){const m=i.scrollAxis,v=m==="x"?s._getContentWidth(i.id):s._getContentHeight(i.id);d.clip=!0,d.scroll={offset:i.scrollOffset,content:v,axis:m},m==="x"?y=c-i.scrollOffset:b=h-i.scrollOffset}if(i.type==="pager"){const m=s._creatorWebPagerSelectedIndex(i.id),v=s._creatorWebPagerStackLen(i.id,m),_=v>0?s._creatorWebPagerPageNode(i.id,m,v-1):0,T=_?this.nodes.get(_):void 0;T?this.pagerShown.set(i.id,T):this.pagerShown.delete(i.id);const P=this.pagerLeaving.get(i.id);for(const O of P&&P.page!==T?P.above?[T,P.page]:[P.page,T]:[T]){const I=O?r(O,c,h,!1):null;I&&d.children.push(I)}return d}if(i.type==="vlist"){for(const m of i.children){const v=s._getParentNode(m.id);if(!v)continue;const _=s._vlistItemOffsetOf(i.id,v);if(Number.isNaN(_))continue;const T=r(m,c,h+_-i.scrollOffset,!1);T&&d.children.push(T)}return d}for(const m of i.children){const v=r(m,y,b,!1);v&&d.children.push(v)}return d};return r(t,0,0,!0)}paddingOf(t){return this.padding(t)}padding(t){const e=this.M;this.padPtr||(this.padPtr=e._malloc(16)),e._getPaddingPointer(t,this.padPtr);const s=this.padPtr>>2;return[e.HEAPF32[s],e.HEAPF32[s+1],e.HEAPF32[s+2],e.HEAPF32[s+3]]}withStr(t,e){const s=this.M.stringToNewUTF8(t);try{return e(s)}finally{this.M._free(s)}}get(t){return this.nodes.get(t)}findAll(t){const e=[],s=r=>{r.name===t&&e.push(r);for(const i of r.children)s(i)};for(const r of this.frame())s(r.tree);return e}findRect(t){const e=s=>{if(s.id===t)return s.rect;for(const r of s.children){const i=e(r);if(i)return i}return null};for(const s of this.frame()){const r=e(s.tree);if(r)return r}return null}toast(){return this.lastToast}pendingFonts(){return this.fontsPending}keyboardHeight(){return this.focused?this.options.keyboardHeight?this.options.keyboardHeight():Math.round(this.height*Ps):0}focusedId(){var t;return((t=this.focused)==null?void 0:t.id)??0}nodeFactory(t,e,s,r){this.lastCreated=t;const i=new Is(t,e);this.nodes.set(t,i),e==="vlist"&&this.vlists.add(i);const o=this.nodes.get(s);o&&this.link(o,i,Math.max(0,r)),this.dirty=!0}link(t,e,s){e.parent&&(e.parent.children=e.parent.children.filter(r=>r!==e)),e.parent=t,t.children.splice(Math.min(s,t.children.length),0,e)}insertNode(t,e,s){const r=this.nodes.get(t),i=this.nodes.get(e);r&&i&&this.link(r,i,s),this.dirty=!0}removeNode(t,e){var i;const s=this.nodes.get(t),r=this.nodes.get(e);!s||!r||(this.forget(r),s.children=s.children.filter(o=>o!==r),r.parent===s&&(r.parent=null),((i=this.pagerLeaving.get(t))==null?void 0:i.page)===r&&this.pagerLeaving.delete(t),this.pagerShown.get(t)===r&&this.pagerShown.delete(t),this.dirty=!0)}releaseNode(t){const e=this.nodes.get(t);if(!e)return;this.nodes.delete(t),this.forget(e),e.parent&&(e.parent.children=e.parent.children.filter(r=>r!==e)),this.root===e&&(this.root=null),this.leaving===e&&(this.leaving=null),this.pagerShown.delete(t),this.pagerLeaving.delete(t);for(const[r,i]of this.pagerLeaving)i.page===e&&this.pagerLeaving.delete(r);this.focused===e&&(this.focused=null,this.shrinkTo(0,0),this.emitKeyboard());const s=this.layerRoots.indexOf(e);s>=0&&this.layerRoots.splice(s,1),this.vlists.delete(e),this.pressed.delete(t),e.type==="native"&&e.viewId&&this.viewNames.delete(e.viewId),this.dirty=!0}forget(t){for(const e of this.gestures.values())e.node===t&&(e.node=null),e.scroll===t&&(e.scroll=null),e.backdrop===t&&(e.backdrop=null),e.edit===t&&(e.edit=null);for(const e of t.children)this.forget(e)}setPropertyString(t,e,s){const r=this.nodes.get(t);if(!r)return;const i=s??"";switch(e){case"text":r.text=i,r.wrapCache=void 0;break;case"value":r.value=i;break;case"name":r.name=i||void 0;break;case"src":{r.src=i||void 0;const o=this.host.resolveSrc(this.srcOf(r));o&&!this.host.getImage(o)&&this.host.loadImage(o).then(()=>{this.nodes.get(t)===r&&this.M._nodeHasMeasure(t)&&this.M._markNodeDirty(t),this.dirty=!0}).catch(()=>{});break}case"sourceRect":{const o=i.split(" ").map(Number);r.sourceRect=o.length===4?[o[0],o[1],o[2],o[3]]:void 0;break}case"focus":i==="1"||i==="true"?this.focusInput(t):this.focused===r&&this.blurInput();break;case"viewName":r.viewName=i;break;case"viewParams":r.viewParams=i;break}this.dirty=!0}srcOf(t){return ce(t.src)}resolveBackground(t){const e=t.style.backgroundImage||void 0;if(e!==t.bgRaw){t.bgRaw=e,t.bgSrc=e?this.host.resolveSrc(ce(e)):void 0;const s=t.bgSrc;s&&!this.host.getImage(s)&&this.host.loadImage(s).then(()=>{this.dirty=!0}).catch(()=>{})}t.style.backgroundImage=t.bgSrc}setPropertyInt(t,e,s){const r=this.nodes.get(t);r&&(e==="playerId"?r.playerId=s:e==="viewId"&&(r.viewId=s,r.viewName!==void 0&&this.viewNames.set(s,r.viewName))),this.dirty=!0}setFlags(t,e){const s=this.nodes.get(t);s&&(s.flags=e>>>0)}leave(t){this.root&&(this.leaving=this.root,this.leavingAbove=t,this.root=null)}openView(t,e,s,r,i,o){var l;this.destKind=t;const a=t===Le?this.nodes.get(e)??null:null;if(a!==this.root&&this.leave(!o||a===null),this.leaving===a&&(this.leaving=null),this.root=a,t===ct){this.viewNames.set(s,r);let c;for(const h of this.nodes.values())if(h.type==="native"&&h.viewId===s){c=h.name;break}this.nativeDest=this.placeholders.has(r)?{id:s,view:r,name:c}:null}this.focused&&this.blurInput(),this.dirty=!0,(l=this.onDestination)==null||l.call(this,t,s)}dropView(t,e,s){var r,i;if(t===Le){const o=this.nodes.get(e)??null;o!==null&&this.leaving===o&&(this.leaving=null),o!==null&&this.root===o&&(this.root=null)}t===ct&&((r=this.nativeDest)==null?void 0:r.id)===s&&this.destKind!==ct&&(this.nativeDest=null),this.dirty=!0,(i=this.onDropped)==null||i.call(this,t,s)}closeView(){var t;this.destKind=-1,this.leave(!0),this.dirty=!0,(t=this.onDestination)==null||t.call(this,-1,0)}isViewSupported(t){return this.placeholders.has(t)}viewVersion(t){return this.placeholders.has(t)?1:0}viewCall(t,e,s,r,i){const o=this.viewNames.get(t);i(o!==void 0&&this.placeholders.has(o)?`headless draws native views only: ${o}.${e}`:"NativeView calls are not supported on this host")}layerOpen(t){const e=this.nodes.get(t);e&&!this.layerRoots.includes(e)&&this.layerRoots.push(e),this.dirty=!0}layerClose(t){const e=this.nodes.get(t);for(const r of this.gestures.values())r.backdrop===e&&(r.backdrop=null);const s=e?this.layerRoots.indexOf(e):-1;s>=0&&this.layerRoots.splice(s,1),this.dirty=!0}registerFont(t,e,s,r,i,o){this.fontsPending++,this.host.loadFont(e,t,{weight:s,style:r===2?"italic":"normal"}).then(()=>{this.invalidateText(),i()},a=>o(String(a))).finally(()=>{this.fontsPending--})}invalidateText(){for(const t of this.nodes.values())t.wrapCache=void 0,t.measured&&t.type!=="image"&&this.M._nodeHasMeasure(t.id)&&this.M._markNodeDirty(t.id);this.dirty=!0}showToast(t,e){var s,r;this.lastToast=t,(r=(s=this.options).onToast)==null||r.call(s,t,e)}getButtonPressed(t){return this.pressed.has(t)}getTextValue(t){var e;return((e=this.nodes.get(t))==null?void 0:e.value)??""}getBoundingRect(t){const e=this.findRect(t);return e?[e.x,e.y,e.width,e.height]:null}longPressHandler(t,e){const s=this.gestures.get(t);s&&(s.swallowClick=!0)}vlistScroll(t,e,s){const r=this.nodes.get(t);r&&(r.scrollOffset=e),this.dirty=!0}pagerCommand(t,e,s){this.pagerLeaving.delete(t),this.dirty=!0}pagerShowPage(t,e,s){const r=this.nodes.get(e),i=this.pagerShown.get(t);r&&this.pagerShown.set(t,r),i&&i!==r&&this.pagerLeaving.set(t,{page:i,above:!s}),this.dirty=!0}pagerDropPage(t,e){var s;((s=this.pagerLeaving.get(t))==null?void 0:s.page.id)===e&&this.pagerLeaving.delete(t),this.dirty=!0}refreshDone(t){}rootOf(t){let e=t;for(;e.parent&&e.type!=="widget";)e=e.parent;return e}emitKeyboard(){var s,r;const t=this.keyboardHeight(),e=this.keyboardDuration();(r=(s=this.options).onKeyboard)==null||r.call(s,t,e),this.M._creatorWebKeyboardEvent(t,e)}shrinkTo(t,e){this.M._creatorWebSetShrunkRoot(t,e);const s=e>0?t:0;s!==this.shrunkRoot&&(this.shrunkRoot&&this.nodes.has(this.shrunkRoot)&&this.M._overrideRootSafeBottom(this.shrunkRoot,this.safeBottom),this.shrunkRoot=s,this.shrunkInset=this.safeBottom);const r=Math.max(0,this.safeBottom-e);s&&r!==this.shrunkInset&&this.nodes.has(s)&&(this.M._overrideRootSafeBottom(s,r),this.shrunkInset=r)}keyboardDuration(){return 0}refreshKeyboard(){this.focused&&(this.shrinkTo(this.rootOf(this.focused).id,this.keyboardHeight()),this.emitKeyboard(),this.dirty=!0)}focusInput(t){const e=this.nodes.get(t);!e||!e.editable||this.focused===e||(this.focused&&this.blurInput(),this.focused=e,this.M._setNodeFocused(t,1),e.has(zr)&&this.M._creatorWebNodeEvent(t,Fr),this.shrinkTo(this.rootOf(e).id,this.keyboardHeight()),this.emitKeyboard(),this.dirty=!0)}blurInput(){const t=this.focused;t&&(this.focused=null,this.M._setNodeFocused(t.id,0),t.has(Kr)&&this.M._creatorWebNodeEvent(t.id,Nr),this.shrinkTo(0,0),this.emitKeyboard(),this.dirty=!0)}setInputValue(t,e){const s=this.nodes.get(t);s&&(s.value=e,s.has(jr)&&this.withStr(e,r=>this.M._creatorWebNodeEventStr(t,Ir,r)),this.M._nodeHasMeasure(t)&&this.M._markNodeDirty(t),this.dirty=!0)}submitInput(){const t=this.focused;return t?(t.has(Xr)&&this.withStr(t.value,e=>this.M._creatorWebNodeEventStr(t.id,Ur,e)),this.focused===t&&this.blurInput(),!0):!1}scrollMax(t){const e=this.findRect(t.id)??t.layoutRect??{width:0,height:0},s=t.scrollAxis==="x"?e.width:e.height,r=t.scrollAxis==="x"?this.M._getContentWidth(t.id):this.M._getContentHeight(t.id);return Math.max(0,r-s)}scrollBy(t,e){const s=this.nodes.get(t);if(!s||!s.scrollable)return!1;const r=this.scrollMax(s),i=s.scrollOffset+e,o=Math.min(r,Math.max(0,i)),a=i<0?i:i>r?i-r:0;return a!==0&&s.has(Vr)&&this.M._creatorWebNodeEventNum(t,Cr,a),o===s.scrollOffset?!1:(s.scrollOffset=o,s.type==="vlist"&&this.M._vlistExists(t)&&this.M._vlistOnScroll(t,o),s.has($r)&&this.M._creatorWebNodeScroll(t,o),this.dirty=!0,!0)}topInteractive(t,e){const s=this.frame();for(let r=s.length-1;r>=0;r--){const i=yt(s[r].tree,t,e,o=>{var a;return((a=this.nodes.get(o.id))==null?void 0:a.interactive)??!1});if(i.node)return this.nodes.get(i.node.id)??null;if(i.blocker)return null}return null}setPressed(t,e){e?this.pressed.add(t.id):this.pressed.delete(t.id),this.nodes.get(t.id)===t&&this.M._setNodePressed(t.id,e?1:0),this.dirty=!0}pointerHover(t,e){this.hoverX=t,this.hoverY=e,this.hoverInside=!0,this.hoverMoved=!0}pointerLeave(){this.hoverInside&&(this.hoverInside=!1,this.hoverMoved=!0)}get hasHover(){return typeof this.M._creatorWebHover=="function"}tickHover(){if(!this.hasHover||!this.hoverMoved&&!this.dirty)return;this.hoverMoved=!1;const t=this.hoverInside?this.topInteractive(this.hoverX,this.hoverY):null;this.M._creatorWebHover((t==null?void 0:t.id)??0,this.hoverX,this.hoverY)}pointerDown(t,e,s){const r=this.M;r._creatorWeb2dSceneOpen()&&r._creatorWeb2dEmitPointer(0,t,e,s);const i={node:null,scroll:null,backdrop:null,edit:null,global:!1,dismiss:!0,lastX:e,lastY:s,acc:0,scrolling:!1,swallowClick:!1};this.gestures.set(t,i);const o=this.frame();for(let a=o.length-1;a>=0;a--){const l=yt(o[a].tree,e,s,c=>{var h;return((h=this.nodes.get(c.id))==null?void 0:h.editable)??!1});if(l.node){const c=this.nodes.get(l.node.id);this.focusInput(c.id),i.edit=c,i.dismiss=!1;return}if(l.blocker)break}for(let a=o.length-1;a>=0;a--){const l=o[a],c=yt(l.tree,e,s,f=>{var d;return((d=this.nodes.get(f.id))==null?void 0:d.interactive)??!1}),h=yt(l.tree,e,s,f=>!!f.scroll&&f.scroll.content>(f.scroll.axis==="x"?f.rect.width:f.rect.height)+.5),u=h.node?this.nodes.get(h.node.id)??null:null;if(c.node){const f=this.nodes.get(c.node.id);i.node=f,i.scroll=u,i.dismiss=f.type!=="button",this.setPressed(f,!0),r._creatorWebNodeTouchStart(f.id,t,e,s);return}if(u){i.scroll=u;return}if(c.blocker){i.backdrop=c.outside?this.nodes.get(c.blocker.id)??null:null;return}}i.global=!0,r._creatorWebSceneTouchStart(t,e,s)}pointerMove(t,e,s){const r=this.gestures.get(t);if(!r)return;const i=this.M;i._creatorWeb2dSceneOpen()&&i._creatorWeb2dEmitPointer(1,t,e,s);const o=e-r.lastX,a=s-r.lastY;if(r.lastX=e,r.lastY=s,r.acc+=Math.abs(o)+Math.abs(a),!r.edit){if(!r.scrolling&&r.scroll&&r.acc>Cs&&(r.scrolling=!0,r.node&&this.setPressed(r.node,!1)),r.scrolling&&r.scroll){this.scrollBy(r.scroll.id,r.scroll.scrollAxis==="x"?-o:-a);return}i._creatorWebTouchMove(t,e,s,o,a)}}pointerUp(t,e,s){const r=this.gestures.get(t);if(!r)return;this.gestures.delete(t);const i=this.M;i._creatorWeb2dSceneOpen()&&i._creatorWeb2dEmitPointer(2,t,e,s);const o=e-r.lastX,a=s-r.lastY;i._creatorWebTouchEnd(t,e,s,o,a),!r.edit&&(r.scrolling&&r.scroll&&r.scroll.has(Gr)&&i._creatorWebNodeEvent(r.scroll.id,Or),r.dismiss&&!r.scrolling&&this.focused&&this.blurInput(),r.node?(this.setPressed(r.node,!1),!r.scrolling&&!r.swallowClick&&this.topInteractive(e,s)===r.node&&r.node.has(Dr)&&i._creatorWebNodeClick(r.node.id,t,e,s)):r.backdrop?!r.scrolling&&r.backdrop.has(Yr)&&i._creatorWebNodeEvent(r.backdrop.id,Br):r.global&&(r.scrolling||i._creatorWebSceneTouchClick(t,e,s)))}pointerCancel(t){const e=this.gestures.get(t);if(!e)return;this.gestures.delete(t);const s=this.M;s._creatorWeb2dSceneOpen()&&s._creatorWeb2dEmitPointer(3,t,e.lastX,e.lastY),e.node&&this.setPressed(e.node,!1),s._creatorWebTouchCancel(t)}wheel(t,e,s,r){const i=this.frame();for(let o=i.length-1;o>=0;o--){const a=yt(i[o].tree,t,e,l=>!!l.scroll&&l.scroll.content>(l.scroll.axis==="x"?l.rect.width:l.rect.height)+.5);if(a.node){const l=this.nodes.get(a.node.id);return l?this.scrollBy(l.id,l.scrollAxis==="x"?s:r):!1}if(a.blocker)return!1}return!1}longPress(t,e,s){const r=this.gestures.get(t);r!=null&&r.node&&r.node.has(Hr)&&this.M._creatorWebNodeLongPress(r.node.id,t,e,s)}isVlist(t){return this.vlists.has(t)}}const Ns=`
11
11
  .lc-field { position: absolute; left: 0; top: 0; margin: 0; border: none; outline: none; background: none; resize: none; box-sizing: border-box; transform-origin: 0 0; pointer-events: auto; overflow: hidden; -webkit-appearance: none; appearance: none; }
12
12
  .lc-field::placeholder { color: var(--lc-placeholder, #999); opacity: 1; }
13
- `,Ie=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),Us=n=>n.type==="native"||n.type==="video",Bs=[1,0,0,1,0,0],Gt=(n,t)=>[n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]],Ws=(n,t)=>{if(!n)return t;const e=Math.max(n.x,t.x),s=Math.max(n.y,t.y);return{x:e,y:s,width:Math.max(0,Math.min(n.x+n.width,t.x+t.width)-e),height:Math.max(0,Math.min(n.y+n.height,t.y+t.height)-s)}};class It extends Fs{constructor(e,s,r,i,o={}){super(e,s,o);w(this,"doc");w(this,"factories",new Map);w(this,"versions",new Map);w(this,"views",new Map);w(this,"wrappers",new Map);w(this,"shown",new Map);w(this,"destination",null);w(this,"field",null);w(this,"placedFor",null);w(this,"band",{root:0,height:0});w(this,"slide",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=Ns,i.appendChild(a)}paintOptions(){var e;return{surfaces:!0,editing:(e=this.field)==null?void 0:e.id}}registerView(e,s,r=1){this.factories.set(e,s),this.versions.set(e,r)}unregisterView(e){this.factories.delete(e),this.versions.delete(e)}isViewSupported(e){return this.factories.has(e)}viewVersion(e){return this.versions.get(e)??0}ensureView(e,s,r){const i=this.views.get(e);if(i&&(i.name!==s||i.params!==r))this.destroyView(e);else if(i)return i.handle;const o=this.factories.get(s);if(!o)return null;let a={};try{a=r?JSON.parse(r):{}}catch{}const l=o(a,{emit:(c,h)=>this.M.jsb.viewEvent(e,c,h)},this.doc);return l.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:l}),l}destroyView(e){var r,i;const s=this.views.get(e);s&&(this.views.delete(e),(i=(r=s.handle).destroy)==null||i.call(r),s.handle.el.remove())}viewCall(e,s,r,i,o){const a=this.views.get(e);if(!(a!=null&&a.handle.call)){o(`NativeView call "${s}": no live instance or no call handler (viewId ${e})`);return}try{Promise.resolve(a.handle.call(s,Array.isArray(r)?r:[])).then(l=>{l===void 0?i():i(l)},l=>o(l instanceof Error?l.message:String(l)))}catch(l){o(l instanceof Error?l.message:String(l))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==ct)return;this.dropDestination();const l=this.ensureView(r,i,o);if(!l)return;const c=this.doc.createElement("div");c.style.cssText="position:absolute;inset:0;pointer-events:auto;",c.appendChild(l.el),this.under.prepend(c),this.destination={viewId:r,el:c}}dropView(e,s,r){var i;super.dropView(e,s,r),e===ct&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==ct&&this.dropDestination()}dropDestination(){var e;(e=this.destination)==null||e.el.remove(),this.destination=null}releaseNode(e){var r,i;const s=this.get(e);((r=this.field)==null?void 0:r.id)===e&&this.unmountField(),super.releaseNode(e),(i=this.shown.get(e))==null||i.remove(),this.shown.delete(e),this.wrappers.delete(e),(s==null?void 0:s.type)==="native"&&s.viewId&&this.destroyView(s.viewId)}keyboardDuration(){return ye}shrinkTo(e,s){const r=this.doc.defaultView;if(!r){super.shrinkTo(e,s);return}this.slide&&(r.cancelAnimationFrame(this.slide.raf),this.slide=null);const i=s>0?e:this.band.root,o=this.band.height;if(o===s||i===0||!this.nodes.has(i)){this.setBand(i,s);return}const a=r.performance.now(),l=()=>{const c=Math.min(1,(r.performance.now()-a)/ye),h=Wn(c);this.setBand(i,c<1?Math.round(o+(s-o)*h):s),c<1?this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(l)}:this.slide=null};this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(l)}}setBand(e,s){this.band=s>0?{root:e,height:s}:{root:0,height:0},super.shrinkTo(this.band.root,this.band.height),this.dirty=!0}focusInput(e){var i;if(super.focusInput(e),this.focusedId()!==e||((i=this.field)==null?void 0:i.id)===e)return;this.unmountField();const s=this.get(e);if(!s)return;const r=this.doc.createElement(s.type==="textarea"?"textarea":"input");r.className="lc-field",r.setAttribute("autocomplete","off"),r.value=s.value,r.addEventListener("input",()=>{this.focusedId()===e&&this.setInputValue(e,r.value)}),r.addEventListener("keydown",o=>{o.key==="Enter"&&r.tagName==="INPUT"&&(o.preventDefault(),this.submitInput())}),r.addEventListener("blur",()=>{var o;((o=this.field)==null?void 0:o.el)===r&&this.focusedId()===e&&this.blurInput()}),this.over.appendChild(r),this.field={id:e,el:r},this.placedFor=null,this.place(),r.focus({preventScroll:!0})}blurInput(){super.blurInput(),this.unmountField()}unmountField(){const e=this.field;e&&(this.field=null,e.el.remove(),this.placedFor=null)}setPropertyString(e,s,r){var i,o;if(super.setPropertyString(e,s,r),s==="value"&&((i=this.field)==null?void 0:i.id)===e){const a=((o=this.get(e))==null?void 0:o.value)??"";this.field.el.value!==a&&(this.field.el.value=a)}}find(){var i;const e=[],s=(i=this.field)==null?void 0:i.id,r=(o,a,l)=>{let c=a;const h=o.style.transform;if(h){const f=o.style.transformOrigin,d=o.rect.x+(f?f.xPercent?o.rect.width*f.x/100:f.x:o.rect.width/2),p=o.rect.y+(f?f.yPercent?o.rect.height*f.y/100:f.y:o.rect.height/2),y=bn(h,o.style.transformBox,o.rect.width,o.rect.height);c=Gt(Gt(Gt(a,[1,0,0,1,d,p]),y),[1,0,0,1,-d,-p])}(Us(o)||o.id===s)&&e.push({node:o,matrix:c,clip:l});const u=o.clip?Ws(l,o.rect):l;for(const f of o.children)r(f,c,u)};for(const o of this.frame())r(o.tree,Bs,null);return e}static put(e,s){const{rect:r}=s.node,i=e.style;i.position="absolute",i.left="0",i.top="0",i.width=r.width+"px",i.height=r.height+"px",i.transformOrigin="0 0",i.transform=`matrix(${s.matrix.join(",")}) translate(${r.x}px,${r.y}px)`;const o=s.clip;i.clipPath=o?`inset(${Math.max(0,o.y-r.y)}px ${Math.max(0,r.x+r.width-(o.x+o.width))}px ${Math.max(0,r.y+r.height-(o.y+o.height))}px ${Math.max(0,o.x-r.x)}px)`:""}surfaceElement(e){const s=this.get(e.id);if(!s)return null;if(s.type==="video"){const o=de(s.playerId);return o instanceof HTMLVideoElement?o:null}if(!s.viewId)return null;const r=this.ensureView(s.viewId,s.viewName??"",s.viewParams??"");if(!r)return null;let i=this.wrappers.get(s.id);return i||(i=this.doc.createElement("div"),this.wrappers.set(s.id,i)),r.el.parentElement!==i&&i.replaceChildren(r.el),i}styleField(e,s){var u,f;const r=s.style,i=e.style,[o,a,l,c]=s.padding??[0,0,0,0];i.padding=`${a}px ${l}px ${c}px ${o}px`,i.color=Ie(r.color,"#000000ff"),i.caretColor=i.color;const h=r.fontFamily??"Roboto";if(i.fontFamily=((f=(u=this.host).resolveFontFamily)==null?void 0:f.call(u,h))??h,i.fontSize=(r.fontSize??14)+"px",i.fontWeight=String(r.fontWeight??400),i.fontStyle=r.fontStyle??"normal",i.letterSpacing=(r.letterSpacing??0)+"px",i.lineHeight=e.tagName==="TEXTAREA"&&r.lineHeight!==void 0?r.lineHeight+"px":"normal",i.textAlign=r.textAlign==="center"?"center":r.textAlign==="end"?"right":"left",i.borderRadius="0",e.placeholder=r.placeholder??"",i.setProperty("--lc-placeholder",Ie(r.placeholderColor,"#999999ff")),e instanceof HTMLInputElement){const d=r.inputType??"text";e.type!==d&&(e.type=d)}}place(){var r;const e=this.frame();if(e===this.placedFor)return;this.placedFor=e;const s=new Set;for(const i of this.find()){const{node:o}=i;if(o.id===((r=this.field)==null?void 0:r.id)){this.styleField(this.field.el,o),It.put(this.field.el,i);continue}const a=this.surfaceElement(o);a&&(s.add(o.id),a.parentElement!==this.under&&this.under.appendChild(a),a.style.display="block",a.style.opacity="",a.style.pointerEvents="auto",a instanceof HTMLVideoElement&&(a.style.objectFit=o.style.objectFit??"contain"),It.put(a,i),this.shown.set(o.id,a))}for(const[i,o]of this.shown)s.has(i)||(o.style.display="none",this.shown.delete(i))}surfaceAt(e,s){const r=this.frame();for(let i=r.length-1;i>=0;i--){const o=r[i];if(o.leaving)continue;const a=yt(o.tree,e,s,l=>{var c,h;return l.type==="native"||(((c=this.get(l.id))==null?void 0:c.interactive)??!1)||(((h=this.get(l.id))==null?void 0:h.editable)??!1)||!!l.scroll});if(a.node)return a.node.type==="native";if(a.blocker)return!1}return this.destination!==null}dispose(){this.unmountField();for(const e of[...this.views.keys()])this.destroyView(e);this.dropDestination();for(const e of this.shown.values())e instanceof HTMLVideoElement||e.remove();this.shown.clear()}}function Ds(n,t,e,s){const r=n.createElement("div");r.textContent=e,r.style.cssText="position:absolute;left:50%;bottom:48px;transform:translateX(-50%);max-width:80%;padding:10px 16px;border-radius:8px;background:rgba(30,30,30,0.92);color:#fff;font:13px/1.4 system-ui,sans-serif;z-index:30;pointer-events:none;",t.appendChild(r),setTimeout(()=>r.remove(),s>0?s:2e3)}const Hs=500,Fe=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],$s=(n,t)=>{const e=n.ownerDocument,{canvas:s}=t;s.style.display="block",s.style.pointerEvents="none",n.style.touchAction="none";const r=s.getContext("2d"),i=()=>{const g=e.createElement("div");return g.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",g},o=i(),a=i();n.insertBefore(o,s),s.after(a);const l=new wr({resolveAssetUrl:g=>an(g),canvasSurfaces:t.canvasHost}),c=new It(t.M,l,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onKeyboard:t.onKeyboard,onToast:(g,M)=>Ds(e,n,g,M)});let h=1,u=new Ae(r,h),f=!0;const d=()=>{(f||c.needsPaint())&&(f=!1,c.paint(u,c.paintOptions())),c.place()},p=(g,M,A)=>{g<=0||M<=0||(A!==h&&(h=A,u=new Ae(r,h)),f=!0,c.resize(g,M))},y=g=>{c.setSafeArea([g.top,g.right,g.bottom,g.left],g.bars??[])},b=g=>{const M=n.getBoundingClientRect(),A=fe(n);return[(g.clientX-M.left)/A,(g.clientY-M.top)/A]},x=g=>g.target instanceof Node&&a.contains(g.target),m=g=>g.target instanceof Node&&o.contains(g.target),v=g=>{m(g)&&g.stopPropagation()},_=new Set,T=new Map,P=g=>{const M=T.get(g);M!==void 0&&(clearTimeout(M),T.delete(g))},O=g=>{if(x(g))return;const[M,A]=b(g);if(!c.surfaceAt(M,A)){v(g),_.add(g.pointerId);try{n.setPointerCapture(g.pointerId)}catch{}c.pointerDown(g.pointerId,M,A),P(g.pointerId),T.set(g.pointerId,window.setTimeout(()=>{T.delete(g.pointerId),c.longPress(g.pointerId,M,A)},Hs))}},I=g=>{const[M,A]=b(g);_.has(g.pointerId)&&(v(g),c.pointerMove(g.pointerId,M,A)),g.pointerType==="mouse"&&(x(g)||!_.has(g.pointerId)&&c.surfaceAt(M,A)?c.pointerLeave():c.pointerHover(M,A))},F=g=>{g.pointerType==="mouse"&&c.pointerLeave()},$=g=>{if(!_.delete(g.pointerId))return;v(g),P(g.pointerId);const[M,A]=b(g);c.pointerUp(g.pointerId,M,A)},z=g=>{_.delete(g.pointerId)&&(P(g.pointerId),c.pointerCancel(g.pointerId))},G=g=>{if(x(g))return;const[M,A]=b(g);if(c.surfaceAt(M,A))return;v(g);const W=g.deltaMode===1?16:g.deltaMode===2?c.height:1;c.wheel(M,A,g.deltaX*W,g.deltaY*W)&&g.preventDefault()},Y=g=>{var q;if(x(g))return;const M="clientX"in g?g:(q=g.changedTouches)==null?void 0:q[0];if(!M)return;const[A,W]=b(M);c.surfaceAt(A,W)||(v(g),g.type==="mousedown"&&g.preventDefault())};n.addEventListener("pointerdown",O,!0),n.addEventListener("pointermove",I,!0),n.addEventListener("pointerleave",F),n.addEventListener("pointerup",$,!0),n.addEventListener("pointercancel",z,!0),n.addEventListener("wheel",G,{passive:!1,capture:!0});for(const g of Fe)n.addEventListener(g,Y,!0);return{ui:c,render:d,resize:p,setSafeArea:y,destroy(){for(const g of T.keys())P(g);n.removeEventListener("pointerdown",O,!0),n.removeEventListener("pointermove",I,!0),n.removeEventListener("pointerleave",F),n.removeEventListener("pointerup",$,!0),n.removeEventListener("pointercancel",z,!0),n.removeEventListener("wheel",G,!0);for(const g of Fe)n.removeEventListener(g,Y,!0);c.dispose(),o.remove(),a.remove()}}},Vs=["miter","round","bevel"],Gs=["butt","round","square"],js=["left","center","right","start","end"],zs=["alphabetic","top","middle","bottom","hanging","ideographic"],Ne=["nonzero","evenodd"],Ks=["pad","reflect","repeat"],jt={COLOR:0,RADIAL:2},xt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},K={SET_TRANSFORM:0,SAVE:1,RESTORE:2,CLIP:3,FILL_PATH:4,STROKE_PATH:5,FILL_TEXT:6,STROKE_TEXT:7,DRAW_IMAGE:8,CLEAR_RECT:9};class Xs{constructor(t,e){w(this,"pos",0);this.w=t,this.strings=e}f(){if(this.pos>=this.w.length)throw new Error("draw list: truncated");return this.w[this.pos++]}i(){return this.f()|0}str(){const t=this.i();if(t<0||t>=this.strings.length)throw new Error(`draw list: bad string index ${t}`);return this.strings[t]}color(){return[this.f(),this.f(),this.f(),this.f()]}matrix(){return[this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]}paint(){const t=this.i(),e=this.f();if(t===jt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===jt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=Ks[this.i()]??"pad",l=this.i(),c=[];for(let h=0;h<l;h++)c.push({offset:this.f(),color:this.color()});return t===jt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:c}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:c}}stroke(){const t=this.f(),e=Vs[this.i()]??"miter",s=Gs[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let l=0;l<o;l++)a.push(this.f());return{width:t,join:e,cap:s,miterLimit:r,dashOffset:i,dash:a}}font(){return{family:this.str(),size:this.f(),weight:this.i(),italic:this.i()!==0}}path(){const t=this.i(),e=this.pos+t;if(e>this.w.length)throw new Error("draw list: truncated path");const s=[];for(;this.pos<e;)switch(this.i()){case xt.MOVE:s.push(["M",this.f(),this.f()]);break;case xt.LINE:s.push(["L",this.f(),this.f()]);break;case xt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case xt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case xt.CLOSE:s.push(["Z"]);break;default:throw new Error("draw list: bad path verb")}return s}rect4(){return[this.f(),this.f(),this.f(),this.f()]}}const Ys=(n,t)=>{const e=new Xs(n,t),s=[];for(;e.pos+2<=n.length;){const r=e.i(),i=e.i(),o=e.pos+i;if(i<0||o>n.length)throw new Error("draw list: truncated command");switch(r){case K.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case K.SAVE:s.push({cmd:"save"});break;case K.RESTORE:s.push({cmd:"restore"});break;case K.CLIP:{const a=Ne[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case K.FILL_PATH:{const a=Ne[e.i()]??"nonzero",l=e.paint();s.push({cmd:"fillPath",rule:a,paint:l,path:e.path()});break}case K.STROKE_PATH:{const a=e.stroke(),l=e.paint();s.push({cmd:"strokePath",stroke:a,paint:l,path:e.path()});break}case K.FILL_TEXT:case K.STROKE_TEXT:{const a=e.str(),l=e.f(),c=e.f(),h=e.f(),u=e.font(),f=js[e.i()]??"start",d=zs[e.i()]??"alphabetic",p=e.f();if(r===K.STROKE_TEXT){const y=e.stroke();s.push({cmd:"strokeText",text:a,x:l,y:c,maxWidth:h,font:u,align:f,baseline:d,letterSpacing:p,stroke:y,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:l,y:c,maxWidth:h,font:u,align:f,baseline:d,letterSpacing:p,paint:e.paint()});break}case K.DRAW_IMAGE:{const a=e.i(),l=e.rect4(),c=e.rect4();s.push({cmd:"drawImage",surface:a,src:l,dst:c,alpha:e.f()});break}case K.CLEAR_RECT:s.push({cmd:"clearRect",rect:e.rect4()});break}if(e.pos!==o){if(e.pos>o)throw new Error(`draw list: command ${r} overran its length`);e.pos=o}}return s},qs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),Sn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,_n=(n,t=n.family)=>{const e=qs.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Mt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Js=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,zt=(n,t)=>{n.beginPath();for(const e of t)switch(e[0]){case"M":n.moveTo(e[1],e[2]);break;case"L":n.lineTo(e[1],e[2]);break;case"Q":n.quadraticCurveTo(e[1],e[2],e[3],e[4]);break;case"C":n.bezierCurveTo(e[1],e[2],e[3],e[4],e[5],e[6]);break;case"Z":n.closePath();break}},Ue=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,Sn(e.color))},Lt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=Sn(t.color),s();return}const r=t.matrix;if(Js(r)){let o;if(t.kind==="linear"){const[a,l]=Mt(r,0,0),[c,h]=Mt(r,1,0);o=n.createLinearGradient(a,l,c,h)}else{const a=Math.hypot(r[0],r[1]),[l,c]=Mt(r,0,0),[h,u]=Mt(r,t.fx,t.fy);o=n.createRadialGradient(h,u,t.r0*a,l,c,a)}Ue(o,t),n[e==="fill"?"fillStyle":"strokeStyle"]=o,s();return}n.save(),n.transform(r[0],r[1],r[2],r[3],r[4],r[5]);const i=t.kind==="linear"?n.createLinearGradient(0,0,1,0):n.createRadialGradient(t.fx,t.fy,t.r0,0,0,1);Ue(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Be=(n,t)=>{n.lineWidth=t.width,n.lineJoin=t.join,n.lineCap=t.cap,n.miterLimit=t.miterLimit,n.setLineDash(t.dash),n.lineDashOffset=t.dashOffset},We=(n,t,e)=>{n.font=_n(t.font,e.fontFamily?e.fontFamily(t.font.family):t.font.family),n.textAlign=t.align,n.textBaseline=t.baseline,"letterSpacing"in n&&(n.letterSpacing=`${t.letterSpacing}px`)},Qs=(n,t,e={})=>{var r;n.save();let s=0;try{n.setTransform(1,0,0,1,0,0),n.globalAlpha=1;for(const i of t)switch(i.cmd){case"setTransform":n.setTransform(i.matrix[0],i.matrix[1],i.matrix[2],i.matrix[3],i.matrix[4],i.matrix[5]);break;case"save":n.save(),s++;break;case"restore":s>0&&(n.restore(),s--);break;case"clip":zt(n,i.path),n.clip(i.rule);break;case"fillPath":zt(n,i.path),Lt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":zt(n,i.path),Be(n,i.stroke),Lt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":We(n,i,e),Lt(n,i.paint,"fill",()=>i.maxWidth>0?n.fillText(i.text,i.x,i.y,i.maxWidth):n.fillText(i.text,i.x,i.y));break;case"strokeText":We(n,i,e),Be(n,i.stroke),Lt(n,i.paint,"stroke",()=>i.maxWidth>0?n.strokeText(i.text,i.x,i.y,i.maxWidth):n.strokeText(i.text,i.x,i.y));break;case"drawImage":{const o=(r=e.image)==null?void 0:r.call(e,i.surface);if(!o)break;n.globalAlpha=i.alpha,n.drawImage(o,i.src[0],i.src[1],i.src[2],i.src[3],i.dst[0],i.dst[1],i.dst[2],i.dst[3]);break}case"clearRect":n.clearRect(i.rect[0],i.rect[1],i.rect[2],i.rect[3]);break;default:{const o=i;throw new Error(`unhandled draw command ${o.cmd}`)}}}finally{for(;s>0;s--)n.restore();n.restore()}},Zs=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(c,h,u)=>{if(!t)return null;let f=e.get(c);return f?(f.width!==h||f.height!==u)&&(f.width=h,f.height=u):(f=new OffscreenCanvas(h,u),e.set(c,f)),f},i={paint:(c,h,u,f,d,p)=>{const y=r(c,Math.max(1,h),Math.max(1,u)),b=y==null?void 0:y.getContext("2d");!y||!b||(b.setTransform(1,0,0,1,0,0),b.clearRect(0,0,y.width,y.height),Qs(b,Ys(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(c,h,u,f,d,p)=>{if(p[0]=0,p[1]=0,p[2]=0,!t||(s||(s=new OffscreenCanvas(1,1).getContext("2d")),!s))return;s.font=_n({family:h,size:u,weight:f,italic:d},h);const y=s.measureText(c);p[0]=y.width,p[1]=y.fontBoundingBoxAscent??y.actualBoundingBoxAscent,p[2]=y.fontBoundingBoxDescent??y.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(c,h)=>{const u=o(c);return u?(h[0]=u.width,h[1]=u.height,new Uint8Array(u.data.buffer,u.data.byteOffset,u.data.byteLength)):null},releaseSurface:c=>{e.delete(c)}},o=c=>{const h=e.get(c),u=h==null?void 0:h.getContext("2d");return!h||!u?null:{data:u.getImageData(0,0,h.width,h.height).data,width:h.width,height:h.height}};return{table:i,readSurface:o,getSurface:c=>{const h=e.get(c);return h?{canvas:h,width:h.width,height:h.height}:null},surfaceToDataUrl:c=>{var f;const h=e.get(c);if(!h||typeof document>"u")return null;const u=document.createElement("canvas");return u.width=h.width,u.height=h.height,(f=u.getContext("2d"))==null||f.drawImage(h,0,0),u.toDataURL()}}},ti=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,ei=(n,t="woff2")=>{const e=/^\/\/ fonts: (.+)$/m.exec(n);if(!e)return[];const s=[];for(const r of e[1].split(";")){const i=r.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(r.slice(0,i));o&&s.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:r.slice(i+1).replace("{fmt}",t)})}return s},ni=async(n,t,e=2e3)=>{const s=t??(typeof document>"u"?void 0:document);if(!(s!=null&&s.fonts)||n.length===0)return;const r=[];for(const i of n)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});s.fonts.add(o),r.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(r),new Promise(i=>setTimeout(i,e))])},kn="Roboto",ri=[`400 14px ${kn}`],De="data-lecodes-fonts",si=async(n=ri,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${De}]`)){const s=new URL(ti,document.baseURI).href,r=e.createElement("style");r.setAttribute(De,""),r.textContent=`@font-face{font-family:"${kn}";src:url("${s}") format("woff2");font-weight:100 900;font-display:swap}`,e.head.appendChild(r)}try{await Promise.all(n.map(s=>e.fonts.load(s)))}catch{}}},He="2.3.1",Kt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},ii=(n,t)=>Kt(n)!==null&&Kt(n)===Kt(t),oi=()=>({setMatrix(){},setVisible(){},setCameraMatrix(){},setProjection(){},clearProjection(){},setBackground(){},createExternalTexture:()=>null,onFrame:()=>()=>{},readPixels:(n,t)=>t(null,0,0),viewport:()=>({width:0,height:0,rotation:0})}),ai=n=>{var s,r;const t=((r=(s=n.screen)==null?void 0:s.orientation)==null?void 0:r.angle)??n.orientation??0;return(Math.round(t/90)%4+4)%4*90},ci=(n,t)=>({width:(n==null?void 0:n.clientWidth)??0,height:(n==null?void 0:n.clientHeight)??0,rotation:ai(t)}),li=[1,0,0,0,1,0],hi=(n,t,e)=>{const s=t*4,r=new Uint8Array(s);for(let i=0,o=e-1;i<o;i++,o--)r.set(n.subarray(i*s,i*s+s)),n.copyWithin(i*s,o*s,o*s+s),n.set(r,o*s);return n},ui=[171,75,84,88,32,50,48,187,13,10,26,10],fi=n=>n.length>=12&&ui.every((t,e)=>n[e]===t),di=(n,t)=>{const e={antialias:!1,depth:!0,alpha:!1,stencil:!1,desynchronized:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"high-performance",premultipliedAlpha:!0,preserveDrawingBuffer:t},s=n.newCanvas(),r=s.getContext("webgl2",e);if(!r)throw new Error("WebGL2 is not available");let i=null,o=!1;const a=[],l=()=>{const u=r.createTexture();return r.bindTexture(r.TEXTURE_2D,u),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),u},c=u=>{var p;u._creatorWebSetViewport(s.width,s.height);const{width:f,height:d}=n.size();f>0&&d>0&&((p=u._setDensityGL)==null||p.call(u,s.width/f,s.height/d))},h=(u,f,d,p)=>{const y=u.GL.getNewId(u.GL.textures);return u.GL.textures[y]=f,u._importTexture(y,d,p)>>>0};return{canvas:s,context:r,options:e,table(u){return i=u,{engineCreated(){a.length=0,u._createSwapChainHeadless(s.width,s.height),c(u),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,d,p,y){const b=Z(f);if(!b){y(`createTexture: no buffer behind id ${f}`);return}const x=new Uint8Array(b);if(fi(x)){const m=u._malloc(x.length);u.HEAPU8.set(x,m);const v=u._createTextureFromKtx2(m,x.length)>>>0;if(u._free(m),v===4294967295){y("KTX2 transcode failed");return}p(v,u._getTextureWidth(v),u._getTextureHeight(v));return}createImageBitmap(Wt(f)).then(m=>{const v=l();r.texStorage2D(r.TEXTURE_2D,1,d&1?r.RGBA8:r.SRGB8_ALPHA8,m.width,m.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,m.width,m.height,r.RGBA,r.UNSIGNED_BYTE,m),p(h(u,v,m.width,m.height),m.width,m.height)},m=>y(m instanceof Error?m.message:String(m)))},createMediaPlayerTexture(f){const d=de(f);if(!d)return 0;const p=l(),y=h(u,p,0,0);return a.push({video:d,texture:p,id:y,lastTime:0}),y}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&c(i)},frame(){for(const u of a)u.video.readyState<2||u.video.currentTime===u.lastTime||(u.lastTime=u.video.currentTime,r.bindTexture(r.TEXTURE_2D,u.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,u.video))},videoTexture(u){const f=a.find(y=>y.video===u);if(f)return f.id;if(!i||!o)return;const d=l(),p=h(i,d,0,0);return a.push({video:u,texture:d,id:p,lastTime:0}),p},readPixels(){const u=r.drawingBufferWidth,f=r.drawingBufferHeight;if(!o||u===0||f===0)return null;const d=new Uint8Array(u*f*4),p=r.getParameter(r.READ_FRAMEBUFFER_BINDING);return r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.readPixels(0,0,u,f,r.RGBA,r.UNSIGNED_BYTE,d),r.bindFramebuffer(r.READ_FRAMEBUFFER,p),{rgba:hi(d,u,f),width:u,height:f}},destroy(){var u;a.length=0,(u=r.getExtension("WEBGL_lose_context"))==null||u.loseContext()}}},pi=n=>{const t={alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,desynchronized:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e=n.newCanvas(),s=e.getContext("webgl2",t);if(!s)throw new Error("WebGL2 is not available");let r=null,i=!1;const o=()=>{!r||!i||(r._c2dSetViewport(e.width,e.height),r._c2dSetDensity(n.size().factor))},a=()=>{r&&(r._creatorWeb2dEnsureInited(),i=!0,o(),e.style.display="block")},l=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(c){return r=c,{open2DScene:a,close2DScene:l}},show:a,hide:l,resize:o,frame(c){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(c)},destroy(){var c;(c=s.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},$e=n=>{if(typeof n=="number"||typeof n=="bigint"||typeof WebAssembly<"u"&&n instanceof WebAssembly.RuntimeError)return!0;const t=n instanceof Error?n.stack??"":"";return/\bwasm\b|wasm-function|\.wasm/i.test(t)},Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rn={};for(let n=0;n<Ve.length;n++)Rn[Ve[n]]=n;const gi=n=>{const t=[];let e=0,s=0;for(const r of n){const i=Rn[r];if(i===void 0)break;const o=i&32;if(s+=(i&31)<<e,o)e+=5;else{const a=s&1;s>>=1,t.push(a?-s:s),s=0,e=0}}return t};class mi{constructor(t){w(this,"sources");w(this,"lines");this.sources=t.sources,this.lines=[];let e=0,s=0,r=0;for(const i of t.mappings.split(";")){const o=[];let a=0;if(i)for(const l of i.split(",")){const c=gi(l);c.length!==0&&(a+=c[0],c.length>=4&&(e+=c[1],s+=c[2],r+=c[3],o.push([a,e,s,r])))}this.lines.push(o)}}originalPositionFor(t,e){const s=this.lines[t-1];if(!s||s.length===0)return null;let r=null;for(const o of s)if(o[0]<=e)r=o;else break;r??(r=s[0]);const i=this.sources[r[1]];return i===void 0?null:{source:i,line:r[2]+1,column:r[3]}}}const yi=n=>{const t=n.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const e=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new mi(JSON.parse(e))}catch{return null}};let mt=null;const wi=()=>{if(mt!==null)return mt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return mt=e?parseInt(e[1],10)-1:2,mt}return mt=2,mt},Xt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=wi(),r=[];for(const i of e.split(`
13
+ `,Ie=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),Us=n=>n.type==="native"||n.type==="video",Bs=[1,0,0,1,0,0],Gt=(n,t)=>[n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]],Ws=(n,t)=>{if(!n)return t;const e=Math.max(n.x,t.x),s=Math.max(n.y,t.y);return{x:e,y:s,width:Math.max(0,Math.min(n.x+n.width,t.x+t.width)-e),height:Math.max(0,Math.min(n.y+n.height,t.y+t.height)-s)}};class It extends Fs{constructor(e,s,r,i,o={}){super(e,s,o);w(this,"doc");w(this,"factories",new Map);w(this,"versions",new Map);w(this,"views",new Map);w(this,"wrappers",new Map);w(this,"shown",new Map);w(this,"destination",null);w(this,"field",null);w(this,"placedFor",null);w(this,"band",{root:0,height:0});w(this,"slide",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=Ns,i.appendChild(a)}paintOptions(){var e;return{surfaces:!0,editing:(e=this.field)==null?void 0:e.id}}registerView(e,s,r=1){this.factories.set(e,s),this.versions.set(e,r)}unregisterView(e){this.factories.delete(e),this.versions.delete(e)}isViewSupported(e){return this.factories.has(e)}viewVersion(e){return this.versions.get(e)??0}ensureView(e,s,r){const i=this.views.get(e);if(i&&(i.name!==s||i.params!==r))this.destroyView(e);else if(i)return i.handle;const o=this.factories.get(s);if(!o)return null;let a={};try{a=r?JSON.parse(r):{}}catch{}const l=o(a,{emit:(c,h)=>this.M.jsb.viewEvent(e,c,h)},this.doc);return l.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:l}),l}destroyView(e){var r,i;const s=this.views.get(e);s&&(this.views.delete(e),(i=(r=s.handle).destroy)==null||i.call(r),s.handle.el.remove())}viewCall(e,s,r,i,o){const a=this.views.get(e);if(!(a!=null&&a.handle.call)){o(`NativeView call "${s}": no live instance or no call handler (viewId ${e})`);return}try{Promise.resolve(a.handle.call(s,Array.isArray(r)?r:[])).then(l=>{l===void 0?i():i(l)},l=>o(l instanceof Error?l.message:String(l)))}catch(l){o(l instanceof Error?l.message:String(l))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==ct)return;this.dropDestination();const l=this.ensureView(r,i,o);if(!l)return;const c=this.doc.createElement("div");c.style.cssText="position:absolute;inset:0;pointer-events:auto;",c.appendChild(l.el),this.under.prepend(c),this.destination={viewId:r,el:c}}dropView(e,s,r){var i;super.dropView(e,s,r),e===ct&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==ct&&this.dropDestination()}dropDestination(){var e;(e=this.destination)==null||e.el.remove(),this.destination=null}releaseNode(e){var r,i;const s=this.get(e);((r=this.field)==null?void 0:r.id)===e&&this.unmountField(),super.releaseNode(e),(i=this.shown.get(e))==null||i.remove(),this.shown.delete(e),this.wrappers.delete(e),(s==null?void 0:s.type)==="native"&&s.viewId&&this.destroyView(s.viewId)}keyboardDuration(){return ye}shrinkTo(e,s){const r=this.doc.defaultView;if(!r){super.shrinkTo(e,s);return}this.slide&&(r.cancelAnimationFrame(this.slide.raf),this.slide=null);const i=s>0?e:this.band.root,o=this.band.height;if(o===s||i===0||!this.nodes.has(i)){this.setBand(i,s);return}const a=r.performance.now(),l=()=>{const c=Math.min(1,(r.performance.now()-a)/ye),h=Wn(c);this.setBand(i,c<1?Math.round(o+(s-o)*h):s),c<1?this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(l)}:this.slide=null};this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(l)}}setBand(e,s){this.band=s>0?{root:e,height:s}:{root:0,height:0},super.shrinkTo(this.band.root,this.band.height),this.dirty=!0}focusInput(e){var i;if(super.focusInput(e),this.focusedId()!==e||((i=this.field)==null?void 0:i.id)===e)return;this.unmountField();const s=this.get(e);if(!s)return;const r=this.doc.createElement(s.type==="textarea"?"textarea":"input");r.className="lc-field",r.setAttribute("autocomplete","off"),r.value=s.value,r.addEventListener("input",()=>{this.focusedId()===e&&this.setInputValue(e,r.value)}),r.addEventListener("keydown",o=>{o.key==="Enter"&&r.tagName==="INPUT"&&(o.preventDefault(),this.submitInput())}),r.addEventListener("blur",()=>{var o;((o=this.field)==null?void 0:o.el)===r&&this.focusedId()===e&&this.blurInput()}),this.over.appendChild(r),this.field={id:e,el:r},this.placedFor=null,this.place(),r.focus({preventScroll:!0})}blurInput(){super.blurInput(),this.unmountField()}unmountField(){const e=this.field;e&&(this.field=null,e.el.remove(),this.placedFor=null)}setPropertyString(e,s,r){var i,o;if(super.setPropertyString(e,s,r),s==="value"&&((i=this.field)==null?void 0:i.id)===e){const a=((o=this.get(e))==null?void 0:o.value)??"";this.field.el.value!==a&&(this.field.el.value=a)}}find(){var i;const e=[],s=(i=this.field)==null?void 0:i.id,r=(o,a,l)=>{let c=a;const h=o.style.transform;if(h){const f=o.style.transformOrigin,d=o.rect.x+(f?f.xPercent?o.rect.width*f.x/100:f.x:o.rect.width/2),p=o.rect.y+(f?f.yPercent?o.rect.height*f.y/100:f.y:o.rect.height/2),y=bn(h,o.style.transformBox,o.rect.width,o.rect.height);c=Gt(Gt(Gt(a,[1,0,0,1,d,p]),y),[1,0,0,1,-d,-p])}(Us(o)||o.id===s)&&e.push({node:o,matrix:c,clip:l});const u=o.clip?Ws(l,o.rect):l;for(const f of o.children)r(f,c,u)};for(const o of this.frame())r(o.tree,Bs,null);return e}static put(e,s){const{rect:r}=s.node,i=e.style;i.position="absolute",i.left="0",i.top="0",i.width=r.width+"px",i.height=r.height+"px",i.transformOrigin="0 0",i.transform=`matrix(${s.matrix.join(",")}) translate(${r.x}px,${r.y}px)`;const o=s.clip;i.clipPath=o?`inset(${Math.max(0,o.y-r.y)}px ${Math.max(0,r.x+r.width-(o.x+o.width))}px ${Math.max(0,r.y+r.height-(o.y+o.height))}px ${Math.max(0,o.x-r.x)}px)`:""}surfaceElement(e){const s=this.get(e.id);if(!s)return null;if(s.type==="video"){const o=de(s.playerId);return o instanceof HTMLVideoElement?o:null}if(!s.viewId)return null;const r=this.ensureView(s.viewId,s.viewName??"",s.viewParams??"");if(!r)return null;let i=this.wrappers.get(s.id);return i||(i=this.doc.createElement("div"),this.wrappers.set(s.id,i)),r.el.parentElement!==i&&i.replaceChildren(r.el),i}styleField(e,s){var u,f;const r=s.style,i=e.style,[o,a,l,c]=s.padding??[0,0,0,0];i.padding=`${a}px ${l}px ${c}px ${o}px`,i.color=Ie(r.color,"#000000ff"),i.caretColor=i.color;const h=r.fontFamily??"Roboto";if(i.fontFamily=((f=(u=this.host).resolveFontFamily)==null?void 0:f.call(u,h))??h,i.fontSize=(r.fontSize??14)+"px",i.fontWeight=String(r.fontWeight??400),i.fontStyle=r.fontStyle??"normal",i.letterSpacing=(r.letterSpacing??0)+"px",i.lineHeight=e.tagName==="TEXTAREA"&&r.lineHeight!==void 0?r.lineHeight+"px":"normal",i.textAlign=r.textAlign==="center"?"center":r.textAlign==="end"?"right":"left",i.borderRadius="0",e.placeholder=r.placeholder??"",i.setProperty("--lc-placeholder",Ie(r.placeholderColor,"#999999ff")),e instanceof HTMLInputElement){const d=r.inputType??"text";e.type!==d&&(e.type=d)}}place(){var r;const e=this.frame();if(e===this.placedFor)return;this.placedFor=e;const s=new Set;for(const i of this.find()){const{node:o}=i;if(o.id===((r=this.field)==null?void 0:r.id)){this.styleField(this.field.el,o),It.put(this.field.el,i);continue}const a=this.surfaceElement(o);a&&(s.add(o.id),a.parentElement!==this.under&&this.under.appendChild(a),a.style.display="block",a.style.opacity="",a.style.pointerEvents="auto",a instanceof HTMLVideoElement&&(a.style.objectFit=o.style.objectFit??"contain"),It.put(a,i),this.shown.set(o.id,a))}for(const[i,o]of this.shown)s.has(i)||(o.style.display="none",this.shown.delete(i))}surfaceAt(e,s){const r=this.frame();for(let i=r.length-1;i>=0;i--){const o=r[i];if(o.leaving)continue;const a=yt(o.tree,e,s,l=>{var c,h;return l.type==="native"||(((c=this.get(l.id))==null?void 0:c.interactive)??!1)||(((h=this.get(l.id))==null?void 0:h.editable)??!1)||!!l.scroll});if(a.node)return a.node.type==="native";if(a.blocker)return!1}return this.destination!==null}dispose(){this.unmountField();for(const e of[...this.views.keys()])this.destroyView(e);this.dropDestination();for(const e of this.shown.values())e instanceof HTMLVideoElement||e.remove();this.shown.clear()}}function Ds(n,t,e,s){const r=n.createElement("div");r.textContent=e,r.style.cssText="position:absolute;left:50%;bottom:48px;transform:translateX(-50%);max-width:80%;padding:10px 16px;border-radius:8px;background:rgba(30,30,30,0.92);color:#fff;font:13px/1.4 system-ui,sans-serif;z-index:30;pointer-events:none;",t.appendChild(r),setTimeout(()=>r.remove(),s>0?s:2e3)}const Hs=500,Fe=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],$s=(n,t)=>{const e=n.ownerDocument,{canvas:s}=t;s.style.display="block",s.style.pointerEvents="none",n.style.touchAction="none";const r=s.getContext("2d"),i=()=>{const g=e.createElement("div");return g.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",g},o=i(),a=i();n.insertBefore(o,s),s.after(a);const l=new wr({resolveAssetUrl:g=>an(g),canvasSurfaces:t.canvasHost}),c=new It(t.M,l,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onKeyboard:t.onKeyboard,onToast:(g,M)=>Ds(e,n,g,M)});let h=1,u=new Ae(r,h),f=!0;const d=()=>{(f||c.needsPaint())&&(f=!1,c.paint(u,c.paintOptions())),c.place()},p=(g,M,A)=>{g<=0||M<=0||(A!==h&&(h=A,u=new Ae(r,h)),f=!0,c.resize(g,M))},y=g=>{c.setSafeArea([g.top,g.right,g.bottom,g.left],g.bars??[])},b=g=>{const M=n.getBoundingClientRect(),A=fe(n);return[(g.clientX-M.left)/A,(g.clientY-M.top)/A]},x=g=>g.target instanceof Node&&a.contains(g.target),m=g=>g.target instanceof Node&&o.contains(g.target),v=g=>{m(g)&&g.stopPropagation()},_=new Set,T=new Map,P=g=>{const M=T.get(g);M!==void 0&&(clearTimeout(M),T.delete(g))},O=g=>{if(x(g))return;const[M,A]=b(g);if(!c.surfaceAt(M,A)){v(g),_.add(g.pointerId);try{n.setPointerCapture(g.pointerId)}catch{}c.pointerDown(g.pointerId,M,A),P(g.pointerId),T.set(g.pointerId,window.setTimeout(()=>{T.delete(g.pointerId),c.longPress(g.pointerId,M,A)},Hs))}},I=g=>{const[M,A]=b(g);_.has(g.pointerId)&&(v(g),c.pointerMove(g.pointerId,M,A)),g.pointerType==="mouse"&&(x(g)||!_.has(g.pointerId)&&c.surfaceAt(M,A)?c.pointerLeave():c.pointerHover(M,A))},F=g=>{g.pointerType==="mouse"&&c.pointerLeave()},$=g=>{if(!_.delete(g.pointerId))return;v(g),P(g.pointerId);const[M,A]=b(g);c.pointerUp(g.pointerId,M,A)},z=g=>{_.delete(g.pointerId)&&(P(g.pointerId),c.pointerCancel(g.pointerId))},G=g=>{if(x(g))return;const[M,A]=b(g);if(c.surfaceAt(M,A))return;v(g);const W=g.deltaMode===1?16:g.deltaMode===2?c.height:1;c.wheel(M,A,g.deltaX*W,g.deltaY*W)&&g.preventDefault()},Y=g=>{var q;if(x(g))return;const M="clientX"in g?g:(q=g.changedTouches)==null?void 0:q[0];if(!M)return;const[A,W]=b(M);c.surfaceAt(A,W)||(v(g),g.type==="mousedown"&&g.preventDefault())};n.addEventListener("pointerdown",O,!0),n.addEventListener("pointermove",I,!0),n.addEventListener("pointerleave",F),n.addEventListener("pointerup",$,!0),n.addEventListener("pointercancel",z,!0),n.addEventListener("wheel",G,{passive:!1,capture:!0});for(const g of Fe)n.addEventListener(g,Y,!0);return{ui:c,render:d,resize:p,setSafeArea:y,destroy(){for(const g of T.keys())P(g);n.removeEventListener("pointerdown",O,!0),n.removeEventListener("pointermove",I,!0),n.removeEventListener("pointerleave",F),n.removeEventListener("pointerup",$,!0),n.removeEventListener("pointercancel",z,!0),n.removeEventListener("wheel",G,!0);for(const g of Fe)n.removeEventListener(g,Y,!0);c.dispose(),o.remove(),a.remove()}}},Vs=["miter","round","bevel"],Gs=["butt","round","square"],js=["left","center","right","start","end"],zs=["alphabetic","top","middle","bottom","hanging","ideographic"],Ne=["nonzero","evenodd"],Ks=["pad","reflect","repeat"],jt={COLOR:0,RADIAL:2},xt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},K={SET_TRANSFORM:0,SAVE:1,RESTORE:2,CLIP:3,FILL_PATH:4,STROKE_PATH:5,FILL_TEXT:6,STROKE_TEXT:7,DRAW_IMAGE:8,CLEAR_RECT:9};class Xs{constructor(t,e){w(this,"pos",0);this.w=t,this.strings=e}f(){if(this.pos>=this.w.length)throw new Error("draw list: truncated");return this.w[this.pos++]}i(){return this.f()|0}str(){const t=this.i();if(t<0||t>=this.strings.length)throw new Error(`draw list: bad string index ${t}`);return this.strings[t]}color(){return[this.f(),this.f(),this.f(),this.f()]}matrix(){return[this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]}paint(){const t=this.i(),e=this.f();if(t===jt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===jt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=Ks[this.i()]??"pad",l=this.i(),c=[];for(let h=0;h<l;h++)c.push({offset:this.f(),color:this.color()});return t===jt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:c}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:c}}stroke(){const t=this.f(),e=Vs[this.i()]??"miter",s=Gs[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let l=0;l<o;l++)a.push(this.f());return{width:t,join:e,cap:s,miterLimit:r,dashOffset:i,dash:a}}font(){return{family:this.str(),size:this.f(),weight:this.i(),italic:this.i()!==0}}path(){const t=this.i(),e=this.pos+t;if(e>this.w.length)throw new Error("draw list: truncated path");const s=[];for(;this.pos<e;)switch(this.i()){case xt.MOVE:s.push(["M",this.f(),this.f()]);break;case xt.LINE:s.push(["L",this.f(),this.f()]);break;case xt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case xt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case xt.CLOSE:s.push(["Z"]);break;default:throw new Error("draw list: bad path verb")}return s}rect4(){return[this.f(),this.f(),this.f(),this.f()]}}const Ys=(n,t)=>{const e=new Xs(n,t),s=[];for(;e.pos+2<=n.length;){const r=e.i(),i=e.i(),o=e.pos+i;if(i<0||o>n.length)throw new Error("draw list: truncated command");switch(r){case K.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case K.SAVE:s.push({cmd:"save"});break;case K.RESTORE:s.push({cmd:"restore"});break;case K.CLIP:{const a=Ne[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case K.FILL_PATH:{const a=Ne[e.i()]??"nonzero",l=e.paint();s.push({cmd:"fillPath",rule:a,paint:l,path:e.path()});break}case K.STROKE_PATH:{const a=e.stroke(),l=e.paint();s.push({cmd:"strokePath",stroke:a,paint:l,path:e.path()});break}case K.FILL_TEXT:case K.STROKE_TEXT:{const a=e.str(),l=e.f(),c=e.f(),h=e.f(),u=e.font(),f=js[e.i()]??"start",d=zs[e.i()]??"alphabetic",p=e.f();if(r===K.STROKE_TEXT){const y=e.stroke();s.push({cmd:"strokeText",text:a,x:l,y:c,maxWidth:h,font:u,align:f,baseline:d,letterSpacing:p,stroke:y,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:l,y:c,maxWidth:h,font:u,align:f,baseline:d,letterSpacing:p,paint:e.paint()});break}case K.DRAW_IMAGE:{const a=e.i(),l=e.rect4(),c=e.rect4();s.push({cmd:"drawImage",surface:a,src:l,dst:c,alpha:e.f()});break}case K.CLEAR_RECT:s.push({cmd:"clearRect",rect:e.rect4()});break}if(e.pos!==o){if(e.pos>o)throw new Error(`draw list: command ${r} overran its length`);e.pos=o}}return s},qs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),Sn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,_n=(n,t=n.family)=>{const e=qs.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Mt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Js=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,zt=(n,t)=>{n.beginPath();for(const e of t)switch(e[0]){case"M":n.moveTo(e[1],e[2]);break;case"L":n.lineTo(e[1],e[2]);break;case"Q":n.quadraticCurveTo(e[1],e[2],e[3],e[4]);break;case"C":n.bezierCurveTo(e[1],e[2],e[3],e[4],e[5],e[6]);break;case"Z":n.closePath();break}},Ue=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,Sn(e.color))},Lt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=Sn(t.color),s();return}const r=t.matrix;if(Js(r)){let o;if(t.kind==="linear"){const[a,l]=Mt(r,0,0),[c,h]=Mt(r,1,0);o=n.createLinearGradient(a,l,c,h)}else{const a=Math.hypot(r[0],r[1]),[l,c]=Mt(r,0,0),[h,u]=Mt(r,t.fx,t.fy);o=n.createRadialGradient(h,u,t.r0*a,l,c,a)}Ue(o,t),n[e==="fill"?"fillStyle":"strokeStyle"]=o,s();return}n.save(),n.transform(r[0],r[1],r[2],r[3],r[4],r[5]);const i=t.kind==="linear"?n.createLinearGradient(0,0,1,0):n.createRadialGradient(t.fx,t.fy,t.r0,0,0,1);Ue(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Be=(n,t)=>{n.lineWidth=t.width,n.lineJoin=t.join,n.lineCap=t.cap,n.miterLimit=t.miterLimit,n.setLineDash(t.dash),n.lineDashOffset=t.dashOffset},We=(n,t,e)=>{n.font=_n(t.font,e.fontFamily?e.fontFamily(t.font.family):t.font.family),n.textAlign=t.align,n.textBaseline=t.baseline,"letterSpacing"in n&&(n.letterSpacing=`${t.letterSpacing}px`)},Qs=(n,t,e={})=>{var r;n.save();let s=0;try{n.setTransform(1,0,0,1,0,0),n.globalAlpha=1;for(const i of t)switch(i.cmd){case"setTransform":n.setTransform(i.matrix[0],i.matrix[1],i.matrix[2],i.matrix[3],i.matrix[4],i.matrix[5]);break;case"save":n.save(),s++;break;case"restore":s>0&&(n.restore(),s--);break;case"clip":zt(n,i.path),n.clip(i.rule);break;case"fillPath":zt(n,i.path),Lt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":zt(n,i.path),Be(n,i.stroke),Lt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":We(n,i,e),Lt(n,i.paint,"fill",()=>i.maxWidth>0?n.fillText(i.text,i.x,i.y,i.maxWidth):n.fillText(i.text,i.x,i.y));break;case"strokeText":We(n,i,e),Be(n,i.stroke),Lt(n,i.paint,"stroke",()=>i.maxWidth>0?n.strokeText(i.text,i.x,i.y,i.maxWidth):n.strokeText(i.text,i.x,i.y));break;case"drawImage":{const o=(r=e.image)==null?void 0:r.call(e,i.surface);if(!o)break;n.globalAlpha=i.alpha,n.drawImage(o,i.src[0],i.src[1],i.src[2],i.src[3],i.dst[0],i.dst[1],i.dst[2],i.dst[3]);break}case"clearRect":n.clearRect(i.rect[0],i.rect[1],i.rect[2],i.rect[3]);break;default:{const o=i;throw new Error(`unhandled draw command ${o.cmd}`)}}}finally{for(;s>0;s--)n.restore();n.restore()}},Zs=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(c,h,u)=>{if(!t)return null;let f=e.get(c);return f?(f.width!==h||f.height!==u)&&(f.width=h,f.height=u):(f=new OffscreenCanvas(h,u),e.set(c,f)),f},i={paint:(c,h,u,f,d,p)=>{const y=r(c,Math.max(1,h),Math.max(1,u)),b=y==null?void 0:y.getContext("2d");!y||!b||(b.setTransform(1,0,0,1,0,0),b.clearRect(0,0,y.width,y.height),Qs(b,Ys(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(c,h,u,f,d,p)=>{if(p[0]=0,p[1]=0,p[2]=0,!t||(s||(s=new OffscreenCanvas(1,1).getContext("2d")),!s))return;s.font=_n({family:h,size:u,weight:f,italic:d},h);const y=s.measureText(c);p[0]=y.width,p[1]=y.fontBoundingBoxAscent??y.actualBoundingBoxAscent,p[2]=y.fontBoundingBoxDescent??y.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(c,h)=>{const u=o(c);return u?(h[0]=u.width,h[1]=u.height,new Uint8Array(u.data.buffer,u.data.byteOffset,u.data.byteLength)):null},releaseSurface:c=>{e.delete(c)}},o=c=>{const h=e.get(c),u=h==null?void 0:h.getContext("2d");return!h||!u?null:{data:u.getImageData(0,0,h.width,h.height).data,width:h.width,height:h.height}};return{table:i,readSurface:o,getSurface:c=>{const h=e.get(c);return h?{canvas:h,width:h.width,height:h.height}:null},surfaceToDataUrl:c=>{var f;const h=e.get(c);if(!h||typeof document>"u")return null;const u=document.createElement("canvas");return u.width=h.width,u.height=h.height,(f=u.getContext("2d"))==null||f.drawImage(h,0,0),u.toDataURL()}}},ti=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,ei=(n,t="woff2")=>{const e=/^\/\/ fonts: (.+)$/m.exec(n);if(!e)return[];const s=[];for(const r of e[1].split(";")){const i=r.indexOf("=");if(i===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(r.slice(0,i));o&&s.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:r.slice(i+1).replace("{fmt}",t)})}return s},ni=async(n,t,e=2e3)=>{const s=t??(typeof document>"u"?void 0:document);if(!(s!=null&&s.fonts)||n.length===0)return;const r=[];for(const i of n)try{const o=new FontFace(i.family,`url("${i.url}")`,{weight:String(i.weight),style:i.italic?"italic":"normal"});s.fonts.add(o),r.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(r),new Promise(i=>setTimeout(i,e))])},kn="Roboto",ri=[`400 14px ${kn}`],De="data-lecodes-fonts",si=async(n=ri,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${De}]`)){const s=new URL(ti,document.baseURI).href,r=e.createElement("style");r.setAttribute(De,""),r.textContent=`@font-face{font-family:"${kn}";src:url("${s}") format("woff2");font-weight:100 900;font-display:swap}`,e.head.appendChild(r)}try{await Promise.all(n.map(s=>e.fonts.load(s)))}catch{}}},He="2.4.0",Kt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},ii=(n,t)=>Kt(n)!==null&&Kt(n)===Kt(t),oi=()=>({setMatrix(){},setVisible(){},setCameraMatrix(){},setProjection(){},clearProjection(){},setBackground(){},createExternalTexture:()=>null,onFrame:()=>()=>{},readPixels:(n,t)=>t(null,0,0),viewport:()=>({width:0,height:0,rotation:0})}),ai=n=>{var s,r;const t=((r=(s=n.screen)==null?void 0:s.orientation)==null?void 0:r.angle)??n.orientation??0;return(Math.round(t/90)%4+4)%4*90},ci=(n,t)=>({width:(n==null?void 0:n.clientWidth)??0,height:(n==null?void 0:n.clientHeight)??0,rotation:ai(t)}),li=[1,0,0,0,1,0],hi=(n,t,e)=>{const s=t*4,r=new Uint8Array(s);for(let i=0,o=e-1;i<o;i++,o--)r.set(n.subarray(i*s,i*s+s)),n.copyWithin(i*s,o*s,o*s+s),n.set(r,o*s);return n},ui=[171,75,84,88,32,50,48,187,13,10,26,10],fi=n=>n.length>=12&&ui.every((t,e)=>n[e]===t),di=(n,t)=>{const e={antialias:!1,depth:!0,alpha:!1,stencil:!1,desynchronized:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"high-performance",premultipliedAlpha:!0,preserveDrawingBuffer:t},s=n.newCanvas(),r=s.getContext("webgl2",e);if(!r)throw new Error("WebGL2 is not available");let i=null,o=!1;const a=[],l=()=>{const u=r.createTexture();return r.bindTexture(r.TEXTURE_2D,u),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),u},c=u=>{var p;u._creatorWebSetViewport(s.width,s.height);const{width:f,height:d}=n.size();f>0&&d>0&&((p=u._setDensityGL)==null||p.call(u,s.width/f,s.height/d))},h=(u,f,d,p)=>{const y=u.GL.getNewId(u.GL.textures);return u.GL.textures[y]=f,u._importTexture(y,d,p)>>>0};return{canvas:s,context:r,options:e,table(u){return i=u,{engineCreated(){a.length=0,u._createSwapChainHeadless(s.width,s.height),c(u),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,d,p,y){const b=Z(f);if(!b){y(`createTexture: no buffer behind id ${f}`);return}const x=new Uint8Array(b);if(fi(x)){const m=u._malloc(x.length);u.HEAPU8.set(x,m);const v=u._createTextureFromKtx2(m,x.length)>>>0;if(u._free(m),v===4294967295){y("KTX2 transcode failed");return}p(v,u._getTextureWidth(v),u._getTextureHeight(v));return}createImageBitmap(Wt(f)).then(m=>{const v=l();r.texStorage2D(r.TEXTURE_2D,1,d&1?r.RGBA8:r.SRGB8_ALPHA8,m.width,m.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,m.width,m.height,r.RGBA,r.UNSIGNED_BYTE,m),p(h(u,v,m.width,m.height),m.width,m.height)},m=>y(m instanceof Error?m.message:String(m)))},createMediaPlayerTexture(f){const d=de(f);if(!d)return 0;const p=l(),y=h(u,p,0,0);return a.push({video:d,texture:p,id:y,lastTime:0}),y}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&c(i)},frame(){for(const u of a)u.video.readyState<2||u.video.currentTime===u.lastTime||(u.lastTime=u.video.currentTime,r.bindTexture(r.TEXTURE_2D,u.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,u.video))},videoTexture(u){const f=a.find(y=>y.video===u);if(f)return f.id;if(!i||!o)return;const d=l(),p=h(i,d,0,0);return a.push({video:u,texture:d,id:p,lastTime:0}),p},readPixels(){const u=r.drawingBufferWidth,f=r.drawingBufferHeight;if(!o||u===0||f===0)return null;const d=new Uint8Array(u*f*4),p=r.getParameter(r.READ_FRAMEBUFFER_BINDING);return r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.readPixels(0,0,u,f,r.RGBA,r.UNSIGNED_BYTE,d),r.bindFramebuffer(r.READ_FRAMEBUFFER,p),{rgba:hi(d,u,f),width:u,height:f}},destroy(){var u;a.length=0,(u=r.getExtension("WEBGL_lose_context"))==null||u.loseContext()}}},pi=n=>{const t={alpha:!1,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,desynchronized:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1},e=n.newCanvas(),s=e.getContext("webgl2",t);if(!s)throw new Error("WebGL2 is not available");let r=null,i=!1;const o=()=>{!r||!i||(r._c2dSetViewport(e.width,e.height),r._c2dSetDensity(n.size().factor))},a=()=>{r&&(r._creatorWeb2dEnsureInited(),i=!0,o(),e.style.display="block")},l=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(c){return r=c,{open2DScene:a,close2DScene:l}},show:a,hide:l,resize:o,frame(c){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(c)},destroy(){var c;(c=s.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},$e=n=>{if(typeof n=="number"||typeof n=="bigint"||typeof WebAssembly<"u"&&n instanceof WebAssembly.RuntimeError)return!0;const t=n instanceof Error?n.stack??"":"";return/\bwasm\b|wasm-function|\.wasm/i.test(t)},Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rn={};for(let n=0;n<Ve.length;n++)Rn[Ve[n]]=n;const gi=n=>{const t=[];let e=0,s=0;for(const r of n){const i=Rn[r];if(i===void 0)break;const o=i&32;if(s+=(i&31)<<e,o)e+=5;else{const a=s&1;s>>=1,t.push(a?-s:s),s=0,e=0}}return t};class mi{constructor(t){w(this,"sources");w(this,"lines");this.sources=t.sources,this.lines=[];let e=0,s=0,r=0;for(const i of t.mappings.split(";")){const o=[];let a=0;if(i)for(const l of i.split(",")){const c=gi(l);c.length!==0&&(a+=c[0],c.length>=4&&(e+=c[1],s+=c[2],r+=c[3],o.push([a,e,s,r])))}this.lines.push(o)}}originalPositionFor(t,e){const s=this.lines[t-1];if(!s||s.length===0)return null;let r=null;for(const o of s)if(o[0]<=e)r=o;else break;r??(r=s[0]);const i=this.sources[r[1]];return i===void 0?null:{source:i,line:r[2]+1,column:r[3]}}}const yi=n=>{const t=n.match(/\/\/# lecodesMap=data:application\/json;(?:charset=[^;]+;)?base64,([A-Za-z0-9+/=]+)\s*$/);if(!t)return null;try{const e=typeof atob=="function"?atob(t[1]):Buffer.from(t[1],"base64").toString("utf8");return new mi(JSON.parse(e))}catch{return null}};let mt=null;const wi=()=>{if(mt!==null)return mt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return mt=e?parseInt(e[1],10)-1:2,mt}return mt=2,mt},Xt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=wi(),r=[];for(const i of e.split(`
14
14
  `)){const o=i.match(/<anonymous>:(\d+):(\d+)/);if(!o)continue;const a=parseInt(o[1],10)-s,l=parseInt(o[2],10)-1;if(a<1)continue;const c=t.originalPositionFor(a,l<0?0:l);if(!c)continue;const h=i.match(/at\s+([^\s(]+)\s*\(/);r.push({fn:h?h[1]:null,source:c.source,line:c.line,column:c.column})}return r},bi=/^\[ERROR\] (run|host callback|JsDispatch|timer|setLoop|animate|tween)\b:? ?([\s\S]*)$/,vi=(n,t)=>{const e=[],s=(c,h,u,f)=>{var y,b;if(u.length===0&&$e(h)){const x=typeof h=="number"||typeof h=="bigint"?`code ${h}`:h instanceof Error?h.message||h.name:String(h),m=[f,x].filter(_=>!!_).filter((_,T,P)=>P.indexOf(_)===T).join(`
15
15
  `);console.error(`[lecodes] native engine error — ${m||x} (see the console for the engine's message)`);const v={message:"Native engine error",detail:m,frames:[],native:!0,stack:h instanceof Error?h.stack:void 0};(y=c.onError)==null||y.call(c,v),v.stack&&t&&rr(v.stack).then(_=>{var T;_.length>0&&((T=c.onError)==null||T.call(c,{...v,nativeFrames:_}))});return}const d=h instanceof Error?h.message:String(h),p=u[0];console.error(p?`[lecodes] ${d}
16
16
  at ${p.source}:${p.line}:${p.column}${p.fn?` (${p.fn})`:""}`:`[lecodes] ${d}`),(b=c.onError)==null||b.call(c,{message:d,frames:u,stack:h instanceof Error?h.stack:void 0})},r=(c,h)=>{for(let f=e.length-1;f>=0;f--){const d=e[f];if(!d.sourceMap)continue;const p=Xt(c,d.sourceMap);if(p.length>0)return s(d,c,p,h)}const u=e[e.length-1];u&&$e(c)&&s(u,c,[],h)};let i=null;const o=()=>{const c=e[e.length-1],h=i;if(i=null,!h||!c)return;const u=new Error(h.message.replace(/^Error: /,""));u.stack=h.stack.join(`
17
17
  `),s(c,u,c.sourceMap?Xt(u,c.sourceMap):[])},a=c=>r(c.error??c.message,c.message),l=c=>r(c.reason);return n.addEventListener("error",a),n.addEventListener("unhandledrejection",l),{track(c,h){const u={sourceMap:yi(c),onError:h};return e.push(u),{drop(){const f=e.indexOf(u);f>=0&&e.splice(f,1)}}},locate(c){var u;const h=(u=e[e.length-1])==null?void 0:u.sourceMap;return h?Xt(c,h):[]},runtimeLine(c){if(i&&/^\s+at /.test(c))return i.stack.push(c),!0;const h=bi.exec(c);if(!h||e.length===0)return!1;o();const[u,...f]=h[2].split(`
18
- `);return i={message:(u??"").replace(/^JsTask /,""),stack:f},n.setTimeout(o,0),!0},dispose(){n.removeEventListener("error",a),n.removeEventListener("unhandledrejection",l),e.length=0}}},Tn=n=>{var l,c,h,u;const t=n.slice(0,2e3),e=new Set,s=t.match(/\/\/ preload: (.+)/);if(s)for(const f of s[1].split(";"))e.add(f);const r=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((l=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:l[1])??null,o=((h=(c=t.match(/^\/\/ name: (.+)$/m))==null?void 0:c[1])==null?void 0:h.trim())??null,a=new Set((((u=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:u[1])??"").split(";").map(f=>f.trim()).filter(Boolean));return{sdk:i,name:o,preloads:e,gl:r,is2d:t.includes("// 2d: enable"),plugins:a,bootFonts:ei(t)}},xi=n=>n.gl!=="off"?"full":n.is2d?"2d":"ui",Ei=n=>{const t=n.ownerDocument,e=t.defaultView??window;let s=1/0;const r=(d,p)=>{const y=Math.min(s,(e.devicePixelRatio||1)*fe(n));return{width:d,height:p,factor:y,pixelWidth:Math.max(1,Math.round(d*y)),pixelHeight:Math.max(1,Math.round(p*y))}};let i=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));const o=[],a=d=>{d.width!==i.pixelWidth&&(d.width=i.pixelWidth),d.height!==i.pixelHeight&&(d.height=i.pixelHeight)},l=()=>{const d=t.createElement("canvas");return d.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:none;",n.appendChild(d),a(d),o.push(d),d},c=new Set,h=d=>{if(!(d.width<=0||d.height<=0)){i=d;for(const p of o)a(p);for(const p of c)p(i)}},u=new ResizeObserver(([d])=>{var v;if(!d)return;const{width:p,height:y}=d.contentRect,b=(v=d.devicePixelContentBoxSize)==null?void 0:v[0],x=r(p,y),m=b&&Math.abs(b.inlineSize-p*x.factor)<=1&&Math.abs(b.blockSize-y*x.factor)<=1;if(!b||!m){h(x);return}h({width:p,height:y,pixelWidth:Math.max(1,b.inlineSize),pixelHeight:Math.max(1,b.blockSize),factor:x.factor})});try{u.observe(n,{box:"device-pixel-content-box"})}catch{u.observe(n)}return{root:n,doc:t,win:e,size:()=>i,newCanvas:l,remeasure:d=>{d!==void 0&&(s=d>0?d:1/0);const p=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));(p.pixelWidth!==i.pixelWidth||p.pixelHeight!==i.pixelHeight||p.factor!==i.factor)&&h(p)},onResize(d){return c.add(d),()=>{c.delete(d)}},destroy(){u.disconnect(),c.clear();for(const d of o)d.remove();o.length=0}}},Si=n=>{const t=new Map;let e=0,s=[];const r=new Set,i=l=>{r.has(l)||(r.add(l),console.warn(`[web-host] gl.${l}: this host's engine has no such call yet (a runtime module of an older build) — ignored`))},o=l=>Float32Array.from(l);return{facade:n?{setMatrix(l,c){var h;(h=n.creator())==null||h.setWorldMatrix(l,o(c))},setVisible(l,c){var h;(h=n.creator())==null||h.setVisible(l,c)},setCameraMatrix(l,c){var u;const h=n.creator();if(h&&!h.setCameraMatrix)return i("setCameraMatrix");(u=h==null?void 0:h.setCameraMatrix)==null||u.call(h,l,o(c))},setProjection(l,c,h,u){var d;const f=n.creator();if(f&&!f.setCameraProjectionMatrix)return i("setProjection");(d=f==null?void 0:f.setCameraProjectionMatrix)==null||d.call(f,l,o(c),h,u)},clearProjection(l){var c,h;(h=(c=n.creator())==null?void 0:c.clearCameraProjectionMatrix)==null||h.call(c,l)},setBackground(l,c,h=li){const u=n.creator();if(!u)return;if(!u.setSceneBackground||!n.surface)return i("setBackground");const f=c?n.surface.videoTexture(c):void 0;u.setSceneBackground(l,f??4294967295,Float32Array.from(h))},createExternalTexture:()=>null,onFrame(l){const c=e++;return t.set(c,l),()=>{t.delete(c)}},readPixels(l,c){if(!n.surface||n.presented()!==l){c(null,0,0);return}s.push({scene:l,then:c})},viewport:()=>ci(n.view,n.view.ownerDocument.defaultView??window)}:oi(),before(){if(t.size!==0)for(const l of[...t.values()])l()},after(){if(s.length===0||!(n!=null&&n.surface))return;const l=n.presented(),c=s.filter(u=>u.scene===l);for(const u of s)u.scene!==l&&u.then(null,0,0);if(s=c,c.length===0||!n.frameRendered())return;s=[];const h=n.surface.readPixels();for(const u of c)h?u.then(h.rgba.slice(),h.width,h.height):u.then(null,0,0)},worldChanged(){t.clear();const l=s;s=[];for(const c of l)c.then(null,0,0)}}},_i=(n,t)=>{const e=[],s=new Set;return{has:r=>s.has(r),register(r,i){s.has(r)||(s.add(r),i({registerView:(o,a,l=1)=>{e.push({id:r,version:l,kind:"view",name:o,factory:a})},registerService:(o,a,l=1)=>{e.push({id:r,version:l,kind:"service",name:o,factory:a})},putBuffer:ut,getBuffer:Z,gl:t}))},allow(r){var o,a;const i=new Set(r);for(const l of e){const c=i.has(l.id);l.kind==="view"?c?(o=n.registerView)==null||o.call(n,l.name,l.factory,l.version):(a=n.unregisterView)==null||a.call(n,l.name):c?n.registerService(l.name,l.factory,l.version):n.unregisterService(l.name)}}}},ki=n=>{const t=n.ownerDocument.createElement("div");t.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);",n.appendChild(t);const e=i=>Math.round(parseFloat(i)||0),s=()=>{const i=getComputedStyle(t);return{top:e(i.paddingTop),right:e(i.paddingRight),bottom:e(i.paddingBottom),left:e(i.paddingLeft)}};let r=null;return{set(i){r=i},current:()=>r??s(),destroy(){t.remove()}}},Ri={lightmap:"world","lightmap-masked":"world","lightmap-lite":"world","lightmap-masked-lite":"world",terrain:"world","terrain-lightmap":"world",foliage:"world","foliage-masked":"world"},Ge="material:",Ti=n=>{const t=new Set;for(const e of n)e.startsWith(Ge)&&t.add(Ri[e.slice(Ge.length)]??"base");return[...t].sort((e,s)=>e==="base"?-1:s==="base"?1:e.localeCompare(s))},Ai=""+new URL("assets/materials-BzTsWTWO.bin",import.meta.url).href,Mi=""+new URL("assets/materials-world-CQWt8TAm.bin",import.meta.url).href,Li=""+new URL("assets/neutral_ibl128-D-lzdkLN.ktx",import.meta.url).href,Pi=""+new URL("assets/uberarchive-Ok2HfJvn.bin",import.meta.url).href,Ci={base:Ai,world:Mi},Oi=n=>{const t=new Uint8Array(n.reduce((s,r)=>s+r.byteLength,0));let e=0;for(const s of n)t.set(new Uint8Array(s),e),e+=s.byteLength;return t.buffer},Ii=async n=>{const t=async o=>{const a=await fetch(o);if(!a.ok)throw new Error(`${o} → HTTP ${a.status}`);return a.arrayBuffer()},e=Ti(n).map(o=>Ci[o]).filter(o=>!!o),[s,r,...i]=await Promise.all([t(Li),t(Pi),...e.map(t)]);return{1:s,2:r,...i.length>0?{3:Oi(i)}:{}}},Fi=n=>{const t=()=>n.push(document.hidden?"pause":"resume"),e=()=>n.push("online"),s=()=>n.push("offline");return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),window.addEventListener("offline",s),{table:{state:()=>document.hidden?"background":"active",isOnline:()=>navigator.onLine,openUrl(i){window.open(i,"_blank","noopener")},worldChange(){var i;(i=n.onWorldChange)==null||i.call(n)},setOrientation(i){var l,c,h,u;const o=i==="landscape"||i==="portrait"?i:"auto";if(n.onOrientation){n.onOrientation(o);return}const a=typeof screen<"u"?screen.orientation:void 0;if(a)try{o==="auto"?(l=a.unlock)==null||l.call(a):(u=(h=(c=a.lock)==null?void 0:c.call(a,o))==null?void 0:h.catch)==null||u.call(h,()=>{})}catch{}}},emit:(i,o)=>n.push(i,o),dispose(){document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener("offline",s)}}},Ni=(n,t,e,s)=>{try{const r=document.createElement("input");r.type="file",r.multiple=e,s&&(r.accept=s),r.onchange=async()=>{const{files:i}=r;if(e){const o=[];if(!i)return n([]);for(let a of i)o.push([ut(await a.arrayBuffer()),a.name,a.size]);n(o)}else{if(!i||i.length===0)return n(null);n([[ut(await i[0].arrayBuffer()),i[0].name,i[0].size]])}},window.addEventListener("focus",()=>{setTimeout(()=>{(!r.files||r.files.length===0)&&n(e?[]:null)},300)},{once:!0}),r.click()}catch(r){t(r)}},An=n=>n==="camera"?"camera":n==="microphone"||n==="speech"?"microphone":n==="location"?"geolocation":null,Mn=(n,t,e)=>{const s=An(n);if(!s){e(`${n}: not a permission this host asks for`);return}const r=navigator.permissions;if(!(r!=null&&r.query)){t("prompt");return}r.query({name:s}).then(i=>t(i.state),()=>t("prompt"))},Ui=(n,t,e)=>{if(!An(n)){e(`${n}: not a permission this host asks for`);return}const s=()=>Mn(n,t,e);if(n==="location"){if(!navigator.geolocation){t("denied");return}navigator.geolocation.getCurrentPosition(()=>t("granted"),i=>i.code===i.PERMISSION_DENIED?t("denied"):s(),{timeout:15e3,maximumAge:1/0});return}const r=navigator.mediaDevices;if(!(r!=null&&r.getUserMedia)){t("denied");return}r.getUserMedia(n==="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"):s()})},Bi=n=>({get platform(){return"web"},get language(){return n()},get pixelRatio(){return window.devicePixelRatio||1},vibrate(){var t;try{(t=navigator.vibrate)==null||t.call(navigator,30)}catch{}},clipboardWrite(t){var e;(e=navigator.clipboard)==null||e.writeText(t).catch(()=>{})},clipboardRead(t,e){const s=navigator.clipboard;if(!(s!=null&&s.readText)){e("Clipboard is not available");return}s.readText().then(t,r=>e(r instanceof Error?r.message:"Clipboard read failed"))},share(t){const e=URL.createObjectURL(Wt(t)),s=document.createElement("a");s.href=e,s.download="image.png",document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(e)},openFilePicker:(t,e,s,r)=>Ni(t,e,s,r??void 0),queryPermission:Mn,requestPermission:Ui}),Wi=(n={})=>({local:t=>hr(t),dispose:t=>or(t),request(t,e,s,r,i,o,a,l){if(t.startsWith("id:")){const u=Number(t.slice(3));o(u,Z(u)?200:404);return}const c={};for(let u=0;u+1<s.length;u+=2)c[s[u]]=s[u+1];let h;if(i.length>0){const u=new FormData;for(const f of i)f.key!==null&&(f.bufferId>0?u.append(f.key,Wt(f.bufferId),f.filename??void 0):u.append(f.key,f.value??""));h=u}else r!==null&&(h=r);(async()=>{var u;try{const f=await fetch(t,{method:e,headers:c,body:h,mode:"cors",credentials:"omit"}),d=l?(u=f.body)==null?void 0:u.getReader():void 0;if(!d){o(ut(await f.arrayBuffer()),f.status);return}const p=Number(f.headers.get("content-length"))||void 0,y=[];let b=0;for(;;){const{done:v,value:_}=await d.read();if(v)break;_&&(y.push(_),b+=_.length,l({loaded:b,total:p}))}const x=new Uint8Array(b);let m=0;for(const v of y)x.set(v,m),m+=v.length;o(ut(x.buffer),f.status)}catch(f){a(f instanceof Error?f.message:String(f))}})()},buffer:t=>{const e=Z(t);return e?new Uint8Array(e):null},putBuffer:t=>ut(t.slice().buffer),bufferSlice(t,e,s){const r=Z(t);if(!r)return null;const i=Math.max(0,Math.min(e,r.byteLength)),o=Math.max(i,Math.min(s,r.byteLength));return new Uint8Array(r,i,o-i)},systemBuffer:t=>{const e=n[t];return e?new Uint8Array(e):null}}),je=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],Yt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],Pt=4,qt=16,ze=16,Di=.5,Hi=n=>{const t=new Set;let e=null;const s=(E,R,U=-1,L=0)=>{e==null||e(E,R,U,L)},r=E=>{if(!E.code)return;const R=t.has(E.code);t.add(E.code),s(0,E.code,-1,R||E.repeat?1:0)},i=E=>{E.code&&t.delete(E.code)&&s(1,E.code)},o=()=>{for(const E of[...t])E.startsWith("Gamepad")||(t.delete(E),s(1,E))},{root:a}=n;let l=0,c=0,h=0,u=0,f=0,d=0,p=0,y=0,b=0,x=0;const m=E=>{if(E.pointerType&&E.pointerType!=="mouse")return;const R=a.getBoundingClientRect();l=E.clientX-R.left,c=E.clientY-R.top,h+=E.movementX||0,u+=E.movementY||0},v=E=>{const R=je[E.button];R&&(t.add(R),s(0,R))},_=E=>{const R=je[E.button];R&&t.delete(R)&&s(1,R)},T=E=>{const R=E.deltaMode===0?.01:1;f+=E.deltaX*R,d+=E.deltaY*R},P=E=>{document.pointerLockElement===a&&E.preventDefault()},O=[],I=[],F=[],$=()=>{var R,U;const E=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let L=0;L<Pt;L++){const tt=E[L]??null,J=!!tt&&tt.connected;if(J!==!!O[L]){if(O[L]=J,!J){for(const N of Yt)t.delete(N+"@"+L)&&(s(1,N,L),z(N));F[L]=[],I[L]=[0,0,0,0,0,0]}s(J?2:3,"",L)}if(!tt||!J)continue;const it=tt.axes,dt=tt.buttons,kt=((R=dt[6])==null?void 0:R.value)??0,S=((U=dt[7])==null?void 0:U.value)??0;I[L]=[it[0]??0,it[1]??0,it[2]??0,it[3]??0,kt,S];const C=F[L]??(F[L]=[]);for(let N=0;N<Yt.length;N++){const Q=dt[N],et=!!Q&&(Q.pressed||Q.value>Di);if(et===!!C[N])continue;C[N]=et;const Rt=Yt[N];et?t.add(Rt+"@"+L):t.delete(Rt+"@"+L),z(Rt),s(et?0:1,Rt,L)}}},z=E=>{let R=!1;for(let U=0;U<Pt&&!R;U++)t.has(E+"@"+U)&&(R=!0);R?t.add(E):t.delete(E)};let G=0;const Y=()=>{p=h,y=u,b=f,x=d,h=u=f=d=0,$(),G=requestAnimationFrame(Y)},g=n.windows.filter((E,R,U)=>E&&U.indexOf(E)===R);for(const E of g)n.keyboard!==!1&&(E.addEventListener("keydown",r),E.addEventListener("keyup",i)),E.addEventListener("blur",o);return a.addEventListener("pointermove",m,!0),a.addEventListener("mousedown",v,!0),window.addEventListener("mouseup",_,!0),a.addEventListener("wheel",T,{passive:!0,capture:!0}),a.addEventListener("contextmenu",P,!0),typeof requestAnimationFrame=="function"&&(G=requestAnimationFrame(Y)),{inputKey:(E,R)=>R>=0&&E.startsWith("Gamepad")?t.has(E+"@"+R):t.has(E),inputRead:E=>{var R;switch(E){case 0:return l;case 1:return c;case 2:return p;case 3:return y;case 4:return b;case 5:return x;case 6:return document.pointerLockElement===a?1:0;case 7:{let U=0;for(let L=0;L<Pt;L++)O[L]&&U++;return U}}if(E>=qt){const U=Math.floor((E-qt)/ze),L=(E-qt)%ze;return U>=Pt||!O[U]?0:L===0?1:((R=I[U])==null?void 0:R[L-1])??0}return 0},inputSetPointerLock:E=>{if(!E)return document.pointerLockElement===a&&document.exitPointerLock(),!0;if(document.pointerLockElement===a)return!0;if(typeof a.requestPointerLock!="function")return!1;try{const R=a.requestPointerLock({unadjustedMovement:!0});return R&&typeof R.catch=="function"&&R.catch(()=>{try{a.requestPointerLock()}catch{}}),!0}catch{return!1}},registerInputEvent:E=>{e=E},dispose:()=>{for(const E of g)E.removeEventListener("keydown",r),E.removeEventListener("keyup",i),E.removeEventListener("blur",o);a.removeEventListener("pointermove",m,!0),a.removeEventListener("mousedown",v,!0),window.removeEventListener("mouseup",_,!0),a.removeEventListener("wheel",T,!0),a.removeEventListener("contextmenu",P,!0),G&&cancelAnimationFrame(G),document.pointerLockElement===a&&document.exitPointerLock(),t.clear(),e=null}}},$i=n=>{const t=Hi(n);return t.registerInputEvent(n.push),{table:{key:t.inputKey,read:t.inputRead,setPointerLock:t.inputSetPointerLock,keyboardHeight:n.keyboardHeight},dispose:t.dispose}},Vi={createVideo:Sr,createAudio:_r,setVolume:kr,setPlaying:Rr,setLoop:Tr,time:Ar,setTime:Mr,duration:Lr,remove:Pr},Gi=()=>{const n=new Map,t=new Map,e=new Map;let s=1;return{registerService:(f,d,p=1)=>{n.set(f,d),t.set(f,p)},unregisterService:f=>{n.delete(f),t.delete(f)},isServiceSupported:f=>n.has(f),serviceVersion:f=>t.get(f)??0,serviceOpen:(f,d,p)=>{const y=n.get(f);if(!y)return-1;const b=s++,x=y(d?JSON.parse(d):{},{emit:(m,v)=>{v===void 0?p(m):p(m,v)}});return e.set(b,x),b},serviceCall:(f,d,p,y,b)=>{const x=e.get(f);if(!(x!=null&&x.call)){b(`Service call "${d}": no live session or no call handler (serviceId ${f})`);return}try{Promise.resolve(x.call(d,Array.isArray(p)?p:[])).then(m=>{m===void 0?y():y(m)},m=>b(m instanceof Error?m.message:String(m)))}catch(m){b(m instanceof Error?m.message:String(m))}},serviceClose:f=>{var d,p;(p=(d=e.get(f))==null?void 0:d.close)==null||p.call(d),e.delete(f)},destroy:()=>{var f;for(const d of e.values())(f=d.close)==null||f.call(d);e.clear()}}},ji=()=>{const n=Gi();return{table:{supported:n.isServiceSupported,version:n.serviceVersion,open:n.serviceOpen,call:n.serviceCall,close:n.serviceClose},registerService:n.registerService,unregisterService:n.unregisterService,dispose:n.destroy}},zi=()=>{const n=[];return{table:{open(e,s){const r=new WebSocket(e);return r.addEventListener("open",()=>s("open")),r.addEventListener("message",i=>s("message",i.data)),r.addEventListener("close",i=>s("close",i.code)),r.addEventListener("error",()=>s("error")),n.push(r),n.length-1},send(e,s){var r;(r=n[e])==null||r.send(s)},close(e){var s;(s=n[e])==null||s.close()}},dispose(){for(const e of n)e.readyState===WebSocket.OPEN&&e.close();n.length=0}}},Ki=n=>{const t=e=>`lecodes:${n}:${e}`;return{load(e){try{return window.localStorage.getItem(t(e))}catch{return null}},save(e,s){try{window.localStorage.setItem(t(e),s)}catch{}}}},Ke=()=>{const n={};return{global:n,evaluate:e=>{const s=Object.getOwnPropertyNames(n);return new Function(...s,e)(...s.map(r=>n[r]))}}},Xi={fetch:ir,getBuffer:Z,getBlob:Wt,putBuffer:ut,putLocalBuffer:ar,hasLocalBuffer:cr,getLocalName:lr,getPlayer:de,removePlayers:gn},Yi=(n,t)=>({nodeFactory(){},setPropertyString(){},setPropertyInt(){},setFlags(){},insertNode(){},removeNode(){},releaseNode(){},openView(e,s,r){n(e,r)},dropView(e,s,r){t(e,r)},closeView(){n(-1,0)},layerOpen(){},layerClose(){},registerFont(e,s,r,i,o){o()},showToast(){},getButtonPressed:()=>!1,getTextValue:()=>"",vlistScroll(){}}),qi=async(n,t={})=>{var kt;const e=t.header,s=t.profile??(e?xi(e):"full"),r=(e==null?void 0:e.preloads)??new Set,i=t.ui!==!1,o=s==="full",a=s==="2d"||s==="full"&&!!(e!=null&&e.is2d),l=Ei(n),{doc:c,win:h}=l,u=i?Promise.all([si(void 0,c),ni((e==null?void 0:e.bootFonts)??[],c)]):null,f=o?di(l,r.has("capture")):null,d=a?pi(l):null,p=i?l.newCanvas():null,y=vi(h,o);o&&sr();const[b,x]=await Promise.all([Gn(s,{glContext:f==null?void 0:f.context,glOptions:f==null?void 0:f.options,gl2dContext:d==null?void 0:d.context,gl2dOptions:d==null?void 0:d.options,moduleArgs:{print:S=>{y.runtimeLine(S)?console.debug(S):console.log(S)},printErr:S=>{console.error(S)}}}),o?Ii(r):Promise.resolve({})]),m=(S,C)=>{const N=b.stringToNewUTF8(S);try{return C(N)}finally{b._free(N)}};let v=null,_=-1,T=-1,P=-1;const O=(S,C)=>{T=S,P=S===Tt?C:-1,S===Tt&&(f==null||f.show()),S===Pe&&(d==null||d.show()),v&&S===Tt&&C!==_&&(_=C,v.openScene(C))},I=S=>{S!==T&&(S===Tt&&(f==null||f.hide(),v&&_>=0&&(_=-1,v.closeScene())),S===Pe&&(d==null||d.hide()))};let F=null;const $=Si(o||t.engine3d?{creator:()=>F==null?void 0:F._creator,surface:f,presented:()=>P,frameRendered:()=>{var S;return!!((S=b._creatorWebFrameRendered)!=null&&S.call(b))},view:(f==null?void 0:f.canvas)??n}:null),z=Zs();let G=t.keyboardBand??0;const g=p?$s(n,{M:b,canvas:p,canvasHost:z,keyboardHeight:()=>{const S=h.visualViewport,C=S?Math.max(0,Math.round((h.innerHeight-S.height-S.offsetTop)/fe(n))):0;return C>0?C:G},onKeyboard:t.onKeyboard}):null;g&&(g.ui.onDestination=O,g.ui.onDropped=I);const M=Fi({onOrientation:t.onOrientation,onWorldChange:()=>$.worldChanged(),push:(S,C)=>{S==="url"&&C!==void 0&&m(C,N=>b._creatorWebSetLaunchUrl(N)),m(S,N=>{C===void 0?b._creatorWebAppEvent(N,0):m(C,Q=>b._creatorWebAppEvent(N,Q))})}}),A=zi(),W=ji(),q=$i({windows:[...new Set([h,...t.keyboardTargets??[]])],root:n,keyboard:t.keyboard!==!1,push:(S,C,N,Q)=>m(C,et=>b._creatorWebInputEvent(S,et,N,Q)),keyboardHeight:()=>(g==null?void 0:g.ui.keyboardHeight())??0}),_t={ui:(g==null?void 0:g.ui)??Yi(O,I),app:M.table,device:Bi(t.language??(()=>(h.navigator.language||"en").slice(0,2))),fetch:Wi(x),storage:Ki(t.project??(e==null?void 0:e.name)??"app"),socket:A.table,service:W.table,input:q.table,media:Vi,canvas:z.table,...f?{gl:f.table(b)}:{},...d?{scene2d:d.table(b)}:{}},E=Ke(),R=E.global;F=R,Zn(b,{host:_t,world:E,newWorld:()=>{const S=Ke();return F=S.global,S}});const U=_i({...g?{registerView:(S,C,N)=>g.ui.registerView(S,C,N),unregisterView:S=>g.ui.unregisterView(S)}:{},registerService:W.registerService,unregisterService:W.unregisterService},$.facade);b._creatorWebInit(),t.launchUrl&&m(t.launchUrl,S=>b._creatorWebSetLaunchUrl(S)),g==null||g.ui.install(),!o&&t.engine3d&&(v=await t.engine3d({newCanvas:l.newCanvas,preloads:r,canvasHost:z,stores:Xi}),Object.defineProperty(R,"_creator",{value:v,configurable:!0,writable:!0,enumerable:!1})),o&&(e==null?void 0:e.gl)!=="defer"&&((kt=R._creator)==null||kt.createEngine());const L=ki(n);t.safeArea&&L.set(t.safeArea);const tt=S=>{var C;f==null||f.resize(),d==null||d.resize(),(C=v==null?void 0:v._onResize)==null||C.call(v,S.width,S.height,S.factor),g?(g.resize(S.width,S.height,S.factor),g.setSafeArea(L.current())):b._creatorWebResize(S.width,S.height)};l.onResize(tt),tt(l.size());let J=0;const it=S=>{J=h.requestAnimationFrame(it),$.before(),f==null||f.frame(),b._creatorWebTick(S),$.after(),d==null||d.frame(S),g&&(g.ui.layoutFrame(),g.ui.tickHover(),g.render())};J=h.requestAnimationFrame(it),await u;let dt=!1;return{profile:s,M:b,world:R,ui:(g==null?void 0:g.ui)??null,engine3d:()=>v,getBuffer:S=>Z(S),run(S,C={}){const N=C.header??Tn(S);if(!ii(N.sdk,He))throw new Error(`This app was built with LeCodes SDK ${N.sdk??"older than 2.0"}; this host runs SDK ${He}. It needs a new build.`);const Q=y.track(S,C.onError);return U.allow(N.plugins),m(S,et=>b._creatorWebRun(et)),{dispose:Q.drop}},registerPlugin:(S,C)=>U.register(S,C),hasPlugin:U.has,locate:y.locate,safeArea:()=>L.current(),setSafeArea(S){L.set(S),g==null||g.setSafeArea(L.current())},setKeyboardBand(S){G=S??0,g==null||g.ui.refreshKeyboard()},remeasure:l.remeasure,emitAppEvent:M.emit,destroy(){var S;dt||(dt=!0,h.cancelAnimationFrame(J),y.dispose(),g==null||g.destroy(),q.dispose(),A.dispose(),W.dispose(),M.dispose(),gn(),L.destroy(),(S=v==null?void 0:v._dispose)==null||S.call(v),f==null||f.destroy(),d==null||d.destroy(),l.destroy())}}},Ji=(n,t)=>new Promise(e=>{const s=n.ownerDocument.defaultView??window;s.requestAnimationFrame(()=>{try{const r=[...n.querySelectorAll("canvas")].filter(c=>c.width>0&&c.height>0&&s.getComputedStyle(c).display!=="none");if(r.length===0){e(null);return}const i=n.getBoundingClientRect(),o=t??Math.max(...r.map(c=>c.width))/Math.max(1,i.width),a=n.ownerDocument.createElement("canvas");a.width=Math.max(1,Math.round(i.width*o)),a.height=Math.max(1,Math.round(i.height*o));const l=a.getContext("2d");if(!l){e(null);return}l.fillStyle="#000000",l.fillRect(0,0,a.width,a.height);for(const c of r)l.drawImage(c,0,0,c.width,c.height,0,0,a.width,a.height);e(a.toDataURL("image/png"))}catch{e(null)}})}),Qi=n=>{if(typeof n=="string")return n;if(n instanceof Error)return n.stack?`${String(n)}
18
+ `);return i={message:(u??"").replace(/^JsTask /,""),stack:f},n.setTimeout(o,0),!0},dispose(){n.removeEventListener("error",a),n.removeEventListener("unhandledrejection",l),e.length=0}}},Tn=n=>{var l,c,h,u;const t=n.slice(0,2e3),e=new Set,s=t.match(/\/\/ preload: (.+)/);if(s)for(const f of s[1].split(";"))e.add(f);const r=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((l=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:l[1])??null,o=((h=(c=t.match(/^\/\/ name: (.+)$/m))==null?void 0:c[1])==null?void 0:h.trim())??null,a=new Set((((u=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:u[1])??"").split(";").map(f=>f.trim()).filter(Boolean));return{sdk:i,name:o,preloads:e,gl:r,is2d:t.includes("// 2d: enable"),plugins:a,bootFonts:ei(t)}},xi=n=>n.gl!=="off"?"full":n.is2d?"2d":"ui",Ei=n=>{const t=n.ownerDocument,e=t.defaultView??window;let s=1/0;const r=(d,p)=>{const y=Math.min(s,(e.devicePixelRatio||1)*fe(n));return{width:d,height:p,factor:y,pixelWidth:Math.max(1,Math.round(d*y)),pixelHeight:Math.max(1,Math.round(p*y))}};let i=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));const o=[],a=d=>{d.width!==i.pixelWidth&&(d.width=i.pixelWidth),d.height!==i.pixelHeight&&(d.height=i.pixelHeight)},l=()=>{const d=t.createElement("canvas");return d.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:none;",n.appendChild(d),a(d),o.push(d),d},c=new Set,h=d=>{if(!(d.width<=0||d.height<=0)){i=d;for(const p of o)a(p);for(const p of c)p(i)}},u=new ResizeObserver(([d])=>{var v;if(!d)return;const{width:p,height:y}=d.contentRect,b=(v=d.devicePixelContentBoxSize)==null?void 0:v[0],x=r(p,y),m=b&&Math.abs(b.inlineSize-p*x.factor)<=1&&Math.abs(b.blockSize-y*x.factor)<=1;if(!b||!m){h(x);return}h({width:p,height:y,pixelWidth:Math.max(1,b.inlineSize),pixelHeight:Math.max(1,b.blockSize),factor:x.factor})});try{u.observe(n,{box:"device-pixel-content-box"})}catch{u.observe(n)}return{root:n,doc:t,win:e,size:()=>i,newCanvas:l,remeasure:d=>{d!==void 0&&(s=d>0?d:1/0);const p=r(Math.max(1,n.clientWidth),Math.max(1,n.clientHeight));(p.pixelWidth!==i.pixelWidth||p.pixelHeight!==i.pixelHeight||p.factor!==i.factor)&&h(p)},onResize(d){return c.add(d),()=>{c.delete(d)}},destroy(){u.disconnect(),c.clear();for(const d of o)d.remove();o.length=0}}},Si=n=>{const t=new Map;let e=0,s=[];const r=new Set,i=l=>{r.has(l)||(r.add(l),console.warn(`[web-host] gl.${l}: this host's engine has no such call yet (a runtime module of an older build) — ignored`))},o=l=>Float32Array.from(l);return{facade:n?{setMatrix(l,c){var h;(h=n.creator())==null||h.setWorldMatrix(l,o(c))},setVisible(l,c){var h;(h=n.creator())==null||h.setVisible(l,c)},setCameraMatrix(l,c){var u;const h=n.creator();if(h&&!h.setCameraMatrix)return i("setCameraMatrix");(u=h==null?void 0:h.setCameraMatrix)==null||u.call(h,l,o(c))},setProjection(l,c,h,u){var d;const f=n.creator();if(f&&!f.setCameraProjectionMatrix)return i("setProjection");(d=f==null?void 0:f.setCameraProjectionMatrix)==null||d.call(f,l,o(c),h,u)},clearProjection(l){var c,h;(h=(c=n.creator())==null?void 0:c.clearCameraProjectionMatrix)==null||h.call(c,l)},setBackground(l,c,h=li){const u=n.creator();if(!u)return;if(!u.setSceneBackground||!n.surface)return i("setBackground");const f=c?n.surface.videoTexture(c):void 0;u.setSceneBackground(l,f??4294967295,Float32Array.from(h))},createExternalTexture:()=>null,onFrame(l){const c=e++;return t.set(c,l),()=>{t.delete(c)}},readPixels(l,c){if(!n.surface||n.presented()!==l){c(null,0,0);return}s.push({scene:l,then:c})},viewport:()=>ci(n.view,n.view.ownerDocument.defaultView??window)}:oi(),before(){if(t.size!==0)for(const l of[...t.values()])l()},after(){if(s.length===0||!(n!=null&&n.surface))return;const l=n.presented(),c=s.filter(u=>u.scene===l);for(const u of s)u.scene!==l&&u.then(null,0,0);if(s=c,c.length===0||!n.frameRendered())return;s=[];const h=n.surface.readPixels();for(const u of c)h?u.then(h.rgba.slice(),h.width,h.height):u.then(null,0,0)},worldChanged(){t.clear();const l=s;s=[];for(const c of l)c.then(null,0,0)}}},_i=(n,t)=>{const e=[],s=new Set;return{has:r=>s.has(r),register(r,i){s.has(r)||(s.add(r),i({registerView:(o,a,l=1)=>{e.push({id:r,version:l,kind:"view",name:o,factory:a})},registerService:(o,a,l=1)=>{e.push({id:r,version:l,kind:"service",name:o,factory:a})},putBuffer:ut,getBuffer:Z,gl:t}))},allow(r){var o,a;const i=new Set(r);for(const l of e){const c=i.has(l.id);l.kind==="view"?c?(o=n.registerView)==null||o.call(n,l.name,l.factory,l.version):(a=n.unregisterView)==null||a.call(n,l.name):c?n.registerService(l.name,l.factory,l.version):n.unregisterService(l.name)}}}},ki=n=>{const t=n.ownerDocument.createElement("div");t.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);",n.appendChild(t);const e=i=>Math.round(parseFloat(i)||0),s=()=>{const i=getComputedStyle(t);return{top:e(i.paddingTop),right:e(i.paddingRight),bottom:e(i.paddingBottom),left:e(i.paddingLeft)}};let r=null;return{set(i){r=i},current:()=>r??s(),destroy(){t.remove()}}},Ri={lightmap:"world","lightmap-masked":"world","lightmap-lite":"world","lightmap-masked-lite":"world",terrain:"world","terrain-lightmap":"world",foliage:"world","foliage-masked":"world","foliage-cards":"world"},Ge="material:",Ti=n=>{const t=new Set;for(const e of n)e.startsWith(Ge)&&t.add(Ri[e.slice(Ge.length)]??"base");return[...t].sort((e,s)=>e==="base"?-1:s==="base"?1:e.localeCompare(s))},Ai=""+new URL("assets/materials-BzTsWTWO.bin",import.meta.url).href,Mi=""+new URL("assets/materials-world-n3tLX5vO.bin",import.meta.url).href,Li=""+new URL("assets/neutral_ibl128-D-lzdkLN.ktx",import.meta.url).href,Pi=""+new URL("assets/uberarchive-Ok2HfJvn.bin",import.meta.url).href,Ci={base:Ai,world:Mi},Oi=n=>{const t=new Uint8Array(n.reduce((s,r)=>s+r.byteLength,0));let e=0;for(const s of n)t.set(new Uint8Array(s),e),e+=s.byteLength;return t.buffer},Ii=async n=>{const t=async o=>{const a=await fetch(o);if(!a.ok)throw new Error(`${o} → HTTP ${a.status}`);return a.arrayBuffer()},e=Ti(n).map(o=>Ci[o]).filter(o=>!!o),[s,r,...i]=await Promise.all([t(Li),t(Pi),...e.map(t)]);return{1:s,2:r,...i.length>0?{3:Oi(i)}:{}}},Fi=n=>{const t=()=>n.push(document.hidden?"pause":"resume"),e=()=>n.push("online"),s=()=>n.push("offline");return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),window.addEventListener("offline",s),{table:{state:()=>document.hidden?"background":"active",isOnline:()=>navigator.onLine,openUrl(i){window.open(i,"_blank","noopener")},worldChange(){var i;(i=n.onWorldChange)==null||i.call(n)},setOrientation(i){var l,c,h,u;const o=i==="landscape"||i==="portrait"?i:"auto";if(n.onOrientation){n.onOrientation(o);return}const a=typeof screen<"u"?screen.orientation:void 0;if(a)try{o==="auto"?(l=a.unlock)==null||l.call(a):(u=(h=(c=a.lock)==null?void 0:c.call(a,o))==null?void 0:h.catch)==null||u.call(h,()=>{})}catch{}}},emit:(i,o)=>n.push(i,o),dispose(){document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener("offline",s)}}},Ni=(n,t,e,s)=>{try{const r=document.createElement("input");r.type="file",r.multiple=e,s&&(r.accept=s),r.onchange=async()=>{const{files:i}=r;if(e){const o=[];if(!i)return n([]);for(let a of i)o.push([ut(await a.arrayBuffer()),a.name,a.size]);n(o)}else{if(!i||i.length===0)return n(null);n([[ut(await i[0].arrayBuffer()),i[0].name,i[0].size]])}},window.addEventListener("focus",()=>{setTimeout(()=>{(!r.files||r.files.length===0)&&n(e?[]:null)},300)},{once:!0}),r.click()}catch(r){t(r)}},An=n=>n==="camera"?"camera":n==="microphone"||n==="speech"?"microphone":n==="location"?"geolocation":null,Mn=(n,t,e)=>{const s=An(n);if(!s){e(`${n}: not a permission this host asks for`);return}const r=navigator.permissions;if(!(r!=null&&r.query)){t("prompt");return}r.query({name:s}).then(i=>t(i.state),()=>t("prompt"))},Ui=(n,t,e)=>{if(!An(n)){e(`${n}: not a permission this host asks for`);return}const s=()=>Mn(n,t,e);if(n==="location"){if(!navigator.geolocation){t("denied");return}navigator.geolocation.getCurrentPosition(()=>t("granted"),i=>i.code===i.PERMISSION_DENIED?t("denied"):s(),{timeout:15e3,maximumAge:1/0});return}const r=navigator.mediaDevices;if(!(r!=null&&r.getUserMedia)){t("denied");return}r.getUserMedia(n==="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"):s()})},Bi=n=>({get platform(){return"web"},get language(){return n()},get pixelRatio(){return window.devicePixelRatio||1},vibrate(){var t;try{(t=navigator.vibrate)==null||t.call(navigator,30)}catch{}},clipboardWrite(t){var e;(e=navigator.clipboard)==null||e.writeText(t).catch(()=>{})},clipboardRead(t,e){const s=navigator.clipboard;if(!(s!=null&&s.readText)){e("Clipboard is not available");return}s.readText().then(t,r=>e(r instanceof Error?r.message:"Clipboard read failed"))},share(t){const e=URL.createObjectURL(Wt(t)),s=document.createElement("a");s.href=e,s.download="image.png",document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(e)},openFilePicker:(t,e,s,r)=>Ni(t,e,s,r??void 0),queryPermission:Mn,requestPermission:Ui}),Wi=(n={})=>({local:t=>hr(t),dispose:t=>or(t),request(t,e,s,r,i,o,a,l){if(t.startsWith("id:")){const u=Number(t.slice(3));o(u,Z(u)?200:404);return}const c={};for(let u=0;u+1<s.length;u+=2)c[s[u]]=s[u+1];let h;if(i.length>0){const u=new FormData;for(const f of i)f.key!==null&&(f.bufferId>0?u.append(f.key,Wt(f.bufferId),f.filename??void 0):u.append(f.key,f.value??""));h=u}else r!==null&&(h=r);(async()=>{var u;try{const f=await fetch(t,{method:e,headers:c,body:h,mode:"cors",credentials:"omit"}),d=l?(u=f.body)==null?void 0:u.getReader():void 0;if(!d){o(ut(await f.arrayBuffer()),f.status);return}const p=Number(f.headers.get("content-length"))||void 0,y=[];let b=0;for(;;){const{done:v,value:_}=await d.read();if(v)break;_&&(y.push(_),b+=_.length,l({loaded:b,total:p}))}const x=new Uint8Array(b);let m=0;for(const v of y)x.set(v,m),m+=v.length;o(ut(x.buffer),f.status)}catch(f){a(f instanceof Error?f.message:String(f))}})()},buffer:t=>{const e=Z(t);return e?new Uint8Array(e):null},putBuffer:t=>ut(t.slice().buffer),bufferSlice(t,e,s){const r=Z(t);if(!r)return null;const i=Math.max(0,Math.min(e,r.byteLength)),o=Math.max(i,Math.min(s,r.byteLength));return new Uint8Array(r,i,o-i)},systemBuffer:t=>{const e=n[t];return e?new Uint8Array(e):null}}),je=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],Yt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],Pt=4,qt=16,ze=16,Di=.5,Hi=n=>{const t=new Set;let e=null;const s=(E,R,U=-1,L=0)=>{e==null||e(E,R,U,L)},r=E=>{if(!E.code)return;const R=t.has(E.code);t.add(E.code),s(0,E.code,-1,R||E.repeat?1:0)},i=E=>{E.code&&t.delete(E.code)&&s(1,E.code)},o=()=>{for(const E of[...t])E.startsWith("Gamepad")||(t.delete(E),s(1,E))},{root:a}=n;let l=0,c=0,h=0,u=0,f=0,d=0,p=0,y=0,b=0,x=0;const m=E=>{if(E.pointerType&&E.pointerType!=="mouse")return;const R=a.getBoundingClientRect();l=E.clientX-R.left,c=E.clientY-R.top,h+=E.movementX||0,u+=E.movementY||0},v=E=>{const R=je[E.button];R&&(t.add(R),s(0,R))},_=E=>{const R=je[E.button];R&&t.delete(R)&&s(1,R)},T=E=>{const R=E.deltaMode===0?.01:1;f+=E.deltaX*R,d+=E.deltaY*R},P=E=>{document.pointerLockElement===a&&E.preventDefault()},O=[],I=[],F=[],$=()=>{var R,U;const E=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let L=0;L<Pt;L++){const tt=E[L]??null,J=!!tt&&tt.connected;if(J!==!!O[L]){if(O[L]=J,!J){for(const N of Yt)t.delete(N+"@"+L)&&(s(1,N,L),z(N));F[L]=[],I[L]=[0,0,0,0,0,0]}s(J?2:3,"",L)}if(!tt||!J)continue;const it=tt.axes,dt=tt.buttons,kt=((R=dt[6])==null?void 0:R.value)??0,S=((U=dt[7])==null?void 0:U.value)??0;I[L]=[it[0]??0,it[1]??0,it[2]??0,it[3]??0,kt,S];const C=F[L]??(F[L]=[]);for(let N=0;N<Yt.length;N++){const Q=dt[N],et=!!Q&&(Q.pressed||Q.value>Di);if(et===!!C[N])continue;C[N]=et;const Rt=Yt[N];et?t.add(Rt+"@"+L):t.delete(Rt+"@"+L),z(Rt),s(et?0:1,Rt,L)}}},z=E=>{let R=!1;for(let U=0;U<Pt&&!R;U++)t.has(E+"@"+U)&&(R=!0);R?t.add(E):t.delete(E)};let G=0;const Y=()=>{p=h,y=u,b=f,x=d,h=u=f=d=0,$(),G=requestAnimationFrame(Y)},g=n.windows.filter((E,R,U)=>E&&U.indexOf(E)===R);for(const E of g)n.keyboard!==!1&&(E.addEventListener("keydown",r),E.addEventListener("keyup",i)),E.addEventListener("blur",o);return a.addEventListener("pointermove",m,!0),a.addEventListener("mousedown",v,!0),window.addEventListener("mouseup",_,!0),a.addEventListener("wheel",T,{passive:!0,capture:!0}),a.addEventListener("contextmenu",P,!0),typeof requestAnimationFrame=="function"&&(G=requestAnimationFrame(Y)),{inputKey:(E,R)=>R>=0&&E.startsWith("Gamepad")?t.has(E+"@"+R):t.has(E),inputRead:E=>{var R;switch(E){case 0:return l;case 1:return c;case 2:return p;case 3:return y;case 4:return b;case 5:return x;case 6:return document.pointerLockElement===a?1:0;case 7:{let U=0;for(let L=0;L<Pt;L++)O[L]&&U++;return U}}if(E>=qt){const U=Math.floor((E-qt)/ze),L=(E-qt)%ze;return U>=Pt||!O[U]?0:L===0?1:((R=I[U])==null?void 0:R[L-1])??0}return 0},inputSetPointerLock:E=>{if(!E)return document.pointerLockElement===a&&document.exitPointerLock(),!0;if(document.pointerLockElement===a)return!0;if(typeof a.requestPointerLock!="function")return!1;try{const R=a.requestPointerLock({unadjustedMovement:!0});return R&&typeof R.catch=="function"&&R.catch(()=>{try{a.requestPointerLock()}catch{}}),!0}catch{return!1}},registerInputEvent:E=>{e=E},dispose:()=>{for(const E of g)E.removeEventListener("keydown",r),E.removeEventListener("keyup",i),E.removeEventListener("blur",o);a.removeEventListener("pointermove",m,!0),a.removeEventListener("mousedown",v,!0),window.removeEventListener("mouseup",_,!0),a.removeEventListener("wheel",T,!0),a.removeEventListener("contextmenu",P,!0),G&&cancelAnimationFrame(G),document.pointerLockElement===a&&document.exitPointerLock(),t.clear(),e=null}}},$i=n=>{const t=Hi(n);return t.registerInputEvent(n.push),{table:{key:t.inputKey,read:t.inputRead,setPointerLock:t.inputSetPointerLock,keyboardHeight:n.keyboardHeight},dispose:t.dispose}},Vi={createVideo:Sr,createAudio:_r,setVolume:kr,setPlaying:Rr,setLoop:Tr,time:Ar,setTime:Mr,duration:Lr,remove:Pr},Gi=()=>{const n=new Map,t=new Map,e=new Map;let s=1;return{registerService:(f,d,p=1)=>{n.set(f,d),t.set(f,p)},unregisterService:f=>{n.delete(f),t.delete(f)},isServiceSupported:f=>n.has(f),serviceVersion:f=>t.get(f)??0,serviceOpen:(f,d,p)=>{const y=n.get(f);if(!y)return-1;const b=s++,x=y(d?JSON.parse(d):{},{emit:(m,v)=>{v===void 0?p(m):p(m,v)}});return e.set(b,x),b},serviceCall:(f,d,p,y,b)=>{const x=e.get(f);if(!(x!=null&&x.call)){b(`Service call "${d}": no live session or no call handler (serviceId ${f})`);return}try{Promise.resolve(x.call(d,Array.isArray(p)?p:[])).then(m=>{m===void 0?y():y(m)},m=>b(m instanceof Error?m.message:String(m)))}catch(m){b(m instanceof Error?m.message:String(m))}},serviceClose:f=>{var d,p;(p=(d=e.get(f))==null?void 0:d.close)==null||p.call(d),e.delete(f)},destroy:()=>{var f;for(const d of e.values())(f=d.close)==null||f.call(d);e.clear()}}},ji=()=>{const n=Gi();return{table:{supported:n.isServiceSupported,version:n.serviceVersion,open:n.serviceOpen,call:n.serviceCall,close:n.serviceClose},registerService:n.registerService,unregisterService:n.unregisterService,dispose:n.destroy}},zi=()=>{const n=[];return{table:{open(e,s){const r=new WebSocket(e);return r.addEventListener("open",()=>s("open")),r.addEventListener("message",i=>s("message",i.data)),r.addEventListener("close",i=>s("close",i.code)),r.addEventListener("error",()=>s("error")),n.push(r),n.length-1},send(e,s){var r;(r=n[e])==null||r.send(s)},close(e){var s;(s=n[e])==null||s.close()}},dispose(){for(const e of n)e.readyState===WebSocket.OPEN&&e.close();n.length=0}}},Ki=n=>{const t=e=>`lecodes:${n}:${e}`;return{load(e){try{return window.localStorage.getItem(t(e))}catch{return null}},save(e,s){try{window.localStorage.setItem(t(e),s)}catch{}}}},Ke=()=>{const n={};return{global:n,evaluate:e=>{const s=Object.getOwnPropertyNames(n);return new Function(...s,e)(...s.map(r=>n[r]))}}},Xi={fetch:ir,getBuffer:Z,getBlob:Wt,putBuffer:ut,putLocalBuffer:ar,hasLocalBuffer:cr,getLocalName:lr,getPlayer:de,removePlayers:gn},Yi=(n,t)=>({nodeFactory(){},setPropertyString(){},setPropertyInt(){},setFlags(){},insertNode(){},removeNode(){},releaseNode(){},openView(e,s,r){n(e,r)},dropView(e,s,r){t(e,r)},closeView(){n(-1,0)},layerOpen(){},layerClose(){},registerFont(e,s,r,i,o){o()},showToast(){},getButtonPressed:()=>!1,getTextValue:()=>"",vlistScroll(){}}),qi=async(n,t={})=>{var kt;const e=t.header,s=t.profile??(e?xi(e):"full"),r=(e==null?void 0:e.preloads)??new Set,i=t.ui!==!1,o=s==="full",a=s==="2d"||s==="full"&&!!(e!=null&&e.is2d),l=Ei(n),{doc:c,win:h}=l,u=i?Promise.all([si(void 0,c),ni((e==null?void 0:e.bootFonts)??[],c)]):null,f=o?di(l,r.has("capture")):null,d=a?pi(l):null,p=i?l.newCanvas():null,y=vi(h,o);o&&sr();const[b,x]=await Promise.all([Gn(s,{glContext:f==null?void 0:f.context,glOptions:f==null?void 0:f.options,gl2dContext:d==null?void 0:d.context,gl2dOptions:d==null?void 0:d.options,moduleArgs:{print:S=>{y.runtimeLine(S)?console.debug(S):console.log(S)},printErr:S=>{console.error(S)}}}),o?Ii(r):Promise.resolve({})]),m=(S,C)=>{const N=b.stringToNewUTF8(S);try{return C(N)}finally{b._free(N)}};let v=null,_=-1,T=-1,P=-1;const O=(S,C)=>{T=S,P=S===Tt?C:-1,S===Tt&&(f==null||f.show()),S===Pe&&(d==null||d.show()),v&&S===Tt&&C!==_&&(_=C,v.openScene(C))},I=S=>{S!==T&&(S===Tt&&(f==null||f.hide(),v&&_>=0&&(_=-1,v.closeScene())),S===Pe&&(d==null||d.hide()))};let F=null;const $=Si(o||t.engine3d?{creator:()=>F==null?void 0:F._creator,surface:f,presented:()=>P,frameRendered:()=>{var S;return!!((S=b._creatorWebFrameRendered)!=null&&S.call(b))},view:(f==null?void 0:f.canvas)??n}:null),z=Zs();let G=t.keyboardBand??0;const g=p?$s(n,{M:b,canvas:p,canvasHost:z,keyboardHeight:()=>{const S=h.visualViewport,C=S?Math.max(0,Math.round((h.innerHeight-S.height-S.offsetTop)/fe(n))):0;return C>0?C:G},onKeyboard:t.onKeyboard}):null;g&&(g.ui.onDestination=O,g.ui.onDropped=I);const M=Fi({onOrientation:t.onOrientation,onWorldChange:()=>$.worldChanged(),push:(S,C)=>{S==="url"&&C!==void 0&&m(C,N=>b._creatorWebSetLaunchUrl(N)),m(S,N=>{C===void 0?b._creatorWebAppEvent(N,0):m(C,Q=>b._creatorWebAppEvent(N,Q))})}}),A=zi(),W=ji(),q=$i({windows:[...new Set([h,...t.keyboardTargets??[]])],root:n,keyboard:t.keyboard!==!1,push:(S,C,N,Q)=>m(C,et=>b._creatorWebInputEvent(S,et,N,Q)),keyboardHeight:()=>(g==null?void 0:g.ui.keyboardHeight())??0}),_t={ui:(g==null?void 0:g.ui)??Yi(O,I),app:M.table,device:Bi(t.language??(()=>(h.navigator.language||"en").slice(0,2))),fetch:Wi(x),storage:Ki(t.project??(e==null?void 0:e.name)??"app"),socket:A.table,service:W.table,input:q.table,media:Vi,canvas:z.table,...f?{gl:f.table(b)}:{},...d?{scene2d:d.table(b)}:{}},E=Ke(),R=E.global;F=R,Zn(b,{host:_t,world:E,newWorld:()=>{const S=Ke();return F=S.global,S}});const U=_i({...g?{registerView:(S,C,N)=>g.ui.registerView(S,C,N),unregisterView:S=>g.ui.unregisterView(S)}:{},registerService:W.registerService,unregisterService:W.unregisterService},$.facade);b._creatorWebInit(),t.launchUrl&&m(t.launchUrl,S=>b._creatorWebSetLaunchUrl(S)),g==null||g.ui.install(),!o&&t.engine3d&&(v=await t.engine3d({newCanvas:l.newCanvas,preloads:r,canvasHost:z,stores:Xi}),Object.defineProperty(R,"_creator",{value:v,configurable:!0,writable:!0,enumerable:!1})),o&&(e==null?void 0:e.gl)!=="defer"&&((kt=R._creator)==null||kt.createEngine());const L=ki(n);t.safeArea&&L.set(t.safeArea);const tt=S=>{var C;f==null||f.resize(),d==null||d.resize(),(C=v==null?void 0:v._onResize)==null||C.call(v,S.width,S.height,S.factor),g?(g.resize(S.width,S.height,S.factor),g.setSafeArea(L.current())):b._creatorWebResize(S.width,S.height)};l.onResize(tt),tt(l.size());let J=0;const it=S=>{J=h.requestAnimationFrame(it),$.before(),f==null||f.frame(),b._creatorWebTick(S),$.after(),d==null||d.frame(S),g&&(g.ui.layoutFrame(),g.ui.tickHover(),g.render())};J=h.requestAnimationFrame(it),await u;let dt=!1;return{profile:s,M:b,world:R,ui:(g==null?void 0:g.ui)??null,engine3d:()=>v,getBuffer:S=>Z(S),run(S,C={}){const N=C.header??Tn(S);if(!ii(N.sdk,He))throw new Error(`This app was built with LeCodes SDK ${N.sdk??"older than 2.0"}; this host runs SDK ${He}. It needs a new build.`);const Q=y.track(S,C.onError);return U.allow(N.plugins),m(S,et=>b._creatorWebRun(et)),{dispose:Q.drop}},registerPlugin:(S,C)=>U.register(S,C),hasPlugin:U.has,locate:y.locate,safeArea:()=>L.current(),setSafeArea(S){L.set(S),g==null||g.setSafeArea(L.current())},setKeyboardBand(S){G=S??0,g==null||g.ui.refreshKeyboard()},remeasure:l.remeasure,emitAppEvent:M.emit,destroy(){var S;dt||(dt=!0,h.cancelAnimationFrame(J),y.dispose(),g==null||g.destroy(),q.dispose(),A.dispose(),W.dispose(),M.dispose(),gn(),L.destroy(),(S=v==null?void 0:v._dispose)==null||S.call(v),f==null||f.destroy(),d==null||d.destroy(),l.destroy())}}},Ji=(n,t)=>new Promise(e=>{const s=n.ownerDocument.defaultView??window;s.requestAnimationFrame(()=>{try{const r=[...n.querySelectorAll("canvas")].filter(c=>c.width>0&&c.height>0&&s.getComputedStyle(c).display!=="none");if(r.length===0){e(null);return}const i=n.getBoundingClientRect(),o=t??Math.max(...r.map(c=>c.width))/Math.max(1,i.width),a=n.ownerDocument.createElement("canvas");a.width=Math.max(1,Math.round(i.width*o)),a.height=Math.max(1,Math.round(i.height*o));const l=a.getContext("2d");if(!l){e(null);return}l.fillStyle="#000000",l.fillRect(0,0,a.width,a.height);for(const c of r)l.drawImage(c,0,0,c.width,c.height,0,0,a.width,a.height);e(a.toDataURL("image/png"))}catch{e(null)}})}),Qi=n=>{if(typeof n=="string")return n;if(n instanceof Error)return n.stack?`${String(n)}
19
19
  ${n.stack}`:String(n);try{return JSON.stringify(n)}catch{return String(n)}},Zi=(n,t)=>{const e=o=>{fetch(`${n}/log`,{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"},keepalive:!0}).catch(()=>{})};let s=-1;const r=async()=>{try{const{v:o}=await(await fetch(`${n}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(r,2500)};setTimeout(r,2500);const i=()=>{let o;try{o=new WebSocket(n.replace(/^http/,"ws")+"/ws")}catch{return}o.onopen=()=>o.send(JSON.stringify({type:"hello",v:s})),o.onmessage=a=>{let l={};try{l=JSON.parse(String(a.data))}catch{return}l.type==="reload"&&typeof l.v=="number"&&t(l.v)},o.onclose=()=>{setTimeout(i,2e3)}};return i(),{bundleUrl:o=>`${n}/bundle.js?t=web&v=${o}`,versionOf(o,a){const l=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(l)?l:a},ran(o){s=o},log:(o,a)=>e({type:"log",level:o,text:a.map(Qi).join(" ")}),error:o=>e({type:"error",text:o})}},to={ar:()=>D(()=>import("./assets/ar-CHvaraG4.js"),[],import.meta.url).then(n=>t=>n.register(t)),"audio-recorder":()=>D(()=>import("./assets/audio-recorder-Bt-Caym7.js"),[],import.meta.url).then(n=>t=>n.register(t)),browser:()=>D(()=>import("./assets/browser-BpFb50ko.js"),[],import.meta.url).then(n=>t=>n.register(t)),camera:()=>D(()=>import("./assets/camera-5XOM8eHl.js"),[],import.meta.url).then(n=>t=>n.register(t)),geolocation:()=>D(()=>import("./assets/geolocation-BjTKN9_P.js"),[],import.meta.url).then(n=>t=>n.register(t)),map:()=>D(()=>import("./assets/map-8PhtP3jn.js").then(n=>n.m),[],import.meta.url).then(n=>t=>n.register(t,()=>D(()=>import("./assets/map-CyBxOSV0.js"),[],import.meta.url).then(e=>e.resources))),"qr-scanner":()=>D(()=>import("./assets/qr-scanner-CK_cYoJR.js"),[],import.meta.url).then(n=>t=>n.register(t)),speech:()=>D(()=>import("./assets/speech-DzDPVK_j.js"),[],import.meta.url).then(n=>t=>n.register(t)),webrtc:()=>D(()=>import("./assets/webrtc-CbCltXvl.js"),[],import.meta.url).then(n=>t=>n.register(t))},eo=async(n,t)=>{await Promise.all([...t].map(async e=>{const s=to[e];if(!(!s||n.hasPlugin(e)))try{n.registerPlugin(e,await s())}catch(r){console.warn(`[lecodes] the "${e}" plugin failed to load: ${r instanceof Error?r.message:String(r)}`)}}))},ge=n=>typeof n=="object"&&n!==null,lt=n=>typeof n=="number"&&Number.isFinite(n),no=n=>{if(!ge(n))return null;switch(n.ask){case"tree":return{ask:"tree"};case"text":return{ask:"text"};case"at":return lt(n.x)&&lt(n.y)?{ask:"at",x:n.x,y:n.y}:null;case"node":return lt(n.node)?{ask:"node",node:n.node}:null;default:return null}},Ln=n=>{if(!ge(n))return null;const t=s=>typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.round(s):0,e=Array.isArray(n.bars)?n.bars.filter(s=>s==="top"||s==="right"||s==="bottom"||s==="left"):void 0;return{top:t(n.top),right:t(n.right),bottom:t(n.bottom),left:t(n.left),...e?{bars:e}:{}}},ro=n=>{const t=Number(n.get("keyboard-band"));return Number.isFinite(t)&&t>0?t:null},so=n=>{const t=n.get("safe-area");if(!t)return null;const[e,s,r,i]=t.split(",").map(Number);return Ln({top:e,right:s,bottom:r,left:i,bars:(n.get("bars")??"").split(",")})},io=n=>{if(!ge(n))return null;switch(n.type){case"lecodes:run":return typeof n.src=="string"?{type:"lecodes:run",src:n.src}:null;case"lecodes:reload":return{type:"lecodes:reload"};case"lecodes:safe-area":return{type:"lecodes:safe-area",insets:Ln(n.insets)};case"lecodes:language":return typeof n.language=="string"&&n.language?{type:"lecodes:language",language:n.language}:null;case"lecodes:keyboard-band":return{type:"lecodes:keyboard-band",height:lt(n.height)&&n.height>0?n.height:null};case"lecodes:inspect":{const t=no(n.question);return t&&lt(n.request)?{type:"lecodes:inspect",request:n.request,question:t}:null}case"lecodes:capture":{if(!lt(n.request))return null;const t=lt(n.pixelRatio)&&n.pixelRatio>0?Math.min(4,n.pixelRatio):void 0;return{type:"lecodes:capture",request:n.request,...t!==void 0?{pixelRatio:t}:{}}}default:return null}},oo=(n,t)=>{try{const e=new URL(n,t);return e.origin===new URL(t).origin&&(e.protocol==="http:"||e.protocol==="https:")?e.href:null}catch{return null}},ao=(n,t)=>{const e=n.parent!==n?n.parent:null,s=r=>{if(!e||r.source!==e)return;const i=io(r.data);i&&t(i)};return n.addEventListener("message",s),{embedded:e!==null,post(r){e==null||e.postMessage(r,"*")},close(){n.removeEventListener("message",s)}}},Ht=window.lecodesPlayerConfig??{},bt=document.getElementById("app"),Jt=document.getElementById("loader"),Xe=document.getElementById("error"),st=new URLSearchParams(location.search),Pn=n=>Jt==null?void 0:Jt.classList.toggle("on",n),Cn=n=>{Xe&&(Xe.textContent=window.parent===window?n:"")};let le=Ht.language||st.get("lang")||(navigator.language||"en").slice(0,2),Ft=Ht.safeArea??so(st),Nt=Ht.keyboardBand??ro(st),B=null;const Ye=()=>{var n;return(n=B==null?void 0:B.world)==null?void 0:n._creatorTree},Ut=st.has("test")?{ready:!1,dump:()=>{var n;return((n=Ye())==null?void 0:n.debugDump())??'{"roots":[]}'},rect:n=>{var s;const t=(s=Ye())==null?void 0:s.getBoundingClientRect(n);if(!t)return null;const e=bt.getBoundingClientRect();return[e.left+t[0],e.top+t[1],t[2],t[3]]}}:null;Ut&&(window.lecodesTest=Ut);const co=st.has("inspect"),he=co?D(()=>import("./assets/inspect-FppKjiJX.js"),[],import.meta.url):null;let wt=null;const lo=async(n,t)=>{const{createInspector:e}=await(he??D(()=>import("./assets/inspect-FppKjiJX.js"),[],import.meta.url));B&&wt===null&&(wt=e(B)),X.post({type:"lecodes:inspected",request:n,answer:(wt==null?void 0:wt.answer(t))??null})},qe=st.has("dev")?new URL(st.get("dev")||"..",location.href).href.replace(/\/$/,""):null,Je=n=>{var s;const t=n.frames[0],e=t?`
20
20
  at ${t.source}:${t.line}:${t.column}${t.fn?` (${t.fn})`:""}`:(s=n.nativeFrames)!=null&&s.length?`
21
- in ${n.nativeFrames[0]}`:"";return`${n.detail?`${n.message}: ${n.detail}`:n.message}${e}`},On=n=>{Cn(Je(n)),X.post({type:"lecodes:error",error:n}),j==null||j.error(Je(n))},In=n=>On({message:n,frames:[]});let ht=null,Qt=!1,Zt=null;const ho=async n=>{Pn(!0),Cn(""),B==null||B.destroy(),B=null,wt=null,bt.replaceChildren();const t=await fetch(n.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${n.src} → HTTP ${t.status}`);const e=await t.text(),s=Tn(e);B=await qi(bt,{header:s,language:()=>le,launchUrl:location.href,...Ft?{safeArea:Ft}:{},...Nt?{keyboardBand:Nt}:{},...X.embedded?{onKeyboard:(r,i)=>X.post({type:"lecodes:keyboard",height:r,duration:i})}:{},...X.embedded?{onOrientation:r=>X.post({type:"lecodes:orientation",mode:r})}:{}}),await eo(B,s.plugins),he&&(await he).recordSites(B),B.run(e,{onError:On}),Ut&&(Ut.ready=!0),j&&n.version!==void 0&&(Bt=j.versionOf(t,n.version),j.ran(Bt)),X.post({type:"lecodes:ready",src:n.src})},ft=n=>{if(Qt){Zt=n;return}Qt=!0,ht=n,ho(n).catch(t=>In(t instanceof Error?t.message:String(t))).finally(()=>{Pn(!1),Qt=!1;const t=Zt;Zt=null,t&&ft(t)})},me=n=>{const t=oo(n,location.href);t?ft({src:t}):In(`The player runs bundles of its own origin only: ${n}`)},Fn=n=>{Ft=n,B==null||B.setSafeArea(Ft)},uo=n=>{Nt=n,B==null||B.setKeyboardBand(Nt)},Nn=async n=>({image:B?await Ji(bt,n):null,width:bt.clientWidth,height:bt.clientHeight}),X=ao(window,n=>{switch(n.type){case"lecodes:run":me(n.src);break;case"lecodes:reload":ht&&ft(ht);break;case"lecodes:safe-area":Fn(n.insets);break;case"lecodes:keyboard-band":uo(n.height);break;case"lecodes:inspect":lo(n.request,n.question);break;case"lecodes:capture":Nn(n.pixelRatio).then(t=>X.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===le)break;le=n.language,ht&&ft(ht);break}});let Bt=-1;const j=qe?Zi(qe,n=>{Bt>=0&&n!==Bt&&ft({src:j.bundleUrl(n),version:n})}):null;if(j||X.embedded){let n=!1;for(const t of["log","warn","error"]){const e=console[t];console[t]=(...s)=>{if(e.apply(console,s),!(n||typeof s[0]=="string"&&s[0].startsWith("[lecodes] "))){n=!0;try{j==null||j.log(t,s),X.post({type:"lecodes:log",level:t,text:s.map(r=>typeof r=="string"?r:r instanceof Error?String(r):(()=>{try{return JSON.stringify(r)}catch{return String(r)}})()).join(" ")})}finally{n=!1}}}}}window.lecodesPlayer={version:"4e996da5-2026-10-17",get host(){return B},run:me,reload(){ht&&ft(ht)},setSafeArea:Fn,capture:async n=>(await Nn(n)).image};const Qe=Ht.src??st.get("src");j?ft({src:j.bundleUrl(0),version:0}):Qe&&me(Qe);export{D as _};
21
+ in ${n.nativeFrames[0]}`:"";return`${n.detail?`${n.message}: ${n.detail}`:n.message}${e}`},On=n=>{Cn(Je(n)),X.post({type:"lecodes:error",error:n}),j==null||j.error(Je(n))},In=n=>On({message:n,frames:[]});let ht=null,Qt=!1,Zt=null;const ho=async n=>{Pn(!0),Cn(""),B==null||B.destroy(),B=null,wt=null,bt.replaceChildren();const t=await fetch(n.src,{cache:"no-store"});if(!t.ok)throw new Error(t.status===503?"No successful compile yet — check the terminal.":`${n.src} → HTTP ${t.status}`);const e=await t.text(),s=Tn(e);B=await qi(bt,{header:s,language:()=>le,launchUrl:location.href,...Ft?{safeArea:Ft}:{},...Nt?{keyboardBand:Nt}:{},...X.embedded?{onKeyboard:(r,i)=>X.post({type:"lecodes:keyboard",height:r,duration:i})}:{},...X.embedded?{onOrientation:r=>X.post({type:"lecodes:orientation",mode:r})}:{}}),await eo(B,s.plugins),he&&(await he).recordSites(B),B.run(e,{onError:On}),Ut&&(Ut.ready=!0),j&&n.version!==void 0&&(Bt=j.versionOf(t,n.version),j.ran(Bt)),X.post({type:"lecodes:ready",src:n.src})},ft=n=>{if(Qt){Zt=n;return}Qt=!0,ht=n,ho(n).catch(t=>In(t instanceof Error?t.message:String(t))).finally(()=>{Pn(!1),Qt=!1;const t=Zt;Zt=null,t&&ft(t)})},me=n=>{const t=oo(n,location.href);t?ft({src:t}):In(`The player runs bundles of its own origin only: ${n}`)},Fn=n=>{Ft=n,B==null||B.setSafeArea(Ft)},uo=n=>{Nt=n,B==null||B.setKeyboardBand(Nt)},Nn=async n=>({image:B?await Ji(bt,n):null,width:bt.clientWidth,height:bt.clientHeight}),X=ao(window,n=>{switch(n.type){case"lecodes:run":me(n.src);break;case"lecodes:reload":ht&&ft(ht);break;case"lecodes:safe-area":Fn(n.insets);break;case"lecodes:keyboard-band":uo(n.height);break;case"lecodes:inspect":lo(n.request,n.question);break;case"lecodes:capture":Nn(n.pixelRatio).then(t=>X.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===le)break;le=n.language,ht&&ft(ht);break}});let Bt=-1;const j=qe?Zi(qe,n=>{Bt>=0&&n!==Bt&&ft({src:j.bundleUrl(n),version:n})}):null;if(j||X.embedded){let n=!1;for(const t of["log","warn","error"]){const e=console[t];console[t]=(...s)=>{if(e.apply(console,s),!(n||typeof s[0]=="string"&&s[0].startsWith("[lecodes] "))){n=!0;try{j==null||j.log(t,s),X.post({type:"lecodes:log",level:t,text:s.map(r=>typeof r=="string"?r:r instanceof Error?String(r):(()=>{try{return JSON.stringify(r)}catch{return String(r)}})()).join(" ")})}finally{n=!1}}}}}window.lecodesPlayer={version:"096c2377-2026-10-19",get host(){return B},run:me,reload(){ht&&ft(ht)},setSafeArea:Fn,capture:async n=>(await Nn(n)).image};const Qe=Ht.src??st.get("src");j?ft({src:j.bundleUrl(0),version:0}):Qe&&me(Qe);export{D as _};
@@ -1,5 +1,5 @@
1
1
  var Kn=Object.defineProperty;var Yn=(e,t,n)=>t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ke=(e,t,n)=>Yn(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 qn=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)}},Xn=(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(qn).join(" ")}),error:o=>n({type:"error",text:o})}},Jn=(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}},Qn="modulepreload",Zn=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=Zn(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":Qn,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.3.1",Ye=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},er=(e,t)=>Ye(e)!==null&&Ye(e)===Ye(t),tr=(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},nr=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))])},rr=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:tr(t)}},or=1,sr=2,ir=3,ar=4,lr=5,cr=6,_t=7,ur=8,kt=9,fr=10,dr=11,pr=12,hr=13,mr=14,gr=15,br=16,Lt=17,yr=18,vr=19,Ue=20,vi=21,Ei=22,wi=23,Si=24,_i=25,Er=26,wr=27,Sr=28,_r=29,Tt=30,xt=31,kr=32,Lr=33,Rt=34,At=35,Ct=36,Ie=1,Tr=2,xr=4,pe=8,Rr=16,qe=32,Ar=64,Xe=128,Cr=256,$r=512,Or=1024,Ur=2048,Mr=4096,$t=8192,ki=16384,Nr=32768,Fr=1<<18,Pr=255,Ot=256,Ut=512,Ir=1024,Z=0,Dr=1,Br=2,Vr=3,Be=4,ye=255,dn=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)},Wr=(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"},zr={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"},Gr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],jr={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},Hr=["duration","delay","layer","commit","loop","loopMode","name"];function pn(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 Kr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Yr=/\b(?:calc|min|max|clamp)\(/,qr=e=>{if(!Yr.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"})},Xr={top:"12px",bottom:"4px",left:"16px",right:"16px"},hn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${Xr[e]})))`,Jr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Ae=e=>qr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>hn(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+Jr[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},Qr=/^(rotate|skew)/,Zr=/^translate/,eo=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,s)=>{const i=Zr.test(r)?"px":Qr.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(", ")})`})},mn=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"],to=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?hn(t):se(e),lt=(e,t)=>{const n=(s,i)=>({rank:i,to:o=>s.map(l=>[t(l),to(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)}},no=()=>{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},ro=new Set(["none","solid","dashed","dotted","double","hidden"]),oo=/^-?\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)))ro.has(l)?i=l:oo.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}}),so=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"))},gn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},io=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),bn=(e,t)=>{if(gn(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("${pn(io(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},ao=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,yn=e=>{const t=String(e??"").trim();return t===""?"none":Ae(t)},lo=(e,t)=>{const n=typeof e=="string"&&ao.test(e),r=gn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?yn(e):"none"],["--lc-bg-img",r?bn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},co=e=>{const t=typeof e=="number"?[e+"px"]:mt(String(e)).map(o=>mn(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"]]},uo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),fo=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||uo.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},po=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",ho=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},...no(),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",bn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",yn(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:co,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",eo(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",fo(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",po(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",ho({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:lo,rank:Q},border:we(De,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:so,rank:Q}},Je=e=>zr[e]??e,mo=e=>e in $e,vn=e=>{const t=$e[e];return!!t&&"attr"in t},go={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"},bo=e=>{const t=$e[e];return t&&"css"in t&&typeof t.css=="string"?t.css:go[e]??null},yo={len:se,lens:mn,num:e=>String(e),raw:e=>String(e),color:Ce},vo={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=yo[l.as??vo[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(";"),En=0,wn=1,Te=2,xe=3,Sn=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)]],Eo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},wo=e=>{const t=Eo[e]??e;for(let n=0;n<ct.length;n++)if(ct[n][0]===t)return n;return-1},So=[.25,.1,.25,1],Fe={kind:En,p:[0,0,0,0]},_o=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},ko=e=>{if(e===void 0)return Fe;if(typeof e=="function")return{kind:Sn,p:[0,0,0,0],table:_o(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:So};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=wo(t);return r===0?Fe:r>0?{kind:wn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Fe)},Lo=(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},To=(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 wn:return ct[e.p[0]][1](t);case Te:return Lo(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 Sn:{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),xo="cubic-bezier(0.3333, 0, 0.6667, 1)",Ro=e=>{switch(e.kind){case En: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(To(e,n/Vt)));return`linear(${t.join(", ")})`},Ao=e=>e===void 0||e==="smoothstep"?xo:Ro(ko(e)),_n=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],Co=["--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"],kn="lc-app",$o=`
2
+ ${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},Xn=(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(qn).join(" ")}),error:o=>n({type:"error",text:o})}},Jn=(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}},Qn="modulepreload",Zn=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=Zn(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":Qn,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.4.0",Ye=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},er=(e,t)=>Ye(e)!==null&&Ye(e)===Ye(t),tr=(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},nr=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))])},rr=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:tr(t)}},or=1,sr=2,ir=3,ar=4,lr=5,cr=6,_t=7,ur=8,kt=9,fr=10,dr=11,pr=12,hr=13,mr=14,gr=15,br=16,Lt=17,yr=18,vr=19,Ue=20,vi=21,Ei=22,wi=23,Si=24,_i=25,Er=26,wr=27,Sr=28,_r=29,Tt=30,xt=31,kr=32,Lr=33,Rt=34,At=35,Ct=36,Ie=1,Tr=2,xr=4,pe=8,Rr=16,qe=32,Ar=64,Xe=128,Cr=256,$r=512,Or=1024,Ur=2048,Mr=4096,$t=8192,ki=16384,Nr=32768,Fr=1<<18,Pr=255,Ot=256,Ut=512,Ir=1024,Z=0,Dr=1,Br=2,Vr=3,Be=4,ye=255,dn=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)},Wr=(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"},zr={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"},Gr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],jr={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},Hr=["duration","delay","layer","commit","loop","loopMode","name"];function pn(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 Kr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Yr=/\b(?:calc|min|max|clamp)\(/,qr=e=>{if(!Yr.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"})},Xr={top:"12px",bottom:"4px",left:"16px",right:"16px"},hn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${Xr[e]})))`,Jr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Ae=e=>qr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>hn(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+Jr[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},Qr=/^(rotate|skew)/,Zr=/^translate/,eo=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,s)=>{const i=Zr.test(r)?"px":Qr.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(", ")})`})},mn=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"],to=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?hn(t):se(e),lt=(e,t)=>{const n=(s,i)=>({rank:i,to:o=>s.map(l=>[t(l),to(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)}},no=()=>{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},ro=new Set(["none","solid","dashed","dotted","double","hidden"]),oo=/^-?\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)))ro.has(l)?i=l:oo.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}}),so=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"))},gn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},io=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),bn=(e,t)=>{if(gn(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("${pn(io(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},ao=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,yn=e=>{const t=String(e??"").trim();return t===""?"none":Ae(t)},lo=(e,t)=>{const n=typeof e=="string"&&ao.test(e),r=gn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?yn(e):"none"],["--lc-bg-img",r?bn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},co=e=>{const t=typeof e=="number"?[e+"px"]:mt(String(e)).map(o=>mn(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"]]},uo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),fo=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||uo.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},po=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",ho=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},...no(),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",bn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",yn(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:co,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",eo(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",fo(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",po(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",ho({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:lo,rank:Q},border:we(De,Q),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:so,rank:Q}},Je=e=>zr[e]??e,mo=e=>e in $e,vn=e=>{const t=$e[e];return!!t&&"attr"in t},go={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"},bo=e=>{const t=$e[e];return t&&"css"in t&&typeof t.css=="string"?t.css:go[e]??null},yo={len:se,lens:mn,num:e=>String(e),raw:e=>String(e),color:Ce},vo={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=yo[l.as??vo[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(";"),En=0,wn=1,Te=2,xe=3,Sn=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)]],Eo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},wo=e=>{const t=Eo[e]??e;for(let n=0;n<ct.length;n++)if(ct[n][0]===t)return n;return-1},So=[.25,.1,.25,1],Fe={kind:En,p:[0,0,0,0]},_o=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},ko=e=>{if(e===void 0)return Fe;if(typeof e=="function")return{kind:Sn,p:[0,0,0,0],table:_o(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:So};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=wo(t);return r===0?Fe:r>0?{kind:wn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Fe)},Lo=(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},To=(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 wn:return ct[e.p[0]][1](t);case Te:return Lo(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 Sn:{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),xo="cubic-bezier(0.3333, 0, 0.6667, 1)",Ro=e=>{switch(e.kind){case En: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(To(e,n/Vt)));return`linear(${t.join(", ")})`},Ao=e=>e===void 0||e==="smoothstep"?xo:Ro(ko(e)),_n=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],Co=["--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"],kn="lc-app",$o=`
3
3
  @layer ${_n.join(", ")};
4
4
 
5
5
  @layer lc-base {
@@ -223,8 +223,8 @@ const buildDesktop = async (flags: FlagValues<typeof desktopBuildFlags>): Promis
223
223
 
224
224
  // 3) Pruned app.json — the host (≥1.3.0) reads name + desktop.window next to app.js, so the
225
225
  // folder carries its own window config (title/size/min/resizable/fullscreen); a newer host also
226
- // reads desktop.mouseEmulateTouch + desktop.virtualKeyboard there (an older one skips the
227
- // unknown fields).
226
+ // reads desktop.mouseEmulateTouch, desktop.virtualKeyboard, desktop.frameRate and desktop.vsync
227
+ // there (an older one skips the unknown fields).
228
228
  const desktop = config.desktop
229
229
  writeJson(join(out, "app.json"), {
230
230
  name,
@@ -232,6 +232,8 @@ const buildDesktop = async (flags: FlagValues<typeof desktopBuildFlags>): Promis
232
232
  window: desktop.window,
233
233
  ...(desktop.mouseEmulateTouch !== undefined ? { mouseEmulateTouch: desktop.mouseEmulateTouch } : {}),
234
234
  ...(desktop.virtualKeyboard !== undefined ? { virtualKeyboard: desktop.virtualKeyboard } : {}),
235
+ ...(desktop.frameRate !== undefined ? { frameRate: desktop.frameRate } : {}),
236
+ ...(desktop.vsync !== undefined ? { vsync: desktop.vsync } : {}),
235
237
  } } : {}),
236
238
  })
237
239