@lottiefiles/dotlottie-web 0.9.2 → 0.11.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.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants.ts","../src/animation-frame-manager.ts","../src/event-manager.ts","../package.json","../src/renderer-wasm/bin/renderer.js","../src/renderer-wasm/index.ts","../../../node_modules/.pnpm/fflate@0.8.0/node_modules/fflate/esm/browser.js","../../../node_modules/.pnpm/valibot@0.13.1/node_modules/valibot/dist/index.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/@rgba-image+copy@0.1.3/node_modules/@rgba-image/copy/src/index.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/@rgba-image+create-image@0.1.1/node_modules/@rgba-image/create-image/src/index.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/src/filters.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/src/convolve.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/src/index.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/@dotlottie/dotlottie-js/src/common/dotlottie-state-machine-common.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/@dotlottie/dotlottie-js/src/common/dotlottie-state.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/@dotlottie/dotlottie-js/src/common/manifest.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/@dotlottie/dotlottie-js/src/common/utils.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/@dotlottie/dotlottie-js/src/common/lottie-audio-common.ts","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/HashableImageSourceConverter/DifferenceHash/VanilaConverter.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/HashSource.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/HashableImageSourceConverter/Resizer/LanczosResizer.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/Hash.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/HashGenerator.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/HashableImageSourceConverter/GlayScaleCalculator/ITU_R601_2Method.js","../../../node_modules/.pnpm/@dotlottie+dotlottie-js@0.6.0/node_modules/node_modules/.pnpm/browser-image-hash@0.0.5/node_modules/browser-image-hash/dist/DifferenceHashBuilder.js","../src/utils.ts","../src/dotlottie.ts"],"names":["IS_BROWSER","MS_TO_SEC_FACTOR","DEFAULT_BG_COLOR","WebAnimationFrameStrategy","callback","id","NodeAnimationFrameStrategy","__publicField","_id","AnimationFrameManager","EventManager","type","listener","listeners","event","package_default","createRendererModule","_scriptDir","moduleArg","Module","readyPromiseResolve","readyPromiseReject","resolve","reject","moduleOverrides","arguments_","thisProgram","quit_","status","toThrow","ENVIRONMENT_IS_WEB","ENVIRONMENT_IS_WORKER","scriptDirectory","locateFile","path","read_","readAsync","readBinary","url","xhr","onload","onerror","out","err","wasmBinary","abort","wasmMemory","ABORT","EXITSTATUS","assert","condition","text","HEAP8","HEAPU8","HEAP16","HEAPU16","HEAP32","HEAPU32","HEAPF32","HEAPF64","updateMemoryViews","b","__ATPRERUN__","__ATINIT__","__ATPOSTRUN__","runtimeInitialized","preRun","addOnPreRun","callRuntimeCallbacks","initRuntime","postRun","addOnPostRun","cb","addOnInit","runDependencies","runDependencyWatcher","dependenciesFulfilled","addRunDependency","removeRunDependency","what","e","dataURIPrefix","isDataURI","filename","wasmBinaryFile","getBinarySync","file","getBinaryPromise","binaryFile","response","instantiateArrayBuffer","imports","receiver","binary","instance","reason","instantiateAsync","result","createWasm","info","wasmImports","receiveInstance","module","wasmExports","wasmTable","receiveInstantiationResult","callbacks","noExitRuntime","UTF8Decoder","UTF8ArrayToString","heapOrArray","idx","maxBytesToRead","endIdx","endPtr","str","u0","u1","u2","ch","UTF8ToString","ptr","___assert_fail","line","func","SYSCALLS","ret","___syscall_fcntl64","fd","cmd","varargs","___syscall_ioctl","op","___syscall_openat","dirfd","flags","__embind_register_bigint","primitiveType","name","size","minRange","maxRange","embind_init_charCodes","codes","embind_charCodes","readLatin1String","c","awaitingDependencies","registeredTypes","typeDependencies","BindingError","throwBindingError","message","InternalError","throwInternalError","whenDependentTypesAreResolved","myTypes","dependentTypes","getTypeConverters","onComplete","typeConverters","myTypeConverters","i","registerType","unregisteredTypes","registered","dt","sharedRegisterType","rawType","registeredInstance","options","GenericWireTypeSize","__embind_register_bool","trueValue","falseValue","wt","destructors","o","pointer","shallowCopyInternalPointer","throwInstanceAlreadyDeleted","obj","getInstanceTypeName","handle","finalizationRegistry","detachFinalizer","runDestructor","$$","releaseClassHandle","toDelete","downcastPointer","ptrClass","desiredClass","rv","registeredPointers","getInheritedInstanceCount","registeredInstances","getLiveInheritedInstances","k","deletionQueue","flushPendingDeletes","delayFunction","setDelayFunction","fn","init_embind","getBasestPointer","class_","getInheritedInstance","makeClassHandle","prototype","record","hasSmartPtrType","hasSmartPtr","attachFinalizer","RegisteredPointer_fromWireType","rawPointer","makeDefaultHandle","actualType","registeredPointerRecord","toType","dp","init_ClassHandle","ClassHandle","other","leftClass","left","rightClass","right","clone","char_0","char_9","makeLegalFunctionName","f","createNamedFunction","body","ensureOverloadTable","proto","methodName","humanName","prevFunc","exposePublicSymbol","value","numArguments","RegisteredClass","constructor","instancePrototype","rawDestructor","baseClass","getActualType","upcast","downcast","upcastPointer","constNoSmartPtrRawPointerToWireType","embindRepr","handleClass","genericPointerToWireType","clonedHandle","Emval","nonConstNoSmartPtrRawPointerToWireType","readPointer","init_RegisteredPointer","RegisteredPointer","registeredClass","isReference","isConst","isSmartPointer","pointeeType","sharingPolicy","rawGetPointee","rawConstructor","rawShare","replacePublicSymbol","dynCallLegacy","sig","args","getWasmTableEntry","funcPtr","dynCall","rtn","getDynCaller","argCache","embind__requireFunction","signature","rawFunction","makeDynCaller","fp","extendError","baseErrorType","errorName","errorClass","stack","UnboundTypeError","getTypeName","___getTypeName","_free","throwUnboundTypeError","types","unboundTypes","seen","visit","__embind_register_class","rawPointerType","rawConstPointerType","baseClassRawType","getActualTypeSignature","upcastSignature","downcastSignature","destructorSignature","legalFunctionName","base","basePrototype","referenceConverter","pointerConverter","constPointerConverter","heap32VectorToArray","count","firstElement","array","runDestructors","del","craftInvokerFunction","argTypes","classType","cppInvokerFunc","cppTargetFunc","isAsync","argCount","isClassMethodFunc","needsDestructorStack","returns","expectedArgCount","argsWired","invokerFuncArgs","thisWired","onDone","param","__embind_register_class_constructor","rawClassType","rawArgTypesAddr","invokerSignature","invoker","rawArgTypes","getFunctionName","argsIndex","__embind_register_class_function","rawInvoker","context","isPureVirtual","unboundTypesHandler","method","memberFunction","handleAllocatorInit","HandleAllocator","emval_handles","__emval_decref","count_emval_handles","init_emval","simpleReadValueFromPointer","__embind_register_emval","v","t","floatReadValueFromPointer","width","__embind_register_float","integerReadValueFromPointer","signed","__embind_register_integer","fromWireType","bitshift","isUnsignedType","checkAssertions","toTypeName","toWireType","__embind_register_memory_view","dataTypeIndex","typeMapping","TA","decodeMemoryView","data","stringToUTF8Array","heap","outIdx","maxBytesToWrite","startIdx","u","stringToUTF8","outPtr","lengthBytesUTF8","len","__embind_register_std_string","stdStringIsUTF8","length","payload","decodeStartPtr","currentBytePtr","maxRead","stringSegment","a","valueIsOfTypeString","_malloc","charCode","UTF16Decoder","UTF16ToString","maxIdx","codeUnit","stringToUTF16","startPtr","numCharsToWrite","lengthBytesUTF16","UTF32ToString","utf32","stringToUTF32","trailSurrogate","lengthBytesUTF32","__embind_register_std_wstring","charSize","decodeString","encodeString","getHeap","lengthBytesUTF","shift","HEAP","maxReadBytes","__embind_register_void","__emscripten_throw_longjmp","__emval_incref","requireRegisteredType","impl","__emval_take_value","arg","_abort","_emscripten_memcpy_js","dest","src","num","getHeapMax","growMemory","pages","_emscripten_resize_heap","requestedSize","oldSize","maxHeapSize","alignUp","x","multiple","cutDown","overGrownHeapSize","newSize","replacement","_fd_close","_fd_read","iov","iovcnt","pnum","convertI32PairToI53Checked","lo","hi","_fd_seek","offset_low","offset_high","whence","newOffset","offset","printCharBuffers","printChar","stream","curr","buffer","_fd_write","j","invoke_ii","invoke_iiii","invoke_iiiiii","invoke_vi","invoke_vii","invoke_viiii","invoke_viiij","___wasm_call_ctors","a0","__embind_initialize_bindings","___errno_location","_setThrew","a1","stackSave","stackRestore","___cxa_increment_exception_refcount","___cxa_is_pointer_type","dynCall_viiij","a2","a3","a4","a5","dynCall_jiji","index","sp","calledRun","runCaller","run","doRun","renderer_default","WasmLoader","initialError","backupUrl","backupError","ch2","wk","msg","transfer","w","d","ed","u8","u16","i32","fleb","fdeb","clim","freb","eb","start","r","_a","fl","revfl","_b","revfd","rev","hMap","cd","mb","s","l","le","co","rvb","sv","r_1","m","flt","fdt","flrm","fdrm","max","bits","p","bits16","shft","slc","n","ec","ind","nt","inflt","dat","st","buf","dict","sl","dl","noBuf","noSt","cbuf","bl","nbuf","final","pos","bt","lm","dm","lbt","dbt","tbts","hLit","hcLen","tl","ldt","clt","clb","clbmsk","clm","lt","lms","dms","lpos","sym","add","dsym","end","dend","et","mrg","wcln","fnStr","td","ks","st_1","spInd","cbfs","wrkr","fns","init","td_1","bInflt","inflateSync","pbf","gopt","cbify","opts","b2","b4","b8","inflate","ev","tds","dutf8","strFromU8","latin1","slzh","zh","z","fnl","es","bs","z64e","sc","su","off","mt","unzip","term","tAll","files","cbd","lft","ze","fltr","_loop_3","c_1","no","cbl","infl","flatten","arg1","flatErrors","issue","key","ValiError","issues","symbol","getIssue","getPipeInfo","executePipe","input","pipe","parseInfo","pipeInfo","output","action","getDefaultArgs","arg2","getIssues","validation","any","item","arg3","error","value2","pathItem","boolean","literal","literal2","nativeEnum","nativeEnum2","number","object","object2","cachedEntries","schema","optional","wrapped","string","getRecordArgs","arg4","error2","pipe2","BLOCKED_KEYS","inputKey","inputValue","keyResult","valueResult","getTupleArgs","tuple","items","rest","union","union2","merge","schemas","schemas2","omit","keys","schema2","safeParse","maxValue","requirement","minValue","exports","copy","source","sx","sy","sw","sh","dx","dy","sourceData","destData","y","sourceY","destY","sourceX","destX","sourceIndex","fill","channels","allZero","height","fixedFracBits","filterValue","xPi","toFixedPoint","filters","srcSize","destSize","scale","use2","scaleInverted","scaleClamped","srcWindow","maxFilterElementSize","packedFilter","packedFilterPtr","destPixel","sourcePixel","sourceFirst","sourceLast","filterElementSize","floatFilter","fxpFilter","total","pixel","floatValue","filterTotal","index2","filterValue2","leftNotEmpty","rightNotEmpty","filterShift","filterSize","convolve","dw","srcOffset","destOffset","filterPtr","srcPtr","g","filters_1","require_filters","convolve_1","require_convolve","resize","xRatio","yRatio","filtersX","filtersY","tmp","lanczos2","dh","croppedSource","create_image_1","copy_1","croppedDest","lanczos22","PlayModeSchema","ManifestThemeSchema","ManifestSchema","PlaybackOptionsSchema","ManifestAnimationSchema","TransitionableSchema","StateTransitionOnClickSchema","StateTransitionOnAfterSchema","StateTransitionOnEnterSchema","StateTransitionOnMouseEnterSchema","StateTransitionOnMouseLeaveSchema","StateTransitionOnCompleteSchema","StateTransitionOnShowSchema","DotLottieStateTransitionEventsSchema","DotLottieStatePlaybackSettingsSchema","DotLottieStateSchema","DotLottieStateMachineSchema","DotLottieStateMachineDescriptorSchema","DotLottieStatesSchema","MIME_TYPES","MIME_CODES","bytes","base64","withoutMeta","bufData","mimeType","dataArr","byte","DotLottieError","code","dataUrlFromU8","uint8Data","binaryString","getMimeTypeFromBase64","isImageAsset","asset","isAudioAsset","unzipDotLottie","dotLottie","filter","unzipDotLottieFile","getManifest","manifestFileName","unzippedManifest","validateDotLottie","manifest","manifestValidationResult","loadFromArrayBuffer","arrayBuffer","validationResult","getAllAudio","unzippedAudio","audio","audioPath","unzippedSingleAudio","audioId","inlineAudioAssets","animations","audioMap","animationId","animationData","animationIdsSet","audioDataURL","getImages","unzippedImages","images","imagePath","unzippedImage","imageId","inlineImageAssets","imagesMap","imageDataURL","getAnimation","inlineAssets","animationFilename","unzippedAnimation","animationsMap","__read","ar","__spreadArray","to","from","il","VanilaConverter","VanilaConverter2","document2","glayScaleCalculator","resizer","canvas","ctx","_this","img","colorMap","resizedColorMap","glayArraySouce","VanilaConverter_default","HashSource","HashSource2","hashSize","HashSource_default","import_lanczos","__toESM","require_dist3","LanczosResizer","LanczosResizer2","nativeWidth","nativeHeight","expectedWidth","expectedHeight","sourceImageData","ImageDataSouce","destImageData","LanczosResizer_default","ImageDataSouce2","__read2","Hash","Hash2","rawHash","row","hash","target","diff","array3","chunk","__spreadArray2","binalyNumbers","Hash_default","__read3","__spreadArray3","HashGenerator","HashGenerator2","glayImage","glayImageDrawingCanvasContext","imageData","glayArray","binaryNumbers","colors","_","glayImageSource","HashGenerator_default","ITU_R601_2Method","__awaiter","thisArg","_arguments","P","generator","adopt","fulfilled","step","rejected","__generator","verb","DifferenceHashBuilder","DifferenceHashBuilder2","dHashConverter","hashableImageSouce","getAnimationJSONFromDotLottie","dotLottieBuffer","loadedDotLottieFile","activeAnimationId","loadAnimationJSONFromURL","animationURL","contentType","animationJSON","isHexColor","color","hexStringToRGBAInt","colorHex","hex","DotLottie","config","loadAnimation","clampedBuffer","effectiveStartFrame","effectiveEndFrame","frameDuration","frameProgress","shouldUpdate","frame","effectiveDuration","effectiveTotalFrames","frameTime","speed","currentTime","loop","mode","startFrame","endFrame","rgbaInt","dpr"],"mappings":"4KAIO,IAAMA,GAAa,OAAO,OAAW,IAC/BC,GAAmB,IACnBC,GAAmB,YCOhC,IAAMC,GAAN,KAAkE,CACzD,sBAAsBC,EAA0C,CACrE,OAAO,OAAO,sBAAsBA,CAAQ,CAC9C,CAEO,qBAAqBC,EAAkB,CAC5C,OAAO,qBAAqBA,CAAE,CAChC,CACF,EAEMC,GAAN,KAAmE,CAAnE,cACEC,EAAA,KAAQ,gBAAwB,GAEhCA,EAAA,KAAQ,iBAA0C,MAE3C,sBAAsBH,EAA0C,CACrE,OAAI,KAAK,eAAiB,OAAO,mBAC/B,KAAK,cAAgB,GAGvB,KAAK,eAAiB,EAEtB,KAAK,eAAiB,aAAa,IAAM,CACvCA,EAAS,KAAK,IAAI,CAAC,CACrB,CAAC,EAEM,KAAK,aACd,CAEO,qBAAqBI,EAAmB,CACzC,KAAK,gBACP,eAAe,KAAK,cAAc,CAEtC,CACF,EAEaC,GAAN,KAA4B,CAG1B,aAAc,CAFrBF,EAAA,KAAiB,aAGf,KAAK,UAAYP,GAAa,IAAIG,GAA8B,IAAIG,EACtE,CAEO,sBAAsBF,EAA0C,CACrE,OAAO,KAAK,UAAU,sBAAsBA,CAAQ,CACtD,CAEO,qBAAqBC,EAAkB,CAC5C,KAAK,UAAU,qBAAqBA,CAAE,CACxC,CACF,ECwFO,IAAMK,GAAN,KAAmB,CAAnB,cACLH,EAAA,KAAiB,kBAAiE,IAAI,KAE/E,iBAAsCI,EAASC,EAAkC,CACtF,IAAIC,EAAY,KAAK,gBAAgB,IAAIF,CAA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AAW0B,EAAmB,CAC1C8c,GAAW,WAAW9c,CAAG,CAC3B,CAMO,SAAgB,CACrB,KAAK,mBAAmB,EACxB,KAAK,eAAiB,UAEtB,KAAK,SAAW,KAChB,KAAK,UAAY,KAEjB,KAAK,cAAc,SAAS,CAC1B,KAAM,SACR,CAAC,EAED,KAAK,cAAc,wBAAwB,CAC7C,CAMO,QAAe,CAChB,KAAK,YAET,KAAK,mBAAmB,EAExB,KAAK,UAAY,GAEjB,KAAK,cAAc,SAAS,CAC1B,KAAM,QACR,CAAC,EACH,CAMO,UAAiB,CACjB,KAAK,WAEV,KAAK,UAAY,GACjB,KAAK,cAAc,SAAS,CAAE,KAAM,UAAW,CAAC,EAG5C,KAAK,YACP,KAAK,4BAA4B,KAAK,aAAa,EACnD,KAAK,oBAAoB,GAE7B,CAOO,mBAAmB84B,EAAqB,CAC7C,KAAK,iBAAmBA,EAExB,IAAMuB,EAAUtB,GAAmBD,CAAK,EAExC,KAAK,WAAW,WAAWuB,CAAO,CACpC,CAWO,QAAe,CACpB,GAAI,CAAC38B,GAAY,OAEjB,GAAM,CAAE,OAAAstB,EAAQ,MAAA5W,CAAM,EAAI,KAAK,QAAQ,sBAAsB,EAEvDkmB,EAAM,KAAK,cAAc,kBAAoB,OAAO,kBAAoB,EAE9E,KAAK,QAAQ,MAAQlmB,EAAQkmB,EAC7B,KAAK,QAAQ,OAAStP,EAASsP,EAG/B,KAAK,QAAQ,CACf,CAGF","sourcesContent":["/**\n * Copyright 2023 Design Barn Inc.\n */\n\nexport const IS_BROWSER = typeof window !== 'undefined';\nexport const MS_TO_SEC_FACTOR = 1000;\nexport const DEFAULT_BG_COLOR = '#00000000';\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\n/* eslint-disable max-classes-per-file */\n\nimport { IS_BROWSER } from './constants';\n\ninterface AnimationFrameStrategy {\n cancelAnimationFrame(id: number): void;\n requestAnimationFrame(callback: (time: number) => void): number;\n}\n\nclass WebAnimationFrameStrategy implements AnimationFrameStrategy {\n public requestAnimationFrame(callback: (time: number) => void): number {\n return window.requestAnimationFrame(callback);\n }\n\n public cancelAnimationFrame(id: number): void {\n window.cancelAnimationFrame(id);\n }\n}\n\nclass NodeAnimationFrameStrategy implements AnimationFrameStrategy {\n private _lastHandleId: number = 0;\n\n private _lastImmediate: NodeJS.Immediate | null = null;\n\n public requestAnimationFrame(callback: (time: number) => void): number {\n if (this._lastHandleId >= Number.MAX_SAFE_INTEGER) {\n this._lastHandleId = 0;\n }\n\n this._lastHandleId += 1;\n\n this._lastImmediate = setImmediate(() => {\n callback(Date.now());\n });\n\n return this._lastHandleId;\n }\n\n public cancelAnimationFrame(_id: number): void {\n if (this._lastImmediate) {\n clearImmediate(this._lastImmediate);\n }\n }\n}\n\nexport class AnimationFrameManager {\n private readonly _strategy: AnimationFrameStrategy;\n\n public constructor() {\n this._strategy = IS_BROWSER ? new WebAnimationFrameStrategy() : new NodeAnimationFrameStrategy();\n }\n\n public requestAnimationFrame(callback: (time: number) => void): number {\n return this._strategy.requestAnimationFrame(callback);\n }\n\n public cancelAnimationFrame(id: number): void {\n this._strategy.cancelAnimationFrame(id);\n }\n}\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\n/**\n * Represents the different types of events that can be dispatched.\n */\nexport type EventType =\n | 'complete'\n | 'frame'\n | 'load'\n | 'loadError'\n | 'loop'\n | 'pause'\n | 'play'\n | 'stop'\n | 'destroy'\n | 'freeze'\n | 'unfreeze';\n\n/**\n * Maps an event type string to its respective event interface.\n */\ntype EventByType<T> = T extends 'complete'\n ? CompleteEvent\n : T extends 'frame'\n ? FrameEvent\n : T extends 'load'\n ? LoadEvent\n : T extends 'loadError'\n ? LoadErrorEvent\n : T extends 'loop'\n ? LoopEvent\n : T extends 'pause'\n ? PauseEvent\n : T extends 'play'\n ? PlayEvent\n : T extends 'stop'\n ? StopEvent\n : T extends 'destroy'\n ? DestroyEvent\n : T extends 'freeze'\n ? FreezeEvent\n : T extends 'unfreeze'\n ? UnfreezeEvent\n : never;\n\n/**\n * Base interface for all events.\n */\nexport interface BaseEvent {\n type: EventType;\n}\n\nexport interface FreezeEvent extends BaseEvent {\n type: 'freeze';\n}\n\nexport interface UnfreezeEvent extends BaseEvent {\n type: 'unfreeze';\n}\n\n/*\n * Event fired when a destroy action occurs.\n */\nexport interface DestroyEvent extends BaseEvent {\n type: 'destroy';\n}\n\n/**\n * Event fired when a loop action occurs.\n */\nexport interface LoopEvent extends BaseEvent {\n loopCount: number;\n type: 'loop';\n}\n\n/**\n * Event fired during frame changes.\n */\nexport interface FrameEvent extends BaseEvent {\n currentFrame: number;\n type: 'frame';\n}\n\n/**\n * Event fired when a load action occurs.\n */\nexport interface LoadEvent extends BaseEvent {\n type: 'load';\n}\n\n/**\n * Event fired when a loading error occurs.\n */\nexport interface LoadErrorEvent extends BaseEvent {\n error: Error;\n type: 'loadError';\n}\n\n/**\n * Event fired when a completion action occurs.\n */\nexport interface CompleteEvent extends BaseEvent {\n type: 'complete';\n}\n\n/**\n * Event fired when a pause action occurs.\n */\nexport interface PauseEvent extends BaseEvent {\n type: 'pause';\n}\n\n/**\n * Event fired when a play action occurs.\n */\nexport interface PlayEvent extends BaseEvent {\n type: 'play';\n}\n\n/**\n * Event fired when a stop action occurs.\n */\nexport interface StopEvent extends BaseEvent {\n type: 'stop';\n}\n\n/**\n * Represents all possible event types.\n */\nexport type Event =\n | LoopEvent\n | FrameEvent\n | LoadEvent\n | LoadErrorEvent\n | CompleteEvent\n | PauseEvent\n | PlayEvent\n | StopEvent;\n\n/**\n * Type for event listener callbacks.\n */\nexport interface EventListener<T extends EventType> {\n (event: EventByType<T>): void;\n}\n\n/**\n * Manages registration and dispatching of event listeners.\n */\nexport class EventManager {\n private readonly _eventListeners: Map<EventType, Set<EventListener<EventType>>> = new Map();\n\n public addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void {\n let listeners = this._eventListeners.get(type);\n\n if (!listeners) {\n listeners = new Set<EventListener<T>>();\n this._eventListeners.set(type, listeners);\n }\n\n listeners.add(listener);\n }\n\n public removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void {\n const listeners = this._eventListeners.get(type);\n\n if (!listeners) return;\n\n if (listener) {\n listeners.delete(listener);\n\n if (listeners.size === 0) {\n this._eventListeners.delete(type);\n }\n } else {\n this._eventListeners.delete(type);\n }\n }\n\n public dispatch<T extends EventType>(event: EventByType<T>): void {\n const listeners = this._eventListeners.get(event.type);\n\n listeners?.forEach((listener) => listener(event));\n }\n\n public removeAllEventListeners(): void {\n this._eventListeners.clear();\n }\n}\n","{\n \"name\": \"@lottiefiles/dotlottie-web\",\n \"version\": \"0.9.2\",\n \"type\": \"module\",\n \"description\": \"Lottie and DotLottie player for the web\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/LottieFiles/dotlottie-web.git\",\n \"directory\": \"packages/web\"\n },\n \"homepage\": \"https://github.com/LottieFiles/dotlottie-web#readme\",\n \"bugs\": \"https://github.com/LottieFiles/dotlottie-web/issues\",\n \"author\": \"LottieFiles\",\n \"contributors\": [\n \"Abdelrahman Ashraf <a.theashraf@gmail.com>\"\n ],\n \"license\": \"MIT\",\n \"engines\": {\n \"node\": \">=18\"\n },\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"keywords\": [\n \"dotlottie\",\n \"lottie\",\n \"player\",\n \"animation\",\n \"web\",\n \"canvas\",\n \"javascript\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:wasm\": \"./build_wasm.sh\",\n \"build:wasm:docker\": \"./docker_build_wasm.sh\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"eslint --fix .\",\n \"size:why\": \"size-limit --why --clean-dir --save-bundle ./tmp\",\n \"stats:eslint\": \"cross-env TIMING=1 eslint .\",\n \"stats:ts\": \"tsc -p tsconfig.build.json --extendedDiagnostics\",\n \"test\": \"vitest --watch=false\",\n \"test:coverage\": \"vitest --coverage --watch=false\",\n \"test:watch\": \"vitest --watch\",\n \"type-check\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@dotlottie/dotlottie-js\": \"^0.6.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.10.2\",\n \"@vitest/coverage-v8\": \"^1.0.1\",\n \"cross-env\": \"7.0.3\",\n \"tsup\": \"7.2.0\",\n \"typescript\": \"5.0.4\",\n \"vitest\": \"^1.0.1\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","var createRendererModule = (() => {\n var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;\n\n return function (moduleArg = {}) {\n var Module = moduleArg;\n\n var readyPromiseResolve, readyPromiseReject;\n\n Module['ready'] = new Promise((resolve, reject) => {\n readyPromiseResolve = resolve;\n readyPromiseReject = reject;\n });\n\n var moduleOverrides = Object.assign({}, Module);\n\n var arguments_ = [];\n\n var thisProgram = './this.program';\n\n var quit_ = (status, toThrow) => {\n throw toThrow;\n };\n\n var ENVIRONMENT_IS_WEB = true;\n\n var ENVIRONMENT_IS_WORKER = false;\n\n var scriptDirectory = '';\n\n function locateFile(path) {\n if (Module['locateFile']) {\n return Module['locateFile'](path, scriptDirectory);\n }\n return scriptDirectory + path;\n }\n\n var read_, readAsync, readBinary;\n\n if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {\n if (ENVIRONMENT_IS_WORKER) {\n scriptDirectory = self.location.href;\n } else if (typeof document != 'undefined' && document.currentScript) {\n scriptDirectory = document.currentScript.src;\n }\n if (_scriptDir) {\n scriptDirectory = _scriptDir;\n }\n if (scriptDirectory.indexOf('blob:') !== 0) {\n scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/') + 1);\n } else {\n scriptDirectory = '';\n }\n {\n read_ = (url) => {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, false);\n xhr.send(null);\n return xhr.responseText;\n };\n if (ENVIRONMENT_IS_WORKER) {\n readBinary = (url) => {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, false);\n xhr.responseType = 'arraybuffer';\n xhr.send(null);\n return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response));\n };\n }\n readAsync = (url, onload, onerror) => {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'arraybuffer';\n xhr.onload = () => {\n if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {\n onload(xhr.response);\n return;\n }\n onerror();\n };\n xhr.onerror = onerror;\n xhr.send(null);\n };\n }\n } else {\n }\n\n var out = Module['print'] || console.log.bind(console);\n\n var err = Module['printErr'] || console.error.bind(console);\n\n Object.assign(Module, moduleOverrides);\n\n moduleOverrides = null;\n\n if (Module['arguments']) arguments_ = Module['arguments'];\n\n if (Module['thisProgram']) thisProgram = Module['thisProgram'];\n\n if (Module['quit']) quit_ = Module['quit'];\n\n var wasmBinary;\n\n if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];\n\n if (typeof WebAssembly != 'object') {\n abort('no native wasm support detected');\n }\n\n var wasmMemory;\n\n var ABORT = false;\n\n var EXITSTATUS;\n\n /** @type {function(*, string=)} */ function assert(condition, text) {\n if (!condition) {\n abort(text);\n }\n }\n\n var /** @type {!Int8Array} */ HEAP8,\n /** @type {!Uint8Array} */ HEAPU8,\n /** @type {!Int16Array} */ HEAP16,\n /** @type {!Uint16Array} */ HEAPU16,\n /** @type {!Int32Array} */ HEAP32,\n /** @type {!Uint32Array} */ HEAPU32,\n /** @type {!Float32Array} */ HEAPF32,\n /** @type {!Float64Array} */ HEAPF64;\n\n function updateMemoryViews() {\n var b = wasmMemory.buffer;\n Module['HEAP8'] = HEAP8 = new Int8Array(b);\n Module['HEAP16'] = HEAP16 = new Int16Array(b);\n Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);\n Module['HEAPU16'] = HEAPU16 = new Uint16Array(b);\n Module['HEAP32'] = HEAP32 = new Int32Array(b);\n Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);\n Module['HEAPF32'] = HEAPF32 = new Float32Array(b);\n Module['HEAPF64'] = HEAPF64 = new Float64Array(b);\n }\n\n var __ATPRERUN__ = [];\n\n var __ATINIT__ = [];\n\n var __ATPOSTRUN__ = [];\n\n var runtimeInitialized = false;\n\n function preRun() {\n if (Module['preRun']) {\n if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];\n while (Module['preRun'].length) {\n addOnPreRun(Module['preRun'].shift());\n }\n }\n callRuntimeCallbacks(__ATPRERUN__);\n }\n\n function initRuntime() {\n runtimeInitialized = true;\n callRuntimeCallbacks(__ATINIT__);\n }\n\n function postRun() {\n if (Module['postRun']) {\n if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];\n while (Module['postRun'].length) {\n addOnPostRun(Module['postRun'].shift());\n }\n }\n callRuntimeCallbacks(__ATPOSTRUN__);\n }\n\n function addOnPreRun(cb) {\n __ATPRERUN__.unshift(cb);\n }\n\n function addOnInit(cb) {\n __ATINIT__.unshift(cb);\n }\n\n function addOnPostRun(cb) {\n __ATPOSTRUN__.unshift(cb);\n }\n\n var runDependencies = 0;\n\n var runDependencyWatcher = null;\n\n var dependenciesFulfilled = null;\n\n function addRunDependency(id) {\n runDependencies++;\n if (Module['monitorRunDependencies']) {\n Module['monitorRunDependencies'](runDependencies);\n }\n }\n\n function removeRunDependency(id) {\n runDependencies--;\n if (Module['monitorRunDependencies']) {\n Module['monitorRunDependencies'](runDependencies);\n }\n if (runDependencies == 0) {\n if (runDependencyWatcher !== null) {\n clearInterval(runDependencyWatcher);\n runDependencyWatcher = null;\n }\n if (dependenciesFulfilled) {\n var callback = dependenciesFulfilled;\n dependenciesFulfilled = null;\n callback();\n }\n }\n }\n\n /** @param {string|number=} what */ function abort(what) {\n if (Module['onAbort']) {\n Module['onAbort'](what);\n }\n what = 'Aborted(' + what + ')';\n err(what);\n ABORT = true;\n EXITSTATUS = 1;\n what += '. Build with -sASSERTIONS for more info.';\n /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);\n readyPromiseReject(e);\n throw e;\n }\n\n var dataURIPrefix = 'data:application/octet-stream;base64,';\n\n /**\n * Indicates whether filename is a base64 data URI.\n * @noinline\n */ var isDataURI = (filename) => filename.startsWith(dataURIPrefix);\n\n var wasmBinaryFile;\n\n wasmBinaryFile = 'renderer.wasm';\n\n if (!isDataURI(wasmBinaryFile)) {\n wasmBinaryFile = locateFile(wasmBinaryFile);\n }\n\n function getBinarySync(file) {\n if (file == wasmBinaryFile && wasmBinary) {\n return new Uint8Array(wasmBinary);\n }\n if (readBinary) {\n return readBinary(file);\n }\n throw 'both async and sync fetching of the wasm failed';\n }\n\n function getBinaryPromise(binaryFile) {\n if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {\n if (typeof fetch == 'function') {\n return fetch(binaryFile, {\n credentials: 'same-origin',\n })\n .then((response) => {\n if (!response['ok']) {\n throw \"failed to load wasm binary file at '\" + binaryFile + \"'\";\n }\n return response['arrayBuffer']();\n })\n .catch(() => getBinarySync(binaryFile));\n }\n }\n return Promise.resolve().then(() => getBinarySync(binaryFile));\n }\n\n function instantiateArrayBuffer(binaryFile, imports, receiver) {\n return getBinaryPromise(binaryFile)\n .then((binary) => WebAssembly.instantiate(binary, imports))\n .then((instance) => instance)\n .then(receiver, (reason) => {\n err(`failed to asynchronously prepare wasm: ${reason}`);\n abort(reason);\n });\n }\n\n function instantiateAsync(binary, binaryFile, imports, callback) {\n if (\n !binary &&\n typeof WebAssembly.instantiateStreaming == 'function' &&\n !isDataURI(binaryFile) &&\n typeof fetch == 'function'\n ) {\n return fetch(binaryFile, {\n credentials: 'same-origin',\n }).then((response) => {\n /** @suppress {checkTypes} */ var result = WebAssembly.instantiateStreaming(response, imports);\n return result.then(callback, function (reason) {\n err(`wasm streaming compile failed: ${reason}`);\n err('falling back to ArrayBuffer instantiation');\n return instantiateArrayBuffer(binaryFile, imports, callback);\n });\n });\n }\n return instantiateArrayBuffer(binaryFile, imports, callback);\n }\n\n function createWasm() {\n var info = {\n a: wasmImports,\n };\n /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) {\n wasmExports = instance.exports;\n wasmMemory = wasmExports['I'];\n updateMemoryViews();\n wasmTable = wasmExports['O'];\n addOnInit(wasmExports['J']);\n removeRunDependency('wasm-instantiate');\n return wasmExports;\n }\n addRunDependency('wasm-instantiate');\n function receiveInstantiationResult(result) {\n receiveInstance(result['instance']);\n }\n if (Module['instantiateWasm']) {\n try {\n return Module['instantiateWasm'](info, receiveInstance);\n } catch (e) {\n err(`Module.instantiateWasm callback failed with error: ${e}`);\n readyPromiseReject(e);\n }\n }\n instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);\n return {};\n }\n\n var callRuntimeCallbacks = (callbacks) => {\n while (callbacks.length > 0) {\n callbacks.shift()(Module);\n }\n };\n\n var noExitRuntime = Module['noExitRuntime'] || true;\n\n var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined;\n\n /**\n * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given\n * array that contains uint8 values, returns a copy of that string as a\n * Javascript String object.\n * heapOrArray is either a regular array, or a JavaScript typed array view.\n * @param {number} idx\n * @param {number=} maxBytesToRead\n * @return {string}\n */ var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {\n var endIdx = idx + maxBytesToRead;\n var endPtr = idx;\n while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;\n if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {\n return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));\n }\n var str = '';\n while (idx < endPtr) {\n var u0 = heapOrArray[idx++];\n if (!(u0 & 128)) {\n str += String.fromCharCode(u0);\n continue;\n }\n var u1 = heapOrArray[idx++] & 63;\n if ((u0 & 224) == 192) {\n str += String.fromCharCode(((u0 & 31) << 6) | u1);\n continue;\n }\n var u2 = heapOrArray[idx++] & 63;\n if ((u0 & 240) == 224) {\n u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;\n } else {\n u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);\n }\n if (u0 < 65536) {\n str += String.fromCharCode(u0);\n } else {\n var ch = u0 - 65536;\n str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));\n }\n }\n return str;\n };\n\n /**\n * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the\n * emscripten HEAP, returns a copy of that string as a Javascript String object.\n *\n * @param {number} ptr\n * @param {number=} maxBytesToRead - An optional length that specifies the\n * maximum number of bytes to read. You can omit this parameter to scan the\n * string until the first 0 byte. If maxBytesToRead is passed, and the string\n * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the\n * string will cut short at that byte index (i.e. maxBytesToRead will not\n * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing\n * frequent uses of UTF8ToString() with and without maxBytesToRead may throw\n * JS JIT optimizations off, so it is worth to consider consistently using one\n * @return {string}\n */ var UTF8ToString = (ptr, maxBytesToRead) => (ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '');\n\n var ___assert_fail = (condition, filename, line, func) => {\n abort(\n `Assertion failed: ${UTF8ToString(condition)}, at: ` +\n [\n filename ? UTF8ToString(filename) : 'unknown filename',\n line,\n func ? UTF8ToString(func) : 'unknown function',\n ],\n );\n };\n\n var SYSCALLS = {\n varargs: undefined,\n get() {\n var ret = HEAP32[+SYSCALLS.varargs >> 2];\n SYSCALLS.varargs += 4;\n return ret;\n },\n getp() {\n return SYSCALLS.get();\n },\n getStr(ptr) {\n var ret = UTF8ToString(ptr);\n return ret;\n },\n };\n\n function ___syscall_fcntl64(fd, cmd, varargs) {\n SYSCALLS.varargs = varargs;\n return 0;\n }\n\n function ___syscall_ioctl(fd, op, varargs) {\n SYSCALLS.varargs = varargs;\n return 0;\n }\n\n function ___syscall_openat(dirfd, path, flags, varargs) {\n SYSCALLS.varargs = varargs;\n }\n\n var __embind_register_bigint = (primitiveType, name, size, minRange, maxRange) => {};\n\n var embind_init_charCodes = () => {\n var codes = new Array(256);\n for (var i = 0; i < 256; ++i) {\n codes[i] = String.fromCharCode(i);\n }\n embind_charCodes = codes;\n };\n\n var embind_charCodes;\n\n var readLatin1String = (ptr) => {\n var ret = '';\n var c = ptr;\n while (HEAPU8[c]) {\n ret += embind_charCodes[HEAPU8[c++]];\n }\n return ret;\n };\n\n var awaitingDependencies = {};\n\n var registeredTypes = {};\n\n var typeDependencies = {};\n\n var BindingError;\n\n var throwBindingError = (message) => {\n throw new BindingError(message);\n };\n\n var InternalError;\n\n var throwInternalError = (message) => {\n throw new InternalError(message);\n };\n\n var whenDependentTypesAreResolved = (myTypes, dependentTypes, getTypeConverters) => {\n myTypes.forEach(function (type) {\n typeDependencies[type] = dependentTypes;\n });\n function onComplete(typeConverters) {\n var myTypeConverters = getTypeConverters(typeConverters);\n if (myTypeConverters.length !== myTypes.length) {\n throwInternalError('Mismatched type converter count');\n }\n for (var i = 0; i < myTypes.length; ++i) {\n registerType(myTypes[i], myTypeConverters[i]);\n }\n }\n var typeConverters = new Array(dependentTypes.length);\n var unregisteredTypes = [];\n var registered = 0;\n dependentTypes.forEach((dt, i) => {\n if (registeredTypes.hasOwnProperty(dt)) {\n typeConverters[i] = registeredTypes[dt];\n } else {\n unregisteredTypes.push(dt);\n if (!awaitingDependencies.hasOwnProperty(dt)) {\n awaitingDependencies[dt] = [];\n }\n awaitingDependencies[dt].push(() => {\n typeConverters[i] = registeredTypes[dt];\n ++registered;\n if (registered === unregisteredTypes.length) {\n onComplete(typeConverters);\n }\n });\n }\n });\n if (0 === unregisteredTypes.length) {\n onComplete(typeConverters);\n }\n };\n\n /** @param {Object=} options */ function sharedRegisterType(rawType, registeredInstance, options = {}) {\n var name = registeredInstance.name;\n if (!rawType) {\n throwBindingError(`type \"${name}\" must have a positive integer typeid pointer`);\n }\n if (registeredTypes.hasOwnProperty(rawType)) {\n if (options.ignoreDuplicateRegistrations) {\n return;\n } else {\n throwBindingError(`Cannot register type '${name}' twice`);\n }\n }\n registeredTypes[rawType] = registeredInstance;\n delete typeDependencies[rawType];\n if (awaitingDependencies.hasOwnProperty(rawType)) {\n var callbacks = awaitingDependencies[rawType];\n delete awaitingDependencies[rawType];\n callbacks.forEach((cb) => cb());\n }\n }\n\n /** @param {Object=} options */ function registerType(rawType, registeredInstance, options = {}) {\n if (!('argPackAdvance' in registeredInstance)) {\n throw new TypeError('registerType registeredInstance requires argPackAdvance');\n }\n return sharedRegisterType(rawType, registeredInstance, options);\n }\n\n var GenericWireTypeSize = 8;\n\n /** @suppress {globalThis} */ var __embind_register_bool = (rawType, name, trueValue, falseValue) => {\n name = readLatin1String(name);\n registerType(rawType, {\n name: name,\n fromWireType: function (wt) {\n return !!wt;\n },\n toWireType: function (destructors, o) {\n return o ? trueValue : falseValue;\n },\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: function (pointer) {\n return this['fromWireType'](HEAPU8[pointer]);\n },\n destructorFunction: null,\n });\n };\n\n var shallowCopyInternalPointer = (o) => ({\n count: o.count,\n deleteScheduled: o.deleteScheduled,\n preservePointerOnDelete: o.preservePointerOnDelete,\n ptr: o.ptr,\n ptrType: o.ptrType,\n smartPtr: o.smartPtr,\n smartPtrType: o.smartPtrType,\n });\n\n var throwInstanceAlreadyDeleted = (obj) => {\n function getInstanceTypeName(handle) {\n return handle.$$.ptrType.registeredClass.name;\n }\n throwBindingError(getInstanceTypeName(obj) + ' instance already deleted');\n };\n\n var finalizationRegistry = false;\n\n var detachFinalizer = (handle) => {};\n\n var runDestructor = ($$) => {\n if ($$.smartPtr) {\n $$.smartPtrType.rawDestructor($$.smartPtr);\n } else {\n $$.ptrType.registeredClass.rawDestructor($$.ptr);\n }\n };\n\n var releaseClassHandle = ($$) => {\n $$.count.value -= 1;\n var toDelete = 0 === $$.count.value;\n if (toDelete) {\n runDestructor($$);\n }\n };\n\n var downcastPointer = (ptr, ptrClass, desiredClass) => {\n if (ptrClass === desiredClass) {\n return ptr;\n }\n if (undefined === desiredClass.baseClass) {\n return null;\n }\n var rv = downcastPointer(ptr, ptrClass, desiredClass.baseClass);\n if (rv === null) {\n return null;\n }\n return desiredClass.downcast(rv);\n };\n\n var registeredPointers = {};\n\n var getInheritedInstanceCount = () => Object.keys(registeredInstances).length;\n\n var getLiveInheritedInstances = () => {\n var rv = [];\n for (var k in registeredInstances) {\n if (registeredInstances.hasOwnProperty(k)) {\n rv.push(registeredInstances[k]);\n }\n }\n return rv;\n };\n\n var deletionQueue = [];\n\n var flushPendingDeletes = () => {\n while (deletionQueue.length) {\n var obj = deletionQueue.pop();\n obj.$$.deleteScheduled = false;\n obj['delete']();\n }\n };\n\n var delayFunction;\n\n var setDelayFunction = (fn) => {\n delayFunction = fn;\n if (deletionQueue.length && delayFunction) {\n delayFunction(flushPendingDeletes);\n }\n };\n\n var init_embind = () => {\n Module['getInheritedInstanceCount'] = getInheritedInstanceCount;\n Module['getLiveInheritedInstances'] = getLiveInheritedInstances;\n Module['flushPendingDeletes'] = flushPendingDeletes;\n Module['setDelayFunction'] = setDelayFunction;\n };\n\n var registeredInstances = {};\n\n var getBasestPointer = (class_, ptr) => {\n if (ptr === undefined) {\n throwBindingError('ptr should not be undefined');\n }\n while (class_.baseClass) {\n ptr = class_.upcast(ptr);\n class_ = class_.baseClass;\n }\n return ptr;\n };\n\n var getInheritedInstance = (class_, ptr) => {\n ptr = getBasestPointer(class_, ptr);\n return registeredInstances[ptr];\n };\n\n var makeClassHandle = (prototype, record) => {\n if (!record.ptrType || !record.ptr) {\n throwInternalError('makeClassHandle requires ptr and ptrType');\n }\n var hasSmartPtrType = !!record.smartPtrType;\n var hasSmartPtr = !!record.smartPtr;\n if (hasSmartPtrType !== hasSmartPtr) {\n throwInternalError('Both smartPtrType and smartPtr must be specified');\n }\n record.count = {\n value: 1,\n };\n return attachFinalizer(\n Object.create(prototype, {\n $$: {\n value: record,\n },\n }),\n );\n };\n\n /** @suppress {globalThis} */ function RegisteredPointer_fromWireType(ptr) {\n var rawPointer = this.getPointee(ptr);\n if (!rawPointer) {\n this.destructor(ptr);\n return null;\n }\n var registeredInstance = getInheritedInstance(this.registeredClass, rawPointer);\n if (undefined !== registeredInstance) {\n if (0 === registeredInstance.$$.count.value) {\n registeredInstance.$$.ptr = rawPointer;\n registeredInstance.$$.smartPtr = ptr;\n return registeredInstance['clone']();\n } else {\n var rv = registeredInstance['clone']();\n this.destructor(ptr);\n return rv;\n }\n }\n function makeDefaultHandle() {\n if (this.isSmartPointer) {\n return makeClassHandle(this.registeredClass.instancePrototype, {\n ptrType: this.pointeeType,\n ptr: rawPointer,\n smartPtrType: this,\n smartPtr: ptr,\n });\n } else {\n return makeClassHandle(this.registeredClass.instancePrototype, {\n ptrType: this,\n ptr: ptr,\n });\n }\n }\n var actualType = this.registeredClass.getActualType(rawPointer);\n var registeredPointerRecord = registeredPointers[actualType];\n if (!registeredPointerRecord) {\n return makeDefaultHandle.call(this);\n }\n var toType;\n if (this.isConst) {\n toType = registeredPointerRecord.constPointerType;\n } else {\n toType = registeredPointerRecord.pointerType;\n }\n var dp = downcastPointer(rawPointer, this.registeredClass, toType.registeredClass);\n if (dp === null) {\n return makeDefaultHandle.call(this);\n }\n if (this.isSmartPointer) {\n return makeClassHandle(toType.registeredClass.instancePrototype, {\n ptrType: toType,\n ptr: dp,\n smartPtrType: this,\n smartPtr: ptr,\n });\n } else {\n return makeClassHandle(toType.registeredClass.instancePrototype, {\n ptrType: toType,\n ptr: dp,\n });\n }\n }\n\n var attachFinalizer = (handle) => {\n if ('undefined' === typeof FinalizationRegistry) {\n attachFinalizer = (handle) => handle;\n return handle;\n }\n finalizationRegistry = new FinalizationRegistry((info) => {\n releaseClassHandle(info.$$);\n });\n attachFinalizer = (handle) => {\n var $$ = handle.$$;\n var hasSmartPtr = !!$$.smartPtr;\n if (hasSmartPtr) {\n var info = {\n $$: $$,\n };\n finalizationRegistry.register(handle, info, handle);\n }\n return handle;\n };\n detachFinalizer = (handle) => finalizationRegistry.unregister(handle);\n return attachFinalizer(handle);\n };\n\n var init_ClassHandle = () => {\n Object.assign(ClassHandle.prototype, {\n isAliasOf(other) {\n if (!(this instanceof ClassHandle)) {\n return false;\n }\n if (!(other instanceof ClassHandle)) {\n return false;\n }\n var leftClass = this.$$.ptrType.registeredClass;\n var left = this.$$.ptr;\n other.$$ = /** @type {Object} */ (other.$$);\n var rightClass = other.$$.ptrType.registeredClass;\n var right = other.$$.ptr;\n while (leftClass.baseClass) {\n left = leftClass.upcast(left);\n leftClass = leftClass.baseClass;\n }\n while (rightClass.baseClass) {\n right = rightClass.upcast(right);\n rightClass = rightClass.baseClass;\n }\n return leftClass === rightClass && left === right;\n },\n clone() {\n if (!this.$$.ptr) {\n throwInstanceAlreadyDeleted(this);\n }\n if (this.$$.preservePointerOnDelete) {\n this.$$.count.value += 1;\n return this;\n } else {\n var clone = attachFinalizer(\n Object.create(Object.getPrototypeOf(this), {\n $$: {\n value: shallowCopyInternalPointer(this.$$),\n },\n }),\n );\n clone.$$.count.value += 1;\n clone.$$.deleteScheduled = false;\n return clone;\n }\n },\n delete() {\n if (!this.$$.ptr) {\n throwInstanceAlreadyDeleted(this);\n }\n if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {\n throwBindingError('Object already scheduled for deletion');\n }\n detachFinalizer(this);\n releaseClassHandle(this.$$);\n if (!this.$$.preservePointerOnDelete) {\n this.$$.smartPtr = undefined;\n this.$$.ptr = undefined;\n }\n },\n isDeleted() {\n return !this.$$.ptr;\n },\n deleteLater() {\n if (!this.$$.ptr) {\n throwInstanceAlreadyDeleted(this);\n }\n if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {\n throwBindingError('Object already scheduled for deletion');\n }\n deletionQueue.push(this);\n if (deletionQueue.length === 1 && delayFunction) {\n delayFunction(flushPendingDeletes);\n }\n this.$$.deleteScheduled = true;\n return this;\n },\n });\n };\n\n /** @constructor */ function ClassHandle() {}\n\n var char_0 = 48;\n\n var char_9 = 57;\n\n var makeLegalFunctionName = (name) => {\n if (undefined === name) {\n return '_unknown';\n }\n name = name.replace(/[^a-zA-Z0-9_]/g, '$');\n var f = name.charCodeAt(0);\n if (f >= char_0 && f <= char_9) {\n return `_${name}`;\n }\n return name;\n };\n\n function createNamedFunction(name, body) {\n name = makeLegalFunctionName(name);\n return {\n [name]: function () {\n return body.apply(this, arguments);\n },\n }[name];\n }\n\n var ensureOverloadTable = (proto, methodName, humanName) => {\n if (undefined === proto[methodName].overloadTable) {\n var prevFunc = proto[methodName];\n proto[methodName] = function () {\n if (!proto[methodName].overloadTable.hasOwnProperty(arguments.length)) {\n throwBindingError(\n `Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`,\n );\n }\n return proto[methodName].overloadTable[arguments.length].apply(this, arguments);\n };\n proto[methodName].overloadTable = [];\n proto[methodName].overloadTable[prevFunc.argCount] = prevFunc;\n }\n };\n\n /** @param {number=} numArguments */ var exposePublicSymbol = (name, value, numArguments) => {\n if (Module.hasOwnProperty(name)) {\n if (\n undefined === numArguments ||\n (undefined !== Module[name].overloadTable && undefined !== Module[name].overloadTable[numArguments])\n ) {\n throwBindingError(`Cannot register public name '${name}' twice`);\n }\n ensureOverloadTable(Module, name, name);\n if (Module.hasOwnProperty(numArguments)) {\n throwBindingError(\n `Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`,\n );\n }\n Module[name].overloadTable[numArguments] = value;\n } else {\n Module[name] = value;\n if (undefined !== numArguments) {\n Module[name].numArguments = numArguments;\n }\n }\n };\n\n /** @constructor */ function RegisteredClass(\n name,\n constructor,\n instancePrototype,\n rawDestructor,\n baseClass,\n getActualType,\n upcast,\n downcast,\n ) {\n this.name = name;\n this.constructor = constructor;\n this.instancePrototype = instancePrototype;\n this.rawDestructor = rawDestructor;\n this.baseClass = baseClass;\n this.getActualType = getActualType;\n this.upcast = upcast;\n this.downcast = downcast;\n this.pureVirtualFunctions = [];\n }\n\n var upcastPointer = (ptr, ptrClass, desiredClass) => {\n while (ptrClass !== desiredClass) {\n if (!ptrClass.upcast) {\n throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`);\n }\n ptr = ptrClass.upcast(ptr);\n ptrClass = ptrClass.baseClass;\n }\n return ptr;\n };\n\n /** @suppress {globalThis} */ function constNoSmartPtrRawPointerToWireType(destructors, handle) {\n if (handle === null) {\n if (this.isReference) {\n throwBindingError(`null is not a valid ${this.name}`);\n }\n return 0;\n }\n if (!handle.$$) {\n throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`);\n }\n if (!handle.$$.ptr) {\n throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);\n }\n var handleClass = handle.$$.ptrType.registeredClass;\n var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);\n return ptr;\n }\n\n /** @suppress {globalThis} */ function genericPointerToWireType(destructors, handle) {\n var ptr;\n if (handle === null) {\n if (this.isReference) {\n throwBindingError(`null is not a valid ${this.name}`);\n }\n if (this.isSmartPointer) {\n ptr = this.rawConstructor();\n if (destructors !== null) {\n destructors.push(this.rawDestructor, ptr);\n }\n return ptr;\n } else {\n return 0;\n }\n }\n if (!handle.$$) {\n throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`);\n }\n if (!handle.$$.ptr) {\n throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);\n }\n if (!this.isConst && handle.$$.ptrType.isConst) {\n throwBindingError(\n `Cannot convert argument of type ${\n handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name\n } to parameter type ${this.name}`,\n );\n }\n var handleClass = handle.$$.ptrType.registeredClass;\n ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);\n if (this.isSmartPointer) {\n if (undefined === handle.$$.smartPtr) {\n throwBindingError('Passing raw pointer to smart pointer is illegal');\n }\n switch (this.sharingPolicy) {\n case 0:\n if (handle.$$.smartPtrType === this) {\n ptr = handle.$$.smartPtr;\n } else {\n throwBindingError(\n `Cannot convert argument of type ${\n handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name\n } to parameter type ${this.name}`,\n );\n }\n break;\n\n case 1:\n ptr = handle.$$.smartPtr;\n break;\n\n case 2:\n if (handle.$$.smartPtrType === this) {\n ptr = handle.$$.smartPtr;\n } else {\n var clonedHandle = handle['clone']();\n ptr = this.rawShare(\n ptr,\n Emval.toHandle(() => clonedHandle['delete']()),\n );\n if (destructors !== null) {\n destructors.push(this.rawDestructor, ptr);\n }\n }\n break;\n\n default:\n throwBindingError('Unsupporting sharing policy');\n }\n }\n return ptr;\n }\n\n /** @suppress {globalThis} */ function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) {\n if (handle === null) {\n if (this.isReference) {\n throwBindingError(`null is not a valid ${this.name}`);\n }\n return 0;\n }\n if (!handle.$$) {\n throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`);\n }\n if (!handle.$$.ptr) {\n throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);\n }\n if (handle.$$.ptrType.isConst) {\n throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`);\n }\n var handleClass = handle.$$.ptrType.registeredClass;\n var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);\n return ptr;\n }\n\n /** @suppress {globalThis} */ function readPointer(pointer) {\n return this['fromWireType'](HEAPU32[pointer >> 2]);\n }\n\n var init_RegisteredPointer = () => {\n Object.assign(RegisteredPointer.prototype, {\n getPointee(ptr) {\n if (this.rawGetPointee) {\n ptr = this.rawGetPointee(ptr);\n }\n return ptr;\n },\n destructor(ptr) {\n if (this.rawDestructor) {\n this.rawDestructor(ptr);\n }\n },\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: readPointer,\n deleteObject(handle) {\n if (handle !== null) {\n handle['delete']();\n }\n },\n fromWireType: RegisteredPointer_fromWireType,\n });\n };\n\n /** @constructor\n @param {*=} pointeeType,\n @param {*=} sharingPolicy,\n @param {*=} rawGetPointee,\n @param {*=} rawConstructor,\n @param {*=} rawShare,\n @param {*=} rawDestructor,\n */ function RegisteredPointer(\n name,\n registeredClass,\n isReference,\n isConst,\n isSmartPointer,\n pointeeType,\n sharingPolicy,\n rawGetPointee,\n rawConstructor,\n rawShare,\n rawDestructor,\n ) {\n this.name = name;\n this.registeredClass = registeredClass;\n this.isReference = isReference;\n this.isConst = isConst;\n this.isSmartPointer = isSmartPointer;\n this.pointeeType = pointeeType;\n this.sharingPolicy = sharingPolicy;\n this.rawGetPointee = rawGetPointee;\n this.rawConstructor = rawConstructor;\n this.rawShare = rawShare;\n this.rawDestructor = rawDestructor;\n if (!isSmartPointer && registeredClass.baseClass === undefined) {\n if (isConst) {\n this['toWireType'] = constNoSmartPtrRawPointerToWireType;\n this.destructorFunction = null;\n } else {\n this['toWireType'] = nonConstNoSmartPtrRawPointerToWireType;\n this.destructorFunction = null;\n }\n } else {\n this['toWireType'] = genericPointerToWireType;\n }\n }\n\n /** @param {number=} numArguments */ var replacePublicSymbol = (name, value, numArguments) => {\n if (!Module.hasOwnProperty(name)) {\n throwInternalError('Replacing nonexistant public symbol');\n }\n if (undefined !== Module[name].overloadTable && undefined !== numArguments) {\n Module[name].overloadTable[numArguments] = value;\n } else {\n Module[name] = value;\n Module[name].argCount = numArguments;\n }\n };\n\n var dynCallLegacy = (sig, ptr, args) => {\n var f = Module['dynCall_' + sig];\n return args && args.length ? f.apply(null, [ptr].concat(args)) : f.call(null, ptr);\n };\n\n var wasmTable;\n\n var getWasmTableEntry = (funcPtr) => wasmTable.get(funcPtr);\n\n /** @param {Object=} args */ var dynCall = (sig, ptr, args) => {\n if (sig.includes('j')) {\n return dynCallLegacy(sig, ptr, args);\n }\n var rtn = getWasmTableEntry(ptr).apply(null, args);\n return rtn;\n };\n\n var getDynCaller = (sig, ptr) => {\n var argCache = [];\n return function () {\n argCache.length = 0;\n Object.assign(argCache, arguments);\n return dynCall(sig, ptr, argCache);\n };\n };\n\n var embind__requireFunction = (signature, rawFunction) => {\n signature = readLatin1String(signature);\n function makeDynCaller() {\n if (signature.includes('j')) {\n return getDynCaller(signature, rawFunction);\n }\n return getWasmTableEntry(rawFunction);\n }\n var fp = makeDynCaller();\n if (typeof fp != 'function') {\n throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`);\n }\n return fp;\n };\n\n var extendError = (baseErrorType, errorName) => {\n var errorClass = createNamedFunction(errorName, function (message) {\n this.name = errorName;\n this.message = message;\n var stack = new Error(message).stack;\n if (stack !== undefined) {\n this.stack = this.toString() + '\\n' + stack.replace(/^Error(:[^\\n]*)?\\n/, '');\n }\n });\n errorClass.prototype = Object.create(baseErrorType.prototype);\n errorClass.prototype.constructor = errorClass;\n errorClass.prototype.toString = function () {\n if (this.message === undefined) {\n return this.name;\n } else {\n return `${this.name}: ${this.message}`;\n }\n };\n return errorClass;\n };\n\n var UnboundTypeError;\n\n var getTypeName = (type) => {\n var ptr = ___getTypeName(type);\n var rv = readLatin1String(ptr);\n _free(ptr);\n return rv;\n };\n\n var throwUnboundTypeError = (message, types) => {\n var unboundTypes = [];\n var seen = {};\n function visit(type) {\n if (seen[type]) {\n return;\n }\n if (registeredTypes[type]) {\n return;\n }\n if (typeDependencies[type]) {\n typeDependencies[type].forEach(visit);\n return;\n }\n unboundTypes.push(type);\n seen[type] = true;\n }\n types.forEach(visit);\n throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([', ']));\n };\n\n var __embind_register_class = (\n rawType,\n rawPointerType,\n rawConstPointerType,\n baseClassRawType,\n getActualTypeSignature,\n getActualType,\n upcastSignature,\n upcast,\n downcastSignature,\n downcast,\n name,\n destructorSignature,\n rawDestructor,\n ) => {\n name = readLatin1String(name);\n getActualType = embind__requireFunction(getActualTypeSignature, getActualType);\n if (upcast) {\n upcast = embind__requireFunction(upcastSignature, upcast);\n }\n if (downcast) {\n downcast = embind__requireFunction(downcastSignature, downcast);\n }\n rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);\n var legalFunctionName = makeLegalFunctionName(name);\n exposePublicSymbol(legalFunctionName, function () {\n throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [baseClassRawType]);\n });\n whenDependentTypesAreResolved(\n [rawType, rawPointerType, rawConstPointerType],\n baseClassRawType ? [baseClassRawType] : [],\n function (base) {\n base = base[0];\n var baseClass;\n var basePrototype;\n if (baseClassRawType) {\n baseClass = base.registeredClass;\n basePrototype = baseClass.instancePrototype;\n } else {\n basePrototype = ClassHandle.prototype;\n }\n var constructor = createNamedFunction(legalFunctionName, function () {\n if (Object.getPrototypeOf(this) !== instancePrototype) {\n throw new BindingError(\"Use 'new' to construct \" + name);\n }\n if (undefined === registeredClass.constructor_body) {\n throw new BindingError(name + ' has no accessible constructor');\n }\n var body = registeredClass.constructor_body[arguments.length];\n if (undefined === body) {\n throw new BindingError(\n `Tried to invoke ctor of ${name} with invalid number of parameters (${\n arguments.length\n }) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`,\n );\n }\n return body.apply(this, arguments);\n });\n var instancePrototype = Object.create(basePrototype, {\n constructor: {\n value: constructor,\n },\n });\n constructor.prototype = instancePrototype;\n var registeredClass = new RegisteredClass(\n name,\n constructor,\n instancePrototype,\n rawDestructor,\n baseClass,\n getActualType,\n upcast,\n downcast,\n );\n if (registeredClass.baseClass) {\n if (registeredClass.baseClass.__derivedClasses === undefined) {\n registeredClass.baseClass.__derivedClasses = [];\n }\n registeredClass.baseClass.__derivedClasses.push(registeredClass);\n }\n var referenceConverter = new RegisteredPointer(name, registeredClass, true, false, false);\n var pointerConverter = new RegisteredPointer(name + '*', registeredClass, false, false, false);\n var constPointerConverter = new RegisteredPointer(name + ' const*', registeredClass, false, true, false);\n registeredPointers[rawType] = {\n pointerType: pointerConverter,\n constPointerType: constPointerConverter,\n };\n replacePublicSymbol(legalFunctionName, constructor);\n return [referenceConverter, pointerConverter, constPointerConverter];\n },\n );\n };\n\n var heap32VectorToArray = (count, firstElement) => {\n var array = [];\n for (var i = 0; i < count; i++) {\n array.push(HEAPU32[(firstElement + i * 4) >> 2]);\n }\n return array;\n };\n\n var runDestructors = (destructors) => {\n while (destructors.length) {\n var ptr = destructors.pop();\n var del = destructors.pop();\n del(ptr);\n }\n };\n\n function craftInvokerFunction(\n humanName,\n argTypes,\n classType,\n cppInvokerFunc,\n cppTargetFunc,\n /** boolean= */ isAsync,\n ) {\n var argCount = argTypes.length;\n if (argCount < 2) {\n throwBindingError(\"argTypes array size mismatch! Must at least get return value and 'this' types!\");\n }\n var isClassMethodFunc = argTypes[1] !== null && classType !== null;\n var needsDestructorStack = false;\n for (var i = 1; i < argTypes.length; ++i) {\n if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) {\n needsDestructorStack = true;\n break;\n }\n }\n var returns = argTypes[0].name !== 'void';\n var expectedArgCount = argCount - 2;\n var argsWired = new Array(expectedArgCount);\n var invokerFuncArgs = [];\n var destructors = [];\n return function () {\n if (arguments.length !== expectedArgCount) {\n throwBindingError(\n `function ${humanName} called with ${arguments.length} arguments, expected ${expectedArgCount}`,\n );\n }\n destructors.length = 0;\n var thisWired;\n invokerFuncArgs.length = isClassMethodFunc ? 2 : 1;\n invokerFuncArgs[0] = cppTargetFunc;\n if (isClassMethodFunc) {\n thisWired = argTypes[1]['toWireType'](destructors, this);\n invokerFuncArgs[1] = thisWired;\n }\n for (var i = 0; i < expectedArgCount; ++i) {\n argsWired[i] = argTypes[i + 2]['toWireType'](destructors, arguments[i]);\n invokerFuncArgs.push(argsWired[i]);\n }\n var rv = cppInvokerFunc.apply(null, invokerFuncArgs);\n function onDone(rv) {\n if (needsDestructorStack) {\n runDestructors(destructors);\n } else {\n for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; i++) {\n var param = i === 1 ? thisWired : argsWired[i - 2];\n if (argTypes[i].destructorFunction !== null) {\n argTypes[i].destructorFunction(param);\n }\n }\n }\n if (returns) {\n return argTypes[0]['fromWireType'](rv);\n }\n }\n return onDone(rv);\n };\n }\n\n var __embind_register_class_constructor = (\n rawClassType,\n argCount,\n rawArgTypesAddr,\n invokerSignature,\n invoker,\n rawConstructor,\n ) => {\n var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);\n invoker = embind__requireFunction(invokerSignature, invoker);\n whenDependentTypesAreResolved([], [rawClassType], function (classType) {\n classType = classType[0];\n var humanName = `constructor ${classType.name}`;\n if (undefined === classType.registeredClass.constructor_body) {\n classType.registeredClass.constructor_body = [];\n }\n if (undefined !== classType.registeredClass.constructor_body[argCount - 1]) {\n throw new BindingError(\n `Cannot register multiple constructors with identical number of parameters (${argCount - 1}) for class '${\n classType.name\n }'! Overload resolution is currently only performed using the parameter count, not actual type info!`,\n );\n }\n classType.registeredClass.constructor_body[argCount - 1] = () => {\n throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`, rawArgTypes);\n };\n whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => {\n argTypes.splice(1, 0, null);\n classType.registeredClass.constructor_body[argCount - 1] = craftInvokerFunction(\n humanName,\n argTypes,\n null,\n invoker,\n rawConstructor,\n );\n return [];\n });\n return [];\n });\n };\n\n var getFunctionName = (signature) => {\n signature = signature.trim();\n const argsIndex = signature.indexOf('(');\n if (argsIndex !== -1) {\n assert(signature[signature.length - 1] == ')', 'Parentheses for argument names should match.');\n return signature.substr(0, argsIndex);\n } else {\n return signature;\n }\n };\n\n var __embind_register_class_function = (\n rawClassType,\n methodName,\n argCount,\n rawArgTypesAddr,\n invokerSignature,\n rawInvoker,\n context,\n isPureVirtual,\n isAsync,\n ) => {\n var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);\n methodName = readLatin1String(methodName);\n methodName = getFunctionName(methodName);\n rawInvoker = embind__requireFunction(invokerSignature, rawInvoker);\n whenDependentTypesAreResolved([], [rawClassType], function (classType) {\n classType = classType[0];\n var humanName = `${classType.name}.${methodName}`;\n if (methodName.startsWith('@@')) {\n methodName = Symbol[methodName.substring(2)];\n }\n if (isPureVirtual) {\n classType.registeredClass.pureVirtualFunctions.push(methodName);\n }\n function unboundTypesHandler() {\n throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`, rawArgTypes);\n }\n var proto = classType.registeredClass.instancePrototype;\n var method = proto[methodName];\n if (\n undefined === method ||\n (undefined === method.overloadTable &&\n method.className !== classType.name &&\n method.argCount === argCount - 2)\n ) {\n unboundTypesHandler.argCount = argCount - 2;\n unboundTypesHandler.className = classType.name;\n proto[methodName] = unboundTypesHandler;\n } else {\n ensureOverloadTable(proto, methodName, humanName);\n proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler;\n }\n whenDependentTypesAreResolved([], rawArgTypes, function (argTypes) {\n var memberFunction = craftInvokerFunction(humanName, argTypes, classType, rawInvoker, context, isAsync);\n if (undefined === proto[methodName].overloadTable) {\n memberFunction.argCount = argCount - 2;\n proto[methodName] = memberFunction;\n } else {\n proto[methodName].overloadTable[argCount - 2] = memberFunction;\n }\n return [];\n });\n return [];\n });\n };\n\n function handleAllocatorInit() {\n Object.assign(\n HandleAllocator.prototype,\n /** @lends {HandleAllocator.prototype} */ {\n get(id) {\n return this.allocated[id];\n },\n has(id) {\n return this.allocated[id] !== undefined;\n },\n allocate(handle) {\n var id = this.freelist.pop() || this.allocated.length;\n this.allocated[id] = handle;\n return id;\n },\n free(id) {\n this.allocated[id] = undefined;\n this.freelist.push(id);\n },\n },\n );\n }\n\n /** @constructor */ function HandleAllocator() {\n this.allocated = [undefined];\n this.freelist = [];\n }\n\n var emval_handles = new HandleAllocator();\n\n var __emval_decref = (handle) => {\n if (handle >= emval_handles.reserved && 0 === --emval_handles.get(handle).refcount) {\n emval_handles.free(handle);\n }\n };\n\n var count_emval_handles = () => {\n var count = 0;\n for (var i = emval_handles.reserved; i < emval_handles.allocated.length; ++i) {\n if (emval_handles.allocated[i] !== undefined) {\n ++count;\n }\n }\n return count;\n };\n\n var init_emval = () => {\n emval_handles.allocated.push(\n {\n value: undefined,\n },\n {\n value: null,\n },\n {\n value: true,\n },\n {\n value: false,\n },\n );\n emval_handles.reserved = emval_handles.allocated.length;\n Module['count_emval_handles'] = count_emval_handles;\n };\n\n var Emval = {\n toValue: (handle) => {\n if (!handle) {\n throwBindingError('Cannot use deleted val. handle = ' + handle);\n }\n return emval_handles.get(handle).value;\n },\n toHandle: (value) => {\n switch (value) {\n case undefined:\n return 1;\n\n case null:\n return 2;\n\n case true:\n return 3;\n\n case false:\n return 4;\n\n default: {\n return emval_handles.allocate({\n refcount: 1,\n value: value,\n });\n }\n }\n },\n };\n\n /** @suppress {globalThis} */ function simpleReadValueFromPointer(pointer) {\n return this['fromWireType'](HEAP32[pointer >> 2]);\n }\n\n var __embind_register_emval = (rawType, name) => {\n name = readLatin1String(name);\n registerType(rawType, {\n name: name,\n fromWireType: (handle) => {\n var rv = Emval.toValue(handle);\n __emval_decref(handle);\n return rv;\n },\n toWireType: (destructors, value) => Emval.toHandle(value),\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: simpleReadValueFromPointer,\n destructorFunction: null,\n });\n };\n\n var embindRepr = (v) => {\n if (v === null) {\n return 'null';\n }\n var t = typeof v;\n if (t === 'object' || t === 'array' || t === 'function') {\n return v.toString();\n } else {\n return '' + v;\n }\n };\n\n var floatReadValueFromPointer = (name, width) => {\n switch (width) {\n case 4:\n return function (pointer) {\n return this['fromWireType'](HEAPF32[pointer >> 2]);\n };\n\n case 8:\n return function (pointer) {\n return this['fromWireType'](HEAPF64[pointer >> 3]);\n };\n\n default:\n throw new TypeError(`invalid float width (${width}): ${name}`);\n }\n };\n\n var __embind_register_float = (rawType, name, size) => {\n name = readLatin1String(name);\n registerType(rawType, {\n name: name,\n fromWireType: (value) => value,\n toWireType: (destructors, value) => value,\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: floatReadValueFromPointer(name, size),\n destructorFunction: null,\n });\n };\n\n var integerReadValueFromPointer = (name, width, signed) => {\n switch (width) {\n case 1:\n return signed ? (pointer) => HEAP8[pointer >> 0] : (pointer) => HEAPU8[pointer >> 0];\n\n case 2:\n return signed ? (pointer) => HEAP16[pointer >> 1] : (pointer) => HEAPU16[pointer >> 1];\n\n case 4:\n return signed ? (pointer) => HEAP32[pointer >> 2] : (pointer) => HEAPU32[pointer >> 2];\n\n default:\n throw new TypeError(`invalid integer width (${width}): ${name}`);\n }\n };\n\n /** @suppress {globalThis} */ var __embind_register_integer = (primitiveType, name, size, minRange, maxRange) => {\n name = readLatin1String(name);\n if (maxRange === -1) {\n maxRange = 4294967295;\n }\n var fromWireType = (value) => value;\n if (minRange === 0) {\n var bitshift = 32 - 8 * size;\n fromWireType = (value) => (value << bitshift) >>> bitshift;\n }\n var isUnsignedType = name.includes('unsigned');\n var checkAssertions = (value, toTypeName) => {};\n var toWireType;\n if (isUnsignedType) {\n toWireType = function (destructors, value) {\n checkAssertions(value, this.name);\n return value >>> 0;\n };\n } else {\n toWireType = function (destructors, value) {\n checkAssertions(value, this.name);\n return value;\n };\n }\n registerType(primitiveType, {\n name: name,\n fromWireType: fromWireType,\n toWireType: toWireType,\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: integerReadValueFromPointer(name, size, minRange !== 0),\n destructorFunction: null,\n });\n };\n\n var __embind_register_memory_view = (rawType, dataTypeIndex, name) => {\n var typeMapping = [\n Int8Array,\n Uint8Array,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n ];\n var TA = typeMapping[dataTypeIndex];\n function decodeMemoryView(handle) {\n var size = HEAPU32[handle >> 2];\n var data = HEAPU32[(handle + 4) >> 2];\n return new TA(HEAP8.buffer, data, size);\n }\n name = readLatin1String(name);\n registerType(\n rawType,\n {\n name: name,\n fromWireType: decodeMemoryView,\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: decodeMemoryView,\n },\n {\n ignoreDuplicateRegistrations: true,\n },\n );\n };\n\n var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {\n if (!(maxBytesToWrite > 0)) return 0;\n var startIdx = outIdx;\n var endIdx = outIdx + maxBytesToWrite - 1;\n for (var i = 0; i < str.length; ++i) {\n var u = str.charCodeAt(i);\n if (u >= 55296 && u <= 57343) {\n var u1 = str.charCodeAt(++i);\n u = (65536 + ((u & 1023) << 10)) | (u1 & 1023);\n }\n if (u <= 127) {\n if (outIdx >= endIdx) break;\n heap[outIdx++] = u;\n } else if (u <= 2047) {\n if (outIdx + 1 >= endIdx) break;\n heap[outIdx++] = 192 | (u >> 6);\n heap[outIdx++] = 128 | (u & 63);\n } else if (u <= 65535) {\n if (outIdx + 2 >= endIdx) break;\n heap[outIdx++] = 224 | (u >> 12);\n heap[outIdx++] = 128 | ((u >> 6) & 63);\n heap[outIdx++] = 128 | (u & 63);\n } else {\n if (outIdx + 3 >= endIdx) break;\n heap[outIdx++] = 240 | (u >> 18);\n heap[outIdx++] = 128 | ((u >> 12) & 63);\n heap[outIdx++] = 128 | ((u >> 6) & 63);\n heap[outIdx++] = 128 | (u & 63);\n }\n }\n heap[outIdx] = 0;\n return outIdx - startIdx;\n };\n\n var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);\n\n var lengthBytesUTF8 = (str) => {\n var len = 0;\n for (var i = 0; i < str.length; ++i) {\n var c = str.charCodeAt(i);\n if (c <= 127) {\n len++;\n } else if (c <= 2047) {\n len += 2;\n } else if (c >= 55296 && c <= 57343) {\n len += 4;\n ++i;\n } else {\n len += 3;\n }\n }\n return len;\n };\n\n var __embind_register_std_string = (rawType, name) => {\n name = readLatin1String(name);\n var stdStringIsUTF8 = name === 'std::string';\n registerType(rawType, {\n name: name,\n fromWireType(value) {\n var length = HEAPU32[value >> 2];\n var payload = value + 4;\n var str;\n if (stdStringIsUTF8) {\n var decodeStartPtr = payload;\n for (var i = 0; i <= length; ++i) {\n var currentBytePtr = payload + i;\n if (i == length || HEAPU8[currentBytePtr] == 0) {\n var maxRead = currentBytePtr - decodeStartPtr;\n var stringSegment = UTF8ToString(decodeStartPtr, maxRead);\n if (str === undefined) {\n str = stringSegment;\n } else {\n str += String.fromCharCode(0);\n str += stringSegment;\n }\n decodeStartPtr = currentBytePtr + 1;\n }\n }\n } else {\n var a = new Array(length);\n for (var i = 0; i < length; ++i) {\n a[i] = String.fromCharCode(HEAPU8[payload + i]);\n }\n str = a.join('');\n }\n _free(value);\n return str;\n },\n toWireType(destructors, value) {\n if (value instanceof ArrayBuffer) {\n value = new Uint8Array(value);\n }\n var length;\n var valueIsOfTypeString = typeof value == 'string';\n if (\n !(\n valueIsOfTypeString ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Int8Array\n )\n ) {\n throwBindingError('Cannot pass non-string to std::string');\n }\n if (stdStringIsUTF8 && valueIsOfTypeString) {\n length = lengthBytesUTF8(value);\n } else {\n length = value.length;\n }\n var base = _malloc(4 + length + 1);\n var ptr = base + 4;\n HEAPU32[base >> 2] = length;\n if (stdStringIsUTF8 && valueIsOfTypeString) {\n stringToUTF8(value, ptr, length + 1);\n } else {\n if (valueIsOfTypeString) {\n for (var i = 0; i < length; ++i) {\n var charCode = value.charCodeAt(i);\n if (charCode > 255) {\n _free(ptr);\n throwBindingError('String has UTF-16 code units that do not fit in 8 bits');\n }\n HEAPU8[ptr + i] = charCode;\n }\n } else {\n for (var i = 0; i < length; ++i) {\n HEAPU8[ptr + i] = value[i];\n }\n }\n }\n if (destructors !== null) {\n destructors.push(_free, base);\n }\n return base;\n },\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: readPointer,\n destructorFunction(ptr) {\n _free(ptr);\n },\n });\n };\n\n var UTF16Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf-16le') : undefined;\n\n var UTF16ToString = (ptr, maxBytesToRead) => {\n var endPtr = ptr;\n var idx = endPtr >> 1;\n var maxIdx = idx + maxBytesToRead / 2;\n while (!(idx >= maxIdx) && HEAPU16[idx]) ++idx;\n endPtr = idx << 1;\n if (endPtr - ptr > 32 && UTF16Decoder) return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));\n var str = '';\n for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {\n var codeUnit = HEAP16[(ptr + i * 2) >> 1];\n if (codeUnit == 0) break;\n str += String.fromCharCode(codeUnit);\n }\n return str;\n };\n\n var stringToUTF16 = (str, outPtr, maxBytesToWrite) => {\n if (maxBytesToWrite === undefined) {\n maxBytesToWrite = 2147483647;\n }\n if (maxBytesToWrite < 2) return 0;\n maxBytesToWrite -= 2;\n var startPtr = outPtr;\n var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;\n for (var i = 0; i < numCharsToWrite; ++i) {\n var codeUnit = str.charCodeAt(i);\n HEAP16[outPtr >> 1] = codeUnit;\n outPtr += 2;\n }\n HEAP16[outPtr >> 1] = 0;\n return outPtr - startPtr;\n };\n\n var lengthBytesUTF16 = (str) => str.length * 2;\n\n var UTF32ToString = (ptr, maxBytesToRead) => {\n var i = 0;\n var str = '';\n while (!(i >= maxBytesToRead / 4)) {\n var utf32 = HEAP32[(ptr + i * 4) >> 2];\n if (utf32 == 0) break;\n ++i;\n if (utf32 >= 65536) {\n var ch = utf32 - 65536;\n str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));\n } else {\n str += String.fromCharCode(utf32);\n }\n }\n return str;\n };\n\n var stringToUTF32 = (str, outPtr, maxBytesToWrite) => {\n if (maxBytesToWrite === undefined) {\n maxBytesToWrite = 2147483647;\n }\n if (maxBytesToWrite < 4) return 0;\n var startPtr = outPtr;\n var endPtr = startPtr + maxBytesToWrite - 4;\n for (var i = 0; i < str.length; ++i) {\n var codeUnit = str.charCodeAt(i);\n if (codeUnit >= 55296 && codeUnit <= 57343) {\n var trailSurrogate = str.charCodeAt(++i);\n codeUnit = (65536 + ((codeUnit & 1023) << 10)) | (trailSurrogate & 1023);\n }\n HEAP32[outPtr >> 2] = codeUnit;\n outPtr += 4;\n if (outPtr + 4 > endPtr) break;\n }\n HEAP32[outPtr >> 2] = 0;\n return outPtr - startPtr;\n };\n\n var lengthBytesUTF32 = (str) => {\n var len = 0;\n for (var i = 0; i < str.length; ++i) {\n var codeUnit = str.charCodeAt(i);\n if (codeUnit >= 55296 && codeUnit <= 57343) ++i;\n len += 4;\n }\n return len;\n };\n\n var __embind_register_std_wstring = (rawType, charSize, name) => {\n name = readLatin1String(name);\n var decodeString, encodeString, getHeap, lengthBytesUTF, shift;\n if (charSize === 2) {\n decodeString = UTF16ToString;\n encodeString = stringToUTF16;\n lengthBytesUTF = lengthBytesUTF16;\n getHeap = () => HEAPU16;\n shift = 1;\n } else if (charSize === 4) {\n decodeString = UTF32ToString;\n encodeString = stringToUTF32;\n lengthBytesUTF = lengthBytesUTF32;\n getHeap = () => HEAPU32;\n shift = 2;\n }\n registerType(rawType, {\n name: name,\n fromWireType: (value) => {\n var length = HEAPU32[value >> 2];\n var HEAP = getHeap();\n var str;\n var decodeStartPtr = value + 4;\n for (var i = 0; i <= length; ++i) {\n var currentBytePtr = value + 4 + i * charSize;\n if (i == length || HEAP[currentBytePtr >> shift] == 0) {\n var maxReadBytes = currentBytePtr - decodeStartPtr;\n var stringSegment = decodeString(decodeStartPtr, maxReadBytes);\n if (str === undefined) {\n str = stringSegment;\n } else {\n str += String.fromCharCode(0);\n str += stringSegment;\n }\n decodeStartPtr = currentBytePtr + charSize;\n }\n }\n _free(value);\n return str;\n },\n toWireType: (destructors, value) => {\n if (!(typeof value == 'string')) {\n throwBindingError(`Cannot pass non-string to C++ string type ${name}`);\n }\n var length = lengthBytesUTF(value);\n var ptr = _malloc(4 + length + charSize);\n HEAPU32[ptr >> 2] = length >> shift;\n encodeString(value, ptr + 4, length + charSize);\n if (destructors !== null) {\n destructors.push(_free, ptr);\n }\n return ptr;\n },\n argPackAdvance: GenericWireTypeSize,\n readValueFromPointer: simpleReadValueFromPointer,\n destructorFunction(ptr) {\n _free(ptr);\n },\n });\n };\n\n var __embind_register_void = (rawType, name) => {\n name = readLatin1String(name);\n registerType(rawType, {\n isVoid: true,\n name: name,\n argPackAdvance: 0,\n fromWireType: () => undefined,\n toWireType: (destructors, o) => undefined,\n });\n };\n\n var __emscripten_throw_longjmp = () => {\n throw Infinity;\n };\n\n var __emval_incref = (handle) => {\n if (handle > 4) {\n emval_handles.get(handle).refcount += 1;\n }\n };\n\n var requireRegisteredType = (rawType, humanName) => {\n var impl = registeredTypes[rawType];\n if (undefined === impl) {\n throwBindingError(humanName + ' has unknown type ' + getTypeName(rawType));\n }\n return impl;\n };\n\n var __emval_take_value = (type, arg) => {\n type = requireRegisteredType(type, '_emval_take_value');\n var v = type['readValueFromPointer'](arg);\n return Emval.toHandle(v);\n };\n\n var _abort = () => {\n abort('');\n };\n\n var _emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);\n\n var getHeapMax = () => 2147483648;\n\n var growMemory = (size) => {\n var b = wasmMemory.buffer;\n var pages = (size - b.byteLength + 65535) / 65536;\n try {\n wasmMemory.grow(pages);\n updateMemoryViews();\n return 1;\n } /*success*/ catch (e) {}\n };\n\n var _emscripten_resize_heap = (requestedSize) => {\n var oldSize = HEAPU8.length;\n requestedSize >>>= 0;\n var maxHeapSize = getHeapMax();\n if (requestedSize > maxHeapSize) {\n return false;\n }\n var alignUp = (x, multiple) => x + ((multiple - (x % multiple)) % multiple);\n for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {\n var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);\n overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);\n var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));\n var replacement = growMemory(newSize);\n if (replacement) {\n return true;\n }\n }\n return false;\n };\n\n var _fd_close = (fd) => 52;\n\n var _fd_read = (fd, iov, iovcnt, pnum) => 52;\n\n var convertI32PairToI53Checked = (lo, hi) =>\n (hi + 2097152) >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN;\n\n function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {\n var offset = convertI32PairToI53Checked(offset_low, offset_high);\n return 70;\n }\n\n var printCharBuffers = [null, [], []];\n\n var printChar = (stream, curr) => {\n var buffer = printCharBuffers[stream];\n if (curr === 0 || curr === 10) {\n (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));\n buffer.length = 0;\n } else {\n buffer.push(curr);\n }\n };\n\n var _fd_write = (fd, iov, iovcnt, pnum) => {\n var num = 0;\n for (var i = 0; i < iovcnt; i++) {\n var ptr = HEAPU32[iov >> 2];\n var len = HEAPU32[(iov + 4) >> 2];\n iov += 8;\n for (var j = 0; j < len; j++) {\n printChar(fd, HEAPU8[ptr + j]);\n }\n num += len;\n }\n HEAPU32[pnum >> 2] = num;\n return 0;\n };\n\n embind_init_charCodes();\n\n BindingError = Module['BindingError'] = class BindingError extends Error {\n constructor(message) {\n super(message);\n this.name = 'BindingError';\n }\n };\n\n InternalError = Module['InternalError'] = class InternalError extends Error {\n constructor(message) {\n super(message);\n this.name = 'InternalError';\n }\n };\n\n init_ClassHandle();\n\n init_embind();\n\n init_RegisteredPointer();\n\n UnboundTypeError = Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeError');\n\n handleAllocatorInit();\n\n init_emval();\n\n var wasmImports = {\n /** @export */ b: ___assert_fail,\n /** @export */ n: ___syscall_fcntl64,\n /** @export */ D: ___syscall_ioctl,\n /** @export */ E: ___syscall_openat,\n /** @export */ w: __embind_register_bigint,\n /** @export */ q: __embind_register_bool,\n /** @export */ H: __embind_register_class,\n /** @export */ G: __embind_register_class_constructor,\n /** @export */ e: __embind_register_class_function,\n /** @export */ F: __embind_register_emval,\n /** @export */ o: __embind_register_float,\n /** @export */ f: __embind_register_integer,\n /** @export */ d: __embind_register_memory_view,\n /** @export */ p: __embind_register_std_string,\n /** @export */ k: __embind_register_std_wstring,\n /** @export */ r: __embind_register_void,\n /** @export */ y: __emscripten_throw_longjmp,\n /** @export */ s: __emval_decref,\n /** @export */ t: __emval_incref,\n /** @export */ g: __emval_take_value,\n /** @export */ h: _abort,\n /** @export */ A: _emscripten_memcpy_js,\n /** @export */ z: _emscripten_resize_heap,\n /** @export */ m: _fd_close,\n /** @export */ C: _fd_read,\n /** @export */ v: _fd_seek,\n /** @export */ B: _fd_write,\n /** @export */ j: invoke_ii,\n /** @export */ i: invoke_iiii,\n /** @export */ l: invoke_iiiiii,\n /** @export */ a: invoke_vi,\n /** @export */ c: invoke_vii,\n /** @export */ x: invoke_viiii,\n /** @export */ u: invoke_viiij,\n };\n\n var wasmExports = createWasm();\n\n var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['J'])();\n\n var _free = (a0) => (_free = wasmExports['K'])(a0);\n\n var _malloc = (a0) => (_malloc = wasmExports['L'])(a0);\n\n var ___getTypeName = (a0) => (___getTypeName = wasmExports['M'])(a0);\n\n var __embind_initialize_bindings = (Module['__embind_initialize_bindings'] = () =>\n (__embind_initialize_bindings = Module['__embind_initialize_bindings'] = wasmExports['N'])());\n\n var ___errno_location = () => (___errno_location = wasmExports['__errno_location'])();\n\n var _setThrew = (a0, a1) => (_setThrew = wasmExports['P'])(a0, a1);\n\n var stackSave = () => (stackSave = wasmExports['Q'])();\n\n var stackRestore = (a0) => (stackRestore = wasmExports['R'])(a0);\n\n var ___cxa_increment_exception_refcount = (a0) =>\n (___cxa_increment_exception_refcount = wasmExports['__cxa_increment_exception_refcount'])(a0);\n\n var ___cxa_is_pointer_type = (a0) => (___cxa_is_pointer_type = wasmExports['__cxa_is_pointer_type'])(a0);\n\n var dynCall_viiij = (Module['dynCall_viiij'] = (a0, a1, a2, a3, a4, a5) =>\n (dynCall_viiij = Module['dynCall_viiij'] = wasmExports['S'])(a0, a1, a2, a3, a4, a5));\n\n var dynCall_jiji = (Module['dynCall_jiji'] = (a0, a1, a2, a3, a4) =>\n (dynCall_jiji = Module['dynCall_jiji'] = wasmExports['T'])(a0, a1, a2, a3, a4));\n\n function invoke_vi(index, a1) {\n var sp = stackSave();\n try {\n getWasmTableEntry(index)(a1);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_vii(index, a1, a2) {\n var sp = stackSave();\n try {\n getWasmTableEntry(index)(a1, a2);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_ii(index, a1) {\n var sp = stackSave();\n try {\n return getWasmTableEntry(index)(a1);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_iiii(index, a1, a2, a3) {\n var sp = stackSave();\n try {\n return getWasmTableEntry(index)(a1, a2, a3);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_iiiiii(index, a1, a2, a3, a4, a5) {\n var sp = stackSave();\n try {\n return getWasmTableEntry(index)(a1, a2, a3, a4, a5);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_viiii(index, a1, a2, a3, a4) {\n var sp = stackSave();\n try {\n getWasmTableEntry(index)(a1, a2, a3, a4);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n function invoke_viiij(index, a1, a2, a3, a4, a5) {\n var sp = stackSave();\n try {\n dynCall_viiij(index, a1, a2, a3, a4, a5);\n } catch (e) {\n stackRestore(sp);\n if (e !== e + 0) throw e;\n _setThrew(1, 0);\n }\n }\n\n var calledRun;\n\n dependenciesFulfilled = function runCaller() {\n if (!calledRun) run();\n if (!calledRun) dependenciesFulfilled = runCaller;\n };\n\n function run() {\n if (runDependencies > 0) {\n return;\n }\n preRun();\n if (runDependencies > 0) {\n return;\n }\n function doRun() {\n if (calledRun) return;\n calledRun = true;\n Module['calledRun'] = true;\n if (ABORT) return;\n initRuntime();\n readyPromiseResolve(Module);\n if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();\n postRun();\n }\n if (Module['setStatus']) {\n Module['setStatus']('Running...');\n setTimeout(function () {\n setTimeout(function () {\n Module['setStatus']('');\n }, 1);\n doRun();\n }, 1);\n } else {\n doRun();\n }\n }\n\n if (Module['preInit']) {\n if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];\n while (Module['preInit'].length > 0) {\n Module['preInit'].pop()();\n }\n }\n\n run();\n\n return moduleArg.ready;\n };\n})();\nexport default createRendererModule;\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport pkg from '../../package.json';\n\nimport createRendererModule from './bin/renderer';\n\nexport interface Renderer {\n duration(): number;\n error(): string;\n frame(no: number): boolean;\n load(data: string, width: number, height: number): boolean;\n render(): Uint8Array;\n resize(width: number, height: number): void;\n setBgColor(color: number): void;\n size(): Float32Array;\n totalFrames(): number;\n update(): boolean;\n}\n\ninterface Module {\n Renderer: new () => Renderer;\n}\n\n/**\n * WasmLoader is a utility class for loading WebAssembly modules.\n * It provides methods to load modules with a primary URL and a backup URL.\n */\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport class WasmLoader {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private static _ModulePromise: Promise<Module> | null = null;\n\n // URL for the WASM file, constructed using package information\n private static _wasmURL = `https://unpkg.com/${pkg.name}@${pkg.version}/dist/renderer.wasm`;\n\n private constructor() {\n throw new Error('WasmLoader is a static class and cannot be instantiated.');\n }\n\n private static async _tryLoad(url: string): Promise<Module> {\n const module = await createRendererModule({ locateFile: () => url });\n\n return module;\n }\n\n /**\n * Tries to load the WASM module from the primary URL, falling back to a backup URL if necessary.\n * Throws an error if both URLs fail to load the module.\n * @returns Promise<Module> - A promise that resolves to the loaded module.\n */\n private static async _loadWithBackup(): Promise<Module> {\n if (!this._ModulePromise) {\n this._ModulePromise = this._tryLoad(this._wasmURL).catch(async (initialError): Promise<Module> => {\n const backupUrl = `https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/renderer.wasm`;\n\n console.warn(`Trying backup URL for WASM loading: ${backupUrl}`);\n try {\n return await this._tryLoad(backupUrl);\n } catch (backupError) {\n console.error(\n `Both primary and backup WASM URLs failed. Primary error: ${\n (initialError as Error).message\n }, Backup error: ${(backupError as Error).message}`,\n );\n throw new Error('WASM loading failed from all sources.');\n }\n });\n }\n\n return this._ModulePromise;\n }\n\n /**\n * Public method to load the WebAssembly module.\n * Utilizes a primary and backup URL for robustness.\n * @returns Promise<Module> - A promise that resolves to the loaded module.\n */\n public static async load(): Promise<Module> {\n return this._loadWithBackup();\n }\n\n /**\n * Sets a new URL for the WASM file and invalidates the current module promise.\n *\n * @param string - The new URL for the WASM file.\n */\n public static setWasmUrl(url: string): void {\n this._wasmURL = url;\n // Invalidate current module promise\n this._ModulePromise = null;\n }\n}\n","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return { b: b, r: r };\n};\nvar _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new u8(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length, dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l)\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt, dend = Math.min(dt, end);\n if (shift + bt < 0)\n err(3);\n for (; bt < dend; ++bt)\n buf[bt] = dict[shift + bt];\n }\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return { t: et, l: 0 };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return { t: v, l: 1 };\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return { t: new u8(tr), l: mbt };\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return { c: cl.subarray(0, cli), n: s };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;\n var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;\n var _c = lc(dlt), lclt = _c.c, nlc = _c.n;\n var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i)\n ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = (sym >> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (sym >> 23) & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos)\n w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = (pos & 7) | w[(pos / 8) | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n }\n else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[(pos / 8) | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Adler32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n if (!st) {\n st = { l: 1 };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; };\nvar bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zls]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get opts\nvar gopt = function (o) { return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n}; };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else if (!Array.isArray(dat))\n ext(dat);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32);\n c[1] |= 31 - ((c[0] << 8) | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function (d, dict) {\n if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict)\n err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = { l: 0, i: 32768, w: 32768, z: 32768 };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n if (split) {\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n }\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n }\n else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = { i: 0, b: dict ? dict.length : 0 };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict)\n this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n if (!this.p.length)\n this.p = c;\n else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n function AsyncInflate(opts, cb) {\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, opts) {\n return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final)\n return;\n }\n else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n // process concatenated GZIP\n if (this.s.f && !this.s.l) {\n this.v = shft(this.s.p) + 9;\n this.s = { i: 0 };\n this.o = new u8(0);\n if (this.p.length)\n this.push(new u8(0), final);\n }\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n function AsyncGunzip(opts, cb) {\n var _this_1 = this;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) { return postMessage(offset); };\n onmessage = astrm(strm);\n }, 9, function (offset) { return _this_1.onmember && _this_1.onmember(offset); });\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length)\n err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final)\n return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n function Decompress(opts, cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.o = StrmOpt.call(this, opts, cb) || {};\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_2 = this;\n // enables reuse of this method by AsyncDecompress\n var cb = function () { _this_2.ondata.apply(_this_2, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(this.o, cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(this.o, cb)\n : new this.Z(this.o, cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n function AsyncDecompress(opts, cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n Decompress.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, opts) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, opts)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, opts)\n : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return { s: r, r: slc(d, i - 1) };\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (final) {\n if (r.length)\n err(8);\n this.p = null;\n }\n else\n this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td) {\n return td.decode(dat);\n }\n else {\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (r.length)\n err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this_1.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this_1.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_3 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, { out: new u8(su) }));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295 || c == 65535;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","// src/error/flatten/flatten.ts\nfunction flatten(arg1) {\n return (Array.isArray(arg1) ? arg1 : arg1.issues).reduce(\n (flatErrors, issue) => {\n if (issue.path) {\n const path = issue.path.map(({ key }) => key).join(\".\");\n flatErrors.nested[path] = [\n ...flatErrors.nested[path] || [],\n issue.message\n ];\n } else {\n flatErrors.root = [...flatErrors.root || [], issue.message];\n }\n return flatErrors;\n },\n { nested: {} }\n );\n}\n\n// src/error/ValiError/ValiError.ts\nvar ValiError = class extends Error {\n issues;\n /**\n * Creates a Valibot error with useful information.\n *\n * @param issues The error issues.\n */\n constructor(issues) {\n super(issues[0].message);\n this.name = \"ValiError\";\n this.issues = issues;\n }\n};\n\n// src/methods/brand/brand.ts\nvar symbol = Symbol(\"brand\");\nfunction brand(schema, name) {\n return schema;\n}\n\n// src/methods/coerce/coerce.ts\nfunction coerce(schema, action) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return schema._parse(action(input), info);\n }\n };\n}\n\n// src/methods/coerce/coerceAsync.ts\nfunction coerceAsync(schema, action) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n return schema._parse(await action(input), info);\n }\n };\n}\n\n// src/methods/fallback/fallback.ts\nfunction fallback(schema, value2) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n const result = schema._parse(input, info);\n return {\n output: result.issues ? typeof value2 === \"function\" ? value2({\n input,\n issues: result.issues\n }) : value2 : result.output\n };\n }\n };\n}\n\n// src/methods/fallback/fallbackAsync.ts\nfunction fallbackAsync(schema, value2) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n const result = await schema._parse(input, info);\n return {\n output: result.issues ? typeof value2 === \"function\" ? value2({\n input,\n issues: result.issues\n }) : value2 : result.output\n };\n }\n };\n}\n\n// src/methods/is/is.ts\nfunction is(schema, input) {\n return !schema._parse(input, { abortEarly: true }).issues;\n}\n\n// src/utils/executePipe/utils/getIssue/getIssue.ts\nfunction getIssue(info, issue) {\n return {\n reason: info?.reason,\n validation: issue.validation,\n origin: info?.origin || \"value\",\n message: issue.message,\n input: issue.input,\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n };\n}\n\n// src/utils/executePipe/utils/getPipeInfo/getPipeInfo.ts\nfunction getPipeInfo(info, reason) {\n return {\n reason,\n origin: info?.origin,\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n };\n}\n\n// src/utils/executePipe/executePipe.ts\nfunction executePipe(input, pipe, parseInfo, reason) {\n if (!pipe || !pipe.length) {\n return { output: input };\n }\n let pipeInfo;\n let issues;\n let output = input;\n for (const action of pipe) {\n const result = action(output);\n if (result.issue) {\n pipeInfo = pipeInfo || getPipeInfo(parseInfo, reason);\n const issue = getIssue(pipeInfo, result.issue);\n issues ? issues.push(issue) : issues = [issue];\n if (pipeInfo.abortEarly || pipeInfo.abortPipeEarly) {\n break;\n }\n } else {\n output = result.output;\n }\n }\n return issues ? { issues } : { output };\n}\n\n// src/utils/executePipe/executePipeAsync.ts\nasync function executePipeAsync(input, pipe, parseInfo, reason) {\n if (!pipe || !pipe.length) {\n return { output: input };\n }\n let pipeInfo;\n let issues;\n let output = input;\n for (const action of pipe) {\n const result = await action(output);\n if (result.issue) {\n pipeInfo = pipeInfo || getPipeInfo(parseInfo, reason);\n const issue = getIssue(pipeInfo, result.issue);\n issues ? issues.push(issue) : issues = [issue];\n if (pipeInfo.abortEarly || pipeInfo.abortPipeEarly) {\n break;\n }\n } else {\n output = result.output;\n }\n }\n return issues ? { issues } : { output };\n}\n\n// src/utils/getDefaultArgs/getDefaultArgs.ts\nfunction getDefaultArgs(arg1, arg2) {\n return !arg1 || typeof arg1 === \"string\" ? [arg1, arg2] : [void 0, arg1];\n}\n\n// src/utils/getIssues/getIssues.ts\nfunction getIssues(info, reason, validation, message, input, issues) {\n return {\n issues: [\n {\n reason,\n validation,\n origin: info?.origin || \"value\",\n message,\n input,\n issues,\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n }\n ]\n };\n}\n\n// src/utils/isLuhnAlgo/isLuhnAlgo.ts\nfunction isLuhnAlgo(input) {\n const number2 = input.replace(/\\D/g, \"\");\n let length2 = number2.length;\n let bit = 1;\n let sum = 0;\n while (length2) {\n const value2 = +number2[--length2];\n bit ^= 1;\n sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value2] : value2;\n }\n return sum % 10 === 0;\n}\n\n// src/schemas/any/any.ts\nfunction any(pipe = []) {\n return {\n /**\n * The schema type.\n */\n schema: \"any\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return executePipe(input, pipe, info, \"any\");\n }\n };\n}\n\n// src/schemas/any/anyAsync.ts\nfunction anyAsync(pipe = []) {\n return {\n /**\n * The schema type.\n */\n schema: \"any\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n return executePipeAsync(input, pipe, info, \"any\");\n }\n };\n}\n\n// src/schemas/array/array.ts\nfunction array(item, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"array\",\n /**\n * The array item schema.\n */\n array: { item },\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!Array.isArray(input)) {\n return getIssues(info, \"type\", \"array\", error || \"Invalid type\", input);\n }\n let issues;\n const output = [];\n for (let key = 0; key < input.length; key++) {\n const value2 = input[key];\n const result = item._parse(value2, info);\n if (result.issues) {\n const pathItem = {\n schema: \"array\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n } else {\n output.push(result.output);\n }\n }\n return issues ? { issues } : executePipe(output, pipe, info, \"array\");\n }\n };\n}\n\n// src/schemas/array/arrayAsync.ts\nfunction arrayAsync(item, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"array\",\n /**\n * The array item schema.\n */\n array: { item },\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!Array.isArray(input)) {\n return getIssues(info, \"type\", \"array\", error || \"Invalid type\", input);\n }\n let issues;\n const output = [];\n await Promise.all(\n input.map(async (value2, key) => {\n if (!(info?.abortEarly && issues)) {\n const result = await item._parse(value2, info);\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n const pathItem = {\n schema: \"array\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n output[key] = result.output;\n }\n }\n }\n })\n ).catch(() => null);\n return issues ? { issues } : executePipeAsync(output, pipe, info, \"array\");\n }\n };\n}\n\n// src/schemas/bigint/bigint.ts\nfunction bigint(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"bigint\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"bigint\") {\n return getIssues(\n info,\n \"type\",\n \"bigint\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"bigint\");\n }\n };\n}\n\n// src/schemas/bigint/bigintAsync.ts\nfunction bigintAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"bigint\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"bigint\") {\n return getIssues(\n info,\n \"type\",\n \"bigint\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"bigint\");\n }\n };\n}\n\n// src/schemas/blob/blob.ts\nfunction blob(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"blob\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!(input instanceof Blob)) {\n return getIssues(info, \"type\", \"blob\", error || \"Invalid type\", input);\n }\n return executePipe(input, pipe, info, \"blob\");\n }\n };\n}\n\n// src/schemas/blob/blobAsync.ts\nfunction blobAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"blob\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!(input instanceof Blob)) {\n return getIssues(info, \"type\", \"blob\", error || \"Invalid type\", input);\n }\n return executePipeAsync(input, pipe, info, \"blob\");\n }\n };\n}\n\n// src/schemas/boolean/boolean.ts\nfunction boolean(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"boolean\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"boolean\") {\n return getIssues(\n info,\n \"type\",\n \"boolean\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"boolean\");\n }\n };\n}\n\n// src/schemas/boolean/booleanAsync.ts\nfunction booleanAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"boolean\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"boolean\") {\n return getIssues(\n info,\n \"type\",\n \"boolean\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"boolean\");\n }\n };\n}\n\n// src/schemas/date/date.ts\nfunction date(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"date\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!(input instanceof Date)) {\n return getIssues(info, \"type\", \"date\", error || \"Invalid type\", input);\n }\n return executePipe(input, pipe, info, \"date\");\n }\n };\n}\n\n// src/schemas/date/dateAsync.ts\nfunction dateAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"date\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!(input instanceof Date)) {\n return getIssues(info, \"type\", \"date\", error || \"Invalid type\", input);\n }\n return executePipeAsync(input, pipe, info, \"date\");\n }\n };\n}\n\n// src/schemas/enumType/enumType.ts\nfunction enumType(enumValue, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"enum\",\n /**\n * The enum value.\n */\n enum: enumValue,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!enumValue.includes(input)) {\n return getIssues(info, \"type\", \"enum\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/enumType/enumTypeAsync.ts\nfunction enumTypeAsync(enumValue, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"enum\",\n /**\n * The enum value.\n */\n enum: enumValue,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!enumValue.includes(input)) {\n return getIssues(info, \"type\", \"enum\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/instance/instance.ts\nfunction instance(of, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"instance\",\n /**\n * The class of the instance.\n */\n class: of,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!(input instanceof of)) {\n return getIssues(\n info,\n \"type\",\n \"instance\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"instance\");\n }\n };\n}\n\n// src/schemas/instance/instanceAsync.ts\nfunction instanceAsync(of, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"instance\",\n /**\n * The class of the instance.\n */\n class: of,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!(input instanceof of)) {\n return getIssues(\n info,\n \"type\",\n \"instance\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"instance\");\n }\n };\n}\n\n// src/schemas/literal/literal.ts\nfunction literal(literal2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"literal\",\n /**\n * The literal value.\n */\n literal: literal2,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input !== literal2) {\n return getIssues(\n info,\n \"type\",\n \"literal\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/literal/literalAsync.ts\nfunction literalAsync(literal2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"literal\",\n /**\n * The literal value.\n */\n literal: literal2,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input !== literal2) {\n return getIssues(\n info,\n \"type\",\n \"literal\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/map/map.ts\nfunction map(key, value2, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"map\",\n /**\n * The map key and value schema.\n */\n map: { key, value: value2 },\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!(input instanceof Map)) {\n return getIssues(info, \"type\", \"map\", error || \"Invalid type\", input);\n }\n let issues;\n const output = /* @__PURE__ */ new Map();\n for (const [inputKey, inputValue] of input.entries()) {\n let pathItem;\n const keyResult = key._parse(inputKey, {\n origin: \"key\",\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n });\n if (keyResult.issues) {\n pathItem = {\n schema: \"map\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of keyResult.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = keyResult.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n }\n const valueResult = value2._parse(inputValue, info);\n if (valueResult.issues) {\n pathItem = pathItem || {\n schema: \"map\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of valueResult.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = valueResult.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n }\n if (!keyResult.issues && !valueResult.issues) {\n output.set(keyResult.output, valueResult.output);\n }\n }\n return issues ? { issues } : executePipe(output, pipe, info, \"map\");\n }\n };\n}\n\n// src/schemas/map/mapAsync.ts\nfunction mapAsync(key, value2, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"map\",\n /**\n * The map key and value schema.\n */\n map: { key, value: value2 },\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!(input instanceof Map)) {\n return getIssues(info, \"type\", \"map\", error || \"Invalid type\", input);\n }\n const output = /* @__PURE__ */ new Map();\n let issues;\n await Promise.all(\n Array.from(input.entries()).map(async ([inputKey, inputValue]) => {\n let pathItem;\n const [keyResult, valueResult] = await Promise.all(\n [\n { schema: key, value: inputKey, origin: \"key\" },\n { schema: value2, value: inputValue, origin: \"value\" }\n ].map(async ({ schema, value: value3, origin }) => {\n if (!(info?.abortEarly && issues)) {\n const result = await schema._parse(value3, {\n origin,\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n });\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n pathItem = pathItem || {\n schema: \"map\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n return result;\n }\n }\n }\n })\n ).catch(() => []);\n if (keyResult && valueResult) {\n output.set(keyResult.output, valueResult.output);\n }\n })\n );\n return issues ? { issues } : executePipeAsync(input, pipe, info, \"map\");\n }\n };\n}\n\n// src/schemas/nan/nan.ts\nfunction nan(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"nan\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!Number.isNaN(input)) {\n return getIssues(info, \"type\", \"nan\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/nan/nanAsync.ts\nfunction nanAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"nan\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!Number.isNaN(input)) {\n return getIssues(info, \"type\", \"nan\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/nativeEnum/nativeEnum.ts\nfunction nativeEnum(nativeEnum2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"native_enum\",\n /**\n * The native enum value.\n */\n nativeEnum: nativeEnum2,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!Object.values(nativeEnum2).includes(input)) {\n return getIssues(\n info,\n \"type\",\n \"native_enum\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/nativeEnum/nativeEnumAsync.ts\nfunction nativeEnumAsync(nativeEnum2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"native_enum\",\n /**\n * The native enum value.\n */\n nativeEnum: nativeEnum2,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!Object.values(nativeEnum2).includes(input)) {\n return getIssues(\n info,\n \"type\",\n \"native_enum\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/never/never.ts\nfunction never(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"never\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return getIssues(info, \"type\", \"never\", error || \"Invalid type\", input);\n }\n };\n}\n\n// src/schemas/never/neverAsync.ts\nfunction neverAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"never\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n return getIssues(info, \"type\", \"never\", error || \"Invalid type\", input);\n }\n };\n}\n\n// src/schemas/nonNullable/nonNullable.ts\nfunction nonNullable(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_nullable\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === null) {\n return getIssues(\n info,\n \"type\",\n \"non_nullable\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nonNullable/nonNullableAsync.ts\nfunction nonNullableAsync(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_nullable\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === null) {\n return getIssues(\n info,\n \"type\",\n \"non_nullable\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nonNullish/nonNullish.ts\nfunction nonNullish(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_nullish\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === null || input === void 0) {\n return getIssues(\n info,\n \"type\",\n \"non_nullish\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nonNullish/nonNullishAsync.ts\nfunction nonNullishAsync(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_nullish\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === null || input === void 0) {\n return getIssues(\n info,\n \"type\",\n \"non_nullish\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nonOptional/nonOptional.ts\nfunction nonOptional(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_optional\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === void 0) {\n return getIssues(\n info,\n \"type\",\n \"non_optional\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nonOptional/nonOptionalAsync.ts\nfunction nonOptionalAsync(wrapped, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"non_optional\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === void 0) {\n return getIssues(\n info,\n \"type\",\n \"non_optional\",\n error || \"Invalid type\",\n input\n );\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nullable/nullable.ts\nfunction nullable(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"nullable\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === null) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nullable/nullableAsync.ts\nfunction nullableAsync(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"nullable\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === null) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nullish/nullish.ts\nfunction nullish(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"nullish\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === null || input === void 0) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nullish/nullishAsync.ts\nfunction nullishAsync(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"nullish\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === null || input === void 0) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/nullType/nullType.ts\nfunction nullType(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"null\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input !== null) {\n return getIssues(info, \"type\", \"null\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/nullType/nullTypeAsync.ts\nfunction nullTypeAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"null\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input !== null) {\n return getIssues(info, \"type\", \"null\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/number/number.ts\nfunction number(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"number\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"number\") {\n return getIssues(\n info,\n \"type\",\n \"number\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"number\");\n }\n };\n}\n\n// src/schemas/number/numberAsync.ts\nfunction numberAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"number\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"number\") {\n return getIssues(\n info,\n \"type\",\n \"number\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"number\");\n }\n };\n}\n\n// src/schemas/object/object.ts\nfunction object(object2, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n let cachedEntries;\n return {\n /**\n * The schema type.\n */\n schema: \"object\",\n /**\n * The object schema.\n */\n object: object2,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!input || typeof input !== \"object\") {\n return getIssues(\n info,\n \"type\",\n \"object\",\n error || \"Invalid type\",\n input\n );\n }\n cachedEntries = cachedEntries || Object.entries(object2);\n let issues;\n const output = {};\n for (const [key, schema] of cachedEntries) {\n const value2 = input[key];\n const result = schema._parse(value2, info);\n if (result.issues) {\n const pathItem = {\n schema: \"object\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n } else {\n output[key] = result.output;\n }\n }\n return issues ? { issues } : executePipe(\n output,\n pipe,\n info,\n \"object\"\n );\n }\n };\n}\n\n// src/schemas/object/objectAsync.ts\nfunction objectAsync(object2, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n let cachedEntries;\n return {\n /**\n * The schema type.\n */\n schema: \"object\",\n /**\n * The object schema.\n */\n object: object2,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!input || typeof input !== \"object\") {\n return getIssues(\n info,\n \"type\",\n \"object\",\n error || \"Invalid type\",\n input\n );\n }\n cachedEntries = cachedEntries || Object.entries(object2);\n let issues;\n const output = {};\n await Promise.all(\n cachedEntries.map(async ([key, schema]) => {\n if (!(info?.abortEarly && issues)) {\n const value2 = input[key];\n const result = await schema._parse(value2, info);\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n const pathItem = {\n schema: \"object\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n output[key] = result.output;\n }\n }\n }\n })\n ).catch(() => null);\n return issues ? { issues } : executePipeAsync(\n output,\n pipe,\n info,\n \"object\"\n );\n }\n };\n}\n\n// src/schemas/optional/optional.ts\nfunction optional(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"optional\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (input === void 0) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/optional/optionalAsync.ts\nfunction optionalAsync(wrapped) {\n return {\n /**\n * The schema type.\n */\n schema: \"optional\",\n /**\n * The wrapped schema.\n */\n wrapped,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (input === void 0) {\n return { output: input };\n }\n return wrapped._parse(input, info);\n }\n };\n}\n\n// src/schemas/string/string.ts\nfunction string(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"string\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"string\") {\n return getIssues(\n info,\n \"type\",\n \"string\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"string\");\n }\n };\n}\n\n// src/schemas/string/stringAsync.ts\nfunction stringAsync(arg1, arg2) {\n const [error, pipe] = getDefaultArgs(arg1, arg2);\n return {\n /**\n * The schema type.\n */\n schema: \"string\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"string\") {\n return getIssues(\n info,\n \"type\",\n \"string\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"string\");\n }\n };\n}\n\n// src/schemas/record/utils/getRecordArgs/getRecordArgs.ts\nfunction getRecordArgs(arg1, arg2, arg3, arg4) {\n if (typeof arg2 === \"object\" && !Array.isArray(arg2)) {\n const [error2, pipe2] = getDefaultArgs(arg3, arg4);\n return [arg1, arg2, error2, pipe2];\n }\n const [error, pipe] = getDefaultArgs(\n arg2,\n arg3\n );\n return [string(), arg1, error, pipe];\n}\n\n// src/schemas/record/values.ts\nvar BLOCKED_KEYS = [\"__proto__\", \"prototype\", \"constructor\"];\n\n// src/schemas/record/record.ts\nfunction record(arg1, arg2, arg3, arg4) {\n const [key, value2, error, pipe] = getRecordArgs(arg1, arg2, arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"record\",\n /**\n * The record key and value schema.\n */\n record: { key, value: value2 },\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!input || typeof input !== \"object\") {\n return getIssues(\n info,\n \"type\",\n \"record\",\n error || \"Invalid type\",\n input\n );\n }\n let issues;\n const output = {};\n for (const [inputKey, inputValue] of Object.entries(input)) {\n if (!BLOCKED_KEYS.includes(inputKey)) {\n let pathItem;\n const keyResult = key._parse(inputKey, {\n origin: \"key\",\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n });\n if (keyResult.issues) {\n pathItem = {\n schema: \"record\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of keyResult.issues) {\n issue.path = [pathItem];\n issues?.push(issue);\n }\n if (!issues) {\n issues = keyResult.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n }\n const valueResult = value2._parse(inputValue, info);\n if (valueResult.issues) {\n pathItem = pathItem || {\n schema: \"record\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of valueResult.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = valueResult.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n }\n if (!keyResult.issues && !valueResult.issues) {\n output[keyResult.output] = valueResult.output;\n }\n }\n }\n return issues ? { issues } : executePipe(\n output,\n pipe,\n info,\n \"record\"\n );\n }\n };\n}\n\n// src/schemas/record/recordAsync.ts\nfunction recordAsync(arg1, arg2, arg3, arg4) {\n const [key, value2, error, pipe] = getRecordArgs(arg1, arg2, arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"record\",\n /**\n * The record key and value schema.\n */\n record: { key, value: value2 },\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!input || typeof input !== \"object\") {\n return getIssues(\n info,\n \"type\",\n \"record\",\n error || \"Invalid type\",\n input\n );\n }\n let issues;\n const output = {};\n await Promise.all(\n // Note: `Object.entries(...)` converts each key to a string\n Object.entries(input).map(async ([inputKey, inputValue]) => {\n if (!BLOCKED_KEYS.includes(inputKey)) {\n let pathItem;\n const [keyResult, valueResult] = await Promise.all(\n [\n { schema: key, value: inputKey, origin: \"key\" },\n { schema: value2, value: inputValue, origin: \"value\" }\n ].map(async ({ schema, value: value3, origin }) => {\n if (!(info?.abortEarly && issues)) {\n const result = await schema._parse(value3, {\n origin,\n abortEarly: info?.abortEarly,\n abortPipeEarly: info?.abortPipeEarly\n });\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n pathItem = pathItem || {\n schema: \"record\",\n input,\n key: inputKey,\n value: inputValue\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n return result;\n }\n }\n }\n })\n ).catch(() => []);\n if (keyResult && valueResult) {\n output[keyResult.output] = valueResult.output;\n }\n }\n })\n );\n return issues ? { issues } : executePipeAsync(\n output,\n pipe,\n info,\n \"record\"\n );\n }\n };\n}\n\n// src/schemas/recursive/recursive.ts\nfunction recursive(getter) {\n return {\n /**\n * The schema type.\n */\n schema: \"recursive\",\n /**\n * The schema getter.\n */\n getter,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return getter()._parse(input, info);\n }\n };\n}\n\n// src/schemas/recursive/recursiveAsync.ts\nfunction recursiveAsync(getter) {\n return {\n /**\n * The schema type.\n */\n schema: \"recursive\",\n /**\n * The schema getter.\n */\n getter,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n return getter()._parse(input, info);\n }\n };\n}\n\n// src/schemas/set/set.ts\nfunction set(value2, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"set\",\n /**\n * The set value schema.\n */\n set: { value: value2 },\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!(input instanceof Set)) {\n return getIssues(info, \"type\", \"set\", error || \"Invalid type\", input);\n }\n let key = 0;\n let issues;\n const output = /* @__PURE__ */ new Set();\n for (const inputValue of input) {\n const result = value2._parse(inputValue, info);\n if (result.issues) {\n const pathItem = {\n schema: \"set\",\n input,\n key,\n value: inputValue\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n } else {\n output.add(result.output);\n }\n key++;\n }\n return issues ? { issues } : executePipe(output, pipe, info, \"set\");\n }\n };\n}\n\n// src/schemas/set/setAsync.ts\nfunction setAsync(value2, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"set\",\n /**\n * The set value schema.\n */\n set: { value: value2 },\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!(input instanceof Set)) {\n return getIssues(info, \"type\", \"set\", error || \"Invalid type\", input);\n }\n let issues;\n const output = /* @__PURE__ */ new Set();\n await Promise.all(\n Array.from(input.values()).map(async (inputValue, key) => {\n if (!(info?.abortEarly && issues)) {\n const result = await value2._parse(inputValue, info);\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n const pathItem = {\n schema: \"set\",\n input,\n key,\n value: inputValue\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n output.add(result.output);\n }\n }\n }\n })\n ).catch(() => null);\n return issues ? { issues } : executePipeAsync(input, pipe, info, \"set\");\n }\n };\n}\n\n// src/schemas/special/special.ts\nfunction special(check, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"special\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!check(input)) {\n return getIssues(\n info,\n \"type\",\n \"special\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipe(input, pipe, info, \"special\");\n }\n };\n}\n\n// src/schemas/special/specialAsync.ts\nfunction specialAsync(check, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return {\n /**\n * The schema type.\n */\n schema: \"special\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!await check(input)) {\n return getIssues(\n info,\n \"type\",\n \"special\",\n error || \"Invalid type\",\n input\n );\n }\n return executePipeAsync(input, pipe, info, \"special\");\n }\n };\n}\n\n// src/schemas/symbol/symbol.ts\nfunction symbol2(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"symbol\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"symbol\") {\n return getIssues(\n info,\n \"type\",\n \"symbol\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/symbol/symbolAsync.ts\nfunction symbolAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"symbol\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"symbol\") {\n return getIssues(\n info,\n \"type\",\n \"symbol\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/tuple/utils/getTupleArgs/getTupleArgs.ts\nfunction getTupleArgs(arg1, arg2, arg3) {\n if (typeof arg1 === \"object\" && !Array.isArray(arg1)) {\n const [error2, pipe2] = getDefaultArgs(arg2, arg3);\n return [arg1, error2, pipe2];\n }\n const [error, pipe] = getDefaultArgs(\n arg1,\n arg2\n );\n return [void 0, error, pipe];\n}\n\n// src/schemas/tuple/tuple.ts\nfunction tuple(items, arg2, arg3, arg4) {\n const [rest, error, pipe] = getTupleArgs(arg2, arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"tuple\",\n /**\n * The tuple items and rest schema.\n */\n tuple: { items, rest },\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (!Array.isArray(input) || !rest && items.length !== input.length || rest && items.length > input.length) {\n return getIssues(info, \"type\", \"tuple\", error || \"Invalid type\", input);\n }\n let issues;\n const output = [];\n for (let key = 0; key < items.length; key++) {\n const value2 = input[key];\n const result = items[key]._parse(value2, info);\n if (result.issues) {\n const pathItem = {\n schema: \"tuple\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n } else {\n output[key] = result.output;\n }\n }\n if (rest) {\n for (let key = items.length; key < input.length; key++) {\n const value2 = input[key];\n const result = rest._parse(value2, info);\n if (result.issues) {\n const pathItem = {\n schema: \"tuple\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n break;\n }\n } else {\n output[key] = result.output;\n }\n }\n }\n return issues ? { issues } : executePipe(\n output,\n pipe,\n info,\n \"tuple\"\n );\n }\n };\n}\n\n// src/schemas/tuple/tupleAsync.ts\nfunction tupleAsync(items, arg2, arg3, arg4) {\n const [rest, error, pipe] = getTupleArgs(arg2, arg3, arg4);\n return {\n /**\n * The schema type.\n */\n schema: \"tuple\",\n /**\n * The tuple items and rest schema.\n */\n tuple: { items, rest },\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (!Array.isArray(input) || !rest && items.length !== input.length || rest && items.length > input.length) {\n return getIssues(info, \"type\", \"tuple\", error || \"Invalid type\", input);\n }\n let issues;\n const output = [];\n await Promise.all([\n // Parse schema of each tuple item\n Promise.all(\n items.map(async (schema, key) => {\n if (!(info?.abortEarly && issues)) {\n const value2 = input[key];\n const result = await schema._parse(value2, info);\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n const pathItem = {\n schema: \"tuple\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n output[key] = result.output;\n }\n }\n }\n })\n ),\n // If necessary parse schema of each rest item\n rest && Promise.all(\n input.slice(items.length).map(async (value2, index) => {\n if (!(info?.abortEarly && issues)) {\n const key = items.length + index;\n const result = await rest._parse(value2, info);\n if (!(info?.abortEarly && issues)) {\n if (result.issues) {\n const pathItem = {\n schema: \"tuple\",\n input,\n key,\n value: value2\n };\n for (const issue of result.issues) {\n if (issue.path) {\n issue.path.unshift(pathItem);\n } else {\n issue.path = [pathItem];\n }\n issues?.push(issue);\n }\n if (!issues) {\n issues = result.issues;\n }\n if (info?.abortEarly) {\n throw null;\n }\n } else {\n output[key] = result.output;\n }\n }\n }\n })\n )\n ]).catch(() => null);\n return issues ? { issues } : executePipeAsync(\n output,\n pipe,\n info,\n \"tuple\"\n );\n }\n };\n}\n\n// src/schemas/undefinedType/undefinedType.ts\nfunction undefinedType(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"undefined\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"undefined\") {\n return getIssues(\n info,\n \"type\",\n \"undefined\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/undefinedType/undefinedTypeAsync.ts\nfunction undefinedTypeAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"undefined\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"undefined\") {\n return getIssues(\n info,\n \"type\",\n \"undefined\",\n error || \"Invalid type\",\n input\n );\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/union/union.ts\nfunction union(union2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"union\",\n /**\n * The union schema.\n */\n union: union2,\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n let issues;\n let output;\n for (const schema of union2) {\n const result = schema._parse(input, info);\n if (result.issues) {\n if (issues) {\n for (const issue of result.issues) {\n issues.push(issue);\n }\n } else {\n issues = result.issues;\n }\n } else {\n output = [result.output];\n break;\n }\n }\n return output ? { output: output[0] } : getIssues(\n info,\n \"type\",\n \"union\",\n error || \"Invalid type\",\n input,\n issues\n );\n }\n };\n}\n\n// src/schemas/union/unionAsync.ts\nfunction unionAsync(union2, error) {\n return {\n /**\n * The schema type.\n */\n schema: \"union\",\n /**\n * The union schema.\n */\n union: union2,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n let issues;\n let output;\n for (const schema of union2) {\n const result = await schema._parse(input, info);\n if (result.issues) {\n if (issues) {\n for (const issue of result.issues) {\n issues.push(issue);\n }\n } else {\n issues = result.issues;\n }\n } else {\n output = [result.output];\n break;\n }\n }\n return output ? { output: output[0] } : getIssues(\n info,\n \"type\",\n \"union\",\n error || \"Invalid type\",\n input,\n issues\n );\n }\n };\n}\n\n// src/schemas/unknown/unknown.ts\nfunction unknown(pipe = []) {\n return {\n /**\n * The schema type.\n */\n schema: \"unknown\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return executePipe(input, pipe, info, \"unknown\");\n }\n };\n}\n\n// src/schemas/unknown/unknownAsync.ts\nfunction unknownAsync(pipe = []) {\n return {\n /**\n * The schema type.\n */\n schema: \"unknown\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n return executePipeAsync(input, pipe, info, \"unknown\");\n }\n };\n}\n\n// src/schemas/voidType/voidType.ts\nfunction voidType(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"void\",\n /**\n * Whether it's async.\n */\n async: false,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n if (typeof input !== \"undefined\") {\n return getIssues(info, \"type\", \"void\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/schemas/voidType/voidTypeAsync.ts\nfunction voidTypeAsync(error) {\n return {\n /**\n * The schema type.\n */\n schema: \"void\",\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n if (typeof input !== \"undefined\") {\n return getIssues(info, \"type\", \"void\", error || \"Invalid type\", input);\n }\n return { output: input };\n }\n };\n}\n\n// src/methods/keyof/keyof.ts\nfunction keyof(schema) {\n return enumType(\n Object.keys(schema.object)\n );\n}\n\n// src/methods/merge/merge.ts\nfunction merge(schemas, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return object(\n schemas.reduce(\n (object2, schemas2) => ({ ...object2, ...schemas2.object }),\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/merge/mergeAsync.ts\nfunction mergeAsync(schemas, arg2, arg3) {\n const [error, pipe] = getDefaultArgs(arg2, arg3);\n return objectAsync(\n schemas.reduce(\n (object2, schemas2) => ({ ...object2, ...schemas2.object }),\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/omit/omit.ts\nfunction omit(schema, keys, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return object(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => keys.includes(key) ? object2 : { ...object2, [key]: schema2 },\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/omit/omitAsync.ts\nfunction omitAsync(schema, keys, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return objectAsync(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => keys.includes(key) ? object2 : { ...object2, [key]: schema2 },\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/parse/parse.ts\nfunction parse(schema, input, info) {\n const result = schema._parse(input, info);\n if (result.issues) {\n throw new ValiError(result.issues);\n }\n return result.output;\n}\n\n// src/methods/parse/parseAsync.ts\nasync function parseAsync(schema, input, info) {\n const result = await schema._parse(input, info);\n if (result.issues) {\n throw new ValiError(result.issues);\n }\n return result.output;\n}\n\n// src/methods/partial/partial.ts\nfunction partial(schema, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return object(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => ({\n ...object2,\n [key]: optional(schema2)\n }),\n {}\n ),\n error,\n // @ts-ignore FIXME: Remove line once bug in TS is fixed\n pipe\n );\n}\n\n// src/methods/partial/partialAsync.ts\nfunction partialAsync(schema, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return objectAsync(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => ({\n ...object2,\n [key]: optionalAsync(schema2)\n }),\n {}\n ),\n error,\n // @ts-ignore FIXME: Remove line once bug in TS is fixed\n pipe\n );\n}\n\n// src/methods/pick/pick.ts\nfunction pick(schema, keys, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return object(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => keys.includes(key) ? { ...object2, [key]: schema2 } : object2,\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/pick/pickAsync.ts\nfunction pickAsync(schema, keys, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return objectAsync(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => keys.includes(key) ? { ...object2, [key]: schema2 } : object2,\n {}\n ),\n error,\n pipe\n );\n}\n\n// src/methods/required/required.ts\nfunction required(schema, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return object(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => ({\n ...object2,\n [key]: nonOptional(schema2)\n }),\n {}\n ),\n error,\n // @ts-ignore FIXME: Remove line once bug in TS is fixed\n pipe\n );\n}\n\n// src/methods/required/requiredAsync.ts\nfunction requiredAsync(schema, arg3, arg4) {\n const [error, pipe] = getDefaultArgs(arg3, arg4);\n return objectAsync(\n Object.entries(schema.object).reduce(\n (object2, [key, schema2]) => ({\n ...object2,\n [key]: nonOptionalAsync(schema2)\n }),\n {}\n ),\n error,\n // @ts-ignore FIXME: Remove line once bug in TS is fixed\n pipe\n );\n}\n\n// src/methods/safeParse/safeParse.ts\nfunction safeParse(schema, input, info) {\n const result = schema._parse(input, info);\n return result.issues ? {\n success: false,\n error: new ValiError(result.issues),\n issues: result.issues\n } : {\n success: true,\n data: result.output,\n output: result.output\n };\n}\n\n// src/methods/safeParse/safeParseAsync.ts\nasync function safeParseAsync(schema, input, info) {\n const result = await schema._parse(input, info);\n return result.issues ? {\n success: false,\n error: new ValiError(result.issues),\n issues: result.issues\n } : {\n success: true,\n data: result.output,\n output: result.output\n };\n}\n\n// src/methods/strict/strict.ts\nfunction strict(schema, error) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n const result = schema._parse(input, info);\n return !result.issues && // Check length of input and output keys\n Object.keys(input).length !== Object.keys(result.output).length ? getIssues(info, \"object\", \"strict\", error || \"Invalid keys\", input) : result;\n }\n };\n}\n\n// src/methods/strict/strictAsync.ts\nfunction strictAsync(schema, error) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n const result = await schema._parse(input, info);\n return !result.issues && // Check length of input and output keys\n Object.keys(input).length !== Object.keys(result.output).length ? getIssues(info, \"object\", \"strict\", error || \"Invalid keys\", input) : result;\n }\n };\n}\n\n// src/methods/transform/transform.ts\nfunction transform(schema, action) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n const result = schema._parse(input, info);\n return result.issues ? result : { output: action(result.output) };\n }\n };\n}\n\n// src/methods/transform/transformAsync.ts\nfunction transformAsync(schema, action) {\n return {\n ...schema,\n /**\n * Whether it's async.\n */\n async: true,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n async _parse(input, info) {\n const result = await schema._parse(input, info);\n return result.issues ? result : { output: await action(result.output) };\n }\n };\n}\n\n// src/methods/unwrap/unwrap.ts\nfunction unwrap(schema) {\n return schema.wrapped;\n}\n\n// src/methods/withDefault/withDefault.ts\nfunction withDefault(schema, value2) {\n return {\n ...schema,\n /**\n * Parses unknown input based on its schema.\n *\n * @param input The input to be parsed.\n * @param info The parse info.\n *\n * @returns The parsed output.\n */\n _parse(input, info) {\n return schema._parse(\n input === void 0 ? typeof value2 === \"function\" ? value2() : value2 : input,\n info\n );\n }\n };\n}\nvar useDefault = withDefault;\n\n// src/transformations/toCustom/toCustom.ts\nfunction toCustom(action) {\n return (input) => ({ output: action(input) });\n}\n\n// src/transformations/toCustom/toCustomAsync.ts\nfunction toCustomAsync(action) {\n return async (input) => ({\n output: await action(input)\n });\n}\n\n// src/transformations/toLowerCase/toLowerCase.ts\nfunction toLowerCase() {\n return (input) => ({\n output: input.toLocaleLowerCase()\n });\n}\n\n// src/transformations/toMaxValue/toMaxValue.ts\nfunction toMaxValue(requirement) {\n return (input) => ({\n output: input > requirement ? requirement : input\n });\n}\n\n// src/transformations/toMinValue/toMinValue.ts\nfunction toMinValue(requirement) {\n return (input) => ({\n output: input < requirement ? requirement : input\n });\n}\n\n// src/transformations/toTrimmed/toTrimmed.ts\nfunction toTrimmed() {\n return (input) => ({ output: input.trim() });\n}\n\n// src/transformations/toTrimmedEnd/toTrimmedEnd.ts\nfunction toTrimmedEnd() {\n return (input) => ({ output: input.trimEnd() });\n}\n\n// src/transformations/toTrimmedStart/toTrimmedStart.ts\nfunction toTrimmedStart() {\n return (input) => ({\n output: input.trimStart()\n });\n}\n\n// src/transformations/toUpperCase/toUpperCase.ts\nfunction toUpperCase() {\n return (input) => ({\n output: input.toUpperCase()\n });\n}\n\n// src/validations/bytes/bytes.ts\nfunction bytes(requirement, error) {\n return (input) => {\n if (new TextEncoder().encode(input).length !== requirement) {\n return {\n issue: {\n validation: \"bytes\",\n message: error || \"Invalid byte length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/custom/custom.ts\nfunction custom(requirement, error) {\n return (input) => {\n if (!requirement(input)) {\n return {\n issue: {\n validation: \"custom\",\n message: error || \"Invalid input\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/custom/customAsync.ts\nfunction customAsync(requirement, error) {\n return async (input) => {\n if (!await requirement(input)) {\n return {\n issue: {\n validation: \"custom\",\n message: error || \"Invalid input\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/email/email.ts\nfunction email(error) {\n return (input) => {\n if (!/^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@(([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{2,})$/i.test(\n input\n )) {\n return {\n issue: {\n validation: \"email\",\n message: error || \"Invalid email\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/emoji/emoji.ts\nfunction emoji(error) {\n return (input) => {\n if (!/^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$/u.test(input)) {\n return {\n issue: {\n validation: \"emoji\",\n message: error || \"Invalid emoji\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/endsWith/endsWith.ts\nfunction endsWith(requirement, error) {\n return (input) => {\n if (!input.endsWith(requirement)) {\n return {\n issue: {\n validation: \"ends_with\",\n message: error || \"Invalid end\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/equal/equal.ts\nfunction equal(requirement, error) {\n return (input) => {\n if (input !== requirement) {\n return {\n issue: {\n validation: \"equal\",\n message: error || \"Invalid input\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/excludes/excludes.ts\nfunction excludes(requirement, error) {\n return (input) => {\n if (input.includes(requirement)) {\n return {\n issue: {\n validation: \"excludes\",\n message: error || \"Invalid content\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/finite/finite.ts\nfunction finite(error) {\n return (input) => {\n if (!Number.isFinite(input)) {\n return {\n issue: {\n validation: \"finite\",\n message: error || \"Invalid finite number\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/imei/imei.ts\nfunction imei(error) {\n return (input) => {\n if (!/^\\d{2}[ |/|-]?\\d{6}[ |/|-]?\\d{6}[ |/|-]?\\d$/.test(input) || !isLuhnAlgo(input)) {\n return {\n issue: {\n validation: \"imei\",\n message: error || \"Invalid IMEI\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/includes/includes.ts\nfunction includes(requirement, error) {\n return (input) => {\n if (!input.includes(requirement)) {\n return {\n issue: {\n validation: \"includes\",\n message: error || \"Invalid content\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/integer/integer.ts\nfunction integer(error) {\n return (input) => {\n if (!Number.isInteger(input)) {\n return {\n issue: {\n validation: \"integer\",\n message: error || \"Invalid integer\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/ip/ip.ts\nfunction ip(error) {\n return (input) => {\n if (!/^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$/.test(input) && !/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test(\n input\n )) {\n return {\n issue: {\n validation: \"ip\",\n message: error || \"Invalid IP\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/ipv4/ipv4.ts\nfunction ipv4(error) {\n return (input) => {\n if (!/^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$/.test(input)) {\n return {\n issue: {\n validation: \"ipv4\",\n message: error || \"Invalid IP v4\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/ipv6/ipv6.ts\nfunction ipv6(error) {\n return (input) => {\n if (!/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test(\n input\n )) {\n return {\n issue: {\n validation: \"ipv6\",\n message: error || \"Invalid IP v6\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoDate/isoDate.ts\nfunction isoDate(error) {\n return (input) => {\n if (!/^\\d{4}-(0[1-9]|1[0-2])-([12]\\d|0[1-9]|3[01])$/.test(input)) {\n return {\n issue: {\n validation: \"iso_date\",\n message: error || \"Invalid date\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoDateTime/isoDateTime.ts\nfunction isoDateTime(error) {\n return (input) => {\n if (!/^\\d{4}-(0[1-9]|1[0-2])-([12]\\d|0[1-9]|3[01])T(0[0-9]|1\\d|2[0-3]):[0-5]\\d$/.test(\n input\n )) {\n return {\n issue: {\n validation: \"iso_date_time\",\n message: error || \"Invalid datetime\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoTime/isoTime.ts\nfunction isoTime(error) {\n return (input) => {\n if (!/^(0[0-9]|1\\d|2[0-3]):[0-5]\\d$/.test(input)) {\n return {\n issue: {\n validation: \"iso_time\",\n message: error || \"Invalid time\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoTimeSecond/isoTimeSecond.ts\nfunction isoTimeSecond(error) {\n return (input) => {\n if (!/^(0[0-9]|1\\d|2[0-3]):[0-5]\\d:[0-5]\\d$/.test(input)) {\n return {\n issue: {\n validation: \"iso_time_second\",\n message: error || \"Invalid time\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoTimestamp/isoTimestamp.ts\nfunction isoTimestamp(error) {\n return (input) => {\n if (!/^\\d{4}-(0[1-9]|1[0-2])-([12]\\d|0[1-9]|3[01])T(0[0-9]|1\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$/.test(\n input\n )) {\n return {\n issue: {\n validation: \"iso_timestamp\",\n message: error || \"Invalid timestamp\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/isoWeek/isoWeek.ts\nfunction isoWeek(error) {\n return (input) => {\n if (!/^\\d{4}-W(0[1-9]|[1-4]\\d|5[0-3])$/.test(input)) {\n return {\n issue: {\n validation: \"iso_week\",\n message: error || \"Invalid week\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/length/length.ts\nfunction length(requirement, error) {\n return (input) => {\n if (input.length !== requirement) {\n return {\n issue: {\n validation: \"length\",\n message: error || \"Invalid length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/maxBytes/maxBytes.ts\nfunction maxBytes(requirement, error) {\n return (input) => {\n if (new TextEncoder().encode(input).length > requirement) {\n return {\n issue: {\n validation: \"max_bytes\",\n message: error || \"Invalid byte length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/maxLength/maxLength.ts\nfunction maxLength(requirement, error) {\n return (input) => {\n if (input.length > requirement) {\n return {\n issue: {\n validation: \"max_length\",\n message: error || \"Invalid length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/maxSize/maxSize.ts\nfunction maxSize(requirement, error) {\n return (input) => {\n if (input.size > requirement) {\n return {\n issue: {\n validation: \"max_size\",\n message: error || \"Invalid size\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/maxValue/maxValue.ts\nfunction maxValue(requirement, error) {\n return (input) => {\n if (input > requirement) {\n return {\n issue: {\n validation: \"max_value\",\n message: error || \"Invalid value\",\n input\n }\n };\n }\n return { output: input };\n };\n}\nvar maxRange = maxValue;\n\n// src/validations/minBytes/minBytes.ts\nfunction minBytes(requirement, error) {\n return (input) => {\n if (new TextEncoder().encode(input).length < requirement) {\n return {\n issue: {\n validation: \"min_bytes\",\n message: error || \"Invalid byte length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/mimeType/mimeType.ts\nfunction mimeType(requirement, error) {\n return (input) => {\n if (!requirement.includes(input.type)) {\n return {\n issue: {\n validation: \"mime_type\",\n message: error || \"Invalid MIME type\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/minLength/minLength.ts\nfunction minLength(requirement, error) {\n return (input) => {\n if (input.length < requirement) {\n return {\n issue: {\n validation: \"min_length\",\n message: error || \"Invalid length\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/minSize/minSize.ts\nfunction minSize(requirement, error) {\n return (input) => {\n if (input.size < requirement) {\n return {\n issue: {\n validation: \"min_size\",\n message: error || \"Invalid size\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/minValue/minValue.ts\nfunction minValue(requirement, error) {\n return (input) => {\n if (input < requirement) {\n return {\n issue: {\n validation: \"min_value\",\n message: error || \"Invalid value\",\n input\n }\n };\n }\n return { output: input };\n };\n}\nvar minRange = minValue;\n\n// src/validations/multipleOf/multipleOf.ts\nfunction multipleOf(requirement, error) {\n return (input) => {\n if (input % requirement !== 0) {\n return {\n issue: {\n validation: \"multipleOf\",\n message: error || \"Invalid multiple\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/regex/regex.ts\nfunction regex(requirement, error) {\n return (input) => {\n if (!requirement.test(input)) {\n return {\n issue: {\n validation: \"regex\",\n message: error || \"Invalid regex\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/safeInteger/safeInteger.ts\nfunction safeInteger(error) {\n return (input) => {\n if (!Number.isSafeInteger(input)) {\n return {\n issue: {\n validation: \"safe_integer\",\n message: error || \"Invalid safe integer\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/size/size.ts\nfunction size(requirement, error) {\n return (input) => {\n if (input.size !== requirement) {\n return {\n issue: {\n validation: \"size\",\n message: error || \"Invalid size\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/startsWith/startsWith.ts\nfunction startsWith(requirement, error) {\n return (input) => {\n if (!input.startsWith(requirement)) {\n return {\n issue: {\n validation: \"starts_with\",\n message: error || \"Invalid start\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/url/url.ts\nfunction url(error) {\n return (input) => {\n try {\n new URL(input);\n return { output: input };\n } catch (_) {\n return {\n issue: {\n validation: \"url\",\n message: error || \"Invalid URL\",\n input\n }\n };\n }\n };\n}\n\n// src/validations/uuid/uuid.ts\nfunction uuid(error) {\n return (input) => {\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(\n input\n )) {\n return {\n issue: {\n validation: \"uuid\",\n message: error || \"Invalid UUID\",\n input\n }\n };\n }\n return { output: input };\n };\n}\n\n// src/validations/value/value.ts\nfunction value(requirement, error) {\n return (input) => {\n if (input !== requirement) {\n return {\n issue: {\n validation: \"value\",\n message: error || \"Invalid value\",\n input\n }\n };\n }\n return { output: input };\n };\n}\nexport {\n ValiError,\n any,\n anyAsync,\n array,\n arrayAsync,\n bigint,\n bigintAsync,\n blob,\n blobAsync,\n boolean,\n booleanAsync,\n brand,\n bytes,\n coerce,\n coerceAsync,\n custom,\n customAsync,\n date,\n dateAsync,\n email,\n emoji,\n endsWith,\n enumType,\n enumTypeAsync,\n equal,\n excludes,\n executePipe,\n executePipeAsync,\n fallback,\n fallbackAsync,\n finite,\n flatten,\n getDefaultArgs,\n getIssues,\n imei,\n includes,\n instance,\n instanceAsync,\n integer,\n ip,\n ipv4,\n ipv6,\n is,\n isLuhnAlgo,\n isoDate,\n isoDateTime,\n isoTime,\n isoTimeSecond,\n isoTimestamp,\n isoWeek,\n keyof,\n length,\n literal,\n literalAsync,\n map,\n mapAsync,\n maxBytes,\n maxLength,\n maxRange,\n maxSize,\n maxValue,\n merge,\n mergeAsync,\n mimeType,\n minBytes,\n minLength,\n minRange,\n minSize,\n minValue,\n multipleOf,\n nan,\n nanAsync,\n nativeEnum,\n nativeEnumAsync,\n never,\n neverAsync,\n nonNullable,\n nonNullableAsync,\n nonNullish,\n nonNullishAsync,\n nonOptional,\n nonOptionalAsync,\n nullType,\n nullTypeAsync,\n nullable,\n nullableAsync,\n nullish,\n nullishAsync,\n number,\n numberAsync,\n object,\n objectAsync,\n omit,\n omitAsync,\n optional,\n optionalAsync,\n parse,\n parseAsync,\n partial,\n partialAsync,\n pick,\n pickAsync,\n record,\n recordAsync,\n recursive,\n recursiveAsync,\n regex,\n required,\n requiredAsync,\n safeInteger,\n safeParse,\n safeParseAsync,\n set,\n setAsync,\n size,\n special,\n specialAsync,\n startsWith,\n strict,\n strictAsync,\n string,\n stringAsync,\n symbol2 as symbol,\n symbolAsync,\n toCustom,\n toCustomAsync,\n toLowerCase,\n toMaxValue,\n toMinValue,\n toTrimmed,\n toTrimmedEnd,\n toTrimmedStart,\n toUpperCase,\n transform,\n transformAsync,\n tuple,\n tupleAsync,\n undefinedType,\n undefinedTypeAsync,\n union,\n unionAsync,\n unknown,\n unknownAsync,\n unwrap,\n url,\n useDefault,\n uuid,\n value,\n voidType,\n voidTypeAsync,\n withDefault\n};\n",null,null,null,null,null,"/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport type { ZipOptions } from 'fflate';\nimport { safeParse, flatten } from 'valibot';\n\nimport {\n DotLottieStatesSchema,\n type DotLottieStates,\n type DotLottieStateMachineDescriptor,\n DotLottieStateMachineDescriptorSchema,\n} from './dotlottie-state';\nimport { DotLottieError, ErrorCodes, createError } from './utils';\n\nexport interface DotLottieStateMachineCommonOptions {\n descriptor: DotLottieStateMachineDescriptor;\n states: DotLottieStates;\n zipOptions?: ZipOptions;\n}\n\nexport class DotLottieStateMachineCommon {\n protected _descriptor: DotLottieStateMachineDescriptor;\n\n protected _zipOptions: ZipOptions;\n\n protected _states: DotLottieStates;\n\n public constructor(options: DotLottieStateMachineCommonOptions) {\n this._requireValidId(options.descriptor.id);\n this._requireValidStates(options.states);\n this._requireValidDescriptor(options.descriptor);\n\n this._descriptor = options.descriptor;\n\n this._zipOptions = options.zipOptions ?? {};\n\n this._states = options.states;\n }\n\n public get zipOptions(): ZipOptions {\n return this._zipOptions;\n }\n\n public set zipOptions(zipOptions: ZipOptions) {\n this._zipOptions = zipOptions;\n }\n\n public get id(): string {\n return this._descriptor.id;\n }\n\n public set id(id: string) {\n this._requireValidId(id);\n\n this._descriptor.id = id;\n }\n\n public get states(): DotLottieStates {\n return this._states;\n }\n\n public set states(states: DotLottieStates) {\n this._states = states;\n }\n\n public get initial(): string {\n return this._descriptor.initial;\n }\n\n public set initial(initial: string) {\n this._descriptor.initial = initial;\n }\n\n public get descriptor(): DotLottieStateMachineDescriptor {\n return this._descriptor;\n }\n\n public set descriptor(descriptor: DotLottieStateMachineDescriptor) {\n this._descriptor = descriptor;\n }\n\n public toString(): string {\n return JSON.stringify({\n descriptor: this._descriptor,\n states: this._states,\n });\n }\n\n protected _requireValidId(id: string | undefined): void {\n if (!id) {\n throw createError('Invalid id.');\n }\n }\n\n protected _requireValidDescriptor(descriptor: DotLottieStateMachineDescriptor): void {\n const result = safeParse(DotLottieStateMachineDescriptorSchema, descriptor);\n\n if (!result.success) {\n const error = `Invalid state machine declaration, ${JSON.stringify(flatten(result.error).nested, null, 2)}`;\n\n throw new DotLottieError(`Invalid descriptor: ${error}`, ErrorCodes.INVALID_STATEMACHINE);\n }\n }\n\n protected _requireValidStates(states: DotLottieStates): void {\n const result = safeParse(DotLottieStatesSchema, states);\n\n if (!result.success) {\n const error = `Invalid state machine declaration, ${JSON.stringify(flatten(result.error).nested, null, 2)}`;\n\n throw new DotLottieError(`Invalid states: ${error}`, ErrorCodes.INVALID_STATEMACHINE);\n }\n }\n}\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport type { Output } from 'valibot';\nimport {\n merge,\n number,\n object,\n optional,\n string,\n union,\n omit,\n record,\n tuple,\n maxValue,\n minValue,\n array,\n} from 'valibot';\n\nimport { ManifestAnimationSchema } from './manifest';\n\nexport const PlaybackOptionsSchema = omit(ManifestAnimationSchema, ['id']);\n\nexport type PlaybackOptions = Output<typeof PlaybackOptionsSchema>;\n\nexport const TransitionableSchema = object({\n state: string(),\n});\nexport type Transitionable = Output<typeof TransitionableSchema>;\n\nexport const StateTransitionOnClickSchema = TransitionableSchema;\n\nexport type StateTransitionOnClick = Output<typeof StateTransitionOnClickSchema>;\n\nexport const StateTransitionOnAfterSchema = merge([TransitionableSchema, object({ ms: number() })]);\n\nexport type StateTransitionOnAfter = Output<typeof StateTransitionOnAfterSchema>;\n\nexport const StateTransitionOnEnterSchema = merge([TransitionableSchema, object({ count: number() })]);\n\nexport type StateTransitionOnEnter = Output<typeof StateTransitionOnEnterSchema>;\n\nexport const StateTransitionOnMouseEnterSchema = TransitionableSchema;\n\nexport type StateTransitionOnMouseEnter = Output<typeof StateTransitionOnMouseEnterSchema>;\n\nexport const StateTransitionOnMouseLeaveSchema = TransitionableSchema;\n\nexport type StateTransitionOnMouseLeave = Output<typeof StateTransitionOnMouseLeaveSchema>;\n\nexport const StateTransitionOnCompleteSchema = TransitionableSchema;\n\nexport type StateTransitionOnComplete = Output<typeof StateTransitionOnCompleteSchema>;\n\nexport const StateTransitionOnShowSchema = merge([\n TransitionableSchema,\n object({ threshold: optional(array(number([minValue(0), maxValue(1)]))) }),\n]);\nexport type StateTransitionOnShow = Output<typeof StateTransitionOnShowSchema>;\n\nexport const DotLottieStateTransitionEventsSchema = object({\n onAfter: optional(StateTransitionOnAfterSchema),\n onClick: optional(StateTransitionOnClickSchema),\n onComplete: optional(StateTransitionOnCompleteSchema),\n onEnter: optional(StateTransitionOnEnterSchema),\n onMouseEnter: optional(StateTransitionOnMouseEnterSchema),\n onMouseLeave: optional(StateTransitionOnMouseLeaveSchema),\n onShow: optional(StateTransitionOnShowSchema),\n});\nexport type DotLottieStateTransitionEvents = Output<typeof DotLottieStateTransitionEventsSchema>;\n\nexport const DotLottieStatePlaybackSettingsSchema = merge([\n PlaybackOptionsSchema,\n object({\n playOnScroll: optional(tuple([number([minValue(0), maxValue(1)]), number([minValue(0), maxValue(1)])])),\n segments: optional(union([tuple([number(), number()]), string()])),\n }),\n]);\nexport type DotLottieStatePlaybackSettings = Output<typeof DotLottieStatePlaybackSettingsSchema>;\n\nexport const DotLottieStateSchema = merge([\n DotLottieStateTransitionEventsSchema,\n object({\n animationId: optional(string()),\n playbackSettings: DotLottieStatePlaybackSettingsSchema,\n }),\n]);\nexport type DotLottieState = Output<typeof DotLottieStateSchema>;\n\nexport const DotLottieStatesSchema = record(string(), DotLottieStateSchema);\nexport type DotLottieStates = Output<typeof DotLottieStatesSchema>;\n\nexport const DotLottieStateMachineDescriptorSchema = object({\n id: string(),\n initial: string(),\n});\nexport type DotLottieStateMachineDescriptor = Output<typeof DotLottieStateMachineDescriptorSchema>;\n\nexport const DotLottieStateMachineSchema = object({\n descriptor: DotLottieStateMachineDescriptorSchema,\n states: DotLottieStatesSchema,\n});\nexport type DotLottieStateMachine = Output<typeof DotLottieStateMachineSchema>;\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport {\n object,\n type Output,\n string,\n array,\n boolean,\n number,\n union,\n optional,\n record,\n any,\n nativeEnum,\n literal,\n} from 'valibot';\n\nexport enum PlayMode {\n Bounce = 'bounce',\n Normal = 'normal',\n}\n\nexport const PlayModeSchema = nativeEnum(PlayMode);\n\nexport const ManifestAnimationSchema = object({\n autoplay: optional(boolean()),\n defaultTheme: optional(string()),\n direction: optional(union([literal(1), literal(-1)])),\n hover: optional(boolean()),\n id: string(),\n intermission: optional(number()),\n loop: optional(union([boolean(), number()])),\n playMode: optional(PlayModeSchema),\n speed: optional(number()),\n themeColor: optional(string()),\n});\nexport type ManifestAnimation = Output<typeof ManifestAnimationSchema>;\n\nexport const ManifestThemeSchema = object({\n animations: array(string()),\n id: string(),\n});\nexport type ManifestTheme = Output<typeof ManifestThemeSchema>;\n\nexport const ManifestSchema = object({\n activeAnimationId: optional(string()),\n animations: array(ManifestAnimationSchema),\n author: optional(string()),\n custom: optional(record(string(), any())),\n description: optional(string()),\n generator: optional(string()),\n keywords: optional(string()),\n revision: optional(number()),\n themes: optional(array(ManifestThemeSchema)),\n states: optional(array(string())),\n version: optional(string()),\n});\n\nexport type Manifest = Output<typeof ManifestSchema>;\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\n/* eslint-disable guard-for-in */\n\nimport type { Animation as AnimationData, Asset } from '@lottiefiles/lottie-types';\nimport type { UnzipFileFilter, Unzipped } from 'fflate';\nimport { unzip as fflateUnzip, strFromU8 } from 'fflate';\nimport { flatten, safeParse } from 'valibot';\n\nimport type { LottieStateMachine } from '../lottie-state-machine';\n\nimport type { Manifest } from './manifest';\nimport { ManifestSchema } from './manifest';\n\nexport interface MimeTypes {\n [key: string]: string;\n}\n\nexport interface MimeCodes {\n [key: string]: number[];\n}\n\nexport const MIME_TYPES: MimeTypes = {\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n bmp: 'image/bmp',\n svg: 'image/svg+xml',\n webp: 'image/webp',\n mpeg: 'audio/mpeg',\n mp3: 'audio/mp3',\n};\n\nexport const MIME_CODES: MimeCodes = {\n jpeg: [0xff, 0xd8, 0xff],\n png: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],\n gif: [0x47, 0x49, 0x46],\n bmp: [0x42, 0x4d],\n webp: [0x52, 0x49, 0x46, 0x46, 0x57, 0x45, 0x42, 0x50],\n svg: [0x3c, 0x3f, 0x78],\n mp3: [0x49, 0x44, 0x33, 0x3, 0x00, 0x00, 0x00, 0x00],\n mpeg: [0x49, 0x44, 0x33, 0x3, 0x00, 0x00, 0x00, 0x00],\n};\n\nexport interface MimeToExtension {\n [key: string]: string;\n}\n\nexport const MIME_TO_EXTENSION: MimeToExtension = {\n 'image/jpeg': 'jpeg',\n 'image/png': 'png',\n 'image/gif': 'gif',\n 'image/bmp': 'bmp',\n 'image/svg+xml': 'svg',\n 'image/webp': 'webp',\n 'audio/mpeg': 'mpeg',\n 'audio/mp3': 'mp3',\n};\n\n/**\n * Converts a base64 string into a Uint8Array.\n *\n * @remarks\n * This function accepts a base64 string and returns a Uint8Array containing the decoded bytes.\n *\n * @param base64String - The base64-encoded string to decode.\n * @returns A Uint8Array containing the decoded bytes.\n *\n * @example\n * ```typescript\n * const base64 = 'SGVsbG8gd29ybGQ=';\n * const array = base64ToUint8Array(base64);\n * ```\n *\n * @public\n */\nexport const base64ToUint8Array = (base64String: string): Uint8Array => {\n const withoutMeta = base64String.substring(base64String.indexOf(',') + 1);\n const binaryString =\n typeof window === 'undefined' ? Buffer.from(withoutMeta, 'base64').toString('binary') : atob(withoutMeta);\n\n const uint8Array = new Uint8Array(binaryString.length);\n\n for (let i = 0; i < binaryString.length; i += 1) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n\n return uint8Array;\n};\n\n/**\n * Determines the MIME type from a base64-encoded string.\n *\n * @remarks\n * This function accepts a base64-encoded string and determines its MIME type by looking at the first few bytes.\n *\n * @param base64 - The base64-encoded string to analyze.\n * @returns The MIME type as a string, or null if the type cannot be determined.\n *\n * @example\n * ```typescript\n * const base64 = 'data:image/jpeg;base64,...';\n * const mimeType = getMimeTypeFromBase64(base64);\n * ```\n *\n * @public\n */\nexport const getMimeTypeFromBase64 = (base64: string): string | null | undefined => {\n let data: string | null = null;\n let bytes: number[] = [];\n\n if (!base64) return null;\n\n const withoutMeta = base64.substring(base64.indexOf(',') + 1);\n\n if (typeof window === 'undefined') {\n data = Buffer.from(withoutMeta, 'base64').toString('binary');\n } else {\n data = atob(withoutMeta);\n }\n\n const bufData = new Uint8Array(data.length);\n\n for (let i = 0; i < data.length; i += 1) {\n bufData[i] = data.charCodeAt(i);\n }\n\n bytes = Array.from(bufData.subarray(0, 8));\n for (const mimeType in MIME_CODES) {\n const dataArr = MIME_CODES[mimeType];\n\n if (dataArr && bytes.every((byte, index) => byte === dataArr[index])) {\n return MIME_TYPES[mimeType];\n }\n }\n\n return null;\n};\n\n/**\n * Determines the file extension from a base64-encoded string.\n *\n * @remarks\n * This function accepts a base64-encoded string and determines its file extension by examining the MIME type.\n *\n * @param base64 - The base64-encoded string to analyze.\n * @returns The file extension as a string, or 'png' if the extension cannot be determined.\n *\n * @example\n * ```typescript\n * const base64 = 'data:image/jpeg;base64,...';\n * const extension = getExtensionTypeFromBase64(base64);\n * ```\n *\n * @public\n */\nexport const getExtensionTypeFromBase64 = (base64: string): string | null => {\n const mimeType = getMimeTypeFromBase64(base64);\n\n if (!mimeType) {\n const ext = base64.split(';')[0]?.split('/')[1];\n\n if (ext) {\n return MIME_TO_EXTENSION[ext] || 'png';\n }\n\n return 'png';\n }\n\n return MIME_TO_EXTENSION[mimeType] || 'png';\n};\n\nexport enum ErrorCodes {\n ASSET_NOT_FOUND = 'ASSET_NOT_FOUND',\n INVALID_DOTLOTTIE = 'INVALID_DOTLOTTIE',\n INVALID_STATEMACHINE = 'INVALID_STATEMACHINE',\n INVALID_URL = 'INVALID_URL',\n}\n\nexport class DotLottieError extends Error {\n public code: ErrorCodes | undefined;\n\n public constructor(message: string, code?: ErrorCodes) {\n super(message);\n this.name = '[dotlottie-js]';\n this.code = code;\n }\n}\n\n/**\n * Creates an Error object with the specified message.\n *\n * @remarks\n * This function accepts a message string and constructs a new Error object prefixed with \"[dotlottie-js]: \".\n *\n * @deprecated\n * This function has been deprecated in favor of using the {@link DotLottieError} class directly.\n *\n * @param message - The error message to include in the Error object.\n * @returns An Error object with the specified message, prefixed with \"[dotlottie-js]: \".\n *\n * @example\n * ```typescript\n * const message = 'DotLottie not found';\n * const error = createError(message);\n * ```\n *\n * @public\n */\nexport const createError = (message: string): Error => {\n const error = new Error(`[dotlottie-js]: ${message}`);\n\n return error;\n};\n\n/**\n * Validates a given URL string.\n *\n * @remarks\n * This function accepts a URL string and checks whether it's a valid URL according to the URL constructor.\n * It returns `true` if the URL is valid, `false` otherwise.\n *\n * @param url - The URL string to validate.\n * @returns `true` if the URL is valid, `false` otherwise.\n *\n * @example\n * ```typescript\n * const url = 'https://example.com';\n * const isValid = isValidURL(url); // true\n * ```\n *\n * @public\n */\nexport const isValidURL = (url: string): boolean => {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Creates a data URL from a Uint8Array.\n *\n * @remarks\n * This function accepts a Uint8Array and a file extension, then converts the Uint8Array into a base64 data URL string.\n * The mimeType is determined based on the provided file extension, or defaults to 'image/png' if the extension is not recognized.\n *\n * @param uint8Data - The Uint8Array containing the binary data.\n * @param fileExtension - The file extension used to determine the mimeType (e.g., 'png', 'jpeg').\n * @returns The data URL string.\n *\n * @example\n * ```typescript\n * const uint8Data = new Uint8Array(...);\n * const fileExtension = 'png';\n * const dataUrl = dataUrlFromU8(uint8Data, fileExtension);\n * ```\n */\nexport function dataUrlFromU8(uint8Data: Uint8Array): string {\n let base64: string;\n\n if (typeof window === 'undefined') {\n // Using Node.js Buffer for non-browser environments\n base64 = Buffer.from(uint8Data).toString('base64');\n } else {\n // Using window.btoa for browser environments\n const binaryString = Array.prototype.map.call(uint8Data, (byte: number) => String.fromCharCode(byte)).join('');\n\n base64 = window.btoa(binaryString);\n }\n\n const mimeType = getMimeTypeFromBase64(base64);\n\n return `data:${mimeType};base64,${base64}`;\n}\n\n/**\n * Checks if an asset is an image asset.\n *\n * @remarks\n * This function accepts an asset object and determines whether it represents an image asset.\n * It returns `true` if it's an image asset, `false` otherwise.\n *\n * @param asset - The asset object to check.\n * @returns `true` if it's an image asset, `false` otherwise.\n *\n * @example\n * ```typescript\n * const asset = { w: 100, h: 100, p: 'image.png' };\n * const isImage = isImageAsset(asset); // true\n * ```\n *\n * @public\n */\nexport function isImageAsset(asset: Asset.Value): asset is Asset.Image {\n return 'w' in asset && 'h' in asset && !('xt' in asset) && 'p' in asset;\n}\n\n/**\n * Checks if an asset is an audio asset.\n *\n * @remarks\n * This function accepts an asset object and determines whether it represents an audio asset.\n * It returns `true` if it's an audio asset, `false` otherwise.\n *\n * @param asset - The asset object to check.\n * @returns `true` if it's an audio asset, `false` otherwise.\n *\n * @example\n * ```typescript\n * const asset = { e: 0, u: 'music/', p: 'audio.mp3' };\n * const isAudio = isAudioAsset(asset); // true\n * ```\n *\n * @public\n */\nexport function isAudioAsset(asset: Asset.Value): asset is Asset.Image {\n return !('h' in asset) && !('w' in asset) && 'p' in asset && 'e' in asset && 'u' in asset && 'id' in asset;\n}\n\n/**\n * Unzips the .lottie file.\n *\n * @remarks\n * This function accepts a .lottie file as a Uint8Array and an optional filter function to refine the unzipping process.\n * It returns a Promise that resolves with the unzipped data.\n *\n * @param dotLottie - The .lottie data as a Uint8Array.\n * @param filter - The filter function to apply to the files. Defaults to a function that always returns true.\n * @returns A Promise that resolves with the unzipped data.\n * @throws {@link DotLottieError} if the .lottie data is not provided or is invalid.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const unzippedData = await unzipDotLottie(dotLottie);\n * ```\n *\n * @public\n */\nexport async function unzipDotLottie(\n dotLottie: Uint8Array | undefined,\n filter: UnzipFileFilter = (): boolean => true,\n): Promise<Unzipped> {\n if (!(dotLottie instanceof Uint8Array)) {\n throw new DotLottieError('DotLottie not found', ErrorCodes.INVALID_DOTLOTTIE);\n }\n\n const unzipped = await new Promise<Unzipped>((resolve, reject) => {\n fflateUnzip(dotLottie, { filter }, (err, data) => {\n if (err) {\n reject(err);\n }\n resolve(data);\n });\n });\n\n return unzipped;\n}\n\n/**\n * Unzips a specific file from a `.lottie` archive.\n *\n * @remarks\n * This function accepts a `.lottie` file as a `Uint8Array`, a path string representing the\n * target file to extract, and an optional filter function to further refine the extraction.\n * It returns a `Promise` that resolves to the unzipped `Uint8Array` of the target file.\n *\n * @param dotLottie - The `.lottie` file content as a `Uint8Array`.\n * @param path - The path of the target file within the `.lottie` archive to extract.\n * @param filter - An optional filter function to apply on the unzipping process.\n * Accepts a file object and returns a boolean indicating whether the file should be included.\n * @returns A `Promise` that resolves to the `Uint8Array` of the unzipped target file.\n *\n * @throws {@link DotLottieError} if the input is not a valid `.lottie` file or if the target file is not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const targetPath = 'images/image.png';\n * const unzippedFile = await unzipDotLottieFile(dotLottie, targetPath);\n * ```\n *\n * @public\n */\nexport async function unzipDotLottieFile(\n dotLottie: Uint8Array,\n path: string,\n filter?: UnzipFileFilter,\n): Promise<Uint8Array | undefined> {\n if (!(dotLottie instanceof Uint8Array)) {\n throw new DotLottieError('DotLottie not found', ErrorCodes.INVALID_DOTLOTTIE);\n }\n\n const unzipped = await unzipDotLottie(dotLottie, (file) => file.name === path && (!filter || filter(file)));\n\n return unzipped[path];\n}\n\n/**\n * Retrieves the manifest data from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and extracts the manifest data from it.\n * The manifest contains metadata information about the .lottie file, such as the list of animations, themes, and image assets.\n * It returns a Promise that resolves to the manifest data or `undefined` if the manifest is not found.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @returns A Promise that resolves with the manifest data or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const manifestData = await getManifest(dotLottie);\n * ```\n *\n * @public\n */\nexport async function getManifest(dotLottie: Uint8Array): Promise<Manifest | undefined> {\n const manifestFileName = 'manifest.json';\n\n const unzipped = await unzipDotLottie(dotLottie, (file) => file.name === manifestFileName);\n\n const unzippedManifest = unzipped[manifestFileName];\n\n if (typeof unzippedManifest === 'undefined') {\n return undefined;\n }\n\n return JSON.parse(strFromU8(unzippedManifest, false)) as Manifest;\n}\n\n/**\n * Validates the provided DotLottie data.\n *\n * @remarks\n * This function accepts a Uint8Array containing .lottie data and validates its structure and content.\n * It returns a Promise that resolves with an object containing a success boolean and an optional error string.\n *\n * @param dotLottie - The DotLottie data as a Uint8Array.\n * @returns A Promise that resolves with an object containing a success boolean and an optional error string.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const validationResult = await validateDotLottie(dotLottie);\n * ```\n *\n * @public\n */\nexport async function validateDotLottie(dotLottie: Uint8Array): Promise<{ error?: string; success: boolean }> {\n if (!(dotLottie instanceof Uint8Array)) {\n return { success: false, error: 'DotLottie not found' };\n }\n\n const manifest = await getManifest(dotLottie);\n\n if (typeof manifest === 'undefined') {\n return { success: false, error: 'Invalid .lottie file, manifest.json is missing' };\n }\n\n const manifestValidationResult = safeParse(ManifestSchema, manifest);\n\n if (!manifestValidationResult.success) {\n const error = `Invalid .lottie file, manifest.json structure is invalid, ${JSON.stringify(\n flatten(manifestValidationResult.error).nested,\n null,\n 2,\n )}`;\n\n return { success: false, error };\n }\n\n return { success: true };\n}\n\n/**\n * Loads a .lottie file from an ArrayBuffer.\n *\n * @remarks\n * This function takes an ArrayBuffer containing .lottie data and converts it into a Uint8Array.\n * It validates the data and returns a Promise that resolves with the DotLottie data as a Uint8Array.\n *\n * @param arrayBuffer - The ArrayBuffer containing .lottie data.\n * @returns A Promise that resolves with the DotLottie data as a Uint8Array.\n * @throws {@link DotLottieError} if the data is invalid.\n *\n * @example\n * ```typescript\n * const arrayBuffer = new ArrayBuffer(...);\n * const dotLottie = await loadFromArrayBuffer(arrayBuffer);\n * ```\n *\n * @public\n */\nexport async function loadFromArrayBuffer(arrayBuffer: ArrayBuffer): Promise<Uint8Array> {\n const dotLottie = new Uint8Array(arrayBuffer);\n\n const validationResult = await validateDotLottie(dotLottie);\n\n if (validationResult.error) {\n throw new DotLottieError(validationResult.error, ErrorCodes.INVALID_DOTLOTTIE);\n }\n\n return dotLottie;\n}\n\n/**\n * Loads a .lottie file from a given URL.\n *\n * @remarks\n * This function takes a URL string as input and fetches the .lottie file from the provided URL.\n * It returns a Promise that resolves with the DotLottie data as a Uint8Array.\n *\n * @param src - The URL source of the .lottie file.\n * @returns A Promise that resolves with the DotLottie data as a Uint8Array.\n * @throws {@link DotLottieError} if the URL is invalid or if the content type is incorrect.\n *\n * @example\n * ```typescript\n * const url = 'https://example.com/animation.lottie';\n * const dotLottie = await loadFromURL(url);\n * ```\n *\n * @public\n */\nexport async function loadFromURL(src: string): Promise<Uint8Array> {\n if (!isValidURL(src)) {\n throw new DotLottieError('Invalid url provided for .lottie file', ErrorCodes.INVALID_URL);\n }\n\n const response = await fetch(src);\n\n const arrayBuffer = await response.arrayBuffer();\n\n const contentType = response.headers.get('content-type');\n\n if (!contentType?.includes('application/zip')) {\n throw new DotLottieError(\n 'Invalid content type provided for .lottie file, expected application/zip',\n ErrorCodes.INVALID_DOTLOTTIE,\n );\n }\n\n const dotLottie = await loadFromArrayBuffer(arrayBuffer);\n\n return dotLottie;\n}\n\n/**\n * Retrieves an audio from the given DotLottie object by its filename.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, the filename of the audio to retrieve, and an optional filter function.\n * It returns a Promise that resolves to the audio data URL or `undefined` if not found.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param filename - The filename of the image to get.\n * @param filter - An optional filter function to apply on the unzipping process.\n * @returns A Promise that resolves with the audio data URL or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const filename = 'alarm.mp3';\n * const imageData = await getAudio(dotLottie, filename);\n * ```\n *\n * @public\n */\nexport async function getAudio(\n dotLottie: Uint8Array,\n filename: string,\n filter?: UnzipFileFilter,\n): Promise<string | undefined> {\n const audioFilename = `audio/${filename}`;\n\n const unzipped = await unzipDotLottieFile(dotLottie, audioFilename, filter);\n\n if (typeof unzipped === 'undefined') {\n return undefined;\n }\n\n return dataUrlFromU8(unzipped);\n}\n\n/**\n * Retrieves all audio files from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and an optional filter function to further refine the extraction.\n * It returns a Promise that resolves to a record containing the audio data URLs mapped by their ID.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param filter - An optional filter function to apply on the unzipping process.\n * @returns A Promise that resolves to a record containing the audio data URLs mapped by their ID.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const allAudio = await getAllAudio(dotLottie);\n * ```\n *\n * @public\n */\nexport async function getAllAudio(dotLottie: Uint8Array, filter?: UnzipFileFilter): Promise<Record<string, string>> {\n const unzippedAudio = await unzipDotLottie(dotLottie, (file) => {\n const name = file.name.replace('audio/', '');\n\n return file.name.startsWith('audio/') && (!filter || filter({ ...file, name }));\n });\n\n const audio: Record<string, string> = {};\n\n for (const audioPath in unzippedAudio) {\n const unzippedSingleAudio = unzippedAudio[audioPath];\n\n if (unzippedSingleAudio instanceof Uint8Array) {\n const audioId = audioPath.replace('audio/', '');\n\n audio[audioId] = dataUrlFromU8(unzippedSingleAudio);\n }\n }\n\n return audio;\n}\n\n/**\n * Inlines audio assets for the given animations within a DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and a record containing the animations to process.\n * It identifies the audio used in the animations and replaces their references with the actual audio data.\n * This operation is performed asynchronously, and the function returns a Promise that resolves when the operation is complete.\n *\n * @param dotLottie - The DotLottie object containing the animations.\n * @param animations - A record containing the animations to process.\n * @returns A Promise that resolves when the operation is complete, returning nothing.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const animations = { animation1: {...}, animation2: {...} };\n * await inlineAudioAssets(dotLottie, animations);\n * ```\n *\n * @public\n */\nexport async function inlineAudioAssets(\n dotLottie: Uint8Array,\n animations: Record<string, AnimationData>,\n): Promise<void> {\n const audioMap = new Map<string, Set<string>>();\n\n for (const [animationId, animationData] of Object.entries(animations)) {\n for (const asset of animationData.assets || []) {\n if (isAudioAsset(asset)) {\n const audioId = asset.p;\n\n if (!audioMap.has(audioId)) {\n audioMap.set(audioId, new Set());\n }\n audioMap.get(audioId)?.add(animationId);\n }\n }\n }\n\n const unzippedAudio = await getAllAudio(dotLottie, (file) => audioMap.has(file.name));\n\n for (const [audioId, animationIdsSet] of audioMap) {\n const audioDataURL = unzippedAudio[audioId];\n\n if (audioDataURL) {\n for (const animationId of animationIdsSet) {\n const animationData = animations[animationId];\n\n for (const asset of animationData?.assets || []) {\n if (isAudioAsset(asset) && asset.p === audioId) {\n asset.p = audioDataURL;\n asset.u = '';\n asset.e = 1;\n }\n }\n }\n }\n }\n}\n\n/**\n * Retrieves an image from the given DotLottie object by its filename.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, the filename of the image to retrieve, and an optional filter function.\n * It returns a Promise that resolves to the image data URL or `undefined` if not found.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param filename - The filename of the image to get.\n * @param filter - An optional filter function to apply on the unzipping process.\n * @returns A Promise that resolves with the image data URL or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const filename = 'image.png';\n * const imageData = await getImage(dotLottie, filename);\n * ```\n *\n * @public\n */\nexport async function getImage(\n dotLottie: Uint8Array,\n filename: string,\n filter?: UnzipFileFilter,\n): Promise<string | undefined> {\n const imageFilename = `images/${filename}`;\n\n const unzipped = await unzipDotLottieFile(dotLottie, imageFilename, filter);\n\n if (typeof unzipped === 'undefined') {\n return undefined;\n }\n\n return dataUrlFromU8(unzipped);\n}\n\n/**\n * Retrieves all images from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and an optional filter function to further refine the extraction.\n * It returns a Promise that resolves to a record containing the image data URLs mapped by their ID.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param filter - An optional filter function to apply on the unzipping process.\n * @returns A Promise that resolves to a record containing the image data URLs mapped by their ID.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const images = await getImages(dotLottie);\n * ```\n *\n * @public\n */\nexport async function getImages(dotLottie: Uint8Array, filter?: UnzipFileFilter): Promise<Record<string, string>> {\n const unzippedImages = await unzipDotLottie(dotLottie, (file) => {\n const name = file.name.replace('images/', '');\n\n return file.name.startsWith('images/') && (!filter || filter({ ...file, name }));\n });\n\n const images: Record<string, string> = {};\n\n for (const imagePath in unzippedImages) {\n const unzippedImage = unzippedImages[imagePath];\n\n if (unzippedImage instanceof Uint8Array) {\n const imageId = imagePath.replace('images/', '');\n\n images[imageId] = dataUrlFromU8(unzippedImage);\n }\n }\n\n return images;\n}\n\n/**\n * Inlines image assets for the given animations within a DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and a record containing the animations to process.\n * It identifies the images used in the animations and replaces their references with the actual image data.\n * This operation is performed asynchronously, and the function returns a Promise that resolves when the operation is complete.\n *\n * @param dotLottie - The DotLottie object containing the animations.\n * @param animations - A record containing the animations to process.\n * @returns A Promise that resolves when the operation is complete, returning nothing.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const animations = { animation1: {...}, animation2: {...} };\n * await inlineImageAssets(dotLottie, animations);\n * ```\n *\n * @public\n */\nexport async function inlineImageAssets(\n dotLottie: Uint8Array,\n animations: Record<string, AnimationData>,\n): Promise<void> {\n const imagesMap = new Map<string, Set<string>>();\n\n for (const [animationId, animationData] of Object.entries(animations)) {\n for (const asset of animationData.assets || []) {\n if (isImageAsset(asset)) {\n const imageId = asset.p;\n\n if (!imagesMap.has(imageId)) {\n imagesMap.set(imageId, new Set());\n }\n imagesMap.get(imageId)?.add(animationId);\n }\n }\n }\n\n const unzippedImages = await getImages(dotLottie, (file) => imagesMap.has(file.name));\n\n for (const [imageId, animationIdsSet] of imagesMap) {\n const imageDataURL = unzippedImages[imageId];\n\n if (imageDataURL) {\n for (const animationId of animationIdsSet) {\n const animationData = animations[animationId];\n\n for (const asset of animationData?.assets || []) {\n if (isImageAsset(asset) && asset.p === imageId) {\n asset.p = imageDataURL;\n asset.u = '';\n asset.e = 1;\n }\n }\n }\n }\n }\n}\n\n/**\n * Retrieves an animation from the given DotLottie object by its ID.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, the animation ID to retrieve, and an optional inlineAssets option.\n * It returns a Promise that resolves to the animation data or `undefined` if not found.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param animationId - The animation ID to get.\n * @param options - An object containing an optional `inlineAssets` boolean to control whether image assets should be inlined.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves with the animation data or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const animationId = 'example';\n * const animationData = await getAnimation(dotLottie, animationId, { inlineAssets: true });\n * ```\n *\n * @public\n */\nexport async function getAnimation(\n dotLottie: Uint8Array,\n animationId: string,\n { inlineAssets }: { inlineAssets?: boolean } = {},\n filter?: UnzipFileFilter,\n): Promise<AnimationData | undefined> {\n const animationFilename = `animations/${animationId}.json`;\n\n const unzippedAnimation = await unzipDotLottieFile(dotLottie, animationFilename, filter);\n\n if (typeof unzippedAnimation === 'undefined') {\n return undefined;\n }\n\n const animationData = JSON.parse(strFromU8(unzippedAnimation, false)) as AnimationData;\n\n if (!inlineAssets) {\n return animationData;\n }\n\n const animationsMap = {\n [animationId]: animationData,\n };\n\n await inlineImageAssets(dotLottie, animationsMap);\n\n await inlineAudioAssets(dotLottie, animationsMap);\n\n return animationData;\n}\n\n/**\n * Retrieves the animations from the given DotLottie object, with optional filtering and asset inlining.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, an optional inlineAssets option, and an optional filter function.\n * It returns a Promise that resolves to a record containing the animation data mapped by their ID.\n *\n * @param dotLottie - The Uint8Array of DotLottie data.\n * @param options - An object containing an optional `inlineAssets` boolean to control whether assets should be inlined.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves to a record containing the animation data mapped by their ID.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const animations = await getAnimations(dotLottie, { inlineAssets: true });\n * ```\n *\n * @public\n */\nexport async function getAnimations(\n dotLottie: Uint8Array,\n { inlineAssets }: { inlineAssets?: boolean } = {},\n filter?: UnzipFileFilter,\n): Promise<Record<string, AnimationData>> {\n const animationsMap: Record<string, AnimationData> = {};\n const unzippedAnimations = await unzipDotLottie(dotLottie, (file) => {\n const filename = file.name.replace('animations/', '').replace('.json', '');\n\n return file.name.startsWith('animations/') && (!filter || filter({ ...file, name: filename }));\n });\n\n for (const animationPath in unzippedAnimations) {\n const data = unzippedAnimations[animationPath];\n\n if (data instanceof Uint8Array) {\n const animationId = animationPath.replace('animations/', '').replace('.json', '');\n const animationData = JSON.parse(strFromU8(data, false)) as AnimationData;\n\n animationsMap[animationId] = animationData;\n }\n }\n\n if (!inlineAssets) {\n return animationsMap;\n }\n\n await inlineImageAssets(dotLottie, animationsMap);\n\n return animationsMap;\n}\n\n/**\n * Retrieves the themes from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and an optional filter function to refine the extraction of themes.\n * It returns a Promise that resolves to a record containing the themes mapped by their ID.\n *\n * @param dotLottie - The DotLottie object containing the themes.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves to a record containing the themes mapped by their ID.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const themes = await getThemes(dotLottie);\n * ```\n */\nexport async function getThemes(dotLottie: Uint8Array, filter?: UnzipFileFilter): Promise<Record<string, string>> {\n const themesMap: Record<string, string> = {};\n\n const unzippedThemes = await unzipDotLottie(dotLottie, (file) => {\n const name = file.name.replace('themes/', '').replace('.lss', '');\n\n return file.name.startsWith('themes/') && (!filter || filter({ ...file, name }));\n });\n\n for (const themePath in unzippedThemes) {\n const data = unzippedThemes[themePath];\n\n if (data instanceof Uint8Array) {\n const themeId = themePath.replace('themes/', '').replace('.lss', '');\n\n themesMap[themeId] = strFromU8(data, false);\n }\n }\n\n return themesMap;\n}\n\n/**\n * Retrieves a specific theme by ID from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, the theme ID to retrieve, and an optional filter function.\n * It returns a Promise that resolves to the theme as a string or `undefined` if not found.\n *\n * @param dotLottie - The DotLottie object containing the theme.\n * @param themeId - The ID of the theme to retrieve.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves to the theme as a string or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const themeId = 'dark';\n * const theme = await getTheme(dotLottie, themeId);\n * ```\n */\nexport async function getTheme(\n dotLottie: Uint8Array,\n themeId: string,\n filter?: UnzipFileFilter,\n): Promise<string | undefined> {\n const themeFilename = `themes/${themeId}.lss`;\n\n const unzippedTheme = await unzipDotLottieFile(dotLottie, themeFilename, filter);\n\n if (typeof unzippedTheme === 'undefined') {\n return undefined;\n }\n\n return strFromU8(unzippedTheme, false);\n}\n\n/**\n * Retrieves the state machines from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array and an optional filter function to refine the extraction of state machines.\n * It returns a Promise that resolves to a record containing the state machines mapped by their ID.\n *\n * @param dotLottie - The DotLottie object containing the state machines.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves to a record containing the state machines mapped by their ID.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const machines = await getStateMachines(dotLottie);\n * ```\n */\nexport async function getStateMachines(\n dotLottie: Uint8Array,\n filter?: UnzipFileFilter,\n): Promise<Record<string, string>> {\n const statesMap: Record<string, string> = {};\n\n const unzippedStates = await unzipDotLottie(dotLottie, (file) => {\n const name = file.name.replace('states/', '').replace('.json', '');\n\n return file.name.startsWith('states/') && (!filter || filter({ ...file, name }));\n });\n\n for (const statePath in unzippedStates) {\n const data = unzippedStates[statePath];\n\n if (data instanceof Uint8Array) {\n const themeId = statePath.replace('states/', '').replace('.json', '');\n\n statesMap[themeId] = strFromU8(data, false);\n }\n }\n\n return statesMap;\n}\n\n/**\n * Retrieves a specific state machine by ID from the given DotLottie object.\n *\n * @remarks\n * This function accepts a DotLottie object as a Uint8Array, the state ID to retrieve, and an optional filter function.\n * It returns a Promise that resolves to the state machine as a string or `undefined` if not found.\n *\n * @param dotLottie - The DotLottie object containing the theme.\n * @param stateMachineId - The ID of the state machine to retrieve.\n * @param filter - An optional function to filter the files to be unzipped.\n * @returns A Promise that resolves to the state machine as a string or `undefined` if not found.\n *\n * @example\n * ```typescript\n * const dotLottie = new Uint8Array(...);\n * const stateMachineId = 'walk';\n * const stateMachine = await getState(dotLottie, stateMachineId);\n * ```\n */\nexport async function getStateMachine(\n dotLottie: Uint8Array,\n stateMachineId: string,\n filter?: UnzipFileFilter,\n): Promise<LottieStateMachine | undefined> {\n const stateMachineFilename = `states/${stateMachineId}.json`;\n\n const unzippedStateMachine = await unzipDotLottieFile(dotLottie, stateMachineFilename, filter);\n\n if (typeof unzippedStateMachine === 'undefined') {\n return undefined;\n }\n\n const stateMachine = JSON.parse(strFromU8(unzippedStateMachine, false)) as LottieStateMachine;\n\n return stateMachine;\n}\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport type { ZipOptions } from 'fflate';\n\nimport type { LottieAnimationCommon } from './lottie-animation-common';\nimport { dataUrlFromU8, DotLottieError, ErrorCodes } from './utils';\n\nexport type AudioData = string | ArrayBuffer | Blob;\n\nexport interface AudioOptions {\n data?: AudioData;\n fileName: string;\n id: string;\n parentAnimations?: LottieAnimationCommon[];\n url?: string;\n zipOptions?: ZipOptions;\n}\n\nexport class LottieAudioCommon {\n protected _data?: AudioData;\n\n protected _id: string = '';\n\n protected _url?: string;\n\n protected _fileName: string = '';\n\n protected _parentAnimations: LottieAnimationCommon[];\n\n protected _zipOptions: ZipOptions;\n\n public constructor(options: AudioOptions) {\n this._requireValidId(options.id);\n this._requireValidFileName(options.fileName);\n\n this._zipOptions = options.zipOptions ?? {};\n\n if (options.data) {\n this._data = options.data;\n }\n\n if (options.id) {\n this._id = options.id;\n }\n\n if (options.url) {\n this._url = options.url;\n }\n\n if (options.fileName) {\n this._fileName = options.fileName;\n }\n\n this._parentAnimations = options.parentAnimations || [];\n }\n\n public get zipOptions(): ZipOptions {\n return this._zipOptions;\n }\n\n public set zipOptions(zipOptions: ZipOptions) {\n this._zipOptions = zipOptions;\n }\n\n public get fileName(): string {\n return this._fileName;\n }\n\n public set fileName(fileName: string) {\n if (!fileName) throw new DotLottieError('Invalid audio file name', ErrorCodes.ASSET_NOT_FOUND);\n this._fileName = fileName;\n }\n\n public get id(): string {\n return this._id;\n }\n\n public set id(id: string) {\n if (!id) throw new DotLottieError('Invalid audio id', ErrorCodes.ASSET_NOT_FOUND);\n this._id = id;\n }\n\n public get data(): AudioData | undefined {\n return this._data;\n }\n\n public set data(data: AudioData | undefined) {\n if (!data) {\n throw new DotLottieError('Invalid data');\n }\n\n this._data = data;\n }\n\n public get parentAnimations(): LottieAnimationCommon[] {\n return this._parentAnimations;\n }\n\n public set parentAnimations(parentAnimations: LottieAnimationCommon[]) {\n this._parentAnimations = parentAnimations;\n }\n\n public async toDataURL(): Promise<string> {\n if (this._data && this._isDataURL(this._data)) return this.data as string;\n\n const arrayBuffer = await this.toArrayBuffer();\n\n return dataUrlFromU8(new Uint8Array(arrayBuffer));\n }\n\n /**\n * Renames the id and fileName to newName.\n * @param newName - A new id and filename for the audio.\n */\n public renameAudio(newName: string): void {\n this.id = newName;\n\n if (this.fileName) {\n let fileExt = this.fileName.split('.').pop();\n\n if (!fileExt) {\n fileExt = '.png';\n }\n // Default to png if the file extension isn't available\n this.fileName = `${newName}.${fileExt}`;\n }\n }\n\n public async toArrayBuffer(): Promise<ArrayBuffer> {\n const blob = await (await this.toBlob()).arrayBuffer();\n\n return blob;\n }\n\n public async toBlob(): Promise<Blob> {\n if (!this._data && this._url) {\n this._data = await this._fromUrlToBlob(this._url);\n }\n\n if (!this._data) {\n throw new Error('Invalid data');\n }\n\n if (this._isDataURL(this._data)) {\n const data = this._data as string;\n\n const [header, base64] = data.split(',');\n\n // If the data doesnt contain the encoding URL, return it\n if ((!header || !base64) && data.length) {\n return new Blob([data]);\n }\n\n if (!header || !base64) {\n throw new Error('Invalid data');\n }\n\n // eslint-disable-next-line require-unicode-regexp\n const type = header.replace('data:', '').replace(/;base64$/, '');\n\n return new Blob([base64], { type });\n }\n\n if (this._isArrayBuffer(this._data)) {\n return new Blob([this._data]);\n }\n\n if (this._isBlob(this._data)) {\n return this._data as Blob;\n }\n\n throw new Error('Invalid data');\n }\n\n protected async _fromUrlToBlob(url: string): Promise<Blob> {\n const response = await fetch(url);\n\n return response.blob();\n }\n\n protected _isArrayBuffer(data: AudioData): boolean {\n return data instanceof ArrayBuffer;\n }\n\n protected _isDataURL(data: AudioData): boolean {\n return typeof data === 'string' && data.startsWith('data:');\n }\n\n protected _isBlob(data: AudioData): boolean {\n return data instanceof Blob;\n }\n\n /**\n * Ensure that the provided id is a valid string.\n * The id must be a non-empty string, otherwise an error will be thrown.\n * @param id - The id to validate.\n * @throws Error - if the id is not a valid string.\n */\n private _requireValidId(id: string | undefined): asserts id is string {\n if (!id) throw new DotLottieError('Invalid audio id');\n }\n\n /**\n * Ensure that the provided fileName is a valid string.\n * The fileName must be a non-empty string, otherwise an error will be thrown.\n * @param fileName - The fileName to validate.\n * @throws Error - if the fileName is not a valid string.\n */\n private _requireValidFileName(fileName: string | undefined): asserts fileName is string {\n if (!fileName) throw new DotLottieError('Invalid audio fileName');\n }\n}\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar VanilaConverter = /** @class */ (function () {\n function VanilaConverter(document, glayScaleCalculator, resizer) {\n this.document = document;\n this.glayScaleCalculator = glayScaleCalculator;\n this.resizer = resizer;\n }\n VanilaConverter.prototype.createCanvasRenderingContext2D = function (width, height) {\n var canvas = this.document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n canvas.setAttribute('style', 'image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges;');\n var ctx = canvas.getContext('2d');\n if (ctx === null) {\n throw new ReferenceError('undefined CanvasRenderingContext2D');\n }\n ctx.mozImageSmoothingEnabled = true;\n ctx.webkitImageSmoothingEnabled = true;\n ctx.msImageSmoothingEnabled = true;\n ctx.imageSmoothingEnabled = true;\n return ctx;\n };\n VanilaConverter.prototype.convert = function (source) {\n var _this = this;\n var img = new Image();\n var result = (new Promise(function (resolve) {\n img.onload = function () {\n var ctx = _this.createCanvasRenderingContext2D(img.width, img.height);\n ctx.drawImage(img, 0, 0, img.width, img.height);\n var colorMap = ctx.getImageData(0, 0, img.width, img.height).data;\n resolve(colorMap);\n };\n }))\n .then(function (colorMap) {\n return _this.resizer.resize(colorMap, img.width, img.height, source.width, source.height);\n }).then(function (resizedColorMap) {\n var glayArraySouce = __spreadArray([], __read(Array(resizedColorMap.length / 4).keys())).map(function (i) {\n var index = i * 4;\n var _a = __read([\n resizedColorMap[index],\n resizedColorMap[index + 1],\n resizedColorMap[index + 2]\n ], 3), r = _a[0], g = _a[1], b = _a[2];\n return _this.glayScaleCalculator(r, g, b);\n });\n return new Uint8ClampedArray(glayArraySouce);\n });\n img.src = source.url.toString();\n return result;\n };\n return VanilaConverter;\n}());\nexport default VanilaConverter;\n","var HashSource = /** @class */ (function () {\n function HashSource(url, hashSize) {\n if (hashSize === void 0) { hashSize = 8; }\n this.url = url;\n this.hashSize = hashSize;\n this.width = hashSize + 1;\n this.height = hashSize;\n }\n HashSource.prototype.calculateArea = function () {\n return this.width * this.height;\n };\n return HashSource;\n}());\nexport default HashSource;\n","import { lanczos } from '@rgba-image/lanczos';\nvar LanczosResizer = /** @class */ (function () {\n function LanczosResizer() {\n }\n LanczosResizer.prototype.resize = function (source, nativeWidth, nativeHeight, expectedWidth, expectedHeight) {\n var sourceImageData = (new ImageDataSouce(nativeWidth, nativeHeight, source));\n var destImageData = (new ImageDataSouce(expectedWidth, expectedHeight, new Uint8ClampedArray(expectedWidth * expectedHeight * 4)));\n lanczos(sourceImageData, destImageData);\n return destImageData.data;\n };\n return LanczosResizer;\n}());\nexport default LanczosResizer;\nvar ImageDataSouce = /** @class */ (function () {\n function ImageDataSouce(width, height, source) {\n this.width = width;\n this.height = height;\n this.data = source;\n }\n return ImageDataSouce;\n}());\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nvar Hash = /** @class */ (function () {\n function Hash(rawHash) {\n if (rawHash.split('').find(function (row) { return (row !== '1' && row !== '0'); })) {\n throw new TypeError('Not bits.');\n }\n this.rawHash = rawHash;\n }\n Hash.prototype.getHammingDistance = function (hash) {\n if (this.rawHash.length !== hash.rawHash.length) {\n throw new TypeError('Not equal to hash length.');\n }\n var target = hash.rawHash.split('');\n var diff = this.rawHash.split('').filter(function (row, index) { return row !== (target[index] || '0'); });\n return diff.length;\n };\n Hash.prototype.toString = function () {\n return this.calcuateHexadecimal(this.rawHash.split('').map(function (row) { return (row === '1') ? 1 : 0; }));\n };\n Hash.prototype.arrayChunk = function (array, chunk) {\n return __spreadArray([], __read(Array(Math.ceil(array.length / chunk)).keys())).map(function (index) { return array.slice(index * chunk, (index * chunk) + chunk); });\n };\n Hash.prototype.calcuateHexadecimal = function (binalyNumbers) {\n return this.arrayChunk(binalyNumbers, 4)\n .map(function (row) { return parseInt(row.join(''), 2).toString(16); }).join('');\n };\n return Hash;\n}());\nexport default Hash;\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n to[j] = from[i];\n return to;\n};\nimport Hash from \"./Hash\";\nvar HashGenerator = /** @class */ (function () {\n function HashGenerator(document) {\n this.document = document;\n }\n HashGenerator.prototype.generateByImage = function (source, glayImage) {\n glayImage.width = source.width;\n glayImage.height = source.height;\n var canvas = this.document.createElement('canvas');\n var context = canvas.getContext('2d');\n if (context === null) {\n throw new ReferenceError('undefined CanvasRenderingContext2D');\n }\n context.drawImage(glayImage, 0, 0, source.width, source.height);\n return this.generate(source, context);\n };\n HashGenerator.prototype.generateByCanvasRenderingContext2D = function (source, glayImageDrawingCanvasContext) {\n var imageData = glayImageDrawingCanvasContext.getImageData(0, 0, source.width, source.height).data;\n var glayArray = new Uint8ClampedArray(__spreadArray([], __read(Array(imageData.length / 4).keys())).map(function (i) {\n var index = i * 4;\n return imageData[index];\n }));\n return this.generate(source, glayArray);\n };\n HashGenerator.prototype.generateByUint8ClampedArray = function (source, glayArray) {\n if (glayArray.length !== source.calculateArea()) {\n throw new Error(\"Not convertable grayArray, convertable grayArray length is \" + source.calculateArea());\n }\n var binaryNumbers = Array.from(glayArray)\n .map(function (row, index, colors) { return ((row <= colors[index + 1]) ? 1 : 0); })\n .filter(function (_, index) { return (index + 1) % source.width !== 0; }).join('');\n return new Hash(binaryNumbers);\n };\n HashGenerator.prototype.generate = function (source, glayImageSource) {\n if (glayImageSource instanceof HTMLImageElement) {\n return this.generateByImage(source, glayImageSource);\n }\n else if (glayImageSource instanceof CanvasRenderingContext2D) {\n return this.generateByCanvasRenderingContext2D(source, glayImageSource);\n }\n else if (glayImageSource instanceof Uint8ClampedArray) {\n return this.generateByUint8ClampedArray(source, glayImageSource);\n }\n throw new TypeError('Not generatable glay image source.');\n };\n return HashGenerator;\n}());\nexport default HashGenerator;\n","export default function ITU_R601_2Method(r, g, b) {\n return Math.round((r * 299 / 1000 + g * 587 / 1000 + b * 114 / 1000));\n}\n;\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport VanilaConverter from \"./HashableImageSourceConverter/DifferenceHash/VanilaConverter\";\nimport HashSource from \"./HashSource\";\nimport LanczosResizer from \"./HashableImageSourceConverter/Resizer/LanczosResizer\";\nimport HashGenerator from \"./HashGenerator\";\nimport ITU_R601_2Method from \"./HashableImageSourceConverter/GlayScaleCalculator/ITU_R601_2Method\";\nvar DifferenceHashBuilder = /** @class */ (function () {\n function DifferenceHashBuilder(dHashConverter, document) {\n if (dHashConverter === void 0) { dHashConverter = null; }\n if (document === void 0) { document = window.document; }\n if (dHashConverter === null) {\n dHashConverter = new VanilaConverter(document, ITU_R601_2Method, new LanczosResizer());\n }\n this.dHashConverter = dHashConverter;\n this.generator = new HashGenerator(document);\n }\n DifferenceHashBuilder.prototype.build = function (url, hashSize) {\n if (hashSize === void 0) { hashSize = 8; }\n return __awaiter(this, void 0, void 0, function () {\n var source, hashableImageSouce;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n source = new HashSource(url, hashSize);\n return [4 /*yield*/, this.dHashConverter.convert(source)];\n case 1:\n hashableImageSouce = _a.sent();\n return [2 /*return*/, this.generator.generate(source, hashableImageSouce)];\n }\n });\n });\n };\n return DifferenceHashBuilder;\n}());\nexport default DifferenceHashBuilder;\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\nimport { getAnimation, getManifest, loadFromArrayBuffer } from '@dotlottie/dotlottie-js';\n\nexport async function getAnimationJSONFromDotLottie(dotLottieBuffer: ArrayBuffer): Promise<string> {\n const loadedDotLottieFile = await loadFromArrayBuffer(dotLottieBuffer);\n const manifest = await getManifest(loadedDotLottieFile);\n const activeAnimationId = manifest?.activeAnimationId || manifest?.animations[0]?.id || '';\n\n if (!activeAnimationId) {\n throw new Error('Unable to determine the active animation ID from the .lottie manifest.');\n }\n const animationData = await getAnimation(loadedDotLottieFile, activeAnimationId, { inlineAssets: true });\n\n return JSON.stringify(animationData);\n}\n\nexport async function loadAnimationJSONFromURL(animationURL: string): Promise<string> {\n try {\n const response = await fetch(animationURL);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch the animation data from URL: ${animationURL}. ${response.status}: ${response.statusText}`,\n );\n }\n\n const contentType = response.headers.get('content-type');\n let animationJSON: string;\n\n if (contentType?.includes('application/json')) {\n animationJSON = await response.text();\n } else {\n const arrayBuffer = await response.arrayBuffer();\n\n animationJSON = await getAnimationJSONFromDotLottie(arrayBuffer);\n }\n\n return animationJSON;\n } catch (error) {\n throw new Error(`Failed to load animation data from URL: ${animationURL}. ${error}`);\n }\n}\n\nexport function isHexColor(color: string): boolean {\n return /^#([\\da-f]{6}|[\\da-f]{8})$/iu.test(color);\n}\n\nexport function hexStringToRGBAInt(colorHex: string): number {\n if (!isHexColor(colorHex)) {\n return 0;\n }\n\n let hex = colorHex.replace('#', '');\n\n // Add alpha if it's not included\n hex = hex.length === 6 ? `${hex}ff` : hex;\n\n return parseInt(hex, 16);\n}\n","/**\n * Copyright 2023 Design Barn Inc.\n */\n\n/* eslint-disable promise/prefer-await-to-then */\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport { AnimationFrameManager } from './animation-frame-manager';\nimport { IS_BROWSER, MS_TO_SEC_FACTOR, DEFAULT_BG_COLOR } from './constants';\nimport type { EventListener, EventType } from './event-manager';\nimport { EventManager } from './event-manager';\nimport type { Renderer } from './renderer-wasm';\nimport { WasmLoader } from './renderer-wasm';\nimport { getAnimationJSONFromDotLottie, loadAnimationJSONFromURL, hexStringToRGBAInt } from './utils';\n\nexport type Mode = 'forward' | 'reverse' | 'bounce' | 'bounce-reverse';\n\ntype PlaybackState = 'playing' | 'paused' | 'stopped';\n\ninterface RenderConfig {\n /**\n * The device pixel ratio to use when resizing the canvas.\n *\n * Default is window.devicePixelRatio or 1.\n */\n devicePixelRatio?: number;\n}\n\nexport interface Config {\n /**\n * Boolean indicating if the animation should start playing automatically.\n */\n autoplay?: boolean;\n /**\n * Animation canvas background color.\n *\n * Default is #00000000.\n */\n backgroundColor?: string;\n /**\n * The canvas element to render the animation on.\n */\n canvas: HTMLCanvasElement;\n /**\n * The animation data.\n * string: The JSON string of the animation data.\n * ArrayBuffer: The ArrayBuffer of the .lottie file.\n *\n * If the data is an ArrayBuffer, the JSON string will be extracted from the .lottie file.\n */\n data?: string | ArrayBuffer;\n /**\n * Boolean indicating if the animation should loop.\n */\n loop?: boolean;\n /**\n * The playback mode of the animation.\n *\n * forward: The animation will play from start to end.\n * reverse: The animation will play from end to start.\n * bounce: The animation will play from start to end and then from end to start.\n * bounce-reverse: The animation will play from end to start and then from start to end.\n *\n */\n mode?: Mode;\n /**\n * The render configuration.\n */\n renderConfig?: RenderConfig;\n /**\n * The frame boundaries of the animation.\n *\n * The animation will only play between the given start and end frames.\n *\n * e.g. [0, 10] will play the first 10 frames of the animation only.\n *\n */\n segments?: [number, number];\n /**\n * The speed of the animation.\n */\n speed?: number;\n /**\n * The source URL of the animation.\n *\n * If the data is provided, the src will be ignored.\n */\n src?: string;\n}\n\nexport class DotLottie {\n private readonly _canvas: HTMLCanvasElement;\n\n private _context: CanvasRenderingContext2D | null;\n\n private readonly _eventManager = new EventManager();\n\n private _renderer: Renderer | null = null;\n\n private _beginTime = 0;\n\n private _elapsedTime = 0;\n\n private _totalFrames = 0;\n\n private _loop = false;\n\n private _speed = 1;\n\n private _currentFrame = 0;\n\n private _duration = 0;\n\n private _loopCount = 0;\n\n private _autoplay = false;\n\n private _mode: Mode = 'forward';\n\n private _direction = 1;\n\n private _bounceCount = 0;\n\n private _animationFrameId?: number | null = null;\n\n private _segments: [number, number] | null = null;\n\n private _playbackState: PlaybackState = 'stopped';\n\n private _backgroundColor: string = DEFAULT_BG_COLOR;\n\n private _renderConfig: RenderConfig = {};\n\n private _isFrozen = false;\n\n private readonly _animationFrameManager = new AnimationFrameManager();\n\n public constructor(config: Config) {\n this._animationLoop = this._animationLoop.bind(this);\n\n this._canvas = config.canvas;\n this._context = this._canvas.getContext('2d');\n if (!this._context) {\n throw new Error('2D context not supported or canvas already initialized with another context type.');\n }\n\n this._loop = config.loop ?? false;\n this._speed = config.speed ?? 1;\n this._autoplay = config.autoplay ?? false;\n this._mode = config.mode ?? 'forward';\n this._segments = config.segments ?? null;\n this._backgroundColor = config.backgroundColor ?? DEFAULT_BG_COLOR;\n this._renderConfig = config.renderConfig ?? {};\n\n WasmLoader.load()\n .then((module) => {\n this._renderer = new module.Renderer();\n\n this.setBackgroundColor(this._backgroundColor);\n\n if (config.src) {\n this._loadAnimationFromURL(config.src);\n } else if (config.data) {\n this._initializeAnimationFromData(config.data);\n }\n })\n .catch((error) => {\n this._eventManager.dispatch({\n type: 'loadError',\n error: error as Error,\n });\n });\n }\n\n // #region Getters and Setters\n\n /**\n * Gets the autoplay status of the animation.\n *\n * @returns The autoplay status of the animation.\n */\n public get autoplay(): boolean {\n return this._autoplay;\n }\n\n /**\n * Gets the background color of the canvas.\n *\n * @returns The background color of the canvas.\n */\n public get backgroundColor(): string {\n return this._backgroundColor;\n }\n\n /**\n * Gets the current direction of the animation.\n *\n * @returns The current direction of the animation.\n */\n public get direction(): number {\n return this._direction;\n }\n\n /**\n * Gets the current frame number.\n *\n * @returns The current frame number.\n */\n public get currentFrame(): number {\n return this._currentFrame;\n }\n\n /**\n * Gets the duration of the animation in seconds.\n *\n * @returns The duration of the animation in seconds.\n */\n public get duration(): number {\n return this._duration;\n }\n\n /**\n * Gets the number of frames in the animation.\n *\n * @returns The number of frames in the animation.\n */\n public get totalFrames(): number {\n return this._totalFrames;\n }\n\n /**\n * Gets the loop status of the animation.\n *\n * @returns The loop status of the animation.\n */\n public get loop(): boolean {\n return this._loop;\n }\n\n /**\n * Gets the speed of the animation.\n *\n * @returns The speed of the animation.\n */\n public get speed(): number {\n return this._speed;\n }\n\n /**\n * Gets the loop count of the animation.\n *\n * @returns The loop count of the animation.\n */\n public get loopCount(): number {\n return this._loopCount;\n }\n\n /**\n * Gets the segments of the animation if any are set.\n * Default is 0 to total frames. but if segments are set, it will be the start and end frames.\n *\n */\n public get segments(): [number, number] | null {\n return this._segments;\n }\n\n public get isPlaying(): boolean {\n return this._playbackState === 'playing';\n }\n\n public get isPaused(): boolean {\n return this._playbackState === 'paused';\n }\n\n public get isStopped(): boolean {\n return this._playbackState === 'stopped';\n }\n\n public get isFrozen(): boolean {\n return this._isFrozen;\n }\n\n // #endregion Getters and Setters\n\n // #region Private Methods\n /**\n * Loads and initializes the animation from a given URL.\n *\n * @public\n * @param animationURL - The source URL of the animation.\n */\n private _loadAnimationFromURL(animationURL: string): void {\n loadAnimationJSONFromURL(animationURL)\n .then((animationJSON) => {\n this._initializeAnimationFromData(animationJSON);\n })\n .catch((error) => {\n this._eventManager.dispatch({\n type: 'loadError',\n error: error as Error,\n });\n });\n }\n\n /**\n * Initializes the animation from the given data.\n *\n * @public\n * @param data - The animation data.\n */\n private _initializeAnimationFromData(data: string | ArrayBuffer): void {\n const loadAnimation = (animationData: string): void => {\n try {\n if (this._renderer?.load(animationData, this._canvas.width, this._canvas.height)) {\n this._setupAnimationDetails();\n this._eventManager.dispatch({ type: 'load' });\n this.resize();\n if (this._autoplay) {\n this.play();\n } else {\n this._currentFrame = this._mode.includes('reverse')\n ? this._getEffectiveEndFrame()\n : this._getEffectiveStartFrame();\n\n this.setFrame(this._currentFrame);\n }\n } else {\n this._eventManager.dispatch({\n type: 'loadError',\n error: new Error('Error encountered while initializing animation from data.'),\n });\n }\n } catch (error) {\n this._eventManager.dispatch({\n type: 'loadError',\n error: error as Error,\n });\n }\n };\n\n if (typeof data === 'string') {\n loadAnimation(data);\n } else if (data instanceof ArrayBuffer) {\n getAnimationJSONFromDotLottie(data)\n .then(loadAnimation)\n .catch((error) => {\n this._eventManager.dispatch({\n type: 'loadError',\n error: error as Error,\n });\n });\n } else {\n console.error('Unsupported data type for animation data. Expected a string or ArrayBuffer.');\n }\n }\n\n /**\n * Sets up animation details like total frames and duration.\n */\n private _setupAnimationDetails(): void {\n if (this._renderer) {\n this._totalFrames = this._renderer.totalFrames();\n this._duration = this._renderer.duration();\n this._segments = [\n Math.max(0, this._segments?.[0] ?? 0),\n Math.min(this._totalFrames - 1, this.segments?.[1] ?? this._totalFrames - 1),\n ];\n }\n }\n\n /**\n * Renders the animation frame on the canvas.\n */\n private _render(): void {\n if (!this._context || !this._renderer) {\n return;\n }\n\n const width = this._canvas.width;\n const height = this._canvas.height;\n\n this._renderer.resize(width, height);\n\n if (this._renderer.update()) {\n const buffer = this._renderer.render();\n\n if (buffer.length === 0) {\n console.warn('Empty buffer received from renderer.');\n\n return;\n }\n\n const clampedBuffer = new Uint8ClampedArray(buffer);\n\n const imageData = this._context.createImageData(width, height);\n\n imageData.data.set(clampedBuffer);\n\n this._context.putImageData(imageData, 0, 0);\n }\n }\n\n /**\n * Updates the current frame and animation state.\n * @returns Boolean indicating if the frame was updated.\n */\n private _update(): boolean {\n // animation is not loaded yet\n if (this._duration === 0 || this._totalFrames === 0) return false;\n\n const effectiveStartFrame = this._getEffectiveStartFrame();\n const effectiveEndFrame = this._getEffectiveEndFrame();\n const effectiveDuration = this._getEffectiveDuration();\n const frameDuration = effectiveDuration / (effectiveEndFrame - effectiveStartFrame);\n\n this._elapsedTime = (Date.now() / MS_TO_SEC_FACTOR - this._beginTime) * this._speed;\n const frameProgress = this._elapsedTime / frameDuration;\n\n // determine the current frame based on the animation mode and progress\n if (this._mode === 'forward' || this._mode === 'reverse') {\n this._currentFrame =\n this._mode === 'forward' ? effectiveStartFrame + frameProgress : effectiveEndFrame - frameProgress;\n } else {\n // handle bounce or bounce-reverse mode\n // eslint-disable-next-line no-lonely-if\n if (this._direction === 1) {\n this._currentFrame = effectiveStartFrame + frameProgress;\n if (this._currentFrame >= effectiveEndFrame) {\n this._currentFrame = effectiveEndFrame;\n this._direction = -1;\n this._beginTime = Date.now() / MS_TO_SEC_FACTOR;\n }\n } else {\n this._currentFrame = effectiveEndFrame - frameProgress;\n if (this._currentFrame <= effectiveStartFrame) {\n this._currentFrame = effectiveStartFrame;\n this._direction = 1;\n this._beginTime = Date.now() / MS_TO_SEC_FACTOR;\n }\n }\n }\n\n // clamp the current frame within the effective range and round it\n this._currentFrame = Math.max(effectiveStartFrame, Math.min(this._currentFrame, effectiveEndFrame));\n\n let shouldUpdate = false;\n\n if (this._renderer?.frame(this._currentFrame)) {\n this._eventManager.dispatch({\n type: 'frame',\n currentFrame: this._currentFrame,\n });\n\n shouldUpdate = true;\n }\n\n // check if the animation should loop or complete\n if (this._mode === 'forward' || this._mode === 'reverse') {\n if (this._currentFrame >= effectiveEndFrame || this._currentFrame <= effectiveStartFrame) {\n this._handleLoopOrCompletion();\n }\n } else if (this._currentFrame <= effectiveStartFrame || this._currentFrame >= effectiveEndFrame) {\n this._bounceCount += 1;\n if (this._bounceCount % 2 === 0) {\n this._bounceCount = 0;\n this._handleLoopOrCompletion();\n }\n }\n\n return shouldUpdate;\n }\n\n /**\n * Handles the loop or completion logic for the animation.\n */\n private _handleLoopOrCompletion(): void {\n if (this._loop) {\n this._loopCount += 1;\n this._eventManager.dispatch({ type: 'loop', loopCount: this._loopCount });\n this._beginTime = Date.now() / MS_TO_SEC_FACTOR;\n } else {\n this._playbackState = 'stopped';\n this._eventManager.dispatch({ type: 'complete' });\n }\n }\n\n /**\n * Loop that handles the animation playback.\n */\n private _animationLoop(): void {\n const updated = this._update();\n\n if (updated) {\n this._render();\n }\n\n // check if the animation is still playing before requesting the next frame\n if (this.isPlaying) {\n this._animationFrameId = this._animationFrameManager.requestAnimationFrame(this._animationLoop);\n }\n }\n\n /**\n * Stops the animation loop.\n *\n * This is used to ensure that the animation loop is only stopped once.\n */\n private _stopAnimationLoop(): void {\n if (this._animationFrameId) {\n this._animationFrameManager.cancelAnimationFrame(this._animationFrameId);\n this._animationFrameId = null;\n }\n }\n\n /**\n * Starts the animation loop.\n *\n * This is used to ensure that the animation loop is only started once.\n */\n private _startAnimationLoop(): void {\n if (!this._animationFrameId) {\n this._animationFrameId = this._animationFrameManager.requestAnimationFrame(this._animationLoop);\n }\n }\n\n private _getEffectiveStartFrame(): number {\n return this._segments ? this._segments[0] : 0;\n }\n\n private _getEffectiveEndFrame(): number {\n return this._segments ? this._segments[1] : this._totalFrames - 1;\n }\n\n private _getEffectiveTotalFrames(): number {\n return this._segments ? this._segments[1] - this._segments[0] : this._totalFrames;\n }\n\n private _getEffectiveDuration(): number {\n return this._segments\n ? this._duration * ((this._segments[1] - this._segments[0]) / this._totalFrames)\n : this._duration;\n }\n\n /**\n * Synchronizes the animation timing based on the current frame, direction, and speed settings.\n * This method calculates the appropriate begin time for the animation loop, ensuring that the\n * animation's playback is consistent with the specified parameters.\n *\n * @param frame - The current frame number from which the animation timing will be synchronized.\n * This frame number is used to calculate the correct position in the animation timeline.\n *\n * Usage:\n * - This function should be called whenever there is a change in the frame, speed, or direction\n * of the animation to maintain the correct timing.\n * - It is used internally in methods like `play`, `setFrame`, and `setMode` to ensure that the\n * animation's playback remains smooth and accurate.\n */\n private _synchronizeAnimationTiming(frame: number): void {\n const effectiveDuration = this._getEffectiveDuration();\n const effectiveTotalFrames = this._getEffectiveTotalFrames();\n const frameDuration = effectiveDuration / effectiveTotalFrames;\n let frameTime = (frame - this._getEffectiveStartFrame()) * frameDuration;\n\n if (this._direction === -1) {\n frameTime = effectiveDuration - frameTime;\n }\n\n this._beginTime = Date.now() / MS_TO_SEC_FACTOR - frameTime / this._speed;\n }\n\n // #endregion\n\n // #region Public Methods\n\n /**\n * Starts the animation playback.\n */\n public play(): void {\n if (this._totalFrames === 0) {\n console.error('Animation is not loaded yet.');\n\n return;\n }\n\n const effectiveStartFrame = this._getEffectiveStartFrame();\n const effectiveEndFrame = this._getEffectiveEndFrame();\n\n // reset begin time and loop count if starting from the beginning\n // eslint-disable-next-line no-negated-condition\n if (this._playbackState !== 'paused') {\n this._currentFrame =\n this._mode === 'reverse' || this._mode === 'bounce-reverse' ? effectiveEndFrame : effectiveStartFrame;\n this._beginTime = Date.now() / MS_TO_SEC_FACTOR;\n } else {\n this._synchronizeAnimationTiming(this._currentFrame);\n }\n\n if (!this.isPlaying) {\n this._playbackState = 'playing';\n\n // auto unfreeze if the animation on play\n if (this._isFrozen) {\n this._isFrozen = false;\n\n this._eventManager.dispatch({ type: 'unfreeze' });\n }\n\n this._eventManager.dispatch({\n type: 'play',\n });\n\n this._animationFrameId = this._animationFrameManager.requestAnimationFrame(this._animationLoop);\n }\n }\n\n /**\n * Stops the animation playback and resets the current frame.\n */\n public stop(): void {\n if (this.isStopped) return;\n\n this._stopAnimationLoop();\n this._playbackState = 'stopped';\n this._bounceCount = 0;\n\n if (this._mode === 'reverse' || this._mode === 'bounce-reverse') {\n this._currentFrame = this._getEffectiveEndFrame();\n this._direction = -1;\n } else {\n this._currentFrame = this._getEffectiveStartFrame();\n this._direction = 1;\n }\n\n this.setFrame(this._currentFrame);\n this._render();\n\n this._eventManager.dispatch({\n type: 'stop',\n });\n }\n\n /**\n * Pauses the animation playback.\n */\n public pause(): void {\n if (this.isPaused) return;\n\n this._stopAnimationLoop();\n\n this._playbackState = 'paused';\n\n this._eventManager.dispatch({\n type: 'pause',\n });\n }\n\n /**\n * Sets the speed for animation playback.\n * @param speed - Speed multiplier for playback.\n */\n public setSpeed(speed: number): void {\n if (speed <= 0) {\n console.error('Speed must be a positive number.');\n\n return;\n }\n\n if (this._speed === speed) return;\n\n if (this.isPlaying) {\n // recalculate the begin time based on the new speed to maintain the current position\n const currentTime = Date.now() / MS_TO_SEC_FACTOR;\n\n this._beginTime = currentTime - this._elapsedTime / speed;\n }\n\n this._speed = speed;\n }\n\n /**\n * Sets the loop state for animation playback.\n * @param loop - Boolean indicating if the animation should loop.\n */\n public setLoop(loop: boolean): void {\n this._loop = loop;\n }\n\n /**\n * Sets the current frame of the animation.\n * @param frame - Frame number to set.\n */\n public setFrame(frame: number): void {\n const effectiveStartFrame = this._getEffectiveStartFrame();\n const effectiveEndFrame = this._getEffectiveEndFrame();\n\n // validate the frame number within the effective frame range\n if (frame < effectiveStartFrame || frame > effectiveEndFrame) {\n console.error(\n `Invalid frame number: ${frame}. It should be between ${effectiveStartFrame} and ${effectiveEndFrame}.`,\n );\n\n return;\n }\n\n this._currentFrame = frame;\n\n if (this.isPlaying) {\n this._synchronizeAnimationTiming(frame);\n }\n\n if (this._renderer?.frame(this._currentFrame)) {\n this._render();\n this._eventManager.dispatch({\n type: 'frame',\n currentFrame: this._currentFrame,\n });\n }\n }\n\n /**\n *\n * Sets the playback mode of the animation.\n *\n */\n public setMode(mode: Mode): void {\n if (this._mode === mode) {\n return;\n }\n\n this._mode = mode;\n this._bounceCount = 0;\n this._direction = mode.includes('reverse') ? -1 : 1;\n\n if (this.isPlaying) {\n this._synchronizeAnimationTiming(this._currentFrame);\n }\n }\n\n public load(config: Omit<Config, 'canvas'>): void {\n if (!this._renderer || !this._context) {\n return;\n }\n\n if (!config.src && !config.data) {\n console.error('Either \"src\" or \"data\" must be provided.');\n\n return;\n }\n\n this._stopAnimationLoop();\n this._playbackState = 'stopped';\n\n this._loop = config.loop ?? false;\n this._speed = config.speed ?? 1;\n this._autoplay = config.autoplay ?? false;\n this._mode = config.mode ?? 'forward';\n this._segments = config.segments ?? null;\n this._loopCount = 0;\n this._bounceCount = 0;\n this._direction = this._mode.includes('reverse') ? -1 : 1;\n this._renderConfig = config.renderConfig ?? {};\n\n const effectiveStartFrame = this._getEffectiveStartFrame();\n const effectiveEndFrame = this._getEffectiveEndFrame();\n\n this._currentFrame =\n this._mode === 'reverse' || this._mode === 'bounce-reverse' ? effectiveEndFrame : effectiveStartFrame;\n\n this._beginTime = 0;\n this._totalFrames = 0;\n this._duration = 0;\n this._backgroundColor = config.backgroundColor ?? DEFAULT_BG_COLOR;\n\n this.setBackgroundColor(this._backgroundColor);\n\n this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);\n\n if (config.src) {\n this._loadAnimationFromURL(config.src);\n } else if (config.data) {\n this._initializeAnimationFromData(config.data);\n }\n }\n\n public setSegments(startFrame: number, endFrame: number): void {\n if (!this._renderer) {\n console.error('Animation not initialized.');\n\n return;\n }\n\n // Validate the frame range\n if (startFrame < 0 || endFrame >= this._totalFrames || startFrame > endFrame) {\n console.error('Invalid frame range.');\n\n return;\n }\n\n this._segments = [startFrame, endFrame];\n\n if (this._currentFrame < startFrame || this._currentFrame > endFrame) {\n this._currentFrame = this._direction === 1 ? startFrame : endFrame;\n\n // render the current frame\n if (this._renderer.frame(this._currentFrame)) {\n this._render();\n this._eventManager.dispatch({\n type: 'frame',\n currentFrame: this._currentFrame,\n });\n }\n }\n\n // If playing, adjust the animation timing\n if (this.isPlaying) {\n this._synchronizeAnimationTiming(this._currentFrame);\n }\n }\n\n /**\n * Registers an event listener for a specific event type.\n *\n * @param type - The type of the event to listen for.\n * @param listener - The callback function to be called when the event is dispatched.\n */\n public addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void {\n this._eventManager.addEventListener(type, listener);\n }\n\n /**\n * Removes an event listener for a specific event type.\n *\n * @param type - The type of the event to listen for.\n * @param listener - The callback function to be called when the event is dispatched.\n */\n public removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void {\n this._eventManager.removeEventListener(type, listener);\n }\n\n /**\n * Sets the source URL of the WASM file to load.\n * @param url - The URL of the WASM file to load.\n */\n public static setWasmUrl(url: string): void {\n WasmLoader.setWasmUrl(url);\n }\n\n /**\n * Destroys the DotLottie instance.\n *\n */\n public destroy(): void {\n this._stopAnimationLoop();\n this._playbackState = 'stopped';\n\n this._context = null;\n this._renderer = null;\n\n this._eventManager.dispatch({\n type: 'destroy',\n });\n\n this._eventManager.removeAllEventListeners();\n }\n\n /**\n * Freezes the animation by stopping the animation loop.\n *\n */\n public freeze(): void {\n if (this._isFrozen) return;\n\n this._stopAnimationLoop();\n\n this._isFrozen = true;\n\n this._eventManager.dispatch({\n type: 'freeze',\n });\n }\n\n /**\n * Unfreezes the animation by resuming the animation loop.\n *\n */\n public unfreeze(): void {\n if (!this.isFrozen) return;\n\n this._isFrozen = false;\n this._eventManager.dispatch({ type: 'unfreeze' });\n\n // resume the animation loop only if the playback state is 'playing'\n if (this.isPlaying) {\n this._synchronizeAnimationTiming(this._currentFrame);\n this._startAnimationLoop();\n }\n }\n\n /**\n * Sets the background color of the canvas.\n *\n * @param color - The background color of the canvas.\n */\n public setBackgroundColor(color: string): void {\n this._backgroundColor = color;\n\n const rgbaInt = hexStringToRGBAInt(color);\n\n this._renderer?.setBgColor(rgbaInt);\n }\n\n /**\n * Adjusts the canvas size to match the size of its bounding box, considering the device's pixel ratio.\n * This method ensures that the canvas is correctly scaled for high-density displays, maintaining\n * the clarity and quality of the rendered animation.\n *\n * Call this method whenever the size of the canvas element changes (e.g., due to window resizing,\n * orientation changes, or dynamic layout updates) to ensure that the canvas is always properly scaled.\n *\n */\n public resize(): void {\n if (!IS_BROWSER) return;\n\n const { height, width } = this._canvas.getBoundingClientRect();\n\n const dpr = this._renderConfig.devicePixelRatio || window.devicePixelRatio || 1;\n\n this._canvas.width = width * dpr;\n this._canvas.height = height * dpr;\n\n // resize the renderer and render the current frame\n this._render();\n }\n\n // #endregion\n}\n"]}