@keeratita/heic-converter 0.5.2 → 0.6.1

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.
@@ -0,0 +1,46 @@
1
+ import type { DecodedImage, IHeicDecoder } from '../types';
2
+ /**
3
+ * Platform-native HEIC decoding — the Strategy behind `nativeDecode: true`.
4
+ * On HEIC-capable hosts (Safari/iOS, Edge, Windows) ImageIO decodes in
5
+ * hardware and the bundled libheif payload is never fetched. Dynamic-import
6
+ * only, so hosts that never opt in never download this chunk.
7
+ */
8
+ /**
9
+ * Decoded-dimension cap, a duplicate of `MAX_CANVAS_DIMENSION` in
10
+ * render/canvas.ts (pinned equal by native-decoder.test.ts) so this lazy
11
+ * chunk stays out of the render module graph.
12
+ */
13
+ export declare const MAX_NATIVE_DECODE_DIMENSION = 16384;
14
+ /**
15
+ * Total-pixel cap, a duplicate of `kMaxDecodePixels` in
16
+ * build-wasm/wrapper/main.cpp (pinned equal by native-decoder.test.ts, same
17
+ * lazy-chunk-purity reason as the dimension cap). Without it, a
18
+ * container-declared 16384x16384 passes both side checks and the canvas +
19
+ * ImageData pair below allocates ~1 GB outside the WASM heap — the libheif
20
+ * path rejects that size, so native must not accept it.
21
+ */
22
+ export declare const MAX_NATIVE_DECODE_PIXELS: number;
23
+ /** @internal Whether this realm has refused native decoding (decoder selection). */
24
+ export declare function isNativeHeicRefused(): boolean;
25
+ /**
26
+ * @internal Record an environment-class native failure so later calls skip
27
+ * the attempt. The once-only warn is the breadcrumb: without it the page
28
+ * silently loses the opt-in with nothing naming the cause.
29
+ */
30
+ export declare function markNativeHeicRefused(): void;
31
+ /** @internal Clear the refusal verdict and its breadcrumb (tests only). */
32
+ export declare function __resetNativeHeicProbe(): void;
33
+ /**
34
+ * createImageBitmap + OffscreenCanvas readback behind the same
35
+ * `DecodedImage` contract as LibheifDecoder, so the render stage is shared.
36
+ * `imageOrientation: 'from-image'` applies the display transform (EXIF and
37
+ * irot/imir), so results are upright with no pending orientation — the
38
+ * selection policy only picks this Strategy when `applyOrientation` is not
39
+ * false. Errors never reach a consumer: convertHeic retries with libheif,
40
+ * which produces the typed error of record, so these strings stay chunk-local.
41
+ */
42
+ export declare class NativeHeicDecoder implements IHeicDecoder {
43
+ initialize(): Promise<void>;
44
+ decode(data: Uint8Array): Promise<DecodedImage>;
45
+ free(): void;
46
+ }
@@ -0,0 +1,62 @@
1
+ import type { IHeicDecoder, DecodedImage } from '../types';
2
+ export interface LibheifDecoderOptions {
3
+ /**
4
+ * Custom function to locate the WASM file.
5
+ * Useful when serving the WASM file from a custom route or CDN.
6
+ */
7
+ locateFile?: (path: string, prefix: string) => string;
8
+ /**
9
+ * Raw WASM binary buffer. If provided, the library will use this buffer
10
+ * directly instead of attempting to fetch the WASM file. Accepts an
11
+ * `ArrayBuffer` or any `ArrayBufferView` (e.g. a Node.js `Buffer` from
12
+ * `fs.readFileSync`).
13
+ */
14
+ wasmBinary?: ArrayBuffer | ArrayBufferView;
15
+ /**
16
+ * Advanced: extra properties merged into the Emscripten module argument
17
+ * object (e.g. `instantiateWasm` for streaming compilation). Prefer
18
+ * `locateFile`/`wasmBinary` for the common cases; keys provided here must
19
+ * not collide with them.
20
+ */
21
+ moduleOverrides?: Record<string, unknown>;
22
+ }
23
+ export declare class LibheifDecoder implements IHeicDecoder {
24
+ private options?;
25
+ private module;
26
+ private decoderInstance;
27
+ /**
28
+ * Memoized module-loading promise so concurrent initialize()/decode() calls
29
+ * on the same instance never instantiate (or mutate) the module twice.
30
+ * Resolves null when a concurrent free() discarded the freshly created
31
+ * instance (see initGeneration).
32
+ */
33
+ private initPromise;
34
+ /**
35
+ * Generation counter for init/free races: a load that finishes after a
36
+ * concurrent free() must not resurrect module/decoderInstance.
37
+ */
38
+ private initGeneration;
39
+ constructor(options?: LibheifDecoderOptions);
40
+ /**
41
+ * Initializes the WebAssembly module and instantiates the HEIC decoder.
42
+ * Safe to call concurrently: the module is loaded at most once per instance.
43
+ */
44
+ initialize(): Promise<void>;
45
+ /**
46
+ * Decodes HEIC binary data into raw RGBA pixel data.
47
+ * @param data The HEIC file contents as a Uint8Array.
48
+ * @param onProgress Optional progress callback (receives a normalized
49
+ * percentage clamped to 0-100).
50
+ */
51
+ decode(data: Uint8Array, onProgress?: (percent: number) => void): Promise<DecodedImage>;
52
+ /**
53
+ * Cleans up the WebAssembly decoder instance and resources.
54
+ * Idempotent: safe to call multiple times. After free(), the next
55
+ * initialize() — or decode() directly, which re-initializes transparently
56
+ * — loads a fresh module.
57
+ *
58
+ * free() is also safe to call while initialize() is in flight: a load that
59
+ * completes after free() discards its fresh instance instead of leaking it.
60
+ */
61
+ free(): void;
62
+ }
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./chunk-TND3VERK.js"),r=require("./chunk-N2LCVW2Q.js"),t="Web Worker is not supported in the current environment",o="The decoder option is not supported by convertHeicInWorker: the worker creates its own decoder (functions and class instances cannot cross the worker boundary). Use convertHeic with an injected decoder instead.",s=e=>"Worker failed"+(void 0!==e?` (could not load worker script at ${String(e)}; check the path resolves and the script is served as JavaScript, e.g. Content-Type: text/javascript)`:"");function n(t){if(void 0!==t&&(!Number.isInteger(t)||t<1||t>e.MAX_BATCH_CONCURRENCY))throw new r.HeicConverterError("invalid_concurrency",(o=t,`maxConcurrentWorkers must be an integer between 1 and ${e.MAX_BATCH_CONCURRENCY}, got: ${o}`));var o}function i(e){if(void 0!==e&&("number"!=typeof e||!Number.isFinite(e)||e<0))throw new r.HeicConverterError("invalid_input",`timeoutMs must be a finite number >= 0 (0 disables the timeout), got: ${e}`)}function a(){const e="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;return Math.max(1,Math.min(e,8))}var d=new Map,c=1;function u(e,r,t){let o=d.get(e);o||(o={active:0,waiters:[],parked:[]},d.set(e,o));const s={granted:!1,released:!1},n=()=>{0===o.active&&0===o.waiters.length&&(0!==o.parked.length?o.idleTimer=setTimeout(()=>{o.idleTimer=void 0;for(const e of o.parked.splice(0))e.terminate();d.delete(e)},5e3):d.delete(e))},i=e=>{if(!s.released)if(s.released=!0,e&&(o.parked.length>=2&&o.parked.shift().terminate(),o.parked.push(e)),s.granted){s.granted=!1,o.active-=1;const e=o.waiters.shift();e?e():n()}else{const e=o.waiters.indexOf(a);-1!==e&&o.waiters.splice(e,1),n()}},a=()=>{s.released||(void 0!==o.idleTimer&&(clearTimeout(o.idleTimer),o.idleTimer=void 0),s.granted=!0,o.active+=1,t(i,o.parked.pop()))};return o.active<r?a():o.waiters.push(a),i}var l={reserveWorkerSlot:u,workerSlots:d,defaultMaxWorkers:a,WORKER_POOL_IDLE_MS:5e3,MAX_PARKED_WORKERS:2};function p(a,d){return new Promise((l,p)=>{if("undefined"==typeof Worker)return void p(new r.HeicConverterError("worker_unsupported",t));if(void 0!==d.decoder)return void p(new r.HeicConverterError("invalid_input",o));try{e.validateConvertOptions(d),n(d?.maxConcurrentWorkers),i(d?.timeoutMs)}catch(e){return void p(e)}if(d.signal?.aborted)return void p(new r.HeicConverterError("aborted",e.Messages.Aborted));const m={progressMessages:0},g=c++,f=e.progressGateFor(d.onProgress);let w,k,h,y=!1,C=!1;const E=(e=!1)=>{y||(y=!0,void 0!==k&&clearTimeout(k),d.signal?.removeEventListener("abort",b),w&&(w.removeEventListener("message",T),w.removeEventListener("messageerror",H),w.removeEventListener("error",$)),e&&w?h?.(w):(w?.terminate(),h?.()))},b=()=>{E(),p(new r.HeicConverterError("aborted",e.Messages.Aborted))};d.signal?.addEventListener("abort",b,{once:!0});const W=d.timeoutMs??6e4,M=Date.now();let _;W>0&&(k=setTimeout(()=>{E(),p(new r.HeicConverterError("worker_timeout",((e,r)=>{if(void 0===r.startedAt)return`Web Worker conversion timed out after ${e}ms before a worker slot was granted — the deadline was spent waiting behind other conversions (timeoutMs includes queue wait). Raise maxConcurrentWorkers or timeoutMs, or set timeoutMs to 0 to disable the timeout.`;const t=[`${r.progressMessages} progress message(s) received`];return void 0!==r.queueWaitMs&&r.queueWaitMs>0&&t.unshift(`started after ${r.queueWaitMs}ms queued`),void 0!==r.lastPercent&&t.push(`last percent ${r.lastPercent}`),void 0!==r.unknownType&&t.push(`last unknown message type '${r.unknownType}' (worker may not implement the progress/result protocol)`),void 0!==r.staleResults&&t.push(`${r.staleResults} result(s) ignored for not echoing the request id (duplicate or stale replies must not be posted)`),void 0!==r.staleProgress&&t.push(`${r.staleProgress} progress message(s) ignored for not echoing the request id`),r.adopted&&t.push("lease adopted from the pool — a script that calls self.close() after replying stalls adopted leases"),void 0!==r.workerUrl&&t.push(`worker ${String(r.workerUrl)}`),`Web Worker conversion timed out after ${e}ms (${t.join("; ")}). Increase timeoutMs for large images, set timeoutMs to 0 to disable the timeout, and verify the worker script implements the { id, type: "progress" | "result" } protocol.`})(W,{progressMessages:m.progressMessages,lastPercent:m.lastPercent,unknownType:m.unknownType,staleResults:m.staleResults,staleProgress:m.staleProgress,adopted:C,workerUrl:d.workerUrl,startedAt:_,queueWaitMs:void 0===_?void 0:_-M})))},W));const T=t=>{const o=t.data;if("progress"===o?.type){if(o.id!==g)return void(m.staleProgress=(m.staleProgress??0)+1);m.progressMessages+=1;const r=e.clampPercent(o.percent);if(m.lastPercent=r,r>=100)return;f?.report(r);const t=f?.pendingError();return void(t&&(E(),p(t)))}if("result"!==o?.type)return void("string"==typeof o?.type&&(m.unknownType=o.type));if(o.id!==g)return void(m.staleResults=(m.staleResults??0)+1);const s=!0===o.ok&&void 0!==o.blob;if(E(s),s){try{f?.complete()}catch(e){return void p(e)}l(o.blob)}else p(new r.HeicConverterError("worker_failed",o.error??"Worker conversion failed"))},$=e=>{E();const t=e.filename?` (${e.filename}:${e.lineno})`:"";p(new r.HeicConverterError("worker_failed",`${e.message||s(d.workerUrl)}${t}`))},H=e=>{E();const t=e.data;p(new r.HeicConverterError("worker_failed",t instanceof Error?t.message:void 0!==t?String(t):s(d.workerUrl),{cause:t}))},{workerUrl:P,onProgress:R,timeoutMs:x,workerType:A,maxConcurrentWorkers:O,signal:L,...S}=d,q=`${String(P)}|${d.workerType??"classic"}`,U=v(d.maxConcurrentWorkers);h=u(q,U,(e,t)=>{if(h=e,y)t?.terminate();else{_=Date.now(),C=void 0!==t;try{w=t??new Worker(P,"module"===d.workerType?{type:"module"}:void 0)}catch(e){return E(),void p(new r.HeicConverterError("worker_create_failed",(o=e instanceof Error?e.message:String(e),`Failed to create Web Worker: ${o}`),{cause:e}))}w.addEventListener("message",T),w.addEventListener("messageerror",H),w.addEventListener("error",$);try{w.postMessage({id:g,input:a,options:S})}catch(e){E(),p(new r.HeicConverterError("worker_post_failed",(e=>`Failed to post message to Web Worker: ${e}`)(e instanceof Error?e.message:String(e)),{cause:e}))}}var o})})}function v(e){return"number"==typeof e&&Number.isInteger(e)?Math.max(1,e):a()}exports.__resetWorkerPool=function(){for(const e of d.values()){void 0!==e.idleTimer&&(clearTimeout(e.idleTimer),e.idleTimer=void 0);for(const r of e.parked.splice(0))r.terminate()}d.clear()},exports.__semaphoreTestHooks=l,exports.convertHeicInWorker=p,exports.convertManyInWorker=async function(s,a){if(!Array.isArray(s))throw new r.HeicConverterError("invalid_input",e.Messages.InputsMustBeArray);if("undefined"==typeof Worker)throw new r.HeicConverterError("worker_unsupported",t);if(void 0!==a.decoder)throw new r.HeicConverterError("invalid_input",o);e.validateConvertOptions(a),e.validateBatchOptions(a),n(a.maxConcurrentWorkers),i(a.timeoutMs);const{onProgress:d,continueOnError:c,...u}=a,l=e.progressCallbackFor(d);return e.runBoundedBatch(s,v(a.maxConcurrentWorkers),(e,r)=>p(e,{...u,...l?{onProgress:e=>l(r,e)}:{}}),{continueOnError:!0===a.continueOnError,signal:a.signal})};
@@ -0,0 +1 @@
1
+ import{validateConvertOptions as e,Messages as r,progressGateFor as t,validateBatchOptions as o,progressCallbackFor as s,runBoundedBatch as n,MAX_BATCH_CONCURRENCY as i,clampPercent as a}from"./chunk-BTAX2PFV.mjs";import{HeicConverterError as d}from"./chunk-AROQBV5T.mjs";var u="Web Worker is not supported in the current environment",l="The decoder option is not supported by convertHeicInWorker: the worker creates its own decoder (functions and class instances cannot cross the worker boundary). Use convertHeic with an injected decoder instead.",c=e=>"Worker failed"+(void 0!==e?` (could not load worker script at ${String(e)}; check the path resolves and the script is served as JavaScript, e.g. Content-Type: text/javascript)`:"");function p(e){if(void 0!==e&&(!Number.isInteger(e)||e<1||e>i))throw new d("invalid_concurrency",`maxConcurrentWorkers must be an integer between 1 and ${i}, got: ${e}`)}function m(e){if(void 0!==e&&("number"!=typeof e||!Number.isFinite(e)||e<0))throw new d("invalid_input",`timeoutMs must be a finite number >= 0 (0 disables the timeout), got: ${e}`)}function g(){const e="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;return Math.max(1,Math.min(e,8))}var v=new Map,f=1;function w(e,r,t){let o=v.get(e);o||(o={active:0,waiters:[],parked:[]},v.set(e,o));const s={granted:!1,released:!1},n=()=>{0===o.active&&0===o.waiters.length&&(0!==o.parked.length?o.idleTimer=setTimeout(()=>{o.idleTimer=void 0;for(const e of o.parked.splice(0))e.terminate();v.delete(e)},5e3):v.delete(e))},i=e=>{if(!s.released)if(s.released=!0,e&&(o.parked.length>=2&&o.parked.shift().terminate(),o.parked.push(e)),s.granted){s.granted=!1,o.active-=1;const e=o.waiters.shift();e?e():n()}else{const e=o.waiters.indexOf(a);-1!==e&&o.waiters.splice(e,1),n()}},a=()=>{s.released||(void 0!==o.idleTimer&&(clearTimeout(o.idleTimer),o.idleTimer=void 0),s.granted=!0,o.active+=1,t(i,o.parked.pop()))};return o.active<r?a():o.waiters.push(a),i}var k={reserveWorkerSlot:w,workerSlots:v,defaultMaxWorkers:g,WORKER_POOL_IDLE_MS:5e3,MAX_PARKED_WORKERS:2};function h(){for(const e of v.values()){void 0!==e.idleTimer&&(clearTimeout(e.idleTimer),e.idleTimer=void 0);for(const r of e.parked.splice(0))r.terminate()}v.clear()}function y(o,s){return new Promise((n,i)=>{if("undefined"==typeof Worker)return void i(new d("worker_unsupported",u));if(void 0!==s.decoder)return void i(new d("invalid_input",l));try{e(s),p(s?.maxConcurrentWorkers),m(s?.timeoutMs)}catch(e){return void i(e)}if(s.signal?.aborted)return void i(new d("aborted",r.Aborted));const g={progressMessages:0},v=f++,k=t(s.onProgress);let h,y,W,M=!1,T=!1;const $=(e=!1)=>{M||(M=!0,void 0!==y&&clearTimeout(y),s.signal?.removeEventListener("abort",_),h&&(h.removeEventListener("message",R),h.removeEventListener("messageerror",S),h.removeEventListener("error",A)),e&&h?W?.(h):(h?.terminate(),W?.()))},_=()=>{$(),i(new d("aborted",r.Aborted))};s.signal?.addEventListener("abort",_,{once:!0});const E=s.timeoutMs??6e4,P=Date.now();let x;E>0&&(y=setTimeout(()=>{$(),i(new d("worker_timeout",((e,r)=>{if(void 0===r.startedAt)return`Web Worker conversion timed out after ${e}ms before a worker slot was granted — the deadline was spent waiting behind other conversions (timeoutMs includes queue wait). Raise maxConcurrentWorkers or timeoutMs, or set timeoutMs to 0 to disable the timeout.`;const t=[`${r.progressMessages} progress message(s) received`];return void 0!==r.queueWaitMs&&r.queueWaitMs>0&&t.unshift(`started after ${r.queueWaitMs}ms queued`),void 0!==r.lastPercent&&t.push(`last percent ${r.lastPercent}`),void 0!==r.unknownType&&t.push(`last unknown message type '${r.unknownType}' (worker may not implement the progress/result protocol)`),void 0!==r.staleResults&&t.push(`${r.staleResults} result(s) ignored for not echoing the request id (duplicate or stale replies must not be posted)`),void 0!==r.staleProgress&&t.push(`${r.staleProgress} progress message(s) ignored for not echoing the request id`),r.adopted&&t.push("lease adopted from the pool — a script that calls self.close() after replying stalls adopted leases"),void 0!==r.workerUrl&&t.push(`worker ${String(r.workerUrl)}`),`Web Worker conversion timed out after ${e}ms (${t.join("; ")}). Increase timeoutMs for large images, set timeoutMs to 0 to disable the timeout, and verify the worker script implements the { id, type: "progress" | "result" } protocol.`})(E,{progressMessages:g.progressMessages,lastPercent:g.lastPercent,unknownType:g.unknownType,staleResults:g.staleResults,staleProgress:g.staleProgress,adopted:T,workerUrl:s.workerUrl,startedAt:x,queueWaitMs:void 0===x?void 0:x-P})))},E));const R=e=>{const r=e.data;if("progress"===r?.type){if(r.id!==v)return void(g.staleProgress=(g.staleProgress??0)+1);g.progressMessages+=1;const e=a(r.percent);if(g.lastPercent=e,e>=100)return;k?.report(e);const t=k?.pendingError();return void(t&&($(),i(t)))}if("result"!==r?.type)return void("string"==typeof r?.type&&(g.unknownType=r.type));if(r.id!==v)return void(g.staleResults=(g.staleResults??0)+1);const t=!0===r.ok&&void 0!==r.blob;if($(t),t){try{k?.complete()}catch(e){return void i(e)}n(r.blob)}else i(new d("worker_failed",r.error??"Worker conversion failed"))},A=e=>{$();const r=e.filename?` (${e.filename}:${e.lineno})`:"";i(new d("worker_failed",`${e.message||c(s.workerUrl)}${r}`))},S=e=>{$();const r=e.data;i(new d("worker_failed",r instanceof Error?r.message:void 0!==r?String(r):c(s.workerUrl),{cause:r}))},{workerUrl:C,onProgress:L,timeoutMs:O,workerType:q,maxConcurrentWorkers:U,signal:I,...j}=s,D=`${String(C)}|${s.workerType??"classic"}`,F=b(s.maxConcurrentWorkers);W=w(D,F,(e,r)=>{if(W=e,M)r?.terminate();else{x=Date.now(),T=void 0!==r;try{h=r??new Worker(C,"module"===s.workerType?{type:"module"}:void 0)}catch(e){return $(),void i(new d("worker_create_failed",(t=e instanceof Error?e.message:String(e),`Failed to create Web Worker: ${t}`),{cause:e}))}h.addEventListener("message",R),h.addEventListener("messageerror",S),h.addEventListener("error",A);try{h.postMessage({id:v,input:o,options:j})}catch(e){$(),i(new d("worker_post_failed",(e=>`Failed to post message to Web Worker: ${e}`)(e instanceof Error?e.message:String(e)),{cause:e}))}}var t})})}function b(e){return"number"==typeof e&&Number.isInteger(e)?Math.max(1,e):g()}async function W(t,i){if(!Array.isArray(t))throw new d("invalid_input",r.InputsMustBeArray);if("undefined"==typeof Worker)throw new d("worker_unsupported",u);if(void 0!==i.decoder)throw new d("invalid_input",l);e(i),o(i),p(i.maxConcurrentWorkers),m(i.timeoutMs);const{onProgress:a,continueOnError:c,...g}=i,v=s(a);return n(t,b(i.maxConcurrentWorkers),(e,r)=>y(e,{...g,...v?{onProgress:e=>v(r,e)}:{}}),{continueOnError:!0===i.continueOnError,signal:i.signal})}export{h as __resetWorkerPool,k as __semaphoreTestHooks,y as convertHeicInWorker,W as convertManyInWorker};
@@ -0,0 +1,128 @@
1
+ import type { ConvertItemResult, ConvertOptions, ConvertResult, HeicInput, OutputShape } from './types';
2
+ export interface WorkerConvertOptions extends Omit<ConvertOptions, 'decoder'> {
3
+ /**
4
+ * URL of the worker script that performs the conversion. Should be a
5
+ * compile-time constant (e.g. `new URL('./worker.js', import.meta.url)`
6
+ * under a bundler); the script runs with the page's privileges.
7
+ */
8
+ workerUrl: string | URL;
9
+ /**
10
+ * Maximum time in milliseconds to wait for the worker result before
11
+ * rejecting with a timeout (queueing for a free worker slot counts toward
12
+ * this). Defaults to 60000 (60s). Set to 0 to disable the timeout.
13
+ */
14
+ timeoutMs?: number;
15
+ /**
16
+ * Worker script type. Use `'module'` when the script uses ES module
17
+ * imports (e.g. `import { convertHeic } from ...`); `'classic'`
18
+ * scripts must be pre-bundled.
19
+ * @default 'classic'
20
+ */
21
+ workerType?: 'classic' | 'module';
22
+ /**
23
+ * Upper bound on simultaneously live workers for this worker script.
24
+ * Calls beyond the bound queue until a slot frees, which keeps bulk
25
+ * conversions (`inputs.map(i => convertHeicInWorker(i, …))`) from
26
+ * exhausting memory or the browser's worker limit. Must be an integer
27
+ * from 1 to `64` (each worker is a full WASM boot with its own heap, so
28
+ * an unbounded value is a page-taking-down footgun, not capacity).
29
+ * Defaults to `navigator.hardwareConcurrency` clamped to 1–8.
30
+ */
31
+ maxConcurrentWorkers?: number;
32
+ }
33
+ /**
34
+ * Correlation token: every reply must echo the `id` of the request it answers.
35
+ * Workers are pooled, so a duplicate or late reply would otherwise settle the
36
+ * *next* lease with the previous item's result.
37
+ */
38
+ interface CorrelatedMessage {
39
+ id: number;
40
+ }
41
+ /** Progress message a worker script posts to report decode progress. */
42
+ export interface WorkerProgressMessage extends CorrelatedMessage {
43
+ type: 'progress';
44
+ percent: number;
45
+ }
46
+ /** Result message a worker script posts to settle a conversion. */
47
+ export interface WorkerResultMessage extends CorrelatedMessage {
48
+ type: 'result';
49
+ ok: boolean;
50
+ /**
51
+ * The converted image as `convertHeic` returned it inside the worker: Blob,
52
+ * data-URL string, or ArrayBuffer. The field name `blob` is kept for
53
+ * protocol compatibility.
54
+ */
55
+ blob?: Blob | string | ArrayBuffer;
56
+ error?: string;
57
+ }
58
+ export type WorkerMessage = WorkerProgressMessage | WorkerResultMessage;
59
+ declare function defaultMaxWorkers(): number;
60
+ /** Hands the lease back; a `recycle` worker is parked for the next grant. */
61
+ type WorkerReleaser = (recycle?: Worker) => void;
62
+ declare function reserveWorkerSlot(key: string, max: number, start: (release: WorkerReleaser, recycled: Worker | undefined) => void): WorkerReleaser;
63
+ /** @internal Semaphore unit-test hooks; not part of the public API. */
64
+ export declare const __semaphoreTestHooks: {
65
+ reserveWorkerSlot: typeof reserveWorkerSlot;
66
+ workerSlots: Map<string, {
67
+ active: number;
68
+ waiters: Array<() => void>;
69
+ parked: Worker[];
70
+ idleTimer?: ReturnType<typeof setTimeout>;
71
+ }>;
72
+ defaultMaxWorkers: typeof defaultMaxWorkers;
73
+ WORKER_POOL_IDLE_MS: number;
74
+ MAX_PARKED_WORKERS: number;
75
+ };
76
+ /**
77
+ * @internal Terminate parked workers, cancel idle prunes and drop slot entries,
78
+ * so tests never adopt a worker parked by an earlier case. Like the other hooks
79
+ * this ships inside the lazy worker chunk — dead but inert bytes outside tests.
80
+ */
81
+ export declare function __resetWorkerPool(): void;
82
+ /**
83
+ * Implementation behind the public `convertHeicInWorker` wrapper in
84
+ * `src/index.ts`, which carries the published JSDoc (worker-script protocol,
85
+ * `workerType`/`decoder` rules, `timeoutMs` caveats) — that is what
86
+ * `dist/index.d.ts` ships, so keep behaviour in sync with that doc.
87
+ */
88
+ export declare function convertHeicInWorker<S extends OutputShape = 'blob'>(input: HeicInput, options: WorkerConvertOptions & {
89
+ output?: S;
90
+ }): Promise<ConvertResult<S>>;
91
+ /**
92
+ * Options for {@link convertManyInWorker}: the {@link convertHeicInWorker}
93
+ * worker options plus the batch semantics of `convertMany`.
94
+ */
95
+ export interface WorkerBatchOptions extends Omit<WorkerConvertOptions, 'onProgress'> {
96
+ /**
97
+ * Per-item progress callback: receives the 0-based item index and its
98
+ * progress percentage (normalized 0–100). Values below 100 may also be
99
+ * reported for items that ultimately fail; the 100% event fires only for
100
+ * items that succeed.
101
+ */
102
+ onProgress?: (index: number, percent: number) => void;
103
+ /**
104
+ * Resolve with per-item results instead of rejecting the batch on the
105
+ * first failure; all items run to completion (see
106
+ * `ConvertManyOptions.continueOnError`).
107
+ * @default false
108
+ */
109
+ continueOnError?: boolean;
110
+ }
111
+ /**
112
+ * Implementation behind the public `convertManyInWorker` wrapper in
113
+ * `src/index.ts`, which carries the published JSDoc — keep behaviour in sync
114
+ * with that doc; the entry point just resolves the lazy chunk and forwards.
115
+ */
116
+ export declare function convertManyInWorker<S extends OutputShape = 'blob'>(inputs: HeicInput[], options: WorkerBatchOptions & {
117
+ output?: S;
118
+ continueOnError: true;
119
+ }): Promise<ConvertItemResult<ConvertResult<S>>[]>;
120
+ export declare function convertManyInWorker<S extends OutputShape = 'blob'>(inputs: HeicInput[], options: WorkerBatchOptions & {
121
+ output?: S;
122
+ continueOnError?: false;
123
+ }): Promise<ConvertResult<S>[]>;
124
+ export declare function convertManyInWorker<S extends OutputShape = 'blob'>(inputs: HeicInput[], options: WorkerBatchOptions & {
125
+ output?: S;
126
+ continueOnError: boolean;
127
+ }): Promise<Array<ConvertResult<S> | ConvertItemResult<ConvertResult<S>>>>;
128
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keeratita/heic-converter",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "Convert HEIC images to standard web formats (JPEG, PNG, WebP, AVIF, SVG) without breaking CSP",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,10 +26,11 @@
26
26
  "node": ">=20.0.0"
27
27
  },
