@contentauth/c2pa-web 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -41
- package/dist/lib/reader.d.ts +16 -3
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/lib/settings.d.ts +1 -0
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/worker.d.ts +3 -1
- package/dist/lib/worker.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +8 -3
- package/CHANGELOG.md +0 -20
- package/eslint.config.mjs +0 -30
- package/project.json +0 -7
- package/src/index.ts +0 -15
- package/src/lib/c2pa.spec.ts +0 -166
- package/src/lib/c2pa.ts +0 -65
- package/src/lib/error.ts +0 -26
- package/src/lib/reader.ts +0 -150
- package/src/lib/settings.ts +0 -52
- package/src/lib/supportedFormats.ts +0 -72
- package/src/lib/worker/setupWorker.ts +0 -53
- package/src/lib/worker/workerManager.ts +0 -64
- package/src/lib/worker/workerObjectMap.ts +0 -35
- package/src/lib/worker/workerResponse.ts +0 -50
- package/src/lib/worker.ts +0 -77
- package/test/fixtures/assets/C_with_CAWG_data.jpg +0 -0
- package/test/fixtures/assets/C_with_CAWG_data.json +0 -144
- package/test/fixtures/assets/C_with_CAWG_data_thumbnail.jpg +0 -0
- package/test/fixtures/assets/C_with_CAWG_data_trusted.json +0 -149
- package/test/fixtures/assets/C_with_CAWG_data_untrusted.json +0 -157
- package/test/fixtures/assets/dash1.m4s +0 -0
- package/test/fixtures/assets/dashinit.json +0 -184
- package/test/fixtures/assets/dashinit.mp4 +0 -0
- package/test/fixtures/assets/no_alg.jpg +0 -0
- package/test/fixtures/trust/anchor-correct.pem +0 -15
- package/test/fixtures/trust/anchor-incorrect.pem +0 -16
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -29
- package/tsconfig.spec.json +0 -36
- package/vite.config.ts +0 -91
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@
|
|
|
9
9
|
export * from './lib/c2pa.js';
|
|
10
10
|
export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS, } from './lib/supportedFormats.js';
|
|
11
11
|
export { type Settings } from './lib/settings.js';
|
|
12
|
+
export type * from '@contentauth/c2pa-types';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,mBAAmB,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const l = '(function(){"use strict";let o;const S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&S.decode();let m=null;function x(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(o.memory.buffer)),m}function a(t,e){return t=t>>>0,S.decode(x().subarray(t,t+e))}function y(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function u(t,e){try{return t.apply(this,e)}catch(n){const r=y(n);o.__wbindgen_exn_store(r)}}let f=0;const T=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},E=typeof T.encodeInto=="function"?function(t,e){return T.encodeInto(t,e)}:function(t,e){const n=T.encode(t);return e.set(n),{read:t.length,written:n.length}};function b(t,e,n){if(n===void 0){const s=T.encode(t),d=e(s.length,1)>>>0;return x().subarray(d,d+s.length).set(s),f=s.length,d}let r=t.length,_=e(r,1)>>>0;const c=x();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=x().subarray(_+i,_+r),d=E(t,s);i+=d.written,_=n(_,r,i,1)>>>0}return f=i,_}let w=null;function g(){return(w===null||w.buffer.detached===!0||w.buffer.detached===void 0&&w.buffer!==o.memory.buffer)&&(w=new DataView(o.memory.buffer)),w}function p(t){return t==null}const A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function O(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),A.unregister(_)):_.a=s}};return c.original=_,A.register(c,_,_),c}function j(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+=j(t[0]));for(let i=1;i<_;i++)c+=", "+j(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}function M(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function I(t){const e=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=f,r=o.loadSettings(e,n);if(r[1])throw M(r[0])}function k(t,e){o._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1953f27c342761b(t,e)}function R(t,e,n){o.closure1391_externref_shim(t,e,n)}function L(t,e,n,r){o.closure2380_externref_shim(t,e,n,r)}const W=["omit","same-origin","include"],D=["same-origin","no-cors","cors","navigate"],F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class h{static __wrap(e){e=e>>>0;const n=Object.create(h.prototype);return n.__wbg_ptr=e,F.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,F.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=f;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;return o.wasmreader_fromBlobFragment(_,c,n,r)}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],a(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=a(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),n}resourceToBuffer(e){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=f,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw M(_[1]);return M(_[0])}}function v(){const t={};return t.wbg={},t.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},t.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},t.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return u(function(e,n,r,_,c){e.append(a(n,r),a(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return u(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_09165b52af8c5237=function(e){return e.buffer},t.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},t.wbg.__wbg_byteLength_e674b853d9c77e1d=function(e){return e.byteLength},t.wbg.__wbg_call_672a4d21634d4a24=function(){return u(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return u(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(a(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return u(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_a5ea9117f258a0ec=function(){return u(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},t.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},t.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},t.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return u(function(){return new Headers},arguments)},t.wbg.__wbg_new_16004015965f986e=function(){return u(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const d=r.a;r.a=0;try{return L(d,r.b,i,s)}finally{r.a=d}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(a(e,n))},t.wbg.__wbg_new_e25e5aab09ff45db=function(){return u(function(){return new AbortController},arguments)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(a(e,n))},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return u(function(e,n,r){return new Request(a(e,n),r)},arguments)},t.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},t.wbg.__wbg_next_6574e1a8a62d1055=function(){return u(function(e){return e.next()},arguments)},t.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},t.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},t.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},t.wbg.__wbg_readAsArrayBuffer_560aeb9fce36c5c8=function(){return u(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_65595bdd868b3009=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=W[n]},t.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,r){e.method=a(n,r)},t.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=D[n]},t.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},t.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},t.wbg.__wbg_size_3808d41635a9c259=function(e){return e.size},t.wbg.__wbg_slice_bd4c84b64bdfe01f=function(){return u(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e=typeof global>"u"?null:global;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e=typeof globalThis>"u"?null:globalThis;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e=typeof self>"u"?null:self;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e=typeof window>"u"?null:window;return p(e)?0:y(e)},t.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},t.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return u(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},t.wbg.__wbg_then_48b406749878a531=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const r=n.url,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},t.wbg.__wbg_wasmreader_new=function(e){return h.__wrap(e)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_closure_wrapper9193=function(e,n,r){return O(e,n,1337,k)},t.wbg.__wbindgen_closure_wrapper9303=function(e,n,r){return O(e,n,1392,R)},t.wbg.__wbindgen_debug_string=function(e,n){const r=j(n),_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},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.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_memory=function(){return o.memory},t.wbg.__wbindgen_string_get=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=p(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=f;g().setInt32(e+4,i,!0),g().setInt32(e+0,c,!0)},t.wbg.__wbindgen_string_new=function(e,n){return a(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(a(e,n))},t}function z(t,e){return o=t.exports,w=null,m=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=v();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return z(n)}function B(t,e){const n={type:"success",...t!==void 0?{payload:t}:{}};postMessage(n,e??[])}function C(t){postMessage({type:"error",error:t})}function U(t){onmessage=async e=>{try{const{args:n,method:r}=e.data,_=await t[r](...n);(_==null?void 0:_.data)!==void 0?B(_.data,_.transfer):B()}catch(n){C(n)}}}function $(){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 l=$();U({async initWorker(t,e){q(t),e&&I(e)},async reader_fromBlob(t,e){const n=await h.fromBlob(t,e);return{data:l.add(n)}},async reader_fromBlobFragment(t,e,n){const r=await h.fromBlobFragment(t,e,n);return{data:l.add(r)}},reader_json(t){return{data:l.get(t).json()}},reader_activeLabel(t){return{data:l.get(t).activeLabel()??null}},reader_resourceToBuffer(t,e){const r=l.get(t).resourceToBuffer(e);return{data:r,transfer:[r]}},reader_free(t){l.get(t).free(),l.remove(t)}})})();\n', f = typeof self < "u" && self.Blob && new Blob([l], { type: "text/javascript;charset=utf-8" });
|
|
1
|
+
const l = '(function(){"use strict";let o;const j=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&j.decode();let y=null;function T(){return(y===null||y.byteLength===0)&&(y=new Uint8Array(o.memory.buffer)),y}function a(t,e){return t=t>>>0,j.decode(T().subarray(t,t+e))}function p(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function u(t,e){try{return t.apply(this,e)}catch(n){const r=p(n);o.__wbindgen_exn_store(r)}}let f=0;const M=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},F=typeof M.encodeInto=="function"?function(t,e){return M.encodeInto(t,e)}:function(t,e){const n=M.encode(t);return e.set(n),{read:t.length,written:n.length}};function g(t,e,n){if(n===void 0){const s=M.encode(t),d=e(s.length,1)>>>0;return T().subarray(d,d+s.length).set(s),f=s.length,d}let r=t.length,_=e(r,1)>>>0;const c=T();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=T().subarray(_+i,_+r),d=F(t,s);i+=d.written,_=n(_,r,i,1)>>>0}return f=i,_}let l=null;function w(){return(l===null||l.buffer.detached===!0||l.buffer.detached===void 0&&l.buffer!==o.memory.buffer)&&(l=new DataView(o.memory.buffer)),l}function h(t){return t==null}const A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function O(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),A.unregister(_)):_.a=s}};return c.original=_,A.register(c,_,_),c}function S(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+=S(t[0]));for(let i=1;i<_;i++)c+=", "+S(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}function m(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function I(t){const e=g(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=f,r=o.loadSettings(e,n);if(r[1])throw m(r[0])}function k(t,e){o._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf8e9222f46d15a02(t,e)}function R(t,e,n){o.closure1461_externref_shim(t,e,n)}function L(t,e,n,r){o.closure2453_externref_shim(t,e,n,r)}const W=["omit","same-origin","include"],v=["same-origin","no-cors","cors","navigate"],B=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class x{static __wrap(e){e=e>>>0;const n=Object.create(x.prototype);return n.__wbg_ptr=e,B.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,B.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=f;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;return o.wasmreader_fromBlobFragment(_,c,n,r)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=a(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 m(e[1]);return m(e[0])}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw m(e[1]);return m(e[0])}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],a(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}resourceToBuffer(e){const n=g(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=f,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw m(_[1]);return m(_[0])}}function D(){const t={};return t.wbg={},t.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},t.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},t.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return u(function(e,n,r,_,c){e.append(a(n,r),a(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return u(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_09165b52af8c5237=function(e){return e.buffer},t.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},t.wbg.__wbg_byteLength_e674b853d9c77e1d=function(e){return e.byteLength},t.wbg.__wbg_call_672a4d21634d4a24=function(){return u(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return u(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(a(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},t.wbg.__wbg_from_2a5d3e218e67aa85=function(e){return Array.from(e)},t.wbg.__wbg_getTime_46267b1c24877e30=function(e){return e.getTime()},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return u(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_a5ea9117f258a0ec=function(){return u(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},t.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},t.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},t.wbg.__wbg_new0_f788a2397c7ca929=function(){return new Date},t.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return u(function(){return new Headers},arguments)},t.wbg.__wbg_new_16004015965f986e=function(){return u(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const d=r.a;r.a=0;try{return L(d,r.b,i,s)}finally{r.a=d}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},t.wbg.__wbg_new_5e0be73521bc8c17=function(){return new Map},t.wbg.__wbg_new_78feb108b6472713=function(){return new Array},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(a(e,n))},t.wbg.__wbg_new_e25e5aab09ff45db=function(){return u(function(){return new AbortController},arguments)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(a(e,n))},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return u(function(e,n,r){return new Request(a(e,n),r)},arguments)},t.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},t.wbg.__wbg_next_6574e1a8a62d1055=function(){return u(function(e){return e.next()},arguments)},t.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},t.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},t.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},t.wbg.__wbg_readAsArrayBuffer_560aeb9fce36c5c8=function(){return u(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_37837023f3d740e8=function(e,n,r){e[n>>>0]=r},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbg_set_65595bdd868b3009=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_set_8fc6bf8a5b1071d1=function(e,n,r){return e.set(n,r)},t.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=W[n]},t.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,r){e.method=a(n,r)},t.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=v[n]},t.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},t.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},t.wbg.__wbg_size_3808d41635a9c259=function(e){return e.size},t.wbg.__wbg_slice_bd4c84b64bdfe01f=function(){return u(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;w().setInt32(e+4,c,!0),w().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e=typeof global>"u"?null:global;return h(e)?0:p(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e=typeof globalThis>"u"?null:globalThis;return h(e)?0:p(e)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e=typeof self>"u"?null:self;return h(e)?0:p(e)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e=typeof window>"u"?null:window;return h(e)?0:p(e)},t.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},t.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return u(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},t.wbg.__wbg_then_48b406749878a531=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const r=n.url,_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;w().setInt32(e+4,c,!0),w().setInt32(e+0,_,!0)},t.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},t.wbg.__wbg_wasmreader_new=function(e){return x.__wrap(e)},t.wbg.__wbindgen_as_number=function(e){return+e},t.wbg.__wbindgen_bigint_from_i64=function(e){return e},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_closure_wrapper10863=function(e,n,r){return O(e,n,1444,k)},t.wbg.__wbindgen_closure_wrapper10914=function(e,n,r){return O(e,n,1462,R)},t.wbg.__wbindgen_debug_string=function(e,n){const r=S(n),_=g(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;w().setInt32(e+4,c,!0),w().setInt32(e+0,_,!0)},t.wbg.__wbindgen_error_new=function(e,n){return new Error(a(e,n))},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.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_memory=function(){return o.memory},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_get=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=h(_)?0:g(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=f;w().setInt32(e+4,i,!0),w().setInt32(e+0,c,!0)},t.wbg.__wbindgen_string_new=function(e,n){return a(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(a(e,n))},t}function z(t,e){return o=t.exports,l=null,y=null,o.__wbindgen_start(),o}function U(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=D();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return z(n)}function E(t,e){const n={type:"success",...t!==void 0?{payload:t}:{}};postMessage(n,e??[])}function q(t){postMessage({type:"error",error:t})}function C(t){onmessage=async e=>{try{const{args:n,method:r}=e.data,_=await t[r](...n);(_==null?void 0:_.data)!==void 0?E(_.data,_.transfer):E()}catch(n){q(n)}}}function N(){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 b=N();C({async initWorker(t,e){U(t),e&&I(e)},async reader_fromBlob(t,e){const n=await x.fromBlob(t,e);return{data:b.add(n)}},async reader_fromBlobFragment(t,e,n){const r=await x.fromBlobFragment(t,e,n);return{data:b.add(r)}},reader_activeLabel(t){return{data:b.get(t).activeLabel()??null}},reader_manifestStore(t){return{data:b.get(t).manifestStore()}},reader_activeManifest(t){return{data:b.get(t).activeManifest()}},reader_json(t){return{data:b.get(t).json()}},reader_resourceToBuffer(t,e){const r=b.get(t).resourceToBuffer(e);return{data:r,transfer:[r]}},reader_free(t){b.get(t).free(),b.remove(t)}})})();\n', f = typeof self < "u" && self.Blob && new Blob([l], { type: "text/javascript;charset=utf-8" });
|
|
2
2
|
function v(e) {
|
|
3
3
|
let t;
|
|
4
4
|
try {
|
|
@@ -20,7 +20,7 @@ function v(e) {
|
|
|
20
20
|
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function S(e, t) {
|
|
24
24
|
e.onmessage = (n) => {
|
|
25
25
|
const { data: r } = n;
|
|
26
26
|
r.type === "success" ? t.onSuccess(r == null ? void 0 : r.payload) : t.onError(r == null ? void 0 : r.error);
|
|
@@ -30,14 +30,14 @@ function T(e, t) {
|
|
|
30
30
|
t.onError(n.data);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
async function
|
|
34
|
-
const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((
|
|
35
|
-
|
|
36
|
-
onSuccess: (i) =>
|
|
37
|
-
onError: (i) =>
|
|
33
|
+
async function T(e) {
|
|
34
|
+
const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((a, c) => {
|
|
35
|
+
S(r, {
|
|
36
|
+
onSuccess: (i) => a(i),
|
|
37
|
+
onError: (i) => c(i)
|
|
38
38
|
});
|
|
39
|
-
const { method:
|
|
40
|
-
r.postMessage({ method:
|
|
39
|
+
const { method: y, args: h, transfer: x } = _;
|
|
40
|
+
r.postMessage({ method: y, args: h }, x ?? []);
|
|
41
41
|
});
|
|
42
42
|
return await o({ method: "initWorker", args: [t, n] }), {
|
|
43
43
|
execute: o,
|
|
@@ -56,7 +56,7 @@ class b extends Error {
|
|
|
56
56
|
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const R = [
|
|
60
60
|
"jpg",
|
|
61
61
|
"video/mp4",
|
|
62
62
|
"image/heif",
|
|
@@ -115,56 +115,67 @@ const S = [
|
|
|
115
115
|
"nef",
|
|
116
116
|
"heif"
|
|
117
117
|
];
|
|
118
|
-
function
|
|
119
|
-
return
|
|
118
|
+
function w(e) {
|
|
119
|
+
return R.includes(e);
|
|
120
120
|
}
|
|
121
121
|
const u = 10 ** 9;
|
|
122
|
-
function
|
|
122
|
+
function j(e) {
|
|
123
123
|
const t = new FinalizationRegistry((n) => {
|
|
124
124
|
e.execute({ method: "reader_free", args: [n] });
|
|
125
125
|
});
|
|
126
126
|
return {
|
|
127
127
|
async fromBlob(n, r) {
|
|
128
|
-
if (!
|
|
128
|
+
if (!w(n))
|
|
129
129
|
throw new b(n);
|
|
130
130
|
if (r.size > u)
|
|
131
131
|
throw new g(r.size);
|
|
132
132
|
const o = await e.execute({
|
|
133
133
|
method: "reader_fromBlob",
|
|
134
134
|
args: [n, r]
|
|
135
|
-
}), _ = Symbol(o),
|
|
135
|
+
}), _ = Symbol(o), a = d(e, o, () => {
|
|
136
136
|
t.unregister(_);
|
|
137
137
|
});
|
|
138
|
-
return t.register(
|
|
138
|
+
return t.register(a, o, _), a;
|
|
139
139
|
},
|
|
140
140
|
async fromBlobFragment(n, r, o) {
|
|
141
|
-
if (!
|
|
141
|
+
if (!w(n))
|
|
142
142
|
throw new b(n);
|
|
143
143
|
if (r.size > u)
|
|
144
144
|
throw new g(r.size);
|
|
145
145
|
const _ = await e.execute({
|
|
146
146
|
method: "reader_fromBlobFragment",
|
|
147
147
|
args: [n, r, o]
|
|
148
|
-
}),
|
|
149
|
-
t.unregister(
|
|
148
|
+
}), a = Symbol(_), c = d(e, _, () => {
|
|
149
|
+
t.unregister(a);
|
|
150
150
|
});
|
|
151
|
-
return t.register(
|
|
151
|
+
return t.register(c, _, a), c;
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function d(e, t, n) {
|
|
156
156
|
return {
|
|
157
|
-
// TODO: manifest type
|
|
158
|
-
async manifestStore() {
|
|
159
|
-
const r = await e.execute({ method: "reader_json", args: [t] });
|
|
160
|
-
return JSON.parse(r);
|
|
161
|
-
},
|
|
162
157
|
async activeLabel() {
|
|
163
158
|
return await e.execute({
|
|
164
159
|
method: "reader_activeLabel",
|
|
165
160
|
args: [t]
|
|
166
161
|
});
|
|
167
162
|
},
|
|
163
|
+
async manifestStore() {
|
|
164
|
+
return await e.execute({
|
|
165
|
+
method: "reader_manifestStore",
|
|
166
|
+
args: [t]
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
async activeManifest() {
|
|
170
|
+
return await e.execute({
|
|
171
|
+
method: "reader_activeManifest",
|
|
172
|
+
args: [t]
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
async json() {
|
|
176
|
+
const r = await e.execute({ method: "reader_json", args: [t] });
|
|
177
|
+
return JSON.parse(r);
|
|
178
|
+
},
|
|
168
179
|
async resourceToBuffer(r) {
|
|
169
180
|
return e.execute({
|
|
170
181
|
method: "reader_resourceToBuffer",
|
|
@@ -177,10 +188,10 @@ function w(e, t, n) {
|
|
|
177
188
|
};
|
|
178
189
|
}
|
|
179
190
|
let m;
|
|
180
|
-
const
|
|
191
|
+
const E = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
|
|
181
192
|
throw Error("TextDecoder not available");
|
|
182
193
|
} };
|
|
183
|
-
typeof TextDecoder < "u" &&
|
|
194
|
+
typeof TextDecoder < "u" && E.decode();
|
|
184
195
|
const s = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
|
|
185
196
|
throw Error("TextEncoder not available");
|
|
186
197
|
} };
|
|
@@ -189,32 +200,32 @@ typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => {
|
|
|
189
200
|
m.__wbindgen_export_6.get(e.dtor)(e.a, e.b);
|
|
190
201
|
});
|
|
191
202
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => m.__wbg_wasmreader_free(e >>> 0, 1));
|
|
192
|
-
const B = "sha512-
|
|
193
|
-
function
|
|
194
|
-
return JSON.stringify(
|
|
203
|
+
const B = "sha512-2Xw4vi1zAuw6ShG+SsG+eJO/jyxat4s8pPK+OcnW963sRFiQXxjHzNcDdbpcNVYrbOO2qgk5FF0osaiBCVi7Ow==";
|
|
204
|
+
function A(e) {
|
|
205
|
+
return JSON.stringify(p(e));
|
|
195
206
|
}
|
|
196
|
-
function
|
|
207
|
+
function p(e) {
|
|
197
208
|
return Object.entries(e).reduce(
|
|
198
|
-
(n, [r, o]) => (n[
|
|
209
|
+
(n, [r, o]) => (n[O(r)] = typeof o == "object" ? p(o) : o, n),
|
|
199
210
|
{}
|
|
200
211
|
);
|
|
201
212
|
}
|
|
202
|
-
function
|
|
213
|
+
function O(e) {
|
|
203
214
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
204
215
|
}
|
|
205
|
-
async function
|
|
206
|
-
const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await
|
|
216
|
+
async function F(e) {
|
|
217
|
+
const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await M(t) : t, o = n ? A(n) : void 0, _ = await T({ wasm: r, settingsString: o });
|
|
207
218
|
return {
|
|
208
|
-
reader:
|
|
219
|
+
reader: j(_),
|
|
209
220
|
dispose: _.terminate
|
|
210
221
|
};
|
|
211
222
|
}
|
|
212
|
-
async function
|
|
223
|
+
async function M(e) {
|
|
213
224
|
const t = await fetch(e, { integrity: B });
|
|
214
225
|
return await WebAssembly.compileStreaming(t);
|
|
215
226
|
}
|
|
216
227
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
228
|
+
R as READER_SUPPORTED_FORMATS,
|
|
229
|
+
F as createC2pa,
|
|
230
|
+
w as isSupportedReaderFormat
|
|
220
231
|
};
|
package/dist/lib/reader.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Manifest, ManifestStore } from '@contentauth/c2pa-types';
|
|
1
2
|
import { WorkerManager } from './worker/workerManager.js';
|
|
2
3
|
export declare const MAX_SIZE_IN_BYTES: number;
|
|
3
4
|
export interface ReaderFactory {
|
|
@@ -12,14 +13,26 @@ export interface ReaderFactory {
|
|
|
12
13
|
fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<Reader>;
|
|
13
14
|
}
|
|
14
15
|
export interface Reader {
|
|
16
|
+
/**
|
|
17
|
+
* @returns The label of the active manifest.
|
|
18
|
+
*/
|
|
19
|
+
activeLabel: () => Promise<string | null>;
|
|
15
20
|
/**
|
|
16
21
|
* @returns The asset's full manifest store containing all its manifests, validation statuses, and the URI of the active manifest.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: At the moment, the manifest store returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.
|
|
17
24
|
*/
|
|
18
|
-
manifestStore: () => Promise<
|
|
25
|
+
manifestStore: () => Promise<ManifestStore>;
|
|
19
26
|
/**
|
|
20
|
-
* @returns The
|
|
27
|
+
* @returns The asset's active manifest.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: At the moment, the manifest returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.
|
|
21
30
|
*/
|
|
22
|
-
|
|
31
|
+
activeManifest: () => Promise<Manifest>;
|
|
32
|
+
/**
|
|
33
|
+
* @returns The asset's full manifest store, including decoded CAWG data.
|
|
34
|
+
*/
|
|
35
|
+
json: () => Promise<any>;
|
|
23
36
|
/**
|
|
24
37
|
* Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.
|
|
25
38
|
*
|
package/dist/lib/reader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAExD;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAoDxE"}
|
package/dist/lib/settings.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,UAEpD"}
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,UAEpD"}
|
package/dist/lib/worker.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ declare const workerFunctions: {
|
|
|
3
3
|
initWorker(module: WebAssembly.Module, settings?: string): Promise<void>;
|
|
4
4
|
reader_fromBlob(format: string, blob: Blob): Promise<WorkerResponse<number>>;
|
|
5
5
|
reader_fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WorkerResponse<number>>;
|
|
6
|
-
reader_json(readerId: number): WorkerResponse<string>;
|
|
7
6
|
reader_activeLabel(readerId: number): WorkerResponse<string | null>;
|
|
7
|
+
reader_manifestStore(readerId: number): WorkerResponse<any>;
|
|
8
|
+
reader_activeManifest(readerId: number): WorkerResponse<any>;
|
|
9
|
+
reader_json(readerId: number): WorkerResponse<string>;
|
|
8
10
|
reader_resourceToBuffer(readerId: number, uri: string): WorkerResponse<ArrayBuffer>;
|
|
9
11
|
reader_free(readerId: number): void;
|
|
10
12
|
};
|
package/dist/lib/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,QAAA,MAAM,eAAe;uBACM,WAAW,CAAC,MAAM,aAAa,MAAM;4BAUpD,MAAM,QACR,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oCAOxB,MAAM,QACR,IAAI,YACA,IAAI,GACb,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,QAAA,MAAM,eAAe;uBACM,WAAW,CAAC,MAAM,aAAa,MAAM;4BAUpD,MAAM,QACR,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oCAOxB,MAAM,QACR,IAAI,YACA,IAAI,GACb,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;iCAOL,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;mCAIpC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC;oCAI3B,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC;0BAItC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;sCAKzC,MAAM,OACX,MAAM,GACV,cAAc,CAAC,WAAW,CAAC;0BAKR,MAAM;CAKH,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,eAAe,CAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentauth/c2pa-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"module": "./dist/index.js",
|
|
6
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**/*"
|
|
10
|
+
],
|
|
7
11
|
"exports": {
|
|
8
12
|
"./package.json": "./package.json",
|
|
13
|
+
"./resources/c2pa.wasm": "./dist/resources/c2pa_bg.wasm",
|
|
9
14
|
".": {
|
|
10
|
-
"development": "./src/index.ts",
|
|
11
15
|
"types": "./dist/index.d.ts",
|
|
12
16
|
"import": "./dist/index.js",
|
|
13
17
|
"default": "./dist/index.js"
|
|
14
18
|
}
|
|
15
19
|
},
|
|
16
20
|
"dependencies": {
|
|
17
|
-
"@contentauth/c2pa-wasm": "0.
|
|
21
|
+
"@contentauth/c2pa-wasm": "0.2.0",
|
|
22
|
+
"@contentauth/c2pa-types": "0.2.0"
|
|
18
23
|
},
|
|
19
24
|
"devDependencies": {
|
|
20
25
|
"@playwright/test": "^1.55.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# @contentauth/c2pa-web
|
|
2
|
-
|
|
3
|
-
## 0.1.1
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 3868d81: Fix broken dependencies
|
|
8
|
-
- Updated dependencies [3868d81]
|
|
9
|
-
- @contentauth/c2pa-wasm@0.1.1
|
|
10
|
-
|
|
11
|
-
## 0.1.0
|
|
12
|
-
|
|
13
|
-
### Minor Changes
|
|
14
|
-
|
|
15
|
-
- e9a7614: Add minimal reader API
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Updated dependencies [e9a7614]
|
|
20
|
-
- @contentauth/c2pa-wasm@0.1.0
|
package/eslint.config.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it.
|
|
8
|
-
*/
|
|
9
|
-
import baseConfig from '../../eslint.config.mjs';
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
...baseConfig,
|
|
13
|
-
{
|
|
14
|
-
files: ['**/*.json'],
|
|
15
|
-
rules: {
|
|
16
|
-
'@nx/dependency-checks': [
|
|
17
|
-
'error',
|
|
18
|
-
{
|
|
19
|
-
ignoredFiles: [
|
|
20
|
-
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
21
|
-
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
languageOptions: {
|
|
27
|
-
parser: await import('jsonc-eslint-parser'),
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
];
|
package/project.json
DELETED
package/src/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export * from './lib/c2pa.js';
|
|
11
|
-
export {
|
|
12
|
-
isSupportedReaderFormat,
|
|
13
|
-
READER_SUPPORTED_FORMATS,
|
|
14
|
-
} from './lib/supportedFormats.js';
|
|
15
|
-
export { type Settings } from './lib/settings.js';
|
package/src/lib/c2pa.spec.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2025 Adobe
|
|
4
|
-
* All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
7
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
8
|
-
* it.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { describe, expect, test } from 'vitest';
|
|
12
|
-
import { createC2pa } from './c2pa.js';
|
|
13
|
-
import { Settings } from './settings.js';
|
|
14
|
-
import wasmSrc from '@contentauth/c2pa-wasm/assets/c2pa_bg.wasm?url';
|
|
15
|
-
|
|
16
|
-
import C_with_CAWG_data from '../../test/fixtures/assets/C_with_CAWG_data.jpg';
|
|
17
|
-
import C_with_CAWG_data_thumbnail from '../../test/fixtures/assets/C_with_CAWG_data_thumbnail.jpg';
|
|
18
|
-
import C_with_CAWG_data_ManifestStore from '../../test/fixtures/assets/C_with_CAWG_data.json' with { type: "json" };
|
|
19
|
-
import C_with_CAWG_data_trusted_ManifestStore from '../../test/fixtures/assets/C_with_CAWG_data_trusted.json' with { type: "json" };
|
|
20
|
-
import C_with_CAWG_data_untrusted_ManifestStore from '../../test/fixtures/assets/C_with_CAWG_data_untrusted.json' with { type: "json" };
|
|
21
|
-
import no_alg from '../../test/fixtures/assets/no_alg.jpg';
|
|
22
|
-
import dashinit from '../../test/fixtures/assets/dashinit.mp4';
|
|
23
|
-
import dash1 from '../../test/fixtures/assets/dash1.m4s?url';
|
|
24
|
-
import dashinit_ManifestStore from '../../test/fixtures/assets/dashinit.json' with { type: "json" };
|
|
25
|
-
|
|
26
|
-
import anchor_correct from '../../test/fixtures/trust/anchor-correct.pem?raw';
|
|
27
|
-
import anchor_incorrect from '../../test/fixtures/trust/anchor-incorrect.pem?raw';
|
|
28
|
-
|
|
29
|
-
describe('c2pa', () => {
|
|
30
|
-
describe('reader', () => {
|
|
31
|
-
test('should work when created from a blob', async () => {
|
|
32
|
-
const c2pa = await createC2pa({ wasmSrc });
|
|
33
|
-
|
|
34
|
-
const blob = await getBlobForAsset(C_with_CAWG_data);
|
|
35
|
-
|
|
36
|
-
const reader = await c2pa.reader.fromBlob(blob.type, blob)
|
|
37
|
-
|
|
38
|
-
const manifestStore = await reader.manifestStore();
|
|
39
|
-
|
|
40
|
-
expect(manifestStore).toEqual(C_with_CAWG_data_ManifestStore);
|
|
41
|
-
|
|
42
|
-
await reader.free();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('should return an embedded thumbnail', async () => {
|
|
46
|
-
const c2pa = await createC2pa({ wasmSrc });
|
|
47
|
-
|
|
48
|
-
const blob = await getBlobForAsset(C_with_CAWG_data);
|
|
49
|
-
|
|
50
|
-
const reader = await c2pa.reader.fromBlob(blob.type, blob)
|
|
51
|
-
|
|
52
|
-
const manifestStore = await reader.manifestStore();
|
|
53
|
-
|
|
54
|
-
const activeManifest =
|
|
55
|
-
manifestStore.manifests[manifestStore.active_manifest];
|
|
56
|
-
const thumbnailId = activeManifest.thumbnail.identifier;
|
|
57
|
-
|
|
58
|
-
const thumbnailBuffer = await reader.resourceToBuffer(thumbnailId);
|
|
59
|
-
const thumbnail = new Uint8Array(thumbnailBuffer!);
|
|
60
|
-
|
|
61
|
-
const thumbnailBlob = await getBlobForAsset(
|
|
62
|
-
C_with_CAWG_data_thumbnail
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const expectedThumbnailBuffer = await thumbnailBlob.arrayBuffer();
|
|
66
|
-
|
|
67
|
-
const expectedThumbnail = new Uint8Array(expectedThumbnailBuffer);
|
|
68
|
-
|
|
69
|
-
expect(thumbnail).toEqual(expectedThumbnail);
|
|
70
|
-
|
|
71
|
-
await reader.free();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('should report c2pa-rs errors correctly', async () => {
|
|
75
|
-
const c2pa = await createC2pa({ wasmSrc });
|
|
76
|
-
|
|
77
|
-
const blob = await getBlobForAsset(no_alg);
|
|
78
|
-
|
|
79
|
-
const readerPromise = c2pa.reader.fromBlob(blob.type, blob);
|
|
80
|
-
|
|
81
|
-
await expect(readerPromise).rejects.toThrowError('C2pa(UnknownAlgorithm)');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test('should report a trusted asset when when configured to verify trust', async () => {
|
|
85
|
-
const settings: Settings = {
|
|
86
|
-
trust: {
|
|
87
|
-
trustAnchors: anchor_correct,
|
|
88
|
-
},
|
|
89
|
-
verify: {
|
|
90
|
-
verifyTrust: true
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const c2pa = await createC2pa({ wasmSrc, settings });
|
|
95
|
-
|
|
96
|
-
const blob = await getBlobForAsset(C_with_CAWG_data);
|
|
97
|
-
|
|
98
|
-
const reader = await c2pa.reader.fromBlob(blob.type, blob);
|
|
99
|
-
|
|
100
|
-
const manifestStore = await reader.manifestStore();
|
|
101
|
-
|
|
102
|
-
expect(manifestStore).toEqual(C_with_CAWG_data_trusted_ManifestStore);
|
|
103
|
-
|
|
104
|
-
await reader.free();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('should report an untrusted asset when configured to verify trust', async () => {
|
|
108
|
-
const settings: Settings = {
|
|
109
|
-
trust: {
|
|
110
|
-
trustAnchors: anchor_incorrect,
|
|
111
|
-
},
|
|
112
|
-
verify: {
|
|
113
|
-
verifyTrust: true
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const c2pa = await createC2pa({ wasmSrc, settings });
|
|
118
|
-
|
|
119
|
-
const blob = await getBlobForAsset(C_with_CAWG_data);
|
|
120
|
-
|
|
121
|
-
const reader = await c2pa.reader.fromBlob(blob.type, blob);
|
|
122
|
-
|
|
123
|
-
const manifestStore = await reader.manifestStore();
|
|
124
|
-
|
|
125
|
-
expect(manifestStore).toEqual(C_with_CAWG_data_untrusted_ManifestStore);
|
|
126
|
-
|
|
127
|
-
await reader.free();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test('should work when created from an initial segment and fragment', async () => {
|
|
131
|
-
const c2pa = await createC2pa({ wasmSrc });
|
|
132
|
-
|
|
133
|
-
const initBlob = await getBlobForAsset(dashinit);
|
|
134
|
-
const fragmentBlob = await getBlobForAsset(dash1);
|
|
135
|
-
|
|
136
|
-
const reader = await c2pa.reader.fromBlobFragment(initBlob.type, initBlob, fragmentBlob);
|
|
137
|
-
|
|
138
|
-
const manifestStore = await reader.manifestStore();
|
|
139
|
-
|
|
140
|
-
expect(manifestStore).toEqual(dashinit_ManifestStore);
|
|
141
|
-
|
|
142
|
-
await reader.free();
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// TODO: can this test be written to track the status of the underlying object instead of checking for an error?
|
|
146
|
-
test('should be freeable', async () => {
|
|
147
|
-
const c2pa = await createC2pa({ wasmSrc });
|
|
148
|
-
|
|
149
|
-
const blob = await getBlobForAsset(C_with_CAWG_data);
|
|
150
|
-
|
|
151
|
-
const reader = await c2pa.reader.fromBlob(blob.type, blob);
|
|
152
|
-
|
|
153
|
-
await reader.free();
|
|
154
|
-
|
|
155
|
-
await expect(reader.manifestStore()).rejects.toThrowError();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
async function getBlobForAsset(src: string): Promise<Blob> {
|
|
162
|
-
const response = await fetch(src);
|
|
163
|
-
const blob = await response.blob();
|
|
164
|
-
|
|
165
|
-
return blob;
|
|
166
|
-
}
|