lecodes-cli 2.2.4 → 2.2.5

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": "724e438-2026-10-12",
3
- "commit": "724e438",
4
- "date": "2026-10-12T06:23:27.009Z"
2
+ "version": "106118c-2026-10-12",
3
+ "commit": "106118c",
4
+ "date": "2026-10-12T07:16:49.262Z"
5
5
  }
@@ -10,7 +10,7 @@ var Mn=Object.defineProperty;var Ln=(n,t,e)=>t in n?Mn(n,t,{enumerable:!0,config
10
10
  `)){if(i.length===0){s.push("");continue}let o=i;for(;o;){if(e(o)<=t){s.push(o),r=Math.max(r,e(o));break}let a=0,h=-1,l=0;for(;(l=o.indexOf(" ",l+1))!==-1&&!(e(o.substring(0,l))>t);)h=l;if(h>0)a=h;else{let f=o.indexOf(" ");f===-1&&(f=o.length);const u=o.substring(0,f);if(e(u)>t){for(let d=1;d<=u.length;d++)if(e(u.substring(0,d))>t){a=d-1;break}}else for(let d=f+1;d<=o.length;d++)if(e(o.substring(0,d))>t){a=d-1;break}}a<=0&&(a=1);const c=o.substring(0,a);s.push(c),r=Math.max(r,e(c)),o=o.substring(a+(h>0?1:0))}}return{lines:s,maxWidth:r}}const $t="…";function un(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]=Vr(i[r-1],e,s)),i}function Vr(n,t,e){if(!isFinite(t))return n+$t;const s=[...n];let r=s.length;for(;r>0&&e(s.slice(0,r).join("")+$t)>t;)r--;return s.slice(0,r).join("").trimEnd()+$t}function jr(n,t,e){const s=se(n),r=hn(s),i=isNaN(e)?1/0:e,o=c=>t.measureText(c,r),a=xt(n.text??"",i,o),h=un(a.lines,n.style,i,o);let l=a.maxWidth;if(h!==a.lines){l=0;for(const c of h)l=Math.max(l,o(c))}return{width:Math.ceil(l),height:Math.ceil(h.length*s.lineHeight)}}function zr(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,h=xt(o,a,l=>t.measureText(l,r));return{width:Math.ceil(h.maxWidth),height:Math.ceil(Math.max(1,h.lines.length)*i)}}function Xr(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(rn(r)){const l=ee(r.svg);if(l)i=l.width,o=l.height;else{const c=t.getImage(t.resolveSrc(r)??"");i=(c==null?void 0:c.naturalWidth)??0,o=(c==null?void 0:c.naturalHeight)??0}}else{const l=t.resolveSrc(r),c=l?t.getImage(l):void 0;i=(c==null?void 0:c.naturalWidth)??0,o=(c==null?void 0:c.naturalHeight)??0}if(i===0||o===0)return{width:0,height:0};const a=Math.min(e/i,s/o),h=isNaN(e)&&isNaN(s)?1:isNaN(e)?s/o:isNaN(s)?e/i:Math.min(a,1);return{width:i*h,height:o*h}}const dn=(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 Kr(n,t,e,s,r,i,o={}){t.beginFrame(s,r);for(const a of n)fn(a.tree,t,e,o);t.endFrame()}function fn(n,t,e,s){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[c,f,u,d,p,b]=dn(r.transform,r.transformBox,i.width,i.height),g=r.transformOrigin,x=i.x+(g?g.xPercent?i.width*g.x/100:g.x:i.width/2),w=i.y+(g?g.yPercent?i.height*g.y/100:g.y:i.height/2);t.translate(x,w),t.transform(c,f,u,d,p,b),t.translate(-x,-w)}const h=re(r.borderRadius,i);if(ne(r.backgroundColor)||t.fillRoundRect(i,h,r.backgroundColor),r.backgroundImage){const c=e.getImage(r.backgroundImage);c&&c.naturalWidth>0&&c.naturalHeight>0&&(t.save(),ke(h)&&t.clipRoundRect(i,h),t.drawImage(c,null,i,{fit:Yr(r.backgroundSize),tile:r.backgroundSize==="tile"}),t.restore())}if(r.backgroundGradients)for(let c=r.backgroundGradients.length-1;c>=0;c--){const f=r.backgroundGradients[c];f.stops.length>0&&t.fillGradient(i,h,f)}if(n.image&&n.image.naturalWidth>0&&n.image.naturalHeight>0){const c=n.sourceRect;t.save(),ke(h)&&t.clipRoundRect(i,h),t.drawImage(n.image,c?{x:c[0],y:c[1],width:c[2],height:c[3]}:null,i,{fit:c?"fill":r.objectFit??"contain",tint:Nt(n.image.src)?r.tintColor:void 0,radius:h}),t.restore()}n.type==="text"&&n.lines&&n.lines.length>0&&Jr(n,t,e),(n.type==="input"||n.type==="textarea")&&n.id!==s.editing&&Zr(n,t,e,h),(n.type==="video"||n.type==="native")&&(s.surfaces?t.clearRoundRect(i,h):n.type==="video"&&Qr(n,t,e,h)),n.clip&&t.clipRoundRect(i,h);for(const c of n.children)c.overlay!==void 0&&!ne(c.overlay)&&t.fillRoundRect(i,void 0,c.overlay),fn(c,t,e,s);r.dim!==void 0&&r.dim>0&&t.fillRoundRect(i,h,Math.round(Math.min(1,r.dim)*255)>>>0);const l=qr(r.border);l&&t.strokeBorder(i,h,l),a&&t.endGroup(),t.restore()}function Yr(n){return n==="contain"||n==="fill"?n:"cover"}function qr(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 pn=(n,t)=>{var s;const e=t??"Roboto";return((s=n.resolveFontFamily)==null?void 0:s.call(n,e))??e};function Jr(n,t,e){var g,x,w;const s=n.style,r={family:pn(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",h=e.fontMetrics(r),{rect:l,lines:c}=n,f=((g=n.padding)==null?void 0:g[0])??0,u=((x=n.padding)==null?void 0:x[1])??0,d=((w=n.padding)==null?void 0:w[2])??0,p=l.x+f,b=l.width-f-d;for(let v=0;v<c.length;v++){const k=c[v],P=l.y+u+v*o+(o-(h.ascent+h.descent))/2+h.ascent,C=e.measureText(k,r),O=a==="center"?p+(b-C)/2:a==="end"?p+b-C:p;if(t.fillText(k,O,P,r,i),s.textDecoration==="underline"||s.textDecoration==="line-through"){const N=Math.max(1,r.size/14),X=s.textDecoration==="underline"?P+N:P-r.size*.3;t.fillRoundRect({x:O,y:X,width:C,height:N},void 0,i)}}}function Qr(n,t,e,s){const{rect:r}=n;ne(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),h=e.measureText("▶",o),l=r.x+(r.width-h)/2,c=r.y+(r.height-(a.ascent+a.descent))/2+a.ascent;t.fillText("▶",l,c,o,4294967244)}}function Zr(n,t,e,s){var T,$,j,y,L;const r=n.style,i={family:pn(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,h=r.inputType==="password"&&!a,l=a?r.placeholder??"":h?"•".repeat(o.length):o,c=a?r.placeholderColor??2576980479:r.color??255,{rect:f}=n,u=((T=n.padding)==null?void 0:T[0])??0,d=(($=n.padding)==null?void 0:$[1])??0,p=((j=n.padding)==null?void 0:j[2])??0,b=((y=n.padding)==null?void 0:y[3])??0,g=f.x+u,x=f.width-u-p,w=f.y+d,v=f.height-d-b,k=e.fontMetrics(i),A=r.lineHeight,P=r.textAlign??"start",C=n.type==="textarea",O=C?xt(l,x,M=>e.measureText(M,i)).lines:[l],N=M=>P==="center"?g+(x-M)/2:P==="end"?g+x-M:g,X=M=>C?w+M*A+(A-(k.ascent+k.descent))/2+k.ascent:w+(v-(k.ascent+k.descent))/2+k.ascent;t.save(),t.clipRoundRect(f,s);for(let M=0;M<O.length;M++){const D=O[M];D.length>0&&t.fillText(D,N(e.measureText(D,i)),X(M),i,c)}if((L=n.state)!=null&&L.focused){const M=a?[""]:C?xt(h?"•".repeat(o.length):o,x,U=>e.measureText(U,i)).lines:[l],D=M.length-1,K=e.measureText(M[D],i),ht=a?N(0):N(K)+K,E=X(D),R=Math.max(1,i.size/14);t.fillRoundRect({x:ht,y:E-k.ascent,width:R,height:k.ascent+k.descent},void 0,r.color??255)}t.restore()}const ts=82,es={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},objectFit:{word:65},placeholder:{word:66},type:{word:67},dim:{word:81}},ns={hidden:1},rs={horizontal:1},ss={italic:1},ft={display:["flex","none"],backgroundSize:["cover","contain","fill","tile"],textDecoration:["underline","line-through","none"],textOverflow:["ellipsis","clip"],objectFit:["cover","contain","fill"],type:["text","password","tel","email","number","decimal","url","search","date","time"]},is=(n,t,e)=>e<32?(n>>>e&1)===1:(t>>>e-32&1)===1,os=["farthest-corner","closest-side","closest-corner","farthest-side"],as=52;function cs(n,t,e,s){const r=[];for(let i=0;i<s;i++)r.push(ls(n,t,e+i*as));return r}function ls(n,t,e){const s=e>>2,r=n[s],i=t[s+1],o=t[s+2],a=t[s+4],h=[];for(let l=0;l<o;l++){const c=a+l*8>>2;h.push({color:t[c]>>>0,position:n[c+1]})}if(i===1){const l=t[s+6],c={type:"radial",shape:t[s+5]===1?"circle":"ellipse",cx:n[s+7],cy:n[s+8],stops:h};return l===4?{...c,extent:"explicit",rx:n[s+9],ry:n[s+10],rxUnit:t[s+11]===1?"fraction":"px",ryUnit:t[s+12]===1?"fraction":"px"}:{...c,extent:os[l]??"farthest-corner"}}return{type:"linear",angle:r,stops:h}}const _=es,hs=["start","center","end","start","end"];let _t=0;function gn(n,t,e){const s=n.HEAPU32,r=n.HEAPF32,i=t>>>2,o=s[i],a=s[i+1],h=O=>is(o,a,O),l=O=>{const N=s[i+O];return N===0?void 0:n.UTF8ToString(n._cuiStringOf(N))};e.backgroundColor=s[i+_.backgroundColor.word]>>>0,e.opacity=r[i+_.opacity.word],e.dim=r[i+_.dim.word],e.display=ft.display[s[i+_.display.word]],e.overflow=s[i+_.overflow.word]===ns.hidden?"hidden":"visible",e.scrollAxis=s[i+_.scrollDirection.word]===rs.horizontal?"x":"y",e.border={top:{width:r[i+_.borderTopWidth.word],color:s[i+_.borderTopColor.word]>>>0},right:{width:r[i+_.borderRightWidth.word],color:s[i+_.borderRightColor.word]>>>0},bottom:{width:r[i+_.borderBottomWidth.word],color:s[i+_.borderBottomColor.word]>>>0},left:{width:r[i+_.borderLeftWidth.word],color:s[i+_.borderLeftColor.word]>>>0}},e.borderRadius={tl:r[i+_.borderTopLeftRadius.word],tr:r[i+_.borderTopRightRadius.word],br:r[i+_.borderBottomRightRadius.word],bl:r[i+_.borderBottomLeftRadius.word]},e.backgroundImage=l(_.backgroundImage.word),e.backgroundSize=ft.backgroundSize[s[i+_.backgroundSize.word]];const c=s[i+_.backgroundGradient.word];if(c===0)e.backgroundGradients=void 0;else{_t===0&&(_t=n._malloc(4));const O=n._cuiGradientOf(c,_t),N=n.HEAPU32[_t>>>2];e.backgroundGradients=O!==0&&N>0?cs(n.HEAPF32,n.HEAPU32,O,N):void 0}const f=i+_.transform.word,u=r[f],d=r[f+1],p=r[f+3],b=r[f+4],g=r[f+6],x=r[f+7],w=r[f+9],v=r[f+10],k=r[f+11],A=r[f+12],P=w===0&&v===0&&k===0&&A===0;e.transform=u===1&&d===0&&p===0&&b===1&&g===0&&x===0&&P?void 0:[u,d,p,b,g,x],e.transformBox=P?void 0:[w,v,k,A];const C=i+_.transformOrigin.word;e.transformOrigin={x:r[C],y:r[C+1],xPercent:s[C+2]!==0,yPercent:s[C+3]!==0},e.color=h(_.color.bit)?s[i+_.color.word]>>>0:void 0,e.fontFamily=h(_.fontFamily.bit)?l(_.fontFamily.word):void 0,e.fontSize=r[i+_.fontSize.word],e.fontWeight=r[i+_.fontWeight.word],e.fontStyle=s[i+_.fontStyle.word]===ss.italic?"italic":"normal",e.lineHeight=r[i+_.lineHeight.word],e.letterSpacing=r[i+_.letterSpacing.word],e.textAlign=hs[s[i+_.textAlign.word]]??"start",e.textDecoration=ft.textDecoration[s[i+_.textDecoration.word]],e.lineClamp=r[i+_.lineClamp.word],e.textOverflow=ft.textOverflow[s[i+_.textOverflow.word]],e.objectFit=ft.objectFit[s[i+_.objectFit.word]],e.tintColor=h(_.tintColor.bit)?s[i+_.tintColor.word]>>>0:void 0,e.placeholder=l(_.placeholder.word),e.placeholderColor=h(_.placeholderColor.bit)?s[i+_.placeholderColor.word]>>>0:void 0,e.inputType=ft.type[s[i+_.type.word]],e.overlayColor=h(_.overlayColor.bit)?s[i+_.overlayColor.word]>>>0:void 0}function us(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 ds(n,t,e){const s=n._cuiPaintOf(t);return s===0?!1:(gn(n,s,e),!0)}function fs(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*ts*4;t(o,h=>gn(n,a,h))}return e}function mn(n,t=[],e={}){const s=e.precision??2,r=e.includeIds??!1,i=n?ie(n,s,r):null;if(t.length===0)return i;const o=t.map(a=>ie(a,s,r));return i?(i.overlays=o,i):{type:"frame",overlays:o}}function ps(n,t=[],e){return JSON.stringify(mn(n,t,e),null,2)}function pt(n,t){const e=10**t;return Math.round(n*e)/e}function ie(n,t,e){var o,a;const s=n.rect,r={type:n.type};n.name&&(r.name=n.name),r.rect=[pt(s.x,t),pt(s.y,t),pt(s.width,t),pt(s.height,t)],e&&(r.id=n.id);const i=ms(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:pt(n.scroll.offset,t),content:pt(n.scroll.content,t)}),n.children.length>0&&(r.children=n.children.map(h=>ie(h,t,e))),r}function gs(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 ms(n){const t={};if(n.backgroundColor!==void 0&&(t.backgroundColor=dt(n.backgroundColor)),n.opacity!==void 0&&(t.opacity=n.opacity),n.color!==void 0&&(t.color=dt(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.objectFit!==void 0&&(t.objectFit=n.objectFit),n.tintColor!==void 0&&(t.tintColor=dt(n.tintColor)),n.overlayColor!==void 0&&(t.overlayColor=dt(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:dt(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=gs(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:dt(r.color)})}Object.keys(e).length>0&&(t.border=e)}return Object.keys(t).length>0?t:void 0}const ys=.32,ws=4,Le=new Map;function oe(n){if(!n)return n;if(n.startsWith("canvas:"))return`lecodes-canvas://${n.slice(7)}`;if(n.startsWith("svg:")){let t=Le.get(n);return t===void 0&&(t=sn(n.slice(4)),Le.set(n,t)),t}return n}class bs{constructor(t,e){m(this,"parent",null);m(this,"children",[]);m(this,"style",{lineHeight:14*1.2});m(this,"name");m(this,"text","");m(this,"src");m(this,"value","");m(this,"sourceRect");m(this,"viewName");m(this,"viewParams");m(this,"playerId",0);m(this,"viewId",0);m(this,"flags",0);m(this,"layoutRect",null);m(this,"scrollOffset",0);m(this,"wrapCache");m(this,"jsNode");m(this,"bgRaw");m(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&Cr)!==0}get imageSrcRaw(){return this.type==="image"?oe(this.src):void 0}has(t){return(this.flags&t)!==0}}class vs{constructor(t,e,s={}){m(this,"nodes",new Map);m(this,"root",null);m(this,"leaving",null);m(this,"leavingAbove",!1);m(this,"pagerShown",new Map);m(this,"pagerLeaving",new Map);m(this,"destKind",-1);m(this,"layerRoots",[]);m(this,"width",0);m(this,"height",0);m(this,"focused",null);m(this,"safeBottom",0);m(this,"shrunkRoot",0);m(this,"shrunkInset",0);m(this,"pressed",new Set);m(this,"gestures",new Map);m(this,"vlists",new Set);m(this,"frameCache",null);m(this,"painted",null);m(this,"fontsPending",0);m(this,"lastToast",null);m(this,"dirty",!0);m(this,"onDestination",null);m(this,"onDropped",null);m(this,"layoutPtr",0);m(this,"padPtr",0);m(this,"lastCreated",0);m(this,"hoverX",0);m(this,"hoverY",0);m(this,"hoverInside",!1);m(this,"hoverMoved",!1);this.M=t,this.host=e,this.options=s}install(){const t=new DataView(new ArrayBuffer(8)),e=(s,r,i,o,a,h)=>{const l=this.measure(r,i,a);return t.setFloat32(4,l.width,!0),t.setFloat32(0,l.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;us(i,t)&&(ds(i,t,r.style),this.resolveBackground(r));const o=r;return r.type==="text"?jr(o,this.host,e):r.type==="image"?Xr(o,this.host,e,s):r.editable?zr(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((h,l)=>h|a[l],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;fs(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(Te)&&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 h=i[s+a],l=this.nodes.get(h);if(!l)continue;const c=o[r+a*4],f=o[r+a*4+1],u=o[r+a*4+2],d=o[r+a*4+3],p={x:c,y:f,width:u-c,height:d-f},b=l.layoutRect,g=!b||b.x!==p.x||b.y!==p.y||b.width!==p.width||b.height!==p.height;l.layoutRect=p,g&&(this.dirty=!0),g&&l.has(Te)&&e._creatorWebNodeLayout(h,c,f,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.leaving?this.build(this.leaving,e):null;if(s&&!this.leavingAbove&&t.push({tree:s,leaving:!0}),this.root){const r=this.build(this.root,e);r&&t.push({tree:r})}s&&this.leavingAbove&&t.push({tree:s,leaving:!0});for(const r of this.layerRoots){const i=this.build(r,e);i&&t.push({tree:i,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 mn(this.renderTree(),this.widgetTrees())}toText(){return ps(this.renderTree(),this.widgetTrees())}paint(t,e){const s=this.frame();Kr(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,h)=>{var x;if(i.style.display==="none")return null;let l,c,f,u;if(h)l=e.x,c=e.y,f=e.width,u=e.height;else{const w=i.layoutRect;if(!w)return null;l=o+w.x,c=a+w.y,f=w.width,u=w.height}const d={id:i.id,type:i.type,rect:{x:l,y:c,width:f,height:u},style:i.style,children:[]};i.name&&(d.name=i.name);const p=i;if(i.type==="text"){const w=se(p),v=hn(w);d.text=i.text;const k=this.padding(i.id);(k[0]||k[1]||k[2]||k[3])&&(d.padding=k);const A=f-k[0]-k[2],P=`${A}|${v.size}|${v.weight}|${v.italic?1:0}|${v.letterSpacing}|${v.family}|${i.style.lineClamp??0}|${i.style.textOverflow??""}|${i.text}`;if(((x=i.wrapCache)==null?void 0:x.key)===P)d.lines=i.wrapCache.lines;else{const C=N=>this.host.measureText(N,v),O=un(xt(i.text,A,C).lines,i.style,A,C);i.wrapCache={key:P,lines:O},d.lines=O}d.style={...i.style,color:w.color,fontSize:w.fontSize,fontFamily:w.fontFamily,fontWeight:w.fontWeight,fontStyle:w.fontStyle,lineHeight:w.lineHeight,letterSpacing:w.letterSpacing,textAlign:w.textAlign,textDecoration:w.textDecoration}}else if(i.type==="image"){const w=this.host.resolveSrc(i.imageSrcRaw),v=w?this.host.getImage(w):void 0;d.image=v??(w?{src:w,naturalWidth:0,naturalHeight:0}:void 0),i.sourceRect&&(d.sourceRect=i.sourceRect)}else if(i.editable){d.value=i.value;const w=this.padding(i.id);(w[0]||w[1]||w[2]||w[3])&&(d.padding=w);const v=se(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}}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 b=l,g=c;if(i.scrollable){const w=i.scrollAxis,v=w==="x"?s._getContentWidth(i.id):s._getContentHeight(i.id);d.clip=!0,d.scroll={offset:i.scrollOffset,content:v,axis:w},w==="x"?b=l-i.scrollOffset:g=c-i.scrollOffset}if(i.type==="pager"){const w=s._creatorWebPagerSelectedIndex(i.id),v=s._creatorWebPagerStackLen(i.id,w),k=v>0?s._creatorWebPagerPageNode(i.id,w,v-1):0,A=k?this.nodes.get(k):void 0;A?this.pagerShown.set(i.id,A):this.pagerShown.delete(i.id);const P=this.pagerLeaving.get(i.id);for(const C of P&&P.page!==A?P.above?[A,P.page]:[P.page,A]:[A]){const O=C?r(C,l,c,!1):null;O&&d.children.push(O)}return d}if(i.type==="vlist"){for(const w of i.children){const v=s._getParentNode(w.id);if(!v)continue;const k=s._vlistItemOffsetOf(i.id,v);if(Number.isNaN(k))continue;const A=r(w,l,c+k-i.scrollOffset,!1);A&&d.children.push(A)}return d}for(const w of i.children){const v=r(w,b,g,!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*ys):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 bs(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),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 oe(t.src)}resolveBackground(t){const e=t.style.backgroundImage||void 0;if(e!==t.bgRaw){t.bgRaw=e,t.bgSrc=e?this.host.resolveSrc(oe(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)),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 h;this.destKind=t;const a=t===Re?this.nodes.get(e)??null:null;a!==this.root&&this.leave(!o||a===null),this.leaving===a&&(this.leaving=null),this.root=a,this.focused&&this.blurInput(),this.dirty=!0,(h=this.onDestination)==null||h.call(this,t,s)}dropView(t,e,s){var r;if(t===Re){const i=this.nodes.get(e)??null;i!==null&&this.leaving===i&&(this.leaving=null),i!==null&&this.root===i&&(this.root=null)}this.dirty=!0,(r=this.onDropped)==null||r.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)}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(Wr)&&this.M._creatorWebNodeEvent(t,Ar),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(Dr)&&this.M._creatorWebNodeEvent(t.id,Mr),this.shrinkTo(0,0),this.emitKeyboard(),this.dirty=!0)}setInputValue(t,e){const s=this.nodes.get(t);s&&(s.value=e,s.has(Br)&&this.withStr(e,r=>this.M._creatorWebNodeEventStr(t,Rr,r)),this.M._nodeHasMeasure(t)&&this.M._markNodeDirty(t),this.dirty=!0)}submitInput(){const t=this.focused;return t?(t.has(Hr)&&this.withStr(t.value,e=>this.M._creatorWebNodeEventStr(t.id,Lr,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(Nr)&&this.M._creatorWebNodeEventNum(t,_r,a),o===s.scrollOffset?!1:(s.scrollOffset=o,s.type==="vlist"&&this.M._vlistExists(t)&&this.M._vlistOnScroll(t,o),s.has(Fr)&&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=mt(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 h=mt(o[a].tree,e,s,l=>{var c;return((c=this.nodes.get(l.id))==null?void 0:c.editable)??!1});if(h.node){const l=this.nodes.get(h.node.id);this.focusInput(l.id),i.edit=l,i.dismiss=!1;return}if(h.blocker)break}for(let a=o.length-1;a>=0;a--){const h=o[a],l=mt(h.tree,e,s,u=>{var d;return((d=this.nodes.get(u.id))==null?void 0:d.interactive)??!1}),c=mt(h.tree,e,s,u=>!!u.scroll&&u.scroll.content>(u.scroll.axis==="x"?u.rect.width:u.rect.height)+.5),f=c.node?this.nodes.get(c.node.id)??null:null;if(l.node){const u=this.nodes.get(l.node.id);i.node=u,i.scroll=f,i.dismiss=u.type!=="button",this.setPressed(u,!0),r._creatorWebNodeTouchStart(u.id,t,e,s);return}if(f){i.scroll=f;return}if(l.blocker){i.backdrop=l.outside?this.nodes.get(l.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>ws&&(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(Ur)&&i._creatorWebNodeEvent(r.scroll.id,Tr),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(Or)&&i._creatorWebNodeClick(r.node.id,t,e,s)):r.backdrop?!r.scrolling&&r.backdrop.has($r)&&i._creatorWebNodeEvent(r.backdrop.id,Pr):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=mt(i[o].tree,t,e,h=>!!h.scroll&&h.scroll.content>(h.scroll.axis==="x"?h.rect.width:h.rect.height)+.5);if(a.node){const h=this.nodes.get(a.node.id);return h?this.scrollBy(h.id,h.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(Ir)&&this.M._creatorWebNodeLongPress(r.node.id,t,e,s)}isVlist(t){return this.vlists.has(t)}}const xs=`
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
- `,Pe=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),Es=n=>n.type==="native"||n.type==="video",Ss=[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]],ks=(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 Lt extends vs{constructor(e,s,r,i,o={}){super(e,s,o);m(this,"doc");m(this,"factories",new Map);m(this,"versions",new Map);m(this,"views",new Map);m(this,"wrappers",new Map);m(this,"shown",new Map);m(this,"destination",null);m(this,"field",null);m(this,"placedFor",null);m(this,"band",{root:0,height:0});m(this,"slide",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=xs,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 h=o(a,{emit:(l,c)=>this.M.jsb.viewEvent(e,l,c)},this.doc);return h.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:h}),h}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(h=>{h===void 0?i():i(h)},h=>o(h instanceof Error?h.message:String(h)))}catch(h){o(h instanceof Error?h.message:String(h))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==Ht)return;this.dropDestination();const h=this.ensureView(r,i,o);if(!h)return;const l=this.doc.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:auto;",l.appendChild(h.el),this.under.prepend(l),this.destination={viewId:r,el:l}}dropView(e,s,r){var i;super.dropView(e,s,r),e===Ht&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==Ht&&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 pe}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(),h=()=>{const l=Math.min(1,(r.performance.now()-a)/pe),c=Pn(l);this.setBand(i,l<1?Math.round(o+(s-o)*c):s),l<1?this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(h)}:this.slide=null};this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(h)}}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,h)=>{let l=a;const c=o.style.transform;if(c){const u=o.style.transformOrigin,d=o.rect.x+(u?u.xPercent?o.rect.width*u.x/100:u.x:o.rect.width/2),p=o.rect.y+(u?u.yPercent?o.rect.height*u.y/100:u.y:o.rect.height/2),b=dn(c,o.style.transformBox,o.rect.width,o.rect.height);l=Gt(Gt(Gt(a,[1,0,0,1,d,p]),b),[1,0,0,1,-d,-p])}(Es(o)||o.id===s)&&e.push({node:o,matrix:l,clip:h});const f=o.clip?ks(h,o.rect):h;for(const u of o.children)r(u,l,f)};for(const o of this.frame())r(o.tree,Ss,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=ue(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 f,u;const r=s.style,i=e.style,[o,a,h,l]=s.padding??[0,0,0,0];i.padding=`${a}px ${h}px ${l}px ${o}px`,i.color=Pe(r.color,"#000000ff"),i.caretColor=i.color;const c=r.fontFamily??"Roboto";if(i.fontFamily=((u=(f=this.host).resolveFontFamily)==null?void 0:u.call(f,c))??c,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",Pe(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),Lt.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"),Lt.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=mt(o.tree,e,s,h=>{var l,c;return h.type==="native"||(((l=this.get(h.id))==null?void 0:l.interactive)??!1)||(((c=this.get(h.id))==null?void 0:c.editable)??!1)||!!h.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 _s(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 Ts=500,Ce=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],Rs=(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 y=e.createElement("div");return y.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",y},o=i(),a=i();n.insertBefore(o,s),s.after(a);const h=new ur({resolveAssetUrl:y=>Qn(y),canvasSurfaces:t.canvasHost}),l=new Lt(t.M,h,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onKeyboard:t.onKeyboard,onToast:(y,L)=>_s(e,n,y,L)});let c=1,f=new _e(r,c),u=!0;const d=()=>{(u||l.needsPaint())&&(u=!1,l.paint(f,l.paintOptions())),l.place()},p=(y,L,M)=>{y<=0||L<=0||(M!==c&&(c=M,f=new _e(r,c)),u=!0,l.resize(y,L))},b=y=>{l.setSafeArea([y.top,y.right,y.bottom,y.left],y.bars??[])},g=y=>{const L=n.getBoundingClientRect(),M=he(n);return[(y.clientX-L.left)/M,(y.clientY-L.top)/M]},x=y=>y.target instanceof Node&&a.contains(y.target),w=y=>y.target instanceof Node&&o.contains(y.target),v=y=>{w(y)&&y.stopPropagation()},k=new Set,A=new Map,P=y=>{const L=A.get(y);L!==void 0&&(clearTimeout(L),A.delete(y))},C=y=>{if(x(y))return;const[L,M]=g(y);if(!l.surfaceAt(L,M)){v(y),k.add(y.pointerId);try{n.setPointerCapture(y.pointerId)}catch{}l.pointerDown(y.pointerId,L,M),P(y.pointerId),A.set(y.pointerId,window.setTimeout(()=>{A.delete(y.pointerId),l.longPress(y.pointerId,L,M)},Ts))}},O=y=>{const[L,M]=g(y);k.has(y.pointerId)&&(v(y),l.pointerMove(y.pointerId,L,M)),y.pointerType==="mouse"&&(x(y)||!k.has(y.pointerId)&&l.surfaceAt(L,M)?l.pointerLeave():l.pointerHover(L,M))},N=y=>{y.pointerType==="mouse"&&l.pointerLeave()},X=y=>{if(!k.delete(y.pointerId))return;v(y),P(y.pointerId);const[L,M]=g(y);l.pointerUp(y.pointerId,L,M)},T=y=>{k.delete(y.pointerId)&&(P(y.pointerId),l.pointerCancel(y.pointerId))},$=y=>{if(x(y))return;const[L,M]=g(y);if(l.surfaceAt(L,M))return;v(y);const D=y.deltaMode===1?16:y.deltaMode===2?l.height:1;l.wheel(L,M,y.deltaX*D,y.deltaY*D)&&y.preventDefault()},j=y=>{var K;if(x(y))return;const L="clientX"in y?y:(K=y.changedTouches)==null?void 0:K[0];if(!L)return;const[M,D]=g(L);l.surfaceAt(M,D)||(v(y),y.type==="mousedown"&&y.preventDefault())};n.addEventListener("pointerdown",C,!0),n.addEventListener("pointermove",O,!0),n.addEventListener("pointerleave",N),n.addEventListener("pointerup",X,!0),n.addEventListener("pointercancel",T,!0),n.addEventListener("wheel",$,{passive:!1,capture:!0});for(const y of Ce)n.addEventListener(y,j,!0);return{ui:l,render:d,resize:p,setSafeArea:b,destroy(){for(const y of A.keys())P(y);n.removeEventListener("pointerdown",C,!0),n.removeEventListener("pointermove",O,!0),n.removeEventListener("pointerleave",N),n.removeEventListener("pointerup",X,!0),n.removeEventListener("pointercancel",T,!0),n.removeEventListener("wheel",$,!0);for(const y of Ce)n.removeEventListener(y,j,!0);l.dispose(),o.remove(),a.remove()}}},As=["miter","round","bevel"],Ms=["butt","round","square"],Ls=["left","center","right","start","end"],Ps=["alphabetic","top","middle","bottom","hanging","ideographic"],Oe=["nonzero","evenodd"],Cs=["pad","reflect","repeat"],Vt={COLOR:0,RADIAL:2},vt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},z={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 Os{constructor(t,e){m(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===Vt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===Vt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=Cs[this.i()]??"pad",h=this.i(),l=[];for(let c=0;c<h;c++)l.push({offset:this.f(),color:this.color()});return t===Vt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:l}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:l}}stroke(){const t=this.f(),e=As[this.i()]??"miter",s=Ms[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let h=0;h<o;h++)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 vt.MOVE:s.push(["M",this.f(),this.f()]);break;case vt.LINE:s.push(["L",this.f(),this.f()]);break;case vt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case vt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case vt.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 Is=(n,t)=>{const e=new Os(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 z.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case z.SAVE:s.push({cmd:"save"});break;case z.RESTORE:s.push({cmd:"restore"});break;case z.CLIP:{const a=Oe[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case z.FILL_PATH:{const a=Oe[e.i()]??"nonzero",h=e.paint();s.push({cmd:"fillPath",rule:a,paint:h,path:e.path()});break}case z.STROKE_PATH:{const a=e.stroke(),h=e.paint();s.push({cmd:"strokePath",stroke:a,paint:h,path:e.path()});break}case z.FILL_TEXT:case z.STROKE_TEXT:{const a=e.str(),h=e.f(),l=e.f(),c=e.f(),f=e.font(),u=Ls[e.i()]??"start",d=Ps[e.i()]??"alphabetic",p=e.f();if(r===z.STROKE_TEXT){const b=e.stroke();s.push({cmd:"strokeText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,stroke:b,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,paint:e.paint()});break}case z.DRAW_IMAGE:{const a=e.i(),h=e.rect4(),l=e.rect4();s.push({cmd:"drawImage",surface:a,src:h,dst:l,alpha:e.f()});break}case z.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},Fs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),yn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,wn=(n,t=n.family)=>{const e=Fs.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Tt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Ns=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,jt=(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}},Ie=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,yn(e.color))},Rt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=yn(t.color),s();return}const r=t.matrix;if(Ns(r)){let o;if(t.kind==="linear"){const[a,h]=Tt(r,0,0),[l,c]=Tt(r,1,0);o=n.createLinearGradient(a,h,l,c)}else{const a=Math.hypot(r[0],r[1]),[h,l]=Tt(r,0,0),[c,f]=Tt(r,t.fx,t.fy);o=n.createRadialGradient(c,f,t.r0*a,h,l,a)}Ie(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);Ie(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Fe=(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},Ne=(n,t,e)=>{n.font=wn(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`)},Us=(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":jt(n,i.path),n.clip(i.rule);break;case"fillPath":jt(n,i.path),Rt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":jt(n,i.path),Fe(n,i.stroke),Rt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":Ne(n,i,e),Rt(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":Ne(n,i,e),Fe(n,i.stroke),Rt(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()}},Bs=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(l,c,f)=>{if(!t)return null;let u=e.get(l);return u?(u.width!==c||u.height!==f)&&(u.width=c,u.height=f):(u=new OffscreenCanvas(c,f),e.set(l,u)),u},i={paint:(l,c,f,u,d,p)=>{const b=r(l,Math.max(1,c),Math.max(1,f)),g=b==null?void 0:b.getContext("2d");!b||!g||(g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,b.width,b.height),Us(g,Is(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(l,c,f,u,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=wn({family:c,size:f,weight:u,italic:d},c);const b=s.measureText(l);p[0]=b.width,p[1]=b.fontBoundingBoxAscent??b.actualBoundingBoxAscent,p[2]=b.fontBoundingBoxDescent??b.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(l,c)=>{const f=o(l);return f?(c[0]=f.width,c[1]=f.height,new Uint8Array(f.data.buffer,f.data.byteOffset,f.data.byteLength)):null},releaseSurface:l=>{e.delete(l)}},o=l=>{const c=e.get(l),f=c==null?void 0:c.getContext("2d");return!c||!f?null:{data:f.getImageData(0,0,c.width,c.height).data,width:c.width,height:c.height}};return{table:i,readSurface:o,getSurface:l=>{const c=e.get(l);return c?{canvas:c,width:c.width,height:c.height}:null},surfaceToDataUrl:l=>{var u;const c=e.get(l);if(!c||typeof document>"u")return null;const f=document.createElement("canvas");return f.width=c.width,f.height=c.height,(u=f.getContext("2d"))==null||u.drawImage(c,0,0),f.toDataURL()}}},Ws=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,Ds=(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},Hs=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))])},bn="Roboto",$s=[`400 14px ${bn}`],Ue="data-lecodes-fonts",Gs=async(n=$s,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${Ue}]`)){const s=new URL(Ws,document.baseURI).href,r=e.createElement("style");r.setAttribute(Ue,""),r.textContent=`@font-face{font-family:"${bn}";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{}}},Be="2.2.4",zt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},Vs=(n,t)=>zt(n)!==null&&zt(n)===zt(t),js=[171,75,84,88,32,50,48,187,13,10,26,10],zs=n=>n.length>=12&&js.every((t,e)=>n[e]===t),Xs=(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=[],h=()=>{const c=r.createTexture();return r.bindTexture(r.TEXTURE_2D,c),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),c},l=(c,f,u,d)=>{const p=c.GL.getNewId(c.GL.textures);return c.GL.textures[p]=f,c._importTexture(p,u,d)>>>0};return{canvas:s,context:r,options:e,table(c){return i=c,{engineCreated(){c._createSwapChainHeadless(s.width,s.height),c._creatorWebSetViewport(s.width,s.height),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,u,d,p){const b=nt(f);if(!b){p(`createTexture: no buffer behind id ${f}`);return}const g=new Uint8Array(b);if(zs(g)){const x=c._malloc(g.length);c.HEAPU8.set(g,x);const w=c._createTextureFromKtx2(x,g.length)>>>0;if(c._free(x),w===4294967295){p("KTX2 transcode failed");return}d(w,c._getTextureWidth(w),c._getTextureHeight(w));return}createImageBitmap(Ft(f)).then(x=>{const w=h();r.texStorage2D(r.TEXTURE_2D,1,u&1?r.RGBA8:r.SRGB8_ALPHA8,x.width,x.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,r.RGBA,r.UNSIGNED_BYTE,x),d(l(c,w,x.width,x.height),x.width,x.height)},x=>p(x instanceof Error?x.message:String(x)))},createMediaPlayerTexture(f){const u=ue(f);if(!u)return 0;const d=h();return a.push({player:u,texture:d,lastTime:0}),l(c,d,0,0)}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&i._creatorWebSetViewport(s.width,s.height)},frame(){for(const c of a)c.player.readyState<2||c.player.currentTime===c.lastTime||(c.lastTime=c.player.currentTime,r.bindTexture(r.TEXTURE_2D,c.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,c.player))},destroy(){var c;a.length=0,(c=r.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},Ks=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")},h=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(l){return r=l,{open2DScene:a,close2DScene:h}},show:a,hide:h,resize:o,frame(l){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(l)},destroy(){var l;(l=s.getExtension("WEBGL_lose_context"))==null||l.loseContext()}}},We=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)},De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn={};for(let n=0;n<De.length;n++)vn[De[n]]=n;const Ys=n=>{const t=[];let e=0,s=0;for(const r of n){const i=vn[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 qs{constructor(t){m(this,"sources");m(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 h of i.split(",")){const l=Ys(h);l.length!==0&&(a+=l[0],l.length>=4&&(e+=l[1],s+=l[2],r+=l[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 Js=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 qs(JSON.parse(e))}catch{return null}};let gt=null;const Qs=()=>{if(gt!==null)return gt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return gt=e?parseInt(e[1],10)-1:2,gt}return gt=2,gt},Xt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=Qs(),r=[];for(const i of e.split(`
13
+ `,Pe=(n,t)=>n===void 0?t:"#"+(n>>>0).toString(16).padStart(8,"0"),Es=n=>n.type==="native"||n.type==="video",Ss=[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]],ks=(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 Lt extends vs{constructor(e,s,r,i,o={}){super(e,s,o);m(this,"doc");m(this,"factories",new Map);m(this,"versions",new Map);m(this,"views",new Map);m(this,"wrappers",new Map);m(this,"shown",new Map);m(this,"destination",null);m(this,"field",null);m(this,"placedFor",null);m(this,"band",{root:0,height:0});m(this,"slide",null);this.under=r,this.over=i,this.doc=r.ownerDocument;const a=this.doc.createElement("style");a.textContent=xs,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 h=o(a,{emit:(l,c)=>this.M.jsb.viewEvent(e,l,c)},this.doc);return h.el.style.cssText+=";position:absolute;inset:0;width:100%;height:100%;",this.views.set(e,{name:s,params:r,handle:h}),h}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(h=>{h===void 0?i():i(h)},h=>o(h instanceof Error?h.message:String(h)))}catch(h){o(h instanceof Error?h.message:String(h))}}openView(e,s,r,i,o,a){if(super.openView(e,s,r,i,o,a),e!==Ht)return;this.dropDestination();const h=this.ensureView(r,i,o);if(!h)return;const l=this.doc.createElement("div");l.style.cssText="position:absolute;inset:0;pointer-events:auto;",l.appendChild(h.el),this.under.prepend(l),this.destination={viewId:r,el:l}}dropView(e,s,r){var i;super.dropView(e,s,r),e===Ht&&((i=this.destination)==null?void 0:i.viewId)===r&&this.destKind!==Ht&&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 pe}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(),h=()=>{const l=Math.min(1,(r.performance.now()-a)/pe),c=Pn(l);this.setBand(i,l<1?Math.round(o+(s-o)*c):s),l<1?this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(h)}:this.slide=null};this.slide={root:i,from:o,to:s,start:a,raf:r.requestAnimationFrame(h)}}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,h)=>{let l=a;const c=o.style.transform;if(c){const u=o.style.transformOrigin,d=o.rect.x+(u?u.xPercent?o.rect.width*u.x/100:u.x:o.rect.width/2),p=o.rect.y+(u?u.yPercent?o.rect.height*u.y/100:u.y:o.rect.height/2),b=dn(c,o.style.transformBox,o.rect.width,o.rect.height);l=Gt(Gt(Gt(a,[1,0,0,1,d,p]),b),[1,0,0,1,-d,-p])}(Es(o)||o.id===s)&&e.push({node:o,matrix:l,clip:h});const f=o.clip?ks(h,o.rect):h;for(const u of o.children)r(u,l,f)};for(const o of this.frame())r(o.tree,Ss,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=ue(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 f,u;const r=s.style,i=e.style,[o,a,h,l]=s.padding??[0,0,0,0];i.padding=`${a}px ${h}px ${l}px ${o}px`,i.color=Pe(r.color,"#000000ff"),i.caretColor=i.color;const c=r.fontFamily??"Roboto";if(i.fontFamily=((u=(f=this.host).resolveFontFamily)==null?void 0:u.call(f,c))??c,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",Pe(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),Lt.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"),Lt.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=mt(o.tree,e,s,h=>{var l,c;return h.type==="native"||(((l=this.get(h.id))==null?void 0:l.interactive)??!1)||(((c=this.get(h.id))==null?void 0:c.editable)??!1)||!!h.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 _s(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 Ts=500,Ce=["mousedown","mouseup","click","dblclick","contextmenu","touchstart","touchmove","touchend"],Rs=(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 y=e.createElement("div");return y.style.cssText="position:absolute;inset:0;overflow:hidden;pointer-events:none;",y},o=i(),a=i();n.insertBefore(o,s),s.after(a);const h=new ur({resolveAssetUrl:y=>Qn(y),canvasSurfaces:t.canvasHost}),l=new Lt(t.M,h,o,a,{keyboardHeight:t.keyboardHeight??(()=>0),onKeyboard:t.onKeyboard,onToast:(y,L)=>_s(e,n,y,L)});let c=1,f=new _e(r,c),u=!0;const d=()=>{(u||l.needsPaint())&&(u=!1,l.paint(f,l.paintOptions())),l.place()},p=(y,L,M)=>{y<=0||L<=0||(M!==c&&(c=M,f=new _e(r,c)),u=!0,l.resize(y,L))},b=y=>{l.setSafeArea([y.top,y.right,y.bottom,y.left],y.bars??[])},g=y=>{const L=n.getBoundingClientRect(),M=he(n);return[(y.clientX-L.left)/M,(y.clientY-L.top)/M]},x=y=>y.target instanceof Node&&a.contains(y.target),w=y=>y.target instanceof Node&&o.contains(y.target),v=y=>{w(y)&&y.stopPropagation()},k=new Set,A=new Map,P=y=>{const L=A.get(y);L!==void 0&&(clearTimeout(L),A.delete(y))},C=y=>{if(x(y))return;const[L,M]=g(y);if(!l.surfaceAt(L,M)){v(y),k.add(y.pointerId);try{n.setPointerCapture(y.pointerId)}catch{}l.pointerDown(y.pointerId,L,M),P(y.pointerId),A.set(y.pointerId,window.setTimeout(()=>{A.delete(y.pointerId),l.longPress(y.pointerId,L,M)},Ts))}},O=y=>{const[L,M]=g(y);k.has(y.pointerId)&&(v(y),l.pointerMove(y.pointerId,L,M)),y.pointerType==="mouse"&&(x(y)||!k.has(y.pointerId)&&l.surfaceAt(L,M)?l.pointerLeave():l.pointerHover(L,M))},N=y=>{y.pointerType==="mouse"&&l.pointerLeave()},X=y=>{if(!k.delete(y.pointerId))return;v(y),P(y.pointerId);const[L,M]=g(y);l.pointerUp(y.pointerId,L,M)},T=y=>{k.delete(y.pointerId)&&(P(y.pointerId),l.pointerCancel(y.pointerId))},$=y=>{if(x(y))return;const[L,M]=g(y);if(l.surfaceAt(L,M))return;v(y);const D=y.deltaMode===1?16:y.deltaMode===2?l.height:1;l.wheel(L,M,y.deltaX*D,y.deltaY*D)&&y.preventDefault()},j=y=>{var K;if(x(y))return;const L="clientX"in y?y:(K=y.changedTouches)==null?void 0:K[0];if(!L)return;const[M,D]=g(L);l.surfaceAt(M,D)||(v(y),y.type==="mousedown"&&y.preventDefault())};n.addEventListener("pointerdown",C,!0),n.addEventListener("pointermove",O,!0),n.addEventListener("pointerleave",N),n.addEventListener("pointerup",X,!0),n.addEventListener("pointercancel",T,!0),n.addEventListener("wheel",$,{passive:!1,capture:!0});for(const y of Ce)n.addEventListener(y,j,!0);return{ui:l,render:d,resize:p,setSafeArea:b,destroy(){for(const y of A.keys())P(y);n.removeEventListener("pointerdown",C,!0),n.removeEventListener("pointermove",O,!0),n.removeEventListener("pointerleave",N),n.removeEventListener("pointerup",X,!0),n.removeEventListener("pointercancel",T,!0),n.removeEventListener("wheel",$,!0);for(const y of Ce)n.removeEventListener(y,j,!0);l.dispose(),o.remove(),a.remove()}}},As=["miter","round","bevel"],Ms=["butt","round","square"],Ls=["left","center","right","start","end"],Ps=["alphabetic","top","middle","bottom","hanging","ideographic"],Oe=["nonzero","evenodd"],Cs=["pad","reflect","repeat"],Vt={COLOR:0,RADIAL:2},vt={MOVE:0,LINE:1,QUAD:2,CUBIC:3,CLOSE:4},z={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 Os{constructor(t,e){m(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===Vt.COLOR)return{kind:"color",alpha:e,color:this.color()};const s=this.matrix();let r=0,i=0,o=0;t===Vt.RADIAL&&(r=this.f(),i=this.f(),o=this.f());const a=Cs[this.i()]??"pad",h=this.i(),l=[];for(let c=0;c<h;c++)l.push({offset:this.f(),color:this.color()});return t===Vt.RADIAL?{kind:"radial",alpha:e,matrix:s,fx:r,fy:i,r0:o,spread:a,stops:l}:{kind:"linear",alpha:e,matrix:s,spread:a,stops:l}}stroke(){const t=this.f(),e=As[this.i()]??"miter",s=Ms[this.i()]??"butt",r=this.f(),i=this.f(),o=this.i(),a=[];for(let h=0;h<o;h++)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 vt.MOVE:s.push(["M",this.f(),this.f()]);break;case vt.LINE:s.push(["L",this.f(),this.f()]);break;case vt.QUAD:s.push(["Q",this.f(),this.f(),this.f(),this.f()]);break;case vt.CUBIC:s.push(["C",this.f(),this.f(),this.f(),this.f(),this.f(),this.f()]);break;case vt.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 Is=(n,t)=>{const e=new Os(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 z.SET_TRANSFORM:s.push({cmd:"setTransform",matrix:e.matrix()});break;case z.SAVE:s.push({cmd:"save"});break;case z.RESTORE:s.push({cmd:"restore"});break;case z.CLIP:{const a=Oe[e.i()]??"nonzero";s.push({cmd:"clip",rule:a,path:e.path()});break}case z.FILL_PATH:{const a=Oe[e.i()]??"nonzero",h=e.paint();s.push({cmd:"fillPath",rule:a,paint:h,path:e.path()});break}case z.STROKE_PATH:{const a=e.stroke(),h=e.paint();s.push({cmd:"strokePath",stroke:a,paint:h,path:e.path()});break}case z.FILL_TEXT:case z.STROKE_TEXT:{const a=e.str(),h=e.f(),l=e.f(),c=e.f(),f=e.font(),u=Ls[e.i()]??"start",d=Ps[e.i()]??"alphabetic",p=e.f();if(r===z.STROKE_TEXT){const b=e.stroke();s.push({cmd:"strokeText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,stroke:b,paint:e.paint()})}else s.push({cmd:"fillText",text:a,x:h,y:l,maxWidth:c,font:f,align:u,baseline:d,letterSpacing:p,paint:e.paint()});break}case z.DRAW_IMAGE:{const a=e.i(),h=e.rect4(),l=e.rect4();s.push({cmd:"drawImage",surface:a,src:h,dst:l,alpha:e.f()});break}case z.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},Fs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),yn=n=>`rgba(${Math.round(n[0]*255)}, ${Math.round(n[1]*255)}, ${Math.round(n[2]*255)}, ${n[3]})`,wn=(n,t=n.family)=>{const e=Fs.has(t)?t:`"${t.replace(/"/g,"'")}"`;return`${n.italic?"italic ":""}${n.weight} ${n.size}px ${e}`},Tt=(n,t,e)=>[n[0]*t+n[2]*e+n[4],n[1]*t+n[3]*e+n[5]],Ns=n=>Math.abs(n[0]-n[3])<1e-6&&Math.abs(n[1]+n[2])<1e-6,jt=(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}},Ie=(n,t)=>{for(const e of t.stops)n.addColorStop(e.offset,yn(e.color))},Rt=(n,t,e,s)=>{if(n.globalAlpha=t.alpha,t.kind==="color"){n[e==="fill"?"fillStyle":"strokeStyle"]=yn(t.color),s();return}const r=t.matrix;if(Ns(r)){let o;if(t.kind==="linear"){const[a,h]=Tt(r,0,0),[l,c]=Tt(r,1,0);o=n.createLinearGradient(a,h,l,c)}else{const a=Math.hypot(r[0],r[1]),[h,l]=Tt(r,0,0),[c,f]=Tt(r,t.fx,t.fy);o=n.createRadialGradient(c,f,t.r0*a,h,l,a)}Ie(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);Ie(i,t),n[e==="fill"?"fillStyle":"strokeStyle"]=i,s(),n.restore()},Fe=(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},Ne=(n,t,e)=>{n.font=wn(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`)},Us=(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":jt(n,i.path),n.clip(i.rule);break;case"fillPath":jt(n,i.path),Rt(n,i.paint,"fill",()=>n.fill(i.rule));break;case"strokePath":jt(n,i.path),Fe(n,i.stroke),Rt(n,i.paint,"stroke",()=>n.stroke());break;case"fillText":Ne(n,i,e),Rt(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":Ne(n,i,e),Fe(n,i.stroke),Rt(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()}},Bs=n=>{const t=typeof OffscreenCanvas<"u",e=new Map;let s=null;const r=(l,c,f)=>{if(!t)return null;let u=e.get(l);return u?(u.width!==c||u.height!==f)&&(u.width=c,u.height=f):(u=new OffscreenCanvas(c,f),e.set(l,u)),u},i={paint:(l,c,f,u,d,p)=>{const b=r(l,Math.max(1,c),Math.max(1,f)),g=b==null?void 0:b.getContext("2d");!b||!g||(g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,b.width,b.height),Us(g,Is(d,p),{image:x=>e.get(x)??null,fontFamily:n}))},measureText:(l,c,f,u,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=wn({family:c,size:f,weight:u,italic:d},c);const b=s.measureText(l);p[0]=b.width,p[1]=b.fontBoundingBoxAscent??b.actualBoundingBoxAscent,p[2]=b.fontBoundingBoxDescent??b.actualBoundingBoxDescent},decodeImage:()=>!1,readPixels:(l,c)=>{const f=o(l);return f?(c[0]=f.width,c[1]=f.height,new Uint8Array(f.data.buffer,f.data.byteOffset,f.data.byteLength)):null},releaseSurface:l=>{e.delete(l)}},o=l=>{const c=e.get(l),f=c==null?void 0:c.getContext("2d");return!c||!f?null:{data:f.getImageData(0,0,c.width,c.height).data,width:c.width,height:c.height}};return{table:i,readSurface:o,getSurface:l=>{const c=e.get(l);return c?{canvas:c,width:c.width,height:c.height}:null},surfaceToDataUrl:l=>{var u;const c=e.get(l);if(!c||typeof document>"u")return null;const f=document.createElement("canvas");return f.width=c.width,f.height=c.height,(u=f.getContext("2d"))==null||u.drawImage(c,0,0),f.toDataURL()}}},Ws=""+new URL("assets/Roboto-Variable-DHm9jpd-.woff2",import.meta.url).href,Ds=(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},Hs=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))])},bn="Roboto",$s=[`400 14px ${bn}`],Ue="data-lecodes-fonts",Gs=async(n=$s,t)=>{const e=t??(typeof document>"u"?void 0:document);if(!(!e||!e.fonts)){if(!e.head.querySelector(`style[${Ue}]`)){const s=new URL(Ws,document.baseURI).href,r=e.createElement("style");r.setAttribute(Ue,""),r.textContent=`@font-face{font-family:"${bn}";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{}}},Be="2.2.5",zt=n=>{const t=n==null?void 0:n.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},Vs=(n,t)=>zt(n)!==null&&zt(n)===zt(t),js=[171,75,84,88,32,50,48,187,13,10,26,10],zs=n=>n.length>=12&&js.every((t,e)=>n[e]===t),Xs=(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=[],h=()=>{const c=r.createTexture();return r.bindTexture(r.TEXTURE_2D,c),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),c},l=(c,f,u,d)=>{const p=c.GL.getNewId(c.GL.textures);return c.GL.textures[p]=f,c._importTexture(p,u,d)>>>0};return{canvas:s,context:r,options:e,table(c){return i=c,{engineCreated(){c._createSwapChainHeadless(s.width,s.height),c._creatorWebSetViewport(s.width,s.height),o=!0},createGLView(){s.style.display="block"},closeScene(){s.style.display="none"},createTexture(f,u,d,p){const b=nt(f);if(!b){p(`createTexture: no buffer behind id ${f}`);return}const g=new Uint8Array(b);if(zs(g)){const x=c._malloc(g.length);c.HEAPU8.set(g,x);const w=c._createTextureFromKtx2(x,g.length)>>>0;if(c._free(x),w===4294967295){p("KTX2 transcode failed");return}d(w,c._getTextureWidth(w),c._getTextureHeight(w));return}createImageBitmap(Ft(f)).then(x=>{const w=h();r.texStorage2D(r.TEXTURE_2D,1,u&1?r.RGBA8:r.SRGB8_ALPHA8,x.width,x.height),r.texSubImage2D(r.TEXTURE_2D,0,0,0,x.width,x.height,r.RGBA,r.UNSIGNED_BYTE,x),d(l(c,w,x.width,x.height),x.width,x.height)},x=>p(x instanceof Error?x.message:String(x)))},createMediaPlayerTexture(f){const u=ue(f);if(!u)return 0;const d=h();return a.push({player:u,texture:d,lastTime:0}),l(c,d,0,0)}}},show(){s.style.display="block"},hide(){s.style.display="none"},resize(){i&&o&&i._creatorWebSetViewport(s.width,s.height)},frame(){for(const c of a)c.player.readyState<2||c.player.currentTime===c.lastTime||(c.lastTime=c.player.currentTime,r.bindTexture(r.TEXTURE_2D,c.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,c.player))},destroy(){var c;a.length=0,(c=r.getExtension("WEBGL_lose_context"))==null||c.loseContext()}}},Ks=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")},h=()=>{e.style.display="none"};return{canvas:e,context:s,options:t,table(l){return r=l,{open2DScene:a,close2DScene:h}},show:a,hide:h,resize:o,frame(l){r&&r._creatorWeb2dSceneOpen()&&r._creatorWeb2dRenderFrame(l)},destroy(){var l;(l=s.getExtension("WEBGL_lose_context"))==null||l.loseContext()}}},We=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)},De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn={};for(let n=0;n<De.length;n++)vn[De[n]]=n;const Ys=n=>{const t=[];let e=0,s=0;for(const r of n){const i=vn[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 qs{constructor(t){m(this,"sources");m(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 h of i.split(",")){const l=Ys(h);l.length!==0&&(a+=l[0],l.length>=4&&(e+=l[1],s+=l[2],r+=l[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 Js=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 qs(JSON.parse(e))}catch{return null}};let gt=null;const Qs=()=>{if(gt!==null)return gt;try{new Function("throw new Error('chisel-calibrate')")()}catch(n){const e=(n.stack??"").match(/<anonymous>:(\d+):\d+/);return gt=e?parseInt(e[1],10)-1:2,gt}return gt=2,gt},Xt=(n,t)=>{const e=(n instanceof Error?n.stack:"")??"",s=Qs(),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,h=parseInt(o[2],10)-1;if(a<1)continue;const l=t.originalPositionFor(a,h<0?0:h);if(!l)continue;const c=i.match(/at\s+([^\s(]+)\s*\(/);r.push({fn:c?c[1]:null,source:l.source,line:l.line,column:l.column})}return r},Zs=/^\[ERROR\] (run|host callback|JsDispatch|timer|setLoop|animate|tween)\b:? ?([\s\S]*)$/,ti=(n,t)=>{const e=[],s=(l,c,f,u)=>{var b,g;if(f.length===0&&We(c)){const x=typeof c=="number"||typeof c=="bigint"?`code ${c}`:c instanceof Error?c.message||c.name:String(c),w=[u,x].filter(k=>!!k).filter((k,A,P)=>P.indexOf(k)===A).join(`
15
15
  `);console.error(`[lecodes] native engine error — ${w||x} (see the console for the engine's message)`);const v={message:"Native engine error",detail:w,frames:[],native:!0,stack:c instanceof Error?c.stack:void 0};(b=l.onError)==null||b.call(l,v),v.stack&&t&&Yn(v.stack).then(k=>{var A;k.length>0&&((A=l.onError)==null||A.call(l,{...v,nativeFrames:k}))});return}const d=c instanceof Error?c.message:String(c),p=f[0];console.error(p?`[lecodes] ${d}
16
16
  at ${p.source}:${p.line}:${p.column}${p.fn?` (${p.fn})`:""}`:`[lecodes] ${d}`),(g=l.onError)==null||g.call(l,{message:d,frames:f,stack:c instanceof Error?c.stack:void 0})},r=(l,c)=>{for(let u=e.length-1;u>=0;u--){const d=e[u];if(!d.sourceMap)continue;const p=Xt(l,d.sourceMap);if(p.length>0)return s(d,l,p,c)}const f=e[e.length-1];f&&We(l)&&s(f,l,[],c)};let i=null;const o=()=>{const l=e[e.length-1],c=i;if(i=null,!c||!l)return;const f=new Error(c.message.replace(/^Error: /,""));f.stack=c.stack.join(`
@@ -18,4 +18,4 @@ var Mn=Object.defineProperty;var Ln=(n,t,e)=>t in n?Mn(n,t,{enumerable:!0,config
18
18
  `);return i={message:(f??"").replace(/^JsTask /,""),stack:u},n.setTimeout(o,0),!0},dispose(){n.removeEventListener("error",a),n.removeEventListener("unhandledrejection",h),e.length=0}}},xn=n=>{var h,l,c,f;const t=n.slice(0,2e3),e=new Set,s=t.match(/\/\/ preload: (.+)/);if(s)for(const u of s[1].split(";"))e.add(u);const r=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",i=((h=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:h[1])??null,o=((c=(l=t.match(/^\/\/ name: (.+)$/m))==null?void 0:l[1])==null?void 0:c.trim())??null,a=new Set((((f=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:f[1])??"").split(";").map(u=>u.trim()).filter(Boolean));return{sdk:i,name:o,preloads:e,gl:r,is2d:t.includes("// 2d: enable"),plugins:a,bootFonts:Ds(t)}},ei=n=>n.gl!=="off"?"full":n.is2d?"2d":"ui",ni=n=>{const t=n.ownerDocument,e=t.defaultView??window;let s=1/0;const r=(d,p)=>{const b=Math.min(s,(e.devicePixelRatio||1)*he(n));return{width:d,height:p,factor:b,pixelWidth:Math.max(1,Math.round(d*b)),pixelHeight:Math.max(1,Math.round(p*b))}};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)},h=()=>{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},l=new Set,c=d=>{if(!(d.width<=0||d.height<=0)){i=d;for(const p of o)a(p);for(const p of l)p(i)}},f=new ResizeObserver(([d])=>{var v;if(!d)return;const{width:p,height:b}=d.contentRect,g=(v=d.devicePixelContentBoxSize)==null?void 0:v[0],x=r(p,b),w=g&&Math.abs(g.inlineSize-p*x.factor)<=1&&Math.abs(g.blockSize-b*x.factor)<=1;if(!g||!w){c(x);return}c({width:p,height:b,pixelWidth:Math.max(1,g.inlineSize),pixelHeight:Math.max(1,g.blockSize),factor:x.factor})});try{f.observe(n,{box:"device-pixel-content-box"})}catch{f.observe(n)}return{root:n,doc:t,win:e,size:()=>i,newCanvas:h,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)&&c(p)},onResize(d){return l.add(d),()=>{l.delete(d)}},destroy(){f.disconnect(),l.clear();for(const d of o)d.remove();o.length=0}}},ri=n=>{const t=[],e=new Set;return{has:s=>e.has(s),register(s,r){e.has(s)||(e.add(s),r({registerView:(i,o,a=1)=>{t.push({id:s,version:a,kind:"view",name:i,factory:o})},registerService:(i,o,a=1)=>{t.push({id:s,version:a,kind:"service",name:i,factory:o})},putBuffer:ct,getBuffer:nt}))},allow(s){var i,o;const r=new Set(s);for(const a of t){const h=r.has(a.id);a.kind==="view"?h?(i=n.registerView)==null||i.call(n,a.name,a.factory,a.version):(o=n.unregisterView)==null||o.call(n,a.name):h?n.registerService(a.name,a.factory,a.version):n.unregisterService(a.name)}}}},si=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()}}},ii={lightmap:"world","lightmap-masked":"world","lightmap-lite":"world","lightmap-masked-lite":"world",terrain:"world","terrain-lightmap":"world",foliage:"world","foliage-masked":"world"},He="material:",oi=n=>{const t=new Set;for(const e of n)e.startsWith(He)&&t.add(ii[e.slice(He.length)]??"base");return[...t].sort((e,s)=>e==="base"?-1:s==="base"?1:e.localeCompare(s))},ai=""+new URL("assets/materials-uri4FvPE.bin",import.meta.url).href,ci=""+new URL("assets/materials-world-CQWt8TAm.bin",import.meta.url).href,li=""+new URL("assets/neutral_ibl128-D-lzdkLN.ktx",import.meta.url).href,hi=""+new URL("assets/uberarchive-DLH-kBhM.bin",import.meta.url).href,ui={base:ai,world:ci},di=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},fi=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=oi(n).map(o=>ui[o]).filter(o=>!!o),[s,r,...i]=await Promise.all([t(li),t(hi),...e.map(t)]);return{1:s,2:r,...i.length>0?{3:di(i)}:{}}},pi=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")},setOrientation(i){var h,l,c,f;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"?(h=a.unlock)==null||h.call(a):(f=(c=(l=a.lock)==null?void 0:l.call(a,o))==null?void 0:c.catch)==null||f.call(c,()=>{})}catch{}}},emit:(i,o)=>n.push(i,o),dispose(){document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener("offline",s)}}},gi=(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([ct(await a.arrayBuffer()),a.name,a.size]);n(o)}else{if(!i||i.length===0)return n(null);n([[ct(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)}},mi=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(Ft(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)=>gi(t,e,s,r??void 0),requestCamera(t){t()}}),yi=(n={})=>({local:t=>rr(t),dispose:t=>Zn(t),request(t,e,s,r,i,o,a,h){if(t.startsWith("id:")){const f=Number(t.slice(3));o(f,nt(f)?200:404);return}const l={};for(let f=0;f+1<s.length;f+=2)l[s[f]]=s[f+1];let c;if(i.length>0){const f=new FormData;for(const u of i)u.key!==null&&(u.bufferId>0?f.append(u.key,Ft(u.bufferId),u.filename??void 0):f.append(u.key,u.value??""));c=f}else r!==null&&(c=r);(async()=>{var f;try{const u=await fetch(t,{method:e,headers:l,body:c,mode:"cors",credentials:"omit"}),d=h?(f=u.body)==null?void 0:f.getReader():void 0;if(!d){o(ct(await u.arrayBuffer()),u.status);return}const p=Number(u.headers.get("content-length"))||void 0,b=[];let g=0;for(;;){const{done:v,value:k}=await d.read();if(v)break;k&&(b.push(k),g+=k.length,h({loaded:g,total:p}))}const x=new Uint8Array(g);let w=0;for(const v of b)x.set(v,w),w+=v.length;o(ct(x.buffer),u.status)}catch(u){a(u instanceof Error?u.message:String(u))}})()},buffer:t=>{const e=nt(t);return e?new Uint8Array(e):null},putBuffer:t=>ct(t.slice().buffer),bufferSlice(t,e,s){const r=nt(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}}),$e=["MouseLeft","MouseMiddle","MouseRight","MouseBack","MouseForward"],Kt=["GamepadSouth","GamepadEast","GamepadWest","GamepadNorth","GamepadL1","GamepadR1","GamepadL2","GamepadR2","GamepadSelect","GamepadStart","GamepadL3","GamepadR3","GamepadUp","GamepadDown","GamepadLeft","GamepadRight"],At=4,Yt=16,Ge=16,wi=.5,bi=n=>{const t=new Set;let e=null;const s=(E,R,U=-1,F=0)=>{e==null||e(E,R,U,F)},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 h=0,l=0,c=0,f=0,u=0,d=0,p=0,b=0,g=0,x=0;const w=E=>{if(E.pointerType&&E.pointerType!=="mouse")return;const R=a.getBoundingClientRect();h=E.clientX-R.left,l=E.clientY-R.top,c+=E.movementX||0,f+=E.movementY||0},v=E=>{const R=$e[E.button];R&&(t.add(R),s(0,R))},k=E=>{const R=$e[E.button];R&&t.delete(R)&&s(1,R)},A=E=>{const R=E.deltaMode===0?.01:1;u+=E.deltaX*R,d+=E.deltaY*R},P=E=>{document.pointerLockElement===a&&E.preventDefault()},C=[],O=[],N=[],X=()=>{var R,U;const E=typeof navigator<"u"&&navigator.getGamepads?Array.from(navigator.getGamepads()):[];for(let F=0;F<At;F++){const Q=E[F]??null,Z=!!Q&&Q.connected;if(Z!==!!C[F]){if(C[F]=Z,!Z){for(const Y of Kt)t.delete(Y+"@"+F)&&(s(1,Y,F),T(Y));N[F]=[],O[F]=[0,0,0,0,0,0]}s(Z?2:3,"",F)}if(!Q||!Z)continue;const S=Q.axes,I=Q.buttons,W=((R=I[6])==null?void 0:R.value)??0,st=((U=I[7])==null?void 0:U.value)??0;O[F]=[S[0]??0,S[1]??0,S[2]??0,S[3]??0,W,st];const ut=N[F]??(N[F]=[]);for(let Y=0;Y<Kt.length;Y++){const Bt=I[Y],St=!!Bt&&(Bt.pressed||Bt.value>wi);if(St===!!ut[Y])continue;ut[Y]=St;const kt=Kt[Y];St?t.add(kt+"@"+F):t.delete(kt+"@"+F),T(kt),s(St?0:1,kt,F)}}},T=E=>{let R=!1;for(let U=0;U<At&&!R;U++)t.has(E+"@"+U)&&(R=!0);R?t.add(E):t.delete(E)};let $=0;const j=()=>{p=c,b=f,g=u,x=d,c=f=u=d=0,X(),$=requestAnimationFrame(j)},y=n.windows.filter((E,R,U)=>E&&U.indexOf(E)===R);for(const E of y)n.keyboard!==!1&&(E.addEventListener("keydown",r),E.addEventListener("keyup",i)),E.addEventListener("blur",o);return a.addEventListener("pointermove",w,!0),a.addEventListener("mousedown",v,!0),window.addEventListener("mouseup",k,!0),a.addEventListener("wheel",A,{passive:!0,capture:!0}),a.addEventListener("contextmenu",P,!0),typeof requestAnimationFrame=="function"&&($=requestAnimationFrame(j)),{inputKey:(E,R)=>R>=0&&E.startsWith("Gamepad")?t.has(E+"@"+R):t.has(E),inputRead:E=>{var R;switch(E){case 0:return h;case 1:return l;case 2:return p;case 3:return b;case 4:return g;case 5:return x;case 6:return document.pointerLockElement===a?1:0;case 7:{let U=0;for(let F=0;F<At;F++)C[F]&&U++;return U}}if(E>=Yt){const U=Math.floor((E-Yt)/Ge),F=(E-Yt)%Ge;return U>=At||!C[U]?0:F===0?1:((R=O[U])==null?void 0:R[F-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 y)E.removeEventListener("keydown",r),E.removeEventListener("keyup",i),E.removeEventListener("blur",o);a.removeEventListener("pointermove",w,!0),a.removeEventListener("mousedown",v,!0),window.removeEventListener("mouseup",k,!0),a.removeEventListener("wheel",A,!0),a.removeEventListener("contextmenu",P,!0),$&&cancelAnimationFrame($),document.pointerLockElement===a&&document.exitPointerLock(),t.clear(),e=null}}},vi=n=>{const t=bi(n);return t.registerInputEvent(n.push),{table:{key:t.inputKey,read:t.inputRead,setPointerLock:t.inputSetPointerLock,keyboardHeight:n.keyboardHeight},dispose:t.dispose}},xi={createVideo:mr,createAudio:yr,setVolume:wr,setPlaying:br,setLoop:vr,time:xr,setTime:Er,duration:Sr,remove:kr},Ei=()=>{const n=new Map,t=new Map,e=new Map;let s=1;return{registerService:(u,d,p=1)=>{n.set(u,d),t.set(u,p)},unregisterService:u=>{n.delete(u),t.delete(u)},isServiceSupported:u=>n.has(u),serviceVersion:u=>t.get(u)??0,serviceOpen:(u,d,p)=>{const b=n.get(u);if(!b)return-1;const g=s++,x=b(d?JSON.parse(d):{},{emit:(w,v)=>{v===void 0?p(w):p(w,v)}});return e.set(g,x),g},serviceCall:(u,d,p,b,g)=>{const x=e.get(u);if(!(x!=null&&x.call)){g(`Service call "${d}": no live session or no call handler (serviceId ${u})`);return}try{Promise.resolve(x.call(d,Array.isArray(p)?p:[])).then(w=>{w===void 0?b():b(w)},w=>g(w instanceof Error?w.message:String(w)))}catch(w){g(w instanceof Error?w.message:String(w))}},serviceClose:u=>{var d,p;(p=(d=e.get(u))==null?void 0:d.close)==null||p.call(d),e.delete(u)},destroy:()=>{var u;for(const d of e.values())(u=d.close)==null||u.call(d);e.clear()}}},Si=()=>{const n=Ei();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}},ki=()=>{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}}},_i=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{}}}},Ve=()=>{const n={};return{global:n,evaluate:e=>{const s=Object.getOwnPropertyNames(n);return new Function(...s,e)(...s.map(r=>n[r]))}}},Ti={fetch:Jn,getBuffer:nt,getBlob:Ft,putBuffer:ct,putLocalBuffer:tr,hasLocalBuffer:er,getLocalName:nr,getPlayer:ue,removePlayers:ln},Ri=(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(){}}),Ai=async(n,t={})=>{var Z;const e=t.header,s=t.profile??(e?ei(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),h=ni(n),{doc:l,win:c}=h,f=i?Promise.all([Gs(void 0,l),Hs((e==null?void 0:e.bootFonts)??[],l)]):null,u=o?Xs(h,r.has("capture")):null,d=a?Ks(h):null,p=i?h.newCanvas():null,b=ti(c,o);o&&qn();const[g,x]=await Promise.all([Nn(s,{glContext:u==null?void 0:u.context,glOptions:u==null?void 0:u.options,gl2dContext:d==null?void 0:d.context,gl2dOptions:d==null?void 0:d.options,moduleArgs:{print:S=>{b.runtimeLine(S)?console.debug(S):console.log(S)},printErr:S=>{console.error(S)}}}),o?fi(r):Promise.resolve({})]),w=(S,I)=>{const W=g.stringToNewUTF8(S);try{return I(W)}finally{g._free(W)}};let v=null,k=-1,A=-1;const P=(S,I)=>{A=S,S===Dt&&(u==null||u.show()),S===Ae&&(d==null||d.show()),v&&S===Dt&&I!==k&&(k=I,v.openScene(I))},C=S=>{S!==A&&(S===Dt&&(u==null||u.hide(),v&&k>=0&&(k=-1,v.closeScene())),S===Ae&&(d==null||d.hide()))},O=Bs();let N=t.keyboardBand??0;const T=p?Rs(n,{M:g,canvas:p,canvasHost:O,keyboardHeight:()=>{const S=c.visualViewport,I=S?Math.max(0,Math.round((c.innerHeight-S.height-S.offsetTop)/he(n))):0;return I>0?I:N},onKeyboard:t.onKeyboard}):null;T&&(T.ui.onDestination=P,T.ui.onDropped=C);const $=pi({onOrientation:t.onOrientation,push:(S,I)=>{S==="url"&&I!==void 0&&w(I,W=>g._creatorWebSetLaunchUrl(W)),w(S,W=>{I===void 0?g._creatorWebAppEvent(W,0):w(I,st=>g._creatorWebAppEvent(W,st))})}}),j=ki(),y=Si(),L=vi({windows:[...new Set([c,...t.keyboardTargets??[]])],root:n,keyboard:t.keyboard!==!1,push:(S,I,W,st)=>w(I,ut=>g._creatorWebInputEvent(S,ut,W,st)),keyboardHeight:()=>(T==null?void 0:T.ui.keyboardHeight())??0}),M={ui:(T==null?void 0:T.ui)??Ri(P,C),app:$.table,device:mi(t.language??(()=>(c.navigator.language||"en").slice(0,2))),fetch:yi(x),storage:_i(t.project??(e==null?void 0:e.name)??"app"),socket:j.table,service:y.table,input:L.table,media:xi,canvas:O.table,...u?{gl:u.table(g)}:{},...d?{scene2d:d.table(g)}:{}},D=Ve(),K=D.global;jn(g,{host:M,world:D,newWorld:Ve});const ht=ri({...T?{registerView:(S,I,W)=>T.ui.registerView(S,I,W),unregisterView:S=>T.ui.unregisterView(S)}:{},registerService:y.registerService,unregisterService:y.unregisterService});g._creatorWebInit(),t.launchUrl&&w(t.launchUrl,S=>g._creatorWebSetLaunchUrl(S)),T==null||T.ui.install(),!o&&t.engine3d&&(v=await t.engine3d({newCanvas:h.newCanvas,preloads:r,canvasHost:O,stores:Ti}),Object.defineProperty(K,"_creator",{value:v,configurable:!0,writable:!0,enumerable:!1})),o&&(e==null?void 0:e.gl)!=="defer"&&((Z=K._creator)==null||Z.createEngine());const E=si(n);t.safeArea&&E.set(t.safeArea);const R=S=>{var I;u==null||u.resize(),d==null||d.resize(),(I=v==null?void 0:v._onResize)==null||I.call(v,S.width,S.height,S.factor),T?(T.resize(S.width,S.height,S.factor),T.setSafeArea(E.current())):g._creatorWebResize(S.width,S.height)};h.onResize(R),R(h.size());let U=0;const F=S=>{U=c.requestAnimationFrame(F),u==null||u.frame(),g._creatorWebTick(S),d==null||d.frame(S),T&&(T.ui.layoutFrame(),T.ui.tickHover(),T.render())};U=c.requestAnimationFrame(F),await f;let Q=!1;return{profile:s,M:g,world:K,ui:(T==null?void 0:T.ui)??null,engine3d:()=>v,getBuffer:S=>nt(S),run(S,I={}){const W=I.header??xn(S);if(!Vs(W.sdk,Be))throw new Error(`This app was built with LeCodes SDK ${W.sdk??"older than 2.0"}; this host runs SDK ${Be}. It needs a new build.`);const st=b.track(S,I.onError);return ht.allow(W.plugins),w(S,ut=>g._creatorWebRun(ut)),{dispose:st.drop}},registerPlugin:(S,I)=>ht.register(S,I),hasPlugin:ht.has,locate:b.locate,safeArea:()=>E.current(),setSafeArea(S){E.set(S),T==null||T.setSafeArea(E.current())},setKeyboardBand(S){N=S??0,T==null||T.ui.refreshKeyboard()},remeasure:h.remeasure,emitAppEvent:$.emit,destroy(){var S;Q||(Q=!0,c.cancelAnimationFrame(U),b.dispose(),T==null||T.destroy(),L.dispose(),j.dispose(),y.dispose(),$.dispose(),ln(),E.destroy(),(S=v==null?void 0:v._dispose)==null||S.call(v),u==null||u.destroy(),d==null||d.destroy(),h.destroy())}}},Mi=(n,t)=>new Promise(e=>{const s=n.ownerDocument.defaultView??window;s.requestAnimationFrame(()=>{try{const r=[...n.querySelectorAll("canvas")].filter(l=>l.width>0&&l.height>0&&s.getComputedStyle(l).display!=="none");if(r.length===0){e(null);return}const i=n.getBoundingClientRect(),o=t??Math.max(...r.map(l=>l.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 h=a.getContext("2d");if(!h){e(null);return}h.fillStyle="#000000",h.fillRect(0,0,a.width,a.height);for(const l of r)h.drawImage(l,0,0,l.width,l.height,0,0,a.width,a.height);e(a.toDataURL("image/png"))}catch{e(null)}})}),Li=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)}},Pi=(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 h={};try{h=JSON.parse(String(a.data))}catch{return}h.type==="reload"&&typeof h.v=="number"&&t(h.v)},o.onclose=()=>{setTimeout(i,2e3)}};return i(),{bundleUrl:o=>`${n}/bundle.js?t=web&v=${o}`,versionOf(o,a){const h=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(h)?h:a},ran(o){s=o},log:(o,a)=>e({type:"log",level:o,text:a.map(Li).join(" ")}),error:o=>e({type:"error",text:o})}},Ci={camera:()=>q(()=>import("./assets/camera-5XOM8eHl.js"),[],import.meta.url).then(n=>t=>n.register(t)),geolocation:()=>q(()=>import("./assets/geolocation-BjTKN9_P.js"),[],import.meta.url).then(n=>t=>n.register(t)),map:()=>q(()=>import("./assets/map-8PhtP3jn.js").then(n=>n.m),[],import.meta.url).then(n=>t=>n.register(t,()=>q(()=>import("./assets/map-CyBxOSV0.js"),[],import.meta.url).then(e=>e.resources))),"qr-scanner":()=>q(()=>import("./assets/qr-scanner-CK_cYoJR.js"),[],import.meta.url).then(n=>t=>n.register(t))},Oi=async(n,t)=>{await Promise.all([...t].map(async e=>{const s=Ci[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)}`)}}))},de=n=>typeof n=="object"&&n!==null,ot=n=>typeof n=="number"&&Number.isFinite(n),Ii=n=>{if(!de(n))return null;switch(n.ask){case"tree":return{ask:"tree"};case"text":return{ask:"text"};case"at":return ot(n.x)&&ot(n.y)?{ask:"at",x:n.x,y:n.y}:null;case"node":return ot(n.node)?{ask:"node",node:n.node}:null;default:return null}},En=n=>{if(!de(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}:{}}},Fi=n=>{const t=Number(n.get("keyboard-band"));return Number.isFinite(t)&&t>0?t:null},Ni=n=>{const t=n.get("safe-area");if(!t)return null;const[e,s,r,i]=t.split(",").map(Number);return En({top:e,right:s,bottom:r,left:i,bars:(n.get("bars")??"").split(",")})},Ui=n=>{if(!de(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:En(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:ot(n.height)&&n.height>0?n.height:null};case"lecodes:inspect":{const t=Ii(n.question);return t&&ot(n.request)?{type:"lecodes:inspect",request:n.request,question:t}:null}case"lecodes:capture":{if(!ot(n.request))return null;const t=ot(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}},Bi=(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}},Wi=(n,t)=>{const e=n.parent!==n?n.parent:null,s=r=>{if(!e||r.source!==e)return;const i=Ui(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)}}},Ut=window.lecodesPlayerConfig??{},wt=document.getElementById("app"),qt=document.getElementById("loader"),je=document.getElementById("error"),rt=new URLSearchParams(location.search),Sn=n=>qt==null?void 0:qt.classList.toggle("on",n),kn=n=>{je&&(je.textContent=window.parent===window?n:"")};let ae=Ut.language||rt.get("lang")||(navigator.language||"en").slice(0,2),Pt=Ut.safeArea??Ni(rt),Ct=Ut.keyboardBand??Fi(rt),B=null;const ze=()=>{var n;return(n=B==null?void 0:B.world)==null?void 0:n._creatorTree},Ot=rt.has("test")?{ready:!1,dump:()=>{var n;return((n=ze())==null?void 0:n.debugDump())??'{"roots":[]}'},rect:n=>{var s;const t=(s=ze())==null?void 0:s.getBoundingClientRect(n);if(!t)return null;const e=wt.getBoundingClientRect();return[e.left+t[0],e.top+t[1],t[2],t[3]]}}:null;Ot&&(window.lecodesTest=Ot);const Di=rt.has("inspect"),ce=Di?q(()=>import("./assets/inspect-CE4HRex9.js"),[],import.meta.url):null;let yt=null;const Hi=async(n,t)=>{const{createInspector:e}=await(ce??q(()=>import("./assets/inspect-CE4HRex9.js"),[],import.meta.url));B&&yt===null&&(yt=e(B)),J.post({type:"lecodes:inspected",request:n,answer:(yt==null?void 0:yt.answer(t))??null})},Xe=rt.has("dev")?new URL(rt.get("dev")||"..",location.href).href.replace(/\/$/,""):null,Ke=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}`},_n=n=>{kn(Ke(n)),J.post({type:"lecodes:error",error:n}),V==null||V.error(Ke(n))},Tn=n=>_n({message:n,frames:[]});let at=null,Jt=!1,Qt=null;const $i=async n=>{Sn(!0),kn(""),B==null||B.destroy(),B=null,yt=null,wt.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=xn(e);B=await Ai(wt,{header:s,language:()=>ae,launchUrl:location.href,...Pt?{safeArea:Pt}:{},...Ct?{keyboardBand:Ct}:{},...J.embedded?{onKeyboard:(r,i)=>J.post({type:"lecodes:keyboard",height:r,duration:i})}:{},...J.embedded?{onOrientation:r=>J.post({type:"lecodes:orientation",mode:r})}:{}}),await Oi(B,s.plugins),ce&&(await ce).recordSites(B),B.run(e,{onError:_n}),Ot&&(Ot.ready=!0),V&&n.version!==void 0&&(It=V.versionOf(t,n.version),V.ran(It)),J.post({type:"lecodes:ready",src:n.src})},lt=n=>{if(Jt){Qt=n;return}Jt=!0,at=n,$i(n).catch(t=>Tn(t instanceof Error?t.message:String(t))).finally(()=>{Sn(!1),Jt=!1;const t=Qt;Qt=null,t&&lt(t)})},fe=n=>{const t=Bi(n,location.href);t?lt({src:t}):Tn(`The player runs bundles of its own origin only: ${n}`)},Rn=n=>{Pt=n,B==null||B.setSafeArea(Pt)},Gi=n=>{Ct=n,B==null||B.setKeyboardBand(Ct)},An=async n=>({image:B?await Mi(wt,n):null,width:wt.clientWidth,height:wt.clientHeight}),J=Wi(window,n=>{switch(n.type){case"lecodes:run":fe(n.src);break;case"lecodes:reload":at&&lt(at);break;case"lecodes:safe-area":Rn(n.insets);break;case"lecodes:keyboard-band":Gi(n.height);break;case"lecodes:inspect":Hi(n.request,n.question);break;case"lecodes:capture":An(n.pixelRatio).then(t=>J.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===ae)break;ae=n.language,at&&lt(at);break}});let It=-1;const V=Xe?Pi(Xe,n=>{It>=0&&n!==It&&lt({src:V.bundleUrl(n),version:n})}):null;if(V||J.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{V==null||V.log(t,s),J.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:"724e438-2026-10-12",get host(){return B},run:fe,reload(){at&&lt(at)},setSafeArea:Rn,capture:async n=>(await An(n)).image};const Ye=Ut.src??rt.get("src");V?lt({src:V.bundleUrl(0),version:0}):Ye&&fe(Ye);export{q as _};
21
+ in ${n.nativeFrames[0]}`:"";return`${n.detail?`${n.message}: ${n.detail}`:n.message}${e}`},_n=n=>{kn(Ke(n)),J.post({type:"lecodes:error",error:n}),V==null||V.error(Ke(n))},Tn=n=>_n({message:n,frames:[]});let at=null,Jt=!1,Qt=null;const $i=async n=>{Sn(!0),kn(""),B==null||B.destroy(),B=null,yt=null,wt.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=xn(e);B=await Ai(wt,{header:s,language:()=>ae,launchUrl:location.href,...Pt?{safeArea:Pt}:{},...Ct?{keyboardBand:Ct}:{},...J.embedded?{onKeyboard:(r,i)=>J.post({type:"lecodes:keyboard",height:r,duration:i})}:{},...J.embedded?{onOrientation:r=>J.post({type:"lecodes:orientation",mode:r})}:{}}),await Oi(B,s.plugins),ce&&(await ce).recordSites(B),B.run(e,{onError:_n}),Ot&&(Ot.ready=!0),V&&n.version!==void 0&&(It=V.versionOf(t,n.version),V.ran(It)),J.post({type:"lecodes:ready",src:n.src})},lt=n=>{if(Jt){Qt=n;return}Jt=!0,at=n,$i(n).catch(t=>Tn(t instanceof Error?t.message:String(t))).finally(()=>{Sn(!1),Jt=!1;const t=Qt;Qt=null,t&&lt(t)})},fe=n=>{const t=Bi(n,location.href);t?lt({src:t}):Tn(`The player runs bundles of its own origin only: ${n}`)},Rn=n=>{Pt=n,B==null||B.setSafeArea(Pt)},Gi=n=>{Ct=n,B==null||B.setKeyboardBand(Ct)},An=async n=>({image:B?await Mi(wt,n):null,width:wt.clientWidth,height:wt.clientHeight}),J=Wi(window,n=>{switch(n.type){case"lecodes:run":fe(n.src);break;case"lecodes:reload":at&&lt(at);break;case"lecodes:safe-area":Rn(n.insets);break;case"lecodes:keyboard-band":Gi(n.height);break;case"lecodes:inspect":Hi(n.request,n.question);break;case"lecodes:capture":An(n.pixelRatio).then(t=>J.post({type:"lecodes:captured",request:n.request,...t}));break;case"lecodes:language":if(n.language===ae)break;ae=n.language,at&&lt(at);break}});let It=-1;const V=Xe?Pi(Xe,n=>{It>=0&&n!==It&&lt({src:V.bundleUrl(n),version:n})}):null;if(V||J.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{V==null||V.log(t,s),J.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:"106118c-2026-10-12",get host(){return B},run:fe,reload(){at&&lt(at)},setSafeArea:Rn,capture:async n=>(await An(n)).image};const Ye=Ut.src??rt.get("src");V?lt({src:V.bundleUrl(0),version:0}):Ye&&fe(Ye);export{q as _};
@@ -1,5 +1,5 @@
1
1
  var Dn=Object.defineProperty;var Bn=(e,t,n)=>t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var je=(e,t,n)=>Bn(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Vn=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)}},zn=(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 i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{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 d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},Wn=(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}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.2.4",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Q=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},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)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",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"},Mr={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"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={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",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},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},zr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${zr[e]})))`,Wr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Wr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},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},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),ne=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,ne),[`${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)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={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:ne},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:ne},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:ne,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},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:ne},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:ne},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",jr(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",ro(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:ne,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"},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",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({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:eo,rank:ne},border:we(Ie,ne),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:ne}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={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",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"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=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,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-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)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};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:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
2
+ ${e.stack}`:String(e);try{return JSON.stringify(e)}catch{return String(e)}},zn=(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 i=async()=>{try{const{v:o}=await(await fetch(`${e}/version`,{cache:"no-store"})).json();typeof o=="number"&&t(o)}catch{}setTimeout(i,2500)};setTimeout(i,2500);const s=()=>{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 d={};try{d=JSON.parse(String(l.data))}catch{return}d.type==="reload"&&typeof d.v=="number"&&t(d.v)},o.onclose=()=>{setTimeout(s,2e3)}};return s(),{bundleUrl:o=>`${e}/bundle.js?t=web&v=${o}`,versionOf(o,l){const d=Number(o.headers.get("x-lecodes-v"));return o.headers.has("x-lecodes-v")&&Number.isFinite(d)?d:l},ran(o){r=o},log:(o,l)=>n({type:"log",level:o,text:l.map(Vn).join(" ")}),error:o=>n({type:"error",text:o})}},Wn=(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}},Gn="modulepreload",Hn=function(e,t){return new URL(e,t).href},Et={},ce=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(y){return Promise.all(y.map(k=>Promise.resolve(k).then(A=>({status:"fulfilled",value:A}),A=>({status:"rejected",reason:A}))))};const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=o(n.map(y=>{if(y=Hn(y,r),y in Et)return;Et[y]=!0;const k=y.endsWith(".css"),A=k?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const b=l[E];if(b.href===y&&(!k||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${A}`))return;const p=document.createElement("link");if(p.rel=k?"stylesheet":Gn,k||(p.as="script"),p.crossOrigin="",p.href=y,f&&p.setAttribute("nonce",f),document.head.appendChild(p),k)return new Promise((E,b)=>{p.addEventListener("load",E),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${y}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},wt="2.2.5",Ke=e=>{const t=e==null?void 0:e.match(/^(\d+)\.\d+\.\d+/);return t?Number(t[1]):null},jn=(e,t)=>Ke(e)!==null&&Ke(e)===Ke(t),Kn=(e,t="woff2")=>{const n=/^\/\/ fonts: (.+)$/m.exec(e);if(!n)return[];const r=[];for(const i of n[1].split(";")){const s=i.indexOf("=");if(s===-1)continue;const o=/^(.+)@(\d+)(i?)$/.exec(i.slice(0,s));o&&r.push({family:o[1],weight:parseInt(o[2],10),italic:o[3]==="i",url:i.slice(s+1).replace("{fmt}",t)})}return r},Yn=async(e,t,n=2e3)=>{const r=t??(typeof document>"u"?void 0:document);if(!(r!=null&&r.fonts)||e.length===0)return;const i=[];for(const s of e)try{const o=new FontFace(s.family,`url("${s.url}")`,{weight:String(s.weight),style:s.italic?"italic":"normal"});r.fonts.add(o),i.push(o.load().catch(()=>{}))}catch{}await Promise.race([Promise.all(i),new Promise(s=>setTimeout(s,n))])},qn=e=>{var d,f,y,k;const t=e.slice(0,2e3),n=new Set,r=t.match(/\/\/ preload: (.+)/);if(r)for(const A of r[1].split(";"))n.add(A);const i=t.includes("// gl: disable")?"off":t.includes("// gl: defer")?"defer":"on",s=((d=t.match(/^\/\/ sdk: (\d+\.\d+\.\d+\S*)/m))==null?void 0:d[1])??null,o=((y=(f=t.match(/^\/\/ name: (.+)$/m))==null?void 0:f[1])==null?void 0:y.trim())??null,l=new Set((((k=t.match(/^\/\/ plugins: (.+)$/m))==null?void 0:k[1])??"").split(";").map(A=>A.trim()).filter(Boolean));return{sdk:s,name:o,preloads:n,gl:i,is2d:t.includes("// 2d: enable"),plugins:l,bootFonts:Kn(t)}},Xn=1,Jn=2,Qn=3,Zn=4,er=5,tr=6,St=7,nr=8,_t=9,rr=10,or=11,sr=12,ir=13,ar=14,lr=15,cr=16,kt=17,ur=18,fr=19,Oe=20,ai=21,li=22,ci=23,ui=24,fi=25,dr=26,pr=27,hr=28,mr=29,Tt=30,Lt=31,gr=32,br=33,xt=34,Rt=35,Ct=36,Pe=1,yr=2,vr=4,de=8,Er=16,Ye=32,wr=64,qe=128,Sr=256,_r=512,kr=1024,Tr=2048,Lr=4096,At=8192,di=16384,xr=32768,Rr=1<<18,Cr=255,$t=256,Ot=512,Ar=1024,Q=0,$r=1,Or=2,Ur=3,De=4,be=255,un=e=>{const t=e.clientWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1},Ut={text:{type:"text"},password:{type:"password"},search:{type:"search"},tel:{type:"tel"},email:{type:"email"},url:{type:"url"},number:{type:"text",mode:"numeric"},decimal:{type:"text",mode:"decimal"},date:{type:"date"},time:{type:"time"}},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)},Nr=(e,t)=>{if(e.type!=="input"&&e.type!=="textarea")return;const n=e.el,r=t("placeholder");if(oe(n,"placeholder",r==null?null:String(r)),e.type==="input"){const l=Ut[String(t("type")??"text")]??Ut.text,d=n;d.type!==l.type&&(d.type=l.type),oe(n,"inputmode",l.mode??null);const f=t("enterKey");oe(n,"enterkeyhint",f==null?null:String(f))}const i=t("autocapitalize");oe(n,"autocapitalize",i==null?null:String(i));const s=t("autocorrect");s==null?(oe(n,"autocorrect",null),oe(n,"spellcheck",null)):(oe(n,"autocorrect",Nt(s,!0)?"on":"off"),oe(n,"spellcheck",Nt(s,!0)?"true":"false"));const o=Number(t("maxLength")??0);oe(n,"maxlength",o>0?String(Math.round(o)):null)},Be={width:"layout",height:"layout",minWidth:"layout",minHeight:"layout",maxWidth:"layout",maxHeight:"layout",flexBasis:"layout",flexGrow:"layout",flexShrink:"layout",aspectRatio:"layout",gap:"layout",rowGap:"layout",columnGap:"layout",padding:"layout",paddingTop:"layout",paddingRight:"layout",paddingBottom:"layout",paddingLeft:"layout",paddingHorizontal:"layout",paddingVertical:"layout",paddingStart:"layout",paddingEnd:"layout",margin:"layout",marginTop:"layout",marginRight:"layout",marginBottom:"layout",marginLeft:"layout",marginHorizontal:"layout",marginVertical:"layout",marginStart:"layout",marginEnd:"layout",left:"layout",right:"layout",top:"layout",bottom:"layout",start:"layout",end:"layout",inset:"layout",flexDirection:"enum",justifyContent:"enum",alignItems:"enum",alignSelf:"enum",position:"enum",flexWrap:"enum",boxSizing:"enum",display:"enum",overflow:"enum",scrollDirection:"enum",borderWidth:"len",borderTopWidth:"len",borderRightWidth:"len",borderBottomWidth:"len",borderLeftWidth:"len",borderHorizontalWidth:"len",borderVerticalWidth:"len",borderStartWidth:"len",borderEndWidth:"len",color:"color",backgroundColor:"color",borderColor:"color",borderTopColor:"color",borderRightColor:"color",borderBottomColor:"color",borderLeftColor:"color",placeholderColor:"color",refreshControlColor:"color",tintColor:"color",rippleColor:"color",overlayColor:"color",backgroundImage:"str",backgroundSize:"enum",backgroundGradient:"str",borderRadius:"len",borderTopLeftRadius:"len",borderTopRightRadius:"len",borderBottomRightRadius:"len",borderBottomLeftRadius:"len",opacity:"num",transform:"str",transformOrigin:"str",pointerEvents:"enum",fontSize:"len",fontWeight:"num",fontStyle:"enum",fontFamily:"str",lineHeight:"len",letterSpacing:"len",textAlign:"enum",textDecoration:"enum",lineClamp:"num",textOverflow:"enum",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"},Mr={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"},Fr=["placeholderColor","refreshControlColor","tintColor","rippleColor","overlayColor","backgroundGradient"],Pr={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",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},Ir=["duration","delay","layer","commit","loop","loopMode","name"];function fn(e){let t=e.trim();/\sxmlns\s*=/.test(t)||(t=t.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"'));const n=new TextEncoder().encode(t);let r="";for(const i of n)r+=String.fromCharCode(i);return`data:image/svg+xml;base64,${btoa(r)}`}function Dr(e){const t=e.match(/viewBox\s*=\s*["']([^"']+)["']/);return t?t[1]:null}const Br=/\b(?:calc|min|max|clamp)\(/,Vr=e=>{if(!Br.test(e))return e;let t="";for(let n=0;n<e.length;n++){if(e.startsWith("var(",n)){let i=0;const s=n;for(;n<e.length;n++)if(e[n]==="(")i++;else if(e[n]===")"&&--i===0)break;t+=e.slice(s,Math.min(n+1,e.length));continue}const r=e[n];if(r==="+"||r==="-"){const i=t[t.length-1]??"";if(!(r==="-"&&(i==="e"&&"btlr".includes(e[n+1]??"")||e.slice(Math.max(0,n-7),n)==="comfort"))&&/[\w%.)]/.test(i)){for(t=t.trimEnd()+" "+r+" ";e[n+1]===" ";)n++;continue}}t+=r}return t.replace(/\d*\.\d+|\d+/g,(n,r,i)=>{const s=i.slice(0,r).trimEnd(),o=i.slice(r+n.length).trimStart();return/[\w.%]$/.test(s)||/^[\w.%]/.test(o)||/[*/]$/.test(s)||/^[*/]/.test(o)?n:n+"px"})},zr={top:"12px",bottom:"4px",left:"16px",right:"16px"},dn=e=>`max(var(--safe-${e}, 0px), calc(var(--safe-${e}-bar, 0px) + var(--comfort-${e}, ${zr[e]})))`,Wr={vw:"cqw",vh:"cqh",vmin:"cqmin",vmax:"cqmax"},Re=e=>Vr(e).replace(new RegExp("(?<![-\\w])comfort-(top|bottom|left|right)\\b","g"),(t,n)=>dn(n)).replace(new RegExp("(?<![-\\w])safe-(top|bottom|left|right)\\b","g"),(t,n)=>`var(--safe-${n}, 0px)`).replace(/(\d)(vmin|vmax|vw|vh)\b/g,(t,n,r)=>n+Wr[r]),pt=/^-?\d*\.?\d+$/,se=e=>{if(typeof e=="number")return e+"px";const t=String(e).trim();return pt.test(t)?t+"px":Re(t)},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},Gr=/^(rotate|skew)/,Hr=/^translate/,jr=e=>{const t=String(e).trim();return t===""||t==="identity"?"none":t.replace(/([a-zA-Z0-9]+)\s*\(([^)]*)\)/g,(n,r,i)=>{const s=Hr.test(r)?"px":Gr.test(r)?"deg":null;return s===null?n:`${r}(${i.split(",").map(o=>{const l=o.trim();return pt.test(l)?l+s:Re(l)}).join(", ")})`})},pn=e=>typeof e=="number"?e+"px":String(e).trim().split(/\s+/).map(t=>pt.test(t)?t+"px":Re(t)).join(" "),ne=0,re=1,_e=2,Ie=["top","right","bottom","left"],Kr=(e,t)=>e==="safe-all"?`var(--safe-${t}, 0px)`:e==="comfort-all"||e==="comfort-x"||e==="comfort-y"?dn(t):se(e),at=(e,t)=>{const n=(i,s)=>({rank:s,to:o=>i.map(l=>[t(l),Kr(o,l)])}),r=i=>({rank:re,to:s=>[[t(i),se(s)]]});return{[e]:n(Ie,ne),[`${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)}},Yr=()=>{const e=at("border",n=>`border-${n}-width`),t={};for(const n of Object.keys(e))t[`${n}Width`]=e[n];return t},ht=e=>{const t=[];let n=0,r="";for(const i of e.trim()){if(i==="("&&n++,i===")"&&n--,/\s/.test(i)&&n===0){r&&t.push(r),r="";continue}r+=i}return r&&t.push(r),t},qr=new Set(["none","solid","dashed","dotted","double","hidden"]),Xr=/^-?\d*\.?\d+([a-z%]*)$|^(calc|min|max|clamp)\(/,we=(e,t)=>({rank:t,to:n=>{let r=null,i=null,s=null;if(typeof n=="number")r=n+"px";else for(const l of ht(String(n)))qr.has(l)?s=l:Xr.test(l)?r=se(l):i=Ce(l);const o=[];for(const l of e)o.push([`border-${l}-width`,r??(i?"1px":"0px")]),o.push([`border-${l}-color`,i??"transparent"]),s&&o.push([`border-${l}-style`,s]);return o}}),Jr=e=>{const t=String(e).trim(),n=(s,o,l)=>[["flex-grow",s],["flex-shrink",o],["flex-basis",l]];if(t==="none")return n("0","0","auto");if(t==="auto")return n("1","1","auto");if(t==="initial")return n("0","1","auto");const r=ht(t),i=s=>s!==void 0&&/^-?\d*\.?\d+$/.test(s);return i(r[0])?r.length===1?n(r[0],"1","0%"):i(r[1])?n(r[0],r[1],r[2]!==void 0?se(r[2]):"0%"):n(r[0],"1",se(r[1])):n("1","1",se(r[0]??"auto"))},hn=e=>{var t;return typeof e=="object"&&e!==null&&"_h"in e&&typeof((t=e._h)==null?void 0:t.id)=="number"},Qr=e=>e.replace(/<svg\b[^>]*>/,t=>t.replace(/\spreserveAspectRatio\s*=\s*("[^"]*"|'[^']*')/,"").replace(/^<svg\b/,'<svg preserveAspectRatio="none"')),mn=(e,t)=>{if(hn(e))return`url("${t.bufferUrl(e._h.id)}")`;const n=String(e??"");return n===""?"none":n.startsWith("id:")?`url("${t.bufferUrl(Number(n.slice(3)))}")`:n.startsWith("svg:")?`url("${fn(Qr(n.slice(4)))}")`:`url("${n.replace(/["\\\n]/g,r=>"\\"+r)}")`},Zr=/^\s*(repeating-)?(linear|radial|conic)-gradient\(/,gn=e=>{const t=String(e??"").trim();return t===""?"none":Re(t)},eo=(e,t)=>{const n=typeof e=="string"&&Zr.test(e),r=hn(e)||typeof e=="string"&&/^(id:|https?:|data:|blob:|\.{0,2}\/)/.test(e);return[["--lc-bg-grad",n?gn(e):"none"],["--lc-bg-img",r?mn(e,t):"none"],["background-color",n||r?"transparent":Ce(e)]]},to=e=>{const t=typeof e=="number"?[e+"px"]:ht(String(e)).map(o=>pn(o)),[n,r=n,i=n,s=r]=t;return[["border-top-left-radius",n??"0px"],["border-top-right-radius",r??"0px"],["border-bottom-right-radius",i??"0px"],["border-bottom-left-radius",s??"0px"]]},no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-monospace","ui-sans-serif","ui-serif","inherit"]),ro=e=>{const t=String(e).trim();return t==="monospaced"?"monospace":t.startsWith("var(")||t.includes(",")||/^["']/.test(t)||no.has(t)?t:`"${t.replace(/"/g,'\\"')}"`},oo=e=>e===!0||e==="true"||typeof e=="number"&&e>.5||e==="1",so=e=>t=>e[String(t)]??String(t),Ae={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:ne},rowGap:{css:"row-gap",as:"len"},columnGap:{css:"column-gap",as:"len"},...at("padding",e=>`padding-${e}`),...at("margin",e=>`margin-${e}`),inset:{css:Ie,as:"len",rank:ne},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:ne,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},...Yr(),color:{css:"color"},backgroundColor:{css:"background-color"},borderColor:{css:Ie.map(e=>`border-${e}-color`),rank:ne},borderTopColor:{css:"border-top-color"},borderRightColor:{css:"border-right-color"},borderBottomColor:{css:"border-bottom-color"},borderLeftColor:{css:"border-left-color"},placeholderColor:{css:"--lc-placeholder"},refreshControlColor:{css:"--lc-refresh"},tintColor:{css:"--lc-tint"},overlayColor:{css:"--lc-overlay"},rippleColor:{none:"a browser has no ripple: the press feedback of a page is `$pressed`"},backgroundImage:{to:(e,t)=>[["--lc-bg-img",mn(e,t)]]},backgroundGradient:{to:e=>[["--lc-bg-grad",gn(e)]]},backgroundSize:{to:e=>e==="tile"?[["background-size","auto"],["background-repeat","repeat"],["background-position","0 0"]]:[["background-size",e==="fill"?"100% 100%":String(e)],["background-repeat","no-repeat"],["background-position","center"]]},borderRadius:{to,rank:ne},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",jr(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",ro(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:ne,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"},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",oo(e)?"thin":"none"]]},overscrollMode:{to:e=>[["overscroll-behavior",so({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:eo,rank:ne},border:we(Ie,ne),borderTop:we(["top"],re),borderRight:we(["right"],re),borderBottom:we(["bottom"],re),borderLeft:we(["left"],re),flex:{to:Jr,rank:ne}},Xe=e=>Mr[e]??e,io=e=>e in Ae,bn=e=>{const t=Ae[e];return!!t&&"attr"in t},ao={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",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"},lo=e=>{const t=Ae[e];return t&&"css"in t&&typeof t.css=="string"?t.css:ao[e]??null},co={len:se,lens:pn,num:e=>String(e),raw:e=>String(e),color:Ce},uo={color:"color",len:"len",enum:"raw",num:"num",str:"raw",layout:"raw"},Mt=e=>{const t=Ae[e];return t&&"rank"in t&&t.rank!==void 0?t.rank:_e},Je=(e,t,n)=>{const r=[...e].filter(([,s])=>s!=null);r.sort((s,o)=>Mt(s[0])-Mt(o[0]));const i=new Map;for(const[s,o]of r){const l=Ae[s];if(!l){n==null||n(s);continue}if("attr"in l||"none"in l)continue;if("to"in l){for(const[y,k]of l.to(o,t))i.set(y,k);continue}const d=co[l.as??uo[Be[s]??"layout"]],f=d(o);if(typeof l.css=="string")i.set(l.css,f);else for(const y of l.css)i.set(y,f)}return i},Ft=e=>[...e].sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0).map(([t,n])=>`${t}:${n}`).join(";"),yn=0,vn=1,Le=2,xe=3,En=4,me=65,Ve=1.70158,Ue=Ve*1.525,Pt=Ve+1,It=2*Math.PI/3,Dt=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,lt=[["linear",e=>e],["inSine",e=>1-Math.cos(e*Math.PI/2)],["outSine",e=>Math.sin(e*Math.PI/2)],["inOutSine",e=>-(Math.cos(Math.PI*e)-1)/2],["inQuad",e=>e*e],["outQuad",e=>1-(1-e)*(1-e)],["inOutQuad",e=>e<.5?2*e*e:1-(-2*e+2)**2/2],["inCubic",e=>e*e*e],["outCubic",e=>1-(1-e)**3],["inOutCubic",e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2],["inQuart",e=>e**4],["outQuart",e=>1-(1-e)**4],["inOutQuart",e=>e<.5?8*e**4:1-(-2*e+2)**4/2],["inExpo",e=>e===0?0:2**(10*e-10)],["outExpo",e=>e===1?1:1-2**(-10*e)],["inOutExpo",e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2],["inCirc",e=>1-Math.sqrt(1-e*e)],["outCirc",e=>Math.sqrt(1-(e-1)**2)],["inOutCirc",e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2],["inBack",e=>Pt*e*e*e-Ve*e*e],["outBack",e=>1+Pt*(e-1)**3+Ve*(e-1)**2],["inOutBack",e=>e<.5?(2*e)**2*((Ue+1)*2*e-Ue)/2:((2*e-2)**2*((Ue+1)*(e*2-2)+Ue)+2)/2],["inElastic",e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*It)],["outElastic",e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*It)+1],["inOutElastic",e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*Dt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*Dt)/2+1],["inBounce",e=>1-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)]],fo={in:"inQuad",out:"outQuad",inOut:"inOutQuad",easeIn:"inQuad",easeOut:"outQuad",easeInOut:"inOutQuad","ease-in":"inQuad","ease-out":"outQuad","ease-in-out":"inOutQuad"},po=e=>{const t=fo[e]??e;for(let n=0;n<lt.length;n++)if(lt[n][0]===t)return n;return-1},ho=[.25,.1,.25,1],Me={kind:yn,p:[0,0,0,0]},mo=e=>{const t=new Float32Array(me);for(let n=0;n<me;n++)t[n]=e(n/(me-1));return t[0]=0,t[me-1]=1,t},go=e=>{if(e===void 0)return Me;if(typeof e=="function")return{kind:En,p:[0,0,0,0],table:mo(e)};if(Array.isArray(e)){const[i,s,o,l]=e;return{kind:Le,p:[i,s,o,l]}}const t=e.trim();if(t==="linear")return Me;if(t==="ease")return{kind:Le,p:ho};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:Le,p:[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])]};const r=po(t);return r===0?Me:r>0?{kind:vn,p:[r,0,0,0]}:(console.warn(`[tween] unknown easing "${t}" — using linear`),Me)},bo=(e,t,n,r,i)=>{const s=1-3*r+3*t,o=3*r-6*t,l=3*t,d=1-3*i+3*n,f=3*i-6*n,y=3*n;let k=e;for(let A=0;A<8;A++){const _=((s*k+o)*k+l)*k-e,p=(3*s*k+2*o)*k+l;if(Math.abs(_)<1e-6||Math.abs(p)<1e-6)break;k-=_/p}return k=Math.min(1,Math.max(0,k)),((d*k+f)*k+y)*k},yo=(e,t)=>{if(t<=0)return e.kind===xe&&e.p[1]===1?1/e.p[0]:0;if(t>=1)return 1;switch(e.kind){case vn:return lt[e.p[0]][1](t);case Le:return bo(t,e.p[0],e.p[1],e.p[2],e.p[3]);case xe:{const n=e.p[0];return e.p[1]===1?Math.min(1,Math.ceil(t*n)/n):Math.floor(t*n)/n}case En:{const n=e.table,r=t*(me-1),i=Math.floor(r),s=n[i],o=n[Math.min(i+1,me-1)];return s+(o-s)*(r-i)}default:return t}},Bt=24,Vt=e=>String(Math.round(e*1e4)/1e4),vo="cubic-bezier(0.3333, 0, 0.6667, 1)",Eo=e=>{switch(e.kind){case yn:return"linear";case Le:return`cubic-bezier(${e.p.map(Vt).join(", ")})`;case xe:return`steps(${e.p[0]}, ${e.p[1]===1?"jump-start":"jump-end"})`}const t=[];for(let n=0;n<=Bt;n++)t.push(Vt(yo(e,n/Bt)));return`linear(${t.join(", ")})`},wo=e=>e===void 0||e==="smoothstep"?vo:Eo(go(e)),wn=["lc-base","lc-bag","lc-own","lc-orient","lc-class","lc-hover","lc-press","lc-focus"],So=["--lc-bg-grad","--lc-bg-img","--lc-tint","--lc-overlay","--lc-refresh","--lc-fit","--lc-src","--lc-src-tint","--lc-iw","--lc-ih","--lc-ir","--lc-crop-size","--lc-crop-pos"],Sn="lc-app",_o=`
3
3
  @layer ${wn.join(", ")};
4
4
 
5
5
  @layer lc-base {
@@ -139,8 +139,8 @@ assertion channel for game state that has no UI.
139
139
 
140
140
  ## 3D scenes
141
141
 
142
- - A HUD over a \`Scene\` is a widget ATTACHED to it: \`const hud = UIWidget(...).style({ left: 16,
143
- bottom: 16, pointerEvents: "none" }); hud.attachTo(scene); hud.show()\`. Never a \`UIScreen\`:
142
+ - A HUD over a \`Scene\` is one of the scene's WIDGETS: \`const hud = UIWidget(...).style({ left: 16,
143
+ bottom: 16, pointerEvents: "none" }); scene.widgets(hud)\` — shown with the scene. Never a \`UIScreen\`:
144
144
  a screen is a destination, so \`UIScreen(...).open()\` after \`scene.open()\` CLOSES the scene
145
145
  (the host logs "3D scene closed" and you see only the screen) — no background makes it transparent.
146
146