exodeui 6.3.5 → 6.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
`&&AA++)}),A.globalAlpha=q}if(g.stroke&&g.stroke.width>0){const q=A.globalAlpha;g.fill&&g.fill.type!=="None"&&g.fill.isEnabled!==!1&&g.fill.opacity!==0&&g.fill.color!=="transparent"&&g.fill.color!=="rgba(0,0,0,0)"&&(A.shadowColor="transparent",A.shadowBlur=0,A.shadowOffsetX=0,A.shadowOffsetY=0),A.strokeStyle=g.stroke.color,A.lineWidth=g.stroke.width,A.globalAlpha=q*this.normalizeOpacity(g.stroke.opacity??100);let V=0,AA=T;(x||[]).forEach(iA=>{let cA=-B/2;c==="center"?cA=0:c==="right"&&(cA=B/2),j(iA.text,cA,AA,!0,V),V+=(iA.text||"").length,AA+=L,V<w.length&&(w[V]===`
|
|
32
32
|
`||w[V]==="\r")&&(R>0&&(AA+=R),V++,w[V-1]==="\r"&&w[V]===`
|
|
33
33
|
`&&V++)}),A.globalAlpha=q}}}applyStrokeAlignment(A,I,C,g,Q,B){if(!I.stroke||I.stroke.width<=0||I.stroke.isEnabled===!1)return;const i=I.stroke,o=i.width,D=(i.alignment||"center").toLowerCase();if(A.save(),I.fill&&I.fill.type!=="None"&&I.fill.isEnabled!==!1&&I.fill.opacity!==0&&I.fill.color!=="transparent"&&I.fill.color!=="rgba(0,0,0,0)"&&(A.shadowColor="transparent",A.shadowBlur=0,A.shadowOffsetX=0,A.shadowOffsetY=0),i.fill){const y=this.createCanvasFill(A,i.fill,g,Q);y?A.strokeStyle=y:A.strokeStyle=i.color||"#000000"}else A.strokeStyle=i.color||"#000000";const w=A.globalAlpha;A.globalAlpha=w*this.normalizeOpacity(i.opacity??100),A.lineWidth=o,A.lineCap=i.lineCap||"round",A.lineJoin=i.lineJoin||"round",i.miterLimit!==void 0&&(A.miterLimit=i.miterLimit);const a=i.trimStart??0,t=i.trimEnd??1,G=i.trimOffset??0,S=i.dashOffset??0,K=i.dashArray||[];if(a!==0||t!==1||G!==0){const y=this.getPerimeter(C,g,Q);if(y>0){const e=Math.max(0,Math.min(1,a)),N=Math.max(0,Math.min(1,t));if(e<N){const k=y*(N-e),c=y-k,F=-(y*(e+G%1));A.setLineDash([k,c]),A.lineDashOffset=F+S*y}else if(e===N)A.setLineDash([0,y]);else{const k=y*(1-e+N),c=y-k,F=-(y*e);A.setLineDash([k,c]),A.lineDashOffset=F+S*y}}}else K.length>0&&(A.setLineDash(K),A.lineDashOffset=S);(C==null?void 0:C.type)==="Line"||g===0||Q===0?(this.applyPath(A,C,g,Q,B),A.stroke()):D==="inside"?(A.lineWidth=o*2,A.save(),this.applyPath(A,C,g,Q,B),A.clip(),A.stroke(),A.restore()):D==="outside"?(A.lineWidth=o*2,this.applyPath(A,C,g,Q,B),A.stroke(),A.save(),A.globalCompositeOperation="destination-out",this.applyPath(A,C,g,Q,B),A.fill(),A.restore()):(A.lineWidth=o,this.applyPath(A,C,g,Q,B),A.stroke()),A.restore()}getPerimeter(A,I,C){switch(this.ensurePathPoints(A),A==null?void 0:A.type){case"Rectangle":return(I+C)*2;case"Ellipse":{const g=Math.abs(I)/2,Q=Math.abs(C)/2,B=Math.abs(A.sweepAngle??360),i=A.ratio||0,o=Math.PI*(3*(g+Q)-Math.sqrt((3*g+Q)*(g+3*Q)));if(B>=360&&i<=0)return o;let D=B/360*o;if(i>0){const s=Math.PI*(3*(g*i+Q*i)-Math.sqrt((3*g*i+Q*i)*(g*i+3*Q*i)));D+=B/360*s,B<360&&(D+=2*Math.sqrt((g-g*i)**2+(Q-Q*i)**2))}else B<360&&(D+=2*Math.max(g,Q));return isNaN(D)?0:D}case"Line":return A.length||Math.sqrt(I*I+C*C);case"Triangle":return I+Math.sqrt((I/2)**2+C**2)*2;case"Polygon":{const g=A.sides||3,Q=A.radius||Math.min(I,C)/2;return 2*g*Q*Math.sin(Math.PI/g)}case"Star":{const g=A.points||5,Q=A.outer_radius||Math.min(I,C)/2,B=A.inner_radius||Q/2,i=Math.PI/g;return Math.sqrt(Q*Q+B*B-2*Q*B*Math.cos(i))*g*2}case"Path":{const g=A.points||[];if(g.length<2)return A.length||0;let Q=0,B=g[0].x,i=g[0].y;for(let o=1;o<g.length;o++){const D=g[o];if(D.moveTo){B=D.x,i=D.y;continue}const s=B,w=i,a=g[o-1].out_x,t=g[o-1].out_y;if(a!==void 0||D.in_x!==void 0?Q+=this.getBezierLength(s,w,a??s,t??w,D.in_x??D.x,D.in_y??D.y,D.x,D.y):Q+=Math.sqrt((D.x-s)**2+(D.y-w)**2),B=D.x,i=D.y,D.closePath||o===g.length-1&&(A.is_closed||A.isClosed)){const G=B,S=i,K=[...g.slice(0,o+1)].reverse().find(R=>R.moveTo)||g[0],y=K.x,e=K.y,N=g[o].out_x,k=g[o].out_y,c=K.in_x,F=K.in_y;N!==void 0||c!==void 0?Q+=this.getBezierLength(G,S,N??G,k??S,c??y,F??e,y,e):Q+=Math.sqrt((y-G)**2+(e-S)**2)}}return Q}default:return(I+C)*2}}getBezierLength(A,I,C,g,Q,B,i,o,D=10){let s=0,w=A,a=I;for(let t=1;t<=D;t++){const G=t/D,S=1-G,K=G*G,y=S*S,e=y*S,N=K*G,k=e*A+3*y*G*C+3*S*K*Q+N*i,c=e*I+3*y*G*g+3*S*K*B+N*o,F=k-w,R=c-a;s+=Math.sqrt(F*F+R*R),w=k,a=c}return s}getBezierTAtLength(A,I,C,g,Q,B,i,o,D,s=20){if(A<=0)return 0;let w=0,a=I,t=C;for(let G=1;G<=s;G++){const S=G/s,K=1-S,y=S*S,e=K*K,N=e*K,k=y*S,c=N*I+3*e*S*g+3*K*y*B+k*o,F=N*C+3*e*S*Q+3*K*y*i+k*D,R=c-a,J=F-t,L=Math.sqrt(R*R+J*J);if(w+L>=A){const l=A-w,Y=L===0?0:l/L;return(G-1+Y)/s}w+=L,a=c,t=F}return 1}getPointOnPath(A,I,C,g){if(this.ensurePathPoints(A),(A==null?void 0:A.type)==="Path"){const Q=A.points||[];if(Q.length<2)return{x:0,y:0,angle:0};let B=1/0,i=-1/0,o=1/0,D=-1/0;Q.forEach(e=>{typeof e.x=="number"&&typeof e.y=="number"&&(B=Math.min(B,e.x),i=Math.max(i,e.x),o=Math.min(o,e.y),D=Math.max(D,e.y),e.out_x!==void 0&&(B=Math.min(B,e.out_x),i=Math.max(i,e.out_x)),e.out_y!==void 0&&(o=Math.min(o,e.out_y),D=Math.max(D,e.out_y)),e.in_x!==void 0&&(B=Math.min(B,e.in_x),i=Math.max(i,e.in_x)),e.in_y!==void 0&&(o=Math.min(o,e.in_y),D=Math.max(D,e.in_y)))});const s=(B+i)/2,w=(o+D)/2,t=this.getPerimeter(A,I,C)*g;let G=0;const S=[];let K=Q[0],y=Q[0];for(let e=1;e<Q.length;e++){const N=Q[e];if(N.moveTo){K=N,y=N;continue}S.push({p0:K,p1:N}),(N.closePath||e===Q.length-1&&(A.is_closed||A.isClosed))&&S.push({p0:N,p1:y}),K=N}for(const e of S){const N=e.p0,k=e.p1;let c=0;const F=N.out_x!==void 0||k.in_x!==void 0;if(F?c=this.getBezierLength(N.x,N.y,N.out_x??N.x,N.out_y??N.y,k.in_x??k.x,k.in_y??k.y,k.x,k.y):c=Math.sqrt((k.x-N.x)**2+(k.y-N.y)**2),G+c>=t||e===S[S.length-1]){let R=0;if(F)return R=this.getBezierTAtLength(t-G,N.x,N.y,N.out_x??N.x,N.out_y??N.y,k.in_x??k.x,k.in_y??k.y,k.x,k.y,20),this.getBezierPointAndAngle(R,N,k,s,w);{R=c===0?0:(t-G)/c;const J=N.x+(k.x-N.x)*R-s,L=N.y+(k.y-N.y)*R-w,l=Math.atan2(k.y-N.y,k.x-N.x);return{x:J,y:L,angle:l}}}G+=c}}else if(A.type==="Ellipse"){const Q=Math.abs(I)/2,B=Math.abs(C)/2,i=A.sweepAngle??360,D=((A.startAngle??0)+i*g)*Math.PI/180,s=Q*Math.cos(D),w=B*Math.sin(D),a=-Q*Math.sin(D),t=B*Math.cos(D),G=Math.atan2(t,a);return{x:s,y:w,angle:G}}else if((A==null?void 0:A.type)==="Rectangle"){const Q=Math.abs(I),B=Math.abs(C),o=(Q+B)*2*g;let D=0,s=0,w=0;return o<Q?(D=-Q/2+o,s=-B/2,w=0):o<Q+B?(D=Q/2,s=-B/2+(o-Q),w=Math.PI/2):o<2*Q+B?(D=Q/2-(o-(Q+B)),s=B/2,w=Math.PI):(D=-Q/2,s=B/2-(o-(2*Q+B)),w=-Math.PI/2),{x:D,y:s,angle:w}}return{x:0,y:0,angle:0}}getBezierPointAndAngle(A,I,C,g,Q){const B=I.x,i=I.y,o=I.out_x??I.x,D=I.out_y??I.y,s=C.in_x??C.x,w=C.in_y??C.y,a=C.x,t=C.y,G=1-A,S=A*A,K=G*G,y=K*G,e=S*A,N=y*B+3*K*A*o+3*G*S*s+e*a-g,k=y*i+3*K*A*D+3*G*S*w+e*t-Q,c=3*K*(o-B)+6*G*A*(s-o)+3*S*(a-s),F=3*K*(D-i)+6*G*A*(w-D)+3*S*(t-w),R=Math.atan2(F,c);return{x:N,y:k,angle:R}}applyAbsoluteTransform(A,I,C){if(!C.get(I))return;const Q=[];let B=I;for(;B;){Q.unshift(B);const i=C.get(B);B=i==null?void 0:i.parentId}Q.forEach(i=>{this.applyObjectTransform(A,i)})}applyObjectTransform(A,I){const C=this.objectStates.get(I);if(!C)return;A.translate(C.x,C.y),A.rotate(C.rotation*Math.PI/180);const g=(C.scale_x??1)*(C.flip_x===!0?-1:1),Q=(C.scale_y??1)*(C.flip_y===!0?-1:1);A.scale(g,Q)}applyArtEffectOverlay(A,I,C,g,Q,B){var w;const i=I.artEffect||((w=I.style)==null?void 0:w.artEffect);if(!i||!i.enabled)return;const o=i.type,D=i.intensity??.5,s=i.speed??1;if(o==="acid_gradient"||o==="acid_rave"||o==="shimmer"||o==="halftone"||o==="noise"||o==="scanlines"||o==="chromatic_aberration"){if(A.save(),this.applyPath(A,C,g,Q,B),A.clip(),o==="shimmer"){const t=this.currentTime*s%2/2,G=A.createLinearGradient(-g,-Q,g,Q);G.addColorStop(Math.max(0,t-.2),"rgba(255,255,255,0)"),G.addColorStop(t,`rgba(255,255,255,${D*.8})`),G.addColorStop(Math.min(1,t+.2),"rgba(255,255,255,0)"),A.fillStyle=G,A.globalCompositeOperation="screen",A.fillRect(-g/2,-Q/2,g,Q)}else if(o==="acid_gradient"||o==="acid_rave"){const a=this.currentTime*s,t=A.createLinearGradient(-g/2,-Q/2,g/2,Q/2),G=a*100%360,S=(G+180)%360;t.addColorStop(0,`hsla(${G}, 80%, 50%, ${D*.5})`),t.addColorStop(1,`hsla(${S}, 80%, 50%, ${D*.5})`),A.fillStyle=t,A.globalCompositeOperation="screen",A.fillRect(-g/2,-Q/2,g,Q)}else if(o==="halftone"){const a=Math.max(2,20*(1-D)),t=document.createElement("canvas");t.width=a,t.height=a;const G=t.getContext("2d");if(G){G.fillStyle="black",G.beginPath(),G.arc(a/2,a/2,a/2*D,0,Math.PI*2),G.fill();const S=A.createPattern(t,"repeat");S&&(A.globalAlpha=.3*D,A.fillStyle=S,A.fillRect(-g/2,-Q/2,g,Q))}}else if(o==="noise"){A.globalAlpha=.1*D;for(let a=0;a<5;a++)A.fillStyle=`rgba(${Math.random()*255}, ${Math.random()*255}, ${Math.random()*255}, ${D})`,A.fillRect(-g/2+Math.random()*g,-Q/2+Math.random()*Q,2,2)}else if(o==="scanlines"){A.globalAlpha=.2*D,A.strokeStyle="rgba(0,0,0,0.5)",A.lineWidth=1;for(let a=-Q/2;a<Q/2;a+=4)A.beginPath(),A.moveTo(-g/2,a),A.lineTo(g/2,a),A.stroke()}else if(o==="chromatic_aberration"){const a=5*D;A.globalCompositeOperation="screen",A.globalAlpha=.5,A.fillStyle="cyan",A.fillRect(-g/2-a,-Q/2,g,Q),A.fillStyle="magenta",A.fillRect(-g/2+a,-Q/2,g,Q)}A.restore()}}applyPath(A,I,C,g,Q){I!=null&&I.data&&(I.type==="Path"||I.type==="Subtract"||I.type==="Union"||I.type==="Intersect"||I.type==="Exclude"||I.type),A.beginPath(),this._tracePath(A,I,C,g,Q)}_tracePath(A,I,C,g,Q){if(I){if(this.ensurePathPoints(I),(I==null?void 0:I.type)==="Rectangle"||I.type==="Image"){const B=Q!==void 0?Q:I.corner_radius??0;this.drawRoundRect(A,-C/2,-g/2,C,g,B)}else if(I.type==="Line")A.moveTo(-C/2,0),A.lineTo(C/2,0);else if(I.type==="Ellipse"){const{startAngle:B=0,sweepAngle:i=360,ratio:o=0}=I,D=C/2,s=g/2,w=B*Math.PI/180,a=i*Math.PI/180,t=w+a;i>=360&&o<=0?A.ellipse(0,0,D,s,0,0,Math.PI*2):(A.ellipse(0,0,D,s,0,w,t,!1),o>0?A.ellipse(0,0,D*o,s*o,0,t,w,!0):A.lineTo(0,0),A.closePath())}else if(I.type==="Triangle")A.moveTo(0,-g/2),A.lineTo(C/2,g/2),A.lineTo(-C/2,g/2),A.closePath();else if(I.type==="Polygon"){const B=I.sides||3,i=I.radius||Math.min(C,g)/2;for(let o=0;o<B;o++){const D=o*2*Math.PI/B-Math.PI/2,s=i*Math.cos(D),w=i*Math.sin(D);o===0?A.moveTo(s,w):A.lineTo(s,w)}A.closePath()}else if(I.type==="Star"){const B=I.inner_radius||20,i=I.outer_radius||50,o=I.points||5;for(let D=0;D<o*2;D++){const s=D*Math.PI/o-Math.PI/2,w=D%2===0?i:B,a=w*Math.cos(s),t=w*Math.sin(s);D===0?A.moveTo(a,t):A.lineTo(a,t)}A.closePath()}else if(((I==null?void 0:I.type)==="Path"||I.type==="Subtract"||I.type==="Union"||I.type==="Intersect"||I.type==="Exclude"||I.type==="BooleanOperation")&&I.points){this.frameCount%10===0&&console.log("[Engine] Tracing Path:",I.points.length,"points");let B=1/0,i=-1/0,o=1/0,D=-1/0;if(I.points.forEach(a=>{typeof a.x=="number"&&typeof a.y=="number"&&(B=Math.min(B,a.x),i=Math.max(i,a.x),o=Math.min(o,a.y),D=Math.max(D,a.y),a.out_x!==void 0&&(B=Math.min(B,a.out_x),i=Math.max(i,a.out_x)),a.out_y!==void 0&&(o=Math.min(o,a.out_y),D=Math.max(D,a.out_y)),a.in_x!==void 0&&(B=Math.min(B,a.in_x),i=Math.max(i,a.in_x)),a.in_y!==void 0&&(o=Math.min(o,a.in_y),D=Math.max(D,a.in_y)))}),B===1/0)return;const s=(B+i)/2,w=(o+D)/2;if(isNaN(s)||isNaN(w)){console.warn("[Engine] Invalid path center:",s,w);return}I.points.forEach((a,t)=>{if(t===0||a.moveTo)A.moveTo(a.x-s,a.y-w);else{const G=I.points[t-1];if(!G)return;const S=(G.out_x??G.x)-s,K=(G.out_y??G.y)-w,y=(a.in_x??a.x)-s,e=(a.in_y??a.y)-w;isNaN(S)||isNaN(y)||isNaN(a.x)?A.lineTo(a.x-s,a.y-w):A.bezierCurveTo(S,K,y,e,a.x-s,a.y-w)}if(a.closePath||t===I.points.length-1&&(I.is_closed||I.isClosed)){const G=[...I.points.slice(0,t+1)].reverse().find(S=>S.moveTo)||I.points[0];G&&(a.out_x!==void 0||G.in_x!==void 0)&&A.bezierCurveTo((a.out_x??a.x)-s,(a.out_y??a.y)-w,(G.in_x??G.x)-s,(G.in_y??G.y)-w,G.x-s,G.y-w),A.closePath()}})}else if(I.points&&Array.isArray(I.points)){let B=1/0,i=-1/0,o=1/0,D=-1/0;I.points.forEach(a=>{B=Math.min(B,a.x),i=Math.max(i,a.x),o=Math.min(o,a.y),D=Math.max(D,a.y)});const s=(B+i)/2,w=(o+D)/2;I.points.forEach((a,t)=>{if(t===0)A.moveTo(a.x-s,a.y-w);else{const G=I.points[t-1];G.out_x!==void 0||a.in_x!==void 0?A.bezierCurveTo((G.out_x??G.x)-s,(G.out_y??G.y)-w,(a.in_x??a.x)-s,(a.in_y??a.y)-w,a.x-s,a.y-w):A.lineTo(a.x-s,a.y-w)}(a.closePath||t===I.points.length-1&&(I.is_closed||I.isClosed))&&A.closePath()})}}}renderInputBox(A,I){var oA,q;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((oA=I.geometry)==null?void 0:oA.width)||250,B=((q=I.geometry)==null?void 0:q.height)||45,i=this.focusedId===I.id,o=this.lastHoveredObjectId===I.id,D=g.previewState||"default",s=D!=="default"?D:i?"focused":o?"hovered":"default",w=g.label||{visible:!0,text:"Label"},a=g.helperText||{visible:!1,text:"Helper text"},t=g.leftIcon||{visible:!1},G=g.rightIcon||{visible:!1},S=g.multiline===!0,K=g.corner_radius??8,y=g.corners||{tl:K,tr:K,bl:K,br:K},e=[y.tl,y.tr,y.br,y.bl];let N=g.backgroundColor||"rgba(31, 41, 55, 1)",k=g.borderColor||"rgba(55, 65, 81, 1)",c=g.borderWidth??1.5,F=g.color||"#ffffff",R=g.placeholderColor||"rgba(156, 163, 175, 1)",J=g.fontSize||14;const L=`${s}Style`,l=g[L];if(l?(l.backgroundColor!==void 0&&(N=l.backgroundColor),l.borderColor!==void 0&&(k=l.borderColor),l.borderWidth!==void 0&&(c=l.borderWidth),l.color!==void 0&&(F=l.color),l.placeholderColor!==void 0&&(R=l.placeholderColor),l.fontSize!==void 0&&(J=l.fontSize)):s==="focused"?(k=g.focusBorderColor||"rgba(59, 130, 246, 1)",c=Math.max(c,2)):s==="hovered"||s==="hover"?(k=g.hoverBorderColor||k,N=g.hoverBackgroundColor||N):s==="disabled"?(N=g.disabledBackgroundColor||"rgba(31, 41, 55, 0.6)",k=g.disabledBorderColor||"rgba(55, 65, 81, 0.4)"):s==="error"&&(k="rgba(239, 68, 68, 1)",c=Math.max(c,2)),A.beginPath(),this.drawRoundRect(A,-Q/2,-B/2,Q,B,e),A.fillStyle=N,A.fill(),c>0&&(A.strokeStyle=k,A.lineWidth=c,A.stroke(),s==="focused"||s==="focus")){A.save(),A.beginPath();const v=e.map(V=>V+2);this.drawRoundRect(A,-Q/2-2,-B/2-2,Q+4,B+4,v),A.strokeStyle="rgba(59, 130, 246, 0.3)",A.lineWidth=2,A.stroke(),A.restore()}const Y=(v,V)=>{if(!v.visible||!v.svgPath)return;const AA=v.size||14,iA=v.offset??16,cA=v.color||"#ffffff",rA=V?-(Q/2)+iA:Q/2-iA,YA=v.svgPath;if(A.save(),A.translate(rA,0),!YA.startsWith("<svg")){const WA=new Path2D(YA),P=AA/24;A.scale(P,P),A.translate(-12,-12),A.fillStyle=cA,A.fill(WA)}A.restore()};Y(t,!0),Y(G,!1);const x=g.text||"",DA=g.placeholder||"Enter text...",hA=!x,W=x||DA,b=hA?R:F,T=J,u=g.fontFamily||"Inter",d=g.fontWeight||400;A.font=`${d} ${T}px "${u}", sans-serif`,A.fillStyle=b,A.textAlign="left",A.textBaseline=S?"top":"middle";const H=g.inputPadding??16,j=t.visible?(t.offset??16)+(t.size||14)/2+8:H,SA=G.visible?(G.offset??16)+(G.size||14)/2+8:H,O=-(Q/2)+j,m=Q-j-SA,QA=g.inputType==="password"?"•".repeat(W.length):W;if(A.save(),A.beginPath(),A.rect(O-2,-B/2+4,m+4,B-8),A.clip(),S){const v=QA.split(`
|
|
34
|
-
`);let V=-B/2+H;const AA=T*1.2;let iA=0;v.forEach((cA,rA)=>{const YA=cA.split(" ");let WA="";for(let P=0;P<YA.length;P++){const wA=WA+YA[P]+" ";A.measureText(wA).width>m&&P>0?(A.fillText(WA,O,V),WA=YA[P]+" ",V+=AA):WA=wA}A.fillText(WA,O,V),iA=A.measureText(WA).width,rA<v.length-1&&(V+=AA,iA=0)}),i&&!hA&&Math.floor(performance.now()/500)%2===0&&A.fillRect(O+iA,V,1.5,T)}else{const V=A.measureText(QA).width;let AA=0;if(V>m&&(AA=V-m),A.fillText(QA,O-AA,0),i&&!hA&&Math.floor(performance.now()/500)%2===0){const cA=O+V-AA;A.fillRect(cA,-(T/2),1.5,T)}}if(A.restore(),w.visible!==!1){const v=w.text||"Label",V=w.fontSize||12,AA=w.color||"rgba(156, 163, 175, 1)",iA=w.offset??8;A.font=`600 ${V}px "${u}", sans-serif`,A.fillStyle=AA,A.textAlign="left",A.textBaseline="bottom";const cA=-(Q/2),rA=-(B/2)-iA;A.fillText(v,cA,rA)}if(a.visible===!0){const v=a.text||"Helper text",V=a.fontSize||11,AA=s==="error"?"rgba(239, 68, 68, 1)":a.color||"rgba(156, 163, 175, 1)",iA=a.offset??6;A.font=`400 ${V}px "${u}", sans-serif`,A.fillStyle=AA,A.textAlign="left",A.textBaseline="top";const cA=-(Q/2),rA=B/2+iA;A.fillText(v,cA,rA)}}renderSlider(A,I){const C=this.objectStates.get(I.id),g=(C==null?void 0:C.geometry)||I.geometry,Q=(C==null?void 0:C.options)||I.options||{},B=g.width||200,i=Q.value??50,o=Q.min??0,s=(Q.max??100)-o,w=s===0?0:(i-o)/s,a=Q.trackHeight||4,t=Q.trackRoundedness??2,G=Q.trackShape??"Rectangle",S=Q.trackPath||"",K=Q.activeColor||"#3b82f6",y=Q.inactiveColor||"#374151",e=Q.thumbShape||"Ellipse",N=Q.thumbWidth??16,k=Q.thumbHeight??16,c=Q.thumbRoundedness??0,F=Q.thumbColor||"#ffffff",R=Q.thumbPath||"",J=Q.thumbIcon||"",L=Q.showValueTooltip??!1,l=Q.tooltipBgColor||"#333333",Y=Q.tooltipColor||"#ffffff",x=Q.tooltipOffsetX??0,DA=Q.tooltipOffsetY??-25,hA=(O,m,QA,oA,q,v,V)=>{if((O==="Custom"||O==="Icon")&&V)try{const AA=new Path2D(V);if(A.save(),A.translate(m,QA),O==="Icon"){const iA=Math.min(oA,q)/24;A.scale(iA,iA),A.translate(-12,-12)}A.fill(AA),A.restore();return}catch(AA){console.error("Error drawing slider shape in engine:",AA)}if(A.beginPath(),O==="Ellipse")A.ellipse(m,QA,oA/2,q/2,0,0,Math.PI*2);else if(O==="Rectangle")this.drawRoundRect(A,m-oA/2,QA-q/2,oA,q,v);else if(O==="Triangle")A.moveTo(m,QA-q/2),A.lineTo(m+oA/2,QA+q/2),A.lineTo(m-oA/2,QA+q/2),A.closePath();else if(O==="Diamond")A.moveTo(m,QA-q/2),A.lineTo(m+oA/2,QA),A.lineTo(m,QA+q/2),A.lineTo(m-oA/2,QA),A.closePath();else if(O==="Polygon"){const AA=I.geometry.sides||3,iA=I.geometry.radius||Math.min(oA,q)/2;for(let cA=0;cA<AA;cA++){const rA=cA*2*Math.PI/AA-Math.PI/2,YA=m+iA*Math.cos(rA),WA=QA+iA*Math.sin(rA);cA===0?A.moveTo(YA,WA):A.lineTo(YA,WA)}A.closePath()}else if(O==="Star"){const iA=Math.min(oA,q)/2,cA=iA/2;for(let rA=0;rA<5*2;rA++){const YA=rA%2===0?iA:cA,WA=rA*Math.PI/5-Math.PI/2;A.lineTo(m+YA*Math.cos(WA),QA+YA*Math.sin(WA))}A.closePath()}else O==="Line"&&(A.moveTo(m-oA/2,QA),A.lineTo(m+oA/2,QA));A.fill()};A.fillStyle=y,G==="Line"?(A.strokeStyle=y,A.lineWidth=a,A.beginPath(),A.moveTo(-B/2,0),A.lineTo(B/2,0),A.stroke()):hA(G,0,0,B,a,t,S);const W=B-N,b=-B/2+N/2+w*W,T=b- -B/2;T>0&&(A.fillStyle=K,G==="Line"?(A.strokeStyle=K,A.lineWidth=a,A.beginPath(),A.moveTo(-B/2,0),A.lineTo(b,0),A.stroke()):G==="Rectangle"&&(A.beginPath(),this.drawRoundRect(A,-B/2,-a/2,T,a,t),A.fill())),A.save(),A.translate(b,0);const u=A.getTransform(),d=Math.sqrt(u.a*u.a+u.b*u.b)||1;if(A.shadowColor="rgba(0,0,0,0.2)",A.shadowBlur=4*d,A.shadowOffsetY=1*d,A.fillStyle=F,hA(e,0,0,N,k,c,e==="Icon"?J:R),A.restore(),L){A.save(),A.translate(b+x,DA);const O=Math.round(i).toString();A.font="10px Inter, sans-serif";const m=A.measureText(O),QA=6,oA=4,q=m.width+QA*2,v=14+oA;A.beginPath(),this.drawRoundRect(A,-q/2,-v/2,q,v,4),A.fillStyle=l,A.fill(),A.fillStyle=Y,A.textAlign="center",A.textBaseline="middle",A.fillText(O,0,0),A.restore()}const H=Q.label||{},j=Q.helperText||{},SA=Q.fontFamily||"Inter";if(H.visible!==!1){const O=H.text||"Label",m=H.fontSize||12,QA=H.color||"rgba(156, 163, 175, 1)",oA=H.offset??8;A.font=`600 ${m}px "${SA}", sans-serif`,A.fillStyle=QA,A.textAlign="left",A.textBaseline="bottom";const q=-(B/2),v=-(a/2)-oA;A.fillText(O,q,v)}if(j.visible===!0){const O=j.text||"Helper text",m=j.fontSize||11,QA=j.color||"rgba(156, 163, 175, 1)",oA=j.offset??6;A.font=`400 ${m}px "${SA}", sans-serif`,A.fillStyle=QA,A.textAlign="left",A.textBaseline="top";const q=-(B/2),v=a/2+oA;A.fillText(O,q,v)}}renderDropdown(A,I){var DA;const C=this.objectStates.get(I.id);if(!C)return;const g=C.options||I.options||{},Q=I.geometry.width||160,B=I.geometry.height||40,i=-Q/2,o=-B/2,D=g.corner_radius??6,s=g.disabled||g.previewState==="disabled",w=this.lastHoveredObjectId===I.id||g.previewState==="hover",a=(g.isOpen||g.previewState==="active")&&!s;let t=g.backgroundColor,G=g.borderColor,S=g.color||"#333333";s?(t=g.disabledBackgroundColor||"#f3f4f6",G=g.disabledBorderColor||"#e5e7eb",S=g.disabledColor||"#9ca3af"):a?(t=g.activeBackgroundColor||t,G=g.activeBorderColor||G,S=g.activeColor||S):w&&(t=g.hoverBackgroundColor||t,G=g.hoverBorderColor||G,S=g.hoverColor||S),t||(t="#ffffff"),G||(G="#e5e7eb");const K=A.globalAlpha;A.globalAlpha=K*(g.opacity??1),this.drawRoundRect(A,i,o,Q,B,D),A.fillStyle=this.createCanvasFill(A,typeof t=="string"?{type:"Solid",color:t}:t,Q,B)||"#ffffff",A.fill();const y=g.borderWidth??1;y>0&&(A.strokeStyle=this.createCanvasFill(A,typeof G=="string"?{type:"Solid",color:G}:G,Q,B)||"#e5e7eb",A.lineWidth=y,A.stroke());const e=12,N=g.chevronType||"chevron",k=g.chevronSize||16,c=(a?g.openIconColor:g.closedIconColor)||g.chevronColor||"#6b7280";if(N!=="none"){const hA=i+Q-e-k/2;A.save(),A.translate(hA,0);const W=a?g.openIconAngle??180:g.closedIconAngle??0;if(A.rotate(W*Math.PI/180),A.strokeStyle=c,A.fillStyle=c,A.lineWidth=1.5,A.lineCap="round",A.lineJoin="round",N==="chevron")A.beginPath(),A.moveTo(-k/2,-k*.2),A.lineTo(0,k*.2),A.lineTo(k/2,-k*.2),A.stroke();else if(N==="custom"||N==="path"){const b=a&&g.openIconPath||g.closedIconPath;if(b){const T=new Path2D(b);A.save();const u=k/24;A.scale(u,u),A.translate(-12,-12),A.fill(T),A.restore()}}A.restore()}const F=g.selectedOption||g.placeholder||"Select...",R=g.fontSize||14,J=g.fontWeight||400,L=g.fontFamily||"Inter, sans-serif";A.font=`${J} ${R}px ${L}`;const l=s?g.disabledColor||"#9ca3af":!g.selectedOption&&g.placeholder?"#9ca3af":S;A.fillStyle=this.createCanvasFill(A,typeof l=="string"?{type:"Solid",color:l}:l,Q,B)||"#333333",A.textAlign="left",A.textBaseline="middle";const Y=N==="none"?0:k+8,x=Q-e*2-Y;if(A.save(),A.beginPath(),A.rect(i+e,o,x,B),A.clip(),A.fillText(F,i+e,0),A.restore(),a&&!s){const hA=o+B+4,W=g.optionsList||[],b=g.itemHeight||32,T=g.listPadding??4,u=W.length*b+T*2,d=g.listCornerRadius??D;A.save();const H=g.listShadow||{},j=A.getTransform(),SA=Math.sqrt(j.a*j.a+j.b*j.b)||1;A.shadowColor=typeof H.color=="string"?H.color:((DA=H.color)==null?void 0:DA.color)||"rgba(0,0,0,0.15)",A.shadowBlur=(H.blur??12)*SA,A.shadowOffsetY=(H.offsetY??6)*SA,A.shadowOffsetX=(H.offsetX??0)*SA,A.beginPath(),this.drawRoundRect(A,i,hA,Q,u,d),A.fillStyle=this.createCanvasFill(A,typeof g.listBackgroundColor=="string"?{type:"Solid",color:g.listBackgroundColor}:g.listBackgroundColor||{type:"Solid",color:"#ffffff"},Q,u)||"#ffffff",A.fill();const O=g.listBorderWidth??1;O>0&&(A.shadowColor="transparent",A.strokeStyle=this.createCanvasFill(A,typeof g.listBorderColor=="string"?{type:"Solid",color:g.listBorderColor}:g.listBorderColor||{type:"Solid",color:G},Q,u)||"#e5e7eb",A.lineWidth=O,A.stroke()),A.restore();const m=g.itemFontSize||R,QA=g.itemFontFamily||L;A.font=`${J} ${m}px ${QA}`,W.forEach((oA,q)=>{const v=hA+T+q*b;if(oA===g.selectedOption)A.fillStyle=this.createCanvasFill(A,typeof g.itemSelectedBackgroundColor=="string"?{type:"Solid",color:g.itemSelectedBackgroundColor}:g.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},Q,b)||"#f3f4f6",A.fillRect(i+O,v,Q-O*2,b),A.fillStyle=g.itemSelectedColor||g.activeColor||S||"#374151";else if(A.fillStyle=g.listTextColor||S||"#333333",this.activeDropdownId===I.id&&this._lastPointerPos){const AA=this._lastPointerPos.y-(hA+T),iA=Math.floor(AA/b);q===iA&&(A.fillStyle=this.createCanvasFill(A,typeof g.itemHoverBackgroundColor=="string"?{type:"Solid",color:g.itemHoverBackgroundColor}:g.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},Q,b)||"#f9fafb",A.fillRect(i+O,v,Q-O*2,b),A.fillStyle=g.itemHoverColor||S)}A.fillText(oA,i+e,v+b/2)})}A.globalAlpha=K}renderButton(A,I){var N,k,c,F;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((N=I.geometry)==null?void 0:N.width)||120,B=((k=I.geometry)==null?void 0:k.height)||40,i=-Q/2,o=-B/2,D=this.lastHoveredObjectId===I.id,s=g.corner_radius??8,w=g.bgShape||"Rectangle",a=D?((c=g.hoverStyle)==null?void 0:c.backgroundColor)||g.buttonBgColor||"#3b82f6":g.buttonBgColor||"#3b82f6",t=g.label||{},G=D?((F=g.hoverStyle)==null?void 0:F.textColor)||t.color||"#ffffff":t.color||"#ffffff",S=g.icon||{enabled:!1};A.save(),A.beginPath(),w==="Rectangle"?this.drawRoundRect(A,i,o,Q,B,s):w==="Ellipse"||w==="Circle"?A.ellipse(0,0,Q/2,B/2,0,0,Math.PI*2):w==="Pill"&&this.drawRoundRect(A,i,o,Q,B,B/2),A.fillStyle=a,A.fill();const K=t.fontSize||14,y=t.fontFamily||"Inter";A.font=`${t.fontWeight||400} ${K}px "${y}", sans-serif`,A.fillStyle=G,A.textAlign="center",A.textBaseline="middle";let e=0;if(S.enabled&&S.svgPath){const R=S.size||16,J=S.gap||8,L=S.position==="left"?-(A.measureText(t.text||"").width/2+R/2+J/2):A.measureText(t.text||"").width/2+R/2+J/2;A.save(),A.translate(L,0);const l=new Path2D(S.svgPath),Y=R/24;A.scale(Y,Y),A.translate(-12,-12),A.fillStyle=S.color||G,A.fill(l),A.restore(),e=S.position==="left"?R/2+J/2:-(R/2+J/2)}A.fillText(t.text||"Button",e,0),A.restore()}renderToggleButton(A,I){var K,y;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=g.checked??!1,B=((K=I.geometry)==null?void 0:K.width)||120,i=((y=I.geometry)==null?void 0:y.height)||40,o=-B/2,D=-i/2,s=g.corner_radius??8,w=g.label||{},a=Q?g.activeColor||"#3b82f6":g.inactiveColor||"#374151",t=Q?g.activeTextColor||"#ffffff":g.inactiveTextColor||"#9ca3af";A.save(),A.beginPath(),this.drawRoundRect(A,o,D,B,i,s),A.fillStyle=a,A.fill();const G=w.fontSize||14,S=w.fontFamily||"Inter";A.font=`${w.fontWeight||600} ${G}px "${S}", sans-serif`,A.fillStyle=t,A.textAlign="center",A.textBaseline="middle",A.fillText(w.text||"Toggle",0,0),A.restore()}renderToggle(A,I){var e,N;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((e=I.geometry)==null?void 0:e.width)||52,B=((N=I.geometry)==null?void 0:N.height)||30,i=-Q/2,o=-B/2,D=g.checked??!1,s=g.corner_radius??B/2;A.beginPath(),this.drawRoundRect(A,i,o,Q,B,s),A.fillStyle=D?g.activeColor||"#10b981":g.inactiveColor||"#374151",g.disabled&&(A.globalAlpha*=.5),A.fill();const w=3,a=B-w*2,t=a/2,G=i+w,S=i+Q-w-a,K=D?S:G,y=o+w;if(A.beginPath(),A.arc(K+t,y+t,t,0,Math.PI*2),A.fillStyle=g.knobColor||"#ffffff",A.fill(),g.disabled&&(A.globalAlpha*=2),g.label&&g.label.text){const k=g.label,c=k.fontSize||14,F=k.fontWeight||400,R=k.fontFamily||"Inter";A.font=`${F} ${c}px "${R}", sans-serif`,A.fillStyle=k.color||"#f3f4f6",A.textBaseline="middle";const J=k.gap||10;let L=0,l=0;k.position==="left"?(A.textAlign="right",L=i-J,l=0):k.position==="right"?(A.textAlign="left",L=i+Q+J,l=0):k.position==="top"?(A.textAlign="center",L=0,l=o-J,A.textBaseline="bottom"):k.position==="bottom"?(A.textAlign="center",L=0,l=o+B+J,A.textBaseline="top"):(A.textAlign="left",L=i+Q+J,l=0),A.fillText(k.text,L,l)}}renderLineGraph(A,I,C,g){let Q=I.datasets||[];if((!Q||Q.length===0)&&(I.data||I.graphData)&&(Q=[{id:"line-1",label:"Series 1",data:I.data||I.graphData||[],lineColor:I.lineColor||"#3b82f6",lineWidth:I.lineWidth||2,showArea:I.showArea||!1,areaColor:I.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:I.smoothing||!1,showPoints:I.showPoints!==void 0?I.showPoints:!0,pointSize:I.pointSize||6,pointFill:I.pointFill||"#ffffff",pointStrokeColor:I.pointStrokeColor||I.lineColor||"#3b82f6",pointStrokeWidth:I.pointStrokeWidth||2}]),!Q||Q.length===0||!Q.some(S=>S.data&&S.data.length>=2)){A.save(),A.fillStyle="#6366f1",A.font="12px Inter, system-ui, sans-serif",A.textAlign="center",A.textBaseline="middle",A.fillText("NO DATA",0,0),A.restore();return}let B=1/0,i=-1/0,o=0;if(Q.forEach(S=>{let K=S.data;if(S.isVarEnabled&&S.inputId){let y=this.inputs.get(S.inputId);if(y===void 0){const e=this.inputNameMap.get(S.inputId);e&&e.length>0&&(y=this.inputs.get(e[0]))}y&&Array.isArray(y)&&(K=y)}if(K&&K.length>0){const y=K.filter(e=>typeof e=="number"&&!isNaN(e));y.length>0&&(B=Math.min(B,...y),i=Math.max(i,...y),o=Math.max(o,K.length))}S._resolvedData=K}),o<2)return;const D=i-B,s=C/(o-1),w=S=>{const K=D===0?.5:(S-B)/D;return g/2-K*g},a=S=>S*s-C/2,t=I.axisColor||"#333333";if(I.showXAxis&&(A.beginPath(),A.strokeStyle=I.xAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,g/2),A.lineTo(C/2,g/2),A.stroke()),I.showYAxis&&(A.beginPath(),A.strokeStyle=I.yAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,-g/2),A.lineTo(-C/2,g/2),A.stroke()),A.fillStyle=I.axisLabelColor||"#333333",A.font=`${I.axisLabelFontSize||10}px Inter, sans-serif`,I.showXLabels){A.textAlign="center",A.textBaseline="top";for(let S=0;S<o;S++){const K=a(S);A.fillText(`${S+1}`,K,g/2+5)}}if(I.showYLabels){A.textAlign="right",A.textBaseline="middle";const S=-C/2-5,K=(i+B)/2;A.fillText(i.toFixed(1),S,w(i)),A.fillText(K.toFixed(1),S,w(K)),A.fillText(B.toFixed(1),S,w(B))}const G=10;if(Q.forEach(S=>{const K=S._resolvedData;if(!(!K||K.length<2)){if(S.showArea){if(A.beginPath(),A.moveTo(a(0),g/2),A.lineTo(a(0),w(K[0])),S.smoothing&&K.length>2)for(let e=0;e<K.length-1;e++){const N=K[e===0?e:e-1],k=K[e],c=K[e+1],F=K[e+1===K.length-1?e+1:e+2];for(let R=1;R<=G;R++){const J=R/G,L=this._catmullRom(N,k,c,F,J);A.lineTo(a(e+J),w(L))}}else for(let e=1;e<K.length;e++)A.lineTo(a(e),w(K[e]));A.lineTo(a(K.length-1),g/2),A.closePath();const y=A.globalAlpha;A.globalAlpha=y*(I.areaOpacity??.3),A.fillStyle=S.areaColor||"rgba(139, 92, 246, 0.2)",A.fill(),A.globalAlpha=y}if(A.beginPath(),A.strokeStyle=S.lineColor||"#3b82f6",A.lineWidth=S.lineWidth||2,A.lineJoin="round",A.lineCap="round",A.moveTo(a(0),w(K[0])),S.smoothing&&K.length>2)for(let y=0;y<K.length-1;y++){const e=K[y===0?y:y-1],N=K[y],k=K[y+1],c=K[y+1===K.length-1?y+1:y+2];for(let F=1;F<=G;F++){const R=F/G,J=this._catmullRom(e,N,k,c,R);A.lineTo(a(y+R),w(J))}}else for(let y=1;y<K.length;y++)A.lineTo(a(y),w(K[y]));A.stroke(),S.showPoints&&K.forEach((y,e)=>{const N=a(e),k=w(y);A.beginPath(),A.arc(N,k,(S.pointSize||6)/2,0,Math.PI*2),A.fillStyle=S.pointFill||"#ffffff",A.fill(),A.strokeStyle=S.pointStrokeColor||S.lineColor||"#3b82f6",A.lineWidth=S.pointStrokeWidth||1,A.stroke()})}}),I.showLegend&&Q.length>0){const S=C/2-10;let K=-g/2+15;const y=I.legendFontSize||10,e=y+5;A.font=`${y}px Inter, sans-serif`,A.textAlign="right",A.textBaseline="alphabetic",Q.forEach(N=>{const c=N.label||"Series",F=A.measureText(c).width;A.beginPath(),A.rect(S-F-8-5,K-(8/2+2),8,8),A.fillStyle=N.lineColor||"#3b82f6",A.fill(),A.fillStyle=I.legendColor||"#333333",A.fillText(c,S,K),K+=e})}}_catmullRom(A,I,C,g,Q){const B=(C-A)*.5,i=(g-I)*.5,o=Q*Q,D=Q*o;return(2*I-2*C+B+i)*D+(-3*I+3*C-2*B-i)*o+B*Q+I}normalizeOpacity(A){const I=typeof A=="number"?A:parseFloat(String(A));return isNaN(I)?1:I>1?Math.min(1,I/100):Math.max(0,Math.min(1,I))}createCanvasFill(A,I,C,g){var Q,B,i;if(!I||I.type==="None")return null;if(typeof I=="string")return I;if(I.type==="Solid"&&I.color){const o=I.color,s=(((B=(Q=this.artboard)==null?void 0:Q.tokens)==null?void 0:B.colors)||{})[o]||o;return A.fillStyle=s,s}if((I.type==="LinearGradient"||I.type==="RadialGradient"||I.type==="AngularGradient"||I.type==="DiamondGradient")&&I.stops){const o=(D,s=100)=>{var k,c;const a=(((c=(k=this.artboard)==null?void 0:k.tokens)==null?void 0:c.colors)||{})[D]||D,t=this.normalizeOpacity(I.opacity??100),S=this.normalizeOpacity(s)*t;if(S>=1&&a.startsWith("#"))return a;const K=a.startsWith("#")?a.replace("#",""):"ffffff",y=parseInt(K.substring(0,2),16),e=parseInt(K.substring(2,4),16),N=parseInt(K.substring(4,6),16);return`rgba(${y}, ${e}, ${N}, ${S})`};if(I.type==="LinearGradient"){const D=(S,K,y)=>Array.isArray(S)?S[K]??(K===0?0:1):S&&typeof S=="object"?S[y]??(K===0?0:1):K===0?0:1,s=D(I.start,0,"x")*C-C/2,w=D(I.start,1,"y")*g-g/2,a=D(I.end,0,"x")*C-C/2,t=D(I.end,1,"y")*g-g/2,G=A.createLinearGradient(s,w,a,t);if(I.stops.forEach(S=>{const K=S.offset!==void 0?S.offset:S.pos!==void 0?S.pos:S.position!==void 0?S.position:0,y=o(S.color||"#000000",S.opacity??100);G.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&G.setTransform){const[S,K,y,e,N,k]=I.gradientTransform;G.setTransform({a:S,b:K,c:y,d:e,e:N,f:k})}return G}else if(I.type==="RadialGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center,0,"x")*C-C/2,w=D(I.center,1,"y")*g-g/2,a=(I.radius??.5)*Math.max(C,g),t=A.createRadialGradient(s,w,0,s,w,a);if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return t}else if(I.type==="AngularGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center||[.5,.5],0,"x")*C-C/2,w=D(I.center||[.5,.5],1,"y")*g-g/2,a=(I.degree||I.angle||0)*(Math.PI/180),t=(i=A.createConicGradient)==null?void 0:i.call(A,a,s,w);if(t){if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return t}}else if(I.type==="DiamondGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center||[.5,.5],0,"x")*C-C/2,w=D(I.center||[.5,.5],1,"y")*g-g/2,a=(I.radius??.5)*Math.max(C,g);A.save(),A.translate(s,w),A.rotate(Math.PI/4);const t=A.createRadialGradient(0,0,0,0,0,a);if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return A.scale(1/Math.SQRT2,1/Math.SQRT2),A.fillStyle=t,A.restore(),t}}if(I.type==="Pattern"&&I.url){let o=this.imageCache.get(I.url);if(o||(o=new Image,o.src=I.url,this.imageCache.set(I.url,o)),o.complete&&o.naturalWidth>0){const D=A.createPattern(o,"repeat");if(D&&(I.scaleX!==void 0||I.offsetX!==void 0)){const s=new DOMMatrix,w=I.scaleX??1,a=I.scaleY??1,t=I.offsetX??0,G=I.offsetY??0,S=I.rotation??0;s.translateSelf(t,G),s.rotateSelf(S),s.scaleSelf(w,a),D.setTransform(s)}return D}}return I.color||null}drawRoundRect(A,I,C,g,Q,B){if(B===0||B===void 0||B===null){A.rect(I,C,g,Q);return}let i=B;if(typeof i=="string")try{i=JSON.parse(i)}catch{i=parseFloat(i)||0}let o=0,D=0,s=0,w=0;typeof i=="number"?o=D=s=w=i:Array.isArray(i)?i.length===1?o=D=s=w=i[0]:i.length===2?(o=s=i[0],D=w=i[1]):i.length===3?(o=i[0],D=w=i[1],s=i[2]):i.length>=4&&(o=i[0],D=i[1],s=i[2],w=i[3]):i&&typeof i=="object"&&(o=i.tl??i.corner_radius??i.cornerRadius??0,D=i.tr??i.corner_radius??i.cornerRadius??0,s=i.br??i.corner_radius??i.cornerRadius??0,w=i.bl??i.corner_radius??i.cornerRadius??0);const a=Math.min(Math.abs(g)/2,Math.abs(Q)/2);if(o=Math.min(Math.max(0,o),a),D=Math.min(Math.max(0,D),a),s=Math.min(Math.max(0,s),a),w=Math.min(Math.max(0,w),a),A.roundRect){A.roundRect(I,C,g,Q,[o,D,s,w]);return}A.moveTo(I+o,C),A.lineTo(I+g-D,C),A.arcTo(I+g,C,I+g,C+D,D),A.lineTo(I+g,C+Q-s),A.arcTo(I+g,C+Q,I+g-s,C+Q,s),A.lineTo(I+w,C+Q),A.arcTo(I,C+Q,I,C+Q-w,w),A.lineTo(I,C+o),A.arcTo(I,C,I+o,C,o),A.closePath()}renderListView(A,I){var hA,W,b,T;const C=this.objectStates.get(I.id)||{},g=C.options||I.options||{},Q=C.width!==void 0?C.width:((hA=I.geometry)==null?void 0:hA.width)||200,B=C.height!==void 0?C.height:((W=I.geometry)==null?void 0:W.height)||300,i=-Q/2,o=-B/2,D=C.corner_radius!==void 0?C.corner_radius:g.corner_radius??0,s=g.orientation||"vertical",w=g.items||[],a=g.itemGap??10,t=g.itemHeight??50,G=g.itemWidth??200,S=g.scrollOffset??0,K=g.padding??0,y=g.glassEffect!==!1,e=g.accentColor||"#3b82f6",N=g.itemTextColor||"#333333",k=g.itemBackgroundColor||"#ffffff",c=g.hoveredIndex??null,F=g.activeItemIndex??null,R=g.glowIntensity??0,J=g.glowColor||"#3b82f6",L=typeof J=="string"?J:J.color||((T=(b=J.stops)==null?void 0:b[0])==null?void 0:T.color)||"#3b82f6",l=g.opacity!==void 0?g.opacity:I.opacity!==void 0?I.opacity:1;if(A.save(),A.globalAlpha*=l,R>0){const u=A.getTransform(),d=Math.sqrt(u.a*u.a+u.b*u.b)||1;A.shadowColor=L,A.shadowBlur=R*2*d,A.shadowOffsetX=0,A.shadowOffsetY=0}if(y){const u=g.listBackgroundColor||"rgba(31, 41, 55, 0.4)",d=this.createCanvasFill(A,u,Q,B);A.fillStyle=d||"rgba(31, 41, 55, 0.4)",this.drawListViewRect(A,i,o,Q,B,D),A.fill();const H=A.createLinearGradient(i,o,i+Q,o+B);H.addColorStop(0,"rgba(255, 255, 255, 0.15)"),H.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),H.addColorStop(1,"rgba(255, 255, 255, 0.03)"),A.fillStyle=H,this.drawListViewRect(A,i,o,Q,B,D),A.fill(),A.strokeStyle="rgba(255, 255, 255, 0.25)",A.lineWidth=1,this.drawListViewRect(A,i,o,Q,B,D),A.stroke()}else{const u=g.listBackgroundColor||"transparent",d=this.createCanvasFill(A,u,Q,B);d&&(A.fillStyle=d,this.drawListViewRect(A,i,o,Q,B,D),A.fill());const H=g.borderWidth??0;H>0&&(A.strokeStyle=g.borderColor||"#cccccc",A.lineWidth=H,this.drawListViewRect(A,i,o,Q,B,D),A.stroke())}A.shadowBlur=0,A.save(),this.drawListViewRect(A,i,o,Q,B,D),A.clip();const Y=typeof K=="number"?K:s==="vertical"?K[0]:K[3];let x=(s==="vertical"?o:i)+S+Y;if(A.textBaseline="middle",w.forEach((u,d)=>{const H=s==="vertical"?Q:G,j=s==="vertical"?t:B,SA=s==="vertical"?i:x,O=s==="vertical"?x:o,m=c===d,QA=F===d;if(QA){const AA=this.createCanvasFill(A,e,H,j);A.fillStyle=AA||e;const iA=A.globalAlpha;A.globalAlpha=iA*.8,A.fillRect(SA,O,H,j),A.globalAlpha=iA}else if(m)A.fillStyle=y?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",A.fillRect(SA,O,H,j);else if(k!=="transparent"){const AA=this.createCanvasFill(A,k,H,j);A.fillStyle=AA||k,A.fillRect(SA,O,H,j)}if(QA||m){const AA=this.createCanvasFill(A,e,s==="vertical"?3:H,s==="vertical"?j:3);A.fillStyle=AA||e,s==="vertical"?A.fillRect(SA,O,3,j):A.fillRect(SA,O+j-3,H,3)}const oA=QA?"#ffffff":y?"rgba(255, 255, 255, 0.9)":N;A.fillStyle=oA,A.font=QA||m?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const q=typeof u=="string"?u:(u==null?void 0:u.label)||`Item ${d+1}`,v=SA+(s==="vertical"?16:H/2),V=O+j/2;s==="horizontal"?A.textAlign="center":A.textAlign="left",A.fillText(q,v,V),x+=(s==="vertical"?t:G)+a}),A.restore(),g.showScrollbar!==!1){const u=(w.length||0)*(s==="vertical"?t:G)+((w.length||0)-1)*a,d=s==="vertical"?B:Q;if(u>d){const H=d/u,j=d*H,SA=-S/u*d,O=g.scrollbarColor||"rgba(255,255,255,0.3)",m=g.scrollbarWidth||4;A.fillStyle=O,s==="vertical"?A.fillRect(i+Q-m-2,o+SA,m,j):A.fillRect(i+SA,o+B-m-2,j,m)}}A.restore()}updateListViewScrollFromPointer(A){var K,y;if(!this._lastPointerPos||!this._prevPointerPos)return;const I=A.options||{},C=I.orientation||"vertical",g=this._lastPointerPos.x-this._prevPointerPos.x,Q=this._lastPointerPos.y-this._prevPointerPos.y;C==="vertical"?I.scrollOffset=(I.scrollOffset||0)+Q:I.scrollOffset=(I.scrollOffset||0)+g;const B=this.objectStates.get(A.id)||{},i=I.items||[],o=I.itemGap??10,D=I.itemHeight??50,s=I.itemWidth??200,w=B.width!==void 0?B.width:((K=A.geometry)==null?void 0:K.width)||200,a=B.height!==void 0?B.height:((y=A.geometry)==null?void 0:y.height)||300,t=(i.length||0)*(C==="vertical"?D:s)+((i.length||0)-1)*o,S=Math.max(0,t-(C==="vertical"?a:w)+(I.padding*2||0));I.scrollOffset>0&&(I.scrollOffset=0),I.scrollOffset<-S&&(I.scrollOffset=-S)}updateListViewHoverFromPointer(A,I,C){const g=this.getListViewItemIndexAtPointer(A,I,C),Q=A.options||{};Q.hoveredIndex!==g&&(Q.hoveredIndex=g)}getListViewItemIndexAtPointer(A,I,C){var Y,x;const g=A.options||{},Q=this.objectStates.get(A.id)||{},B=g.items||[];if(B.length===0)return null;const i=Q.width!==void 0?Q.width:((Y=A.geometry)==null?void 0:Y.width)||200,o=Q.height!==void 0?Q.height:((x=A.geometry)==null?void 0:x.height)||300,D=g.orientation||"vertical",s=g.itemGap??10,w=g.itemHeight??50,a=g.itemWidth??200,t=g.scrollOffset??0,G=g.padding??0,S=this.getWorldTransform(A.id),K=I-S.x,y=C-S.y,e=-S.rotation*(Math.PI/180),N=Math.cos(e),k=Math.sin(e),c=K*N-y*k,F=K*k+y*N,R=-i/2,J=-o/2,L=typeof G=="number"?G:D==="vertical"?G[0]:G[3];let l=(D==="vertical"?J:R)+t+L;for(let DA=0;DA<B.length;DA++){const hA=D==="vertical"?i:a,W=D==="vertical"?w:o,b=D==="vertical"?R:l,T=D==="vertical"?l:J;if(c>=b&&c<=b+hA&&F>=T&&F<=T+W)return DA;l+=(D==="vertical"?w:a)+s}return null}drawListViewRect(A,I,C,g,Q,B){A.beginPath(),this.drawRoundRect(A,I,C,g,Q,B),A.fill()}solveBehaviors(A){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:I,y:C}=this._lastPointerPos;this.artboard.objects.forEach(g=>{if(!g.behaviors||g.behaviors.length===0)return;const Q=this.objectStates.get(g.id);Q&&g.behaviors.forEach(B=>{var a,t,G,S,K,y,e,N,k,c,F,R,J,L,l,Y,x,DA,hA,W,b,T,u,d,H,j,SA,O,m,QA,oA,q,v,V,AA,iA,cA,rA,YA,WA,P,wA,Z,p,_,EA,fA,lA,nA,FA,yA,n,bA,_A,VA,xA,sA,kA,uA,UA,tA,HA,gA,$,BA,eA,f,GA,NA,wI,yI,kI,rI,tI,sI,GI,NI;if(!B.enabled)return;const i=B.startTime||0,o=B.endTime||1/0;if(this.currentTime<i||this.currentTime>o)return;const D=Q.x-I,s=Q.y-C,w=Math.sqrt(D*D+s*s);if(this.frameCount%240===0&&Math.random()<.1&&console.log(`[ExodeUI] Executing ${B.type} on ${g.name}`),B.type===X.Proximity){const z=((a=B.settings)==null?void 0:a.radius)||300,IA=((t=B.settings)==null?void 0:t.falloff)||"smooth";let CA=0;w<z&&(IA==="linear"?CA=1-w/z:CA=Math.pow(1-w/z,2)),CA>0&&B.sensors.forEach(dA=>{this.applyBehaviorSensor(Q,dA,CA,A,B.settings,g)})}else if(B.type===X.Magnetic){const z=((G=B.settings)==null?void 0:G.radius)||400,IA=((S=B.settings)==null?void 0:S.strength)||.5;if(w<z&&w>5){const CA=1-w/z,dA=D*CA*IA,aI=s*CA*IA;Q.x-=dA*A*10,Q.y-=aI*A*10}}else if(B.type===X.Repel){const z=((K=B.settings)==null?void 0:K.radius)||300,IA=((y=B.settings)==null?void 0:y.strength)||1;if(w<z){const CA=Math.pow(1-w/z,2);Q.x+=D/(w||1)*CA*60*IA*A*5,Q.y+=s/(w||1)*CA*60*IA*A*5}}else if(B.type===X.Orbit){const z=((e=B.settings)==null?void 0:e.speed)||1,IA=((N=B.settings)==null?void 0:N.radius)||30,CA=this.currentTime*z*Math.PI*2;Q.x+=Math.cos(CA)*IA*A*5,Q.y+=Math.sin(CA)*IA*A*5,Q.rotation+=2*A*5}else if(B.type===X.Vortex){const z=((k=B.settings)==null?void 0:k.radius)||400,IA=((c=B.settings)==null?void 0:c.speed)||2,CA=((F=B.settings)==null?void 0:F.strength)||1;if(w<z){const dA=Math.pow(1-w/z,1.5),aI=this.currentTime*IA*Math.PI*2,rC=Math.cos(aI)*30-D*.4,nC=Math.sin(aI)*30-s*.4;Q.x+=rC*dA*CA*A*5,Q.y+=nC*dA*CA*A*5,Q.rotation+=5*dA*CA*A*5,Q.scale_x*=1-dA*.1*CA*A,Q.scale_y*=1-dA*.1*CA*A}}else if(B.type===X.Fluid){const z=((R=B.settings)==null?void 0:R.radius)||300,IA=((J=B.settings)==null?void 0:J.strength)||1;if(w<z){const CA=Math.pow(1-w/z,1.2),dA=D/(w||1)*CA*1.2*IA,aI=s/(w||1)*CA*1.2*IA;Q.x+=dA*10*A*5,Q.y+=aI*10*A*5,Q.scale_x*=1+CA*.3*IA*A,Q.scale_y*=1+CA*.3*IA*A}}else if(B.type===X.Elastic){const z=((L=B.settings)==null?void 0:L.radius)||300,IA=((l=B.settings)==null?void 0:l.strength)||1;if(w<z){const CA=1-w/z;Q.scale_x*=1+CA*.4*IA*A,Q.scale_y*=1+CA*.4*IA*A}}else if(B.type===X.Holographic){const z=Q.x-this.canvasWidth/2,IA=Q.y-this.canvasHeight/2,CA=((Y=B.settings)==null?void 0:Y.factor)||25;if(Q.x-=z/1e3*CA*A*5,Q.y-=IA/1e3*CA*A*5,Q.style){const dA=1-Math.min(1,w/400);Q.style.exposure=(Q.style.exposure||1)+dA*.5*A}}else if(B.type===X.Sticky){const z=((x=B.settings)==null?void 0:x.radius)||80,IA=((DA=B.settings)==null?void 0:DA.strength)||1;if(w<z){const CA=Math.pow(1-w/z,2);Q.x-=D*CA*IA*A*10,Q.y-=s*CA*IA*A*10,Q.scale_x*=1-CA*.1*IA*A,Q.scale_y*=1-CA*.1*IA*A}}else if(B.type===X.Dilation){const z=((hA=B.settings)==null?void 0:hA.size)||120,IA=((W=B.settings)==null?void 0:W.strength)||1;if(w<z){const CA=1-w/z;Q.scale_x*=1+CA*.5*IA*A,Q.scale_y*=1+CA*.5*IA*A}}else if(B.type===X.Parallax){const z=((b=B.settings)==null?void 0:b.factor)||.05,IA=this.canvasHeight/2,CA=(this._lastPointerPos.y-IA)*z;Q.y+=CA*A*10}else if(B.type===X.Squash){const z=((T=B.settings)==null?void 0:T.strength)||.8;w<(g.width||100)&&this.isMouseDown?(Q.scale_y=this.lerp(Q.scale_y??1,(((u=g.transform)==null?void 0:u.scale_y)??1)*z,.3),Q.scale_x=this.lerp(Q.scale_x??1,(((d=g.transform)==null?void 0:d.scale_x)??1)*(1+(1-z)*.4),.3)):(Q.scale_y=this.lerp(Q.scale_y??1,((H=g.transform)==null?void 0:H.scale_y)??1,.2),Q.scale_x=this.lerp(Q.scale_x??1,((j=g.transform)==null?void 0:j.scale_x)??1,.2))}else if(B.type===X.TextCounter){const z=((SA=B.settings)==null?void 0:SA.duration)||2,IA=((O=B.settings)==null?void 0:O.from)||0,CA=((m=B.settings)==null?void 0:m.to)||100;B._runtimeStart===void 0&&(B._runtimeStart=this.currentTime);const dA=this.currentTime-B._runtimeStart,aI=Math.min(1,dA/z),rC=Math.floor(IA+(CA-IA)*aI);if(((QA=g.geometry)==null?void 0:QA.type)==="Text"){const nC=((oA=B.settings)==null?void 0:oA.prefix)||"",ki=((q=B.settings)==null?void 0:q.suffix)||"";Q.geometry||(Q.geometry={...g.geometry}),Q.geometry.text=`${nC}${rC}${ki}`}}else if(B.type===X.Spotlight){const z=((v=B.settings)==null?void 0:v.radius)||250,IA=((V=B.settings)==null?void 0:V.strength)||1.5;if(w<z){const CA=Math.pow(1-w/z,2);Q.style||(Q.style={...g.style}),Q.style.adjustments||(Q.style.adjustments={...(AA=g.style)==null?void 0:AA.adjustments}),Q.style.adjustments.exposure=(((cA=(iA=g.style)==null?void 0:iA.adjustments)==null?void 0:cA.exposure)||0)+CA*IA*50}else(rA=Q.style)!=null&&rA.adjustments&&(Q.style.adjustments.exposure=this.lerp(Q.style.adjustments.exposure||0,((WA=(YA=g.style)==null?void 0:YA.adjustments)==null?void 0:WA.exposure)||0,.1))}else if(B.type===X.Noise||B.type===X.Float){const z=(((P=B.settings)==null?void 0:P.frequency)||((wA=B.settings)==null?void 0:wA.speed)||1)*.002,IA=(((Z=B.settings)==null?void 0:Z.amplitude)||((p=B.settings)==null?void 0:p.range)||50)*(((_=B.settings)==null?void 0:_.strength)||1),CA=Date.now();Q.x+=Math.sin(CA*z)*IA*A,Q.y+=Math.cos(CA*z*.8)*IA*A,Q.rotation+=Math.sin(CA*z*.5)*5*A}else if(B.type===X.Pulse){const z=(((EA=B.settings)==null?void 0:EA.speed)||1)*.005,IA=(((fA=B.settings)==null?void 0:fA.scale)||1.2)-1,CA=Math.sin(Date.now()*z),dA=((lA=B.settings)==null?void 0:lA.strength)||1;Q.scale_x*=1+CA*IA*dA*A,Q.scale_y*=1+CA*IA*dA*A,Q.style&&(Q.style.exposure=(Q.style.exposure||1)+Math.max(0,CA)*.1*dA*A)}else if(B.type===X.Draggable){const z=((nA=B.settings)==null?void 0:nA.radius)||150,IA=this.draggingBehaviors.has(g.id);if(w<z||IA){const CA=((FA=B.settings)==null?void 0:FA.strength)||1,dA=IA?1:Math.max(0,1-w/z);this.applyBehaviorSensor(Q,II.PositionX,dA*CA,A,B.settings),this.applyBehaviorSensor(Q,II.PositionY,dA*CA,A,B.settings)}}else if(B.type===X.Scroll){const z=((yA=B.settings)==null?void 0:yA.axis)||"vertical",IA=((n=B.settings)==null?void 0:n.factor)||.5,CA=((bA=B.settings)==null?void 0:bA.strength)||1,dA=((_A=B.settings)==null?void 0:_A.scaleFactor)||0;(z==="vertical"||z==="both")&&(Q.y+=this.scrollOffset.y*IA*CA*A),(z==="horizontal"||z==="both")&&(Q.x+=this.scrollOffset.x*IA*CA*A),dA!==0&&(Q.scale_x*=1+this.scrollOffset.y*dA*A,Q.scale_y*=1+this.scrollOffset.y*dA*A)}else if(B.type===X.LookAt){const z=((VA=B.settings)==null?void 0:VA.factor)||1,IA=((xA=B.settings)==null?void 0:xA.strength)||1,CA=Math.atan2(-s,-D)*(180/Math.PI),dA=Q.rotation,aI=(CA-dA+180)%360-180;Q.rotation+=aI*z*IA*A*10}else if(B.type===X.Glint||B.type===X.Scan){const z=(((sA=B.settings)==null?void 0:sA.speed)||1)*.004,IA=((kA=B.settings)==null?void 0:kA.strength)||1,CA=(Math.sin(Date.now()*z)+1)/2;Q.style&&(Q.style.exposure=(Q.style.exposure||1)+CA*IA*A*5),Q.x+=(CA-.5)*20*IA*A}else if(B.type===X.Ratchet){const z=((uA=B.settings)==null?void 0:uA.steps)||12,IA=(((UA=B.settings)==null?void 0:UA.speed)||1)*30,CA=Math.floor(Q.rotation/(360/z))*(360/z);Q.rotation=this.lerp(Q.rotation,CA+IA*A,.1)}else if(B.type===X.Jitter&&w<300){const z=((tA=B.settings)==null?void 0:tA.strength)||1,IA=(((HA=B.settings)==null?void 0:HA.intensity)||5)*z;Q.x+=(Math.random()-.5)*IA*A*60,Q.y+=(Math.random()-.5)*IA*A*60,Q.rotation+=(Math.random()-.5)*IA*A*120}else if(B.type===X.Follower){const z=(gA=B.settings)==null?void 0:gA.targetId;if(z){const IA=this.objectStates.get(z);if(IA){const CA=(($=B.settings)==null?void 0:$.stiffness)||.1,dA=IA.x-Q.x,aI=IA.y-Q.y;Q.x+=dA*CA*A*60,Q.y+=aI*CA*A*60}}}else if(B.type===X.Wrap)Q.x<0?Q.x=this.canvasWidth:Q.x>this.canvasWidth&&(Q.x=0),Q.y<0?Q.y=this.canvasHeight:Q.y>this.canvasHeight&&(Q.y=0);else if(B.type===X.Gravity){const z=((BA=B.settings)==null?void 0:BA.strength)||9.8;Q.y+=z*A*10}else if(B.type===X.Velocity){const z=((eA=B.settings)==null?void 0:eA.vx)||0,IA=((f=B.settings)==null?void 0:f.vy)||0;Q.x+=z*A*10,Q.y+=IA*A*10}else if(B.type===X.Shear){const z=((GA=B.settings)==null?void 0:GA.strength)||1,IA=((NA=B.settings)==null?void 0:NA.radius)||300;if(w<IA){const CA=1-w/IA;Q.skew_x=this.lerp(Q.skew_x||0,(((wI=g.transform)==null?void 0:wI.skew_x)||0)+CA*z*30,.1)}else Q.skew_x=this.lerp(Q.skew_x||0,((yI=g.transform)==null?void 0:yI.skew_x)||0,.05)}else if(B.type===X.Lens){const z=((kI=B.settings)==null?void 0:kI.radius)||200,IA=((rI=B.settings)==null?void 0:rI.strength)||.5;if(w<z){const CA=Math.pow(1-w/z,2);Q.scale_x=this.lerp(Q.scale_x??1,(((tI=g.transform)==null?void 0:tI.scale_x)??1)*(1+CA*IA),.2),Q.scale_y=this.lerp(Q.scale_y??1,(((sI=g.transform)==null?void 0:sI.scale_y)??1)*(1+CA*IA),.2)}else Q.scale_x=this.lerp(Q.scale_x??1,((GI=g.transform)==null?void 0:GI.scale_x)??1,.1),Q.scale_y=this.lerp(Q.scale_y??1,((NI=g.transform)==null?void 0:NI.scale_y)??1,.1)}})})}applyBehaviorSensor(A,I,C,g,Q,B){var D,s,w,a,t,G,S,K,y;const i=(Q==null?void 0:Q.intensity)||(Q==null?void 0:Q.strength)||1,o=C*i*g;switch(I){case II.Scale:A.scale_x*=1+o*.5,A.scale_y*=1+o*.5;break;case II.Opacity:A.opacity=Math.max(0,Math.min(100,A.opacity-o*100));break;case II.RotateZ:A.rotation+=o*180;break;case II.RotateX:A.rotate_x=(A.rotate_x||0)+o*180;break;case II.RotateY:A.rotate_y=(A.rotate_y||0)+o*180;break;case II.PositionX:A.x+=o*300;break;case II.PositionY:A.y+=o*300;break;case II.SkewX:A.skew_x=(A.skew_x||0)+o*45;break;case II.Blur:A.style||(A.style={...B.style}),A.style.blur||(A.style.blur={...(D=B.style)==null?void 0:D.blur}),A.style.blur.amount=(((w=(s=B.style)==null?void 0:s.blur)==null?void 0:w.amount)||0)+C*((Q==null?void 0:Q.blur)||50)*i;break;case II.Exposure:A.style||(A.style={...B.style}),A.style.adjustments||(A.style.adjustments={...(a=B.style)==null?void 0:a.adjustments}),A.style.adjustments.exposure=(((G=(t=B.style)==null?void 0:t.adjustments)==null?void 0:G.exposure)||0)+C*((Q==null?void 0:Q.exposure)||50)*i;break;case II.HueShift:A.style||(A.style={...B.style}),A.style.adjustments||(A.style.adjustments={...(S=B.style)==null?void 0:S.adjustments}),A.style.adjustments.hue=(((y=(K=B.style)==null?void 0:K.adjustments)==null?void 0:y.hue)||0)+C*((Q==null?void 0:Q.hue)||180)*i;break;case II.CornerRadius:A.corner_radius=Math.min(200,(A.corner_radius||0)+o*100);break;case II.LetterSpacing:A.geometry||(A.geometry={}),A.geometry.letterSpacing=(A.geometry.letterSpacing||0)+o*10;break}}lerp(A,I,C){return A*(1-C)+I*C}deepMerge(A,I){if(!A)return I;if(!I)return A;if(typeof A!="object"||typeof I!="object"||A===null||I===null)return I;const C={...A};for(const g in I)Object.prototype.hasOwnProperty.call(I,g)&&(I[g]&&typeof I[g]=="object"&&!Array.isArray(I[g])?C[g]=this.deepMerge(A[g],I[g]):C[g]=I[g]);return C}renderFittedImage(A,I,C,g,Q,B,i="cover"){const o=I.naturalWidth,D=I.naturalHeight,s=o/D,w=Q/B;let a=Q,t=B,G=C,S=g;i==="cover"?s>w?(a=B*s,G=C-(a-Q)/2):(t=Q/s,S=g-(t-B)/2):i==="contain"&&(s>w?(t=Q/s,S=g+(B-t)/2):(a=B*s,G=C+(Q-a)/2)),A.drawImage(I,G,S,a,t)}}const iB=({artboard:E,config:A})=>{const I={...E.seo,...A},C=I.enableSmartExtraction!==!1;RA.useEffect(()=>{const i=I.title||E.name;i&&(document.title=i);let o=I.description;if(!o&&C){const w=E.objects.filter(a=>{var t;return((t=a.geometry)==null?void 0:t.type)==="Text"}).sort((a,t)=>{var G,S;return(((G=t.geometry.text)==null?void 0:G.length)||0)-(((S=a.geometry.text)==null?void 0:S.length)||0)});w.length>0&&(o=w[0].geometry.text)}o&&(g("name","description",o),g("property","og:description",o)),I.keywords&&I.keywords.length>0&&g("name","keywords",I.keywords.join(", "));const D=I.ogImage||E.backgroundImage;D&&g("property","og:image",D),i&&g("property","og:title",i),g("property","og:type","website")},[I,E,C]);const g=(i,o,D)=>{let s=document.querySelector(`meta[${i}="${o}"]`);s||(s=document.createElement("meta"),s.setAttribute(i,o),document.head.appendChild(s)),s.setAttribute("content",D)},Q=()=>{const i=[];return i.push(vA.jsx("h1",{children:I.title||E.name},"artboard-title")),E.objects.forEach((D,s)=>{var w,a;if(!(!D.visible&&D.isVisible!==!0))if(((w=D.geometry)==null?void 0:w.type)==="Text"){const t=D.geometry.text;t&&(D.geometry.fontSize>24?i.push(vA.jsx("h2",{children:t},D.id||s)):i.push(vA.jsx("p",{children:t},D.id||s)))}else if(((a=D.geometry)==null?void 0:a.type)==="Image"){const t=D.geometry.src,G=D.altText||D.name||"Illustration";i.push(vA.jsx("img",{src:t,alt:G},D.id||s))}else D.type==="Button"&&i.push(vA.jsx("button",{children:D.name||"Button"},D.id||s))}),i},B=I.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:I.title||E.name,description:I.description,image:I.ogImage||E.backgroundImage,abstract:"Animated interface created with ExodeUI"};return vA.jsxs("div",{id:`exode-seo-${E.id||"default"}`,"aria-hidden":"false",style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0",zIndex:-1},children:[Q(),vA.jsx("script",{type:"application/ld+json",children:JSON.stringify(B)})]})},Si=RA.forwardRef(({artboard:E,src:A,className:I,style:C,autoPlay:g=!0,fit:Q="Contain",alignment:B="Center",enableSEO:i=!0,seo:o,onReady:D,onTrigger:s,onInputUpdate:w,onComponentChange:a,onToggle:t,onInputChange:G,onInputFocus:S,onInputBlur:K,onLog:y,onLogicUpdate:e,onButtonClick:N,onGraphPointClick:k,currentTime:c,revision:F=0,scrollY:R,scrollX:J,mouseX:L,mouseY:l,isMouseDown:Y,inputs:x,interactive:DA=!0},hA)=>{const W=RA.useRef(null),b=RA.useRef(new EB),T=RA.useRef(void 0),u=RA.useRef(0),d=RA.useRef(null),H=RA.useRef(F),[j,SA]=RA.useState(E||null);RA.useImperativeHandle(hA,()=>W.current),RA.useEffect(()=>{console.log("[ExodeUI] Layout Effect - Component Updated/Mounted"),b.current.setLayout(Q,B)},[Q,B]),RA.useEffect(()=>{s&&b.current.setTriggerCallback(s)},[s]),RA.useEffect(()=>{w&&b.current.setInputUpdateCallback(w)},[w]),RA.useEffect(()=>{a&&b.current.setComponentChangeCallback(a)},[a]),RA.useEffect(()=>{t&&b.current.setToggleCallback(t)},[t]),RA.useEffect(()=>{G&&b.current.setInputChangeCallback(G)},[G]),RA.useEffect(()=>{S&&b.current.setInputFocusCallback(S)},[S]),RA.useEffect(()=>{K&&b.current.setInputBlurCallback(K)},[K]),RA.useEffect(()=>{e&&b.current.setLogicUpdateCallback(e)},[e]),RA.useEffect(()=>{N&&b.current.setButtonClickCallback(N)},[N]),RA.useEffect(()=>{k&&b.current.setGraphPointClickCallback(k)},[k]),RA.useEffect(()=>{(async()=>{let QA=E;if(!QA&&A)try{const q=await(await fetch(A)).text();if(!q.trim().startsWith("{")&&!q.trim().startsWith("["))try{const v=BB.decompressFromBase64(q.trim());v&&(QA=JSON.parse(v))}catch{console.warn("[ExodeUI] File is not standard JSON, and decompression failed.")}if(!QA&&q)try{QA=JSON.parse(q)}catch(v){console.error("[ExodeUI] Failed to parse JSON content:",v)}}catch(oA){console.error("Failed to load ExodeUI animation:",oA);return}if(QA){const oA=new Set;QA.objects&&QA.objects.forEach(V=>{var AA;((AA=V.geometry)==null?void 0:AA.type)==="Text"&&(V.geometry.fontFamily&&oA.add(V.geometry.fontFamily),V.geometry.segments&&V.geometry.segments.forEach(iA=>{iA.fontFamily&&oA.add(iA.fontFamily)}))}),oA.forEach(V=>{const AA=`exode-font-${V.replace(/\s+/g,"-").toLowerCase()}`;if(!document.getElementById(AA)){const iA=document.createElement("link");iA.id=AA,iA.rel="stylesheet";const cA=V.replace(/\s+/g,"+");iA.href=`https://fonts.googleapis.com/css2?family=${cA}:wght@100;200;300;400;500;600;700;800;900&display=swap`,document.head.appendChild(iA),console.log(`[ExodeUI] Loading dynamic font: ${V}`)}});const q=b.current,v=QA.id||QA.name||"default";(d.current!==v||H.current!==F)&&(q.load(QA),d.current=v,H.current=F,SA(QA),u.current=0,q.advance(0)),D&&D(q)}})()},[E,A,F]),RA.useEffect(()=>{c!==void 0&&b.current.seek(c)},[c]),RA.useEffect(()=>{const m=b.current;R!==void 0&&m.updateInput("scrollY",R),J!==void 0&&m.updateInput("scrollX",J),L!==void 0&&m.updateInput("mouseX",L),l!==void 0&&m.updateInput("mouseY",l),Y!==void 0&&m.updateInput("isMouseDown",Y),x&&Object.entries(x).forEach(([QA,oA])=>{m.updateInput(QA,oA)})},[R,J,L,l,Y,x]),RA.useEffect(()=>{const m=b.current,QA=W.current;if(!QA)return;u.current=0;const oA=QA.getContext("2d");if(!oA)return;oA.imageSmoothingEnabled=!0,oA.imageSmoothingQuality="high",y&&m.setOnLogCallback(y);const q=V=>{u.current||(u.current=V);const AA=(V-u.current)/1e3;u.current=V,g&&m.advance(AA);const iA=window.devicePixelRatio||1,cA=QA.getBoundingClientRect(),rA=Math.floor(cA.width*iA),YA=Math.floor(cA.height*iA);(QA.width!==rA||QA.height!==YA)&&(QA.width=rA,QA.height=YA),oA.imageSmoothingEnabled=!0,oA.imageSmoothingQuality="high",m.render(oA,rA,YA),T.current=requestAnimationFrame(q)};T.current=requestAnimationFrame(q);const v=()=>{m.handleScroll(window.scrollX,window.scrollY)};return window.addEventListener("scroll",v,{passive:!0}),()=>{T.current&&cancelAnimationFrame(T.current),window.removeEventListener("scroll",v)}},[g]);const O=(m,QA)=>{const oA=m.currentTarget.getBoundingClientRect(),q=m.clientX-oA.left,v=m.clientY-oA.top,V=oA.width,AA=oA.height;DA&&b.current.handlePointerInput(QA,q,v,V,AA)};return vA.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...C},className:I,children:[vA.jsx("canvas",{ref:W,style:{width:"100%",height:"100%",outline:"none"},tabIndex:0,onPointerDown:m=>{var QA;O(m,"down"),(QA=W.current)==null||QA.focus()},onPointerUp:m=>O(m,"up"),onPointerMove:m=>O(m,"move"),onPointerLeave:m=>O(m,"blur"),onClick:m=>O(m,"click"),onKeyDown:m=>{m.key==="Backspace"||m.key==="Enter"||m.key,b.current.handleKeyDown(m.nativeEvent)},onWheel:m=>{DA&&b.current.handleWheel(m.deltaX,m.deltaY)}}),i&&j&&vA.jsx(iB,{artboard:j,config:o})]})});function Ki(){const[E,A]=RA.useState(null),I=RA.useCallback((w,a)=>{E==null||E.setInputBool(w,a)},[E]),C=RA.useCallback((w,a)=>{E==null||E.setInputNumber(w,a)},[E]),g=RA.useCallback(w=>{E==null||E.fireTrigger(w)},[E]),Q=RA.useCallback((w,a)=>{E==null||E.setInputText(w,a)},[E]),B=RA.useCallback((w,a)=>{E==null||E.setInputNumberArray(w,a)},[E]),i=RA.useCallback((w,a)=>{E==null||E.setInputStringArray(w,a)},[E]),o=RA.useCallback((w,a)=>{E==null||E.updateObjectOptions(w,a)},[E]),D=RA.useCallback((w,a,t)=>{E==null||E.updateConstraint(w,a,t)},[E]),s=RA.useCallback((w,a)=>{E==null||E.updateGraphData(w,a)},[E]);return{setEngine:A,engine:E,setInputBool:I,setInputNumber:C,fireTrigger:g,setInputText:Q,setInputNumberArray:B,setInputStringArray:i,updateConstraint:D,updateGraphData:s,updateObjectOptions:o}}const yi={version:"6.2.11"}.version;XA.BehaviorSensor=II,XA.BehaviorType=X,XA.ConditionOp=lC,XA.ExodeSEO=iB,XA.ExodeUICanvas=Si,XA.ExodeUIEngine=EB,XA.LogicOp=JA,XA.VERSION=yi,XA.useExodeUI=Ki,Object.defineProperty(XA,Symbol.toStringTag,{value:"Module"})});
|
|
34
|
+
`);let V=-B/2+H;const AA=T*1.2;let iA=0;v.forEach((cA,rA)=>{const YA=cA.split(" ");let WA="";for(let P=0;P<YA.length;P++){const wA=WA+YA[P]+" ";A.measureText(wA).width>m&&P>0?(A.fillText(WA,O,V),WA=YA[P]+" ",V+=AA):WA=wA}A.fillText(WA,O,V),iA=A.measureText(WA).width,rA<v.length-1&&(V+=AA,iA=0)}),i&&!hA&&Math.floor(performance.now()/500)%2===0&&A.fillRect(O+iA,V,1.5,T)}else{const V=A.measureText(QA).width;let AA=0;if(V>m&&(AA=V-m),A.fillText(QA,O-AA,0),i&&!hA&&Math.floor(performance.now()/500)%2===0){const cA=O+V-AA;A.fillRect(cA,-(T/2),1.5,T)}}if(A.restore(),w.visible!==!1){const v=w.text||"Label",V=w.fontSize||12,AA=w.color||"rgba(156, 163, 175, 1)",iA=w.offset??8;A.font=`600 ${V}px "${u}", sans-serif`,A.fillStyle=AA,A.textAlign="left",A.textBaseline="bottom";const cA=-(Q/2),rA=-(B/2)-iA;A.fillText(v,cA,rA)}if(a.visible===!0){const v=a.text||"Helper text",V=a.fontSize||11,AA=s==="error"?"rgba(239, 68, 68, 1)":a.color||"rgba(156, 163, 175, 1)",iA=a.offset??6;A.font=`400 ${V}px "${u}", sans-serif`,A.fillStyle=AA,A.textAlign="left",A.textBaseline="top";const cA=-(Q/2),rA=B/2+iA;A.fillText(v,cA,rA)}}renderSlider(A,I){const C=this.objectStates.get(I.id),g=(C==null?void 0:C.geometry)||I.geometry,Q=(C==null?void 0:C.options)||I.options||{},B=g.width||200,i=Q.value??50,o=Q.min??0,s=(Q.max??100)-o,w=s===0?0:(i-o)/s,a=Q.trackHeight||4,t=Q.trackRoundedness??2,G=Q.trackShape??"Rectangle",S=Q.trackPath||"",K=Q.activeColor||"#3b82f6",y=Q.inactiveColor||"#374151",e=Q.thumbShape||"Ellipse",N=Q.thumbWidth??16,k=Q.thumbHeight??16,c=Q.thumbRoundedness??0,F=Q.thumbColor||"#ffffff",R=Q.thumbPath||"",J=Q.thumbIcon||"",L=Q.showValueTooltip??!1,l=Q.tooltipBgColor||"#333333",Y=Q.tooltipColor||"#ffffff",x=Q.tooltipOffsetX??0,DA=Q.tooltipOffsetY??-25,hA=(O,m,QA,oA,q,v,V)=>{if((O==="Custom"||O==="Icon")&&V)try{const AA=new Path2D(V);if(A.save(),A.translate(m,QA),O==="Icon"){const iA=Math.min(oA,q)/24;A.scale(iA,iA),A.translate(-12,-12)}A.fill(AA),A.restore();return}catch(AA){console.error("Error drawing slider shape in engine:",AA)}if(A.beginPath(),O==="Ellipse")A.ellipse(m,QA,oA/2,q/2,0,0,Math.PI*2);else if(O==="Rectangle")this.drawRoundRect(A,m-oA/2,QA-q/2,oA,q,v);else if(O==="Triangle")A.moveTo(m,QA-q/2),A.lineTo(m+oA/2,QA+q/2),A.lineTo(m-oA/2,QA+q/2),A.closePath();else if(O==="Diamond")A.moveTo(m,QA-q/2),A.lineTo(m+oA/2,QA),A.lineTo(m,QA+q/2),A.lineTo(m-oA/2,QA),A.closePath();else if(O==="Polygon"){const AA=I.geometry.sides||3,iA=I.geometry.radius||Math.min(oA,q)/2;for(let cA=0;cA<AA;cA++){const rA=cA*2*Math.PI/AA-Math.PI/2,YA=m+iA*Math.cos(rA),WA=QA+iA*Math.sin(rA);cA===0?A.moveTo(YA,WA):A.lineTo(YA,WA)}A.closePath()}else if(O==="Star"){const iA=Math.min(oA,q)/2,cA=iA/2;for(let rA=0;rA<5*2;rA++){const YA=rA%2===0?iA:cA,WA=rA*Math.PI/5-Math.PI/2;A.lineTo(m+YA*Math.cos(WA),QA+YA*Math.sin(WA))}A.closePath()}else O==="Line"&&(A.moveTo(m-oA/2,QA),A.lineTo(m+oA/2,QA));A.fill()};A.fillStyle=y,G==="Line"?(A.strokeStyle=y,A.lineWidth=a,A.beginPath(),A.moveTo(-B/2,0),A.lineTo(B/2,0),A.stroke()):hA(G,0,0,B,a,t,S);const W=B-N,b=-B/2+N/2+w*W,T=b- -B/2;T>0&&(A.fillStyle=K,G==="Line"?(A.strokeStyle=K,A.lineWidth=a,A.beginPath(),A.moveTo(-B/2,0),A.lineTo(b,0),A.stroke()):G==="Rectangle"&&(A.beginPath(),this.drawRoundRect(A,-B/2,-a/2,T,a,t),A.fill())),A.save(),A.translate(b,0);const u=A.getTransform(),d=Math.sqrt(u.a*u.a+u.b*u.b)||1;if(A.shadowColor="rgba(0,0,0,0.2)",A.shadowBlur=4*d,A.shadowOffsetY=1*d,A.fillStyle=F,hA(e,0,0,N,k,c,e==="Icon"?J:R),A.restore(),L){A.save(),A.translate(b+x,DA);const O=Math.round(i).toString();A.font="10px Inter, sans-serif";const m=A.measureText(O),QA=6,oA=4,q=m.width+QA*2,v=14+oA;A.beginPath(),this.drawRoundRect(A,-q/2,-v/2,q,v,4),A.fillStyle=l,A.fill(),A.fillStyle=Y,A.textAlign="center",A.textBaseline="middle",A.fillText(O,0,0),A.restore()}const H=Q.label||{},j=Q.helperText||{},SA=Q.fontFamily||"Inter";if(H.visible!==!1){const O=H.text||"Label",m=H.fontSize||12,QA=H.color||"rgba(156, 163, 175, 1)",oA=H.offset??8;A.font=`600 ${m}px "${SA}", sans-serif`,A.fillStyle=QA,A.textAlign="left",A.textBaseline="bottom";const q=-(B/2),v=-(a/2)-oA;A.fillText(O,q,v)}if(j.visible===!0){const O=j.text||"Helper text",m=j.fontSize||11,QA=j.color||"rgba(156, 163, 175, 1)",oA=j.offset??6;A.font=`400 ${m}px "${SA}", sans-serif`,A.fillStyle=QA,A.textAlign="left",A.textBaseline="top";const q=-(B/2),v=a/2+oA;A.fillText(O,q,v)}}renderDropdown(A,I){var DA;const C=this.objectStates.get(I.id);if(!C)return;const g=C.options||I.options||{},Q=I.geometry.width||160,B=I.geometry.height||40,i=-Q/2,o=-B/2,D=g.corner_radius??6,s=g.disabled||g.previewState==="disabled",w=this.lastHoveredObjectId===I.id||g.previewState==="hover",a=(g.isOpen||g.previewState==="active")&&!s;let t=g.backgroundColor,G=g.borderColor,S=g.color||"#333333";s?(t=g.disabledBackgroundColor||"#f3f4f6",G=g.disabledBorderColor||"#e5e7eb",S=g.disabledColor||"#9ca3af"):a?(t=g.activeBackgroundColor||t,G=g.activeBorderColor||G,S=g.activeColor||S):w&&(t=g.hoverBackgroundColor||t,G=g.hoverBorderColor||G,S=g.hoverColor||S),t||(t="#ffffff"),G||(G="#e5e7eb");const K=A.globalAlpha;A.globalAlpha=K*(g.opacity??1),this.drawRoundRect(A,i,o,Q,B,D),A.fillStyle=this.createCanvasFill(A,typeof t=="string"?{type:"Solid",color:t}:t,Q,B)||"#ffffff",A.fill();const y=g.borderWidth??1;y>0&&(A.strokeStyle=this.createCanvasFill(A,typeof G=="string"?{type:"Solid",color:G}:G,Q,B)||"#e5e7eb",A.lineWidth=y,A.stroke());const e=12,N=g.chevronType||"chevron",k=g.chevronSize||16,c=(a?g.openIconColor:g.closedIconColor)||g.chevronColor||"#6b7280";if(N!=="none"){const hA=i+Q-e-k/2;A.save(),A.translate(hA,0);const W=a?g.openIconAngle??180:g.closedIconAngle??0;if(A.rotate(W*Math.PI/180),A.strokeStyle=c,A.fillStyle=c,A.lineWidth=1.5,A.lineCap="round",A.lineJoin="round",N==="chevron")A.beginPath(),A.moveTo(-k/2,-k*.2),A.lineTo(0,k*.2),A.lineTo(k/2,-k*.2),A.stroke();else if(N==="custom"||N==="path"){const b=a&&g.openIconPath||g.closedIconPath;if(b){const T=new Path2D(b);A.save();const u=k/24;A.scale(u,u),A.translate(-12,-12),A.fill(T),A.restore()}}A.restore()}const F=g.selectedOption||g.placeholder||"Select...",R=g.fontSize||14,J=g.fontWeight||400,L=g.fontFamily||"Inter, sans-serif";A.font=`${J} ${R}px ${L}`;const l=s?g.disabledColor||"#9ca3af":!g.selectedOption&&g.placeholder?"#9ca3af":S;A.fillStyle=this.createCanvasFill(A,typeof l=="string"?{type:"Solid",color:l}:l,Q,B)||"#333333",A.textAlign="left",A.textBaseline="middle";const Y=N==="none"?0:k+8,x=Q-e*2-Y;if(A.save(),A.beginPath(),A.rect(i+e,o,x,B),A.clip(),A.fillText(F,i+e,0),A.restore(),a&&!s){const hA=o+B+4,W=g.optionsList||[],b=g.itemHeight||32,T=g.listPadding??4,u=W.length*b+T*2,d=g.listCornerRadius??D;A.save();const H=g.listShadow||{},j=A.getTransform(),SA=Math.sqrt(j.a*j.a+j.b*j.b)||1;A.shadowColor=typeof H.color=="string"?H.color:((DA=H.color)==null?void 0:DA.color)||"rgba(0,0,0,0.15)",A.shadowBlur=(H.blur??12)*SA,A.shadowOffsetY=(H.offsetY??6)*SA,A.shadowOffsetX=(H.offsetX??0)*SA,A.beginPath(),this.drawRoundRect(A,i,hA,Q,u,d),A.fillStyle=this.createCanvasFill(A,typeof g.listBackgroundColor=="string"?{type:"Solid",color:g.listBackgroundColor}:g.listBackgroundColor||{type:"Solid",color:"#ffffff"},Q,u)||"#ffffff",A.fill();const O=g.listBorderWidth??1;O>0&&(A.shadowColor="transparent",A.strokeStyle=this.createCanvasFill(A,typeof g.listBorderColor=="string"?{type:"Solid",color:g.listBorderColor}:g.listBorderColor||{type:"Solid",color:G},Q,u)||"#e5e7eb",A.lineWidth=O,A.stroke()),A.restore();const m=g.itemFontSize||R,QA=g.itemFontFamily||L;A.font=`${J} ${m}px ${QA}`,W.forEach((oA,q)=>{const v=hA+T+q*b;if(oA===g.selectedOption)A.fillStyle=this.createCanvasFill(A,typeof g.itemSelectedBackgroundColor=="string"?{type:"Solid",color:g.itemSelectedBackgroundColor}:g.itemSelectedBackgroundColor||{type:"Solid",color:"#f3f4f6"},Q,b)||"#f3f4f6",A.fillRect(i+O,v,Q-O*2,b),A.fillStyle=g.itemSelectedColor||g.activeColor||S||"#374151";else if(A.fillStyle=g.listTextColor||S||"#333333",this.activeDropdownId===I.id&&this._lastPointerPos){const AA=this._lastPointerPos.y-(hA+T),iA=Math.floor(AA/b);q===iA&&(A.fillStyle=this.createCanvasFill(A,typeof g.itemHoverBackgroundColor=="string"?{type:"Solid",color:g.itemHoverBackgroundColor}:g.itemHoverBackgroundColor||{type:"Solid",color:"#f9fafb"},Q,b)||"#f9fafb",A.fillRect(i+O,v,Q-O*2,b),A.fillStyle=g.itemHoverColor||S)}A.fillText(oA,i+e,v+b/2)})}A.globalAlpha=K}renderButton(A,I){var N,k,c,F;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((N=I.geometry)==null?void 0:N.width)||120,B=((k=I.geometry)==null?void 0:k.height)||40,i=-Q/2,o=-B/2,D=this.lastHoveredObjectId===I.id,s=g.corner_radius??8,w=g.bgShape||"Rectangle",a=D?((c=g.hoverStyle)==null?void 0:c.backgroundColor)||g.buttonBgColor||"#3b82f6":g.buttonBgColor||"#3b82f6",t=g.label||{},G=D?((F=g.hoverStyle)==null?void 0:F.textColor)||t.color||"#ffffff":t.color||"#ffffff",S=g.icon||{enabled:!1};A.save(),A.beginPath(),w==="Rectangle"?this.drawRoundRect(A,i,o,Q,B,s):w==="Ellipse"||w==="Circle"?A.ellipse(0,0,Q/2,B/2,0,0,Math.PI*2):w==="Pill"&&this.drawRoundRect(A,i,o,Q,B,B/2),A.fillStyle=a,A.fill();const K=t.fontSize||14,y=t.fontFamily||"Inter";A.font=`${t.fontWeight||400} ${K}px "${y}", sans-serif`,A.fillStyle=G,A.textAlign="center",A.textBaseline="middle";let e=0;if(S.enabled&&S.svgPath){const R=S.size||16,J=S.gap||8,L=S.position==="left"?-(A.measureText(t.text||"").width/2+R/2+J/2):A.measureText(t.text||"").width/2+R/2+J/2;A.save(),A.translate(L,0);const l=new Path2D(S.svgPath),Y=R/24;A.scale(Y,Y),A.translate(-12,-12),A.fillStyle=S.color||G,A.fill(l),A.restore(),e=S.position==="left"?R/2+J/2:-(R/2+J/2)}A.fillText(t.text||"Button",e,0),A.restore()}renderToggleButton(A,I){var K,y;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=g.checked??!1,B=((K=I.geometry)==null?void 0:K.width)||120,i=((y=I.geometry)==null?void 0:y.height)||40,o=-B/2,D=-i/2,s=g.corner_radius??8,w=g.label||{},a=Q?g.activeColor||"#3b82f6":g.inactiveColor||"#374151",t=Q?g.activeTextColor||"#ffffff":g.inactiveTextColor||"#9ca3af";A.save(),A.beginPath(),this.drawRoundRect(A,o,D,B,i,s),A.fillStyle=a,A.fill();const G=w.fontSize||14,S=w.fontFamily||"Inter";A.font=`${w.fontWeight||600} ${G}px "${S}", sans-serif`,A.fillStyle=t,A.textAlign="center",A.textBaseline="middle",A.fillText(w.text||"Toggle",0,0),A.restore()}renderToggle(A,I){var e,N;const C=this.objectStates.get(I.id),g=(C==null?void 0:C.options)||I.options||{},Q=((e=I.geometry)==null?void 0:e.width)||52,B=((N=I.geometry)==null?void 0:N.height)||30,i=-Q/2,o=-B/2,D=g.checked??!1,s=g.corner_radius??B/2;A.beginPath(),this.drawRoundRect(A,i,o,Q,B,s),A.fillStyle=D?g.activeColor||"#10b981":g.inactiveColor||"#374151",g.disabled&&(A.globalAlpha*=.5),A.fill();const w=3,a=B-w*2,t=a/2,G=i+w,S=i+Q-w-a,K=D?S:G,y=o+w;if(A.beginPath(),A.arc(K+t,y+t,t,0,Math.PI*2),A.fillStyle=g.knobColor||"#ffffff",A.fill(),g.disabled&&(A.globalAlpha*=2),g.label&&g.label.text){const k=g.label,c=k.fontSize||14,F=k.fontWeight||400,R=k.fontFamily||"Inter";A.font=`${F} ${c}px "${R}", sans-serif`,A.fillStyle=k.color||"#f3f4f6",A.textBaseline="middle";const J=k.gap||10;let L=0,l=0;k.position==="left"?(A.textAlign="right",L=i-J,l=0):k.position==="right"?(A.textAlign="left",L=i+Q+J,l=0):k.position==="top"?(A.textAlign="center",L=0,l=o-J,A.textBaseline="bottom"):k.position==="bottom"?(A.textAlign="center",L=0,l=o+B+J,A.textBaseline="top"):(A.textAlign="left",L=i+Q+J,l=0),A.fillText(k.text,L,l)}}renderLineGraph(A,I,C,g){let Q=I.datasets||[];if((!Q||Q.length===0)&&(I.data||I.graphData)&&(Q=[{id:"line-1",label:"Series 1",data:I.data||I.graphData||[],lineColor:I.lineColor||"#3b82f6",lineWidth:I.lineWidth||2,showArea:I.showArea||!1,areaColor:I.areaColor||"rgba(139, 92, 246, 0.3)",smoothing:I.smoothing||!1,showPoints:I.showPoints!==void 0?I.showPoints:!0,pointSize:I.pointSize||6,pointFill:I.pointFill||"#ffffff",pointStrokeColor:I.pointStrokeColor||I.lineColor||"#3b82f6",pointStrokeWidth:I.pointStrokeWidth||2}]),!Q||Q.length===0||!Q.some(S=>S.data&&S.data.length>=2)){A.save(),A.fillStyle="#6366f1",A.font="12px Inter, system-ui, sans-serif",A.textAlign="center",A.textBaseline="middle",A.fillText("NO DATA",0,0),A.restore();return}let B=1/0,i=-1/0,o=0;if(Q.forEach(S=>{let K=S.data;if(S.isVarEnabled&&S.inputId){let y=this.inputs.get(S.inputId);if(y===void 0){const e=this.inputNameMap.get(S.inputId);e&&e.length>0&&(y=this.inputs.get(e[0]))}y&&Array.isArray(y)&&(K=y)}if(K&&K.length>0){const y=K.filter(e=>typeof e=="number"&&!isNaN(e));y.length>0&&(B=Math.min(B,...y),i=Math.max(i,...y),o=Math.max(o,K.length))}S._resolvedData=K}),o<2)return;const D=i-B,s=C/(o-1),w=S=>{const K=D===0?.5:(S-B)/D;return g/2-K*g},a=S=>S*s-C/2,t=I.axisColor||"#333333";if(I.showXAxis&&(A.beginPath(),A.strokeStyle=I.xAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,g/2),A.lineTo(C/2,g/2),A.stroke()),I.showYAxis&&(A.beginPath(),A.strokeStyle=I.yAxisColor||t,A.lineWidth=1,A.moveTo(-C/2,-g/2),A.lineTo(-C/2,g/2),A.stroke()),A.fillStyle=I.axisLabelColor||"#333333",A.font=`${I.axisLabelFontSize||10}px Inter, sans-serif`,I.showXLabels){A.textAlign="center",A.textBaseline="top";for(let S=0;S<o;S++){const K=a(S);A.fillText(`${S+1}`,K,g/2+5)}}if(I.showYLabels){A.textAlign="right",A.textBaseline="middle";const S=-C/2-5,K=(i+B)/2;A.fillText(i.toFixed(1),S,w(i)),A.fillText(K.toFixed(1),S,w(K)),A.fillText(B.toFixed(1),S,w(B))}const G=10;if(Q.forEach(S=>{const K=S._resolvedData;if(!(!K||K.length<2)){if(S.showArea){if(A.beginPath(),A.moveTo(a(0),g/2),A.lineTo(a(0),w(K[0])),S.smoothing&&K.length>2)for(let e=0;e<K.length-1;e++){const N=K[e===0?e:e-1],k=K[e],c=K[e+1],F=K[e+1===K.length-1?e+1:e+2];for(let R=1;R<=G;R++){const J=R/G,L=this._catmullRom(N,k,c,F,J);A.lineTo(a(e+J),w(L))}}else for(let e=1;e<K.length;e++)A.lineTo(a(e),w(K[e]));A.lineTo(a(K.length-1),g/2),A.closePath();const y=A.globalAlpha;A.globalAlpha=y*(I.areaOpacity??.3),A.fillStyle=S.areaColor||"rgba(139, 92, 246, 0.2)",A.fill(),A.globalAlpha=y}if(A.beginPath(),A.strokeStyle=S.lineColor||"#3b82f6",A.lineWidth=S.lineWidth||2,A.lineJoin="round",A.lineCap="round",A.moveTo(a(0),w(K[0])),S.smoothing&&K.length>2)for(let y=0;y<K.length-1;y++){const e=K[y===0?y:y-1],N=K[y],k=K[y+1],c=K[y+1===K.length-1?y+1:y+2];for(let F=1;F<=G;F++){const R=F/G,J=this._catmullRom(e,N,k,c,R);A.lineTo(a(y+R),w(J))}}else for(let y=1;y<K.length;y++)A.lineTo(a(y),w(K[y]));A.stroke(),S.showPoints&&K.forEach((y,e)=>{const N=a(e),k=w(y);A.beginPath(),A.arc(N,k,(S.pointSize||6)/2,0,Math.PI*2),A.fillStyle=S.pointFill||"#ffffff",A.fill(),A.strokeStyle=S.pointStrokeColor||S.lineColor||"#3b82f6",A.lineWidth=S.pointStrokeWidth||1,A.stroke()})}}),I.showLegend&&Q.length>0){const S=C/2-10;let K=-g/2+15;const y=I.legendFontSize||10,e=y+5;A.font=`${y}px Inter, sans-serif`,A.textAlign="right",A.textBaseline="alphabetic",Q.forEach(N=>{const c=N.label||"Series",F=A.measureText(c).width;A.beginPath(),A.rect(S-F-8-5,K-(8/2+2),8,8),A.fillStyle=N.lineColor||"#3b82f6",A.fill(),A.fillStyle=I.legendColor||"#333333",A.fillText(c,S,K),K+=e})}}_catmullRom(A,I,C,g,Q){const B=(C-A)*.5,i=(g-I)*.5,o=Q*Q,D=Q*o;return(2*I-2*C+B+i)*D+(-3*I+3*C-2*B-i)*o+B*Q+I}normalizeOpacity(A){const I=typeof A=="number"?A:parseFloat(String(A));return isNaN(I)?1:I>1?Math.min(1,I/100):Math.max(0,Math.min(1,I))}createCanvasFill(A,I,C,g){var Q,B,i;if(!I||I.type==="None")return null;if(typeof I=="string")return I;if(I.type==="Solid"&&I.color){const o=I.color,s=(((B=(Q=this.artboard)==null?void 0:Q.tokens)==null?void 0:B.colors)||{})[o]||o;return A.fillStyle=s,s}if((I.type==="LinearGradient"||I.type==="RadialGradient"||I.type==="AngularGradient"||I.type==="DiamondGradient")&&I.stops){const o=(D,s=100)=>{var k,c;const a=(((c=(k=this.artboard)==null?void 0:k.tokens)==null?void 0:c.colors)||{})[D]||D,t=this.normalizeOpacity(I.opacity??100),S=this.normalizeOpacity(s)*t;if(S>=1&&a.startsWith("#"))return a;const K=a.startsWith("#")?a.replace("#",""):"ffffff",y=parseInt(K.substring(0,2),16),e=parseInt(K.substring(2,4),16),N=parseInt(K.substring(4,6),16);return`rgba(${y}, ${e}, ${N}, ${S})`};if(I.type==="LinearGradient"){const D=(S,K,y)=>Array.isArray(S)?S[K]??(K===0?0:1):S&&typeof S=="object"?S[y]??(K===0?0:1):K===0?0:1,s=D(I.start,0,"x")*C-C/2,w=D(I.start,1,"y")*g-g/2,a=D(I.end,0,"x")*C-C/2,t=D(I.end,1,"y")*g-g/2,G=A.createLinearGradient(s,w,a,t);if(I.stops.forEach(S=>{const K=S.offset!==void 0?S.offset:S.pos!==void 0?S.pos:S.position!==void 0?S.position:0,y=o(S.color||"#000000",S.opacity??100);G.addColorStop(Math.max(0,Math.min(1,K)),y)}),I.gradientTransform&&G.setTransform){const[S,K,y,e,N,k]=I.gradientTransform;G.setTransform({a:S,b:K,c:y,d:e,e:N,f:k})}return G}else if(I.type==="RadialGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center,0,"x")*C-C/2,w=D(I.center,1,"y")*g-g/2,a=(I.radius??.5)*Math.max(C,g),t=A.createRadialGradient(s,w,0,s,w,a);if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return t}else if(I.type==="AngularGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center||[.5,.5],0,"x")*C-C/2,w=D(I.center||[.5,.5],1,"y")*g-g/2,a=(I.degree||I.angle||0)*(Math.PI/180),t=(i=A.createConicGradient)==null?void 0:i.call(A,a,s,w);if(t){if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return t}}else if(I.type==="DiamondGradient"){const D=(G,S,K)=>Array.isArray(G)?G[S]??.5:G&&typeof G=="object"?G[K]??.5:.5,s=D(I.center||[.5,.5],0,"x")*C-C/2,w=D(I.center||[.5,.5],1,"y")*g-g/2,a=(I.radius??.5)*Math.max(C,g);A.save(),A.translate(s,w),A.rotate(Math.PI/4);const t=A.createRadialGradient(0,0,0,0,0,a);if(I.stops.forEach(G=>{const S=G.offset!==void 0?G.offset:G.pos!==void 0?G.pos:G.position!==void 0?G.position:0,K=o(G.color||"#000000",G.opacity??100);t.addColorStop(Math.max(0,Math.min(1,S)),K)}),I.gradientTransform&&t.setTransform){const[G,S,K,y,e,N]=I.gradientTransform;t.setTransform({a:G,b:S,c:K,d:y,e,f:N})}return A.scale(1/Math.SQRT2,1/Math.SQRT2),A.fillStyle=t,A.restore(),t}}if(I.type==="Pattern"&&I.url){let o=this.imageCache.get(I.url);if(o||(o=new Image,o.src=I.url,this.imageCache.set(I.url,o)),o.complete&&o.naturalWidth>0){const D=A.createPattern(o,"repeat");if(D&&(I.scaleX!==void 0||I.offsetX!==void 0)){const s=new DOMMatrix,w=I.scaleX??1,a=I.scaleY??1,t=I.offsetX??0,G=I.offsetY??0,S=I.rotation??0;s.translateSelf(t,G),s.rotateSelf(S),s.scaleSelf(w,a),D.setTransform(s)}return D}}return I.color||null}drawRoundRect(A,I,C,g,Q,B){if(B===0||B===void 0||B===null){A.rect(I,C,g,Q);return}let i=B;if(typeof i=="string")try{i=JSON.parse(i)}catch{i=parseFloat(i)||0}let o=0,D=0,s=0,w=0;typeof i=="number"?o=D=s=w=i:Array.isArray(i)?i.length===1?o=D=s=w=i[0]:i.length===2?(o=s=i[0],D=w=i[1]):i.length===3?(o=i[0],D=w=i[1],s=i[2]):i.length>=4&&(o=i[0],D=i[1],s=i[2],w=i[3]):i&&typeof i=="object"&&(o=i.tl??i.corner_radius??i.cornerRadius??0,D=i.tr??i.corner_radius??i.cornerRadius??0,s=i.br??i.corner_radius??i.cornerRadius??0,w=i.bl??i.corner_radius??i.cornerRadius??0);const a=Math.min(Math.abs(g)/2,Math.abs(Q)/2);if(o=Math.min(Math.max(0,o),a),D=Math.min(Math.max(0,D),a),s=Math.min(Math.max(0,s),a),w=Math.min(Math.max(0,w),a),A.roundRect){A.roundRect(I,C,g,Q,[o,D,s,w]);return}A.moveTo(I+o,C),A.lineTo(I+g-D,C),A.arcTo(I+g,C,I+g,C+D,D),A.lineTo(I+g,C+Q-s),A.arcTo(I+g,C+Q,I+g-s,C+Q,s),A.lineTo(I+w,C+Q),A.arcTo(I,C+Q,I,C+Q-w,w),A.lineTo(I,C+o),A.arcTo(I,C,I+o,C,o),A.closePath()}renderListView(A,I){var hA,W,b,T;const C=this.objectStates.get(I.id)||{},g=C.options||I.options||{},Q=C.width!==void 0?C.width:((hA=I.geometry)==null?void 0:hA.width)||200,B=C.height!==void 0?C.height:((W=I.geometry)==null?void 0:W.height)||300,i=-Q/2,o=-B/2,D=C.corner_radius!==void 0?C.corner_radius:g.corner_radius??0,s=g.orientation||"vertical",w=g.items||[],a=g.itemGap??10,t=g.itemHeight??50,G=g.itemWidth??200,S=g.scrollOffset??0,K=g.padding??0,y=g.glassEffect!==!1,e=g.accentColor||"#3b82f6",N=g.itemTextColor||"#333333",k=g.itemBackgroundColor||"#ffffff",c=g.hoveredIndex??null,F=g.activeItemIndex??null,R=g.glowIntensity??0,J=g.glowColor||"#3b82f6",L=typeof J=="string"?J:J.color||((T=(b=J.stops)==null?void 0:b[0])==null?void 0:T.color)||"#3b82f6",l=g.opacity!==void 0?g.opacity:I.opacity!==void 0?I.opacity:1;if(A.save(),A.globalAlpha*=l,R>0){const u=A.getTransform(),d=Math.sqrt(u.a*u.a+u.b*u.b)||1;A.shadowColor=L,A.shadowBlur=R*2*d,A.shadowOffsetX=0,A.shadowOffsetY=0}if(y){const u=g.listBackgroundColor||"rgba(31, 41, 55, 0.4)",d=this.createCanvasFill(A,u,Q,B);A.fillStyle=d||"rgba(31, 41, 55, 0.4)",this.drawListViewRect(A,i,o,Q,B,D),A.fill();const H=A.createLinearGradient(i,o,i+Q,o+B);H.addColorStop(0,"rgba(255, 255, 255, 0.15)"),H.addColorStop(.5,"rgba(255, 255, 255, 0.08)"),H.addColorStop(1,"rgba(255, 255, 255, 0.03)"),A.fillStyle=H,this.drawListViewRect(A,i,o,Q,B,D),A.fill(),A.strokeStyle="rgba(255, 255, 255, 0.25)",A.lineWidth=1,this.drawListViewRect(A,i,o,Q,B,D),A.stroke()}else{const u=g.listBackgroundColor||"transparent",d=this.createCanvasFill(A,u,Q,B);d&&(A.fillStyle=d,this.drawListViewRect(A,i,o,Q,B,D),A.fill());const H=g.borderWidth??0;H>0&&(A.strokeStyle=g.borderColor||"#cccccc",A.lineWidth=H,this.drawListViewRect(A,i,o,Q,B,D),A.stroke())}A.shadowBlur=0,A.save(),this.drawListViewRect(A,i,o,Q,B,D),A.clip();const Y=typeof K=="number"?K:s==="vertical"?K[0]:K[3];let x=(s==="vertical"?o:i)+S+Y;if(A.textBaseline="middle",w.forEach((u,d)=>{const H=s==="vertical"?Q:G,j=s==="vertical"?t:B,SA=s==="vertical"?i:x,O=s==="vertical"?x:o,m=c===d,QA=F===d;if(QA){const AA=this.createCanvasFill(A,e,H,j);A.fillStyle=AA||e;const iA=A.globalAlpha;A.globalAlpha=iA*.8,A.fillRect(SA,O,H,j),A.globalAlpha=iA}else if(m)A.fillStyle=y?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",A.fillRect(SA,O,H,j);else if(k!=="transparent"){const AA=this.createCanvasFill(A,k,H,j);A.fillStyle=AA||k,A.fillRect(SA,O,H,j)}if(QA||m){const AA=this.createCanvasFill(A,e,s==="vertical"?3:H,s==="vertical"?j:3);A.fillStyle=AA||e,s==="vertical"?A.fillRect(SA,O,3,j):A.fillRect(SA,O+j-3,H,3)}const oA=QA?"#ffffff":y?"rgba(255, 255, 255, 0.9)":N;A.fillStyle=oA,A.font=QA||m?"600 14px Inter, sans-serif":"400 14px Inter, sans-serif";const q=typeof u=="string"?u:(u==null?void 0:u.label)||`Item ${d+1}`,v=SA+(s==="vertical"?16:H/2),V=O+j/2;s==="horizontal"?A.textAlign="center":A.textAlign="left",A.fillText(q,v,V),x+=(s==="vertical"?t:G)+a}),A.restore(),g.showScrollbar!==!1){const u=(w.length||0)*(s==="vertical"?t:G)+((w.length||0)-1)*a,d=s==="vertical"?B:Q;if(u>d){const H=d/u,j=d*H,SA=-S/u*d,O=g.scrollbarColor||"rgba(255,255,255,0.3)",m=g.scrollbarWidth||4;A.fillStyle=O,s==="vertical"?A.fillRect(i+Q-m-2,o+SA,m,j):A.fillRect(i+SA,o+B-m-2,j,m)}}A.restore()}updateListViewScrollFromPointer(A){var K,y;if(!this._lastPointerPos||!this._prevPointerPos)return;const I=A.options||{},C=I.orientation||"vertical",g=this._lastPointerPos.x-this._prevPointerPos.x,Q=this._lastPointerPos.y-this._prevPointerPos.y;C==="vertical"?I.scrollOffset=(I.scrollOffset||0)+Q:I.scrollOffset=(I.scrollOffset||0)+g;const B=this.objectStates.get(A.id)||{},i=I.items||[],o=I.itemGap??10,D=I.itemHeight??50,s=I.itemWidth??200,w=B.width!==void 0?B.width:((K=A.geometry)==null?void 0:K.width)||200,a=B.height!==void 0?B.height:((y=A.geometry)==null?void 0:y.height)||300,t=(i.length||0)*(C==="vertical"?D:s)+((i.length||0)-1)*o,S=Math.max(0,t-(C==="vertical"?a:w)+(I.padding*2||0));I.scrollOffset>0&&(I.scrollOffset=0),I.scrollOffset<-S&&(I.scrollOffset=-S)}updateListViewHoverFromPointer(A,I,C){const g=this.getListViewItemIndexAtPointer(A,I,C),Q=A.options||{};Q.hoveredIndex!==g&&(Q.hoveredIndex=g)}getListViewItemIndexAtPointer(A,I,C){var Y,x;const g=A.options||{},Q=this.objectStates.get(A.id)||{},B=g.items||[];if(B.length===0)return null;const i=Q.width!==void 0?Q.width:((Y=A.geometry)==null?void 0:Y.width)||200,o=Q.height!==void 0?Q.height:((x=A.geometry)==null?void 0:x.height)||300,D=g.orientation||"vertical",s=g.itemGap??10,w=g.itemHeight??50,a=g.itemWidth??200,t=g.scrollOffset??0,G=g.padding??0,S=this.getWorldTransform(A.id),K=I-S.x,y=C-S.y,e=-S.rotation*(Math.PI/180),N=Math.cos(e),k=Math.sin(e),c=K*N-y*k,F=K*k+y*N,R=-i/2,J=-o/2,L=typeof G=="number"?G:D==="vertical"?G[0]:G[3];let l=(D==="vertical"?J:R)+t+L;for(let DA=0;DA<B.length;DA++){const hA=D==="vertical"?i:a,W=D==="vertical"?w:o,b=D==="vertical"?R:l,T=D==="vertical"?l:J;if(c>=b&&c<=b+hA&&F>=T&&F<=T+W)return DA;l+=(D==="vertical"?w:a)+s}return null}drawListViewRect(A,I,C,g,Q,B){A.beginPath(),this.drawRoundRect(A,I,C,g,Q,B),A.fill()}solveBehaviors(A){if(!this.artboard)return;if(!this._lastPointerPos){this.frameCount%60;return}const{x:I,y:C}=this._lastPointerPos;this.artboard.objects.forEach(g=>{if(!g.behaviors||g.behaviors.length===0)return;const Q=this.objectStates.get(g.id);Q&&g.behaviors.forEach(B=>{var a,t,G,S,K,y,e,N,k,c,F,R,J,L,l,Y,x,DA,hA,W,b,T,u,d,H,j,SA,O,m,QA,oA,q,v,V,AA,iA,cA,rA,YA,WA,P,wA,Z,p,_,EA,fA,lA,nA,FA,yA,n,bA,_A,VA,xA,sA,kA,uA,UA,tA,HA,gA,$,BA,eA,f,GA,NA,wI,yI,kI,rI,tI,sI,GI,NI;if(!B.enabled)return;const i=B.startTime||0,o=B.endTime||1/0;if(this.currentTime<i||this.currentTime>o)return;const D=Q.x-I,s=Q.y-C,w=Math.sqrt(D*D+s*s);if(this.frameCount%240===0&&Math.random()<.1&&console.log(`[ExodeUI] Executing ${B.type} on ${g.name}`),B.type===X.Proximity){const z=((a=B.settings)==null?void 0:a.radius)||300,IA=((t=B.settings)==null?void 0:t.falloff)||"smooth";let CA=0;w<z&&(IA==="linear"?CA=1-w/z:CA=Math.pow(1-w/z,2)),CA>0&&B.sensors.forEach(dA=>{this.applyBehaviorSensor(Q,dA,CA,A,B.settings,g)})}else if(B.type===X.Magnetic){const z=((G=B.settings)==null?void 0:G.radius)||400,IA=((S=B.settings)==null?void 0:S.strength)||.5;if(w<z&&w>5){const CA=1-w/z,dA=D*CA*IA,aI=s*CA*IA;Q.x-=dA*A*10,Q.y-=aI*A*10}}else if(B.type===X.Repel){const z=((K=B.settings)==null?void 0:K.radius)||300,IA=((y=B.settings)==null?void 0:y.strength)||1;if(w<z){const CA=Math.pow(1-w/z,2);Q.x+=D/(w||1)*CA*60*IA*A*5,Q.y+=s/(w||1)*CA*60*IA*A*5}}else if(B.type===X.Orbit){const z=((e=B.settings)==null?void 0:e.speed)||1,IA=((N=B.settings)==null?void 0:N.radius)||30,CA=this.currentTime*z*Math.PI*2;Q.x+=Math.cos(CA)*IA*A*5,Q.y+=Math.sin(CA)*IA*A*5,Q.rotation+=2*A*5}else if(B.type===X.Vortex){const z=((k=B.settings)==null?void 0:k.radius)||400,IA=((c=B.settings)==null?void 0:c.speed)||2,CA=((F=B.settings)==null?void 0:F.strength)||1;if(w<z){const dA=Math.pow(1-w/z,1.5),aI=this.currentTime*IA*Math.PI*2,rC=Math.cos(aI)*30-D*.4,nC=Math.sin(aI)*30-s*.4;Q.x+=rC*dA*CA*A*5,Q.y+=nC*dA*CA*A*5,Q.rotation+=5*dA*CA*A*5,Q.scale_x*=1-dA*.1*CA*A,Q.scale_y*=1-dA*.1*CA*A}}else if(B.type===X.Fluid){const z=((R=B.settings)==null?void 0:R.radius)||300,IA=((J=B.settings)==null?void 0:J.strength)||1;if(w<z){const CA=Math.pow(1-w/z,1.2),dA=D/(w||1)*CA*1.2*IA,aI=s/(w||1)*CA*1.2*IA;Q.x+=dA*10*A*5,Q.y+=aI*10*A*5,Q.scale_x*=1+CA*.3*IA*A,Q.scale_y*=1+CA*.3*IA*A}}else if(B.type===X.Elastic){const z=((L=B.settings)==null?void 0:L.radius)||300,IA=((l=B.settings)==null?void 0:l.strength)||1;if(w<z){const CA=1-w/z;Q.scale_x*=1+CA*.4*IA*A,Q.scale_y*=1+CA*.4*IA*A}}else if(B.type===X.Holographic){const z=Q.x-this.canvasWidth/2,IA=Q.y-this.canvasHeight/2,CA=((Y=B.settings)==null?void 0:Y.factor)||25;if(Q.x-=z/1e3*CA*A*5,Q.y-=IA/1e3*CA*A*5,Q.style){const dA=1-Math.min(1,w/400);Q.style.exposure=(Q.style.exposure||1)+dA*.5*A}}else if(B.type===X.Sticky){const z=((x=B.settings)==null?void 0:x.radius)||80,IA=((DA=B.settings)==null?void 0:DA.strength)||1;if(w<z){const CA=Math.pow(1-w/z,2);Q.x-=D*CA*IA*A*10,Q.y-=s*CA*IA*A*10,Q.scale_x*=1-CA*.1*IA*A,Q.scale_y*=1-CA*.1*IA*A}}else if(B.type===X.Dilation){const z=((hA=B.settings)==null?void 0:hA.size)||120,IA=((W=B.settings)==null?void 0:W.strength)||1;if(w<z){const CA=1-w/z;Q.scale_x*=1+CA*.5*IA*A,Q.scale_y*=1+CA*.5*IA*A}}else if(B.type===X.Parallax){const z=((b=B.settings)==null?void 0:b.factor)||.05,IA=this.canvasHeight/2,CA=(this._lastPointerPos.y-IA)*z;Q.y+=CA*A*10}else if(B.type===X.Squash){const z=((T=B.settings)==null?void 0:T.strength)||.8;w<(g.width||100)&&this.isMouseDown?(Q.scale_y=this.lerp(Q.scale_y??1,(((u=g.transform)==null?void 0:u.scale_y)??1)*z,.3),Q.scale_x=this.lerp(Q.scale_x??1,(((d=g.transform)==null?void 0:d.scale_x)??1)*(1+(1-z)*.4),.3)):(Q.scale_y=this.lerp(Q.scale_y??1,((H=g.transform)==null?void 0:H.scale_y)??1,.2),Q.scale_x=this.lerp(Q.scale_x??1,((j=g.transform)==null?void 0:j.scale_x)??1,.2))}else if(B.type===X.TextCounter){const z=((SA=B.settings)==null?void 0:SA.duration)||2,IA=((O=B.settings)==null?void 0:O.from)||0,CA=((m=B.settings)==null?void 0:m.to)||100;B._runtimeStart===void 0&&(B._runtimeStart=this.currentTime);const dA=this.currentTime-B._runtimeStart,aI=Math.min(1,dA/z),rC=Math.floor(IA+(CA-IA)*aI);if(((QA=g.geometry)==null?void 0:QA.type)==="Text"){const nC=((oA=B.settings)==null?void 0:oA.prefix)||"",ki=((q=B.settings)==null?void 0:q.suffix)||"";Q.geometry||(Q.geometry={...g.geometry}),Q.geometry.text=`${nC}${rC}${ki}`}}else if(B.type===X.Spotlight){const z=((v=B.settings)==null?void 0:v.radius)||250,IA=((V=B.settings)==null?void 0:V.strength)||1.5;if(w<z){const CA=Math.pow(1-w/z,2);Q.style||(Q.style={...g.style}),Q.style.adjustments||(Q.style.adjustments={...(AA=g.style)==null?void 0:AA.adjustments}),Q.style.adjustments.exposure=(((cA=(iA=g.style)==null?void 0:iA.adjustments)==null?void 0:cA.exposure)||0)+CA*IA*50}else(rA=Q.style)!=null&&rA.adjustments&&(Q.style.adjustments.exposure=this.lerp(Q.style.adjustments.exposure||0,((WA=(YA=g.style)==null?void 0:YA.adjustments)==null?void 0:WA.exposure)||0,.1))}else if(B.type===X.Noise||B.type===X.Float){const z=(((P=B.settings)==null?void 0:P.frequency)||((wA=B.settings)==null?void 0:wA.speed)||1)*.002,IA=(((Z=B.settings)==null?void 0:Z.amplitude)||((p=B.settings)==null?void 0:p.range)||50)*(((_=B.settings)==null?void 0:_.strength)||1),CA=Date.now();Q.x+=Math.sin(CA*z)*IA*A,Q.y+=Math.cos(CA*z*.8)*IA*A,Q.rotation+=Math.sin(CA*z*.5)*5*A}else if(B.type===X.Pulse){const z=(((EA=B.settings)==null?void 0:EA.speed)||1)*.005,IA=(((fA=B.settings)==null?void 0:fA.scale)||1.2)-1,CA=Math.sin(Date.now()*z),dA=((lA=B.settings)==null?void 0:lA.strength)||1;Q.scale_x*=1+CA*IA*dA*A,Q.scale_y*=1+CA*IA*dA*A,Q.style&&(Q.style.exposure=(Q.style.exposure||1)+Math.max(0,CA)*.1*dA*A)}else if(B.type===X.Draggable){const z=((nA=B.settings)==null?void 0:nA.radius)||150,IA=this.draggingBehaviors.has(g.id);if(w<z||IA){const CA=((FA=B.settings)==null?void 0:FA.strength)||1,dA=IA?1:Math.max(0,1-w/z);this.applyBehaviorSensor(Q,II.PositionX,dA*CA,A,B.settings),this.applyBehaviorSensor(Q,II.PositionY,dA*CA,A,B.settings)}}else if(B.type===X.Scroll){const z=((yA=B.settings)==null?void 0:yA.axis)||"vertical",IA=((n=B.settings)==null?void 0:n.factor)||.5,CA=((bA=B.settings)==null?void 0:bA.strength)||1,dA=((_A=B.settings)==null?void 0:_A.scaleFactor)||0;(z==="vertical"||z==="both")&&(Q.y+=this.scrollOffset.y*IA*CA*A),(z==="horizontal"||z==="both")&&(Q.x+=this.scrollOffset.x*IA*CA*A),dA!==0&&(Q.scale_x*=1+this.scrollOffset.y*dA*A,Q.scale_y*=1+this.scrollOffset.y*dA*A)}else if(B.type===X.LookAt){const z=((VA=B.settings)==null?void 0:VA.factor)||1,IA=((xA=B.settings)==null?void 0:xA.strength)||1,CA=Math.atan2(-s,-D)*(180/Math.PI),dA=Q.rotation,aI=(CA-dA+180)%360-180;Q.rotation+=aI*z*IA*A*10}else if(B.type===X.Glint||B.type===X.Scan){const z=(((sA=B.settings)==null?void 0:sA.speed)||1)*.004,IA=((kA=B.settings)==null?void 0:kA.strength)||1,CA=(Math.sin(Date.now()*z)+1)/2;Q.style&&(Q.style.exposure=(Q.style.exposure||1)+CA*IA*A*5),Q.x+=(CA-.5)*20*IA*A}else if(B.type===X.Ratchet){const z=((uA=B.settings)==null?void 0:uA.steps)||12,IA=(((UA=B.settings)==null?void 0:UA.speed)||1)*30,CA=Math.floor(Q.rotation/(360/z))*(360/z);Q.rotation=this.lerp(Q.rotation,CA+IA*A,.1)}else if(B.type===X.Jitter&&w<300){const z=((tA=B.settings)==null?void 0:tA.strength)||1,IA=(((HA=B.settings)==null?void 0:HA.intensity)||5)*z;Q.x+=(Math.random()-.5)*IA*A*60,Q.y+=(Math.random()-.5)*IA*A*60,Q.rotation+=(Math.random()-.5)*IA*A*120}else if(B.type===X.Follower){const z=(gA=B.settings)==null?void 0:gA.targetId;if(z){const IA=this.objectStates.get(z);if(IA){const CA=(($=B.settings)==null?void 0:$.stiffness)||.1,dA=IA.x-Q.x,aI=IA.y-Q.y;Q.x+=dA*CA*A*60,Q.y+=aI*CA*A*60}}}else if(B.type===X.Wrap)Q.x<0?Q.x=this.canvasWidth:Q.x>this.canvasWidth&&(Q.x=0),Q.y<0?Q.y=this.canvasHeight:Q.y>this.canvasHeight&&(Q.y=0);else if(B.type===X.Gravity){const z=((BA=B.settings)==null?void 0:BA.strength)||9.8;Q.y+=z*A*10}else if(B.type===X.Velocity){const z=((eA=B.settings)==null?void 0:eA.vx)||0,IA=((f=B.settings)==null?void 0:f.vy)||0;Q.x+=z*A*10,Q.y+=IA*A*10}else if(B.type===X.Shear){const z=((GA=B.settings)==null?void 0:GA.strength)||1,IA=((NA=B.settings)==null?void 0:NA.radius)||300;if(w<IA){const CA=1-w/IA;Q.skew_x=this.lerp(Q.skew_x||0,(((wI=g.transform)==null?void 0:wI.skew_x)||0)+CA*z*30,.1)}else Q.skew_x=this.lerp(Q.skew_x||0,((yI=g.transform)==null?void 0:yI.skew_x)||0,.05)}else if(B.type===X.Lens){const z=((kI=B.settings)==null?void 0:kI.radius)||200,IA=((rI=B.settings)==null?void 0:rI.strength)||.5;if(w<z){const CA=Math.pow(1-w/z,2);Q.scale_x=this.lerp(Q.scale_x??1,(((tI=g.transform)==null?void 0:tI.scale_x)??1)*(1+CA*IA),.2),Q.scale_y=this.lerp(Q.scale_y??1,(((sI=g.transform)==null?void 0:sI.scale_y)??1)*(1+CA*IA),.2)}else Q.scale_x=this.lerp(Q.scale_x??1,((GI=g.transform)==null?void 0:GI.scale_x)??1,.1),Q.scale_y=this.lerp(Q.scale_y??1,((NI=g.transform)==null?void 0:NI.scale_y)??1,.1)}})})}applyBehaviorSensor(A,I,C,g,Q,B){var D,s,w,a,t,G,S,K,y;const i=(Q==null?void 0:Q.intensity)||(Q==null?void 0:Q.strength)||1,o=C*i*g;switch(I){case II.Scale:A.scale_x*=1+o*.5,A.scale_y*=1+o*.5;break;case II.Opacity:A.opacity=Math.max(0,Math.min(100,A.opacity-o*100));break;case II.RotateZ:A.rotation+=o*180;break;case II.RotateX:A.rotate_x=(A.rotate_x||0)+o*180;break;case II.RotateY:A.rotate_y=(A.rotate_y||0)+o*180;break;case II.PositionX:A.x+=o*300;break;case II.PositionY:A.y+=o*300;break;case II.SkewX:A.skew_x=(A.skew_x||0)+o*45;break;case II.Blur:A.style||(A.style={...B.style}),A.style.blur||(A.style.blur={...(D=B.style)==null?void 0:D.blur}),A.style.blur.amount=(((w=(s=B.style)==null?void 0:s.blur)==null?void 0:w.amount)||0)+C*((Q==null?void 0:Q.blur)||50)*i;break;case II.Exposure:A.style||(A.style={...B.style}),A.style.adjustments||(A.style.adjustments={...(a=B.style)==null?void 0:a.adjustments}),A.style.adjustments.exposure=(((G=(t=B.style)==null?void 0:t.adjustments)==null?void 0:G.exposure)||0)+C*((Q==null?void 0:Q.exposure)||50)*i;break;case II.HueShift:A.style||(A.style={...B.style}),A.style.adjustments||(A.style.adjustments={...(S=B.style)==null?void 0:S.adjustments}),A.style.adjustments.hue=(((y=(K=B.style)==null?void 0:K.adjustments)==null?void 0:y.hue)||0)+C*((Q==null?void 0:Q.hue)||180)*i;break;case II.CornerRadius:A.corner_radius=Math.min(200,(A.corner_radius||0)+o*100);break;case II.LetterSpacing:A.geometry||(A.geometry={}),A.geometry.letterSpacing=(A.geometry.letterSpacing||0)+o*10;break}}lerp(A,I,C){return A*(1-C)+I*C}deepMerge(A,I){if(!A)return I;if(!I)return A;if(typeof A!="object"||typeof I!="object"||A===null||I===null)return I;const C={...A};for(const g in I)Object.prototype.hasOwnProperty.call(I,g)&&(I[g]&&typeof I[g]=="object"&&!Array.isArray(I[g])?C[g]=this.deepMerge(A[g],I[g]):C[g]=I[g]);return C}renderFittedImage(A,I,C,g,Q,B,i="cover"){const o=I.naturalWidth,D=I.naturalHeight,s=o/D,w=Q/B;let a=Q,t=B,G=C,S=g;i==="cover"?s>w?(a=B*s,G=C-(a-Q)/2):(t=Q/s,S=g-(t-B)/2):i==="contain"&&(s>w?(t=Q/s,S=g+(B-t)/2):(a=B*s,G=C+(Q-a)/2)),A.drawImage(I,G,S,a,t)}}const iB=({artboard:E,config:A})=>{const I={...E.seo,...A},C=I.enableSmartExtraction!==!1;RA.useEffect(()=>{const i=I.title||E.name;i&&(document.title=i);let o=I.description;if(!o&&C){const w=E.objects.filter(a=>{var t;return((t=a.geometry)==null?void 0:t.type)==="Text"}).sort((a,t)=>{var G,S;return(((G=t.geometry.text)==null?void 0:G.length)||0)-(((S=a.geometry.text)==null?void 0:S.length)||0)});w.length>0&&(o=w[0].geometry.text)}o&&(g("name","description",o),g("property","og:description",o)),I.keywords&&I.keywords.length>0&&g("name","keywords",I.keywords.join(", "));const D=I.ogImage||E.backgroundImage;D&&g("property","og:image",D),i&&g("property","og:title",i),g("property","og:type","website")},[I,E,C]);const g=(i,o,D)=>{let s=document.querySelector(`meta[${i}="${o}"]`);s||(s=document.createElement("meta"),s.setAttribute(i,o),document.head.appendChild(s)),s.setAttribute("content",D)},Q=()=>{const i=[];return i.push(vA.jsx("h1",{children:I.title||E.name},"artboard-title")),E.objects.forEach((D,s)=>{var w,a;if(!(!D.visible&&D.isVisible!==!0))if(((w=D.geometry)==null?void 0:w.type)==="Text"){const t=D.geometry.text;t&&(D.geometry.fontSize>24?i.push(vA.jsx("h2",{children:t},D.id||s)):i.push(vA.jsx("p",{children:t},D.id||s)))}else if(((a=D.geometry)==null?void 0:a.type)==="Image"){const t=D.geometry.src,G=D.altText||D.name||"Illustration";i.push(vA.jsx("img",{src:t,alt:G},D.id||s))}else D.type==="Button"&&i.push(vA.jsx("button",{children:D.name||"Button"},D.id||s))}),i},B=I.jsonLd||{"@context":"https://schema.org","@type":"VisualArtwork",name:I.title||E.name,description:I.description,image:I.ogImage||E.backgroundImage,abstract:"Animated interface created with ExodeUI"};return vA.jsxs("div",{id:`exode-seo-${E.id||"default"}`,"aria-hidden":"false",style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0",zIndex:-1},children:[Q(),vA.jsx("script",{type:"application/ld+json",children:JSON.stringify(B)})]})},Si=RA.forwardRef(({artboard:E,src:A,className:I,style:C,autoPlay:g=!0,fit:Q="Contain",alignment:B="Center",enableSEO:i=!0,seo:o,onReady:D,onTrigger:s,onInputUpdate:w,onComponentChange:a,onToggle:t,onInputChange:G,onInputFocus:S,onInputBlur:K,onLog:y,onLogicUpdate:e,onButtonClick:N,onGraphPointClick:k,currentTime:c,revision:F=0,scrollY:R,scrollX:J,mouseX:L,mouseY:l,isMouseDown:Y,inputs:x,interactive:DA=!0},hA)=>{const W=RA.useRef(null),b=RA.useRef(new EB),T=RA.useRef(void 0),u=RA.useRef(0),d=RA.useRef(null),H=RA.useRef(F),[j,SA]=RA.useState(E||null);RA.useImperativeHandle(hA,()=>W.current),RA.useEffect(()=>{console.log("[ExodeUI] Layout Effect - Component Updated/Mounted"),b.current.setLayout(Q,B)},[Q,B]),RA.useEffect(()=>{s&&b.current.setTriggerCallback(s)},[s]),RA.useEffect(()=>{w&&b.current.setInputUpdateCallback(w)},[w]),RA.useEffect(()=>{a&&b.current.setComponentChangeCallback(a)},[a]),RA.useEffect(()=>{t&&b.current.setToggleCallback(t)},[t]),RA.useEffect(()=>{G&&b.current.setInputChangeCallback(G)},[G]),RA.useEffect(()=>{S&&b.current.setInputFocusCallback(S)},[S]),RA.useEffect(()=>{K&&b.current.setInputBlurCallback(K)},[K]),RA.useEffect(()=>{e&&b.current.setLogicUpdateCallback(e)},[e]),RA.useEffect(()=>{N&&b.current.setButtonClickCallback(N)},[N]),RA.useEffect(()=>{k&&b.current.setGraphPointClickCallback(k)},[k]),RA.useEffect(()=>{(async()=>{let QA=E;if(!QA&&A)try{const q=await(await fetch(A)).text();if(!q.trim().startsWith("{")&&!q.trim().startsWith("["))try{const v=BB.decompressFromBase64(q.trim());v&&(QA=JSON.parse(v))}catch{console.warn("[ExodeUI] File is not standard JSON, and decompression failed.")}if(!QA&&q)try{QA=JSON.parse(q)}catch(v){console.error("[ExodeUI] Failed to parse JSON content:",v)}}catch(oA){console.error("Failed to load ExodeUI animation:",oA);return}if(QA){const oA=new Set;QA.objects&&QA.objects.forEach(V=>{var AA;((AA=V.geometry)==null?void 0:AA.type)==="Text"&&(V.geometry.fontFamily&&oA.add(V.geometry.fontFamily),V.geometry.segments&&V.geometry.segments.forEach(iA=>{iA.fontFamily&&oA.add(iA.fontFamily)}))}),oA.forEach(V=>{const AA=`exode-font-${V.replace(/\s+/g,"-").toLowerCase()}`;if(!document.getElementById(AA)){const iA=document.createElement("link");iA.id=AA,iA.rel="stylesheet";const cA=V.replace(/\s+/g,"+");iA.href=`https://fonts.googleapis.com/css2?family=${cA}:wght@100;200;300;400;500;600;700;800;900&display=swap`,document.head.appendChild(iA),console.log(`[ExodeUI] Loading dynamic font: ${V}`)}});const q=b.current,v=QA.id||QA.name||"default";(d.current!==v||H.current!==F)&&(q.load(QA),d.current=v,H.current=F,SA(QA),u.current=0,q.advance(0)),D&&D(q)}})()},[E,A,F]),RA.useEffect(()=>{c!==void 0&&b.current.seek(c)},[c]),RA.useEffect(()=>{const m=b.current;R!==void 0&&m.updateInput("scrollY",R),J!==void 0&&m.updateInput("scrollX",J),L!==void 0&&m.updateInput("mouseX",L),l!==void 0&&m.updateInput("mouseY",l),Y!==void 0&&m.updateInput("isMouseDown",Y),x&&Object.entries(x).forEach(([QA,oA])=>{m.updateInput(QA,oA)})},[R,J,L,l,Y,x]),RA.useEffect(()=>{const m=b.current,QA=W.current;if(!QA)return;u.current=0;const oA=QA.getContext("2d");if(!oA)return;oA.imageSmoothingEnabled=!0,oA.imageSmoothingQuality="high",y&&m.setOnLogCallback(y);const q=V=>{u.current||(u.current=V);const AA=(V-u.current)/1e3;u.current=V,g&&m.advance(AA);const iA=window.devicePixelRatio||1,cA=QA.getBoundingClientRect(),rA=Math.floor(cA.width*iA),YA=Math.floor(cA.height*iA);(QA.width!==rA||QA.height!==YA)&&(QA.width=rA,QA.height=YA),oA.imageSmoothingEnabled=!0,oA.imageSmoothingQuality="high",m.render(oA,rA,YA),T.current=requestAnimationFrame(q)};T.current=requestAnimationFrame(q);const v=()=>{m.handleScroll(window.scrollX,window.scrollY)};return window.addEventListener("scroll",v,{passive:!0}),()=>{T.current&&cancelAnimationFrame(T.current),window.removeEventListener("scroll",v)}},[g]);const O=(m,QA)=>{const oA=m.currentTarget.getBoundingClientRect(),q=m.clientX-oA.left,v=m.clientY-oA.top,V=oA.width,AA=oA.height;DA&&b.current.handlePointerInput(QA,q,v,V,AA)};return vA.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",...C},className:I,children:[vA.jsx("canvas",{ref:W,style:{width:"100%",height:"100%",outline:"none"},tabIndex:0,onPointerDown:m=>{var QA;O(m,"down"),(QA=W.current)==null||QA.focus()},onPointerUp:m=>O(m,"up"),onPointerMove:m=>O(m,"move"),onPointerLeave:m=>O(m,"blur"),onClick:m=>O(m,"click"),onKeyDown:m=>{m.key==="Backspace"||m.key==="Enter"||m.key,b.current.handleKeyDown(m.nativeEvent)},onWheel:m=>{DA&&b.current.handleWheel(m.deltaX,m.deltaY)}}),i&&j&&vA.jsx(iB,{artboard:j,config:o})]})});function Ki(){const[E,A]=RA.useState(null),I=RA.useCallback((w,a)=>{E==null||E.setInputBool(w,a)},[E]),C=RA.useCallback((w,a)=>{E==null||E.setInputNumber(w,a)},[E]),g=RA.useCallback(w=>{E==null||E.fireTrigger(w)},[E]),Q=RA.useCallback((w,a)=>{E==null||E.setInputText(w,a)},[E]),B=RA.useCallback((w,a)=>{E==null||E.setInputNumberArray(w,a)},[E]),i=RA.useCallback((w,a)=>{E==null||E.setInputStringArray(w,a)},[E]),o=RA.useCallback((w,a)=>{E==null||E.updateObjectOptions(w,a)},[E]),D=RA.useCallback((w,a,t)=>{E==null||E.updateConstraint(w,a,t)},[E]),s=RA.useCallback((w,a)=>{E==null||E.updateGraphData(w,a)},[E]);return{setEngine:A,engine:E,setInputBool:I,setInputNumber:C,fireTrigger:g,setInputText:Q,setInputNumberArray:B,setInputStringArray:i,updateConstraint:D,updateGraphData:s,updateObjectOptions:o}}const yi={version:"6.3.6"}.version;XA.BehaviorSensor=II,XA.BehaviorType=X,XA.ConditionOp=lC,XA.ExodeSEO=iB,XA.ExodeUICanvas=Si,XA.ExodeUIEngine=EB,XA.LogicOp=JA,XA.VERSION=yi,XA.useExodeUI=Ki,Object.defineProperty(XA,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -10587,7 +10587,7 @@ function li() {
|
|
|
10587
10587
|
updateObjectOptions: o
|
|
10588
10588
|
};
|
|
10589
10589
|
}
|
|
10590
|
-
const Mi = "6.
|
|
10590
|
+
const Mi = "6.3.6", Ji = {
|
|
10591
10591
|
version: Mi
|
|
10592
10592
|
}, Yi = Ji.version;
|
|
10593
10593
|
export {
|