@glissade/browser 0.19.0-pre.3 → 0.19.0-pre.4
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/glissade.api.json +1 -1
- package/dist/glissade.browser.js +4 -4
- package/dist/glissade.browser.js.map +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +6 -6
package/dist/glissade.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var glissade=(()=>{var $t=Object.defineProperty,Zi=Object.defineProperties,eo=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyDescriptors,no=Object.getOwnPropertyNames,It=Object.getOwnPropertySymbols;var Tn=Object.prototype.hasOwnProperty,Us=Object.prototype.propertyIsEnumerable;var Xs=e=>{throw TypeError(e)};var Mn=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))Tn.call(t,n)&&Mn(e,n,t[n]);if(It)for(var n of It(t))Us.call(t,n)&&Mn(e,n,t[n]);return e},L=(e,t)=>Zi(e,to(t));var Gs=e=>typeof e=="symbol"?e:e+"",Ve=(e,t)=>{var n={};for(var s in e)Tn.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&It)for(var s of It(e))t.indexOf(s)<0&&Us.call(e,s)&&(n[s]=e[s]);return n};var so=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},ro=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of no(t))!Tn.call(e,r)&&r!==n&&$t(e,r,{get:()=>t[r],enumerable:!(s=eo(t,r))||s.enumerable});return e};var io=e=>ro($t({},"__esModule",{value:!0}),e);var S=(e,t,n)=>Mn(e,typeof t!="symbol"?t+"":t,n),En=(e,t,n)=>t.has(e)||Xs("Cannot "+n);var F=(e,t,n)=>(En(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?Xs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Y=(e,t,n,s)=>(En(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),_=(e,t,n)=>(En(e,t,"access private method"),n);var gc={};so(gc,{ALL_FILTER_KINDS:()=>Ds,BakeError:()=>Qt,BindTypeMismatchError:()=>zr,Canvas2DBackend:()=>Le,Circle:()=>dn,CircularDependencyError:()=>Er,ClipError:()=>le,ColdAssetError:()=>xt,ColorParseError:()=>Rn,Custom:()=>ri,DEFAULT_EASE:()=>sr,DL_SNAPSHOT_VERSION:()=>Qr,DeterminismViolationError:()=>vi,DlSnapshotError:()=>sn,DuplicateNodeIdError:()=>ki,EachError:()=>Ke,FilterValidationError:()=>Re,FollowPath:()=>Ti,FontValidationError:()=>Ar,Group:()=>re,GsPlayerElement:()=>Gi,Highlight:()=>yi,IDENTITY:()=>Ie,Image:()=>pn,ImageNode:()=>pn,LayoutEngineMissingError:()=>Is,MEASURE_QUANTUM_PX:()=>rn,MESH_DOWNSCALE:()=>Ea,MESH_SHEPARD_POWER:()=>Ia,MESH_SIGMA:()=>Ps,MorphError:()=>Qe,NODE_TAXONOMY:()=>Go,Node:()=>Z,Path:()=>vt,PositionError:()=>rs,PresenceError:()=>Bs,Raster2D:()=>Rs,Rect:()=>fn,ReservedNodeIdError:()=>xi,ShaderEffect:()=>va,SidecarVersionError:()=>Zn,SketchValidationError:()=>ge,TARGET_PATH:()=>Pe,TargetOverlapError:()=>Hi,Text:()=>Ge,TextCursor:()=>wi,TimelineValidationError:()=>X,TokenHighlight:()=>Ei,TokenMatchError:()=>Mt,TrackValidationError:()=>xe,UnboundTargetError:()=>Nr,UnknownEasingError:()=>Pn,UnknownValueTypeError:()=>Ln,UnresolvableTargetError:()=>Lt,ValueTypeInferenceError:()=>Hn,Video:()=>mn,WriteDuringEvaluationError:()=>Gt,__resetEstimateWarnings:()=>si,applyToPoint:()=>Gr,arcLength:()=>vs,assignKeyIds:()=>ts,audioOffsetSamples:()=>mr,auditCacheCold:()=>ha,bake:()=>Vo,bakeCheckpointed:()=>_o,batch:()=>Co,beginReadPhase:()=>Ir,bindScene:()=>Mi,bindTimeline:()=>cs,booleanType:()=>qn,breakLines:()=>se,buildFontRegistry:()=>pt,buildTimeline:()=>Lr,clip:()=>be,clipList:()=>Ba,clockDriver:()=>ji,coercePathData:()=>on,collapseReplacer:()=>Ue,collectLocalizedTextUsages:()=>ba,collectTextUsages:()=>Ii,colorType:()=>Vn,compileTimeline:()=>ne,computed:()=>dt,createDisplayListBuilder:()=>wt,createPlayer:()=>Yi,createPlayhead:()=>Zt,createScene:()=>la,cubicBezier:()=>On,cubicBezierDerivative:()=>An,defineGsPlayer:()=>Ji,deleteSidecarTrack:()=>kr,describe:()=>fc,diffDisplayLists:()=>gs,drawOn:()=>bi,drawOnEach:()=>oa,driftLoop:()=>Wa,each:()=>ia,easingDerivatives:()=>Ft,easings:()=>ot,emitDevWarning:()=>q,emptySidecar:()=>br,endReadPhase:()=>$r,estimatingMeasurer:()=>ln,evaluate:()=>we,evaluateAt:()=>ls,filtersToCanvasFilter:()=>an,flatten:()=>bt,followPath:()=>ma,fontString:()=>bn,formatColor:()=>zt,formatDisplayDiff:()=>Kr,fromTRS:()=>ms,getLayoutEngine:()=>ai,getTimelineCallbacks:()=>Rr,getValueType:()=>ct,glow:()=>ei,hachureLines:()=>xs,hashKeys:()=>Yt,highlight:()=>Ko,inReadPhase:()=>Oo,inferValueType:()=>Ae,invert:()=>Xr,isDurationEditable:()=>yr,isEditableNodeId:()=>ut,isEstimatingMeasurer:()=>Ms,isExemptFamily:()=>Pr,key:()=>O,lerpColor:()=>he,listValueTypes:()=>Vt,matEquals:()=>Ee,matchTokenRun:()=>As,mediaPrefersReducedMotion:()=>Xi,mergeSidecar:()=>xr,mergeSidecarDetailed:()=>ns,meshRasterSize:()=>Ci,migrateSidecar:()=>es,morph:()=>ja,motionPath:()=>St,mount:()=>qs,multiply:()=>gt,namedEasing:()=>rt,normalizeEditedKeys:()=>Sr,numberType:()=>Nn,oklabToRgba:()=>qe,paintType:()=>jn,parseCmap:()=>Ht,parseColor:()=>de,parseDisplaySnapshot:()=>Zr,parseSvgPathData:()=>Vi,pathFromSegs:()=>hn,pathFromSvg:()=>ec,pathLength:()=>da,pathType:()=>Wn,planReducedMotion:()=>Ui,pointAtLength:()=>pa,popIn:()=>Va,presence:()=>Za,pulse:()=>qa,quantize:()=>U,random:()=>ce,rasterizeMesh:()=>$i,registerValueType:()=>ae,renderToDataURL:()=>Pi,reprOf:()=>_t,requireLayoutEngine:()=>ci,resolveAnchor:()=>Ts,resolveEase:()=>Yn,resolveEaseDerivative:()=>Un,resolveSketch:()=>bs,resolveTweenTarget:()=>Se,revealSchedule:()=>ii,rgbaToOklab:()=>Oe,roughen:()=>cn,roundedRectSegs:()=>Xe,sampleTrack:()=>jt,scrollDriver:()=>dc,segmentGraphemes:()=>ye,segmentWords:()=>un,serializeDisplayList:()=>Jr,setDefaultMeasurer:()=>ni,setDevWarning:()=>cr,setLayoutEngine:()=>oi,setScheduler:()=>To,setShaderRunner:()=>Ai,setSidecarTrack:()=>vr,signal:()=>A,sketchStrokes:()=>ti,slideIn:()=>_a,snapshotCanvas:()=>Ls,spring:()=>fe,springEasing:()=>Dn,springEasingDerivative:()=>Fn,springPresets:()=>or,springTo:()=>ur,stagger:()=>Wt,stringType:()=>_n,swapOnHmr:()=>pc,synchronousScheduler:()=>is,targetNodeId:()=>We,textCursor:()=>Qo,timeline:()=>Bo,tokenHighlight:()=>ga,track:()=>pe,transitionToClip:()=>zi,typewriter:()=>ea,untracked:()=>Ao,validateFilters:()=>ys,validateFonts:()=>as,validateHachure:()=>ks,validateSceneFonts:()=>Fs,validateSketch:()=>ws,validateTrack:()=>lt,vec2ArcType:()=>Bn,vec2Equals:()=>qt,vec2Signal:()=>He,vec2Type:()=>zn,velocityAt:()=>Xn,withDeterminismGuards:()=>ca});var Pt=2.5949095,Dt=2.70158,_e=2*Math.PI/3,st=2*Math.PI/4.5;function Ct(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}var ot={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInCubic:e=>e**3,easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeInQuart:e=>e**4,easeOutQuart:e=>1-(1-e)**4,easeInOutQuart:e=>e<.5?8*e**4:1-(-2*e+2)**4/2,easeInQuint:e=>e**5,easeOutQuint:e=>1-(1-e)**5,easeInOutQuint:e=>e<.5?16*e**5:1-(-2*e+2)**5/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:2**(10*e-10),easeOutExpo:e=>e===1?1:1-2**(-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-e*e),easeOutCirc:e=>Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,easeInBack:e=>Dt*e**3-1.70158*e*e,easeOutBack:e=>1+Dt*(e-1)**3+1.70158*(e-1)**2,easeInOutBack:e=>e<.5?(2*e)**2*(3.5949095*2*e-Pt)/2:((2*e-2)**2*(3.5949095*(e*2-2)+Pt)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*_e),easeOutElastic:e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*_e)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*st))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*st)/2+1,easeInBounce:e=>1-Ct(1-e),easeOutBounce:Ct,easeInOutBounce:e=>e<.5?(1-Ct(1-2*e))/2:(1+Ct(2*e-1))/2};function Ot(e){return e<1/2.75?2*7.5625*e:e<2/2.75?2*7.5625*(e-1.5/2.75):e<2.5/2.75?2*7.5625*(e-2.25/2.75):2*7.5625*(e-2.625/2.75)}var ke=Math.LN2,Ft={linear:()=>1,easeInQuad:e=>2*e,easeOutQuad:e=>2*(1-e),easeInOutQuad:e=>e<.5?4*e:4*(1-e),easeInCubic:e=>3*e**2,easeOutCubic:e=>3*(1-e)**2,easeInOutCubic:e=>e<.5?12*e**2:12*(1-e)**2,easeInQuart:e=>4*e**3,easeOutQuart:e=>4*(1-e)**3,easeInOutQuart:e=>e<.5?32*e**3:32*(1-e)**3,easeInQuint:e=>5*e**4,easeOutQuint:e=>5*(1-e)**4,easeInOutQuint:e=>e<.5?80*e**4:80*(1-e)**4,easeInSine:e=>Math.PI/2*Math.sin(e*Math.PI/2),easeOutSine:e=>Math.PI/2*Math.cos(e*Math.PI/2),easeInOutSine:e=>Math.PI/2*Math.sin(Math.PI*e),easeInExpo:e=>e===0?0:10*ke*2**(10*e-10),easeOutExpo:e=>e===1?0:10*ke*2**(-10*e),easeInOutExpo:e=>e===0||e===1?0:e<.5?10*ke*2**(20*e-10):10*ke*2**(-20*e+10),easeInCirc:e=>e/Math.sqrt(1-e*e),easeOutCirc:e=>(1-e)/Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?2*e/Math.sqrt(1-4*e*e):(2-2*e)/Math.sqrt(1-(-2*e+2)**2),easeInBack:e=>3*Dt*e**2-2*1.70158*e,easeOutBack:e=>3*Dt*(e-1)**2+2*1.70158*(e-1),easeInOutBack:e=>e<.5?12*3.5949095*e**2-4*Pt*e:3*3.5949095*(2*e-2)**2+2*Pt*(2*e-2),easeInElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-10.75)*_e,n=2**(10*e-10);return-(10*ke*n*Math.sin(t)+n*10*_e*Math.cos(t))},easeOutElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-.75)*_e,n=2**(-10*e);return-10*ke*n*Math.sin(t)+n*10*_e*Math.cos(t)},easeInOutElastic:e=>{if(e===0||e===1)return 0;let t=(20*e-11.125)*st;if(e<.5){let s=2**(20*e-10);return-(20*ke*s*Math.sin(t)+s*20*st*Math.cos(t))/2}let n=2**(-20*e+10);return(-20*ke*n*Math.sin(t)+n*20*st*Math.cos(t))/2},easeInBounce:e=>Ot(1-e),easeOutBounce:Ot,easeInOutBounce:e=>e<.5?Ot(1-2*e):Ot(2*e-1)},sr="easeInOutCubic";function rr(e,t,n,s){let r=3*e-3*n+1,i=3*n-6*e,o=3*e,a=3*t-3*s+1,l=3*s-6*t,c=3*t,u=m=>((r*m+i)*m+o)*m,h=m=>((a*m+l)*m+c)*m,f=m=>(3*r*m+2*i)*m+o;return{sampleY:h,sampleDX:f,sampleDY:m=>(3*a*m+2*l)*m+c,solveU:m=>{let v=m;for(let p=0;p<8;p++){let b=u(v)-m;if(Math.abs(b)<1e-7)return v;let k=f(v);if(Math.abs(k)<1e-6)break;v-=b/k}let T=0,y=1;for(v=m;y-T>1e-7;)u(v)<m?T=v:y=v,v=(T+y)/2;return v}}}function On(e,t,n,s){let r=rr(e,t,n,s);return i=>i<=0?0:i>=1?1:r.sampleY(r.solveU(i))}function An(e,t,n,s){let r=rr(e,t,n,s);return i=>{let o=r.solveU(Math.min(1,Math.max(0,i))),a=r.sampleDX(o);return Math.abs(a)<1e-9?0:r.sampleDY(o)/a}}var Pn=class extends Error{constructor(e){super(`unknown easing '${e}'; register it via easings or use cubicBezier/spring`),this.name="UnknownEasingError"}};function rt(e){let t=ot[e];if(!t)throw new Pn(e);return t}var oo=.005;function at(e){var n;let t=(n=e.mass)!=null?n:1;if(!(e.stiffness>0)||!(e.damping>0)||!(t>0))throw new RangeError("spring stiffness, damping, and mass must all be > 0");return{w0:Math.sqrt(e.stiffness/t),zeta:e.damping/(2*Math.sqrt(e.stiffness*t))}}function ao(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=at(e);if(Math.abs(s-1)<1e-9)return n*n*t*Math.exp(-n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return Math.exp(-s*n*t)*(n*n/a)*Math.sin(a*t)}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return i*o*(Math.exp(i*t)-Math.exp(o*t))/(i-o)}function it(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=at(e);if(Math.abs(s-1)<1e-9)return 1-Math.exp(-n*t)*(1+n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return 1-Math.exp(-s*n*t)*(Math.cos(a*t)+s*n/a*Math.sin(a*t))}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return 1+(o*Math.exp(i*t)-i*Math.exp(o*t))/(i-o)}function Nt(e,t){var a;let n=(a=t==null?void 0:t.settleTolerance)!=null?a:oo,{w0:s,zeta:r}=at(e);if(r<1){let l=s*Math.sqrt(1-r*r),c=Math.sqrt(1+(r*s/l)**2);return Math.log(c/n)/(r*s)}let i=1/s;for(;1-it(e,i)>n;)i*=2;let o=0;for(let l=0;l<64&&i-o>1e-9;l++){let c=(o+i)/2;1-it(e,c)>n?o=c:i=c}return i}function ir(e,t,n){let s=Nt(e,n);return it(e,Math.min(t,s))/it(e,s)}function co(e,t,n){let{w0:s,zeta:r}=at(e),i,o,a;if(Math.abs(r-1)<1e-9){let c=n+s*t;i=u=>u<=0?t:Math.exp(-s*u)*(t+c*u),o=u=>u<=0?n:Math.exp(-s*u)*(n-s*c*u),a=u=>Math.exp(-s*u)*(Math.abs(t)+Math.abs(c)*u)}else if(r<1){let c=s*Math.sqrt(1-r*r),u=(n+r*s*t)/c,h=Math.hypot(t,u);i=f=>f<=0?t:Math.exp(-r*s*f)*(t*Math.cos(c*f)+u*Math.sin(c*f)),o=f=>f<=0?n:Math.exp(-r*s*f)*(n*Math.cos(c*f)-(s*s*t+r*s*n)/c*Math.sin(c*f)),a=f=>Math.exp(-r*s*f)*h}else{let c=Math.sqrt(r*r-1),u=s*(-r+c),h=s*(-r-c),f=(n-h*t)/(u-h),d=(u*t-n)/(u-h);i=g=>g<=0?t:f*Math.exp(u*g)+d*Math.exp(h*g),o=g=>g<=0?n:f*u*Math.exp(u*g)+d*h*Math.exp(h*g),a=g=>Math.abs(f)*Math.exp(u*g)+Math.abs(d)*Math.exp(h*g)}return{value:i,velocity:o,settleTime:c=>{let u=c!=null?c:Math.abs(t)*.005+1e-6;if(a(0)<=u&&Math.abs(n)<1e-12)return 0;let h=1/s,f=0;for(;a(h)>u&&f++<64;)h*=2;let d=0;for(let g=0;g<64&&h-d>1e-9;g++){let m=(d+h)/2;Math.max(a(m),a(m*1.05+1e-6))>u?d=m:h=m}return h}}}var fe=Object.assign(e=>{var t;return at(e),{kind:"spring",stiffness:e.stiffness,damping:e.damping,mass:(t=e.mass)!=null?t:1}},{duration:Nt,value:ir,retarget:co}),or={default:{stiffness:170,damping:26},gentle:{stiffness:120,damping:14},wobbly:{stiffness:180,damping:12},stiff:{stiffness:210,damping:20},slow:{stiffness:280,damping:60},molasses:{stiffness:280,damping:120}};function Dn(e){let t=Nt(e);return n=>ir(e,n*t)}function Fn(e){let t=Nt(e),n=t/it(e,t);return s=>s>=1?0:ao(e,s*t)*n}var ar=e=>{var t;(t=globalThis.console)==null||t.warn(`[glissade] ${e}`)};function cr(e){ar=e}function q(e){ar(e)}var lo=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,uo=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i,Rn=class extends Error{constructor(e){super(`cannot parse color '${e}' (supported: #rgb[a], #rrggbb[aa], rgb()/rgba())`),this.name="ColorParseError"}};function de(e){let t=lo.exec(e);if(t){let s=t[1];s.length<=4&&(s=[...s].map(i=>i+i).join(""));let r=parseInt(s,16);return s.length===6?{r:r>>16,g:r>>8&255,b:r&255,a:1}:{r:r>>>24&255,g:r>>>16&255,b:r>>>8&255,a:(r&255)/255}}let n=uo.exec(e);if(n){let s=n[4],r=s===void 0?1:s.endsWith("%")?parseFloat(s)/100:parseFloat(s);return{r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:r}}throw new Rn(e)}function zt(e){let t=i=>Math.min(255,Math.max(0,Math.round(i))),n=i=>t(i).toString(16).padStart(2,"0"),s=`#${n(e.r)}${n(e.g)}${n(e.b)}`,r=Math.min(1,Math.max(0,e.a));return r>=1?s:`${s}${n(r*255)}`}function In(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function $n(e){return(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*255}function Oe(e){let t=In(e.r),n=In(e.g),s=In(e.b),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*s);return{L:.2104542553*r+.793617785*i-.0040720468*o,a:1.9779984951*r-2.428592205*i+.4505937099*o,b:.0259040371*r+.7827717662*i-.808675766*o,alpha:e.a}}function qe(e){let t=(e.L+.3963377774*e.a+.2158037573*e.b)**3,n=(e.L-.1055613458*e.a-.0638541728*e.b)**3,s=(e.L-.0894841775*e.a-1.291485548*e.b)**3;return{r:$n(4.0767416621*t-3.3077115913*n+.2309699292*s),g:$n(-1.2684380046*t+2.6097574011*n-.3413193965*s),b:$n(-.0041960863*t-.7034186147*n+1.707614701*s),a:e.alpha}}function he(e,t,n){let s=Oe(de(e)),r=Oe(de(t)),i=(o,a)=>o+(a-o)*n;return zt(qe({L:i(s.L,r.L),a:i(s.a,r.a),b:i(s.b,r.b),alpha:i(s.alpha,r.alpha)}))}var Bt=new Map;function ae(e){Bt.set(e.id,e)}var Ln=class extends Error{constructor(e){super(`unknown value type '${e}'; register it via registerValueType()`),this.name="UnknownValueTypeError"}};function ct(e){let t=Bt.get(e);if(!t)throw new Ln(e);return t}function Vt(){return[...Bt.keys()]}function _t(e){var t,n;return(n=(t=Bt.get(e))==null?void 0:t.repr)!=null?n:e}var Nn={id:"number",lerp:(e,t,n)=>e+(t-e)*n,extrapolates:!0,equals:Object.is,add:(e,t)=>e+t,sub:(e,t)=>e-t,scale:(e,t)=>e*t,defaultHandoff:"spring"},qt=(e,t)=>e[0]===t[0]&&e[1]===t[1],zn={id:"vec2",lerp:(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],extrapolates:!0,equals:qt,add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],scale:(e,t)=>[e[0]*t,e[1]*t],defaultHandoff:"spring"},Bn={id:"vec2-arc",repr:"vec2",lerp:(e,t,n)=>{let s=Math.hypot(e[0],e[1]),r=Math.hypot(t[0],t[1]),i=Math.atan2(e[1],e[0]),o=Math.atan2(t[1],t[0])-i;for(;o>Math.PI;)o-=2*Math.PI;for(;o<-Math.PI;)o+=2*Math.PI;let a=s+(r-s)*n,l=i+o*n;return[a*Math.cos(l),a*Math.sin(l)]},extrapolates:!0,equals:qt,defaultHandoff:"blend-from-frozen"},Vn={id:"color",lerp:he,extrapolates:!0,equals:(e,t)=>e===t,defaultHandoff:"blend-from-frozen"};function lr(e){return{id:e,lerp:(t,n,s)=>s>=1?n:t,extrapolates:!1,equals:(t,n)=>Object.is(t,n),defaultHandoff:"cut"}}var _n=lr("string"),qn=lr("boolean"),Cn=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n];function Ks(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.closed!==r.closed||s.v.length!==r.v.length)return!1}return!0}var Qs=!1,Wn={id:"path",lerp:(e,t,n)=>Ks(e,t)?e.map((s,r)=>{let i=t[r];return{closed:s.closed,v:s.v.map((o,a)=>Cn(o,i.v[a],n)),in:s.in.map((o,a)=>Cn(o,i.in[a],n)),out:s.out.map((o,a)=>Cn(o,i.out[a],n))}}):(Qs||(Qs=!0,q("path lerp with mismatched topology (contour/vertex counts or closed flags differ): snapping instead of morphing \u2014 supply matched vertex counts (\xA72.2)")),n>=1?t:e),extrapolates:!1,equals:(e,t)=>{if(e===t)return!0;if(!Ks(e,t))return!1;let n=(s,r)=>s[0]===r[0]&&s[1]===r[1];return e.every((s,r)=>{let i=t[r];return s.v.every((o,a)=>n(o,i.v[a]))&&s.in.every((o,a)=>n(o,i.in[a]))&&s.out.every((o,a)=>n(o,i.out[a]))})},defaultHandoff:"blend-from-frozen"},Rt=(e,t,n)=>e+(t-e)*n,At=(e,t,n)=>[Rt(e[0],t[0],n),Rt(e[1],t[1],n)];function Js(e){try{return zt(L(M({},de(e)),{a:0}))}catch(t){return e}}function ho(e,t,n){try{return he(e,t,n)}catch(s){return n>=1?t:e}}function Zs(e,t){let n=t.stops.map(r=>({offset:r.offset,color:e})),s=t.interpolation?{interpolation:t.interpolation}:{};return t.kind==="radial"?M(M(M({kind:"radial",stops:n},t.center?{center:t.center}:{}),t.radius!==void 0?{radius:t.radius}:{}),s):M(M(M({kind:"linear",stops:n},t.from?{from:t.from}:{}),t.to?{to:t.to}:{}),s)}var er=!1;function nt(e,t,n,s="paint lerp across mismatched gradient shapes (different kind or stop count): snapping instead of interpolating \u2014 match the kind + stop count on both keyframes (\xA72.2)"){return er||(er=!0,q(s)),e>=1?n:t}var fo=(e,t)=>e.length===t.length&&e.every((n,s)=>n.offset===t[s].offset&&n.color===t[s].color),jn={id:"paint",lerp:(e,t,n)=>{var a,l,c,u;if(e.kind==="color"&&t.kind==="color")return{kind:"color",color:he(e.color,t.color,n)};if(e.kind==="mesh"&&t.kind==="mesh"){if(e.points.length!==t.points.length)return nt(n,e,t);if(e.interpolation!==t.interpolation)return nt(n,e,t,`paint lerp across mismatched mesh interpolation modes ('${(a=e.interpolation)!=null?a:"smooth"}' \u2192 '${(l=t.interpolation)!=null?l:"smooth"}'): snapping instead of interpolating \u2014 the blend kernel is discrete, so it switches once at the boundary; match \`interpolation\` on both keyframes to morph the points (\xA73 Paint)`);let h=e.points.map((d,g)=>{let m=t.points[g];return{pos:At(d.pos,m.pos,n),color:he(d.color,m.color,n)}}),f=e.bg!==void 0||t.bg!==void 0?{bg:ho((c=e.bg)!=null?c:Js(t.bg),(u=t.bg)!=null?u:Js(e.bg),n)}:{};return M(M({kind:"mesh",points:h},e.interpolation?{interpolation:e.interpolation}:{}),f)}if(e.kind==="mesh"||t.kind==="mesh")return nt(n,e,t);let s=e,r=t;if(s.kind==="color"&&r.kind!=="color"?s=Zs(s.color,r):r.kind==="color"&&s.kind!=="color"&&(r=Zs(r.color,s)),s.kind==="color"||r.kind==="color"||s.kind!==r.kind||s.stops.length!==r.stops.length)return nt(n,e,t);let i=s.stops.map((h,f)=>({offset:Rt(h.offset,r.stops[f].offset,n),color:he(h.color,r.stops[f].color,n)})),o=s.interpolation?{interpolation:s.interpolation}:{};return s.kind==="radial"&&r.kind==="radial"?M(M(M({kind:"radial",stops:i},s.center&&r.center?{center:At(s.center,r.center,n)}:s.center?{center:s.center}:{}),s.radius!==void 0&&r.radius!==void 0?{radius:Rt(s.radius,r.radius,n)}:s.radius!==void 0?{radius:s.radius}:{}),o):s.kind==="linear"&&r.kind==="linear"?M(M(M({kind:"linear",stops:i},s.from&&r.from?{from:At(s.from,r.from,n)}:s.from?{from:s.from}:{}),s.to&&r.to?{to:At(s.to,r.to,n)}:s.to?{to:s.to}:{}),o):nt(n,e,t)},extrapolates:!1,equals:(e,t)=>e===t?!0:e.kind!==t.kind?!1:e.kind==="color"?t.kind==="color"&&e.color===t.color:e.kind==="mesh"?t.kind!=="mesh"||e.interpolation!==t.interpolation||e.bg!==t.bg||e.points.length!==t.points.length?!1:e.points.every((n,s)=>{let r=t.points[s];return n.color===r.color&&n.pos[0]===r.pos[0]&&n.pos[1]===r.pos[1]}):t.kind==="color"||t.kind==="mesh"||!fo(e.stops,t.stops)||e.interpolation!==t.interpolation?!1:e.kind==="radial"&&t.kind==="radial"?JSON.stringify(e.center)===JSON.stringify(t.center)&&e.radius===t.radius:e.kind==="linear"&&t.kind==="linear"?JSON.stringify(e.from)===JSON.stringify(t.from)&&JSON.stringify(e.to)===JSON.stringify(t.to):!1,defaultHandoff:"blend-from-frozen"},Hn=class extends Error{constructor(e){super(`cannot infer a value type for ${JSON.stringify(e)}; register a custom type`),this.name="ValueTypeInferenceError"}},po=e=>typeof e=="object"&&e!==null&&typeof e.closed=="boolean"&&Array.isArray(e.v)&&Array.isArray(e.in)&&Array.isArray(e.out),mo=e=>typeof e=="object"&&e!==null&&(e.kind==="color"||e.kind==="linear"||e.kind==="radial"||e.kind==="mesh");function Ae(e){if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(mo(e))return"paint";if(Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"))return"vec2";if(Array.isArray(e)&&e.length>0&&e.every(po))return"path";if(typeof e=="string")try{return de(e),"color"}catch(t){return"string"}throw new Hn(e)}ae(Nn);ae(zn);ae(Bn);ae(Vn);ae(_n);ae(qn);ae(Wn);ae(jn);var xe=class extends Error{constructor(e,t){super(`track '${e}': ${t}`),this.name="TrackValidationError"}};function lt(e){let t=ct(e.type);if(e.keys.length===0)throw new xe(e.target,"must have at least one key");if(t.defaultHandoff==="cut")for(let n of e.keys)n.interp!=="hold"&&(n.interp="hold");for(let n=1;n<e.keys.length;n++){let s=e.keys[n-1],r=e.keys[n];if(r.t<=s.t)throw new xe(e.target,`keys must be strictly increasing in t (key[${n}] at t=${r.t} after t=${s.t})`)}if(!/^[^/]+\/.+$/.test(e.target))throw new xe(e.target,"target must be '<nodeId>/<prop.path>' (e.g. 'circle/opacity')")}function O(e,t,n){if(n===void 0)return{t:e,value:t};if(typeof n=="string"||"kind"in n)return{t:e,value:t,ease:n};let s=n,r={t:e,value:t};return s.ease!==void 0&&(r.ease=s.ease),s.interp!==void 0&&(r.interp=s.interp),s.id!==void 0&&(r.id=s.id),s.derived!==void 0&&(r.derived=s.derived),r}function ur(e,t,n,s){let r=fe.duration(s);if(e-r<0)throw new xe("springTo",`this spring needs ${r.toFixed(3)}s to settle \u2014 endT must be \u2265 its duration (got ${e})`);return[O(e-r,t),O(e,n,fe(s))]}function Wt(e,t){let n=typeof t=="function"?t:s=>s*t;return e.map((s,r)=>{let i=n(r);return L(M({},s),{keys:s.keys.map(o=>L(M({},o),{t:o.t+i}))})})}function pe(e,t,n,s){let r={target:e,type:t,keys:n};return(s==null?void 0:s.editable)!==void 0&&(r.editable=s.editable),lt(r),r}function Yn(e){return e===void 0?rt("linear"):typeof e=="string"?rt(e):e.kind==="cubicBezier"?On(...e.pts):Dn(e)}var tr=new Set;function Un(e){if(e===void 0)return Ft.linear;if(typeof e=="string"){let t=Ft[e];if(t)return t;let n=rt(e);tr.has(e)||(tr.add(e),q(`easing '${e}' has no registered derivative; velocity uses a numeric fallback \u2014 register one in easingDerivatives for exact interruption handoff`));let s=1/1024;return r=>(n(Math.min(1,r+s))-n(Math.max(0,r-s)))/(Math.min(1,r+s)-Math.max(0,r-s))}return e.kind==="cubicBezier"?An(...e.pts):Fn(e)}var nr=new WeakMap;function hr(e){let t=nr.get(e);return t||(t={cursor:1,easeCache:new Array(e.keys.length)},nr.set(e,t)),t}function fr(e,t,n){let s=t.easeCache[n];return s||(s=Yn(e.keys[n].ease),t.easeCache[n]=s),s}function dr(e,t,n){let s=e.length;for(let o=Math.max(1,n-1);o<=Math.min(s-1,n+1);o++)if(e[o-1].t<=t&&t<e[o].t)return o;if(t<e[0].t)return 0;if(t>=e[s-1].t)return s;let r=1,i=s-1;for(;r<i;){let o=r+i>>1;e[o].t<=t?r=o+1:i=o}return r}function Xn(e,t){let n=ct(e.type);if(!n.sub||!n.scale)return null;let s=e.keys,r=s.length,i=hr(e),o=dr(s,t,i.cursor),a=n.scale(n.sub(s[0].value,s[0].value),0);if(o===0||o>=r)return a;let l=s[o];if(l.interp==="hold")return a;let c=s[o-1],u=l.t-c.t,h=(t-c.t)/u;if(!n.extrapolates){let d=fr(e,i,o)(h);if(d<0||d>1)return a}let f=Un(l.ease)(h);return n.scale(n.sub(l.value,c.value),f/u)}function jt(e,t){let n=e.keys,s=n.length,r=hr(e),i=dr(n,t,r.cursor);if(i===0)return n[0].value;if(i>=s)return n[s-1].value;r.cursor=i;let o=n[i],a=n[i-1];if(o.interp==="hold")return a.value;let l=ct(e.type),c=(t-a.t)/(o.t-a.t),u=fr(e,r,i)(c);return!l.extrapolates&&(u<0||u>1)&&(r.warnedClamp||(r.warnedClamp=!0,q(`track '${e.target}' (type '${e.type}') clamped an out-of-range eased value \u2014 non-extrapolating types can't overshoot, so a spring/overshooting ease on this track is flattened`)),u=Math.min(1,Math.max(0,u))),l.lerp(a.value,o.value,u)}var Pe=Symbol.for("glissade.targetPath"),Lt=class extends Error{constructor(e){super(e!=null?e:'tween target is not addressable: pass a target string ("node/prop") or a property signal of a node that has an explicit id (\xA73.1 \u2014 anonymous nodes cannot be track targets)'),this.name="UnresolvableTargetError"}};function We(e){let t=e.indexOf("/");return t<0?e:e.slice(0,t)}function ut(e){return typeof e=="string"&&e.length>0&&e!=="__root"&&!e.startsWith("~")}function Se(e){let t=typeof e=="string"?e:e[Pe];if(typeof t!="string")throw new Lt;if(We(t).startsWith("~"))throw new Lt(`'${t}': structural ids (~Type.ordinal) are inspection-only and cannot be track targets (\xA76.5) \u2014 give the node an explicit id`);return t}function te(e,t){return t+2<=e.byteLength?e.getUint16(t):0}function me(e,t){return t+4<=e.byteLength?e.getUint32(t):0}function go(e,t){return e===3&&t===10||e===0&&t>=4?5:e===3&&t===1||e===0?3:0}function yo(e,t,n){let s=te(e,t+6),r=s>>1,i=t+14,o=i+s+2,a=o+s,l=a+s;for(let c=0;c<r;c++){let u=te(e,i+c*2),h=te(e,o+c*2);if(h>u)continue;let f=te(e,a+c*2),d=te(e,l+c*2);for(let g=h;g<=u;g++){if(g===65535)continue;let m;if(d===0)m=g+f&65535;else{let v=te(e,l+c*2+d+(g-h)*2);m=v===0?0:v+f&65535}m!==0&&n.add(g)}}}function wo(e,t,n){let s=me(e,t+12),r=Math.max(0,Math.floor((e.byteLength-(t+16))/12)),i=Math.min(s,r),o=t+16;for(let a=0;a<i;a++,o+=12){let l=me(e,o),c=me(e,o+4),u=me(e,o+8);if(!(l>c)&&!(c-l>2097152))for(let h=l;h<=c;h++)u+(h-l)!==0&&n.add(h)}}function Ht(e){let t=new Set;try{let n=ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e);if(n.byteLength<12)return t;let s=0;me(n,0)===1953784678&&(s=me(n,12));let r=te(n,s+4),i=0;for(let u=0;u<r;u++){let h=s+12+u*16;if(me(n,h)===1668112752){i=me(n,h+8);break}}if(i===0)return t;let o=te(n,i+2),a=0,l=-1;for(let u=0;u<o;u++){let h=i+4+u*8,f=te(n,h),d=te(n,h+2),g=i+me(n,h+4),m=go(f,d);m>l&&g+2<=n.byteLength&&(l=m,a=g)}if(l<0)return t;let c=te(n,a);c===4?yo(n,a,t):c===12&&wo(n,a,t)}catch(n){return t}return t}function Gn(e){var n;let t={version:1,tracks:(n=e.tracks)!=null?n:[]};return e.duration!==void 0&&(t.duration=e.duration),e.editableDuration!==void 0&&(t.editableDuration=e.editableDuration),e.fps!==void 0&&(t.fps=e.fps),e.posterTime!==void 0&&(t.posterTime=e.posterTime),e.labels!==void 0&&(t.labels=e.labels),e.markers!==void 0&&(t.markers=e.markers),e.children!==void 0&&(t.children=e.children),e.audio!==void 0&&(t.audio=e.audio),e.assets!==void 0&&(t.assets=e.assets),t}var X=class extends Error{constructor(e){super(e),this.name="TimelineValidationError"}};function bo(e){for(let t=1;t<e.keys.length;t++){let n=e.keys[t];if(n.ease&&typeof n.ease=="object"&&n.ease.kind==="spring"){let s=e.keys[t-1].t+fe.duration(n.ease);if(Math.abs(n.t-s)>1e-6)throw new X(`track '${e.target}': spring-eased key at t=${n.t} must sit at prev.t + spring.duration (${s.toFixed(6)}); the builder computes this automatically`)}}}function mr(e,t=48e3){return Math.round(e*t)}function vo(e,t,n){return e.map(s=>L(M({},s),{t:t+s.t/n}))}function Kn(e){return`c${e}/`}var ko=/(^|\/)call:\d+$/;function Qn(e,t){return t!==""&&ko.test(e)?t+e:e}function gr(e,t,n,s,r,i){var o,a;for(let l of e.tracks)lt(l),bo(l),r.push({track:L(M({},l),{keys:vo(l.keys,t,n)}),unit:s});for(let l of(o=e.children)!=null?o:[]){let c=l.mode==="sync"&&(a=l.timeScale)!=null?a:1;if(l.mode==="add"&&l.timeScale!==void 0)throw new X("timeScale is only valid on mode:'sync' children (\xA72.3)");if(c<=0)throw new X("sync timeScale must be > 0");let u=l.mode==="sync"?++i.n:s;gr(l.timeline,t+l.at/n,n*c,u,r,i)}}function xo(e){let t=new Map;for(let{track:s,unit:r}of e){let i=t.get(s.target);if(!i){t.set(s.target,{track:L(M({},s),{keys:[...s.keys]}),unit:r});continue}if(i.unit!==r)throw new X(`target '${s.target}' is animated by a sync (opaque) child and another timeline unit; sync children must own disjoint targets (no last-writer-wins across the sync boundary, \xA72.3)`);if(i.track.type!==s.type)throw new X(`target '${s.target}' has conflicting value types '${i.track.type}' and '${s.type}'`);let o=s.keys[0].t,a=s.keys[s.keys.length-1].t,l=i.track.keys[0].t,c=i.track.keys[i.track.keys.length-1].t,u=i.track.keys.filter(h=>h.t<o||h.t>a);l<=a&&o<=c&&q(`overlapping tracks for '${s.target}' in [${o}, ${a}]: later insertion wins (${i.track.keys.length-u.length} earlier key(s) dropped)`),i.track.keys=[...u,...s.keys].sort((h,f)=>h.t-f.t)}let n=new Map;for(let[s,{track:r}]of t)n.set(s,r);return n}function yr(e){return e.editableDuration===!0}function So(e){var n;let t=e.mode==="sync"&&(n=e.timeScale)!=null?n:1;return e.at+wr(e.timeline)/t}function wr(e){var n,s;if(e.duration!==void 0)return e.duration;let t=0;for(let r of e.tracks){let i=r.keys[r.keys.length-1];i&&(t=Math.max(t,i.t))}for(let r of(n=e.markers)!=null?n:[])t=Math.max(t,r.t);for(let r of(s=e.children)!=null?s:[])t=Math.max(t,So(r));return t}function ne(e){var a,l;if(e.version!==1)throw new X(`unsupported timeline document version ${String(e.version)}`);let t=[];gr(e,0,1,0,t,{n:0});let n=xo(t),s=M({},e.labels),r=[...(a=e.markers)!=null?a:[]],i=[...(l=e.audio)!=null?l:[]],o=(c,u,h,f)=>{(c!=null?c:[]).forEach((d,g)=>{var y,p,b,k,I;let m=u+d.at/h,v=h*(d.mode==="sync"&&(y=d.timeScale)!=null?y:1),T=f+Kn(g);for(let[w,x]of Object.entries((p=d.timeline.labels)!=null?p:{}))w in s||(s[w]=m+x/v);for(let w of(b=d.timeline.markers)!=null?b:[])r.push(L(M({},w),{name:Qn(w.name,T),t:m+w.t/v}));for(let w of(k=d.timeline.audio)!=null?k:[])i.push(M(L(M({},w),{at:m+w.at/v}),v!==1?{playbackRate:((I=w.playbackRate)!=null?I:1)*v}:{}));o(d.timeline.children,m,v,T)})};return o(e.children,0,1,""),r.sort((c,u)=>c.t-u.t),i.sort((c,u)=>c.at-u.at),{duration:wr(e),labels:s,markers:r,tracks:n,audio:i}}var Jn="main",Zn=class extends Error{constructor(e){super(`unsupported sidecar version ${String(e)}; this build reads sidecarVersion 1 or 2`),this.name="SidecarVersionError"}};function br(){return{sidecarVersion:2,timelines:{[Jn]:{tracks:{}}}}}function es(e){if(!e)return null;if(e.sidecarVersion===2)return e;if(e.sidecarVersion===1){let t={};for(let s of e.tracks)t[s.target]={type:s.type,baseHash:null,keys:s.keys};let n={tracks:t};return e.labels&&(n.labels=e.labels),{sidecarVersion:2,timelines:{[Jn]:n}}}throw new Zn(e.sidecarVersion)}function Yt(e){let t=JSON.stringify(e.map(s=>{var r,i;return[s.t,s.value,(r=s.ease)!=null?r:null,(i=s.interp)!=null?i:null]})),n=2166136261;for(let s=0;s<t.length;s++)n^=t.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(16)}function ts(e){let t=-1;for(let n of e){let s=n.id?/^k(\d+)$/.exec(n.id):null;s&&(t=Math.max(t,Number(s[1])))}return e.map(n=>n.id?M({},n):L(M({},n),{id:`k${++t}`}))}function vr(e,t,n,s,r,i){var l;if(!ut(We(n)))throw new xe(n,"structural/un-id'd nodes cannot host editor tracks (\xA76.5) \u2014 only nodes with an explicit id");let o=(l=e.timelines[t])!=null?l:{tracks:{}},a={type:s,baseHash:i?Yt(i):null,keys:ts(r)};return L(M({},e),{timelines:L(M({},e.timelines),{[t]:L(M({},o),{tracks:L(M({},o.tracks),{[n]:a})})})})}function kr(e,t,n){let s=e.timelines[t];if(!s||!(n in s.tracks))return e;let o=s.tracks,{[n]:r}=o,i=Ve(o,[Gs(n)]);return L(M({},e),{timelines:L(M({},e.timelines),{[t]:L(M({},s),{tracks:i})})})}function pr(e){return e.some(t=>t.derived)?e.map((t,n)=>t.derived&&n>0?L(M({},t),{value:e[n-1].value}):t):e}function ns(e,t){var c,u,h;let n=es(t);if(!n)return{timeline:e,drift:[],orphans:{}};let s=(c=n.timelines[Jn])!=null?c:{tracks:{}},r=new Map(Object.entries(s.tracks)),i=[],o=M({},(u=s.orphans)!=null?u:{}),a=e.tracks.map(f=>{let d=r.get(f.target);return d?(r.delete(f.target),d.type!==f.type?(o[f.target]={type:d.type,keys:d.keys,reason:"type-changed"},f):(d.baseHash!==null&&d.baseHash!==Yt(f.keys)&&i.push(f.target),L(M({},f),{keys:pr(d.keys.map(g=>M({},g))),editable:!0}))):f});for(let[f,d]of r)d.baseHash!==null?o[f]={type:d.type,keys:d.keys,reason:"prop-missing"}:a.push({target:f,type:d.type,keys:pr(d.keys.map(g=>M({},g))),editable:!0});let l=L(M({},e),{tracks:a});if(s.labels&&Object.keys(s.labels).length>0){let f=(h=e.labels)!=null?h:{},d=Object.keys(s.labels).filter(g=>g in f);d.length&&q(`sidecar label(s) ${d.join(", ")} collide with code labels; code wins (\xA76.2)`),l.labels=M(M({},s.labels),f)}return i.length&&q(`sidecar: code baseline changed beneath edits on ${i.join(", ")} (\xA76.2)`),{timeline:l,drift:i,orphans:o}}function xr(e,t){return ns(e,t).timeline}function Sr(e){let t=e.map(n=>M({},n)).sort((n,s)=>n.t-s.t);for(let n=0;n<2;n++){for(let s=1;s<t.length;s++){let r=t[s].ease;r&&typeof r=="object"&&r.kind==="spring"&&(t[s].t=t[s-1].t+fe.duration(r))}t.sort((s,r)=>s.t-r.t)}for(let n=1;n<t.length;n++)t[n].t<=t[n-1].t&&(t[n].t=t[n-1].t+.001);return t}var is=e=>e(),ss=is,De=new Set,Kt=0,je=!1,ft=!1,Mo=1e3;function To(e){let t=ss;return ss=e!=null?e:is,ft&&!je&&(ft=!1,De.size>0&&os()),t}function Eo(e){De.add(e),os()}function os(){Kt>0||je||ft||(ft=!0,ss(Io))}function Io(){ft=!1,!je&&$o()}function $o(){if(je)return;je=!0;let e;try{let t=0;for(;De.size>0;){if(++t>Mo)throw De.clear(),new Error("signal notification flush did not settle within 1000 passes: a subscriber is writing to a signal it observes (DESIGN.md \xA76.1).");let n=[...De];De.clear();for(let s of n)try{s()}catch(r){e!=null||(e={err:r})}}}finally{je=!1}if(e)throw e.err}function Ut(){Kt++}function Xt(){Kt--,Kt===0&&De.size>0&&os()}function Co(e){Ut();try{return e()}finally{Xt()}}var Me=null,Fe=0,Gt=class extends Error{constructor(){super("signal.set() during evaluation: the read phase is pure (DESIGN.md \xA72.1). Drivers write the playhead before evaluation begins; stateful animation belongs in bake()."),this.name="WriteDuringEvaluationError"}},Er=class extends Error{constructor(){super("circular signal dependency detected"),this.name="CircularDependencyError"}};function Ir(){Fe++}function $r(){if(Fe===0)throw new Error("endReadPhase() without matching beginReadPhase()");Fe--}function Oo(){return Fe>0}var Cr=class{constructor(e){S(this,"value");S(this,"fn");S(this,"equals");S(this,"version",0);S(this,"state");S(this,"computing",!1);S(this,"deps",[]);S(this,"depVersions",[]);S(this,"dependents",new Set);S(this,"subscribers",new Set);var t,n;this.fn=(t=e.fn)!=null?t:null,this.value=e.value,this.equals=(n=e.equals)!=null?n:Object.is,this.state=this.fn?2:0}get(){return Me&&Me.addDep(this),this.updateIfNecessary(),this.value}peek(){return this.updateIfNecessary(),this.value}set(e){if(Fe>0)throw new Gt;Ut();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Xt()}}forceSet(e){Ut();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Xt()}}bindSource(e){if(Fe>0)throw new Gt;Ut();try{this.fn=e,this.state=2,this.invalidateDependents(2)}finally{Xt()}}unbindSource(){if(Fe>0)throw new Gt;this.fn&&(this.updateIfNecessary(),this.detachFn())}get isBound(){return this.fn!==null}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}addDep(e){this.deps[this.deps.length-1]!==e&&(this.deps.push(e),this.depVersions.push(-1),e.dependents.add(this))}detachFn(){this.fn=null,this.clearDeps(),this.state=0}writeValue(e){(this.version>0||this.value!==void 0)&&this.equals(this.value,e)||(this.value=e,this.version++,this.invalidateDependents(2))}invalidateDependents(e){for(let t of[...this.dependents])t.markStale(e);if(this.subscribers.size>0)for(let t of[...this.subscribers])Eo(t)}markStale(e){if(this.state>=e)return;let t=this.state===0;this.state=e,t&&this.invalidateDependents(1)}updateIfNecessary(){if(!(this.fn===null||this.state===0)){if(this.computing)throw new Er;if(this.state===1){this.state=0;for(let e=0;e<this.deps.length;e++){let t=this.deps[e];if(t.updateIfNecessary(),t.version!==this.depVersions[e]){this.state=2;break}}}this.state===2&&this.recompute(),this.state=0}}recompute(){this.clearDeps();let e=Me;Me=this,this.computing=!0;let t;try{t=this.fn()}finally{this.computing=!1,Me=e}for(let n=0;n<this.deps.length;n++)this.depVersions[n]=this.deps[n].version;(!(this.version>0||this.value!==void 0)||!this.equals(this.value,t))&&(this.value=t,this.version++)}clearDeps(){for(let e of this.deps)e.dependents.delete(this);this.deps=[],this.depVersions=[]}};function Or(e,t){let n=(()=>e.get());return n.peek=()=>e.peek(),n.subscribe=s=>e.subscribe(s),t(n),n}function A(e,t){let n=new Cr({value:e,equals:t==null?void 0:t.equals});return Or(n,s=>{s.set=r=>n.set(r),s.forceSet=r=>n.forceSet(r),s.bindSource=r=>n.bindSource(r),s.unbindSource=()=>n.unbindSource(),Object.defineProperty(s,"isBound",{get:()=>n.isBound})})}function dt(e,t){return Or(new Cr({fn:e,equals:t==null?void 0:t.equals}),()=>{})}function Ao(e){let t=Me;Me=null;try{return e()}finally{Me=t}}function He(e){let[t,n]=Array.isArray(e)?e:[e.x,e.y],s=A(t),r=A(n);s.expects="number",r.expects="number";let i=A(null,{equals:(u,h)=>u===null||h===null?u===h:u[0]===h[0]&&u[1]===h[1]}),o=A(t),a=A(n);s.bindSource(()=>{let u=i();return u===null?o():u[0]}),r.bindSource(()=>{let u=i();return u===null?a():u[1]});let l=dt(()=>[s(),r()],{equals:(u,h)=>u[0]===h[0]&&u[1]===h[1]}),c=(()=>l());return c.peek=()=>l.peek(),c.subscribe=u=>l.subscribe(u),c.set=u=>{i.set(null),o.set(u[0]),a.set(u[1])},c.bindSource=u=>i.bindSource(()=>u()),c.unbindSource=()=>{i.unbindSource(),i.set(null)},c.expects="vec2",Object.defineProperty(c,"x",{value:s,enumerable:!0}),Object.defineProperty(c,"y",{value:r,enumerable:!0}),c}function Po(e,t){return t.faces&&t.faces.length>0?t.faces.map(n=>{var s,r;return{family:e,url:n.url,weight:(s=n.weight)!=null?s:400,style:(r=n.style)!=null?r:"normal"}}):[{family:e,url:t.url,weight:400,style:"normal"}]}function Do(e,t){let n,s=Number.POSITIVE_INFINITY;for(let r of e){let i=Math.abs(r.weight-t);(i<s||i===s&&n!==void 0&&r.weight<n.weight)&&(n=r,s=i)}return n}function pt(e){let t=new Map;for(let[n,s]of Object.entries(e!=null?e:{}))s.kind==="font"&&t.set(n,{faces:Po(n,s),fallback:s.fallback?[...s.fallback]:[]});return{has(n){return t.has(n)},faces(){let n=[];for(let s of t.values())n.push(...s.faces);return n},resolveFace(n,s=400,r="normal"){let i=t.get(n);if(!i)return;let o=i.faces.filter(a=>a.style===r);return Do(o.length>0?o:i.faces,s)},fallbackChain(n){let s=t.get(n);return s?[n,...s.fallback]:[n]}}}var Ar=class extends Error{constructor(t){super(Dr(t));S(this,"report");this.name="FontValidationError",this.report=t}},Fo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);function Pr(e,t){var s;let n=e.trim().toLowerCase();return Fo.has(n)?!0:(s=t==null?void 0:t.has(n))!=null?s:!1}function Ro(e){let t=[];for(let n of e){let s=n.codePointAt(0);s!==void 0&&t.push(s)}return t}function Dr(e){let t=[];e.unregistered.length>0&&t.push(`unregistered font ${e.unregistered.length===1?"family":"families"}: ${e.unregistered.join(", ")}`);for(let n of e.missingGlyphs){let s=n.codePoints.map(r=>"U+"+r.toString(16).toUpperCase().padStart(4,"0")).join(", ");t.push(`family '${n.family}' is missing glyphs for ${s}`)}return"font validation failed (\xA73.6): "+t.join("; ")+" \u2014 register the family with its faces/fallback, or supply covering glyphs"}function as(e,t,n,s,r={}){let i=new Set,o=new Map;for(let l of e){let c=l.family,u=Pr(c,r.osFamilies);if(!t.has(c)){u||i.add(c);continue}let h=t.fallbackChain(c);for(let f of Ro(l.text))if(!h.some(d=>{var g,m;return(m=(g=n.get(d))==null?void 0:g.has(f))!=null?m:!1})){let d=o.get(c);d||(d=new Set,o.set(c,d)),d.add(f)}}let a={unregistered:[...i].sort(),missingGlyphs:[...o.entries()].map(([l,c])=>({family:l,codePoints:[...c].sort((u,h)=>u-h)})).sort((l,c)=>l.family<c.family?-1:l.family>c.family?1:0)};if(!(a.unregistered.length===0&&a.missingGlyphs.length===0)){if(s==="strict")throw new Ar(a);q(Dr(a))}return a}var rs=class extends Error{constructor(e,t){super(`invalid position '${e}': ${t}`),this.name="PositionError"}};function ht(e,t,n){let s=new Set(n),r=Object.keys(t).filter(i=>!s.has(i));if(r.length>0)throw new X(`${e}: unknown option${r.length>1?"s":""} ${r.map(i=>`'${i}'`).join(", ")} \u2014 known: ${n.map(i=>`'${i}'`).join(", ")}`)}var Mr=["duration","ease","at","from"],Lo=["at"],No=["to","from","duration","ease"],zo=["each","anchor","at"];function Tr(e){return typeof e!="string"&&typeof e.peek=="function"?e.peek():void 0}var Fr=new WeakMap;function Rr(e){var t;return(t=Fr.get(e))!=null?t:new Map}function Lr(e,t={}){var T;let n=[],s=[],r=M({},t.labels),i=[],o=[],a=new Map,l=!1,c=0,u=0,h=0;function f(y){if(y===void 0)return u;if(typeof y=="number")return y;if(y==="<")return c;if(y===">")return u;let p=/^([+-])=([\d.]+)$/.exec(y);if(p)return u+(p[1]==="+"?1:-1)*parseFloat(p[2]);let b=/^([^+\-=]+?)(?:([+-])=([\d.]+))?$/.exec(y);if(b){let k=b[1];if(!(k in r))throw new rs(y,`unknown label '${k}' (labels must be declared before use)`);let I=b[2]?(b[2]==="+"?1:-1)*parseFloat(b[3]):0;return r[k]+I}throw new rs(y,"expected a number, '<', '>', '+=x', '-=x', or 'label[+=x]'")}let d={to(y,p,b={}){var $,D;ht("to",b,Mr);let k=($=b.ease)!=null?$:"easeInOutCubic",I=typeof k=="object"&&k.kind==="spring",w=I?fe.duration(k):(D=b.duration)!=null?D:1;if(I&&b.duration!==void 0)throw new X("a spring ease determines its duration (spring.duration(cfg)); do not pass duration with a spring");let x=f(b.at),E={kind:"tween",target:Se(y),value:p,duration:w,ease:k,at:b.at,baseValue:Tr(y),editable:!1,start:x};return b.from!==void 0&&(E.explicitFrom=b.from),n.push(E),c=x,u=x+w,d},fromTo(y,p,b,k={}){return ht("fromTo",k,Mr),d.to(y,b,k),n[n.length-1].explicitFrom=p,d},stagger(y,p,b){var tt;ht("stagger spec",p,No),ht("stagger opts",b,zo);let k=y.length,I=f(b.at),w=(k-1)/2,{anchor:x="start",each:E}=b,$=C=>{if(!Number.isFinite(C))throw new X(`stagger: non-finite each/anchor (${String(C)})`);return C};typeof x=="number"&&$(x),typeof E=="number"&&$(E);let D=C=>x==="start"?C:x==="end"?k-1-C:Math.round(x==="center"?Math.abs(C-w):x==="edges"?w-Math.abs(C-w):Math.abs(C-x)),N=C=>$(typeof E=="function"?E(C,k):C*E),B=p.ease,K=typeof B=="object"&&B!==null&&B.kind==="spring"?fe.duration(B):(tt=p.duration)!=null?tt:1,et=C=>M(M({at:I+C},p.duration!==void 0?{duration:p.duration}:{}),p.ease!==void 0?{ease:p.ease}:{}),ze=0,Be=0;for(let C=0;C<k;C++){let P=N(D(C));(C===0||P<ze)&&(ze=P),(C===0||P>Be)&&(Be=P);let R=I+P;if(R<0)throw new X(`stagger: target would land at t=${R} (< 0); shift opts.at`);let V=y[C],W=typeof p.to=="function"?p.to(C,k):p.to;if(p.from!==void 0){let Q=typeof p.from=="function"?p.from(C,k):p.from;d.fromTo(V,Q,W,et(P))}else d.to(V,W,et(P))}return k>0&&(c=I+ze,u=I+Be+K),d},set(y,p,b={}){ht("set",b,Lo);let k=f(b.at);return n.push({kind:"set",target:Se(y),value:p,duration:0,ease:"linear",at:b.at,baseValue:Tr(y),editable:!1,start:k}),c=k,u=k,d},tracks(y){for(let p of y)s.push(p);return d},label(y,p){return r[y]=p===void 0?u:f(p),d},add(y,p,b={}){var D,N;let k=p===void 0?u:f(p),I=(D=b.mode)!=null?D:"add",w={timeline:y,at:k,mode:I,_pos:p};b.timeScale!==void 0&&(w.timeScale=b.timeScale);let x=i.length;i.push(w);let E=Kn(x);for(let[B,K]of Rr(y))a.set(Qn(B,E),K);let $=I==="sync"&&(N=b.timeScale)!=null?N:1;return c=k,u=k+ne(y).duration/$,d},sequence(y,p={}){var I;let b=(I=p.gap)!=null?I:0,k=b<0?`-=${-b}`:`+=${b}`;for(let w=0;w<y.length;w++)d.add(y[w],w===0?void 0:k);return d},at(y,p){return d.add(p,y)},call(y,p){let b=p===void 0?u:f(p),k=`call:${h++}`;return o.push({t:b,name:k}),a.set(k,y),d},cue(y,p,b){let k=b!=null&&typeof b=="object"&&!Array.isArray(b)?M({kind:"cue"},b):{kind:"cue"};return o.push({t:f(y),name:p,data:k}),d},adBreak(y,p={}){var k;let b=M({kind:"ad-break"},p.duration!==void 0?{duration:p.duration}:{});return o.push({t:f(y),name:(k=p.id)!=null?k:"ad-break",data:b}),d},editable(){let y=n[n.length-1];if(!y)throw new X(".editable() requires a preceding insertion");let p=We(y.target);if(!ut(p))throw new X(`.editable() needs a node with an explicit id; '${p}' is not an editable host (\xA76.4)`);return y.editable=!0,d},editableDuration(){return l=!0,d}};e(d);let g=new Map;for(let y of n){let p=g.get(y.target);p||(p=[],g.set(y.target,p)),p.push(y)}let m=[];for(let[y,p]of g){p.sort(($,D)=>$.start-D.start);let b=[],k=p.some($=>$.editable),I=(T=p.find($=>$.baseValue!==void 0))==null?void 0:T.baseValue,w=p[0];w.kind==="tween"&&w.explicitFrom===void 0&&I===void 0&&q(`'${y}': first tween has no resolvable from-value (string targets have no base) \u2014 the track sits at its end state before the tween. Anchor it with { from }, fromTo(), or set(..., { at: 0 }).`);for(let $ of p){if($.kind==="set"){b.push({t:$.start,value:$.value,interp:"hold"}),I=$.value;continue}let D=$.explicitFrom!==void 0?$.explicitFrom:I,N=b[b.length-1];if(D!==void 0&&(!N||N.t<$.start)){let B={t:$.start,value:D};$.explicitFrom===void 0&&(B.derived=!0),(!N||$.start>N.t)&&b.push(B)}b.push({t:$.start+$.duration,value:$.value,ease:$.ease}),I=$.value}let x=[];for(let $ of b.sort((D,N)=>D.t-N.t)){let D=x[x.length-1];D&&D.t===$.t?x[x.length-1]=$:x.push($)}let E={target:y,type:Ae(p[0].value),keys:x};k&&(E.editable=!0),m.push(E)}for(let y of s)m.push(y);let v=Gn(M(M(M(L(M({},t),{tracks:m,labels:r}),l?{editableDuration:!0}:{}),o.length?{markers:o}:{}),i.length?{children:i.map(b=>{var k=b,{_pos:y}=k,p=Ve(k,["_pos"]);return p})}:{}));return a.size&&Fr.set(v,a),v}function Bo(e,t){return typeof e=="function"?Lr(e,t):Gn(e)}function Zt(e=0){return A(e)}var Nr=class extends Error{constructor(e){super(`timeline targets '${e}' but no property signal resolves to it`),this.name="UnboundTargetError"}},zr=class extends Error{constructor(t,n,s){let r=t.slice(t.lastIndexOf("/")+1),i=[s].flat(),o=n==="number"&&i.includes("vec2")?`; target '${r}.x'/'${r}.y' or author a vec2 track`:"";super(`track '${t}' is '${n}' but '${r}' expects '${i.join("'|'")}' (would silently NaN evaluation)${o}`);S(this,"target");S(this,"got");S(this,"expected");this.target=t,this.got=n,this.name="BindTypeMismatchError",this.expected=s}};function cs(e,t,n=Zt()){let s=[],r=new Map;for(let[i,o]of e.tracks){let a=t(i);if(!a)throw new Nr(i);let l=o.type,c=a.expects;if(c!==void 0){let u=_t(l);if(!(Array.isArray(c)?c:[c]).some(h=>_t(h)===u))throw new zr(i,l,c)}a.bindSource(()=>jt(o,n())),s.push(a),r.set(i,{track:o,value:u=>jt(o,u),velocity:u=>Xn(o,u)})}return{playhead:n,samplers:r,unbind:()=>{for(let i of s)i.unbindSource()}}}function ls(e,t,n){e.forceSet(t),Ir();try{return n()}finally{$r()}}function ce(e){let t=e>>>0;return()=>{t=t+2654435769|0;let n=t^t>>>16;return n=Math.imul(n,569420461),n=n^n>>>15,n=Math.imul(n,1935289751),n=n^n>>>15,(n>>>0)/4294967296}}var Qt=class extends Error{constructor(e){super(`bake(): ${e}`),this.name="BakeError"}};function Jt(e,t,n){for(let[s,r]of Object.entries(t)){let i=e.get(s);i||(i={keys:[],type:Ae(r)},e.set(s,i)),i.keys.push({t:n,value:r})}}function Br(e){return[...e.entries()].map(([t,n])=>({target:t,type:n.type,keys:n.keys}))}function Vo(e){var o,a;if(!(e.fps>0)||!(e.duration>=0))throw new Qt("fps must be > 0 and duration >= 0");let t=ce((o=e.seed)!=null?o:0),n=1/e.fps,s=Math.round(e.duration*e.fps),r=e.setup(t),i=new Map;Jt(i,e.sample(r),0);for(let l=1;l<=s;l++)r=(a=e.step(r,n,t))!=null?a:r,Jt(i,e.sample(r),l*n);return Br(i)}function _o(e){var h;if(!(e.every>=1))throw new Qt("checkpoint interval `every` must be >= 1 frame");let t=1/e.fps,n=Math.round(e.duration*e.fps),s=0,r=ce((h=e.seed)!=null?h:0),i=()=>(s++,r()),o=f=>{var g;let d=ce((g=e.seed)!=null?g:0);for(let m=0;m<f;m++)d();return d},a=e.setup(i),l=[{snap:e.snapshot(a),rngDraws:s}],c=0;function u(f){var d;for(;c<Math.min(f,n);)a=(d=e.step(a,t,i))!=null?d:a,c++,c%e.every===0&&l.push({snap:e.snapshot(a),rngDraws:s})}return{frames:n,bakeRange(f,d){var b;if(f<0||d>n||f>d)throw new Qt(`range ${f}..${d} outside 0..${n}`);let g=Math.floor(f/e.every)*e.every;u(g);let m=l[g/e.every],v=e.restore(m.snap),T=o(m.rngDraws),y=g,p=new Map;for(y>=f&&Jt(p,e.sample(v),y*t);y<d;)v=(b=e.step(v,t,T))!=null?b:v,y++,y>=f&&Jt(p,e.sample(v),y*t);return Br(p)}}}var Ie=[1,0,0,1,0,0],H=e=>e===0?0:e;function gt(e,t){let[n,s,r,i,o,a]=e,[l,c,u,h,f,d]=t;return[H(n*l+r*c),H(s*l+i*c),H(n*u+r*h),H(s*u+i*h),H(n*f+r*d+o),H(s*f+i*d+a)]}function ms(e,t,n){let s=t*Math.PI/180,r=Math.cos(s),i=Math.sin(s),[o,a]=n;return[H(r*o),H(i*o),H(-i*a),H(r*a),H(e[0]),H(e[1])]}function Xr(e){let[t,n,s,r,i,o]=e,a=t*r-n*s;if(a===0)return null;let l=r/a,c=-n/a,u=-s/a,h=t/a;return[H(l),H(c),H(u),H(h),H(-(l*i+u*o)),H(-(c*i+h*o))]}function Gr(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}function Ee(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Ue(e,t){if(t instanceof ArrayBuffer)return`ab:${t.byteLength}`;if(ArrayBuffer.isView(t))return`view:${t.byteLength}`;if(typeof t!="function")return typeof t=="number"&&!Number.isFinite(t)?Number.isNaN(t)?"NaN":t>0?"Infinity":"-Infinity":t}function Vr(e,t){let n={};for(let[s,r]of Object.entries(e))n[s]=r;return e.op==="clip"||e.op==="fillPath"||e.op==="strokePath"?n.path=t[e.path]:e.op==="drawImage"&&(n.image=t[e.image]),n}var Ye=e=>JSON.stringify(e,Ue);function qo(e,t){let n=[],s=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of s)r!=="op"&&Ye(e[r])!==Ye(t[r])&&n.push({path:r,from:e[r],to:t[r]});return n}function gs(e,t){let n=[],s=Math.max(e.commands.length,t.commands.length);for(let i=0;i<s;i++){let o=e.commands[i],a=t.commands[i];if(o!==void 0&&a!==void 0){let l=Vr(o,e.resources),c=Vr(a,t.resources);if(Ye(l)===Ye(c))continue;o.op!==a.op?n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:[{path:"op",from:o.op,to:a.op}]}):n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:qo(l,c)})}else a!==void 0?n.push({index:i,kind:"add",opB:a.op,fields:[]}):o!==void 0&&n.push({index:i,kind:"remove",opA:o.op,fields:[]})}let r=e.size.w!==t.size.w||e.size.h!==t.size.h;return M({equal:n.length===0&&!r,deltas:n},r?{size:{from:e.size,to:t.size}}:{})}function Kr(e){var n,s,r,i;if(e.equal)return"DisplayLists are identical.";let t=[];e.size&&t.push(`size ${e.size.from.w}x${e.size.from.h} -> ${e.size.to.w}x${e.size.to.h}`);for(let o of e.deltas)if(o.kind==="add")t.push(`+ [${o.index}] add ${(n=o.opB)!=null?n:"?"}`);else if(o.kind==="remove")t.push(`- [${o.index}] remove ${(s=o.opA)!=null?s:"?"}`);else{let a=o.opA===o.opB?o.opA:`${(r=o.opA)!=null?r:"?"} -> ${(i=o.opB)!=null?i:"?"}`;t.push(`~ [${o.index}] ${a}`);for(let l of o.fields)t.push(` ${l.path}: ${Ye(l.from)} -> ${Ye(l.to)}`)}return t.join(`
|
|
2
|
-
`)}var Qr=1;function Jr(e){let t={dlSnapshotVersion:1,size:e.size,commands:e.commands,resources:e.resources};return JSON.stringify(t,
|
|
3
|
-
`);if(n===void 0||n<=0)return r;let i=[];for(let o of r){let a=un(o),l="";for(let c of a){let u=l+c;l!==""&&U(s.measureText(u.trimEnd(),t).width)>n?(i.push(l.trimEnd()),l=c.trimStart()===""?"":c):l=u}i.push(l.trimEnd())}return i}var Uo={center:[.5,.5],"top-left":[0,0],top:[.5,0],"top-right":[1,0],left:[0,.5],right:[1,.5],"bottom-left":[0,1],bottom:[.5,1],"bottom-right":[1,1]};function Ts(e){if(typeof e=="string"){let t=Uo[e];if(!t)throw new Error(`unknown anchor '${e}' (use a preset like 'top-left' or a [ax, ay] pair)`);return t}return[e[0],e[1]]}function mt(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Wr(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var yt,Yr,Z=(Yr=class{constructor(e={}){S(this,"id");S(this,"position");S(this,"rotation");S(this,"scale");S(this,"opacity");S(this,"blend");S(this,"zIndex");S(this,"filters");S(this,"anchor");S(this,"hasAnchor");S(this,"cache");S(this,"parent",null);J(this,yt,!1);S(this,"interactive",!1);S(this,"interactiveChildren",!0);S(this,"hitArea");S(this,"measurerSource",null);S(this,"localMatrix");S(this,"worldMatrix");S(this,"targets",new Map);var t;this.id=e.id,this.position=Wr(He([0,0]),e.position),this.rotation=mt(A(0),e.rotation),this.scale=Wr(He([1,1]),e.scale),this.opacity=mt(A(1),e.opacity),this.blend=mt(A("source-over"),e.blend),this.zIndex=mt(A(0),e.zIndex),this.filters=mt(A([]),e.filters),this.hasAnchor=e.anchor!==void 0,this.anchor=Ts((t=e.anchor)!=null?t:"center"),this.cache=e.cache===!0,this.localMatrix=dt(()=>{let n=ms(this.position(),this.rotation(),this.scale()),[s,r]=this.anchorShift();return s===0&&r===0?n:gt(n,[1,0,0,1,s,r])},{equals:Ee}),this.worldMatrix=dt(()=>this.parent?gt(this.parent.worldMatrix(),this.localMatrix()):this.localMatrix(),{equals:Ee}),this.registerTarget("position",this.position,"vec2"),this.registerTarget("position.x",this.position.x,"number"),this.registerTarget("position.y",this.position.y,"number"),this.registerTarget("rotation",this.rotation,"number"),this.registerTarget("scale",this.scale,"vec2"),this.registerTarget("scale.x",this.scale.x,"number"),this.registerTarget("scale.y",this.scale.y,"number"),this.registerTarget("opacity",this.opacity,"number"),this.registerTarget("zIndex",this.zIndex,"number")}registerTarget(e,t,n){t.expects=n,this.targets.set(e,t),this.id!==void 0&&(t[Pe]=`${this.id}/${e}`)}resolveTarget(e){return this.targets.get(e)}listTargets(){return[...this.targets].map(([e,t])=>({path:e,expects:t.expects}))}intrinsicSize(e){return null}drawOffset(e){var s,r,i;let t=(r=e!=null?e:(s=this.measurerSource)==null?void 0:s.call(this))!=null?r:G(),n=(i=this.intrinsicSize(t))!=null?i:{w:0,h:0};return{x:-n.w/2,y:-n.h/2}}flowOffset(e){var i,o;let t=(o=e!=null?e:(i=this.measurerSource)==null?void 0:i.call(this))!=null?o:G(),n=this.drawOffset(t),[s,r]=this.anchorShift(t);return{x:n.x+s,y:n.y+r}}anchorShift(e){var l,c;if(!this.hasAnchor)return[0,0];let[t,n]=this.anchor,s=(c=e!=null?e:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:G(),r=this.intrinsicSize(s);if(!r)return F(this,yt)||(Y(this,yt,!0),q(`anchor set on a node without an intrinsic box${this.id?` ('${this.id}')`:""} \u2014 ignored (give it a sized node, or position children explicitly)`)),[0,0];let i=this.drawOffset(s),o=-(i.x+t*r.w),a=-(i.y+n*r.h);return[o===0?0:o,a===0?0:a]}requiresGroup(){return this.opacity()<1||this.blend()!=="source-over"||this.filters().length>0}groupShader(){}emit(e,t){let n=this.opacity();if(n<=0)return;let s=this.localMatrix(),r=Ee(s,Ie),i=this.groupShader(),o=this.requiresGroup()||i!==void 0||this.cache,a=this.cache&&e.mark!==void 0;e.push({op:"save"}),r||e.push({op:"transform",m:s});let l=-1;o&&(a&&(l=e.mark()),e.push(M({op:"pushGroup",opacity:n,blend:this.blend(),filters:this.filters()},i!==void 0?{shader:i}:{})));let c=a?e.mark():-1;if(this.draw(e,t),o){if(a){let u=e.cacheKey(c,e.mark());u!==void 0&&e.patchCacheKey(l,u)}e.push({op:"popGroup"})}e.push({op:"restore"})}},yt=new WeakMap,Yr),ri=class extends Z{};function Xe(e,t,n,s,r){if(r<=0)return[["M",e,t],["L",e+n,t],["L",e+n,t+s],["L",e,t+s],["Z"]];let i=Math.PI/2;return[["M",e+r,t],["L",e+n-r,t],["E",e+n-r,t+r,r,r,0,-i,0],["L",e+n,t+s-r],["E",e+n-r,t+s-r,r,r,0,0,i],["L",e+r,t+s],["E",e+r,t+s-r,r,r,0,i,Math.PI],["L",e,t+r],["E",e+r,t+r,r,r,0,Math.PI,Math.PI+i],["Z"]]}var Te,Ur,re=(Ur=class extends Z{constructor(t={}){var n;super(t);S(this,"children");J(this,Te,A(0));this.children=(n=t.children)!=null?n:[];for(let s of this.children)s.parent=this}trackStructure(){F(this,Te).call(this)}add(t){return t.parent=this,this.children.push(t),F(this,Te).set(F(this,Te).peek()+1),this}remove(t){let n=this.children.indexOf(t);return n>=0&&(this.children.splice(n,1),t.parent===this&&(t.parent=null),F(this,Te).set(F(this,Te).peek()+1)),this}draw(t,n){let s=this.children.map((r,i)=>({node:r,i})).sort((r,i)=>r.node.zIndex()-i.node.zIndex()||r.i-i.i).map(r=>r.node);for(let r of s)r.emit(t,n)}},Te=new WeakMap,Ur);function jr(e){return typeof e=="string"?{kind:"color",color:e}:e}var Es=class extends Z{constructor(t={}){var n;super(t);S(this,"fill");S(this,"stroke");S(this,"strokeWidth");S(this,"sketch");S(this,"sketchFill");S(this,"sketchSeed");S(this,"reveal");this.fill=j(A(""),t.fill),this.stroke=j(A(""),t.stroke),this.strokeWidth=j(A(0),t.strokeWidth),this.reveal=j(A(1),t.reveal),this.registerTarget("fill",this.fill,["color","paint"]),this.registerTarget("stroke",this.stroke,"color"),this.registerTarget("strokeWidth",this.strokeWidth,"number"),this.registerTarget("reveal",this.reveal,"number"),t.sketch&&ws(t.sketch),t.sketchFill&&ks(t.sketchFill),t.sketchFill&&!t.sketch&&q(`${this.id!==void 0?`'${this.id}': `:""}sketchFill is ignored without sketch \u2014 hachure fill is drawn only by the sketch renderer. Set a sketch style (e.g. { kind: 'pencil' }) to see it.`),this.sketch=t.sketch,this.sketchFill=t.sketchFill,this.sketchSeed=(n=t.sketchSeed)!=null?n:this.id!==void 0?Ss(this.id):0}draw(t){let n=this.pathSegs();if(this.sketch)return this.drawSketch(t,n);let s=t.resource({kind:"path",segs:n}),r=this.fill();r&&t.push({op:"fillPath",path:s,paint:jr(r)});let i=this.stroke(),o=this.strokeWidth();if(i&&o>0){let a=this.reveal();a<1?Hr(t,n,{kind:"color",color:i},{width:o},a):t.push({op:"strokePath",path:s,paint:{kind:"color",color:i},stroke:{width:o}})}}drawSketch(t,n){let s=ce(this.sketchSeed>>>0),r=this.fill();if(r){let u=t.resource({kind:"path",segs:n});t.push({op:"fillPath",path:u,paint:jr(r)})}let{strokes:i,resolved:o}=cn(n,this.sketch,s),a=this.stroke()||(typeof r=="string"?r:"")||"#000000";if(this.sketchFill){let u=t.resource({kind:"path",segs:n});t.push({op:"save"}),t.push({op:"clip",path:u,rule:"nonzero"});let h=xs(n,this.sketchFill,s);if(h.length>0){let f=t.resource({kind:"path",segs:h});t.push({op:"strokePath",path:f,paint:{kind:"color",color:a},stroke:{width:Math.max(1,o.width*.5),cap:"round"}})}t.push({op:"restore"})}let l=this.reveal(),c=l<1;for(let u of i){if(u.length===0)continue;if(c){Hr(t,u,{kind:"color",color:a},{width:o.width,cap:"round",join:"round"},l);continue}let h=t.resource({kind:"path",segs:u});t.push({op:"strokePath",path:h,paint:{kind:"color",color:a},stroke:M({width:o.width,cap:"round",join:"round"},o.dash?{dash:o.dash}:{})})}}};function j(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Xo(e){let t=[],n=null;for(let s of e)s[0]==="M"?(n=[s],t.push(n)):n&&n.push(s);return t}function Hr(e,t,n,s,r){for(let i of Xo(t)){let o=bt(i).reduce((l,c)=>l+vs(c),0),a=e.resource({kind:"path",segs:i});e.push({op:"strokePath",path:a,paint:n,stroke:L(M({},s),{dash:[o,o],dashOffset:o*(1-r)})})}}function on(e){if(e===void 0)return[];if(Array.isArray(e)&&e.every(t=>typeof t=="object"&&t!==null&&Array.isArray(t.v)&&Array.isArray(t.in)&&Array.isArray(t.out)))return e;throw new TypeError(`Path.data expects PathValue (PathContour[]); for an SVG path 'd' string, parse it with pathFromSvg(d) from "@glissade/scene/path" (or window.glissade.pathFromSvg in the browser bundle)`)}function hn(e){let t=[],n=null,s=(i,o=[0,0],a=[0,0])=>{n.v.push(i),n.in.push(o),n.out.push(a)},r=()=>n.v[n.v.length-1];for(let i of e)switch(i[0]){case"M":n={closed:!1,v:[[i[1],i[2]]],in:[[0,0]],out:[[0,0]]},t.push(n);break;case"L":n&&s([i[1],i[2]]);break;case"C":if(n){let o=r();n.out[n.out.length-1]=[i[1]-o[0],i[2]-o[1]],s([i[5],i[6]],[i[3]-i[5],i[4]-i[6]])}break;case"Q":if(n){let o=r(),a=i[1],l=i[2],c=i[3],u=i[4];n.out[n.out.length-1]=[2/3*(a-o[0]),2/3*(l-o[1])],s([c,u],[2/3*(a-c),2/3*(l-u)])}break;case"E":if(n){let[,o,a,l,c,u,h,f]=i,d=Math.cos(u),g=Math.sin(u);for(let m=1;m<=16;m++){let v=h+(f-h)*(m/16),T=l*Math.cos(v),y=c*Math.sin(v);s([o+T*d-y*g,a+T*g+y*d])}}break;case"Z":if(n){n.closed=!0;let o=n.v[0],a=r();n.v.length>1&&Math.abs(o[0]-a[0])<1e-9&&Math.abs(o[1]-a[1])<1e-9&&(n.in[0]=n.in[n.in.length-1],n.v.pop(),n.in.pop(),n.out.pop())}break}return t}var fn=class extends Es{constructor(t={}){super(t);S(this,"width");S(this,"height");S(this,"cornerRadius");this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.cornerRadius=j(A(0),t.cornerRadius),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number"),this.registerTarget("cornerRadius",this.cornerRadius,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}pathSegs(){let t=this.width(),n=this.height(),s=Math.min(Math.max(0,this.cornerRadius()),t/2,n/2);return Xe(-t/2,-n/2,t,n,s)}},dn=class extends Es{constructor(t={}){super(t);S(this,"radius");this.radius=j(A(0),t.radius),this.registerTarget("radius",this.radius,"number")}intrinsicSize(){let t=this.radius()*2;return{w:t,h:t}}pathSegs(){let t=this.radius();return[["E",0,0,t,t,0,0,Math.PI*2],["Z"]]}},vt=class extends Es{constructor(t={}){super(t);S(this,"data");let n=t.data,s=typeof n=="function"?()=>on(n()):n!==void 0?on(n):void 0;this.data=j(A([]),s),this.registerTarget("d",this.data,"path")}bounds(){let t=1/0,n=1/0,s=-1/0,r=-1/0;for(let i of this.data())for(let o=0;o<i.v.length;o++){let a=i.v[o][0],l=i.v[o][1],c=[[a,l],[a+i.in[o][0],l+i.in[o][1]],[a+i.out[o][0],l+i.out[o][1]]];for(let u of c)u[0]<t&&(t=u[0]),u[1]<n&&(n=u[1]),u[0]>s&&(s=u[0]),u[1]>r&&(r=u[1])}return t>s?{minX:0,minY:0,maxX:0,maxY:0}:{minX:t,minY:n,maxX:s,maxY:r}}intrinsicSize(){let t=this.bounds();return{w:t.maxX-t.minX,h:t.maxY-t.minY}}drawOffset(){let t=this.bounds();return{x:t.minX,y:t.minY}}pathSegs(){let t=[];for(let n of this.data()){let s=n.v.length;if(s!==0){t.push(["M",n.v[0][0],n.v[0][1]]);for(let r=0;r<s-1;r++)t.push(["C",n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1],n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1],n.v[r+1][0],n.v[r+1][1]]);n.closed&&s>1&&(t.push(["C",n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1],n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1],n.v[0][0],n.v[0][1]]),t.push(["Z"]))}}return t}},fs,pn=(fs=class extends Z{constructor(t){super(t);S(this,"assetId");S(this,"width");S(this,"height");this.assetId=t.assetId,this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}draw(t){let n=this.width(),s=this.height();if(n<=0||s<=0)return;let r=t.resource({kind:"image",assetId:this.assetId});t.push({op:"drawImage",image:r,dst:{x:-n/2,y:-s/2,w:n,h:s}})}},S(fs,"assetKind","image"),fs),ds,mn=(ds=class extends Z{constructor(t){var n,s,r;super(t);S(this,"assetId");S(this,"at");S(this,"trimStart");S(this,"playbackRate");S(this,"clipDuration");S(this,"sourceFps");S(this,"width");S(this,"height");this.assetId=t.assetId,this.at=(n=t.at)!=null?n:0,this.trimStart=(s=t.trimStart)!=null?s:0,this.playbackRate=(r=t.playbackRate)!=null?r:1,this.clipDuration=t.clipDuration,this.sourceFps=t.sourceFps,this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}mediaTime(t){let n=(t-this.at)*this.playbackRate;if(n<0||this.clipDuration!==void 0&&t-this.at>=this.clipDuration)return null;let s=this.trimStart+n;return this.sourceFps!==void 0?Math.floor(s*this.sourceFps+1e-9)/this.sourceFps:s}draw(t,n){let s=this.mediaTime(n.time);if(s===null)return;let r=this.width(),i=this.height();if(r<=0||i<=0)return;let o=t.resource({kind:"videoFrame",assetId:this.assetId,mediaT:s});t.push({op:"drawImage",image:o,dst:{x:-r/2,y:-i/2,w:r,h:i}})}},S(ds,"assetKind","video"),ds),Ge=class extends Z{constructor(t={}){var n,s,r,i,o;super(t);S(this,"text");S(this,"fill");S(this,"fontSize");S(this,"fontFamily");S(this,"fontWeight");S(this,"fontStyle");S(this,"align");S(this,"width");S(this,"lineHeight");S(this,"reveal");S(this,"revealFraction");this.text=j(A(""),t.text),this.fill=j(A("#000000"),t.fill),this.fontSize=j(A(16),t.fontSize),this.fontFamily=(n=t.fontFamily)!=null?n:"sans-serif",this.fontWeight=(s=t.fontWeight)!=null?s:400,this.fontStyle=(r=t.fontStyle)!=null?r:"normal",this.align=(i=t.align)!=null?i:"left",this.width=j(A(0),t.width),this.lineHeight=(o=t.lineHeight)!=null?o:1.25,this.reveal=j(A(Number.POSITIVE_INFINITY),t.reveal),this.revealFraction=j(A(NaN),t.revealFraction),this.registerTarget("width",this.width,"number"),this.registerTarget("text",this.text,"string"),this.registerTarget("fill",this.fill,"color"),this.registerTarget("fontSize",this.fontSize,"number"),this.registerTarget("reveal",this.reveal,"number"),this.registerTarget("revealFraction",this.revealFraction,"number")}effectiveReveal(t){let n=this.revealFraction();if(Number.isNaN(n))return this.reveal();let s=this.graphemes(t).length;return Math.round((n<=0?0:n>=1?1:n)*s)}intrinsicSize(t){let n=this.text();if(!n)return{w:0,h:0};let s=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=se(n,s,r>0?r:void 0,t),o=Math.max(...i.map(a=>U(t.measureText(a,s).width)),0);return{w:r>0?r:o,h:U(s.size*this.lineHeight)*i.length}}drawOffset(t){var a,l,c;let n=(l=t!=null?t:(a=this.measurerSource)==null?void 0:a.call(this))!=null?l:G(),s=this.intrinsicSize(n),r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=(c=se(this.text(),r,this.width()>0?this.width():void 0,n)[0])!=null?c:"",o=n.measureText(i,r).ascent;return{x:this.align==="left"?0:this.align==="center"?-s.w/2:-s.w,y:-o}}measuredSize(t){var n,s;return this.intrinsicSize((s=t!=null?t:(n=this.measurerSource)==null?void 0:n.call(this))!=null?s:G())}lineBoxes(t){var c,u;let n=(u=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?u:G();t===void 0&&hs(n,"Text.lineBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=se(s,r,i>0?i:void 0,n),a=U(r.size*this.lineHeight),l=[];for(let h=0;h<o.length;h++){let f=o[h];if(!f)continue;let d=n.measureText(f,r),g=U(d.width),m=this.align==="left"?0:this.align==="center"?-g/2:-g;l.push({text:f,x:m,y:h*a-d.ascent,w:g,h:d.ascent+d.descent})}return l}wordBoxes(t){var c,u;let n=(u=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?u:G();t===void 0&&hs(n,"Text.wordBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=se(s,r,i>0?i:void 0,n),a=U(r.size*this.lineHeight),l=[];for(let h=0;h<o.length;h++){let f=o[h];if(!f)continue;let d=n.measureText(f,r),g=U(d.width),m=this.align==="left"?0:this.align==="center"?-g/2:-g,v=h*a-d.ascent,T=d.ascent+d.descent,y="";for(let p of un(f)){let b=y;y+=p;let k=p.trim();if(k==="")continue;let I=p.length-p.trimStart().length,w=n.measureText(b+p.slice(0,I),r).width,x=n.measureText(b+p.trimEnd(),r).width;l.push({text:k,line:h,x:m+w,y:v,w:x-w,h:T})}}return l}graphemeBoxes(t){var c,u;let n=(u=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?u:G();t===void 0&&hs(n,"Text.graphemeBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=se(s,r,i>0?i:void 0,n),a=U(r.size*this.lineHeight),l=[];for(let h=0;h<o.length;h++){let f=o[h];if(!f)continue;let d=n.measureText(f,r),g=U(d.width),m=this.align==="left"?0:this.align==="center"?-g/2:-g,v=h*a-d.ascent,T=d.ascent+d.descent,y="";for(let p of ye(f)){let b=y;if(y+=p,p.trim()==="")continue;let k=n.measureText(b,r).width,I=n.measureText(b+p,r).width;l.push({text:p,line:h,x:m+k,y:v,w:I-k,h:T})}}return l}graphemes(t){var l,c;let n=(c=t!=null?t:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:G(),s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=se(s,r,i>0?i:void 0,n),a=[];for(let u of o)for(let h of ye(u))a.push(h);return a}revealHead(t){var f,d,g;let n=(d=t!=null?t:(f=this.measurerSource)==null?void 0:f.call(this))!=null?d:G(),s=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=se(this.text(),s,r>0?r:void 0,n),o=U(s.size*this.lineHeight),a=i.reduce((m,v)=>m+ye(v).length,0),l=this.effectiveReveal(n),c=Math.max(0,Math.min(Number.isFinite(l)?Math.floor(l):a,a)),u=c,h={x:0,y:0,h:0,line:0,index:c};for(let m=0;m<i.length;m++){let v=(g=i[m])!=null?g:"",T=n.measureText(v,s),y=U(T.width),p=this.align==="left"?0:this.align==="center"?-y/2:-y,b=m*o-T.ascent,k=T.ascent+T.descent,I=ye(v);if(u<=I.length)return{x:p+(u<=0?0:n.measureText(I.slice(0,u).join(""),s).width),y:b,h:k,line:m,index:c};u-=I.length,h={x:p+T.width,y:b,h:k,line:m,index:c}}return h}draw(t,n){let s=this.text();if(!s)return;let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=se(s,r,i>0?i:void 0,n.measurer),a=U(r.size*this.lineHeight),l=this.effectiveReveal(n.measurer),c=Number.isFinite(l),u=c?Math.max(0,Math.floor(l)):0;for(let h=0;h<o.length;h++){let f=o[h];if(!f)continue;if(!c){t.push(M({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:h*a},this.align!=="left"?{align:this.align}:{}));continue}if(u<=0)break;let d=ye(f),g=Math.min(u,d.length);if(u-=g,g===d.length)t.push(M({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:h*a},this.align!=="left"?{align:this.align}:{}));else{let m=U(n.measurer.measureText(f,r).width),v=this.align==="left"?0:this.align==="center"?-m/2:-m;t.push({op:"fillText",text:d.slice(0,g).join(""),font:r,paint:{kind:"color",color:this.fill()},x:v,y:h*a})}}}};function ii(e,t,n){var f,d;let s=(d=n!=null?n:(f=e.measurerSource)==null?void 0:f.call(e))!=null?d:G(),r=e.text();if(!r)return[];let i=M({family:e.fontFamily,size:e.fontSize(),weight:e.fontWeight},e.fontStyle==="italic"?{style:"italic"}:{}),o=e.width(),a=se(r,i,o>0?o:void 0,s),l=U(i.size*e.lineHeight),c=t.keys,u=[],h=0;for(let g=0;g<a.length;g++){let m=a[g];if(!m)continue;let v=s.measureText(m,i),T=U(v.width),y=e.align==="left"?0:e.align==="center"?-T/2:-T,p=g*l-v.ascent,b="";for(let k of ye(m)){b+=k;let I=h+1,w=Number.POSITIVE_INFINITY;for(let x of c)if(x.value>=I){w=x.t;break}Number.isFinite(w)&&u.push({charIndex:h,grapheme:k,time:w,x:y+s.measureText(b,i).width,y:p,line:g}),h++}}return u}var Is=class extends Error{constructor(){super("a Layout node was evaluated but no LayoutEngine is registered \u2014 await loadYogaLayoutEngine() from '@glissade/scene/layout' before mounting/rendering (the engine is wasm and loads async; evaluate() never awaits, \xA72.5)"),this.name="LayoutEngineMissingError"}},gn=null;function oi(e){gn=e}function ai(){return gn}function ci(){if(!gn)throw new Is;return gn}var Go=["Group","Rect","Circle","Path","Text","Image","Video","Layout","Custom"],yi=class extends Z{constructor(t){var n,s;super(t);S(this,"target");S(this,"color");S(this,"progress");S(this,"padding");S(this,"cornerRadius");this.target=t.text,this.color=li(A("#ffe066"),t.color),this.progress=li(A(1),t.progress),this.padding=(n=t.padding)!=null?n:[4,2],this.cornerRadius=(s=t.cornerRadius)!=null?s:4,this.registerTarget("progress",this.progress,"number"),this.registerTarget("color",this.color,"color")}draw(t,n){let s=Math.min(1,Math.max(0,this.progress()));if(s<=0)return;let[r,i]=this.padding,o=this.target.lineBoxes(n.measurer).map(h=>({x:h.x-r,y:h.y-i,w:h.w+2*r,h:h.h+2*i})),a=o.reduce((h,f)=>h+f.w,0);if(a<=0)return;let l=this.target.localMatrix();Ee(l,Ie)||t.push({op:"transform",m:l});let c=this.color(),u=s*a;for(let h of o){let f=Math.min(h.w,u);if(u-=f,f<=0)break;let d=Math.min(this.cornerRadius,f/2,h.h/2),g=t.resource({kind:"path",segs:Xe(h.x,h.y,f,h.h,d)});if(t.push({op:"fillPath",path:g,paint:{kind:"color",color:c}}),u<=0)break}}};function Ko(e,t={}){return new yi(L(M({},t),{text:e}))}function li(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var wi=class extends Z{constructor(t){var n,s,r,i;super(t);S(this,"target");S(this,"blinkPeriod");S(this,"blinkPhase");S(this,"solidWhileTyping");S(this,"caretWidth");S(this,"fill");this.target=t.text,this.blinkPeriod=(n=t.blinkPeriod)!=null?n:1.06,this.blinkPhase=(s=t.blinkPhase)!=null?s:0,this.solidWhileTyping=(r=t.solidWhileTyping)!=null?r:!0,this.caretWidth=(i=t.width)!=null?i:2,this.fill=Jo(A(""),t.fill),this.registerTarget("fill",this.fill,"color")}draw(t,n){let s=this.target.revealHead(n.measurer);if(s.h<=0)return;let r=!0,i=this.target.graphemes(n.measurer).length,o=s.index<i;if(!(this.solidWhileTyping&&o)){let u=this.blinkPeriod>0?this.blinkPeriod:1;r=((n.time-this.blinkPhase)%u+u)%u<u/2}if(!r)return;let a=this.target.localMatrix();Ee(a,Ie)||t.push({op:"transform",m:a});let l=this.fill()||this.target.fill(),c=t.resource({kind:"path",segs:Xe(s.x,s.y,this.caretWidth,s.h,0)});t.push({op:"fillPath",path:c,paint:{kind:"color",color:l}})}};function Qo(e,t={}){return new wi(L(M({},t),{text:e}))}function Jo(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var Zo=.06;function ea(e,t,n={}){var h,f,d,g;let s=(h=n.start)!=null?h:0,r=(f=n.perChar)!=null?f:Zo,i=(d=n.gap)!=null?d:0,o=s,a=[],l=[O(s,"",{interp:"hold"})],c=[],u=[];for(let m=0;m<t.length;m++){let v=t[m],T=o,y=(g=v.perChar)!=null?g:r;if(v.type!==void 0)for(let p of ye(v.type)){o+=y,a.push(p);let b=a.join("");l.push(O(o,b,{interp:"hold"})),c.push({time:o,kind:"insert",grapheme:p,value:b})}if(v.delete!==void 0)for(let p=0;p<v.delete&&a.length>0;p++){o+=y;let b=a.pop(),k=a.join("");l.push(O(o,k,{interp:"hold"})),c.push({time:o,kind:"delete",grapheme:b,value:k})}v.hold!==void 0&&(o+=v.hold),u.push({index:m,start:T,end:o,value:a.join("")}),i>0&&m<t.length-1&&(o+=i)}return{track:pe(e,"string",l),marks:c,steps:u,duration:o}}var Ke=class extends Error{constructor(e){super(e),this.name="EachError"}};function $s(e,t){let n=(e^Math.imul(t+1,2654435769))>>>0;return n=Math.imul(n^n>>>16,569420461),n=Math.imul(n^n>>>15,1935289751),(n^n>>>15)>>>0}var ta=1779033703;function na(e,t,n){var s,r,i,o,a,l,c,u,h,f,d,g;if(typeof e=="function")return e(t,n);switch(e.kind){case"row":{let m=(s=e.gap)!=null?s:n>1?1/(n-1):0,v=(r=e.align)!=null?r:.5,T=.5-m*(n-1)/2;return[n===1?.5:T+m*t,v]}case"column":{let m=(i=e.gap)!=null?i:n>1?1/(n-1):0,v=(o=e.align)!=null?o:.5,T=.5-m*(n-1)/2;return[v,n===1?.5:T+m*t]}case"grid":{let m=e.cols;if(!(m>=1))throw new Ke(`grid layout needs cols >= 1 (got ${m})`);let v=(a=e.rows)!=null?a:Math.ceil(n/m),T=(l=e.order)!=null?l:"row",y=T==="row"?t%m:Math.floor(t/v),p=T==="row"?Math.floor(t/m):t%v,b=(c=e.gapX)!=null?c:m>1?1/(m-1):0,k=(u=e.gapY)!=null?u:v>1?1/(v-1):0,I=b*(m-1),w=k*(v-1);return[m===1?.5:.5-I/2+b*y,v===1?.5:.5-w/2+k*p]}case"ring":{let m=(h=e.radius)!=null?h:.5,[v,T]=(f=e.center)!=null?f:[.5,.5],y=((d=e.startAngle)!=null?d:-Math.PI/2)+((g=e.sweep)!=null?g:Math.PI*2)*(n===0?0:t/n);return[v+m*Math.cos(y),T+m*Math.sin(y)]}}}function sa(e,t,n){let s=(n-1)/2;switch(e){case"from-center":return r=>Math.abs(r-s)*t;case"from-edges":return r=>(s-Math.abs(r-s))*t;case"delay":return r=>r*t}}function ra(e,t){var s,r;let n=(s=e.stagger)!=null?s:0;return typeof n=="function"?n:sa((r=e.distribute)!=null?r:"delay",n,t)}function ia(e,t,n){var d,g,m,v,T,y;if(!Number.isInteger(e)||e<0)throw new Ke(`each() count must be a non-negative integer (got ${e})`);let s=((d=n.seed)!=null?d:Ss(n.id))>>>0,r=n.box,[i,o]=(g=r==null?void 0:r.origin)!=null?g:[0,0],a=[],l=[],c=new Set;for(let p=0;p<e;p++){let b=`${n.id}/${p}`,k=na(n.layout,p,e),I={i:p,n:e,id:b,place:k,rng:ce($s(s,p)),seed:s},w=t(p,I);if(!(w instanceof Z))throw new Ke(`each() factory must return a Node for index ${p} (got ${typeof w})`);if(c.has(w))throw new Ke(`each() factory returned the same Node instance for index ${p} \u2014 the factory must construct a new node per index (it is called once per clone)`);if(c.add(w),w.id===void 0)w.id=b;else if(w.id!==b)throw new Ke(`each() factory set id '${w.id}' on index ${p}, but each owns the id namespace \u2014 leave it unset so it becomes '${b}'`);a.push(w),l.push(r?{frac:k,px:[i+k[0]*r.w,o+k[1]*r.h]}:{frac:k})}let u=new re({id:n.id,children:a}),h=[],f=(v=(m=n.motion)==null?void 0:m.startSec)!=null?v:0;if(n.motion){let p=n.motion,b=(T=p.startSec)!=null?T:0,k=ra(p,e);for(let I=0;I<e;I++){let w=ce($s($s(s,I),ta)),x=(y=p.jitter)==null?void 0:y.call(p,I,w,e),E=M(M({},x!==void 0?{overrides:x}:{}),p.speed!==void 0?{speed:p.speed}:{}),$=p.clip.apply(`${n.id}/${I}`,b+k(I),E);h.push(...$.tracks),$.end>f&&(f=$.end)}}return{node:u,children:a,tracks:h,end:f,places:l}}function bi(e,t={}){var i,o,a;let n=(i=t.start)!=null?i:0,s=(o=t.duration)!=null?o:1,r=(a=t.ease)!=null?a:"easeInOutCubic";return pe(`${e}/reveal`,"number",[O(n,0),O(n+s,1,r)])}function oa(e,t={}){var s,r;let n=(r=t.delay)!=null?r:((s=t.duration)!=null?s:1)*.6;return Wt(e.map(i=>bi(i,t)),n)}var vi=class extends Error{constructor(e){super(`'${e}' was called inside evaluate() \u2014 scene code must be a pure function of time (\xA75.5). Read ctx.time/frame, use the seeded random(seed) from @glissade/core, and resolve assets before rendering.`),this.name="DeterminismViolationError"}};function aa(){let e=globalThis,t=[{target:Math,key:"random",label:"Math.random"},{target:Date,key:"now",label:"Date.now"},{target:e,key:"setTimeout",label:"setTimeout"},{target:e,key:"setInterval",label:"setInterval"}];return typeof performance!="undefined"&&t.push({target:performance,key:"now",label:"performance.now"}),typeof e.requestAnimationFrame=="function"&&t.push({target:e,key:"requestAnimationFrame",label:"requestAnimationFrame"}),t}function ca(e,t){if(e==="off")return t();let n=aa(),s=n.map(i=>i.target[i.key]),r=new Set;n.forEach((i,o)=>{i.target[i.key]=(...a)=>{if(e==="throw")throw new vi(i.label);return r.has(i.label)||(r.add(i.label),q(`${i.label} called inside evaluate() \u2014 nondeterministic, not reproducible on export (\xA75.5)`)),s[o].apply(i.target,a)}});try{return t()}finally{n.forEach((i,o)=>{i.target[i.key]=s[o]})}}var ki=class extends Error{constructor(e){super(`duplicate node id '${e}' \u2014 explicit ids must be unique (\xA73.1/\xA76.5)`),this.name="DuplicateNodeIdError"}},xi=class extends Error{constructor(e){super(`node id '${e}' uses the reserved '~' prefix \u2014 that namespace is for structural fallback ids (\xA76.5), which are inspection-only and never track targets; choose another id`),this.name="ReservedNodeIdError"}};function Si(e,t,n){if(e.measurerSource=n,e.id!==void 0){if(e.id.startsWith("~"))throw new xi(e.id);if(t.has(e.id))throw new ki(e.id);t.set(e.id,e)}if(e instanceof re)for(let s of e.children)Si(s,t,n)}function la(e){let t=new re({id:"__root",children:e.children}),n=new Map,s=Zt(),r=A(null);return Si(t,n,()=>{var i;return(i=r())!=null?i:G()}),{root:t,nodes:n,size:e.size,playhead:s,resolveTarget:i=>{for(let o=i.lastIndexOf("/");o>0;o=i.lastIndexOf("/",o-1)){let a=n.get(i.slice(0,o));if(a)return a.resolveTarget(i.slice(o+1))}},setTextMeasurer:i=>{r.set(i)},get textMeasurer(){var i;return(i=r.peek())!=null?i:G()}}}var ui=new WeakMap;function Mi(e,t){let n=ui.get(e);n||(n=new WeakMap,ui.set(e,n));let s=n.get(t);if(!s){let r=ne(t);s={compiled:r,bound:cs(r,e.resolveTarget,e.playhead)},n.set(t,s)}return s}var ua=Object.freeze({version:1,tracks:[]});function we(e,t,n=0){if(t===void 0)return we(e,ua,e.playhead.peek());Mi(e,t);let s=t.fps,r={time:n,frame:s!==void 0?Math.round(n*s):-1,measurer:e.textMeasurer};return ls(e.playhead,n,()=>{let i=wt(e.size);return e.root.emit(i,r),i.finish()})}function yn(e){return JSON.stringify(e,Ue)}function ha(e,t,n){let s=e(),r=e(),i=we(s,t,n),o=we(r,t,n);if(yn(i)===yn(o))return{ok:!0};let a=t.fps!==void 0?Math.round(n*t.fps):-1,l={time:n,frame:a,measurer:s.textMeasurer},c={time:n,frame:a,measurer:r.textMeasurer},u;for(let[h,f]of s.nodes){let d=r.nodes.get(h);if(!d)return{ok:!1,node:h};let g=wt(s.size);f.emit(g,l);let m=wt(r.size);d.emit(m,c);let v=g.finish(),T=m.finish();if(yn(v)===yn(T))continue;if(f instanceof re){u!=null||(u=h);continue}let y=gs(v,T).deltas[0];return M({ok:!1,node:h},y!==void 0?{delta:y}:{})}return M({ok:!1},u!==void 0?{node:u}:{})}var Ds=new Set(["blur","drop-shadow","brightness","contrast","saturate"]),hi=e=>e<0?0:e>1?1:e;function fi(e,t,n,s,r){let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*e[0]+a*t[0]+l*n[0]+c*s[0],o*e[1]+a*t[1]+l*n[1]+c*s[1]]}function fa(e){let t=[];for(let n of e){let s=n.v.length;for(let r=0;r<s-1;r++)t.push([n.v[r],[n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1]],[n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1]],n.v[r+1]]);n.closed&&s>1&&t.push([n.v[s-1],[n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1]],[n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1]],n.v[0]])}return t}function St(e,t={}){var u,h;let n=Math.max(1,Math.floor((u=t.samplesPerSegment)!=null?u:32)),s=fa(e),r=[],i=[];if(s.length>0){let f=fi(...s[0],0);r.push(f),i.push(0);let d=0;for(let g of s)for(let m=1;m<=n;m++){let v=fi(...g,m/n);d+=Math.hypot(v[0]-f[0],v[1]-f[1]),r.push(v),i.push(d),f=v}}else{let f=(h=e[0])==null?void 0:h.v[0];r.push(f?[f[0],f[1]]:[0,0]),i.push(0)}let o=i[i.length-1],a=f=>{if(o<=0||f<=0)return{i:0,f:0};if(f>=o)return{i:r.length-2,f:1};let d=0;for(;d<i.length-1&&i[d+1]<f;)d++;let g=i[d+1]-i[d];return{i:d,f:g>0?(f-i[d])/g:0}},l=f=>{if(r.length===1)return[r[0][0],r[0][1]];let{i:d,f:g}=a(f),m=r[d],v=r[d+1];return[m[0]+(v[0]-m[0])*g,m[1]+(v[1]-m[1])*g]},c=f=>{if(r.length===1)return[1,0];let{i:d}=a(f),g=r[d],m=r[d+1],v=m[0]-g[0],T=m[1]-g[1],y=Math.hypot(v,T);return y>0?[v/y,T/y]:[1,0]};return{length:o,at:l,tangentAt:c,atProgress:f=>l(hi(f)*o),tangentAtProgress:f=>c(hi(f)*o)}}function da(e){return St(e).length}function pa(e,t){return St(e).at(t)}var Ti=class extends Z{constructor(t){var a;super(t);S(this,"target");S(this,"progress");this.target=t.target,this.progress=A(1),typeof t.progress=="function"?this.progress.bindSource(t.progress):t.progress!==void 0&&this.progress.set(t.progress),this.registerTarget("progress",this.progress,"number");let n=t.samplesPerSegment!==void 0?{samplesPerSegment:t.samplesPerSegment}:{},s=t.path instanceof vt?()=>t.path.data():()=>t.path,r=s(),i=St(r,n),o=()=>{let l=s();return l!==r&&(r=l,i=St(l,n)),i};if(t.target.position.bindSource(()=>o().atProgress(this.progress())),t.orient){let l=(a=t.orientOffset)!=null?a:0;t.target.rotation.bindSource(()=>{let c=o().tangentAtProgress(this.progress());return Math.atan2(c[1],c[0])*180/Math.PI+l})}}draw(){}};function ma(e,t,n={}){return new Ti(L(M({},n),{target:e,path:t}))}var Mt=class extends Error{constructor(e){super(e),this.name="TokenMatchError"}},Os=e=>e.replace(/\s+/g,"");function As(e,t,n=1){let s=Os(t);if(s.length===0)throw new Mt("empty token");let r=0;for(let i=0;i<e.length;i++){let o="";for(let a=i;a<e.length;a++){if(o+=Os(e[a].text),o===s){if(r++,r===n)return[i,a];break}if(!s.startsWith(o))break}}throw new Mt(`no match for token '${t}'${n>1?` (occurrence ${n})`:""} \u2014 segments are [${e.map(i=>`'${i.text}'`).join(", ")}]`)}var Ei=class extends Z{constructor(t){var s,r,i;super(t);S(this,"target");S(this,"padding");S(this,"cornerRadius");S(this,"rematch");S(this,"ranges");this.target=t.text,this.padding=(s=t.padding)!=null?s:[4,2],this.cornerRadius=(r=t.cornerRadius)!=null?r:4,this.rematch=(i=t.rematch)!=null?i:!1;let n=this.target.wordBoxes();this.ranges=t.ranges.map((o,a)=>{var h;let l=this.resolveRun(n,o),c=(h=o.id)!=null?h:`r${a}`,u={spec:o,fill:wn(A("#ffe066"),o.fill),opacity:wn(A(1),o.opacity),progress:wn(A(1),o.progress),scale:wn(A(1),o.scale),offset:ya(He([0,0]),o.offset),run:l,bound:di(n,l)};return this.registerTarget(`${c}/fill`,u.fill,"color"),this.registerTarget(`${c}/opacity`,u.opacity,"number"),this.registerTarget(`${c}/progress`,u.progress,"number"),this.registerTarget(`${c}/scale`,u.scale,"number"),this.registerTarget(`${c}/offset`,u.offset,"vec2"),this.registerTarget(`${c}/offset.x`,u.offset.x,"number"),this.registerTarget(`${c}/offset.y`,u.offset.y,"number"),u})}resolveRun(t,n){var s;if(typeof n.match!="string"){let[r,i]=n.match;if(r<0||i>=t.length||r>i)throw new Mt(`word index range [${r}, ${i}] out of bounds (${t.length} boxes)`);return[r,i]}return As(t,n.match,(s=n.occurrence)!=null?s:1)}draw(t,n){var l;let s=this.target.wordBoxes(n.measurer);if(s.length===0)return;let r=this.target.localMatrix(),[i,o]=this.padding,a=!1;for(let c of this.ranges){let u=c.opacity();if(u<=0)continue;let h=Math.min(1,Math.max(0,c.progress()));if(h<=0)continue;let f=c.run;if(this.rematch&&typeof c.spec.match=="string")f=As(s,c.spec.match,(l=c.spec.occurrence)!=null?l:1);else if(di(s,f)!==c.bound)throw new Mt(`bound token '${c.bound}' no longer matches boxes [${f[0]}, ${f[1]}] \u2014 the text changed (segments now [${s.slice(f[0],f[1]+1).map(b=>`'${b.text}'`).join(", ")}]); pass rematch: true for animated text`);let d=[];for(let b=f[0];b<=f[1];b++){let k=s[b],I=d[d.length-1],w=b>f[0]&&s[b-1].line===k.line?I:void 0;w?(w.w=k.x+k.w+i-w.x,w.y=Math.min(w.y,k.y-o),w.h=Math.max(w.h,k.y+k.h+o-w.y)):d.push({x:k.x-i,y:k.y-o,w:k.w+2*i,h:k.h+2*o})}!a&&!Ee(r,Ie)&&(t.push({op:"transform",m:r}),a=!0);let g=u<1;g&&t.push({op:"pushGroup",opacity:u,blend:"source-over",filters:[]});let m=c.fill(),v=c.scale(),[T,y]=c.offset(),p=h*d.reduce((b,k)=>b+k.w,0);for(let b of d){let k=Math.min(b.w,p);if(p-=k,k<=0)break;let I=b.x+b.w/2+T,w=b.y+b.h/2+y,x=k*v,E=b.h*v,$=I-b.w/2*v,D=w-E/2,N=Math.min(this.cornerRadius,x/2,E/2),B=t.resource({kind:"path",segs:Xe($,D,x,E,N)});if(t.push({op:"fillPath",path:B,paint:{kind:"color",color:m}}),p<=0)break}g&&t.push({op:"popGroup"})}}};function di(e,t){return e.slice(t[0],t[1]+1).map(n=>Os(n.text)).join("")}function ga(e,t){return new Ei(L(M({},t),{text:e}))}function wn(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function ya(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Ii(e){let t=[],n=s=>{if(s instanceof Ge){let r=s.text();r&&t.push({family:s.fontFamily,text:r})}if(s instanceof re)for(let r of s.children)n(r)};return n(e.root),t}function wa(e){let t=e.indexOf("/");return t>=0?e.slice(0,t):e}function ba(e,t){let n=[];for(let s of t.tracks){if(s.type!=="string")continue;let r=e.nodes.get(wa(s.target));if(r instanceof Ge)for(let i of s.keys){let o=i.value;typeof o=="string"&&o&&n.push({family:r.fontFamily,text:o})}}return n}async function Fs(e,t,n,s={}){var c,u;let r=(c=s.mode)!=null?c:"dev",i=pt(t.assets),o=[...Ii(e),...(u=s.extraUsages)!=null?u:[]],a=new Set;for(let h of o)if(i.has(h.family))for(let f of i.fallbackChain(h.family))a.add(f);let l=new Map;for(let h of a){let f=i.resolveFace(h);if(!f)continue;let d=await n(f.url);d&&l.set(h,Ht(d))}return as(o,i,l,r,M({},s.osFamilies!==void 0?{osFamilies:s.osFamilies}:{}))}var xt=class extends Error{constructor(t,n,s){super(`asset '${t}' not ready: ${n}. evaluate() never awaits \u2014 warm assets before evaluating (\xA72.5 readiness precondition)`);S(this,"assetId");S(this,"detail");S(this,"mediaT");this.name="ColdAssetError",this.assetId=t,this.detail=n,this.mediaT=s}},va=class extends re{constructor(t){var s;super(t);S(this,"wgsl");S(this,"uniformSignals");this.wgsl=t.wgsl;let n=new Map;for(let[r,i]of Object.entries((s=t.uniforms)!=null?s:{})){let o=A(i);n.set(r,o),this.registerTarget(`u.${r}`,o,"number")}this.uniformSignals=n}uniform(t){let n=this.uniformSignals.get(t);if(!n)throw new Error(`ShaderEffect has no uniform '${t}' (have: ${[...this.uniformSignals.keys()].join(", ")})`);return n}groupShader(){let t={};for(let[n,s]of this.uniformSignals)t[n]=s();return{wgsl:this.wgsl,uniforms:t}}},ka=e=>e*e*(3-2*e),xa=2.4,Sa=1-Math.exp(-5.76/2),Ma=e=>(1-Math.exp(-((e*xa)**2)/2))/Sa;function Ta(e,t){if(t==="linear"||e.length<2)return e;let n=t==="gaussian"?Ma:ka,s=e[0].offset,r=e[e.length-1].offset-s;if(r<=0)return e;let i=[],o=0;for(let a=0;a<64;a++){let l=s+r*(a/63);for(;o<e.length-2&&l>e[o+1].offset;)o++;let c=e[o],u=e[o+1],h=u.offset-c.offset,f=h>0?Math.min(1,Math.max(0,(l-c.offset)/h)):0;i.push({offset:l,color:he(c.color,u.color,n(f))})}return i}var Ea=4,Ia=2,Ps=.32,pi=1e-6,mi=1024;function $i(e,t,n){let s=new Uint8ClampedArray(Math.max(1,t)*Math.max(1,n)*4),r=e.points.map(l=>({u:l.pos[0],v:l.pos[1],lab:Oe(de(l.color))})),i=e.bg!==void 0?Oe(de(e.bg)):null,o=e.interpolation==="gaussian",a=2*Ps*Ps;for(let l=0;l<n;l++){let c=n>1?(l+.5)/n:.5;for(let u=0;u<t;u++){let h=t>1?(u+.5)/t:.5,f=0,d=0,g=0,m=0,v=0;i&&(f=1,d=i.L,g=i.a,m=i.b,v=i.alpha);let T=!1;for(let b=0;b<r.length;b++){let k=r[b],I=h-k.u,w=c-k.v,x=I*I+w*w;if(x<=pi*pi){d=k.lab.L,g=k.lab.a,m=k.lab.b,v=k.lab.alpha,T=!0;break}let E;o?E=Math.exp(-x/a):E=1/x,f+=E,d+=E*k.lab.L,g+=E*k.lab.a,m+=E*k.lab.b,v+=E*k.lab.alpha}let y;if(T)y=qe({L:d,a:g,b:m,alpha:v});else if(f>0){let b=1/f;y=qe({L:d*b,a:g*b,b:m*b,alpha:v*b})}else y={r:0,g:0,b:0,a:0};let p=(l*t+u)*4;s[p]=y.r,s[p+1]=y.g,s[p+2]=y.b,s[p+3]=Math.round(y.a*255)}}return s}function Ci(e,t){return{w:Math.min(mi,Math.max(1,Math.ceil(Math.abs(e)/4))),h:Math.min(mi,Math.max(1,Math.ceil(Math.abs(t)/4)))}}var gi=!1;function $a(e){var t,n,s;return gi||(gi=!0,q("mesh Paint on a stroke/text resolves to a representative solid color (mesh fill is supported only on filled paths, \xA73 Paint) \u2014 use a fillPath for the mesh gradient")),(s=(n=e.bg)!=null?n:(t=e.points[0])==null?void 0:t.color)!=null?s:"#00000000"}function Cs(e,t,n){if(t.kind==="color")return t.color;if(t.kind==="mesh")return $a(t);let s;if(t.kind==="radial"){let i=t.center?t.center[0]:n?(n.minX+n.maxX)/2:0,o=t.center?t.center[1]:n?(n.minY+n.maxY)/2:0,a=t.radius!==void 0?t.radius:n?Math.hypot(n.maxX-n.minX,n.maxY-n.minY)/2:0;s=e.createRadialGradient(i,o,0,i,o,a)}else{let i=t.from?t.from[0]:n?(n.minX+n.maxX)/2:0,o=t.from?t.from[1]:n?n.minY:0,a=t.to?t.to[0]:n?(n.minX+n.maxX)/2:0,l=t.to?t.to[1]:n?n.maxY:0;s=e.createLinearGradient(i,o,a,l)}let r=t.interpolation?Ta(t.stops,t.interpolation):t.stops;for(let i of r)s.addColorStop(i.offset,i.color);return s}function bn(e){return`${e.style==="italic"?"italic ":""}${e.weight!==void 0&&e.weight!==400?`${e.weight} `:""}${e.size}px ${e.family}`}var Ca=16;function Oa(e){let t=n=>Object.is(n,-0)?"0":String(Math.round(n*1e4)/1e4);return`${t(e[0])},${t(e[1])},${t(e[2])},${t(e[3])},${t(e[4])},${t(e[5])}`}function Aa(e){let t=0;for(let n of e!=null?e:[])n.kind==="blur"?t+=3*n.radius:n.kind==="drop-shadow"&&(t+=Math.max(Math.abs(n.dx),Math.abs(n.dy))+3*n.blur);return t}function Oi(e,t,n){return e?(t<e.minX&&(e.minX=t),n<e.minY&&(e.minY=n),t>e.maxX&&(e.maxX=t),n>e.maxY&&(e.maxY=n),e):{minX:t,minY:n,maxX:t,maxY:n}}function kt(e,t,n,s,r,i){for(let[o,a]of[[n,s],[r,s],[n,i],[r,i]])e.bounds=Oi(e.bounds,t[0]*o+t[2]*a+t[4],t[1]*o+t[3]*a+t[5])}function Pa(e){let t=null,n=(s,r)=>{t=Oi(t,s,r)};for(let s of e)switch(s[0]){case"M":case"L":n(s[1],s[2]);break;case"C":n(s[1],s[2]),n(s[3],s[4]),n(s[5],s[6]);break;case"Q":n(s[1],s[2]),n(s[3],s[4]);break;case"E":{let r=Math.max(s[3],s[4]);n(s[1]-r,s[2]-r),n(s[1]+r,s[2]+r);break}}return t}var Rs=class{constructor(e,t="warn",n=(i=>(i=(r=>(r=(s=>(s=globalThis.process)==null?void 0:s.env)())==null?void 0:r.RASTER_CACHE)())!=null?i:"1")()!=="0"){S(this,"host");S(this,"shaderCaps");S(this,"pool",[]);S(this,"pathCache",new WeakMap);S(this,"pathBoundsCache",new WeakMap);S(this,"images",new Map);S(this,"videos",new Map);S(this,"warnedShaders",!1);S(this,"rasterCache",new Map);S(this,"cacheEnabled");this.host=e,this.shaderCaps=t,this.cacheEnabled=n}setImageAsset(e,t){this.images.set(e,t)}setVideoAsset(e,t){this.videos.set(e,t)}dispose(){this.pool.length=0,this.rasterCache.clear()}resolveDrawable(e,t){if(e.kind==="image"){let n=this.images.get(e.assetId);if(!n)throw new xt(e.assetId,"no decoded image registered");return n}if(e.kind==="videoFrame"){let n=this.videos.get(e.assetId);if(!n)throw new xt(e.assetId,"no VideoFrameSource registered",e.mediaT);try{return n.getFrameSync(e.mediaT)}catch(s){throw s instanceof xt?new xt(e.assetId,s.detail,e.mediaT):s}}throw new Error(`resource ${t} is not drawable`)}path(e,t){let n=e[t];if(!n||n.kind!=="path")throw new Error(`resource ${t} is not a path`);let s=this.pathCache.get(n);return s||(s=this.buildPath(n.segs),this.pathCache.set(n,s)),s}pathBounds(e,t){var s;let n=e[t];return!n||n.kind!=="path"?null:(this.pathBoundsCache.has(n)||this.pathBoundsCache.set(n,Pa(n.segs)),(s=this.pathBoundsCache.get(n))!=null?s:null)}buildPath(e){let t=this.host.newPath();for(let n of e)switch(n[0]){case"M":t.moveTo(n[1],n[2]);break;case"L":t.lineTo(n[1],n[2]);break;case"C":t.bezierCurveTo(n[1],n[2],n[3],n[4],n[5],n[6]);break;case"Q":t.quadraticCurveTo(n[1],n[2],n[3],n[4]);break;case"E":t.ellipse(n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"Z":t.closePath();break}return t}acquire(e,t){let n=this.pool.pop();return n?(n.width!==e&&(n.width=e),n.height!==t&&(n.height=t),n):this.host.createCanvas(e,t)}release(e){this.pool.length<8&&this.pool.push(e)}cacheStore(e,t){let n=this.rasterCache.get(e);for(n&&(this.rasterCache.delete(e),n.canvas!==t.canvas&&this.release(n.canvas)),this.rasterCache.set(e,t);this.rasterCache.size>Ca;){let s=this.rasterCache.keys().next().value;if(s===void 0)break;let r=this.rasterCache.get(s);this.rasterCache.delete(s),this.release(r.canvas)}}cacheTouch(e){let t=this.rasterCache.get(e);return t&&(this.rasterCache.delete(e),this.rasterCache.set(e,t)),t}fillMesh(e,t,n,s){let r=s.maxX-s.minX,i=s.maxY-s.minY;if(r<=0||i<=0)return;let{w:o,h:a}=Ci(r,i),l=$i(n,o,a),c=this.acquire(o,a),u=this.host.context(c),h=u.createImageData(o,a);h.data.set(l),u.putImageData(h,0,0),e.save(),e.clip(t,"nonzero"),e.imageSmoothingEnabled=!0,e.drawImage(c,0,0,o,a,s.minX,s.minY,r,i),e.restore(),this.release(c)}composite(e,t,n,s,r,i,o,a,l,c,u,h){let f=l!==void 0&&l!=="none",d=f?Aa(c):0;r||a!=="source-over"?t.unbounded=!0:s&&kt(t,Ie,s.minX-d,s.minY-d,s.maxX+d,s.maxY+d);let g=f&&!i&&!r&&a==="source-over";if(!(g&&s===null)){if(e.save(),e.resetTransform(),g&&s){let m=Math.max(0,Math.floor(s.minX-d)),v=Math.max(0,Math.floor(s.minY-d)),T=Math.min(u,Math.ceil(s.maxX+d)),y=Math.min(h,Math.ceil(s.maxY+d));if(m>=T||v>=y){e.restore();return}let p=this.host.newPath();p.moveTo(m,v),p.lineTo(T,v),p.lineTo(T,y),p.lineTo(m,y),p.closePath(),e.clip(p,"nonzero")}e.globalAlpha=o,f&&(e.filter=l),e.globalCompositeOperation=a,e.drawImage(n,0,0),e.restore()}}render(e,t){var h,f,d,g,m,v,T,y,p,b,k;let{w:n,h:s}=t.size;e.width!==n&&(e.width=n),e.height!==s&&(e.height=s);let r=this.host.context(e);r.resetTransform(),r.clearRect(0,0,n,s);let i=[{ctx:r,canvas:null,opacity:1,blend:"source-over",bounds:null,unbounded:!1}],o=()=>i[i.length-1].ctx,a=()=>i[i.length-1],l=Ie,c=[],u=t.commands;for(let I=0;I<u.length;I++){let w=u[I];switch(w.op){case"save":c.push(l),o().save();break;case"restore":l=(h=c.pop())!=null?h:l,o().restore();break;case"transform":l=gt(l,w.m),o().transform(w.m[0],w.m[1],w.m[2],w.m[3],w.m[4],w.m[5]);break;case"clip":o().clip(this.path(t.resources,w.path),(f=w.rule)!=null?f:"nonzero");break;case"fillPath":{let x=o(),E=this.pathBounds(t.resources,w.path);w.paint.kind==="mesh"&&E?this.fillMesh(x,this.path(t.resources,w.path),w.paint,E):(x.fillStyle=Cs(x,w.paint,E),x.fill(this.path(t.resources,w.path))),E&&kt(a(),l,E.minX,E.minY,E.maxX,E.maxY);break}case"strokePath":{let x=o(),E=this.pathBounds(t.resources,w.path);if(x.strokeStyle=Cs(x,w.paint,E),x.lineWidth=w.stroke.width,x.lineCap=(d=w.stroke.cap)!=null?d:"butt",x.lineJoin=(g=w.stroke.join)!=null?g:"miter",w.stroke.dash&&(x.setLineDash(w.stroke.dash),x.lineDashOffset=(m=w.stroke.dashOffset)!=null?m:0),x.stroke(this.path(t.resources,w.path)),w.stroke.dash&&(x.setLineDash([]),x.lineDashOffset=0),E){let $=w.stroke.width*(((v=w.stroke.join)!=null?v:"miter")==="miter"?5:1);kt(a(),l,E.minX-$,E.minY-$,E.maxX+$,E.maxY+$)}break}case"fillText":{let x=o();x.font=bn(w.font),x.fillStyle=Cs(x,w.paint,null),x.textBaseline="alphabetic",x.textAlign=(T=w.align)!=null?T:"left",x.fillText(w.text,w.x,w.y);try{let E=x.measureText(w.text).width,$=(y=w.align)!=null?y:"left",D=$==="center"?w.x-E/2:$==="right"?w.x-E:w.x,N=w.font.size;kt(a(),l,D-N,w.y-1.5*N,D+E+N,w.y+.75*N)}catch(E){a().unbounded=!0}break}case"drawImage":{let x=t.resources[w.image];if(!x)throw new Error(`drawImage references missing resource ${w.image}`);let E=this.resolveDrawable(x,w.image),$=o();w.smoothing!==void 0&&($.imageSmoothingEnabled=w.smoothing);let{x:D,y:N,w:B,h:K}=w.dst;w.src?$.drawImage(E,w.src.x,w.src.y,w.src.w,w.src.h,D,N,B,K):$.drawImage(E,D,N,B,K),kt(a(),l,D,N,D+B,N+K);break}case"pushGroup":{let x=o(),E=this.cacheEnabled&&w.cacheKey!==void 0&&w.shader===void 0?`${w.cacheKey}@${Oa(l)}`:void 0;if(E!==void 0){let N=this.cacheTouch(E);if(N){this.composite(x,a(),N.canvas,N.bounds,N.unbounded,!1,w.opacity,w.blend,an(w.filters),w.filters,n,s);let B=1;for(;B>0&&++I<u.length;){let K=u[I];K.op==="pushGroup"?B++:K.op==="popGroup"&&B--}break}}let $=this.acquire(n,s),D=this.host.context($);D.resetTransform(),D.clearRect(0,0,n,s),D.setTransform(x.getTransform()),i.push(M(L(M({ctx:D,canvas:$,opacity:w.opacity,blend:w.blend,filter:an(w.filters),filters:w.filters},w.shader!==void 0?{shader:w.shader}:{}),{bounds:null,unbounded:!1}),E!==void 0?{cacheStoreKey:E}:{}));break}case"popGroup":{let x=i.pop();if(!x||x.canvas===null)throw new Error("popGroup without matching pushGroup");let E=o(),$=x.canvas,D=!1;if(x.shader!==void 0){let N=(k=(b=(p=this.host).applyShader)==null?void 0:b.call(p,x.canvas,x.shader,n,s))!=null?k:null;if(N!==null)$=N,D=!0,x.bounds={minX:0,minY:0,maxX:n,maxY:s},x.unbounded=!1;else{if(this.shaderCaps==="error")throw new Error("a ShaderEffect reached a backend without a shader runner (\xA73.7) \u2014 load @glissade/effects-webgpu in the browser, or accept passthrough with caps.shaders: warn");this.warnedShaders||(this.warnedShaders=!0,q("ShaderEffect pass skipped: no shader runner here (headless or webgpu-less browser) \u2014 subtree composites unfiltered (\xA73.7 caps.shaders)"))}}this.composite(E,a(),$,x.bounds,x.unbounded,D,x.opacity,x.blend,x.filter,x.filters,n,s),x.cacheStoreKey!==void 0&&!D?this.cacheStore(x.cacheStoreKey,{canvas:x.canvas,bounds:x.bounds,unbounded:x.unbounded}):this.release(x.canvas);break}}}if(i.length!==1)throw new Error("unbalanced pushGroup/popGroup in DisplayList")}};var Tt=null;function Ai(e){Tt=e}function Da(e,t){if(typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(e,t);let n=document.createElement("canvas");return n.width=e,n.height=t,n}var Fa=16384,Le=class{constructor(e,t={}){S(this,"target");S(this,"raster");var n;this.target=e,this.raster=new Rs({context:s=>this.context(s),createCanvas:(s,r)=>Da(s,r),newPath:()=>new Path2D,applyShader:(s,r,i,o)=>{var a;return(a=Tt==null?void 0:Tt.apply(s,r,i,o))!=null?a:null}},(n=t.shaderCaps)!=null?n:"warn")}get caps(){return{filters:Ds,shaders:Tt!==null,maxTextureSize:Fa}}setImageAsset(e,t){this.raster.setImageAsset(e,t)}setVideoAsset(e,t){this.raster.setVideoAsset(e,t)}measureText(e,t){let n=this.context(this.target);n.save(),n.font=bn(t);let s=n.measureText(e);return n.restore(),{width:s.width,ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent}}render(e){this.raster.render(this.target,e)}async readPixels(){return this.context(this.target).getImageData(0,0,this.target.width,this.target.height).data}get canvas(){return this.target}dispose(){this.raster.dispose()}context(e){let t=e.getContext("2d");if(!t)throw new Error("canvas 2d context unavailable");return t}};async function Ra(e){let t=new Uint8Array(await e.arrayBuffer()),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return`data:${e.type||"image/png"};base64,${btoa(n)}`}function La(e){return e instanceof Le?e.canvas:e}async function Ls(e,t="image/png",n){let s=La(e);if(typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas)return await Ra(await s.convertToBlob(M({type:t},n!==void 0?{quality:n}:{})));let r=s;if(typeof r.toDataURL!="function")throw new Error("snapshotCanvas() is browser-only: canvas has no toDataURL/convertToBlob");return n!==void 0?r.toDataURL(t,n):r.toDataURL(t)}async function Pi(e,t,n,s){var u;let r=t!==void 0&&typeof t.version=="number",i=r?t:void 0,o=(u=r?s:t)!=null?u:{},{w:a,h:l}=e.size,c=new Le(typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,l):Object.assign(document.createElement("canvas"),{width:a,height:l}));try{return c.render(i!==void 0?we(e,i,n!=null?n:0):we(e)),await Ls(c,o.type,o.quality)}finally{c.dispose()}}var le=class extends Error{constructor(e){super(e),this.name="ClipError"}};function Di(e,t,n){let s;try{s=Ae(n)}catch(i){throw new le(`clip override for '${e}' has an un-typeable value ${JSON.stringify(n)} (channel type '${t}')`)}let r=i=>i==="color"||i==="string";if(!(s===t||r(s)&&r(t)))throw new le(`clip override for '${e}' is a '${s}' value but the channel is '${t}' (${JSON.stringify(n)}); a mismatched override samples to NaN`);return n}function Fi(e){return e.keys.length===0?0:e.keys[e.keys.length-1].t}function Na(e,t,n){if(typeof e=="string")return Se(`${e}/${n}`);let s=e[t];if(s===void 0)throw new le(`clip target map is missing channel '${t}' \u2014 provide a target for every channel, or pass a node-id string`);return Se(s)}function za(e,t,n,s,r){var a;if(t.keys.length===0)throw new le(`clip channel '${e}' has no keys`);let i=(a=t.type)!=null?a:Ae(t.keys[0].value),o=t.keys.length-1;if(r&&o===0&&r.from!==void 0)throw new le(r.to!==void 0?`clip override for '${e}' supplies both 'from' and 'to' on a single-key channel \u2014 ambiguous (both target the only key)`:`clip override for '${e}' supplies 'from' on a single-key channel \u2014 ambiguous (the only key already is the 'to' value)`);return pe(e,i,t.keys.map((l,c)=>{let u=l.value,h=!1;r&&(c===0&&r.from!==void 0&&(u=Di(e,i,r.from),h=!0),c===o&&r.to!==void 0&&(u=Di(e,i,r.to),h=!0));let f={t:n+l.t/s,value:u},d=r&&c===o&&r.ease!==void 0?r.ease:l.ease;return d!==void 0&&(f.ease=d),l.interp!==void 0&&(f.interp=l.interp),l.id!==void 0&&(f.id=l.id),l.derived!==void 0&&!h&&(f.derived=l.derived),l.from!==void 0&&(f.from=l.from),f}))}function be(e){let t=Object.keys(e.channels);if(t.length===0)throw new le("clip() requires at least one channel");let n=0;for(let r of t){let i=e.channels[r];if(i.keys.length===0)throw new le(`clip channel '${r}' has no keys`);n=Math.max(n,Fi(i))}function s(r,i,o){var h;let a=(h=o==null?void 0:o.speed)!=null?h:1;if(!(a>0))throw new le(`clip speed must be > 0 (got ${a})`);let l=o==null?void 0:o.overrides,c=[],u=i;for(let f of t){let d=e.channels[f],g=Na(r,f,d.path);c.push(za(g,d,i,a,l==null?void 0:l[f])),u=Math.max(u,i+Fi(d)/a)}if(l){for(let f of Object.keys(l))if(!(f in e.channels))throw new le(`clip override references unknown channel '${f}'`)}return{tracks:c,end:u}}return{spec:e,duration:n,apply:s}}function Ba(e,t,n,s){var u;let r=(u=s==null?void 0:s.stagger)!=null?u:0,i=typeof r=="function"?r:f=>f*r,h=s!=null?s:{},{stagger:o}=h,a=Ve(h,["stagger"]),l=[],c=n;return t.forEach((f,d)=>{let g=e.apply(f,n+i(d),a);l.push(...g.tracks),g.end>c&&(c=g.end)}),{tracks:l,end:c}}function Va(e){var s,r;let t=(s=e==null?void 0:e.duration)!=null?s:.3,n=(r=e==null?void 0:e.ease)!=null?r:"easeOutCubic";return be({channels:{opacity:{path:"opacity",keys:[O(0,0),O(t,1,n)]},scale:{path:"scale",keys:[O(0,[.8,.8]),O(t,[1,1],n)]}}})}function _a(e,t){var o,a,l;let n=(o=t==null?void 0:t.duration)!=null?o:.3,s=(a=t==null?void 0:t.ease)!=null?a:"easeOutCubic",r=(l=t==null?void 0:t.distance)!=null?l:40,i=e==="left"?[-r,0]:e==="right"?[r,0]:e==="top"?[0,-r]:[0,r];return be({channels:{opacity:{path:"opacity",keys:[O(0,0),O(n,1,s)]},offset:{path:"position",keys:[O(0,i),O(n,[0,0],s)]}}})}function qa(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:.4,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.scale)!=null?o:1.1;return be({channels:{scale:{path:"scale",keys:[O(0,[1,1]),O(t/2,[s,s],n),O(t,[1,1],n)]}}})}function Wa(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:2,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.amplitude)!=null?o:8;return be({channels:{drift:{path:"position",keys:[O(0,[0,0]),O(t/2,[s,0],n),O(t,[0,0],n)]}}})}var Qe=class extends Error{constructor(e){super(e),this.name="MorphError"}};function Ns(e,t){for(let[n,s]of[["x",t.x],["y",t.y],["w",t.w],["h",t.h]])if(!Number.isFinite(s))throw new Qe(`morph ${e}.${n} must be finite (got ${s})`);if(!(t.w>0)||!(t.h>0))throw new Qe(`morph ${e} must have w>0 and h>0 (got w=${t.w}, h=${t.h}); a zero/negative box yields a NaN/Infinity scale`)}function vn(e,t){let n=typeof e=="string"?e:e[Pe];return typeof n!="string"||n.length===0?`${String(n)}/${t}`:`${typeof e=="string"?n:n.slice(0,Math.max(0,n.lastIndexOf("/")))}/${t}`}function ja(e,t,n,s){var T,y,p;let{at:r,duration:i}=s,o=s.ease,a=(T=s.crossfade)!=null?T:.5,l=(y=s.metric)!=null?y:"transform";if(l!=="transform")throw new Qe(`morph metric '${l}' is not supported in v1 (only 'transform')`);if(Ns("from",e),Ns("to",t),!(i>0))throw new Qe(`morph duration must be > 0 (got ${i})`);if(!(a>=0&&a<=1))throw new Qe(`morph crossfade must be in [0,1] (got ${a})`);let c=(p=s.base)!=null?p:{w:t.w,h:t.h};Ns("to",{x:0,y:0,w:c.w,h:c.h});let u=[e.w/c.w,e.h/c.h],h=[t.w/c.w,t.h/c.h],f=[e.x,e.y],d=[t.x,t.y],g={position:{path:"position",type:"vec2",keys:[O(0,f),O(i,d,o)]},scale:{path:"scale",type:"vec2",keys:[O(0,u),O(i,h,o)]}},m={position:vn(n.morphNode,"position"),scale:vn(n.morphNode,"scale")};n.fromNode!==void 0&&i*a>0&&(g.fromOpacity={path:"opacity",type:"number",keys:[O(0,1),O(i*a,0,o)]},m.fromOpacity=vn(n.fromNode,"opacity")),n.toNode!==void 0&&i*(1-a)<i&&(g.toOpacity={path:"opacity",type:"number",keys:[O(i*(1-a),0),O(i,1,o)]},m.toOpacity=vn(n.toNode,"opacity"));let{tracks:v}=be({channels:g}).apply(m,r);return{tracks:v,end:r+i}}var Bs=class extends Error{constructor(e){super(e),this.name="PresenceError"}},_s=.3;function Ha(){return be({channels:{opacity:{path:"opacity",keys:[O(0,0),O(_s,1)]}}})}function Ya(){return be({channels:{opacity:{path:"opacity",keys:[O(0,1),O(_s,0)]}}})}function Ua(e){return typeof e.apply=="function"}function Vs(e){return Array.isArray(e)}function zi(e,t){var i,o;let n=(i=e.dur)!=null?i:_s,s=e.ease,r={};if(e.opacity!==void 0){let[a,l]=e.opacity;r.opacity={path:"opacity",keys:[O(0,a),O(n,l,...zs(s))]}}if(e.offset!==void 0){let[a,l]=Ga(e.offset,(o=e.edge)!=null?o:"bottom",t);r.offset={path:"position",keys:[O(0,a),O(n,l,...zs(s))]}}if(e.scale!==void 0){let[a,l]=Ka(e.scale);r.scale={path:"scale",keys:[O(0,a),O(n,l,...zs(s))]}}return be({channels:r})}function zs(e){return e!==void 0?[e]:[]}function Xa(e,t){return e==="left"?[-t,0]:e==="right"?[t,0]:e==="top"?[0,-t]:[0,t]}function Ga(e,t,n){if(Array.isArray(e)&&Vs(e[0]))return e;let s=Vs(e)?e:Xa(t,e),r=[0,0];return n==="enter"?[s,r]:[r,s]}function Ka(e){let[t,n]=e,s=r=>Vs(r)?r:[r,r];return[s(t),s(n)]}function Ri(e,t,n){return e===void 0?n():Ua(e)?e:zi(e,t)}function Li(e,t){var n;return e.duration/((n=t==null?void 0:t.speed)!=null?n:1)}function Qa(e){return e.map((t,n)=>[t,n]).sort((t,n)=>t[0].t-n[0].t||t[1]-n[1]).map(([t])=>t)}function Ni(e,t){let n=[],s=[];for(let r of e)r.target===t?s=r.keys:n.push(r);return{opacityKeys:s,rest:n}}function Bi(e){let t=Qa(e),n=[];for(let s of t){let r=n[n.length-1];r&&r.t===s.t?n[n.length-1]=s:n.push(s)}return n}function Ja(e,t){let n=[],s=new Map;for(let r of[...e,...t]){let i=s.get(r.target);i?i.push(r):(s.set(r.target,[r]),n.push(r.target))}return n.map(r=>{let i=s.get(r);if(i.length===1)return i[0];let o=i.flatMap(a=>a.keys);return pe(r,i[0].type,Bi(o))})}function Za(e,t){var b,k,I,w;let n=(k=t.show)!=null?k:(b=t.window)==null?void 0:b[0],s=(w=t.hide)!=null?w:(I=t.window)==null?void 0:I[1];if(n===void 0||s===void 0)throw new Bs("presence() needs a window: pass { show, hide } or { window: [show, hide] }");let r=Se(typeof e=="string"?`${e}/opacity`:e),i=r.lastIndexOf("/"),o=i<0?r:r.slice(0,i),a=Ri(t.enter,"enter",Ha),l=Ri(t.exit,"exit",Ya),c=a.apply(o,n,t.enterOpts),u=n+Li(a,t.enterOpts),h=Li(l,t.exitOpts),f=s-h;if(f<=n)throw new Bs(`presence('${o}') exit needs ${h.toFixed(3)}s but only ${(s-n).toFixed(3)}s between show (${n}) and hide (${s}) \u2014 widen the window or shorten/speed up the exit`);let d=l.apply(o,f,t.exitOpts),{opacityKeys:g,rest:m}=Ni(c.tracks,r),{opacityKeys:v,rest:T}=Ni(d.tracks,r),y=[O(0,0,{interp:"hold"}),O(u,1,{interp:"hold"}),O(s,0,{interp:"hold"})],p=[];if(g.length>0?g.forEach((x,E)=>{E===0&&x.value!==0&&x.interp!=="hold"?p.push(L(M({},x),{interp:"hold"})):p.push(x)}):p.push(O(n,0),O(u,1)),v.length>0)for(let x of v)p.push(x);else p.push(O(f,1),O(s,0));return{tracks:[pe(r,"number",Bi([...y,...p])),...Ja(m,T)],end:s,shownAt:n,hiddenAt:s}}function Vi(e){var h;let t=(h=e.match(/[MmLlHhVvCcQqZz]|-?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))!=null?h:[],n=[],s=0,r=0,i=0,o=0,a=0,l="",c=()=>Number(t[s++]),u=f=>!!f&&/^[MmLlHhVvCcQqZz]$/.test(f);for(;s<t.length;){let f=t[s];if(u(f)?s++:f=l==="M"?"L":l==="m"?"l":l,!f)break;let d=f===f.toLowerCase();switch(f.toUpperCase()){case"M":{let g=c()+(d?r:0),m=c()+(d?i:0);r=g,i=m,o=g,a=m,n.push(["M",g,m]);break}case"L":{let g=c()+(d?r:0),m=c()+(d?i:0);r=g,i=m,n.push(["L",g,m]);break}case"H":{let g=c()+(d?r:0);r=g,n.push(["L",g,i]);break}case"V":{let g=c()+(d?i:0);i=g,n.push(["L",r,g]);break}case"C":{let g=c()+(d?r:0),m=c()+(d?i:0),v=c()+(d?r:0),T=c()+(d?i:0),y=c()+(d?r:0),p=c()+(d?i:0);r=y,i=p,n.push(["C",g,m,v,T,y,p]);break}case"Q":{let g=c()+(d?r:0),m=c()+(d?i:0),v=c()+(d?r:0),T=c()+(d?i:0);r=v,i=T,n.push(["Q",g,m,v,T]);break}case"Z":n.push(["Z"]),r=o,i=a;break;default:s++;break}l=f}return n}function ec(e){return hn(Vi(e))}var _i="0.19.0-pre.3",tc=_i.includes("GLISSADE_".concat("VERSION"))?"0.0.0-dev":_i;function qi(e){if(e==="number")return 1;if(e==="vec2"||e==="vec2-arc")return 2}function nc(e){return e===void 0?"unknown":Array.isArray(e)?e.join("|"):e}var sc={Group:{children:{type:"Node[]"}},Rect:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Circle:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Path:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Text:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"'normal'|'italic'"},align:{type:"'left'|'center'|'right'"},lineHeight:{type:"number"}},Image:{assetId:{type:"string",required:!0}},Video:{assetId:{type:"string",required:!0},at:{type:"number"},trimStart:{type:"number"},playbackRate:{type:"number"},clipDuration:{type:"number"},sourceFps:{type:"number"}}},rc={id:{type:"string"},blend:{type:"BlendMode"},filters:{type:"FilterSpec[]"},anchor:{type:"AnchorSpec"},cache:{type:"boolean"}};function Wi(e,t){var r;let n={};for(let{path:i,expects:o}of e.listTargets()){let a=nc(o),l=qi(a);n[i]=M({type:a,animatable:!0,target:`<id>/${i}`},l!==void 0?{arity:l}:{})}let s=M(M({},rc),(r=sc[t])!=null?r:{});for(let[i,o]of Object.entries(s))n[i]=M({type:o.type,animatable:!1},o.required?{required:!0}:{});return{props:n}}var ic="@glissade/scene/layout",oc={width:{type:"number"},height:{type:"number"},gap:{type:"number"},padding:{type:"number"}},ac={direction:{type:"'row'|'column'"},justify:{type:"'start'|'center'|'end'|'space-between'|'space-around'"},align:{type:"'start'|'center'|'end'|'stretch'"},children:{type:"Node[]"}};function cc(){let e=Wi(new re,"Group").props;delete e.children;for(let[n,s]of Object.entries(oc)){let r=qi(s.type);e[n]=M({type:s.type,animatable:!0,target:`<id>/${n}`},r!==void 0?{arity:r}:{})}let t=ac;for(let[n,s]of Object.entries(t))e[n]=M({type:s.type,animatable:!1},s.required?{required:!0}:{});return{props:e,subpath:ic}}var lc={Group:()=>new re,Rect:()=>new fn,Circle:()=>new dn,Path:()=>new vt,Text:()=>new Ge,Image:()=>new pn({assetId:"~describe"}),Video:()=>new mn({assetId:"~describe"})},uc=[{name:"to",signature:"to<T>(target, value, opts?: { duration?, ease?, at?, from? }): TimelineBuilder"},{name:"fromTo",signature:"fromTo<T>(target, from, to, opts?: { duration?, ease?, at? }): TimelineBuilder"},{name:"stagger",signature:"stagger<T>(targets, { to: T | ((index, count) => T), from?: T | ((index, count) => T), duration?, ease? }, { each: number | ((rank, count) => number), anchor?, at? }): TimelineBuilder"},{name:"tracks",signature:"tracks(tracks: Track[]): TimelineBuilder"},{name:"set",signature:"set<T>(target, value, opts?: { at? }): TimelineBuilder"},{name:"label",signature:"label(name, at?): TimelineBuilder"},{name:"add",signature:"add(child, at?, opts?: { mode?: 'add'|'sync', timeScale? }): TimelineBuilder"},{name:"sequence",signature:"sequence(subs, opts?: { gap? }): TimelineBuilder"},{name:"at",signature:"at(time, sub): TimelineBuilder"},{name:"call",signature:"call(fn, at?): TimelineBuilder"},{name:"cue",signature:"cue(at, name, data?): TimelineBuilder"},{name:"adBreak",signature:"adBreak(at, opts?: { id?, duration? }): TimelineBuilder"},{name:"editable",signature:"editable(): TimelineBuilder"},{name:"editableDuration",signature:"editableDuration(): TimelineBuilder"}],hc={"@glissade/core/clips":"motion clips: clip/clipList + the popIn/slideIn/pulse/driftLoop literals, presence (enter/exit) and morph (box-FLIP) build-time sugar.","@glissade/core/i18n":"localization: requireParity (id-set diff), localize (doc\u2192doc resolver), t() ambient-table sugar.","@glissade/scene/layout":"flexbox: the Yoga-backed Layout node + LayoutEngine (the only entry that ships Yoga wasm).","@glissade/scene/path":"SVG geometry: pathFromSvg / parseSvgPathData \u2014 parse an SVG `d` string into a PathValue for Path.data."};function fc(){let e={};for(let[n,s]of Object.entries(lc))e[n]=Wi(s(),n);let t=cc();for(let n of["Layout","Stack","Row","Column"])e[n]=t;return{version:tc,nodes:e,valueTypes:Vt(),easings:Object.keys(ot),builder:{methods:uc},createScene:"createScene({ size: { w, h }, children: Node[] }): Scene \u2014 media assets are declared on the Timeline document: timeline({ assets: { <id>: { kind: 'image'|'video', url } } }); an Image/Video node's `assetId` names an entry here.",subpaths:hc}}function ji(){let e=0,t=!1;return{start(n){t=!0;let s,r=i=>{t&&(s!=null||(s=i),n((i-s)/1e3),e=requestAnimationFrame(r))};e=requestAnimationFrame(r)},stop(){t=!1,cancelAnimationFrame(e)}}}function dc(e){var r;let t=(r=e.axis)!=null?r:"y",n=null,s=e.source;return{start(i,o){var c,u;let a=(u=e.range)!=null?u:[0,(c=o.duration)!=null?c:1],l=()=>{if(s instanceof Element){let g=t==="y"?s.scrollHeight-s.clientHeight:s.scrollWidth-s.clientWidth,m=t==="y"?s.scrollTop:s.scrollLeft;return g>0?m/g:0}let h=document.documentElement,f=t==="y"?h.scrollHeight-window.innerHeight:h.scrollWidth-window.innerWidth,d=t==="y"?window.scrollY:window.scrollX;return f>0?d/f:0};n=()=>{let h=Math.min(1,Math.max(0,l()));i(a[0]+h*(a[1]-a[0]))},s.addEventListener("scroll",n,{passive:!0}),n()},stop(){n&&s.removeEventListener("scroll",n),n=null}}}var Hi=class extends Error{constructor(e){super(`machine targets overlap an already-bound target set: ${e.join(", ")} \u2014 concurrent writers to one property is the silent last-writer-wins \xA72.2 exists to kill`),this.name="TargetOverlapError"}};function Yi(e,t={}){var N,B,K,et,ze,Be,tt;let{playhead:n}=e,s=e.duration,r=(N=e.markers)!=null?N:[],i=(B=e.driver)!=null?B:ji(),o=(K=t.loop)!=null?K:!1,a=(et=t.background)!=null?et:"pause",l=(ze=e.visibility)!=null?ze:(()=>"visible"),c=new Map,u=new Map,h=(Be=t.rate)!=null?Be:1,f=!1,d=A(!1),g=C=>{f=C,d.set(C)},m=!1,v=new Set((tt=e.targets)!=null?tt:[]),T=[],y=0,p=null,b=0,k=[0,s],I=0,w=null;function x(C,P){var V,W,Q;if(C===P||c.size===0&&u.size===0)return;let R=P>C;for(let oe of r){if(!(R?oe.t>C&&oe.t<=P:oe.t>=P&&oe.t<C))continue;for(let Sn of(V=c.get(oe.name))!=null?V:[])Sn(oe);let Ce=(W=oe.data)==null?void 0:W.kind;if(typeof Ce=="string")for(let Sn of(Q=u.get(Ce))!=null?Q:[])Sn(oe)}}function E(C){g(!1),p=null;let P=w;w=null,P==null||P(C)}function $(C){b=C;for(let Ce of T)Ce.step(C);if(!f)return;if(a==="pause"&&l()==="hidden"){y=n.peek(),p=null;return}p!=null||(p=C);let P=n.peek(),R=y+(C-p)*h,[V,W]=k;if(!(h>=0?R>=W:R<=V)){n.set(R),x(P,R);return}let Q=o===!0?{mode:"restart"}:o===!1?null:o,oe=Q&&"count"in Q&&Q.count!==void 0?Q.count:1/0;if(!Q||I+1>=oe){let Ce=h>=0?W:V;n.set(Ce),x(P,Ce),E(!0);return}I++,W-V,Q.mode==="alternate"?(x(P,h>=0?W:V),h=-h,y=h>=0?V:W):(x(P,h>=0?W:V),y=h>=0?V:W),p=C,R=y,n.set(R)}function D(){m||(m=!0,i.start($,{duration:s,visibility:l}))}return{playhead:n,get duration(){return s},get playing(){return f},playingSignal:d,get rate(){return h},set rate(C){y=n.peek(),p=f?b:null,h=C},play(C){var W;w&&E(!1),k=(W=C==null?void 0:C.range)!=null?W:[0,s];let P=n.peek(),[R,V]=k;return y=h>=0?P>=V||P<R?R:P:P<=R||P>V?V:P,n.set(y),p=null,I=0,g(!0),D(),{finished:new Promise(Q=>{w=Q})}},pause(){f&&(y=n.peek(),E(!1))},seek(C){y=Math.min(Math.max(C,0),s),p=f?b:null,n.set(y)},swap(C){var R,V;s=C.duration,r=(R=C.markers)!=null?R:[],v=new Set((V=C.targets)!=null?V:[]);let P=Math.min(n.peek(),s);k=[0,s],y=P,p=f?b:null,I=0,n.set(P)},attach(C){if(C.targets){let P=[];for(let R of C.targets)v.has(R)?P.push(`'${R}' (player timeline)`):T.some(V=>{var W;return(W=V.targets)==null?void 0:W.has(R)})&&P.push(`'${R}' (another machine)`);if(P.length>0)throw new Hi(P)}return T.push(C),D(),()=>{let P=T.indexOf(C);P>=0&&T.splice(P,1)}},onMarker(C,P){let R=c.get(C);return R||(R=new Set,c.set(C,R)),R.add(P),()=>R.delete(P)},onCue(C,P){let R=u.get(C);return R||(R=new Set,u.set(C,R)),R.add(P),()=>R.delete(P)},dispose(){f&&E(!1),T.length=0,m&&i.stop(),m=!1}}}function Ui(e,t,n,s,r){var o;let i=e!=null?e:"respect";return i==="ignore"||!t?{autoplay:r}:typeof i=="function"?{autoplay:r,swapTo:i(n)}:{autoplay:!1,seekTo:(o=n.posterTime)!=null?o:s}}function Xi(){return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function qs(e,t,n,s={}){var T;let r=e,i=t,o=ne(i),a=new Le(n);r.setTextMeasurer(a);let l=r.playhead,c=Yi({playhead:l,duration:o.duration,markers:o.markers,targets:o.tracks.keys()},s),u=()=>a.render(we(r,i,l.peek())),h=!1,f=()=>{h||(h=!0,requestAnimationFrame(()=>{h=!1,u()}))},d=l.subscribe(f),g=y=>{if(typeof FontFace=="undefined")return;let p=pt(y.assets);for(let b of p.faces()){let k=new FontFace(b.family,`url(${b.url})`,{weight:String(b.weight),style:b.style});document.fonts.add(k),k.load().then(()=>u(),()=>{})}Fs(r,y,async b=>{try{let k=await fetch(b);return k.ok?await k.arrayBuffer():void 0}catch(k){return}},M({mode:s.strictFonts?"strict":"dev"},s.osFonts!==void 0?{osFamilies:s.osFonts}:{}))};g(i);let m=((T=s.prefersReducedMotion)!=null?T:Xi)(),v=Ui(s.reducedMotion,m,i,o.duration,!!s.autoplay);if(v.swapTo){i=v.swapTo;let y=ne(i);c.swap({duration:y.duration,markers:y.markers,targets:y.tracks.keys()}),g(i)}return v.seekTo!==void 0&&c.seek(v.seekTo),u(),v.autoplay&&c.play(),{player:c,backend:a,render:u,swap(y){y.scene&&(r=y.scene,r.setTextMeasurer(a)),i=y.timeline;let p=ne(i);c.swap({duration:p.duration,markers:p.markers,targets:p.tracks.keys()}),g(i),u()},dispose(){d(),c.dispose(),a.dispose()}}}function pc(e,t,n){let s=Object.keys(ne(t).labels);return r=>{if(r==null)return;let i=n(r),o=Object.keys(ne(i.timeline).labels),a=s.filter(l=>!o.includes(l));a.length>0&&console.warn(`[glissade] HMR: this edit removed label(s) ${a.map(l=>`'${l}'`).join(", ")} \u2014 anything seeking to them will no longer resolve`),s=o,e.swap(i)}}var mc=`
|
|
1
|
+
"use strict";var glissade=(()=>{var Ct=Object.defineProperty,eo=Object.defineProperties,to=Object.getOwnPropertyDescriptor,no=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertyNames,$t=Object.getOwnPropertySymbols;var En=Object.prototype.hasOwnProperty,Us=Object.prototype.propertyIsEnumerable;var Xs=e=>{throw TypeError(e)};var Tn=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))En.call(t,n)&&Tn(e,n,t[n]);if($t)for(var n of $t(t))Us.call(t,n)&&Tn(e,n,t[n]);return e},R=(e,t)=>eo(e,no(t));var Gs=e=>typeof e=="symbol"?e:e+"",_e=(e,t)=>{var n={};for(var s in e)En.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&$t)for(var s of $t(e))t.indexOf(s)<0&&Us.call(e,s)&&(n[s]=e[s]);return n};var ro=(e,t)=>{for(var n in t)Ct(e,n,{get:t[n],enumerable:!0})},io=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of so(t))!En.call(e,r)&&r!==n&&Ct(e,r,{get:()=>t[r],enumerable:!(s=to(t,r))||s.enumerable});return e};var oo=e=>io(Ct({},"__esModule",{value:!0}),e);var S=(e,t,n)=>Tn(e,typeof t!="symbol"?t+"":t,n),In=(e,t,n)=>t.has(e)||Xs("Cannot "+n);var F=(e,t,n)=>(In(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?Xs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),U=(e,t,n,s)=>(In(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),_=(e,t,n)=>(In(e,t,"access private method"),n);var wc={};ro(wc,{ALL_FILTER_KINDS:()=>Ds,BakeError:()=>Jt,BindTypeMismatchError:()=>Nr,Canvas2DBackend:()=>ze,Circle:()=>pn,CircularDependencyError:()=>Er,ClipError:()=>he,ColdAssetError:()=>St,ColorParseError:()=>Ln,Custom:()=>ri,DEFAULT_EASE:()=>sr,DL_SNAPSHOT_VERSION:()=>Qr,DeterminismViolationError:()=>ki,DlSnapshotError:()=>rn,DuplicateNodeIdError:()=>xi,EachError:()=>Ke,FilterValidationError:()=>Le,FollowPath:()=>Ei,FontValidationError:()=>Ar,Group:()=>ee,GsPlayerElement:()=>Ki,Highlight:()=>wi,IDENTITY:()=>$e,Image:()=>mn,ImageNode:()=>mn,LayoutEngineMissingError:()=>Is,MEASURE_QUANTUM_PX:()=>on,MESH_DOWNSCALE:()=>$a,MESH_SHEPARD_POWER:()=>Ca,MESH_SIGMA:()=>Ps,MorphError:()=>Qe,NODE_TAXONOMY:()=>Qo,Node:()=>Z,Path:()=>kt,PositionError:()=>is,PresenceError:()=>Bs,Raster2D:()=>Rs,Rect:()=>dn,ReservedNodeIdError:()=>Si,ShaderEffect:()=>xa,SidecarVersionError:()=>es,SketchValidationError:()=>ye,TARGET_PATH:()=>De,TargetOverlapError:()=>Yi,Text:()=>le,TextCursor:()=>bi,TimelineValidationError:()=>G,TokenHighlight:()=>Ii,TokenMatchError:()=>Tt,TrackValidationError:()=>Se,UnboundTargetError:()=>zr,UnknownEasingError:()=>Dn,UnknownValueTypeError:()=>zn,UnresolvableTargetError:()=>zt,ValueTypeInferenceError:()=>Yn,Video:()=>gn,WriteDuringEvaluationError:()=>Kt,__resetEstimateWarnings:()=>si,applyToPoint:()=>Gr,arcLength:()=>vs,assignKeyIds:()=>ns,audioOffsetSamples:()=>mr,auditCacheCold:()=>da,bake:()=>_o,bakeCheckpointed:()=>qo,batch:()=>Oo,beginReadPhase:()=>Ir,bindScene:()=>Ti,bindTimeline:()=>ls,booleanType:()=>Wn,breakLines:()=>re,buildFontRegistry:()=>pt,buildTimeline:()=>Lr,clip:()=>ve,clipList:()=>_a,clockDriver:()=>Hi,coercePathData:()=>an,collapseReplacer:()=>Xe,collectLocalizedTextUsages:()=>ka,collectTextUsages:()=>$i,colorType:()=>_n,compileTimeline:()=>se,computed:()=>dt,createDisplayListBuilder:()=>bt,createPlayer:()=>Ui,createPlayhead:()=>en,createScene:()=>ua,cubicBezier:()=>An,cubicBezierDerivative:()=>Pn,defineGsPlayer:()=>Zi,deleteSidecarTrack:()=>kr,describe:()=>pc,diffDisplayLists:()=>gs,drawOn:()=>vi,drawOnEach:()=>ca,driftLoop:()=>Ha,each:()=>aa,easingDerivatives:()=>Rt,easings:()=>ot,emitDevWarning:()=>q,emptySidecar:()=>br,endReadPhase:()=>$r,estimatingMeasurer:()=>hn,evaluate:()=>be,evaluateAt:()=>hs,filtersToCanvasFilter:()=>cn,flatten:()=>vt,followPath:()=>ya,fontString:()=>vn,formatColor:()=>Bt,formatDisplayDiff:()=>Kr,fromTRS:()=>ms,getLayoutEngine:()=>ci,getTimelineCallbacks:()=>Rr,getValueType:()=>ct,glow:()=>ei,hachureLines:()=>xs,hashKeys:()=>Ut,highlight:()=>Jo,inReadPhase:()=>Ao,inferValueType:()=>Pe,invert:()=>Xr,isDurationEditable:()=>yr,isEditableNodeId:()=>ht,isEstimatingMeasurer:()=>Ms,isExemptFamily:()=>Pr,key:()=>O,lerpColor:()=>fe,listValueTypes:()=>_t,matEquals:()=>Ie,matchTokenRun:()=>As,mediaPrefersReducedMotion:()=>Gi,mergeSidecar:()=>xr,mergeSidecarDetailed:()=>ss,meshRasterSize:()=>Oi,migrateSidecar:()=>ts,morph:()=>Ya,motionPath:()=>Mt,mount:()=>qs,multiply:()=>yt,namedEasing:()=>rt,normalizeEditedKeys:()=>Sr,numberType:()=>Nn,oklabToRgba:()=>We,paintType:()=>Hn,parseCmap:()=>Yt,parseColor:()=>pe,parseDisplaySnapshot:()=>Zr,parseSvgPathData:()=>_i,pathFromSegs:()=>fn,pathFromSvg:()=>nc,pathLength:()=>ma,pathType:()=>jn,planReducedMotion:()=>Xi,pointAtLength:()=>ga,popIn:()=>qa,presence:()=>tc,pulse:()=>ja,quantize:()=>j,random:()=>ce,rasterizeMesh:()=>Ci,registerValueType:()=>ae,renderToDataURL:()=>Di,reprOf:()=>qt,requireLayoutEngine:()=>li,resolveAnchor:()=>Ts,resolveEase:()=>Un,resolveEaseDerivative:()=>Xn,resolveSketch:()=>bs,resolveTweenTarget:()=>Me,revealSchedule:()=>ii,rgbaToOklab:()=>Ae,roughen:()=>ln,roundedRectSegs:()=>Ge,sampleTrack:()=>Ht,scrollDriver:()=>mc,segmentGraphemes:()=>we,segmentWords:()=>un,serializeDisplayList:()=>Jr,setDefaultMeasurer:()=>ni,setDevWarning:()=>cr,setLayoutEngine:()=>ai,setScheduler:()=>Eo,setShaderRunner:()=>Pi,setSidecarTrack:()=>vr,signal:()=>A,sketchStrokes:()=>ti,slideIn:()=>Wa,snapshotCanvas:()=>Ls,splitText:()=>oi,spring:()=>de,springEasing:()=>Fn,springEasingDerivative:()=>Rn,springPresets:()=>or,springTo:()=>hr,stagger:()=>jt,stringType:()=>qn,swapOnHmr:()=>gc,synchronousScheduler:()=>os,targetNodeId:()=>je,textCursor:()=>Zo,timeline:()=>Vo,tokenHighlight:()=>wa,track:()=>me,transitionToClip:()=>Bi,typewriter:()=>na,untracked:()=>Po,validateFilters:()=>ys,validateFonts:()=>cs,validateHachure:()=>ks,validateSceneFonts:()=>Fs,validateSketch:()=>ws,validateTrack:()=>lt,vec2ArcType:()=>Vn,vec2Equals:()=>Wt,vec2Signal:()=>Ye,vec2Type:()=>Bn,velocityAt:()=>Gn,withDeterminismGuards:()=>ha});var Dt=2.5949095,Ft=2.70158,qe=2*Math.PI/3,st=2*Math.PI/4.5;function Ot(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}var ot={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInCubic:e=>e**3,easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeInQuart:e=>e**4,easeOutQuart:e=>1-(1-e)**4,easeInOutQuart:e=>e<.5?8*e**4:1-(-2*e+2)**4/2,easeInQuint:e=>e**5,easeOutQuint:e=>1-(1-e)**5,easeInOutQuint:e=>e<.5?16*e**5:1-(-2*e+2)**5/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:2**(10*e-10),easeOutExpo:e=>e===1?1:1-2**(-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-e*e),easeOutCirc:e=>Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,easeInBack:e=>Ft*e**3-1.70158*e*e,easeOutBack:e=>1+Ft*(e-1)**3+1.70158*(e-1)**2,easeInOutBack:e=>e<.5?(2*e)**2*(3.5949095*2*e-Dt)/2:((2*e-2)**2*(3.5949095*(e*2-2)+Dt)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*qe),easeOutElastic:e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*qe)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*st))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*st)/2+1,easeInBounce:e=>1-Ot(1-e),easeOutBounce:Ot,easeInOutBounce:e=>e<.5?(1-Ot(1-2*e))/2:(1+Ot(2*e-1))/2};function At(e){return e<1/2.75?2*7.5625*e:e<2/2.75?2*7.5625*(e-1.5/2.75):e<2.5/2.75?2*7.5625*(e-2.25/2.75):2*7.5625*(e-2.625/2.75)}var xe=Math.LN2,Rt={linear:()=>1,easeInQuad:e=>2*e,easeOutQuad:e=>2*(1-e),easeInOutQuad:e=>e<.5?4*e:4*(1-e),easeInCubic:e=>3*e**2,easeOutCubic:e=>3*(1-e)**2,easeInOutCubic:e=>e<.5?12*e**2:12*(1-e)**2,easeInQuart:e=>4*e**3,easeOutQuart:e=>4*(1-e)**3,easeInOutQuart:e=>e<.5?32*e**3:32*(1-e)**3,easeInQuint:e=>5*e**4,easeOutQuint:e=>5*(1-e)**4,easeInOutQuint:e=>e<.5?80*e**4:80*(1-e)**4,easeInSine:e=>Math.PI/2*Math.sin(e*Math.PI/2),easeOutSine:e=>Math.PI/2*Math.cos(e*Math.PI/2),easeInOutSine:e=>Math.PI/2*Math.sin(Math.PI*e),easeInExpo:e=>e===0?0:10*xe*2**(10*e-10),easeOutExpo:e=>e===1?0:10*xe*2**(-10*e),easeInOutExpo:e=>e===0||e===1?0:e<.5?10*xe*2**(20*e-10):10*xe*2**(-20*e+10),easeInCirc:e=>e/Math.sqrt(1-e*e),easeOutCirc:e=>(1-e)/Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?2*e/Math.sqrt(1-4*e*e):(2-2*e)/Math.sqrt(1-(-2*e+2)**2),easeInBack:e=>3*Ft*e**2-2*1.70158*e,easeOutBack:e=>3*Ft*(e-1)**2+2*1.70158*(e-1),easeInOutBack:e=>e<.5?12*3.5949095*e**2-4*Dt*e:3*3.5949095*(2*e-2)**2+2*Dt*(2*e-2),easeInElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-10.75)*qe,n=2**(10*e-10);return-(10*xe*n*Math.sin(t)+n*10*qe*Math.cos(t))},easeOutElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-.75)*qe,n=2**(-10*e);return-10*xe*n*Math.sin(t)+n*10*qe*Math.cos(t)},easeInOutElastic:e=>{if(e===0||e===1)return 0;let t=(20*e-11.125)*st;if(e<.5){let s=2**(20*e-10);return-(20*xe*s*Math.sin(t)+s*20*st*Math.cos(t))/2}let n=2**(-20*e+10);return(-20*xe*n*Math.sin(t)+n*20*st*Math.cos(t))/2},easeInBounce:e=>At(1-e),easeOutBounce:At,easeInOutBounce:e=>e<.5?At(1-2*e):At(2*e-1)},sr="easeInOutCubic";function rr(e,t,n,s){let r=3*e-3*n+1,i=3*n-6*e,o=3*e,a=3*t-3*s+1,l=3*s-6*t,c=3*t,h=g=>((r*g+i)*g+o)*g,u=g=>((a*g+l)*g+c)*g,f=g=>(3*r*g+2*i)*g+o;return{sampleY:u,sampleDX:f,sampleDY:g=>(3*a*g+2*l)*g+c,solveU:g=>{let v=g;for(let p=0;p<8;p++){let b=h(v)-g;if(Math.abs(b)<1e-7)return v;let k=f(v);if(Math.abs(k)<1e-6)break;v-=b/k}let T=0,m=1;for(v=g;m-T>1e-7;)h(v)<g?T=v:m=v,v=(T+m)/2;return v}}}function An(e,t,n,s){let r=rr(e,t,n,s);return i=>i<=0?0:i>=1?1:r.sampleY(r.solveU(i))}function Pn(e,t,n,s){let r=rr(e,t,n,s);return i=>{let o=r.solveU(Math.min(1,Math.max(0,i))),a=r.sampleDX(o);return Math.abs(a)<1e-9?0:r.sampleDY(o)/a}}var Dn=class extends Error{constructor(e){super(`unknown easing '${e}'; register it via easings or use cubicBezier/spring`),this.name="UnknownEasingError"}};function rt(e){let t=ot[e];if(!t)throw new Dn(e);return t}var ao=.005;function at(e){var n;let t=(n=e.mass)!=null?n:1;if(!(e.stiffness>0)||!(e.damping>0)||!(t>0))throw new RangeError("spring stiffness, damping, and mass must all be > 0");return{w0:Math.sqrt(e.stiffness/t),zeta:e.damping/(2*Math.sqrt(e.stiffness*t))}}function co(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=at(e);if(Math.abs(s-1)<1e-9)return n*n*t*Math.exp(-n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return Math.exp(-s*n*t)*(n*n/a)*Math.sin(a*t)}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return i*o*(Math.exp(i*t)-Math.exp(o*t))/(i-o)}function it(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=at(e);if(Math.abs(s-1)<1e-9)return 1-Math.exp(-n*t)*(1+n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return 1-Math.exp(-s*n*t)*(Math.cos(a*t)+s*n/a*Math.sin(a*t))}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return 1+(o*Math.exp(i*t)-i*Math.exp(o*t))/(i-o)}function Nt(e,t){var a;let n=(a=t==null?void 0:t.settleTolerance)!=null?a:ao,{w0:s,zeta:r}=at(e);if(r<1){let l=s*Math.sqrt(1-r*r),c=Math.sqrt(1+(r*s/l)**2);return Math.log(c/n)/(r*s)}let i=1/s;for(;1-it(e,i)>n;)i*=2;let o=0;for(let l=0;l<64&&i-o>1e-9;l++){let c=(o+i)/2;1-it(e,c)>n?o=c:i=c}return i}function ir(e,t,n){let s=Nt(e,n);return it(e,Math.min(t,s))/it(e,s)}function lo(e,t,n){let{w0:s,zeta:r}=at(e),i,o,a;if(Math.abs(r-1)<1e-9){let c=n+s*t;i=h=>h<=0?t:Math.exp(-s*h)*(t+c*h),o=h=>h<=0?n:Math.exp(-s*h)*(n-s*c*h),a=h=>Math.exp(-s*h)*(Math.abs(t)+Math.abs(c)*h)}else if(r<1){let c=s*Math.sqrt(1-r*r),h=(n+r*s*t)/c,u=Math.hypot(t,h);i=f=>f<=0?t:Math.exp(-r*s*f)*(t*Math.cos(c*f)+h*Math.sin(c*f)),o=f=>f<=0?n:Math.exp(-r*s*f)*(n*Math.cos(c*f)-(s*s*t+r*s*n)/c*Math.sin(c*f)),a=f=>Math.exp(-r*s*f)*u}else{let c=Math.sqrt(r*r-1),h=s*(-r+c),u=s*(-r-c),f=(n-u*t)/(h-u),d=(h*t-n)/(h-u);i=y=>y<=0?t:f*Math.exp(h*y)+d*Math.exp(u*y),o=y=>y<=0?n:f*h*Math.exp(h*y)+d*u*Math.exp(u*y),a=y=>Math.abs(f)*Math.exp(h*y)+Math.abs(d)*Math.exp(u*y)}return{value:i,velocity:o,settleTime:c=>{let h=c!=null?c:Math.abs(t)*.005+1e-6;if(a(0)<=h&&Math.abs(n)<1e-12)return 0;let u=1/s,f=0;for(;a(u)>h&&f++<64;)u*=2;let d=0;for(let y=0;y<64&&u-d>1e-9;y++){let g=(d+u)/2;Math.max(a(g),a(g*1.05+1e-6))>h?d=g:u=g}return u}}}var de=Object.assign(e=>{var t;return at(e),{kind:"spring",stiffness:e.stiffness,damping:e.damping,mass:(t=e.mass)!=null?t:1}},{duration:Nt,value:ir,retarget:lo}),or={default:{stiffness:170,damping:26},gentle:{stiffness:120,damping:14},wobbly:{stiffness:180,damping:12},stiff:{stiffness:210,damping:20},slow:{stiffness:280,damping:60},molasses:{stiffness:280,damping:120}};function Fn(e){let t=Nt(e);return n=>ir(e,n*t)}function Rn(e){let t=Nt(e),n=t/it(e,t);return s=>s>=1?0:co(e,s*t)*n}var ar=e=>{var t;(t=globalThis.console)==null||t.warn(`[glissade] ${e}`)};function cr(e){ar=e}function q(e){ar(e)}var ho=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,uo=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i,Ln=class extends Error{constructor(e){super(`cannot parse color '${e}' (supported: #rgb[a], #rrggbb[aa], rgb()/rgba())`),this.name="ColorParseError"}};function pe(e){let t=ho.exec(e);if(t){let s=t[1];s.length<=4&&(s=[...s].map(i=>i+i).join(""));let r=parseInt(s,16);return s.length===6?{r:r>>16,g:r>>8&255,b:r&255,a:1}:{r:r>>>24&255,g:r>>>16&255,b:r>>>8&255,a:(r&255)/255}}let n=uo.exec(e);if(n){let s=n[4],r=s===void 0?1:s.endsWith("%")?parseFloat(s)/100:parseFloat(s);return{r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:r}}throw new Ln(e)}function Bt(e){let t=i=>Math.min(255,Math.max(0,Math.round(i))),n=i=>t(i).toString(16).padStart(2,"0"),s=`#${n(e.r)}${n(e.g)}${n(e.b)}`,r=Math.min(1,Math.max(0,e.a));return r>=1?s:`${s}${n(r*255)}`}function $n(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Cn(e){return(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*255}function Ae(e){let t=$n(e.r),n=$n(e.g),s=$n(e.b),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*s);return{L:.2104542553*r+.793617785*i-.0040720468*o,a:1.9779984951*r-2.428592205*i+.4505937099*o,b:.0259040371*r+.7827717662*i-.808675766*o,alpha:e.a}}function We(e){let t=(e.L+.3963377774*e.a+.2158037573*e.b)**3,n=(e.L-.1055613458*e.a-.0638541728*e.b)**3,s=(e.L-.0894841775*e.a-1.291485548*e.b)**3;return{r:Cn(4.0767416621*t-3.3077115913*n+.2309699292*s),g:Cn(-1.2684380046*t+2.6097574011*n-.3413193965*s),b:Cn(-.0041960863*t-.7034186147*n+1.707614701*s),a:e.alpha}}function fe(e,t,n){let s=Ae(pe(e)),r=Ae(pe(t)),i=(o,a)=>o+(a-o)*n;return Bt(We({L:i(s.L,r.L),a:i(s.a,r.a),b:i(s.b,r.b),alpha:i(s.alpha,r.alpha)}))}var Vt=new Map;function ae(e){Vt.set(e.id,e)}var zn=class extends Error{constructor(e){super(`unknown value type '${e}'; register it via registerValueType()`),this.name="UnknownValueTypeError"}};function ct(e){let t=Vt.get(e);if(!t)throw new zn(e);return t}function _t(){return[...Vt.keys()]}function qt(e){var t,n;return(n=(t=Vt.get(e))==null?void 0:t.repr)!=null?n:e}var Nn={id:"number",lerp:(e,t,n)=>e+(t-e)*n,extrapolates:!0,equals:Object.is,add:(e,t)=>e+t,sub:(e,t)=>e-t,scale:(e,t)=>e*t,defaultHandoff:"spring"},Wt=(e,t)=>e[0]===t[0]&&e[1]===t[1],Bn={id:"vec2",lerp:(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],extrapolates:!0,equals:Wt,add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],scale:(e,t)=>[e[0]*t,e[1]*t],defaultHandoff:"spring"},Vn={id:"vec2-arc",repr:"vec2",lerp:(e,t,n)=>{let s=Math.hypot(e[0],e[1]),r=Math.hypot(t[0],t[1]),i=Math.atan2(e[1],e[0]),o=Math.atan2(t[1],t[0])-i;for(;o>Math.PI;)o-=2*Math.PI;for(;o<-Math.PI;)o+=2*Math.PI;let a=s+(r-s)*n,l=i+o*n;return[a*Math.cos(l),a*Math.sin(l)]},extrapolates:!0,equals:Wt,defaultHandoff:"blend-from-frozen"},_n={id:"color",lerp:fe,extrapolates:!0,equals:(e,t)=>e===t,defaultHandoff:"blend-from-frozen"};function lr(e){return{id:e,lerp:(t,n,s)=>s>=1?n:t,extrapolates:!1,equals:(t,n)=>Object.is(t,n),defaultHandoff:"cut"}}var qn=lr("string"),Wn=lr("boolean"),On=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n];function Ks(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.closed!==r.closed||s.v.length!==r.v.length)return!1}return!0}var Qs=!1,jn={id:"path",lerp:(e,t,n)=>Ks(e,t)?e.map((s,r)=>{let i=t[r];return{closed:s.closed,v:s.v.map((o,a)=>On(o,i.v[a],n)),in:s.in.map((o,a)=>On(o,i.in[a],n)),out:s.out.map((o,a)=>On(o,i.out[a],n))}}):(Qs||(Qs=!0,q("path lerp with mismatched topology (contour/vertex counts or closed flags differ): snapping instead of morphing \u2014 supply matched vertex counts (\xA72.2)")),n>=1?t:e),extrapolates:!1,equals:(e,t)=>{if(e===t)return!0;if(!Ks(e,t))return!1;let n=(s,r)=>s[0]===r[0]&&s[1]===r[1];return e.every((s,r)=>{let i=t[r];return s.v.every((o,a)=>n(o,i.v[a]))&&s.in.every((o,a)=>n(o,i.in[a]))&&s.out.every((o,a)=>n(o,i.out[a]))})},defaultHandoff:"blend-from-frozen"},Lt=(e,t,n)=>e+(t-e)*n,Pt=(e,t,n)=>[Lt(e[0],t[0],n),Lt(e[1],t[1],n)];function Js(e){try{return Bt(R(M({},pe(e)),{a:0}))}catch(t){return e}}function fo(e,t,n){try{return fe(e,t,n)}catch(s){return n>=1?t:e}}function Zs(e,t){let n=t.stops.map(r=>({offset:r.offset,color:e})),s=t.interpolation?{interpolation:t.interpolation}:{};return t.kind==="radial"?M(M(M({kind:"radial",stops:n},t.center?{center:t.center}:{}),t.radius!==void 0?{radius:t.radius}:{}),s):M(M(M({kind:"linear",stops:n},t.from?{from:t.from}:{}),t.to?{to:t.to}:{}),s)}var er=!1;function nt(e,t,n,s="paint lerp across mismatched gradient shapes (different kind or stop count): snapping instead of interpolating \u2014 match the kind + stop count on both keyframes (\xA72.2)"){return er||(er=!0,q(s)),e>=1?n:t}var po=(e,t)=>e.length===t.length&&e.every((n,s)=>n.offset===t[s].offset&&n.color===t[s].color),Hn={id:"paint",lerp:(e,t,n)=>{var a,l,c,h;if(e.kind==="color"&&t.kind==="color")return{kind:"color",color:fe(e.color,t.color,n)};if(e.kind==="mesh"&&t.kind==="mesh"){if(e.points.length!==t.points.length)return nt(n,e,t);if(e.interpolation!==t.interpolation)return nt(n,e,t,`paint lerp across mismatched mesh interpolation modes ('${(a=e.interpolation)!=null?a:"smooth"}' \u2192 '${(l=t.interpolation)!=null?l:"smooth"}'): snapping instead of interpolating \u2014 the blend kernel is discrete, so it switches once at the boundary; match \`interpolation\` on both keyframes to morph the points (\xA73 Paint)`);let u=e.points.map((d,y)=>{let g=t.points[y];return{pos:Pt(d.pos,g.pos,n),color:fe(d.color,g.color,n)}}),f=e.bg!==void 0||t.bg!==void 0?{bg:fo((c=e.bg)!=null?c:Js(t.bg),(h=t.bg)!=null?h:Js(e.bg),n)}:{};return M(M({kind:"mesh",points:u},e.interpolation?{interpolation:e.interpolation}:{}),f)}if(e.kind==="mesh"||t.kind==="mesh")return nt(n,e,t);let s=e,r=t;if(s.kind==="color"&&r.kind!=="color"?s=Zs(s.color,r):r.kind==="color"&&s.kind!=="color"&&(r=Zs(r.color,s)),s.kind==="color"||r.kind==="color"||s.kind!==r.kind||s.stops.length!==r.stops.length)return nt(n,e,t);let i=s.stops.map((u,f)=>({offset:Lt(u.offset,r.stops[f].offset,n),color:fe(u.color,r.stops[f].color,n)})),o=s.interpolation?{interpolation:s.interpolation}:{};return s.kind==="radial"&&r.kind==="radial"?M(M(M({kind:"radial",stops:i},s.center&&r.center?{center:Pt(s.center,r.center,n)}:s.center?{center:s.center}:{}),s.radius!==void 0&&r.radius!==void 0?{radius:Lt(s.radius,r.radius,n)}:s.radius!==void 0?{radius:s.radius}:{}),o):s.kind==="linear"&&r.kind==="linear"?M(M(M({kind:"linear",stops:i},s.from&&r.from?{from:Pt(s.from,r.from,n)}:s.from?{from:s.from}:{}),s.to&&r.to?{to:Pt(s.to,r.to,n)}:s.to?{to:s.to}:{}),o):nt(n,e,t)},extrapolates:!1,equals:(e,t)=>e===t?!0:e.kind!==t.kind?!1:e.kind==="color"?t.kind==="color"&&e.color===t.color:e.kind==="mesh"?t.kind!=="mesh"||e.interpolation!==t.interpolation||e.bg!==t.bg||e.points.length!==t.points.length?!1:e.points.every((n,s)=>{let r=t.points[s];return n.color===r.color&&n.pos[0]===r.pos[0]&&n.pos[1]===r.pos[1]}):t.kind==="color"||t.kind==="mesh"||!po(e.stops,t.stops)||e.interpolation!==t.interpolation?!1:e.kind==="radial"&&t.kind==="radial"?JSON.stringify(e.center)===JSON.stringify(t.center)&&e.radius===t.radius:e.kind==="linear"&&t.kind==="linear"?JSON.stringify(e.from)===JSON.stringify(t.from)&&JSON.stringify(e.to)===JSON.stringify(t.to):!1,defaultHandoff:"blend-from-frozen"},Yn=class extends Error{constructor(e){super(`cannot infer a value type for ${JSON.stringify(e)}; register a custom type`),this.name="ValueTypeInferenceError"}},mo=e=>typeof e=="object"&&e!==null&&typeof e.closed=="boolean"&&Array.isArray(e.v)&&Array.isArray(e.in)&&Array.isArray(e.out),go=e=>typeof e=="object"&&e!==null&&(e.kind==="color"||e.kind==="linear"||e.kind==="radial"||e.kind==="mesh");function Pe(e){if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(go(e))return"paint";if(Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"))return"vec2";if(Array.isArray(e)&&e.length>0&&e.every(mo))return"path";if(typeof e=="string")try{return pe(e),"color"}catch(t){return"string"}throw new Yn(e)}ae(Nn);ae(Bn);ae(Vn);ae(_n);ae(qn);ae(Wn);ae(jn);ae(Hn);var Se=class extends Error{constructor(e,t){super(`track '${e}': ${t}`),this.name="TrackValidationError"}};function lt(e){let t=ct(e.type);if(e.keys.length===0)throw new Se(e.target,"must have at least one key");if(t.defaultHandoff==="cut")for(let n of e.keys)n.interp!=="hold"&&(n.interp="hold");for(let n=1;n<e.keys.length;n++){let s=e.keys[n-1],r=e.keys[n];if(r.t<=s.t)throw new Se(e.target,`keys must be strictly increasing in t (key[${n}] at t=${r.t} after t=${s.t})`)}if(!/^[^/]+\/.+$/.test(e.target))throw new Se(e.target,"target must be '<nodeId>/<prop.path>' (e.g. 'circle/opacity')")}function O(e,t,n){if(n===void 0)return{t:e,value:t};if(typeof n=="string"||"kind"in n)return{t:e,value:t,ease:n};let s=n,r={t:e,value:t};return s.ease!==void 0&&(r.ease=s.ease),s.interp!==void 0&&(r.interp=s.interp),s.id!==void 0&&(r.id=s.id),s.derived!==void 0&&(r.derived=s.derived),r}function hr(e,t,n,s){let r=de.duration(s);if(e-r<0)throw new Se("springTo",`this spring needs ${r.toFixed(3)}s to settle \u2014 endT must be \u2265 its duration (got ${e})`);return[O(e-r,t),O(e,n,de(s))]}function jt(e,t){let n=typeof t=="function"?t:s=>s*t;return e.map((s,r)=>{let i=n(r);return R(M({},s),{keys:s.keys.map(o=>R(M({},o),{t:o.t+i}))})})}function me(e,t,n,s){let r={target:e,type:t,keys:n};return(s==null?void 0:s.editable)!==void 0&&(r.editable=s.editable),lt(r),r}function Un(e){return e===void 0?rt("linear"):typeof e=="string"?rt(e):e.kind==="cubicBezier"?An(...e.pts):Fn(e)}var tr=new Set;function Xn(e){if(e===void 0)return Rt.linear;if(typeof e=="string"){let t=Rt[e];if(t)return t;let n=rt(e);tr.has(e)||(tr.add(e),q(`easing '${e}' has no registered derivative; velocity uses a numeric fallback \u2014 register one in easingDerivatives for exact interruption handoff`));let s=1/1024;return r=>(n(Math.min(1,r+s))-n(Math.max(0,r-s)))/(Math.min(1,r+s)-Math.max(0,r-s))}return e.kind==="cubicBezier"?Pn(...e.pts):Rn(e)}var nr=new WeakMap;function ur(e){let t=nr.get(e);return t||(t={cursor:1,easeCache:new Array(e.keys.length)},nr.set(e,t)),t}function fr(e,t,n){let s=t.easeCache[n];return s||(s=Un(e.keys[n].ease),t.easeCache[n]=s),s}function dr(e,t,n){let s=e.length;for(let o=Math.max(1,n-1);o<=Math.min(s-1,n+1);o++)if(e[o-1].t<=t&&t<e[o].t)return o;if(t<e[0].t)return 0;if(t>=e[s-1].t)return s;let r=1,i=s-1;for(;r<i;){let o=r+i>>1;e[o].t<=t?r=o+1:i=o}return r}function Gn(e,t){let n=ct(e.type);if(!n.sub||!n.scale)return null;let s=e.keys,r=s.length,i=ur(e),o=dr(s,t,i.cursor),a=n.scale(n.sub(s[0].value,s[0].value),0);if(o===0||o>=r)return a;let l=s[o];if(l.interp==="hold")return a;let c=s[o-1],h=l.t-c.t,u=(t-c.t)/h;if(!n.extrapolates){let d=fr(e,i,o)(u);if(d<0||d>1)return a}let f=Xn(l.ease)(u);return n.scale(n.sub(l.value,c.value),f/h)}function Ht(e,t){let n=e.keys,s=n.length,r=ur(e),i=dr(n,t,r.cursor);if(i===0)return n[0].value;if(i>=s)return n[s-1].value;r.cursor=i;let o=n[i],a=n[i-1];if(o.interp==="hold")return a.value;let l=ct(e.type),c=(t-a.t)/(o.t-a.t),h=fr(e,r,i)(c);return!l.extrapolates&&(h<0||h>1)&&(r.warnedClamp||(r.warnedClamp=!0,q(`track '${e.target}' (type '${e.type}') clamped an out-of-range eased value \u2014 non-extrapolating types can't overshoot, so a spring/overshooting ease on this track is flattened`)),h=Math.min(1,Math.max(0,h))),l.lerp(a.value,o.value,h)}var De=Symbol.for("glissade.targetPath"),zt=class extends Error{constructor(e){super(e!=null?e:'tween target is not addressable: pass a target string ("node/prop") or a property signal of a node that has an explicit id (\xA73.1 \u2014 anonymous nodes cannot be track targets)'),this.name="UnresolvableTargetError"}};function je(e){let t=e.indexOf("/");return t<0?e:e.slice(0,t)}function ht(e){return typeof e=="string"&&e.length>0&&e!=="__root"&&!e.startsWith("~")}function Me(e){let t=typeof e=="string"?e:e[De];if(typeof t!="string")throw new zt;if(je(t).startsWith("~"))throw new zt(`'${t}': structural ids (~Type.ordinal) are inspection-only and cannot be track targets (\xA76.5) \u2014 give the node an explicit id`);return t}function ne(e,t){return t+2<=e.byteLength?e.getUint16(t):0}function ge(e,t){return t+4<=e.byteLength?e.getUint32(t):0}function yo(e,t){return e===3&&t===10||e===0&&t>=4?5:e===3&&t===1||e===0?3:0}function wo(e,t,n){let s=ne(e,t+6),r=s>>1,i=t+14,o=i+s+2,a=o+s,l=a+s;for(let c=0;c<r;c++){let h=ne(e,i+c*2),u=ne(e,o+c*2);if(u>h)continue;let f=ne(e,a+c*2),d=ne(e,l+c*2);for(let y=u;y<=h;y++){if(y===65535)continue;let g;if(d===0)g=y+f&65535;else{let v=ne(e,l+c*2+d+(y-u)*2);g=v===0?0:v+f&65535}g!==0&&n.add(y)}}}function bo(e,t,n){let s=ge(e,t+12),r=Math.max(0,Math.floor((e.byteLength-(t+16))/12)),i=Math.min(s,r),o=t+16;for(let a=0;a<i;a++,o+=12){let l=ge(e,o),c=ge(e,o+4),h=ge(e,o+8);if(!(l>c)&&!(c-l>2097152))for(let u=l;u<=c;u++)h+(u-l)!==0&&n.add(u)}}function Yt(e){let t=new Set;try{let n=ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e);if(n.byteLength<12)return t;let s=0;ge(n,0)===1953784678&&(s=ge(n,12));let r=ne(n,s+4),i=0;for(let h=0;h<r;h++){let u=s+12+h*16;if(ge(n,u)===1668112752){i=ge(n,u+8);break}}if(i===0)return t;let o=ne(n,i+2),a=0,l=-1;for(let h=0;h<o;h++){let u=i+4+h*8,f=ne(n,u),d=ne(n,u+2),y=i+ge(n,u+4),g=yo(f,d);g>l&&y+2<=n.byteLength&&(l=g,a=y)}if(l<0)return t;let c=ne(n,a);c===4?wo(n,a,t):c===12&&bo(n,a,t)}catch(n){return t}return t}function Kn(e){var n;let t={version:1,tracks:(n=e.tracks)!=null?n:[]};return e.duration!==void 0&&(t.duration=e.duration),e.editableDuration!==void 0&&(t.editableDuration=e.editableDuration),e.fps!==void 0&&(t.fps=e.fps),e.posterTime!==void 0&&(t.posterTime=e.posterTime),e.labels!==void 0&&(t.labels=e.labels),e.markers!==void 0&&(t.markers=e.markers),e.children!==void 0&&(t.children=e.children),e.audio!==void 0&&(t.audio=e.audio),e.assets!==void 0&&(t.assets=e.assets),t}var G=class extends Error{constructor(e){super(e),this.name="TimelineValidationError"}};function vo(e){for(let t=1;t<e.keys.length;t++){let n=e.keys[t];if(n.ease&&typeof n.ease=="object"&&n.ease.kind==="spring"){let s=e.keys[t-1].t+de.duration(n.ease);if(Math.abs(n.t-s)>1e-6)throw new G(`track '${e.target}': spring-eased key at t=${n.t} must sit at prev.t + spring.duration (${s.toFixed(6)}); the builder computes this automatically`)}}}function mr(e,t=48e3){return Math.round(e*t)}function ko(e,t,n){return e.map(s=>R(M({},s),{t:t+s.t/n}))}function Qn(e){return`c${e}/`}var xo=/(^|\/)call:\d+$/;function Jn(e,t){return t!==""&&xo.test(e)?t+e:e}function gr(e,t,n,s,r,i){var o,a;for(let l of e.tracks)lt(l),vo(l),r.push({track:R(M({},l),{keys:ko(l.keys,t,n)}),unit:s});for(let l of(o=e.children)!=null?o:[]){let c=l.mode==="sync"&&(a=l.timeScale)!=null?a:1;if(l.mode==="add"&&l.timeScale!==void 0)throw new G("timeScale is only valid on mode:'sync' children (\xA72.3)");if(c<=0)throw new G("sync timeScale must be > 0");let h=l.mode==="sync"?++i.n:s;gr(l.timeline,t+l.at/n,n*c,h,r,i)}}function So(e){let t=new Map;for(let{track:s,unit:r}of e){let i=t.get(s.target);if(!i){t.set(s.target,{track:R(M({},s),{keys:[...s.keys]}),unit:r});continue}if(i.unit!==r)throw new G(`target '${s.target}' is animated by a sync (opaque) child and another timeline unit; sync children must own disjoint targets (no last-writer-wins across the sync boundary, \xA72.3)`);if(i.track.type!==s.type)throw new G(`target '${s.target}' has conflicting value types '${i.track.type}' and '${s.type}'`);let o=s.keys[0].t,a=s.keys[s.keys.length-1].t,l=i.track.keys[0].t,c=i.track.keys[i.track.keys.length-1].t,h=i.track.keys.filter(u=>u.t<o||u.t>a);l<=a&&o<=c&&q(`overlapping tracks for '${s.target}' in [${o}, ${a}]: later insertion wins (${i.track.keys.length-h.length} earlier key(s) dropped)`),i.track.keys=[...h,...s.keys].sort((u,f)=>u.t-f.t)}let n=new Map;for(let[s,{track:r}]of t)n.set(s,r);return n}function yr(e){return e.editableDuration===!0}function Mo(e){var n;let t=e.mode==="sync"&&(n=e.timeScale)!=null?n:1;return e.at+wr(e.timeline)/t}function wr(e){var n,s;if(e.duration!==void 0)return e.duration;let t=0;for(let r of e.tracks){let i=r.keys[r.keys.length-1];i&&(t=Math.max(t,i.t))}for(let r of(n=e.markers)!=null?n:[])t=Math.max(t,r.t);for(let r of(s=e.children)!=null?s:[])t=Math.max(t,Mo(r));return t}function se(e){var a,l;if(e.version!==1)throw new G(`unsupported timeline document version ${String(e.version)}`);let t=[];gr(e,0,1,0,t,{n:0});let n=So(t),s=M({},e.labels),r=[...(a=e.markers)!=null?a:[]],i=[...(l=e.audio)!=null?l:[]],o=(c,h,u,f)=>{(c!=null?c:[]).forEach((d,y)=>{var m,p,b,k,I;let g=h+d.at/u,v=u*(d.mode==="sync"&&(m=d.timeScale)!=null?m:1),T=f+Qn(y);for(let[w,x]of Object.entries((p=d.timeline.labels)!=null?p:{}))w in s||(s[w]=g+x/v);for(let w of(b=d.timeline.markers)!=null?b:[])r.push(R(M({},w),{name:Jn(w.name,T),t:g+w.t/v}));for(let w of(k=d.timeline.audio)!=null?k:[])i.push(M(R(M({},w),{at:g+w.at/v}),v!==1?{playbackRate:((I=w.playbackRate)!=null?I:1)*v}:{}));o(d.timeline.children,g,v,T)})};return o(e.children,0,1,""),r.sort((c,h)=>c.t-h.t),i.sort((c,h)=>c.at-h.at),{duration:wr(e),labels:s,markers:r,tracks:n,audio:i}}var Zn="main",es=class extends Error{constructor(e){super(`unsupported sidecar version ${String(e)}; this build reads sidecarVersion 1 or 2`),this.name="SidecarVersionError"}};function br(){return{sidecarVersion:2,timelines:{[Zn]:{tracks:{}}}}}function ts(e){if(!e)return null;if(e.sidecarVersion===2)return e;if(e.sidecarVersion===1){let t={};for(let s of e.tracks)t[s.target]={type:s.type,baseHash:null,keys:s.keys};let n={tracks:t};return e.labels&&(n.labels=e.labels),{sidecarVersion:2,timelines:{[Zn]:n}}}throw new es(e.sidecarVersion)}function Ut(e){let t=JSON.stringify(e.map(s=>{var r,i;return[s.t,s.value,(r=s.ease)!=null?r:null,(i=s.interp)!=null?i:null]})),n=2166136261;for(let s=0;s<t.length;s++)n^=t.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(16)}function ns(e){let t=-1;for(let n of e){let s=n.id?/^k(\d+)$/.exec(n.id):null;s&&(t=Math.max(t,Number(s[1])))}return e.map(n=>n.id?M({},n):R(M({},n),{id:`k${++t}`}))}function vr(e,t,n,s,r,i){var l;if(!ht(je(n)))throw new Se(n,"structural/un-id'd nodes cannot host editor tracks (\xA76.5) \u2014 only nodes with an explicit id");let o=(l=e.timelines[t])!=null?l:{tracks:{}},a={type:s,baseHash:i?Ut(i):null,keys:ns(r)};return R(M({},e),{timelines:R(M({},e.timelines),{[t]:R(M({},o),{tracks:R(M({},o.tracks),{[n]:a})})})})}function kr(e,t,n){let s=e.timelines[t];if(!s||!(n in s.tracks))return e;let o=s.tracks,{[n]:r}=o,i=_e(o,[Gs(n)]);return R(M({},e),{timelines:R(M({},e.timelines),{[t]:R(M({},s),{tracks:i})})})}function pr(e){return e.some(t=>t.derived)?e.map((t,n)=>t.derived&&n>0?R(M({},t),{value:e[n-1].value}):t):e}function ss(e,t){var c,h,u;let n=ts(t);if(!n)return{timeline:e,drift:[],orphans:{}};let s=(c=n.timelines[Zn])!=null?c:{tracks:{}},r=new Map(Object.entries(s.tracks)),i=[],o=M({},(h=s.orphans)!=null?h:{}),a=e.tracks.map(f=>{let d=r.get(f.target);return d?(r.delete(f.target),d.type!==f.type?(o[f.target]={type:d.type,keys:d.keys,reason:"type-changed"},f):(d.baseHash!==null&&d.baseHash!==Ut(f.keys)&&i.push(f.target),R(M({},f),{keys:pr(d.keys.map(y=>M({},y))),editable:!0}))):f});for(let[f,d]of r)d.baseHash!==null?o[f]={type:d.type,keys:d.keys,reason:"prop-missing"}:a.push({target:f,type:d.type,keys:pr(d.keys.map(y=>M({},y))),editable:!0});let l=R(M({},e),{tracks:a});if(s.labels&&Object.keys(s.labels).length>0){let f=(u=e.labels)!=null?u:{},d=Object.keys(s.labels).filter(y=>y in f);d.length&&q(`sidecar label(s) ${d.join(", ")} collide with code labels; code wins (\xA76.2)`),l.labels=M(M({},s.labels),f)}return i.length&&q(`sidecar: code baseline changed beneath edits on ${i.join(", ")} (\xA76.2)`),{timeline:l,drift:i,orphans:o}}function xr(e,t){return ss(e,t).timeline}function Sr(e){let t=e.map(n=>M({},n)).sort((n,s)=>n.t-s.t);for(let n=0;n<2;n++){for(let s=1;s<t.length;s++){let r=t[s].ease;r&&typeof r=="object"&&r.kind==="spring"&&(t[s].t=t[s-1].t+de.duration(r))}t.sort((s,r)=>s.t-r.t)}for(let n=1;n<t.length;n++)t[n].t<=t[n-1].t&&(t[n].t=t[n-1].t+.001);return t}var os=e=>e(),rs=os,Fe=new Set,Qt=0,He=!1,ft=!1,To=1e3;function Eo(e){let t=rs;return rs=e!=null?e:os,ft&&!He&&(ft=!1,Fe.size>0&&as()),t}function Io(e){Fe.add(e),as()}function as(){Qt>0||He||ft||(ft=!0,rs($o))}function $o(){ft=!1,!He&&Co()}function Co(){if(He)return;He=!0;let e;try{let t=0;for(;Fe.size>0;){if(++t>To)throw Fe.clear(),new Error("signal notification flush did not settle within 1000 passes: a subscriber is writing to a signal it observes (DESIGN.md \xA76.1).");let n=[...Fe];Fe.clear();for(let s of n)try{s()}catch(r){e!=null||(e={err:r})}}}finally{He=!1}if(e)throw e.err}function Xt(){Qt++}function Gt(){Qt--,Qt===0&&Fe.size>0&&as()}function Oo(e){Xt();try{return e()}finally{Gt()}}var Te=null,Re=0,Kt=class extends Error{constructor(){super("signal.set() during evaluation: the read phase is pure (DESIGN.md \xA72.1). Drivers write the playhead before evaluation begins; stateful animation belongs in bake()."),this.name="WriteDuringEvaluationError"}},Er=class extends Error{constructor(){super("circular signal dependency detected"),this.name="CircularDependencyError"}};function Ir(){Re++}function $r(){if(Re===0)throw new Error("endReadPhase() without matching beginReadPhase()");Re--}function Ao(){return Re>0}var Cr=class{constructor(e){S(this,"value");S(this,"fn");S(this,"equals");S(this,"version",0);S(this,"state");S(this,"computing",!1);S(this,"deps",[]);S(this,"depVersions",[]);S(this,"dependents",new Set);S(this,"subscribers",new Set);var t,n;this.fn=(t=e.fn)!=null?t:null,this.value=e.value,this.equals=(n=e.equals)!=null?n:Object.is,this.state=this.fn?2:0}get(){return Te&&Te.addDep(this),this.updateIfNecessary(),this.value}peek(){return this.updateIfNecessary(),this.value}set(e){if(Re>0)throw new Kt;Xt();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Gt()}}forceSet(e){Xt();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Gt()}}bindSource(e){if(Re>0)throw new Kt;Xt();try{this.fn=e,this.state=2,this.invalidateDependents(2)}finally{Gt()}}unbindSource(){if(Re>0)throw new Kt;this.fn&&(this.updateIfNecessary(),this.detachFn())}get isBound(){return this.fn!==null}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}addDep(e){this.deps[this.deps.length-1]!==e&&(this.deps.push(e),this.depVersions.push(-1),e.dependents.add(this))}detachFn(){this.fn=null,this.clearDeps(),this.state=0}writeValue(e){(this.version>0||this.value!==void 0)&&this.equals(this.value,e)||(this.value=e,this.version++,this.invalidateDependents(2))}invalidateDependents(e){for(let t of[...this.dependents])t.markStale(e);if(this.subscribers.size>0)for(let t of[...this.subscribers])Io(t)}markStale(e){if(this.state>=e)return;let t=this.state===0;this.state=e,t&&this.invalidateDependents(1)}updateIfNecessary(){if(!(this.fn===null||this.state===0)){if(this.computing)throw new Er;if(this.state===1){this.state=0;for(let e=0;e<this.deps.length;e++){let t=this.deps[e];if(t.updateIfNecessary(),t.version!==this.depVersions[e]){this.state=2;break}}}this.state===2&&this.recompute(),this.state=0}}recompute(){this.clearDeps();let e=Te;Te=this,this.computing=!0;let t;try{t=this.fn()}finally{this.computing=!1,Te=e}for(let n=0;n<this.deps.length;n++)this.depVersions[n]=this.deps[n].version;(!(this.version>0||this.value!==void 0)||!this.equals(this.value,t))&&(this.value=t,this.version++)}clearDeps(){for(let e of this.deps)e.dependents.delete(this);this.deps=[],this.depVersions=[]}};function Or(e,t){let n=(()=>e.get());return n.peek=()=>e.peek(),n.subscribe=s=>e.subscribe(s),t(n),n}function A(e,t){let n=new Cr({value:e,equals:t==null?void 0:t.equals});return Or(n,s=>{s.set=r=>n.set(r),s.forceSet=r=>n.forceSet(r),s.bindSource=r=>n.bindSource(r),s.unbindSource=()=>n.unbindSource(),Object.defineProperty(s,"isBound",{get:()=>n.isBound})})}function dt(e,t){return Or(new Cr({fn:e,equals:t==null?void 0:t.equals}),()=>{})}function Po(e){let t=Te;Te=null;try{return e()}finally{Te=t}}function Ye(e){let[t,n]=Array.isArray(e)?e:[e.x,e.y],s=A(t),r=A(n);s.expects="number",r.expects="number";let i=A(null,{equals:(h,u)=>h===null||u===null?h===u:h[0]===u[0]&&h[1]===u[1]}),o=A(t),a=A(n);s.bindSource(()=>{let h=i();return h===null?o():h[0]}),r.bindSource(()=>{let h=i();return h===null?a():h[1]});let l=dt(()=>[s(),r()],{equals:(h,u)=>h[0]===u[0]&&h[1]===u[1]}),c=(()=>l());return c.peek=()=>l.peek(),c.subscribe=h=>l.subscribe(h),c.set=h=>{i.set(null),o.set(h[0]),a.set(h[1])},c.bindSource=h=>i.bindSource(()=>h()),c.unbindSource=()=>{i.unbindSource(),i.set(null)},c.expects="vec2",Object.defineProperty(c,"x",{value:s,enumerable:!0}),Object.defineProperty(c,"y",{value:r,enumerable:!0}),c}function Do(e,t){return t.faces&&t.faces.length>0?t.faces.map(n=>{var s,r;return{family:e,url:n.url,weight:(s=n.weight)!=null?s:400,style:(r=n.style)!=null?r:"normal"}}):[{family:e,url:t.url,weight:400,style:"normal"}]}function Fo(e,t){let n,s=Number.POSITIVE_INFINITY;for(let r of e){let i=Math.abs(r.weight-t);(i<s||i===s&&n!==void 0&&r.weight<n.weight)&&(n=r,s=i)}return n}function pt(e){let t=new Map;for(let[n,s]of Object.entries(e!=null?e:{}))s.kind==="font"&&t.set(n,{faces:Do(n,s),fallback:s.fallback?[...s.fallback]:[]});return{has(n){return t.has(n)},faces(){let n=[];for(let s of t.values())n.push(...s.faces);return n},resolveFace(n,s=400,r="normal"){let i=t.get(n);if(!i)return;let o=i.faces.filter(a=>a.style===r);return Fo(o.length>0?o:i.faces,s)},fallbackChain(n){let s=t.get(n);return s?[n,...s.fallback]:[n]}}}var Ar=class extends Error{constructor(t){super(Dr(t));S(this,"report");this.name="FontValidationError",this.report=t}},Ro=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);function Pr(e,t){var s;let n=e.trim().toLowerCase();return Ro.has(n)?!0:(s=t==null?void 0:t.has(n))!=null?s:!1}function Lo(e){let t=[];for(let n of e){let s=n.codePointAt(0);s!==void 0&&t.push(s)}return t}function Dr(e){let t=[];e.unregistered.length>0&&t.push(`unregistered font ${e.unregistered.length===1?"family":"families"}: ${e.unregistered.join(", ")}`);for(let n of e.missingGlyphs){let s=n.codePoints.map(r=>"U+"+r.toString(16).toUpperCase().padStart(4,"0")).join(", ");t.push(`family '${n.family}' is missing glyphs for ${s}`)}return"font validation failed (\xA73.6): "+t.join("; ")+" \u2014 register the family with its faces/fallback, or supply covering glyphs"}function cs(e,t,n,s,r={}){let i=new Set,o=new Map;for(let l of e){let c=l.family,h=Pr(c,r.osFamilies);if(!t.has(c)){h||i.add(c);continue}let u=t.fallbackChain(c);for(let f of Lo(l.text))if(!u.some(d=>{var y,g;return(g=(y=n.get(d))==null?void 0:y.has(f))!=null?g:!1})){let d=o.get(c);d||(d=new Set,o.set(c,d)),d.add(f)}}let a={unregistered:[...i].sort(),missingGlyphs:[...o.entries()].map(([l,c])=>({family:l,codePoints:[...c].sort((h,u)=>h-u)})).sort((l,c)=>l.family<c.family?-1:l.family>c.family?1:0)};if(!(a.unregistered.length===0&&a.missingGlyphs.length===0)){if(s==="strict")throw new Ar(a);q(Dr(a))}return a}var is=class extends Error{constructor(e,t){super(`invalid position '${e}': ${t}`),this.name="PositionError"}};function ut(e,t,n){let s=new Set(n),r=Object.keys(t).filter(i=>!s.has(i));if(r.length>0)throw new G(`${e}: unknown option${r.length>1?"s":""} ${r.map(i=>`'${i}'`).join(", ")} \u2014 known: ${n.map(i=>`'${i}'`).join(", ")}`)}var Mr=["duration","ease","at","from"],zo=["at"],No=["to","from","duration","ease"],Bo=["each","anchor","at"];function Tr(e){return typeof e!="string"&&typeof e.peek=="function"?e.peek():void 0}var Fr=new WeakMap;function Rr(e){var t;return(t=Fr.get(e))!=null?t:new Map}function Lr(e,t={}){var T;let n=[],s=[],r=M({},t.labels),i=[],o=[],a=new Map,l=!1,c=0,h=0,u=0;function f(m){if(m===void 0)return h;if(typeof m=="number")return m;if(m==="<")return c;if(m===">")return h;let p=/^([+-])=([\d.]+)$/.exec(m);if(p)return h+(p[1]==="+"?1:-1)*parseFloat(p[2]);let b=/^([^+\-=]+?)(?:([+-])=([\d.]+))?$/.exec(m);if(b){let k=b[1];if(!(k in r))throw new is(m,`unknown label '${k}' (labels must be declared before use)`);let I=b[2]?(b[2]==="+"?1:-1)*parseFloat(b[3]):0;return r[k]+I}throw new is(m,"expected a number, '<', '>', '+=x', '-=x', or 'label[+=x]'")}let d={to(m,p,b={}){var $,D;ut("to",b,Mr);let k=($=b.ease)!=null?$:"easeInOutCubic",I=typeof k=="object"&&k.kind==="spring",w=I?de.duration(k):(D=b.duration)!=null?D:1;if(I&&b.duration!==void 0)throw new G("a spring ease determines its duration (spring.duration(cfg)); do not pass duration with a spring");let x=f(b.at),E={kind:"tween",target:Me(m),value:p,duration:w,ease:k,at:b.at,baseValue:Tr(m),editable:!1,start:x};return b.from!==void 0&&(E.explicitFrom=b.from),n.push(E),c=x,h=x+w,d},fromTo(m,p,b,k={}){return ut("fromTo",k,Mr),d.to(m,b,k),n[n.length-1].explicitFrom=p,d},stagger(m,p,b){var tt;ut("stagger spec",p,No),ut("stagger opts",b,Bo);let k=m.length,I=f(b.at),w=(k-1)/2,{anchor:x="start",each:E}=b,$=C=>{if(!Number.isFinite(C))throw new G(`stagger: non-finite each/anchor (${String(C)})`);return C};typeof x=="number"&&$(x),typeof E=="number"&&$(E);let D=C=>x==="start"?C:x==="end"?k-1-C:Math.round(x==="center"?Math.abs(C-w):x==="edges"?w-Math.abs(C-w):Math.abs(C-x)),z=C=>$(typeof E=="function"?E(C,k):C*E),B=p.ease,K=typeof B=="object"&&B!==null&&B.kind==="spring"?de.duration(B):(tt=p.duration)!=null?tt:1,et=C=>M(M({at:I+C},p.duration!==void 0?{duration:p.duration}:{}),p.ease!==void 0?{ease:p.ease}:{}),Be=0,Ve=0;for(let C=0;C<k;C++){let P=z(D(C));(C===0||P<Be)&&(Be=P),(C===0||P>Ve)&&(Ve=P);let L=I+P;if(L<0)throw new G(`stagger: target would land at t=${L} (< 0); shift opts.at`);let V=m[C],W=typeof p.to=="function"?p.to(C,k):p.to;if(p.from!==void 0){let Q=typeof p.from=="function"?p.from(C,k):p.from;d.fromTo(V,Q,W,et(P))}else d.to(V,W,et(P))}return k>0&&(c=I+Be,h=I+Ve+K),d},set(m,p,b={}){ut("set",b,zo);let k=f(b.at);return n.push({kind:"set",target:Me(m),value:p,duration:0,ease:"linear",at:b.at,baseValue:Tr(m),editable:!1,start:k}),c=k,h=k,d},tracks(m){for(let p of m)s.push(p);return d},label(m,p){return r[m]=p===void 0?h:f(p),d},add(m,p,b={}){var D,z;let k=p===void 0?h:f(p),I=(D=b.mode)!=null?D:"add",w={timeline:m,at:k,mode:I,_pos:p};b.timeScale!==void 0&&(w.timeScale=b.timeScale);let x=i.length;i.push(w);let E=Qn(x);for(let[B,K]of Rr(m))a.set(Jn(B,E),K);let $=I==="sync"&&(z=b.timeScale)!=null?z:1;return c=k,h=k+se(m).duration/$,d},sequence(m,p={}){var I;let b=(I=p.gap)!=null?I:0,k=b<0?`-=${-b}`:`+=${b}`;for(let w=0;w<m.length;w++)d.add(m[w],w===0?void 0:k);return d},at(m,p){return d.add(p,m)},call(m,p){let b=p===void 0?h:f(p),k=`call:${u++}`;return o.push({t:b,name:k}),a.set(k,m),d},cue(m,p,b){let k=b!=null&&typeof b=="object"&&!Array.isArray(b)?M({kind:"cue"},b):{kind:"cue"};return o.push({t:f(m),name:p,data:k}),d},adBreak(m,p={}){var k;let b=M({kind:"ad-break"},p.duration!==void 0?{duration:p.duration}:{});return o.push({t:f(m),name:(k=p.id)!=null?k:"ad-break",data:b}),d},editable(){let m=n[n.length-1];if(!m)throw new G(".editable() requires a preceding insertion");let p=je(m.target);if(!ht(p))throw new G(`.editable() needs a node with an explicit id; '${p}' is not an editable host (\xA76.4)`);return m.editable=!0,d},editableDuration(){return l=!0,d}};e(d);let y=new Map;for(let m of n){let p=y.get(m.target);p||(p=[],y.set(m.target,p)),p.push(m)}let g=[];for(let[m,p]of y){p.sort(($,D)=>$.start-D.start);let b=[],k=p.some($=>$.editable),I=(T=p.find($=>$.baseValue!==void 0))==null?void 0:T.baseValue,w=p[0];w.kind==="tween"&&w.explicitFrom===void 0&&I===void 0&&q(`'${m}': first tween has no resolvable from-value (string targets have no base) \u2014 the track sits at its end state before the tween. Anchor it with { from }, fromTo(), or set(..., { at: 0 }).`);for(let $ of p){if($.kind==="set"){b.push({t:$.start,value:$.value,interp:"hold"}),I=$.value;continue}let D=$.explicitFrom!==void 0?$.explicitFrom:I,z=b[b.length-1];if(D!==void 0&&(!z||z.t<$.start)){let B={t:$.start,value:D};$.explicitFrom===void 0&&(B.derived=!0),(!z||$.start>z.t)&&b.push(B)}b.push({t:$.start+$.duration,value:$.value,ease:$.ease}),I=$.value}let x=[];for(let $ of b.sort((D,z)=>D.t-z.t)){let D=x[x.length-1];D&&D.t===$.t?x[x.length-1]=$:x.push($)}let E={target:m,type:Pe(p[0].value),keys:x};k&&(E.editable=!0),g.push(E)}for(let m of s)g.push(m);let v=Kn(M(M(M(R(M({},t),{tracks:g,labels:r}),l?{editableDuration:!0}:{}),o.length?{markers:o}:{}),i.length?{children:i.map(b=>{var k=b,{_pos:m}=k,p=_e(k,["_pos"]);return p})}:{}));return a.size&&Fr.set(v,a),v}function Vo(e,t){return typeof e=="function"?Lr(e,t):Kn(e)}function en(e=0){return A(e)}var zr=class extends Error{constructor(e){super(`timeline targets '${e}' but no property signal resolves to it`),this.name="UnboundTargetError"}},Nr=class extends Error{constructor(t,n,s){let r=t.slice(t.lastIndexOf("/")+1),i=[s].flat(),o=n==="number"&&i.includes("vec2")?`; target '${r}.x'/'${r}.y' or author a vec2 track`:"";super(`track '${t}' is '${n}' but '${r}' expects '${i.join("'|'")}' (would silently NaN evaluation)${o}`);S(this,"target");S(this,"got");S(this,"expected");this.target=t,this.got=n,this.name="BindTypeMismatchError",this.expected=s}};function ls(e,t,n=en()){let s=[],r=new Map;for(let[i,o]of e.tracks){let a=t(i);if(!a)throw new zr(i);let l=o.type,c=a.expects;if(c!==void 0){let h=qt(l);if(!(Array.isArray(c)?c:[c]).some(u=>qt(u)===h))throw new Nr(i,l,c)}a.bindSource(()=>Ht(o,n())),s.push(a),r.set(i,{track:o,value:h=>Ht(o,h),velocity:h=>Gn(o,h)})}return{playhead:n,samplers:r,unbind:()=>{for(let i of s)i.unbindSource()}}}function hs(e,t,n){e.forceSet(t),Ir();try{return n()}finally{$r()}}function ce(e){let t=e>>>0;return()=>{t=t+2654435769|0;let n=t^t>>>16;return n=Math.imul(n,569420461),n=n^n>>>15,n=Math.imul(n,1935289751),n=n^n>>>15,(n>>>0)/4294967296}}var Jt=class extends Error{constructor(e){super(`bake(): ${e}`),this.name="BakeError"}};function Zt(e,t,n){for(let[s,r]of Object.entries(t)){let i=e.get(s);i||(i={keys:[],type:Pe(r)},e.set(s,i)),i.keys.push({t:n,value:r})}}function Br(e){return[...e.entries()].map(([t,n])=>({target:t,type:n.type,keys:n.keys}))}function _o(e){var o,a;if(!(e.fps>0)||!(e.duration>=0))throw new Jt("fps must be > 0 and duration >= 0");let t=ce((o=e.seed)!=null?o:0),n=1/e.fps,s=Math.round(e.duration*e.fps),r=e.setup(t),i=new Map;Zt(i,e.sample(r),0);for(let l=1;l<=s;l++)r=(a=e.step(r,n,t))!=null?a:r,Zt(i,e.sample(r),l*n);return Br(i)}function qo(e){var u;if(!(e.every>=1))throw new Jt("checkpoint interval `every` must be >= 1 frame");let t=1/e.fps,n=Math.round(e.duration*e.fps),s=0,r=ce((u=e.seed)!=null?u:0),i=()=>(s++,r()),o=f=>{var y;let d=ce((y=e.seed)!=null?y:0);for(let g=0;g<f;g++)d();return d},a=e.setup(i),l=[{snap:e.snapshot(a),rngDraws:s}],c=0;function h(f){var d;for(;c<Math.min(f,n);)a=(d=e.step(a,t,i))!=null?d:a,c++,c%e.every===0&&l.push({snap:e.snapshot(a),rngDraws:s})}return{frames:n,bakeRange(f,d){var b;if(f<0||d>n||f>d)throw new Jt(`range ${f}..${d} outside 0..${n}`);let y=Math.floor(f/e.every)*e.every;h(y);let g=l[y/e.every],v=e.restore(g.snap),T=o(g.rngDraws),m=y,p=new Map;for(m>=f&&Zt(p,e.sample(v),m*t);m<d;)v=(b=e.step(v,t,T))!=null?b:v,m++,m>=f&&Zt(p,e.sample(v),m*t);return Br(p)}}}var $e=[1,0,0,1,0,0],Y=e=>e===0?0:e;function yt(e,t){let[n,s,r,i,o,a]=e,[l,c,h,u,f,d]=t;return[Y(n*l+r*c),Y(s*l+i*c),Y(n*h+r*u),Y(s*h+i*u),Y(n*f+r*d+o),Y(s*f+i*d+a)]}function ms(e,t,n){let s=t*Math.PI/180,r=Math.cos(s),i=Math.sin(s),[o,a]=n;return[Y(r*o),Y(i*o),Y(-i*a),Y(r*a),Y(e[0]),Y(e[1])]}function Xr(e){let[t,n,s,r,i,o]=e,a=t*r-n*s;if(a===0)return null;let l=r/a,c=-n/a,h=-s/a,u=t/a;return[Y(l),Y(c),Y(h),Y(u),Y(-(l*i+h*o)),Y(-(c*i+u*o))]}function Gr(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}function Ie(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Xe(e,t){if(t instanceof ArrayBuffer)return`ab:${t.byteLength}`;if(ArrayBuffer.isView(t))return`view:${t.byteLength}`;if(typeof t!="function")return typeof t=="number"&&!Number.isFinite(t)?Number.isNaN(t)?"NaN":t>0?"Infinity":"-Infinity":t}function Vr(e,t){let n={};for(let[s,r]of Object.entries(e))n[s]=r;return e.op==="clip"||e.op==="fillPath"||e.op==="strokePath"?n.path=t[e.path]:e.op==="drawImage"&&(n.image=t[e.image]),n}var Ue=e=>JSON.stringify(e,Xe);function Wo(e,t){let n=[],s=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of s)r!=="op"&&Ue(e[r])!==Ue(t[r])&&n.push({path:r,from:e[r],to:t[r]});return n}function gs(e,t){let n=[],s=Math.max(e.commands.length,t.commands.length);for(let i=0;i<s;i++){let o=e.commands[i],a=t.commands[i];if(o!==void 0&&a!==void 0){let l=Vr(o,e.resources),c=Vr(a,t.resources);if(Ue(l)===Ue(c))continue;o.op!==a.op?n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:[{path:"op",from:o.op,to:a.op}]}):n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:Wo(l,c)})}else a!==void 0?n.push({index:i,kind:"add",opB:a.op,fields:[]}):o!==void 0&&n.push({index:i,kind:"remove",opA:o.op,fields:[]})}let r=e.size.w!==t.size.w||e.size.h!==t.size.h;return M({equal:n.length===0&&!r,deltas:n},r?{size:{from:e.size,to:t.size}}:{})}function Kr(e){var n,s,r,i;if(e.equal)return"DisplayLists are identical.";let t=[];e.size&&t.push(`size ${e.size.from.w}x${e.size.from.h} -> ${e.size.to.w}x${e.size.to.h}`);for(let o of e.deltas)if(o.kind==="add")t.push(`+ [${o.index}] add ${(n=o.opB)!=null?n:"?"}`);else if(o.kind==="remove")t.push(`- [${o.index}] remove ${(s=o.opA)!=null?s:"?"}`);else{let a=o.opA===o.opB?o.opA:`${(r=o.opA)!=null?r:"?"} -> ${(i=o.opB)!=null?i:"?"}`;t.push(`~ [${o.index}] ${a}`);for(let l of o.fields)t.push(` ${l.path}: ${Ue(l.from)} -> ${Ue(l.to)}`)}return t.join(`
|
|
2
|
+
`)}var Qr=1;function Jr(e){let t={dlSnapshotVersion:1,size:e.size,commands:e.commands,resources:e.resources};return JSON.stringify(t,Xe,2)}var rn=class extends Error{constructor(e){super(e),this.name="DlSnapshotError"}};function Zr(e){let t=JSON.parse(e);if(t.dlSnapshotVersion!==1)throw new rn(`unsupported dlSnapshotVersion ${String(t.dlSnapshotVersion)}; this build reads 1`);if(!t.size||!Array.isArray(t.commands)||!Array.isArray(t.resources))throw new rn("malformed .dl.json snapshot (need size, commands[], resources[])");return{size:t.size,commands:t.commands,resources:t.resources}}var Le=class extends Error{constructor(e){super(e),this.name="FilterValidationError"}},_r=new Set(["blur","drop-shadow","brightness","contrast","saturate"]);function ys(e){for(let t of e){if(!_r.has(t.kind))throw new Le(`unknown filter kind '${String(t.kind)}' (have: ${[..._r].join(", ")})`);if(t.kind==="blur"&&!(Number.isFinite(t.radius)&&t.radius>=0))throw new Le(`blur radius must be \u2265 0, got ${String(t.radius)}`);if(t.kind==="drop-shadow"){if(![t.dx,t.dy,t.blur].every(Number.isFinite)||t.blur<0)throw new Le("drop-shadow needs finite dx/dy and blur \u2265 0");if(typeof t.color!="string"||t.color.length===0)throw new Le("drop-shadow needs a color string")}if((t.kind==="brightness"||t.kind==="contrast"||t.kind==="saturate")&&!(Number.isFinite(t.amount)&&t.amount>=0))throw new Le(`${t.kind} amount must be \u2265 0, got ${String(t.amount)}`)}}function cn(e){return e.length===0?"none":e.map(t=>{switch(t.kind){case"blur":return`blur(${t.radius}px)`;case"drop-shadow":return`drop-shadow(${t.dx}px ${t.dy}px ${t.blur}px ${t.color})`;default:return`${t.kind}(${t.amount})`}}).join(" ")}function ei(e,t=16,n=2){let s=[];for(let r=0;r<Math.max(1,n);r++)s.push({kind:"drop-shadow",dx:0,dy:0,blur:t*(1+r*1.5),color:e});return s}function jo(e){switch(e.op){case"clip":case"fillPath":case"strokePath":return[e.path];case"drawImage":return[e.image];default:return[]}}function Ho(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function bt(e){let t=[],n=[],s=new Map;return{push:r=>{r.op==="pushGroup"&&r.filters.length>0&&ys(r.filters),t.push(r)},resource:r=>{let i=JSON.stringify(r),o=s.get(i);if(o!==void 0)return o;let a=n.length;return n.push(r),s.set(i,a),a},mark:()=>t.length,cacheKey:(r,i)=>{if(i<=r)return;let o=new Map,a=[],l=h=>{let u=o.get(h);return u===void 0&&(u=o.size,o.set(h,u),a.push(n[h])),u},c=t.slice(r,i).map(h=>jo(h).length===0?h:h.op==="drawImage"?R(M({},h),{image:l(h.image)}):R(M({},h),{path:l(h.path)}));return Ho(JSON.stringify({c,r:a},Xe))},patchCacheKey:(r,i)=>{let o=t[r];o&&o.op==="pushGroup"&&(o.cacheKey=i)},finish:()=>({commands:t,resources:n,size:e})}}var qr=["marker","crayon","pencil","ink","chalk"],ye=class extends Error{constructor(e){super(e),this.name="SketchValidationError"}};function ws(e){if(!qr.includes(e.kind))throw new ye(`unknown sketch kind '${String(e.kind)}' (have: ${qr.join(", ")})`);if(e.width!==void 0&&!(e.width>0))throw new ye(`sketch width must be > 0, got ${String(e.width)}`);if(e.roughness!==void 0&&!(e.roughness>=0))throw new ye(`sketch roughness must be \u2265 0, got ${String(e.roughness)}`);if((e.kind==="crayon"||e.kind==="pencil")&&e.passes!==void 0&&!(e.passes>=1))throw new ye(`sketch passes must be \u2265 1, got ${String(e.passes)}`);if(e.kind==="chalk"&&e.dash!==void 0&&(!Array.isArray(e.dash)||e.dash.some(t=>!(t>=0))))throw new ye("sketch chalk dash must be an array of non-negative numbers")}function bs(e){var t,n,s,r,i,o,a,l,c,h,u,f,d;switch(e.kind){case"marker":return{width:(t=e.width)!=null?t:8,roughness:(n=e.roughness)!=null?n:1.2,passes:2};case"crayon":return{width:(s=e.width)!=null?s:4,roughness:(r=e.roughness)!=null?r:2.4,passes:(i=e.passes)!=null?i:3};case"pencil":return{width:(o=e.width)!=null?o:1.5,roughness:(a=e.roughness)!=null?a:1,passes:(l=e.passes)!=null?l:2};case"ink":return{width:(c=e.width)!=null?c:2.5,roughness:(h=e.roughness)!=null?h:.8,passes:1};case"chalk":return{width:(u=e.width)!=null?u:3,roughness:(f=e.roughness)!=null?f:1.6,passes:1,dash:(d=e.dash)!=null?d:[6,5]}}}var Yo=(e,t,n,s,r)=>{let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*e[0]+a*t[0]+l*n[0]+c*s[0],o*e[1]+a*t[1]+l*n[1]+c*s[1]]},Uo=(e,t,n,s)=>{let r=1-s;return[r*r*e[0]+2*r*s*t[0]+s*s*n[0],r*r*e[1]+2*r*s*t[1]+s*s*n[1]]},us=(e,t,n,s,r,i)=>{let o=n*Math.cos(i),a=s*Math.sin(i),l=Math.cos(r),c=Math.sin(r);return[e+o*l-a*c,t+o*c+a*l]};function vt(e,t=16){let n=[],s=null,r=0,i=0,o=0,a=0,l=(c,h)=>(s||(s={points:[[c,h]],closed:!1},n.push(s),o=c,a=h),s);for(let c of e)switch(c[0]){case"M":s={points:[[c[1],c[2]]],closed:!1},n.push(s),r=o=c[1],i=a=c[2];break;case"L":l(r,i).points.push([c[1],c[2]]),r=c[1],i=c[2];break;case"C":{let h=l(r,i);for(let u=1;u<=t;u++)h.points.push(Yo([r,i],[c[1],c[2]],[c[3],c[4]],[c[5],c[6]],u/t));r=c[5],i=c[6];break}case"Q":{let h=l(r,i);for(let u=1;u<=t;u++)h.points.push(Uo([r,i],[c[1],c[2]],[c[3],c[4]],u/t));r=c[3],i=c[4];break}case"E":{let[,h,u,f,d,y,g,v]=c,T=us(h,u,f,d,y,g),m=l(T[0],T[1]);for(let b=1;b<=t;b++)m.points.push(us(h,u,f,d,y,g+(v-g)*(b/t)));let p=us(h,u,f,d,y,v);r=p[0],i=p[1];break}case"Z":s&&(s.points.push([o,a]),s.closed=!0,r=o,i=a);break}return n.filter(c=>c.points.length>0)}function vs(e){let t=0;for(let n=1;n<e.points.length;n++)t+=Math.hypot(e.points[n][0]-e.points[n-1][0],e.points[n][1]-e.points[n-1][1]);return t}function ks(e){if(!(e.gap>0))throw new ye(`hachure gap must be > 0, got ${String(e.gap)}`);if(e.roughness!==void 0&&!(e.roughness>=0))throw new ye(`hachure roughness must be \u2265 0, got ${String(e.roughness)}`)}function xs(e,t,n){var I;let s=vt(e),r=1/0,i=1/0,o=-1/0,a=-1/0;for(let w of s)for(let[x,E]of w.points)x<r&&(r=x),E<i&&(i=E),x>o&&(o=x),E>a&&(a=E);if(!Number.isFinite(r))return[];let l=(r+o)/2,c=(i+a)/2,h=Math.cos(t.angleRad),u=Math.sin(t.angleRad),f=(w,x)=>[(w-l)*h+(x-c)*u,-(w-l)*u+(x-c)*h],d=(w,x)=>[l+w*h-x*u,c+w*u+x*h],y=1/0,g=1/0,v=-1/0,T=-1/0,m=[[r,i],[o,i],[o,a],[r,a]];for(let[w,x]of m){let[E,$]=f(w,x);E<y&&(y=E),$<g&&(g=$),E>v&&(v=E),$>T&&(T=$)}let p=(I=t.roughness)!=null?I:1,b=()=>(n()*2-1)*p,k=[];for(let w=g+t.gap/2;w<T;w+=t.gap){let x=d(y,w+b()),E=d(v,w+b());k.push(["M",x[0],x[1]],["L",E[0],E[1]])}return k}function ln(e,t,n){let s=bs(t),r=vt(e),i=()=>(n()*2-1)*s.roughness,o=[];for(let a=0;a<s.passes;a++){let l=[];for(let c of r){let h=c.points;if(h.length<2)continue;let u=h[0][0]+i(),f=h[0][1]+i();l.push(["M",u,f]);for(let d=1;d<h.length;d++){let y=h[d][0]+i(),g=h[d][1]+i(),v=y-u,T=g-f,m=Math.hypot(v,T)||1,p=i()*.5,b=(u+y)/2+-T/m*p,k=(f+g)/2+v/m*p;l.push(["Q",b,k,y,g]),u=y,f=g}}o.push(l)}return{strokes:o,resolved:s}}function Ss(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function ti(e,t,n){return ln(e,t,ce(n>>>0)).strokes}var on=.5;function j(e){return Math.round(e/on)*on}var sn=null;function ni(e){sn=e}function X(){return sn!=null?sn:hn}var hn={measureText(e,t){return{width:e.length*t.size*.52,ascent:t.size*.8,descent:t.size*.2}}};function Ms(e){return e===hn}var ps=new Set;function gt(e,t){Ms(e)&&(ps.has(t)||(ps.add(t),q(`${t}: no text measurer available \u2014 using a rough per-character estimate; pass { measurer } or call after setTextMeasurer()/setDefaultMeasurer() for exact layout.`)))}function si(){ps.clear()}var tn;function un(e){if(tn===void 0&&(tn=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"word"}):null),tn){let t=[...tn.segment(e)].map(s=>s.segment),n=[];for(let s of t)n.length>0&&/^[^\p{L}\p{N}\s]+$/u.test(s)?n[n.length-1]+=s:n.push(s);return n}return e.split(/(\s+)/).filter(t=>t.length>0)}var nn;function we(e){return nn===void 0&&(nn=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null),nn?[...nn.segment(e)].map(t=>t.segment):Array.from(e)}function re(e,t,n,s){let r=e.split(`
|
|
3
|
+
`);if(n===void 0||n<=0)return r;let i=[];for(let o of r){let a=un(o),l="";for(let c of a){let h=l+c;l!==""&&j(s.measureText(h.trimEnd(),t).width)>n?(i.push(l.trimEnd()),l=c.trimStart()===""?"":c):l=h}i.push(l.trimEnd())}return i}var Xo={center:[.5,.5],"top-left":[0,0],top:[.5,0],"top-right":[1,0],left:[0,.5],right:[1,.5],"bottom-left":[0,1],bottom:[.5,1],"bottom-right":[1,1]};function Ts(e){if(typeof e=="string"){let t=Xo[e];if(!t)throw new Error(`unknown anchor '${e}' (use a preset like 'top-left' or a [ax, ay] pair)`);return t}return[e[0],e[1]]}function mt(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Wr(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var wt,Yr,Z=(Yr=class{constructor(e={}){S(this,"id");S(this,"position");S(this,"rotation");S(this,"scale");S(this,"opacity");S(this,"blend");S(this,"zIndex");S(this,"filters");S(this,"anchor");S(this,"hasAnchor");S(this,"cache");S(this,"parent",null);J(this,wt,!1);S(this,"interactive",!1);S(this,"interactiveChildren",!0);S(this,"hitArea");S(this,"measurerSource",null);S(this,"localMatrix");S(this,"worldMatrix");S(this,"targets",new Map);var t;this.id=e.id,this.position=Wr(Ye([0,0]),e.position),this.rotation=mt(A(0),e.rotation),this.scale=Wr(Ye([1,1]),e.scale),this.opacity=mt(A(1),e.opacity),this.blend=mt(A("source-over"),e.blend),this.zIndex=mt(A(0),e.zIndex),this.filters=mt(A([]),e.filters),this.hasAnchor=e.anchor!==void 0,this.anchor=Ts((t=e.anchor)!=null?t:"center"),this.cache=e.cache===!0,this.localMatrix=dt(()=>{let n=ms(this.position(),this.rotation(),this.scale()),[s,r]=this.anchorShift();return s===0&&r===0?n:yt(n,[1,0,0,1,s,r])},{equals:Ie}),this.worldMatrix=dt(()=>this.parent?yt(this.parent.worldMatrix(),this.localMatrix()):this.localMatrix(),{equals:Ie}),this.registerTarget("position",this.position,"vec2"),this.registerTarget("position.x",this.position.x,"number"),this.registerTarget("position.y",this.position.y,"number"),this.registerTarget("rotation",this.rotation,"number"),this.registerTarget("scale",this.scale,"vec2"),this.registerTarget("scale.x",this.scale.x,"number"),this.registerTarget("scale.y",this.scale.y,"number"),this.registerTarget("opacity",this.opacity,"number"),this.registerTarget("zIndex",this.zIndex,"number")}registerTarget(e,t,n){t.expects=n,this.targets.set(e,t),this.id!==void 0&&(t[De]=`${this.id}/${e}`)}resolveTarget(e){return this.targets.get(e)}listTargets(){return[...this.targets].map(([e,t])=>({path:e,expects:t.expects}))}intrinsicSize(e){return null}drawOffset(e){var s,r,i;let t=(r=e!=null?e:(s=this.measurerSource)==null?void 0:s.call(this))!=null?r:X(),n=(i=this.intrinsicSize(t))!=null?i:{w:0,h:0};return{x:-n.w/2,y:-n.h/2}}flowOffset(e){var i,o;let t=(o=e!=null?e:(i=this.measurerSource)==null?void 0:i.call(this))!=null?o:X(),n=this.drawOffset(t),[s,r]=this.anchorShift(t);return{x:n.x+s,y:n.y+r}}anchorShift(e){var l,c;if(!this.hasAnchor)return[0,0];let[t,n]=this.anchor,s=(c=e!=null?e:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:X(),r=this.intrinsicSize(s);if(!r)return F(this,wt)||(U(this,wt,!0),q(`anchor set on a node without an intrinsic box${this.id?` ('${this.id}')`:""} \u2014 ignored (give it a sized node, or position children explicitly)`)),[0,0];let i=this.drawOffset(s),o=-(i.x+t*r.w),a=-(i.y+n*r.h);return[o===0?0:o,a===0?0:a]}requiresGroup(){return this.opacity()<1||this.blend()!=="source-over"||this.filters().length>0}groupShader(){}emit(e,t){let n=this.opacity();if(n<=0)return;let s=this.localMatrix(),r=Ie(s,$e),i=this.groupShader(),o=this.requiresGroup()||i!==void 0||this.cache,a=this.cache&&e.mark!==void 0;e.push({op:"save"}),r||e.push({op:"transform",m:s});let l=-1;o&&(a&&(l=e.mark()),e.push(M({op:"pushGroup",opacity:n,blend:this.blend(),filters:this.filters()},i!==void 0?{shader:i}:{})));let c=a?e.mark():-1;if(this.draw(e,t),o){if(a){let h=e.cacheKey(c,e.mark());h!==void 0&&e.patchCacheKey(l,h)}e.push({op:"popGroup"})}e.push({op:"restore"})}},wt=new WeakMap,Yr),ri=class extends Z{};function Ge(e,t,n,s,r){if(r<=0)return[["M",e,t],["L",e+n,t],["L",e+n,t+s],["L",e,t+s],["Z"]];let i=Math.PI/2;return[["M",e+r,t],["L",e+n-r,t],["E",e+n-r,t+r,r,r,0,-i,0],["L",e+n,t+s-r],["E",e+n-r,t+s-r,r,r,0,0,i],["L",e+r,t+s],["E",e+r,t+s-r,r,r,0,i,Math.PI],["L",e,t+r],["E",e+r,t+r,r,r,0,Math.PI,Math.PI+i],["Z"]]}var Ee,Ur,ee=(Ur=class extends Z{constructor(t={}){var n;super(t);S(this,"children");J(this,Ee,A(0));this.children=(n=t.children)!=null?n:[];for(let s of this.children)s.parent=this}trackStructure(){F(this,Ee).call(this)}add(t){return t.parent=this,this.children.push(t),F(this,Ee).set(F(this,Ee).peek()+1),this}remove(t){let n=this.children.indexOf(t);return n>=0&&(this.children.splice(n,1),t.parent===this&&(t.parent=null),F(this,Ee).set(F(this,Ee).peek()+1)),this}draw(t,n){let s=this.children.map((r,i)=>({node:r,i})).sort((r,i)=>r.node.zIndex()-i.node.zIndex()||r.i-i.i).map(r=>r.node);for(let r of s)r.emit(t,n)}},Ee=new WeakMap,Ur);function jr(e){return typeof e=="string"?{kind:"color",color:e}:e}var Es=class extends Z{constructor(t={}){var n;super(t);S(this,"fill");S(this,"stroke");S(this,"strokeWidth");S(this,"sketch");S(this,"sketchFill");S(this,"sketchSeed");S(this,"reveal");this.fill=H(A(""),t.fill),this.stroke=H(A(""),t.stroke),this.strokeWidth=H(A(0),t.strokeWidth),this.reveal=H(A(1),t.reveal),this.registerTarget("fill",this.fill,["color","paint"]),this.registerTarget("stroke",this.stroke,"color"),this.registerTarget("strokeWidth",this.strokeWidth,"number"),this.registerTarget("reveal",this.reveal,"number"),t.sketch&&ws(t.sketch),t.sketchFill&&ks(t.sketchFill),t.sketchFill&&!t.sketch&&q(`${this.id!==void 0?`'${this.id}': `:""}sketchFill is ignored without sketch \u2014 hachure fill is drawn only by the sketch renderer. Set a sketch style (e.g. { kind: 'pencil' }) to see it.`),this.sketch=t.sketch,this.sketchFill=t.sketchFill,this.sketchSeed=(n=t.sketchSeed)!=null?n:this.id!==void 0?Ss(this.id):0}draw(t){let n=this.pathSegs();if(this.sketch)return this.drawSketch(t,n);let s=t.resource({kind:"path",segs:n}),r=this.fill();r&&t.push({op:"fillPath",path:s,paint:jr(r)});let i=this.stroke(),o=this.strokeWidth();if(i&&o>0){let a=this.reveal();a<1?Hr(t,n,{kind:"color",color:i},{width:o},a):t.push({op:"strokePath",path:s,paint:{kind:"color",color:i},stroke:{width:o}})}}drawSketch(t,n){let s=ce(this.sketchSeed>>>0),r=this.fill();if(r){let h=t.resource({kind:"path",segs:n});t.push({op:"fillPath",path:h,paint:jr(r)})}let{strokes:i,resolved:o}=ln(n,this.sketch,s),a=this.stroke()||(typeof r=="string"?r:"")||"#000000";if(this.sketchFill){let h=t.resource({kind:"path",segs:n});t.push({op:"save"}),t.push({op:"clip",path:h,rule:"nonzero"});let u=xs(n,this.sketchFill,s);if(u.length>0){let f=t.resource({kind:"path",segs:u});t.push({op:"strokePath",path:f,paint:{kind:"color",color:a},stroke:{width:Math.max(1,o.width*.5),cap:"round"}})}t.push({op:"restore"})}let l=this.reveal(),c=l<1;for(let h of i){if(h.length===0)continue;if(c){Hr(t,h,{kind:"color",color:a},{width:o.width,cap:"round",join:"round"},l);continue}let u=t.resource({kind:"path",segs:h});t.push({op:"strokePath",path:u,paint:{kind:"color",color:a},stroke:M({width:o.width,cap:"round",join:"round"},o.dash?{dash:o.dash}:{})})}}};function H(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Go(e){let t=[],n=null;for(let s of e)s[0]==="M"?(n=[s],t.push(n)):n&&n.push(s);return t}function Hr(e,t,n,s,r){for(let i of Go(t)){let o=vt(i).reduce((l,c)=>l+vs(c),0),a=e.resource({kind:"path",segs:i});e.push({op:"strokePath",path:a,paint:n,stroke:R(M({},s),{dash:[o,o],dashOffset:o*(1-r)})})}}function an(e){if(e===void 0)return[];if(Array.isArray(e)&&e.every(t=>typeof t=="object"&&t!==null&&Array.isArray(t.v)&&Array.isArray(t.in)&&Array.isArray(t.out)))return e;throw new TypeError(`Path.data expects PathValue (PathContour[]); for an SVG path 'd' string, parse it with pathFromSvg(d) from "@glissade/scene/path" (or window.glissade.pathFromSvg in the browser bundle)`)}function fn(e){let t=[],n=null,s=(i,o=[0,0],a=[0,0])=>{n.v.push(i),n.in.push(o),n.out.push(a)},r=()=>n.v[n.v.length-1];for(let i of e)switch(i[0]){case"M":n={closed:!1,v:[[i[1],i[2]]],in:[[0,0]],out:[[0,0]]},t.push(n);break;case"L":n&&s([i[1],i[2]]);break;case"C":if(n){let o=r();n.out[n.out.length-1]=[i[1]-o[0],i[2]-o[1]],s([i[5],i[6]],[i[3]-i[5],i[4]-i[6]])}break;case"Q":if(n){let o=r(),a=i[1],l=i[2],c=i[3],h=i[4];n.out[n.out.length-1]=[2/3*(a-o[0]),2/3*(l-o[1])],s([c,h],[2/3*(a-c),2/3*(l-h)])}break;case"E":if(n){let[,o,a,l,c,h,u,f]=i,d=Math.cos(h),y=Math.sin(h);for(let g=1;g<=16;g++){let v=u+(f-u)*(g/16),T=l*Math.cos(v),m=c*Math.sin(v);s([o+T*d-m*y,a+T*y+m*d])}}break;case"Z":if(n){n.closed=!0;let o=n.v[0],a=r();n.v.length>1&&Math.abs(o[0]-a[0])<1e-9&&Math.abs(o[1]-a[1])<1e-9&&(n.in[0]=n.in[n.in.length-1],n.v.pop(),n.in.pop(),n.out.pop())}break}return t}var dn=class extends Es{constructor(t={}){super(t);S(this,"width");S(this,"height");S(this,"cornerRadius");this.width=H(A(0),t.width),this.height=H(A(0),t.height),this.cornerRadius=H(A(0),t.cornerRadius),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number"),this.registerTarget("cornerRadius",this.cornerRadius,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}pathSegs(){let t=this.width(),n=this.height(),s=Math.min(Math.max(0,this.cornerRadius()),t/2,n/2);return Ge(-t/2,-n/2,t,n,s)}},pn=class extends Es{constructor(t={}){super(t);S(this,"radius");this.radius=H(A(0),t.radius),this.registerTarget("radius",this.radius,"number")}intrinsicSize(){let t=this.radius()*2;return{w:t,h:t}}pathSegs(){let t=this.radius();return[["E",0,0,t,t,0,0,Math.PI*2],["Z"]]}},kt=class extends Es{constructor(t={}){super(t);S(this,"data");let n=t.data,s=typeof n=="function"?()=>an(n()):n!==void 0?an(n):void 0;this.data=H(A([]),s),this.registerTarget("d",this.data,"path")}bounds(){let t=1/0,n=1/0,s=-1/0,r=-1/0;for(let i of this.data())for(let o=0;o<i.v.length;o++){let a=i.v[o][0],l=i.v[o][1],c=[[a,l],[a+i.in[o][0],l+i.in[o][1]],[a+i.out[o][0],l+i.out[o][1]]];for(let h of c)h[0]<t&&(t=h[0]),h[1]<n&&(n=h[1]),h[0]>s&&(s=h[0]),h[1]>r&&(r=h[1])}return t>s?{minX:0,minY:0,maxX:0,maxY:0}:{minX:t,minY:n,maxX:s,maxY:r}}intrinsicSize(){let t=this.bounds();return{w:t.maxX-t.minX,h:t.maxY-t.minY}}drawOffset(){let t=this.bounds();return{x:t.minX,y:t.minY}}pathSegs(){let t=[];for(let n of this.data()){let s=n.v.length;if(s!==0){t.push(["M",n.v[0][0],n.v[0][1]]);for(let r=0;r<s-1;r++)t.push(["C",n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1],n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1],n.v[r+1][0],n.v[r+1][1]]);n.closed&&s>1&&(t.push(["C",n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1],n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1],n.v[0][0],n.v[0][1]]),t.push(["Z"]))}}return t}},fs,mn=(fs=class extends Z{constructor(t){super(t);S(this,"assetId");S(this,"width");S(this,"height");this.assetId=t.assetId,this.width=H(A(0),t.width),this.height=H(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}draw(t){let n=this.width(),s=this.height();if(n<=0||s<=0)return;let r=t.resource({kind:"image",assetId:this.assetId});t.push({op:"drawImage",image:r,dst:{x:-n/2,y:-s/2,w:n,h:s}})}},S(fs,"assetKind","image"),fs),ds,gn=(ds=class extends Z{constructor(t){var n,s,r;super(t);S(this,"assetId");S(this,"at");S(this,"trimStart");S(this,"playbackRate");S(this,"clipDuration");S(this,"sourceFps");S(this,"width");S(this,"height");this.assetId=t.assetId,this.at=(n=t.at)!=null?n:0,this.trimStart=(s=t.trimStart)!=null?s:0,this.playbackRate=(r=t.playbackRate)!=null?r:1,this.clipDuration=t.clipDuration,this.sourceFps=t.sourceFps,this.width=H(A(0),t.width),this.height=H(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}mediaTime(t){let n=(t-this.at)*this.playbackRate;if(n<0||this.clipDuration!==void 0&&t-this.at>=this.clipDuration)return null;let s=this.trimStart+n;return this.sourceFps!==void 0?Math.floor(s*this.sourceFps+1e-9)/this.sourceFps:s}draw(t,n){let s=this.mediaTime(n.time);if(s===null)return;let r=this.width(),i=this.height();if(r<=0||i<=0)return;let o=t.resource({kind:"videoFrame",assetId:this.assetId,mediaT:s});t.push({op:"drawImage",image:o,dst:{x:-r/2,y:-i/2,w:r,h:i}})}},S(ds,"assetKind","video"),ds),le=class extends Z{constructor(t={}){var n,s,r,i,o;super(t);S(this,"text");S(this,"fill");S(this,"fontSize");S(this,"fontFamily");S(this,"fontWeight");S(this,"fontStyle");S(this,"align");S(this,"width");S(this,"lineHeight");S(this,"reveal");S(this,"revealFraction");this.text=H(A(""),t.text),this.fill=H(A("#000000"),t.fill),this.fontSize=H(A(16),t.fontSize),this.fontFamily=(n=t.fontFamily)!=null?n:"sans-serif",this.fontWeight=(s=t.fontWeight)!=null?s:400,this.fontStyle=(r=t.fontStyle)!=null?r:"normal",this.align=(i=t.align)!=null?i:"left",this.width=H(A(0),t.width),this.lineHeight=(o=t.lineHeight)!=null?o:1.25,this.reveal=H(A(Number.POSITIVE_INFINITY),t.reveal),this.revealFraction=H(A(NaN),t.revealFraction),this.registerTarget("width",this.width,"number"),this.registerTarget("text",this.text,"string"),this.registerTarget("fill",this.fill,"color"),this.registerTarget("fontSize",this.fontSize,"number"),this.registerTarget("reveal",this.reveal,"number"),this.registerTarget("revealFraction",this.revealFraction,"number")}effectiveReveal(t){let n=this.revealFraction();if(Number.isNaN(n))return this.reveal();let s=this.graphemes(t).length;return Math.round((n<=0?0:n>=1?1:n)*s)}intrinsicSize(t){let n=this.text();if(!n)return{w:0,h:0};let s=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=re(n,s,r>0?r:void 0,t),o=Math.max(...i.map(a=>j(t.measureText(a,s).width)),0);return{w:r>0?r:o,h:j(s.size*this.lineHeight)*i.length}}drawOffset(t){var a,l,c;let n=(l=t!=null?t:(a=this.measurerSource)==null?void 0:a.call(this))!=null?l:X(),s=this.intrinsicSize(n),r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=(c=re(this.text(),r,this.width()>0?this.width():void 0,n)[0])!=null?c:"",o=n.measureText(i,r).ascent;return{x:this.align==="left"?0:this.align==="center"?-s.w/2:-s.w,y:-o}}measuredSize(t){var n,s;return this.intrinsicSize((s=t!=null?t:(n=this.measurerSource)==null?void 0:n.call(this))!=null?s:X())}lineBoxes(t){var c,h;let n=(h=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?h:X();t===void 0&>(n,"Text.lineBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=re(s,r,i>0?i:void 0,n),a=j(r.size*this.lineHeight),l=[];for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;let d=n.measureText(f,r),y=j(d.width),g=this.align==="left"?0:this.align==="center"?-y/2:-y;l.push({text:f,x:g,y:u*a-d.ascent,w:y,h:d.ascent+d.descent})}return l}wordBoxes(t){var c,h;let n=(h=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?h:X();t===void 0&>(n,"Text.wordBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=re(s,r,i>0?i:void 0,n),a=j(r.size*this.lineHeight),l=[];for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;let d=n.measureText(f,r),y=j(d.width),g=this.align==="left"?0:this.align==="center"?-y/2:-y,v=u*a-d.ascent,T=d.ascent+d.descent,m="";for(let p of un(f)){let b=m;m+=p;let k=p.trim();if(k==="")continue;let I=p.length-p.trimStart().length,w=n.measureText(b+p.slice(0,I),r).width,x=n.measureText(b+p.trimEnd(),r).width;l.push({text:k,line:u,x:g+w,y:v,w:x-w,h:T})}}return l}graphemeBoxes(t){var c,h;let n=(h=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?h:X();t===void 0&>(n,"Text.graphemeBoxes");let s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=re(s,r,i>0?i:void 0,n),a=j(r.size*this.lineHeight),l=[];for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;let d=n.measureText(f,r),y=j(d.width),g=this.align==="left"?0:this.align==="center"?-y/2:-y,v=u*a-d.ascent,T=d.ascent+d.descent,m="";for(let p of we(f)){let b=m;if(m+=p,p.trim()==="")continue;let k=n.measureText(b,r).width,I=n.measureText(b+p,r).width;l.push({text:p,line:u,x:g+k,y:v,w:I-k,h:T})}}return l}graphemes(t){var l,c;let n=(c=t!=null?t:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:X(),s=this.text();if(!s)return[];let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=re(s,r,i>0?i:void 0,n),a=[];for(let h of o)for(let u of we(h))a.push(u);return a}revealHead(t){var f,d,y;let n=(d=t!=null?t:(f=this.measurerSource)==null?void 0:f.call(this))!=null?d:X(),s=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=re(this.text(),s,r>0?r:void 0,n),o=j(s.size*this.lineHeight),a=i.reduce((g,v)=>g+we(v).length,0),l=this.effectiveReveal(n),c=Math.max(0,Math.min(Number.isFinite(l)?Math.floor(l):a,a)),h=c,u={x:0,y:0,h:0,line:0,index:c};for(let g=0;g<i.length;g++){let v=(y=i[g])!=null?y:"",T=n.measureText(v,s),m=j(T.width),p=this.align==="left"?0:this.align==="center"?-m/2:-m,b=g*o-T.ascent,k=T.ascent+T.descent,I=we(v);if(h<=I.length)return{x:p+(h<=0?0:n.measureText(I.slice(0,h).join(""),s).width),y:b,h:k,line:g,index:c};h-=I.length,u={x:p+T.width,y:b,h:k,line:g,index:c}}return u}draw(t,n){let s=this.text();if(!s)return;let r=M({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=re(s,r,i>0?i:void 0,n.measurer),a=j(r.size*this.lineHeight),l=this.effectiveReveal(n.measurer),c=Number.isFinite(l),h=c?Math.max(0,Math.floor(l)):0;for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;if(!c){t.push(M({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:u*a},this.align!=="left"?{align:this.align}:{}));continue}if(h<=0)break;let d=we(f),y=Math.min(h,d.length);if(h-=y,y===d.length)t.push(M({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:u*a},this.align!=="left"?{align:this.align}:{}));else{let g=j(n.measurer.measureText(f,r).width),v=this.align==="left"?0:this.align==="center"?-g/2:-g;t.push({op:"fillText",text:d.slice(0,y).join(""),font:r,paint:{kind:"color",color:this.fill()},x:v,y:u*a})}}}};function ii(e,t,n){var f,d;let s=(d=n!=null?n:(f=e.measurerSource)==null?void 0:f.call(e))!=null?d:X(),r=e.text();if(!r)return[];let i=M({family:e.fontFamily,size:e.fontSize(),weight:e.fontWeight},e.fontStyle==="italic"?{style:"italic"}:{}),o=e.width(),a=re(r,i,o>0?o:void 0,s),l=j(i.size*e.lineHeight),c=t.keys,h=[],u=0;for(let y=0;y<a.length;y++){let g=a[y];if(!g)continue;let v=s.measureText(g,i),T=j(v.width),m=e.align==="left"?0:e.align==="center"?-T/2:-T,p=y*l-v.ascent,b="";for(let k of we(g)){b+=k;let I=u+1,w=Number.POSITIVE_INFINITY;for(let x of c)if(x.value>=I){w=x.t;break}Number.isFinite(w)&&h.push({charIndex:u,grapheme:k,time:w,x:m+s.measureText(b,i).width,y:p,line:y}),u++}}return h}var Ko=class extends Error{constructor(e){super(e),this.name="SplitTextError"}};function oi(e,t={}){var d,y,g,v,T;let n=e instanceof le?e:new le(e),s=(d=t.id)!=null?d:n.id;if(s===void 0)throw new Ko("splitText() needs a stable id \u2014 pass { id } or give the source Text an id (the parts bind tracks against ${id}/${i})");let r=(y=t.by)!=null?y:"word",i=(T=(v=t.measurer)!=null?v:(g=n.measurerSource)==null?void 0:g.call(n))!=null?T:X();gt(i,"splitText");let o={fontFamily:n.fontFamily,fontSize:n.fontSize(),fontWeight:n.fontWeight,fontStyle:n.fontStyle,fill:n.fill(),lineHeight:n.lineHeight},a=j(o.fontSize*o.lineHeight),l=r==="line"?n.lineBoxes(i).map((m,p)=>({text:m.text,line:p,x:m.x,y:m.y,w:m.w,h:m.h})):r==="word"?n.wordBoxes(i).map(m=>({text:m.text,line:m.line,x:m.x,y:m.y,w:m.w,h:m.h})):n.graphemeBoxes(i).map(m=>({text:m.text,line:m.line,x:m.x,y:m.y,w:m.w,h:m.h})),c=[],h=[];for(let m=0;m<l.length;m++){let p=l[m],b=new le(R(M({id:`${s}/${m}`,text:p.text,fill:o.fill,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight},o.fontStyle==="italic"?{fontStyle:"italic"}:{}),{lineHeight:o.lineHeight,align:"left",position:[p.x,p.line*a]}));c.push(b),h.push({text:p.text,node:b,line:p.line,box:{x:p.x,y:p.y,w:p.w,h:p.h}})}let[u,f]=n.position();return{node:new ee({id:s,children:c,position:[u,f]}),children:c,parts:h}}var Is=class extends Error{constructor(){super("a Layout node was evaluated but no LayoutEngine is registered \u2014 await loadYogaLayoutEngine() from '@glissade/scene/layout' before mounting/rendering (the engine is wasm and loads async; evaluate() never awaits, \xA72.5)"),this.name="LayoutEngineMissingError"}},yn=null;function ai(e){yn=e}function ci(){return yn}function li(){if(!yn)throw new Is;return yn}var Qo=["Group","Rect","Circle","Path","Text","Image","Video","Layout","Custom"],wi=class extends Z{constructor(t){var n,s;super(t);S(this,"target");S(this,"color");S(this,"progress");S(this,"padding");S(this,"cornerRadius");this.target=t.text,this.color=hi(A("#ffe066"),t.color),this.progress=hi(A(1),t.progress),this.padding=(n=t.padding)!=null?n:[4,2],this.cornerRadius=(s=t.cornerRadius)!=null?s:4,this.registerTarget("progress",this.progress,"number"),this.registerTarget("color",this.color,"color")}draw(t,n){let s=Math.min(1,Math.max(0,this.progress()));if(s<=0)return;let[r,i]=this.padding,o=this.target.lineBoxes(n.measurer).map(u=>({x:u.x-r,y:u.y-i,w:u.w+2*r,h:u.h+2*i})),a=o.reduce((u,f)=>u+f.w,0);if(a<=0)return;let l=this.target.localMatrix();Ie(l,$e)||t.push({op:"transform",m:l});let c=this.color(),h=s*a;for(let u of o){let f=Math.min(u.w,h);if(h-=f,f<=0)break;let d=Math.min(this.cornerRadius,f/2,u.h/2),y=t.resource({kind:"path",segs:Ge(u.x,u.y,f,u.h,d)});if(t.push({op:"fillPath",path:y,paint:{kind:"color",color:c}}),h<=0)break}}};function Jo(e,t={}){return new wi(R(M({},t),{text:e}))}function hi(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var bi=class extends Z{constructor(t){var n,s,r,i;super(t);S(this,"target");S(this,"blinkPeriod");S(this,"blinkPhase");S(this,"solidWhileTyping");S(this,"caretWidth");S(this,"fill");this.target=t.text,this.blinkPeriod=(n=t.blinkPeriod)!=null?n:1.06,this.blinkPhase=(s=t.blinkPhase)!=null?s:0,this.solidWhileTyping=(r=t.solidWhileTyping)!=null?r:!0,this.caretWidth=(i=t.width)!=null?i:2,this.fill=ea(A(""),t.fill),this.registerTarget("fill",this.fill,"color")}draw(t,n){let s=this.target.revealHead(n.measurer);if(s.h<=0)return;let r=!0,i=this.target.graphemes(n.measurer).length,o=s.index<i;if(!(this.solidWhileTyping&&o)){let h=this.blinkPeriod>0?this.blinkPeriod:1;r=((n.time-this.blinkPhase)%h+h)%h<h/2}if(!r)return;let a=this.target.localMatrix();Ie(a,$e)||t.push({op:"transform",m:a});let l=this.fill()||this.target.fill(),c=t.resource({kind:"path",segs:Ge(s.x,s.y,this.caretWidth,s.h,0)});t.push({op:"fillPath",path:c,paint:{kind:"color",color:l}})}};function Zo(e,t={}){return new bi(R(M({},t),{text:e}))}function ea(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var ta=.06;function na(e,t,n={}){var u,f,d,y;let s=(u=n.start)!=null?u:0,r=(f=n.perChar)!=null?f:ta,i=(d=n.gap)!=null?d:0,o=s,a=[],l=[O(s,"",{interp:"hold"})],c=[],h=[];for(let g=0;g<t.length;g++){let v=t[g],T=o,m=(y=v.perChar)!=null?y:r;if(v.type!==void 0)for(let p of we(v.type)){o+=m,a.push(p);let b=a.join("");l.push(O(o,b,{interp:"hold"})),c.push({time:o,kind:"insert",grapheme:p,value:b})}if(v.delete!==void 0)for(let p=0;p<v.delete&&a.length>0;p++){o+=m;let b=a.pop(),k=a.join("");l.push(O(o,k,{interp:"hold"})),c.push({time:o,kind:"delete",grapheme:b,value:k})}v.hold!==void 0&&(o+=v.hold),h.push({index:g,start:T,end:o,value:a.join("")}),i>0&&g<t.length-1&&(o+=i)}return{track:me(e,"string",l),marks:c,steps:h,duration:o}}var Ke=class extends Error{constructor(e){super(e),this.name="EachError"}};function $s(e,t){let n=(e^Math.imul(t+1,2654435769))>>>0;return n=Math.imul(n^n>>>16,569420461),n=Math.imul(n^n>>>15,1935289751),(n^n>>>15)>>>0}var sa=1779033703;function ra(e,t,n){var s,r,i,o,a,l,c,h,u,f,d,y;if(typeof e=="function")return e(t,n);switch(e.kind){case"row":{let g=(s=e.gap)!=null?s:n>1?1/(n-1):0,v=(r=e.align)!=null?r:.5,T=.5-g*(n-1)/2;return[n===1?.5:T+g*t,v]}case"column":{let g=(i=e.gap)!=null?i:n>1?1/(n-1):0,v=(o=e.align)!=null?o:.5,T=.5-g*(n-1)/2;return[v,n===1?.5:T+g*t]}case"grid":{let g=e.cols;if(!(g>=1))throw new Ke(`grid layout needs cols >= 1 (got ${g})`);let v=(a=e.rows)!=null?a:Math.ceil(n/g),T=(l=e.order)!=null?l:"row",m=T==="row"?t%g:Math.floor(t/v),p=T==="row"?Math.floor(t/g):t%v,b=(c=e.gapX)!=null?c:g>1?1/(g-1):0,k=(h=e.gapY)!=null?h:v>1?1/(v-1):0,I=b*(g-1),w=k*(v-1);return[g===1?.5:.5-I/2+b*m,v===1?.5:.5-w/2+k*p]}case"ring":{let g=(u=e.radius)!=null?u:.5,[v,T]=(f=e.center)!=null?f:[.5,.5],m=((d=e.startAngle)!=null?d:-Math.PI/2)+((y=e.sweep)!=null?y:Math.PI*2)*(n===0?0:t/n);return[v+g*Math.cos(m),T+g*Math.sin(m)]}}}function ia(e,t,n){let s=(n-1)/2;switch(e){case"from-center":return r=>Math.abs(r-s)*t;case"from-edges":return r=>(s-Math.abs(r-s))*t;case"delay":return r=>r*t}}function oa(e,t){var s,r;let n=(s=e.stagger)!=null?s:0;return typeof n=="function"?n:ia((r=e.distribute)!=null?r:"delay",n,t)}function aa(e,t,n){var d,y,g,v,T,m;if(!Number.isInteger(e)||e<0)throw new Ke(`each() count must be a non-negative integer (got ${e})`);let s=((d=n.seed)!=null?d:Ss(n.id))>>>0,r=n.box,[i,o]=(y=r==null?void 0:r.origin)!=null?y:[0,0],a=[],l=[],c=new Set;for(let p=0;p<e;p++){let b=`${n.id}/${p}`,k=ra(n.layout,p,e),I={i:p,n:e,id:b,place:k,rng:ce($s(s,p)),seed:s},w=t(p,I);if(!(w instanceof Z))throw new Ke(`each() factory must return a Node for index ${p} (got ${typeof w})`);if(c.has(w))throw new Ke(`each() factory returned the same Node instance for index ${p} \u2014 the factory must construct a new node per index (it is called once per clone)`);if(c.add(w),w.id===void 0)w.id=b;else if(w.id!==b)throw new Ke(`each() factory set id '${w.id}' on index ${p}, but each owns the id namespace \u2014 leave it unset so it becomes '${b}'`);a.push(w),l.push(r?{frac:k,px:[i+k[0]*r.w,o+k[1]*r.h]}:{frac:k})}let h=new ee({id:n.id,children:a}),u=[],f=(v=(g=n.motion)==null?void 0:g.startSec)!=null?v:0;if(n.motion){let p=n.motion,b=(T=p.startSec)!=null?T:0,k=oa(p,e);for(let I=0;I<e;I++){let w=ce($s($s(s,I),sa)),x=(m=p.jitter)==null?void 0:m.call(p,I,w,e),E=M(M({},x!==void 0?{overrides:x}:{}),p.speed!==void 0?{speed:p.speed}:{}),$=p.clip.apply(`${n.id}/${I}`,b+k(I),E);u.push(...$.tracks),$.end>f&&(f=$.end)}}return{node:h,children:a,tracks:u,end:f,places:l}}function vi(e,t={}){var i,o,a;let n=(i=t.start)!=null?i:0,s=(o=t.duration)!=null?o:1,r=(a=t.ease)!=null?a:"easeInOutCubic";return me(`${e}/reveal`,"number",[O(n,0),O(n+s,1,r)])}function ca(e,t={}){var s,r;let n=(r=t.delay)!=null?r:((s=t.duration)!=null?s:1)*.6;return jt(e.map(i=>vi(i,t)),n)}var ki=class extends Error{constructor(e){super(`'${e}' was called inside evaluate() \u2014 scene code must be a pure function of time (\xA75.5). Read ctx.time/frame, use the seeded random(seed) from @glissade/core, and resolve assets before rendering.`),this.name="DeterminismViolationError"}};function la(){let e=globalThis,t=[{target:Math,key:"random",label:"Math.random"},{target:Date,key:"now",label:"Date.now"},{target:e,key:"setTimeout",label:"setTimeout"},{target:e,key:"setInterval",label:"setInterval"}];return typeof performance!="undefined"&&t.push({target:performance,key:"now",label:"performance.now"}),typeof e.requestAnimationFrame=="function"&&t.push({target:e,key:"requestAnimationFrame",label:"requestAnimationFrame"}),t}function ha(e,t){if(e==="off")return t();let n=la(),s=n.map(i=>i.target[i.key]),r=new Set;n.forEach((i,o)=>{i.target[i.key]=(...a)=>{if(e==="throw")throw new ki(i.label);return r.has(i.label)||(r.add(i.label),q(`${i.label} called inside evaluate() \u2014 nondeterministic, not reproducible on export (\xA75.5)`)),s[o].apply(i.target,a)}});try{return t()}finally{n.forEach((i,o)=>{i.target[i.key]=s[o]})}}var xi=class extends Error{constructor(e){super(`duplicate node id '${e}' \u2014 explicit ids must be unique (\xA73.1/\xA76.5)`),this.name="DuplicateNodeIdError"}},Si=class extends Error{constructor(e){super(`node id '${e}' uses the reserved '~' prefix \u2014 that namespace is for structural fallback ids (\xA76.5), which are inspection-only and never track targets; choose another id`),this.name="ReservedNodeIdError"}};function Mi(e,t,n){if(e.measurerSource=n,e.id!==void 0){if(e.id.startsWith("~"))throw new Si(e.id);if(t.has(e.id))throw new xi(e.id);t.set(e.id,e)}if(e instanceof ee)for(let s of e.children)Mi(s,t,n)}function ua(e){let t=new ee({id:"__root",children:e.children}),n=new Map,s=en(),r=A(null);return Mi(t,n,()=>{var i;return(i=r())!=null?i:X()}),{root:t,nodes:n,size:e.size,playhead:s,resolveTarget:i=>{for(let o=i.lastIndexOf("/");o>0;o=i.lastIndexOf("/",o-1)){let a=n.get(i.slice(0,o));if(a)return a.resolveTarget(i.slice(o+1))}},setTextMeasurer:i=>{r.set(i)},get textMeasurer(){var i;return(i=r.peek())!=null?i:X()}}}var ui=new WeakMap;function Ti(e,t){let n=ui.get(e);n||(n=new WeakMap,ui.set(e,n));let s=n.get(t);if(!s){let r=se(t);s={compiled:r,bound:ls(r,e.resolveTarget,e.playhead)},n.set(t,s)}return s}var fa=Object.freeze({version:1,tracks:[]});function be(e,t,n=0){if(t===void 0)return be(e,fa,e.playhead.peek());Ti(e,t);let s=t.fps,r={time:n,frame:s!==void 0?Math.round(n*s):-1,measurer:e.textMeasurer};return hs(e.playhead,n,()=>{let i=bt(e.size);return e.root.emit(i,r),i.finish()})}function wn(e){return JSON.stringify(e,Xe)}function da(e,t,n){let s=e(),r=e(),i=be(s,t,n),o=be(r,t,n);if(wn(i)===wn(o))return{ok:!0};let a=t.fps!==void 0?Math.round(n*t.fps):-1,l={time:n,frame:a,measurer:s.textMeasurer},c={time:n,frame:a,measurer:r.textMeasurer},h;for(let[u,f]of s.nodes){let d=r.nodes.get(u);if(!d)return{ok:!1,node:u};let y=bt(s.size);f.emit(y,l);let g=bt(r.size);d.emit(g,c);let v=y.finish(),T=g.finish();if(wn(v)===wn(T))continue;if(f instanceof ee){h!=null||(h=u);continue}let m=gs(v,T).deltas[0];return M({ok:!1,node:u},m!==void 0?{delta:m}:{})}return M({ok:!1},h!==void 0?{node:h}:{})}var Ds=new Set(["blur","drop-shadow","brightness","contrast","saturate"]),fi=e=>e<0?0:e>1?1:e;function di(e,t,n,s,r){let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*e[0]+a*t[0]+l*n[0]+c*s[0],o*e[1]+a*t[1]+l*n[1]+c*s[1]]}function pa(e){let t=[];for(let n of e){let s=n.v.length;for(let r=0;r<s-1;r++)t.push([n.v[r],[n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1]],[n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1]],n.v[r+1]]);n.closed&&s>1&&t.push([n.v[s-1],[n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1]],[n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1]],n.v[0]])}return t}function Mt(e,t={}){var h,u;let n=Math.max(1,Math.floor((h=t.samplesPerSegment)!=null?h:32)),s=pa(e),r=[],i=[];if(s.length>0){let f=di(...s[0],0);r.push(f),i.push(0);let d=0;for(let y of s)for(let g=1;g<=n;g++){let v=di(...y,g/n);d+=Math.hypot(v[0]-f[0],v[1]-f[1]),r.push(v),i.push(d),f=v}}else{let f=(u=e[0])==null?void 0:u.v[0];r.push(f?[f[0],f[1]]:[0,0]),i.push(0)}let o=i[i.length-1],a=f=>{if(o<=0||f<=0)return{i:0,f:0};if(f>=o)return{i:r.length-2,f:1};let d=0;for(;d<i.length-1&&i[d+1]<f;)d++;let y=i[d+1]-i[d];return{i:d,f:y>0?(f-i[d])/y:0}},l=f=>{if(r.length===1)return[r[0][0],r[0][1]];let{i:d,f:y}=a(f),g=r[d],v=r[d+1];return[g[0]+(v[0]-g[0])*y,g[1]+(v[1]-g[1])*y]},c=f=>{if(r.length===1)return[1,0];let{i:d}=a(f),y=r[d],g=r[d+1],v=g[0]-y[0],T=g[1]-y[1],m=Math.hypot(v,T);return m>0?[v/m,T/m]:[1,0]};return{length:o,at:l,tangentAt:c,atProgress:f=>l(fi(f)*o),tangentAtProgress:f=>c(fi(f)*o)}}function ma(e){return Mt(e).length}function ga(e,t){return Mt(e).at(t)}var Ei=class extends Z{constructor(t){var a;super(t);S(this,"target");S(this,"progress");this.target=t.target,this.progress=A(1),typeof t.progress=="function"?this.progress.bindSource(t.progress):t.progress!==void 0&&this.progress.set(t.progress),this.registerTarget("progress",this.progress,"number");let n=t.samplesPerSegment!==void 0?{samplesPerSegment:t.samplesPerSegment}:{},s=t.path instanceof kt?()=>t.path.data():()=>t.path,r=s(),i=Mt(r,n),o=()=>{let l=s();return l!==r&&(r=l,i=Mt(l,n)),i};if(t.target.position.bindSource(()=>o().atProgress(this.progress())),t.orient){let l=(a=t.orientOffset)!=null?a:0;t.target.rotation.bindSource(()=>{let c=o().tangentAtProgress(this.progress());return Math.atan2(c[1],c[0])*180/Math.PI+l})}}draw(){}};function ya(e,t,n={}){return new Ei(R(M({},n),{target:e,path:t}))}var Tt=class extends Error{constructor(e){super(e),this.name="TokenMatchError"}},Os=e=>e.replace(/\s+/g,"");function As(e,t,n=1){let s=Os(t);if(s.length===0)throw new Tt("empty token");let r=0;for(let i=0;i<e.length;i++){let o="";for(let a=i;a<e.length;a++){if(o+=Os(e[a].text),o===s){if(r++,r===n)return[i,a];break}if(!s.startsWith(o))break}}throw new Tt(`no match for token '${t}'${n>1?` (occurrence ${n})`:""} \u2014 segments are [${e.map(i=>`'${i.text}'`).join(", ")}]`)}var Ii=class extends Z{constructor(t){var s,r,i;super(t);S(this,"target");S(this,"padding");S(this,"cornerRadius");S(this,"rematch");S(this,"ranges");this.target=t.text,this.padding=(s=t.padding)!=null?s:[4,2],this.cornerRadius=(r=t.cornerRadius)!=null?r:4,this.rematch=(i=t.rematch)!=null?i:!1;let n=this.target.wordBoxes();this.ranges=t.ranges.map((o,a)=>{var u;let l=this.resolveRun(n,o),c=(u=o.id)!=null?u:`r${a}`,h={spec:o,fill:bn(A("#ffe066"),o.fill),opacity:bn(A(1),o.opacity),progress:bn(A(1),o.progress),scale:bn(A(1),o.scale),offset:ba(Ye([0,0]),o.offset),run:l,bound:pi(n,l)};return this.registerTarget(`${c}/fill`,h.fill,"color"),this.registerTarget(`${c}/opacity`,h.opacity,"number"),this.registerTarget(`${c}/progress`,h.progress,"number"),this.registerTarget(`${c}/scale`,h.scale,"number"),this.registerTarget(`${c}/offset`,h.offset,"vec2"),this.registerTarget(`${c}/offset.x`,h.offset.x,"number"),this.registerTarget(`${c}/offset.y`,h.offset.y,"number"),h})}resolveRun(t,n){var s;if(typeof n.match!="string"){let[r,i]=n.match;if(r<0||i>=t.length||r>i)throw new Tt(`word index range [${r}, ${i}] out of bounds (${t.length} boxes)`);return[r,i]}return As(t,n.match,(s=n.occurrence)!=null?s:1)}draw(t,n){var l;let s=this.target.wordBoxes(n.measurer);if(s.length===0)return;let r=this.target.localMatrix(),[i,o]=this.padding,a=!1;for(let c of this.ranges){let h=c.opacity();if(h<=0)continue;let u=Math.min(1,Math.max(0,c.progress()));if(u<=0)continue;let f=c.run;if(this.rematch&&typeof c.spec.match=="string")f=As(s,c.spec.match,(l=c.spec.occurrence)!=null?l:1);else if(pi(s,f)!==c.bound)throw new Tt(`bound token '${c.bound}' no longer matches boxes [${f[0]}, ${f[1]}] \u2014 the text changed (segments now [${s.slice(f[0],f[1]+1).map(b=>`'${b.text}'`).join(", ")}]); pass rematch: true for animated text`);let d=[];for(let b=f[0];b<=f[1];b++){let k=s[b],I=d[d.length-1],w=b>f[0]&&s[b-1].line===k.line?I:void 0;w?(w.w=k.x+k.w+i-w.x,w.y=Math.min(w.y,k.y-o),w.h=Math.max(w.h,k.y+k.h+o-w.y)):d.push({x:k.x-i,y:k.y-o,w:k.w+2*i,h:k.h+2*o})}!a&&!Ie(r,$e)&&(t.push({op:"transform",m:r}),a=!0);let y=h<1;y&&t.push({op:"pushGroup",opacity:h,blend:"source-over",filters:[]});let g=c.fill(),v=c.scale(),[T,m]=c.offset(),p=u*d.reduce((b,k)=>b+k.w,0);for(let b of d){let k=Math.min(b.w,p);if(p-=k,k<=0)break;let I=b.x+b.w/2+T,w=b.y+b.h/2+m,x=k*v,E=b.h*v,$=I-b.w/2*v,D=w-E/2,z=Math.min(this.cornerRadius,x/2,E/2),B=t.resource({kind:"path",segs:Ge($,D,x,E,z)});if(t.push({op:"fillPath",path:B,paint:{kind:"color",color:g}}),p<=0)break}y&&t.push({op:"popGroup"})}}};function pi(e,t){return e.slice(t[0],t[1]+1).map(n=>Os(n.text)).join("")}function wa(e,t){return new Ii(R(M({},t),{text:e}))}function bn(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function ba(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function $i(e){let t=[],n=s=>{if(s instanceof le){let r=s.text();r&&t.push({family:s.fontFamily,text:r})}if(s instanceof ee)for(let r of s.children)n(r)};return n(e.root),t}function va(e){let t=e.indexOf("/");return t>=0?e.slice(0,t):e}function ka(e,t){let n=[];for(let s of t.tracks){if(s.type!=="string")continue;let r=e.nodes.get(va(s.target));if(r instanceof le)for(let i of s.keys){let o=i.value;typeof o=="string"&&o&&n.push({family:r.fontFamily,text:o})}}return n}async function Fs(e,t,n,s={}){var c,h;let r=(c=s.mode)!=null?c:"dev",i=pt(t.assets),o=[...$i(e),...(h=s.extraUsages)!=null?h:[]],a=new Set;for(let u of o)if(i.has(u.family))for(let f of i.fallbackChain(u.family))a.add(f);let l=new Map;for(let u of a){let f=i.resolveFace(u);if(!f)continue;let d=await n(f.url);d&&l.set(u,Yt(d))}return cs(o,i,l,r,M({},s.osFamilies!==void 0?{osFamilies:s.osFamilies}:{}))}var St=class extends Error{constructor(t,n,s){super(`asset '${t}' not ready: ${n}. evaluate() never awaits \u2014 warm assets before evaluating (\xA72.5 readiness precondition)`);S(this,"assetId");S(this,"detail");S(this,"mediaT");this.name="ColdAssetError",this.assetId=t,this.detail=n,this.mediaT=s}},xa=class extends ee{constructor(t){var s;super(t);S(this,"wgsl");S(this,"uniformSignals");this.wgsl=t.wgsl;let n=new Map;for(let[r,i]of Object.entries((s=t.uniforms)!=null?s:{})){let o=A(i);n.set(r,o),this.registerTarget(`u.${r}`,o,"number")}this.uniformSignals=n}uniform(t){let n=this.uniformSignals.get(t);if(!n)throw new Error(`ShaderEffect has no uniform '${t}' (have: ${[...this.uniformSignals.keys()].join(", ")})`);return n}groupShader(){let t={};for(let[n,s]of this.uniformSignals)t[n]=s();return{wgsl:this.wgsl,uniforms:t}}},Sa=e=>e*e*(3-2*e),Ma=2.4,Ta=1-Math.exp(-5.76/2),Ea=e=>(1-Math.exp(-((e*Ma)**2)/2))/Ta;function Ia(e,t){if(t==="linear"||e.length<2)return e;let n=t==="gaussian"?Ea:Sa,s=e[0].offset,r=e[e.length-1].offset-s;if(r<=0)return e;let i=[],o=0;for(let a=0;a<64;a++){let l=s+r*(a/63);for(;o<e.length-2&&l>e[o+1].offset;)o++;let c=e[o],h=e[o+1],u=h.offset-c.offset,f=u>0?Math.min(1,Math.max(0,(l-c.offset)/u)):0;i.push({offset:l,color:fe(c.color,h.color,n(f))})}return i}var $a=4,Ca=2,Ps=.32,mi=1e-6,gi=1024;function Ci(e,t,n){let s=new Uint8ClampedArray(Math.max(1,t)*Math.max(1,n)*4),r=e.points.map(l=>({u:l.pos[0],v:l.pos[1],lab:Ae(pe(l.color))})),i=e.bg!==void 0?Ae(pe(e.bg)):null,o=e.interpolation==="gaussian",a=2*Ps*Ps;for(let l=0;l<n;l++){let c=n>1?(l+.5)/n:.5;for(let h=0;h<t;h++){let u=t>1?(h+.5)/t:.5,f=0,d=0,y=0,g=0,v=0;i&&(f=1,d=i.L,y=i.a,g=i.b,v=i.alpha);let T=!1;for(let b=0;b<r.length;b++){let k=r[b],I=u-k.u,w=c-k.v,x=I*I+w*w;if(x<=mi*mi){d=k.lab.L,y=k.lab.a,g=k.lab.b,v=k.lab.alpha,T=!0;break}let E;o?E=Math.exp(-x/a):E=1/x,f+=E,d+=E*k.lab.L,y+=E*k.lab.a,g+=E*k.lab.b,v+=E*k.lab.alpha}let m;if(T)m=We({L:d,a:y,b:g,alpha:v});else if(f>0){let b=1/f;m=We({L:d*b,a:y*b,b:g*b,alpha:v*b})}else m={r:0,g:0,b:0,a:0};let p=(l*t+h)*4;s[p]=m.r,s[p+1]=m.g,s[p+2]=m.b,s[p+3]=Math.round(m.a*255)}}return s}function Oi(e,t){return{w:Math.min(gi,Math.max(1,Math.ceil(Math.abs(e)/4))),h:Math.min(gi,Math.max(1,Math.ceil(Math.abs(t)/4)))}}var yi=!1;function Oa(e){var t,n,s;return yi||(yi=!0,q("mesh Paint on a stroke/text resolves to a representative solid color (mesh fill is supported only on filled paths, \xA73 Paint) \u2014 use a fillPath for the mesh gradient")),(s=(n=e.bg)!=null?n:(t=e.points[0])==null?void 0:t.color)!=null?s:"#00000000"}function Cs(e,t,n){if(t.kind==="color")return t.color;if(t.kind==="mesh")return Oa(t);let s;if(t.kind==="radial"){let i=t.center?t.center[0]:n?(n.minX+n.maxX)/2:0,o=t.center?t.center[1]:n?(n.minY+n.maxY)/2:0,a=t.radius!==void 0?t.radius:n?Math.hypot(n.maxX-n.minX,n.maxY-n.minY)/2:0;s=e.createRadialGradient(i,o,0,i,o,a)}else{let i=t.from?t.from[0]:n?(n.minX+n.maxX)/2:0,o=t.from?t.from[1]:n?n.minY:0,a=t.to?t.to[0]:n?(n.minX+n.maxX)/2:0,l=t.to?t.to[1]:n?n.maxY:0;s=e.createLinearGradient(i,o,a,l)}let r=t.interpolation?Ia(t.stops,t.interpolation):t.stops;for(let i of r)s.addColorStop(i.offset,i.color);return s}function vn(e){return`${e.style==="italic"?"italic ":""}${e.weight!==void 0&&e.weight!==400?`${e.weight} `:""}${e.size}px ${e.family}`}var Aa=16;function Pa(e){let t=n=>Object.is(n,-0)?"0":String(Math.round(n*1e4)/1e4);return`${t(e[0])},${t(e[1])},${t(e[2])},${t(e[3])},${t(e[4])},${t(e[5])}`}function Da(e){let t=0;for(let n of e!=null?e:[])n.kind==="blur"?t+=3*n.radius:n.kind==="drop-shadow"&&(t+=Math.max(Math.abs(n.dx),Math.abs(n.dy))+3*n.blur);return t}function Ai(e,t,n){return e?(t<e.minX&&(e.minX=t),n<e.minY&&(e.minY=n),t>e.maxX&&(e.maxX=t),n>e.maxY&&(e.maxY=n),e):{minX:t,minY:n,maxX:t,maxY:n}}function xt(e,t,n,s,r,i){for(let[o,a]of[[n,s],[r,s],[n,i],[r,i]])e.bounds=Ai(e.bounds,t[0]*o+t[2]*a+t[4],t[1]*o+t[3]*a+t[5])}function Fa(e){let t=null,n=(s,r)=>{t=Ai(t,s,r)};for(let s of e)switch(s[0]){case"M":case"L":n(s[1],s[2]);break;case"C":n(s[1],s[2]),n(s[3],s[4]),n(s[5],s[6]);break;case"Q":n(s[1],s[2]),n(s[3],s[4]);break;case"E":{let r=Math.max(s[3],s[4]);n(s[1]-r,s[2]-r),n(s[1]+r,s[2]+r);break}}return t}var Rs=class{constructor(e,t="warn",n=(i=>(i=(r=>(r=(s=>(s=globalThis.process)==null?void 0:s.env)())==null?void 0:r.RASTER_CACHE)())!=null?i:"1")()!=="0"){S(this,"host");S(this,"shaderCaps");S(this,"pool",[]);S(this,"pathCache",new WeakMap);S(this,"pathBoundsCache",new WeakMap);S(this,"images",new Map);S(this,"videos",new Map);S(this,"warnedShaders",!1);S(this,"rasterCache",new Map);S(this,"cacheEnabled");this.host=e,this.shaderCaps=t,this.cacheEnabled=n}setImageAsset(e,t){this.images.set(e,t)}setVideoAsset(e,t){this.videos.set(e,t)}dispose(){this.pool.length=0,this.rasterCache.clear()}resolveDrawable(e,t){if(e.kind==="image"){let n=this.images.get(e.assetId);if(!n)throw new St(e.assetId,"no decoded image registered");return n}if(e.kind==="videoFrame"){let n=this.videos.get(e.assetId);if(!n)throw new St(e.assetId,"no VideoFrameSource registered",e.mediaT);try{return n.getFrameSync(e.mediaT)}catch(s){throw s instanceof St?new St(e.assetId,s.detail,e.mediaT):s}}throw new Error(`resource ${t} is not drawable`)}path(e,t){let n=e[t];if(!n||n.kind!=="path")throw new Error(`resource ${t} is not a path`);let s=this.pathCache.get(n);return s||(s=this.buildPath(n.segs),this.pathCache.set(n,s)),s}pathBounds(e,t){var s;let n=e[t];return!n||n.kind!=="path"?null:(this.pathBoundsCache.has(n)||this.pathBoundsCache.set(n,Fa(n.segs)),(s=this.pathBoundsCache.get(n))!=null?s:null)}buildPath(e){let t=this.host.newPath();for(let n of e)switch(n[0]){case"M":t.moveTo(n[1],n[2]);break;case"L":t.lineTo(n[1],n[2]);break;case"C":t.bezierCurveTo(n[1],n[2],n[3],n[4],n[5],n[6]);break;case"Q":t.quadraticCurveTo(n[1],n[2],n[3],n[4]);break;case"E":t.ellipse(n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"Z":t.closePath();break}return t}acquire(e,t){let n=this.pool.pop();return n?(n.width!==e&&(n.width=e),n.height!==t&&(n.height=t),n):this.host.createCanvas(e,t)}release(e){this.pool.length<8&&this.pool.push(e)}cacheStore(e,t){let n=this.rasterCache.get(e);for(n&&(this.rasterCache.delete(e),n.canvas!==t.canvas&&this.release(n.canvas)),this.rasterCache.set(e,t);this.rasterCache.size>Aa;){let s=this.rasterCache.keys().next().value;if(s===void 0)break;let r=this.rasterCache.get(s);this.rasterCache.delete(s),this.release(r.canvas)}}cacheTouch(e){let t=this.rasterCache.get(e);return t&&(this.rasterCache.delete(e),this.rasterCache.set(e,t)),t}fillMesh(e,t,n,s){let r=s.maxX-s.minX,i=s.maxY-s.minY;if(r<=0||i<=0)return;let{w:o,h:a}=Oi(r,i),l=Ci(n,o,a),c=this.acquire(o,a),h=this.host.context(c),u=h.createImageData(o,a);u.data.set(l),h.putImageData(u,0,0),e.save(),e.clip(t,"nonzero"),e.imageSmoothingEnabled=!0,e.drawImage(c,0,0,o,a,s.minX,s.minY,r,i),e.restore(),this.release(c)}composite(e,t,n,s,r,i,o,a,l,c,h,u){let f=l!==void 0&&l!=="none",d=f?Da(c):0;r||a!=="source-over"?t.unbounded=!0:s&&xt(t,$e,s.minX-d,s.minY-d,s.maxX+d,s.maxY+d);let y=f&&!i&&!r&&a==="source-over";if(!(y&&s===null)){if(e.save(),e.resetTransform(),y&&s){let g=Math.max(0,Math.floor(s.minX-d)),v=Math.max(0,Math.floor(s.minY-d)),T=Math.min(h,Math.ceil(s.maxX+d)),m=Math.min(u,Math.ceil(s.maxY+d));if(g>=T||v>=m){e.restore();return}let p=this.host.newPath();p.moveTo(g,v),p.lineTo(T,v),p.lineTo(T,m),p.lineTo(g,m),p.closePath(),e.clip(p,"nonzero")}e.globalAlpha=o,f&&(e.filter=l),e.globalCompositeOperation=a,e.drawImage(n,0,0),e.restore()}}render(e,t){var u,f,d,y,g,v,T,m,p,b,k;let{w:n,h:s}=t.size;e.width!==n&&(e.width=n),e.height!==s&&(e.height=s);let r=this.host.context(e);r.resetTransform(),r.clearRect(0,0,n,s);let i=[{ctx:r,canvas:null,opacity:1,blend:"source-over",bounds:null,unbounded:!1}],o=()=>i[i.length-1].ctx,a=()=>i[i.length-1],l=$e,c=[],h=t.commands;for(let I=0;I<h.length;I++){let w=h[I];switch(w.op){case"save":c.push(l),o().save();break;case"restore":l=(u=c.pop())!=null?u:l,o().restore();break;case"transform":l=yt(l,w.m),o().transform(w.m[0],w.m[1],w.m[2],w.m[3],w.m[4],w.m[5]);break;case"clip":o().clip(this.path(t.resources,w.path),(f=w.rule)!=null?f:"nonzero");break;case"fillPath":{let x=o(),E=this.pathBounds(t.resources,w.path);w.paint.kind==="mesh"&&E?this.fillMesh(x,this.path(t.resources,w.path),w.paint,E):(x.fillStyle=Cs(x,w.paint,E),x.fill(this.path(t.resources,w.path))),E&&xt(a(),l,E.minX,E.minY,E.maxX,E.maxY);break}case"strokePath":{let x=o(),E=this.pathBounds(t.resources,w.path);if(x.strokeStyle=Cs(x,w.paint,E),x.lineWidth=w.stroke.width,x.lineCap=(d=w.stroke.cap)!=null?d:"butt",x.lineJoin=(y=w.stroke.join)!=null?y:"miter",w.stroke.dash&&(x.setLineDash(w.stroke.dash),x.lineDashOffset=(g=w.stroke.dashOffset)!=null?g:0),x.stroke(this.path(t.resources,w.path)),w.stroke.dash&&(x.setLineDash([]),x.lineDashOffset=0),E){let $=w.stroke.width*(((v=w.stroke.join)!=null?v:"miter")==="miter"?5:1);xt(a(),l,E.minX-$,E.minY-$,E.maxX+$,E.maxY+$)}break}case"fillText":{let x=o();x.font=vn(w.font),x.fillStyle=Cs(x,w.paint,null),x.textBaseline="alphabetic",x.textAlign=(T=w.align)!=null?T:"left",x.fillText(w.text,w.x,w.y);try{let E=x.measureText(w.text).width,$=(m=w.align)!=null?m:"left",D=$==="center"?w.x-E/2:$==="right"?w.x-E:w.x,z=w.font.size;xt(a(),l,D-z,w.y-1.5*z,D+E+z,w.y+.75*z)}catch(E){a().unbounded=!0}break}case"drawImage":{let x=t.resources[w.image];if(!x)throw new Error(`drawImage references missing resource ${w.image}`);let E=this.resolveDrawable(x,w.image),$=o();w.smoothing!==void 0&&($.imageSmoothingEnabled=w.smoothing);let{x:D,y:z,w:B,h:K}=w.dst;w.src?$.drawImage(E,w.src.x,w.src.y,w.src.w,w.src.h,D,z,B,K):$.drawImage(E,D,z,B,K),xt(a(),l,D,z,D+B,z+K);break}case"pushGroup":{let x=o(),E=this.cacheEnabled&&w.cacheKey!==void 0&&w.shader===void 0?`${w.cacheKey}@${Pa(l)}`:void 0;if(E!==void 0){let z=this.cacheTouch(E);if(z){this.composite(x,a(),z.canvas,z.bounds,z.unbounded,!1,w.opacity,w.blend,cn(w.filters),w.filters,n,s);let B=1;for(;B>0&&++I<h.length;){let K=h[I];K.op==="pushGroup"?B++:K.op==="popGroup"&&B--}break}}let $=this.acquire(n,s),D=this.host.context($);D.resetTransform(),D.clearRect(0,0,n,s),D.setTransform(x.getTransform()),i.push(M(R(M({ctx:D,canvas:$,opacity:w.opacity,blend:w.blend,filter:cn(w.filters),filters:w.filters},w.shader!==void 0?{shader:w.shader}:{}),{bounds:null,unbounded:!1}),E!==void 0?{cacheStoreKey:E}:{}));break}case"popGroup":{let x=i.pop();if(!x||x.canvas===null)throw new Error("popGroup without matching pushGroup");let E=o(),$=x.canvas,D=!1;if(x.shader!==void 0){let z=(k=(b=(p=this.host).applyShader)==null?void 0:b.call(p,x.canvas,x.shader,n,s))!=null?k:null;if(z!==null)$=z,D=!0,x.bounds={minX:0,minY:0,maxX:n,maxY:s},x.unbounded=!1;else{if(this.shaderCaps==="error")throw new Error("a ShaderEffect reached a backend without a shader runner (\xA73.7) \u2014 load @glissade/effects-webgpu in the browser, or accept passthrough with caps.shaders: warn");this.warnedShaders||(this.warnedShaders=!0,q("ShaderEffect pass skipped: no shader runner here (headless or webgpu-less browser) \u2014 subtree composites unfiltered (\xA73.7 caps.shaders)"))}}this.composite(E,a(),$,x.bounds,x.unbounded,D,x.opacity,x.blend,x.filter,x.filters,n,s),x.cacheStoreKey!==void 0&&!D?this.cacheStore(x.cacheStoreKey,{canvas:x.canvas,bounds:x.bounds,unbounded:x.unbounded}):this.release(x.canvas);break}}}if(i.length!==1)throw new Error("unbalanced pushGroup/popGroup in DisplayList")}};var Et=null;function Pi(e){Et=e}function Ra(e,t){if(typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(e,t);let n=document.createElement("canvas");return n.width=e,n.height=t,n}var La=16384,ze=class{constructor(e,t={}){S(this,"target");S(this,"raster");var n;this.target=e,this.raster=new Rs({context:s=>this.context(s),createCanvas:(s,r)=>Ra(s,r),newPath:()=>new Path2D,applyShader:(s,r,i,o)=>{var a;return(a=Et==null?void 0:Et.apply(s,r,i,o))!=null?a:null}},(n=t.shaderCaps)!=null?n:"warn")}get caps(){return{filters:Ds,shaders:Et!==null,maxTextureSize:La}}setImageAsset(e,t){this.raster.setImageAsset(e,t)}setVideoAsset(e,t){this.raster.setVideoAsset(e,t)}measureText(e,t){let n=this.context(this.target);n.save(),n.font=vn(t);let s=n.measureText(e);return n.restore(),{width:s.width,ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent}}render(e){this.raster.render(this.target,e)}async readPixels(){return this.context(this.target).getImageData(0,0,this.target.width,this.target.height).data}get canvas(){return this.target}dispose(){this.raster.dispose()}context(e){let t=e.getContext("2d");if(!t)throw new Error("canvas 2d context unavailable");return t}};async function za(e){let t=new Uint8Array(await e.arrayBuffer()),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return`data:${e.type||"image/png"};base64,${btoa(n)}`}function Na(e){return e instanceof ze?e.canvas:e}async function Ls(e,t="image/png",n){let s=Na(e);if(typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas)return await za(await s.convertToBlob(M({type:t},n!==void 0?{quality:n}:{})));let r=s;if(typeof r.toDataURL!="function")throw new Error("snapshotCanvas() is browser-only: canvas has no toDataURL/convertToBlob");return n!==void 0?r.toDataURL(t,n):r.toDataURL(t)}async function Di(e,t,n,s){var h;let r=t!==void 0&&typeof t.version=="number",i=r?t:void 0,o=(h=r?s:t)!=null?h:{},{w:a,h:l}=e.size,c=new ze(typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(a,l):Object.assign(document.createElement("canvas"),{width:a,height:l}));try{return c.render(i!==void 0?be(e,i,n!=null?n:0):be(e)),await Ls(c,o.type,o.quality)}finally{c.dispose()}}var he=class extends Error{constructor(e){super(e),this.name="ClipError"}};function Fi(e,t,n){let s;try{s=Pe(n)}catch(i){throw new he(`clip override for '${e}' has an un-typeable value ${JSON.stringify(n)} (channel type '${t}')`)}let r=i=>i==="color"||i==="string";if(!(s===t||r(s)&&r(t)))throw new he(`clip override for '${e}' is a '${s}' value but the channel is '${t}' (${JSON.stringify(n)}); a mismatched override samples to NaN`);return n}function Ri(e){return e.keys.length===0?0:e.keys[e.keys.length-1].t}function Ba(e,t,n){if(typeof e=="string")return Me(`${e}/${n}`);let s=e[t];if(s===void 0)throw new he(`clip target map is missing channel '${t}' \u2014 provide a target for every channel, or pass a node-id string`);return Me(s)}function Va(e,t,n,s,r){var a;if(t.keys.length===0)throw new he(`clip channel '${e}' has no keys`);let i=(a=t.type)!=null?a:Pe(t.keys[0].value),o=t.keys.length-1;if(r&&o===0&&r.from!==void 0)throw new he(r.to!==void 0?`clip override for '${e}' supplies both 'from' and 'to' on a single-key channel \u2014 ambiguous (both target the only key)`:`clip override for '${e}' supplies 'from' on a single-key channel \u2014 ambiguous (the only key already is the 'to' value)`);return me(e,i,t.keys.map((l,c)=>{let h=l.value,u=!1;r&&(c===0&&r.from!==void 0&&(h=Fi(e,i,r.from),u=!0),c===o&&r.to!==void 0&&(h=Fi(e,i,r.to),u=!0));let f={t:n+l.t/s,value:h},d=r&&c===o&&r.ease!==void 0?r.ease:l.ease;return d!==void 0&&(f.ease=d),l.interp!==void 0&&(f.interp=l.interp),l.id!==void 0&&(f.id=l.id),l.derived!==void 0&&!u&&(f.derived=l.derived),l.from!==void 0&&(f.from=l.from),f}))}function ve(e){let t=Object.keys(e.channels);if(t.length===0)throw new he("clip() requires at least one channel");let n=0;for(let r of t){let i=e.channels[r];if(i.keys.length===0)throw new he(`clip channel '${r}' has no keys`);n=Math.max(n,Ri(i))}function s(r,i,o){var u;let a=(u=o==null?void 0:o.speed)!=null?u:1;if(!(a>0))throw new he(`clip speed must be > 0 (got ${a})`);let l=o==null?void 0:o.overrides,c=[],h=i;for(let f of t){let d=e.channels[f],y=Ba(r,f,d.path);c.push(Va(y,d,i,a,l==null?void 0:l[f])),h=Math.max(h,i+Ri(d)/a)}if(l){for(let f of Object.keys(l))if(!(f in e.channels))throw new he(`clip override references unknown channel '${f}'`)}return{tracks:c,end:h}}return{spec:e,duration:n,apply:s}}function _a(e,t,n,s){var h;let r=(h=s==null?void 0:s.stagger)!=null?h:0,i=typeof r=="function"?r:f=>f*r,u=s!=null?s:{},{stagger:o}=u,a=_e(u,["stagger"]),l=[],c=n;return t.forEach((f,d)=>{let y=e.apply(f,n+i(d),a);l.push(...y.tracks),y.end>c&&(c=y.end)}),{tracks:l,end:c}}function qa(e){var s,r;let t=(s=e==null?void 0:e.duration)!=null?s:.3,n=(r=e==null?void 0:e.ease)!=null?r:"easeOutCubic";return ve({channels:{opacity:{path:"opacity",keys:[O(0,0),O(t,1,n)]},scale:{path:"scale",keys:[O(0,[.8,.8]),O(t,[1,1],n)]}}})}function Wa(e,t){var o,a,l;let n=(o=t==null?void 0:t.duration)!=null?o:.3,s=(a=t==null?void 0:t.ease)!=null?a:"easeOutCubic",r=(l=t==null?void 0:t.distance)!=null?l:40,i=e==="left"?[-r,0]:e==="right"?[r,0]:e==="top"?[0,-r]:[0,r];return ve({channels:{opacity:{path:"opacity",keys:[O(0,0),O(n,1,s)]},offset:{path:"position",keys:[O(0,i),O(n,[0,0],s)]}}})}function ja(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:.4,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.scale)!=null?o:1.1;return ve({channels:{scale:{path:"scale",keys:[O(0,[1,1]),O(t/2,[s,s],n),O(t,[1,1],n)]}}})}function Ha(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:2,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.amplitude)!=null?o:8;return ve({channels:{drift:{path:"position",keys:[O(0,[0,0]),O(t/2,[s,0],n),O(t,[0,0],n)]}}})}var Qe=class extends Error{constructor(e){super(e),this.name="MorphError"}};function zs(e,t){for(let[n,s]of[["x",t.x],["y",t.y],["w",t.w],["h",t.h]])if(!Number.isFinite(s))throw new Qe(`morph ${e}.${n} must be finite (got ${s})`);if(!(t.w>0)||!(t.h>0))throw new Qe(`morph ${e} must have w>0 and h>0 (got w=${t.w}, h=${t.h}); a zero/negative box yields a NaN/Infinity scale`)}function kn(e,t){let n=typeof e=="string"?e:e[De];return typeof n!="string"||n.length===0?`${String(n)}/${t}`:`${typeof e=="string"?n:n.slice(0,Math.max(0,n.lastIndexOf("/")))}/${t}`}function Ya(e,t,n,s){var T,m,p;let{at:r,duration:i}=s,o=s.ease,a=(T=s.crossfade)!=null?T:.5,l=(m=s.metric)!=null?m:"transform";if(l!=="transform")throw new Qe(`morph metric '${l}' is not supported in v1 (only 'transform')`);if(zs("from",e),zs("to",t),!(i>0))throw new Qe(`morph duration must be > 0 (got ${i})`);if(!(a>=0&&a<=1))throw new Qe(`morph crossfade must be in [0,1] (got ${a})`);let c=(p=s.base)!=null?p:{w:t.w,h:t.h};zs("to",{x:0,y:0,w:c.w,h:c.h});let h=[e.w/c.w,e.h/c.h],u=[t.w/c.w,t.h/c.h],f=[e.x,e.y],d=[t.x,t.y],y={position:{path:"position",type:"vec2",keys:[O(0,f),O(i,d,o)]},scale:{path:"scale",type:"vec2",keys:[O(0,h),O(i,u,o)]}},g={position:kn(n.morphNode,"position"),scale:kn(n.morphNode,"scale")};n.fromNode!==void 0&&i*a>0&&(y.fromOpacity={path:"opacity",type:"number",keys:[O(0,1),O(i*a,0,o)]},g.fromOpacity=kn(n.fromNode,"opacity")),n.toNode!==void 0&&i*(1-a)<i&&(y.toOpacity={path:"opacity",type:"number",keys:[O(i*(1-a),0),O(i,1,o)]},g.toOpacity=kn(n.toNode,"opacity"));let{tracks:v}=ve({channels:y}).apply(g,r);return{tracks:v,end:r+i}}var Bs=class extends Error{constructor(e){super(e),this.name="PresenceError"}},_s=.3;function Ua(){return ve({channels:{opacity:{path:"opacity",keys:[O(0,0),O(_s,1)]}}})}function Xa(){return ve({channels:{opacity:{path:"opacity",keys:[O(0,1),O(_s,0)]}}})}function Ga(e){return typeof e.apply=="function"}function Vs(e){return Array.isArray(e)}function Bi(e,t){var i,o;let n=(i=e.dur)!=null?i:_s,s=e.ease,r={};if(e.opacity!==void 0){let[a,l]=e.opacity;r.opacity={path:"opacity",keys:[O(0,a),O(n,l,...Ns(s))]}}if(e.offset!==void 0){let[a,l]=Qa(e.offset,(o=e.edge)!=null?o:"bottom",t);r.offset={path:"position",keys:[O(0,a),O(n,l,...Ns(s))]}}if(e.scale!==void 0){let[a,l]=Ja(e.scale);r.scale={path:"scale",keys:[O(0,a),O(n,l,...Ns(s))]}}return ve({channels:r})}function Ns(e){return e!==void 0?[e]:[]}function Ka(e,t){return e==="left"?[-t,0]:e==="right"?[t,0]:e==="top"?[0,-t]:[0,t]}function Qa(e,t,n){if(Array.isArray(e)&&Vs(e[0]))return e;let s=Vs(e)?e:Ka(t,e),r=[0,0];return n==="enter"?[s,r]:[r,s]}function Ja(e){let[t,n]=e,s=r=>Vs(r)?r:[r,r];return[s(t),s(n)]}function Li(e,t,n){return e===void 0?n():Ga(e)?e:Bi(e,t)}function zi(e,t){var n;return e.duration/((n=t==null?void 0:t.speed)!=null?n:1)}function Za(e){return e.map((t,n)=>[t,n]).sort((t,n)=>t[0].t-n[0].t||t[1]-n[1]).map(([t])=>t)}function Ni(e,t){let n=[],s=[];for(let r of e)r.target===t?s=r.keys:n.push(r);return{opacityKeys:s,rest:n}}function Vi(e){let t=Za(e),n=[];for(let s of t){let r=n[n.length-1];r&&r.t===s.t?n[n.length-1]=s:n.push(s)}return n}function ec(e,t){let n=[],s=new Map;for(let r of[...e,...t]){let i=s.get(r.target);i?i.push(r):(s.set(r.target,[r]),n.push(r.target))}return n.map(r=>{let i=s.get(r);if(i.length===1)return i[0];let o=i.flatMap(a=>a.keys);return me(r,i[0].type,Vi(o))})}function tc(e,t){var b,k,I,w;let n=(k=t.show)!=null?k:(b=t.window)==null?void 0:b[0],s=(w=t.hide)!=null?w:(I=t.window)==null?void 0:I[1];if(n===void 0||s===void 0)throw new Bs("presence() needs a window: pass { show, hide } or { window: [show, hide] }");let r=Me(typeof e=="string"?`${e}/opacity`:e),i=r.lastIndexOf("/"),o=i<0?r:r.slice(0,i),a=Li(t.enter,"enter",Ua),l=Li(t.exit,"exit",Xa),c=a.apply(o,n,t.enterOpts),h=n+zi(a,t.enterOpts),u=zi(l,t.exitOpts),f=s-u;if(f<=n)throw new Bs(`presence('${o}') exit needs ${u.toFixed(3)}s but only ${(s-n).toFixed(3)}s between show (${n}) and hide (${s}) \u2014 widen the window or shorten/speed up the exit`);let d=l.apply(o,f,t.exitOpts),{opacityKeys:y,rest:g}=Ni(c.tracks,r),{opacityKeys:v,rest:T}=Ni(d.tracks,r),m=[O(0,0,{interp:"hold"}),O(h,1,{interp:"hold"}),O(s,0,{interp:"hold"})],p=[];if(y.length>0?y.forEach((x,E)=>{E===0&&x.value!==0&&x.interp!=="hold"?p.push(R(M({},x),{interp:"hold"})):p.push(x)}):p.push(O(n,0),O(h,1)),v.length>0)for(let x of v)p.push(x);else p.push(O(f,1),O(s,0));return{tracks:[me(r,"number",Vi([...m,...p])),...ec(g,T)],end:s,shownAt:n,hiddenAt:s}}function _i(e){var u;let t=(u=e.match(/[MmLlHhVvCcQqZz]|-?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))!=null?u:[],n=[],s=0,r=0,i=0,o=0,a=0,l="",c=()=>Number(t[s++]),h=f=>!!f&&/^[MmLlHhVvCcQqZz]$/.test(f);for(;s<t.length;){let f=t[s];if(h(f)?s++:f=l==="M"?"L":l==="m"?"l":l,!f)break;let d=f===f.toLowerCase();switch(f.toUpperCase()){case"M":{let y=c()+(d?r:0),g=c()+(d?i:0);r=y,i=g,o=y,a=g,n.push(["M",y,g]);break}case"L":{let y=c()+(d?r:0),g=c()+(d?i:0);r=y,i=g,n.push(["L",y,g]);break}case"H":{let y=c()+(d?r:0);r=y,n.push(["L",y,i]);break}case"V":{let y=c()+(d?i:0);i=y,n.push(["L",r,y]);break}case"C":{let y=c()+(d?r:0),g=c()+(d?i:0),v=c()+(d?r:0),T=c()+(d?i:0),m=c()+(d?r:0),p=c()+(d?i:0);r=m,i=p,n.push(["C",y,g,v,T,m,p]);break}case"Q":{let y=c()+(d?r:0),g=c()+(d?i:0),v=c()+(d?r:0),T=c()+(d?i:0);r=v,i=T,n.push(["Q",y,g,v,T]);break}case"Z":n.push(["Z"]),r=o,i=a;break;default:s++;break}l=f}return n}function nc(e){return fn(_i(e))}var qi="0.19.0-pre.4",sc=qi.includes("GLISSADE_".concat("VERSION"))?"0.0.0-dev":qi;function Wi(e){if(e==="number")return 1;if(e==="vec2"||e==="vec2-arc")return 2}function rc(e){return e===void 0?"unknown":Array.isArray(e)?e.join("|"):e}var ic={Group:{children:{type:"Node[]"}},Rect:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Circle:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Path:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Text:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"'normal'|'italic'"},align:{type:"'left'|'center'|'right'"},lineHeight:{type:"number"}},Image:{assetId:{type:"string",required:!0}},Video:{assetId:{type:"string",required:!0},at:{type:"number"},trimStart:{type:"number"},playbackRate:{type:"number"},clipDuration:{type:"number"},sourceFps:{type:"number"}}},oc={id:{type:"string"},blend:{type:"BlendMode"},filters:{type:"FilterSpec[]"},anchor:{type:"AnchorSpec"},cache:{type:"boolean"}};function ji(e,t){var r;let n={};for(let{path:i,expects:o}of e.listTargets()){let a=rc(o),l=Wi(a);n[i]=M({type:a,animatable:!0,target:`<id>/${i}`},l!==void 0?{arity:l}:{})}let s=M(M({},oc),(r=ic[t])!=null?r:{});for(let[i,o]of Object.entries(s))n[i]=M({type:o.type,animatable:!1},o.required?{required:!0}:{});return{props:n}}var ac="@glissade/scene/layout",cc={width:{type:"number"},height:{type:"number"},gap:{type:"number"},padding:{type:"number"}},lc={direction:{type:"'row'|'column'"},justify:{type:"'start'|'center'|'end'|'space-between'|'space-around'"},align:{type:"'start'|'center'|'end'|'stretch'"},children:{type:"Node[]"}};function hc(){let e=ji(new ee,"Group").props;delete e.children;for(let[n,s]of Object.entries(cc)){let r=Wi(s.type);e[n]=M({type:s.type,animatable:!0,target:`<id>/${n}`},r!==void 0?{arity:r}:{})}let t=lc;for(let[n,s]of Object.entries(t))e[n]=M({type:s.type,animatable:!1},s.required?{required:!0}:{});return{props:e,subpath:ac}}var uc={Group:()=>new ee,Rect:()=>new dn,Circle:()=>new pn,Path:()=>new kt,Text:()=>new le,Image:()=>new mn({assetId:"~describe"}),Video:()=>new gn({assetId:"~describe"})},fc=[{name:"to",signature:"to<T>(target, value, opts?: { duration?, ease?, at?, from? }): TimelineBuilder"},{name:"fromTo",signature:"fromTo<T>(target, from, to, opts?: { duration?, ease?, at? }): TimelineBuilder"},{name:"stagger",signature:"stagger<T>(targets, { to: T | ((index, count) => T), from?: T | ((index, count) => T), duration?, ease? }, { each: number | ((rank, count) => number), anchor?, at? }): TimelineBuilder"},{name:"tracks",signature:"tracks(tracks: Track[]): TimelineBuilder"},{name:"set",signature:"set<T>(target, value, opts?: { at? }): TimelineBuilder"},{name:"label",signature:"label(name, at?): TimelineBuilder"},{name:"add",signature:"add(child, at?, opts?: { mode?: 'add'|'sync', timeScale? }): TimelineBuilder"},{name:"sequence",signature:"sequence(subs, opts?: { gap? }): TimelineBuilder"},{name:"at",signature:"at(time, sub): TimelineBuilder"},{name:"call",signature:"call(fn, at?): TimelineBuilder"},{name:"cue",signature:"cue(at, name, data?): TimelineBuilder"},{name:"adBreak",signature:"adBreak(at, opts?: { id?, duration? }): TimelineBuilder"},{name:"editable",signature:"editable(): TimelineBuilder"},{name:"editableDuration",signature:"editableDuration(): TimelineBuilder"}],dc={"@glissade/core/clips":"motion clips: clip/clipList + the popIn/slideIn/pulse/driftLoop literals, presence (enter/exit) and morph (box-FLIP) build-time sugar.","@glissade/core/i18n":"localization: requireParity (id-set diff), localize (doc\u2192doc resolver), t() ambient-table sugar.","@glissade/scene/layout":"flexbox: the Yoga-backed Layout node + LayoutEngine (the only entry that ships Yoga wasm).","@glissade/scene/path":"SVG geometry: pathFromSvg / parseSvgPathData \u2014 parse an SVG `d` string into a PathValue for Path.data."};function pc(){let e={};for(let[n,s]of Object.entries(uc))e[n]=ji(s(),n);let t=hc();for(let n of["Layout","Stack","Row","Column"])e[n]=t;return{version:sc,nodes:e,valueTypes:_t(),easings:Object.keys(ot),builder:{methods:fc},createScene:"createScene({ size: { w, h }, children: Node[] }): Scene \u2014 media assets are declared on the Timeline document: timeline({ assets: { <id>: { kind: 'image'|'video', url } } }); an Image/Video node's `assetId` names an entry here.",subpaths:dc}}function Hi(){let e=0,t=!1;return{start(n){t=!0;let s,r=i=>{t&&(s!=null||(s=i),n((i-s)/1e3),e=requestAnimationFrame(r))};e=requestAnimationFrame(r)},stop(){t=!1,cancelAnimationFrame(e)}}}function mc(e){var r;let t=(r=e.axis)!=null?r:"y",n=null,s=e.source;return{start(i,o){var c,h;let a=(h=e.range)!=null?h:[0,(c=o.duration)!=null?c:1],l=()=>{if(s instanceof Element){let y=t==="y"?s.scrollHeight-s.clientHeight:s.scrollWidth-s.clientWidth,g=t==="y"?s.scrollTop:s.scrollLeft;return y>0?g/y:0}let u=document.documentElement,f=t==="y"?u.scrollHeight-window.innerHeight:u.scrollWidth-window.innerWidth,d=t==="y"?window.scrollY:window.scrollX;return f>0?d/f:0};n=()=>{let u=Math.min(1,Math.max(0,l()));i(a[0]+u*(a[1]-a[0]))},s.addEventListener("scroll",n,{passive:!0}),n()},stop(){n&&s.removeEventListener("scroll",n),n=null}}}var Yi=class extends Error{constructor(e){super(`machine targets overlap an already-bound target set: ${e.join(", ")} \u2014 concurrent writers to one property is the silent last-writer-wins \xA72.2 exists to kill`),this.name="TargetOverlapError"}};function Ui(e,t={}){var z,B,K,et,Be,Ve,tt;let{playhead:n}=e,s=e.duration,r=(z=e.markers)!=null?z:[],i=(B=e.driver)!=null?B:Hi(),o=(K=t.loop)!=null?K:!1,a=(et=t.background)!=null?et:"pause",l=(Be=e.visibility)!=null?Be:(()=>"visible"),c=new Map,h=new Map,u=(Ve=t.rate)!=null?Ve:1,f=!1,d=A(!1),y=C=>{f=C,d.set(C)},g=!1,v=new Set((tt=e.targets)!=null?tt:[]),T=[],m=0,p=null,b=0,k=[0,s],I=0,w=null;function x(C,P){var V,W,Q;if(C===P||c.size===0&&h.size===0)return;let L=P>C;for(let oe of r){if(!(L?oe.t>C&&oe.t<=P:oe.t>=P&&oe.t<C))continue;for(let Mn of(V=c.get(oe.name))!=null?V:[])Mn(oe);let Oe=(W=oe.data)==null?void 0:W.kind;if(typeof Oe=="string")for(let Mn of(Q=h.get(Oe))!=null?Q:[])Mn(oe)}}function E(C){y(!1),p=null;let P=w;w=null,P==null||P(C)}function $(C){b=C;for(let Oe of T)Oe.step(C);if(!f)return;if(a==="pause"&&l()==="hidden"){m=n.peek(),p=null;return}p!=null||(p=C);let P=n.peek(),L=m+(C-p)*u,[V,W]=k;if(!(u>=0?L>=W:L<=V)){n.set(L),x(P,L);return}let Q=o===!0?{mode:"restart"}:o===!1?null:o,oe=Q&&"count"in Q&&Q.count!==void 0?Q.count:1/0;if(!Q||I+1>=oe){let Oe=u>=0?W:V;n.set(Oe),x(P,Oe),E(!0);return}I++,W-V,Q.mode==="alternate"?(x(P,u>=0?W:V),u=-u,m=u>=0?V:W):(x(P,u>=0?W:V),m=u>=0?V:W),p=C,L=m,n.set(L)}function D(){g||(g=!0,i.start($,{duration:s,visibility:l}))}return{playhead:n,get duration(){return s},get playing(){return f},playingSignal:d,get rate(){return u},set rate(C){m=n.peek(),p=f?b:null,u=C},play(C){var W;w&&E(!1),k=(W=C==null?void 0:C.range)!=null?W:[0,s];let P=n.peek(),[L,V]=k;return m=u>=0?P>=V||P<L?L:P:P<=L||P>V?V:P,n.set(m),p=null,I=0,y(!0),D(),{finished:new Promise(Q=>{w=Q})}},pause(){f&&(m=n.peek(),E(!1))},seek(C){m=Math.min(Math.max(C,0),s),p=f?b:null,n.set(m)},swap(C){var L,V;s=C.duration,r=(L=C.markers)!=null?L:[],v=new Set((V=C.targets)!=null?V:[]);let P=Math.min(n.peek(),s);k=[0,s],m=P,p=f?b:null,I=0,n.set(P)},attach(C){if(C.targets){let P=[];for(let L of C.targets)v.has(L)?P.push(`'${L}' (player timeline)`):T.some(V=>{var W;return(W=V.targets)==null?void 0:W.has(L)})&&P.push(`'${L}' (another machine)`);if(P.length>0)throw new Yi(P)}return T.push(C),D(),()=>{let P=T.indexOf(C);P>=0&&T.splice(P,1)}},onMarker(C,P){let L=c.get(C);return L||(L=new Set,c.set(C,L)),L.add(P),()=>L.delete(P)},onCue(C,P){let L=h.get(C);return L||(L=new Set,h.set(C,L)),L.add(P),()=>L.delete(P)},dispose(){f&&E(!1),T.length=0,g&&i.stop(),g=!1}}}function Xi(e,t,n,s,r){var o;let i=e!=null?e:"respect";return i==="ignore"||!t?{autoplay:r}:typeof i=="function"?{autoplay:r,swapTo:i(n)}:{autoplay:!1,seekTo:(o=n.posterTime)!=null?o:s}}function Gi(){return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function qs(e,t,n,s={}){var T;let r=e,i=t,o=se(i),a=new ze(n);r.setTextMeasurer(a);let l=r.playhead,c=Ui({playhead:l,duration:o.duration,markers:o.markers,targets:o.tracks.keys()},s),h=()=>a.render(be(r,i,l.peek())),u=!1,f=()=>{u||(u=!0,requestAnimationFrame(()=>{u=!1,h()}))},d=l.subscribe(f),y=m=>{if(typeof FontFace=="undefined")return;let p=pt(m.assets);for(let b of p.faces()){let k=new FontFace(b.family,`url(${b.url})`,{weight:String(b.weight),style:b.style});document.fonts.add(k),k.load().then(()=>h(),()=>{})}Fs(r,m,async b=>{try{let k=await fetch(b);return k.ok?await k.arrayBuffer():void 0}catch(k){return}},M({mode:s.strictFonts?"strict":"dev"},s.osFonts!==void 0?{osFamilies:s.osFonts}:{}))};y(i);let g=((T=s.prefersReducedMotion)!=null?T:Gi)(),v=Xi(s.reducedMotion,g,i,o.duration,!!s.autoplay);if(v.swapTo){i=v.swapTo;let m=se(i);c.swap({duration:m.duration,markers:m.markers,targets:m.tracks.keys()}),y(i)}return v.seekTo!==void 0&&c.seek(v.seekTo),h(),v.autoplay&&c.play(),{player:c,backend:a,render:h,swap(m){m.scene&&(r=m.scene,r.setTextMeasurer(a)),i=m.timeline;let p=se(i);c.swap({duration:p.duration,markers:p.markers,targets:p.tracks.keys()}),y(i),h()},dispose(){d(),c.dispose(),a.dispose()}}}function gc(e,t,n){let s=Object.keys(se(t).labels);return r=>{if(r==null)return;let i=n(r),o=Object.keys(se(i.timeline).labels),a=s.filter(l=>!o.includes(l));a.length>0&&console.warn(`[glissade] HMR: this edit removed label(s) ${a.map(l=>`'${l}'`).join(", ")} \u2014 anything seeking to them will no longer resolve`),s=o,e.swap(i)}}var yc=`
|
|
4
4
|
<style>
|
|
5
5
|
:host { display: inline-block; }
|
|
6
6
|
canvas { display: block; width: 100%; height: auto; }
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
.time { font-variant-numeric: tabular-nums; opacity: 0.75; min-width: 9ch; text-align: right; }
|
|
11
11
|
</style>
|
|
12
12
|
<canvas part="canvas"></canvas>
|
|
13
|
-
`,Ws,ie,
|
|
13
|
+
`,Ws,ie,ke,ue,Ze,Ce,It,Ne,te,N,js,Hs,Qi,Ji,Ys,xn,Sn,Je,Ki=(Ws=class extends HTMLElement{constructor(){super();J(this,N);J(this,ie,null);J(this,ke,null);J(this,ue,null);J(this,Ze,!1);J(this,Ce,null);J(this,It);J(this,Ne);J(this,te,null);let t=this.attachShadow({mode:"open"});t.innerHTML=yc,U(this,It,t),U(this,Ne,t.querySelector("canvas"))}get scene(){return F(this,ke)}set scene(t){U(this,ke,t),_(this,N,xn).call(this)}get player(){var t,n;return(n=(t=F(this,ie))==null?void 0:t.player)!=null?n:null}connectedCallback(){_(this,N,Hs).call(this),_(this,N,xn).call(this)}disconnectedCallback(){_(this,N,Ys).call(this)}attributeChangedCallback(t){if(t==="controls"){_(this,N,Hs).call(this),_(this,N,js).call(this);return}this.isConnected&&F(this,ke)&&_(this,N,xn).call(this)}},ie=new WeakMap,ke=new WeakMap,ue=new WeakMap,Ze=new WeakMap,Ce=new WeakMap,It=new WeakMap,Ne=new WeakMap,te=new WeakMap,N=new WeakSet,js=function(){F(this,te)&&!F(this,ue)&&F(this,Ce)?(U(this,ue,F(this,Ce).subscribe(()=>{requestAnimationFrame(()=>{F(this,te)&&(_(this,N,Sn).call(this),_(this,N,Je).call(this))})})),_(this,N,Sn).call(this),_(this,N,Je).call(this)):!F(this,te)&&F(this,ue)&&(F(this,ue).call(this),U(this,ue,null))},Hs=function(){let t=this.hasAttribute("controls");t&&!F(this,te)?_(this,N,Qi).call(this):!t&&F(this,te)&&_(this,N,Ji).call(this)},Qi=function(){let t=document.createElement("div");t.className="controls",t.setAttribute("part","controls");let n=document.createElement("button");n.setAttribute("part","button"),n.setAttribute("aria-label","Play or pause"),n.textContent="Play";let s=document.createElement("input");s.setAttribute("part","scrubber"),s.type="range",s.min="0",s.max="1",s.step="0.0001",s.value="0",s.setAttribute("aria-label","Seek");let r=document.createElement("span");r.className="time",r.setAttribute("part","time");let i=()=>{var l;let a=(l=F(this,ie))==null?void 0:l.player;a&&(a.playing?a.pause():a.play(),_(this,N,Je).call(this))},o=()=>{var l;let a=(l=F(this,ie))==null?void 0:l.player;a&&(U(this,Ze,!0),a.pause(),a.seek(parseFloat(s.value)*a.duration),U(this,Ze,!1),_(this,N,Je).call(this))};n.addEventListener("click",i),s.addEventListener("input",o),t.append(n,s,r),F(this,It).append(t),U(this,te,{root:t,button:n,scrubber:s,time:r,onClick:i,onInput:o}),_(this,N,Sn).call(this),_(this,N,Je).call(this)},Ji=function(){let t=F(this,te);t&&(t.button.removeEventListener("click",t.onClick),t.scrubber.removeEventListener("input",t.onInput),t.root.remove(),U(this,te,null))},Ys=function(){var t,n;(t=F(this,ue))==null||t.call(this),U(this,ue,null),(n=F(this,ie))==null||n.dispose(),U(this,ie,null),U(this,Ce,null)},xn=function(){if(_(this,N,Ys).call(this),!F(this,ke)||!this.isConnected)return;let t=F(this,ke).createScene();F(this,Ne).width=t.size.w,F(this,Ne).height=t.size.h;let n=this.hasAttribute("pingpong")||this.hasAttribute("yoyo")?{mode:"alternate"}:this.hasAttribute("loop");U(this,ie,qs(t,F(this,ke).timeline,F(this,Ne),{loop:n,autoplay:this.hasAttribute("autoplay")})),U(this,Ce,t.playhead),_(this,N,js).call(this)},Sn=function(){var r,i,o;let t=F(this,te),n=(r=F(this,ie))==null?void 0:r.player;if(!t||!n)return;let s=(o=(i=F(this,Ce))==null?void 0:i.peek())!=null?o:0;t.time.textContent=`${s.toFixed(2)} / ${n.duration.toFixed(2)}s`,!F(this,Ze)&&n.duration>0&&(t.scrubber.value=String(s/n.duration))},Je=function(){var s,r;let t=F(this,te);if(!t)return;let n=(r=(s=F(this,ie))==null?void 0:s.player.playing)!=null?r:!1;t.button.textContent=n?"Pause":"Play"},S(Ws,"observedAttributes",["loop","pingpong","yoyo","autoplay","controls"]),Ws);function Zi(e="gs-player"){customElements.get(e)||customElements.define(e,Ki)}Zi();return oo(wc);})();
|
|
14
14
|
//# sourceMappingURL=glissade.browser.js.map
|