@contentauth/c2pa-web 0.13.4 → 0.14.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.
@@ -1,19 +1,18 @@
1
- import { channel as z, transfer as $ } from "highgain";
2
- import { merge as p } from "ts-deepmerge";
3
- const { createTx: W, rx: se } = z(), { createTx: ce, rx: P } = z("worker"), J = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw b(t[0])}addAssertion(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addAssertion(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}addIngredient(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=o.wasmbuilder_addIngredient(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}addIngredientFromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,i=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n)}addRedaction(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addRedaction(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}addResourceFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}filterActionsAndIngredientsAt(e,t){const n=E(e,o.__wbindgen_malloc),_=a,c=E(t,o.__wbindgen_malloc),i=a,s=o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr,n,_,c,i);if(s[1])throw b(s[0])}filterActionsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterActionsAt(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}filterIngredientsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterIngredientsAt(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}static fromArchive(e,t){var n=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw b(c[1]);return p.__wrap(c[0])}static fromJson(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;var c=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw b(s[1]);return p.__wrap(s[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}static new(e){var t=g(e)?0:f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;const _=o.wasmbuilder_new(t,n);if(_[2])throw b(_[1]);return p.__wrap(_[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw b(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setRemoteUrl(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}sign(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,n)}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}updateActionsAt(e){const t=o.wasmbuilder_updateActionsAt(this.__wbg_ptr,e);if(t[1])throw b(t[0])}}Symbol.dispose&&(p.prototype[Symbol.dispose]=p.prototype.free);class v{static __wrap(e){const t=Object.create(v.prototype);return t.__wbg_ptr=e,N.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=y(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}crJson(){let e,t;try{const n=o.wasmreader_crJson(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;var i=g(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;var s=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),u=a;return o.wasmreader_fromBlobFragment(c,i,t,n,s,u)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}resourceToBytes(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,n);if(_[2])throw b(_[1]);return b(_[0])}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function C(r){const e=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),t=a,n=o.loadSettings(e,t);if(n[1])throw b(n[0])}function P(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,t){return Error(y(e,t))},__wbg_Number_6b506e6536831eaa:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,g(_)?BigInt(0):_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=U(t),_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,t){return e==t},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,g(_)?0:_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,t){throw new Error(y(e,t))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){e._wbg_cb_unref()},__wbg_abort_2ec46222bf378517:function(e){e.abort()},__wbg_abort_b29d719932441c95:function(e,t){e.abort(t)},__wbg_append_e1746995edcb0170:function(){return l(function(e,t,n,_,c){e.append(y(t,n),y(_,c))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return l(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_2c6dc3b4b85d3547:function(e){return e.byteLength},__wbg_call_8a89609d89f6608a:function(){return l(function(e,t){return e.call(t)},arguments)},__wbg_call_9c758de292015997:function(){return l(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearTimeout_6b8d9a38b9263d65:function(e){return clearTimeout(e)},__wbg_crypto_38df2bab126b63dc:function(e){return e.crypto},__wbg_done_60cf307fcc680536:function(e){return e.done},__wbg_entries_04b37a02507f1713:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(y(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_344c8d3849002659:function(e,t){return e.fetch(t)},__wbg_fetch_9dad4fe911207b37:function(e){return fetch(e)},__wbg_from_d300fe49deab18f5:function(e){return Array.from(e)},__wbg_getRandomValues_3f44b700395062e5:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_76dfc69825c9c552:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_8aa3112c6615eef6:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return l(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_00b3f7db575e4ef5:function(e){return e.getTime()},__wbg_get_1f8f054ddbaa7db2:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,t){return e[t>>>0]},__wbg_get_de6a0f7d4d18a304:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_has_73740b27f436fed3:function(){return l(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_0feb63d2d374b44a:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_9fc06d9a951bcee6:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_d0db99486956c8e8:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(e)},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(e)},__wbg_iterator_8732428d309e270e:function(){return Symbol.iterator},__wbg_length_4a591ecaa01354d9:function(e){return e.length},__wbg_length_66f1a4b2e9026940:function(e){return e.length},__wbg_msCrypto_bd5a034af96bcba6:function(e){return e.msCrypto},__wbg_new_0_445c13a750296eb6:function(){return new Date},__wbg_new_0d09705104e164af:function(){return l(function(){return new AbortController},arguments)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_578aeef4b6b94378:function(e){return new Uint8Array(e)},__wbg_new_622fc80556be2e26:function(){return new Map},__wbg_new_a1b9f645bba64f0f:function(){return l(function(){return new FileReaderSync},arguments)},__wbg_new_ce1ab61c1c2b300d:function(){return new Object},__wbg_new_d90091b82fdf5b91:function(){return new Array},__wbg_new_e436d06bc8e77460:function(){return l(function(){return new Headers},arguments)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_typed_bf31d18f92484486:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const u=n.a;n.a=0;try{return H(u,n.b,i,s)}finally{n.a=u}};return new Promise(_)}finally{n.a=0}},__wbg_new_with_length_36a4998e27b014c5:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return l(function(e,t,n){return new Request(y(e,t),n)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){return e.next},__wbg_next_eb8ca7351fa27906:function(){return l(function(e){return e.next()},arguments)},__wbg_node_84ea875411254db1:function(e){return e.node},__wbg_now_190933fa139cc119:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){return e.process},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(e)},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){return e.queueMicrotask},__wbg_randomFillSync_6c25eac9869eb53c:function(){return l(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_f1b8da05559618d9:function(){return l(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return l(function(){return module.require},arguments)},__wbg_resolve_25a7e548d5881dca:function(e){return Promise.resolve(e)},__wbg_setTimeout_f757f00851f76c42:function(e,t){return setTimeout(e,t)},__wbg_set_29c99a8aac1c01e5:function(e,t,n){e.set(A(t,n))},__wbg_set_52b1e1eb5bed906a:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_body_36614c7e61546809:function(e,t){e.body=t},__wbg_set_cache_488ea16c11cbf20d:function(e,t){e.cache=X[t]},__wbg_set_credentials_fa9c491a27c4bdf0:function(e,t){e.credentials=Y[t]},__wbg_set_dca99999bba88a9a:function(e,t,n){e[t>>>0]=n},__wbg_set_headers_7c1e39ece7826bec:function(e,t){e.headers=t},__wbg_set_method_7a6811dec7a4feff:function(e,t,n){e.method=y(t,n)},__wbg_set_mode_c90e3667002857d4:function(e,t){e.mode=K[t]},__wbg_set_signal_d9da62b3f215c821:function(e,t){e.signal=t},__wbg_signal_e03304a84df9ed09:function(e){return e.signal},__wbg_size_9970092b88b1094c:function(e){return e.size},__wbg_slice_02bb778501725738:function(){return l(function(e,t,n){return e.slice(t,n)},arguments)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){const e=typeof global>"u"?null:global;return g(e)?0:R(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:R(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return g(e)?0:R(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return g(e)?0:R(e)},__wbg_status_00549d55b78d949e:function(e){return e.status},__wbg_stringify_8286df6dcc591521:function(){return l(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_4aa221f6a4f5ab22:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_18f476d590e58992:function(e,t,n){return e.then(t,n)},__wbg_then_ac7b025999b52837:function(e,t){return e.then(t)},__wbg_url_6808f1c468f2d0cd:function(e,t){const n=t.url,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_41ae57308c1f031c:function(e){return e.valueOf()},__wbg_value_f3625092ee4b37f4:function(e){return e.value},__wbg_versions_276b2795b1c6a219:function(e){return e.versions},__wbg_wasmreader_new:function(e){return v.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return J(e,t,$)},__wbindgen_cast_0000000000000002:function(e,t){return J(e,t,G)},__wbindgen_cast_0000000000000003:function(e){return e},__wbindgen_cast_0000000000000004:function(e){return e},__wbindgen_cast_0000000000000005:function(e,t){return A(e,t)},__wbindgen_cast_0000000000000006:function(e,t){return y(e,t)},__wbindgen_cast_0000000000000007:function(e){return BigInt.asUintN(64,e)},__wbindgen_cast_0000000000000008:function(e,t){var n=A(e,t).slice();return o.__wbindgen_free(e,t*1,1),n},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function G(r,e){o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke_______true_(r,e)}function $(r,e,t){const n=o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___wasm_bindgen_304c265eb9e6f0af___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_304c265eb9e6f0af___JsError___true_(r,e,t);if(n[1])throw b(n[0])}function H(r,e,t,n){o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined_______true_(r,e,t,n)}const X=["default","no-store","reload","no-cache","force-cache","only-if-cached"],Y=["omit","same-origin","include"],K=["same-origin","no-cors","cors","navigate"],k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r,1)),N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r,1));function R(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbindgen_destroy_closure(r.a,r.b));function U(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let c="[";_>0&&(c+=U(r[0]));for(let i=1;i<_;i++)c+=", "+U(r[i]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:n}function A(r,e){return r=r>>>0,T().subarray(r/1,r/1+e)}let I=null;function m(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==o.memory.buffer)&&(I=new DataView(o.memory.buffer)),I}function y(r,e){return ee(r>>>0,e)}let S=null;function Q(){return(S===null||S.byteLength===0)&&(S=new Uint32Array(o.memory.buffer)),S}let B=null;function T(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(o.memory.buffer)),B}function l(r,e){try{return r.apply(this,e)}catch(t){const n=R(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function J(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const i=n.a;n.a=0;try{return t(i,n.b,...c)}finally{n.a=i,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,z.unregister(n))},z.register(_,n,n),_}function E(r,e){const t=e(r.length*4,4)>>>0;return Q().set(r,t/4),a=r.length,t}function f(r,e,t){if(t===void 0){const s=j.encode(r),u=e(s.length,1)>>>0;return T().subarray(u,u+s.length).set(s),a=s.length,u}let n=r.length,_=e(n,1)>>>0;const c=T();let i=0;for(;i<n;i++){const s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){i!==0&&(r=r.slice(i)),_=t(_,n,n=i+r.length*3,1)>>>0;const s=T().subarray(_+i,_+n),u=j.encodeInto(r,s);i+=u.written,_=t(_,n,i,1)>>>0}return a=i,_}function b(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();const Z=2146435072;let x=0;function ee(r,e){return x+=e,x>=Z&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),x=e),O.decode(T().subarray(r,r+e))}const j=new TextEncoder;"encodeInto"in j||(j.encodeInto=function(r,e){const t=j.encode(r);return e.set(t),{read:r.length,written:t.length}});let a=0,o;function te(r,e){return o=r.exports,I=null,S=null,B=null,o.__wbindgen_start(),o}function ne(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=P();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return te(t)}function L(){let r=0;const e=new Map;return{add(t){const n=r++;return e.set(n,t),n},get(t){const n=e.get(t);if(!n)throw new Error("Attempted to use an object that has been freed");return n},remove(t){return e.delete(t)}}}const V=Symbol("transfer");function F(r,e){return{type:V,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function D(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===V)}function q(r="default"){return{createTx(e){const t=new Map,n=e??self;return n.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==r)return;const{id:i,result:s,error:u}=c,w=t.get(i);w&&(u?w.reject(u):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=re(),u=[],w=[];return i.forEach(M=>{D(M)?(u.push(M.value),w.push(...M.transfer)):u.push(M)}),n.postMessage({method:c,args:u,id:s,channelName:r},{transfer:w}),new Promise((M,se)=>{t.set(s,{resolve:M,reject:se})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:i,args:s,id:u}=c;try{const w=await e[i](...s);D(w)?n.postMessage({result:w.value,id:u,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:u,channelName:r})}catch(w){n.postMessage({error:w,id:u,channelName:r})}})}}}function re(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:_e}=q(),{createTx:oe}=q("worker");function ce(r){if(!(r!=null&&r.manifests))return r;const e=r.manifests,t=Object.assign(Object.create(null),e),n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&r.active_manifest&&(t[r.active_manifest]=n),r.manifests=t,r}const h=L(),d=L(),W=oe();_e(ie({async initWorker(r,e){ne({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return h.add(_)},reader_activeLabel(r){return h.get(r).activeLabel()??null},reader_manifestStore(r){const e=h.get(r);return ce(e.manifestStore())},reader_activeManifest(r){return h.get(r).activeManifest()},reader_json(r){return h.get(r).json()},reader_crJson(r){return h.get(r).crJson()},reader_resourceToBytes(r,e){const n=h.get(r).resourceToBytes(e);return F(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return d.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return d.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return d.add(t)},builder_setIntent(r,e){d.get(r).setIntent(e)},builder_addAction(r,e){d.get(r).addAction(e)},builder_addAssertion(r,e,t){d.get(r).addAssertion(e,t)},builder_addRedaction(r,e,t){d.get(r).addRedaction(e,t)},builder_filterActionsAt(r,e){d.get(r).filterActionsAt(Uint32Array.from(e))},builder_updateActionsAt(r,e){d.get(r).updateActionsAt(e)},builder_filterIngredientsAt(r,e){d.get(r).filterIngredientsAt(Uint32Array.from(e))},builder_filterActionsAndIngredientsAt(r,e,t){d.get(r).filterActionsAndIngredientsAt(Uint32Array.from(e),Uint32Array.from(t))},builder_setRemoteUrl(r,e){d.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){d.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){d.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){d.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await d.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){d.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return d.get(r).getDefinition()},builder_toArchive(r){const t=d.get(r).toArchive();return F(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await d.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,F(s,s.buffer),t.reserveSize)},n,_);return F(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=d.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async u=>await W.sign(e,F(u,u.buffer),t.reserveSize)},n,_);return F({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){d.get(r).free(),d.remove(r)}}));function ie(r){const e={};for(const[t,n]of Object.entries(r))e[t]=async(..._)=>{try{return await n(..._)}catch(c){throw typeof c=="string"?new Error(c):c}};return e}})();\n', A = typeof self < "u" && self.Blob && new Blob([J], { type: "text/javascript;charset=utf-8" });
1
+ import { channel as N, transfer as P } from "highgain";
2
+ const { createTx: W, rx: we } = N(), { createTx: me, rx: q } = N("worker"), L = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw b(t[0])}addAssertion(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addAssertion(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}addIngredient(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=o.wasmbuilder_addIngredient(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}addIngredientFromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,i=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n)}addRedaction(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addRedaction(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}addResourceFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}filterActionsAndIngredientsAt(e,t){const n=E(e,o.__wbindgen_malloc),_=a,c=E(t,o.__wbindgen_malloc),i=a,s=o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr,n,_,c,i);if(s[1])throw b(s[0])}filterActionsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterActionsAt(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}filterIngredientsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterIngredientsAt(this.__wbg_ptr,t,n);if(_[1])throw b(_[0])}static fromArchive(e,t){var n=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw b(c[1]);return p.__wrap(c[0])}static fromJson(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;var c=g(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw b(s[1]);return p.__wrap(s[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}static new(e){var t=g(e)?0:f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;const _=o.wasmbuilder_new(t,n);if(_[2])throw b(_[1]);return p.__wrap(_[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw b(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setRemoteUrl(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw b(c[0])}sign(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,n)}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}updateActionsAt(e){const t=o.wasmbuilder_updateActionsAt(this.__wbg_ptr,e);if(t[1])throw b(t[0])}}Symbol.dispose&&(p.prototype[Symbol.dispose]=p.prototype.free);class v{static __wrap(e){const t=Object.create(v.prototype);return t.__wbg_ptr=e,N.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=y(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}crJson(){let e,t;try{const n=o.wasmreader_crJson(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t,n){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;var i=g(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;var s=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),u=a;return o.wasmreader_fromBlobFragment(c,i,t,n,s,u)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw b(e[1]);return b(e[0])}resourceToBytes(e){const t=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,n);if(_[2])throw b(_[1]);return b(_[0])}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function C(r){const e=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),t=a,n=o.loadSettings(e,t);if(n[1])throw b(n[0])}function P(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,t){return Error(y(e,t))},__wbg_Number_6b506e6536831eaa:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,g(_)?BigInt(0):_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=U(t),_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,t){return e==t},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,g(_)?0:_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,t){throw new Error(y(e,t))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){e._wbg_cb_unref()},__wbg_abort_2ec46222bf378517:function(e){e.abort()},__wbg_abort_b29d719932441c95:function(e,t){e.abort(t)},__wbg_append_e1746995edcb0170:function(){return l(function(e,t,n,_,c){e.append(y(t,n),y(_,c))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return l(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_2c6dc3b4b85d3547:function(e){return e.byteLength},__wbg_call_8a89609d89f6608a:function(){return l(function(e,t){return e.call(t)},arguments)},__wbg_call_9c758de292015997:function(){return l(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearTimeout_6b8d9a38b9263d65:function(e){return clearTimeout(e)},__wbg_crypto_38df2bab126b63dc:function(e){return e.crypto},__wbg_done_60cf307fcc680536:function(e){return e.done},__wbg_entries_04b37a02507f1713:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(y(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_344c8d3849002659:function(e,t){return e.fetch(t)},__wbg_fetch_9dad4fe911207b37:function(e){return fetch(e)},__wbg_from_d300fe49deab18f5:function(e){return Array.from(e)},__wbg_getRandomValues_3f44b700395062e5:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_76dfc69825c9c552:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_8aa3112c6615eef6:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return l(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_00b3f7db575e4ef5:function(e){return e.getTime()},__wbg_get_1f8f054ddbaa7db2:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,t){return e[t>>>0]},__wbg_get_de6a0f7d4d18a304:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_has_73740b27f436fed3:function(){return l(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_0feb63d2d374b44a:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_9fc06d9a951bcee6:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_d0db99486956c8e8:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(e)},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(e)},__wbg_iterator_8732428d309e270e:function(){return Symbol.iterator},__wbg_length_4a591ecaa01354d9:function(e){return e.length},__wbg_length_66f1a4b2e9026940:function(e){return e.length},__wbg_msCrypto_bd5a034af96bcba6:function(e){return e.msCrypto},__wbg_new_0_445c13a750296eb6:function(){return new Date},__wbg_new_0d09705104e164af:function(){return l(function(){return new AbortController},arguments)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_578aeef4b6b94378:function(e){return new Uint8Array(e)},__wbg_new_622fc80556be2e26:function(){return new Map},__wbg_new_a1b9f645bba64f0f:function(){return l(function(){return new FileReaderSync},arguments)},__wbg_new_ce1ab61c1c2b300d:function(){return new Object},__wbg_new_d90091b82fdf5b91:function(){return new Array},__wbg_new_e436d06bc8e77460:function(){return l(function(){return new Headers},arguments)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_typed_bf31d18f92484486:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const u=n.a;n.a=0;try{return H(u,n.b,i,s)}finally{n.a=u}};return new Promise(_)}finally{n.a=0}},__wbg_new_with_length_36a4998e27b014c5:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return l(function(e,t,n){return new Request(y(e,t),n)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){return e.next},__wbg_next_eb8ca7351fa27906:function(){return l(function(e){return e.next()},arguments)},__wbg_node_84ea875411254db1:function(e){return e.node},__wbg_now_190933fa139cc119:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){return e.process},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(e)},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){return e.queueMicrotask},__wbg_randomFillSync_6c25eac9869eb53c:function(){return l(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_f1b8da05559618d9:function(){return l(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return l(function(){return module.require},arguments)},__wbg_resolve_25a7e548d5881dca:function(e){return Promise.resolve(e)},__wbg_setTimeout_f757f00851f76c42:function(e,t){return setTimeout(e,t)},__wbg_set_29c99a8aac1c01e5:function(e,t,n){e.set(A(t,n))},__wbg_set_52b1e1eb5bed906a:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_body_36614c7e61546809:function(e,t){e.body=t},__wbg_set_cache_488ea16c11cbf20d:function(e,t){e.cache=X[t]},__wbg_set_credentials_fa9c491a27c4bdf0:function(e,t){e.credentials=Y[t]},__wbg_set_dca99999bba88a9a:function(e,t,n){e[t>>>0]=n},__wbg_set_headers_7c1e39ece7826bec:function(e,t){e.headers=t},__wbg_set_method_7a6811dec7a4feff:function(e,t,n){e.method=y(t,n)},__wbg_set_mode_c90e3667002857d4:function(e,t){e.mode=K[t]},__wbg_set_signal_d9da62b3f215c821:function(e,t){e.signal=t},__wbg_signal_e03304a84df9ed09:function(e){return e.signal},__wbg_size_9970092b88b1094c:function(e){return e.size},__wbg_slice_02bb778501725738:function(){return l(function(e,t,n){return e.slice(t,n)},arguments)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){const e=typeof global>"u"?null:global;return g(e)?0:R(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:R(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return g(e)?0:R(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return g(e)?0:R(e)},__wbg_status_00549d55b78d949e:function(e){return e.status},__wbg_stringify_8286df6dcc591521:function(){return l(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_4aa221f6a4f5ab22:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_18f476d590e58992:function(e,t,n){return e.then(t,n)},__wbg_then_ac7b025999b52837:function(e,t){return e.then(t)},__wbg_url_6808f1c468f2d0cd:function(e,t){const n=t.url,_=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_41ae57308c1f031c:function(e){return e.valueOf()},__wbg_value_f3625092ee4b37f4:function(e){return e.value},__wbg_versions_276b2795b1c6a219:function(e){return e.versions},__wbg_wasmreader_new:function(e){return v.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return J(e,t,$)},__wbindgen_cast_0000000000000002:function(e,t){return J(e,t,G)},__wbindgen_cast_0000000000000003:function(e){return e},__wbindgen_cast_0000000000000004:function(e){return e},__wbindgen_cast_0000000000000005:function(e,t){return A(e,t)},__wbindgen_cast_0000000000000006:function(e,t){return y(e,t)},__wbindgen_cast_0000000000000007:function(e){return BigInt.asUintN(64,e)},__wbindgen_cast_0000000000000008:function(e,t){var n=A(e,t).slice();return o.__wbindgen_free(e,t*1,1),n},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function G(r,e){o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke_______true_(r,e)}function $(r,e,t){const n=o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___wasm_bindgen_304c265eb9e6f0af___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_304c265eb9e6f0af___JsError___true_(r,e,t);if(n[1])throw b(n[0])}function H(r,e,t,n){o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined_______true_(r,e,t,n)}const X=["default","no-store","reload","no-cache","force-cache","only-if-cached"],Y=["omit","same-origin","include"],K=["same-origin","no-cors","cors","navigate"],k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r,1)),N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r,1));function R(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbindgen_destroy_closure(r.a,r.b));function U(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let c="[";_>0&&(c+=U(r[0]));for(let i=1;i<_;i++)c+=", "+U(r[i]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:n}function A(r,e){return r=r>>>0,T().subarray(r/1,r/1+e)}let I=null;function m(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==o.memory.buffer)&&(I=new DataView(o.memory.buffer)),I}function y(r,e){return ee(r>>>0,e)}let S=null;function Q(){return(S===null||S.byteLength===0)&&(S=new Uint32Array(o.memory.buffer)),S}let B=null;function T(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(o.memory.buffer)),B}function l(r,e){try{return r.apply(this,e)}catch(t){const n=R(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function J(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const i=n.a;n.a=0;try{return t(i,n.b,...c)}finally{n.a=i,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,z.unregister(n))},z.register(_,n,n),_}function E(r,e){const t=e(r.length*4,4)>>>0;return Q().set(r,t/4),a=r.length,t}function f(r,e,t){if(t===void 0){const s=j.encode(r),u=e(s.length,1)>>>0;return T().subarray(u,u+s.length).set(s),a=s.length,u}let n=r.length,_=e(n,1)>>>0;const c=T();let i=0;for(;i<n;i++){const s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){i!==0&&(r=r.slice(i)),_=t(_,n,n=i+r.length*3,1)>>>0;const s=T().subarray(_+i,_+n),u=j.encodeInto(r,s);i+=u.written,_=t(_,n,i,1)>>>0}return a=i,_}function b(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();const Z=2146435072;let x=0;function ee(r,e){return x+=e,x>=Z&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),x=e),O.decode(T().subarray(r,r+e))}const j=new TextEncoder;"encodeInto"in j||(j.encodeInto=function(r,e){const t=j.encode(r);return e.set(t),{read:r.length,written:t.length}});let a=0,o;function te(r,e){return o=r.exports,I=null,S=null,B=null,o.__wbindgen_start(),o}function ne(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=P();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return te(t)}function L(){let r=0;const e=new Map;return{add(t){const n=r++;return e.set(n,t),n},get(t){const n=e.get(t);if(!n)throw new Error("Attempted to use an object that has been freed");return n},remove(t){return e.delete(t)}}}const V=Symbol("transfer");function F(r,e){return{type:V,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function D(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===V)}function q(r="default"){return{createTx(e){const t=new Map,n=e??self;return n.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==r)return;const{id:i,result:s,error:u}=c,w=t.get(i);w&&(u?w.reject(u):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=re(),u=[],w=[];return i.forEach(M=>{D(M)?(u.push(M.value),w.push(...M.transfer)):u.push(M)}),n.postMessage({method:c,args:u,id:s,channelName:r},{transfer:w}),new Promise((M,se)=>{t.set(s,{resolve:M,reject:se})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:i,args:s,id:u}=c;try{const w=await e[i](...s);D(w)?n.postMessage({result:w.value,id:u,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:u,channelName:r})}catch(w){n.postMessage({error:w,id:u,channelName:r})}})}}}function re(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:_e}=q(),{createTx:oe}=q("worker");function ce(r){if(!(r!=null&&r.manifests))return r;const e=r.manifests,t=Object.assign(Object.create(null),e),n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&r.active_manifest&&(t[r.active_manifest]=n),r.manifests=t,r}const h=L(),d=L(),W=oe();_e(ie({async initWorker(r,e){ne({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return h.add(_)},reader_activeLabel(r){return h.get(r).activeLabel()??null},reader_manifestStore(r){const e=h.get(r);return ce(e.manifestStore())},reader_activeManifest(r){return h.get(r).activeManifest()},reader_json(r){return h.get(r).json()},reader_crJson(r){return h.get(r).crJson()},reader_resourceToBytes(r,e){const n=h.get(r).resourceToBytes(e);return F(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return d.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return d.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return d.add(t)},builder_setIntent(r,e){d.get(r).setIntent(e)},builder_addAction(r,e){d.get(r).addAction(e)},builder_addAssertion(r,e,t){d.get(r).addAssertion(e,t)},builder_addRedaction(r,e,t){d.get(r).addRedaction(e,t)},builder_filterActionsAt(r,e){d.get(r).filterActionsAt(Uint32Array.from(e))},builder_updateActionsAt(r,e){d.get(r).updateActionsAt(e)},builder_filterIngredientsAt(r,e){d.get(r).filterIngredientsAt(Uint32Array.from(e))},builder_filterActionsAndIngredientsAt(r,e,t){d.get(r).filterActionsAndIngredientsAt(Uint32Array.from(e),Uint32Array.from(t))},builder_setRemoteUrl(r,e){d.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){d.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){d.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){d.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await d.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){d.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return d.get(r).getDefinition()},builder_toArchive(r){const t=d.get(r).toArchive();return F(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await d.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,F(s,s.buffer),t.reserveSize)},n,_);return F(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=d.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async u=>await W.sign(e,F(u,u.buffer),t.reserveSize)},n,_);return F({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){d.get(r).free(),d.remove(r)}}));function ie(r){const e={};for(const[t,n]of Object.entries(r))e[t]=async(..._)=>{try{return await n(..._)}catch(c){throw typeof c=="string"?new Error(c):c}};return e}})();\n', F = typeof self < "u" && self.Blob && new Blob([L], { type: "text/javascript;charset=utf-8" });
4
3
  function C(e) {
5
4
  let t;
6
5
  try {
7
- if (t = A && (self.URL || self.webkitURL).createObjectURL(A), !t) throw "";
8
- const i = new Worker(t, {
6
+ if (t = F && (self.URL || self.webkitURL).createObjectURL(F), !t) throw "";
7
+ const n = new Worker(t, {
9
8
  name: e == null ? void 0 : e.name
10
9
  });
11
- return i.addEventListener("error", () => {
10
+ return n.addEventListener("error", () => {
12
11
  (self.URL || self.webkitURL).revokeObjectURL(t);
13
- }), i;
12
+ }), n;
14
13
  } catch {
15
14
  return new Worker(
16
- "data:text/javascript;charset=utf-8," + encodeURIComponent(J),
15
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(L),
17
16
  {
18
17
  name: e == null ? void 0 : e.name
19
18
  }
@@ -22,7 +21,7 @@ function C(e) {
22
21
  t && (self.URL || self.webkitURL).revokeObjectURL(t);
23
22
  }
24
23
  }
25
- function q(e) {
24
+ function V(e) {
26
25
  if (e.protocol !== "https:")
27
26
  throw new Error(
28
27
  `Worker source URL must use https, but got ${e.protocol}`
@@ -30,44 +29,37 @@ function q(e) {
30
29
  return e.toString();
31
30
  }
32
31
  async function G(e) {
33
- const { wasm: t, settingsString: i, workerSrc: r } = e;
34
- let n = 0;
35
- const _ = r ? new Worker(q(r), { type: "module" }) : new C(), o = W(_), s = /* @__PURE__ */ new Map();
36
- P(
32
+ const { wasm: t, settingsString: n, workerSrc: r } = e;
33
+ let i = 0;
34
+ const o = r ? new Worker(V(r), { type: "module" }) : new C(), _ = W(o), a = /* @__PURE__ */ new Map();
35
+ q(
37
36
  {
38
37
  sign: async (c, u, f) => {
39
- const d = s.get(c);
40
- if (s.delete(c), !d)
38
+ const d = a.get(c);
39
+ if (a.delete(c), !d)
41
40
  throw new Error("No signer registered for request");
42
41
  const b = await d(u, f);
43
- return $(b, b.buffer);
42
+ return P(b, b.buffer);
44
43
  }
45
44
  },
46
- _
45
+ o
47
46
  );
48
- function a(c) {
49
- const u = n++;
50
- return s.set(u, c), u;
47
+ function s(c) {
48
+ const u = i++;
49
+ return a.set(u, c), u;
51
50
  }
52
- return await o.initWorker(t, i), {
53
- tx: o,
54
- registerSignReceiver: a,
55
- terminate: () => _.terminate()
51
+ return await _.initWorker(t, n), {
52
+ tx: _,
53
+ registerSignReceiver: s,
54
+ terminate: () => o.terminate()
56
55
  };
57
56
  }
58
- class v extends Error {
59
- constructor(t) {
60
- super(
61
- `The provided asset was too large. Size: ${t} bytes. Maximum: ${h}.`
62
- ), this.name = "AssetTooLargeError";
63
- }
64
- }
65
- class R extends Error {
57
+ class I extends Error {
66
58
  constructor(t) {
67
59
  super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
68
60
  }
69
61
  }
70
- const V = [
62
+ const k = [
71
63
  "jpg",
72
64
  "video/mp4",
73
65
  "image/heif",
@@ -128,168 +120,266 @@ const V = [
128
120
  "jxl",
129
121
  "image/jxl"
130
122
  ];
131
- function S(e) {
132
- return V.includes(e);
133
- }
134
- const Y = {
135
- userAnchors: !0,
136
- trustAnchors: !0,
137
- trustConfig: !0,
138
- allowedList: !0
139
- }, X = Object.keys(Y), Z = {
140
- builder: {
141
- generateC2paArchive: !0
142
- }
143
- }, I = 1 * 1024 * 1024;
144
- async function l(e, t) {
145
- const i = t ? p(e ?? {}, t) : e;
146
- if (!i)
147
- return;
148
- const r = p(Z, i), n = [];
149
- return r.trust && n.push(T(r.trust)), r.cawgTrust && n.push(T(r.cawgTrust)), await Promise.all(n), JSON.stringify(k(r));
150
- }
151
- function k(e) {
152
- return Object.entries(e).reduce(
153
- (i, [r, n]) => (i[K(r)] = typeof n == "object" && n !== null ? k(n) : n, i),
154
- {}
155
- );
123
+ function T(e) {
124
+ return k.includes(e);
156
125
  }
157
- function K(e) {
158
- return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
159
- }
160
- async function T(e) {
161
- try {
162
- const t = Object.entries(e).filter(([i]) => X.includes(i)).map(async ([i, r]) => {
163
- if (r && typeof r == "object" && Array.isArray(r)) {
164
- const n = r.map(async (s) => {
165
- if (typeof s != "string")
166
- throw new Error("Expected a string value for array item");
167
- const a = await j(s);
168
- if (E(i) && !F(a))
169
- throw new Error(`Error parsing PEM file at: ${s}`);
170
- return a;
171
- }), o = (await Promise.all(n)).join("");
172
- e[i] = o;
173
- } else if (r && typeof r == "string" && H(r)) {
174
- const n = await j(r);
175
- if (E(i) && !F(n))
176
- throw new Error(`Error parsing PEM file at: ${r}`);
177
- e[i] = n;
178
- } else
179
- return r;
180
- });
181
- await Promise.all(t);
182
- } catch (t) {
183
- const i = t instanceof Error ? t.message : String(t);
184
- throw new Error(`Failed to resolve trust settings. ${i}`, { cause: t });
126
+ const y = (e) => {
127
+ if (typeof e == "object" && e !== null) {
128
+ if (typeof Object.getPrototypeOf == "function") {
129
+ const t = Object.getPrototypeOf(e);
130
+ return t === Object.prototype || t === null;
131
+ }
132
+ return Object.prototype.toString.call(e) === "[object Object]";
185
133
  }
134
+ return !1;
135
+ }, Y = /* @__PURE__ */ new Set([
136
+ "__proto__",
137
+ "constructor",
138
+ "prototype",
139
+ "toString",
140
+ "valueOf",
141
+ "hasOwnProperty",
142
+ "isPrototypeOf",
143
+ "propertyIsEnumerable",
144
+ "toLocaleString"
145
+ ]), l = (...e) => e.reduce((t, n) => {
146
+ if (n === void 0)
147
+ return t;
148
+ if (Array.isArray(n))
149
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
150
+ return Object.keys(n).forEach((r) => {
151
+ Y.has(r) || (Array.isArray(t[r]) && Array.isArray(n[r]) ? t[r] = l.options.mergeArrays ? l.options.uniqueArrayItems ? Array.from(new Set(t[r].concat(n[r]))) : [...t[r], ...n[r]] : n[r] : y(t[r]) && y(n[r]) ? t[r] = l(t[r], n[r]) : !y(t[r]) && y(n[r]) ? t[r] = l(n[r], void 0) : t[r] = n[r] === void 0 ? l.options.allowUndefinedOverrides ? n[r] : t[r] : n[r]);
152
+ }), t;
153
+ }, {}), S = {
154
+ allowUndefinedOverrides: !0,
155
+ mergeArrays: !0,
156
+ uniqueArrayItems: !0
157
+ };
158
+ l.options = S;
159
+ l.withOptions = (e, ...t) => {
160
+ l.options = Object.assign(Object.assign({}, S), e);
161
+ const n = l(...t);
162
+ return l.options = S, n;
163
+ };
164
+ const K = 1 * 1024 * 1024, X = 2, H = 200, Z = 2e3, Q = 3e4;
165
+ function ee(e) {
166
+ return e === 429 || e >= 500;
186
167
  }
187
- const E = (e) => ["userAnchors", "trustAnchors"].includes(e), F = (e) => e.includes("-----BEGIN CERTIFICATE-----"), H = (e) => e.startsWith("http"), w = 2, Q = 200, x = 2e3, M = 3e4;
188
- function B(e) {
189
- const t = Math.min(
190
- Q * 2 ** e,
191
- x
192
- ), i = Math.floor(Math.random() * 200);
193
- return Math.min(t + i, x);
168
+ function te(e) {
169
+ return e instanceof Error && e.name === "AbortError";
194
170
  }
195
- function ee(e) {
171
+ function ne(e, t, n) {
172
+ const r = Math.min(t * 2 ** e, n), i = Math.floor(Math.random() * 200);
173
+ return Math.min(r + i, n);
174
+ }
175
+ function re(e) {
196
176
  if (!e)
197
177
  return null;
198
178
  const t = Number(e);
199
179
  if (!Number.isNaN(t))
200
180
  return t * 1e3;
201
- const i = Date.parse(e);
202
- return Number.isNaN(i) ? null : i - Date.now();
181
+ const n = Date.parse(e);
182
+ return Number.isNaN(n) ? null : n - Date.now();
183
+ }
184
+ function ie(e) {
185
+ try {
186
+ new URL(e);
187
+ } catch {
188
+ throw new Error(`Invalid URL: ${e}`);
189
+ }
203
190
  }
204
- async function j(e) {
205
- for (let t = 0; ; t++) {
206
- let i;
191
+ async function D(e, t, n) {
192
+ ie(e);
193
+ const r = (n == null ? void 0 : n.maxRetries) ?? X, i = (n == null ? void 0 : n.initialRetryDelayMs) ?? H, o = (n == null ? void 0 : n.maxRetryDelayMs) ?? Z, _ = (n == null ? void 0 : n.maxRetryAfterMs) ?? Q, a = (n == null ? void 0 : n.isRetryableStatus) ?? ee, s = (n == null ? void 0 : n.isRetryableError) ?? (() => !0), c = (n == null ? void 0 : n.fetch) ?? fetch, u = (f) => ne(f, i, o);
194
+ for (let f = 0; ; f++) {
195
+ let d;
207
196
  try {
208
- i = await fetch(e);
209
- } catch (n) {
210
- if (t < w) {
211
- await new Promise((o) => setTimeout(o, B(t)));
197
+ d = await c(e, t);
198
+ } catch (b) {
199
+ if (!te(b) && s(b) && f < r) {
200
+ await new Promise((m) => setTimeout(m, u(f)));
212
201
  continue;
213
202
  }
214
- const _ = n instanceof Error ? n.message : String(n);
215
- throw new Error(`Network error fetching ${e}: ${_}`, { cause: n });
203
+ const g = b instanceof Error ? b.message : String(b);
204
+ throw new Error(`Network error fetching ${e}: ${g}`, {
205
+ cause: b
206
+ });
216
207
  }
217
- if (!i.ok) {
218
- if (i.status === 429 || i.status >= 500) {
219
- if (i.status === 429) {
220
- const _ = ee(i.headers.get("retry-after"));
221
- if (_ !== null) {
222
- if (_ > M)
223
- throw new Error(
224
- `Failed to fetch ${e}: server requested a Retry-After delay of ${Math.ceil(_ / 1e3)}s, which exceeds the maximum allowed delay of ${M / 1e3}s`
225
- );
226
- if (t < w) {
227
- await new Promise((o) => setTimeout(o, Math.max(_, 0)));
228
- continue;
229
- }
230
- throw new Error(`Failed to fetch ${e}: ${i.status} ${i.statusText}`);
208
+ if (!d.ok) {
209
+ if (a(d.status)) {
210
+ const g = re(d.headers.get("retry-after"));
211
+ if (g !== null) {
212
+ if (g > _)
213
+ throw new Error(`Failed to fetch ${e}: server requested a Retry-After delay of ${Math.ceil(g / 1e3)}s, which exceeds the maximum allowed delay of ${_ / 1e3}s`);
214
+ if (f < r) {
215
+ await new Promise((m) => setTimeout(m, Math.max(g, 0)));
216
+ continue;
231
217
  }
218
+ throw new Error(`Failed to fetch ${e}: ${d.status} ${d.statusText}`);
232
219
  }
233
- if (t < w) {
234
- await new Promise((_) => setTimeout(_, B(t)));
220
+ if (f < r) {
221
+ await new Promise((m) => setTimeout(m, u(f)));
235
222
  continue;
236
223
  }
237
224
  }
238
- throw new Error(`Failed to fetch ${e}: ${i.status} ${i.statusText}`);
225
+ throw new Error(`Failed to fetch ${e}: ${d.status} ${d.statusText}`);
239
226
  }
240
- const r = await i.text();
241
- if (r.length > I)
242
- throw new Error(`Response from ${e} is too large. Max size is ${I} bytes.`);
243
- return r;
227
+ return d;
244
228
  }
245
229
  }
246
- const h = 10 ** 9;
247
- function te(e, t) {
248
- const { tx: i } = e, r = t, n = new FinalizationRegistry(async (_) => {
249
- await i.reader_free(_);
230
+ async function x(e, t) {
231
+ const n = (t == null ? void 0 : t.maxResponseBytes) ?? K, r = await D(e, void 0, t), i = r.headers.get("content-length");
232
+ if (i !== null && Number(i) > n)
233
+ throw new Error(`Response from ${e} is too large. Max size is ${n} bytes.`);
234
+ const o = await r.text();
235
+ if (o.length > n)
236
+ throw new Error(`Response from ${e} is too large. Max size is ${n} bytes.`);
237
+ return o;
238
+ }
239
+ function E(e) {
240
+ return Object.entries(e).reduce((n, [r, i]) => (n[oe(r)] = z(i), n), {});
241
+ }
242
+ function z(e) {
243
+ return Array.isArray(e) ? e.map(z) : typeof e == "object" && e !== null ? E(e) : e;
244
+ }
245
+ function oe(e) {
246
+ return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
247
+ }
248
+ const _e = {
249
+ builder: {
250
+ generateC2paArchive: !0
251
+ }
252
+ };
253
+ async function w(e, t, n) {
254
+ const r = t ? l(e ?? {}, t) : e;
255
+ if (!r)
256
+ return;
257
+ const i = l(_e, r), o = [];
258
+ return i.trust && o.push(M(i.trust, n)), i.cawgTrust && o.push(M(i.cawgTrust, n)), await Promise.all(o), JSON.stringify(E(i));
259
+ }
260
+ function ye(e) {
261
+ return { trust: { ...e } };
262
+ }
263
+ function he(e) {
264
+ return { cawgTrust: { ...e } };
265
+ }
266
+ function pe(e) {
267
+ return { verify: { ...e } };
268
+ }
269
+ function Ae(...e) {
270
+ return l(...e);
271
+ }
272
+ function Re(e) {
273
+ return JSON.stringify(E(e));
274
+ }
275
+ async function ve(e, t) {
276
+ return await (await D(e, void 0, t)).text();
277
+ }
278
+ const ae = [
279
+ "userAnchors",
280
+ "trustAnchors",
281
+ "trustConfig",
282
+ "allowedList"
283
+ ];
284
+ async function M(e, t) {
285
+ const n = (o) => ["userAnchors", "trustAnchors"].includes(o), r = (o) => o.includes("-----BEGIN CERTIFICATE-----"), i = (o) => o.startsWith("http");
286
+ try {
287
+ const o = Object.entries(e).filter(([_]) => ae.includes(_)).map(async ([_, a]) => {
288
+ if (a && typeof a == "object" && Array.isArray(a)) {
289
+ const s = a.map(async (f) => {
290
+ if (typeof f != "string")
291
+ throw new Error("Expected a string value for array item");
292
+ const d = await x(f, t);
293
+ if (n(_) && !r(d))
294
+ throw new Error(`Error parsing PEM file at: ${f}`);
295
+ return d;
296
+ }), u = (await Promise.all(s)).join("");
297
+ e[_] = u;
298
+ } else if (a && typeof a == "string" && i(a)) {
299
+ const s = await x(a, t);
300
+ if (n(_) && !r(s))
301
+ throw new Error(`Error parsing PEM file at: ${a}`);
302
+ e[_] = s;
303
+ } else
304
+ return a;
305
+ });
306
+ await Promise.all(o);
307
+ } catch (o) {
308
+ const _ = o instanceof Error ? o.message : String(o);
309
+ throw new Error(`Failed to resolve trust settings. ${_}`, {
310
+ cause: o
311
+ });
312
+ }
313
+ }
314
+ const se = 10 ** 9;
315
+ function J(e) {
316
+ return Number.isFinite(e) && e > 0 ? e : se;
317
+ }
318
+ class ce extends Error {
319
+ /**
320
+ * @param sizeInBytes Size of the asset, in bytes.
321
+ * @param maxSizeInBytes Maximum allowed size, in bytes. `0` (or any other
322
+ * non-finite/negative value) resolves to {@link DEFAULT_MAX_SIZE_IN_BYTES}.
323
+ */
324
+ constructor(t, n) {
325
+ const r = J(n);
326
+ super(`The provided asset was too large. Size: ${t} bytes. Maximum: ${r}.`), this.name = "AssetTooLargeError";
327
+ }
328
+ }
329
+ function p(e, t) {
330
+ if (!Number.isFinite(e) || e < 0)
331
+ throw new RangeError(`sizeInBytes must be a finite, non-negative number. Received: ${e}.`);
332
+ if (!Number.isFinite(t) || t < 0)
333
+ throw new RangeError(`maxSizeInBytes must be a finite, non-negative number. Received: ${t}.`);
334
+ const n = J(t);
335
+ if (e > n)
336
+ throw new ce(e, n);
337
+ }
338
+ const A = 10 ** 9;
339
+ function ue(e, t) {
340
+ const { tx: n } = e, r = t, i = new FinalizationRegistry(async (o) => {
341
+ await n.reader_free(o);
250
342
  });
251
343
  return {
252
- async fromBlob(_, o, s) {
253
- if (!S(_))
254
- throw new R(_);
255
- if (o.size > h)
256
- throw new v(o.size);
344
+ async fromBlob(o, _, a) {
345
+ if (!T(o))
346
+ throw new I(o);
347
+ p(_.size, A);
257
348
  try {
258
- const a = await l(r, s), c = await i.reader_fromBlob(_, o, a), u = N(e, c, () => {
259
- n.unregister(u);
349
+ const s = await w(r, a), c = await n.reader_fromBlob(o, _, s), u = B(e, c, () => {
350
+ i.unregister(u);
260
351
  });
261
- return n.register(u, c, u), u;
262
- } catch (a) {
263
- return U(a);
352
+ return i.register(u, c, u), u;
353
+ } catch (s) {
354
+ return j(s);
264
355
  }
265
356
  },
266
- async fromBlobFragment(_, o, s, a) {
267
- if (!S(_))
268
- throw new R(_);
269
- if (o.size > h)
270
- throw new v(o.size);
357
+ async fromBlobFragment(o, _, a, s) {
358
+ if (!T(o))
359
+ throw new I(o);
360
+ p(_.size, A), p(a.size, A);
271
361
  try {
272
- const c = await l(r, a), u = await i.reader_fromBlobFragment(
273
- _,
362
+ const c = await w(r, s), u = await n.reader_fromBlobFragment(
274
363
  o,
275
- s,
364
+ _,
365
+ a,
276
366
  c
277
- ), f = N(e, u, () => {
278
- n.unregister(f);
367
+ ), f = B(e, u, () => {
368
+ i.unregister(f);
279
369
  });
280
- return n.register(f, u, f), f;
370
+ return i.register(f, u, f), f;
281
371
  } catch (c) {
282
- return U(c);
372
+ return j(c);
283
373
  }
284
374
  }
285
375
  };
286
376
  }
287
- function U(e) {
377
+ function j(e) {
288
378
  if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
289
379
  return null;
290
380
  throw e;
291
381
  }
292
- function N(e, t, i) {
382
+ function B(e, t, n) {
293
383
  const { tx: r } = e;
294
384
  return {
295
385
  async activeLabel() {
@@ -302,37 +392,37 @@ function N(e, t, i) {
302
392
  return await r.reader_activeManifest(t);
303
393
  },
304
394
  async json() {
305
- const n = await r.reader_json(t);
306
- return JSON.parse(n);
395
+ const i = await r.reader_json(t);
396
+ return JSON.parse(i);
307
397
  },
308
398
  async crJson() {
309
- const n = await r.reader_crJson(t);
310
- return JSON.parse(n);
399
+ const i = await r.reader_crJson(t);
400
+ return JSON.parse(i);
311
401
  },
312
- async resourceToBytes(n) {
313
- return await r.reader_resourceToBytes(t, n);
402
+ async resourceToBytes(i) {
403
+ return await r.reader_resourceToBytes(t, i);
314
404
  },
315
405
  async free() {
316
- i(), await r.reader_free(t);
406
+ n(), await r.reader_free(t);
317
407
  }
318
408
  };
319
409
  }
320
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e, 1));
321
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e, 1));
322
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e, 1));
323
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbindgen_destroy_closure(e.a, e.b));
324
- let ne = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
325
- ne.decode();
326
- const m = new TextEncoder();
327
- "encodeInto" in m || (m.encodeInto = function(e, t) {
328
- const i = m.encode(e);
329
- return t.set(i), {
410
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => h.__wbg_wasmbuilder_free(e, 1));
411
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => h.__wbg_wasmreader_free(e, 1));
412
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => h.__wbg_wasmsigner_free(e, 1));
413
+ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => h.__wbindgen_destroy_closure(e.a, e.b));
414
+ let fe = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
415
+ fe.decode();
416
+ const R = new TextEncoder();
417
+ "encodeInto" in R || (R.encodeInto = function(e, t) {
418
+ const n = R.encode(e);
419
+ return t.set(n), {
330
420
  read: e.length,
331
- written: i.length
421
+ written: n.length
332
422
  };
333
423
  });
334
- let g;
335
- const re = "sha512-JDgJjxNbd/twwreFXlKMWAMvONRRKQot0lqVEL/GA4Uw5j4kTw1fSfLy14JE/mX1gyzDZdZsE+a8eg1QZkJ04Q==";
424
+ let h;
425
+ const de = "sha512-MqM7VL8b6NoK003EIdVNEV5gmt/a52dS+KYs96DK45qy5YfEQFKGDTDBJszTSSoGP7JoRfYqLw5ER1FQnnf1jw==";
336
426
  async function O(e) {
337
427
  const { alg: t } = e;
338
428
  return {
@@ -340,102 +430,102 @@ async function O(e) {
340
430
  alg: t
341
431
  };
342
432
  }
343
- function L(e) {
344
- return D(e).flat();
433
+ function U(e) {
434
+ return $(e).flat();
345
435
  }
346
- function D(e) {
436
+ function $(e) {
347
437
  return (e.assertions ?? []).filter((t) => t.label.startsWith("c2pa.actions")).map((t) => {
348
- const i = t.data;
349
- return (i == null ? void 0 : i.actions) ?? [];
438
+ const n = t.data;
439
+ return (n == null ? void 0 : n.actions) ?? [];
350
440
  });
351
441
  }
352
- function ie(e, t) {
353
- const i = t, { tx: r } = e, n = new FinalizationRegistry((_) => {
354
- r.builder_free(_);
442
+ function be(e, t) {
443
+ const n = t, { tx: r } = e, i = new FinalizationRegistry((o) => {
444
+ r.builder_free(o);
355
445
  });
356
446
  return {
357
- async new(_) {
358
- const o = await l(i, _), s = await r.builder_new(o), a = y(e, s, () => {
359
- n.unregister(a);
447
+ async new(o) {
448
+ const _ = await w(n, o), a = await r.builder_new(_), s = v(e, a, () => {
449
+ i.unregister(s);
360
450
  });
361
- return n.register(a, s, a), a;
451
+ return i.register(s, a, s), s;
362
452
  },
363
- async fromDefinition(_, o) {
364
- const s = JSON.stringify(_), a = await l(i, o), c = await r.builder_fromJson(s, a), u = y(e, c, () => {
365
- n.unregister(u);
453
+ async fromDefinition(o, _) {
454
+ const a = JSON.stringify(o), s = await w(n, _), c = await r.builder_fromJson(a, s), u = v(e, c, () => {
455
+ i.unregister(u);
366
456
  });
367
- return n.register(u, c, u), u;
457
+ return i.register(u, c, u), u;
368
458
  },
369
- async fromArchive(_, o) {
370
- const s = await l(i, o), a = await r.builder_fromArchive(_, s), c = y(e, a, () => {
371
- n.unregister(c);
459
+ async fromArchive(o, _) {
460
+ const a = await w(n, _), s = await r.builder_fromArchive(o, a), c = v(e, s, () => {
461
+ i.unregister(c);
372
462
  });
373
- return n.register(c, a, c), c;
463
+ return i.register(c, s, c), c;
374
464
  }
375
465
  };
376
466
  }
377
- function y(e, t, i) {
467
+ function v(e, t, n) {
378
468
  const { tx: r } = e;
379
469
  return {
380
- async setIntent(n) {
381
- await r.builder_setIntent(t, n);
470
+ async setIntent(i) {
471
+ await r.builder_setIntent(t, i);
382
472
  },
383
- async addAction(n) {
384
- await r.builder_addAction(t, n);
473
+ async addAction(i) {
474
+ await r.builder_addAction(t, i);
385
475
  },
386
- async addAssertion(n, _) {
387
- await r.builder_addAssertion(t, n, _);
476
+ async addAssertion(i, o) {
477
+ await r.builder_addAssertion(t, i, o);
388
478
  },
389
- async addRedaction(n, _) {
390
- await r.builder_addRedaction(t, n, _);
479
+ async addRedaction(i, o) {
480
+ await r.builder_addRedaction(t, i, o);
391
481
  },
392
- async setRemoteUrl(n) {
393
- await r.builder_setRemoteUrl(t, n);
482
+ async setRemoteUrl(i) {
483
+ await r.builder_setRemoteUrl(t, i);
394
484
  },
395
- async setNoEmbed(n) {
396
- await r.builder_setNoEmbed(t, n);
485
+ async setNoEmbed(i) {
486
+ await r.builder_setNoEmbed(t, i);
397
487
  },
398
- async setThumbnailFromBlob(n, _) {
399
- await r.builder_setThumbnailFromBlob(t, n, _);
488
+ async setThumbnailFromBlob(i, o) {
489
+ await r.builder_setThumbnailFromBlob(t, i, o);
400
490
  },
401
491
  // Unlike the Node binding, Neon, which can invoke the JS predicate synchronously from Rust,
402
492
  // the WASM builder lives in a Web Worker. A predicate closure can't be called across the
403
493
  // worker boundary, so we evaluate it here on the main thread and send the resulting indices
404
494
  // to the worker, where WASM applies the equivalent index-based filter. The action/ingredient
405
495
  // ordering here must match what WASM iterates. See `filterActionsAt` and `filterIngredientsAt`.
406
- async filterActions(n) {
407
- const _ = await r.builder_getDefinition(t), s = L(_).reduce((a, c, u) => (n(c) && a.push(u), a), []);
408
- await r.builder_filterActionsAt(t, s);
496
+ async filterActions(i) {
497
+ const o = await r.builder_getDefinition(t), a = U(o).reduce((s, c, u) => (i(c) && s.push(u), s), []);
498
+ await r.builder_filterActionsAt(t, a);
409
499
  },
410
- async filterIngredients(n) {
411
- const s = ((await r.builder_getDefinition(t)).ingredients ?? []).reduce((a, c, u) => (n(c) && a.push(u), a), []);
412
- await r.builder_filterIngredientsAt(t, s);
500
+ async filterIngredients(i) {
501
+ const a = ((await r.builder_getDefinition(t)).ingredients ?? []).reduce((s, c, u) => (i(c) && s.push(u), s), []);
502
+ await r.builder_filterIngredientsAt(t, a);
413
503
  },
414
- async filterActionsAndIngredients(n, _) {
415
- const o = await r.builder_getDefinition(t), a = L(o).reduce((f, d, b) => (n(d) && f.push(b), f), []), u = (o.ingredients ?? []).reduce(
416
- (f, d, b) => (_(d) && f.push(b), f),
504
+ async filterActionsAndIngredients(i, o) {
505
+ const _ = await r.builder_getDefinition(t), s = U(_).reduce((f, d, b) => (i(d) && f.push(b), f), []), u = (_.ingredients ?? []).reduce(
506
+ (f, d, b) => (o(d) && f.push(b), f),
417
507
  []
418
508
  );
419
509
  await r.builder_filterActionsAndIngredientsAt(
420
510
  t,
421
- a,
511
+ s,
422
512
  u
423
513
  );
424
514
  },
425
- async updateActions(n) {
426
- const _ = await r.builder_getDefinition(t), s = D(_).map((a) => n(a));
427
- await r.builder_updateActionsAt(t, s);
515
+ async updateActions(i) {
516
+ const o = await r.builder_getDefinition(t), a = $(o).map((s) => i(s));
517
+ await r.builder_updateActionsAt(t, a);
428
518
  },
429
- async addIngredient(n) {
430
- const _ = JSON.stringify(n);
431
- await r.builder_addIngredient(t, _);
519
+ async addIngredient(i) {
520
+ const o = JSON.stringify(i);
521
+ await r.builder_addIngredient(t, o);
432
522
  },
433
- async addIngredientFromBlob(n, _, o) {
434
- const s = JSON.stringify(n);
435
- await r.builder_addIngredientFromBlob(t, s, _, o);
523
+ async addIngredientFromBlob(i, o, _) {
524
+ const a = JSON.stringify(i);
525
+ await r.builder_addIngredientFromBlob(t, a, o, _);
436
526
  },
437
- async addResourceFromBlob(n, _) {
438
- await r.builder_addResourceFromBlob(t, n, _);
527
+ async addResourceFromBlob(i, o) {
528
+ await r.builder_addResourceFromBlob(t, i, o);
439
529
  },
440
530
  async getDefinition() {
441
531
  return await r.builder_getDefinition(t);
@@ -443,45 +533,65 @@ function y(e, t, i) {
443
533
  async toArchive() {
444
534
  return await r.builder_toArchive(t);
445
535
  },
446
- async sign(n, _, o) {
447
- const s = await O(n), a = e.registerSignReceiver(n.sign);
536
+ async sign(i, o, _) {
537
+ const a = await O(i), s = e.registerSignReceiver(i.sign);
448
538
  return await r.builder_sign(
449
539
  t,
450
- a,
451
540
  s,
452
- _,
453
- o
541
+ a,
542
+ o,
543
+ _
454
544
  );
455
545
  },
456
- async signAndGetManifestBytes(n, _, o) {
457
- const s = await O(n), a = e.registerSignReceiver(n.sign);
546
+ async signAndGetManifestBytes(i, o, _) {
547
+ const a = await O(i), s = e.registerSignReceiver(i.sign);
458
548
  return await r.builder_signAndGetManifestBytes(
459
549
  t,
460
- a,
461
550
  s,
462
- _,
463
- o
551
+ a,
552
+ o,
553
+ _
464
554
  );
465
555
  },
466
556
  async free() {
467
- i(), await r.builder_free(t);
557
+ n(), await r.builder_free(t);
468
558
  }
469
559
  };
470
560
  }
471
- async function ue(e) {
472
- const { wasmSrc: t, workerSrc: i, settings: r } = e, n = typeof t == "string" ? await _e(t) : t, _ = await l(r, void 0), o = await G({ wasm: n, workerSrc: i, settingsString: _ });
561
+ async function Se(e) {
562
+ const { wasmSrc: t, workerSrc: n, settings: r } = e, i = typeof t == "string" ? await le(t) : t, o = await w(r, void 0), _ = await G({ wasm: i, workerSrc: n, settingsString: o });
473
563
  return {
474
- reader: te(o, r),
475
- builder: ie(o, r),
476
- dispose: o.terminate
564
+ reader: ue(_, r),
565
+ builder: be(_, r),
566
+ dispose: _.terminate
477
567
  };
478
568
  }
479
- async function _e(e) {
480
- const t = await fetch(e, { integrity: re });
569
+ async function le(e) {
570
+ const t = await fetch(e, { integrity: de });
481
571
  return await WebAssembly.compileStreaming(t);
482
572
  }
483
573
  export {
484
- V as R,
485
- ue as c,
486
- S as i
574
+ ce as A,
575
+ H as D,
576
+ k as R,
577
+ K as a,
578
+ X as b,
579
+ Q as c,
580
+ Z as d,
581
+ se as e,
582
+ Se as f,
583
+ he as g,
584
+ ye as h,
585
+ pe as i,
586
+ ee as j,
587
+ x as k,
588
+ D as l,
589
+ T as m,
590
+ ve as n,
591
+ Ae as o,
592
+ M as p,
593
+ E as q,
594
+ w as r,
595
+ Re as s,
596
+ p as v
487
597
  };