@haiyue/animation-spec 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { b3 as ANIMATION_FILE_EXTENSION, b4 as ANIMATION_FORMAT, b5 as ANIMATION_MIME_TYPE, b6 as ANIMATION_VECTOR_SHAPE_EXTENSION_ID, b7 as ANIMATION_VERSION, b8 as AnimationAudioComponent, b9 as AnimationAudioResource, ba as AnimationBinaryResource, bb as AnimationBlurEffect, bc as AnimationCanvas, bd as AnimationColorMatrixEffect, be as AnimationComponent, bf as AnimationComposite, bg as AnimationCompositeKind, bh as AnimationCompositeLayer, bi as AnimationCompositeMode, bj as AnimationCompositeOperation, bk as AnimationCompositeStack, bl as AnimationCoordinateSystem, bm as AnimationDocument, bn as AnimationDropShadowEffect, bo as AnimationEndBehavior, bp as AnimationExtensionComponent, bq as AnimationExtensionHandler, br as AnimationExtensionRegistry, bs as AnimationExtensionValidationContext, bt as AnimationFillEffect, bu as AnimationFillRule, bv as AnimationFormatError, bw as AnimationFormatErrorCode, bx as AnimationImageResource, by as AnimationInterpolation, bz as AnimationLayerEffect, bA as AnimationNode, bB as AnimationOpacityEffect, bC as AnimationParseLimits, bD as AnimationParseOptions, bE as AnimationParticle2DComponent, bF as AnimationPath2DComponent, bG as AnimationPathCommand, bH as AnimationResource, bI as AnimationSafeExpressionContext, bJ as AnimationSafeExpressionInstruction, bK as AnimationSafeExpressionProgram, bL as AnimationShape2DComponent, bM as AnimationSource, bN as AnimationSprite2DComponent, bO as AnimationText2DComponent, bP as AnimationTextAnimator, bQ as AnimationTextDocumentKeyframe, bR as AnimationTextRangeSelector, bS as AnimationTextSelectorShape, bT as AnimationTextSelectorUnits, bU as AnimationTextStyleRun, bV as AnimationTintEffect, bW as AnimationTrack, bX as AnimationTrackProperty, bY as AnimationTransform2D, bZ as AnimationVectorFeather, b_ as AnimationVectorGradientPaint, b$ as AnimationVectorShapeComponent, c0 as AnimationVectorSolidPaint, c1 as AnimationVectorStrokePaint, c2 as AnimationVectorValueTrack, c3 as HYA_SAFE_EXPRESSION_VERSION, c4 as HYA_STATE_MACHINE_CHANNEL_REGISTRY, c5 as HYA_STATE_MACHINE_EXTENSION_ID, c6 as HyaAnimationClipRange, c7 as HyaStateMachineBindingMask, c8 as HyaStateMachineBlendMode, c9 as HyaStateMachineChannelCapability, ca as HyaStateMachineChannelId, cb as HyaStateMachineChannelKind, cc as HyaStateMachineChannelSupport, cd as HyaStateMachineCondition, ce as HyaStateMachineDefinition, cf as HyaStateMachineExtension, cg as HyaStateMachineLayer, ch as HyaStateMachineLoopMode, ci as HyaStateMachineMotion, cj as HyaStateMachineParameter, ck as HyaStateMachineState, cl as HyaStateMachineTransition, cm as ParsedAnimation, cn as ParsedAnimationTrack, co as decodeAnimationBinary, cp as encodeAnimationBinary, cq as evaluateSafeExpression, cr as extensionIdFromComponentType, cs as hyaStateMachineChannelCapability, ct as isAnimationBinary, cu as parseAnimation, cv as parseHyaStateMachineExtension, cw as safeExpressionDataResources, cx as validateExtensionId } from './shared.js';
1
+ export { b3 as ANIMATION_FILE_EXTENSION, b4 as ANIMATION_FORMAT, b5 as ANIMATION_MIME_TYPE, b6 as ANIMATION_PROCEDURAL_RASTER_EXTENSION_ID, b7 as ANIMATION_VECTOR_SHAPE_EXTENSION_ID, b8 as ANIMATION_VERSION, b9 as AnimationAudioComponent, ba as AnimationAudioResource, bb as AnimationBinaryResource, bc as AnimationBlurEffect, bd as AnimationCanvas, be as AnimationColorMatrixEffect, bf as AnimationComponent, bg as AnimationComposite, bh as AnimationCompositeKind, bi as AnimationCompositeLayer, bj as AnimationCompositeMode, bk as AnimationCompositeOperation, bl as AnimationCompositeStack, bm as AnimationCoordinateSystem, bn as AnimationDocument, bo as AnimationDropShadowEffect, bp as AnimationEndBehavior, bq as AnimationExtensionComponent, br as AnimationExtensionHandler, bs as AnimationExtensionRegistry, bt as AnimationExtensionValidationContext, bu as AnimationFillEffect, bv as AnimationFillRule, bw as AnimationFormatError, bx as AnimationFormatErrorCode, by as AnimationImageResource, bz as AnimationInterpolation, bA as AnimationLayerEffect, bB as AnimationNode, bC as AnimationOpacityEffect, bD as AnimationParseLimits, bE as AnimationParseOptions, bF as AnimationParticle2DComponent, bG as AnimationPath2DComponent, bH as AnimationPathCommand, bI as AnimationProceduralRasterComponent, bJ as AnimationResource, bK as AnimationSafeExpressionContext, bL as AnimationSafeExpressionInstruction, bM as AnimationSafeExpressionProgram, bN as AnimationShape2DComponent, bO as AnimationSource, bP as AnimationSprite2DComponent, bQ as AnimationText2DComponent, bR as AnimationTextAnimator, bS as AnimationTextDocumentKeyframe, bT as AnimationTextRangeSelector, bU as AnimationTextSelectorShape, bV as AnimationTextSelectorUnits, bW as AnimationTextStyleRun, bX as AnimationTintEffect, bY as AnimationTrack, bZ as AnimationTrackProperty, b_ as AnimationTransform2D, b$ as AnimationVectorFeather, c0 as AnimationVectorGradientPaint, c1 as AnimationVectorShapeComponent, c2 as AnimationVectorSolidPaint, c3 as AnimationVectorStrokePaint, c4 as AnimationVectorValueTrack, c5 as HYA_SAFE_EXPRESSION_VERSION, c6 as HYA_STATE_MACHINE_CHANNEL_REGISTRY, c7 as HYA_STATE_MACHINE_EXTENSION_ID, c8 as HyaAnimationClipRange, c9 as HyaResourceDescriptor, ca as HyaResourceIntegrity, cb as HyaResourcePack, cc as HyaResourcePackEntry, cd as HyaResourceSource, ce as HyaStateMachineBindingMask, cf as HyaStateMachineBlendMode, cg as HyaStateMachineChannelCapability, ch as HyaStateMachineChannelId, ci as HyaStateMachineChannelKind, cj as HyaStateMachineChannelSupport, ck as HyaStateMachineCondition, cl as HyaStateMachineDefinition, cm as HyaStateMachineExtension, cn as HyaStateMachineLayer, co as HyaStateMachineLoopMode, cp as HyaStateMachineMotion, cq as HyaStateMachineParameter, cr as HyaStateMachineState, cs as HyaStateMachineTransition, ct as ParsedAnimation, cu as ParsedAnimationTrack, cv as decodeAnimationBinary, cw as decodeHyaBase64, cx as decodeHyaDataUri, cy as decodeHyaResourcePack, cz as describeHyaResource, cA as encodeAnimationBinary, cB as encodeHyaBase64, cC as encodeHyaDataUri, cD as encodeHyaResourcePack, cE as evaluateSafeExpression, cF as extensionIdFromComponentType, cG as hyaResourceIntegritySri, cH as hyaResourceSha256, cI as hyaStateMachineChannelCapability, cJ as isAnimationBinary, cK as isHyaResourcePack, cL as normalizeHyaResourceIntegrity, cM as normalizeHyaResourceSource, cN as parseAnimation, cO as parseHyaStateMachineExtension, cP as safeExpressionDataResources, cQ as validateExtensionId } from './shared.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{c as ANIMATION_FILE_EXTENSION,a as ANIMATION_FORMAT,d as ANIMATION_MIME_TYPE,b as ANIMATION_VECTOR_SHAPE_EXTENSION_ID,A as ANIMATION_VERSION,H as HYA_SAFE_EXPRESSION_VERSION,e as evaluateSafeExpression,s as safeExpressionDataResources}from"./chunks/expression-D1cKtNwM.js";import{A as n}from"./chunks/errors-Bzs3GOD9.js";export{A as AnimationExtensionRegistry,e as extensionIdFromComponentType,v as validateExtensionId}from"./chunks/extensions-DxL4AxOC.js";import{t,r as o,p as r}from"./chunks/binary-DvuTJ_hy.js";export{H as HYA_STATE_MACHINE_CHANNEL_REGISTRY,a as HYA_STATE_MACHINE_EXTENSION_ID,d as decodeAnimationBinary,e as encodeAnimationBinary,h as hyaStateMachineChannelCapability,i as isAnimationBinary,b as parseHyaStateMachineExtension}from"./chunks/binary-DvuTJ_hy.js";const I=Object.freeze({}),E=new TextDecoder,N=new TextEncoder;function _(e,s=I){if(e instanceof ArrayBuffer){const a=t(e,s);if(a)return a;const r=o(s);if(e.byteLength>r.maxInputBytes)throw new n("E_ANIMATION_LIMIT_EXCEEDED",`Input exceeds ${r.maxInputBytes} bytes.`,"$");return T(E.decode(e),s)}return"string"==typeof e?T(e,s):r(e,s,"json")}function T(e,s){const t=o(s);if(N.encode(e).byteLength>t.maxInputBytes)throw new n("E_ANIMATION_LIMIT_EXCEEDED",`Input exceeds ${t.maxInputBytes} bytes.`,"$");let a;try{a=JSON.parse(e)}catch(e){throw new n("E_ANIMATION_INVALID_FORMAT",`Animation JSON cannot be decoded: ${e instanceof Error?e.message:String(e)}.`,"$")}return r(a,s,"json")}export{n as AnimationFormatError,_ as parseAnimation};//# sourceMappingURL=index.js.map
1
+ export{A as ANIMATION_FILE_EXTENSION,a as ANIMATION_FORMAT,b as ANIMATION_MIME_TYPE,c as ANIMATION_PROCEDURAL_RASTER_EXTENSION_ID,d as ANIMATION_VECTOR_SHAPE_EXTENSION_ID,e as ANIMATION_VERSION,H as HYA_SAFE_EXPRESSION_VERSION,f as evaluateSafeExpression,s as safeExpressionDataResources}from"./chunks/expression-sAWA2ssN.js";import{A as t}from"./chunks/errors-Bzs3GOD9.js";export{A as AnimationExtensionRegistry,e as extensionIdFromComponentType,v as validateExtensionId}from"./chunks/extensions-DxL4AxOC.js";export{p as parseAnimation}from"./chunks/parser-DiexwIBc.js";import{r,H as I,m as y,w as u,d as E}from"./chunks/binary-Btol_e09.js";export{a as HYA_STATE_MACHINE_CHANNEL_REGISTRY,b as HYA_STATE_MACHINE_EXTENSION_ID,c as decodeHyaBase64,e as decodeHyaDataUri,f as describeHyaResource,g as encodeAnimationBinary,h as encodeHyaBase64,i as encodeHyaDataUri,j as hyaResourceIntegritySri,k as hyaResourceSha256,l as hyaStateMachineChannelCapability,n as isAnimationBinary,o as normalizeHyaResourceIntegrity,p as normalizeHyaResourceSource,q as parseHyaStateMachineExtension}from"./chunks/binary-Btol_e09.js";const N=1346459976;function m(e){throw new t("E_ANIMATION_INVALID_BINARY",e,"$pack")}function _(e){return"string"==typeof e&&e.length>0&&e.length<=512&&/^[A-Za-z0-9_.\/-]+$/.test(e)&&!e.startsWith("/")&&!e.split("/").some(e=>!e||"."===e||".."===e)}function S(e,a={}){e.length>(a.maxResources??1e4)&&m("Too many pack entries");const t=new I(a.maxInputBytes??67108864),s=[],n=[],o=new Set;let i=0;for(const c of e){_(c.id)&&!o.has(c.id)||m("Invalid or duplicate logical pack ID"),o.add(c.id),E(c.data,a);const e=r(c.data,a),l=y(e.metadata,a=>t.add(e.blobs[a]));s.push([c.id,l,[i,e.floats.length]]),n.push(e.floats),i+=e.floats.length,4*i>(a.maxInputBytes??67108864)&&m("Pack float pool exceeds budget")}const c=new Float32Array(i);let l=0;for(const e of n)c.set(e,l),l+=e.length;return u(s,c,t.blobs,a,N,1)}function T(e){return e.byteLength>=4&&new DataView(e).getUint32(0,!0)===N}function x(e,a={}){e.byteLength>(a.maxInputBytes??67108864)&&m("Pack exceeds byte budget");const t=r(e.slice(0),a,N,1),s=t.metadata;(!Array.isArray(s)||s.length>(a.maxResources??1e4))&&m("Invalid pack directory");const n=new Map;let o=0;for(const e of s){Array.isArray(e)&&3===e.length&&_(e[0])&&!n.has(e[0])&&Array.isArray(e[2])&&2===e[2].length&&e[2].every(e=>Number.isSafeInteger(e)&&e>=0)||m("Invalid pack entry");const[a,s]=e[2];(a!==o||s>t.floats.length-a)&&m("Invalid pack float range"),n.set(e[0],{metadata:e[1],offset:a,length:s}),o+=s}return o!==t.floats.length&&m("Unreferenced pack floats"),Object.freeze({entries:Object.freeze([...n.keys()]),blobCount:t.blobs.length,embeddedBytes:t.blobs.reduce((e,a)=>e+a.length,0),read(e){const s=n.get(e);s||m("Unknown pack entry");const o=new I(a.maxInputBytes??67108864),r=y(s.metadata,e=>o.add(t.blobs[e])),i=u(r,t.floats.subarray(s.offset,s.offset+s.length),o.blobs,a);return E(i,a),i}})}export{t as AnimationFormatError,E as decodeAnimationBinary,x as decodeHyaResourcePack,S as encodeHyaResourcePack,T as isHyaResourcePack};//# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export{C as CUBISM_CAPTURE_FRAME_OPERATIONS,a as CUBISM_CLIP_BAKED_UPDATE_ORDER,e as CubismClipBakedAdapter,r as runCubismClipBakedConversion}from"../chunks/clip-baked-Dv-wjX9d.js";import"../chunks/binary-DvuTJ_hy.js";import"../chunks/errors-Bzs3GOD9.js";import"../chunks/expression-D1cKtNwM.js";import"../chunks/extensions-DxL4AxOC.js";import"../deformable2d.js";import"../conversion.js";//# sourceMappingURL=clip-baked.js.map
1
+ export{C as CUBISM_CAPTURE_FRAME_OPERATIONS,a as CUBISM_CLIP_BAKED_UPDATE_ORDER,e as CubismClipBakedAdapter,r as runCubismClipBakedConversion}from"../chunks/clip-baked-D9PAhUfD.js";import"../chunks/binary-Btol_e09.js";import"../chunks/errors-Bzs3GOD9.js";import"../chunks/expression-sAWA2ssN.js";import"../chunks/extensions-DxL4AxOC.js";import"../deformable2d.js";import"../conversion.js";//# sourceMappingURL=clip-baked.js.map
package/dist/live2d.js CHANGED
@@ -1 +1 @@
1
- export{C as CUBISM_CAPTURE_FRAME_OPERATIONS,a as CUBISM_CLIP_BAKED_UPDATE_ORDER,b as CUBISM_DRAWABLE_CAPTURE_FORMAT,c as CUBISM_DRAWABLE_CAPTURE_VERSION,d as CubismCaptureConversionError,e as CubismClipBakedAdapter,f as convertCubismCaptureToHya,r as runCubismClipBakedConversion}from"./chunks/clip-baked-Dv-wjX9d.js";export{combineCubismCaptureClips,listCubismModel3Motions,sampleCubismMotion3}from"./cubism.js";import"./chunks/binary-DvuTJ_hy.js";import"./chunks/errors-Bzs3GOD9.js";import"./chunks/expression-D1cKtNwM.js";import"./chunks/extensions-DxL4AxOC.js";import"./deformable2d.js";import"./conversion.js";//# sourceMappingURL=live2d.js.map
1
+ export{C as CUBISM_CAPTURE_FRAME_OPERATIONS,a as CUBISM_CLIP_BAKED_UPDATE_ORDER,b as CUBISM_DRAWABLE_CAPTURE_FORMAT,c as CUBISM_DRAWABLE_CAPTURE_VERSION,d as CubismCaptureConversionError,e as CubismClipBakedAdapter,f as convertCubismCaptureToHya,r as runCubismClipBakedConversion}from"./chunks/clip-baked-D9PAhUfD.js";export{combineCubismCaptureClips,listCubismModel3Motions,sampleCubismMotion3}from"./cubism.js";import"./chunks/binary-Btol_e09.js";import"./chunks/errors-Bzs3GOD9.js";import"./chunks/expression-sAWA2ssN.js";import"./chunks/extensions-DxL4AxOC.js";import"./deformable2d.js";import"./conversion.js";//# sourceMappingURL=live2d.js.map
package/dist/lottie.d.ts CHANGED
@@ -1 +1 @@
1
- export { cy as LottieConversionDiagnostic, cz as LottieConversionOptions, cA as LottieConversionResult, cB as LottieFontMetrics, cC as LottieFontRequirement, cD as LottieWebFontMapping, cE as convertLottie, cF as convertLottieDocument, cG as inspectLottieFonts } from './shared.js';
1
+ export { cR as LottieConversionDiagnostic, cS as LottieConversionOptions, cT as LottieConversionResult, cU as LottieFontMetrics, cV as LottieFontRequirement, cW as LottieWebFontMapping, cX as convertLottie, cY as convertLottieDocument, cZ as inspectLottieFonts } from './shared.js';
package/dist/lottie.js CHANGED
@@ -1 +1 @@
1
- import{p as e,H as t,A as n,a as o,b as s}from"./chunks/expression-D1cKtNwM.js";import r from"polygon-clipping/dist/polygon-clipping.esm.js";import"./chunks/errors-Bzs3GOD9.js";const i=r;function a(e,t){const n=e.flat();if(1===t)return 0===n.length?null:{commands:n.map(e=>e.commands).join(""),values:n.flatMap(e=>Array.from(e.values))};const o=e.map(u).filter(e=>e.length>0);if(0===o.length)return null;const[s,...r]=o;return function(e){let t="";const n=[];for(const o of e)for(const e of o){const o=e.length>1&&h(e[0],e.at(-1))?e.slice(0,-1):e;o.length<3||(t+=`M${"L".repeat(o.length-1)}Z`,n.push(...o.flat()))}return t?{commands:t,values:n}:null}(2===t?i.union(s,...r):3===t?i.difference(s,...r):4===t?i.intersection(s,...r):i.xor(s,...r))}function c(e,t,n,o){const s=(n[0]??100)/100,r=(n[1]??100)/100,i=Math.cos(o),a=Math.sin(o),c=i*s,l=a*s,u=-a*r,f=i*r,p=t[0]??0,d=t[1]??0;return[c,l,u,f,(e[0]??0)-c*p-u*d,(e[1]??0)-l*p-f*d]}function l(e,t){const[n,o,s,r,i,a]=t,c=[];for(let t=0;t<e.values.length;t+=2){const l=e.values[t]??0,u=e.values[t+1]??0;c.push(n*l+s*u+i,o*l+r*u+a)}return{commands:e.commands,values:c}}function u(e){const t=e.flatMap(e=>function(e,t=.35){const n=[];let o=0,s=[],r=[0,0];const i=()=>[Number(e.values[o++]??0),Number(e.values[o++]??0)],a=()=>{s.length<3||(h(s[0],s.at(-1))||s.push([...s[0]]),Math.abs(function(e){let t=0;for(let n=0;n+1<e.length;n++)t+=e[n][0]*e[n+1][1]-e[n+1][0]*e[n][1];return t/2}(s))>1e-8&&n.push(s)),s=[]};for(const n of e.commands)if("M"===n)a(),r=i(),s.push(r);else if("L"===n)r=i(),s.push(r);else if("C"===n){const e=i(),n=i(),o=i();f(r,e,n,o,t,s),r=o}else if("Q"===n){const e=i(),n=i();p(r,e,n,t,s),r=n}else"Z"===n&&a();return a(),n}(e).map(e=>[e]));return t.length<=1?t:i.union(t[0],...t.slice(1))}function f(e,t,n,o,s,r,i=0){if(i>=10||Math.max(d(t,e,o),d(n,e,o))<=s)return void r.push(o);const a=m(e,t),c=m(t,n),l=m(n,o),u=m(a,c),p=m(c,l),h=m(u,p);f(e,a,u,h,s,r,i+1),f(h,p,l,o,s,r,i+1)}function p(e,t,n,o,s,r=0){if(r>=10||d(t,e,n)<=o)return void s.push(n);const i=m(e,t),a=m(t,n),c=m(i,a);p(e,i,c,o,s,r+1),p(c,a,n,o,s,r+1)}function d(e,t,n){const o=n[0]-t[0],s=n[1]-t[1],r=Math.hypot(o,s);return r<=1e-12?Math.hypot(e[0]-t[0],e[1]-t[1]):Math.abs(s*e[0]-o*e[1]+n[0]*t[1]-n[1]*t[0])/r}function m(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function h(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}class g extends Error{offset;constructor(e,t){super(e),this.offset=t,this.name="LottieTextExpressionCompileError"}}function y(e,t,n){if("identifier"===e.kind)return t.get(e.name)??null;if("member"===e.kind){const o=y(e.object,t,n);return o?"sourceData"===e.property?o:{resource:o.resource,path:[...o.path,e.property]}:null}if("call"!==e.kind)return null;if("member"===e.callee.kind&&"layer"===e.callee.property&&"identifier"===e.callee.object.kind&&"thisComp"===e.callee.object.name){const t=v(e,"thisComp.layer"),o=n.resolveDataLayer(t);if(!o)throw b(`Expression references unknown or non-data layer "${t}".`,e.offset);return{resource:o,path:[]}}const o=y(e.callee,t,n);if(!o)return null;const s=v(e,"Data Layer selector");return"Data"!==s&&"Outline"!==s||0!==o.path.length?{resource:o.resource,path:[...o.path,T(s)]}:o}function v(e,t){if(1!==e.arguments.length||"literal"!==e.arguments[0]?.kind||"string"!=typeof e.arguments[0].value)throw b(`${t} requires one static string argument.`,e.offset);return e.arguments[0].value}function T(e){const t=/^(.*) (\d+)$/.exec(e);return t&&t[1]?`${t[1]} ${t[2]}`:e}function k(e,t){const n={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","<":"less","<=":"less-equal",">":"greater",">=":"greater-equal","===":"equal","!==":"not-equal"}[e];if(!n)throw b(`Operator "${e}" is not supported.`,t);return n}class ${tokens;index=0;constructor(e){this.tokens=function(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];if(/\s/.test(o)){n++;continue}if("/"===o&&"/"===e[n+1]){for(n+=2;n<e.length&&"\n"!==e[n];)n++;continue}if("/"===o&&"*"===e[n+1]){const t=e.indexOf("*/",n+2);if(t<0)throw b("Unterminated block comment.",n);n=t+2;continue}if(/[A-Za-z_$]/.test(o)){const o=n++;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;t.push({kind:"identifier",value:e.slice(o,n),offset:o});continue}if(/\d/.test(o)||"."===o&&/\d/.test(e[n+1]??"")){const o=n++;for(;n<e.length&&/[0-9.eE+-]/.test(e[n]);){const t=e.slice(o,n+1);if(!/^(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d*)?$/.test(t))break;n++}const s=Number(e.slice(o,n));if(!Number.isFinite(s))throw b("Invalid numeric literal.",o);t.push({kind:"number",value:s,offset:o});continue}if('"'===o||"'"===o){const s=n++;let r="";for(;n<e.length&&e[n]!==o;){const t=e[n++];if("\\"!==t){r+=t;continue}if(n>=e.length)throw b("Unterminated string escape.",s);const o=e[n++],i={n:"\n",r:"\r",t:"\t",b:"\b",f:"\f",v:"\v",0:"\0","\\":"\\","'":"'",'"':'"'};if(o in i)r+=i[o];else{if("x"===o||"u"===o){const t="x"===o?2:4,s=e.slice(n,n+t);if(!new RegExp(`^[0-9a-fA-F]{${t}}$`).test(s))throw b("Invalid hexadecimal string escape.",n);r+=String.fromCharCode(Number.parseInt(s,16)),n+=t;continue}r+=o}}if(e[n]!==o)throw b("Unterminated string literal.",s);n++,t.push({kind:"string",value:r,offset:s});continue}const s=["===","!==","<=",">=","==","!=","&&","||"].find(t=>e.startsWith(t,n));if(s)t.push({kind:"operator",value:s,offset:n}),n+=s.length;else if("+-*/%<>=!".includes(o))t.push({kind:"operator",value:o,offset:n++});else{if(!"().,;?:".includes(o))throw b(`Token "${o}" is not permitted in safe expressions.`,n);t.push({kind:"punctuation",value:o,offset:n++})}}return t.push({kind:"eof",value:"",offset:e.length}),t}(e)}parseProgram(){const e=[];for(;"eof"!==this.peek().kind;)if("identifier"===this.peek().kind&&E.has(String(this.peek().value))?e.push(this.parseVariableStatement()):e.push({kind:"expression",expression:this.parseAssignment()}),";"===this.peek().value)this.take();else if("eof"!==this.peek().kind)throw b("Expected semicolon between expression statements.",this.peek().offset);return e}parseVariableStatement(){this.take();const e=[];for(;;){const t=this.expect("identifier");let n;if("="===this.peek().value&&(this.take(),n=this.parseAssignment()),e.push({name:String(t.value),...n?{initializer:n}:{},offset:t.offset}),","!==this.peek().value)break;this.take()}return{kind:"variable",declarations:e}}parseAssignment(){const e=this.parseConditional();if("="!==this.peek().value)return e;const t=this.take();if("identifier"!==e.kind)throw b("Only local identifier assignment is supported.",t.offset);return{kind:"assignment",target:e.name,value:this.parseAssignment(),offset:t.offset}}parseConditional(){const e=this.parseBinary(0);if("?"!==this.peek().value)return e;const t=this.take(),n=this.parseAssignment();return this.expectValue(":"),{kind:"conditional",test:e,consequent:n,alternate:this.parseAssignment(),offset:t.offset}}parseBinary(e){let t=this.parseUnary();for(;;){const n=this.peek(),o="string"==typeof n.value?_[n.value]:void 0;if(void 0===o||o<e)break;this.take(),t={kind:"binary",operator:String(n.value),left:t,right:this.parseBinary(o+1),offset:n.offset}}return t}parseUnary(){const e=this.peek();return"+"===e.value||"-"===e.value||"!"===e.value?(this.take(),{kind:"unary",operator:e.value,argument:this.parseUnary(),offset:e.offset}):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;){const t=this.peek();if("."===t.value){this.take();const n=this.expect("identifier");e={kind:"member",object:e,property:String(n.value),offset:t.offset};continue}if("("===t.value){this.take();const n=[];if(")"!==this.peek().value)for(;;){if(n.push(this.parseAssignment()),","!==this.peek().value)break;this.take()}this.expectValue(")"),e={kind:"call",callee:e,arguments:n,offset:t.offset};continue}return e}}parsePrimary(){const e=this.take();if("number"===e.kind||"string"===e.kind)return{kind:"literal",value:e.value,offset:e.offset};if("identifier"===e.kind)return"true"===e.value||"false"===e.value||"null"===e.value?{kind:"literal",value:"null"===e.value?null:"true"===e.value,offset:e.offset}:{kind:"identifier",name:String(e.value),offset:e.offset};if("("===e.value){const e=this.parseAssignment();return this.expectValue(")"),e}throw b(`Unexpected token "${String(e.value)}".`,e.offset)}peek(){return this.tokens[this.index]}take(){return this.tokens[this.index++]}expect(e){const t=this.take();if(t.kind!==e)throw b(`Expected ${e}.`,t.offset);return t}expectValue(e){const t=this.take();if(t.value!==e)throw b(`Expected "${e}".`,t.offset)}}const _={"||":1,"&&":2,"==":3,"!=":3,"===":3,"!==":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},E=new Set(["var","let","const"]);function b(e,t){return new g(e,t)}const M="org.haiyue.vector-stroke@1",x="org.haiyue.vector-path-morph@1",I="org.haiyue.data-layer@1",L=1/64,w=256;function A(e,t={}){const r="string"==typeof e?Be(e):e,i=tt(r.fr,"$.fr"),a=et(r.ip??0,"$.ip"),c=et(r.op,"$.op");if(c<=a)throw new TypeError("Lottie op must be greater than ip.");const l=tt(r.w,"$.w"),u=tt(r.h,"$.h"),f=(c-a)/i,p={frameRate:i,secondsOffset:-a/i,secondsPerFrame:1/i},d=O(r,t.fonts),m=function(e,t){const n=new Map,o=[];for(const s of Je(Xe(e).list).map(Xe)){if("string"!=typeof s.fName||!s.fName)continue;const e=t.fonts?.[s.fName],r="string"==typeof e?{uri:e}:e,i=P("string"==typeof s.fStyle?s.fStyle:"Regular"),a={name:s.fName,family:r?.family??("string"==typeof s.fFamily&&s.fFamily?s.fFamily:s.fName),style:r?.style??i.style,weight:r?.weight??i.weight,...r?{resourceId:`font:${s.fName}`}:{}};n.set(s.fName,a),r&&o.push({id:a.resourceId,type:"binary",uri:r.uri,mimeType:r.mimeType??"font/woff2",...void 0===r.integrity?{}:{integrity:r.integrity}})}return{fonts:n,resources:o}}(r.fonts,t),h={frameRate:i,duration:f,diagnostics:[],tracks:[],timeline:p,shapeCounter:0,convertedLayerCount:0,skippedLayerCount:0,usesStrokeExtension:!1,usesPathMorphExtension:!1,usesVectorShapeExtension:!1,usesDataLayerExtension:!1,fonts:m.fonts,warnedFontSubstitutions:new Set},g=Je(r.layers),y=Je(r.assets),v=new Map;for(let e=0;e<y.length;e++){const t=Xe(y[e]);"string"==typeof t.id&&v.set(t.id,{value:t,index:e})}const T=C([g,...y.map(e=>Je(Xe(e).layers))],6),k=C([g,...y.map(e=>Je(Xe(e).layers))],15),$=[...R(r.assets,t,T,k),...m.resources],_=[];b(g,{listPath:"$.layers",idPrefix:"",timeline:p,compositionWidth:l,compositionHeight:u,precompStack:[]});const E={format:o,version:n,name:t.name??("string"==typeof r.nm?r.nm:"Converted Lottie"),canvas:{width:l,height:u,coordinateSystem:"screen-y-down"},duration:f,frameRate:i,endBehavior:"loop",resources:$,nodes:_,tracks:h.tracks,...h.usesStrokeExtension||h.usesPathMorphExtension||h.usesVectorShapeExtension||h.usesDataLayerExtension?{extensionsUsed:[...h.usesStrokeExtension?[M]:[],...h.usesPathMorphExtension?[x]:[],...h.usesVectorShapeExtension?[s]:[],...h.usesDataLayerExtension?[I]:[]]}:{}};if(t.strict&&h.diagnostics.length>0){const e=h.diagnostics[0];throw new TypeError(`Lottie conversion failed: ${e.message} (${e.path})`)}return Object.freeze({document:E,diagnostics:Object.freeze(h.diagnostics),convertedLayerCount:h.convertedLayerCount,skippedLayerCount:h.skippedLayerCount,fonts:d});function b(e,t){const n=h.timeline;h.timeline=t.timeline;try{const n=function(e,t){const n=new Map,o=new Set;for(let s=0;s<e.length;s++){const r=Xe(e[s]),i=nt(r.ind??s+1,`${t}[${s}].ind`);n.set(i,{layer:r,sourceIndex:s}),!0!==r.hd&&o.add(i)}const s=[...o];for(let e=0;e<s.length;e++){const r=s[e],i=n.get(r);if(!i||void 0===i.layer.parent)continue;const a=nt(i.layer.parent,`${t}[${i.sourceIndex}].parent`);n.has(a)&&!o.has(a)&&(o.add(a),s.push(a))}return o}(e,t.listPath),o=new Map,s=new Map;for(let r=0;r<e.length;r++){const i=Xe(e[r]),a=nt(i.ind??r+1,`${t.listPath}[${r}].ind`);n.has(a)&&(o.set(a,`${t.idPrefix}layer:${a}`),15===i.ty&&"string"==typeof i.nm&&"string"==typeof i.refId&&$.some(e=>e.id===i.refId&&"binary"===e.type)&&s.set(i.nm,i.refId))}for(let r=e.length-1;r>=0;r--){const i=Xe(e[r]),a=`${t.listPath}[${r}]`,c=nt(i.ind??r+1,`${a}.ind`);if(!n.has(c))continue;const l=o.get(c),u=nt(i.ty,`${a}.ty`),f=!0===i.hd,p=void 0===i.parent?void 0:nt(i.parent,`${a}.parent`),d=void 0===p?void 0:o.get(p);void 0===p||d||it(h,"W_LOTTIE_MISSING_PARENT",`${a}.parent`,`Parent layer ${p} was not found.`);const m=d??t.fallbackParent,g=0===u?t.timeline:He(i,a,t.timeline,h);h.timeline=g;try{const n=f?[]:fe(i.ef,a,h),c=null;f||ue(i,a,u,h);const p=z(i.ks,a,l,h),d=et(i.ip??0,`${a}.ip`),g=je(d,et(i.op??d+t.timeline.frameRate*h.duration,`${a}.op`),t.timeline,h.duration),y=f?{nodes:[]}:ye(i,r,e,o,l,a,t.listPath,h,t.compositionWidth,t.compositionHeight),v={id:l,name:"string"==typeof i.nm?i.nm:l,start:g.start,duration:g.duration,transform:p,...m?{parent:m}:{},...y.value?{composite:y.value}:{},...n.length>0?{effects:n}:{}};if(f){_.push(v),h.convertedLayerCount++;continue}if(0===u){_.push(v),_.push(...y.nodes),h.convertedLayerCount++,L(i,l,a,t);continue}if(1===u){const e=tt(i.sw,`${a}.sw`),t=tt(i.sh,`${a}.sh`);_.push({...v,components:[{type:"shape2d",shape:"rect",size:[e,t],position:[e/2,t/2],fill:ge(Ye(i.sc,`${a}.sc`),c)}]}),_.push(...y.nodes),h.convertedLayerCount++;continue}if(2===u){const e="string"==typeof i.refId?i.refId:"",n=$.find(t=>t.id===e);if(n&&"image"===n.type){const o=[n.width??t.compositionWidth,n.height??t.compositionHeight];_.push({...v,components:[{type:"sprite2d",resource:e,size:o,position:[o[0]/2,o[1]/2]}]})}else it(h,"W_LOTTIE_MISSING_IMAGE",`${a}.refId`,`Image asset "${e}" was not found.`),_.push(v);_.push(...y.nodes),h.convertedLayerCount++;continue}if(3===u){_.push(v),_.push(...y.nodes),h.convertedLayerCount++;continue}if(4===u){_.push(v);const e=D(i.shapes,l,a,h,c);_.push(...e),_.push(...y.nodes),e.some(e=>(e.components?.length??0)>0)||H(i.shapes)||j(i.shapes)||it(h,"W_LOTTIE_EMPTY_SHAPE",`${a}.shapes`,"No supported filled vector shape was found."),h.convertedLayerCount++;continue}if(5===u){const e=W(i.t,a,t.compositionWidth,h,c,s);_.push(e?{...v,components:[e]}:v),_.push(...y.nodes),e?h.convertedLayerCount++:h.skippedLayerCount++;continue}if(6===u){const e="string"==typeof i.refId?i.refId:"",t=$.find(t=>t.id===e);t&&"audio"===t.type?_.push({...v,components:[{type:"audio",resource:e,volume:1,loop:!1}]}):(it(h,"W_LOTTIE_MISSING_AUDIO",`${a}.refId`,`Audio asset "${e}" was not found.`),_.push(v)),_.push(...y.nodes),h.convertedLayerCount++;continue}if(15===u){const e="string"==typeof i.refId?i.refId:"",t=$.find(t=>t.id===e);t&&"binary"===t.type?(h.usesDataLayerExtension=!0,_.push({...v,extensions:{[I]:{resource:e,mediaType:t.mimeType??"application/octet-stream"}}})):(it(h,"W_LOTTIE_MISSING_DATA",`${a}.refId`,`Data asset "${e}" was not found.`),_.push(v)),_.push(...y.nodes),h.convertedLayerCount++;continue}_.push(v),_.push(...y.nodes),h.skippedLayerCount++,it(h,"W_LOTTIE_UNSUPPORTED_LAYER",`${a}.ty`,`Layer type ${u} is preserved as a transform-only node.`)}finally{h.timeline=t.timeline}}}finally{h.timeline=n}}function L(e,t,n,o){const s="string"==typeof e.refId?e.refId:"",r=v.get(s);if(!r||!Array.isArray(r.value.layers))return h.skippedLayerCount++,void it(h,"W_LOTTIE_MISSING_PRECOMP",`${n}.refId`,`Precomposition asset "${s}" was not found.`);if(o.precompStack.includes(s))return h.skippedLayerCount++,void it(h,"W_LOTTIE_PRECOMP_CYCLE",`${n}.refId`,`Precomposition cycle detected for asset "${s}".`);const i=et(e.sr??1,`${n}.sr`);if(i<=0)return h.skippedLayerCount++,void it(h,"W_LOTTIE_INVALID_TIME_STRETCH",`${n}.sr`,"Precomposition time stretch must be greater than zero.");const a=et(e.st??0,`${n}.st`),c=tt(r.value.fr??o.timeline.frameRate,`$.assets[${r.index}].fr`),l={frameRate:c,secondsOffset:ze(o.timeline,a),secondsPerFrame:o.timeline.secondsPerFrame*o.timeline.frameRate/c*i},u=void 0!==e.tm&&qe(e.tm)?function(e,t,n,o,s){if(!qe(e))return it(s,"W_LOTTIE_TIME_REMAP",o,"Static time remapping cannot be represented by ordinary HYA transform tracks."),null;const r=Je(Xe(e).k).map(Xe);if(r.length<2)return it(s,"W_LOTTIE_TIME_REMAP",o,"Time remapping requires at least two scalar keyframes."),null;const i=[];for(let e=0;e<r.length;e++){const t=r[e];if("number"!=typeof t.t||!Number.isFinite(t.t))return it(s,"W_LOTTIE_TIME_REMAP",`${o}.k[${e}].t`,"Time-remap keyframe time must be finite."),null;const n=Qe(t.s,Number.NaN);Number.isFinite(n)&&i.push({frame:t.t,value:n})}if(i.length<1)return it(s,"W_LOTTIE_TIME_REMAP",o,"Time remapping contains no scalar keyframe values."),null;const a=et(r.at(-1).t,`${o}.k[${r.length-1}].t`),c=r[Math.max(0,r.length-2)],l=Qe(r.at(-1).s,Qe(c.e,i.at(-1).value));a>i.at(-1).frame&&i.push({frame:a,value:l});for(let e=1;e<i.length;e++)if(i[e].frame<=i[e-1].frame||i[e].value+1e-6<i[e-1].value)return it(s,"W_LOTTIE_TIME_REMAP",o,"Non-monotonic time remapping requires runtime time-warp support and was not converted."),null;const u=i[0],f=i.at(-1),p=e=>{if(e<=u.frame)return u.value;if(e>=f.frame)return f.value;let t=0;for(;t+1<i.length&&e>=i[t+1].frame;)t++;const n=i[t],o=i[t+1],s=r[Math.min(t,r.length-1)];if(1===s.h||o.frame<=n.frame)return n.value;const a=Fe(st((e-n.frame)/(o.frame-n.frame),0,1),st(Qe(Xe(s.o).x,.333),0,1),Qe(Xe(s.o).y,.333),st(Qe(Xe(s.i).x,.667),0,1),Qe(Xe(s.i).y,.667));return n.value+(o.value-n.value)*a},d=e=>{if(e<=u.value)return u.frame;if(e>=f.value)return f.frame;let t=u.frame,n=f.frame;for(let o=0;o<28;o++){const o=(t+n)/2;p(o)<e?t=o:n=o}return(t+n)/2};return{frameRate:n,secondsOffset:ze(t,u.frame),secondsPerFrame:t.secondsPerFrame,mapFrameToSeconds:e=>ze(t,d(e/n))}}(e.tm,o.timeline,c,`${n}.tm`,h)??l:l;b(Je(r.value.layers),{listPath:`$.assets[${r.index}].layers`,idPrefix:`${t}/`,fallbackParent:t,timeline:u,compositionWidth:tt(r.value.w??e.w??o.compositionWidth,`$.assets[${r.index}].w`),compositionHeight:tt(r.value.h??e.h??o.compositionHeight,`$.assets[${r.index}].h`),precompStack:[...o.precompStack,s]})}}function O(e,t={}){const n="string"==typeof e?Be(e):e,o=new Map,s=e=>{if(!e||"object"!=typeof e)return;if(Array.isArray(e)){for(const t of e)s(t);return}const t=e;"string"==typeof t.f&&"string"==typeof t.t&&o.set(t.f,(o.get(t.f)??0)+1);for(const e of Object.values(t))s(e)};s(n.layers),s(n.assets);const r=Je(Xe(n.fonts).list).map(Xe),i=new Set(r.map(e=>"string"==typeof e.fName?e.fName:"").filter(Boolean));for(const e of o.keys())i.has(e)||r.push({fName:e,fFamily:e,fStyle:"Regular"});return Object.freeze(r.flatMap(e=>{if("string"!=typeof e.fName||!e.fName)return[];const n=t?.[e.fName],s="string"==typeof n?{uri:n}:n,r="string"==typeof e.fFamily&&e.fFamily?e.fFamily:e.fName,i="string"==typeof e.fStyle?e.fStyle:"Regular",a=P(i);return[Object.freeze({name:e.fName,authoredFamily:r,authoredStyle:i,..."number"==typeof e.ascent&&Number.isFinite(e.ascent)?{authoredAscent:e.ascent}:{},usageCount:o.get(e.fName)??0,mapped:void 0!==s,resolvedFamily:s?.family??r,resolvedStyle:s?.style??a.style,resolvedWeight:s?.weight??a.weight,...s?{uri:s.uri,mimeType:s.mimeType??"font/woff2"}:{},...void 0===s?.integrity?{}:{integrity:s.integrity},...void 0===s?.metrics?{}:{metrics:Object.freeze({...s.metrics})}})]}))}function S(e,t={}){return A(e,t).document}function P(e){const t=e.toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ").trim(),n=t.replace(/\s+/g,""),o=t.includes("italic")||t.includes("oblique")?"italic":"normal";let s=400;return/thin|hairline/.test(n)?s=100:/extralight|ultralight/.test(n)?s=200:/light/.test(n)?s=300:/extrabold|ultrabold/.test(n)?s=800:/semibold|demibold|demi/.test(n)?s=600:/bold/.test(n)?s=700:/black|heavy/.test(n)?s=900:/medium/.test(n)&&(s=500),{style:o,weight:s}}function R(e,t,n,o){const s=[],r=Je(e);for(let e=0;e<r.length;e++){const i=Xe(r[e]);if("string"!=typeof i.id||"string"!=typeof i.p)continue;const a="string"==typeof i.u?i.u:"",c=i.p.startsWith("data:")?i.p:Ze(t.imageBaseUrl??"",`${a}${i.p}`);if(n.has(i.id))s.push({id:i.id,type:"audio",uri:c});else if(o.has(i.id)){const e=3===i.t||/\.json(?:$|[?#])/i.test(i.p)?"application/json":"application/octet-stream";s.push({id:i.id,type:"binary",uri:c,mimeType:e})}else s.push({id:i.id,type:"image",uri:c,..."number"==typeof i.w&&i.w>0?{width:i.w}:{},..."number"==typeof i.h&&i.h>0?{height:i.h}:{}})}return s}function C(e,t){const n=new Set;for(const o of e)for(const e of o){const o=Xe(e);o.ty===t&&"string"==typeof o.refId&&n.add(o.refId)}return n}function W(n,o,s,r,i,a){const c=Xe(n),l=Xe(c.d).x;let u;if("string"==typeof l&&l.trim().length>0)try{u=function(n,o){const s=new $(n).parseProgram(),r=[],i=new Map,a=new Map;let c,l=-1;for(let e=s.length-1;e>=0;e--)if("expression"===s[e].kind){l=e;break}const u=(e,t)=>{const n=i.get(e);if(void 0!==n)return n;if(i.size>=16)throw b("Expression declares too many local variables.",t);const o=i.size;return i.set(e,o),o},f=e=>{const t=y(e,a,o);if(t){if(0===t.path.length)throw b("Data Layer references must select a primitive field.",e.offset);r.push({op:"data",resource:t.resource,path:t.path})}else switch(e.kind){case"literal":return void r.push({op:"constant",value:e.value});case"identifier":{if("time"===e.name)return void r.push({op:"time"});if("value"===e.name)return void r.push({op:"text"});const t=i.get(e.name);if(void 0===t)throw b(`Unknown expression identifier "${e.name}".`,e.offset);return void r.push({op:"local.get",index:t})}case"unary":return f(e.argument),void r.push({op:"unary",operator:"+"===e.operator?"positive":"-"===e.operator?"negative":"not"});case"binary":return f(e.left),f(e.right),void r.push({op:"binary",operator:k(e.operator,e.offset)});case"conditional":f(e.test);{const t=r.length;r.push({op:"branch.false",target:t+1}),f(e.consequent);const n=r.length;r.push({op:"jump",target:n+1}),r[t].target=r.length,f(e.alternate),r[n].target=r.length}return;case"call":return void p(e);case"assignment":throw b("Nested assignments are not supported.",e.offset);case"member":if("identifier"===e.object.kind&&"Math"===e.object.name&&("PI"===e.property||"E"===e.property))return void r.push({op:"constant",value:"PI"===e.property?Math.PI:Math.E});throw b(`Property "${e.property}" is not available in the safe expression profile.`,e.offset)}},p=e=>{if("identifier"===e.callee.kind&&"$bm_sum"===e.callee.name){if(2!==e.arguments.length)throw b("$bm_sum requires exactly two arguments.",e.offset);return f(e.arguments[0]),f(e.arguments[1]),void r.push({op:"binary",operator:"add"})}if("member"===e.callee.kind&&"toFixed"===e.callee.property){if(1!==e.arguments.length)throw b("toFixed requires exactly one digits argument.",e.offset);return f(e.callee.object),f(e.arguments[0]),void r.push({op:"call",function:"to-fixed",argc:2})}const t=function(e){return"identifier"===e.kind?e.name:"member"===e.kind&&"identifier"===e.object.kind&&"Math"===e.object.name?e.property:null}(e.callee),n=function(e){return e?{abs:"abs",min:"min",max:"max",clamp:"clamp",floor:"floor",ceil:"ceil",round:"round",sqrt:"sqrt",pow:"pow",sin:"sin",cos:"cos",tan:"tan",asin:"asin",acos:"acos",atan:"atan",atan2:"atan2",log:"log",exp:"exp",lerp:"lerp"}[e]??null:null}(t);if(!n)throw b(`Function "${t??"<dynamic>"}" is not available in the safe expression profile.`,e.offset);for(const t of e.arguments)f(t);r.push({op:"call",function:n,argc:e.arguments.length})};for(let e=0;e<s.length;e++){const t=s[e];if("variable"===t.kind){for(const e of t.declarations){if("$bm_rt"===e.name){c=u(e.name,e.offset),e.initializer&&(f(e.initializer),r.push({op:"local.set",index:c}));continue}if(e.initializer){const t=y(e.initializer,a,o);if(t){a.set(e.name,t);continue}}const t=u(e.name,e.offset);e.initializer?f(e.initializer):r.push({op:"constant",value:null}),r.push({op:"local.set",index:t})}continue}const n=t.expression;if("assignment"===n.kind){if("$bm_rt"===n.target){c=u(n.target,n.offset),f(n.value),r.push({op:"local.set",index:c});continue}const e=y(n.value,a,o);if(e){a.set(n.target,e);continue}const t=u(n.target,n.offset);f(n.value),r.push({op:"local.set",index:t});continue}f(n),e===l&&void 0===c||r.push({op:"pop"})}if(void 0!==c&&r.push({op:"local.get",index:c}),void 0===c&&l<0)throw b("Expression does not produce a result.",0);return r.push({op:"return"}),e({version:t,result:"text",localCount:i.size,instructions:r},"$.compiledExpression")}(l,{resolveDataLayer:e=>a.get(e)})}catch(e){it(r,"W_LOTTIE_TEXT_EXPRESSION",`${o}.t.d.x`,`Text document expression could not be lowered to safe HYA IR: ${e instanceof g?`${e.message} (source offset ${e.offset})`:e instanceof Error?e.message:String(e)}`)}const f=Je(Xe(c.d).k).map(Xe),p=[];for(let e=0;e<f.length;e++){const t=f[e],n=Xe(t.s);if("string"!=typeof n.t){it(r,"W_LOTTIE_INVALID_TEXT",`${o}.t.d.k[${e}].s`,"Text document has no string value.");continue}const s=N(n,ze(r.timeline,et(t.t??0,`${o}.t.d.k[${e}].t`)),r,i,`${o}.t.d.k[${e}].s`);p.length>0&&s.time<=p[p.length-1].time?it(r,"W_LOTTIE_TEXT_DOCUMENT_TIME",`${o}.t.d.k[${e}].t`,"Duplicate or reversed text document time was omitted."):p.push(s)}const d=p[0];if(!d)return it(r,"W_LOTTIE_INVALID_TEXT",`${o}.t.d`,"Text layer has no usable text document."),null;const m=Ke(Xe(f[0]?.s).sz),h=m[0]&&m[0]>0?m[0]:Math.min(s,Math.max(64,Math.max(...p.map(e=>e.text.length))*(d.fontSize??32)*.7)),v=m[1]&&m[1]>0?m[1]:1.35*(d.lineHeight??1.2*(d.fontSize??32)),T=function(e,t,n,o){const s=[],r=Je(e).map(Xe);for(let e=0;e<r.length;e++){const i=r[e],a=`${n}[${e}]`,c=Xe(i.s),l=void 0===c.t?0:nt(c.t,`${a}.s.t`),u=void 0===c.b?1:nt(c.b,`${a}.s.b`);if(0!==l){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.t`,"Expression text selectors are not executed; use an offline bake or a range selector.");continue}const f=[void 0,"characters","characters-excluding-spaces","words","lines"][u];if(!f){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.b`,`Text selector based-on mode ${u} is not supported.`);continue}const p=[["xe",c.xe],["ne",c.ne],["sm",c.sm]].find(([,e])=>qe(e));if(p){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.${p[0]}`,"Animated selector easing or smoothness requires offline baking.");continue}const d=2===c.r?"index":"percent",m=e=>["percent"===d?(e[0]??0)/100:e[0]??0],h=c.s,g=c.e,y=c.o,v=c.a,T=m([Ve(h,0)])[0],k=m([Ve(g,"percent"===d?100:0)])[0],$=m([Ve(y,0)])[0],_=st(Ve(v,100)/100,-1,1),E=void 0===c.sh?1:nt(c.sh,`${a}.s.sh`),b=["square","square","ramp-up","ramp-down","triangle","round","smooth"][E];if(!b){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.sh`,`Range selector shape ${E} is not supported.`);continue}const M=st(Ve(c.xe,0),-100,100)/100,x=st(Ve(c.ne,0),-100,100)/100,I=[x>0?x:0,x<0?-x:0,M>0?1-M:1,M<0?1+M:1],L=st(Ve(c.sm,100)/100,0,1),w=1===c.rn?rt(a):void 0,A=Xe(i.a),O=Ue(A.p,[0,0]),S=Ue(A.s,[100,100]),P=Ue(A.fc,[1,1,1]),R=Ne(h,o,`${a}.s.s`,m),C=Ne(g,o,`${a}.s.e`,m),W=Ne(y,o,`${a}.s.o`,m),N=Ne(v,o,`${a}.s.a`,e=>[st((e[0]??100)/100,-1,1)]),z=Ne(A.p,o,`${a}.a.p`,e=>[e[0]??0,e[1]??0]),F=Ne(A.s,o,`${a}.a.s`,e=>[(e[0]??100)/100,(e[1]??100)/100]),D=Ne(A.r,o,`${a}.a.r`,e=>[ot(e[0]??0)]),H=Ne(A.o,o,`${a}.a.o`,e=>[st((e[0]??100)/100,0,1)]),j=Ne(A.fc,o,`${a}.a.fc`,e=>[st(e[0]??1,0,1),st(e[1]??1,0,1),st(e[2]??1,0,1),1]),q=Ne(A.t,o,`${a}.a.t`,e=>[(e[0]??0)*t/1e3]);s.push({selector:{start:T,end:k,offset:$,units:d,amount:_,shape:b,basedOn:f,...0===I[0]&&0===I[1]&&1===I[2]&&1===I[3]?{}:{easing:I},...1===L?{}:{smoothness:L},...void 0===w?{}:{randomSeed:w},...R?{startTrack:R}:{},...C?{endTrack:C}:{},...W?{offsetTrack:W}:{},...N?{amountTrack:N}:{}},...void 0===A.p?{}:{position:[O[0]??0,O[1]??0]},...void 0===A.s?{}:{scale:[(S[0]??100)/100,(S[1]??100)/100]},...void 0===A.r?{}:{rotation:ot(Ve(A.r,0))},...void 0===A.o?{}:{opacity:st(Ve(A.o,100)/100,0,1)},...void 0===A.fc?{}:{fillColor:[st(P[0]??1,0,1),st(P[1]??1,0,1),st(P[2]??1,0,1),1]},...void 0===A.t?{}:{tracking:Ve(A.t,0)*t/1e3},...z?{positionTrack:z}:{},...F?{scaleTrack:F}:{},...D?{rotationTrack:D}:{},...H?{opacityTrack:H}:{},...j?{fillColorTrack:j}:{},...q?{trackingTrack:q}:{}})}return s}(c.a,d.fontSize??32,`${o}.t.a`,r);return{type:"text2d",text:d.text,size:[h,v],...void 0===d.fontFamily?{}:{fontFamily:d.fontFamily},...void 0===d.fontSize?{}:{fontSize:d.fontSize},...void 0===d.fontWeight?{}:{fontWeight:d.fontWeight},...void 0===d.fontStyle?{}:{fontStyle:d.fontStyle},...void 0===d.fontResource?{}:{fontResource:d.fontResource},...void 0===d.lineHeight?{}:{lineHeight:d.lineHeight},...void 0===d.tracking?{}:{tracking:d.tracking},...void 0===d.textAlign?{}:{textAlign:d.textAlign},verticalAlign:"middle",color:d.color??[1,1,1,1],...p.length>1?{documents:p}:{},...T.length>0?{animators:T}:{},...u?{expression:u}:{}}}function N(e,t,n,o,s){const r="number"==typeof e.s&&e.s>0?e.s:32,i="string"==typeof e.f?e.f:"",a=n.fonts.get(i);!i||a?.resourceId||n.warnedFontSubstitutions.has(i)||(n.warnedFontSubstitutions.add(i),it(n,"W_LOTTIE_FONT_SUBSTITUTION",`${s}.f`,`Font "${i}" has no mapped web-font resource; the original family, style and weight are preserved and the browser may use a system fallback.`));const c=Ke(e.fc),l="number"==typeof e.j?e.j:2;return{time:Math.max(0,t),text:e.t,fontFamily:a?.family??(i||"sans-serif"),fontSize:r,fontWeight:a?.weight??400,fontStyle:a?.style??"normal",...void 0===a?.resourceId?{}:{fontResource:a.resourceId},lineHeight:"number"==typeof e.lh&&e.lh>0?e.lh:1.2*r,tracking:et(e.tr??0,`${s}.tr`)*r/1e3,textAlign:0===l?"left":1===l?"right":"center",color:ge([st(c[0]??1,0,1),st(c[1]??1,0,1),st(c[2]??1,0,1),1])}}function z(e,t,n,o){return F(Xe(e),`${t}.ks`,n,o)}function F(e,t,n,o){const s=Ue(e.p,[0,0]),r=Ue(e.s,[100,100]),i=Ue(e.a,[0,0]),a=Ve(e.r??e.rz,0),c=Ve(e.o,100);return We(e.p,n,"position",o,e=>[e[0]??0,e[1]??0],`${t}.p`),We(e.s,n,"scale",o,e=>[(e[0]??100)/100,(e[1]??100)/100],`${t}.s`),We(e.r??e.rz,n,"rotation",o,e=>[ot(e[0]??0)],`${t}.r`),We(e.o,n,"opacity",o,e=>[st((e[0]??100)/100,0,1)],`${t}.o`),qe(e.a)&&it(o,"W_LOTTIE_ANIMATED_ANCHOR",`${t}.a`,"Animated anchor points are sampled at their initial value."),{position:[s[0]??0,s[1]??0],rotation:ot(a),scale:[(r[0]??100)/100,(r[1]??100)/100],anchor:[i[0]??0,i[1]??0],opacity:st(c/100,0,1)}}function D(e,t,n,o,s){const r=[];return function e(n,s,i,a,c){const l=[],u=[];for(let e=0;e<n.length;e++){const t=Xe(n[e]);if(!0===t.hd)continue;if("fl"===t.ty&&l.push({index:e,paint:{kind:"fill",fill:X(t,`${c}[${e}]`,o),fillRule:2===t.r?"evenodd":"nonzero"}}),"gf"===t.ty&&l.push({index:e,paint:{kind:"fill",fill:J(t,`${c}[${e}]`,o),fillRule:2===t.r?"evenodd":"nonzero"}}),"st"===t.ty){const n=re(t,`${c}[${e}]`,o);n&&l.push({index:e,paint:{kind:"stroke",stroke:n}})}if("gs"===t.ty){const n=Q(t,`${c}[${e}]`,o);n&&l.push({index:e,paint:{kind:"stroke",stroke:n}})}const s=oe(t,`${c}[${e}]`,o);s&&u.push({index:e,modifier:s})}const f=e=>[...s,...l.filter(t=>t.index>e).map(e=>e.paint)],p=e=>[...u.filter(t=>t.index>e).map(e=>e.modifier),...i],d=function(e,t,n){const o=new Map;let s=0;for(let r=0;r<e.length;r++){const i=Xe(e[r]);if("mm"!==i.ty||!0===i.hd)continue;const a=`${t}[${r}]`,c=[];let l;for(let t=s;t<r;t++){const n=Xe(e[t]);!0!==n.hd&&(Y(n.ty)?c.push(t):["tm","rd","rp","pb","zz","op","tw"].includes(String(n.ty))&&(l=String(n.ty)))}if(s=r+1,0===c.length){it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,"Merge Paths has no preceding path geometry to combine.");continue}if(l){it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,`Merge Paths cannot yet bake the preceding "${l}" modifier.`);continue}const u="number"==typeof i.mm&&Number.isInteger(i.mm)?i.mm:1;if(u<1||u>5){it(n,"W_LOTTIE_MERGE_PATH_INPUT",`${a}.mm`,`Unknown Merge Paths mode "${String(i.mm)}".`);continue}const f=c.map(o=>Z(Xe(e[o]),`${t}[${o}]`,n));if(f.some(e=>e.animated)){const s=1===u?G(e,c,t,n):void 0;s?o.set(r,{inputIndices:c,prepared:s}):it(n,"W_LOTTIE_ANIMATED_MERGE_PATH",a,1===u?"Animated Merge Paths could not be baked into a stable compound morph.":`Animated Merge Paths mode ${u} requires time-varying boolean topology and remains unmerged.`);continue}const p=f.find(e=>e.unsupportedReason)?.unsupportedReason;if(p)it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,p);else try{o.set(r,{inputIndices:c,...B(f,u)??{}})}catch(e){it(n,"W_LOTTIE_MERGE_PATH_GEOMETRY",a,`Static Merge Paths boolean failed: ${e instanceof Error?e.message:String(e)}`)}}return o}(n,c,o),m=new Set([...d.values()].flatMap(e=>e.inputIndices));for(let s=0;s<n.length;s++){const i=Xe(n[s]),l=`${c}[${s}]`;if(!0===i.hd)continue;if(m.has(s))continue;if("mm"===i.ty){const e=d.get(s);if(!e)continue;const n=f(s).flatMap(t=>e.prepared?te(e.prepared,t,p(s),o):e.path?ne(e.path,t,p(s),o):[]);if(0===n.length)continue;const c=`${t}:shape:${o.shapeCounter++}`;r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,components:n});continue}if("gr"===i.ty){const n=Je(i.it),c=n.findIndex(e=>"tr"===Xe(e).ty),u=`${t}:group:${o.shapeCounter++}`,d={id:u,name:"string"==typeof i.nm?i.nm:u,parent:a};if(c>=0){const e=Xe(n[c]);d.transform=F(e,`${l}.it[${c}]`,u,o),(qe(e.sk)||qe(e.sa)||Math.abs(Ve(e.sk,0))>1e-6||Math.abs(Ve(e.sa,0))>1e-6)&&it(o,"W_LOTTIE_GROUP_SKEW",`${l}.it[${c}]`,"Shape group skew is not converted.")}r.push(d),e(n,f(s),p(s),u,`${l}.it`);continue}if("sh"===i.ty){const e=ee(i.ks,`${l}.ks`,o),n=e?f(s).flatMap(t=>te(e,t,p(s),o)):[];if(0===n.length)continue;const c=`${t}:shape:${o.shapeCounter++}`;r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,components:n});continue}if("sr"===i.ty){const e=f(s);if(0===e.length)continue;const n=le(i,l,o);if(!n)continue;const c=`${t}:shape:${o.shapeCounter++}`,u=Ue(i.p,[0,0]),d=Ve(i.r,0);We(i.p,c,"position",o,e=>[e[0]??0,e[1]??0],`${l}.p`),We(i.r,c,"rotation",o,e=>[ot(e[0]??0)],`${l}.r`),r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,transform:{position:[u[0]??0,u[1]??0],rotation:ot(d)},components:e.flatMap(e=>ne(n,e,p(s),o))});continue}if("rc"!==i.ty&&"el"!==i.ty){["fl","gf","st","gs","tr","tm","rd","mm"].includes(String(i.ty))||it(o,"W_LOTTIE_UNSUPPORTED_SHAPE",`${l}.ty`,`Shape operator "${String(i.ty)}" is not converted.`);continue}const u=f(s);if(0===u.length)continue;const h=Ge(i.s,2)??Ue(i.s,[0,0]),g=Ue(i.p,[0,0]);if((h[0]??0)<=0||(h[1]??0)<=0){it(o,"W_LOTTIE_INVALID_SHAPE_SIZE",`${l}.s`,"Shape has no positive static size.");continue}const y=`${t}:shape:${o.shapeCounter++}`,v="rc"===i.ty?Math.max(0,Ve(i.r,0)):0,T="rc"===i.ty?ae(h[0],h[1],v):ce(h[0]/2,h[1]/2),k=u.flatMap(e=>ne(T,e,p(s),o));We(i.p,y,"position",o,e=>[e[0]??0,e[1]??0],`${l}.p`),We(i.s,y,"scale",o,e=>[(e[0]??h[0])/h[0],(e[1]??h[1])/h[1]],`${l}.s`),"rc"===i.ty&&qe(i.r)&&it(o,"W_LOTTIE_ANIMATED_ROUNDED_RECT",`${l}.r`,"Animated corner radius is sampled at its initial value."),r.push({id:y,name:"string"==typeof i.nm?i.nm:y,parent:a,transform:{position:[g[0]??0,g[1]??0]},components:k})}}(Je(e),[],[],t,`${n}.shapes`),r}function H(e){const t=[],n=e=>{for(const o of e){const e=Xe(o);!0!==e.hd&&("gr"===e.ty?n(Je(e.it)):"fl"!==e.ty&&"gf"!==e.ty&&"st"!==e.ty&&"gs"!==e.ty||t.push(e))}};return n(Je(e)),0!==t.length&&t.every(e=>{if(!((Ge(e.o,1)?.[0]??Ve(e.o,100))>0))return!0;if("st"===e.ty||"gs"===e.ty)return void 0===Ge(e.w,1);if("fl"===e.ty){return(Ue(e.c,[1,1,1,1])[3]??1)<=0}return!1})}function j(e){let t=0,n=!1;const o=e=>{for(const s of e){const e=Xe(s);!0!==e.hd&&("gr"!==e.ty?"sh"!==e.ty?"rc"!==e.ty&&"el"!==e.ty&&"sr"!==e.ty&&"mm"!==e.ty||(n=!0):(t++,q(e.ks)||(n=!0)):o(Je(e.it)))}};return o(Je(e)),t>0&&!n}function q(e){const t=Xe(e);if(!qe(t))return U(Se(e));const n=[];for(const e of Je(t.k).map(Xe))for(const t of[e.s,e.e]){if(void 0===t)continue;const e=Xe(Je(t)[0]??t);Object.keys(e).length>0&&n.push(e)}return n.length>0&&n.every(U)}function U(e){return Array.isArray(e.v)&&0===e.v.length&&Array.isArray(e.i)&&0===e.i.length&&Array.isArray(e.o)&&0===e.o.length}function G(e,t,n,o){const s=[];for(const r of t){const t=Xe(e[r]);if("sh"!==t.ty)return;const i=ee(t.ks,`${n}[${r}].ks`,o);if(!i)return;s.push(i)}if(0===s.length)return;const r=s.map(e=>e.commands).join(""),i=s.filter(e=>void 0!==e.morph);if(0===i.length)return{sourcePath:n,commands:r,values:s.flatMap(e=>e.values),closed:s.every(e=>e.closed)};const a=Math.min(...i.map(e=>e.morph.times[0])),c=Math.max(...i.map(e=>e.morph.times.at(-1))),l=new Set;for(const e of i)for(const t of e.morph.times)l.add(Math.fround(t));const u=1/Math.max(1,o.frameRate),f=Math.ceil(a/u-1e-6),p=Math.floor(c/u+1e-6);if(p-f+1>1024)return;for(let e=f;e<=p;e++)l.add(Math.fround(st(e*u,0,o.duration)));const d=[...l].filter(e=>e>=0&&e<=o.duration).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e>n[t-1]);if(0===d.length)return;const m=[];for(const e of d)for(const t of s)m.push(...t.morph?V(t.morph,e):t.values);const h=s.reduce((e,t)=>e+t.values.length,0);return{sourcePath:n,commands:r,values:m.slice(0,h),closed:s.every(e=>e.closed),morph:{times:d,values:m,valueSize:h,interpolation:"linear"}}}function V(e,t){const n=e.times;let o=0;if(t>=n[n.length-1])o=n.length-1;else for(;o+1<n.length&&t>=n[o+1];)o++;const s=Math.min(o+1,n.length-1);let r=0;if(s!==o&&"step"!==e.interpolation&&(r=st((t-n[o])/Math.max(1e-8,n[s]-n[o]),0,1),"cubic-bezier"===e.interpolation&&e.easings)){const t=4*o;r=Fe(r,e.easings[t]??.333,e.easings[t+1]??.333,e.easings[t+2]??.667,e.easings[t+3]??.667)}const i=new Array(e.valueSize),a=o*e.valueSize,c=s*e.valueSize;for(let t=0;t<e.valueSize;t++){const n=e.values[a+t]??0;i[t]=n+((e.values[c+t]??n)-n)*r}return i}function Y(e){return"sh"===e||"rc"===e||"el"===e||"sr"===e||"gr"===e}function Z(e,t,n){if("sh"===e.ty){if(qe(e.ks))return{paths:[],animated:!0};const o=Oe(Se(e.ks),`${t}.ks`,n,!1,!1);return o?{paths:[o],animated:!1}:{paths:[],animated:!1,unsupportedReason:`Merge Paths input at ${t} is not valid path geometry.`}}if("rc"===e.ty||"el"===e.ty){if([e.s,e.p,..."rc"===e.ty?[e.r]:[]].some(qe))return{paths:[],animated:!0};const n=Ue(e.s,[0,0]);if((n[0]??0)<=0||(n[1]??0)<=0)return{paths:[],animated:!1,unsupportedReason:`Merge Paths primitive at ${t} has no positive size.`};const r="rc"===e.ty?ae(n[0],n[1],Math.max(0,Ve(e.r,0))):ce(n[0]/2,n[1]/2),i=Ue(e.p,[0,0]);return{paths:[l(r,(o=i[0]??0,s=i[1]??0,[1,0,0,1,o,s]))],animated:!1}}var o,s;if("sr"===e.ty){if([e.pt,e.or,e.ir,e.is,e.os,e.p,e.r].some(qe))return{paths:[],animated:!0};const o=le(e,t,n);if(!o)return{paths:[],animated:!1,unsupportedReason:`Merge Paths polystar at ${t} is invalid.`};return{paths:[l(o,c(Ue(e.p,[0,0]),[0,0],[100,100],ot(Ve(e.r,0))))],animated:!1}}if("gr"===e.ty){const o=Je(e.it),s=o.map(Xe).find(e=>"tr"===e.ty);if(s&&[s.p,s.a,s.s,s.r??s.rz,s.sk,s.sa].some(qe))return{paths:[],animated:!0};if(s&&(Math.abs(Ve(s.sk,0))>1e-6||Math.abs(Ve(s.sa,0))>1e-6))return{paths:[],animated:!1,unsupportedReason:`Merge Paths group at ${t} uses skew, which is not safe to bake.`};const r=o.map((e,t)=>({item:Xe(e),index:t})).filter(e=>!0!==e.item.hd&&Y(e.item.ty)),i=o.map(Xe).find(e=>!0!==e.hd&&["mm","tm","rd","rp","pb","zz","op","tw"].includes(String(e.ty)));if(i)return{paths:[],animated:!1,unsupportedReason:`Nested Merge Paths input at ${t} contains the "${String(i.ty)}" operator.`};const a=r.map(e=>Z(e.item,`${t}.it[${e.index}]`,n));if(a.some(e=>e.animated))return{paths:[],animated:!0};const u=a.find(e=>e.unsupportedReason)?.unsupportedReason;if(u)return{paths:[],animated:!1,unsupportedReason:u};const f=s?c(Ue(s.p,[0,0]),Ue(s.a,[0,0]),Ue(s.s,[100,100]),ot(Ve(s.r??s.rz,0))):[1,0,0,1,0,0];return{paths:a.flatMap(e=>e.paths).map(e=>l(e,f)),animated:!1}}return{paths:[],animated:!1,unsupportedReason:`Merge Paths input at ${t} is not supported.`}}function B(e,t){const n=a(e.map(e=>e.paths),t);return n?{path:n}:null}function X(e,t,n,o){const s=Ue(e.c,[1,1,1,1]),r=st(Ve(e.o,100)/100,0,1),i=ge([st(s[0]??1,0,1),st(s[1]??1,0,1),st(s[2]??1,0,1),st(s[3]??1,0,1)]),a=Ne(e.c,n,`${t}.c`,e=>[...ge([st(e[0]??1,0,1),st(e[1]??1,0,1),st(e[2]??1,0,1),st(e[3]??1,0,1)])]),c=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]);return{kind:"solid",color:i,opacity:r,...a?{colorTrack:a}:{},...c?{opacityTrack:c}:{}}}function J(e,t,n,o){const s=Xe(e.g);2===e.t&&(qe(e.h)||qe(e.a)||Math.abs(Ve(e.h,0))>1e-6||Math.abs(Ve(e.a,0))>1e-6)&&it(n,"W_LOTTIE_GRADIENT_HIGHLIGHT",t,"Radial gradient highlight length and angle are not converted.");const r=Math.max(2,nt(s.p??2,`${t}.g.p`)),i=Math.min(8,r);r>8&&it(n,"W_LOTTIE_GRADIENT_STOP_LIMIT",`${t}.g.p`,"Gradient is resampled to the eight-stop HYA runtime budget.");const a=s.k,c=st(Ve(e.o,100)/100,0,1),l=K(Ue(a,[]),r,i),u=Ue(e.s,[0,0]),f=Ue(e.e,[100,0]),p=Ne(a,n,`${t}.g.k`,e=>K(e,r,i)),d=Ne(e.s,n,`${t}.s`,e=>[e[0]??0,e[1]??0]),m=Ne(e.e,n,`${t}.e`,e=>[e[0]??0,e[1]??0]),h=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]);return{kind:2===e.t?"radial-gradient":"linear-gradient",start:[u[0]??0,u[1]??0],end:[f[0]??100,f[1]??0],stops:l,opacity:c,...d?{startTrack:d}:{},...m?{endTrack:m}:{},...p?{stopsTrack:p}:{},...h?{opacityTrack:h}:{}}}function K(e,t,n,o){const s=Math.min(t,Math.floor(e.length/4)),r=e.slice(4*s),i=e=>{if(r.length<2)return 1;let t=0;for(;t+3<r.length&&r[t+2]<=e;)t+=2;const n=r[Math.max(0,t)]??0,o=r[Math.max(0,t)+1]??1,s=r[Math.min(r.length-2,t+2)]??n,i=r[Math.min(r.length-1,t+3)]??o,a=s<=n?0:st((e-n)/(s-n),0,1);return st(o+(i-o)*a,0,1)},a=t=>{if(0===s)return[1,1,1];let n=0;for(;n+1<s&&(e[4*(n+1)]??1)<=t;)n++;const o=Math.min(s-1,n+1),r=e[4*n]??0,i=e[4*o]??r,a=i<=r?0:st((t-r)/(i-r),0,1);return[1,2,3].map(t=>st((e[4*n+t]??1)+((e[4*o+t]??e[4*n+t]??1)-(e[4*n+t]??1))*a,0,1))},c=[];for(let t=0;t<n;t++){const o=n===s?t:-1,r=st(o>=0?e[4*o]??0:t/Math.max(1,n-1),0,1),l=a(r),u=ge([l[0],l[1],l[2],i(r)]);c.push(r,...u)}return c}function Q(e,t,n,o){const s=re({...e,c:{a:0,k:[1,1,1,1]}},t,n);return s?{...s,gradient:J(e,t,n)}:null}function ee(e,t,n){if(qe(e)){const o=$e(e,t,n,!1);if(o)return{sourcePath:t,commands:o.commands,values:o.values.slice(0,o.valueSize),closed:o.commands.endsWith("Z"),morph:{times:o.times,values:o.values,valueSize:o.valueSize,interpolation:o.interpolation,...o.easings?{easings:o.easings}:{}}}}const o=Se(e),s=Oe(o,t,n,!1,!1);return s?{sourcePath:t,commands:s.commands,values:Array.from(s.values),closed:!1!==o.c}:null}function te(e,t,n,o){const r="fill"===t.kind?function(e,t){if(e.closed)return e;it(t,"W_LOTTIE_OPEN_FILLED_PATH",e.sourcePath,"Open filled path is closed with a straight segment.");const n=e=>[...e,e[0]??0,e[1]??0];if(!e.morph)return{commands:`${e.commands}LZ`,values:n(e.values),closed:!0,sourcePath:e.sourcePath};const o=[];for(let t=0;t<e.morph.times.length;t++){const s=t*e.morph.valueSize;o.push(...n(Array.from(e.morph.values).slice(s,s+e.morph.valueSize)))}return{commands:`${e.commands}LZ`,values:n(e.values),closed:!0,sourcePath:e.sourcePath,morph:{...e.morph,values:o,valueSize:e.morph.valueSize+2}}}(e,o):e,i=r.morph?function(e,t){const n=Array.from(e.values,(n,o)=>Ae(n-(t[o%e.valueSize]??0)));return{times:e.times,values:n,valueSize:e.valueSize,interpolation:e.interpolation,...e.easings?{easings:e.easings}:{}}}(r.morph,r.values):void 0;var a;if(!(void 0!==e.morph||n.length>0||"fill"===t.kind&&("solid"!==t.fill.kind||void 0!==t.fill.colorTrack||void 0!==t.fill.opacityTrack)||"stroke"===t.kind&&(void 0!==(a=t.stroke).colorTrack||void 0!==a.opacityTrack||void 0!==a.widthTrack||void 0!==a.dash||void 0!==a.dashOffsetTrack||void 0!==a.gradient))){if("fill"===t.kind&&"solid"===t.fill.kind)return[{type:"path2d",commands:r.commands,values:r.values,fill:[t.fill.color[0],t.fill.color[1],t.fill.color[2],t.fill.color[3]*(t.fill.opacity??1)],fillRule:t.fillRule}];if("stroke"===t.kind)return[ie(r.commands,r.values,t.stroke,o)]}return o.usesVectorShapeExtension=!0,[{type:s,commands:r.commands,values:r.values,...i?{morph:i,morphRelative:!0}:{},..."fill"===t.kind?{fill:t.fill}:{stroke:se(t.stroke)},...n.length>0?{modifiers:n}:{},fillRule:"fill"===t.kind?t.fillRule:"nonzero",tolerance:.35}]}function ne(e,t,n,o){return te({sourcePath:"$generated",commands:e.commands,values:Array.from(e.values),closed:e.commands.endsWith("Z")},t,n,o)}function oe(e,t,n){if("tm"===e.ty){const o=Ne(e.s,n,`${t}.s`,e=>[(e[0]??0)/100]),s=Ne(e.e,n,`${t}.e`,e=>[(e[0]??100)/100]),r=Ne(e.o,n,`${t}.o`,e=>[(e[0]??0)/360]);return{kind:"trim-path",start:Ve(e.s,0)/100,end:Ve(e.e,100)/100,offset:Ve(e.o,0)/360,mode:2===e.m?"individual":"simultaneous",...o?{startTrack:o}:{},...s?{endTrack:s}:{},...r?{offsetTrack:r}:{}}}if("rd"===e.ty){const o=Ne(e.r,n,`${t}.r`,e=>[Math.max(0,e[0]??0)]);return{kind:"round-corners",radius:Math.max(0,Ve(e.r,0)),...o?{radiusTrack:o}:{}}}return null}function se(e){const t=e.gradient;return{color:e.color,width:e.width,opacity:e.opacity,lineCap:2===e.lineCap?"round":3===e.lineCap?"square":"butt",lineJoin:2===e.lineJoin?"round":3===e.lineJoin?"bevel":"miter",miterLimit:e.miterLimit,...t?{gradient:t}:{},...e.dash?{dash:e.dash}:{},...void 0===e.dashOffset?{}:{dashOffset:e.dashOffset},...e.colorTrack?{colorTrack:e.colorTrack}:{},...e.opacityTrack?{opacityTrack:e.opacityTrack}:{},...e.widthTrack?{widthTrack:e.widthTrack}:{},...e.dashOffsetTrack?{dashOffsetTrack:e.dashOffsetTrack}:{}}}function re(e,t,n){const o=Ue(e.c,[0,0,0,1]),s=st(Ve(e.o,100)/100,0,1),r=Ve(e.w,0),i=Ge(e.w,1)?.[0];if(r<0||void 0!==i&&i<0)return it(n,"W_LOTTIE_INVALID_STROKE",`${t}.w`,"Stroke width cannot be negative."),null;const a=r>0?r:i;if(void 0===a)return null;const c=Ne(e.c,n,`${t}.c`,e=>[st(e[0]??0,0,1),st(e[1]??0,0,1),st(e[2]??0,0,1),st(e[3]??1,0,1)]),l=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]),u=Ne(e.w,n,`${t}.w`,e=>[Math.max(0,e[0]??a)]),f=Je(e.d).map(Xe),p=f.filter(e=>"o"!==e.n).map((e,o)=>(qe(e.v)&&it(n,"W_LOTTIE_ANIMATED_STROKE_DASH",`${t}.d[${o}].v`,"Animated dash lengths are sampled at their initial value."),Math.max(0,Ve(e.v,0)))).filter(e=>e>0),d=f.find(e=>"o"===e.n),m=d?Ve(d.v,0):void 0,h=d?Ne(d.v,n,`${t}.d`,e=>[e[0]??0]):void 0;return{color:[st(o[0]??0,0,1),st(o[1]??0,0,1),st(o[2]??0,0,1),st(o[3]??1,0,1)],width:a,opacity:s,lineCap:2===e.lc||3===e.lc?e.lc:1,lineJoin:2===e.lj||3===e.lj?e.lj:1,miterLimit:Math.max(1,"number"==typeof e.ml&&Number.isFinite(e.ml)?e.ml:4),...c?{colorTrack:c}:{},...l?{opacityTrack:l}:{},...u?{widthTrack:u}:{},...p.length>0?{dash:p}:{},...void 0===m?{}:{dashOffset:m},...h?{dashOffsetTrack:h}:{}}}function ie(e,t,n,o,s){return o.usesStrokeExtension=!0,{type:M,commands:e,values:t,color:[n.color[0],n.color[1],n.color[2],n.color[3]*n.opacity],width:n.width,lineCap:2===n.lineCap?"round":3===n.lineCap?"square":"butt",lineJoin:2===n.lineJoin?"round":3===n.lineJoin?"bevel":"miter",miterLimit:n.miterLimit,tolerance:.2}}function ae(e,t,n){const o=e/2,s=t/2,r=Math.min(Math.max(0,n),o,s);if(r<=1e-6)return{commands:"MLLLZ",values:[-o,-s,o,-s,o,s,-o,s]};const i=.5522847498307936*r;return{commands:"MLCLCLCLCZ",values:[-o+r,-s,o-r,-s,o-r+i,-s,o,-s+r-i,o,-s+r,o,s-r,o,s-r+i,o-r+i,s,o-r,s,-o+r,s,-o+r-i,s,-o,s-r+i,-o,s-r,-o,-s+r,-o,-s+r-i,-o+r-i,-s,-o+r,-s]}}function ce(e,t){const n=.5522847498307936*e,o=.5522847498307936*t;return{commands:"MCCCCZ",values:[0,-t,n,-t,e,-o,e,0,e,o,n,t,0,t,-n,t,-e,o,-e,0,-e,-o,-n,-t,0,-t]}}function le(e,t,n){const o=Math.round(Ve(e.pt,0)),s=Ve(e.or,0),r=2!==e.sy,i=r?Ve(e.ir,0):s;if(o<3||s<=0||r&&i<=0)return it(n,"W_LOTTIE_INVALID_POLYSTAR",t,"Polystar requires at least three points and positive radii."),null;[e.pt,e.or,e.ir].some(qe)&&it(n,"W_LOTTIE_ANIMATED_POLYSTAR_GEOMETRY",t,"Animated polystar points and radii are sampled at their initial value.");const a=st(Ve(e.is,0)/100,0,1),c=st(Ve(e.os,0)/100,0,1);(qe(e.is)||qe(e.os))&&it(n,"W_LOTTIE_ANIMATED_POLYSTAR_ROUNDNESS",t,"Animated polystar roundness is sampled at its initial value.");const l=r?2*o:o,u=3===e.d?-1:1,f=[],p=[];for(let e=0;e<l;e++){const t=r&&!(1&~e),n=t?i:s,o=-Math.PI/2+u*e*Math.PI*2/l;f.push([Math.cos(o)*n,Math.sin(o)*n]),p.push(t?a:c)}if(p.every(e=>e<=1e-6))return{commands:`M${"L".repeat(l-1)}Z`,values:f.flat()};const d=f.map((e,t)=>{const n=f[(t-1+l)%l],o=f[(t+1)%l],s=.25*p[t];return{vertex:e,enter:[e[0]+(n[0]-e[0])*s,e[1]+(n[1]-e[1])*s],exit:[e[0]+(o[0]-e[0])*s,e[1]+(o[1]-e[1])*s]}});let m="M";const h=[...d[0].enter];for(let e=0;e<d.length;e++){const t=d[e];e>0&&(m+="L",h.push(...t.enter)),m+="Q",h.push(...t.vertex,...t.exit)}return m+="LZ",h.push(...d[0].enter),{commands:m,values:h}}function ue(e,t,n,o){1===e.ddd&&it(o,"W_LOTTIE_3D_LAYER",`${t}.ddd`,"3D layer transforms are flattened to the supported 2D transform subset."),"number"==typeof e.bm&&0!==e.bm&&it(o,"W_LOTTIE_BLEND_MODE",`${t}.bm`,`Layer blend mode ${e.bm} is not represented by the HYA 2D renderer.`),1===e.ao&&it(o,"W_LOTTIE_AUTO_ORIENT",`${t}.ao`,"Auto-orient along a motion path is not converted."),void 0===e.tm||0===n&&qe(e.tm)||it(o,"W_LOTTIE_TIME_REMAP",`${t}.tm`,0!==n?"Time remapping is only supported for precomposition layers.":"Static time remapping cannot be represented by ordinary HYA transform tracks.");const s=Xe(Xe(e.ks).p);!0!==s.s&&void 0===s.x&&void 0===s.y||it(o,"W_LOTTIE_SPLIT_POSITION",`${t}.ks.p`,"Separated position dimensions are sampled as the default position.");const r=Xe(e.ks);(qe(r.sk)||qe(r.sa)||Math.abs(Ve(r.sk,0))>1e-6||Math.abs(Ve(r.sa,0))>1e-6)&&it(o,"W_LOTTIE_LAYER_SKEW",`${t}.ks`,"Layer skew and skew axis are not converted.")}function fe(e,t,n){const o=[],s=Je(e).map(Xe);for(let e=0;e<s.length;e++){const r=s[e],i=`${t}.ef[${e}]`,a=pe(r.nm??r.mn),c=Je(r.ef).map(Xe);if("tint"===a){const e=de(c,["map black to","adbe tint-0001"]),t=de(c,["map white to","adbe tint-0002"]),s=de(c,["amount to tint","adbe tint-0003"]);if(!e||!t||!s){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Tint requires Map Black To, Map White To and Amount to Tint parameters.");continue}const r=Ue(e,[0,0,0]),a=Ue(t,[1,1,1]),l=Ne(e,n,`${i}.black`,e=>me(e,[0,0,0])),u=Ne(t,n,`${i}.white`,e=>me(e,[1,1,1])),f=Ne(s,n,`${i}.amount`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"tint",black:me(r,[0,0,0]),white:me(a,[1,1,1]),amount:st(Ve(s,100)/100,0,1),...l?{blackTrack:l}:{},...u?{whiteTrack:u}:{},...f?{amountTrack:f}:{}});continue}if("fill"===a){const e=de(c,["color","adbe fill-0002"]),t=de(c,["opacity","adbe fill-0007"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Fill requires a Color parameter.");continue}const s=Ue(e,[1,1,1,1]),r=Ne(e,n,`${i}.color`,e=>he(e)),a=Ne(t,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"fill",color:he(s),opacity:st(Ve(t,100)/100,0,1),...r?{colorTrack:r}:{},...a?{opacityTrack:a}:{}});continue}if(a.includes("gaussian blur")||a.includes("fast box blur")||"blur"===a){const e=de(c,["blurriness","blur","adbe gaussian blur 2-0001","adbe fast blur-0001"]),t=Math.round(Ve(de(c,["blur dimensions","dimensions"]),1));if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Blur requires a Blurriness parameter.");continue}const s=e=>2===t?[0,Math.max(0,e[0]??0)]:3===t?[Math.max(0,e[0]??0),0]:[Math.max(0,e[0]??0),Math.max(0,e[0]??0)],r=Ne(e,n,`${i}.blur`,s);o.push({kind:"blur",radius:s([Ve(e,0)]),...r?{radiusTrack:r}:{}});continue}if("drop shadow"===a||a.includes("drop shadow")){const e=de(c,["shadow color","color","adbe drop shadow-0001"]),t=de(c,["opacity","adbe drop shadow-0002"]),s=de(c,["direction","adbe drop shadow-0003"]),r=de(c,["distance","adbe drop shadow-0004"]),a=de(c,["softness","blur","adbe drop shadow-0005"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Drop Shadow requires a Shadow Color parameter.");continue}(qe(s)||qe(r))&&it(n,"W_LOTTIE_EFFECT_PARAM",i,"Animated Drop Shadow direction/distance requires coupled sampling and is held at its first value.");const l=ot(Ve(s,135)),u=Math.max(0,Ve(r,0)),f=Ue(e,[0,0,0,1]),p=Ne(e,n,`${i}.color`,e=>he(e,[0,0,0,1])),d=Ne(t,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]),m=Ne(a,n,`${i}.blur`,e=>[Math.max(0,e[0]??0)]);o.push({kind:"drop-shadow",color:he(f,[0,0,0,1]),opacity:st(Ve(t,100)/100,0,1),offset:[Math.cos(l)*u,Math.sin(l)*u],blur:Math.max(0,Ve(a,0)),...p?{colorTrack:p}:{},...d?{opacityTrack:d}:{},...m?{blurTrack:m}:{}});continue}if("opacity"===a){const e=de(c,["opacity","amount"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Opacity effect requires an Opacity parameter.");continue}const t=Ne(e,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"opacity",opacity:st(Ve(e,100)/100,0,1),...t?{opacityTrack:t}:{}});continue}if("color matrix"===a){const e=de(c,["matrix","color matrix"]),t=Ue(e,[]);if(20!==t.length){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Color Matrix requires exactly 20 values.");continue}const s=Ne(e,n,`${i}.matrix`,e=>e.slice(0,20));o.push({kind:"color-matrix",matrix:t.slice(0,20),...s?{matrixTrack:s}:{}});continue}it(n,"W_LOTTIE_EFFECT",i,`Layer effect "${"string"==typeof r.nm?r.nm:String(r.ty)}" is not converted.`)}return o}function pe(e){return"string"==typeof e?e.trim().toLowerCase():""}function de(e,t){const n=t.map(e=>e.toLowerCase());return e.find(e=>{const t=pe(e.nm),o=pe(e.mn);return n.includes(t)||n.includes(o)})?.v}function me(e,t){return[st(e[0]??t[0],0,1),st(e[1]??t[1],0,1),st(e[2]??t[2],0,1)]}function he(e,t=[1,1,1,1]){return[st(e[0]??t[0],0,1),st(e[1]??t[1],0,1),st(e[2]??t[2],0,1),st(e[3]??t[3],0,1)]}function ge(e,t){return e}function ye(e,t,n,o,s,r,i,a,c,l){const u=void 0===e.tt?0:nt(e.tt,`${r}.tt`),f=function(e,t,n,o,s,r,i){const a=Je(e).map((e,t)=>({mask:Xe(e),sourceIndex:t})).filter(e=>!0!==e.mask.hd&&"n"!==e.mask.mode);if(0===a.length)return{nodes:[]};const c=a.filter(({mask:e,sourceIndex:t})=>!(void 0!==e.mode&&!["a","s","i","f"].includes(String(e.mode)))||(it(o,"W_LOTTIE_MASK_MODE",`${n}.masksProperties[${t}].mode`,`Mask mode "${String(e.mode)}" is not recognized.`),!1));if(0===c.length)return{nodes:[]};const l=[],u=[];for(let e=0;e<c.length;e++){const{mask:s,sourceIndex:r}=c[e],i=`${n}.masksProperties[${r}]`,a=`${t}:mask:${o.shapeCounter++}`,f=st(Ve(s.o,100)/100,0,1),p=Ue(s.f,[0,0]),d=Ve(s.x,0),m=Ne(s.x,o,`${i}.x`,e=>[e[0]??0]);qe(s.f)&&it(o,"W_LOTTIE_ANIMATED_MASK_FEATHER",`${i}.f`,"Animated mask feather is sampled at its initial value.");const h=qe(s.pt),g=qe(s.o),y=[],v=[];if(h||g){const n=`${t}:mask-entry:${o.shapeCounter++}`,r={id:n,name:`${t} mask ${e}`,parent:a,transform:{opacity:f}};g&&We(s.o,n,"opacity",o,e=>[st((e[0]??100)/100,0,1)],`${i}.o`);const c=ke(s.pt,[1,1,1,1],`${i}.pt`,o);c&&(r.components=[c]),v.push(r)}else{const e=ke(s.pt,[1,1,1,f],`${i}.pt`,o);e&&y.push(e)}0===y.length&&0===v.length||(l.push({id:a,name:`${t} mask ${e}`,parent:t,...y.length>0?{components:y}:{}},...v),u.push({kind:"mask",source:a,mode:!0===s.inv?"alpha-inverted":"alpha",operation:"s"===s.mode?"subtract":"i"===s.mode?"intersect":"f"===s.mode?"difference":"add",...p.some(e=>Math.abs(e)>1e-6)?{feather:[Math.abs(p[0]??0),Math.abs(p[1]??p[0]??0)]}:{},...Math.abs(d)>1e-6?{expansion:d}:{},...m?{expansionTrack:m}:{}}))}if(0===u.length)return{nodes:[]};const f=function(e,t,n,o,s,r){const i=[...e],a=[];let c;for(;i.length+(c?1:0)>t;){const e=c?7:8,t=[...c?[{kind:"mask",source:c,mode:"alpha",operation:"add"}]:[],...i.splice(0,e)],l=`${n}:mask-stack:${o.shapeCounter++}`;a.push({id:l,name:`${n} mask stack`,composite:ve(t),components:[{type:"shape2d",shape:"rect",size:[s,r],position:[s/2,r/2],fill:[1,1,1,1]}]}),c=l}return{layers:[...c?[{kind:"mask",source:c,mode:"alpha",operation:"add"}]:[],...i],nodes:a}}(u,s,t,o,r,i);return l.push(...f.nodes),{value:ve(f.layers),nodes:l}}(e.masksProperties,s,r,a,u>0?7:8,c,l);if(0===u)return f;if(u<1||u>4)return it(a,"W_LOTTIE_UNSUPPORTED_MATTE",`${r}.tt`,`Track matte type ${u} is not supported.`),f;const p=void 0===e.tp?void 0:nt(e.tp,`${r}.tp`),d=Xe(n[t-1]),m=p??(t>0?nt(d.ind??t,`${i}[${t-1}].ind`):void 0),h=void 0===m?void 0:o.get(m);if(!h)return it(a,"W_LOTTIE_MISSING_MATTE_SOURCE",`${r}.tt`,"Track matte source layer was not found immediately before the target layer."),f;const g={kind:"matte",source:h,mode:2===u?"alpha-inverted":3===u?"luma":4===u?"luma-inverted":"alpha",operation:f.value?"intersect":"add"};return{value:ve([...Te(f.value),g]),nodes:f.nodes}}function ve(e){if(1!==e.length)return{layers:e};const t=e[0];return void 0===t.operation||"add"===t.operation?{kind:t.kind,source:t.source,mode:t.mode,...t.feather?{feather:t.feather}:{},...void 0===t.expansion?{}:{expansion:t.expansion},...void 0===t.expansionTrack?{}:{expansionTrack:t.expansionTrack}}:t}function Te(e){return e?"layers"in e?e.layers:[e]:[]}function ke(e,t,n,o){if(qe(e)){const s=o.diagnostics.length,r=$e(e,n,o);if(r)return o.usesPathMorphExtension=!0,{type:x,...r,fill:t,fillRule:"nonzero"};o.diagnostics.slice(s).some(e=>"W_LOTTIE_PATH_TOPOLOGY"===e.code)||it(o,"W_LOTTIE_ANIMATED_PATH",n,"Animated path cannot be represented and is sampled at its initial value.")}const s=Oe(Se(e),n,o);return s?{type:"path2d",...s,fill:t,fillRule:"nonzero"}:null}function $e(e,t,n,o=!0){const s=Je(Xe(e).k).map(Xe),r=[],i=[],a=[];let c=null;for(let e=0;e<s.length;e++){const o=s[e],l=Xe(Je(o.s)[0]??o.s??Je(s[e-1]?.e)[0]??c);if(0===Object.keys(l).length)continue;const u=Math.fround(st(ze(n.timeline,et(o.t,`${t}.k[${e}].t`)),0,n.duration));r.length>0&&u<=r.at(-1)||(r.push(u),i.push(l),a.push(o),c=Xe(Je(o.e)[0]??o.e??l))}if(0===r.length)return null;const l=function(e,t,n,o){const s=[];for(let r=0;r<e.length;r++){const i=_e(e[r],o);if(!i)return it(n,"W_LOTTIE_INVALID_PATH",`${t}.k[${r}].s`,"Animated path requires matching vertices and tangent arrays."),null;s.push(i)}const r=s[0].closed;if(s.some(e=>e.closed!==r))return it(n,"W_LOTTIE_PATH_TOPOLOGY",t,"Animated path changes between open and closed topology."),null;const i=Math.max(...s.map(e=>e.segments.length));if(i<1||i>w)return it(n,"W_LOTTIE_PATH_TOPOLOGY",t,`Animated path requires ${i} canonical segments; the safe budget is 256.`),null;const a=s.map(e=>function(e,t){const n=[...e.segments];for(;n.length<t;){let e=0,t=-1/0;for(let o=0;o<n.length;o++){const s=n[o],r=Le(s.start,s.control1)+Le(s.control1,s.control2)+Le(s.control2,s.end);r>t&&(e=o,t=r)}n.splice(e,1,...Ee(n[e]))}return{closed:e.closed,segments:n}}(e,i)),c=a[0];for(let e=1;e<a.length;e++)a[e]=be(a[e],c);return{commands:`M${"C".repeat(i)}${r?"Z":""}`,frames:a.map(e=>[...e.segments[0].start,...e.segments.flatMap(e=>[...e.control1,...e.control2,...e.end])])}}(i,t,n,o);if(!l)return null;const u=l.frames.flatMap(e=>e.map(Ae)),f=l.commands,p=l.frames[0].length,d=a.length>1&&a.slice(0,-1).every(e=>1===e.h)?"step":r.length>1?"cubic-bezier":"linear",m=[];if("cubic-bezier"===d)for(let e=0;e<r.length-1;e++){const t=a[e],n=Xe(t.o),o=Xe(t.i);m.push(st(Qe(n.x,.333),0,1),Qe(n.y,.333),st(Qe(o.x,.667),0,1),Qe(o.y,.667))}return{commands:f,times:r,values:u,valueSize:p,interpolation:d,...m.length>0?{easings:m}:{},tolerance:.35}}function _e(e,t){const n=Pe(e.v),o=Re(e.i,n.length),s=Re(e.o,n.length);if(n.length<2||o.length!==n.length||s.length!==n.length)return null;const r=!1!==e.c,i=r||t,a=i?n.length:n.length-1,c=[];for(let e=0;e<a;e++){const t=(e+1)%n.length,i=n[e],a=n[t],l=r||0!==t;c.push({start:i,control1:l?[i[0]+s[e][0],i[1]+s[e][1]]:i,control2:l?[a[0]+o[t][0],a[1]+o[t][1]]:a,end:a})}return{closed:i,segments:c}}function Ee(e){const t=Ie(e.start,e.control1),n=Ie(e.control1,e.control2),o=Ie(e.control2,e.end),s=Ie(t,n),r=Ie(n,o),i=Ie(s,r);return[{start:e.start,control1:t,control2:s,end:i},{start:i,control1:r,control2:o,end:e.end}]}function be(e,t){let n=e;if(e.closed){Math.sign(xe(n))!==Math.sign(xe(t))&&(n=Me(n));let e=0,o=1/0;for(let s=0;s<n.segments.length;s++){let r=0;for(let e=0;e<t.segments.length;e++)r+=we(t.segments[e].start,n.segments[(e+s)%n.segments.length].start);r<o&&(o=r,e=s)}return e>0&&(n={closed:!0,segments:[...n.segments.slice(e),...n.segments.slice(0,e)]}),n}const o=we(t.segments[0].start,n.segments[0].start)+we(t.segments.at(-1).end,n.segments.at(-1).end);return we(t.segments[0].start,n.segments.at(-1).end)+we(t.segments.at(-1).end,n.segments[0].start)<o?Me(n):n}function Me(e){return{closed:e.closed,segments:[...e.segments].reverse().map(e=>({start:e.end,control1:e.control2,control2:e.control1,end:e.start}))}}function xe(e){let t=0;for(const n of e.segments)t+=n.start[0]*n.end[1]-n.end[0]*n.start[1];return t/2}function Ie(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Le(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function we(e,t){const n=e[0]-t[0],o=e[1]-t[1];return n*n+o*o}function Ae(e){return Math.round(e/L)*L}function Oe(e,t,n,o=!0,s=!0){const r=Pe(e.v),i=Re(e.i,r.length),a=Re(e.o,r.length);if(r.length<2||i.length!==r.length||a.length!==r.length)return o&&it(n,"W_LOTTIE_INVALID_PATH",t,"Path requires matching vertex, incoming-tangent and outgoing-tangent arrays."),null;let c="M";const l=[...r[0]],u=!1!==e.c,f=u?r.length:r.length-1;for(let e=0;e<f;e++){const t=e,n=(e+1)%r.length,o=r[t],s=r[n],u=[o[0]+a[t][0],o[1]+a[t][1]],f=[s[0]+i[n][0],s[1]+i[n][1]];Ce(u,o)&&Ce(f,s)?(c+="L",l.push(...s)):(c+="C",l.push(...u,...f,...s))}return!u&&s&&(o&&it(n,"W_LOTTIE_OPEN_FILLED_PATH",t,"Open filled path is closed with a straight segment."),c+="L",l.push(...r[0])),(u||s)&&(c+="Z"),{commands:c,values:l}}function Se(e){const t=Xe(e);if(qe(t)){const e=Xe(Je(t.k)[0]);return Xe(Je(e.s)[0]??e.s)}return Xe(t.k??e)}function Pe(e){return Je(e).map(e=>{const t=Ke(e);return[t[0]??0,t[1]??0]})}function Re(e,t){const n=Pe(e);return 0===n.length&&t>0?Array.from({length:t},()=>[0,0]):n}function Ce(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function We(e,t,n,o,s,r){const i=Ne(e,o,r,s);i&&o.tracks.push({node:t,property:n,interpolation:i.interpolation,times:i.times,values:i.values,...i.easings?{easings:i.easings}:{},..."position"===n&&i.spatialTangents?{spatialTangents:i.spatialTangents}:{}})}function Ne(e,t,n,o){if(!qe(e))return;const s=Je(Xe(e).k).map(Xe),r=[],i=[],a=[];let c=null;for(let e=0;e<s.length;e++){const l=s[e],u=et(l.t,`${n}.k[${e}].t`),f=Ke(l.s),p=f.length>0?f:c??Ke(s[e-1]?.e);if(0===p.length)continue;const d=Math.fround(st(ze(t.timeline,u),0,t.duration));if(r.length>0&&d<=r[r.length-1])continue;const m=o(p);r.push(d),i.push(...m),a.push(l),c=Ke(l.e).length>0?Ke(l.e):p}if(r.length<1)return void it(t,"W_LOTTIE_EMPTY_TRACK",n,"Animated property contains no usable keyframes.");if(a.length>1&&a.slice(0,-1).every(e=>1===e.h))return{times:r,values:i,valueSize:i.length/r.length,interpolation:"step"};const l=[],u=[];let f=!1;for(let e=0;e<r.length-1;e++){const t=a[e],n=Xe(t.o),o=Xe(t.i);if(l.push(st(Qe(n.x,.333),0,1),Qe(n.y,.333),st(Qe(o.x,.667),0,1),Qe(o.y,.667)),i.length/r.length===2){const n=Ke(t.to),o=Ke(t.ti),s=[...n,...o].some(e=>Math.abs(e)>1e-8);if(f||=s,s)u.push(n[0]??0,n[1]??0,o[0]??0,o[1]??0);else{const t=2*e,n=((i[t+2]??i[t]??0)-(i[t]??0))/3,o=((i[t+3]??i[t+1]??0)-(i[t+1]??0))/3;u.push(n,o,-n,-o)}}}return{times:r,values:i,valueSize:i.length/r.length,interpolation:r.length>1?"cubic-bezier":"linear",...r.length>1?{easings:l}:{},...r.length>1&&f?{spatialTangents:u}:{}}}function ze(e,t){return e.mapFrameToSeconds?.(t)??e.secondsOffset+t*e.secondsPerFrame}function Fe(e,t,n,o,s){let r=0,i=1;for(let n=0;n<16;n++){const n=(r+i)/2;De(n,t,o)<e?r=n:i=n}return De((r+i)/2,n,s)}function De(e,t,n){const o=1-e;return 3*o*o*e*t+3*o*e*e*n+e*e*e}function He(e,t,n,o){const s=et(e.sr??1,`${t}.sr`);if(Math.abs(s-1)<1e-8)return n;if(s<=0)return it(o,"W_LOTTIE_INVALID_TIME_STRETCH",`${t}.sr`,"Layer time stretch must be greater than zero."),n;const r=et(e.st??e.ip??0,`${t}.st`),i=e=>ze(n,r+(e-r)*s);return{frameRate:n.frameRate,secondsOffset:i(0),secondsPerFrame:n.secondsPerFrame*s,mapFrameToSeconds:i}}function je(e,t,n,o){const s=Math.min(o,Math.max(1e-6,n.secondsPerFrame)),r=ze(n,e),i=ze(n,t),a=st(r,0,Math.max(0,o-s)),c=st(i,a+s,o);return{start:a,duration:Math.max(s,c-a)}}function qe(e){const t=Xe(e);if(!Array.isArray(t.k))return!1;if(1===t.a)return!0;const n=Xe(t.k[0]);return"number"==typeof n.t&&Number.isFinite(n.t)&&(void 0!==n.s||void 0!==n.e)}function Ue(e,t){const n=Xe(e);if(qe(n))return Ke(Xe(Je(n.k)[0]).s).length>0?Ke(Xe(Je(n.k)[0]).s):t;const o=Ke(n.k);return o.length>0?o:t}function Ge(e,t){const n=Xe(e);return(qe(n)?Je(n.k).flatMap(e=>{const t=Xe(e);return[Ke(t.s),Ke(t.e)]}):[Ke(n.k)]).find(e=>e.length>=t&&e.slice(0,t).every(e=>e>0))}function Ve(e,t){return Ue(e,[t])[0]??t}function Ye(e,t){if("string"!=typeof e||!/^#[0-9a-f]{6}$/i.test(e))throw new TypeError(`Expected #RRGGBB at ${t}.`);const n=Number.parseInt(e.slice(1),16);return[(n>>16&255)/255,(n>>8&255)/255,(255&n)/255,1]}function Ze(e,t){if(!e)return t;try{return new URL(t,e).toString()}catch{return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}}function Be(e){return Xe(JSON.parse(e))}function Xe(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function Je(e){return Array.isArray(e)?e:[]}function Ke(e){if("number"==typeof e&&Number.isFinite(e))return[e];if(!Array.isArray(e))return[];return(1===e.length&&Array.isArray(e[0])?e[0]:e).filter(e=>"number"==typeof e&&Number.isFinite(e))}function Qe(e,t){return Ke(e)[0]??t}function et(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError(`Expected a finite number at ${t}.`);return e}function tt(e,t){const n=et(e,t);if(n<=0)throw new TypeError(`Expected a positive number at ${t}.`);return n}function nt(e,t){const n=et(e,t);if(!Number.isSafeInteger(n))throw new TypeError(`Expected an integer at ${t}.`);return n}function ot(e){return e*Math.PI/180}function st(e,t,n){return Math.min(n,Math.max(t,e))}function rt(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 it(e,t,n,o){e.diagnostics.push(Object.freeze({severity:"warning",code:t,path:n,message:o}))}export{A as convertLottie,S as convertLottieDocument,O as inspectLottieFonts};//# sourceMappingURL=lottie.js.map
1
+ import{p as e,H as t,e as n,a as o,d as s}from"./chunks/expression-sAWA2ssN.js";import r from"polygon-clipping/dist/polygon-clipping.esm.js";import"./chunks/errors-Bzs3GOD9.js";const i=r;function a(e,t){const n=e.flat();if(1===t)return 0===n.length?null:{commands:n.map(e=>e.commands).join(""),values:n.flatMap(e=>Array.from(e.values))};const o=e.map(u).filter(e=>e.length>0);if(0===o.length)return null;const[s,...r]=o;return function(e){let t="";const n=[];for(const o of e)for(const e of o){const o=e.length>1&&h(e[0],e.at(-1))?e.slice(0,-1):e;o.length<3||(t+=`M${"L".repeat(o.length-1)}Z`,n.push(...o.flat()))}return t?{commands:t,values:n}:null}(2===t?i.union(s,...r):3===t?i.difference(s,...r):4===t?i.intersection(s,...r):i.xor(s,...r))}function c(e,t,n,o){const s=(n[0]??100)/100,r=(n[1]??100)/100,i=Math.cos(o),a=Math.sin(o),c=i*s,l=a*s,u=-a*r,f=i*r,p=t[0]??0,d=t[1]??0;return[c,l,u,f,(e[0]??0)-c*p-u*d,(e[1]??0)-l*p-f*d]}function l(e,t){const[n,o,s,r,i,a]=t,c=[];for(let t=0;t<e.values.length;t+=2){const l=e.values[t]??0,u=e.values[t+1]??0;c.push(n*l+s*u+i,o*l+r*u+a)}return{commands:e.commands,values:c}}function u(e){const t=e.flatMap(e=>function(e,t=.35){const n=[];let o=0,s=[],r=[0,0];const i=()=>[Number(e.values[o++]??0),Number(e.values[o++]??0)],a=()=>{s.length<3||(h(s[0],s.at(-1))||s.push([...s[0]]),Math.abs(function(e){let t=0;for(let n=0;n+1<e.length;n++)t+=e[n][0]*e[n+1][1]-e[n+1][0]*e[n][1];return t/2}(s))>1e-8&&n.push(s)),s=[]};for(const n of e.commands)if("M"===n)a(),r=i(),s.push(r);else if("L"===n)r=i(),s.push(r);else if("C"===n){const e=i(),n=i(),o=i();f(r,e,n,o,t,s),r=o}else if("Q"===n){const e=i(),n=i();p(r,e,n,t,s),r=n}else"Z"===n&&a();return a(),n}(e).map(e=>[e]));return t.length<=1?t:i.union(t[0],...t.slice(1))}function f(e,t,n,o,s,r,i=0){if(i>=10||Math.max(d(t,e,o),d(n,e,o))<=s)return void r.push(o);const a=m(e,t),c=m(t,n),l=m(n,o),u=m(a,c),p=m(c,l),h=m(u,p);f(e,a,u,h,s,r,i+1),f(h,p,l,o,s,r,i+1)}function p(e,t,n,o,s,r=0){if(r>=10||d(t,e,n)<=o)return void s.push(n);const i=m(e,t),a=m(t,n),c=m(i,a);p(e,i,c,o,s,r+1),p(c,a,n,o,s,r+1)}function d(e,t,n){const o=n[0]-t[0],s=n[1]-t[1],r=Math.hypot(o,s);return r<=1e-12?Math.hypot(e[0]-t[0],e[1]-t[1]):Math.abs(s*e[0]-o*e[1]+n[0]*t[1]-n[1]*t[0])/r}function m(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function h(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}class g extends Error{offset;constructor(e,t){super(e),this.offset=t,this.name="LottieTextExpressionCompileError"}}function y(e,t,n){if("identifier"===e.kind)return t.get(e.name)??null;if("member"===e.kind){const o=y(e.object,t,n);return o?"sourceData"===e.property?o:{resource:o.resource,path:[...o.path,e.property]}:null}if("call"!==e.kind)return null;if("member"===e.callee.kind&&"layer"===e.callee.property&&"identifier"===e.callee.object.kind&&"thisComp"===e.callee.object.name){const t=v(e,"thisComp.layer"),o=n.resolveDataLayer(t);if(!o)throw b(`Expression references unknown or non-data layer "${t}".`,e.offset);return{resource:o,path:[]}}const o=y(e.callee,t,n);if(!o)return null;const s=v(e,"Data Layer selector");return"Data"!==s&&"Outline"!==s||0!==o.path.length?{resource:o.resource,path:[...o.path,T(s)]}:o}function v(e,t){if(1!==e.arguments.length||"literal"!==e.arguments[0]?.kind||"string"!=typeof e.arguments[0].value)throw b(`${t} requires one static string argument.`,e.offset);return e.arguments[0].value}function T(e){const t=/^(.*) (\d+)$/.exec(e);return t&&t[1]?`${t[1]} ${t[2]}`:e}function k(e,t){const n={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","<":"less","<=":"less-equal",">":"greater",">=":"greater-equal","===":"equal","!==":"not-equal"}[e];if(!n)throw b(`Operator "${e}" is not supported.`,t);return n}class ${tokens;index=0;constructor(e){this.tokens=function(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];if(/\s/.test(o)){n++;continue}if("/"===o&&"/"===e[n+1]){for(n+=2;n<e.length&&"\n"!==e[n];)n++;continue}if("/"===o&&"*"===e[n+1]){const t=e.indexOf("*/",n+2);if(t<0)throw b("Unterminated block comment.",n);n=t+2;continue}if(/[A-Za-z_$]/.test(o)){const o=n++;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;t.push({kind:"identifier",value:e.slice(o,n),offset:o});continue}if(/\d/.test(o)||"."===o&&/\d/.test(e[n+1]??"")){const o=n++;for(;n<e.length&&/[0-9.eE+-]/.test(e[n]);){const t=e.slice(o,n+1);if(!/^(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d*)?$/.test(t))break;n++}const s=Number(e.slice(o,n));if(!Number.isFinite(s))throw b("Invalid numeric literal.",o);t.push({kind:"number",value:s,offset:o});continue}if('"'===o||"'"===o){const s=n++;let r="";for(;n<e.length&&e[n]!==o;){const t=e[n++];if("\\"!==t){r+=t;continue}if(n>=e.length)throw b("Unterminated string escape.",s);const o=e[n++],i={n:"\n",r:"\r",t:"\t",b:"\b",f:"\f",v:"\v",0:"\0","\\":"\\","'":"'",'"':'"'};if(o in i)r+=i[o];else{if("x"===o||"u"===o){const t="x"===o?2:4,s=e.slice(n,n+t);if(!new RegExp(`^[0-9a-fA-F]{${t}}$`).test(s))throw b("Invalid hexadecimal string escape.",n);r+=String.fromCharCode(Number.parseInt(s,16)),n+=t;continue}r+=o}}if(e[n]!==o)throw b("Unterminated string literal.",s);n++,t.push({kind:"string",value:r,offset:s});continue}const s=["===","!==","<=",">=","==","!=","&&","||"].find(t=>e.startsWith(t,n));if(s)t.push({kind:"operator",value:s,offset:n}),n+=s.length;else if("+-*/%<>=!".includes(o))t.push({kind:"operator",value:o,offset:n++});else{if(!"().,;?:".includes(o))throw b(`Token "${o}" is not permitted in safe expressions.`,n);t.push({kind:"punctuation",value:o,offset:n++})}}return t.push({kind:"eof",value:"",offset:e.length}),t}(e)}parseProgram(){const e=[];for(;"eof"!==this.peek().kind;)if("identifier"===this.peek().kind&&E.has(String(this.peek().value))?e.push(this.parseVariableStatement()):e.push({kind:"expression",expression:this.parseAssignment()}),";"===this.peek().value)this.take();else if("eof"!==this.peek().kind)throw b("Expected semicolon between expression statements.",this.peek().offset);return e}parseVariableStatement(){this.take();const e=[];for(;;){const t=this.expect("identifier");let n;if("="===this.peek().value&&(this.take(),n=this.parseAssignment()),e.push({name:String(t.value),...n?{initializer:n}:{},offset:t.offset}),","!==this.peek().value)break;this.take()}return{kind:"variable",declarations:e}}parseAssignment(){const e=this.parseConditional();if("="!==this.peek().value)return e;const t=this.take();if("identifier"!==e.kind)throw b("Only local identifier assignment is supported.",t.offset);return{kind:"assignment",target:e.name,value:this.parseAssignment(),offset:t.offset}}parseConditional(){const e=this.parseBinary(0);if("?"!==this.peek().value)return e;const t=this.take(),n=this.parseAssignment();return this.expectValue(":"),{kind:"conditional",test:e,consequent:n,alternate:this.parseAssignment(),offset:t.offset}}parseBinary(e){let t=this.parseUnary();for(;;){const n=this.peek(),o="string"==typeof n.value?_[n.value]:void 0;if(void 0===o||o<e)break;this.take(),t={kind:"binary",operator:String(n.value),left:t,right:this.parseBinary(o+1),offset:n.offset}}return t}parseUnary(){const e=this.peek();return"+"===e.value||"-"===e.value||"!"===e.value?(this.take(),{kind:"unary",operator:e.value,argument:this.parseUnary(),offset:e.offset}):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;){const t=this.peek();if("."===t.value){this.take();const n=this.expect("identifier");e={kind:"member",object:e,property:String(n.value),offset:t.offset};continue}if("("===t.value){this.take();const n=[];if(")"!==this.peek().value)for(;;){if(n.push(this.parseAssignment()),","!==this.peek().value)break;this.take()}this.expectValue(")"),e={kind:"call",callee:e,arguments:n,offset:t.offset};continue}return e}}parsePrimary(){const e=this.take();if("number"===e.kind||"string"===e.kind)return{kind:"literal",value:e.value,offset:e.offset};if("identifier"===e.kind)return"true"===e.value||"false"===e.value||"null"===e.value?{kind:"literal",value:"null"===e.value?null:"true"===e.value,offset:e.offset}:{kind:"identifier",name:String(e.value),offset:e.offset};if("("===e.value){const e=this.parseAssignment();return this.expectValue(")"),e}throw b(`Unexpected token "${String(e.value)}".`,e.offset)}peek(){return this.tokens[this.index]}take(){return this.tokens[this.index++]}expect(e){const t=this.take();if(t.kind!==e)throw b(`Expected ${e}.`,t.offset);return t}expectValue(e){const t=this.take();if(t.value!==e)throw b(`Expected "${e}".`,t.offset)}}const _={"||":1,"&&":2,"==":3,"!=":3,"===":3,"!==":3,"<":4,"<=":4,">":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},E=new Set(["var","let","const"]);function b(e,t){return new g(e,t)}const M="org.haiyue.vector-stroke@1",x="org.haiyue.vector-path-morph@1",I="org.haiyue.data-layer@1",L=1/64,w=256;function A(e,t={}){const r="string"==typeof e?Be(e):e,i=tt(r.fr,"$.fr"),a=et(r.ip??0,"$.ip"),c=et(r.op,"$.op");if(c<=a)throw new TypeError("Lottie op must be greater than ip.");const l=tt(r.w,"$.w"),u=tt(r.h,"$.h"),f=(c-a)/i,p={frameRate:i,secondsOffset:-a/i,secondsPerFrame:1/i},d=O(r,t.fonts),m=function(e,t){const n=new Map,o=[];for(const s of Je(Xe(e).list).map(Xe)){if("string"!=typeof s.fName||!s.fName)continue;const e=t.fonts?.[s.fName],r="string"==typeof e?{uri:e}:e,i=P("string"==typeof s.fStyle?s.fStyle:"Regular"),a={name:s.fName,family:r?.family??("string"==typeof s.fFamily&&s.fFamily?s.fFamily:s.fName),style:r?.style??i.style,weight:r?.weight??i.weight,...r?{resourceId:`font:${s.fName}`}:{}};n.set(s.fName,a),r&&o.push({id:a.resourceId,type:"binary",uri:r.uri,mimeType:r.mimeType??"font/woff2",...void 0===r.integrity?{}:{integrity:r.integrity}})}return{fonts:n,resources:o}}(r.fonts,t),h={frameRate:i,duration:f,diagnostics:[],tracks:[],timeline:p,shapeCounter:0,convertedLayerCount:0,skippedLayerCount:0,usesStrokeExtension:!1,usesPathMorphExtension:!1,usesVectorShapeExtension:!1,usesDataLayerExtension:!1,fonts:m.fonts,warnedFontSubstitutions:new Set},g=Je(r.layers),y=Je(r.assets),v=new Map;for(let e=0;e<y.length;e++){const t=Xe(y[e]);"string"==typeof t.id&&v.set(t.id,{value:t,index:e})}const T=C([g,...y.map(e=>Je(Xe(e).layers))],6),k=C([g,...y.map(e=>Je(Xe(e).layers))],15),$=[...R(r.assets,t,T,k),...m.resources],_=[];b(g,{listPath:"$.layers",idPrefix:"",timeline:p,compositionWidth:l,compositionHeight:u,precompStack:[]});const E={format:o,version:n,name:t.name??("string"==typeof r.nm?r.nm:"Converted Lottie"),canvas:{width:l,height:u,coordinateSystem:"screen-y-down"},duration:f,frameRate:i,endBehavior:"loop",resources:$,nodes:_,tracks:h.tracks,...h.usesStrokeExtension||h.usesPathMorphExtension||h.usesVectorShapeExtension||h.usesDataLayerExtension?{extensionsUsed:[...h.usesStrokeExtension?[M]:[],...h.usesPathMorphExtension?[x]:[],...h.usesVectorShapeExtension?[s]:[],...h.usesDataLayerExtension?[I]:[]]}:{}};if(t.strict&&h.diagnostics.length>0){const e=h.diagnostics[0];throw new TypeError(`Lottie conversion failed: ${e.message} (${e.path})`)}return Object.freeze({document:E,diagnostics:Object.freeze(h.diagnostics),convertedLayerCount:h.convertedLayerCount,skippedLayerCount:h.skippedLayerCount,fonts:d});function b(e,t){const n=h.timeline;h.timeline=t.timeline;try{const n=function(e,t){const n=new Map,o=new Set;for(let s=0;s<e.length;s++){const r=Xe(e[s]),i=nt(r.ind??s+1,`${t}[${s}].ind`);n.set(i,{layer:r,sourceIndex:s}),!0!==r.hd&&o.add(i)}const s=[...o];for(let e=0;e<s.length;e++){const r=s[e],i=n.get(r);if(!i||void 0===i.layer.parent)continue;const a=nt(i.layer.parent,`${t}[${i.sourceIndex}].parent`);n.has(a)&&!o.has(a)&&(o.add(a),s.push(a))}return o}(e,t.listPath),o=new Map,s=new Map;for(let r=0;r<e.length;r++){const i=Xe(e[r]),a=nt(i.ind??r+1,`${t.listPath}[${r}].ind`);n.has(a)&&(o.set(a,`${t.idPrefix}layer:${a}`),15===i.ty&&"string"==typeof i.nm&&"string"==typeof i.refId&&$.some(e=>e.id===i.refId&&"binary"===e.type)&&s.set(i.nm,i.refId))}for(let r=e.length-1;r>=0;r--){const i=Xe(e[r]),a=`${t.listPath}[${r}]`,c=nt(i.ind??r+1,`${a}.ind`);if(!n.has(c))continue;const l=o.get(c),u=nt(i.ty,`${a}.ty`),f=!0===i.hd,p=void 0===i.parent?void 0:nt(i.parent,`${a}.parent`),d=void 0===p?void 0:o.get(p);void 0===p||d||it(h,"W_LOTTIE_MISSING_PARENT",`${a}.parent`,`Parent layer ${p} was not found.`);const m=d??t.fallbackParent,g=0===u?t.timeline:He(i,a,t.timeline,h);h.timeline=g;try{const n=f?[]:fe(i.ef,a,h),c=null;f||ue(i,a,u,h);const p=z(i.ks,a,l,h),d=et(i.ip??0,`${a}.ip`),g=je(d,et(i.op??d+t.timeline.frameRate*h.duration,`${a}.op`),t.timeline,h.duration),y=f?{nodes:[]}:ye(i,r,e,o,l,a,t.listPath,h,t.compositionWidth,t.compositionHeight),v={id:l,name:"string"==typeof i.nm?i.nm:l,start:g.start,duration:g.duration,transform:p,...m?{parent:m}:{},...y.value?{composite:y.value}:{},...n.length>0?{effects:n}:{}};if(f){_.push(v),h.convertedLayerCount++;continue}if(0===u){_.push(v),_.push(...y.nodes),h.convertedLayerCount++,L(i,l,a,t);continue}if(1===u){const e=tt(i.sw,`${a}.sw`),t=tt(i.sh,`${a}.sh`);_.push({...v,components:[{type:"shape2d",shape:"rect",size:[e,t],position:[e/2,t/2],fill:ge(Ye(i.sc,`${a}.sc`),c)}]}),_.push(...y.nodes),h.convertedLayerCount++;continue}if(2===u){const e="string"==typeof i.refId?i.refId:"",n=$.find(t=>t.id===e);if(n&&"image"===n.type){const o=[n.width??t.compositionWidth,n.height??t.compositionHeight];_.push({...v,components:[{type:"sprite2d",resource:e,size:o,position:[o[0]/2,o[1]/2]}]})}else it(h,"W_LOTTIE_MISSING_IMAGE",`${a}.refId`,`Image asset "${e}" was not found.`),_.push(v);_.push(...y.nodes),h.convertedLayerCount++;continue}if(3===u){_.push(v),_.push(...y.nodes),h.convertedLayerCount++;continue}if(4===u){_.push(v);const e=D(i.shapes,l,a,h,c);_.push(...e),_.push(...y.nodes),e.some(e=>(e.components?.length??0)>0)||H(i.shapes)||j(i.shapes)||it(h,"W_LOTTIE_EMPTY_SHAPE",`${a}.shapes`,"No supported filled vector shape was found."),h.convertedLayerCount++;continue}if(5===u){const e=W(i.t,a,t.compositionWidth,h,c,s);_.push(e?{...v,components:[e]}:v),_.push(...y.nodes),e?h.convertedLayerCount++:h.skippedLayerCount++;continue}if(6===u){const e="string"==typeof i.refId?i.refId:"",t=$.find(t=>t.id===e);t&&"audio"===t.type?_.push({...v,components:[{type:"audio",resource:e,volume:1,loop:!1}]}):(it(h,"W_LOTTIE_MISSING_AUDIO",`${a}.refId`,`Audio asset "${e}" was not found.`),_.push(v)),_.push(...y.nodes),h.convertedLayerCount++;continue}if(15===u){const e="string"==typeof i.refId?i.refId:"",t=$.find(t=>t.id===e);t&&"binary"===t.type?(h.usesDataLayerExtension=!0,_.push({...v,extensions:{[I]:{resource:e,mediaType:t.mimeType??"application/octet-stream"}}})):(it(h,"W_LOTTIE_MISSING_DATA",`${a}.refId`,`Data asset "${e}" was not found.`),_.push(v)),_.push(...y.nodes),h.convertedLayerCount++;continue}_.push(v),_.push(...y.nodes),h.skippedLayerCount++,it(h,"W_LOTTIE_UNSUPPORTED_LAYER",`${a}.ty`,`Layer type ${u} is preserved as a transform-only node.`)}finally{h.timeline=t.timeline}}}finally{h.timeline=n}}function L(e,t,n,o){const s="string"==typeof e.refId?e.refId:"",r=v.get(s);if(!r||!Array.isArray(r.value.layers))return h.skippedLayerCount++,void it(h,"W_LOTTIE_MISSING_PRECOMP",`${n}.refId`,`Precomposition asset "${s}" was not found.`);if(o.precompStack.includes(s))return h.skippedLayerCount++,void it(h,"W_LOTTIE_PRECOMP_CYCLE",`${n}.refId`,`Precomposition cycle detected for asset "${s}".`);const i=et(e.sr??1,`${n}.sr`);if(i<=0)return h.skippedLayerCount++,void it(h,"W_LOTTIE_INVALID_TIME_STRETCH",`${n}.sr`,"Precomposition time stretch must be greater than zero.");const a=et(e.st??0,`${n}.st`),c=tt(r.value.fr??o.timeline.frameRate,`$.assets[${r.index}].fr`),l={frameRate:c,secondsOffset:ze(o.timeline,a),secondsPerFrame:o.timeline.secondsPerFrame*o.timeline.frameRate/c*i},u=void 0!==e.tm&&qe(e.tm)?function(e,t,n,o,s){if(!qe(e))return it(s,"W_LOTTIE_TIME_REMAP",o,"Static time remapping cannot be represented by ordinary HYA transform tracks."),null;const r=Je(Xe(e).k).map(Xe);if(r.length<2)return it(s,"W_LOTTIE_TIME_REMAP",o,"Time remapping requires at least two scalar keyframes."),null;const i=[];for(let e=0;e<r.length;e++){const t=r[e];if("number"!=typeof t.t||!Number.isFinite(t.t))return it(s,"W_LOTTIE_TIME_REMAP",`${o}.k[${e}].t`,"Time-remap keyframe time must be finite."),null;const n=Qe(t.s,Number.NaN);Number.isFinite(n)&&i.push({frame:t.t,value:n})}if(i.length<1)return it(s,"W_LOTTIE_TIME_REMAP",o,"Time remapping contains no scalar keyframe values."),null;const a=et(r.at(-1).t,`${o}.k[${r.length-1}].t`),c=r[Math.max(0,r.length-2)],l=Qe(r.at(-1).s,Qe(c.e,i.at(-1).value));a>i.at(-1).frame&&i.push({frame:a,value:l});for(let e=1;e<i.length;e++)if(i[e].frame<=i[e-1].frame||i[e].value+1e-6<i[e-1].value)return it(s,"W_LOTTIE_TIME_REMAP",o,"Non-monotonic time remapping requires runtime time-warp support and was not converted."),null;const u=i[0],f=i.at(-1),p=e=>{if(e<=u.frame)return u.value;if(e>=f.frame)return f.value;let t=0;for(;t+1<i.length&&e>=i[t+1].frame;)t++;const n=i[t],o=i[t+1],s=r[Math.min(t,r.length-1)];if(1===s.h||o.frame<=n.frame)return n.value;const a=Fe(st((e-n.frame)/(o.frame-n.frame),0,1),st(Qe(Xe(s.o).x,.333),0,1),Qe(Xe(s.o).y,.333),st(Qe(Xe(s.i).x,.667),0,1),Qe(Xe(s.i).y,.667));return n.value+(o.value-n.value)*a},d=e=>{if(e<=u.value)return u.frame;if(e>=f.value)return f.frame;let t=u.frame,n=f.frame;for(let o=0;o<28;o++){const o=(t+n)/2;p(o)<e?t=o:n=o}return(t+n)/2};return{frameRate:n,secondsOffset:ze(t,u.frame),secondsPerFrame:t.secondsPerFrame,mapFrameToSeconds:e=>ze(t,d(e/n))}}(e.tm,o.timeline,c,`${n}.tm`,h)??l:l;b(Je(r.value.layers),{listPath:`$.assets[${r.index}].layers`,idPrefix:`${t}/`,fallbackParent:t,timeline:u,compositionWidth:tt(r.value.w??e.w??o.compositionWidth,`$.assets[${r.index}].w`),compositionHeight:tt(r.value.h??e.h??o.compositionHeight,`$.assets[${r.index}].h`),precompStack:[...o.precompStack,s]})}}function O(e,t={}){const n="string"==typeof e?Be(e):e,o=new Map,s=e=>{if(!e||"object"!=typeof e)return;if(Array.isArray(e)){for(const t of e)s(t);return}const t=e;"string"==typeof t.f&&"string"==typeof t.t&&o.set(t.f,(o.get(t.f)??0)+1);for(const e of Object.values(t))s(e)};s(n.layers),s(n.assets);const r=Je(Xe(n.fonts).list).map(Xe),i=new Set(r.map(e=>"string"==typeof e.fName?e.fName:"").filter(Boolean));for(const e of o.keys())i.has(e)||r.push({fName:e,fFamily:e,fStyle:"Regular"});return Object.freeze(r.flatMap(e=>{if("string"!=typeof e.fName||!e.fName)return[];const n=t?.[e.fName],s="string"==typeof n?{uri:n}:n,r="string"==typeof e.fFamily&&e.fFamily?e.fFamily:e.fName,i="string"==typeof e.fStyle?e.fStyle:"Regular",a=P(i);return[Object.freeze({name:e.fName,authoredFamily:r,authoredStyle:i,..."number"==typeof e.ascent&&Number.isFinite(e.ascent)?{authoredAscent:e.ascent}:{},usageCount:o.get(e.fName)??0,mapped:void 0!==s,resolvedFamily:s?.family??r,resolvedStyle:s?.style??a.style,resolvedWeight:s?.weight??a.weight,...s?{uri:s.uri,mimeType:s.mimeType??"font/woff2"}:{},...void 0===s?.integrity?{}:{integrity:s.integrity},...void 0===s?.metrics?{}:{metrics:Object.freeze({...s.metrics})}})]}))}function S(e,t={}){return A(e,t).document}function P(e){const t=e.toLowerCase().replace(/[_-]+/g," ").replace(/\s+/g," ").trim(),n=t.replace(/\s+/g,""),o=t.includes("italic")||t.includes("oblique")?"italic":"normal";let s=400;return/thin|hairline/.test(n)?s=100:/extralight|ultralight/.test(n)?s=200:/light/.test(n)?s=300:/extrabold|ultrabold/.test(n)?s=800:/semibold|demibold|demi/.test(n)?s=600:/bold/.test(n)?s=700:/black|heavy/.test(n)?s=900:/medium/.test(n)&&(s=500),{style:o,weight:s}}function R(e,t,n,o){const s=[],r=Je(e);for(let e=0;e<r.length;e++){const i=Xe(r[e]);if("string"!=typeof i.id||"string"!=typeof i.p)continue;const a="string"==typeof i.u?i.u:"",c=i.p.startsWith("data:")?i.p:Ze(t.imageBaseUrl??"",`${a}${i.p}`);if(n.has(i.id))s.push({id:i.id,type:"audio",uri:c});else if(o.has(i.id)){const e=3===i.t||/\.json(?:$|[?#])/i.test(i.p)?"application/json":"application/octet-stream";s.push({id:i.id,type:"binary",uri:c,mimeType:e})}else s.push({id:i.id,type:"image",uri:c,..."number"==typeof i.w&&i.w>0?{width:i.w}:{},..."number"==typeof i.h&&i.h>0?{height:i.h}:{}})}return s}function C(e,t){const n=new Set;for(const o of e)for(const e of o){const o=Xe(e);o.ty===t&&"string"==typeof o.refId&&n.add(o.refId)}return n}function W(n,o,s,r,i,a){const c=Xe(n),l=Xe(c.d).x;let u;if("string"==typeof l&&l.trim().length>0)try{u=function(n,o){const s=new $(n).parseProgram(),r=[],i=new Map,a=new Map;let c,l=-1;for(let e=s.length-1;e>=0;e--)if("expression"===s[e].kind){l=e;break}const u=(e,t)=>{const n=i.get(e);if(void 0!==n)return n;if(i.size>=16)throw b("Expression declares too many local variables.",t);const o=i.size;return i.set(e,o),o},f=e=>{const t=y(e,a,o);if(t){if(0===t.path.length)throw b("Data Layer references must select a primitive field.",e.offset);r.push({op:"data",resource:t.resource,path:t.path})}else switch(e.kind){case"literal":return void r.push({op:"constant",value:e.value});case"identifier":{if("time"===e.name)return void r.push({op:"time"});if("value"===e.name)return void r.push({op:"text"});const t=i.get(e.name);if(void 0===t)throw b(`Unknown expression identifier "${e.name}".`,e.offset);return void r.push({op:"local.get",index:t})}case"unary":return f(e.argument),void r.push({op:"unary",operator:"+"===e.operator?"positive":"-"===e.operator?"negative":"not"});case"binary":return f(e.left),f(e.right),void r.push({op:"binary",operator:k(e.operator,e.offset)});case"conditional":f(e.test);{const t=r.length;r.push({op:"branch.false",target:t+1}),f(e.consequent);const n=r.length;r.push({op:"jump",target:n+1}),r[t].target=r.length,f(e.alternate),r[n].target=r.length}return;case"call":return void p(e);case"assignment":throw b("Nested assignments are not supported.",e.offset);case"member":if("identifier"===e.object.kind&&"Math"===e.object.name&&("PI"===e.property||"E"===e.property))return void r.push({op:"constant",value:"PI"===e.property?Math.PI:Math.E});throw b(`Property "${e.property}" is not available in the safe expression profile.`,e.offset)}},p=e=>{if("identifier"===e.callee.kind&&"$bm_sum"===e.callee.name){if(2!==e.arguments.length)throw b("$bm_sum requires exactly two arguments.",e.offset);return f(e.arguments[0]),f(e.arguments[1]),void r.push({op:"binary",operator:"add"})}if("member"===e.callee.kind&&"toFixed"===e.callee.property){if(1!==e.arguments.length)throw b("toFixed requires exactly one digits argument.",e.offset);return f(e.callee.object),f(e.arguments[0]),void r.push({op:"call",function:"to-fixed",argc:2})}const t=function(e){return"identifier"===e.kind?e.name:"member"===e.kind&&"identifier"===e.object.kind&&"Math"===e.object.name?e.property:null}(e.callee),n=function(e){return e?{abs:"abs",min:"min",max:"max",clamp:"clamp",floor:"floor",ceil:"ceil",round:"round",sqrt:"sqrt",pow:"pow",sin:"sin",cos:"cos",tan:"tan",asin:"asin",acos:"acos",atan:"atan",atan2:"atan2",log:"log",exp:"exp",lerp:"lerp"}[e]??null:null}(t);if(!n)throw b(`Function "${t??"<dynamic>"}" is not available in the safe expression profile.`,e.offset);for(const t of e.arguments)f(t);r.push({op:"call",function:n,argc:e.arguments.length})};for(let e=0;e<s.length;e++){const t=s[e];if("variable"===t.kind){for(const e of t.declarations){if("$bm_rt"===e.name){c=u(e.name,e.offset),e.initializer&&(f(e.initializer),r.push({op:"local.set",index:c}));continue}if(e.initializer){const t=y(e.initializer,a,o);if(t){a.set(e.name,t);continue}}const t=u(e.name,e.offset);e.initializer?f(e.initializer):r.push({op:"constant",value:null}),r.push({op:"local.set",index:t})}continue}const n=t.expression;if("assignment"===n.kind){if("$bm_rt"===n.target){c=u(n.target,n.offset),f(n.value),r.push({op:"local.set",index:c});continue}const e=y(n.value,a,o);if(e){a.set(n.target,e);continue}const t=u(n.target,n.offset);f(n.value),r.push({op:"local.set",index:t});continue}f(n),e===l&&void 0===c||r.push({op:"pop"})}if(void 0!==c&&r.push({op:"local.get",index:c}),void 0===c&&l<0)throw b("Expression does not produce a result.",0);return r.push({op:"return"}),e({version:t,result:"text",localCount:i.size,instructions:r},"$.compiledExpression")}(l,{resolveDataLayer:e=>a.get(e)})}catch(e){it(r,"W_LOTTIE_TEXT_EXPRESSION",`${o}.t.d.x`,`Text document expression could not be lowered to safe HYA IR: ${e instanceof g?`${e.message} (source offset ${e.offset})`:e instanceof Error?e.message:String(e)}`)}const f=Je(Xe(c.d).k).map(Xe),p=[];for(let e=0;e<f.length;e++){const t=f[e],n=Xe(t.s);if("string"!=typeof n.t){it(r,"W_LOTTIE_INVALID_TEXT",`${o}.t.d.k[${e}].s`,"Text document has no string value.");continue}const s=N(n,ze(r.timeline,et(t.t??0,`${o}.t.d.k[${e}].t`)),r,i,`${o}.t.d.k[${e}].s`);p.length>0&&s.time<=p[p.length-1].time?it(r,"W_LOTTIE_TEXT_DOCUMENT_TIME",`${o}.t.d.k[${e}].t`,"Duplicate or reversed text document time was omitted."):p.push(s)}const d=p[0];if(!d)return it(r,"W_LOTTIE_INVALID_TEXT",`${o}.t.d`,"Text layer has no usable text document."),null;const m=Ke(Xe(f[0]?.s).sz),h=m[0]&&m[0]>0?m[0]:Math.min(s,Math.max(64,Math.max(...p.map(e=>e.text.length))*(d.fontSize??32)*.7)),v=m[1]&&m[1]>0?m[1]:1.35*(d.lineHeight??1.2*(d.fontSize??32)),T=function(e,t,n,o){const s=[],r=Je(e).map(Xe);for(let e=0;e<r.length;e++){const i=r[e],a=`${n}[${e}]`,c=Xe(i.s),l=void 0===c.t?0:nt(c.t,`${a}.s.t`),u=void 0===c.b?1:nt(c.b,`${a}.s.b`);if(0!==l){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.t`,"Expression text selectors are not executed; use an offline bake or a range selector.");continue}const f=[void 0,"characters","characters-excluding-spaces","words","lines"][u];if(!f){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.b`,`Text selector based-on mode ${u} is not supported.`);continue}const p=[["xe",c.xe],["ne",c.ne],["sm",c.sm]].find(([,e])=>qe(e));if(p){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.${p[0]}`,"Animated selector easing or smoothness requires offline baking.");continue}const d=2===c.r?"index":"percent",m=e=>["percent"===d?(e[0]??0)/100:e[0]??0],h=c.s,g=c.e,y=c.o,v=c.a,T=m([Ve(h,0)])[0],k=m([Ve(g,"percent"===d?100:0)])[0],$=m([Ve(y,0)])[0],_=st(Ve(v,100)/100,-1,1),E=void 0===c.sh?1:nt(c.sh,`${a}.s.sh`),b=["square","square","ramp-up","ramp-down","triangle","round","smooth"][E];if(!b){it(o,"W_LOTTIE_TEXT_SELECTOR",`${a}.s.sh`,`Range selector shape ${E} is not supported.`);continue}const M=st(Ve(c.xe,0),-100,100)/100,x=st(Ve(c.ne,0),-100,100)/100,I=[x>0?x:0,x<0?-x:0,M>0?1-M:1,M<0?1+M:1],L=st(Ve(c.sm,100)/100,0,1),w=1===c.rn?rt(a):void 0,A=Xe(i.a),O=Ue(A.p,[0,0]),S=Ue(A.s,[100,100]),P=Ue(A.fc,[1,1,1]),R=Ne(h,o,`${a}.s.s`,m),C=Ne(g,o,`${a}.s.e`,m),W=Ne(y,o,`${a}.s.o`,m),N=Ne(v,o,`${a}.s.a`,e=>[st((e[0]??100)/100,-1,1)]),z=Ne(A.p,o,`${a}.a.p`,e=>[e[0]??0,e[1]??0]),F=Ne(A.s,o,`${a}.a.s`,e=>[(e[0]??100)/100,(e[1]??100)/100]),D=Ne(A.r,o,`${a}.a.r`,e=>[ot(e[0]??0)]),H=Ne(A.o,o,`${a}.a.o`,e=>[st((e[0]??100)/100,0,1)]),j=Ne(A.fc,o,`${a}.a.fc`,e=>[st(e[0]??1,0,1),st(e[1]??1,0,1),st(e[2]??1,0,1),1]),q=Ne(A.t,o,`${a}.a.t`,e=>[(e[0]??0)*t/1e3]);s.push({selector:{start:T,end:k,offset:$,units:d,amount:_,shape:b,basedOn:f,...0===I[0]&&0===I[1]&&1===I[2]&&1===I[3]?{}:{easing:I},...1===L?{}:{smoothness:L},...void 0===w?{}:{randomSeed:w},...R?{startTrack:R}:{},...C?{endTrack:C}:{},...W?{offsetTrack:W}:{},...N?{amountTrack:N}:{}},...void 0===A.p?{}:{position:[O[0]??0,O[1]??0]},...void 0===A.s?{}:{scale:[(S[0]??100)/100,(S[1]??100)/100]},...void 0===A.r?{}:{rotation:ot(Ve(A.r,0))},...void 0===A.o?{}:{opacity:st(Ve(A.o,100)/100,0,1)},...void 0===A.fc?{}:{fillColor:[st(P[0]??1,0,1),st(P[1]??1,0,1),st(P[2]??1,0,1),1]},...void 0===A.t?{}:{tracking:Ve(A.t,0)*t/1e3},...z?{positionTrack:z}:{},...F?{scaleTrack:F}:{},...D?{rotationTrack:D}:{},...H?{opacityTrack:H}:{},...j?{fillColorTrack:j}:{},...q?{trackingTrack:q}:{}})}return s}(c.a,d.fontSize??32,`${o}.t.a`,r);return{type:"text2d",text:d.text,size:[h,v],...void 0===d.fontFamily?{}:{fontFamily:d.fontFamily},...void 0===d.fontSize?{}:{fontSize:d.fontSize},...void 0===d.fontWeight?{}:{fontWeight:d.fontWeight},...void 0===d.fontStyle?{}:{fontStyle:d.fontStyle},...void 0===d.fontResource?{}:{fontResource:d.fontResource},...void 0===d.lineHeight?{}:{lineHeight:d.lineHeight},...void 0===d.tracking?{}:{tracking:d.tracking},...void 0===d.textAlign?{}:{textAlign:d.textAlign},verticalAlign:"middle",color:d.color??[1,1,1,1],...p.length>1?{documents:p}:{},...T.length>0?{animators:T}:{},...u?{expression:u}:{}}}function N(e,t,n,o,s){const r="number"==typeof e.s&&e.s>0?e.s:32,i="string"==typeof e.f?e.f:"",a=n.fonts.get(i);!i||a?.resourceId||n.warnedFontSubstitutions.has(i)||(n.warnedFontSubstitutions.add(i),it(n,"W_LOTTIE_FONT_SUBSTITUTION",`${s}.f`,`Font "${i}" has no mapped web-font resource; the original family, style and weight are preserved and the browser may use a system fallback.`));const c=Ke(e.fc),l="number"==typeof e.j?e.j:2;return{time:Math.max(0,t),text:e.t,fontFamily:a?.family??(i||"sans-serif"),fontSize:r,fontWeight:a?.weight??400,fontStyle:a?.style??"normal",...void 0===a?.resourceId?{}:{fontResource:a.resourceId},lineHeight:"number"==typeof e.lh&&e.lh>0?e.lh:1.2*r,tracking:et(e.tr??0,`${s}.tr`)*r/1e3,textAlign:0===l?"left":1===l?"right":"center",color:ge([st(c[0]??1,0,1),st(c[1]??1,0,1),st(c[2]??1,0,1),1])}}function z(e,t,n,o){return F(Xe(e),`${t}.ks`,n,o)}function F(e,t,n,o){const s=Ue(e.p,[0,0]),r=Ue(e.s,[100,100]),i=Ue(e.a,[0,0]),a=Ve(e.r??e.rz,0),c=Ve(e.o,100);return We(e.p,n,"position",o,e=>[e[0]??0,e[1]??0],`${t}.p`),We(e.s,n,"scale",o,e=>[(e[0]??100)/100,(e[1]??100)/100],`${t}.s`),We(e.r??e.rz,n,"rotation",o,e=>[ot(e[0]??0)],`${t}.r`),We(e.o,n,"opacity",o,e=>[st((e[0]??100)/100,0,1)],`${t}.o`),qe(e.a)&&it(o,"W_LOTTIE_ANIMATED_ANCHOR",`${t}.a`,"Animated anchor points are sampled at their initial value."),{position:[s[0]??0,s[1]??0],rotation:ot(a),scale:[(r[0]??100)/100,(r[1]??100)/100],anchor:[i[0]??0,i[1]??0],opacity:st(c/100,0,1)}}function D(e,t,n,o,s){const r=[];return function e(n,s,i,a,c){const l=[],u=[];for(let e=0;e<n.length;e++){const t=Xe(n[e]);if(!0===t.hd)continue;if("fl"===t.ty&&l.push({index:e,paint:{kind:"fill",fill:X(t,`${c}[${e}]`,o),fillRule:2===t.r?"evenodd":"nonzero"}}),"gf"===t.ty&&l.push({index:e,paint:{kind:"fill",fill:J(t,`${c}[${e}]`,o),fillRule:2===t.r?"evenodd":"nonzero"}}),"st"===t.ty){const n=re(t,`${c}[${e}]`,o);n&&l.push({index:e,paint:{kind:"stroke",stroke:n}})}if("gs"===t.ty){const n=Q(t,`${c}[${e}]`,o);n&&l.push({index:e,paint:{kind:"stroke",stroke:n}})}const s=oe(t,`${c}[${e}]`,o);s&&u.push({index:e,modifier:s})}const f=e=>[...s,...l.filter(t=>t.index>e).map(e=>e.paint)],p=e=>[...u.filter(t=>t.index>e).map(e=>e.modifier),...i],d=function(e,t,n){const o=new Map;let s=0;for(let r=0;r<e.length;r++){const i=Xe(e[r]);if("mm"!==i.ty||!0===i.hd)continue;const a=`${t}[${r}]`,c=[];let l;for(let t=s;t<r;t++){const n=Xe(e[t]);!0!==n.hd&&(Y(n.ty)?c.push(t):["tm","rd","rp","pb","zz","op","tw"].includes(String(n.ty))&&(l=String(n.ty)))}if(s=r+1,0===c.length){it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,"Merge Paths has no preceding path geometry to combine.");continue}if(l){it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,`Merge Paths cannot yet bake the preceding "${l}" modifier.`);continue}const u="number"==typeof i.mm&&Number.isInteger(i.mm)?i.mm:1;if(u<1||u>5){it(n,"W_LOTTIE_MERGE_PATH_INPUT",`${a}.mm`,`Unknown Merge Paths mode "${String(i.mm)}".`);continue}const f=c.map(o=>Z(Xe(e[o]),`${t}[${o}]`,n));if(f.some(e=>e.animated)){const s=1===u?G(e,c,t,n):void 0;s?o.set(r,{inputIndices:c,prepared:s}):it(n,"W_LOTTIE_ANIMATED_MERGE_PATH",a,1===u?"Animated Merge Paths could not be baked into a stable compound morph.":`Animated Merge Paths mode ${u} requires time-varying boolean topology and remains unmerged.`);continue}const p=f.find(e=>e.unsupportedReason)?.unsupportedReason;if(p)it(n,"W_LOTTIE_MERGE_PATH_INPUT",a,p);else try{o.set(r,{inputIndices:c,...B(f,u)??{}})}catch(e){it(n,"W_LOTTIE_MERGE_PATH_GEOMETRY",a,`Static Merge Paths boolean failed: ${e instanceof Error?e.message:String(e)}`)}}return o}(n,c,o),m=new Set([...d.values()].flatMap(e=>e.inputIndices));for(let s=0;s<n.length;s++){const i=Xe(n[s]),l=`${c}[${s}]`;if(!0===i.hd)continue;if(m.has(s))continue;if("mm"===i.ty){const e=d.get(s);if(!e)continue;const n=f(s).flatMap(t=>e.prepared?te(e.prepared,t,p(s),o):e.path?ne(e.path,t,p(s),o):[]);if(0===n.length)continue;const c=`${t}:shape:${o.shapeCounter++}`;r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,components:n});continue}if("gr"===i.ty){const n=Je(i.it),c=n.findIndex(e=>"tr"===Xe(e).ty),u=`${t}:group:${o.shapeCounter++}`,d={id:u,name:"string"==typeof i.nm?i.nm:u,parent:a};if(c>=0){const e=Xe(n[c]);d.transform=F(e,`${l}.it[${c}]`,u,o),(qe(e.sk)||qe(e.sa)||Math.abs(Ve(e.sk,0))>1e-6||Math.abs(Ve(e.sa,0))>1e-6)&&it(o,"W_LOTTIE_GROUP_SKEW",`${l}.it[${c}]`,"Shape group skew is not converted.")}r.push(d),e(n,f(s),p(s),u,`${l}.it`);continue}if("sh"===i.ty){const e=ee(i.ks,`${l}.ks`,o),n=e?f(s).flatMap(t=>te(e,t,p(s),o)):[];if(0===n.length)continue;const c=`${t}:shape:${o.shapeCounter++}`;r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,components:n});continue}if("sr"===i.ty){const e=f(s);if(0===e.length)continue;const n=le(i,l,o);if(!n)continue;const c=`${t}:shape:${o.shapeCounter++}`,u=Ue(i.p,[0,0]),d=Ve(i.r,0);We(i.p,c,"position",o,e=>[e[0]??0,e[1]??0],`${l}.p`),We(i.r,c,"rotation",o,e=>[ot(e[0]??0)],`${l}.r`),r.push({id:c,name:"string"==typeof i.nm?i.nm:c,parent:a,transform:{position:[u[0]??0,u[1]??0],rotation:ot(d)},components:e.flatMap(e=>ne(n,e,p(s),o))});continue}if("rc"!==i.ty&&"el"!==i.ty){["fl","gf","st","gs","tr","tm","rd","mm"].includes(String(i.ty))||it(o,"W_LOTTIE_UNSUPPORTED_SHAPE",`${l}.ty`,`Shape operator "${String(i.ty)}" is not converted.`);continue}const u=f(s);if(0===u.length)continue;const h=Ge(i.s,2)??Ue(i.s,[0,0]),g=Ue(i.p,[0,0]);if((h[0]??0)<=0||(h[1]??0)<=0){it(o,"W_LOTTIE_INVALID_SHAPE_SIZE",`${l}.s`,"Shape has no positive static size.");continue}const y=`${t}:shape:${o.shapeCounter++}`,v="rc"===i.ty?Math.max(0,Ve(i.r,0)):0,T="rc"===i.ty?ae(h[0],h[1],v):ce(h[0]/2,h[1]/2),k=u.flatMap(e=>ne(T,e,p(s),o));We(i.p,y,"position",o,e=>[e[0]??0,e[1]??0],`${l}.p`),We(i.s,y,"scale",o,e=>[(e[0]??h[0])/h[0],(e[1]??h[1])/h[1]],`${l}.s`),"rc"===i.ty&&qe(i.r)&&it(o,"W_LOTTIE_ANIMATED_ROUNDED_RECT",`${l}.r`,"Animated corner radius is sampled at its initial value."),r.push({id:y,name:"string"==typeof i.nm?i.nm:y,parent:a,transform:{position:[g[0]??0,g[1]??0]},components:k})}}(Je(e),[],[],t,`${n}.shapes`),r}function H(e){const t=[],n=e=>{for(const o of e){const e=Xe(o);!0!==e.hd&&("gr"===e.ty?n(Je(e.it)):"fl"!==e.ty&&"gf"!==e.ty&&"st"!==e.ty&&"gs"!==e.ty||t.push(e))}};return n(Je(e)),0!==t.length&&t.every(e=>{if(!((Ge(e.o,1)?.[0]??Ve(e.o,100))>0))return!0;if("st"===e.ty||"gs"===e.ty)return void 0===Ge(e.w,1);if("fl"===e.ty){return(Ue(e.c,[1,1,1,1])[3]??1)<=0}return!1})}function j(e){let t=0,n=!1;const o=e=>{for(const s of e){const e=Xe(s);!0!==e.hd&&("gr"!==e.ty?"sh"!==e.ty?"rc"!==e.ty&&"el"!==e.ty&&"sr"!==e.ty&&"mm"!==e.ty||(n=!0):(t++,q(e.ks)||(n=!0)):o(Je(e.it)))}};return o(Je(e)),t>0&&!n}function q(e){const t=Xe(e);if(!qe(t))return U(Se(e));const n=[];for(const e of Je(t.k).map(Xe))for(const t of[e.s,e.e]){if(void 0===t)continue;const e=Xe(Je(t)[0]??t);Object.keys(e).length>0&&n.push(e)}return n.length>0&&n.every(U)}function U(e){return Array.isArray(e.v)&&0===e.v.length&&Array.isArray(e.i)&&0===e.i.length&&Array.isArray(e.o)&&0===e.o.length}function G(e,t,n,o){const s=[];for(const r of t){const t=Xe(e[r]);if("sh"!==t.ty)return;const i=ee(t.ks,`${n}[${r}].ks`,o);if(!i)return;s.push(i)}if(0===s.length)return;const r=s.map(e=>e.commands).join(""),i=s.filter(e=>void 0!==e.morph);if(0===i.length)return{sourcePath:n,commands:r,values:s.flatMap(e=>e.values),closed:s.every(e=>e.closed)};const a=Math.min(...i.map(e=>e.morph.times[0])),c=Math.max(...i.map(e=>e.morph.times.at(-1))),l=new Set;for(const e of i)for(const t of e.morph.times)l.add(Math.fround(t));const u=1/Math.max(1,o.frameRate),f=Math.ceil(a/u-1e-6),p=Math.floor(c/u+1e-6);if(p-f+1>1024)return;for(let e=f;e<=p;e++)l.add(Math.fround(st(e*u,0,o.duration)));const d=[...l].filter(e=>e>=0&&e<=o.duration).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e>n[t-1]);if(0===d.length)return;const m=[];for(const e of d)for(const t of s)m.push(...t.morph?V(t.morph,e):t.values);const h=s.reduce((e,t)=>e+t.values.length,0);return{sourcePath:n,commands:r,values:m.slice(0,h),closed:s.every(e=>e.closed),morph:{times:d,values:m,valueSize:h,interpolation:"linear"}}}function V(e,t){const n=e.times;let o=0;if(t>=n[n.length-1])o=n.length-1;else for(;o+1<n.length&&t>=n[o+1];)o++;const s=Math.min(o+1,n.length-1);let r=0;if(s!==o&&"step"!==e.interpolation&&(r=st((t-n[o])/Math.max(1e-8,n[s]-n[o]),0,1),"cubic-bezier"===e.interpolation&&e.easings)){const t=4*o;r=Fe(r,e.easings[t]??.333,e.easings[t+1]??.333,e.easings[t+2]??.667,e.easings[t+3]??.667)}const i=new Array(e.valueSize),a=o*e.valueSize,c=s*e.valueSize;for(let t=0;t<e.valueSize;t++){const n=e.values[a+t]??0;i[t]=n+((e.values[c+t]??n)-n)*r}return i}function Y(e){return"sh"===e||"rc"===e||"el"===e||"sr"===e||"gr"===e}function Z(e,t,n){if("sh"===e.ty){if(qe(e.ks))return{paths:[],animated:!0};const o=Oe(Se(e.ks),`${t}.ks`,n,!1,!1);return o?{paths:[o],animated:!1}:{paths:[],animated:!1,unsupportedReason:`Merge Paths input at ${t} is not valid path geometry.`}}if("rc"===e.ty||"el"===e.ty){if([e.s,e.p,..."rc"===e.ty?[e.r]:[]].some(qe))return{paths:[],animated:!0};const n=Ue(e.s,[0,0]);if((n[0]??0)<=0||(n[1]??0)<=0)return{paths:[],animated:!1,unsupportedReason:`Merge Paths primitive at ${t} has no positive size.`};const r="rc"===e.ty?ae(n[0],n[1],Math.max(0,Ve(e.r,0))):ce(n[0]/2,n[1]/2),i=Ue(e.p,[0,0]);return{paths:[l(r,(o=i[0]??0,s=i[1]??0,[1,0,0,1,o,s]))],animated:!1}}var o,s;if("sr"===e.ty){if([e.pt,e.or,e.ir,e.is,e.os,e.p,e.r].some(qe))return{paths:[],animated:!0};const o=le(e,t,n);if(!o)return{paths:[],animated:!1,unsupportedReason:`Merge Paths polystar at ${t} is invalid.`};return{paths:[l(o,c(Ue(e.p,[0,0]),[0,0],[100,100],ot(Ve(e.r,0))))],animated:!1}}if("gr"===e.ty){const o=Je(e.it),s=o.map(Xe).find(e=>"tr"===e.ty);if(s&&[s.p,s.a,s.s,s.r??s.rz,s.sk,s.sa].some(qe))return{paths:[],animated:!0};if(s&&(Math.abs(Ve(s.sk,0))>1e-6||Math.abs(Ve(s.sa,0))>1e-6))return{paths:[],animated:!1,unsupportedReason:`Merge Paths group at ${t} uses skew, which is not safe to bake.`};const r=o.map((e,t)=>({item:Xe(e),index:t})).filter(e=>!0!==e.item.hd&&Y(e.item.ty)),i=o.map(Xe).find(e=>!0!==e.hd&&["mm","tm","rd","rp","pb","zz","op","tw"].includes(String(e.ty)));if(i)return{paths:[],animated:!1,unsupportedReason:`Nested Merge Paths input at ${t} contains the "${String(i.ty)}" operator.`};const a=r.map(e=>Z(e.item,`${t}.it[${e.index}]`,n));if(a.some(e=>e.animated))return{paths:[],animated:!0};const u=a.find(e=>e.unsupportedReason)?.unsupportedReason;if(u)return{paths:[],animated:!1,unsupportedReason:u};const f=s?c(Ue(s.p,[0,0]),Ue(s.a,[0,0]),Ue(s.s,[100,100]),ot(Ve(s.r??s.rz,0))):[1,0,0,1,0,0];return{paths:a.flatMap(e=>e.paths).map(e=>l(e,f)),animated:!1}}return{paths:[],animated:!1,unsupportedReason:`Merge Paths input at ${t} is not supported.`}}function B(e,t){const n=a(e.map(e=>e.paths),t);return n?{path:n}:null}function X(e,t,n,o){const s=Ue(e.c,[1,1,1,1]),r=st(Ve(e.o,100)/100,0,1),i=ge([st(s[0]??1,0,1),st(s[1]??1,0,1),st(s[2]??1,0,1),st(s[3]??1,0,1)]),a=Ne(e.c,n,`${t}.c`,e=>[...ge([st(e[0]??1,0,1),st(e[1]??1,0,1),st(e[2]??1,0,1),st(e[3]??1,0,1)])]),c=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]);return{kind:"solid",color:i,opacity:r,...a?{colorTrack:a}:{},...c?{opacityTrack:c}:{}}}function J(e,t,n,o){const s=Xe(e.g);2===e.t&&(qe(e.h)||qe(e.a)||Math.abs(Ve(e.h,0))>1e-6||Math.abs(Ve(e.a,0))>1e-6)&&it(n,"W_LOTTIE_GRADIENT_HIGHLIGHT",t,"Radial gradient highlight length and angle are not converted.");const r=Math.max(2,nt(s.p??2,`${t}.g.p`)),i=Math.min(8,r);r>8&&it(n,"W_LOTTIE_GRADIENT_STOP_LIMIT",`${t}.g.p`,"Gradient is resampled to the eight-stop HYA runtime budget.");const a=s.k,c=st(Ve(e.o,100)/100,0,1),l=K(Ue(a,[]),r,i),u=Ue(e.s,[0,0]),f=Ue(e.e,[100,0]),p=Ne(a,n,`${t}.g.k`,e=>K(e,r,i)),d=Ne(e.s,n,`${t}.s`,e=>[e[0]??0,e[1]??0]),m=Ne(e.e,n,`${t}.e`,e=>[e[0]??0,e[1]??0]),h=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]);return{kind:2===e.t?"radial-gradient":"linear-gradient",start:[u[0]??0,u[1]??0],end:[f[0]??100,f[1]??0],stops:l,opacity:c,...d?{startTrack:d}:{},...m?{endTrack:m}:{},...p?{stopsTrack:p}:{},...h?{opacityTrack:h}:{}}}function K(e,t,n,o){const s=Math.min(t,Math.floor(e.length/4)),r=e.slice(4*s),i=e=>{if(r.length<2)return 1;let t=0;for(;t+3<r.length&&r[t+2]<=e;)t+=2;const n=r[Math.max(0,t)]??0,o=r[Math.max(0,t)+1]??1,s=r[Math.min(r.length-2,t+2)]??n,i=r[Math.min(r.length-1,t+3)]??o,a=s<=n?0:st((e-n)/(s-n),0,1);return st(o+(i-o)*a,0,1)},a=t=>{if(0===s)return[1,1,1];let n=0;for(;n+1<s&&(e[4*(n+1)]??1)<=t;)n++;const o=Math.min(s-1,n+1),r=e[4*n]??0,i=e[4*o]??r,a=i<=r?0:st((t-r)/(i-r),0,1);return[1,2,3].map(t=>st((e[4*n+t]??1)+((e[4*o+t]??e[4*n+t]??1)-(e[4*n+t]??1))*a,0,1))},c=[];for(let t=0;t<n;t++){const o=n===s?t:-1,r=st(o>=0?e[4*o]??0:t/Math.max(1,n-1),0,1),l=a(r),u=ge([l[0],l[1],l[2],i(r)]);c.push(r,...u)}return c}function Q(e,t,n,o){const s=re({...e,c:{a:0,k:[1,1,1,1]}},t,n);return s?{...s,gradient:J(e,t,n)}:null}function ee(e,t,n){if(qe(e)){const o=$e(e,t,n,!1);if(o)return{sourcePath:t,commands:o.commands,values:o.values.slice(0,o.valueSize),closed:o.commands.endsWith("Z"),morph:{times:o.times,values:o.values,valueSize:o.valueSize,interpolation:o.interpolation,...o.easings?{easings:o.easings}:{}}}}const o=Se(e),s=Oe(o,t,n,!1,!1);return s?{sourcePath:t,commands:s.commands,values:Array.from(s.values),closed:!1!==o.c}:null}function te(e,t,n,o){const r="fill"===t.kind?function(e,t){if(e.closed)return e;it(t,"W_LOTTIE_OPEN_FILLED_PATH",e.sourcePath,"Open filled path is closed with a straight segment.");const n=e=>[...e,e[0]??0,e[1]??0];if(!e.morph)return{commands:`${e.commands}LZ`,values:n(e.values),closed:!0,sourcePath:e.sourcePath};const o=[];for(let t=0;t<e.morph.times.length;t++){const s=t*e.morph.valueSize;o.push(...n(Array.from(e.morph.values).slice(s,s+e.morph.valueSize)))}return{commands:`${e.commands}LZ`,values:n(e.values),closed:!0,sourcePath:e.sourcePath,morph:{...e.morph,values:o,valueSize:e.morph.valueSize+2}}}(e,o):e,i=r.morph?function(e,t){const n=Array.from(e.values,(n,o)=>Ae(n-(t[o%e.valueSize]??0)));return{times:e.times,values:n,valueSize:e.valueSize,interpolation:e.interpolation,...e.easings?{easings:e.easings}:{}}}(r.morph,r.values):void 0;var a;if(!(void 0!==e.morph||n.length>0||"fill"===t.kind&&("solid"!==t.fill.kind||void 0!==t.fill.colorTrack||void 0!==t.fill.opacityTrack)||"stroke"===t.kind&&(void 0!==(a=t.stroke).colorTrack||void 0!==a.opacityTrack||void 0!==a.widthTrack||void 0!==a.dash||void 0!==a.dashOffsetTrack||void 0!==a.gradient))){if("fill"===t.kind&&"solid"===t.fill.kind)return[{type:"path2d",commands:r.commands,values:r.values,fill:[t.fill.color[0],t.fill.color[1],t.fill.color[2],t.fill.color[3]*(t.fill.opacity??1)],fillRule:t.fillRule}];if("stroke"===t.kind)return[ie(r.commands,r.values,t.stroke,o)]}return o.usesVectorShapeExtension=!0,[{type:s,commands:r.commands,values:r.values,...i?{morph:i,morphRelative:!0}:{},..."fill"===t.kind?{fill:t.fill}:{stroke:se(t.stroke)},...n.length>0?{modifiers:n}:{},fillRule:"fill"===t.kind?t.fillRule:"nonzero",tolerance:.35}]}function ne(e,t,n,o){return te({sourcePath:"$generated",commands:e.commands,values:Array.from(e.values),closed:e.commands.endsWith("Z")},t,n,o)}function oe(e,t,n){if("tm"===e.ty){const o=Ne(e.s,n,`${t}.s`,e=>[(e[0]??0)/100]),s=Ne(e.e,n,`${t}.e`,e=>[(e[0]??100)/100]),r=Ne(e.o,n,`${t}.o`,e=>[(e[0]??0)/360]);return{kind:"trim-path",start:Ve(e.s,0)/100,end:Ve(e.e,100)/100,offset:Ve(e.o,0)/360,mode:2===e.m?"individual":"simultaneous",...o?{startTrack:o}:{},...s?{endTrack:s}:{},...r?{offsetTrack:r}:{}}}if("rd"===e.ty){const o=Ne(e.r,n,`${t}.r`,e=>[Math.max(0,e[0]??0)]);return{kind:"round-corners",radius:Math.max(0,Ve(e.r,0)),...o?{radiusTrack:o}:{}}}return null}function se(e){const t=e.gradient;return{color:e.color,width:e.width,opacity:e.opacity,lineCap:2===e.lineCap?"round":3===e.lineCap?"square":"butt",lineJoin:2===e.lineJoin?"round":3===e.lineJoin?"bevel":"miter",miterLimit:e.miterLimit,...t?{gradient:t}:{},...e.dash?{dash:e.dash}:{},...void 0===e.dashOffset?{}:{dashOffset:e.dashOffset},...e.colorTrack?{colorTrack:e.colorTrack}:{},...e.opacityTrack?{opacityTrack:e.opacityTrack}:{},...e.widthTrack?{widthTrack:e.widthTrack}:{},...e.dashOffsetTrack?{dashOffsetTrack:e.dashOffsetTrack}:{}}}function re(e,t,n){const o=Ue(e.c,[0,0,0,1]),s=st(Ve(e.o,100)/100,0,1),r=Ve(e.w,0),i=Ge(e.w,1)?.[0];if(r<0||void 0!==i&&i<0)return it(n,"W_LOTTIE_INVALID_STROKE",`${t}.w`,"Stroke width cannot be negative."),null;const a=r>0?r:i;if(void 0===a)return null;const c=Ne(e.c,n,`${t}.c`,e=>[st(e[0]??0,0,1),st(e[1]??0,0,1),st(e[2]??0,0,1),st(e[3]??1,0,1)]),l=Ne(e.o,n,`${t}.o`,e=>[st((e[0]??100)/100,0,1)]),u=Ne(e.w,n,`${t}.w`,e=>[Math.max(0,e[0]??a)]),f=Je(e.d).map(Xe),p=f.filter(e=>"o"!==e.n).map((e,o)=>(qe(e.v)&&it(n,"W_LOTTIE_ANIMATED_STROKE_DASH",`${t}.d[${o}].v`,"Animated dash lengths are sampled at their initial value."),Math.max(0,Ve(e.v,0)))).filter(e=>e>0),d=f.find(e=>"o"===e.n),m=d?Ve(d.v,0):void 0,h=d?Ne(d.v,n,`${t}.d`,e=>[e[0]??0]):void 0;return{color:[st(o[0]??0,0,1),st(o[1]??0,0,1),st(o[2]??0,0,1),st(o[3]??1,0,1)],width:a,opacity:s,lineCap:2===e.lc||3===e.lc?e.lc:1,lineJoin:2===e.lj||3===e.lj?e.lj:1,miterLimit:Math.max(1,"number"==typeof e.ml&&Number.isFinite(e.ml)?e.ml:4),...c?{colorTrack:c}:{},...l?{opacityTrack:l}:{},...u?{widthTrack:u}:{},...p.length>0?{dash:p}:{},...void 0===m?{}:{dashOffset:m},...h?{dashOffsetTrack:h}:{}}}function ie(e,t,n,o,s){return o.usesStrokeExtension=!0,{type:M,commands:e,values:t,color:[n.color[0],n.color[1],n.color[2],n.color[3]*n.opacity],width:n.width,lineCap:2===n.lineCap?"round":3===n.lineCap?"square":"butt",lineJoin:2===n.lineJoin?"round":3===n.lineJoin?"bevel":"miter",miterLimit:n.miterLimit,tolerance:.2}}function ae(e,t,n){const o=e/2,s=t/2,r=Math.min(Math.max(0,n),o,s);if(r<=1e-6)return{commands:"MLLLZ",values:[-o,-s,o,-s,o,s,-o,s]};const i=.5522847498307936*r;return{commands:"MLCLCLCLCZ",values:[-o+r,-s,o-r,-s,o-r+i,-s,o,-s+r-i,o,-s+r,o,s-r,o,s-r+i,o-r+i,s,o-r,s,-o+r,s,-o+r-i,s,-o,s-r+i,-o,s-r,-o,-s+r,-o,-s+r-i,-o+r-i,-s,-o+r,-s]}}function ce(e,t){const n=.5522847498307936*e,o=.5522847498307936*t;return{commands:"MCCCCZ",values:[0,-t,n,-t,e,-o,e,0,e,o,n,t,0,t,-n,t,-e,o,-e,0,-e,-o,-n,-t,0,-t]}}function le(e,t,n){const o=Math.round(Ve(e.pt,0)),s=Ve(e.or,0),r=2!==e.sy,i=r?Ve(e.ir,0):s;if(o<3||s<=0||r&&i<=0)return it(n,"W_LOTTIE_INVALID_POLYSTAR",t,"Polystar requires at least three points and positive radii."),null;[e.pt,e.or,e.ir].some(qe)&&it(n,"W_LOTTIE_ANIMATED_POLYSTAR_GEOMETRY",t,"Animated polystar points and radii are sampled at their initial value.");const a=st(Ve(e.is,0)/100,0,1),c=st(Ve(e.os,0)/100,0,1);(qe(e.is)||qe(e.os))&&it(n,"W_LOTTIE_ANIMATED_POLYSTAR_ROUNDNESS",t,"Animated polystar roundness is sampled at its initial value.");const l=r?2*o:o,u=3===e.d?-1:1,f=[],p=[];for(let e=0;e<l;e++){const t=r&&!(1&~e),n=t?i:s,o=-Math.PI/2+u*e*Math.PI*2/l;f.push([Math.cos(o)*n,Math.sin(o)*n]),p.push(t?a:c)}if(p.every(e=>e<=1e-6))return{commands:`M${"L".repeat(l-1)}Z`,values:f.flat()};const d=f.map((e,t)=>{const n=f[(t-1+l)%l],o=f[(t+1)%l],s=.25*p[t];return{vertex:e,enter:[e[0]+(n[0]-e[0])*s,e[1]+(n[1]-e[1])*s],exit:[e[0]+(o[0]-e[0])*s,e[1]+(o[1]-e[1])*s]}});let m="M";const h=[...d[0].enter];for(let e=0;e<d.length;e++){const t=d[e];e>0&&(m+="L",h.push(...t.enter)),m+="Q",h.push(...t.vertex,...t.exit)}return m+="LZ",h.push(...d[0].enter),{commands:m,values:h}}function ue(e,t,n,o){1===e.ddd&&it(o,"W_LOTTIE_3D_LAYER",`${t}.ddd`,"3D layer transforms are flattened to the supported 2D transform subset."),"number"==typeof e.bm&&0!==e.bm&&it(o,"W_LOTTIE_BLEND_MODE",`${t}.bm`,`Layer blend mode ${e.bm} is not represented by the HYA 2D renderer.`),1===e.ao&&it(o,"W_LOTTIE_AUTO_ORIENT",`${t}.ao`,"Auto-orient along a motion path is not converted."),void 0===e.tm||0===n&&qe(e.tm)||it(o,"W_LOTTIE_TIME_REMAP",`${t}.tm`,0!==n?"Time remapping is only supported for precomposition layers.":"Static time remapping cannot be represented by ordinary HYA transform tracks.");const s=Xe(Xe(e.ks).p);!0!==s.s&&void 0===s.x&&void 0===s.y||it(o,"W_LOTTIE_SPLIT_POSITION",`${t}.ks.p`,"Separated position dimensions are sampled as the default position.");const r=Xe(e.ks);(qe(r.sk)||qe(r.sa)||Math.abs(Ve(r.sk,0))>1e-6||Math.abs(Ve(r.sa,0))>1e-6)&&it(o,"W_LOTTIE_LAYER_SKEW",`${t}.ks`,"Layer skew and skew axis are not converted.")}function fe(e,t,n){const o=[],s=Je(e).map(Xe);for(let e=0;e<s.length;e++){const r=s[e],i=`${t}.ef[${e}]`,a=pe(r.nm??r.mn),c=Je(r.ef).map(Xe);if("tint"===a){const e=de(c,["map black to","adbe tint-0001"]),t=de(c,["map white to","adbe tint-0002"]),s=de(c,["amount to tint","adbe tint-0003"]);if(!e||!t||!s){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Tint requires Map Black To, Map White To and Amount to Tint parameters.");continue}const r=Ue(e,[0,0,0]),a=Ue(t,[1,1,1]),l=Ne(e,n,`${i}.black`,e=>me(e,[0,0,0])),u=Ne(t,n,`${i}.white`,e=>me(e,[1,1,1])),f=Ne(s,n,`${i}.amount`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"tint",black:me(r,[0,0,0]),white:me(a,[1,1,1]),amount:st(Ve(s,100)/100,0,1),...l?{blackTrack:l}:{},...u?{whiteTrack:u}:{},...f?{amountTrack:f}:{}});continue}if("fill"===a){const e=de(c,["color","adbe fill-0002"]),t=de(c,["opacity","adbe fill-0007"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Fill requires a Color parameter.");continue}const s=Ue(e,[1,1,1,1]),r=Ne(e,n,`${i}.color`,e=>he(e)),a=Ne(t,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"fill",color:he(s),opacity:st(Ve(t,100)/100,0,1),...r?{colorTrack:r}:{},...a?{opacityTrack:a}:{}});continue}if(a.includes("gaussian blur")||a.includes("fast box blur")||"blur"===a){const e=de(c,["blurriness","blur","adbe gaussian blur 2-0001","adbe fast blur-0001"]),t=Math.round(Ve(de(c,["blur dimensions","dimensions"]),1));if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Blur requires a Blurriness parameter.");continue}const s=e=>2===t?[0,Math.max(0,e[0]??0)]:3===t?[Math.max(0,e[0]??0),0]:[Math.max(0,e[0]??0),Math.max(0,e[0]??0)],r=Ne(e,n,`${i}.blur`,s);o.push({kind:"blur",radius:s([Ve(e,0)]),...r?{radiusTrack:r}:{}});continue}if("drop shadow"===a||a.includes("drop shadow")){const e=de(c,["shadow color","color","adbe drop shadow-0001"]),t=de(c,["opacity","adbe drop shadow-0002"]),s=de(c,["direction","adbe drop shadow-0003"]),r=de(c,["distance","adbe drop shadow-0004"]),a=de(c,["softness","blur","adbe drop shadow-0005"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Drop Shadow requires a Shadow Color parameter.");continue}(qe(s)||qe(r))&&it(n,"W_LOTTIE_EFFECT_PARAM",i,"Animated Drop Shadow direction/distance requires coupled sampling and is held at its first value.");const l=ot(Ve(s,135)),u=Math.max(0,Ve(r,0)),f=Ue(e,[0,0,0,1]),p=Ne(e,n,`${i}.color`,e=>he(e,[0,0,0,1])),d=Ne(t,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]),m=Ne(a,n,`${i}.blur`,e=>[Math.max(0,e[0]??0)]);o.push({kind:"drop-shadow",color:he(f,[0,0,0,1]),opacity:st(Ve(t,100)/100,0,1),offset:[Math.cos(l)*u,Math.sin(l)*u],blur:Math.max(0,Ve(a,0)),...p?{colorTrack:p}:{},...d?{opacityTrack:d}:{},...m?{blurTrack:m}:{}});continue}if("opacity"===a){const e=de(c,["opacity","amount"]);if(!e){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Opacity effect requires an Opacity parameter.");continue}const t=Ne(e,n,`${i}.opacity`,e=>[st((e[0]??100)/100,0,1)]);o.push({kind:"opacity",opacity:st(Ve(e,100)/100,0,1),...t?{opacityTrack:t}:{}});continue}if("color matrix"===a){const e=de(c,["matrix","color matrix"]),t=Ue(e,[]);if(20!==t.length){it(n,"W_LOTTIE_EFFECT_PARAM",i,"Color Matrix requires exactly 20 values.");continue}const s=Ne(e,n,`${i}.matrix`,e=>e.slice(0,20));o.push({kind:"color-matrix",matrix:t.slice(0,20),...s?{matrixTrack:s}:{}});continue}it(n,"W_LOTTIE_EFFECT",i,`Layer effect "${"string"==typeof r.nm?r.nm:String(r.ty)}" is not converted.`)}return o}function pe(e){return"string"==typeof e?e.trim().toLowerCase():""}function de(e,t){const n=t.map(e=>e.toLowerCase());return e.find(e=>{const t=pe(e.nm),o=pe(e.mn);return n.includes(t)||n.includes(o)})?.v}function me(e,t){return[st(e[0]??t[0],0,1),st(e[1]??t[1],0,1),st(e[2]??t[2],0,1)]}function he(e,t=[1,1,1,1]){return[st(e[0]??t[0],0,1),st(e[1]??t[1],0,1),st(e[2]??t[2],0,1),st(e[3]??t[3],0,1)]}function ge(e,t){return e}function ye(e,t,n,o,s,r,i,a,c,l){const u=void 0===e.tt?0:nt(e.tt,`${r}.tt`),f=function(e,t,n,o,s,r,i){const a=Je(e).map((e,t)=>({mask:Xe(e),sourceIndex:t})).filter(e=>!0!==e.mask.hd&&"n"!==e.mask.mode);if(0===a.length)return{nodes:[]};const c=a.filter(({mask:e,sourceIndex:t})=>!(void 0!==e.mode&&!["a","s","i","f"].includes(String(e.mode)))||(it(o,"W_LOTTIE_MASK_MODE",`${n}.masksProperties[${t}].mode`,`Mask mode "${String(e.mode)}" is not recognized.`),!1));if(0===c.length)return{nodes:[]};const l=[],u=[];for(let e=0;e<c.length;e++){const{mask:s,sourceIndex:r}=c[e],i=`${n}.masksProperties[${r}]`,a=`${t}:mask:${o.shapeCounter++}`,f=st(Ve(s.o,100)/100,0,1),p=Ue(s.f,[0,0]),d=Ve(s.x,0),m=Ne(s.x,o,`${i}.x`,e=>[e[0]??0]);qe(s.f)&&it(o,"W_LOTTIE_ANIMATED_MASK_FEATHER",`${i}.f`,"Animated mask feather is sampled at its initial value.");const h=qe(s.pt),g=qe(s.o),y=[],v=[];if(h||g){const n=`${t}:mask-entry:${o.shapeCounter++}`,r={id:n,name:`${t} mask ${e}`,parent:a,transform:{opacity:f}};g&&We(s.o,n,"opacity",o,e=>[st((e[0]??100)/100,0,1)],`${i}.o`);const c=ke(s.pt,[1,1,1,1],`${i}.pt`,o);c&&(r.components=[c]),v.push(r)}else{const e=ke(s.pt,[1,1,1,f],`${i}.pt`,o);e&&y.push(e)}0===y.length&&0===v.length||(l.push({id:a,name:`${t} mask ${e}`,parent:t,...y.length>0?{components:y}:{}},...v),u.push({kind:"mask",source:a,mode:!0===s.inv?"alpha-inverted":"alpha",operation:"s"===s.mode?"subtract":"i"===s.mode?"intersect":"f"===s.mode?"difference":"add",...p.some(e=>Math.abs(e)>1e-6)?{feather:[Math.abs(p[0]??0),Math.abs(p[1]??p[0]??0)]}:{},...Math.abs(d)>1e-6?{expansion:d}:{},...m?{expansionTrack:m}:{}}))}if(0===u.length)return{nodes:[]};const f=function(e,t,n,o,s,r){const i=[...e],a=[];let c;for(;i.length+(c?1:0)>t;){const e=c?7:8,t=[...c?[{kind:"mask",source:c,mode:"alpha",operation:"add"}]:[],...i.splice(0,e)],l=`${n}:mask-stack:${o.shapeCounter++}`;a.push({id:l,name:`${n} mask stack`,composite:ve(t),components:[{type:"shape2d",shape:"rect",size:[s,r],position:[s/2,r/2],fill:[1,1,1,1]}]}),c=l}return{layers:[...c?[{kind:"mask",source:c,mode:"alpha",operation:"add"}]:[],...i],nodes:a}}(u,s,t,o,r,i);return l.push(...f.nodes),{value:ve(f.layers),nodes:l}}(e.masksProperties,s,r,a,u>0?7:8,c,l);if(0===u)return f;if(u<1||u>4)return it(a,"W_LOTTIE_UNSUPPORTED_MATTE",`${r}.tt`,`Track matte type ${u} is not supported.`),f;const p=void 0===e.tp?void 0:nt(e.tp,`${r}.tp`),d=Xe(n[t-1]),m=p??(t>0?nt(d.ind??t,`${i}[${t-1}].ind`):void 0),h=void 0===m?void 0:o.get(m);if(!h)return it(a,"W_LOTTIE_MISSING_MATTE_SOURCE",`${r}.tt`,"Track matte source layer was not found immediately before the target layer."),f;const g={kind:"matte",source:h,mode:2===u?"alpha-inverted":3===u?"luma":4===u?"luma-inverted":"alpha",operation:f.value?"intersect":"add"};return{value:ve([...Te(f.value),g]),nodes:f.nodes}}function ve(e){if(1!==e.length)return{layers:e};const t=e[0];return void 0===t.operation||"add"===t.operation?{kind:t.kind,source:t.source,mode:t.mode,...t.feather?{feather:t.feather}:{},...void 0===t.expansion?{}:{expansion:t.expansion},...void 0===t.expansionTrack?{}:{expansionTrack:t.expansionTrack}}:t}function Te(e){return e?"layers"in e?e.layers:[e]:[]}function ke(e,t,n,o){if(qe(e)){const s=o.diagnostics.length,r=$e(e,n,o);if(r)return o.usesPathMorphExtension=!0,{type:x,...r,fill:t,fillRule:"nonzero"};o.diagnostics.slice(s).some(e=>"W_LOTTIE_PATH_TOPOLOGY"===e.code)||it(o,"W_LOTTIE_ANIMATED_PATH",n,"Animated path cannot be represented and is sampled at its initial value.")}const s=Oe(Se(e),n,o);return s?{type:"path2d",...s,fill:t,fillRule:"nonzero"}:null}function $e(e,t,n,o=!0){const s=Je(Xe(e).k).map(Xe),r=[],i=[],a=[];let c=null;for(let e=0;e<s.length;e++){const o=s[e],l=Xe(Je(o.s)[0]??o.s??Je(s[e-1]?.e)[0]??c);if(0===Object.keys(l).length)continue;const u=Math.fround(st(ze(n.timeline,et(o.t,`${t}.k[${e}].t`)),0,n.duration));r.length>0&&u<=r.at(-1)||(r.push(u),i.push(l),a.push(o),c=Xe(Je(o.e)[0]??o.e??l))}if(0===r.length)return null;const l=function(e,t,n,o){const s=[];for(let r=0;r<e.length;r++){const i=_e(e[r],o);if(!i)return it(n,"W_LOTTIE_INVALID_PATH",`${t}.k[${r}].s`,"Animated path requires matching vertices and tangent arrays."),null;s.push(i)}const r=s[0].closed;if(s.some(e=>e.closed!==r))return it(n,"W_LOTTIE_PATH_TOPOLOGY",t,"Animated path changes between open and closed topology."),null;const i=Math.max(...s.map(e=>e.segments.length));if(i<1||i>w)return it(n,"W_LOTTIE_PATH_TOPOLOGY",t,`Animated path requires ${i} canonical segments; the safe budget is 256.`),null;const a=s.map(e=>function(e,t){const n=[...e.segments];for(;n.length<t;){let e=0,t=-1/0;for(let o=0;o<n.length;o++){const s=n[o],r=Le(s.start,s.control1)+Le(s.control1,s.control2)+Le(s.control2,s.end);r>t&&(e=o,t=r)}n.splice(e,1,...Ee(n[e]))}return{closed:e.closed,segments:n}}(e,i)),c=a[0];for(let e=1;e<a.length;e++)a[e]=be(a[e],c);return{commands:`M${"C".repeat(i)}${r?"Z":""}`,frames:a.map(e=>[...e.segments[0].start,...e.segments.flatMap(e=>[...e.control1,...e.control2,...e.end])])}}(i,t,n,o);if(!l)return null;const u=l.frames.flatMap(e=>e.map(Ae)),f=l.commands,p=l.frames[0].length,d=a.length>1&&a.slice(0,-1).every(e=>1===e.h)?"step":r.length>1?"cubic-bezier":"linear",m=[];if("cubic-bezier"===d)for(let e=0;e<r.length-1;e++){const t=a[e],n=Xe(t.o),o=Xe(t.i);m.push(st(Qe(n.x,.333),0,1),Qe(n.y,.333),st(Qe(o.x,.667),0,1),Qe(o.y,.667))}return{commands:f,times:r,values:u,valueSize:p,interpolation:d,...m.length>0?{easings:m}:{},tolerance:.35}}function _e(e,t){const n=Pe(e.v),o=Re(e.i,n.length),s=Re(e.o,n.length);if(n.length<2||o.length!==n.length||s.length!==n.length)return null;const r=!1!==e.c,i=r||t,a=i?n.length:n.length-1,c=[];for(let e=0;e<a;e++){const t=(e+1)%n.length,i=n[e],a=n[t],l=r||0!==t;c.push({start:i,control1:l?[i[0]+s[e][0],i[1]+s[e][1]]:i,control2:l?[a[0]+o[t][0],a[1]+o[t][1]]:a,end:a})}return{closed:i,segments:c}}function Ee(e){const t=Ie(e.start,e.control1),n=Ie(e.control1,e.control2),o=Ie(e.control2,e.end),s=Ie(t,n),r=Ie(n,o),i=Ie(s,r);return[{start:e.start,control1:t,control2:s,end:i},{start:i,control1:r,control2:o,end:e.end}]}function be(e,t){let n=e;if(e.closed){Math.sign(xe(n))!==Math.sign(xe(t))&&(n=Me(n));let e=0,o=1/0;for(let s=0;s<n.segments.length;s++){let r=0;for(let e=0;e<t.segments.length;e++)r+=we(t.segments[e].start,n.segments[(e+s)%n.segments.length].start);r<o&&(o=r,e=s)}return e>0&&(n={closed:!0,segments:[...n.segments.slice(e),...n.segments.slice(0,e)]}),n}const o=we(t.segments[0].start,n.segments[0].start)+we(t.segments.at(-1).end,n.segments.at(-1).end);return we(t.segments[0].start,n.segments.at(-1).end)+we(t.segments.at(-1).end,n.segments[0].start)<o?Me(n):n}function Me(e){return{closed:e.closed,segments:[...e.segments].reverse().map(e=>({start:e.end,control1:e.control2,control2:e.control1,end:e.start}))}}function xe(e){let t=0;for(const n of e.segments)t+=n.start[0]*n.end[1]-n.end[0]*n.start[1];return t/2}function Ie(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Le(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function we(e,t){const n=e[0]-t[0],o=e[1]-t[1];return n*n+o*o}function Ae(e){return Math.round(e/L)*L}function Oe(e,t,n,o=!0,s=!0){const r=Pe(e.v),i=Re(e.i,r.length),a=Re(e.o,r.length);if(r.length<2||i.length!==r.length||a.length!==r.length)return o&&it(n,"W_LOTTIE_INVALID_PATH",t,"Path requires matching vertex, incoming-tangent and outgoing-tangent arrays."),null;let c="M";const l=[...r[0]],u=!1!==e.c,f=u?r.length:r.length-1;for(let e=0;e<f;e++){const t=e,n=(e+1)%r.length,o=r[t],s=r[n],u=[o[0]+a[t][0],o[1]+a[t][1]],f=[s[0]+i[n][0],s[1]+i[n][1]];Ce(u,o)&&Ce(f,s)?(c+="L",l.push(...s)):(c+="C",l.push(...u,...f,...s))}return!u&&s&&(o&&it(n,"W_LOTTIE_OPEN_FILLED_PATH",t,"Open filled path is closed with a straight segment."),c+="L",l.push(...r[0])),(u||s)&&(c+="Z"),{commands:c,values:l}}function Se(e){const t=Xe(e);if(qe(t)){const e=Xe(Je(t.k)[0]);return Xe(Je(e.s)[0]??e.s)}return Xe(t.k??e)}function Pe(e){return Je(e).map(e=>{const t=Ke(e);return[t[0]??0,t[1]??0]})}function Re(e,t){const n=Pe(e);return 0===n.length&&t>0?Array.from({length:t},()=>[0,0]):n}function Ce(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function We(e,t,n,o,s,r){const i=Ne(e,o,r,s);i&&o.tracks.push({node:t,property:n,interpolation:i.interpolation,times:i.times,values:i.values,...i.easings?{easings:i.easings}:{},..."position"===n&&i.spatialTangents?{spatialTangents:i.spatialTangents}:{}})}function Ne(e,t,n,o){if(!qe(e))return;const s=Je(Xe(e).k).map(Xe),r=[],i=[],a=[];let c=null;for(let e=0;e<s.length;e++){const l=s[e],u=et(l.t,`${n}.k[${e}].t`),f=Ke(l.s),p=f.length>0?f:c??Ke(s[e-1]?.e);if(0===p.length)continue;const d=Math.fround(st(ze(t.timeline,u),0,t.duration));if(r.length>0&&d<=r[r.length-1])continue;const m=o(p);r.push(d),i.push(...m),a.push(l),c=Ke(l.e).length>0?Ke(l.e):p}if(r.length<1)return void it(t,"W_LOTTIE_EMPTY_TRACK",n,"Animated property contains no usable keyframes.");if(a.length>1&&a.slice(0,-1).every(e=>1===e.h))return{times:r,values:i,valueSize:i.length/r.length,interpolation:"step"};const l=[],u=[];let f=!1;for(let e=0;e<r.length-1;e++){const t=a[e],n=Xe(t.o),o=Xe(t.i);if(l.push(st(Qe(n.x,.333),0,1),Qe(n.y,.333),st(Qe(o.x,.667),0,1),Qe(o.y,.667)),i.length/r.length===2){const n=Ke(t.to),o=Ke(t.ti),s=[...n,...o].some(e=>Math.abs(e)>1e-8);if(f||=s,s)u.push(n[0]??0,n[1]??0,o[0]??0,o[1]??0);else{const t=2*e,n=((i[t+2]??i[t]??0)-(i[t]??0))/3,o=((i[t+3]??i[t+1]??0)-(i[t+1]??0))/3;u.push(n,o,-n,-o)}}}return{times:r,values:i,valueSize:i.length/r.length,interpolation:r.length>1?"cubic-bezier":"linear",...r.length>1?{easings:l}:{},...r.length>1&&f?{spatialTangents:u}:{}}}function ze(e,t){return e.mapFrameToSeconds?.(t)??e.secondsOffset+t*e.secondsPerFrame}function Fe(e,t,n,o,s){let r=0,i=1;for(let n=0;n<16;n++){const n=(r+i)/2;De(n,t,o)<e?r=n:i=n}return De((r+i)/2,n,s)}function De(e,t,n){const o=1-e;return 3*o*o*e*t+3*o*e*e*n+e*e*e}function He(e,t,n,o){const s=et(e.sr??1,`${t}.sr`);if(Math.abs(s-1)<1e-8)return n;if(s<=0)return it(o,"W_LOTTIE_INVALID_TIME_STRETCH",`${t}.sr`,"Layer time stretch must be greater than zero."),n;const r=et(e.st??e.ip??0,`${t}.st`),i=e=>ze(n,r+(e-r)*s);return{frameRate:n.frameRate,secondsOffset:i(0),secondsPerFrame:n.secondsPerFrame*s,mapFrameToSeconds:i}}function je(e,t,n,o){const s=Math.min(o,Math.max(1e-6,n.secondsPerFrame)),r=ze(n,e),i=ze(n,t),a=st(r,0,Math.max(0,o-s)),c=st(i,a+s,o);return{start:a,duration:Math.max(s,c-a)}}function qe(e){const t=Xe(e);if(!Array.isArray(t.k))return!1;if(1===t.a)return!0;const n=Xe(t.k[0]);return"number"==typeof n.t&&Number.isFinite(n.t)&&(void 0!==n.s||void 0!==n.e)}function Ue(e,t){const n=Xe(e);if(qe(n))return Ke(Xe(Je(n.k)[0]).s).length>0?Ke(Xe(Je(n.k)[0]).s):t;const o=Ke(n.k);return o.length>0?o:t}function Ge(e,t){const n=Xe(e);return(qe(n)?Je(n.k).flatMap(e=>{const t=Xe(e);return[Ke(t.s),Ke(t.e)]}):[Ke(n.k)]).find(e=>e.length>=t&&e.slice(0,t).every(e=>e>0))}function Ve(e,t){return Ue(e,[t])[0]??t}function Ye(e,t){if("string"!=typeof e||!/^#[0-9a-f]{6}$/i.test(e))throw new TypeError(`Expected #RRGGBB at ${t}.`);const n=Number.parseInt(e.slice(1),16);return[(n>>16&255)/255,(n>>8&255)/255,(255&n)/255,1]}function Ze(e,t){if(!e)return t;try{return new URL(t,e).toString()}catch{return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}}function Be(e){return Xe(JSON.parse(e))}function Xe(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function Je(e){return Array.isArray(e)?e:[]}function Ke(e){if("number"==typeof e&&Number.isFinite(e))return[e];if(!Array.isArray(e))return[];return(1===e.length&&Array.isArray(e[0])?e[0]:e).filter(e=>"number"==typeof e&&Number.isFinite(e))}function Qe(e,t){return Ke(e)[0]??t}function et(e,t){if("number"!=typeof e||!Number.isFinite(e))throw new TypeError(`Expected a finite number at ${t}.`);return e}function tt(e,t){const n=et(e,t);if(n<=0)throw new TypeError(`Expected a positive number at ${t}.`);return n}function nt(e,t){const n=et(e,t);if(!Number.isSafeInteger(n))throw new TypeError(`Expected an integer at ${t}.`);return n}function ot(e){return e*Math.PI/180}function st(e,t,n){return Math.min(n,Math.max(t,e))}function rt(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 it(e,t,n,o){e.diagnostics.push(Object.freeze({severity:"warning",code:t,path:n,message:o}))}export{A as convertLottie,S as convertLottieDocument,O as inspectLottieFonts};//# sourceMappingURL=lottie.js.map
@@ -1 +1 @@
1
- export { cH as NATIVE_3D_ANIMATION_EXTENSION_ID, cI as NATIVE_3D_ANIMATION_FORMAT, cJ as NATIVE_3D_CLIP_FORMAT, cK as NATIVE_3D_STATE_MACHINE_FORMAT, cL as Native3DAnimationDiagnosticCode, cM as Native3DAnimationFormatError, cN as Native3DAnimationParseOptions, cO as Native3DAnimationPayload, cP as Native3DAnimationSource, cQ as Native3DBinding, cR as Native3DBindingTarget, cS as Native3DCameraComponent, cT as Native3DCameraProjection, cU as Native3DClip, cV as Native3DComponent, cW as Native3DCoordinateSystem, cX as Native3DEvent, cY as Native3DMaterial, cZ as Native3DModelComponent, c_ as Native3DNode, c$ as Native3DParseLimits, d0 as Native3DParticleComponent, d1 as Native3DParticleDescriptor, d2 as Native3DPrimitiveComponent, d3 as Native3DQuaternion, d4 as Native3DScalarRange, d5 as Native3DStateMachine, d6 as Native3DStateMachineCondition, d7 as Native3DStateMachineLayer, d8 as Native3DStateMachineMotion, d9 as Native3DStateMachineParameter, da as Native3DStateMachineState, db as Native3DStateMachineTransition, dc as Native3DTrack, dd as Native3DTransform, de as Native3DVec2, df as Native3DVec3, dg as Native3DVec4, dh as Native3DViewport, di as ParsedNative3DAnimation, dj as createNative3DAnimationExtensionHandler, dk as parseNative3DAnimation, dl as parseNative3DAnimationPayload } from './shared.js';
1
+ export { c_ as NATIVE_3D_ANIMATION_EXTENSION_ID, c$ as NATIVE_3D_ANIMATION_FORMAT, d0 as NATIVE_3D_CLIP_FORMAT, d1 as NATIVE_3D_STATE_MACHINE_FORMAT, d2 as Native3DAnimationDiagnosticCode, d3 as Native3DAnimationFormatError, d4 as Native3DAnimationParseOptions, d5 as Native3DAnimationPayload, d6 as Native3DAnimationSource, d7 as Native3DBinding, d8 as Native3DBindingTarget, d9 as Native3DCameraComponent, da as Native3DCameraProjection, db as Native3DClip, dc as Native3DComponent, dd as Native3DCoordinateSystem, de as Native3DEvent, df as Native3DMaterial, dg as Native3DModelComponent, dh as Native3DNode, di as Native3DParseLimits, dj as Native3DParticleComponent, dk as Native3DParticleDescriptor, dl as Native3DPrimitiveComponent, dm as Native3DQuaternion, dn as Native3DScalarRange, dp as Native3DStateMachine, dq as Native3DStateMachineCondition, dr as Native3DStateMachineLayer, ds as Native3DStateMachineMotion, dt as Native3DStateMachineParameter, du as Native3DStateMachineState, dv as Native3DStateMachineTransition, dw as Native3DTrack, dx as Native3DTransform, dy as Native3DVec2, dz as Native3DVec3, dA as Native3DVec4, dB as Native3DViewport, dC as ParsedNative3DAnimation, dD as createNative3DAnimationExtensionHandler, dE as parseNative3DAnimation, dF as parseNative3DAnimationPayload } from './shared.js';