28
28
  "scripts": {
29
- "build": "tsup && node build-scripts/compress-wasm.mjs",
29
+ "build": "tsup && tsc -p tsconfig.json --emitDeclarationOnly && node build-scripts/compress-wasm.mjs",
30
30
  "build:wasm": "bash build-scripts/build-wasm.sh",
31
31
  "verify:wasm": "node build-scripts/verify-wasm-artifacts.mjs",
32
32
  "wasm:hashes": "node build-scripts/verify-wasm-artifacts.mjs --write",
33
+ "wasm:goldens": "node build-scripts/wasm-golden-table.mjs",
33
34
  "check:scripts": "node build-scripts/check-install-scripts.mjs",
34
35
  "verify:provenance": "node build-scripts/verify-npm-provenance.mjs",
35
36
  "test": "vitest run",
@@ -78,16 +79,16 @@
78
79
  "homepage": "https://github.com/keeratita/heic-converter#readme",
79
80
  "devDependencies": {
80
81
  "@eslint/js": "^10.0.1",
81
- "@types/node": "^22.20.5",
82
+ "@types/node": "^26.6.5",
82
83
  "@vitest/coverage-v8": "^5.0.3",
83
84
  "eslint": "^10.12.0",
84
85
  "globals": "^17.13.0",
85
86
  "husky": "^9.1.7",
86
- "playwright": "^1.63.0",
87
+ "playwright": "^1.64.0",
87
88
  "terser": "^5.51.2",
88
89
  "tsup": "^8.0.0",
89
- "typescript": "^5.0.0",
90
- "typescript-eslint": "^8.71.0",
90
+ "typescript": "^6.0.3",
91
+ "typescript-eslint": "^8.71.1",
91
92
  "vitest": "^5.0.3"
92
93
  }
93
94
  }
