@gmb/bitmark-parser 6.11.1 → 7.0.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.
Files changed (45) hide show
  1. package/README.md +222 -54
  2. package/dist/browser/bitmark-parser.min.js +4 -4
  3. package/dist/browser/bitmark-parser.min.js.map +1 -1
  4. package/dist/browser/cjs/index.cjs +547 -325
  5. package/dist/browser/cjs/index.cjs.map +1 -1
  6. package/dist/browser/cjs/index.d.cts +342 -68
  7. package/dist/browser/esm/index.d.ts +342 -68
  8. package/dist/browser/esm/index.js +546 -324
  9. package/dist/browser/esm/index.js.map +1 -1
  10. package/dist/browser/esm/worker-entry.js +497 -242
  11. package/dist/browser/esm/worker-entry.js.map +1 -1
  12. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  13. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  15. package/dist/index.cjs +51 -88
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +342 -68
  18. package/dist/index.d.ts +342 -68
  19. package/dist/index.js +50 -87
  20. package/dist/index.js.map +1 -1
  21. package/dist/legacy.cjs +8 -30
  22. package/dist/legacy.cjs.map +1 -1
  23. package/dist/legacy.d.cts +0 -2
  24. package/dist/legacy.d.ts +0 -2
  25. package/dist/legacy.js +8 -30
  26. package/dist/legacy.js.map +1 -1
  27. package/dist/worker-entry.cjs +1 -5
  28. package/dist/worker-entry.cjs.map +1 -1
  29. package/package.json +6 -6
  30. package/schema/bitmark.schema.json +496 -139
  31. package/wasm/bitmark_wasm.d.ts +27 -23
  32. package/wasm/bitmark_wasm.js +198 -112
  33. package/wasm/bitmark_wasm_bg.wasm +0 -0
  34. package/wasm/bitmark_wasm_bg.wasm.d.ts +2 -2
  35. package/wasm/package.json +1 -1
  36. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +18 -12
  37. package/wasm-bitmark-json/bitmark_json_wasm.js +170 -72
  38. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  39. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +1 -1
  40. package/wasm-bitmark-json/package.json +1 -1
  41. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +27 -23
  42. package/wasm-browser-full/bitmark_browser_full_wasm.js +198 -112
  43. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  44. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +2 -2
  45. package/wasm-browser-full/package.json +1 -1
