@contentauth/c2pa-web 0.3.0 → 0.3.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.
- package/dist/{c2pa-DoH4pYyU.js → c2pa-B24NQuig.js} +51 -42
- package/dist/index.js +1 -1
- package/dist/inline.js +3 -3
- package/dist/lib/builder.d.ts +20 -0
- package/dist/lib/builder.d.ts.map +1 -1
- package/dist/lib/worker/rpc.d.ts +6 -0
- package/dist/lib/worker/rpc.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { channel as h, transfer as F } from "highgain";
|
|
2
|
-
const { createTx: S, rx: W } = h(), { createTx: J, rx: T } = h("worker"), v = '(function(){"use strict";let o,T=null;function F(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(o.memory.buffer)),T}let A=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&A.decode();const q=2146435072;let j=0;function C(t,e){return j+=e,j>=q&&(A=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},A.decode(),j=e),A.decode(F().subarray(t,t+e))}function w(t,e){return t=t>>>0,C(t,e)}function B(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function b(t,e){try{return t.apply(this,e)}catch(n){const r=B(n);o.__wbindgen_exn_store(r)}}function h(t,e){return t=t>>>0,F().subarray(t/1,t/1+e)}let u=0;const R=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},V=typeof R.encodeInto=="function"?function(t,e){return R.encodeInto(t,e)}:function(t,e){const n=R.encode(t);return e.set(n),{read:t.length,written:n.length}};function f(t,e,n){if(n===void 0){const s=R.encode(t),a=e(s.length,1)>>>0;return F().subarray(a,a+s.length).set(s),u=s.length,a}let r=t.length,_=e(r,1)>>>0;const c=F();let i=0;for(;i<r;i++){const s=t.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==r){i!==0&&(t=t.slice(i)),_=n(_,r,r=i+t.length*3,1)>>>0;const s=F().subarray(_+i,_+r),a=V(t,s);i+=a.written,_=n(_,r,i,1)>>>0}return u=i,_}let y=null;function m(){return(y===null||y.buffer.detached===!0||y.buffer.detached===void 0&&y.buffer!==o.memory.buffer)&&(y=new DataView(o.memory.buffer)),y}function M(t){return t==null}function v(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const _=t.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=t.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(t)){const _=t.length;let c="[";_>0&&(c+=v(t[0]));for(let i=1;i<_;i++)c+=", "+v(t[i]);return c+="]",c}const n=/\\[object ([^\\]]+)\\]/.exec(toString.call(t));let r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function D(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return r(s,_.b,...i)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(s,_.b),O.unregister(_)):_.a=s}};return c.original=_,O.register(c,_,_),c}function g(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function P(t){const e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,r=o.loadSettings(e,n);if(r[1])throw g(r[0])}function $(t,e,n){o.closure1669_externref_shim(t,e,n)}function J(t,e){o.wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d(t,e)}function G(t,e,n,r){o.closure2615_externref_shim(t,e,n,r)}const H=["omit","same-origin","include"],X=["same-origin","no-cors","cors","navigate"],N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmbuilder_free(t>>>0,1));class E{static __wrap(e){e=e>>>0;const n=Object.create(E.prototype);return n.__wbg_ptr=e,N.register(n,n.__wbg_ptr,n),n}__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_wasmbuilder_free(e,0)}static fromJson(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmbuilder_fromJson(n,r);if(_[2])throw g(_[1]);return E.__wrap(_[0])}setRemoteUrl(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,n,r)}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setThumbnailFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}addIngredientFromBlob(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,i=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u,a=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,r);if(a[1])throw g(a[0])}addResourceFromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,_,n);if(c[1])throw g(c[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}sign(e,n,r){const _=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,r)}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class S{static __wrap(e){e=e>>>0;const n=Object.create(S.prototype);return n.__wbg_ptr=e,L.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,L.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmreader_fromBlobFragment(_,c,n,r)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=w(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),n}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw g(e[1]);return g(e[0])}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],w(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw g(_[1]);return g(_[0])}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>o.__wbg_wasmsigner_free(t>>>0,1));function Y(){const t={};return t.wbg={},t.wbg.__wbg_Error_1f3748b298f99708=function(e,n){return Error(w(e,n))},t.wbg.__wbg_Number_577a493fc95ea223=function(e){return Number(e)},t.wbg.__wbg_abort_6665281623826052=function(e){e.abort()},t.wbg.__wbg_abort_c11a5d245a242912=function(e,n){e.abort(n)},t.wbg.__wbg_append_3e86b0cd6215edd8=function(){return b(function(e,n,r,_,c){e.append(w(n,r),w(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_55e4a430671abfd8=function(){return b(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_1f897e9f3ed6b41d=function(e){return e.buffer},t.wbg.__wbg_byteLength_7029fecd0c136e6d=function(e){return e.byteLength},t.wbg.__wbg_call_2f8d426a20a307fe=function(){return b(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_f53f0647ceb9c567=function(){return b(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},t.wbg.__wbg_done_4a7743b6f942c9f3=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(w(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_9885d2e26ad251bb=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_237b1ad767238d8b=function(e){return Array.from(e)},t.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return b(function(e,n){globalThis.crypto.getRandomValues(h(e,n))},arguments)},t.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return b(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_getTime_5b1dd03bb6d4b784=function(e){return e.getTime()},t.wbg.__wbg_get_27b4bcbec57323ca=function(){return b(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_85abdd8aeb8edebf=function(){return b(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_177bc880a5823968=function(e){return e.headers},t.wbg.__wbg_instanceof_Promise_1147df2e75727145=function(e){let n;try{n=e instanceof Promise}catch{n=!1}return n},t.wbg.__wbg_instanceof_Response_0ab386c6818f788a=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_96378c3c9a17347c=function(){return Symbol.iterator},t.wbg.__wbg_length_904c0910ed998bf3=function(e){return e.length},t.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},t.wbg.__wbg_new0_85cc856927102294=function(){return new Date},t.wbg.__wbg_new_12588505388d0897=function(){return b(function(){return new Headers},arguments)},t.wbg.__wbg_new_1930cbb8d9ffc31b=function(){return new Object},t.wbg.__wbg_new_56407f99198feff7=function(){return new Map},t.wbg.__wbg_new_6a8b180049d9484e=function(){return b(function(){return new AbortController},arguments)},t.wbg.__wbg_new_7e574c906ccc59b1=function(){return b(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_9190433fb67ed635=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_97ddeb994a38bb69=function(e,n){return new Error(w(e,n))},t.wbg.__wbg_new_d5e3800b120e37e1=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const a=r.a;r.a=0;try{return G(a,r.b,i,s)}finally{r.a=a}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_e969dc3f68d25093=function(){return new Array},t.wbg.__wbg_newfromslice_d0d56929c6d9c842=function(e,n){return new Uint8Array(h(e,n))},t.wbg.__wbg_newnoargs_a81330f6e05d8aca=function(e,n){return new Function(w(e,n))},t.wbg.__wbg_newwithlength_ed0ee6c1edca86fc=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_e8e22e9851f3c2fe=function(){return b(function(e,n,r){return new Request(w(e,n),r)},arguments)},t.wbg.__wbg_next_2e6b37020ac5fe58=function(){return b(function(e){return e.next()},arguments)},t.wbg.__wbg_next_3de8f2669431a3ff=function(e){return e.next},t.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},t.wbg.__wbg_now_e3057dd824ca0191=function(){return Date.now()},t.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},t.wbg.__wbg_prototypesetcall_c5f74efd31aea86b=function(e,n,r){Uint8Array.prototype.set.call(h(e,n),r)},t.wbg.__wbg_queueMicrotask_bcc6e26d899696db=function(e){return e.queueMicrotask},t.wbg.__wbg_queueMicrotask_f24a794d09c42640=function(e){queueMicrotask(e)},t.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return b(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_readAsArrayBuffer_b45cdda102d3c0b2=function(){return b(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_require_60cc747a6bc5215a=function(){return b(function(){return module.require},arguments)},t.wbg.__wbg_resolve_5775c0ef9222f556=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_1d5fe1e3f51a48d8=function(e,n,r){e.set(h(n,r))},t.wbg.__wbg_set_31197016f65a6a19=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_d636a0463acf1dbc=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_setbody_e324371c31597f2a=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_55a9317ed2777533=function(e,n){e.credentials=H[n]},t.wbg.__wbg_setheaders_ac0b1e4890a949cd=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_9ce6e95af1ae0eaf=function(e,n,r){e.method=w(n,r)},t.wbg.__wbg_setmode_b89d1784e7e7f118=function(e,n){e.mode=X[n]},t.wbg.__wbg_setsignal_e663c6d962763cd5=function(e,n){e.signal=n},t.wbg.__wbg_signal_bdb003fe19e53a13=function(e){return e.signal},t.wbg.__wbg_size_4181b899cbfa6483=function(e){return e.size},t.wbg.__wbg_slice_dc41c7f2c4886814=function(){return b(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_1f13249cc3acc96d=function(){const e=typeof global>"u"?null:global;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3=function(){const e=typeof globalThis>"u"?null:globalThis;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_SELF_6265471db3b3c228=function(){const e=typeof self>"u"?null:self;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_WINDOW_16fb482f8ec52863=function(){const e=typeof window>"u"?null:window;return M(e)?0:B(e)},t.wbg.__wbg_status_31874648c8651949=function(e){return e.status},t.wbg.__wbg_stringify_1f41b6198e0932e0=function(){return b(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_subarray_a219824899e59712=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_then_8d2fcccde5380a03=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_then_9cc266be2bf537b6=function(e,n){return e.then(n)},t.wbg.__wbg_url_d5273b9e10503471=function(e,n){const r=n.url,_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},t.wbg.__wbg_valueOf_94f1c9efbe2ba399=function(e){return e.valueOf()},t.wbg.__wbg_value_09d0b4eaab48b91d=function(e){return e.value},t.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},t.wbg.__wbg_wasmreader_new=function(e){return S.__wrap(e)},t.wbg.__wbg_wbindgencbdrop_a85ed476c6a370b9=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d=function(e,n){const r=v(n),_=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},t.wbg.__wbg_wbindgenisfunction_ea72b9d66a0e1705=function(e){return typeof e=="function"},t.wbg.__wbg_wbindgenisobject_dfe064a121d87553=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbg_wbindgenisstring_4b74e4111ba029e6=function(e){return typeof e=="string"},t.wbg.__wbg_wbindgenisundefined_71f08a6ade4354e7=function(e){return e===void 0},t.wbg.__wbg_wbindgenstringget_43fe05afe34b0cb1=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=M(_)?0:f(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},t.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf=function(e,n){throw new Error(w(e,n))},t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,n){return w(e,n)},t.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,n){return BigInt.asUintN(64,e)|n<<BigInt(64)},t.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,n){var r=h(e,n).slice();return o.__wbindgen_free(e,n*1,1),r},t.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},t.wbg.__wbindgen_cast_cb60167f8bf6c33f=function(e,n){return D(e,n,1658,$)},t.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,n){return h(e,n)},t.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},t.wbg.__wbindgen_cast_e943630f8c22ccf7=function(e,n){return D(e,n,1651,J)},t.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t}function K(t,e){return o=t.exports,y=null,T=null,o.__wbindgen_start(),o}function Q(t){if(o!==void 0)return o;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=Y();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return K(n)}function k(){let t=0;const e=new Map;return{add(n){const r=t++;return e.set(r,n),r},get(n){const r=e.get(n);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(n){return e.delete(n)}}}const z=Symbol("transfer");function I(t,e){return{type:z,value:t,transfer:e?Array.isArray(e)?e:[e]:[t]}}function U(t){return!!(t&&typeof t=="object"&&Reflect.get(t,"type")===z)}function W(t="default"){return{createTx(e){const n=new Map,r=e??self;return r.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==t)return;const{id:i,result:s,error:a}=c,d=n.get(i);d&&(a?d.reject(a):d.resolve(s),n.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=Z(),a=[],d=[];return i.forEach(x=>{U(x)?(a.push(x.value),d.push(...x.transfer)):a.push(x)}),r.postMessage({method:c,args:a,id:s,channelName:t},{transfer:d}),new Promise((x,re)=>{n.set(s,{resolve:x,reject:re})})}}})},rx(e,n){const r=n??self;r.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==t)return;const{method:i,args:s,id:a}=c;try{const d=await e[i](...s);U(d)?r.postMessage({result:d.value,id:a,channelName:t},{transfer:d.transfer}):r.postMessage({result:d,id:a,channelName:t})}catch(d){r.postMessage({error:d,id:a,channelName:t})}})}}}function Z(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:ee}=W(),{createTx:te}=W("worker"),l=k(),p=k(),ne=te();ee({async initWorker(t,e){Q(t),e&&P(e)},async reader_fromBlob(t,e){const n=await S.fromBlob(t,e);return l.add(n)},async reader_fromBlobFragment(t,e,n){const r=await S.fromBlobFragment(t,e,n);return l.add(r)},reader_activeLabel(t){return l.get(t).activeLabel()??null},reader_manifestStore(t){return l.get(t).manifestStore()},reader_activeManifest(t){return l.get(t).activeManifest()},reader_json(t){return l.get(t).json()},reader_resourceToBuffer(t,e){const r=l.get(t).resourceToBuffer(e);return I(r)},reader_free(t){l.get(t).free(),l.remove(t)},builder_fromJson(t){const e=E.fromJson(t);return p.add(e)},builder_addIngredientFromBlob(t,e,n,r){p.get(t).addIngredientFromBlob(e,n,r)},builder_addResourceFromBlob(t,e,n){p.get(t).addResourceFromBlob(e,n)},builder_getDefinition(t){return p.get(t).getDefinition()},async builder_sign(t,e,n,r,_){const i=await p.get(t).sign({reserveSize:n.reserveSize,alg:n.alg,sign:async s=>await ne.sign(e,I(s,s.buffer),n.reserveSize)},r,_);return I(i,i.buffer)},builder_free(t){p.get(t).free(),p.remove(t)}})})();\n', d = typeof self < "u" && self.Blob && new Blob([v], { type: "text/javascript;charset=utf-8" });
|
|
3
|
-
function
|
|
2
|
+
const { createTx: T, rx: W } = h(), { createTx: q, rx: B } = h("worker"), v = '(function(){"use strict";let _,x=null;function F(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(_.memory.buffer)),x}let S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&S.decode();const q=2146435072;let j=0;function C(t,e){return j+=e,j>=q&&(S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},S.decode(),j=e),S.decode(F().subarray(t,t+e))}function w(t,e){return t=t>>>0,C(t,e)}function B(t){const e=_.__externref_table_alloc();return _.__wbindgen_export_2.set(e,t),e}function a(t,e){try{return t.apply(this,e)}catch(n){const r=B(n);_.__wbindgen_exn_store(r)}}function h(t,e){return t=t>>>0,F().subarray(t/1,t/1+e)}let u=0;const E=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},V=typeof E.encodeInto=="function"?function(t,e){return E.encodeInto(t,e)}:function(t,e){const n=E.encode(t);return e.set(n),{read:t.length,written:n.length}};function f(t,e,n){if(n===void 0){const s=E.encode(t),b=e(s.length,1)>>>0;return F().subarray(b,b+s.length).set(s),u=s.length,b}let r=t.length,o=e(r,1)>>>0;const c=F();let i=0;for(;i<r;i++){const s=t.charCodeAt(i);if(s>127)break;c[o+i]=s}if(i!==r){i!==0&&(t=t.slice(i)),o=n(o,r,r=i+t.length*3,1)>>>0;const s=F().subarray(o+i,o+r),b=V(t,s);i+=b.written,o=n(o,r,i,1)>>>0}return u=i,o}let p=null;function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==_.memory.buffer)&&(p=new DataView(_.memory.buffer)),p}function M(t){return t==null}function v(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const o=t.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=t.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(t)){const o=t.length;let c="[";o>0&&(c+=v(t[0]));for(let i=1;i<o;i++)c+=", "+v(t[i]);return c+="]",c}const n=/\\[object ([^\\]]+)\\]/.exec(toString.call(t));let r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}const O=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{_.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function D(t,e,n,r){const o={a:t,b:e,cnt:1,dtor:n},c=(...i)=>{o.cnt++;const s=o.a;o.a=0;try{return r(s,o.b,...i)}finally{--o.cnt===0?(_.__wbindgen_export_6.get(o.dtor)(s,o.b),O.unregister(o)):o.a=s}};return c.original=o,O.register(c,o,o),c}function d(t){const e=_.__wbindgen_export_2.get(t);return _.__externref_table_dealloc(t),e}function P(t){const e=f(t,_.__wbindgen_malloc,_.__wbindgen_realloc),n=u,r=_.loadSettings(e,n);if(r[1])throw d(r[0])}function $(t,e){_.wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d(t,e)}function J(t,e,n){_.closure1669_externref_shim(t,e,n)}function G(t,e,n,r){_.closure2615_externref_shim(t,e,n,r)}const H=["omit","same-origin","include"],X=["same-origin","no-cors","cors","navigate"],N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>_.__wbg_wasmbuilder_free(t>>>0,1));class A{static __wrap(e){e=e>>>0;const n=Object.create(A.prototype);return n.__wbg_ptr=e,N.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){const e=this.__destroy_into_raw();_.__wbg_wasmbuilder_free(e,0)}static fromJson(e){const n=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),r=u,o=_.wasmbuilder_fromJson(n,r);if(o[2])throw d(o[1]);return A.__wrap(o[0])}setRemoteUrl(e){const n=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),r=u;_.wasmbuilder_setRemoteUrl(this.__wbg_ptr,n,r)}setNoEmbed(e){_.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setThumbnailFromBlob(e,n){const r=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),o=u,c=_.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,r,o,n);if(c[1])throw d(c[0])}addIngredientFromBlob(e,n,r){const o=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u,i=f(n,_.__wbindgen_malloc,_.__wbindgen_realloc),s=u,b=_.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,o,c,i,s,r);if(b[1])throw d(b[0])}addResourceFromBlob(e,n){const r=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),o=u,c=_.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,r,o,n);if(c[1])throw d(c[0])}getDefinition(){const e=_.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}sign(e,n,r){const o=f(n,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u;return _.wasmbuilder_sign(this.__wbg_ptr,e,o,c,r)}}const L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>_.__wbg_wasmreader_free(t>>>0,1));class R{static __wrap(e){e=e>>>0;const n=Object.create(R.prototype);return n.__wbg_ptr=e,L.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,L.unregister(this),e}free(){const e=this.__destroy_into_raw();_.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),o=u;return _.wasmreader_fromBlob(r,o,n)}static fromBlobFragment(e,n,r){const o=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u;return _.wasmreader_fromBlobFragment(o,c,n,r)}activeLabel(){const e=_.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=w(e[0],e[1]).slice(),_.__wbindgen_free(e[0],e[1]*1,1)),n}manifestStore(){const e=_.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}activeManifest(){const e=_.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw d(e[1]);return d(e[0])}json(){let e,n;try{const r=_.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],w(r[0],r[1])}finally{_.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=f(e,_.__wbindgen_malloc,_.__wbindgen_realloc),r=u,o=_.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(o[2])throw d(o[1]);return d(o[0])}}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>_.__wbg_wasmsigner_free(t>>>0,1));function Y(){const t={};return t.wbg={},t.wbg.__wbg_Error_1f3748b298f99708=function(e,n){return Error(w(e,n))},t.wbg.__wbg_Number_577a493fc95ea223=function(e){return Number(e)},t.wbg.__wbg_abort_6665281623826052=function(e){e.abort()},t.wbg.__wbg_abort_c11a5d245a242912=function(e,n){e.abort(n)},t.wbg.__wbg_append_3e86b0cd6215edd8=function(){return a(function(e,n,r,o,c){e.append(w(n,r),w(o,c))},arguments)},t.wbg.__wbg_arrayBuffer_55e4a430671abfd8=function(){return a(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_1f897e9f3ed6b41d=function(e){return e.buffer},t.wbg.__wbg_byteLength_7029fecd0c136e6d=function(e){return e.byteLength},t.wbg.__wbg_call_2f8d426a20a307fe=function(){return a(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_f53f0647ceb9c567=function(){return a(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_crypto_574e78ad8b13b65f=function(e){return e.crypto},t.wbg.__wbg_done_4a7743b6f942c9f3=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,o;try{r=e,o=n,console.error(w(e,n))}finally{_.__wbindgen_free(r,o,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_9885d2e26ad251bb=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_237b1ad767238d8b=function(e){return Array.from(e)},t.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7=function(){return a(function(e,n){globalThis.crypto.getRandomValues(h(e,n))},arguments)},t.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e=function(){return a(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_getTime_5b1dd03bb6d4b784=function(e){return e.getTime()},t.wbg.__wbg_get_27b4bcbec57323ca=function(){return a(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_85abdd8aeb8edebf=function(){return a(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_177bc880a5823968=function(e){return e.headers},t.wbg.__wbg_instanceof_Promise_1147df2e75727145=function(e){let n;try{n=e instanceof Promise}catch{n=!1}return n},t.wbg.__wbg_instanceof_Response_0ab386c6818f788a=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_96378c3c9a17347c=function(){return Symbol.iterator},t.wbg.__wbg_length_904c0910ed998bf3=function(e){return e.length},t.wbg.__wbg_msCrypto_a61aeb35a24c1329=function(e){return e.msCrypto},t.wbg.__wbg_new0_85cc856927102294=function(){return new Date},t.wbg.__wbg_new_12588505388d0897=function(){return a(function(){return new Headers},arguments)},t.wbg.__wbg_new_1930cbb8d9ffc31b=function(){return new Object},t.wbg.__wbg_new_56407f99198feff7=function(){return new Map},t.wbg.__wbg_new_6a8b180049d9484e=function(){return a(function(){return new AbortController},arguments)},t.wbg.__wbg_new_7e574c906ccc59b1=function(){return a(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_9190433fb67ed635=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_97ddeb994a38bb69=function(e,n){return new Error(w(e,n))},t.wbg.__wbg_new_d5e3800b120e37e1=function(e,n){try{var r={a:e,b:n},o=(i,s)=>{const b=r.a;r.a=0;try{return G(b,r.b,i,s)}finally{r.a=b}};return new Promise(o)}finally{r.a=r.b=0}},t.wbg.__wbg_new_e969dc3f68d25093=function(){return new Array},t.wbg.__wbg_newfromslice_d0d56929c6d9c842=function(e,n){return new Uint8Array(h(e,n))},t.wbg.__wbg_newnoargs_a81330f6e05d8aca=function(e,n){return new Function(w(e,n))},t.wbg.__wbg_newwithlength_ed0ee6c1edca86fc=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_e8e22e9851f3c2fe=function(){return a(function(e,n,r){return new Request(w(e,n),r)},arguments)},t.wbg.__wbg_next_2e6b37020ac5fe58=function(){return a(function(e){return e.next()},arguments)},t.wbg.__wbg_next_3de8f2669431a3ff=function(e){return e.next},t.wbg.__wbg_node_905d3e251edff8a2=function(e){return e.node},t.wbg.__wbg_now_e3057dd824ca0191=function(){return Date.now()},t.wbg.__wbg_process_dc0fbacc7c1c06f7=function(e){return e.process},t.wbg.__wbg_prototypesetcall_c5f74efd31aea86b=function(e,n,r){Uint8Array.prototype.set.call(h(e,n),r)},t.wbg.__wbg_queueMicrotask_bcc6e26d899696db=function(e){return e.queueMicrotask},t.wbg.__wbg_queueMicrotask_f24a794d09c42640=function(e){queueMicrotask(e)},t.wbg.__wbg_randomFillSync_ac0988aba3254290=function(){return a(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_readAsArrayBuffer_b45cdda102d3c0b2=function(){return a(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_require_60cc747a6bc5215a=function(){return a(function(){return module.require},arguments)},t.wbg.__wbg_resolve_5775c0ef9222f556=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_1d5fe1e3f51a48d8=function(e,n,r){e.set(h(n,r))},t.wbg.__wbg_set_31197016f65a6a19=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_d636a0463acf1dbc=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_setbody_e324371c31597f2a=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_55a9317ed2777533=function(e,n){e.credentials=H[n]},t.wbg.__wbg_setheaders_ac0b1e4890a949cd=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_9ce6e95af1ae0eaf=function(e,n,r){e.method=w(n,r)},t.wbg.__wbg_setmode_b89d1784e7e7f118=function(e,n){e.mode=X[n]},t.wbg.__wbg_setsignal_e663c6d962763cd5=function(e,n){e.signal=n},t.wbg.__wbg_signal_bdb003fe19e53a13=function(e){return e.signal},t.wbg.__wbg_size_4181b899cbfa6483=function(e){return e.size},t.wbg.__wbg_slice_dc41c7f2c4886814=function(){return a(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,o=f(r,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,o,!0)},t.wbg.__wbg_static_accessor_GLOBAL_1f13249cc3acc96d=function(){const e=typeof global>"u"?null:global;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3=function(){const e=typeof globalThis>"u"?null:globalThis;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_SELF_6265471db3b3c228=function(){const e=typeof self>"u"?null:self;return M(e)?0:B(e)},t.wbg.__wbg_static_accessor_WINDOW_16fb482f8ec52863=function(){const e=typeof window>"u"?null:window;return M(e)?0:B(e)},t.wbg.__wbg_status_31874648c8651949=function(e){return e.status},t.wbg.__wbg_stringify_1f41b6198e0932e0=function(){return a(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_subarray_a219824899e59712=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_then_8d2fcccde5380a03=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_then_9cc266be2bf537b6=function(e,n){return e.then(n)},t.wbg.__wbg_url_d5273b9e10503471=function(e,n){const r=n.url,o=f(r,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,o,!0)},t.wbg.__wbg_valueOf_94f1c9efbe2ba399=function(e){return e.valueOf()},t.wbg.__wbg_value_09d0b4eaab48b91d=function(e){return e.value},t.wbg.__wbg_versions_c01dfd4722a88165=function(e){return e.versions},t.wbg.__wbg_wasmreader_new=function(e){return R.__wrap(e)},t.wbg.__wbg_wbindgencbdrop_a85ed476c6a370b9=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_wbindgendebugstring_bb652b1bc2061b6d=function(e,n){const r=v(n),o=f(r,_.__wbindgen_malloc,_.__wbindgen_realloc),c=u;y().setInt32(e+4,c,!0),y().setInt32(e+0,o,!0)},t.wbg.__wbg_wbindgenisfunction_ea72b9d66a0e1705=function(e){return typeof e=="function"},t.wbg.__wbg_wbindgenisobject_dfe064a121d87553=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbg_wbindgenisstring_4b74e4111ba029e6=function(e){return typeof e=="string"},t.wbg.__wbg_wbindgenisundefined_71f08a6ade4354e7=function(e){return e===void 0},t.wbg.__wbg_wbindgenstringget_43fe05afe34b0cb1=function(e,n){const r=n,o=typeof r=="string"?r:void 0;var c=M(o)?0:f(o,_.__wbindgen_malloc,_.__wbindgen_realloc),i=u;y().setInt32(e+4,i,!0),y().setInt32(e+0,c,!0)},t.wbg.__wbg_wbindgenthrow_4c11a24fca429ccf=function(e,n){throw new Error(w(e,n))},t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,n){return w(e,n)},t.wbg.__wbindgen_cast_2ddd8a25ff58642a=function(e,n){return BigInt.asUintN(64,e)|n<<BigInt(64)},t.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cast_77bc3e92745e9a35=function(e,n){var r=h(e,n).slice();return _.__wbindgen_free(e,n*1,1),r},t.wbg.__wbindgen_cast_9ae0607507abb057=function(e){return e},t.wbg.__wbindgen_cast_cb60167f8bf6c33f=function(e,n){return D(e,n,1658,J)},t.wbg.__wbindgen_cast_cb9088102bce6b30=function(e,n){return h(e,n)},t.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},t.wbg.__wbindgen_cast_e943630f8c22ccf7=function(e,n){return D(e,n,1651,$)},t.wbg.__wbindgen_init_externref_table=function(){const e=_.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t}function K(t,e){return _=t.exports,p=null,x=null,_.__wbindgen_start(),_}function Q(t){if(_!==void 0)return _;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=Y();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return K(n)}function k(){let t=0;const e=new Map;return{add(n){const r=t++;return e.set(r,n),r},get(n){const r=e.get(n);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(n){return e.delete(n)}}}const z=Symbol("transfer");function I(t,e){return{type:z,value:t,transfer:e?Array.isArray(e)?e:[e]:[t]}}function U(t){return!!(t&&typeof t=="object"&&Reflect.get(t,"type")===z)}function W(t="default"){return{createTx(e){const n=new Map,r=e??self;return r.addEventListener("message",o=>{const{data:c}=o;if(c.channelName!==t)return;const{id:i,result:s,error:b}=c,g=n.get(i);g&&(b?g.reject(b):g.resolve(s),n.delete(i))}),new Proxy({},{get(o,c){return(...i)=>{const s=Z(),b=[],g=[];return i.forEach(T=>{U(T)?(b.push(T.value),g.push(...T.transfer)):b.push(T)}),r.postMessage({method:c,args:b,id:s,channelName:t},{transfer:g}),new Promise((T,re)=>{n.set(s,{resolve:T,reject:re})})}}})},rx(e,n){const r=n??self;r.addEventListener("message",async o=>{const{data:c}=o;if(c.channelName!==t)return;const{method:i,args:s,id:b}=c;try{const g=await e[i](...s);U(g)?r.postMessage({result:g.value,id:b,channelName:t},{transfer:g.transfer}):r.postMessage({result:g,id:b,channelName:t})}catch(g){r.postMessage({error:g,id:b,channelName:t})}})}}}function Z(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:ee}=W(),{createTx:te}=W("worker"),m=k(),l=k(),ne=te();ee({async initWorker(t,e){Q(t),e&&P(e)},async reader_fromBlob(t,e){const n=await R.fromBlob(t,e);return m.add(n)},async reader_fromBlobFragment(t,e,n){const r=await R.fromBlobFragment(t,e,n);return m.add(r)},reader_activeLabel(t){return m.get(t).activeLabel()??null},reader_manifestStore(t){return m.get(t).manifestStore()},reader_activeManifest(t){return m.get(t).activeManifest()},reader_json(t){return m.get(t).json()},reader_resourceToBuffer(t,e){const r=m.get(t).resourceToBuffer(e);return I(r)},reader_free(t){m.get(t).free(),m.remove(t)},builder_fromJson(t){const e=A.fromJson(t);return l.add(e)},builder_setRemoteUrl(t,e){l.get(t).setRemoteUrl(e)},builder_setNoEmbed(t,e){l.get(t).setNoEmbed(e)},builder_setThumbnailFromBlob(t,e,n){l.get(t).setThumbnailFromBlob(e,n)},builder_addIngredientFromBlob(t,e,n,r){l.get(t).addIngredientFromBlob(e,n,r)},builder_addResourceFromBlob(t,e,n){l.get(t).addResourceFromBlob(e,n)},builder_getDefinition(t){return l.get(t).getDefinition()},async builder_sign(t,e,n,r,o){const i=await l.get(t).sign({reserveSize:n.reserveSize,alg:n.alg,sign:async s=>await ne.sign(e,I(s,s.buffer),n.reserveSize)},r,o);return I(i,i.buffer)},builder_free(t){l.get(t).free(),l.remove(t)}})})();\n', d = typeof self < "u" && self.Blob && new Blob([v], { type: "text/javascript;charset=utf-8" });
|
|
3
|
+
function S(e) {
|
|
4
4
|
let t;
|
|
5
5
|
try {
|
|
6
6
|
if (t = d && (self.URL || self.webkitURL).createObjectURL(d), !t) throw "";
|
|
@@ -24,12 +24,12 @@ function B(e) {
|
|
|
24
24
|
async function E(e) {
|
|
25
25
|
const { wasm: t, settingsString: o } = e;
|
|
26
26
|
let r = 0;
|
|
27
|
-
const n = new
|
|
28
|
-
|
|
27
|
+
const n = new S(), i = T(n), _ = /* @__PURE__ */ new Map();
|
|
28
|
+
B(
|
|
29
29
|
{
|
|
30
30
|
sign: async (c, s, R) => {
|
|
31
|
-
const g =
|
|
32
|
-
if (
|
|
31
|
+
const g = _.get(c);
|
|
32
|
+
if (_.delete(c), !g)
|
|
33
33
|
throw new Error("No signer registered for request");
|
|
34
34
|
const w = await g(s, R);
|
|
35
35
|
return F(w, w.buffer);
|
|
@@ -39,10 +39,10 @@ async function E(e) {
|
|
|
39
39
|
);
|
|
40
40
|
function a(c) {
|
|
41
41
|
const s = r++;
|
|
42
|
-
return
|
|
42
|
+
return _.set(s, c), s;
|
|
43
43
|
}
|
|
44
|
-
return await
|
|
45
|
-
tx:
|
|
44
|
+
return await i.initWorker(t, o), {
|
|
45
|
+
tx: i,
|
|
46
46
|
registerSignReceiver: a,
|
|
47
47
|
terminate: () => n.terminate()
|
|
48
48
|
};
|
|
@@ -132,20 +132,20 @@ function A(e) {
|
|
|
132
132
|
throw new m(r);
|
|
133
133
|
if (n.size > f)
|
|
134
134
|
throw new l(n.size);
|
|
135
|
-
const
|
|
136
|
-
o.unregister(
|
|
135
|
+
const i = await t.reader_fromBlob(r, n), _ = p(e, i, () => {
|
|
136
|
+
o.unregister(_);
|
|
137
137
|
});
|
|
138
|
-
return o.register(i, _
|
|
138
|
+
return o.register(_, i, _), _;
|
|
139
139
|
},
|
|
140
|
-
async fromBlobFragment(r, n,
|
|
140
|
+
async fromBlobFragment(r, n, i) {
|
|
141
141
|
if (!y(r))
|
|
142
142
|
throw new m(r);
|
|
143
143
|
if (n.size > f)
|
|
144
144
|
throw new l(n.size);
|
|
145
|
-
const
|
|
145
|
+
const _ = await t.reader_fromBlobFragment(r, n, i), a = p(e, _, () => {
|
|
146
146
|
o.unregister(a);
|
|
147
147
|
});
|
|
148
|
-
return o.register(a,
|
|
148
|
+
return o.register(a, _, a), a;
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
@@ -173,10 +173,10 @@ function p(e, t, o) {
|
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
let u,
|
|
176
|
+
let u, I = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
|
|
177
177
|
throw Error("TextDecoder not available");
|
|
178
178
|
} };
|
|
179
|
-
typeof TextDecoder < "u" &&
|
|
179
|
+
typeof TextDecoder < "u" && I.decode();
|
|
180
180
|
const b = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
|
|
181
181
|
throw Error("TextEncoder not available");
|
|
182
182
|
} };
|
|
@@ -189,60 +189,69 @@ typeof FinalizationRegistry > "u" || new FinalizationRegistry(
|
|
|
189
189
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmbuilder_free(e >>> 0, 1));
|
|
190
190
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmreader_free(e >>> 0, 1));
|
|
191
191
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => u.__wbg_wasmsigner_free(e >>> 0, 1));
|
|
192
|
-
const
|
|
192
|
+
const M = "sha512-l3IeNQ0oUfQxJIgCRyA2ms8ANqNnsxAr65TnXBBp0VATrFRqIIJkQ9mzQtBW1SRclCGFpFiU4q/L399OYZvFpw==";
|
|
193
193
|
function z(e) {
|
|
194
194
|
return JSON.stringify(x(e));
|
|
195
195
|
}
|
|
196
196
|
function x(e) {
|
|
197
197
|
return Object.entries(e).reduce(
|
|
198
|
-
(o, [r, n]) => (o[
|
|
198
|
+
(o, [r, n]) => (o[L(r)] = typeof n == "object" ? x(n) : n, o),
|
|
199
199
|
{}
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function L(e) {
|
|
203
203
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
204
204
|
}
|
|
205
|
-
async function
|
|
205
|
+
async function O(e) {
|
|
206
206
|
const { alg: t } = e;
|
|
207
207
|
return {
|
|
208
208
|
reserveSize: await e.reserveSize(),
|
|
209
209
|
alg: t
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function N(e) {
|
|
213
213
|
const { tx: t } = e, o = new FinalizationRegistry((r) => {
|
|
214
214
|
t.builder_free(r);
|
|
215
215
|
});
|
|
216
216
|
return {
|
|
217
217
|
async fromDefinition(r) {
|
|
218
|
-
const n = JSON.stringify(r),
|
|
219
|
-
o.unregister(
|
|
218
|
+
const n = JSON.stringify(r), i = await t.builder_fromJson(n), _ = U(e, i, () => {
|
|
219
|
+
o.unregister(_);
|
|
220
220
|
});
|
|
221
|
-
return o.register(i, _
|
|
221
|
+
return o.register(_, i, _), _;
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function U(e, t, o) {
|
|
226
226
|
const { tx: r } = e;
|
|
227
227
|
return {
|
|
228
|
-
async
|
|
228
|
+
async setRemoteUrl(n) {
|
|
229
|
+
await r.builder_setRemoteUrl(t, n);
|
|
230
|
+
},
|
|
231
|
+
async setNoEmbed(n) {
|
|
232
|
+
await r.builder_setNoEmbed(t, n);
|
|
233
|
+
},
|
|
234
|
+
async setThumbnailFromBlob(n, i) {
|
|
235
|
+
await r.builder_setThumbnailFromBlob(t, n, i);
|
|
236
|
+
},
|
|
237
|
+
async addIngredientFromBlob(n, i, _) {
|
|
229
238
|
const a = JSON.stringify(n);
|
|
230
|
-
await r.builder_addIngredientFromBlob(t, a,
|
|
239
|
+
await r.builder_addIngredientFromBlob(t, a, i, _);
|
|
231
240
|
},
|
|
232
|
-
async addResourceFromBlob(n,
|
|
233
|
-
await r.builder_addResourceFromBlob(t, n,
|
|
241
|
+
async addResourceFromBlob(n, i) {
|
|
242
|
+
await r.builder_addResourceFromBlob(t, n, i);
|
|
234
243
|
},
|
|
235
244
|
async getDefinition() {
|
|
236
245
|
return await r.builder_getDefinition(t);
|
|
237
246
|
},
|
|
238
|
-
async sign(n,
|
|
239
|
-
const a = await
|
|
247
|
+
async sign(n, i, _) {
|
|
248
|
+
const a = await O(n), c = e.registerSignReceiver(n.sign);
|
|
240
249
|
return await r.builder_sign(
|
|
241
250
|
t,
|
|
242
251
|
c,
|
|
243
252
|
a,
|
|
244
|
-
|
|
245
|
-
|
|
253
|
+
i,
|
|
254
|
+
_
|
|
246
255
|
);
|
|
247
256
|
},
|
|
248
257
|
async free() {
|
|
@@ -250,20 +259,20 @@ function k(e, t, o) {
|
|
|
250
259
|
}
|
|
251
260
|
};
|
|
252
261
|
}
|
|
253
|
-
async function
|
|
254
|
-
const { wasmSrc: t, settings: o } = e, r = typeof t == "string" ? await
|
|
262
|
+
async function J(e) {
|
|
263
|
+
const { wasmSrc: t, settings: o } = e, r = typeof t == "string" ? await k(t) : t, n = o ? z(o) : void 0, i = await E({ wasm: r, settingsString: n });
|
|
255
264
|
return {
|
|
256
|
-
reader: A(
|
|
257
|
-
builder:
|
|
258
|
-
dispose:
|
|
265
|
+
reader: A(i),
|
|
266
|
+
builder: N(i),
|
|
267
|
+
dispose: i.terminate
|
|
259
268
|
};
|
|
260
269
|
}
|
|
261
|
-
async function
|
|
262
|
-
const t = await fetch(e, { integrity:
|
|
270
|
+
async function k(e) {
|
|
271
|
+
const t = await fetch(e, { integrity: M });
|
|
263
272
|
return await WebAssembly.compileStreaming(t);
|
|
264
273
|
}
|
|
265
274
|
export {
|
|
266
275
|
j as R,
|
|
267
|
-
|
|
276
|
+
J as c,
|
|
268
277
|
y as i
|
|
269
278
|
};
|
package/dist/index.js
CHANGED