@@ -1 +0,0 @@
1
- var e={QualityInvalid:e=>`Quality must be a number between 0.0 and 1.0, got: ${e}`,ApplyOrientationInvalid:e=>`applyOrientation must be a boolean, got: ${e}`,UnsupportedInputType:e=>`Unsupported input type. Expected Blob, File, ArrayBuffer, or Uint8Array. Got: ${e}`,DecoderInitFailed:e=>`Failed to initialize HEIC decoder: ${e} — verify heic-decoder.wasm is served (dist/heic-decoder.wasm; see the README "Serving and Locating WASM" section / locateFile option) and that your CSP allows 'wasm-unsafe-eval'`,WorkerChunkLoadFailed:e=>`Failed to load the Web Worker implementation chunk (dist/worker-*.mjs): ${e} — deploy every file in dist/ together, or use convertHeic to convert in the current thread`,RenderEncodeFailed:(e,t)=>`Failed to render and encode image as ${e}: ${t}`,ConcurrencyInvalid:e=>`Concurrency must be a positive integer, got: ${e}`,InputsMustBeArray:"Inputs must be an array of HEIC images",OutputShapeInvalid:e=>`output must be one of 'blob', 'dataUrl', 'arrayBuffer', got: ${e}`,ReuseDecodersInvalid:e=>`reuseDecoders must be a boolean, got: ${e}`,ContinueOnErrorInvalid:e=>`continueOnError must be a boolean, got: ${e}`,PreserveExifInvalid:e=>`preserveExif must be a boolean, got: ${e}`,SignalInvalid:e=>`signal must be an AbortSignal, got: ${e}`,Aborted:"Conversion aborted (AbortSignal was aborted)",ConvertManyItemFailed:(e,t,n)=>`Conversion of item ${e} of ${t} failed: ${n}`,ConvertManyExtraFailures:(e,t)=>` (${e} of ${t} items failed in total)`,ConvertManyOtherErrors:e=>`; other errors: ${e.join(" | ")}`,BatchItemProducedNoResult:e=>`Item ${String(e)} produced no result`,BatchEndedWithoutResult:"Batch ended without a result",ScaleInvalid:e=>`Scale must be a positive finite number, got: ${e}`,MaxWidthInvalid:e=>`maxWidth must be a positive finite number, got: ${e}`,MaxHeightInvalid:e=>`maxHeight must be a positive finite number, got: ${e}`,TargetSizeTooLarge:(e,t,n)=>`Target image size ${e}x${t} exceeds the maximum supported dimension of ${n}px`,BlobToBase64Failed:"Failed to convert Blob to base64 string",BlobToBase64FailedWithCause:e=>`Failed to convert Blob to base64 string: ${e}`,CanvasToBlobFailed:e=>`Failed to convert canvas to blob (type: ${e})`,CanvasUnsupported:"Canvas is not supported in the current environment. In a browser this requires OffscreenCanvas or HTMLCanvasElement. In Node.js there is no canvas: decode raw RGBA with LibheifDecoder and encode externally (see the Node.js section of the README).",InvalidDimensions:(e,t)=>`Invalid image dimensions: ${e}x${t}. Width and height must be positive integers.`,DataLengthMismatch:(e,t,n,i)=>`Image data length mismatch. Expected ${e} bytes for ${t}x${n}, got ${i}`,ContextUnavailable:"Failed to acquire 2D rendering context from canvas",UnsupportedFormat:e=>`Unsupported output format: ${e}`,FormatUnsupported:e=>`The current environment cannot encode '${e}' — canvas encoding produced no '${e}' image (e.g. AVIF encoding is not supported in this browser). Try 'jpeg', 'png', or 'webp' instead.`,CropInvalid:(e,t)=>`crop.${e} must be ${"width"===e||"height"===e?"a positive integer":"a non-negative integer"}, got: ${t}`,CropOutOfBounds:(e,t,n,i,o,r)=>`crop ${n}x${i} at (${e}, ${t}) exceeds the ${o}x${r} image (crop coordinates are in post-orientation display pixels)`,DecoderFreedDuringDecode:"Decoder was freed before decoding completed; call initialize() again.",DecodeInputAllocFailed:e=>`Failed to allocate ${e} bytes in the WASM heap for decode input`,DecodeFailed:e=>`HEIC decoding failed (no result returned; input: ${e} bytes — is the file truncated or empty?)`,DecodeFailedWithDetail:(e,t)=>`HEIC decoding failed: ${e} (input: ${t} bytes)`,DecodeFaulted:e=>`Decoder faulted on a ${e}-byte image (out of memory, or a corrupted WebAssembly instance); retry — a faulted pooled decoder is discarded, not reused`,ProgressCallbackThrew:e=>`onProgress callback threw during decode: ${e}`},t=class extends Error{code;itemIndex;itemTotal;failedCount;constructor(e,t,n){super(t,{cause:n?.cause}),this.name="HeicConverterError",this.code=e,void 0!==n?.itemIndex&&(this.itemIndex=n.itemIndex),void 0!==n?.itemTotal&&(this.itemTotal=n.itemTotal),void 0!==n?.failedCount&&(this.failedCount=n.failedCount)}},n=["jpeg","jpg","png","svg","webp","avif"];function i(n){if(void 0!==n&&"boolean"!=typeof n)throw new t("invalid_input",e.ContinueOnErrorInvalid(n))}function o(i){const o=String(i).toLowerCase();if(!n.includes(o))throw new t("invalid_format",e.UnsupportedFormat(String(i)))}function r(n){if(!n)return;const{maxWidth:i,maxHeight:o,scale:r}=n;if(void 0!==r&&("number"!=typeof r||!Number.isFinite(r)||r<=0))throw new t("invalid_resize",e.ScaleInvalid(r));if(void 0!==i&&("number"!=typeof i||!Number.isFinite(i)||i<=0))throw new t("invalid_resize",e.MaxWidthInvalid(i));if(void 0!==o&&("number"!=typeof o||!Number.isFinite(o)||o<=0))throw new t("invalid_resize",e.MaxHeightInvalid(o))}function a(n){if(!n)return;const{x:i=0,y:o=0,width:r,height:a}=n;if(!Number.isInteger(r)||r<=0)throw new t("invalid_crop",e.CropInvalid("width",r));if(!Number.isInteger(a)||a<=0)throw new t("invalid_crop",e.CropInvalid("height",a));if(!Number.isInteger(i)||i<0)throw new t("invalid_crop",e.CropInvalid("x",i));if(!Number.isInteger(o)||o<0)throw new t("invalid_crop",e.CropInvalid("y",o))}function d(e,t){return Math.min(e,t)}exports.DEFAULT_QUALITY=.92,exports.HeicConverterError=t,exports.Messages=e,exports.SUPPORTED_FORMATS=n,exports.clampPercent=function(e){const t=Number(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0},exports.runBoundedBatch=async function(n,i,o,r){const a=!0===r?.continueOnError,s=r?.signal,l=new Array(n.length);let u=0,c=!1,p=0,v=null,h=-1,f=0;const m=[];let g;const b=new Promise(e=>{g=e}),w=()=>g?.();s&&!a&&s.addEventListener("abort",w,{once:!0});const y=d(i,n.length),x=Array.from({length:y},()=>(async()=>{for(;!c&&!s?.aborted||a;){const i=u;if(u+=1,i>=n.length)return;if(a&&s?.aborted){const o=new t("aborted",e.Aborted);for(let e=i;e<n.length;e++)l[e]={index:e,ok:!1,error:o};return void(u=n.length)}try{const e=await o(n[i],i);l[i]={index:i,ok:!0,result:e},p+=1}catch(e){if(f+=1,a){l[i]={index:i,ok:!1,error:e instanceof Error?e:new Error(String(e))};continue}c?m.length<2&&m.push(e instanceof Error?e.message:String(e)):(c=!0,v=e,h=i,g?.())}}})());try{if(a)return await Promise.all(x),l;if(await Promise.race([Promise.all(x),b]),p===n.length)return l.map(n=>{if(!n||!n.ok)throw new t("batch_item_failed",e.BatchItemProducedNoResult(n?.index));return n.result});if(s?.aborted)throw new t("aborted",e.Aborted);if(c){const i=v instanceof Error?v.message:String(v);let o=e.ConvertManyItemFailed(h+1,n.length,i);throw f>1&&(o+=e.ConvertManyExtraFailures(f,n.length),m.length>0&&(o+=e.ConvertManyOtherErrors(m))),new t("batch_item_failed",o,{cause:v,itemIndex:h,itemTotal:n.length,failedCount:f})}throw new t("batch_item_failed",e.BatchEndedWithoutResult)}finally{s?.removeEventListener("abort",w)}},exports.runnerCountFor=d,exports.throwIfAborted=function(n){if(n?.aborted)throw new t("aborted",e.Aborted)},exports.validateBatchOptions=function(n){i(n?.continueOnError),function(n){if(void 0!==n&&"boolean"!=typeof n)throw new t("invalid_input",e.ReuseDecodersInvalid(n))}(n?.reuseDecoders)},exports.validateConcurrency=function(n){if(!Number.isInteger(n)||n<1)throw new t("invalid_concurrency",e.ConcurrencyInvalid(n))},exports.validateContinueOnError=i,exports.validateConvertOptions=function(n){o(n?.to??"jpeg"),void 0!==n?.quality&&function(n){if("number"!=typeof n||!Number.isFinite(n)||n<0||n>1)throw new t("invalid_quality",e.QualityInvalid(n))}(n.quality),function(n){if(void 0!==n&&"boolean"!=typeof n)throw new t("invalid_input",e.ApplyOrientationInvalid(n))}(n?.applyOrientation),function(n){if(void 0!==n&&"blob"!==n&&"dataUrl"!==n&&"arrayBuffer"!==n)throw new t("invalid_input",e.OutputShapeInvalid(n))}(n?.output),function(n){if(void 0!==n&&("object"!=typeof n||null===n||"function"!=typeof n.addEventListener))throw new t("invalid_input",e.SignalInvalid(n))}(n?.signal),a(n?.crop),function(n){if(void 0!==n&&"boolean"!=typeof n)throw new t("invalid_input",e.PreserveExifInvalid(n))}(n?.preserveExif),r(void 0!==n?.maxWidth||void 0!==n?.maxHeight||void 0!==n?.scale?n:void 0)},exports.validateCrop=a,exports.validateFormat=o,exports.validateResize=r;
@@ -1 +0,0 @@
1
- var e={QualityInvalid:e=>`Quality must be a number between 0.0 and 1.0, got: ${e}`,ApplyOrientationInvalid:e=>`applyOrientation must be a boolean, got: ${e}`,UnsupportedInputType:e=>`Unsupported input type. Expected Blob, File, ArrayBuffer, or Uint8Array. Got: ${e}`,DecoderInitFailed:e=>`Failed to initialize HEIC decoder: ${e} — verify heic-decoder.wasm is served (dist/heic-decoder.wasm; see the README "Serving and Locating WASM" section / locateFile option) and that your CSP allows 'wasm-unsafe-eval'`,WorkerChunkLoadFailed:e=>`Failed to load the Web Worker implementation chunk (dist/worker-*.mjs): ${e} — deploy every file in dist/ together, or use convertHeic to convert in the current thread`,RenderEncodeFailed:(e,t)=>`Failed to render and encode image as ${e}: ${t}`,ConcurrencyInvalid:e=>`Concurrency must be a positive integer, got: ${e}`,InputsMustBeArray:"Inputs must be an array of HEIC images",OutputShapeInvalid:e=>`output must be one of 'blob', 'dataUrl', 'arrayBuffer', got: ${e}`,ReuseDecodersInvalid:e=>`reuseDecoders must be a boolean, got: ${e}`,ContinueOnErrorInvalid:e=>`continueOnError must be a boolean, got: ${e}`,PreserveExifInvalid:e=>`preserveExif must be a boolean, got: ${e}`,SignalInvalid:e=>`signal must be an AbortSignal, got: ${e}`,Aborted:"Conversion aborted (AbortSignal was aborted)",ConvertManyItemFailed:(e,t,n)=>`Conversion of item ${e} of ${t} failed: ${n}`,ConvertManyExtraFailures:(e,t)=>` (${e} of ${t} items failed in total)`,ConvertManyOtherErrors:e=>`; other errors: ${e.join(" | ")}`,BatchItemProducedNoResult:e=>`Item ${String(e)} produced no result`,BatchEndedWithoutResult:"Batch ended without a result",ScaleInvalid:e=>`Scale must be a positive finite number, got: ${e}`,MaxWidthInvalid:e=>`maxWidth must be a positive finite number, got: ${e}`,MaxHeightInvalid:e=>`maxHeight must be a positive finite number, got: ${e}`,TargetSizeTooLarge:(e,t,n)=>`Target image size ${e}x${t} exceeds the maximum supported dimension of ${n}px`,BlobToBase64Failed:"Failed to convert Blob to base64 string",BlobToBase64FailedWithCause:e=>`Failed to convert Blob to base64 string: ${e}`,CanvasToBlobFailed:e=>`Failed to convert canvas to blob (type: ${e})`,CanvasUnsupported:"Canvas is not supported in the current environment. In a browser this requires OffscreenCanvas or HTMLCanvasElement. In Node.js there is no canvas: decode raw RGBA with LibheifDecoder and encode externally (see the Node.js section of the README).",InvalidDimensions:(e,t)=>`Invalid image dimensions: ${e}x${t}. Width and height must be positive integers.`,DataLengthMismatch:(e,t,n,i)=>`Image data length mismatch. Expected ${e} bytes for ${t}x${n}, got ${i}`,ContextUnavailable:"Failed to acquire 2D rendering context from canvas",UnsupportedFormat:e=>`Unsupported output format: ${e}`,FormatUnsupported:e=>`The current environment cannot encode '${e}' — canvas encoding produced no '${e}' image (e.g. AVIF encoding is not supported in this browser). Try 'jpeg', 'png', or 'webp' instead.`,CropInvalid:(e,t)=>`crop.${e} must be ${"width"===e||"height"===e?"a positive integer":"a non-negative integer"}, got: ${t}`,CropOutOfBounds:(e,t,n,i,o,r)=>`crop ${n}x${i} at (${e}, ${t}) exceeds the ${o}x${r} image (crop coordinates are in post-orientation display pixels)`,DecoderFreedDuringDecode:"Decoder was freed before decoding completed; call initialize() again.",DecodeInputAllocFailed:e=>`Failed to allocate ${e} bytes in the WASM heap for decode input`,DecodeFailed:e=>`HEIC decoding failed (no result returned; input: ${e} bytes — is the file truncated or empty?)`,DecodeFailedWithDetail:(e,t)=>`HEIC decoding failed: ${e} (input: ${t} bytes)`,DecodeFaulted:e=>`Decoder faulted on a ${e}-byte image (out of memory, or a corrupted WebAssembly instance); retry — a faulted pooled decoder is discarded, not reused`,ProgressCallbackThrew:e=>`onProgress callback threw during decode: ${e}`};function t(e){const t=Number(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}var n=class extends Error{code;itemIndex;itemTotal;failedCount;constructor(e,t,n){super(t,{cause:n?.cause}),this.name="HeicConverterError",this.code=e,void 0!==n?.itemIndex&&(this.itemIndex=n.itemIndex),void 0!==n?.itemTotal&&(this.itemTotal=n.itemTotal),void 0!==n?.failedCount&&(this.failedCount=n.failedCount)}},i=["jpeg","jpg","png","svg","webp","avif"],o=.92;function r(t){u(t?.to??"jpeg"),void 0!==t?.quality&&function(t){if("number"!=typeof t||!Number.isFinite(t)||t<0||t>1)throw new n("invalid_quality",e.QualityInvalid(t))}(t.quality),function(t){if(void 0!==t&&"boolean"!=typeof t)throw new n("invalid_input",e.ApplyOrientationInvalid(t))}(t?.applyOrientation),function(t){if(void 0!==t&&"blob"!==t&&"dataUrl"!==t&&"arrayBuffer"!==t)throw new n("invalid_input",e.OutputShapeInvalid(t))}(t?.output),function(t){if(void 0!==t&&("object"!=typeof t||null===t||"function"!=typeof t.addEventListener))throw new n("invalid_input",e.SignalInvalid(t))}(t?.signal),f(t?.crop),function(t){if(void 0!==t&&"boolean"!=typeof t)throw new n("invalid_input",e.PreserveExifInvalid(t))}(t?.preserveExif),c(void 0!==t?.maxWidth||void 0!==t?.maxHeight||void 0!==t?.scale?t:void 0)}function a(t){s(t?.continueOnError),function(t){if(void 0!==t&&"boolean"!=typeof t)throw new n("invalid_input",e.ReuseDecodersInvalid(t))}(t?.reuseDecoders)}function d(t){if(!Number.isInteger(t)||t<1)throw new n("invalid_concurrency",e.ConcurrencyInvalid(t))}function s(t){if(void 0!==t&&"boolean"!=typeof t)throw new n("invalid_input",e.ContinueOnErrorInvalid(t))}function l(t){if(t?.aborted)throw new n("aborted",e.Aborted)}function u(t){const o=String(t).toLowerCase();if(!i.includes(o))throw new n("invalid_format",e.UnsupportedFormat(String(t)))}function c(t){if(!t)return;const{maxWidth:i,maxHeight:o,scale:r}=t;if(void 0!==r&&("number"!=typeof r||!Number.isFinite(r)||r<=0))throw new n("invalid_resize",e.ScaleInvalid(r));if(void 0!==i&&("number"!=typeof i||!Number.isFinite(i)||i<=0))throw new n("invalid_resize",e.MaxWidthInvalid(i));if(void 0!==o&&("number"!=typeof o||!Number.isFinite(o)||o<=0))throw new n("invalid_resize",e.MaxHeightInvalid(o))}function f(t){if(!t)return;const{x:i=0,y:o=0,width:r,height:a}=t;if(!Number.isInteger(r)||r<=0)throw new n("invalid_crop",e.CropInvalid("width",r));if(!Number.isInteger(a)||a<=0)throw new n("invalid_crop",e.CropInvalid("height",a));if(!Number.isInteger(i)||i<0)throw new n("invalid_crop",e.CropInvalid("x",i));if(!Number.isInteger(o)||o<0)throw new n("invalid_crop",e.CropInvalid("y",o))}function h(e,t){return Math.min(e,t)}async function v(t,i,o,r){const a=!0===r?.continueOnError,d=r?.signal,s=new Array(t.length);let l=0,u=!1,c=0,f=null,v=-1,p=0;const m=[];let g;const b=new Promise(e=>{g=e}),w=()=>g?.();d&&!a&&d.addEventListener("abort",w,{once:!0});const y=h(i,t.length),I=Array.from({length:y},()=>(async()=>{for(;!u&&!d?.aborted||a;){const i=l;if(l+=1,i>=t.length)return;if(a&&d?.aborted){const o=new n("aborted",e.Aborted);for(let e=i;e<t.length;e++)s[e]={index:e,ok:!1,error:o};return void(l=t.length)}try{const e=await o(t[i],i);s[i]={index:i,ok:!0,result:e},c+=1}catch(e){if(p+=1,a){s[i]={index:i,ok:!1,error:e instanceof Error?e:new Error(String(e))};continue}u?m.length<2&&m.push(e instanceof Error?e.message:String(e)):(u=!0,f=e,v=i,g?.())}}})());try{if(a)return await Promise.all(I),s;if(await Promise.race([Promise.all(I),b]),c===t.length)return s.map(t=>{if(!t||!t.ok)throw new n("batch_item_failed",e.BatchItemProducedNoResult(t?.index));return t.result});if(d?.aborted)throw new n("aborted",e.Aborted);if(u){const i=f instanceof Error?f.message:String(f);let o=e.ConvertManyItemFailed(v+1,t.length,i);throw p>1&&(o+=e.ConvertManyExtraFailures(p,t.length),m.length>0&&(o+=e.ConvertManyOtherErrors(m))),new n("batch_item_failed",o,{cause:f,itemIndex:v,itemTotal:t.length,failedCount:p})}throw new n("batch_item_failed",e.BatchEndedWithoutResult)}finally{d?.removeEventListener("abort",w)}}export{o as DEFAULT_QUALITY,n as HeicConverterError,e as Messages,i as SUPPORTED_FORMATS,t as clampPercent,v as runBoundedBatch,h as runnerCountFor,l as throwIfAborted,a as validateBatchOptions,d as validateConcurrency,s as validateContinueOnError,r as validateConvertOptions,f as validateCrop,u as validateFormat,c as validateResize};
@@ -1 +0,0 @@
1
- var t,r=(t=import.meta.url,async function(r={}){var e,n,a=r;a.ready=new Promise((t,r)=>{e=t,n=r});var i,o,s=Object.assign({},a),u="./this.program",l="object"==typeof window,c="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:t}=await(import("module"));var d=t(import.meta.url),p=d("fs"),y=d("path");f=c?y.dirname(f)+"/":d("url").fileURLToPath(new URL("./",import.meta.url)),i=(t,r)=>(t=V(t)?new URL(t):y.normalize(t),p.readFileSync(t,r?void 0:"utf8")),o=t=>{var r=i(t,!0);return r.buffer||(r=new Uint8Array(r)),r},!a.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(l||c)&&(c?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),t&&(f=t),f=f.startsWith("blob:")?"":f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1),i=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.send(null),r.responseText},c&&(o=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}));var v,m,g=a.print||console.log.bind(console),$=a.printErr||console.error.bind(console);Object.assign(a,s),s=null,a.arguments&&a.arguments,a.thisProgram&&(u=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(v=a.wasmBinary);var w,b,_,C,P,T,A,j,F=!1;function S(){var t=m.buffer;a.HEAP8=w=new Int8Array(t),a.HEAP16=_=new Int16Array(t),a.HEAPU8=b=new Uint8Array(t),a.HEAPU16=C=new Uint16Array(t),a.HEAP32=P=new Int32Array(t),a.HEAPU32=T=new Uint32Array(t),a.HEAPF32=A=new Float32Array(t),a.HEAPF64=j=new Float64Array(t)}var O=[],E=[],D=[];function W(t){O.unshift(t)}function R(t){D.unshift(t)}var k=0,M=null;function x(t){a.onAbort?.(t),$(t="Aborted("+t+")"),F=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw n(r),r}var H,U,I=t=>t.startsWith("data:application/octet-stream;base64,"),V=t=>t.startsWith("file://");function Y(t){if(t==H&&v)return new Uint8Array(v);if(o)return o(t);throw"both async and sync fetching of the wasm failed"}function L(t,r,e){return function(t){return v||!l&&!c||"function"!=typeof fetch?Promise.resolve().then(()=>Y(t)):fetch(t,{credentials:"same-origin"}).then(r=>{if(!r.ok)throw`failed to load wasm binary file at '${t}'`;return r.arrayBuffer()}).catch(()=>Y(t))}(t).then(t=>WebAssembly.instantiate(t,r)).then(e,t=>{$(`failed to asynchronously prepare wasm: ${t}`),x(t)})}a.locateFile?I(H="heic-decoder.wasm")||(U=H,H=a.locateFile?a.locateFile(U,f):f+U):H=new URL("heic-decoder.wasm",import.meta.url).href;var z=t=>{for(;t.length>0;)t.shift()(a)};a.noExitRuntime;var B="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,G=(t,r,e)=>{for(var n=r+e,a=r;t[a]&&!(a>=n);)++a;if(a-r>16&&t.buffer&&B)return B.decode(t.subarray(r,a));for(var i="";r<a;){var o=t[r++];if(128&o){var s=63&t[r++];if(192!=(224&o)){var u=63&t[r++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&t[r++])<65536)i+=String.fromCharCode(o);else{var l=o-65536;i+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else i+=String.fromCharCode((31&o)<<6|s)}else i+=String.fromCharCode(o)}return i},q=(t,r)=>t?G(b,t,r):"",N=[],J=0,X=0;class Z{constructor(t){this.excPtr=t,this.ptr=t-24}set_type(t){T[this.ptr+4>>2]=t}get_type(){return T[this.ptr+4>>2]}set_destructor(t){T[this.ptr+8>>2]=t}get_destructor(){return T[this.ptr+8>>2]}set_caught(t){t=t?1:0,w[this.ptr+12]=t}get_caught(){return 0!=w[this.ptr+12]}set_rethrown(t){t=t?1:0,w[this.ptr+13]=t}get_rethrown(){return 0!=w[this.ptr+13]}init(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r)}set_adjusted_ptr(t){T[this.ptr+16>>2]=t}get_adjusted_ptr(){return T[this.ptr+16>>2]}get_exception_ptr(){if(Wr(this.get_type()))return T[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var K,Q,tt,rt=t=>{var r=X;if(!r)return jr(0),0;var e=new Z(r);e.set_adjusted_ptr(r);var n=e.get_type();if(!n)return jr(0),r;for(var a in t){var i=t[a];if(0===i||i===n)break;var o=e.ptr+16;if(Dr(i,n,o))return jr(i),r}return jr(n),r},et=t=>{for(var r="",e=t;b[e];)r+=K[b[e++]];return r},nt={},at={},it={},ot=t=>{throw new Q(t)},st=t=>{throw new tt(t)},ut=(t,r,e)=>{function n(r){var n=e(r);n.length!==t.length&&st("Mismatched type converter count");for(var a=0;a<t.length;++a)lt(t[a],n[a])}t.forEach(function(t){it[t]=r});var a=new Array(r.length),i=[],o=0;r.forEach((t,r)=>{at.hasOwnProperty(t)?a[r]=at[t]:(i.push(t),nt.hasOwnProperty(t)||(nt[t]=[]),nt[t].push(()=>{a[r]=at[t],++o===i.length&&n(a)}))}),0===i.length&&n(a)};function lt(t,r,e={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,r,e={}){var n=r.name;if(t||ot(`type "${n}" must have a positive integer typeid pointer`),at.hasOwnProperty(t)){if(e.ignoreDuplicateRegistrations)return;ot(`Cannot register type '${n}' twice`)}if(at[t]=r,delete it[t],nt.hasOwnProperty(t)){var a=nt[t];delete nt[t],a.forEach(t=>t())}}(t,r,e)}var ct,ht=t=>{ot(t.$$.ptrType.registeredClass.name+" instance already deleted")},ft=!1,dt=t=>{},pt=t=>{t.count.value-=1,0===t.count.value&&(t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)})(t)},yt=(t,r,e)=>{if(r===e)return t;if(void 0===e.baseClass)return null;var n=yt(t,r,e.baseClass);return null===n?null:e.downcast(n)},vt={},mt=[],gt=()=>{for(;mt.length;){var t=mt.pop();t.$$.deleteScheduled=!1,t.delete()}},$t={},wt=(t,r)=>(r.ptrType&&r.ptr||st("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!=!!r.smartPtr&&st("Both smartPtrType and smartPtr must be specified"),r.count={value:1},bt(Object.create(t,{$$:{value:r,writable:!0}}))),bt=t=>"undefined"==typeof FinalizationRegistry?(bt=t=>t,t):(ft=new FinalizationRegistry(t=>{pt(t.$$)}),dt=t=>ft.unregister(t),(bt=t=>{var r=t.$$;if(r.smartPtr){var e={$$:r};ft.register(t,e,t)}return t})(t));function _t(){}var Ct=(t,r)=>Object.defineProperty(r,"name",{value:t}),Pt=(t,r,e)=>{if(void 0===t[r].overloadTable){var n=t[r];t[r]=function(...n){return t[r].overloadTable.hasOwnProperty(n.length)||ot(`Function '${e}' called with an invalid number of arguments (${n.length}) - expects one of (${t[r].overloadTable})!`),t[r].overloadTable[n.length].apply(this,n)},t[r].overloadTable=[],t[r].overloadTable[n.argCount]=n}};function Tt(t,r,e,n,a,i,o,s){this.name=t,this.constructor=r,this.instancePrototype=e,this.rawDestructor=n,this.baseClass=a,this.getActualType=i,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var At=(t,r,e)=>{for(;r!==e;)r.upcast||ot(`Expected null or instance of ${e.name}, got an instance of ${r.name}`),t=r.upcast(t),r=r.baseClass;return t};function jt(t,r){if(null===r)return this.isReference&&ot(`null is not a valid ${this.name}`),0;r.$$||ot(`Cannot pass "${Jt(r)}" as a ${this.name}`),r.$$.ptr||ot(`Cannot pass deleted object as a pointer of type ${this.name}`);var e=r.$$.ptrType.registeredClass;return At(r.$$.ptr,e,this.registeredClass)}function Ft(t,r){var e;if(null===r)return this.isReference&&ot(`null is not a valid ${this.name}`),this.isSmartPointer?(e=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,e),e):0;r&&r.$$||ot(`Cannot pass "${Jt(r)}" as a ${this.name}`),r.$$.ptr||ot(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&ot(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(e=At(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===r.$$.smartPtr&&ot("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?e=r.$$.smartPtr:ot(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:e=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)e=r.$$.smartPtr;else{var a=r.clone();e=this.rawShare(e,qt.toHandle(()=>a.delete())),null!==t&&t.push(this.rawDestructor,e)}break;default:ot("Unsupporting sharing policy")}return e}function St(t,r){if(null===r)return this.isReference&&ot(`null is not a valid ${this.name}`),0;r.$$||ot(`Cannot pass "${Jt(r)}" as a ${this.name}`),r.$$.ptr||ot(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&ot(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var e=r.$$.ptrType.registeredClass;return At(r.$$.ptr,e,this.registeredClass)}function Ot(t){return this.fromWireType(T[t>>2])}function Et(t,r,e,n,a,i,o,s,u,l,c){this.name=t,this.registeredClass=r,this.isReference=e,this.isConst=n,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==r.baseClass?this.toWireType=Ft:n?(this.toWireType=jt,this.destructorFunction=null):(this.toWireType=St,this.destructorFunction=null)}var Dt,Wt,Rt=[],kt=t=>{var r=Rt[t];return r||(t>=Rt.length&&(Rt.length=t+1),Rt[t]=r=Dt.get(t)),r},Mt=(t,r)=>{var e,n,i=(t=et(t)).includes("j")?(e=t,n=r,(...t)=>((t,r,e=[])=>t.includes("j")?((t,r,e)=>(0,a["dynCall_"+t])(r,...e))(t,r,e):kt(r)(...e))(e,n,t)):kt(r);return"function"!=typeof i&&ot(`unknown function pointer with signature ${t}: ${r}`),i},xt=t=>{var r=Tr(t),e=et(r);return Pr(r),e},Ht=(t,r)=>{var e=[],n={};throw r.forEach(function t(r){n[r]||at[r]||(it[r]?it[r].forEach(t):(e.push(r),n[r]=!0))}),new Wt(`${t}: `+e.map(xt).join([", "]))},Ut=(t,r)=>{for(var e=[],n=0;n<t;n++)e.push(T[r+4*n>>2]);return e},It=t=>{for(;t.length;){var r=t.pop();t.pop()(r)}};function Vt(t,r,e,n,a,i){var o=r.length;o<2&&ot("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==r[1]&&null!==e,u=function(t){for(var r=1;r<t.length;++r)if(null!==t[r]&&void 0===t[r].destructorFunction)return!0;return!1}(r),l="void"!==r[0].name,c=o-2,h=new Array(c),f=[],d=[];return Ct(t,function(...e){var i;e.length!==c&&ot(`function ${t} called with ${e.length} arguments, expected ${c}`),d.length=0,f.length=s?2:1,f[0]=a,s&&(i=r[1].toWireType(d,this),f[1]=i);for(var o=0;o<c;++o)h[o]=r[o+2].toWireType(d,e[o]),f.push(h[o]);return function(t){if(u)It(d);else for(var e=s?1:2;e<r.length;e++){var n=1===e?i:h[e-2];null!==r[e].destructorFunction&&r[e].destructorFunction(n)}if(l)return r[0].fromWireType(t)}(n(...f))})}var Yt,Lt,zt=[],Bt=[],Gt=t=>{t>9&&0===--Bt[t+1]&&(Bt[t]=void 0,zt.push(t))},qt={toValue:t=>(t||ot("Cannot use deleted val. handle = "+t),Bt[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=zt.pop()||Bt.length;return Bt[r]=t,Bt[r+1]=1,r}}}},Nt={name:"emscripten::val",fromWireType:t=>{var r=qt.toValue(t);return Gt(t),r},toWireType:(t,r)=>qt.toHandle(r),argPackAdvance:8,readValueFromPointer:Ot,destructorFunction:null},Jt=t=>{if(null===t)return"null";var r=typeof t;return"object"===r||"array"===r||"function"===r?t.toString():""+t},Xt=(t,r)=>{switch(r){case 4:return function(t){return this.fromWireType(A[t>>2])};case 8:return function(t){return this.fromWireType(j[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${t}`)}},Zt=(t,r,e)=>{switch(r){case 1:return e?t=>w[t]:t=>b[t];case 2:return e?t=>_[t>>1]:t=>C[t>>1];case 4:return e?t=>P[t>>2]:t=>T[t>>2];default:throw new TypeError(`invalid integer width (${r}): ${t}`)}},Kt=(t,r,e,n)=>{if(!(n>0))return 0;for(var a=e,i=e+n-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o)),s<=127){if(e>=i)break;r[e++]=s}else if(s<=2047){if(e+1>=i)break;r[e++]=192|s>>6,r[e++]=128|63&s}else if(s<=65535){if(e+2>=i)break;r[e++]=224|s>>12,r[e++]=128|s>>6&63,r[e++]=128|63&s}else{if(e+3>=i)break;r[e++]=240|s>>18,r[e++]=128|s>>12&63,r[e++]=128|s>>6&63,r[e++]=128|63&s}}return r[e]=0,e-a},Qt=t=>{for(var r=0,e=0;e<t.length;++e){var n=t.charCodeAt(e);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++e):r+=3}return r},tr="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,rr=(t,r)=>{for(var e=t,n=e>>1,a=n+r/2;!(n>=a)&&C[n];)++n;if((e=n<<1)-t>32&&tr)return tr.decode(b.subarray(t,e));for(var i="",o=0;!(o>=r/2);++o){var s=_[t+2*o>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},er=(t,r,e)=>{if(e??=2147483647,e<2)return 0;for(var n=r,a=(e-=2)<2*t.length?e/2:t.length,i=0;i<a;++i){var o=t.charCodeAt(i);_[r>>1]=o,r+=2}return _[r>>1]=0,r-n},nr=t=>2*t.length,ar=(t,r)=>{for(var e=0,n="";!(e>=r/4);){var a=P[t+4*e>>2];if(0==a)break;if(++e,a>=65536){var i=a-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(a)}return n},ir=(t,r,e)=>{if(e??=2147483647,e<4)return 0;for(var n=r,a=n+e-4,i=0;i<t.length;++i){var o=t.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),P[r>>2]=o,(r+=4)+4>a)break}return P[r>>2]=0,r-n},or=t=>{for(var r=0,e=0;e<t.length;++e){var n=t.charCodeAt(e);n>=55296&&n<=57343&&++e,r+=4}return r},sr=[],ur={},lr=t=>{var r=ur[t];return void 0===r?et(t):r},cr=()=>{if("object"==typeof globalThis)return globalThis;function t(t){t.$$$embind_global$$$=t;var r="object"==typeof $$$embind_global$$$&&t.$$$embind_global$$$==t;return r||delete t.$$$embind_global$$$,r}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof global&&t(global)?$$$embind_global$$$=global:"object"==typeof self&&t(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},hr=(t,r)=>{var e=at[t];return void 0===e&&ot(`${r} has unknown type ${xt(t)}`),e},fr=Reflect.construct,dr=t=>{var r=(t-m.buffer.byteLength+65535)/65536;try{return m.grow(r),S(),1}catch(t){}},pr={},yr=()=>{if(!yr.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in pr)void 0===pr[r]?delete t[r]:t[r]=pr[r];var e=[];for(var r in t)e.push(`${r}=${t[r]}`);yr.strings=e}return yr.strings},vr=[null,[],[]],mr=(t,r)=>{var e=vr[t];0===r||10===r?((1===t?g:$)(G(e,0)),e.length=0):e.push(r)},gr=t=>t%4==0&&(t%100!=0||t%400==0),$r=[31,29,31,30,31,30,31,31,30,31,30,31],wr=[31,28,31,30,31,30,31,31,30,31,30,31];(()=>{for(var t=new Array(256),r=0;r<256;++r)t[r]=String.fromCharCode(r);K=t})(),Q=a.BindingError=class extends Error{constructor(t){super(t),this.name="BindingError"}},tt=a.InternalError=class extends Error{constructor(t){super(t),this.name="InternalError"}},Object.assign(_t.prototype,{isAliasOf(t){if(!(this instanceof _t))return!1;if(!(t instanceof _t))return!1;var r=this.$$.ptrType.registeredClass,e=this.$$.ptr;t.$$=t.$$;for(var n=t.$$.ptrType.registeredClass,a=t.$$.ptr;r.baseClass;)e=r.upcast(e),r=r.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return r===n&&e===a},clone(){if(this.$$.ptr||ht(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,r=bt(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r},delete(){this.$$.ptr||ht(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ot("Object already scheduled for deletion"),dt(this),pt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ht(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ot("Object already scheduled for deletion"),mt.push(this),1===mt.length&&ct&&ct(gt),this.$$.deleteScheduled=!0,this}}),a.getInheritedInstanceCount=()=>Object.keys($t).length,a.getLiveInheritedInstances=()=>{var t=[];for(var r in $t)$t.hasOwnProperty(r)&&t.push($t[r]);return t},a.flushPendingDeletes=gt,a.setDelayFunction=t=>{ct=t,mt.length&&ct&&ct(gt)},Object.assign(Et.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},argPackAdvance:8,readValueFromPointer:Ot,fromWireType:function(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var e=((t,r)=>(r=((t,r)=>{for(void 0===r&&ot("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r})(t,r),$t[r]))(this.registeredClass,r);if(void 0!==e){if(0===e.$$.count.value)return e.$$.ptr=r,e.$$.smartPtr=t,e.clone();var n=e.clone();return this.destructor(t),n}function a(){return this.isSmartPointer?wt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):wt(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,o=this.registeredClass.getActualType(r),s=vt[o];if(!s)return a.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=yt(r,this.registeredClass,i.registeredClass);return null===u?a.call(this):this.isSmartPointer?wt(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:t}):wt(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}}),Wt=a.UnboundTypeError=(Yt=Error,(Lt=Ct("UnboundTypeError",function(t){this.name="UnboundTypeError",this.message=t;var r=new Error(t).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))})).prototype=Object.create(Yt.prototype),Lt.prototype.constructor=Lt,Lt.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Lt),Bt.push(0,1,void 0,1,null,1,!0,1,!1,1),a.count_emval_handles=()=>Bt.length/2-5-zt.length;var br={b:(t,r,e,n)=>{x(`Assertion failed: ${q(t)}, at: `+[r?q(r):"unknown filename",e,n?q(n):"unknown function"])},o:t=>{var r=new Z(t);return r.get_caught()||(r.set_caught(!0),J--),r.set_rethrown(!1),N.push(r),Er(r.excPtr),r.get_exception_ptr()},p:()=>{Ar(0,0);var t=N.pop();Or(t.excPtr),X=0},a:()=>rt([]),g:t=>rt([t]),L:()=>{var t=N.pop();t||x("no exception to throw");var r=t.excPtr;throw t.get_rethrown()||(N.push(t),t.set_rethrown(!0),t.set_caught(!1),J++),X=r},q:(t,r,e)=>{throw new Z(t).init(r,e),J++,X=t},$:()=>J,e:t=>{throw X||(X=t),X},ba:(t,r,e)=>{},Y:(t,r,e,n,a)=>{},ia:(t,r,e,n)=>{lt(t,{name:r=et(r),fromWireType:function(t){return!!t},toWireType:function(t,r){return r?e:n},argPackAdvance:8,readValueFromPointer:function(t){return this.fromWireType(b[t])},destructorFunction:null})},T:(t,r,e,n,i,o,s,u,l,c,h,f,d)=>{h=et(h),o=Mt(i,o),u&&=Mt(s,u),c&&=Mt(l,c),d=Mt(f,d);var p=(t=>{if(void 0===t)return"_unknown";var r=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=48&&r<=57?`_${t}`:t})(h);((t,r)=>{a.hasOwnProperty(t)?(ot(`Cannot register public name '${t}' twice`),Pt(a,t,t),a.hasOwnProperty(void 0)&&ot("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),a[t].overloadTable[void 0]=r):a[t]=r})(p,function(){Ht(`Cannot construct ${h} due to unbound types`,[n])}),ut([t,r,e],n?[n]:[],r=>{var e,i;r=r[0],i=n?(e=r.registeredClass).instancePrototype:_t.prototype;var s=Ct(h,function(...t){if(Object.getPrototypeOf(this)!==l)throw new Q("Use 'new' to construct "+h);if(void 0===f.constructor_body)throw new Q(h+" has no accessible constructor");var r=f.constructor_body[t.length];if(void 0===r)throw new Q(`Tried to invoke ctor of ${h} with invalid number of parameters (${t.length}) - expected (${Object.keys(f.constructor_body).toString()}) parameters instead!`);return r.apply(this,t)}),l=Object.create(i,{constructor:{value:s}});s.prototype=l;var f=new Tt(h,s,l,d,e,o,u,c);f.baseClass&&(f.baseClass.__derivedClasses??=[],f.baseClass.__derivedClasses.push(f));var y=new Et(h,f,!0,!1,!1),v=new Et(h+"*",f,!1,!1,!1),m=new Et(h+" const*",f,!1,!0,!1);return vt[t]={pointerType:v,constPointerType:m},((t,r)=>{a.hasOwnProperty(t)||st("Replacing nonexistent public symbol"),a[t].overloadTable,a[t]=r,a[t].argCount=void 0})(p,s),[y,v,m]})},S:(t,r,e,n,a,i)=>{var o=Ut(r,e);a=Mt(n,a),ut([],[t],t=>{var e=`constructor ${(t=t[0]).name}`;if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[r-1])throw new Q(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${t.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return t.registeredClass.constructor_body[r-1]=()=>{Ht(`Cannot construct ${t.name} due to unbound types`,o)},ut([],o,n=>(n.splice(1,0,null),t.registeredClass.constructor_body[r-1]=Vt(e,n,null,a,i),[])),[]})},B:(t,r,e,n,a,i,o,s,u)=>{var l=Ut(e,n);r=(t=>{const r=(t=t.trim()).indexOf("(");return-1!==r?t.substr(0,r):t})(r=et(r)),i=Mt(a,i),ut([],[t],t=>{var n=`${(t=t[0]).name}.${r}`;function a(){Ht(`Cannot call ${n} due to unbound types`,l)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(r);var u=t.registeredClass.instancePrototype,c=u[r];return void 0===c||void 0===c.overloadTable&&c.className!==t.name&&c.argCount===e-2?(a.argCount=e-2,a.className=t.name,u[r]=a):(Pt(u,r,n),u[r].overloadTable[e-2]=a),ut([],l,a=>{var s=Vt(n,a,t,i,o);return void 0===u[r].overloadTable?(s.argCount=e-2,u[r]=s):u[r].overloadTable[e-2]=s,[]}),[]})},ha:t=>lt(t,Nt),O:(t,r,e)=>{lt(t,{name:r=et(r),fromWireType:t=>t,toWireType:(t,r)=>r,argPackAdvance:8,readValueFromPointer:Xt(r,e),destructorFunction:null})},s:(t,r,e,n,a)=>{r=et(r);var i=t=>t;if(0===n){var o=32-8*e;i=t=>t<<o>>>o}var s=r.includes("unsigned");lt(t,{name:r,fromWireType:i,toWireType:s?function(t,r){return this.name,r>>>0}:function(t,r){return this.name,r},argPackAdvance:8,readValueFromPointer:Zt(r,e,0!==n),destructorFunction:null})},n:(t,r,e)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function a(t){var r=T[t>>2],e=T[t+4>>2];return new n(w.buffer,e,r)}lt(t,{name:e=et(e),fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},N:(t,r)=>{var e="std::string"===(r=et(r));lt(t,{name:r,fromWireType(t){var r,n=T[t>>2],a=t+4;if(e)for(var i=a,o=0;o<=n;++o){var s=a+o;if(o==n||0==b[s]){var u=q(i,s-i);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),i=s+1}}else{var l=new Array(n);for(o=0;o<n;++o)l[o]=String.fromCharCode(b[a+o]);r=l.join("")}return Pr(t),r},toWireType(t,r){var n;r instanceof ArrayBuffer&&(r=new Uint8Array(r));var a="string"==typeof r;a||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||ot("Cannot pass non-string to std::string"),n=e&&a?Qt(r):r.length;var i=Cr(4+n+1),o=i+4;if(T[i>>2]=n,e&&a)Kt(r,b,o,n+1);else if(a)for(var s=0;s<n;++s){var u=r.charCodeAt(s);u>255&&(Pr(o),ot("String has UTF-16 code units that do not fit in 8 bits")),b[o+s]=u}else for(s=0;s<n;++s)b[o+s]=r[s];return null!==t&&t.push(Pr,i),i},argPackAdvance:8,readValueFromPointer:Ot,destructorFunction(t){Pr(t)}})},E:(t,r,e)=>{var n,a,i,o;e=et(e),2===r?(n=rr,a=er,o=nr,i=t=>C[t>>1]):4===r&&(n=ar,a=ir,o=or,i=t=>T[t>>2]),lt(t,{name:e,fromWireType:t=>{for(var e,a=T[t>>2],o=t+4,s=0;s<=a;++s){var u=t+4+s*r;if(s==a||0==i(u)){var l=n(o,u-o);void 0===e?e=l:(e+=String.fromCharCode(0),e+=l),o=u+r}}return Pr(t),e},toWireType:(t,n)=>{"string"!=typeof n&&ot(`Cannot pass non-string to C++ string type ${e}`);var i=o(n),s=Cr(4+i+r);return T[s>>2]=i/r,a(n,s+4,i+r),null!==t&&t.push(Pr,s),s},argPackAdvance:8,readValueFromPointer:Ot,destructorFunction(t){Pr(t)}})},ja:(t,r)=>{lt(t,{isVoid:!0,name:r=et(r),argPackAdvance:0,fromWireType:()=>{},toWireType:(t,r)=>{}})},F:(t,r,e,n)=>(t=sr[t])(null,r=qt.toValue(r),e,n),P:(t,r,e,n,a)=>(t=sr[t])(r=qt.toValue(r),r[e=lr(e)],n,a),U:Gt,ma:t=>0===t?qt.toHandle(cr()):(t=lr(t),qt.toHandle(cr()[t])),x:(t,r,e)=>{var n=((t,r)=>{for(var e=new Array(t),n=0;n<t;++n)e[n]=hr(T[r+4*n>>2],"parameter "+n);return e})(t,r),a=n.shift();t--;var i,o,s=new Array(t),u=`methodCaller<(${n.map(t=>t.name).join(", ")}) => ${a.name}>`;return i=Ct(u,(r,i,o,u)=>{for(var l=0,c=0;c<t;++c)s[c]=n[c].readValueFromPointer(u+l),l+=n[c].argPackAdvance;var h=1===e?fr(i,s):i.apply(r,s);return((t,r,e)=>{var n=[],a=t.toWireType(n,e);return n.length&&(T[r>>2]=qt.toHandle(n)),a})(a,o,h)}),o=sr.length,sr.push(i),o},Q:t=>{t>9&&(Bt[t+1]+=1)},w:t=>qt.toHandle(lr(t)),la:()=>qt.toHandle({}),oa:t=>{var r=qt.toValue(t);It(r),Gt(t)},ka:(t,r,e)=>{t=qt.toValue(t),r=qt.toValue(r),e=qt.toValue(e),t[r]=e},G:(t,r)=>{var e=(t=hr(t,"_emval_take_value")).readValueFromPointer(r);return qt.toHandle(e)},C:()=>{x("")},ga:(t,r,e)=>b.copyWithin(t,r,r+e),aa:t=>{var r=b.length,e=2147483648;if((t>>>=0)>e)return!1;for(var n=(t,r)=>t+(r-t%r)%r,a=1;a<=4;a*=2){var i=r*(1+.2/a);i=Math.min(i,t+100663296);var o=Math.min(e,n(Math.max(t,i),65536));if(dr(o))return!0}return!1},ea:(t,r)=>{var e=0;return yr().forEach((n,a)=>{var i=r+e;T[t+4*a>>2]=i,((t,r)=>{for(var e=0;e<t.length;++e)w[r++]=t.charCodeAt(e);w[r]=0})(n,i),e+=n.length+1}),0},fa:(t,r)=>{var e=yr();T[t>>2]=e.length;var n=0;return e.forEach(t=>n+=t.length+1),T[r>>2]=n,0},ca:t=>52,da:(t,r,e,n)=>52,X:function(t,r,e,n,a){return 70},M:(t,r,e,n)=>{for(var a=0,i=0;i<e;i++){var o=T[r>>2],s=T[r+4>>2];r+=8;for(var u=0;u<s;u++)mr(t,b[o+u]);a+=s}return T[n>>2]=a,0},H:function(t,r,e,n){var a=Fr();try{return kt(t)(r,e,n)}catch(t){if(Sr(a),t!==t+0)throw t;Ar(1,0)}},R:function(t,r,e,n,a){var i=Fr();try{return kt(t)(r,e,n,a)}catch(t){if(Sr(i),t!==t+0)throw t;Ar(1,0)}},I:function(t,r,e,n){var a=Fr();try{return kt(t)(r,e,n)}catch(t){if(Sr(a),t!==t+0)throw t;Ar(1,0)}},m:function(t){var r=Fr();try{return kt(t)()}catch(t){if(Sr(r),t!==t+0)throw t;Ar(1,0)}},c:function(t,r){var e=Fr();try{return kt(t)(r)}catch(t){if(Sr(e),t!==t+0)throw t;Ar(1,0)}},f:function(t,r,e){var n=Fr();try{return kt(t)(r,e)}catch(t){if(Sr(n),t!==t+0)throw t;Ar(1,0)}},l:function(t,r,e,n){var a=Fr();try{return kt(t)(r,e,n)}catch(t){if(Sr(a),t!==t+0)throw t;Ar(1,0)}},j:function(t,r,e,n,a){var i=Fr();try{return kt(t)(r,e,n,a)}catch(t){if(Sr(i),t!==t+0)throw t;Ar(1,0)}},K:function(t,r,e,n,a,i){var o=Fr();try{return kt(t)(r,e,n,a,i)}catch(t){if(Sr(o),t!==t+0)throw t;Ar(1,0)}},u:function(t,r,e,n,a,i){var o=Fr();try{return kt(t)(r,e,n,a,i)}catch(t){if(Sr(o),t!==t+0)throw t;Ar(1,0)}},t:function(t,r,e,n,a,i,o){var s=Fr();try{return kt(t)(r,e,n,a,i,o)}catch(t){if(Sr(s),t!==t+0)throw t;Ar(1,0)}},J:function(t,r,e,n,a,i,o,s){var u=Fr();try{return kt(t)(r,e,n,a,i,o,s)}catch(t){if(Sr(u),t!==t+0)throw t;Ar(1,0)}},A:function(t,r,e,n,a,i,o,s,u,l,c,h){var f=Fr();try{return kt(t)(r,e,n,a,i,o,s,u,l,c,h)}catch(t){if(Sr(f),t!==t+0)throw t;Ar(1,0)}},W:function(t,r,e,n,a,i,o){var s=Fr();try{return kr(t,r,e,n,a,i,o)}catch(t){if(Sr(s),t!==t+0)throw t;Ar(1,0)}},V:function(t,r,e,n,a){var i=Fr();try{return xr(t,r,e,n,a)}catch(t){if(Sr(i),t!==t+0)throw t;Ar(1,0)}},i:function(t){var r=Fr();try{kt(t)()}catch(t){if(Sr(r),t!==t+0)throw t;Ar(1,0)}},h:function(t,r){var e=Fr();try{kt(t)(r)}catch(t){if(Sr(e),t!==t+0)throw t;Ar(1,0)}},d:function(t,r,e){var n=Fr();try{kt(t)(r,e)}catch(t){if(Sr(n),t!==t+0)throw t;Ar(1,0)}},k:function(t,r,e,n){var a=Fr();try{kt(t)(r,e,n)}catch(t){if(Sr(a),t!==t+0)throw t;Ar(1,0)}},y:function(t,r,e,n,a){var i=Fr();try{kt(t)(r,e,n,a)}catch(t){if(Sr(i),t!==t+0)throw t;Ar(1,0)}},D:function(t,r,e,n,a,i){var o=Fr();try{kt(t)(r,e,n,a,i)}catch(t){if(Sr(o),t!==t+0)throw t;Ar(1,0)}},na:function(t,r,e,n,a,i,o){var s=Fr();try{kt(t)(r,e,n,a,i,o)}catch(t){if(Sr(s),t!==t+0)throw t;Ar(1,0)}},r:function(t,r,e,n,a,i,o,s){var u=Fr();try{kt(t)(r,e,n,a,i,o,s)}catch(t){if(Sr(u),t!==t+0)throw t;Ar(1,0)}},v:function(t,r,e,n,a,i,o,s,u,l,c){var h=Fr();try{kt(t)(r,e,n,a,i,o,s,u,l,c)}catch(t){if(Sr(h),t!==t+0)throw t;Ar(1,0)}},z:function(t,r,e,n,a,i,o,s,u,l,c,h,f,d,p,y){var v=Fr();try{kt(t)(r,e,n,a,i,o,s,u,l,c,h,f,d,p,y)}catch(t){if(Sr(v),t!==t+0)throw t;Ar(1,0)}},Z:function(t,r,e,n){var a=Fr();try{Rr(t,r,e,n)}catch(t){if(Sr(a),t!==t+0)throw t;Ar(1,0)}},_:(t,r,e,n,a)=>((t,r,e,n)=>{var a=T[n+40>>2],i={tm_sec:P[n>>2],tm_min:P[n+4>>2],tm_hour:P[n+8>>2],tm_mday:P[n+12>>2],tm_mon:P[n+16>>2],tm_year:P[n+20>>2],tm_wday:P[n+24>>2],tm_yday:P[n+28>>2],tm_isdst:P[n+32>>2],tm_gmtoff:P[n+36>>2],tm_zone:a?q(a):""},o=q(e),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)o=o.replace(new RegExp(u,"g"),s[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function h(t,r,e){for(var n="number"==typeof t?t.toString():t||"";n.length<r;)n=e[0]+n;return n}function f(t,r){return h(t,r,"0")}function d(t,r){function e(t){return t<0?-1:t>0?1:0}var n;return 0===(n=e(t.getFullYear()-r.getFullYear()))&&0===(n=e(t.getMonth()-r.getMonth()))&&(n=e(t.getDate()-r.getDate())),n}function p(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function y(t){var r=((t,r)=>{for(var e=new Date(t.getTime());r>0;){var n=gr(e.getFullYear()),a=e.getMonth(),i=(n?$r:wr)[a];if(!(r>i-e.getDate()))return e.setDate(e.getDate()+r),e;r-=i-e.getDate()+1,e.setDate(1),a<11?e.setMonth(a+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e})(new Date(t.tm_year+1900,0,1),t.tm_yday),e=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),a=p(e),i=p(n);return d(a,r)<=0?d(i,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":t=>l[t.tm_wday].substring(0,3),"%A":t=>l[t.tm_wday],"%b":t=>c[t.tm_mon].substring(0,3),"%B":t=>c[t.tm_mon],"%C":t=>f((t.tm_year+1900)/100|0,2),"%d":t=>f(t.tm_mday,2),"%e":t=>h(t.tm_mday,2," "),"%g":t=>y(t).toString().substring(2),"%G":y,"%H":t=>f(t.tm_hour,2),"%I":t=>{var r=t.tm_hour;return 0==r?r=12:r>12&&(r-=12),f(r,2)},"%j":t=>f(t.tm_mday+((t,r)=>{for(var e=0,n=0;n<=r;e+=t[n++]);return e})(gr(t.tm_year+1900)?$r:wr,t.tm_mon-1),3),"%m":t=>f(t.tm_mon+1,2),"%M":t=>f(t.tm_min,2),"%n":()=>"\n","%p":t=>t.tm_hour>=0&&t.tm_hour<12?"AM":"PM","%S":t=>f(t.tm_sec,2),"%t":()=>"\t","%u":t=>t.tm_wday||7,"%U":t=>{var r=t.tm_yday+7-t.tm_wday;return f(Math.floor(r/7),2)},"%V":t=>{var r=Math.floor((t.tm_yday+7-(t.tm_wday+6)%7)/7);if((t.tm_wday+371-t.tm_yday-2)%7<=2&&r++,r){if(53==r){var e=(t.tm_wday+371-t.tm_yday)%7;4==e||3==e&&gr(t.tm_year)||(r=1)}}else{r=52;var n=(t.tm_wday+7-t.tm_yday-1)%7;(4==n||5==n&&gr(t.tm_year%400-1))&&r++}return f(r,2)},"%w":t=>t.tm_wday,"%W":t=>{var r=t.tm_yday+7-(t.tm_wday+6)%7;return f(Math.floor(r/7),2)},"%y":t=>(t.tm_year+1900).toString().substring(2),"%Y":t=>t.tm_year+1900,"%z":t=>{var r=t.tm_gmtoff,e=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(e?"+":"-")+String("0000"+r).slice(-4)},"%Z":t=>t.tm_zone,"%%":()=>"%"};for(var u in o=o.replace(/%%/g,"\0\0"),v)o.includes(u)&&(o=o.replace(new RegExp(u,"g"),v[u](i)));o=o.replace(/\0\0/g,"%");var m,g,$,b,_,C=(g=Qt(m=o)+1,$=new Array(g),Kt(m,$,0,$.length),$);return C.length>r?0:(b=C,_=t,w.set(b,_),C.length-1)})(t,r,e,n)},_r=function(){var t,r,e,i,o={a:br};function s(t,r){var e;return _r=t.exports,m=_r.pa,S(),Dt=_r.sa,e=_r.qa,E.unshift(e),function(){if(k--,a.monitorRunDependencies?.(k),0==k&&M){var t=M;M=null,t()}}(),_r}if(k++,a.monitorRunDependencies?.(k),a.instantiateWasm)try{return a.instantiateWasm(o,s)}catch(t){$(`Module.instantiateWasm callback failed with error: ${t}`),n(t)}return(t=v,r=H,e=o,i=function(t){s(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||I(r)||h||"function"!=typeof fetch?L(r,e,i):fetch(r,{credentials:"same-origin"}).then(t=>WebAssembly.instantiateStreaming(t,e).then(i,function(t){return $(`wasm streaming compile failed: ${t}`),$("falling back to ArrayBuffer instantiation"),L(r,e,i)}))).catch(n),{}}(),Cr=a._malloc=t=>(Cr=a._malloc=_r.ra)(t),Pr=a._free=t=>(Pr=a._free=_r.ta)(t),Tr=t=>(Tr=_r.ua)(t),Ar=(t,r)=>(Ar=_r.va)(t,r),jr=t=>(jr=_r.wa)(t),Fr=()=>(Fr=_r.xa)(),Sr=t=>(Sr=_r.ya)(t),Or=t=>(Or=_r.za)(t),Er=t=>(Er=_r.Aa)(t),Dr=(t,r,e)=>(Dr=_r.Ba)(t,r,e),Wr=t=>(Wr=_r.Ca)(t),Rr=a.dynCall_vij=(t,r,e,n)=>(Rr=a.dynCall_vij=_r.Da)(t,r,e,n);a.dynCall_ji=(t,r)=>(a.dynCall_ji=_r.Ea)(t,r),a.dynCall_iij=(t,r,e,n)=>(a.dynCall_iij=_r.Fa)(t,r,e,n),a.dynCall_jijj=(t,r,e,n,i,o)=>(a.dynCall_jijj=_r.Ga)(t,r,e,n,i,o),a.dynCall_vijj=(t,r,e,n,i,o)=>(a.dynCall_vijj=_r.Ha)(t,r,e,n,i,o),a.dynCall_jiji=(t,r,e,n,i)=>(a.dynCall_jiji=_r.Ia)(t,r,e,n,i);var kr=a.dynCall_iiiiij=(t,r,e,n,i,o,s)=>(kr=a.dynCall_iiiiij=_r.Ja)(t,r,e,n,i,o,s);a.dynCall_viijii=(t,r,e,n,i,o,s)=>(a.dynCall_viijii=_r.Ka)(t,r,e,n,i,o,s);var Mr,xr=a.dynCall_jiiii=(t,r,e,n,i)=>(xr=a.dynCall_jiiii=_r.La)(t,r,e,n,i);function Hr(){function t(){Mr||(Mr=!0,a.calledRun=!0,F||(z(E),e(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)R(a.postRun.shift());z(D)}()))}k>0||(function(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)W(a.preRun.shift());z(O)}(),k>0||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),t()},1)):t()))}if(a.dynCall_iiiiijj=(t,r,e,n,i,o,s,u,l)=>(a.dynCall_iiiiijj=_r.Ma)(t,r,e,n,i,o,s,u,l),a.dynCall_iiiiiijj=(t,r,e,n,i,o,s,u,l,c)=>(a.dynCall_iiiiiijj=_r.Na)(t,r,e,n,i,o,s,u,l,c),M=function t(){Mr||Hr(),Mr||(M=t)},a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return Hr(),r.ready});export{r as default};
@@ -1 +0,0 @@
1
- var e,t="undefined"!=typeof document?document.currentScript:null,r=(e="undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("heic-decoder-RXDCJDOS.js",document.baseURI).href,async function(r={}){var n,a,i=r;i.ready=new Promise((e,t)=>{n=e,a=t});var o,s,u=Object.assign({},i),l="./this.program",c="object"==typeof window,h="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d="";if(f){const{createRequire:e}=await(import("module"));var p=e("undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("heic-decoder-RXDCJDOS.js",document.baseURI).href),y=p("fs"),v=p("path");d=h?v.dirname(d)+"/":p("url").fileURLToPath(new URL("./","undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("heic-decoder-RXDCJDOS.js",document.baseURI).href)),o=(e,t)=>(e=Y(e)?new URL(e):v.normalize(e),y.readFileSync(e,t?void 0:"utf8")),s=e=>{var t=o(e,!0);return t.buffer||(t=new Uint8Array(t)),t},!i.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(c||h)&&(h?d=self.location.href:"undefined"!=typeof document&&document.currentScript&&(d=document.currentScript.src),e&&(d=e),d=d.startsWith("blob:")?"":d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1),o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},h&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}));var m,g,$=i.print||console.log.bind(console),w=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(l=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(m=i.wasmBinary);var b,_,C,P,T,A,j,S,F=!1;function R(){var e=g.buffer;i.HEAP8=b=new Int8Array(e),i.HEAP16=C=new Int16Array(e),i.HEAPU8=_=new Uint8Array(e),i.HEAPU16=P=new Uint16Array(e),i.HEAP32=T=new Int32Array(e),i.HEAPU32=A=new Uint32Array(e),i.HEAPF32=j=new Float32Array(e),i.HEAPF64=S=new Float64Array(e)}var O=[],D=[],E=[];function U(e){O.unshift(e)}function W(e){E.unshift(e)}var k=0,I=null;function M(e){i.onAbort?.(e),w(e="Aborted("+e+")"),F=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw a(t),t}var x,H,V=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function L(e){if(e==x&&m)return new Uint8Array(m);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function q(e,t,r){return function(e){return m||!c&&!h||"function"!=typeof fetch?Promise.resolve().then(()=>L(e)):fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw`failed to load wasm binary file at '${e}'`;return t.arrayBuffer()}).catch(()=>L(e))}(e).then(e=>WebAssembly.instantiate(e,t)).then(r,e=>{w(`failed to asynchronously prepare wasm: ${e}`),M(e)})}i.locateFile?V(x="heic-decoder.wasm")||(H=x,x=i.locateFile?i.locateFile(H,d):d+H):x=new URL("heic-decoder.wasm","undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("heic-decoder-RXDCJDOS.js",document.baseURI).href).href;var z=e=>{for(;e.length>0;)e.shift()(i)};i.noExitRuntime;var B="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,N=(e,t,r)=>{for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&B)return B.decode(e.subarray(t,a));for(var i="";t<a;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var l=o-65536;i+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else i+=String.fromCharCode((31&o)<<6|s)}else i+=String.fromCharCode(o)}return i},G=(e,t)=>e?N(_,e,t):"",J=[],X=0,Z=0;class K{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){A[this.ptr+4>>2]=e}get_type(){return A[this.ptr+4>>2]}set_destructor(e){A[this.ptr+8>>2]=e}get_destructor(){return A[this.ptr+8>>2]}set_caught(e){e=e?1:0,b[this.ptr+12]=e}get_caught(){return 0!=b[this.ptr+12]}set_rethrown(e){e=e?1:0,b[this.ptr+13]=e}get_rethrown(){return 0!=b[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){A[this.ptr+16>>2]=e}get_adjusted_ptr(){return A[this.ptr+16>>2]}get_exception_ptr(){if(Ut(this.get_type()))return A[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var Q,ee,te,re=e=>{var t=Z;if(!t)return St(0),0;var r=new K(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return St(0),t;for(var a in e){var i=e[a];if(0===i||i===n)break;var o=r.ptr+16;if(Et(i,n,o))return St(i),t}return St(n),t},ne=e=>{for(var t="",r=e;_[r];)t+=Q[_[r++]];return t},ae={},ie={},oe={},se=e=>{throw new ee(e)},ue=e=>{throw new te(e)},le=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&ue("Mismatched type converter count");for(var a=0;a<e.length;++a)ce(e[a],n[a])}e.forEach(function(e){oe[e]=t});var a=new Array(t.length),i=[],o=0;t.forEach((e,t)=>{ie.hasOwnProperty(e)?a[t]=ie[e]:(i.push(e),ae.hasOwnProperty(e)||(ae[e]=[]),ae[e].push(()=>{a[t]=ie[e],++o===i.length&&n(a)}))}),0===i.length&&n(a)};function ce(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||se(`type "${n}" must have a positive integer typeid pointer`),ie.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;se(`Cannot register type '${n}' twice`)}if(ie[e]=t,delete oe[e],ae.hasOwnProperty(e)){var a=ae[e];delete ae[e],a.forEach(e=>e())}}(e,t,r)}var he,fe=e=>{se(e.$$.ptrType.registeredClass.name+" instance already deleted")},de=!1,pe=e=>{},ye=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},ve=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=ve(e,t,r.baseClass);return null===n?null:r.downcast(n)},me={},ge=[],$e=()=>{for(;ge.length;){var e=ge.pop();e.$$.deleteScheduled=!1,e.delete()}},we={},be=(e,t)=>(t.ptrType&&t.ptr||ue("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&ue("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_e(Object.create(e,{$$:{value:t,writable:!0}}))),_e=e=>"undefined"==typeof FinalizationRegistry?(_e=e=>e,e):(de=new FinalizationRegistry(e=>{ye(e.$$)}),pe=e=>de.unregister(e),(_e=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};de.register(e,r,e)}return e})(e));function Ce(){}var Pe=(e,t)=>Object.defineProperty(t,"name",{value:e}),Te=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||se(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}};function Ae(e,t,r,n,a,i,o,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=i,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var je=(e,t,r)=>{for(;t!==r;)t.upcast||se(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Se(e,t){if(null===t)return this.isReference&&se(`null is not a valid ${this.name}`),0;t.$$||se(`Cannot pass "${Xe(t)}" as a ${this.name}`),t.$$.ptr||se(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return je(t.$$.ptr,r,this.registeredClass)}function Fe(e,t){var r;if(null===t)return this.isReference&&se(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||se(`Cannot pass "${Xe(t)}" as a ${this.name}`),t.$$.ptr||se(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&se(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=je(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&se("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:se(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var a=t.clone();r=this.rawShare(r,Ge.toHandle(()=>a.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:se("Unsupporting sharing policy")}return r}function Re(e,t){if(null===t)return this.isReference&&se(`null is not a valid ${this.name}`),0;t.$$||se(`Cannot pass "${Xe(t)}" as a ${this.name}`),t.$$.ptr||se(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&se(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return je(t.$$.ptr,r,this.registeredClass)}function Oe(e){return this.fromWireType(A[e>>2])}function De(e,t,r,n,a,i,o,s,u,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=Fe:n?(this.toWireType=Se,this.destructorFunction=null):(this.toWireType=Re,this.destructorFunction=null)}var Ee,Ue,We=[],ke=e=>{var t=We[e];return t||(e>=We.length&&(We.length=e+1),We[e]=t=Ee.get(e)),t},Ie=(e,t)=>{var r,n,a=(e=ne(e)).includes("j")?(r=e,n=t,(...e)=>((e,t,r=[])=>e.includes("j")?((e,t,r)=>(0,i["dynCall_"+e])(t,...r))(e,t,r):ke(t)(...r))(r,n,e)):ke(t);return"function"!=typeof a&&se(`unknown function pointer with signature ${e}: ${t}`),a},Me=e=>{var t=At(e),r=ne(t);return Tt(t),r},xe=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||ie[t]||(oe[t]?oe[t].forEach(e):(r.push(t),n[t]=!0))}),new Ue(`${e}: `+r.map(Me).join([", "]))},He=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(A[t+4*n>>2]);return r},Ve=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Ye(e,t,r,n,a,i){var o=t.length;o<2&&se("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==r,u=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}(t),l="void"!==t[0].name,c=o-2,h=new Array(c),f=[],d=[];return Pe(e,function(...r){var i;r.length!==c&&se(`function ${e} called with ${r.length} arguments, expected ${c}`),d.length=0,f.length=s?2:1,f[0]=a,s&&(i=t[1].toWireType(d,this),f[1]=i);for(var o=0;o<c;++o)h[o]=t[o+2].toWireType(d,r[o]),f.push(h[o]);return function(e){if(u)Ve(d);else for(var r=s?1:2;r<t.length;r++){var n=1===r?i:h[r-2];null!==t[r].destructorFunction&&t[r].destructorFunction(n)}if(l)return t[0].fromWireType(e)}(n(...f))})}var Le,qe,ze=[],Be=[],Ne=e=>{e>9&&0===--Be[e+1]&&(Be[e]=void 0,ze.push(e))},Ge={toValue:e=>(e||se("Cannot use deleted val. handle = "+e),Be[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ze.pop()||Be.length;return Be[t]=e,Be[t+1]=1,t}}}},Je={name:"emscripten::val",fromWireType:e=>{var t=Ge.toValue(e);return Ne(e),t},toWireType:(e,t)=>Ge.toHandle(t),argPackAdvance:8,readValueFromPointer:Oe,destructorFunction:null},Xe=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ze=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(j[e>>2])};case 8:return function(e){return this.fromWireType(S[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ke=(e,t,r)=>{switch(t){case 1:return r?e=>b[e]:e=>_[e];case 2:return r?e=>C[e>>1]:e=>P[e>>1];case 4:return r?e=>T[e>>2]:e=>A[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Qe=(e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,i=r+n-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(r>=i)break;t[r++]=s}else if(s<=2047){if(r+1>=i)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=i)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-a},et=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},tt="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,rt=(e,t)=>{for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&P[n];)++n;if((r=n<<1)-e>32&&tt)return tt.decode(_.subarray(e,r));for(var i="",o=0;!(o>=t/2);++o){var s=C[e+2*o>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},nt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,a=(r-=2)<2*e.length?r/2:e.length,i=0;i<a;++i){var o=e.charCodeAt(i);C[t>>1]=o,t+=2}return C[t>>1]=0,t-n},at=e=>2*e.length,it=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var a=T[e+4*r>>2];if(0==a)break;if(++r,a>=65536){var i=a-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(a)}return n},ot=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,a=n+r-4,i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),T[t>>2]=o,(t+=4)+4>a)break}return T[t>>2]=0,t-n},st=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},ut=[],lt={},ct=e=>{var t=lt[e];return void 0===t?ne(e):t},ht=()=>{if("object"==typeof globalThis)return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==typeof $$$embind_global$$$&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof global&&e(global)?$$$embind_global$$$=global:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},ft=(e,t)=>{var r=ie[e];return void 0===r&&se(`${t} has unknown type ${Me(e)}`),r},dt=Reflect.construct,pt=e=>{var t=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(t),R(),1}catch(e){}},yt={},vt=()=>{if(!vt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l||"./this.program"};for(var t in yt)void 0===yt[t]?delete e[t]:e[t]=yt[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);vt.strings=r}return vt.strings},mt=[null,[],[]],gt=(e,t)=>{var r=mt[e];0===t||10===t?((1===e?$:w)(N(r,0)),r.length=0):r.push(t)},$t=e=>e%4==0&&(e%100!=0||e%400==0),wt=[31,29,31,30,31,30,31,31,30,31,30,31],bt=[31,28,31,30,31,30,31,31,30,31,30,31];(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Q=e})(),ee=i.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},te=i.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Object.assign(Ce.prototype,{isAliasOf(e){if(!(this instanceof Ce))return!1;if(!(e instanceof Ce))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||fe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=_e(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&se("Object already scheduled for deletion"),pe(this),ye(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&se("Object already scheduled for deletion"),ge.push(this),1===ge.length&&he&&he($e),this.$$.deleteScheduled=!0,this}}),i.getInheritedInstanceCount=()=>Object.keys(we).length,i.getLiveInheritedInstances=()=>{var e=[];for(var t in we)we.hasOwnProperty(t)&&e.push(we[t]);return e},i.flushPendingDeletes=$e,i.setDelayFunction=e=>{he=e,ge.length&&he&&he($e)},Object.assign(De.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:8,readValueFromPointer:Oe,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&se("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),we[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?be(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):be(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,o=this.registeredClass.getActualType(t),s=me[o];if(!s)return a.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=ve(t,this.registeredClass,i.registeredClass);return null===u?a.call(this):this.isSmartPointer?be(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:e}):be(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}}),Ue=i.UnboundTypeError=(Le=Error,(qe=Pe("UnboundTypeError",function(e){this.name="UnboundTypeError",this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))})).prototype=Object.create(Le.prototype),qe.prototype.constructor=qe,qe.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},qe),Be.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=()=>Be.length/2-5-ze.length;var _t={b:(e,t,r,n)=>{M(`Assertion failed: ${G(e)}, at: `+[t?G(t):"unknown filename",r,n?G(n):"unknown function"])},o:e=>{var t=new K(e);return t.get_caught()||(t.set_caught(!0),X--),t.set_rethrown(!1),J.push(t),Dt(t.excPtr),t.get_exception_ptr()},p:()=>{jt(0,0);var e=J.pop();Ot(e.excPtr),Z=0},a:()=>re([]),g:e=>re([e]),L:()=>{var e=J.pop();e||M("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(J.push(e),e.set_rethrown(!0),e.set_caught(!1),X++),Z=t},q:(e,t,r)=>{throw new K(e).init(t,r),X++,Z=e},$:()=>X,e:e=>{throw Z||(Z=e),Z},ba:(e,t,r)=>{},Y:(e,t,r,n,a)=>{},ia:(e,t,r,n)=>{ce(e,{name:t=ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(_[e])},destructorFunction:null})},T:(e,t,r,n,a,o,s,u,l,c,h,f,d)=>{h=ne(h),o=Ie(a,o),u&&=Ie(s,u),c&&=Ie(l,c),d=Ie(f,d);var p=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(h);((e,t)=>{i.hasOwnProperty(e)?(se(`Cannot register public name '${e}' twice`),Te(i,e,e),i.hasOwnProperty(void 0)&&se("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),i[e].overloadTable[void 0]=t):i[e]=t})(p,function(){xe(`Cannot construct ${h} due to unbound types`,[n])}),le([e,t,r],n?[n]:[],t=>{var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:Ce.prototype;var s=Pe(h,function(...e){if(Object.getPrototypeOf(this)!==l)throw new ee("Use 'new' to construct "+h);if(void 0===f.constructor_body)throw new ee(h+" has no accessible constructor");var t=f.constructor_body[e.length];if(void 0===t)throw new ee(`Tried to invoke ctor of ${h} with invalid number of parameters (${e.length}) - expected (${Object.keys(f.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),l=Object.create(a,{constructor:{value:s}});s.prototype=l;var f=new Ae(h,s,l,d,r,o,u,c);f.baseClass&&(f.baseClass.__derivedClasses??=[],f.baseClass.__derivedClasses.push(f));var y=new De(h,f,!0,!1,!1),v=new De(h+"*",f,!1,!1,!1),m=new De(h+" const*",f,!1,!0,!1);return me[e]={pointerType:v,constPointerType:m},((e,t)=>{i.hasOwnProperty(e)||ue("Replacing nonexistent public symbol"),i[e].overloadTable,i[e]=t,i[e].argCount=void 0})(p,s),[y,v,m]})},S:(e,t,r,n,a,i)=>{var o=He(t,r);a=Ie(n,a),le([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ee(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{xe(`Cannot construct ${e.name} due to unbound types`,o)},le([],o,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ye(r,n,null,a,i),[])),[]})},B:(e,t,r,n,a,i,o,s,u)=>{var l=He(r,n);t=(e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e})(t=ne(t)),i=Ie(a,i),le([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function a(){xe(`Cannot call ${n} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,c=u[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(a.argCount=r-2,a.className=e.name,u[t]=a):(Te(u,t,n),u[t].overloadTable[r-2]=a),le([],l,a=>{var s=Ye(n,a,e,i,o);return void 0===u[t].overloadTable?(s.argCount=r-2,u[t]=s):u[t].overloadTable[r-2]=s,[]}),[]})},ha:e=>ce(e,Je),O:(e,t,r)=>{ce(e,{name:t=ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:Ze(t,r),destructorFunction:null})},s:(e,t,r,n,a)=>{t=ne(t);var i=e=>e;if(0===n){var o=32-8*r;i=e=>e<<o>>>o}var s=t.includes("unsigned");ce(e,{name:t,fromWireType:i,toWireType:s?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Ke(t,r,0!==n),destructorFunction:null})},n:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function a(e){var t=A[e>>2],r=A[e+4>>2];return new n(b.buffer,r,t)}ce(e,{name:r=ne(r),fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},N:(e,t)=>{var r="std::string"===(t=ne(t));ce(e,{name:t,fromWireType(e){var t,n=A[e>>2],a=e+4;if(r)for(var i=a,o=0;o<=n;++o){var s=a+o;if(o==n||0==_[s]){var u=G(i,s-i);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),i=s+1}}else{var l=new Array(n);for(o=0;o<n;++o)l[o]=String.fromCharCode(_[a+o]);t=l.join("")}return Tt(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var a="string"==typeof t;a||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||se("Cannot pass non-string to std::string"),n=r&&a?et(t):t.length;var i=Pt(4+n+1),o=i+4;if(A[i>>2]=n,r&&a)Qe(t,_,o,n+1);else if(a)for(var s=0;s<n;++s){var u=t.charCodeAt(s);u>255&&(Tt(o),se("String has UTF-16 code units that do not fit in 8 bits")),_[o+s]=u}else for(s=0;s<n;++s)_[o+s]=t[s];return null!==e&&e.push(Tt,i),i},argPackAdvance:8,readValueFromPointer:Oe,destructorFunction(e){Tt(e)}})},E:(e,t,r)=>{var n,a,i,o;r=ne(r),2===t?(n=rt,a=nt,o=at,i=e=>P[e>>1]):4===t&&(n=it,a=ot,o=st,i=e=>A[e>>2]),ce(e,{name:r,fromWireType:e=>{for(var r,a=A[e>>2],o=e+4,s=0;s<=a;++s){var u=e+4+s*t;if(s==a||0==i(u)){var l=n(o,u-o);void 0===r?r=l:(r+=String.fromCharCode(0),r+=l),o=u+t}}return Tt(e),r},toWireType:(e,n)=>{"string"!=typeof n&&se(`Cannot pass non-string to C++ string type ${r}`);var i=o(n),s=Pt(4+i+t);return A[s>>2]=i/t,a(n,s+4,i+t),null!==e&&e.push(Tt,s),s},argPackAdvance:8,readValueFromPointer:Oe,destructorFunction(e){Tt(e)}})},ja:(e,t)=>{ce(e,{isVoid:!0,name:t=ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},F:(e,t,r,n)=>(e=ut[e])(null,t=Ge.toValue(t),r,n),P:(e,t,r,n,a)=>(e=ut[e])(t=Ge.toValue(t),t[r=ct(r)],n,a),U:Ne,ma:e=>0===e?Ge.toHandle(ht()):(e=ct(e),Ge.toHandle(ht()[e])),x:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=ft(A[t+4*n>>2],"parameter "+n);return r})(e,t),a=n.shift();e--;var i,o,s=new Array(e),u=`methodCaller<(${n.map(e=>e.name).join(", ")}) => ${a.name}>`;return i=Pe(u,(t,i,o,u)=>{for(var l=0,c=0;c<e;++c)s[c]=n[c].readValueFromPointer(u+l),l+=n[c].argPackAdvance;var h=1===r?dt(i,s):i.apply(t,s);return((e,t,r)=>{var n=[],a=e.toWireType(n,r);return n.length&&(A[t>>2]=Ge.toHandle(n)),a})(a,o,h)}),o=ut.length,ut.push(i),o},Q:e=>{e>9&&(Be[e+1]+=1)},w:e=>Ge.toHandle(ct(e)),la:()=>Ge.toHandle({}),oa:e=>{var t=Ge.toValue(e);Ve(t),Ne(e)},ka:(e,t,r)=>{e=Ge.toValue(e),t=Ge.toValue(t),r=Ge.toValue(r),e[t]=r},G:(e,t)=>{var r=(e=ft(e,"_emval_take_value")).readValueFromPointer(t);return Ge.toHandle(r)},C:()=>{M("")},ga:(e,t,r)=>_.copyWithin(e,t,t+r),aa:e=>{var t=_.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=(e,t)=>e+(t-e%t)%t,a=1;a<=4;a*=2){var i=t*(1+.2/a);i=Math.min(i,e+100663296);var o=Math.min(r,n(Math.max(e,i),65536));if(pt(o))return!0}return!1},ea:(e,t)=>{var r=0;return vt().forEach((n,a)=>{var i=t+r;A[e+4*a>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)b[t++]=e.charCodeAt(r);b[t]=0})(n,i),r+=n.length+1}),0},fa:(e,t)=>{var r=vt();A[e>>2]=r.length;var n=0;return r.forEach(e=>n+=e.length+1),A[t>>2]=n,0},ca:e=>52,da:(e,t,r,n)=>52,X:function(e,t,r,n,a){return 70},M:(e,t,r,n)=>{for(var a=0,i=0;i<r;i++){var o=A[t>>2],s=A[t+4>>2];t+=8;for(var u=0;u<s;u++)gt(e,_[o+u]);a+=s}return A[n>>2]=a,0},H:function(e,t,r,n){var a=Ft();try{return ke(e)(t,r,n)}catch(e){if(Rt(a),e!==e+0)throw e;jt(1,0)}},R:function(e,t,r,n,a){var i=Ft();try{return ke(e)(t,r,n,a)}catch(e){if(Rt(i),e!==e+0)throw e;jt(1,0)}},I:function(e,t,r,n){var a=Ft();try{return ke(e)(t,r,n)}catch(e){if(Rt(a),e!==e+0)throw e;jt(1,0)}},m:function(e){var t=Ft();try{return ke(e)()}catch(e){if(Rt(t),e!==e+0)throw e;jt(1,0)}},c:function(e,t){var r=Ft();try{return ke(e)(t)}catch(e){if(Rt(r),e!==e+0)throw e;jt(1,0)}},f:function(e,t,r){var n=Ft();try{return ke(e)(t,r)}catch(e){if(Rt(n),e!==e+0)throw e;jt(1,0)}},l:function(e,t,r,n){var a=Ft();try{return ke(e)(t,r,n)}catch(e){if(Rt(a),e!==e+0)throw e;jt(1,0)}},j:function(e,t,r,n,a){var i=Ft();try{return ke(e)(t,r,n,a)}catch(e){if(Rt(i),e!==e+0)throw e;jt(1,0)}},K:function(e,t,r,n,a,i){var o=Ft();try{return ke(e)(t,r,n,a,i)}catch(e){if(Rt(o),e!==e+0)throw e;jt(1,0)}},u:function(e,t,r,n,a,i){var o=Ft();try{return ke(e)(t,r,n,a,i)}catch(e){if(Rt(o),e!==e+0)throw e;jt(1,0)}},t:function(e,t,r,n,a,i,o){var s=Ft();try{return ke(e)(t,r,n,a,i,o)}catch(e){if(Rt(s),e!==e+0)throw e;jt(1,0)}},J:function(e,t,r,n,a,i,o,s){var u=Ft();try{return ke(e)(t,r,n,a,i,o,s)}catch(e){if(Rt(u),e!==e+0)throw e;jt(1,0)}},A:function(e,t,r,n,a,i,o,s,u,l,c,h){var f=Ft();try{return ke(e)(t,r,n,a,i,o,s,u,l,c,h)}catch(e){if(Rt(f),e!==e+0)throw e;jt(1,0)}},W:function(e,t,r,n,a,i,o){var s=Ft();try{return kt(e,t,r,n,a,i,o)}catch(e){if(Rt(s),e!==e+0)throw e;jt(1,0)}},V:function(e,t,r,n,a){var i=Ft();try{return Mt(e,t,r,n,a)}catch(e){if(Rt(i),e!==e+0)throw e;jt(1,0)}},i:function(e){var t=Ft();try{ke(e)()}catch(e){if(Rt(t),e!==e+0)throw e;jt(1,0)}},h:function(e,t){var r=Ft();try{ke(e)(t)}catch(e){if(Rt(r),e!==e+0)throw e;jt(1,0)}},d:function(e,t,r){var n=Ft();try{ke(e)(t,r)}catch(e){if(Rt(n),e!==e+0)throw e;jt(1,0)}},k:function(e,t,r,n){var a=Ft();try{ke(e)(t,r,n)}catch(e){if(Rt(a),e!==e+0)throw e;jt(1,0)}},y:function(e,t,r,n,a){var i=Ft();try{ke(e)(t,r,n,a)}catch(e){if(Rt(i),e!==e+0)throw e;jt(1,0)}},D:function(e,t,r,n,a,i){var o=Ft();try{ke(e)(t,r,n,a,i)}catch(e){if(Rt(o),e!==e+0)throw e;jt(1,0)}},na:function(e,t,r,n,a,i,o){var s=Ft();try{ke(e)(t,r,n,a,i,o)}catch(e){if(Rt(s),e!==e+0)throw e;jt(1,0)}},r:function(e,t,r,n,a,i,o,s){var u=Ft();try{ke(e)(t,r,n,a,i,o,s)}catch(e){if(Rt(u),e!==e+0)throw e;jt(1,0)}},v:function(e,t,r,n,a,i,o,s,u,l,c){var h=Ft();try{ke(e)(t,r,n,a,i,o,s,u,l,c)}catch(e){if(Rt(h),e!==e+0)throw e;jt(1,0)}},z:function(e,t,r,n,a,i,o,s,u,l,c,h,f,d,p,y){var v=Ft();try{ke(e)(t,r,n,a,i,o,s,u,l,c,h,f,d,p,y)}catch(e){if(Rt(v),e!==e+0)throw e;jt(1,0)}},Z:function(e,t,r,n){var a=Ft();try{Wt(e,t,r,n)}catch(e){if(Rt(a),e!==e+0)throw e;jt(1,0)}},_:(e,t,r,n,a)=>((e,t,r,n)=>{var a=A[n+40>>2],i={tm_sec:T[n>>2],tm_min:T[n+4>>2],tm_hour:T[n+8>>2],tm_mday:T[n+12>>2],tm_mon:T[n+16>>2],tm_year:T[n+20>>2],tm_wday:T[n+24>>2],tm_yday:T[n+28>>2],tm_isdst:T[n+32>>2],tm_gmtoff:T[n+36>>2],tm_zone:a?G(a):""},o=G(r),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)o=o.replace(new RegExp(u,"g"),s[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function h(e,t,r){for(var n="number"==typeof e?e.toString():e||"";n.length<t;)n=r[0]+n;return n}function f(e,t){return h(e,t,"0")}function d(e,t){function r(e){return e<0?-1:e>0?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function y(e){var t=((e,t)=>{for(var r=new Date(e.getTime());t>0;){var n=$t(r.getFullYear()),a=r.getMonth(),i=(n?wt:bt)[a];if(!(t>i-r.getDate()))return r.setDate(r.getDate()+t),r;t-=i-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r})(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),n=new Date(t.getFullYear()+1,0,4),a=p(r),i=p(n);return d(a,t)<=0?d(i,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>f((e.tm_year+1900)/100|0,2),"%d":e=>f(e.tm_mday,2),"%e":e=>h(e.tm_mday,2," "),"%g":e=>y(e).toString().substring(2),"%G":y,"%H":e=>f(e.tm_hour,2),"%I":e=>{var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),f(t,2)},"%j":e=>f(e.tm_mday+((e,t)=>{for(var r=0,n=0;n<=t;r+=e[n++]);return r})($t(e.tm_year+1900)?wt:bt,e.tm_mon-1),3),"%m":e=>f(e.tm_mon+1,2),"%M":e=>f(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>f(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var t=e.tm_yday+7-e.tm_wday;return f(Math.floor(t/7),2)},"%V":e=>{var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var r=(e.tm_wday+371-e.tm_yday)%7;4==r||3==r&&$t(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&$t(e.tm_year%400-1))&&t++}return f(t,2)},"%w":e=>e.tm_wday,"%W":e=>{var t=e.tm_yday+7-(e.tm_wday+6)%7;return f(Math.floor(t/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var t=e.tm_gmtoff,r=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in o=o.replace(/%%/g,"\0\0"),v)o.includes(u)&&(o=o.replace(new RegExp(u,"g"),v[u](i)));o=o.replace(/\0\0/g,"%");var m,g,$,w,_,C=(g=et(m=o)+1,$=new Array(g),Qe(m,$,0,$.length),$);return C.length>t?0:(w=C,_=e,b.set(w,_),C.length-1)})(e,t,r,n)},Ct=function(){var e,t,r,n,o={a:_t};function s(e,t){var r;return Ct=e.exports,g=Ct.pa,R(),Ee=Ct.sa,r=Ct.qa,D.unshift(r),function(){if(k--,i.monitorRunDependencies?.(k),0==k&&I){var e=I;I=null,e()}}(),Ct}if(k++,i.monitorRunDependencies?.(k),i.instantiateWasm)try{return i.instantiateWasm(o,s)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),a(e)}return(e=m,t=x,r=o,n=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||V(t)||f||"function"!=typeof fetch?q(t,r,n):fetch(t,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,r).then(n,function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),q(t,r,n)}))).catch(a),{}}(),Pt=i._malloc=e=>(Pt=i._malloc=Ct.ra)(e),Tt=i._free=e=>(Tt=i._free=Ct.ta)(e),At=e=>(At=Ct.ua)(e),jt=(e,t)=>(jt=Ct.va)(e,t),St=e=>(St=Ct.wa)(e),Ft=()=>(Ft=Ct.xa)(),Rt=e=>(Rt=Ct.ya)(e),Ot=e=>(Ot=Ct.za)(e),Dt=e=>(Dt=Ct.Aa)(e),Et=(e,t,r)=>(Et=Ct.Ba)(e,t,r),Ut=e=>(Ut=Ct.Ca)(e),Wt=i.dynCall_vij=(e,t,r,n)=>(Wt=i.dynCall_vij=Ct.Da)(e,t,r,n);i.dynCall_ji=(e,t)=>(i.dynCall_ji=Ct.Ea)(e,t),i.dynCall_iij=(e,t,r,n)=>(i.dynCall_iij=Ct.Fa)(e,t,r,n),i.dynCall_jijj=(e,t,r,n,a,o)=>(i.dynCall_jijj=Ct.Ga)(e,t,r,n,a,o),i.dynCall_vijj=(e,t,r,n,a,o)=>(i.dynCall_vijj=Ct.Ha)(e,t,r,n,a,o),i.dynCall_jiji=(e,t,r,n,a)=>(i.dynCall_jiji=Ct.Ia)(e,t,r,n,a);var kt=i.dynCall_iiiiij=(e,t,r,n,a,o,s)=>(kt=i.dynCall_iiiiij=Ct.Ja)(e,t,r,n,a,o,s);i.dynCall_viijii=(e,t,r,n,a,o,s)=>(i.dynCall_viijii=Ct.Ka)(e,t,r,n,a,o,s);var It,Mt=i.dynCall_jiiii=(e,t,r,n,a)=>(Mt=i.dynCall_jiiii=Ct.La)(e,t,r,n,a);function xt(){function e(){It||(It=!0,i.calledRun=!0,F||(z(D),n(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)W(i.postRun.shift());z(E)}()))}k>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)U(i.preRun.shift());z(O)}(),k>0||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e()))}if(i.dynCall_iiiiijj=(e,t,r,n,a,o,s,u,l)=>(i.dynCall_iiiiijj=Ct.Ma)(e,t,r,n,a,o,s,u,l),i.dynCall_iiiiiijj=(e,t,r,n,a,o,s,u,l,c)=>(i.dynCall_iiiiiijj=Ct.Na)(e,t,r,n,a,o,s,u,l,c),I=function e(){It||xt(),It||(I=e)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return xt(),r.ready});module.exports=r;