@@ -1,5 +1,5 @@
1
- var Yt=Object.defineProperty;var $e=(t,e,r)=>e in t?Yt(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r;var ut=(t,e)=>{for(var r in e)Yt(t,r,{get:e[r],enumerable:true});};var J=(t,e,r)=>$e(t,typeof e!="symbol"?e+"":e,r);var At={};ut(At,{breakscape_text:()=>Ye,canonicalize:()=>sn,convert:()=>on,convert_text:()=>Ze,count_bits:()=>an,default:()=>St,diff:()=>nn,info:()=>Qe,initSync:()=>Bt,is_bitmark:()=>cn,lex:()=>qe,prettify:()=>un,register:()=>rn,resolve_patch_document:()=>en,split_bits:()=>pn,split_json_bits:()=>_n,transform:()=>tn,unbreakscape_text:()=>Xe});var p,h=0,st=null;function dt(){return (st===null||st.byteLength===0)&&(st=new Uint8Array(p.memory.buffer)),st}var lt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Ke=typeof lt.encodeInto=="function"?function(t,e){return lt.encodeInto(t,e)}:function(t,e){let r=lt.encode(t);return e.set(r),{read:t.length,written:r.length}};function v(t,e,r){if(r===void 0){let a=lt.encode(t),_=e(a.length,1)>>>0;return dt().subarray(_,_+a.length).set(a),h=a.length,_}let n=t.length,o=e(n,1)>>>0,s=dt(),i=0;for(;i<n;i++){let a=t.charCodeAt(i);if(a>127)break;s[o+i]=a;}if(i!==n){i!==0&&(t=t.slice(i)),o=r(o,n,n=i+t.length*3,1)>>>0;let a=dt().subarray(o+i,o+n),_=Ke(t,a);i+=_.written,o=r(o,n,i,1)>>>0;}return h=i,o}var q=null;function B(){return (q===null||q.buffer.detached===true||q.buffer.detached===void 0&&q.buffer!==p.memory.buffer)&&(q=new DataView(p.memory.buffer)),q}var Xt=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Xt.decode();function N(t,e){return t=t>>>0,Xt.decode(dt().subarray(t,t+e))}function qe(t,e){let r,n;try{let i=p.__wbindgen_add_to_stack_pointer(-16),a=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=h,d=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=h;p.lex(i,a,_,d,l);var o=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return r=o,n=s,N(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function Ye(t,e,r){let n,o;try{let a=p.__wbindgen_add_to_stack_pointer(-16),_=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=h,l=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=h,g=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),b=h;p.breakscape_text(a,_,d,l,f,g,b);var s=B().getInt32(a+0,!0),i=B().getInt32(a+4,!0);return n=s,o=i,N(s,i)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function Xe(t,e,r){let n,o;try{let a=p.__wbindgen_add_to_stack_pointer(-16),_=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),d=h,l=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=h,g=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),b=h;p.unbreakscape_text(a,_,d,l,f,g,b);var s=B().getInt32(a+0,!0),i=B().getInt32(a+4,!0);return n=s,o=i,N(s,i)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function Qe(t,e,r,n,o,s,i,a,_){let d,l;try{let b=p.__wbindgen_add_to_stack_pointer(-16),k=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=h,m=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=h,y=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),I=h,E=v(_,p.__wbindgen_export_0,p.__wbindgen_export_1),L=h;p.info(b,k,x,m,w,y,I,n,o,s,i,a,E,L);var f=B().getInt32(b+0,!0),g=B().getInt32(b+4,!0);return d=f,l=g,N(f,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,l,1);}}function Ze(t,e,r,n){let o,s;try{let _=p.__wbindgen_add_to_stack_pointer(-16),d=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),l=h,f=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),g=h,b=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),k=h,x=v(n,p.__wbindgen_export_0,p.__wbindgen_export_1),m=h;p.convert_text(_,d,l,f,g,b,k,x,m);var i=B().getInt32(_+0,!0),a=B().getInt32(_+4,!0);return o=i,s=a,N(i,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,s,1);}}function tn(t,e,r,n,o,s,i,a){let _,d;try{let g=p.__wbindgen_add_to_stack_pointer(-16),b=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=h,x=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),m=h,w=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),y=h,I=v(n,p.__wbindgen_export_0,p.__wbindgen_export_1),E=h,L=v(o,p.__wbindgen_export_0,p.__wbindgen_export_1),it=h;p.transform(g,b,k,x,m,w,y,I,E,L,it,s,i,a);var l=B().getInt32(g+0,!0),f=B().getInt32(g+4,!0);return _=l,d=f,N(l,f)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(_,d,1);}}function en(t,e){let r,n;try{let i=p.__wbindgen_add_to_stack_pointer(-16),a=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=h,d=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=h;p.resolve_patch_document(i,a,_,d,l);var o=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return r=o,n=s,N(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function nn(t,e,r,n,o,s,i,a,_){let d,l;try{let b=p.__wbindgen_add_to_stack_pointer(-16),k=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=h,m=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=h,y=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),I=h,E=v(n,p.__wbindgen_export_0,p.__wbindgen_export_1),L=h;p.diff(b,k,x,m,w,y,I,E,L,o,s,i,a,_);var f=B().getInt32(b+0,!0),g=B().getInt32(b+4,!0);return d=f,l=g,N(f,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,l,1);}}function rn(t,e){let r,n;try{let i=p.__wbindgen_add_to_stack_pointer(-16),a=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=h,d=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),l=h;p.register(i,a,_,d,l);var o=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return r=o,n=s,N(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function on(t,e,r,n,o,s,i,a,_){let d,l;try{let b=p.__wbindgen_add_to_stack_pointer(-16),k=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=h,m=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=h,y=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),I=h,E=v(n,p.__wbindgen_export_0,p.__wbindgen_export_1),L=h;p.convert(b,k,x,m,w,y,I,E,L,o,s,i,a,_);var f=B().getInt32(b+0,!0),g=B().getInt32(b+4,!0);return d=f,l=g,N(f,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(d,l,1);}}function sn(t,e,r,n,o,s){let i,a;try{let l=p.__wbindgen_add_to_stack_pointer(-16),f=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),g=h,b=v(e,p.__wbindgen_export_0,p.__wbindgen_export_1),k=h,x=v(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=h;p.canonicalize(l,f,g,b,k,x,m,n,o,s);var _=B().getInt32(l+0,!0),d=B().getInt32(l+4,!0);return i=_,a=d,N(_,d)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(i,a,1);}}function an(t){let e,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),a=h;p.count_bits(s,i,a);var n=B().getInt32(s+0,!0),o=B().getInt32(s+4,!0);return e=n,r=o,N(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function pn(t){let e,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),a=h;p.split_bits(s,i,a);var n=B().getInt32(s+0,!0),o=B().getInt32(s+4,!0);return e=n,r=o,N(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function cn(t){let e=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),r=h;return p.is_bitmark(e,r)!==0}function _n(t){let e,r;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),a=h;p.split_json_bits(s,i,a);var n=B().getInt32(s+0,!0),o=B().getInt32(s+4,!0);return e=n,r=o,N(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function un(t,e){let r,n;try{let i=p.__wbindgen_add_to_stack_pointer(-16),a=v(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=h;p.prettify(i,a,_,e);var o=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return r=o,n=s,N(o,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}async function dn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function Qt(){let t={};return t.wbg={},t}function Zt(t,e){return p=t.exports,te.__wbindgen_wasm_module=e,q=null,st=null,p}function Bt(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=Qt();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return Zt(r,t)}async function te(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_wasm_bg.wasm",import.meta.url));let e=Qt();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await dn(await t,e);return Zt(r,n)}var St=te;var Lt={};ut(Lt,{breakscape_text:()=>gn,canonicalize:()=>vn,convert:()=>On,convert_text:()=>xn,count_bits:()=>Tn,default:()=>jt,diff:()=>kn,info:()=>mn,initSync:()=>Pt,is_bitmark:()=>In,lex:()=>fn,prettify:()=>En,register:()=>hn,resolve_patch_document:()=>wn,split_bits:()=>Fn,split_json_bits:()=>Rn,transform:()=>yn,unbreakscape_text:()=>bn});var c,O=0,at=null;function ft(){return (at===null||at.byteLength===0)&&(at=new Uint8Array(c.memory.buffer)),at}var gt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ln=typeof gt.encodeInto=="function"?function(t,e){return gt.encodeInto(t,e)}:function(t,e){let r=gt.encode(t);return e.set(r),{read:t.length,written:r.length}};function T(t,e,r){if(r===void 0){let a=gt.encode(t),_=e(a.length,1)>>>0;return ft().subarray(_,_+a.length).set(a),O=a.length,_}let n=t.length,o=e(n,1)>>>0,s=ft(),i=0;for(;i<n;i++){let a=t.charCodeAt(i);if(a>127)break;s[o+i]=a;}if(i!==n){i!==0&&(t=t.slice(i)),o=r(o,n,n=i+t.length*3,1)>>>0;let a=ft().subarray(o+i,o+n),_=ln(t,a);i+=_.written,o=r(o,n,i,1)>>>0;}return O=i,o}var Y=null;function S(){return (Y===null||Y.buffer.detached===true||Y.buffer.detached===void 0&&Y.buffer!==c.memory.buffer)&&(Y=new DataView(c.memory.buffer)),Y}var ee=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ee.decode();function V(t,e){return t=t>>>0,ee.decode(ft().subarray(t,t+e))}function fn(t,e){let r,n;try{let i=c.__wbindgen_add_to_stack_pointer(-16),a=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),_=O,d=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),l=O;c.lex(i,a,_,d,l);var o=S().getInt32(i+0,!0),s=S().getInt32(i+4,!0);return r=o,n=s,V(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}function gn(t,e,r){let n,o;try{let a=c.__wbindgen_add_to_stack_pointer(-16),_=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),d=O,l=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=O,g=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),b=O;c.breakscape_text(a,_,d,l,f,g,b);var s=S().getInt32(a+0,!0),i=S().getInt32(a+4,!0);return n=s,o=i,V(s,i)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,o,1);}}function bn(t,e,r){let n,o;try{let a=c.__wbindgen_add_to_stack_pointer(-16),_=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),d=O,l=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),f=O,g=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),b=O;c.unbreakscape_text(a,_,d,l,f,g,b);var s=S().getInt32(a+0,!0),i=S().getInt32(a+4,!0);return n=s,o=i,V(s,i)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(n,o,1);}}function mn(t,e,r,n,o,s,i,a,_){let d,l;try{let b=c.__wbindgen_add_to_stack_pointer(-16),k=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),x=O,m=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=O,y=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),I=O,E=T(_,c.__wbindgen_export_0,c.__wbindgen_export_1),L=O;c.info(b,k,x,m,w,y,I,n,o,s,i,a,E,L);var f=S().getInt32(b+0,!0),g=S().getInt32(b+4,!0);return d=f,l=g,V(f,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,l,1);}}function xn(t,e,r,n){let o,s;try{let _=c.__wbindgen_add_to_stack_pointer(-16),d=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),l=O,f=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),g=O,b=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),k=O,x=T(n,c.__wbindgen_export_0,c.__wbindgen_export_1),m=O;c.convert_text(_,d,l,f,g,b,k,x,m);var i=S().getInt32(_+0,!0),a=S().getInt32(_+4,!0);return o=i,s=a,V(i,a)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(o,s,1);}}function yn(t,e,r,n,o,s,i,a){let _,d;try{let g=c.__wbindgen_add_to_stack_pointer(-16),b=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),k=O,x=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),m=O,w=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),y=O,I=T(n,c.__wbindgen_export_0,c.__wbindgen_export_1),E=O,L=T(o,c.__wbindgen_export_0,c.__wbindgen_export_1),it=O;c.transform(g,b,k,x,m,w,y,I,E,L,it,s,i,a);var l=S().getInt32(g+0,!0),f=S().getInt32(g+4,!0);return _=l,d=f,V(l,f)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(_,d,1);}}function wn(t,e){let r,n;try{let i=c.__wbindgen_add_to_stack_pointer(-16),a=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),_=O,d=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),l=O;c.resolve_patch_document(i,a,_,d,l);var o=S().getInt32(i+0,!0),s=S().getInt32(i+4,!0);return r=o,n=s,V(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}function kn(t,e,r,n,o,s,i,a,_){let d,l;try{let b=c.__wbindgen_add_to_stack_pointer(-16),k=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),x=O,m=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=O,y=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),I=O,E=T(n,c.__wbindgen_export_0,c.__wbindgen_export_1),L=O;c.diff(b,k,x,m,w,y,I,E,L,o,s,i,a,_);var f=S().getInt32(b+0,!0),g=S().getInt32(b+4,!0);return d=f,l=g,V(f,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,l,1);}}function hn(t,e){let r,n;try{let i=c.__wbindgen_add_to_stack_pointer(-16),a=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),_=O,d=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),l=O;c.register(i,a,_,d,l);var o=S().getInt32(i+0,!0),s=S().getInt32(i+4,!0);return r=o,n=s,V(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}function On(t,e,r,n,o,s,i,a,_){let d,l;try{let b=c.__wbindgen_add_to_stack_pointer(-16),k=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),x=O,m=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),w=O,y=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),I=O,E=T(n,c.__wbindgen_export_0,c.__wbindgen_export_1),L=O;c.convert(b,k,x,m,w,y,I,E,L,o,s,i,a,_);var f=S().getInt32(b+0,!0),g=S().getInt32(b+4,!0);return d=f,l=g,V(f,g)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(d,l,1);}}function vn(t,e,r,n,o,s){let i,a;try{let l=c.__wbindgen_add_to_stack_pointer(-16),f=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),g=O,b=T(e,c.__wbindgen_export_0,c.__wbindgen_export_1),k=O,x=T(r,c.__wbindgen_export_0,c.__wbindgen_export_1),m=O;c.canonicalize(l,f,g,b,k,x,m,n,o,s);var _=S().getInt32(l+0,!0),d=S().getInt32(l+4,!0);return i=_,a=d,V(_,d)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(i,a,1);}}function Tn(t){let e,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),a=O;c.count_bits(s,i,a);var n=S().getInt32(s+0,!0),o=S().getInt32(s+4,!0);return e=n,r=o,V(n,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function Fn(t){let e,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),a=O;c.split_bits(s,i,a);var n=S().getInt32(s+0,!0),o=S().getInt32(s+4,!0);return e=n,r=o,V(n,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function In(t){let e=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),r=O;return c.is_bitmark(e,r)!==0}function Rn(t){let e,r;try{let s=c.__wbindgen_add_to_stack_pointer(-16),i=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),a=O;c.split_json_bits(s,i,a);var n=S().getInt32(s+0,!0),o=S().getInt32(s+4,!0);return e=n,r=o,V(n,o)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(e,r,1);}}function En(t,e){let r,n;try{let i=c.__wbindgen_add_to_stack_pointer(-16),a=T(t,c.__wbindgen_export_0,c.__wbindgen_export_1),_=O;c.prettify(i,a,_,e);var o=S().getInt32(i+0,!0),s=S().getInt32(i+4,!0);return r=o,n=s,V(o,s)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_export_2(r,n,1);}}async function Bn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function ne(){let t={};return t.wbg={},t}function re(t,e){return c=t.exports,oe.__wbindgen_wasm_module=e,Y=null,at=null,c}function Pt(t){if(c!==void 0)return c;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=ne();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return re(r,t)}async function oe(t){if(c!==void 0)return c;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let e=ne();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Bn(await t,e);return re(r,n)}var jt=oe;var Jt={};ut(Jt,{breakscape_text:()=>An,canonicalize:()=>Mn,convert:()=>Jn,convert_text:()=>Hn,count_bits:()=>Dn,default:()=>Ct,info:()=>jn,initSync:()=>Wt,is_bitmark:()=>Vn,prettify:()=>Gn,register:()=>Ln,resolve_patch_document:()=>Cn,split_bits:()=>Nn,split_json_bits:()=>Un,transform:()=>Wn,unbreakscape_text:()=>Pn});var u,F=0,pt=null;function bt(){return (pt===null||pt.byteLength===0)&&(pt=new Uint8Array(u.memory.buffer)),pt}var mt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Sn=typeof mt.encodeInto=="function"?function(t,e){return mt.encodeInto(t,e)}:function(t,e){let r=mt.encode(t);return e.set(r),{read:t.length,written:r.length}};function R(t,e,r){if(r===void 0){let a=mt.encode(t),_=e(a.length,1)>>>0;return bt().subarray(_,_+a.length).set(a),F=a.length,_}let n=t.length,o=e(n,1)>>>0,s=bt(),i=0;for(;i<n;i++){let a=t.charCodeAt(i);if(a>127)break;s[o+i]=a;}if(i!==n){i!==0&&(t=t.slice(i)),o=r(o,n,n=i+t.length*3,1)>>>0;let a=bt().subarray(o+i,o+n),_=Sn(t,a);i+=_.written,o=r(o,n,i,1)>>>0;}return F=i,o}var X=null;function A(){return (X===null||X.buffer.detached===true||X.buffer.detached===void 0&&X.buffer!==u.memory.buffer)&&(X=new DataView(u.memory.buffer)),X}var ie=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ie.decode();function G(t,e){return t=t>>>0,ie.decode(bt().subarray(t,t+e))}function An(t,e,r){let n,o;try{let a=u.__wbindgen_add_to_stack_pointer(-16),_=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),d=F,l=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),f=F,g=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),b=F;u.breakscape_text(a,_,d,l,f,g,b);var s=A().getInt32(a+0,!0),i=A().getInt32(a+4,!0);return n=s,o=i,G(s,i)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function Pn(t,e,r){let n,o;try{let a=u.__wbindgen_add_to_stack_pointer(-16),_=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),d=F,l=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),f=F,g=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),b=F;u.unbreakscape_text(a,_,d,l,f,g,b);var s=A().getInt32(a+0,!0),i=A().getInt32(a+4,!0);return n=s,o=i,G(s,i)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function jn(t,e,r,n,o,s,i,a,_){let d,l;try{let b=u.__wbindgen_add_to_stack_pointer(-16),k=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),x=F,m=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),w=F,y=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),I=F,E=R(_,u.__wbindgen_export_0,u.__wbindgen_export_1),L=F;u.info(b,k,x,m,w,y,I,n,o,s,i,a,E,L);var f=A().getInt32(b+0,!0),g=A().getInt32(b+4,!0);return d=f,l=g,G(f,g)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(d,l,1);}}function Ln(t,e){let r,n;try{let i=u.__wbindgen_add_to_stack_pointer(-16),a=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),_=F,d=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),l=F;u.register(i,a,_,d,l);var o=A().getInt32(i+0,!0),s=A().getInt32(i+4,!0);return r=o,n=s,G(o,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}function Wn(t,e,r,n,o,s,i,a){let _,d;try{let g=u.__wbindgen_add_to_stack_pointer(-16),b=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),k=F,x=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),m=F,w=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),y=F,I=R(n,u.__wbindgen_export_0,u.__wbindgen_export_1),E=F,L=R(o,u.__wbindgen_export_0,u.__wbindgen_export_1),it=F;u.transform(g,b,k,x,m,w,y,I,E,L,it,s,i,a);var l=A().getInt32(g+0,!0),f=A().getInt32(g+4,!0);return _=l,d=f,G(l,f)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(_,d,1);}}function Cn(t,e){let r,n;try{let i=u.__wbindgen_add_to_stack_pointer(-16),a=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),_=F,d=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),l=F;u.resolve_patch_document(i,a,_,d,l);var o=A().getInt32(i+0,!0),s=A().getInt32(i+4,!0);return r=o,n=s,G(o,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}function Jn(t,e,r,n,o,s,i,a,_){let d,l;try{let b=u.__wbindgen_add_to_stack_pointer(-16),k=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),x=F,m=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),w=F,y=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),I=F,E=R(n,u.__wbindgen_export_0,u.__wbindgen_export_1),L=F;u.convert(b,k,x,m,w,y,I,E,L,o,s,i,a,_);var f=A().getInt32(b+0,!0),g=A().getInt32(b+4,!0);return d=f,l=g,G(f,g)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(d,l,1);}}function Mn(t,e,r,n,o,s){let i,a;try{let l=u.__wbindgen_add_to_stack_pointer(-16),f=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),g=F,b=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),k=F,x=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),m=F;u.canonicalize(l,f,g,b,k,x,m,n,o,s);var _=A().getInt32(l+0,!0),d=A().getInt32(l+4,!0);return i=_,a=d,G(_,d)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(i,a,1);}}function Dn(t){let e,r;try{let s=u.__wbindgen_add_to_stack_pointer(-16),i=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),a=F;u.count_bits(s,i,a);var n=A().getInt32(s+0,!0),o=A().getInt32(s+4,!0);return e=n,r=o,G(n,o)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Nn(t){let e,r;try{let s=u.__wbindgen_add_to_stack_pointer(-16),i=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),a=F;u.split_bits(s,i,a);var n=A().getInt32(s+0,!0),o=A().getInt32(s+4,!0);return e=n,r=o,G(n,o)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Vn(t){let e=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),r=F;return u.is_bitmark(e,r)!==0}function Un(t){let e,r;try{let s=u.__wbindgen_add_to_stack_pointer(-16),i=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),a=F;u.split_json_bits(s,i,a);var n=A().getInt32(s+0,!0),o=A().getInt32(s+4,!0);return e=n,r=o,G(n,o)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Gn(t,e){let r,n;try{let i=u.__wbindgen_add_to_stack_pointer(-16),a=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),_=F;u.prettify(i,a,_,e);var o=A().getInt32(i+0,!0),s=A().getInt32(i+4,!0);return r=o,n=s,G(o,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}function Hn(t,e,r,n){let o,s;try{let _=u.__wbindgen_add_to_stack_pointer(-16),d=R(t,u.__wbindgen_export_0,u.__wbindgen_export_1),l=F,f=R(e,u.__wbindgen_export_0,u.__wbindgen_export_1),g=F,b=R(r,u.__wbindgen_export_0,u.__wbindgen_export_1),k=F,x=R(n,u.__wbindgen_export_0,u.__wbindgen_export_1),m=F;u.convert_text(_,d,l,f,g,b,k,x,m);var i=A().getInt32(_+0,!0),a=A().getInt32(_+4,!0);return o=i,s=a,G(i,a)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(o,s,1);}}async function zn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function se(){let t={};return t.wbg={},t}function ae(t,e){return u=t.exports,pe.__wbindgen_wasm_module=e,X=null,pt=null,u}function Wt(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=se();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return ae(r,t)}async function pe(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let e=se();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await zn(await t,e);return ae(r,n)}var Ct=pe;var ct={version:"6.11.1"};var Mt="browser-full",yt=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},et=class extends Error{constructor(e){super(e),this.name="RegisterError";}},nt=class extends Error{constructor(e,r){super(`${e} is not available in the loaded wasm module${r?` (feature: "${r}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},xt,_e,ce,ue=new Map;function D(){if(!xt&&ce&&ce(),!xt)throw new yt;return xt}function Dt(t,e){for(let[r,n]of ue){let o=e.register(r,n);if(o)throw new et(o.replace(/^error:\s*/,""))}xt=e,_e=t;}function de(t,e){ue.set(t,e);}function Q(){return _e}function Z(t){return t.startsWith("error:")}function wt(t){let e=t instanceof Error?t.message:String(t);return e.startsWith("error:")?e:`error: ${e}`}function $n(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):t}function Kn(t){return t===void 0?"":typeof t=="string"?t.trim():JSON.stringify(t)}function qn(t,e,r){if(r){let s=t.split_bits(e);if(Z(s))throw new Error(s);let i=JSON.parse(s);return i.map(a=>({view:{format:"bitmark",index:a.index,total:i.length,source:a.source},source:a.source}))}let n=t.split_json_bits(e);if(Z(n))throw new Error(n);let o=JSON.parse(n);return o.map((s,i)=>({view:{format:"json",index:i,total:o.length,bit:s.bit??{}},source:JSON.stringify([s])}))}function Nt(t,e,r){let n=r.mode??"optimized",o=r.outputFormat??"json",s=r.spacesAroundValues??1,i=r.indent??2,a=r.pretty??false,_=r.inputFormat??"auto",d=_==="bitmark"||_!=="json"&&t.is_bitmark(e),l=d?"bitmark":"json",f=qn(t,e,d),g=f.length,b=[];for(let y=0;y<g;y++){let{view:I}=f[y];I.index=y,I.total=g;let E=r.preHook?r.preHook(I)||{}:{};b.push(E.drop?null:{patches:E.patches??[],outputFormat:E.outputFormat??o});}let k=Kn(r.patch),x;if(k==="")x=f.map((y,I)=>({source:I,bit:null,patch:[]}));else {let y=t.resolve_patch_document(e,k);if(Z(y))throw new Error(y);x=JSON.parse(y);}let m=[],w=[];for(let y of x)if(y.source!==null){let I=b[y.source];if(!I)continue;m.push({index:y.source,source:f[y.source].source,inputFormat:l,outputFormat:I.outputFormat,mode:n,patchJson:JSON.stringify([...y.patch,...I.patches]),spacesAroundValues:s}),w.push(f[y.source].view);}else {let I=y.bit??{},E=m.length;m.push({index:E,source:JSON.stringify([{bit:I}]),inputFormat:"json",outputFormat:o,mode:n,patchJson:JSON.stringify(y.patch),spacesAroundValues:s}),w.push({format:"json",index:E,total:g,bit:I});}return {jobs:m,views:w,output:o,pretty:a,indent:i}}function Yn(t,e){let r=t.transform(e.source,e.inputFormat,e.outputFormat,e.mode,e.patchJson,false,2,e.spacesAroundValues);return Z(r)?r:e.outputFormat==="json"?$n(r):r}function Vt(t,e,r,n,o){if(r==="bitmark"||r==="text")return e.join(`
2
- `);let s=`[${e.join(",")}]`;return n?t.prettify(s,o):s}function le(t,e,r){let n;try{n=Nt(t,e,r);}catch(s){return wt(s)}let o=[];for(let s=0;s<n.jobs.length;s++){let i=Yn(t,n.jobs[s]);if(Z(i))return i;r.postHook?.(n.views[s],i),o.push(i);}return Vt(t,o,n.output,n.pretty,n.indent)}async function fe(t,e,r,n){let o;try{o=Nt(t,e,r);}catch(i){return wt(i)}let s;try{s=await n(o.jobs,r.workers??4);}catch(i){return wt(i)}for(let i=0;i<s.length;i++){if(Z(s[i]))return s[i];r.postHook?.(o.views[i],s[i]);}return Vt(t,s,o.output,o.pretty,o.indent)}var Ut;function ge(t){Ut=t;}function W(){if(!Ut)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return Ut()}function be(t,e,r){if(t.length===0)return Promise.resolve([]);let n=Math.max(1,Math.min(e,t.length)),o=new URL("./worker-entry.js",import.meta.url);return new Promise((s,i)=>{let a=new Array(t.length),_=0,d=0,l=false,f=[],g=()=>{for(let x of f)x.terminate();},b=x=>{l||(l=true,g(),i(x));},k=x=>{if(l||_>=t.length)return;let m=_++;x.postMessage({id:m,job:t[m],feature:r});};for(let x=0;x<n;x++){let m=new Worker(o,{type:"module"});f.push(m),m.onmessage=w=>{let y=w.data;if(!l){if(!y.ok){b(new Error(y.error??"worker job failed"));return}if(a[y.id]=y.element,d++,d===t.length){l=true,g(),s(a);return}k(m);}},m.onerror=w=>b(new Error(w.message||"worker error"));}for(let x of f)k(x);})}var Ue={};ut(Ue,{Ast:()=>Ee,BitType:()=>Te,BitmarkFileGenerator:()=>Ae,BitmarkGenerator:()=>Be,BitmarkParser:()=>Je,BitmarkParserGenerator:()=>It,BitmarkParserType:()=>ar,BitmarkStringGenerator:()=>Se,BitmarkVersion:()=>ir,BodyTextFormat:()=>_r,BoundingBoxIndex:()=>Re,Builder:()=>Ft,CardSetVersion:()=>sr,FileWriter:()=>Ne,HtmlTableGenerator:()=>We,HtmlTableParser:()=>Ce,InfoFormat:()=>cr,InfoType:()=>pr,Input:()=>nr,InputFormat:()=>or,JsonFileGenerator:()=>Le,JsonGenerator:()=>Pe,JsonParser:()=>Me,JsonStringGenerator:()=>je,LegacyUnsupportedError:()=>rt,NodeType:()=>Ie,Output:()=>rr,ResourceBuilder:()=>Rt,StreamWriter:()=>Ve,StringWriter:()=>De,TextLocation:()=>ur,TextMarkType:()=>Oe,TextNodeType:()=>ve,bitmarkTextParse:()=>ke,isPseudoAst:()=>xe});var rt=class extends Error{constructor(e){super(e),this.name="LegacyUnsupportedError";}};function $(t,e){throw new rt(`'${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}function z(t,e){throw new rt(`Option '${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}var Gt="bitmark v2 output is not supported (this parser is bitmark v3 only)";function Ht(t){t.bitmarkVersion===2&&z("bitmarkVersion: 2",Gt);}function ht(t){t.explicitTextFormat&&z("bitmarkOptions.explicitTextFormat"),t.cardSetVersion===1&&z("bitmarkOptions.cardSetVersion: 1",Gt),t.debugGenerationInline&&z("bitmarkOptions.debugGenerationInline"),t.noBreakscaping&&z("bitmarkOptions.noBreakscaping");}function Ot(t){t.textAsPlainText&&z("jsonOptions.textAsPlainText",Gt),t.debugGenerationInline&&z("jsonOptions.debugGenerationInline");}function tt(t){return t===true?{pretty:true,indent:2}:typeof t=="number"&&t>0?{pretty:true,indent:t}:{pretty:false,indent:2}}function vt(t){return t===void 0||t===true?1:t===false?0:Math.max(0,Math.min(10,t))}function Tt(t){switch(t){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var me=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function ot(t){let e={bits:t};return Object.defineProperty(e,me,{value:true,enumerable:false}),e}function xe(t){return t!==null&&typeof t=="object"&&(me in t||Array.isArray(t.bits))}var ye={"extractor-image":{key:"images",resourceType:"image"},"extractor-image-collapsible":{key:"images",resourceType:"image"},"images-logo-grave":{key:"logos",resourceType:"image"},"prototype-images":{key:"images",resourceType:"image"}};var zt=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),Qn={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},Zn={"bitmark--":"bitmark++","bitmark+":"bitmark++"},tr={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},er=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],Ft=class{buildBitmark(e){let r=ot(e.bits??[]);return e.errors!==void 0&&(r.errors=e.errors),r}buildBit(e,r){let n=W(),o={...e},s=o.bitType,i=this.getBitConfig(s),a={};a.type=s,o.isCommented&&(a.type="_comment",a.originalType=s),delete o.bitType,delete o.isCommented;let _=o.textFormat;_!==void 0?(a.format=Zn[_]??_,delete o.textFormat):a.format=tr[i.bodyFormat??""]??"bitmark++",delete o.resourceType;let d=o.body;d!=null&&typeof d=="object"&&"body"in d&&(a.body=d.body,delete o.body),o.example!==void 0?(a.isExample=true,a.example=o.example,delete o.example,delete o.__isDefaultExample):o.__isDefaultExample&&(a.isExample=true,delete o.__isDefaultExample);let l=o.resources;if(l!==void 0&&s!==void 0){let m=Array.isArray(l)?l:[l],w=ye[s];w?a[w.key]=m.filter(y=>y!==null&&typeof y=="object"&&y.type===w.resourceType):m.length>=1&&(a.resource=m[0]),delete o.resources;}let f=o.parser;delete o.parser;let g=o.extraProperties;delete o.extraProperties;for(let[m,w]of Object.entries(o))w!==void 0&&(a[Qn[m]??m]=w);if(g)for(let[m,w]of Object.entries(g))m in a||(a[m]=w);this.parseStringTexts(a);let b=n.convert(JSON.stringify([{bit:a}]),"json","json","optimized",false,2,1,false,false);if(b.startsWith("error:"))throw new Error(b.slice(6).trim());let x=JSON.parse(b)[0]?.bit??a;for(let[m,w]of Object.entries(a))m in x||w===false||w===""||w===null||Array.isArray(w)&&w.length===0||(x[m]=w);return f!==void 0&&Object.defineProperty(x,zt,{value:f,enumerable:false}),x}buildHighlight(e,r){if(!r)return;let n={...r},o=n.attrs;return o&&Object.assign(n,o),{type:"highlight",texts:Array.isArray(n.texts)?n.texts.filter(a=>a!=null).map(a=>({text:a.text??"",isCorrect:a.isCorrect??false,isHighlighted:a.isHighlighted??false,...we(a,["text","isCorrect","isHighlighted"])})):[],prefix:n.prefix??"",postfix:n.postfix??"",...we(n,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(e){let r=W(),n=(i,a)=>{if(i==="")return i;let _=r.convert_text(i,"textToAst","bitmark++",a);try{return JSON.parse(_)}catch{return i}},o=e.format,s=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof e.body=="string")if(o==="json")try{e.body=JSON.parse(e.body);}catch{e.body=null;}else s&&(e.body=n(e.body,"body"));for(let i of er){let a=e[i];typeof a=="string"&&(e[i]=n(a,"tag"));}}getBitConfig(e){let r=W();if(e!==void 0)try{let n=JSON.parse(r.info("bit","json",e,!1,2,!1,!1,!0,""));if(n.error===void 0)return {bodyFormat:n.body?.format}}catch{}throw new Error(`No config found for bit: ${e}`)}};function we(t,e){let r={};for(let[n,o]of Object.entries(t))o!==void 0&&!e.includes(n)&&(r[n]=o);return r}var It=class{version(){return ct.version}convert(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);Ht(n),ht(s),Ot(o),this.checkBrowserFileWrite(n.outputFile);let i=W(),{source:a,isBitmark:_}=this.resolveInput(e,n.inputFormat),d=n.outputFormat??(_?"json":"bitmark"),l=d==="ast"?"json":d,{pretty:f,indent:g}=tt(o.prettify),b=l==="bitmark"?tt(s.prettifyJson):{pretty:f,indent:g},k=vt(s.spacesAroundValues),x=!o.excludeUnknownProperties,m=i.convert(a,_?"bitmark":"json",l,"optimized",b.pretty,b.indent,k,x,false);if(this.throwOnError(m),d==="bitmark"||d==="text")return this.deliver(m,n.outputFile,n.fileOptions);if(d==="json")return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):f||o.stringify?m:JSON.parse(m);let w=ot(JSON.parse(m));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}upgrade(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);Ht(n),ht(s),Ot(o),this.checkBrowserFileWrite(n.outputFile);let i=W(),{source:a,isBitmark:_}=this.resolveInput(e,n.inputFormat),{pretty:d,indent:l}=tt(_?s.prettifyJson:o.prettify),f=vt(s.spacesAroundValues),g=i.canonicalize(a,_?"bitmark":"json","optimized",d,l,f);return this.throwOnError(g),_?this.deliver(g,n.outputFile,n.fileOptions):n.outputFile?this.deliver(g,n.outputFile,n.fileOptions):d||o.stringify?g:JSON.parse(g)}info(e){let r=Object.assign({},e),n=W(),o=r.type??"list",s=r.outputFormat??"text",{pretty:i,indent:a}=tt(r.prettify),_=s==="pojo"?"json":s,d=n.info(o,_,r.bit??"",i,a,false,false,true,"");return this.throwOnError(d),s==="pojo"?JSON.parse(d):d}generateConfig(e){$("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),s=Object.assign({},n.bitmarkOptions);ht(s),Ot(o),n.keepUnknownTags&&z("keepUnknownTags"),n.noBreakscaping&&z("noBreakscaping"),this.checkBrowserFileWrite(n.outputFile);let i=W(),a=typeof e=="string"?this.maybeReadFile(e,void 0):"";if(!(n.inputFormat==="html"||n.inputFormat===void 0&&typeof e=="string"&&/<table[\s>]/iu.test(a))){let{source:y,isBitmark:I}=this.resolveInput(e,void 0),E=i.convert(y,I?"bitmark":"json","html","optimized",false,2,1,false,false);return this.throwOnError(E),this.deliver($t(E).join(`
3
- `),n.outputFile,n.fileOptions)}let d=n.tableFormat==="table"?"table":"table-extended",l=$t(a).map(y=>`<bitmark-bit data-type="${d}" data-format="bitmark++">${y}</bitmark-bit>`).join(""),f=n.outputFormat??"bitmark",{pretty:g,indent:b}=tt(o.prettify),k=vt(s.spacesAroundValues);if(f==="html"){let y=i.convert(l,"html","html","optimized",false,2,1,false,false);return this.throwOnError(y),this.deliver($t(y).join(`
4
- `),n.outputFile,n.fileOptions)}let x=f==="ast"?"json":f,m=i.convert(l,"html",x,"optimized",g,b,k,false,false);if(this.throwOnError(m),f==="bitmark"||f==="text")return this.deliver(m,n.outputFile,n.fileOptions);if(f==="json")return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):g||o.stringify?m:JSON.parse(m);let w=ot(JSON.parse(m));return n.outputFile?this.deliver(JSON.stringify(w),n.outputFile,n.fileOptions):w}createAst(e,r){let n=Object.assign({},r),o=W(),{source:s,isBitmark:i}=this.resolveInput(e,n.inputFormat),a=o.convert(s,i?"bitmark":"json","json","optimized",false,2,1,true,false);return this.throwOnError(a),ot(JSON.parse(a))}breakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),s=this.maybeReadFile(e,n.inputFormat),i=o.breakscape_text(s,Tt(n.textFormat),n.textLocation??"body");return this.deliver(i,n.outputFile,n.fileOptions)}unbreakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),s=this.maybeReadFile(e,n.inputFormat),i=o.unbreakscape_text(s,Tt(n.textFormat),n.textLocation??"body");return this.deliver(i,n.outputFile,n.fileOptions)}convertText(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions);this.checkBrowserFileWrite(n.outputFile);let s=W(),i=n.textFormat===void 0||Tt(n.textFormat)==="bitmark++",a=n.textLocation??"body",_,d;if(typeof e=="string"?(_=this.maybeReadFile(e,n.inputFormat),d=this.parseTextAstString(_)):(_=JSON.stringify(e),d=Array.isArray(e)?e:void 0),d!==void 0){let k=i?s.convert_text(JSON.stringify(d),"astToText","bitmark++",a):s.convert_text(JSON.stringify(d),"astToPlainText","plainText",a);return this.throwOnError(k),this.deliver(k,n.outputFile,n.fileOptions)}let l=s.convert_text(_,"textToAst",i?"bitmark++":"plainText","body");this.throwOnError(l);let{pretty:f,indent:g}=tt(o.prettify),b=f?s.prettify(l,g):l;return n.outputFile?this.deliver(b,n.outputFile,n.fileOptions):f?b:JSON.parse(l)}textAstToPlainText(e,r){let o=W().convert_text(typeof e=="string"?e:JSON.stringify(e),"astToPlainText","bitmark++","body");return this.throwOnError(o),o}extractPlainText(e,r){let n=r?.inputFormat,o=W();if(n==="plainText")return typeof e=="string"?String(e):"";if(n==="bitmarkText"){let _=o.convert_text(String(e),"textToAst","bitmark++","body"),d=o.convert_text(_,"astToPlainText","bitmark++","body");return this.throwOnError(d),d}if(typeof e=="string"&&this.parseTextAstString(e)===void 0&&!o.is_bitmark(e)&&!(()=>{try{return JSON.parse(e),!0}catch{return false}})())return this.extractPlainText(e,{inputFormat:"bitmarkText"});let{source:s,isBitmark:i}=this.resolveInput(e,void 0),a=o.convert(s,i?"bitmark":"json","text","optimized",false,2,1,false,false);return this.throwOnError(a),a}parseTextAstString(e){let r=e.trim();if(r.startsWith("["))try{let n=JSON.parse(r);if(Array.isArray(n)&&n.every(o=>o!==null&&typeof o=="object"&&"type"in o))return n}catch{}}resolveInput(e,r){if(typeof e!="string"){let s=this.jsonEntries(e);return {source:JSON.stringify(s?s.map(i=>this.toWrapperEntry(i)):e),isBitmark:false}}let n=this.maybeReadFile(e,r);if(W().is_bitmark(n))return {source:n,isBitmark:true};try{let s=JSON.parse(n),i=this.jsonEntries(s);if(i)return {source:JSON.stringify(i.map(a=>this.toWrapperEntry(a))),isBitmark:!1}}catch{return {source:n,isBitmark:true}}return {source:n,isBitmark:false}}jsonEntries(e){if(Array.isArray(e))return e;if(e!==null&&typeof e=="object"){let r=e;if(Array.isArray(r.bits))return r.bits;if("bit"in r)return [r];if(typeof r.type=="string")return [{bit:r}]}}toWrapperEntry(e){if(e!==null&&typeof e=="object"&&"bit"in e)return e;let r={bit:e},n=e?.[zt];return n!==void 0&&(r.parser=n),r}maybeReadFile(e,r){if(r==="string")return e;return e;}checkBrowserFileWrite(e){if(e&&true)throw new Error("Cannot write to file in browser environment")}deliver(e,r,n){if(!r)return e;throw new Error("Cannot write to file in browser environment");}throwOnError(e){if(e.startsWith("error:"))throw new Error(e.slice(6).trim())}};function $t(t){let e=[],r=t.toLowerCase(),n=0;for(;;){let o=r.indexOf("<table",n);if(o===-1)break;let s=0,i=o,a=-1;for(;i<t.length;){let _=r.indexOf("<table",i),d=r.indexOf("</table",i);if(d===-1)break;if(_!==-1&&_<d)s++,i=_+6;else {s--;let l=r.indexOf(">",d);if(i=l===-1?t.length:l+1,s===0){a=i;break}}}if(a===-1)break;e.push(t.slice(o,a)),n=a;}return e}function ke(t){let e=W().convert_text(t,"textToAst","bitmark++","body");if(e.startsWith("error:"))throw new Error(e.slice(6).trim());return JSON.parse(e)}var M={imageResource:{type:"image",key:"image",valueField:"src"},imageLinkResource:{type:"image-link",key:"imageLink",valueField:"url"},audioResource:{type:"audio",key:"audio",valueField:"src"},audioEmbedResource:{type:"audio-embed",key:"audioEmbed",valueField:"src"},audioLinkResource:{type:"audio-link",key:"audioLink",valueField:"url"},videoResource:{type:"video",key:"video",valueField:"src"},videoEmbedResource:{type:"video-embed",key:"videoEmbed",valueField:"url"},videoLinkResource:{type:"video-link",key:"videoLink",valueField:"url"},stillImageFilmEmbedResource:{type:"still-image-film-embed",key:"stillImageFilmEmbed",valueField:"url"},stillImageFilmLinkResource:{type:"still-image-film-link",key:"stillImageFilmLink",valueField:"url"},articleResource:{type:"article",key:"article",valueField:"body"},documentResource:{type:"document",key:"document",valueField:"url"},documentEmbedResource:{type:"document-embed",key:"documentEmbed",valueField:"url"},documentLinkResource:{type:"document-link",key:"documentLink",valueField:"url"},documentDownloadResource:{type:"document-download",key:"documentDownload",valueField:"url"},appLinkResource:{type:"app-link",key:"appLink",valueField:"url"},websiteLinkResource:{type:"website-link",key:"websiteLink",valueField:"url"}};function C(t){return (e,r,n)=>{if(!r)return;let{value:o,...s}=r,i={[t.valueField]:o??""};for(let[a,_]of Object.entries(s))_!==void 0&&(i[a]=_);return {type:t.type,[t.key]:i}}}var he=Object.fromEntries(Object.values(M).map(t=>[t.type,t])),Rt=class{constructor(){J(this,"imageResource",C(M.imageResource));J(this,"imageLinkResource",C(M.imageLinkResource));J(this,"audioResource",C(M.audioResource));J(this,"audioEmbedResource",C(M.audioEmbedResource));J(this,"audioLinkResource",C(M.audioLinkResource));J(this,"videoResource",C(M.videoResource));J(this,"videoEmbedResource",C(M.videoEmbedResource));J(this,"videoLinkResource",C(M.videoLinkResource));J(this,"stillImageFilmEmbedResource",C(M.stillImageFilmEmbedResource));J(this,"stillImageFilmLinkResource",C(M.stillImageFilmLinkResource));J(this,"articleResource",C(M.articleResource));J(this,"documentResource",C(M.documentResource));J(this,"documentEmbedResource",C(M.documentEmbedResource));J(this,"documentLinkResource",C(M.documentLinkResource));J(this,"documentDownloadResource",C(M.documentDownloadResource));J(this,"appLinkResource",C(M.appLinkResource));J(this,"websiteLinkResource",C(M.websiteLinkResource));}resourceFromResourceJson(e,r){if(!r)return;let n=!Array.isArray(r),o=n?[r]:r,s=[];for(let i of o){let a=he[i.type];if(!a)continue;let _=i[a.key]??{},{[a.valueField]:d,...l}=_,f=C(a)(void 0,{value:d,...l});f&&s.push(f);}if(s.length!==0)return n?s[0]:s}resourceFromResourceDataJson(e,r,n){if(!n)return;let o=he[r];if(!o)return;let s=typeof n=="string"?n:void 0,i=typeof n=="object"?n:{},{url:a,src:_,body:d,...l}=i,f=a??_??d??s;return C(o)(e,{value:f,...l})}};var nr={string:"string",file:"file"},rr={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},or={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},ir={v2:2,v3:3},sr={v1:1,v2:2},ar={peggy:"peggy"},pr={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},cr={text:"text",json:"json",pojo:"pojo"},_r={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},ur={tag:"tag",body:"body"};var Oe={bold:"bold",light:"light",italic:"italic",highlight:"highlight",highlightOrange:"highlightOrange",highlightYellow:"highlightYellow",highlightGreen:"highlightGreen",highlightBlue:"highlightBlue",highlightPurple:"highlightPurple",highlightPink:"highlightPink",highlightBrown:"highlightBrown",highlightBlack:"highlightBlack",highlightWhite:"highlightWhite",highlightGray:"highlightGray",strike:"strike",subscript:"subscript",superscript:"superscript",ins:"ins",del:"del",underline:"underline",doubleUnderline:"doubleUnderline",circle:"circle",languageEmRed:"languageEmRed",languageEmOrange:"languageEmOrange",languageEmYellow:"languageEmYellow",languageEmGreen:"languageEmGreen",languageEmBlue:"languageEmBlue",languageEmPurple:"languageEmPurple",languageEmPink:"languageEmPink",languageEmBrown:"languageEmBrown",languageEmBlack:"languageEmBlack",languageEmWhite:"languageEmWhite",languageEmGray:"languageEmGray",languageEm:"languageEm",userUnderline:"userUnderline",userDoubleUnderline:"userDoubleUnderline",userStrike:"userStrike",userCircle:"userCircle",userHighlight:"userHighlight",notranslate:"notranslate",link:"link",ref:"ref",xref:"xref",extref:"extref",footnote:"footnote",footnoteStar:"footnote*",symbol:"symbol",var:"var",code:"code",timer:"timer",duration:"duration",color:"color",colorPicker:"colorPicker",comment:"comment"},ve={text:"text",hardBreak:"hardBreak",paragraph:"paragraph",heading:"heading",section:"section",noBulletList:"noBulletList",bulletList:"bulletList",orderedList:"orderedList",orderedListRoman:"orderedListRoman",orderedListRomanLower:"orderedListRomanLower",letteredList:"letteredList",letteredListLower:"letteredListLower",taskList:"taskList",listItem:"listItem",taskItem:"taskItem",image:"image",imageInline:"imageInline",codeBlock:"codeBlock",latex:"latex",gap:"gap",select:"select",highlight:"highlight",mark:"mark"};function dr(t){return t.replace(/-([a-z0-9])/gu,(e,r)=>r.toUpperCase())}var Kt;function _t(){if(!Kt){let t=W(),e=JSON.parse(t.info("all","json","",false,2,true,false,false,"")),r={_standard:"_standard"};for(let{name:n}of e)r[dr(n)]=n;Kt=r;}return Kt}var Te=new Proxy({},{get:(t,e)=>typeof e=="string"?_t()[e]:void 0,has:(t,e)=>typeof e=="string"&&e in _t(),ownKeys:()=>Reflect.ownKeys(_t()),getOwnPropertyDescriptor:(t,e)=>typeof e=="string"&&e in _t()?{value:_t()[e],enumerable:true,configurable:true,writable:false}:void 0});function Fe(t,e){return new Proxy({},{get:(r,n)=>n===Symbol.toPrimitive||n==="toString"||n===Symbol.toStringTag?()=>`[unsupported ${t}]`:$(t,e),has:()=>$(t,e),ownKeys:()=>$(t,e)})}var Ie=Fe("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),Re=Fe("BoundingBoxIndex","bpg-internal bounding-box utility");function U(t,e){return class{constructor(){$(t,e);}}}var lr="the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave",H="internal class of bpg's TS implementation",Ee=U("Ast",lr),Be=U("BitmarkGenerator",H),Se=U("BitmarkStringGenerator",H),Ae=U("BitmarkFileGenerator",H),Pe=U("JsonGenerator",H),je=U("JsonStringGenerator",H),Le=U("JsonFileGenerator",H),We=U("HtmlTableGenerator",H),Ce=U("HtmlTableParser",H),Je=U("BitmarkParser",H),Me=U("JsonParser",H),De=U("StringWriter",H),Ne=U("FileWriter",H),Ve=U("StreamWriter",H);function fr(t,e,r){return r===void 0?{path:t,op:e}:{path:t,op:e,value:r}}var gr="all";function br(t,e={}){let r=D();if(typeof r.lex!="function")throw new nt("lex",Q());return r.lex(t,e.stage??"lex")}function mr(t,e={}){let r=D().convert(t,"bitmark","json",e.mode??"optimized",false,2,1,e.includeUnknownProperties??false,false);if(r.startsWith("error:"))throw new Error(r.slice(6).trim());return JSON.parse(r)}function xr(t,e={}){let r=t.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o}),n=D().convert(JSON.stringify(r),"json","bitmark",e.mode??"optimized",false,2,1,false,false);if(n.startsWith("error:"))throw new Error(n.slice(6).trim());return n}function yr(t,e={}){return D().convert(t,e.inputFormat??"auto",e.outputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1,e.includeUnknownProperties??false,e.mappingReport??false)}function wr(t,e={}){return D().canonicalize(t,e.inputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function kr(t){let e=D().count_bits(t);if(e.startsWith("error:"))throw new Error(e);return Number.parseInt(e,10)}function hr(t){return JSON.parse(D().split_bits(t))}function Or(t,e={}){let r=D();if(e.preHook||e.postHook)return le(r,t,e);let n=e.patch===void 0?"":typeof e.patch=="string"?e.patch:JSON.stringify(e.patch);return r.transform(t,e.inputFormat??"auto",e.outputFormat??"json",e.mode??"optimized",n,e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function Ge(t,e,r={}){let n=D();if(typeof n.diff!="function")throw new nt("diff",Q());let o=n.diff(t,e,r.inputFormat??"auto",r.outputFormat??"bitmark",r.context??3,r.locate??false,r.similarity??.6,r.bboxTolerance??8,r.spacesAroundValues??0);if(o.startsWith("error:"))throw new Error(o.slice(6).trim());return o}function vr(t,e,r={}){return JSON.parse(Ge(t,e,{...r,outputFormat:"json"}))}function Tr(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return D().breakscape_text(t,r,n)}function Fr(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return D().unbreakscape_text(t,r,n)}function Ir(t={}){let e=t.infoType??"list",r=t.format??"text",n=t.bit??"",o=t.pretty??false,s=t.indent??2,i=t.includeDeprecated??false,a=t.onlyDeprecated??false,_=t.full??false,d=typeof t.language=="string"?t.language:t.language?.join(",")??"";return D().info(e,r,n,o,s,i,a,_,d)}function Rr(t){let e=D().register(t.type,t.data);if(e)throw new et(e.replace(/^error:\s*/,""));de(t.type,t.data);}var Er="./wasm/",ze={full:{init:St,initSync:Bt,ns:At,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:jt,initSync:Pt,ns:Lt,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:Ct,initSync:Wt,ns:Jt,wasmFile:"bitmark_json_wasm_bg.wasm"}};ge(()=>D());function qt(t){return t===void 0?Mt:"full"}function Br(t){if(t!==null&&typeof t=="object"&&!(t instanceof URL)&&("feature"in t||"module_or_path"in t)){let r=t;return {feature:r.feature??qt(r.module_or_path),module_or_path:r.module_or_path}}let e=t??void 0;return {feature:qt(e),module_or_path:e}}var He=0,Et,K;async function Zo(t){let{feature:e,module_or_path:r}=Br(t);if(r===void 0){if(!K&&Q()===e)return Et;if(K?.feature===e)return K.promise}let n=++He,o=ze[e],s=r??new URL(`${Er}${o.wasmFile}?v=${ct.version}`,import.meta.url),i=(async()=>{try{let a=await o.init(s);n===He&&(Dt(e,o.ns),Et=a);}finally{K?.seq===n&&(K=void 0);}for(;K;)await K.promise.catch(()=>{});return Et})();return K={feature:e,seq:n,promise:i},i}function ti(t,e={}){let r=e.feature??qt(t),n=ze[r],o=n.initSync(t);return Dt(r,n.ns),Et=o,o}function ei(){return ct.version}function ni(t,e={}){let r=D(),n=Q()??Mt;return fe(r,t,e,(o,s)=>be(o,s,n))}export{gr as ALL_LANGUAGES,yt as NotInitializedError,et as RegisterError,nt as UnsupportedFeatureError,mr as bitmarkToObjects,Tr as breakscapeText,wr as canonicalize,yr as convert,kr as countBits,Ge as diff,vr as diffBits,Ir as info,Zo as init,ti as initSync,Ue as legacy,br as lex,xr as objectsToBitmark,fr as patchEntry,Rr as register,hr as splitBits,Or as transform,ni as transformParallel,Fr as unbreakscapeText,Q as variant,ei as version};//# sourceMappingURL=bitmark-parser.min.js.map
1
+ var de=Object.defineProperty;var _n=(t,e,r)=>e in t?de(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r;var Rt=(t,e)=>{for(var r in e)de(t,r,{get:e[r],enumerable:true});};var J=(t,e,r)=>_n(t,typeof e!="symbol"?e+"":e,r);var Kt={};Rt(Kt,{breakscape_text:()=>fn,canonicalize:()=>In,convert:()=>On,convert_text:()=>wn,count_bits:()=>Fn,default:()=>$t,diff:()=>hn,info:()=>bn,info_text_supported:()=>mn,initSync:()=>zt,is_bitmark:()=>Sn,prettify:()=>En,register:()=>Tn,resolve_patch_document:()=>vn,split_bits:()=>Rn,split_json_bits:()=>Bn,transform:()=>kn,unbreakscape_text:()=>gn});var p,le=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&le.decode();var wt=null;function St(){return (wt===null||wt.byteLength===0)&&(wt=new Uint8Array(p.memory.buffer)),wt}function G(t,e){return t=t>>>0,le.decode(St().subarray(t,t+e))}var Q=new Array(128).fill(void 0);Q.push(void 0,null,true,false);var kt=Q.length;function dn(t){kt===Q.length&&Q.push(Q.length+1);let e=kt;return kt=Q[e],Q[e]=t,e}var O=0,Bt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ln=typeof Bt.encodeInto=="function"?function(t,e){return Bt.encodeInto(t,e)}:function(t,e){let r=Bt.encode(t);return e.set(r),{read:t.length,written:r.length}};function R(t,e,r){if(r===void 0){let i=Bt.encode(t),c=e(i.length,1)>>>0;return St().subarray(c,c+i.length).set(i),O=i.length,c}let n=t.length,o=e(n,1)>>>0,a=St(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=St().subarray(o+s,o+n),c=ln(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return O=s,o}var st=null;function h(){return (st===null||st.buffer.detached===true||st.buffer.detached===void 0&&st.buffer!==p.memory.buffer)&&(st=new DataView(p.memory.buffer)),st}function fn(t,e,r){let n,o;try{let i=p.__wbindgen_add_to_stack_pointer(-16),c=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=O,l=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=O,g=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=O;p.breakscape_text(i,c,_,l,f,g,m);var a=h().getInt32(i+0,!0),s=h().getInt32(i+4,!0);return n=a,o=s,G(a,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function gn(t,e,r){let n,o;try{let i=p.__wbindgen_add_to_stack_pointer(-16),c=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),_=O,l=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),f=O,g=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),m=O;p.unbreakscape_text(i,c,_,l,f,g,m);var a=h().getInt32(i+0,!0),s=h().getInt32(i+4,!0);return n=a,o=s,G(a,s)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(n,o,1);}}function bn(t,e,r,n,o,a,s,i,c){let _,l;try{let m=p.__wbindgen_add_to_stack_pointer(-16),x=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),k=O,b=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),y=O,w=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),v=O,F=R(c,p.__wbindgen_export_0,p.__wbindgen_export_1),L=O;p.info(m,x,k,b,y,w,v,n,o,a,s,i,F,L);var f=h().getInt32(m+0,!0),g=h().getInt32(m+4,!0);return _=f,l=g,G(f,g)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(_,l,1);}}function mn(){return p.info_text_supported()!==0}function yn(t){return Q[t]}function xn(t){t<132||(Q[t]=kt,kt=t);}function Z(t){let e=yn(t);return xn(t),e}function wn(t,e,r,n){let o,a;try{let g=p.__wbindgen_add_to_stack_pointer(-16),m=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O,k=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),b=O,y=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O,v=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),F=O;p.convert_text(g,m,x,k,b,y,w,v,F);var s=h().getInt32(g+0,!0),i=h().getInt32(g+4,!0),c=h().getInt32(g+8,!0),_=h().getInt32(g+12,!0),l=s,f=i;if(_)throw l=0,f=0,Z(c);return o=l,a=f,G(l,f)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(o,a,1);}}function kn(t,e,r,n,o,a,s,i){let c,_;try{let b=p.__wbindgen_add_to_stack_pointer(-16),y=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O,v=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),F=O,L=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),N=O,V=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),U=O,H=R(o,p.__wbindgen_export_0,p.__wbindgen_export_1),Y=O;p.transform(b,y,w,v,F,L,N,V,U,H,Y,a,s,i);var l=h().getInt32(b+0,!0),f=h().getInt32(b+4,!0),g=h().getInt32(b+8,!0),m=h().getInt32(b+12,!0),x=l,k=f;if(m)throw x=0,k=0,Z(g);return c=x,_=k,G(x,k)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(c,_,1);}}function vn(t,e){let r,n;try{let l=p.__wbindgen_add_to_stack_pointer(-16),f=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),g=O,m=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),x=O;p.resolve_patch_document(l,f,g,m,x);var o=h().getInt32(l+0,!0),a=h().getInt32(l+4,!0),s=h().getInt32(l+8,!0),i=h().getInt32(l+12,!0),c=o,_=a;if(i)throw c=0,_=0,Z(s);return r=c,n=_,G(c,_)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}function hn(t,e,r,n,o,a,s,i,c){let _,l;try{let y=p.__wbindgen_add_to_stack_pointer(-16),w=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),v=O,F=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),L=O,N=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),V=O,U=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),H=O;p.diff(y,w,v,F,L,N,V,U,H,o,a,s,i,c);var f=h().getInt32(y+0,!0),g=h().getInt32(y+4,!0),m=h().getInt32(y+8,!0),x=h().getInt32(y+12,!0),k=f,b=g;if(x)throw k=0,b=0,Z(m);return _=k,l=b,G(k,b)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(_,l,1);}}function Tn(t,e){try{let o=p.__wbindgen_add_to_stack_pointer(-16),a=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),s=O,i=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),c=O;p.register(o,a,s,i,c);var r=h().getInt32(o+0,!0),n=h().getInt32(o+4,!0);if(n)throw Z(r)}finally{p.__wbindgen_add_to_stack_pointer(16);}}function On(t,e,r,n,o,a,s,i,c,_,l){let f,g;try{let v=p.__wbindgen_add_to_stack_pointer(-16),F=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),L=O,N=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),V=O,U=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),H=O,Y=R(n,p.__wbindgen_export_0,p.__wbindgen_export_1),gt=O,bt=R(_,p.__wbindgen_export_0,p.__wbindgen_export_1),mt=O,yt=R(l,p.__wbindgen_export_0,p.__wbindgen_export_1),xt=O;p.convert(v,F,L,N,V,U,H,Y,gt,o,a,s,i,c,bt,mt,yt,xt);var m=h().getInt32(v+0,!0),x=h().getInt32(v+4,!0),k=h().getInt32(v+8,!0),b=h().getInt32(v+12,!0),y=m,w=x;if(b)throw y=0,w=0,Z(k);return f=y,g=w,G(y,w)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(f,g,1);}}function In(t,e,r,n,o,a){let s,i;try{let x=p.__wbindgen_add_to_stack_pointer(-16),k=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),b=O,y=R(e,p.__wbindgen_export_0,p.__wbindgen_export_1),w=O,v=R(r,p.__wbindgen_export_0,p.__wbindgen_export_1),F=O;p.canonicalize(x,k,b,y,w,v,F,n,o,a);var c=h().getInt32(x+0,!0),_=h().getInt32(x+4,!0),l=h().getInt32(x+8,!0),f=h().getInt32(x+12,!0),g=c,m=_;if(f)throw g=0,m=0,Z(l);return s=g,i=m,G(g,m)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(s,i,1);}}function Fn(t){let e,r;try{let _=p.__wbindgen_add_to_stack_pointer(-16),l=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),f=O;p.count_bits(_,l,f);var n=h().getInt32(_+0,!0),o=h().getInt32(_+4,!0),a=h().getInt32(_+8,!0),s=h().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,Z(a);return e=i,r=c,G(i,c)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function Rn(t){let e,r;try{let a=p.__wbindgen_add_to_stack_pointer(-16),s=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),i=O;p.split_bits(a,s,i);var n=h().getInt32(a+0,!0),o=h().getInt32(a+4,!0);return e=n,r=o,G(n,o)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function Sn(t){let e=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),r=O;return p.is_bitmark(e,r)!==0}function Bn(t){let e,r;try{let _=p.__wbindgen_add_to_stack_pointer(-16),l=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),f=O;p.split_json_bits(_,l,f);var n=h().getInt32(_+0,!0),o=h().getInt32(_+4,!0),a=h().getInt32(_+8,!0),s=h().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,Z(a);return e=i,r=c,G(i,c)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(e,r,1);}}function En(t,e){let r,n;try{let s=p.__wbindgen_add_to_stack_pointer(-16),i=R(t,p.__wbindgen_export_0,p.__wbindgen_export_1),c=O;p.prettify(s,i,c,e);var o=h().getInt32(s+0,!0),a=h().getInt32(s+4,!0);return r=o,n=a,G(o,a)}finally{p.__wbindgen_add_to_stack_pointer(16),p.__wbindgen_export_2(r,n,1);}}async function An(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function fe(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(G(e,r));return dn(n)},t}function ge(t,e){return p=t.exports,be.__wbindgen_wasm_module=e,st=null,wt=null,p}function zt(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=fe();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return ge(r,t)}async function be(t){if(p!==void 0)return p;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_wasm_bg.wasm",import.meta.url));let e=fe();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await An(await t,e);return ge(r,n)}var $t=be;var Xt={};Rt(Xt,{breakscape_text:()=>Ln,canonicalize:()=>$n,convert:()=>zn,convert_text:()=>Nn,count_bits:()=>Kn,default:()=>Yt,diff:()=>Hn,info:()=>Cn,info_text_supported:()=>Jn,initSync:()=>qt,is_bitmark:()=>Yn,prettify:()=>Qn,register:()=>Gn,resolve_patch_document:()=>Un,split_bits:()=>qn,split_json_bits:()=>Xn,transform:()=>Vn,unbreakscape_text:()=>Wn});var u,me=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&me.decode();var vt=null;function Et(){return (vt===null||vt.byteLength===0)&&(vt=new Uint8Array(u.memory.buffer)),vt}function z(t,e){return t=t>>>0,me.decode(Et().subarray(t,t+e))}var tt=new Array(128).fill(void 0);tt.push(void 0,null,true,false);var ht=tt.length;function jn(t){ht===tt.length&&tt.push(tt.length+1);let e=ht;return ht=tt[e],tt[e]=t,e}var I=0,At=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Pn=typeof At.encodeInto=="function"?function(t,e){return At.encodeInto(t,e)}:function(t,e){let r=At.encode(t);return e.set(r),{read:t.length,written:r.length}};function S(t,e,r){if(r===void 0){let i=At.encode(t),c=e(i.length,1)>>>0;return Et().subarray(c,c+i.length).set(i),I=i.length,c}let n=t.length,o=e(n,1)>>>0,a=Et(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=Et().subarray(o+s,o+n),c=Pn(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return I=s,o}var at=null;function T(){return (at===null||at.buffer.detached===true||at.buffer.detached===void 0&&at.buffer!==u.memory.buffer)&&(at=new DataView(u.memory.buffer)),at}function Ln(t,e,r){let n,o;try{let i=u.__wbindgen_add_to_stack_pointer(-16),c=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),_=I,l=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),f=I,g=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),m=I;u.breakscape_text(i,c,_,l,f,g,m);var a=T().getInt32(i+0,!0),s=T().getInt32(i+4,!0);return n=a,o=s,z(a,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function Wn(t,e,r){let n,o;try{let i=u.__wbindgen_add_to_stack_pointer(-16),c=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),_=I,l=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),f=I,g=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),m=I;u.unbreakscape_text(i,c,_,l,f,g,m);var a=T().getInt32(i+0,!0),s=T().getInt32(i+4,!0);return n=a,o=s,z(a,s)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(n,o,1);}}function Cn(t,e,r,n,o,a,s,i,c){let _,l;try{let m=u.__wbindgen_add_to_stack_pointer(-16),x=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),k=I,b=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),y=I,w=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),v=I,F=S(c,u.__wbindgen_export_0,u.__wbindgen_export_1),L=I;u.info(m,x,k,b,y,w,v,n,o,a,s,i,F,L);var f=T().getInt32(m+0,!0),g=T().getInt32(m+4,!0);return _=f,l=g,z(f,g)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(_,l,1);}}function Jn(){return u.info_text_supported()!==0}function Mn(t){return tt[t]}function Dn(t){t<132||(tt[t]=ht,ht=t);}function et(t){let e=Mn(t);return Dn(t),e}function Nn(t,e,r,n){let o,a;try{let g=u.__wbindgen_add_to_stack_pointer(-16),m=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),x=I,k=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),b=I,y=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),w=I,v=S(n,u.__wbindgen_export_0,u.__wbindgen_export_1),F=I;u.convert_text(g,m,x,k,b,y,w,v,F);var s=T().getInt32(g+0,!0),i=T().getInt32(g+4,!0),c=T().getInt32(g+8,!0),_=T().getInt32(g+12,!0),l=s,f=i;if(_)throw l=0,f=0,et(c);return o=l,a=f,z(l,f)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(o,a,1);}}function Vn(t,e,r,n,o,a,s,i){let c,_;try{let b=u.__wbindgen_add_to_stack_pointer(-16),y=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),w=I,v=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),F=I,L=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),N=I,V=S(n,u.__wbindgen_export_0,u.__wbindgen_export_1),U=I,H=S(o,u.__wbindgen_export_0,u.__wbindgen_export_1),Y=I;u.transform(b,y,w,v,F,L,N,V,U,H,Y,a,s,i);var l=T().getInt32(b+0,!0),f=T().getInt32(b+4,!0),g=T().getInt32(b+8,!0),m=T().getInt32(b+12,!0),x=l,k=f;if(m)throw x=0,k=0,et(g);return c=x,_=k,z(x,k)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(c,_,1);}}function Un(t,e){let r,n;try{let l=u.__wbindgen_add_to_stack_pointer(-16),f=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),g=I,m=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),x=I;u.resolve_patch_document(l,f,g,m,x);var o=T().getInt32(l+0,!0),a=T().getInt32(l+4,!0),s=T().getInt32(l+8,!0),i=T().getInt32(l+12,!0),c=o,_=a;if(i)throw c=0,_=0,et(s);return r=c,n=_,z(c,_)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}function Hn(t,e,r,n,o,a,s,i,c){let _,l;try{let y=u.__wbindgen_add_to_stack_pointer(-16),w=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),v=I,F=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),L=I,N=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),V=I,U=S(n,u.__wbindgen_export_0,u.__wbindgen_export_1),H=I;u.diff(y,w,v,F,L,N,V,U,H,o,a,s,i,c);var f=T().getInt32(y+0,!0),g=T().getInt32(y+4,!0),m=T().getInt32(y+8,!0),x=T().getInt32(y+12,!0),k=f,b=g;if(x)throw k=0,b=0,et(m);return _=k,l=b,z(k,b)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(_,l,1);}}function Gn(t,e){try{let o=u.__wbindgen_add_to_stack_pointer(-16),a=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),s=I,i=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),c=I;u.register(o,a,s,i,c);var r=T().getInt32(o+0,!0),n=T().getInt32(o+4,!0);if(n)throw et(r)}finally{u.__wbindgen_add_to_stack_pointer(16);}}function zn(t,e,r,n,o,a,s,i,c,_,l){let f,g;try{let v=u.__wbindgen_add_to_stack_pointer(-16),F=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),L=I,N=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),V=I,U=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),H=I,Y=S(n,u.__wbindgen_export_0,u.__wbindgen_export_1),gt=I,bt=S(_,u.__wbindgen_export_0,u.__wbindgen_export_1),mt=I,yt=S(l,u.__wbindgen_export_0,u.__wbindgen_export_1),xt=I;u.convert(v,F,L,N,V,U,H,Y,gt,o,a,s,i,c,bt,mt,yt,xt);var m=T().getInt32(v+0,!0),x=T().getInt32(v+4,!0),k=T().getInt32(v+8,!0),b=T().getInt32(v+12,!0),y=m,w=x;if(b)throw y=0,w=0,et(k);return f=y,g=w,z(y,w)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(f,g,1);}}function $n(t,e,r,n,o,a){let s,i;try{let x=u.__wbindgen_add_to_stack_pointer(-16),k=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),b=I,y=S(e,u.__wbindgen_export_0,u.__wbindgen_export_1),w=I,v=S(r,u.__wbindgen_export_0,u.__wbindgen_export_1),F=I;u.canonicalize(x,k,b,y,w,v,F,n,o,a);var c=T().getInt32(x+0,!0),_=T().getInt32(x+4,!0),l=T().getInt32(x+8,!0),f=T().getInt32(x+12,!0),g=c,m=_;if(f)throw g=0,m=0,et(l);return s=g,i=m,z(g,m)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(s,i,1);}}function Kn(t){let e,r;try{let _=u.__wbindgen_add_to_stack_pointer(-16),l=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),f=I;u.count_bits(_,l,f);var n=T().getInt32(_+0,!0),o=T().getInt32(_+4,!0),a=T().getInt32(_+8,!0),s=T().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,et(a);return e=i,r=c,z(i,c)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function qn(t){let e,r;try{let a=u.__wbindgen_add_to_stack_pointer(-16),s=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),i=I;u.split_bits(a,s,i);var n=T().getInt32(a+0,!0),o=T().getInt32(a+4,!0);return e=n,r=o,z(n,o)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Yn(t){let e=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),r=I;return u.is_bitmark(e,r)!==0}function Xn(t){let e,r;try{let _=u.__wbindgen_add_to_stack_pointer(-16),l=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),f=I;u.split_json_bits(_,l,f);var n=T().getInt32(_+0,!0),o=T().getInt32(_+4,!0),a=T().getInt32(_+8,!0),s=T().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,et(a);return e=i,r=c,z(i,c)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(e,r,1);}}function Qn(t,e){let r,n;try{let s=u.__wbindgen_add_to_stack_pointer(-16),i=S(t,u.__wbindgen_export_0,u.__wbindgen_export_1),c=I;u.prettify(s,i,c,e);var o=T().getInt32(s+0,!0),a=T().getInt32(s+4,!0);return r=o,n=a,z(o,a)}finally{u.__wbindgen_add_to_stack_pointer(16),u.__wbindgen_export_2(r,n,1);}}async function Zn(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function ye(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(z(e,r));return jn(n)},t}function xe(t,e){return u=t.exports,we.__wbindgen_wasm_module=e,at=null,vt=null,u}function qt(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=ye();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return xe(r,t)}async function we(t){if(u!==void 0)return u;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_browser_full_wasm_bg.wasm",import.meta.url));let e=ye();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await Zn(await t,e);return xe(r,n)}var Yt=we;var te={};Rt(te,{breakscape_text:()=>nr,canonicalize:()=>_r,convert:()=>ur,convert_text:()=>mr,count_bits:()=>dr,default:()=>Zt,info:()=>or,initSync:()=>Qt,is_bitmark:()=>fr,prettify:()=>br,register:()=>ar,resolve_patch_document:()=>pr,split_bits:()=>lr,split_json_bits:()=>gr,transform:()=>cr,unbreakscape_text:()=>rr});var d,ke=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ke.decode();var Tt=null;function jt(){return (Tt===null||Tt.byteLength===0)&&(Tt=new Uint8Array(d.memory.buffer)),Tt}function K(t,e){return t=t>>>0,ke.decode(jt().subarray(t,t+e))}var nt=new Array(128).fill(void 0);nt.push(void 0,null,true,false);var Ot=nt.length;function tr(t){Ot===nt.length&&nt.push(nt.length+1);let e=Ot;return Ot=nt[e],nt[e]=t,e}var E=0,Pt=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},er=typeof Pt.encodeInto=="function"?function(t,e){return Pt.encodeInto(t,e)}:function(t,e){let r=Pt.encode(t);return e.set(r),{read:t.length,written:r.length}};function A(t,e,r){if(r===void 0){let i=Pt.encode(t),c=e(i.length,1)>>>0;return jt().subarray(c,c+i.length).set(i),E=i.length,c}let n=t.length,o=e(n,1)>>>0,a=jt(),s=0;for(;s<n;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i;}if(s!==n){s!==0&&(t=t.slice(s)),o=r(o,n,n=s+t.length*3,1)>>>0;let i=jt().subarray(o+s,o+n),c=er(t,i);s+=c.written,o=r(o,n,s,1)>>>0;}return E=s,o}var ct=null;function B(){return (ct===null||ct.buffer.detached===true||ct.buffer.detached===void 0&&ct.buffer!==d.memory.buffer)&&(ct=new DataView(d.memory.buffer)),ct}function nr(t,e,r){let n,o;try{let i=d.__wbindgen_add_to_stack_pointer(-16),c=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),_=E,l=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),f=E,g=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),m=E;d.breakscape_text(i,c,_,l,f,g,m);var a=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return n=a,o=s,K(a,s)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(n,o,1);}}function rr(t,e,r){let n,o;try{let i=d.__wbindgen_add_to_stack_pointer(-16),c=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),_=E,l=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),f=E,g=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),m=E;d.unbreakscape_text(i,c,_,l,f,g,m);var a=B().getInt32(i+0,!0),s=B().getInt32(i+4,!0);return n=a,o=s,K(a,s)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(n,o,1);}}function or(t,e,r,n,o,a,s,i,c){let _,l;try{let m=d.__wbindgen_add_to_stack_pointer(-16),x=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),k=E,b=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),y=E,w=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),v=E,F=A(c,d.__wbindgen_export_0,d.__wbindgen_export_1),L=E;d.info(m,x,k,b,y,w,v,n,o,a,s,i,F,L);var f=B().getInt32(m+0,!0),g=B().getInt32(m+4,!0);return _=f,l=g,K(f,g)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(_,l,1);}}function ir(t){return nt[t]}function sr(t){t<132||(nt[t]=Ot,Ot=t);}function rt(t){let e=ir(t);return sr(t),e}function ar(t,e){try{let o=d.__wbindgen_add_to_stack_pointer(-16),a=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),s=E,i=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),c=E;d.register(o,a,s,i,c);var r=B().getInt32(o+0,!0),n=B().getInt32(o+4,!0);if(n)throw rt(r)}finally{d.__wbindgen_add_to_stack_pointer(16);}}function cr(t,e,r,n,o,a,s,i){let c,_;try{let b=d.__wbindgen_add_to_stack_pointer(-16),y=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),w=E,v=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),F=E,L=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),N=E,V=A(n,d.__wbindgen_export_0,d.__wbindgen_export_1),U=E,H=A(o,d.__wbindgen_export_0,d.__wbindgen_export_1),Y=E;d.transform(b,y,w,v,F,L,N,V,U,H,Y,a,s,i);var l=B().getInt32(b+0,!0),f=B().getInt32(b+4,!0),g=B().getInt32(b+8,!0),m=B().getInt32(b+12,!0),x=l,k=f;if(m)throw x=0,k=0,rt(g);return c=x,_=k,K(x,k)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(c,_,1);}}function pr(t,e){let r,n;try{let l=d.__wbindgen_add_to_stack_pointer(-16),f=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),g=E,m=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),x=E;d.resolve_patch_document(l,f,g,m,x);var o=B().getInt32(l+0,!0),a=B().getInt32(l+4,!0),s=B().getInt32(l+8,!0),i=B().getInt32(l+12,!0),c=o,_=a;if(i)throw c=0,_=0,rt(s);return r=c,n=_,K(c,_)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(r,n,1);}}function ur(t,e,r,n,o,a,s,i,c,_,l){let f,g;try{let v=d.__wbindgen_add_to_stack_pointer(-16),F=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),L=E,N=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),V=E,U=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),H=E,Y=A(n,d.__wbindgen_export_0,d.__wbindgen_export_1),gt=E,bt=A(_,d.__wbindgen_export_0,d.__wbindgen_export_1),mt=E,yt=A(l,d.__wbindgen_export_0,d.__wbindgen_export_1),xt=E;d.convert(v,F,L,N,V,U,H,Y,gt,o,a,s,i,c,bt,mt,yt,xt);var m=B().getInt32(v+0,!0),x=B().getInt32(v+4,!0),k=B().getInt32(v+8,!0),b=B().getInt32(v+12,!0),y=m,w=x;if(b)throw y=0,w=0,rt(k);return f=y,g=w,K(y,w)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(f,g,1);}}function _r(t,e,r,n,o,a){let s,i;try{let x=d.__wbindgen_add_to_stack_pointer(-16),k=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),b=E,y=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),w=E,v=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),F=E;d.canonicalize(x,k,b,y,w,v,F,n,o,a);var c=B().getInt32(x+0,!0),_=B().getInt32(x+4,!0),l=B().getInt32(x+8,!0),f=B().getInt32(x+12,!0),g=c,m=_;if(f)throw g=0,m=0,rt(l);return s=g,i=m,K(g,m)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(s,i,1);}}function dr(t){let e,r;try{let _=d.__wbindgen_add_to_stack_pointer(-16),l=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),f=E;d.count_bits(_,l,f);var n=B().getInt32(_+0,!0),o=B().getInt32(_+4,!0),a=B().getInt32(_+8,!0),s=B().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,rt(a);return e=i,r=c,K(i,c)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function lr(t){let e,r;try{let a=d.__wbindgen_add_to_stack_pointer(-16),s=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),i=E;d.split_bits(a,s,i);var n=B().getInt32(a+0,!0),o=B().getInt32(a+4,!0);return e=n,r=o,K(n,o)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function fr(t){let e=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),r=E;return d.is_bitmark(e,r)!==0}function gr(t){let e,r;try{let _=d.__wbindgen_add_to_stack_pointer(-16),l=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),f=E;d.split_json_bits(_,l,f);var n=B().getInt32(_+0,!0),o=B().getInt32(_+4,!0),a=B().getInt32(_+8,!0),s=B().getInt32(_+12,!0),i=n,c=o;if(s)throw i=0,c=0,rt(a);return e=i,r=c,K(i,c)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(e,r,1);}}function br(t,e){let r,n;try{let s=d.__wbindgen_add_to_stack_pointer(-16),i=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),c=E;d.prettify(s,i,c,e);var o=B().getInt32(s+0,!0),a=B().getInt32(s+4,!0);return r=o,n=a,K(o,a)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(r,n,1);}}function mr(t,e,r,n){let o,a;try{let g=d.__wbindgen_add_to_stack_pointer(-16),m=A(t,d.__wbindgen_export_0,d.__wbindgen_export_1),x=E,k=A(e,d.__wbindgen_export_0,d.__wbindgen_export_1),b=E,y=A(r,d.__wbindgen_export_0,d.__wbindgen_export_1),w=E,v=A(n,d.__wbindgen_export_0,d.__wbindgen_export_1),F=E;d.convert_text(g,m,x,k,b,y,w,v,F);var s=B().getInt32(g+0,!0),i=B().getInt32(g+4,!0),c=B().getInt32(g+8,!0),_=B().getInt32(g+12,!0),l=s,f=i;if(_)throw l=0,f=0,rt(c);return o=l,a=f,K(l,f)}finally{d.__wbindgen_add_to_stack_pointer(16),d.__wbindgen_export_2(o,a,1);}}async function yr(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function ve(){let t={};return t.wbg={},t.wbg.__wbindgen_error_new=function(e,r){let n=new Error(K(e,r));return tr(n)},t}function he(t,e){return d=t.exports,Te.__wbindgen_wasm_module=e,ct=null,Tt=null,d}function Qt(t){if(d!==void 0)return d;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=ve();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return he(r,t)}async function Te(t){if(d!==void 0)return d;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("bitmark_json_wasm_bg.wasm",import.meta.url));let e=ve();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await yr(await t,e);return he(r,n)}var Zt=Te;var It={version:"7.0.0"};var ee="browser-full",Wt=class extends Error{constructor(){super("wasm not initialised: call init() (or init({ feature: \u2026 })) first"),this.name="NotInitializedError";}},_t=class extends Error{constructor(e){super(e),this.name="RegisterError";}},dt=class extends Error{constructor(e,r){super(`${e} is not available in the loaded wasm module${r?` (feature: "${r}")`:""}; init({ feature: "full" }) to load it`),this.name="UnsupportedFeatureError";}},Lt,Ie,Oe,Fe=new Map;function D(){if(!Lt&&Oe&&Oe(),!Lt)throw new Wt;return Lt}function ne(t,e){for(let[r,n]of Fe)try{e.register(r,n);}catch(o){throw new _t(o instanceof Error?o.message:String(o))}Lt=e,Ie=t;}function Re(t,e){Fe.set(t,e);}function pt(){return Ie}function xr(t){let e=t.trim();return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):t}function wr(t){return t===void 0?"":typeof t=="string"?t.trim():JSON.stringify(t)}function kr(t,e,r){if(r){let o=JSON.parse(t.split_bits(e));return o.map(a=>({view:{format:"bitmark",index:a.index,total:o.length,source:a.source},source:a.source}))}let n=JSON.parse(t.split_json_bits(e));return n.map((o,a)=>({view:{format:"json",index:a,total:n.length,bit:o.bit??{}},source:JSON.stringify([o])}))}function re(t,e,r){let n=r.mode??"optimized",o=r.outputFormat??"json",a=r.spacesAroundValues??1,s=r.indent??2,i=r.pretty??false,c=r.inputFormat??"auto",_=c==="bitmark"||c!=="json"&&t.is_bitmark(e),l=_?"bitmark":"json",f=kr(t,e,_),g=f.length,m=[];for(let w=0;w<g;w++){let{view:v}=f[w];v.index=w,v.total=g;let F=r.preHook?r.preHook(v)||{}:{};m.push(F.drop?null:{patches:F.patches??[],outputFormat:F.outputFormat??o});}let x=wr(r.patch),k;x===""?k=f.map((w,v)=>({source:v,bit:null,patch:[]})):k=JSON.parse(t.resolve_patch_document(e,x));let b=[],y=[];for(let w of k)if(w.source!==null){let v=m[w.source];if(!v)continue;b.push({index:w.source,source:f[w.source].source,inputFormat:l,outputFormat:v.outputFormat,mode:n,patchJson:JSON.stringify([...w.patch,...v.patches]),spacesAroundValues:a}),y.push(f[w.source].view);}else {let v=w.bit??{},F=b.length;b.push({index:F,source:JSON.stringify([{bit:v}]),inputFormat:"json",outputFormat:o,mode:n,patchJson:JSON.stringify(w.patch),spacesAroundValues:a}),y.push({format:"json",index:F,total:g,bit:v});}return {jobs:b,views:y,output:o,pretty:i,indent:s}}function vr(t,e){let r=t.transform(e.source,e.inputFormat,e.outputFormat,e.mode,e.patchJson,false,2,e.spacesAroundValues);return e.outputFormat==="json"?xr(r):r}function oe(t,e,r,n,o){if(r==="bitmark"||r==="text")return e.join(`
2
+ `);let a=`[${e.join(",")}]`;return n?t.prettify(a,o):a}function Se(t,e,r){let n=re(t,e,r),o=[];for(let a=0;a<n.jobs.length;a++){let s=vr(t,n.jobs[a]);r.postHook?.(n.views[a],s),o.push(s);}return oe(t,o,n.output,n.pretty,n.indent)}async function Be(t,e,r,n){let o=re(t,e,r),a=await n(o.jobs,r.workers??4);for(let s=0;s<a.length;s++)r.postHook?.(o.views[s],a[s]);return oe(t,a,o.output,o.pretty,o.indent)}var ie;function Ee(t){ie=t;}function W(){if(!ie)throw new Error("legacy API not initialised: the WASM module has not been provided (browser consumers must call init() first)");return ie()}function Ae(t,e,r){if(t.length===0)return Promise.resolve([]);let n=Math.max(1,Math.min(e,t.length)),o=new URL("./worker-entry.js",import.meta.url);return new Promise((a,s)=>{let i=new Array(t.length),c=0,_=0,l=false,f=[],g=()=>{for(let k of f)k.terminate();},m=k=>{l||(l=true,g(),s(k));},x=k=>{if(l||c>=t.length)return;let b=c++;k.postMessage({id:b,job:t[b],feature:r});};for(let k=0;k<n;k++){let b=new Worker(o,{type:"module"});f.push(b),b.onmessage=y=>{let w=y.data;if(!l){if(!w.ok){m(new Error(w.error??"worker job failed"));return}if(i[w.id]=w.element,_++,_===t.length){l=true,g(),a(i);return}x(b);}},b.onerror=y=>m(new Error(y.message||"worker error"));}for(let k of f)x(k);})}var sn={};Rt(sn,{Ast:()=>Ge,BitType:()=>Ne,BitmarkFileGenerator:()=>Ke,BitmarkGenerator:()=>ze,BitmarkParser:()=>tn,BitmarkParserGenerator:()=>Ut,BitmarkParserType:()=>jr,BitmarkStringGenerator:()=>$e,BitmarkVersion:()=>Er,BodyTextFormat:()=>Wr,BoundingBoxIndex:()=>He,Builder:()=>Vt,CardSetVersion:()=>Ar,FileWriter:()=>rn,HtmlTableGenerator:()=>Qe,HtmlTableParser:()=>Ze,InfoFormat:()=>Lr,InfoType:()=>Pr,Input:()=>Rr,InputFormat:()=>Br,JsonFileGenerator:()=>Xe,JsonGenerator:()=>qe,JsonParser:()=>en,JsonStringGenerator:()=>Ye,LegacyUnsupportedError:()=>lt,NodeType:()=>Ue,Output:()=>Sr,ResourceBuilder:()=>Ht,StreamWriter:()=>on,StringWriter:()=>nn,TextLocation:()=>Cr,TextMarkType:()=>Me,TextNodeType:()=>De,bitmarkTextParse:()=>Ce,isPseudoAst:()=>Pe});var lt=class extends Error{constructor(e){super(e),this.name="LegacyUnsupportedError";}};function ot(t,e){throw new lt(`'${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}function X(t,e){throw new lt(`Option '${t}' is not supported by the @gmb/bitmark-parser legacy API`+(e?`: ${e}`:""))}var se="bitmark v2 output is not supported (this parser is bitmark v3 only)";function ae(t){t.bitmarkVersion===2&&X("bitmarkVersion: 2",se);}function Jt(t){t.explicitTextFormat&&X("bitmarkOptions.explicitTextFormat"),t.cardSetVersion===1&&X("bitmarkOptions.cardSetVersion: 1",se),t.debugGenerationInline&&X("bitmarkOptions.debugGenerationInline"),t.noBreakscaping&&X("bitmarkOptions.noBreakscaping");}function Mt(t){t.textAsPlainText&&X("jsonOptions.textAsPlainText",se),t.debugGenerationInline&&X("jsonOptions.debugGenerationInline");}function ut(t){return t===true?{pretty:true,indent:2}:typeof t=="number"&&t>0?{pretty:true,indent:t}:{pretty:false,indent:2}}function Dt(t){return t===void 0||t===true?1:t===false?0:Math.max(0,Math.min(10,t))}function Nt(t){switch(t){case "text":case "latex":case "json":case "xml":return "plainText";default:return "bitmark++"}}var je=Symbol.for("@gmb/bitmark-parser/legacy-pseudo-ast");function ft(t){let e={bits:t};return Object.defineProperty(e,je,{value:true,enumerable:false}),e}function Pe(t){return t!==null&&typeof t=="object"&&(je in t||Array.isArray(t.bits))}var Le={"extractor-image":{key:"images",resourceType:"image"},"extractor-image-collapsible":{key:"images",resourceType:"image"},"images-logo-grave":{key:"logos",resourceType:"image"},"prototype-images":{key:"images",resourceType:"image"}};var ce=Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser"),Tr={bitType:"type",textFormat:"format",flashcards:"cards",markConfig:"marks"},Or={"bitmark--":"bitmark++","bitmark+":"bitmark++"},Ir={bitmark:"bitmark++",text:"text",json:"json",latex:"latex",xml:"xml"},Fr=["title","subtitle","item","lead","pageNumber","marginNumber","hint","instruction","caption"],Vt=class{buildBitmark(e){let r=ft(e.bits??[]);return e.errors!==void 0&&(r.errors=e.errors),r}buildBit(e,r){let n=W(),o={...e},a=o.bitType,s=this.getBitConfig(a),i={};i.type=a,o.isCommented&&(i.type="_comment",i.originalType=a),delete o.bitType,delete o.isCommented;let c=o.textFormat;c!==void 0?(i.format=Or[c]??c,delete o.textFormat):i.format=Ir[s.bodyFormat??""]??"bitmark++",delete o.resourceType;let _=o.body;_!=null&&typeof _=="object"&&"body"in _&&(i.body=_.body,delete o.body),o.example!==void 0?(i.isExample=true,i.example=o.example,delete o.example,delete o.__isDefaultExample):o.__isDefaultExample&&(i.isExample=true,delete o.__isDefaultExample);let l=o.resources;if(l!==void 0&&a!==void 0){let b=Array.isArray(l)?l:[l],y=Le[a];y?i[y.key]=b.filter(w=>w!==null&&typeof w=="object"&&w.type===y.resourceType):b.length>=1&&(i.resource=b[0]),delete o.resources;}let f=o.parser;delete o.parser;let g=o.extraProperties;delete o.extraProperties;for(let[b,y]of Object.entries(o))y!==void 0&&(i[Tr[b]??b]=y);if(g)for(let[b,y]of Object.entries(g))b in i||(i[b]=y);this.parseStringTexts(i);let m=n.convert(JSON.stringify([{bit:i}]),"json","json","optimized",false,2,1,false,false,"",""),k=JSON.parse(m)[0]?.bit??i;for(let[b,y]of Object.entries(i))b in k||y===false||y===""||y===null||Array.isArray(y)&&y.length===0||(k[b]=y);return f!==void 0&&Object.defineProperty(k,ce,{value:f,enumerable:false}),k}buildHighlight(e,r){if(!r)return;let n={...r},o=n.attrs;return o&&Object.assign(n,o),{type:"highlight",texts:Array.isArray(n.texts)?n.texts.filter(i=>i!=null).map(i=>({text:i.text??"",isCorrect:i.isCorrect??false,isHighlighted:i.isHighlighted??false,...We(i,["text","isCorrect","isHighlighted"])})):[],prefix:n.prefix??"",postfix:n.postfix??"",...We(n,["type","texts","prefix","postfix","attrs"]),attrs:{}}}parseStringTexts(e){let r=W(),n=(s,i)=>{if(s==="")return s;let c=r.convert_text(s,"textToAst","bitmark++",i);try{return JSON.parse(c)}catch{return s}},o=e.format,a=o===void 0||o==="bitmark++"||o==="bitmark+";if(typeof e.body=="string")if(o==="json")try{e.body=JSON.parse(e.body);}catch{e.body=null;}else a&&(e.body=n(e.body,"body"));for(let s of Fr){let i=e[s];typeof i=="string"&&(e[s]=n(i,"tag"));}}getBitConfig(e){let r=W();if(e!==void 0)try{let n=JSON.parse(r.info("bit","json",e,!1,2,!1,!1,!0,""));if(n.error===void 0)return {bodyFormat:n.body?.format}}catch{}throw new Error(`No config found for bit: ${e}`)}};function We(t,e){let r={};for(let[n,o]of Object.entries(t))o!==void 0&&!e.includes(n)&&(r[n]=o);return r}var Ut=class{version(){return It.version}convert(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);ae(n),Jt(a),Mt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:c}=this.resolveInput(e,n.inputFormat),_=n.outputFormat??(c?"json":"bitmark"),l=_==="ast"?"json":_,{pretty:f,indent:g}=ut(o.prettify),m=l==="bitmark"?ut(a.prettifyJson):{pretty:f,indent:g},x=Dt(a.spacesAroundValues),k=!o.excludeUnknownProperties,b=s.convert(i,c?"bitmark":"json",l,"optimized",m.pretty,m.indent,x,k,false,"","");if(_==="bitmark"||_==="text")return this.deliver(b,n.outputFile,n.fileOptions);if(_==="json")return n.outputFile?this.deliver(b,n.outputFile,n.fileOptions):f||o.stringify?b:JSON.parse(b);let y=ft(JSON.parse(b));return n.outputFile?this.deliver(JSON.stringify(y),n.outputFile,n.fileOptions):y}upgrade(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);ae(n),Jt(a),Mt(o),this.checkBrowserFileWrite(n.outputFile);let s=W(),{source:i,isBitmark:c}=this.resolveInput(e,n.inputFormat),{pretty:_,indent:l}=ut(c?a.prettifyJson:o.prettify),f=Dt(a.spacesAroundValues),g=s.canonicalize(i,c?"bitmark":"json","optimized",_,l,f);return c?this.deliver(g,n.outputFile,n.fileOptions):n.outputFile?this.deliver(g,n.outputFile,n.fileOptions):_||o.stringify?g:JSON.parse(g)}info(e){let r=Object.assign({},e),n=W(),o=r.type??"list",a=r.outputFormat??"text",{pretty:s,indent:i}=ut(r.prettify),c=a==="pojo"?"json":a,_=n.info(o,c,r.bit??"",s,i,false,false,true,"");return a==="pojo"?JSON.parse(_):_}generateConfig(e){ot("BitmarkParserGenerator.generateConfig","bpg-internal development tool");}convertHtmlTable(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions),a=Object.assign({},n.bitmarkOptions);Jt(a),Mt(o),n.keepUnknownTags&&X("keepUnknownTags"),n.noBreakscaping&&X("noBreakscaping"),this.checkBrowserFileWrite(n.outputFile);let s=W(),i=typeof e=="string"?this.maybeReadFile(e,void 0):"";if(!(n.inputFormat==="html"||n.inputFormat===void 0&&typeof e=="string"&&/<table[\s>]/iu.test(i))){let{source:w,isBitmark:v}=this.resolveInput(e,void 0),F=s.convert(w,v?"bitmark":"json","html","optimized",false,2,1,false,false,"","");return this.deliver(pe(F).join(`
3
+ `),n.outputFile,n.fileOptions)}let _=n.tableFormat==="table"?"table":"table-extended",l=pe(i).map(w=>`<bitmark-bit data-type="${_}" data-format="bitmark++">${w}</bitmark-bit>`).join(""),f=n.outputFormat??"bitmark",{pretty:g,indent:m}=ut(o.prettify),x=Dt(a.spacesAroundValues);if(f==="html"){let w=s.convert(l,"html","html","optimized",false,2,1,false,false,"","");return this.deliver(pe(w).join(`
4
+ `),n.outputFile,n.fileOptions)}let k=f==="ast"?"json":f,b=s.convert(l,"html",k,"optimized",g,m,x,false,false,"","");if(f==="bitmark"||f==="text")return this.deliver(b,n.outputFile,n.fileOptions);if(f==="json")return n.outputFile?this.deliver(b,n.outputFile,n.fileOptions):g||o.stringify?b:JSON.parse(b);let y=ft(JSON.parse(b));return n.outputFile?this.deliver(JSON.stringify(y),n.outputFile,n.fileOptions):y}createAst(e,r){let n=Object.assign({},r),o=W(),{source:a,isBitmark:s}=this.resolveInput(e,n.inputFormat),i=o.convert(a,s?"bitmark":"json","json","optimized",false,2,1,true,false,"","");return ft(JSON.parse(i))}breakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.breakscape_text(a,Nt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}unbreakscapeText(e,r){if(!e)return e;let n=Object.assign({},r);this.checkBrowserFileWrite(n.outputFile);let o=W(),a=this.maybeReadFile(e,n.inputFormat),s=o.unbreakscape_text(a,Nt(n.textFormat),n.textLocation??"body");return this.deliver(s,n.outputFile,n.fileOptions)}convertText(e,r){let n=Object.assign({},r),o=Object.assign({},n.jsonOptions);this.checkBrowserFileWrite(n.outputFile);let a=W(),s=n.textFormat===void 0||Nt(n.textFormat)==="bitmark++",i=n.textLocation??"body",c,_;if(typeof e=="string"?(c=this.maybeReadFile(e,n.inputFormat),_=this.parseTextAstString(c)):(c=JSON.stringify(e),_=Array.isArray(e)?e:void 0),_!==void 0){let x=s?a.convert_text(JSON.stringify(_),"astToText","bitmark++",i):a.convert_text(JSON.stringify(_),"astToPlainText","plainText",i);return this.deliver(x,n.outputFile,n.fileOptions)}let l=a.convert_text(c,"textToAst",s?"bitmark++":"plainText","body"),{pretty:f,indent:g}=ut(o.prettify),m=f?a.prettify(l,g):l;return n.outputFile?this.deliver(m,n.outputFile,n.fileOptions):f?m:JSON.parse(l)}textAstToPlainText(e,r){return W().convert_text(typeof e=="string"?e:JSON.stringify(e),"astToPlainText","bitmark++","body")}extractPlainText(e,r){let n=r?.inputFormat,o=W();if(n==="plainText")return typeof e=="string"?String(e):"";if(n==="bitmarkText"){let c=o.convert_text(String(e),"textToAst","bitmark++","body");return o.convert_text(c,"astToPlainText","bitmark++","body")}if(typeof e=="string"&&this.parseTextAstString(e)===void 0&&!o.is_bitmark(e)&&!(()=>{try{return JSON.parse(e),!0}catch{return false}})())return this.extractPlainText(e,{inputFormat:"bitmarkText"});let{source:a,isBitmark:s}=this.resolveInput(e,void 0);return o.convert(a,s?"bitmark":"json","text","optimized",false,2,1,false,false,"","")}parseTextAstString(e){let r=e.trim();if(r.startsWith("["))try{let n=JSON.parse(r);if(Array.isArray(n)&&n.every(o=>o!==null&&typeof o=="object"&&"type"in o))return n}catch{}}resolveInput(e,r){if(typeof e!="string"){let a=this.jsonEntries(e);return {source:JSON.stringify(a?a.map(s=>this.toWrapperEntry(s)):e),isBitmark:false}}let n=this.maybeReadFile(e,r);if(W().is_bitmark(n))return {source:n,isBitmark:true};try{let a=JSON.parse(n),s=this.jsonEntries(a);if(s)return {source:JSON.stringify(s.map(i=>this.toWrapperEntry(i))),isBitmark:!1}}catch{return {source:n,isBitmark:true}}return {source:n,isBitmark:false}}jsonEntries(e){if(Array.isArray(e))return e;if(e!==null&&typeof e=="object"){let r=e;if(Array.isArray(r.bits))return r.bits;if("bit"in r)return [r];if(typeof r.type=="string")return [{bit:r}]}}toWrapperEntry(e){if(e!==null&&typeof e=="object"&&"bit"in e)return e;let r={bit:e},n=e?.[ce];return n!==void 0&&(r.parser=n),r}maybeReadFile(e,r){if(r==="string")return e;return e;}checkBrowserFileWrite(e){if(e&&true)throw new Error("Cannot write to file in browser environment")}deliver(e,r,n){if(!r)return e;throw new Error("Cannot write to file in browser environment");}};function pe(t){let e=[],r=t.toLowerCase(),n=0;for(;;){let o=r.indexOf("<table",n);if(o===-1)break;let a=0,s=o,i=-1;for(;s<t.length;){let c=r.indexOf("<table",s),_=r.indexOf("</table",s);if(_===-1)break;if(c!==-1&&c<_)a++,s=c+6;else {a--;let l=r.indexOf(">",_);if(s=l===-1?t.length:l+1,a===0){i=s;break}}}if(i===-1)break;e.push(t.slice(o,i)),n=i;}return e}function Ce(t){let e=W().convert_text(t,"textToAst","bitmark++","body");return JSON.parse(e)}var M={imageResource:{type:"image",key:"image",valueField:"src"},imageLinkResource:{type:"image-link",key:"imageLink",valueField:"url"},audioResource:{type:"audio",key:"audio",valueField:"src"},audioEmbedResource:{type:"audio-embed",key:"audioEmbed",valueField:"src"},audioLinkResource:{type:"audio-link",key:"audioLink",valueField:"url"},videoResource:{type:"video",key:"video",valueField:"src"},videoEmbedResource:{type:"video-embed",key:"videoEmbed",valueField:"url"},videoLinkResource:{type:"video-link",key:"videoLink",valueField:"url"},stillImageFilmEmbedResource:{type:"still-image-film-embed",key:"stillImageFilmEmbed",valueField:"url"},stillImageFilmLinkResource:{type:"still-image-film-link",key:"stillImageFilmLink",valueField:"url"},articleResource:{type:"article",key:"article",valueField:"body"},documentResource:{type:"document",key:"document",valueField:"url"},documentEmbedResource:{type:"document-embed",key:"documentEmbed",valueField:"url"},documentLinkResource:{type:"document-link",key:"documentLink",valueField:"url"},documentDownloadResource:{type:"document-download",key:"documentDownload",valueField:"url"},appLinkResource:{type:"app-link",key:"appLink",valueField:"url"},websiteLinkResource:{type:"website-link",key:"websiteLink",valueField:"url"}};function C(t){return (e,r,n)=>{if(!r)return;let{value:o,...a}=r,s={[t.valueField]:o??""};for(let[i,c]of Object.entries(a))c!==void 0&&(s[i]=c);return {type:t.type,[t.key]:s}}}var Je=Object.fromEntries(Object.values(M).map(t=>[t.type,t])),Ht=class{constructor(){J(this,"imageResource",C(M.imageResource));J(this,"imageLinkResource",C(M.imageLinkResource));J(this,"audioResource",C(M.audioResource));J(this,"audioEmbedResource",C(M.audioEmbedResource));J(this,"audioLinkResource",C(M.audioLinkResource));J(this,"videoResource",C(M.videoResource));J(this,"videoEmbedResource",C(M.videoEmbedResource));J(this,"videoLinkResource",C(M.videoLinkResource));J(this,"stillImageFilmEmbedResource",C(M.stillImageFilmEmbedResource));J(this,"stillImageFilmLinkResource",C(M.stillImageFilmLinkResource));J(this,"articleResource",C(M.articleResource));J(this,"documentResource",C(M.documentResource));J(this,"documentEmbedResource",C(M.documentEmbedResource));J(this,"documentLinkResource",C(M.documentLinkResource));J(this,"documentDownloadResource",C(M.documentDownloadResource));J(this,"appLinkResource",C(M.appLinkResource));J(this,"websiteLinkResource",C(M.websiteLinkResource));}resourceFromResourceJson(e,r){if(!r)return;let n=!Array.isArray(r),o=n?[r]:r,a=[];for(let s of o){let i=Je[s.type];if(!i)continue;let c=s[i.key]??{},{[i.valueField]:_,...l}=c,f=C(i)(void 0,{value:_,...l});f&&a.push(f);}if(a.length!==0)return n?a[0]:a}resourceFromResourceDataJson(e,r,n){if(!n)return;let o=Je[r];if(!o)return;let a=typeof n=="string"?n:void 0,s=typeof n=="object"?n:{},{url:i,src:c,body:_,...l}=s,f=i??c??_??a;return C(o)(e,{value:f,...l})}};var Rr={string:"string",file:"file"},Sr={bitmark:"bitmark",json:"json",ast:"ast",text:"text"},Br={bitmark:"bitmark",bitmarkText:"bitmarkText",plainText:"plainText",html:"html"},Er={v2:2,v3:3},Ar={v1:1,v2:2},jr={peggy:"peggy"},Pr={list:"list",deprecated:"deprecated",all:"all",bit:"bit"},Lr={text:"text",json:"json",pojo:"pojo"},Wr={plainText:"text",latex:"latex",json:"json",xml:"xml",bitmarkPlusPlus:"bitmark++"},Cr={tag:"tag",body:"body"};var Me={bold:"bold",light:"light",italic:"italic",highlight:"highlight",highlightOrange:"highlightOrange",highlightYellow:"highlightYellow",highlightGreen:"highlightGreen",highlightBlue:"highlightBlue",highlightPurple:"highlightPurple",highlightPink:"highlightPink",highlightBrown:"highlightBrown",highlightBlack:"highlightBlack",highlightWhite:"highlightWhite",highlightGray:"highlightGray",strike:"strike",subscript:"subscript",superscript:"superscript",ins:"ins",del:"del",underline:"underline",doubleUnderline:"doubleUnderline",circle:"circle",languageEmRed:"languageEmRed",languageEmOrange:"languageEmOrange",languageEmYellow:"languageEmYellow",languageEmGreen:"languageEmGreen",languageEmBlue:"languageEmBlue",languageEmPurple:"languageEmPurple",languageEmPink:"languageEmPink",languageEmBrown:"languageEmBrown",languageEmBlack:"languageEmBlack",languageEmWhite:"languageEmWhite",languageEmGray:"languageEmGray",languageEm:"languageEm",userUnderline:"userUnderline",userDoubleUnderline:"userDoubleUnderline",userStrike:"userStrike",userCircle:"userCircle",userHighlight:"userHighlight",notranslate:"notranslate",link:"link",ref:"ref",xref:"xref",extref:"extref",footnote:"footnote",footnoteStar:"footnote*",symbol:"symbol",var:"var",code:"code",timer:"timer",duration:"duration",color:"color",colorPicker:"colorPicker",comment:"comment"},De={text:"text",hardBreak:"hardBreak",paragraph:"paragraph",heading:"heading",section:"section",noBulletList:"noBulletList",bulletList:"bulletList",orderedList:"orderedList",orderedListRoman:"orderedListRoman",orderedListRomanLower:"orderedListRomanLower",letteredList:"letteredList",letteredListLower:"letteredListLower",taskList:"taskList",listItem:"listItem",taskItem:"taskItem",image:"image",imageInline:"imageInline",codeBlock:"codeBlock",latex:"latex",gap:"gap",select:"select",highlight:"highlight",mark:"mark"};function Jr(t){return t.replace(/-([a-z0-9])/gu,(e,r)=>r.toUpperCase())}var ue;function Ft(){if(!ue){let t=W(),e=JSON.parse(t.info("all","json","",false,2,true,false,false,"")),r={_standard:"_standard"};for(let{name:n}of e)r[Jr(n)]=n;ue=r;}return ue}var Ne=new Proxy({},{get:(t,e)=>typeof e=="string"?Ft()[e]:void 0,has:(t,e)=>typeof e=="string"&&e in Ft(),ownKeys:()=>Reflect.ownKeys(Ft()),getOwnPropertyDescriptor:(t,e)=>typeof e=="string"&&e in Ft()?{value:Ft()[e],enumerable:true,configurable:true,writable:false}:void 0});function Ve(t,e){return new Proxy({},{get:(r,n)=>n===Symbol.toPrimitive||n==="toString"||n===Symbol.toStringTag?()=>`[unsupported ${t}]`:ot(t,e),has:()=>ot(t,e),ownKeys:()=>ot(t,e)})}var Ue=Ve("NodeType","it names bpg's internal AST nodes; the legacy AST is bit JSON (see createAst)"),He=Ve("BoundingBoxIndex","bpg-internal bounding-box utility");function $(t,e){return class{constructor(){ot(t,e);}}}var Mr="the legacy AST is bit JSON, not bpg's internal node model; walking it with bpg NodeType names would silently misbehave",q="internal class of bpg's TS implementation",Ge=$("Ast",Mr),ze=$("BitmarkGenerator",q),$e=$("BitmarkStringGenerator",q),Ke=$("BitmarkFileGenerator",q),qe=$("JsonGenerator",q),Ye=$("JsonStringGenerator",q),Xe=$("JsonFileGenerator",q),Qe=$("HtmlTableGenerator",q),Ze=$("HtmlTableParser",q),tn=$("BitmarkParser",q),en=$("JsonParser",q),nn=$("StringWriter",q),rn=$("FileWriter",q),on=$("StreamWriter",q);function Dr(t,e,r){return r===void 0?{path:t,op:e}:{path:t,op:e,value:r}}var Nr="all";function Vr(t,e={}){let r=D().convert(t,"bitmark","json",e.mode??"optimized",false,2,1,e.includeUnknownProperties??false,false,"","");return JSON.parse(r)}function Ur(t,e={}){let r=t.map(o=>o!==null&&typeof o=="object"&&"bit"in o&&typeof o.bit=="object"?o:{bit:o});return D().convert(JSON.stringify(r),"json","bitmark",e.mode??"optimized",false,2,1,false,false,"","")}function an(t,e={}){return D().convert(t,e.inputFormat??"auto",e.outputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1,e.includeUnknownProperties??false,e.mappingReport??false,e.positionEncoding??"",e.tokensLayout??"")}function Hr(t,e={}){return JSON.parse(an(t,{inputFormat:"bitmark",outputFormat:"semantic-tokens",positionEncoding:e.positionEncoding,tokensLayout:e.tokensLayout}))}function Gr(t,e={}){return D().canonicalize(t,e.inputFormat??"auto",e.mode??"optimized",e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function zr(t){return Number.parseInt(D().count_bits(t),10)}function $r(t){return JSON.parse(D().split_bits(t))}function Kr(t,e={}){let r=D();if(e.preHook||e.postHook)return Se(r,t,e);let n=e.patch===void 0?"":typeof e.patch=="string"?e.patch:JSON.stringify(e.patch);return r.transform(t,e.inputFormat??"auto",e.outputFormat??"json",e.mode??"optimized",n,e.pretty??false,e.indent??2,e.spacesAroundValues??1)}function cn(t,e,r={}){let n=D();if(typeof n.diff!="function")throw new dt("diff",pt());return n.diff(t,e,r.inputFormat??"auto",r.outputFormat??"bitmark",r.context??3,r.locate??false,r.similarity??.6,r.bboxTolerance??8,r.spacesAroundValues??0)}function qr(t,e,r={}){return JSON.parse(cn(t,e,{...r,outputFormat:"json"}))}function Yr(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return D().breakscape_text(t,r,n)}function Xr(t,e={}){let r=e.format??"bitmark++",n=e.location??"body";return D().unbreakscape_text(t,r,n)}function Qr(t={}){let e=t.infoType??"list",r=t.format??"text",n=t.bit??"",o=t.pretty??false,a=t.indent??2,s=t.includeDeprecated??false,i=t.onlyDeprecated??false,c=t.full??false,_=typeof t.language=="string"?t.language:t.language?.join(",")??"",l=D();if(r!=="json"&&typeof l.info_text_supported!="function")throw new dt('info (format: "text")',pt());return l.info(e,r,n,o,a,s,i,c,_)}function Zr(t){try{D().register(t.type,t.data);}catch(e){throw new _t(e instanceof Error?e.message:String(e))}Re(t.type,t.data);}var to="./wasm/",un={full:{init:$t,initSync:zt,ns:Kt,wasmFile:"bitmark_wasm_bg.wasm"},"browser-full":{init:Yt,initSync:qt,ns:Xt,wasmFile:"bitmark_browser_full_wasm_bg.wasm"},"bitmark-json":{init:Zt,initSync:Qt,ns:te,wasmFile:"bitmark_json_wasm_bg.wasm"}};Ee(()=>D());function _e(t){return t===void 0?ee:"full"}function eo(t){if(t!==null&&typeof t=="object"&&!(t instanceof URL)&&("feature"in t||"module_or_path"in t)){let r=t;return {feature:r.feature??_e(r.module_or_path),module_or_path:r.module_or_path}}let e=t??void 0;return {feature:_e(e),module_or_path:e}}var pn=0,Gt,it;async function Ti(t){let{feature:e,module_or_path:r}=eo(t);if(r===void 0){if(!it&&pt()===e)return Gt;if(it?.feature===e)return it.promise}let n=++pn,o=un[e],a=r??new URL(`${to}${o.wasmFile}?v=${It.version}`,import.meta.url),s=(async()=>{try{let i=await o.init(a);n===pn&&(ne(e,o.ns),Gt=i);}finally{it?.seq===n&&(it=void 0);}for(;it;)await it.promise.catch(()=>{});return Gt})();return it={feature:e,seq:n,promise:s},s}function Oi(t,e={}){let r=e.feature??_e(t),n=un[r],o=n.initSync(t);return ne(r,n.ns),Gt=o,o}function Ii(){return It.version}function Fi(t,e={}){let r=D(),n=pt()??ee;return Be(r,t,e,(o,a)=>Ae(o,a,n))}export{Nr as ALL_LANGUAGES,Wt as NotInitializedError,_t as RegisterError,dt as UnsupportedFeatureError,Vr as bitmarkToObjects,Yr as breakscapeText,Gr as canonicalize,an as convert,zr as countBits,cn as diff,qr as diffBits,Qr as info,Ti as init,Oi as initSync,sn as legacy,Ur as objectsToBitmark,Dr as patchEntry,Zr as register,Hr as semanticTokens,$r as splitBits,Kr as transform,Fi as transformParallel,Xr as unbreakscapeText,pt as variant,Ii as version};//# sourceMappingURL=bitmark-parser.min.js.map
5
5
  //# sourceMappingURL=bitmark-parser.min.js.map