@contentauth/c2pa-web 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/{c2pa-DIv7lJlp.js → c2pa-DdK7nuOh.js} +318 -286
- package/dist/index.js +1 -1
- package/dist/inline.js +5 -5
- package/dist/lib/reader.d.ts +7 -3
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +4 -4
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var $ = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var $ = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var O = (
|
|
7
|
-
var i = (
|
|
8
|
-
import { channel as
|
|
9
|
-
const { createTx: ie, rx: Ue } = X(), { createTx: Le, rx: se } = X("worker"), K = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.prototype);return t.__wbg_ptr=e,z.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.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=d(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=d(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 _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,s=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,n)}addRedaction(e,t){const n=d(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=d(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),s=a,i=o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr,n,_,c,s);if(i[1])throw b(i[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=w(t)?0:d(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=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;var c=w(t)?0:d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;const i=o.wasmbuilder_fromJson(n,_,c,s);if(i[2])throw b(i[1]);return p.__wrap(i[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=w(e)?0:d(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=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=d(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 c=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_sign(this.__wbg_ptr,e,t,c,s,_)}signAndGetManifestBytes(e,t,n,_){const c=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,t,c,s,_)}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 I{static __wrap(e){const t=Object.create(I.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 _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;var s=w(n)?0:d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;return o.wasmreader_fromBlob(_,c,t,s,i)}static fromBlobFragment(e,t,n,_){const c=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;var i=w(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),u=a;return o.wasmreader_fromBlobFragment(c,s,t,n,i,u)}static fromBytes(e,t,n){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,s=Z(t,o.__wbindgen_malloc),i=a;var u=w(n)?0:d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=a;return o.wasmreader_fromBytes(_,c,s,i,u,g)}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=d(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&&(I.prototype[Symbol.dispose]=I.prototype.free);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_String_8564e559799eccda:function(e,t){const n=String(t),_=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,w(_)?BigInt(0):_,!0),m().setInt32(e+0,!w(_),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return w(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=U(t),_=d(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_null_87c3bfe968c6a5ad:function(e){return e===null},__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,w(_)?0:_,!0),m().setInt32(e+0,!w(_),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=w(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;m().setInt32(e+4,s,!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},_=(s,i)=>{const u=n.a;n.a=0;try{return H(u,n.b,s,i)}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,_=d(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 w(e)?0:S(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return w(e)?0:S(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return w(e)?0:S(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return w(e)?0:S(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,_=d(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 I.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return L(e,t,$)},__wbindgen_cast_0000000000000002:function(e,t){return L(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_4d7940e3be85a6dc___convert__closures_____invoke_______true_(r,e)}function $(r,e,t){const n=o.wasm_bindgen_4d7940e3be85a6dc___convert__closures_____invoke___wasm_bindgen_4d7940e3be85a6dc___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_4d7940e3be85a6dc___JsError___true_(r,e,t);if(n[1])throw b(n[0])}function H(r,e,t,n){o.wasm_bindgen_4d7940e3be85a6dc___convert__closures_____invoke___js_sys_a576b80f2209464___Function_fn_wasm_bindgen_4d7940e3be85a6dc___JsValue_____wasm_bindgen_4d7940e3be85a6dc___sys__Undefined___js_sys_a576b80f2209464___Function_fn_wasm_bindgen_4d7940e3be85a6dc___JsValue_____wasm_bindgen_4d7940e3be85a6dc___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"],z=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 S(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const J=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 s=1;s<_;s++)c+=", "+U(r[s]);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,R().subarray(r/1,r/1+e)}let F=null;function m(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==o.memory.buffer)&&(F=new DataView(o.memory.buffer)),F}function y(r,e){return te(r>>>0,e)}let B=null;function Q(){return(B===null||B.byteLength===0)&&(B=new Uint32Array(o.memory.buffer)),B}let T=null;function R(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(o.memory.buffer)),T}function l(r,e){try{return r.apply(this,e)}catch(t){const n=S(t);o.__wbindgen_exn_store(n)}}function w(r){return r==null}function L(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const s=n.a;n.a=0;try{return t(s,n.b,...c)}finally{n.a=s,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,J.unregister(n))},J.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 Z(r,e){const t=e(r.length*1,1)>>>0;return R().set(r,t/1),a=r.length,t}function d(r,e,t){if(t===void 0){const i=j.encode(r),u=e(i.length,1)>>>0;return R().subarray(u,u+i.length).set(i),a=i.length,u}let n=r.length,_=e(n,1)>>>0;const c=R();let s=0;for(;s<n;s++){const i=r.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==n){s!==0&&(r=r.slice(s)),_=t(_,n,n=s+r.length*3,1)>>>0;const i=R().subarray(_+s,_+n),u=j.encodeInto(r,i);s+=u.written,_=t(_,n,s,1)>>>0}return a=s,_}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 ee=2146435072;let x=0;function te(r,e){return x+=e,x>=ee&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),x=e),O.decode(R().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 ne(r,e){return o=r.exports,F=null,B=null,T=null,o.__wbindgen_start(),o}function re(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 ne(t)}function V(){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 D=Symbol("transfer");function M(r,e){return{type:D,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function W(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===D)}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:s,result:i,error:u}=c,g=t.get(s);g&&(u?g.reject(u):g.resolve(i),t.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=_e(),u=[],g=[];return s.forEach(v=>{W(v)?(u.push(v.value),g.push(...v.transfer)):u.push(v)}),n.postMessage({method:c,args:u,id:i,channelName:r},{transfer:g}),new Promise((v,ae)=>{t.set(i,{resolve:v,reject:ae})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:s,args:i,id:u}=c;try{const g=await e[s](...i);W(g)?n.postMessage({result:g.value,id:u,channelName:r},{transfer:g.transfer}):n.postMessage({result:g,id:u,channelName:r})}catch(g){n.postMessage({error:g,id:u,channelName:r})}})}}}function _e(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:oe}=q(),{createTx:ce}=q("worker");function se(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&&(t.__proto__=n),r.manifests=t,r}const h=V(),f=V(),k=ce();function C(r){return r.map(e=>({sigType:e.sigType,reserveSize:e.reserveSize,referencedAssertions:e.referencedAssertions,roles:e.roles,sign:async t=>{const n=t.referencedAssertions.map(c=>c.hash.buffer);return await k.cawgSign(e.requestId,M(t,n))}}))}oe(ie({async initWorker(r){re({module:r})},async reader_fromBlob(r,e,t){const n=await I.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await I.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 se(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 M(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return f.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return f.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return f.add(t)},builder_setIntent(r,e){f.get(r).setIntent(e)},builder_addAction(r,e){f.get(r).addAction(e)},builder_addAssertion(r,e,t){f.get(r).addAssertion(e,t)},builder_addRedaction(r,e,t){f.get(r).addRedaction(e,t)},builder_filterActionsAt(r,e){f.get(r).filterActionsAt(Uint32Array.from(e))},builder_updateActionsAt(r,e){f.get(r).updateActionsAt(e)},builder_filterIngredientsAt(r,e){f.get(r).filterIngredientsAt(Uint32Array.from(e))},builder_filterActionsAndIngredientsAt(r,e,t){f.get(r).filterActionsAndIngredientsAt(Uint32Array.from(e),Uint32Array.from(t))},builder_setRemoteUrl(r,e){f.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){f.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){f.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){f.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await f.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){f.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return f.get(r).getDefinition()},builder_toArchive(r){const t=f.get(r).toArchive();return M(t,t.buffer)},async builder_sign(r,e,t,n,_,c){const i=await f.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async u=>await k.sign(e,M(u,u.buffer),t.reserveSize)},C(n),_,c);return M(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_,c){const s=f.get(r),{manifest:i,asset:u}=await s.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async g=>await k.sign(e,M(g,g.buffer),t.reserveSize)},C(n),_,c);return M({manifest:i,asset:u},[i.buffer,u.buffer])},builder_free(r){f.get(r).free(),f.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', W = typeof self < "u" && self.Blob && new Blob([K], { type: "text/javascript;charset=utf-8" });
|
|
10
|
-
function
|
|
5
|
+
var se = (t, e, n) => e in t ? ie(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
6
|
+
var O = (t, e, n) => se(t, typeof e != "symbol" ? e + "" : e, n), C = (t, e, n) => e.has(t) || $("Cannot " + n);
|
|
7
|
+
var i = (t, e, n) => (C(t, e, "read from private field"), n ? n.call(t) : e.get(t)), v = (t, e, n) => e.has(t) ? $("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), S = (t, e, n, r) => (C(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
|
|
8
|
+
import { channel as K, transfer as P } from "highgain";
|
|
9
|
+
const { createTx: oe, rx: ze } = K(), { createTx: De, rx: _e } = K("worker"), Z = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.prototype);return t.__wbg_ptr=e,z.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.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=d(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=d(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 _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,s=d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,s,i,n)}addRedaction(e,t){const n=d(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=d(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),s=a,i=o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr,n,_,c,s);if(i[1])throw b(i[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=w(t)?0:d(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=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;var c=w(t)?0:d(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;const i=o.wasmbuilder_fromJson(n,_,c,s);if(i[2])throw b(i[1]);return p.__wrap(i[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=w(e)?0:d(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=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=d(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 c=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_sign(this.__wbg_ptr,e,t,c,s,_)}signAndGetManifestBytes(e,t,n,_){const c=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,t,c,s,_)}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 I{static __wrap(e){const t=Object.create(I.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 _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;var s=w(n)?0:d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;return o.wasmreader_fromBlob(_,c,t,s,i)}static fromBlobFragment(e,t,n,_){const c=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;var i=w(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),u=a;return o.wasmreader_fromBlobFragment(c,s,t,n,i,u)}static fromBytes(e,t,n){const _=d(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a,s=Z(t,o.__wbindgen_malloc),i=a;var u=w(n)?0:d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=a;return o.wasmreader_fromBytes(_,c,s,i,u,g)}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=d(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&&(I.prototype[Symbol.dispose]=I.prototype.free);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_String_8564e559799eccda:function(e,t){const n=String(t),_=d(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,w(_)?BigInt(0):_,!0),m().setInt32(e+0,!w(_),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return w(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=U(t),_=d(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_null_87c3bfe968c6a5ad:function(e){return e===null},__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,w(_)?0:_,!0),m().setInt32(e+0,!w(_),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=w(_)?0:d(_,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;m().setInt32(e+4,s,!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},_=(s,i)=>{const u=n.a;n.a=0;try{return H(u,n.b,s,i)}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,_=d(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 w(e)?0:S(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return w(e)?0:S(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return w(e)?0:S(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return w(e)?0:S(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,_=d(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 I.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return L(e,t,$)},__wbindgen_cast_0000000000000002:function(e,t){return L(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_4d7940e3be85a6dc___convert__closures_____invoke_______true_(r,e)}function $(r,e,t){const n=o.wasm_bindgen_4d7940e3be85a6dc___convert__closures_____invoke___wasm_bindgen_4d7940e3be85a6dc___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_4d7940e3be85a6dc___JsError___true_(r,e,t);if(n[1])throw b(n[0])}function H(r,e,t,n){o.wasm_bindgen_4d7940e3be85a6dc___convert__closures_____invoke___js_sys_a576b80f2209464___Function_fn_wasm_bindgen_4d7940e3be85a6dc___JsValue_____wasm_bindgen_4d7940e3be85a6dc___sys__Undefined___js_sys_a576b80f2209464___Function_fn_wasm_bindgen_4d7940e3be85a6dc___JsValue_____wasm_bindgen_4d7940e3be85a6dc___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"],z=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 S(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const J=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 s=1;s<_;s++)c+=", "+U(r[s]);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,R().subarray(r/1,r/1+e)}let F=null;function m(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==o.memory.buffer)&&(F=new DataView(o.memory.buffer)),F}function y(r,e){return te(r>>>0,e)}let B=null;function Q(){return(B===null||B.byteLength===0)&&(B=new Uint32Array(o.memory.buffer)),B}let T=null;function R(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(o.memory.buffer)),T}function l(r,e){try{return r.apply(this,e)}catch(t){const n=S(t);o.__wbindgen_exn_store(n)}}function w(r){return r==null}function L(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const s=n.a;n.a=0;try{return t(s,n.b,...c)}finally{n.a=s,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,J.unregister(n))},J.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 Z(r,e){const t=e(r.length*1,1)>>>0;return R().set(r,t/1),a=r.length,t}function d(r,e,t){if(t===void 0){const i=j.encode(r),u=e(i.length,1)>>>0;return R().subarray(u,u+i.length).set(i),a=i.length,u}let n=r.length,_=e(n,1)>>>0;const c=R();let s=0;for(;s<n;s++){const i=r.charCodeAt(s);if(i>127)break;c[_+s]=i}if(s!==n){s!==0&&(r=r.slice(s)),_=t(_,n,n=s+r.length*3,1)>>>0;const i=R().subarray(_+s,_+n),u=j.encodeInto(r,i);s+=u.written,_=t(_,n,s,1)>>>0}return a=s,_}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 ee=2146435072;let x=0;function te(r,e){return x+=e,x>=ee&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),x=e),O.decode(R().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 ne(r,e){return o=r.exports,F=null,B=null,T=null,o.__wbindgen_start(),o}function re(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 ne(t)}function V(){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 D=Symbol("transfer");function M(r,e){return{type:D,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function W(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===D)}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:s,result:i,error:u}=c,g=t.get(s);g&&(u?g.reject(u):g.resolve(i),t.delete(s))}),new Proxy({},{get(_,c){return(...s)=>{const i=_e(),u=[],g=[];return s.forEach(v=>{W(v)?(u.push(v.value),g.push(...v.transfer)):u.push(v)}),n.postMessage({method:c,args:u,id:i,channelName:r},{transfer:g}),new Promise((v,ae)=>{t.set(i,{resolve:v,reject:ae})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:s,args:i,id:u}=c;try{const g=await e[s](...i);W(g)?n.postMessage({result:g.value,id:u,channelName:r},{transfer:g.transfer}):n.postMessage({result:g,id:u,channelName:r})}catch(g){n.postMessage({error:g,id:u,channelName:r})}})}}}function _e(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:oe}=q(),{createTx:ce}=q("worker");function se(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&&(t.__proto__=n),r.manifests=t,r}const h=V(),f=V(),k=ce();function C(r){return r.map(e=>({sigType:e.sigType,reserveSize:e.reserveSize,referencedAssertions:e.referencedAssertions,roles:e.roles,sign:async t=>{const n=t.referencedAssertions.map(c=>c.hash.buffer);return await k.cawgSign(e.requestId,M(t,n))}}))}oe(ie({async initWorker(r){re({module:r})},async reader_fromBlob(r,e,t){const n=await I.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await I.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 se(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 M(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return f.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return f.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return f.add(t)},builder_setIntent(r,e){f.get(r).setIntent(e)},builder_addAction(r,e){f.get(r).addAction(e)},builder_addAssertion(r,e,t){f.get(r).addAssertion(e,t)},builder_addRedaction(r,e,t){f.get(r).addRedaction(e,t)},builder_filterActionsAt(r,e){f.get(r).filterActionsAt(Uint32Array.from(e))},builder_updateActionsAt(r,e){f.get(r).updateActionsAt(e)},builder_filterIngredientsAt(r,e){f.get(r).filterIngredientsAt(Uint32Array.from(e))},builder_filterActionsAndIngredientsAt(r,e,t){f.get(r).filterActionsAndIngredientsAt(Uint32Array.from(e),Uint32Array.from(t))},builder_setRemoteUrl(r,e){f.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){f.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){f.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){f.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await f.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){f.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return f.get(r).getDefinition()},builder_toArchive(r){const t=f.get(r).toArchive();return M(t,t.buffer)},async builder_sign(r,e,t,n,_,c){const i=await f.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async u=>await k.sign(e,M(u,u.buffer),t.reserveSize)},C(n),_,c);return M(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_,c){const s=f.get(r),{manifest:i,asset:u}=await s.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async g=>await k.sign(e,M(g,g.buffer),t.reserveSize)},C(n),_,c);return M({manifest:i,asset:u},[i.buffer,u.buffer])},builder_free(r){f.get(r).free(),f.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', k = typeof self < "u" && self.Blob && new Blob([Z], { type: "text/javascript;charset=utf-8" });
|
|
10
|
+
function ae(t) {
|
|
11
11
|
let e;
|
|
12
12
|
try {
|
|
13
|
-
if (e =
|
|
14
|
-
const
|
|
15
|
-
name:
|
|
13
|
+
if (e = k && (self.URL || self.webkitURL).createObjectURL(k), !e) throw "";
|
|
14
|
+
const n = new Worker(e, {
|
|
15
|
+
name: t == null ? void 0 : t.name
|
|
16
16
|
});
|
|
17
|
-
return
|
|
17
|
+
return n.addEventListener("error", () => {
|
|
18
18
|
(self.URL || self.webkitURL).revokeObjectURL(e);
|
|
19
|
-
}),
|
|
19
|
+
}), n;
|
|
20
20
|
} catch {
|
|
21
21
|
return new Worker(
|
|
22
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
22
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Z),
|
|
23
23
|
{
|
|
24
|
-
name:
|
|
24
|
+
name: t == null ? void 0 : t.name
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
27
|
} finally {
|
|
28
28
|
e && (self.URL || self.webkitURL).revokeObjectURL(e);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
31
|
+
function ce(t) {
|
|
32
|
+
if (t.protocol !== "https:")
|
|
33
33
|
throw new Error(
|
|
34
|
-
`Worker source URL must use https, but got ${
|
|
34
|
+
`Worker source URL must use https, but got ${t.protocol}`
|
|
35
35
|
);
|
|
36
|
-
return
|
|
36
|
+
return t.toString();
|
|
37
37
|
}
|
|
38
|
-
async function
|
|
39
|
-
const { wasm: e, workerSrc:
|
|
38
|
+
async function ue(t) {
|
|
39
|
+
const { wasm: e, workerSrc: n } = t;
|
|
40
40
|
let r = 0;
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const s = n ? new Worker(ce(n), { type: "module" }) : new ae(), o = oe(s), _ = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
42
|
+
_e(
|
|
43
43
|
{
|
|
44
44
|
sign: async (l, d, b) => {
|
|
45
45
|
const g = _.get(l);
|
|
@@ -61,7 +61,7 @@ async function ae(n) {
|
|
|
61
61
|
return P(g, g.buffer);
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
s
|
|
65
65
|
);
|
|
66
66
|
function u(l) {
|
|
67
67
|
const d = r++;
|
|
@@ -71,38 +71,38 @@ async function ae(n) {
|
|
|
71
71
|
const d = r++;
|
|
72
72
|
return a.set(d, l), d;
|
|
73
73
|
}
|
|
74
|
-
return await
|
|
75
|
-
tx:
|
|
74
|
+
return await o.initWorker(e), {
|
|
75
|
+
tx: o,
|
|
76
76
|
registerSignReceiver: u,
|
|
77
77
|
registerCredentialHolderReceiver: w,
|
|
78
|
-
terminate: () =>
|
|
78
|
+
terminate: () => s.terminate()
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((
|
|
82
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((
|
|
83
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((
|
|
84
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
"encodeInto" in
|
|
89
|
-
const
|
|
90
|
-
return e.set(
|
|
91
|
-
read:
|
|
92
|
-
written:
|
|
81
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((t) => B.__wbg_wasmbuilder_free(t, 1));
|
|
82
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((t) => B.__wbg_wasmreader_free(t, 1));
|
|
83
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((t) => B.__wbg_wasmsigner_free(t, 1));
|
|
84
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((t) => B.__wbindgen_destroy_closure(t.a, t.b));
|
|
85
|
+
let fe = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
|
86
|
+
fe.decode();
|
|
87
|
+
const L = new TextEncoder();
|
|
88
|
+
"encodeInto" in L || (L.encodeInto = function(t, e) {
|
|
89
|
+
const n = L.encode(t);
|
|
90
|
+
return e.set(n), {
|
|
91
|
+
read: t.length,
|
|
92
|
+
written: n.length
|
|
93
93
|
};
|
|
94
94
|
});
|
|
95
|
-
let
|
|
96
|
-
const
|
|
97
|
-
if (typeof
|
|
95
|
+
let B;
|
|
96
|
+
const de = "sha512-7kRrn+2o664Awfeh77jfkR5ByQxO+iKD2KZ9qdEr0h6ta/REeas8aNXBLRPRneuAowl+tLbbKQHjvXYfs2nVmg==", T = (t) => {
|
|
97
|
+
if (typeof t == "object" && t !== null) {
|
|
98
98
|
if (typeof Object.getPrototypeOf == "function") {
|
|
99
|
-
const e = Object.getPrototypeOf(
|
|
99
|
+
const e = Object.getPrototypeOf(t);
|
|
100
100
|
return e === Object.prototype || e === null;
|
|
101
101
|
}
|
|
102
|
-
return Object.prototype.toString.call(
|
|
102
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
103
103
|
}
|
|
104
104
|
return !1;
|
|
105
|
-
},
|
|
105
|
+
}, le = /* @__PURE__ */ new Set([
|
|
106
106
|
"__proto__",
|
|
107
107
|
"constructor",
|
|
108
108
|
"prototype",
|
|
@@ -112,13 +112,13 @@ const ue = "sha512-dy+y/WRGgJP0600LxgBD8aQ6GKZr631fVXf06RNemy3HRyKkx6vVvx1BQvUgq
|
|
|
112
112
|
"isPrototypeOf",
|
|
113
113
|
"propertyIsEnumerable",
|
|
114
114
|
"toLocaleString"
|
|
115
|
-
]), m = (...
|
|
116
|
-
if (
|
|
115
|
+
]), m = (...t) => t.reduce((e, n) => {
|
|
116
|
+
if (n === void 0)
|
|
117
117
|
return e;
|
|
118
|
-
if (Array.isArray(
|
|
118
|
+
if (Array.isArray(n))
|
|
119
119
|
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
120
|
-
return Object.keys(
|
|
121
|
-
|
|
120
|
+
return Object.keys(n).forEach((r) => {
|
|
121
|
+
le.has(r) || (Array.isArray(e[r]) && Array.isArray(n[r]) ? e[r] = m.options.mergeArrays ? m.options.uniqueArrayItems ? Array.from(new Set(e[r].concat(n[r]))) : [...e[r], ...n[r]] : n[r] : T(e[r]) && T(n[r]) ? e[r] = m(e[r], n[r]) : !T(e[r]) && T(n[r]) ? e[r] = m(n[r], void 0) : e[r] = n[r] === void 0 ? m.options.allowUndefinedOverrides ? n[r] : e[r] : n[r]);
|
|
122
122
|
}), e;
|
|
123
123
|
}, {}), D = {
|
|
124
124
|
allowUndefinedOverrides: !0,
|
|
@@ -126,158 +126,186 @@ const ue = "sha512-dy+y/WRGgJP0600LxgBD8aQ6GKZr631fVXf06RNemy3HRyKkx6vVvx1BQvUgq
|
|
|
126
126
|
uniqueArrayItems: !0
|
|
127
127
|
};
|
|
128
128
|
m.options = D;
|
|
129
|
-
m.withOptions = (
|
|
130
|
-
m.options = Object.assign(Object.assign({}, D),
|
|
131
|
-
const
|
|
132
|
-
return m.options = D,
|
|
129
|
+
m.withOptions = (t, ...e) => {
|
|
130
|
+
m.options = Object.assign(Object.assign({}, D), t);
|
|
131
|
+
const n = m(...e);
|
|
132
|
+
return m.options = D, n;
|
|
133
133
|
};
|
|
134
|
-
const
|
|
135
|
-
function
|
|
136
|
-
return
|
|
134
|
+
const be = 1 * 1024 * 1024, ge = 2, we = 200, me = 2e3, he = 3e4;
|
|
135
|
+
function ye(t) {
|
|
136
|
+
return t === 429 || t >= 500;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
138
|
+
function Ae(t) {
|
|
139
|
+
return t instanceof Error && t.name === "AbortError";
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const r = Math.min(e * 2 **
|
|
143
|
-
return Math.min(r +
|
|
141
|
+
function pe(t, e, n) {
|
|
142
|
+
const r = Math.min(e * 2 ** t, n), s = Math.floor(Math.random() * 200);
|
|
143
|
+
return Math.min(r + s, n);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
if (!
|
|
145
|
+
function Re(t) {
|
|
146
|
+
if (!t)
|
|
147
147
|
return null;
|
|
148
|
-
const e = Number(
|
|
148
|
+
const e = Number(t);
|
|
149
149
|
if (!Number.isNaN(e))
|
|
150
150
|
return e * 1e3;
|
|
151
|
-
const
|
|
152
|
-
return Number.isNaN(
|
|
151
|
+
const n = Date.parse(t);
|
|
152
|
+
return Number.isNaN(n) ? null : n - Date.now();
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function ve(t) {
|
|
155
155
|
try {
|
|
156
|
-
new URL(
|
|
156
|
+
new URL(t);
|
|
157
157
|
} catch {
|
|
158
|
-
throw new Error(`Invalid URL: ${
|
|
158
|
+
throw new Error(`Invalid URL: ${t}`);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
async function
|
|
162
|
-
|
|
163
|
-
const r = (
|
|
161
|
+
async function Q(t, e, n) {
|
|
162
|
+
ve(t);
|
|
163
|
+
const r = (n == null ? void 0 : n.maxRetries) ?? ge, s = (n == null ? void 0 : n.initialRetryDelayMs) ?? we, o = (n == null ? void 0 : n.maxRetryDelayMs) ?? me, _ = (n == null ? void 0 : n.maxRetryAfterMs) ?? he, a = (n == null ? void 0 : n.isRetryableStatus) ?? ye, u = (n == null ? void 0 : n.isRetryableError) ?? (() => !0), w = (n == null ? void 0 : n.fetch) ?? fetch, l = (d) => pe(d, s, o);
|
|
164
164
|
for (let d = 0; ; d++) {
|
|
165
165
|
let b;
|
|
166
166
|
try {
|
|
167
|
-
b = await w(
|
|
167
|
+
b = await w(t, e);
|
|
168
168
|
} catch (g) {
|
|
169
|
-
if (!
|
|
169
|
+
if (!Ae(g) && u(g) && d < r) {
|
|
170
170
|
await new Promise((R) => setTimeout(R, l(d)));
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
173
|
const p = g instanceof Error ? g.message : String(g);
|
|
174
|
-
throw new Error(`Network error fetching ${
|
|
174
|
+
throw new Error(`Network error fetching ${t}: ${p}`, {
|
|
175
175
|
cause: g
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
if (!b.ok) {
|
|
179
179
|
if (a(b.status)) {
|
|
180
|
-
const p =
|
|
180
|
+
const p = Re(b.headers.get("retry-after"));
|
|
181
181
|
if (p !== null) {
|
|
182
182
|
if (p > _)
|
|
183
|
-
throw new Error(`Failed to fetch ${
|
|
183
|
+
throw new Error(`Failed to fetch ${t}: server requested a Retry-After delay of ${Math.ceil(p / 1e3)}s, which exceeds the maximum allowed delay of ${_ / 1e3}s`);
|
|
184
184
|
if (d < r) {
|
|
185
185
|
await new Promise((R) => setTimeout(R, Math.max(p, 0)));
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
throw new Error(`Failed to fetch ${
|
|
188
|
+
throw new Error(`Failed to fetch ${t}: ${b.status} ${b.statusText}`);
|
|
189
189
|
}
|
|
190
190
|
if (d < r) {
|
|
191
191
|
await new Promise((R) => setTimeout(R, l(d)));
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
throw new Error(`Failed to fetch ${
|
|
195
|
+
throw new Error(`Failed to fetch ${t}: ${b.status} ${b.statusText}`);
|
|
196
196
|
}
|
|
197
197
|
return b;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
async function
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
throw new Error(`Response from ${
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
throw new Error(`Response from ${
|
|
207
|
-
return
|
|
200
|
+
async function W(t, e) {
|
|
201
|
+
const n = (e == null ? void 0 : e.maxResponseBytes) ?? be, r = await Q(t, void 0, e), s = r.headers.get("content-length");
|
|
202
|
+
if (s !== null && Number(s) > n)
|
|
203
|
+
throw new Error(`Response from ${t} is too large. Max size is ${n} bytes.`);
|
|
204
|
+
const o = await r.text();
|
|
205
|
+
if (o.length > n)
|
|
206
|
+
throw new Error(`Response from ${t} is too large. Max size is ${n} bytes.`);
|
|
207
|
+
return o;
|
|
208
208
|
}
|
|
209
|
-
function J(
|
|
210
|
-
return Object.entries(
|
|
209
|
+
function J(t) {
|
|
210
|
+
return Object.entries(t).reduce((n, [r, s]) => (n[Se(r)] = ee(s), n), {});
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
return Array.isArray(
|
|
212
|
+
function ee(t) {
|
|
213
|
+
return Array.isArray(t) ? t.map(ee) : typeof t == "object" && t !== null ? J(t) : t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
215
|
+
function Se(t) {
|
|
216
|
+
return t.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const xe = Object.freeze({
|
|
219
219
|
builder: Object.freeze({
|
|
220
220
|
generateC2paArchive: !0
|
|
221
221
|
})
|
|
222
222
|
});
|
|
223
|
-
function
|
|
224
|
-
return m(
|
|
225
|
-
}
|
|
226
|
-
async function
|
|
227
|
-
const
|
|
228
|
-
return
|
|
229
|
-
}
|
|
230
|
-
function
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
223
|
+
function Ee(t) {
|
|
224
|
+
return m(xe, t ?? {});
|
|
225
|
+
}
|
|
226
|
+
async function Ie(t, e) {
|
|
227
|
+
const n = Ee(t), r = [];
|
|
228
|
+
return n.trust && r.push(V(n.trust, e)), n.cawgTrust && r.push(V(n.cawgTrust, e)), await Promise.all(r), JSON.stringify(J(te(n)));
|
|
229
|
+
}
|
|
230
|
+
function te(t) {
|
|
231
|
+
const { trust: e, cawgTrust: n, ...r } = t, s = [
|
|
232
|
+
...q(e, "manifest"),
|
|
233
|
+
...q(n, "cawg")
|
|
234
|
+
], o = r;
|
|
235
|
+
return (s.length > 0 || e != null && e.trustConfig) && (o.trust = {
|
|
236
|
+
...s.length > 0 ? { anchors: s } : {},
|
|
237
|
+
...e != null && e.trustConfig ? { trustConfig: e.trustConfig } : {}
|
|
238
|
+
}), o;
|
|
239
|
+
}
|
|
240
|
+
function q(t, e) {
|
|
241
|
+
if (!t || t.verifyTrustList === !1)
|
|
242
|
+
return [];
|
|
243
|
+
const n = t.trustConfig, r = t.allowedList, s = [];
|
|
244
|
+
return t.userAnchors && s.push({
|
|
245
|
+
trustAnchors: t.userAnchors,
|
|
246
|
+
trustUri: `${e}_user_anchors`,
|
|
247
|
+
trustKind: e,
|
|
248
|
+
...n ? { trustConfig: n } : {},
|
|
249
|
+
...r ? { allowedList: r } : {}
|
|
250
|
+
}), t.trustAnchors && s.push({
|
|
251
|
+
trustAnchors: t.trustAnchors,
|
|
252
|
+
trustUri: `${e}_system_anchors`,
|
|
253
|
+
trustKind: e,
|
|
254
|
+
...n ? { trustConfig: n } : {},
|
|
255
|
+
...r ? { allowedList: r } : {}
|
|
256
|
+
}), s;
|
|
257
|
+
}
|
|
258
|
+
function Je(t) {
|
|
259
|
+
return { trust: { ...t } };
|
|
260
|
+
}
|
|
261
|
+
function $e(t) {
|
|
262
|
+
return { cawgTrust: { ...t } };
|
|
263
|
+
}
|
|
264
|
+
function Ce(t) {
|
|
265
|
+
return { verify: { ...t } };
|
|
266
|
+
}
|
|
267
|
+
function x(...t) {
|
|
268
|
+
return m(...t);
|
|
269
|
+
}
|
|
270
|
+
function Pe(t) {
|
|
271
|
+
return JSON.stringify(J(te(t)));
|
|
272
|
+
}
|
|
273
|
+
async function ke(t, e) {
|
|
274
|
+
return await (await Q(t, void 0, e)).text();
|
|
275
|
+
}
|
|
276
|
+
const Te = [
|
|
249
277
|
"userAnchors",
|
|
250
278
|
"trustAnchors",
|
|
251
279
|
"trustConfig",
|
|
252
280
|
"allowedList"
|
|
253
281
|
];
|
|
254
|
-
async function
|
|
255
|
-
const
|
|
282
|
+
async function V(t, e) {
|
|
283
|
+
const n = (o) => ["userAnchors", "trustAnchors"].includes(o), r = (o) => o.includes("-----BEGIN CERTIFICATE-----"), s = (o) => o.startsWith("http");
|
|
256
284
|
try {
|
|
257
|
-
const
|
|
285
|
+
const o = Object.entries(t).filter(([_]) => Te.includes(_)).map(async ([_, a]) => {
|
|
258
286
|
if (a && typeof a == "object" && Array.isArray(a)) {
|
|
259
287
|
const u = a.map(async (d) => {
|
|
260
288
|
if (typeof d != "string")
|
|
261
289
|
throw new Error("Expected a string value for array item");
|
|
262
|
-
const b = await
|
|
263
|
-
if (
|
|
290
|
+
const b = await W(d, e);
|
|
291
|
+
if (n(_) && !r(b))
|
|
264
292
|
throw new Error(`Error parsing PEM file at: ${d}`);
|
|
265
293
|
return b;
|
|
266
294
|
}), l = (await Promise.all(u)).join("");
|
|
267
|
-
|
|
268
|
-
} else if (a && typeof a == "string" &&
|
|
269
|
-
const u = await
|
|
270
|
-
if (
|
|
295
|
+
t[_] = l;
|
|
296
|
+
} else if (a && typeof a == "string" && s(a)) {
|
|
297
|
+
const u = await W(a, e);
|
|
298
|
+
if (n(_) && !r(u))
|
|
271
299
|
throw new Error(`Error parsing PEM file at: ${a}`);
|
|
272
|
-
|
|
300
|
+
t[_] = u;
|
|
273
301
|
} else
|
|
274
302
|
return a;
|
|
275
303
|
});
|
|
276
|
-
await Promise.all(
|
|
277
|
-
} catch (
|
|
278
|
-
const _ =
|
|
304
|
+
await Promise.all(o);
|
|
305
|
+
} catch (o) {
|
|
306
|
+
const _ = o instanceof Error ? o.message : String(o);
|
|
279
307
|
throw new Error(`Failed to resolve trust settings. ${_}`, {
|
|
280
|
-
cause:
|
|
308
|
+
cause: o
|
|
281
309
|
});
|
|
282
310
|
}
|
|
283
311
|
}
|
|
@@ -313,89 +341,93 @@ class A {
|
|
|
313
341
|
* @returns A JSON-serialized string of the resolved settings.
|
|
314
342
|
*/
|
|
315
343
|
toJson(e) {
|
|
316
|
-
return this._jsonPromise ?? (this._jsonPromise =
|
|
317
|
-
throw this._jsonPromise = void 0,
|
|
344
|
+
return this._jsonPromise ?? (this._jsonPromise = Ie(this.settings, e).catch((n) => {
|
|
345
|
+
throw this._jsonPromise = void 0, n;
|
|
318
346
|
})), this._jsonPromise;
|
|
319
347
|
}
|
|
320
348
|
}
|
|
321
|
-
const
|
|
322
|
-
function
|
|
323
|
-
return Number.isFinite(
|
|
349
|
+
const Fe = 10 ** 9;
|
|
350
|
+
function ne(t) {
|
|
351
|
+
return Number.isFinite(t) && t > 0 ? t : Fe;
|
|
324
352
|
}
|
|
325
|
-
class
|
|
353
|
+
class Me extends Error {
|
|
326
354
|
/**
|
|
327
355
|
* @param sizeInBytes Size of the asset, in bytes.
|
|
328
356
|
* @param maxSizeInBytes Maximum allowed size, in bytes. `0` (or any other
|
|
329
357
|
* non-finite/negative value) resolves to {@link DEFAULT_MAX_SIZE_IN_BYTES}.
|
|
330
358
|
*/
|
|
331
|
-
constructor(e,
|
|
332
|
-
const r =
|
|
359
|
+
constructor(e, n) {
|
|
360
|
+
const r = ne(n);
|
|
333
361
|
super(`The provided asset was too large. Size: ${e} bytes. Maximum: ${r}.`), this.name = "AssetTooLargeError";
|
|
334
362
|
}
|
|
335
363
|
}
|
|
336
|
-
function
|
|
337
|
-
if (!Number.isFinite(
|
|
338
|
-
throw new RangeError(`sizeInBytes must be a finite, non-negative number. Received: ${
|
|
364
|
+
function N(t, e) {
|
|
365
|
+
if (!Number.isFinite(t) || t < 0)
|
|
366
|
+
throw new RangeError(`sizeInBytes must be a finite, non-negative number. Received: ${t}.`);
|
|
339
367
|
if (!Number.isFinite(e) || e < 0)
|
|
340
368
|
throw new RangeError(`maxSizeInBytes must be a finite, non-negative number. Received: ${e}.`);
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
throw new
|
|
369
|
+
const n = ne(e);
|
|
370
|
+
if (t > n)
|
|
371
|
+
throw new Me(t, n);
|
|
344
372
|
}
|
|
345
|
-
const
|
|
346
|
-
async ({ worker:
|
|
347
|
-
await
|
|
373
|
+
const U = 10 ** 9, z = new FinalizationRegistry(
|
|
374
|
+
async ({ worker: t, id: e }) => {
|
|
375
|
+
await t.tx.reader_free(e);
|
|
348
376
|
}
|
|
349
377
|
);
|
|
350
378
|
var h, y;
|
|
351
|
-
const
|
|
352
|
-
constructor(e,
|
|
379
|
+
const j = class j {
|
|
380
|
+
constructor(e, n) {
|
|
353
381
|
v(this, h);
|
|
354
382
|
v(this, y);
|
|
355
|
-
S(this, h, e), S(this, y,
|
|
383
|
+
S(this, h, e), S(this, y, n);
|
|
356
384
|
}
|
|
357
385
|
/**
|
|
358
386
|
* Create a {@link Reader} from an asset's format and a blob of its bytes.
|
|
359
387
|
*
|
|
360
388
|
* @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this reader on.
|
|
361
|
-
* @param format Asset format.
|
|
389
|
+
* @param format Asset format (MIME type or extension), typically `blob.type`. If omitted
|
|
390
|
+
* or empty, the native library will attempt to detect the format from the asset's bytes instead.
|
|
391
|
+
* Always provide the format if known, and only omit this when the caller has no way to determine
|
|
392
|
+
* the asset's format otherwise.
|
|
362
393
|
* @param blob Blob of asset bytes.
|
|
363
394
|
* @param context Optional `Context` configuring this reader's behavior.
|
|
364
395
|
* @returns A {@link Reader} object or null if no C2PA metadata was found.
|
|
365
396
|
* @throws If the asset is too large.
|
|
366
397
|
*/
|
|
367
|
-
static async fromBlob(e,
|
|
368
|
-
|
|
398
|
+
static async fromBlob(e, n, r, s = new A()) {
|
|
399
|
+
N(r.size, U);
|
|
369
400
|
try {
|
|
370
|
-
const
|
|
401
|
+
const o = await s.toJson(), { worker: _ } = e, a = await _.tx.reader_fromBlob(n ?? "", r, o), u = new j(_, a);
|
|
371
402
|
return z.register(u, { worker: _, id: a }, u), u;
|
|
372
|
-
} catch (
|
|
373
|
-
return
|
|
403
|
+
} catch (o) {
|
|
404
|
+
return G(o);
|
|
374
405
|
}
|
|
375
406
|
}
|
|
376
407
|
/**
|
|
377
408
|
* Create a {@link Reader} from an initial fragment and a subsequent fragment.
|
|
378
409
|
*
|
|
379
410
|
* @param c2pa The `C2pa` instance (from {@link createC2pa}) to create this reader on.
|
|
380
|
-
* @param format Asset format.
|
|
411
|
+
* @param format Asset format (MIME type or extension). Unlike {@link fromBlob}, fragmented
|
|
412
|
+
* assets cannot be auto-detected from their bytes, so a format must be supplied.
|
|
381
413
|
* @param init Blob of initial fragment bytes.
|
|
382
414
|
* @param fragment Blob of fragment bytes.
|
|
383
415
|
* @param context Optional `Context` configuring this reader's behavior.
|
|
384
416
|
* @returns A {@link Reader} object or null if no C2PA metadata was found.
|
|
385
417
|
* @throws If the asset is too large.
|
|
386
418
|
*/
|
|
387
|
-
static async fromBlobFragment(e,
|
|
388
|
-
|
|
419
|
+
static async fromBlobFragment(e, n, r, s, o = new A()) {
|
|
420
|
+
N(r.size, U), N(s.size, U);
|
|
389
421
|
try {
|
|
390
|
-
const _ = await
|
|
391
|
-
|
|
422
|
+
const _ = await o.toJson(), { worker: a } = e, u = await a.tx.reader_fromBlobFragment(
|
|
423
|
+
n,
|
|
392
424
|
r,
|
|
393
|
-
|
|
425
|
+
s,
|
|
394
426
|
_
|
|
395
|
-
), w = new
|
|
427
|
+
), w = new j(a, u);
|
|
396
428
|
return z.register(w, { worker: a, id: u }, w), w;
|
|
397
429
|
} catch (_) {
|
|
398
|
-
return
|
|
430
|
+
return G(_);
|
|
399
431
|
}
|
|
400
432
|
}
|
|
401
433
|
/**
|
|
@@ -457,79 +489,79 @@ const B = class B {
|
|
|
457
489
|
}
|
|
458
490
|
};
|
|
459
491
|
h = new WeakMap(), y = new WeakMap();
|
|
460
|
-
let M =
|
|
461
|
-
function
|
|
492
|
+
let M = j;
|
|
493
|
+
function je(t, e = {}) {
|
|
462
494
|
return {
|
|
463
|
-
fromBlob: (
|
|
464
|
-
n,
|
|
495
|
+
fromBlob: (n, r, s = {}) => M.fromBlob(
|
|
465
496
|
t,
|
|
497
|
+
n,
|
|
466
498
|
r,
|
|
467
|
-
new A(x(e,
|
|
499
|
+
new A(x(e, s))
|
|
468
500
|
),
|
|
469
|
-
fromBlobFragment: (
|
|
470
|
-
n,
|
|
501
|
+
fromBlobFragment: (n, r, s, o = {}) => M.fromBlobFragment(
|
|
471
502
|
t,
|
|
503
|
+
n,
|
|
472
504
|
r,
|
|
473
|
-
|
|
474
|
-
new A(x(e,
|
|
505
|
+
s,
|
|
506
|
+
new A(x(e, o))
|
|
475
507
|
)
|
|
476
508
|
};
|
|
477
509
|
}
|
|
478
|
-
function
|
|
479
|
-
if (
|
|
510
|
+
function G(t) {
|
|
511
|
+
if (t instanceof Error && t.message === "C2pa(JumbfNotFound)")
|
|
480
512
|
return null;
|
|
481
|
-
throw
|
|
513
|
+
throw t;
|
|
482
514
|
}
|
|
483
|
-
async function
|
|
484
|
-
const { alg: e } =
|
|
515
|
+
async function Y(t) {
|
|
516
|
+
const { alg: e } = t;
|
|
485
517
|
return {
|
|
486
|
-
reserveSize: await
|
|
518
|
+
reserveSize: await t.reserveSize(),
|
|
487
519
|
alg: e
|
|
488
520
|
};
|
|
489
521
|
}
|
|
490
|
-
function
|
|
491
|
-
const { credentialHolder:
|
|
522
|
+
function Be(t, e) {
|
|
523
|
+
const { credentialHolder: n, referencedAssertions: r, roles: s } = t;
|
|
492
524
|
return {
|
|
493
525
|
requestId: e,
|
|
494
|
-
sigType:
|
|
495
|
-
reserveSize:
|
|
526
|
+
sigType: n.sigType,
|
|
527
|
+
reserveSize: n.reserveSize,
|
|
496
528
|
referencedAssertions: r ?? [],
|
|
497
|
-
roles:
|
|
529
|
+
roles: s ?? []
|
|
498
530
|
};
|
|
499
531
|
}
|
|
500
|
-
function
|
|
501
|
-
return
|
|
532
|
+
function H(t) {
|
|
533
|
+
return re(t).flat();
|
|
502
534
|
}
|
|
503
|
-
function
|
|
504
|
-
return (
|
|
505
|
-
const
|
|
506
|
-
return (
|
|
535
|
+
function re(t) {
|
|
536
|
+
return (t.assertions ?? []).filter((e) => e.label.startsWith("c2pa.actions")).map((e) => {
|
|
537
|
+
const n = e.data;
|
|
538
|
+
return (n == null ? void 0 : n.actions) ?? [];
|
|
507
539
|
});
|
|
508
540
|
}
|
|
509
|
-
function
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
541
|
+
function X(t, e) {
|
|
542
|
+
const n = (e == null ? void 0 : e.identityAssertions) ?? [];
|
|
543
|
+
if (n.length > 1)
|
|
512
544
|
throw new Error(
|
|
513
545
|
"Only one identity assertion is currently supported per signing operation."
|
|
514
546
|
);
|
|
515
|
-
return
|
|
516
|
-
const
|
|
547
|
+
return n.map((r) => {
|
|
548
|
+
const s = t.registerCredentialHolderReceiver(
|
|
517
549
|
r.credentialHolder.sign
|
|
518
550
|
);
|
|
519
|
-
return
|
|
551
|
+
return Be(r, s);
|
|
520
552
|
});
|
|
521
553
|
}
|
|
522
|
-
const
|
|
523
|
-
({ worker:
|
|
524
|
-
|
|
554
|
+
const F = new FinalizationRegistry(
|
|
555
|
+
({ worker: t, id: e }) => {
|
|
556
|
+
t.tx.builder_free(e);
|
|
525
557
|
}
|
|
526
558
|
);
|
|
527
559
|
var c, f;
|
|
528
560
|
const I = class I {
|
|
529
|
-
constructor(e,
|
|
561
|
+
constructor(e, n) {
|
|
530
562
|
v(this, c);
|
|
531
563
|
v(this, f);
|
|
532
|
-
S(this, c, e), S(this, f,
|
|
564
|
+
S(this, c, e), S(this, f, n);
|
|
533
565
|
}
|
|
534
566
|
/**
|
|
535
567
|
* Create a {@link Builder} with a minimal manifest definition as its initial state.
|
|
@@ -538,9 +570,9 @@ const I = class I {
|
|
|
538
570
|
* @param context Optional `Context` configuring this builder's behavior.
|
|
539
571
|
* @returns A {@link Builder} object.
|
|
540
572
|
*/
|
|
541
|
-
static async new(e,
|
|
542
|
-
const r = await
|
|
543
|
-
return
|
|
573
|
+
static async new(e, n = new A()) {
|
|
574
|
+
const r = await n.toJson(), { worker: s } = e, o = await s.tx.builder_new(r), _ = new I(s, o);
|
|
575
|
+
return F.register(_, { worker: s, id: o }, _), _;
|
|
544
576
|
}
|
|
545
577
|
/**
|
|
546
578
|
* Create a {@link Builder} from a {@link ManifestDefinition}.
|
|
@@ -550,9 +582,9 @@ const I = class I {
|
|
|
550
582
|
* @param context Optional `Context` configuring this builder's behavior.
|
|
551
583
|
* @returns A {@link Builder} object.
|
|
552
584
|
*/
|
|
553
|
-
static async fromDefinition(e,
|
|
554
|
-
const
|
|
555
|
-
return
|
|
585
|
+
static async fromDefinition(e, n, r = new A()) {
|
|
586
|
+
const s = JSON.stringify(n), o = await r.toJson(), { worker: _ } = e, a = await _.tx.builder_fromJson(s, o), u = new I(_, a);
|
|
587
|
+
return F.register(u, { worker: _, id: a }, u), u;
|
|
556
588
|
}
|
|
557
589
|
/**
|
|
558
590
|
* Create a {@link Builder} from a builder archive (created from {@link Builder.toArchive}).
|
|
@@ -562,9 +594,9 @@ const I = class I {
|
|
|
562
594
|
* @param context Optional `Context` configuring this builder's behavior.
|
|
563
595
|
* @returns A {@link Builder} object.
|
|
564
596
|
*/
|
|
565
|
-
static async fromArchive(e,
|
|
566
|
-
const
|
|
567
|
-
return
|
|
597
|
+
static async fromArchive(e, n, r = new A()) {
|
|
598
|
+
const s = await r.toJson(), { worker: o } = e, _ = await o.tx.builder_fromArchive(n, s), a = new I(o, _);
|
|
599
|
+
return F.register(a, { worker: o, id: _ }, a), a;
|
|
568
600
|
}
|
|
569
601
|
/**
|
|
570
602
|
* Sets the builder "intent."
|
|
@@ -590,8 +622,8 @@ const I = class I {
|
|
|
590
622
|
* @param label The assertion label (reverse-domain format).
|
|
591
623
|
* @param data The assertion data (any JSON-serializable value).
|
|
592
624
|
*/
|
|
593
|
-
async addAssertion(e,
|
|
594
|
-
await i(this, c).tx.builder_addAssertion(i(this, f), e,
|
|
625
|
+
async addAssertion(e, n) {
|
|
626
|
+
await i(this, c).tx.builder_addAssertion(i(this, f), e, n);
|
|
595
627
|
}
|
|
596
628
|
/**
|
|
597
629
|
* Redact an assertion from an ingredient manifest.
|
|
@@ -602,8 +634,8 @@ const I = class I {
|
|
|
602
634
|
* @param uri JUMBF URI of the assertion to redact.
|
|
603
635
|
* @param reason The {@link C2paReason} for the redaction.
|
|
604
636
|
*/
|
|
605
|
-
async addRedaction(e,
|
|
606
|
-
await i(this, c).tx.builder_addRedaction(i(this, f), e,
|
|
637
|
+
async addRedaction(e, n) {
|
|
638
|
+
await i(this, c).tx.builder_addRedaction(i(this, f), e, n);
|
|
607
639
|
}
|
|
608
640
|
/**
|
|
609
641
|
* Sets the remote URL for a remote manifest. The manifest is expected to be available at this location.
|
|
@@ -628,8 +660,8 @@ const I = class I {
|
|
|
628
660
|
* @param format Format of the thumbnail
|
|
629
661
|
* @param blob Blob of the thumbnail bytes
|
|
630
662
|
*/
|
|
631
|
-
async setThumbnailFromBlob(e,
|
|
632
|
-
await i(this, c).tx.builder_setThumbnailFromBlob(i(this, f), e,
|
|
663
|
+
async setThumbnailFromBlob(e, n) {
|
|
664
|
+
await i(this, c).tx.builder_setThumbnailFromBlob(i(this, f), e, n);
|
|
633
665
|
}
|
|
634
666
|
/**
|
|
635
667
|
* Experimental.
|
|
@@ -651,10 +683,10 @@ const I = class I {
|
|
|
651
683
|
* @param keep The action is retained when the predicate returns true.
|
|
652
684
|
*/
|
|
653
685
|
async filterActions(e) {
|
|
654
|
-
const
|
|
686
|
+
const n = await i(this, c).tx.builder_getDefinition(
|
|
655
687
|
i(this, f)
|
|
656
|
-
),
|
|
657
|
-
await i(this, c).tx.builder_filterActionsAt(i(this, f),
|
|
688
|
+
), s = H(n).reduce((o, _, a) => (e(_) && o.push(a), o), []);
|
|
689
|
+
await i(this, c).tx.builder_filterActionsAt(i(this, f), s);
|
|
658
690
|
}
|
|
659
691
|
/**
|
|
660
692
|
* Experimental.
|
|
@@ -670,10 +702,10 @@ const I = class I {
|
|
|
670
702
|
* @param rescue Can rescue an otherwise-orphaned ingredient by returning true.
|
|
671
703
|
*/
|
|
672
704
|
async filterIngredients(e) {
|
|
673
|
-
const
|
|
705
|
+
const s = ((await i(this, c).tx.builder_getDefinition(
|
|
674
706
|
i(this, f)
|
|
675
|
-
)).ingredients ?? []).reduce((
|
|
676
|
-
await i(this, c).tx.builder_filterIngredientsAt(i(this, f),
|
|
707
|
+
)).ingredients ?? []).reduce((o, _, a) => (e(_) && o.push(a), o), []);
|
|
708
|
+
await i(this, c).tx.builder_filterIngredientsAt(i(this, f), s);
|
|
677
709
|
}
|
|
678
710
|
/**
|
|
679
711
|
* Experimental.
|
|
@@ -686,16 +718,16 @@ const I = class I {
|
|
|
686
718
|
* @param rescueIngredient Can rescue an otherwise-orphaned ingredient (and the action
|
|
687
719
|
* referencing it) by returning true.
|
|
688
720
|
*/
|
|
689
|
-
async filterActionsAndIngredients(e,
|
|
721
|
+
async filterActionsAndIngredients(e, n) {
|
|
690
722
|
const r = await i(this, c).tx.builder_getDefinition(
|
|
691
723
|
i(this, f)
|
|
692
|
-
),
|
|
693
|
-
(u, w, l) => (
|
|
724
|
+
), o = H(r).reduce((u, w, l) => (e(w) && u.push(l), u), []), a = (r.ingredients ?? []).reduce(
|
|
725
|
+
(u, w, l) => (n(w) && u.push(l), u),
|
|
694
726
|
[]
|
|
695
727
|
);
|
|
696
728
|
await i(this, c).tx.builder_filterActionsAndIngredientsAt(
|
|
697
729
|
i(this, f),
|
|
698
|
-
|
|
730
|
+
o,
|
|
699
731
|
a
|
|
700
732
|
);
|
|
701
733
|
}
|
|
@@ -717,10 +749,10 @@ const I = class I {
|
|
|
717
749
|
* @param transform Receives one assertion's actions and returns its full replacement list.
|
|
718
750
|
*/
|
|
719
751
|
async updateActions(e) {
|
|
720
|
-
const
|
|
752
|
+
const n = await i(this, c).tx.builder_getDefinition(
|
|
721
753
|
i(this, f)
|
|
722
|
-
),
|
|
723
|
-
await i(this, c).tx.builder_updateActionsAt(i(this, f),
|
|
754
|
+
), s = re(n).map((o) => e(o));
|
|
755
|
+
await i(this, c).tx.builder_updateActionsAt(i(this, f), s);
|
|
724
756
|
}
|
|
725
757
|
/**
|
|
726
758
|
* Add an ingredient to the builder from a definition only.
|
|
@@ -728,8 +760,8 @@ const I = class I {
|
|
|
728
760
|
* @param ingredientDefinition {@link Ingredient} definition.
|
|
729
761
|
*/
|
|
730
762
|
async addIngredient(e) {
|
|
731
|
-
const
|
|
732
|
-
await i(this, c).tx.builder_addIngredient(i(this, f),
|
|
763
|
+
const n = JSON.stringify(e);
|
|
764
|
+
await i(this, c).tx.builder_addIngredient(i(this, f), n);
|
|
733
765
|
}
|
|
734
766
|
/**
|
|
735
767
|
* Add an ingredient to the builder from a definition, format, and blob.
|
|
@@ -739,9 +771,9 @@ const I = class I {
|
|
|
739
771
|
* @param format Format of the ingredient.
|
|
740
772
|
* @param blob Blob of the ingredient's bytes.
|
|
741
773
|
*/
|
|
742
|
-
async addIngredientFromBlob(e,
|
|
743
|
-
const
|
|
744
|
-
await i(this, c).tx.builder_addIngredientFromBlob(i(this, f),
|
|
774
|
+
async addIngredientFromBlob(e, n, r) {
|
|
775
|
+
const s = JSON.stringify(e);
|
|
776
|
+
await i(this, c).tx.builder_addIngredientFromBlob(i(this, f), s, n, r);
|
|
745
777
|
}
|
|
746
778
|
/**
|
|
747
779
|
* Add a resource to the builder's resource store with an ID and blob of the resource's bytes.
|
|
@@ -749,8 +781,8 @@ const I = class I {
|
|
|
749
781
|
* @param resourceId ID associated with the resource being added.
|
|
750
782
|
* @param blob Blob of the resource's bytes.
|
|
751
783
|
*/
|
|
752
|
-
async addResourceFromBlob(e,
|
|
753
|
-
await i(this, c).tx.builder_addResourceFromBlob(i(this, f), e,
|
|
784
|
+
async addResourceFromBlob(e, n) {
|
|
785
|
+
await i(this, c).tx.builder_addResourceFromBlob(i(this, f), e, n);
|
|
754
786
|
}
|
|
755
787
|
/**
|
|
756
788
|
* Gets the current manifest definition held by the builder.
|
|
@@ -780,17 +812,17 @@ const I = class I {
|
|
|
780
812
|
*
|
|
781
813
|
* @todo Docs coming soon
|
|
782
814
|
*/
|
|
783
|
-
async sign(e,
|
|
784
|
-
const
|
|
815
|
+
async sign(e, n, r, s) {
|
|
816
|
+
const o = await Y(e), _ = i(this, c).registerSignReceiver(e.sign), a = X(
|
|
785
817
|
i(this, c),
|
|
786
|
-
|
|
818
|
+
s
|
|
787
819
|
);
|
|
788
820
|
return await i(this, c).tx.builder_sign(
|
|
789
821
|
i(this, f),
|
|
790
822
|
_,
|
|
791
|
-
|
|
823
|
+
o,
|
|
792
824
|
a,
|
|
793
|
-
|
|
825
|
+
n,
|
|
794
826
|
r
|
|
795
827
|
);
|
|
796
828
|
}
|
|
@@ -805,17 +837,17 @@ const I = class I {
|
|
|
805
837
|
*
|
|
806
838
|
* @todo Docs coming soon
|
|
807
839
|
*/
|
|
808
|
-
async signAndGetManifestBytes(e,
|
|
809
|
-
const
|
|
840
|
+
async signAndGetManifestBytes(e, n, r, s) {
|
|
841
|
+
const o = await Y(e), _ = i(this, c).registerSignReceiver(e.sign), a = X(
|
|
810
842
|
i(this, c),
|
|
811
|
-
|
|
843
|
+
s
|
|
812
844
|
);
|
|
813
845
|
return await i(this, c).tx.builder_signAndGetManifestBytes(
|
|
814
846
|
i(this, f),
|
|
815
847
|
_,
|
|
816
|
-
|
|
848
|
+
o,
|
|
817
849
|
a,
|
|
818
|
-
|
|
850
|
+
n,
|
|
819
851
|
r
|
|
820
852
|
);
|
|
821
853
|
}
|
|
@@ -823,64 +855,64 @@ const I = class I {
|
|
|
823
855
|
* Dispose of this Builder, freeing the memory it occupied and preventing further use. Call this whenever the Builder is no longer needed.
|
|
824
856
|
*/
|
|
825
857
|
async free() {
|
|
826
|
-
|
|
858
|
+
F.unregister(this), await i(this, c).tx.builder_free(i(this, f));
|
|
827
859
|
}
|
|
828
860
|
};
|
|
829
861
|
c = new WeakMap(), f = new WeakMap();
|
|
830
862
|
let E = I;
|
|
831
|
-
function
|
|
863
|
+
function Oe(t, e = {}) {
|
|
832
864
|
return {
|
|
833
|
-
new: (
|
|
834
|
-
fromDefinition: (
|
|
835
|
-
n,
|
|
865
|
+
new: (n = {}) => E.new(t, new A(x(e, n))),
|
|
866
|
+
fromDefinition: (n, r = {}) => E.fromDefinition(
|
|
836
867
|
t,
|
|
868
|
+
n,
|
|
837
869
|
new A(x(e, r))
|
|
838
870
|
),
|
|
839
|
-
fromArchive: (
|
|
840
|
-
n,
|
|
871
|
+
fromArchive: (n, r = {}) => E.fromArchive(
|
|
841
872
|
t,
|
|
873
|
+
n,
|
|
842
874
|
new A(x(e, r))
|
|
843
875
|
)
|
|
844
876
|
};
|
|
845
877
|
}
|
|
846
|
-
async function
|
|
847
|
-
const { wasmSrc: e, workerSrc:
|
|
848
|
-
worker:
|
|
878
|
+
async function We(t) {
|
|
879
|
+
const { wasmSrc: e, workerSrc: n, settings: r } = t, s = typeof e == "string" ? await Le(e) : e, o = await ue({ wasm: s, workerSrc: n }), _ = {
|
|
880
|
+
worker: o,
|
|
849
881
|
reader: void 0,
|
|
850
882
|
builder: void 0,
|
|
851
|
-
dispose:
|
|
883
|
+
dispose: o.terminate
|
|
852
884
|
};
|
|
853
|
-
return _.reader =
|
|
885
|
+
return _.reader = je(_, r), _.builder = Oe(_, r), _;
|
|
854
886
|
}
|
|
855
|
-
async function
|
|
856
|
-
const e = await fetch(
|
|
887
|
+
async function Le(t) {
|
|
888
|
+
const e = await fetch(t, { integrity: de });
|
|
857
889
|
return await WebAssembly.compileStreaming(e);
|
|
858
890
|
}
|
|
859
891
|
export {
|
|
860
|
-
|
|
892
|
+
Me as A,
|
|
861
893
|
E as B,
|
|
862
894
|
A as C,
|
|
863
|
-
|
|
895
|
+
we as D,
|
|
864
896
|
M as R,
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
897
|
+
be as a,
|
|
898
|
+
ge as b,
|
|
899
|
+
he as c,
|
|
900
|
+
me as d,
|
|
901
|
+
Fe as e,
|
|
902
|
+
xe as f,
|
|
903
|
+
We as g,
|
|
904
|
+
$e as h,
|
|
905
|
+
Je as i,
|
|
906
|
+
Ce as j,
|
|
907
|
+
ye as k,
|
|
908
|
+
W as l,
|
|
909
|
+
Q as m,
|
|
878
910
|
ke as n,
|
|
879
911
|
x as o,
|
|
880
|
-
|
|
912
|
+
V as p,
|
|
881
913
|
J as q,
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
914
|
+
Ie as r,
|
|
915
|
+
Pe as s,
|
|
916
|
+
N as v,
|
|
917
|
+
Ee as w
|
|
886
918
|
};
|