You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@gmb/bitmark-parser

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gmb/bitmark-parser - npm Package Compare versions

Comparing version
3.0.1-alpha.3
to
3.0.1-alpha.4
+1
-1
dist/browser/bitmark-parser.min.js

@@ -1,2 +0,2 @@

var t,d=0,m=null;function k(){return (m===null||m.byteLength===0)&&(m=new Uint8Array(t.memory.buffer)),m}var v=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},O=typeof v.encodeInto=="function"?function(e,r){return v.encodeInto(e,r)}:function(e,r){let _=v.encode(e);return r.set(_),{read:e.length,written:_.length}};function f(e,r,_){if(_===void 0){let i=v.encode(e),a=r(i.length,1)>>>0;return k().subarray(a,a+i.length).set(i),d=i.length,a}let o=e.length,s=r(o,1)>>>0,c=k(),n=0;for(;n<o;n++){let i=e.charCodeAt(n);if(i>127)break;c[s+n]=i;}if(n!==o){n!==0&&(e=e.slice(n)),s=_(s,o,o=n+e.length*3,1)>>>0;let i=k().subarray(s+n,s+o),a=O(e,i);n+=a.written,s=_(s,o,n,1)>>>0;}return d=n,s}var w=null;function b(){return (w===null||w.buffer.detached===true||w.buffer.detached===void 0&&w.buffer!==t.memory.buffer)&&(w=new DataView(t.memory.buffer)),w}var I=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&I.decode();function u(e,r){return e=e>>>0,I.decode(k().subarray(e,e+r))}function D(e,r,_){let o,s;try{let i=t.__wbindgen_add_to_stack_pointer(-16),a=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,g=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d;t.breakscape_text(i,a,p,g,l,x,y);var c=b().getInt32(i+0,!0),n=b().getInt32(i+4,!0);return o=c,s=n,u(c,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function R(e,r,_){let o,s;try{let i=t.__wbindgen_add_to_stack_pointer(-16),a=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,g=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d;t.unbreakscape_text(i,a,p,g,l,x,y);var c=b().getInt32(i+0,!0),n=b().getInt32(i+4,!0);return o=c,s=n,u(c,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function j(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.parse(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}function U(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.convert(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}function L(e,r,_,o,s){let c,n;try{let p=t.__wbindgen_add_to_stack_pointer(-16),g=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d,W=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),M=d;t.info(p,g,l,x,y,W,M,o,s);var i=b().getInt32(p+0,!0),a=b().getInt32(p+4,!0);return c=i,n=a,u(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(c,n,1);}}function V(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.lex(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}async function C(e,r){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,r)}catch(o){if(e.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",o);else throw o}let _=await e.arrayBuffer();return await WebAssembly.instantiate(_,r)}else {let _=await WebAssembly.instantiate(e,r);return _ instanceof WebAssembly.Instance?{instance:_,module:e}:_}}function A(){let e={};return e.wbg={},e}function h(e,r){return t=e.exports,T.__wbindgen_wasm_module=r,w=null,m=null,t}function F(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let r=A();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let _=new WebAssembly.Instance(e,r);return h(_,e)}async function T(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_wasm_bg.wasm",import.meta.url));let r=A();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:_,module:o}=await C(await e,r);return h(_,o)}var q=T;export{D as breakscapeText,U as convert,L as info,q as init,F as initSync,V as lex,j as parse,R as unbreakscapeText};//# sourceMappingURL=bitmark-parser.min.js.map
var t,d=0,m=null;function k(){return (m===null||m.byteLength===0)&&(m=new Uint8Array(t.memory.buffer)),m}var O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},C=typeof O.encodeInto=="function"?function(e,n){return O.encodeInto(e,n)}:function(e,n){let r=O.encode(e);return n.set(r),{read:e.length,written:r.length}};function f(e,n,r){if(r===void 0){let _=O.encode(e),c=n(_.length,1)>>>0;return k().subarray(c,c+_.length).set(_),d=_.length,c}let o=e.length,s=n(o,1)>>>0,a=k(),i=0;for(;i<o;i++){let _=e.charCodeAt(i);if(_>127)break;a[s+i]=_;}if(i!==o){i!==0&&(e=e.slice(i)),s=r(s,o,o=i+e.length*3,1)>>>0;let _=k().subarray(s+i,s+o),c=C(e,_);i+=c.written,s=r(s,o,i,1)>>>0;}return d=i,s}var x=null;function g(){return (x===null||x.buffer.detached===true||x.buffer.detached===void 0&&x.buffer!==t.memory.buffer)&&(x=new DataView(t.memory.buffer)),x}var I=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&I.decode();function y(e,n){return e=e>>>0,I.decode(k().subarray(e,e+n))}function T(e,n,r){let o,s;try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,b=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),u=d,w=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d;t.breakscape_text(_,c,p,b,u,w,l);var a=g().getInt32(_+0,!0),i=g().getInt32(_+4,!0);return o=a,s=i,y(a,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function A(e,n,r){let o,s;try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,b=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),u=d,w=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d;t.unbreakscape_text(_,c,p,b,u,w,l);var a=g().getInt32(_+0,!0),i=g().getInt32(_+4,!0);return o=a,s=i,y(a,i)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function h(e,n){let r,o;try{let i=t.__wbindgen_add_to_stack_pointer(-16),_=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),c=d,p=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),b=d;t.parse(i,_,c,p,b);var s=g().getInt32(i+0,!0),a=g().getInt32(i+4,!0);return r=s,o=a,y(s,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(r,o,1);}}function W(e,n,r,o,s,a){let i,_;try{let b=t.__wbindgen_add_to_stack_pointer(-16),u=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),w=d,l=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),v=d;t.convert(b,u,w,l,v,r,o,s,a);var c=g().getInt32(b+0,!0),p=g().getInt32(b+4,!0);return i=c,_=p,y(c,p)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(i,_,1);}}function M(e,n,r,o,s){let a,i;try{let p=t.__wbindgen_add_to_stack_pointer(-16),b=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),u=d,w=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,v=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),D=d;t.info(p,b,u,w,l,v,D,o,s);var _=g().getInt32(p+0,!0),c=g().getInt32(p+4,!0);return a=_,i=c,y(_,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(a,i,1);}}function S(e,n){let r,o;try{let i=t.__wbindgen_add_to_stack_pointer(-16),_=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),c=d,p=f(n,t.__wbindgen_export_0,t.__wbindgen_export_1),b=d;t.lex(i,_,c,p,b);var s=g().getInt32(i+0,!0),a=g().getInt32(i+4,!0);return r=s,o=a,y(s,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(r,o,1);}}async function U(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(o){if(e.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",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else {let r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function L(){let e={};return e.wbg={},e}function E(e,n){return t=e.exports,j.__wbindgen_wasm_module=n,x=null,m=null,t}function F(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=L();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,n);return E(r,e)}async function j(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_wasm_bg.wasm",import.meta.url));let n=L();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:o}=await U(await e,n);return E(r,o)}var P=j;function q(e,n={}){return S(e,n.stage??"lex")}function N(e,n={}){return h(e,n.mode??"optimized")}function G(e,n={}){return W(e,n.mode??"optimized",n.warnings??false,n.plainText??false,n.pretty??false,n.indent??2)}function H(e,n={}){let r=n.format??"bitmark++",o=n.location??"body";return T(e,r,o)}function J(e,n={}){let r=n.format??"bitmark++",o=n.location??"body";return A(e,r,o)}function K(e={}){let n=e.infoType??"list",r=e.format??"text",o=e.bit??"",s=e.pretty??false,a=e.indent??2;return M(n,r,o,s,a)}export{H as breakscapeText,G as convert,K as info,P as init,F as initSync,q as lex,N as parse,J as unbreakscapeText};//# sourceMappingURL=bitmark-parser.min.js.map
//# sourceMappingURL=bitmark-parser.min.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../wasm-web/bitmark_wasm.js"],"names":["wasm","WASM_VECTOR_LEN","cachedUint8ArrayMemory0","getUint8ArrayMemory0","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","ptr","len","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","cachedTextDecoder","getStringFromWasm0","breakscape_text","input","format","location","deferred4_0","deferred4_1","retptr","ptr0","len0","ptr1","len1","ptr2","len2","r0","r1","unbreakscape_text","parse","options_json","deferred3_0","deferred3_1","convert","info","info_type","bit","pretty","indent","lex","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","__wbg_finalize_init","__wbg_init","initSync","module_or_path","bitmark_wasm_default"],"mappings":"AAAA,IAAIA,CAAAA,CAEAC,CAAAA,CAAkB,CAAA,CAElBC,CAAAA,CAA0B,IAAA,CAE9B,SAASC,CAAAA,EAAuB,CAC5B,OAAA,CAAID,CAAAA,GAA4B,IAAA,EAAQA,CAAAA,CAAwB,aAAe,CAAA,IAC3EA,CAAAA,CAA0B,IAAI,UAAA,CAAWF,CAAAA,CAAK,MAAA,CAAO,MAAM,CAAA,CAAA,CAExDE,CACX,CAEA,IAAME,CAAAA,CAAqB,OAAO,WAAA,CAAgB,GAAA,CAAc,IAAI,YAAY,OAAO,CAAA,CAAI,CAAE,MAAA,CAAQ,IAAM,CAAE,MAAM,KAAA,CAAM,2BAA2B,CAAE,CAAE,CAAA,CAElJC,CAAAA,CAAgB,OAAOD,CAAAA,CAAkB,UAAA,EAAe,WACxD,SAAUE,CAAAA,CAA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OAAO2D,CAAAA,CAAmB,GAAA,GACtB,MAAA,CAAO,cAAA,CAAeA,CAAc,CAAA,GAAM,MAAA,CAAO,SAAA,CAChD,CAAC,cAAA,CAAAA,CAAc,CAAA,CAAIA,CAAAA,CAEpB,OAAA,CAAQ,IAAA,CAAK,2FAA2F,CAAA,CAAA,CAI5G,OAAOA,CAAAA,CAAmB,GAAA,GAC1BA,CAAAA,CAAiB,IAAI,GAAA,CAAI,sBAAA,CAAwB,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAA,CAEpE,IAAMR,CAAAA,CAAUI,CAAAA,EAAkB,CAAA,CAE9B,OAAOI,GAAmB,QAAA,EAAa,OAAO,OAAA,EAAY,UAAA,EAAcA,CAAAA,YAA0B,OAAA,EAAa,OAAO,GAAA,EAAQ,UAAA,EAAcA,CAAAA,YAA0B,GAAA,IACtKA,CAAAA,CAAiB,KAAA,CAAMA,CAAc,CAAA,CAAA,CAKzC,GAAM,CAAE,QAAA,CAAAL,CAAAA,CAAU,MAAA,CAAAJ,CAAO,CAAA,CAAI,MAAMD,CAAAA,CAAW,MAAMU,EAAgBR,CAAO,CAAA,CAE3E,OAAOK,CAAAA,CAAoBF,CAAAA,CAAUJ,CAAM,CAC/C,KAGOU,CAAAA,CAAQH","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"]}
{"version":3,"sources":["../../wasm-web/bitmark_wasm.js","../../src/browser/index.ts"],"names":["wasm","WASM_VECTOR_LEN","cachedUint8ArrayMemory0","getUint8ArrayMemory0","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","ptr","len","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","cachedTextDecoder","getStringFromWasm0","breakscape_text","input","format","location","deferred4_0","deferred4_1","retptr","ptr0","len0","ptr1","len1","ptr2","len2","r0","r1","unbreakscape_text","parse","mode","deferred3_0","deferred3_1","convert","warnings","plain_text","pretty","indent","info","info_type","bit","lex","stage","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","__wbg_finalize_init","__wbg_init","initSync","module_or_path","bitmark_wasm_default","options","breakscapeText","unbreakscapeText","infoType"],"mappings":"AAAA,IAAIA,CAAAA,CAEAC,CAAAA,CAAkB,CAAA,CAElBC,CAAAA,CAA0B,KAE9B,SAASC,CAAAA,EAAuB,CAC5B,OAAA,CAAID,IAA4B,IAAA,EAAQA,CAAAA,CAAwB,UAAA,GAAe,CAAA,IAC3EA,EAA0B,IAAI,UAAA,CAAWF,CAAAA,CAAK,MAAA,CAAO,MAAM,CAAA,CAAA,CAExDE,CACX,CAEA,IAAME,CAAAA,CAAqB,OAAO,WAAA,CAAgB,GAAA,CAAc,IAAI,WAAA,CAAY,OAAO,CAAA,CAAI,CAAE,OAAQ,IAAM,CAAE,MAAM,KAAA,CAAM,2BAA2B,CAAE,CAAE,CAAA,CAElJC,EAAgB,OAAOD,CAAAA,CAAkB,UAAA,EAAe,UAAA,CACxD,SAAUE,CAAAA,CAAKC,CAAAA,CAAM,CACvB,OAAOH,EAAkB,UAAA,CAAWE,CAAAA,CAAKC,CAAI,CACjD,EACM,SAAUD,CAAAA,CAAKC,CAAAA,CAAM,CACvB,IAAMC,CAAAA,CAAMJ,CAAAA,CA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EAAQ,QAAA,EAAY,MAAA,CAC/BxC,CAAAA,CAASwC,CAAAA,CAAQ,QAAU,MAAA,CAC3Bf,CAAAA,CAAMe,CAAAA,CAAQ,GAAA,EAAO,GACrBnB,CAAAA,CAASmB,CAAAA,CAAQ,MAAA,EAAU,KAAA,CAC3BlB,EAASkB,CAAAA,CAAQ,MAAA,EAAU,CAAA,CACjC,OAAYjB,EAAKoB,CAAAA,CAAU3C,CAAAA,CAAQyB,CAAAA,CAAKJ,CAAAA,CAAQC,CAAM,CACxD","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} mode\n * @returns {string}\n */\nexport function parse(input, mode) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * `warnings`: whether to include validation warnings (default: false)\n * `plain_text`: output text as plain text — debug mode (default: false)\n * `pretty`: prettify JSON output (default: false)\n * `indent`: indent size for pretty-printing (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} mode\n * @param {boolean} warnings\n * @param {boolean} plain_text\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function convert(input, mode, warnings, plain_text, pretty, indent) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nimport * as wasm from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"../types.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"../types.js\";\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n"]}

@@ -23,10 +23,10 @@ "use strict";

__export(index_exports, {
breakscapeText: () => breakscape_text,
convert: () => convert,
info: () => info,
breakscapeText: () => breakscapeText,
convert: () => convert2,
info: () => info2,
init: () => bitmark_wasm_default,
initSync: () => initSync,
lex: () => lex,
parse: () => parse,
unbreakscapeText: () => unbreakscape_text
lex: () => lex2,
parse: () => parse2,
unbreakscapeText: () => unbreakscapeText
});

@@ -153,3 +153,3 @@ module.exports = __toCommonJS(index_exports);

}
function parse(input, options_json) {
function parse(input, mode) {
let deferred3_0;

@@ -161,3 +161,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -175,3 +175,3 @@ wasm.parse(retptr, ptr0, len0, ptr1, len1);

}
function convert(input, options_json) {
function convert(input, mode, warnings, plain_text, pretty, indent) {
let deferred3_0;

@@ -183,5 +183,5 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;
wasm.convert(retptr, ptr0, len0, ptr1, len1);
wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);

@@ -219,3 +219,3 @@ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);

}
function lex(input, options_json) {
function lex(input, stage) {
let deferred3_0;

@@ -227,3 +227,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -317,2 +317,31 @@ wasm.lex(retptr, ptr0, len0, ptr1, len1);

var bitmark_wasm_default = __wbg_init;
// src/browser/index.ts
function lex2(input, options = {}) {
return lex(input, options.stage ?? "lex");
}
function parse2(input, options = {}) {
return parse(input, options.mode ?? "optimized");
}
function convert2(input, options = {}) {
return convert(input, options.mode ?? "optimized", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);
}
function breakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return breakscape_text(input, format, location);
}
function unbreakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return unbreakscape_text(input, format, location);
}
function info2(options = {}) {
const infoType = options.infoType ?? "list";
const format = options.format ?? "text";
const bit = options.bit ?? "";
const pretty = options.pretty ?? false;
const indent = options.indent ?? 2;
return info(infoType, format, bit, pretty, indent);
}
// Annotate the CommonJS export names for ESM import in node:

@@ -319,0 +348,0 @@ 0 && (module.exports = {

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../src/browser/index.ts","../../../../../node_modules/tsup/assets/cjs_shims.js","../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nexport { convert, breakscape_text as breakscapeText, unbreakscape_text as unbreakscapeText, parse, lex, info } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACZ9D,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY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,aAAe;AAAA,EACpE;AACA,QAAM,UAAU,kBAAkB;AAElC,MAAI,OAAO,mBAAmB,YAAa,OAAO,YAAY,cAAc,0BAA0B,WAAa,OAAO,QAAQ,cAAc,0BAA0B,KAAM;AAC5K,qBAAiB,MAAM,cAAc;AAAA,EACzC;AAEA,oBAAkB,OAAO;AAEzB,QAAM,EAAE,UAAU,QAAAA,QAAO,IAAI,MAAM,WAAW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAUA,OAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr","module"]}
{"version":3,"sources":["../../../src/browser/index.ts","../../../../../node_modules/tsup/assets/cjs_shims.js","../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nimport * as wasm from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"../types.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"../types.js\";\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} mode\n * @returns {string}\n */\nexport function parse(input, mode) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * `warnings`: whether to include validation warnings (default: false)\n * `plain_text`: output text as plain text — debug mode (default: false)\n * `pretty`: prettify JSON output (default: false)\n * `indent`: indent size for pretty-printing (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} mode\n * @param {boolean} warnings\n * @param {boolean} plain_text\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function convert(input, mode, warnings, plain_text, pretty, indent) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA,YAAAC;AAAA,EAAA;AAAA;AAAA,aAAAC;AAAA,EAAA,aAAAC;AAAA,EAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACZ9D,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,e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lex","parse","convert","info"]}

@@ -1,65 +0,1 @@

/* tslint:disable */
/* eslint-disable */
/**
* Breakscape text (escape bitmark special characters).
*
* `format`: `"bitmark++"` (default) or `"plainText"`
* `location`: `"body"` (default) or `"tag"`
*/
declare function breakscape_text(input: string, format: string, location: string): string;
/**
* Unbreakscape text (unescape bitmark special characters).
*
* `format`: `"bitmark++"` (default) or `"plainText"`
* `location`: `"body"` (default) or `"tag"`
*/
declare function unbreakscape_text(input: string, format: string, location: string): string;
/**
* Parse bitmark input text and return the reference JSON format.
*
* Uses the full pipeline: parse → validate → serialize.
*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
*/
declare function parse(input: string, options_json: string): string;
/**
* Auto-detect input format and convert between bitmark and JSON.
*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* - `"warnings"`: `true` or `false` (default)
* - `"plainText"`: `true` or `false` (default)
* - `"pretty"`: `true` or `false` (default)
* - `"indent"`: number (default: 2)
*
* Returns JSON if input is bitmark, or an error message if input is JSON
* (generator not yet implemented).
*/
declare function convert(input: string, options_json: string): string;
/**
* Query information about supported bit types.
*
* `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
* `format`: `"text"` or `"json"`
* `bit`: bit name (required when `info_type` is `"bit"`)
* `pretty`: whether to pretty-print JSON output
* `indent`: indent size for pretty-printing (default: 2)
*/
declare function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number): string;
/**
* Lex bitmark input text, returning one line per token in the same format as
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
*
* `options_json` is a JSON string with optional fields:
* - `"stage"`: selects the lexer pipeline:
* - `"lex"` — combined (default)
* - `"lex-bitmark"` — bitmark-level only
* - `"lex-text"` — text-level only
* - `"lex-json"` — combined, JSON array output
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
* - `"lex-text-json"` — text-level, JSON array output
*/
declare function lex(input: string, options_json: string): string;
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

@@ -70,3 +6,3 @@

readonly breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
readonly convert: (a: number, b: number, c: number, d: number, e: number) => void;
readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;

@@ -103,2 +39,120 @@ readonly lex: (a: number, b: number, c: number, d: number, e: number) => void;

export { breakscape_text as breakscapeText, convert, info, __wbg_init as init, initSync, lex, parse, unbreakscape_text as unbreakscapeText };
/**
* Output mode for JSON serialization.
*
* - `"optimized"` — omit keys whose values match their natural defaults.
* - `"full"` — include all keys enumerated from the bitmark configuration.
*/
type OutputMode = "optimized" | "full";
/**
* Lexer stage selector.
*
* - `"lex"` — combined lexer, text output (default).
* - `"lex-bitmark"` — bitmark-level only, text output.
* - `"lex-text"` — text-level only, text output.
* - `"lex-json"` — combined lexer, JSON array output.
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
* - `"lex-text-json"` — text-level only, JSON array output.
*/
type LexStage = "lex" | "lex-bitmark" | "lex-text" | "lex-json" | "lex-bitmark-json" | "lex-text-json";
/** Options for the {@link lex} function. */
interface LexOptions {
/** Selects the lexer pipeline stage (default: `"lex"`). */
stage?: LexStage;
}
/** Options for the {@link parse} function. */
interface ParseOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
}
/** Options for the {@link convert} function. */
interface ConvertOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
/** Include validation warnings in output (default: `false`). */
warnings?: boolean;
/** Output text as plain text — debug mode (default: `false`). */
plainText?: boolean;
/** Prettify JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/** Text format for breakscape / unbreakscape operations. */
type TextFormat = "bitmark++" | "plainText";
/** Text location for breakscape / unbreakscape operations. */
type TextLocation = "body" | "tag";
/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */
interface BreakscapeOptions {
/** Text format (default: `"bitmark++"`). */
format?: TextFormat;
/** Text location (default: `"body"`). */
location?: TextLocation;
}
/** Info query type for the {@link info} function. */
type InfoType = "list" | "bit" | "all" | "deprecated";
/** Output format for the {@link info} function. */
type InfoFormat = "text" | "json";
/** Options for the {@link info} function. */
interface InfoOptions {
/** Info query type (default: `"list"`). */
infoType?: InfoType;
/** Output format (default: `"text"`). */
format?: InfoFormat;
/** Bit name — required when `infoType` is `"bit"`. */
bit?: string;
/** Whether to pretty-print JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/**
* Lex bitmark input text, returning one line per token.
*
* @param input - The bitmark source text.
* @param options - Lex options (e.g. `{ stage: "lex-bitmark" }`).
* @returns Token dump string (one token per line).
*/
declare function lex(input: string, options?: LexOptions): string;
/**
* Parse bitmark input text and return the reference JSON format.
*
* @param input - The bitmark source text.
* @param options - Parse options (e.g. `{ mode: "full" }`).
* @returns JSON string of the parsed bitmark document.
*/
declare function parse(input: string, options?: ParseOptions): string;
/**
* Auto-detect input format and convert between bitmark and JSON.
*
* @param input - Bitmark or JSON input text.
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
* @returns Converted output string.
*/
declare function convert(input: string, options?: ConvertOptions): string;
/**
* Breakscape text (escape bitmark special characters).
*
* @param input - The text to breakscape.
* @param options - Breakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Breakscaped text.
*/
declare function breakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Unbreakscape text (unescape bitmark special characters).
*
* @param input - The text to unbreakscape.
* @param options - Unbreakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Unbreakscaped text.
*/
declare function unbreakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Query information about supported bit types.
*
* @param options - Info options (e.g. `{ infoType: "bit", format: "json", bit: "cloze" }`).
* @returns Information string.
*/
declare function info(options?: InfoOptions): string;
export { type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type LexOptions, type LexStage, type OutputMode, type ParseOptions, type TextFormat, type TextLocation, breakscapeText, convert, info, __wbg_init as init, initSync, lex, parse, unbreakscapeText };

@@ -1,65 +0,1 @@

/* tslint:disable */
/* eslint-disable */
/**
* Breakscape text (escape bitmark special characters).
*
* `format`: `"bitmark++"` (default) or `"plainText"`
* `location`: `"body"` (default) or `"tag"`
*/
declare function breakscape_text(input: string, format: string, location: string): string;
/**
* Unbreakscape text (unescape bitmark special characters).
*
* `format`: `"bitmark++"` (default) or `"plainText"`
* `location`: `"body"` (default) or `"tag"`
*/
declare function unbreakscape_text(input: string, format: string, location: string): string;
/**
* Parse bitmark input text and return the reference JSON format.
*
* Uses the full pipeline: parse → validate → serialize.
*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
*/
declare function parse(input: string, options_json: string): string;
/**
* Auto-detect input format and convert between bitmark and JSON.
*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* - `"warnings"`: `true` or `false` (default)
* - `"plainText"`: `true` or `false` (default)
* - `"pretty"`: `true` or `false` (default)
* - `"indent"`: number (default: 2)
*
* Returns JSON if input is bitmark, or an error message if input is JSON
* (generator not yet implemented).
*/
declare function convert(input: string, options_json: string): string;
/**
* Query information about supported bit types.
*
* `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
* `format`: `"text"` or `"json"`
* `bit`: bit name (required when `info_type` is `"bit"`)
* `pretty`: whether to pretty-print JSON output
* `indent`: indent size for pretty-printing (default: 2)
*/
declare function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number): string;
/**
* Lex bitmark input text, returning one line per token in the same format as
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
*
* `options_json` is a JSON string with optional fields:
* - `"stage"`: selects the lexer pipeline:
* - `"lex"` — combined (default)
* - `"lex-bitmark"` — bitmark-level only
* - `"lex-text"` — text-level only
* - `"lex-json"` — combined, JSON array output
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
* - `"lex-text-json"` — text-level, JSON array output
*/
declare function lex(input: string, options_json: string): string;
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

@@ -70,3 +6,3 @@

readonly breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
readonly convert: (a: number, b: number, c: number, d: number, e: number) => void;
readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;

@@ -103,2 +39,120 @@ readonly lex: (a: number, b: number, c: number, d: number, e: number) => void;

export { breakscape_text as breakscapeText, convert, info, __wbg_init as init, initSync, lex, parse, unbreakscape_text as unbreakscapeText };
/**
* Output mode for JSON serialization.
*
* - `"optimized"` — omit keys whose values match their natural defaults.
* - `"full"` — include all keys enumerated from the bitmark configuration.
*/
type OutputMode = "optimized" | "full";
/**
* Lexer stage selector.
*
* - `"lex"` — combined lexer, text output (default).
* - `"lex-bitmark"` — bitmark-level only, text output.
* - `"lex-text"` — text-level only, text output.
* - `"lex-json"` — combined lexer, JSON array output.
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
* - `"lex-text-json"` — text-level only, JSON array output.
*/
type LexStage = "lex" | "lex-bitmark" | "lex-text" | "lex-json" | "lex-bitmark-json" | "lex-text-json";
/** Options for the {@link lex} function. */
interface LexOptions {
/** Selects the lexer pipeline stage (default: `"lex"`). */
stage?: LexStage;
}
/** Options for the {@link parse} function. */
interface ParseOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
}
/** Options for the {@link convert} function. */
interface ConvertOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
/** Include validation warnings in output (default: `false`). */
warnings?: boolean;
/** Output text as plain text — debug mode (default: `false`). */
plainText?: boolean;
/** Prettify JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/** Text format for breakscape / unbreakscape operations. */
type TextFormat = "bitmark++" | "plainText";
/** Text location for breakscape / unbreakscape operations. */
type TextLocation = "body" | "tag";
/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */
interface BreakscapeOptions {
/** Text format (default: `"bitmark++"`). */
format?: TextFormat;
/** Text location (default: `"body"`). */
location?: TextLocation;
}
/** Info query type for the {@link info} function. */
type InfoType = "list" | "bit" | "all" | "deprecated";
/** Output format for the {@link info} function. */
type InfoFormat = "text" | "json";
/** Options for the {@link info} function. */
interface InfoOptions {
/** Info query type (default: `"list"`). */
infoType?: InfoType;
/** Output format (default: `"text"`). */
format?: InfoFormat;
/** Bit name — required when `infoType` is `"bit"`. */
bit?: string;
/** Whether to pretty-print JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/**
* Lex bitmark input text, returning one line per token.
*
* @param input - The bitmark source text.
* @param options - Lex options (e.g. `{ stage: "lex-bitmark" }`).
* @returns Token dump string (one token per line).
*/
declare function lex(input: string, options?: LexOptions): string;
/**
* Parse bitmark input text and return the reference JSON format.
*
* @param input - The bitmark source text.
* @param options - Parse options (e.g. `{ mode: "full" }`).
* @returns JSON string of the parsed bitmark document.
*/
declare function parse(input: string, options?: ParseOptions): string;
/**
* Auto-detect input format and convert between bitmark and JSON.
*
* @param input - Bitmark or JSON input text.
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
* @returns Converted output string.
*/
declare function convert(input: string, options?: ConvertOptions): string;
/**
* Breakscape text (escape bitmark special characters).
*
* @param input - The text to breakscape.
* @param options - Breakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Breakscaped text.
*/
declare function breakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Unbreakscape text (unescape bitmark special characters).
*
* @param input - The text to unbreakscape.
* @param options - Unbreakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Unbreakscaped text.
*/
declare function unbreakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Query information about supported bit types.
*
* @param options - Info options (e.g. `{ infoType: "bit", format: "json", bit: "cloze" }`).
* @returns Information string.
*/
declare function info(options?: InfoOptions): string;
export { type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type LexOptions, type LexStage, type OutputMode, type ParseOptions, type TextFormat, type TextLocation, breakscapeText, convert, info, __wbg_init as init, initSync, lex, parse, unbreakscapeText };

@@ -115,3 +115,3 @@ // wasm-web/bitmark_wasm.js

}
function parse(input, options_json) {
function parse(input, mode) {
let deferred3_0;

@@ -123,3 +123,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -137,3 +137,3 @@ wasm.parse(retptr, ptr0, len0, ptr1, len1);

}
function convert(input, options_json) {
function convert(input, mode, warnings, plain_text, pretty, indent) {
let deferred3_0;

@@ -145,5 +145,5 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;
wasm.convert(retptr, ptr0, len0, ptr1, len1);
wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);

@@ -181,3 +181,3 @@ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);

}
function lex(input, options_json) {
function lex(input, stage) {
let deferred3_0;

@@ -189,3 +189,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -279,12 +279,41 @@ wasm.lex(retptr, ptr0, len0, ptr1, len1);

var bitmark_wasm_default = __wbg_init;
// src/browser/index.ts
function lex2(input, options = {}) {
return lex(input, options.stage ?? "lex");
}
function parse2(input, options = {}) {
return parse(input, options.mode ?? "optimized");
}
function convert2(input, options = {}) {
return convert(input, options.mode ?? "optimized", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);
}
function breakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return breakscape_text(input, format, location);
}
function unbreakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return unbreakscape_text(input, format, location);
}
function info2(options = {}) {
const infoType = options.infoType ?? "list";
const format = options.format ?? "text";
const bit = options.bit ?? "";
const pretty = options.pretty ?? false;
const indent = options.indent ?? 2;
return info(infoType, format, bit, pretty, indent);
}
export {
breakscape_text as breakscapeText,
convert,
info,
breakscapeText,
convert2 as convert,
info2 as info,
bitmark_wasm_default as init,
initSync,
lex,
parse,
unbreakscape_text as unbreakscapeText
lex2 as lex,
parse2 as parse,
unbreakscapeText
};
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";AAAA,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,eAAe,aACxD,SAAU,KAAK,MAAM;AACvB,SAAO,kBAAkB,WAAW,KAAK,IAAI;AACjD,IACM,SAAU,KAAK,MAAM;AACvB,QAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,OAAK,IAAI,GAAG;AACZ,SAAO;AAAA,IACH,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,EACjB;AACJ;AAEA,SAAS,kBAAkB,KAAK,QAAQ,SAAS;AAE7C,MAAI,YAAY,QAAW;AACvB,UAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,UAAMA,OAAM,OAAO,IAAI,QAAQ,CAAC,MAAM;AACtC,yBAAqB,EAAE,SAASA,MAAKA,OAAM,IAAI,MAAM,EAAE,IAAI,GAAG;AAC9D,sBAAkB,IAAI;AACtB,WAAOA;AAAA,EACX;AAEA,MAAI,MAAM,IAAI;AACd,MAAI,MAAM,OAAO,KAAK,CAAC,MAAM;AAE7B,QAAM,MAAM,qBAAqB;AAEjC,MAAI,SAAS;AAEb,SAAO,SAAS,KAAK,UAAU;AAC3B,UAAM,OAAO,IAAI,WAAW,MAAM;AAClC,QAAI,OAAO,IAAM;AACjB,QAAI,MAAM,MAAM,IAAI;AAAA,E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D,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAEA,eAAe,WAAW,gBAAgB;AACtC,MAAI,SAAS,OAAW,QAAO;AAG/B,MAAI,OAAO,mBAAmB,aAAa;AACvC,QAAI,OAAO,eAAe,cAAc,MAAM,OAAO,WAAW;AAC5D,OAAC,EAAC,eAAc,IAAI;AAAA,IACxB,OAAO;AACH,cAAQ,KAAK,2FAA2F;AAAA,IAC5G;AAAA,EACJ;AAEA,MAAI,OAAO,mBAAmB,aAAa;AACvC,qBAAiB,IAAI,IAAI,wBAAwB,YAAY,GAAG;AAAA,EACpE;AACA,QAAM,UAAU,kBAAkB;AAElC,MAAI,OAAO,mBAAmB,YAAa,OAAO,YAAY,cAAc,0BAA0B,WAAa,OAAO,QAAQ,cAAc,0BAA0B,KAAM;AAC5K,qBAAiB,MAAM,cAAc;AAAA,EACzC;AAEA,oBAAkB,OAAO;AAEzB,QAAM,EAAE,UAAU,OAAO,IAAI,MAAM,WAAW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr"]}
{"version":3,"sources":["../../../wasm-web/bitmark_wasm.js","../../../src/browser/index.ts"],"sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} mode\n * @returns {string}\n */\nexport function parse(input, mode) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `mode`: `\"optimized\"` (default) or `\"full\"`\n * `warnings`: whether to include validation warnings (default: false)\n * `plain_text`: output text as plain text — debug mode (default: false)\n * `pretty`: prettify JSON output (default: false)\n * `indent`: indent size for pretty-printing (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} mode\n * @param {boolean} warnings\n * @param {boolean} plain_text\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function convert(input, mode, warnings, plain_text, pretty, indent) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n 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\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nimport * as wasm from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"../types.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"../types.js\";\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n"],"mappings":";AAAA,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,eAAe,aACxD,SAAU,KAAK,MAAM;AACvB,SAAO,kBAAkB,WAAW,KAAK,IAAI;AACjD,IACM,SAAU,KAAK,MAAM;AACvB,QAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,OAAK,IAAI,GAAG;AACZ,SAAO;AAAA,IACH,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,EACjB;AACJ;AAEA,SAAS,kBAAkB,KAAK,QAAQ,SAAS;AAE7C,MAAI,YAAY,QAAW;AACvB,UAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,UAAMA,OAAM,OAAO,IAAI,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,CAAC,GAAW;AACvE,SAAY,MAAM,OAAO,QAAQ,QAAQ,WAAW;AACtD;AASO,SAASC,SAAQ,OAAe,UAA0B,CAAC,GAAW;AAC3E,SAAY,QAAQ,OAAO,QAAQ,QAAQ,aAAa,QAAQ,YAAY,OAAO,QAAQ,aAAa,OAAO,QAAQ,UAAU,OAAO,QAAQ,UAAU,CAAC;AAC7J;AASO,SAAS,eAAe,OAAe,UAA6B,CAAC,GAAW;AACrF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAY,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AASO,SAAS,iBAAiB,OAAe,UAA6B,CAAC,GAAW;AACvF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAY,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAQO,SAASC,MAAK,UAAuB,CAAC,GAAW;AACtD,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO;AAC3B,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAY,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;","names":["ptr","lex","parse","convert","info"]}

@@ -9,21 +9,30 @@ #!/usr/bin/env node

var PACKAGE_INFO = {
"version": "3.0.1-alpha.3"};
"version": "3.0.1-alpha.4"};
var require2 = createRequire(import.meta.url);
var wasm = require2("../wasm/bitmark_wasm.js");
function lex(input, optionsJson = "{}") {
return wasm.lex(input, optionsJson);
function lex(input, options = {}) {
return wasm.lex(input, options.stage ?? "lex");
}
function parse(input, optionsJson = "{}") {
return wasm.parse(input, optionsJson);
function parse(input, options = {}) {
return wasm.parse(input, options.mode ?? "optimized");
}
function convert(input, optionsJson = "{}") {
return wasm.convert(input, optionsJson);
function convert(input, options = {}) {
return wasm.convert(input, options.mode ?? "optimized", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);
}
function breakscapeText(input, format = "bitmark++", location = "body") {
function breakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.breakscape_text(input, format, location);
}
function unbreakscapeText(input, format = "bitmark++", location = "body") {
function unbreakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.unbreakscape_text(input, format, location);
}
function info(infoType = "list", format = "text", bit = "", pretty = false, indent = 2) {
function info(options = {}) {
const infoType = options.infoType ?? "list";
const format = options.format ?? "text";
const bit = options.bit ?? "";
const pretty = options.pretty ?? false;
const indent = options.indent ?? 2;
return wasm.info(infoType, format, bit, pretty, indent);

@@ -76,7 +85,5 @@ }

if (options.stage === "lex" || options.stage === "lex-bitmark" || options.stage === "lex-text") {
const lexOptionsJson = JSON.stringify({ stage: options.stage });
result = lex(content, lexOptionsJson);
result = lex(content, { stage: options.stage });
} else {
const optionsJson = JSON.stringify({ mode: options.mode });
result = parse(content, optionsJson);
result = parse(content, { mode: options.mode });
}

@@ -100,3 +107,3 @@ writeOutput(result, options.output, options.append);

const content = readInputs(inputs);
const optionsJson = JSON.stringify({
const result = convert(content, {
mode: options.mode,

@@ -108,3 +115,2 @@ warnings: options.warnings,

});
const result = convert(content, optionsJson);
writeOutput(result, options.output, options.append);

@@ -119,3 +125,6 @@ }

const content = readInputs(inputs);
const result = breakscapeText(content, options.format, options.location);
const result = breakscapeText(content, {
format: options.format,
location: options.location
});
writeOutput(result, options.output, options.append);

@@ -129,3 +138,6 @@ });

const content = readInputs(inputs);
const result = unbreakscapeText(content, options.format, options.location);
const result = unbreakscapeText(content, {
format: options.format,
location: options.location
});
writeOutput(result, options.output, options.append);

@@ -139,3 +151,9 @@ });

(infoType, options) => {
const result = info(infoType, options.format, options.bit ?? "", options.pretty, parseInt(options.indent, 10));
const result = info({
infoType,
format: options.format,
bit: options.bit,
pretty: options.pretty,
indent: parseInt(options.indent, 10)
});
writeOutput(result, options.output, options.append);

@@ -142,0 +160,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/generated/package_info.ts","../src/index.ts","../src/utils/io.ts","../src/commands/parse.ts","../src/commands/generate.ts","../src/commands/convert.ts","../src/commands/breakscape.ts","../src/commands/unbreakscape.ts","../src/commands/info.ts","../src/cli.ts"],"names":["require","program"],"mappings":";;;;;;;AAIO,IAAM,YAAA,GAAe;AAAA,EAE1B,SAAA,EAAW,eAIb,CAAA;ACNA,IAAMA,QAAAA,GAAU,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAC7C,IAAM,IAAA,GAAOA,SAAQ,yBAAyB,CAAA;AAkBvC,SAAS,GAAA,CAAI,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACrE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,WAAW,CAAA;AACpC;AASO,SAAS,KAAA,CAAM,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACvE,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,WAAW,CAAA;AACtC;AASO,SAAS,OAAA,CAAQ,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACzE,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,WAAW,CAAA;AACxC;AAUO,SAAS,cAAA,CAAe,KAAA,EAAe,MAAA,GAAiB,WAAA,EAAa,WAAmB,MAAA,EAAgB;AAC7G,EAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,KAAA,EAAO,MAAA,EAAQ,QAAQ,CAAA;AACrD;AAUO,SAAS,gBAAA,CAAiB,KAAA,EAAe,MAAA,GAAiB,WAAA,EAAa,WAAmB,MAAA,EAAgB;AAC/G,EAAA,OAAO,IAAA,CAAK,iBAAA,CAAkB,KAAA,EAAO,MAAA,EAAQ,QAAQ,CAAA;AACvD;AAYO,SAAS,IAAA,CAAK,QAAA,GAAmB,MAAA,EAAQ,MAA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A,EAAQ,OAAA,CAAQ,MAAA,EAAQ,OAAA,CAAQ,MAAM,CAAA;AAAA,IACpD;AAAA,GACF;AACJ;;;ACzBA,IAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAE5B,OAAA,CAAQ,IAAA,CAAK,gBAAgB,CAAA,CAAE,WAAA,CAAY,iCAAiC,CAAA,CAAE,OAAA,CAAQ,aAAa,OAAO,CAAA;AAE1G,oBAAA,CAAqB,OAAO,CAAA;AAC5B,uBAAA,CAAwB,OAAO,CAAA;AAC/B,sBAAA,CAAuB,OAAO,CAAA;AAC9B,yBAAA,CAA0B,OAAO,CAAA;AACjC,2BAAA,CAA4B,OAAO,CAAA;AACnC,mBAAA,CAAoB,OAAO,CAAA;AAE3B,OAAA,CAAQ,KAAA,EAAM","file":"cli.js","sourcesContent":["// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// @zen-component: CLI-SharedIO\n//! Shared I/O utilities for the TS CLI.\n\nimport { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\n/**\n * Resolve multiple inputs into a single concatenated string.\n *\n * If the array is empty, reads from stdin.\n * Multiple inputs are concatenated with `\\n` — valid for bitmark\n * because bits are `\\n`-delimited.\n */\nexport function readInputs(inputs: string[]): string {\n if (inputs.length === 0) {\n return readStdin();\n }\n if (inputs.length === 1) {\n return readSingle(inputs[0]);\n }\n return inputs.map(readSingle).join(\"\\n\");\n}\n\n/**\n * Resolve a single input string (file path or literal).\n */\nfunction readSingle(input: string): string {\n if (existsSync(input)) {\n return readFileSync(input, \"utf-8\");\n }\n return input;\n}\n\n/**\n * Read all of stdin synchronously.\n */\nfunction readStdin(): string {\n const buf = readFileSync(0, \"utf-8\") as string;\n if (!buf) {\n console.error(\"No input provided. Pass a file path, literal string, or pipe via stdin.\");\n process.exit(1);\n }\n return buf;\n}\n\n/**\n * Write output to stdout or a file.\n *\n * - If `outputPath` is undefined → write to stdout\n * - If `append` is true → append to file\n * - Otherwise → overwrite file\n */\nexport function writeOutput(content: string, outputPath: string | undefined, append: boolean): void {\n if (outputPath === undefined) {\n process.stdout.write(content);\n return;\n }\n\n // Ensure parent directory exists\n const dir = dirname(outputPath);\n if (dir && !existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n if (append) {\n appendFileSync(outputPath, content, \"utf-8\");\n } else {\n writeFileSync(outputPath, content, \"utf-8\");\n }\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\nimport { lex, parse } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerParseCommand(program: Command): void {\n program\n .command(\"parse\")\n .description(\"Parse a bitmark file to JSON\")\n .argument(\"[INPUT...]\", \"Input: bitmark files, literal strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--stage <STAGE>\", \"Stage to run: all, lex, lex-bitmark, lex-text\", \"all\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .action((inputs: string[], options: { output?: string; append: boolean; stage: string; mode: string }) => {\n const content = readInputs(inputs);\n let result: string;\n\n if (options.stage === \"lex\" || options.stage === \"lex-bitmark\" || options.stage === \"lex-text\") {\n const lexOptionsJson = JSON.stringify({ stage: options.stage });\n result = lex(content, lexOptionsJson);\n } else {\n const optionsJson = JSON.stringify({ mode: options.mode });\n result = parse(content, optionsJson);\n }\n\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\n\nexport function registerGenerateCommand(program: Command): void {\n program\n .command(\"generate\")\n .description(\"Generate bitmark text from JSON\")\n .argument(\"<INPUT>\", \"Input JSON file\")\n .argument(\"<OUTPUT>\", \"Output bitmark file\")\n .action((_input: string, _output: string) => {\n console.error(\"generate not yet implemented\");\n process.exit(1);\n });\n}\n","// @zen-component: CLI-Convert\n\nimport type { Command } from \"commander\";\nimport { convert } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerConvertCommand(program: Command): void {\n program\n .command(\"convert\")\n .description(\"Auto-detect input format and convert between bitmark and JSON\")\n .argument(\"[INPUT...]\", \"Input: file paths, bitmark/JSON strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-w, --warnings\", \"Enable validation warnings in output\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .option(\"--plain-text\", \"Output text as plain text (debug)\", false)\n .action(\n (\n inputs: string[],\n options: {\n output?: string;\n append: boolean;\n warnings: boolean;\n pretty: boolean;\n indent: string;\n mode: string;\n plainText: boolean;\n },\n ) => {\n const content = readInputs(inputs);\n const optionsJson = JSON.stringify({\n mode: options.mode,\n warnings: options.warnings,\n plainText: options.plainText,\n pretty: options.pretty,\n indent: parseInt(options.indent, 10),\n });\n const result = convert(content, optionsJson);\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { breakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerBreakscapeCommand(program: Command): void {\n program\n .command(\"breakscape\")\n .description(\"Breakscape text (escape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = breakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { unbreakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerUnbreakscapeCommand(program: Command): void {\n program\n .command(\"unbreakscape\")\n .description(\"Unbreakscape text (unescape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = unbreakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Info\n\nimport type { Command } from \"commander\";\nimport { info } from \"../index.js\";\nimport { writeOutput } from \"../utils/io.js\";\n\nexport function registerInfoCommand(program: Command): void {\n program\n .command(\"info\")\n .description(\"Show information about supported bit types\")\n .argument(\"[INFO]\", \"Info type: list, bit, all, deprecated\", \"list\")\n .option(\"-f, --format <FORMAT>\", \"Output format: text or json\", \"text\")\n .option(\"--all\", \"Include deprecated bits\", false)\n .option(\"--bit <NAME>\", \"Filter to specific bit type\")\n .option(\"--deprecated\", \"Show only deprecated bits\", false)\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .action(\n (\n infoType: string,\n options: {\n format: string;\n all: boolean;\n bit?: string;\n deprecated: boolean;\n output?: string;\n append: boolean;\n pretty: boolean;\n indent: string;\n },\n ) => {\n const result = info(infoType, options.format, options.bit ?? \"\", options.pretty, parseInt(options.indent, 10));\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","#!/usr/bin/env node\n// @zen-component: WASM-TSBindings\n\nimport { Command } from \"commander\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { registerParseCommand } from \"./commands/parse.js\";\nimport { registerGenerateCommand } from \"./commands/generate.js\";\nimport { registerConvertCommand } from \"./commands/convert.js\";\nimport { registerBreakscapeCommand } from \"./commands/breakscape.js\";\nimport { registerUnbreakscapeCommand } from \"./commands/unbreakscape.js\";\nimport { registerInfoCommand } from \"./commands/info.js\";\n\nconst program = new Command();\n\nprogram.name(\"bitmark-parser\").description(\"Parse and generate bitmark text\").version(PACKAGE_INFO.version);\n\nregisterParseCommand(program);\nregisterGenerateCommand(program);\nregisterConvertCommand(program);\nregisterBreakscapeCommand(program);\nregisterUnbreakscapeCommand(program);\nregisterInfoCommand(program);\n\nprogram.parse();\n"]}
{"version":3,"sources":["../src/generated/package_info.ts","../src/index.ts","../src/utils/io.ts","../src/commands/parse.ts","../src/commands/generate.ts","../src/commands/convert.ts","../src/commands/breakscape.ts","../src/commands/unbreakscape.ts","../src/commands/info.ts","../src/cli.ts"],"names":["require","program"],"mappings":";;;;;;;AAIO,IAAM,YAAA,GAAe;AAAA,EAE1B,SAAA,EAAW,eAIb,CAAA;ACLA,IAAMA,QAAAA,GAAU,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAC7C,IAAM,IAAA,GAAOA,SAAQ,yBAAyB,CAAA;AAoBvC,SAAS,GAAA,CAAI,KAAA,EAAe,OAAA,GAAsB,EAAC,EAAW;AACnE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,OAAA,CAAQ,SAAS,KAAK,CAAA;AAC/C;AASO,SAAS,KAAA,CAAM,KAAA,EAAe,OAAA,GAAwB,EAAC,EAAW;AACvE,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,OAAA,CAAQ,QAAQ,WAAW,CAAA;AACtD;AASO,SAAS,OAAA,CAAQ,KAAA,EAAe,OAAA,GAA0B,EAAC,EAAW;AAC3E,EAAA,OAAO,KAAK,OAAA,CAAQ,KAAA,EAAO,OAAA,CAAQ,IAAA,IAAQ,aAAa,OAAA,CAAQ,QAAA,IAAY,KAAA,EAAO,OAAA,CAAQ,aAAa,KAAA,EAAO,OAAA,CAAQ,UAAU,KAAA,EAAO,OAAA,CAAQ,UAAU,CAAC,CAAA;AAC7J;AASO,SAAS,cAAA,CAAe,KAAA,EAAe,OAAA,GAA6B,EAAC,EAAW;AACrF,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,IAAU,WAAA;AACjC,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,MAAA;AACrC,EAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,KAAA,EAAO,MAAA,EAAQ,QAAQ,CAAA;AACrD;AASO,SAAS,gBAAA,CAAiB,KAAA,EAAe,OAAA,GAA6B,EAAC,EAAW;AACv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ACpD,MAAA,CAAO,cAAA,EAAgB,6BAAA,EAA+B,GAAG,CAAA,CACzD,MAAA;AAAA,IACC,CACE,UACA,OAAA,KAUG;AACH,MAAA,MAAM,SAAS,IAAA,CAAK;AAAA,QAClB,QAAA;AAAA,QACA,QAAQ,OAAA,CAAQ,MAAA;AAAA,QAChB,KAAK,OAAA,CAAQ,GAAA;AAAA,QACb,QAAQ,OAAA,CAAQ,MAAA;AAAA,QAChB,MAAA,EAAQ,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,EAAE;AAAA,OACpC,CAAA;AACD,MAAA,WAAA,CAAY,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,OAAA,CAAQ,MAAM,CAAA;AAAA,IACpD;AAAA,GACF;AACJ;;;AC/BA,IAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAE5B,OAAA,CAAQ,IAAA,CAAK,gBAAgB,CAAA,CAAE,WAAA,CAAY,iCAAiC,CAAA,CAAE,OAAA,CAAQ,aAAa,OAAO,CAAA;AAE1G,oBAAA,CAAqB,OAAO,CAAA;AAC5B,uBAAA,CAAwB,OAAO,CAAA;AAC/B,sBAAA,CAAuB,OAAO,CAAA;AAC9B,yBAAA,CAA0B,OAAO,CAAA;AACjC,2BAAA,CAA4B,OAAO,CAAA;AACnC,mBAAA,CAAoB,OAAO,CAAA;AAE3B,OAAA,CAAQ,KAAA,EAAM","file":"cli.js","sourcesContent":["// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.4\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// @zen-component: CLI-SharedIO\n//! Shared I/O utilities for the TS CLI.\n\nimport { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\n/**\n * Resolve multiple inputs into a single concatenated string.\n *\n * If the array is empty, reads from stdin.\n * Multiple inputs are concatenated with `\\n` — valid for bitmark\n * because bits are `\\n`-delimited.\n */\nexport function readInputs(inputs: string[]): string {\n if (inputs.length === 0) {\n return readStdin();\n }\n if (inputs.length === 1) {\n return readSingle(inputs[0]);\n }\n return inputs.map(readSingle).join(\"\\n\");\n}\n\n/**\n * Resolve a single input string (file path or literal).\n */\nfunction readSingle(input: string): string {\n if (existsSync(input)) {\n return readFileSync(input, \"utf-8\");\n }\n return input;\n}\n\n/**\n * Read all of stdin synchronously.\n */\nfunction readStdin(): string {\n const buf = readFileSync(0, \"utf-8\") as string;\n if (!buf) {\n console.error(\"No input provided. Pass a file path, literal string, or pipe via stdin.\");\n process.exit(1);\n }\n return buf;\n}\n\n/**\n * Write output to stdout or a file.\n *\n * - If `outputPath` is undefined → write to stdout\n * - If `append` is true → append to file\n * - Otherwise → overwrite file\n */\nexport function writeOutput(content: string, outputPath: string | undefined, append: boolean): void {\n if (outputPath === undefined) {\n process.stdout.write(content);\n return;\n }\n\n // Ensure parent directory exists\n const dir = dirname(outputPath);\n if (dir && !existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n if (append) {\n appendFileSync(outputPath, content, \"utf-8\");\n } else {\n writeFileSync(outputPath, content, \"utf-8\");\n }\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\nimport { lex, parse } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerParseCommand(program: Command): void {\n program\n .command(\"parse\")\n .description(\"Parse a bitmark file to JSON\")\n .argument(\"[INPUT...]\", \"Input: bitmark files, literal strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--stage <STAGE>\", \"Stage to run: all, lex, lex-bitmark, lex-text\", \"all\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .action((inputs: string[], options: { output?: string; append: boolean; stage: string; mode: string }) => {\n const content = readInputs(inputs);\n let result: string;\n\n if (options.stage === \"lex\" || options.stage === \"lex-bitmark\" || options.stage === \"lex-text\") {\n result = lex(content, { stage: options.stage });\n } else {\n result = parse(content, { mode: options.mode as \"optimized\" | \"full\" });\n }\n\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\n\nexport function registerGenerateCommand(program: Command): void {\n program\n .command(\"generate\")\n .description(\"Generate bitmark text from JSON\")\n .argument(\"<INPUT>\", \"Input JSON file\")\n .argument(\"<OUTPUT>\", \"Output bitmark file\")\n .action((_input: string, _output: string) => {\n console.error(\"generate not yet implemented\");\n process.exit(1);\n });\n}\n","// @zen-component: CLI-Convert\n\nimport type { Command } from \"commander\";\nimport { convert } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerConvertCommand(program: Command): void {\n program\n .command(\"convert\")\n .description(\"Auto-detect input format and convert between bitmark and JSON\")\n .argument(\"[INPUT...]\", \"Input: file paths, bitmark/JSON strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-w, --warnings\", \"Enable validation warnings in output\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .option(\"--plain-text\", \"Output text as plain text (debug)\", false)\n .action(\n (\n inputs: string[],\n options: {\n output?: string;\n append: boolean;\n warnings: boolean;\n pretty: boolean;\n indent: string;\n mode: string;\n plainText: boolean;\n },\n ) => {\n const content = readInputs(inputs);\n const result = convert(content, {\n mode: options.mode as \"optimized\" | \"full\",\n warnings: options.warnings,\n plainText: options.plainText,\n pretty: options.pretty,\n indent: parseInt(options.indent, 10),\n });\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { breakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerBreakscapeCommand(program: Command): void {\n program\n .command(\"breakscape\")\n .description(\"Breakscape text (escape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = breakscapeText(content, {\n format: options.format as \"bitmark++\" | \"plainText\",\n location: options.location as \"body\" | \"tag\",\n });\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { unbreakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerUnbreakscapeCommand(program: Command): void {\n program\n .command(\"unbreakscape\")\n .description(\"Unbreakscape text (unescape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = unbreakscapeText(content, {\n format: options.format as \"bitmark++\" | \"plainText\",\n location: options.location as \"body\" | \"tag\",\n });\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Info\n\nimport type { Command } from \"commander\";\nimport { info } from \"../index.js\";\nimport { writeOutput } from \"../utils/io.js\";\n\nexport function registerInfoCommand(program: Command): void {\n program\n .command(\"info\")\n .description(\"Show information about supported bit types\")\n .argument(\"[INFO]\", \"Info type: list, bit, all, deprecated\", \"list\")\n .option(\"-f, --format <FORMAT>\", \"Output format: text or json\", \"text\")\n .option(\"--all\", \"Include deprecated bits\", false)\n .option(\"--bit <NAME>\", \"Filter to specific bit type\")\n .option(\"--deprecated\", \"Show only deprecated bits\", false)\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .action(\n (\n infoType: string,\n options: {\n format: string;\n all: boolean;\n bit?: string;\n deprecated: boolean;\n output?: string;\n append: boolean;\n pretty: boolean;\n indent: string;\n },\n ) => {\n const result = info({\n infoType: infoType as \"list\" | \"bit\" | \"all\" | \"deprecated\",\n format: options.format as \"text\" | \"json\",\n bit: options.bit,\n pretty: options.pretty,\n indent: parseInt(options.indent, 10),\n });\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","#!/usr/bin/env node\n// @zen-component: WASM-TSBindings\n\nimport { Command } from \"commander\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { registerParseCommand } from \"./commands/parse.js\";\nimport { registerGenerateCommand } from \"./commands/generate.js\";\nimport { registerConvertCommand } from \"./commands/convert.js\";\nimport { registerBreakscapeCommand } from \"./commands/breakscape.js\";\nimport { registerUnbreakscapeCommand } from \"./commands/unbreakscape.js\";\nimport { registerInfoCommand } from \"./commands/info.js\";\n\nconst program = new Command();\n\nprogram.name(\"bitmark-parser\").description(\"Parse and generate bitmark text\").version(PACKAGE_INFO.version);\n\nregisterParseCommand(program);\nregisterGenerateCommand(program);\nregisterConvertCommand(program);\nregisterBreakscapeCommand(program);\nregisterUnbreakscapeCommand(program);\nregisterInfoCommand(program);\n\nprogram.parse();\n"]}

@@ -44,3 +44,3 @@ "use strict";

"name": "@gmb/bitmark-parser",
"version": "3.0.1-alpha.3",
"version": "3.0.1-alpha.4",
"author": "Get More Brain Ltd <info@getmorebrain.com>",

@@ -57,18 +57,27 @@ "license": "ISC",

}
function lex(input, optionsJson = "{}") {
return wasm.lex(input, optionsJson);
function lex(input, options = {}) {
return wasm.lex(input, options.stage ?? "lex");
}
function parse(input, optionsJson = "{}") {
return wasm.parse(input, optionsJson);
function parse(input, options = {}) {
return wasm.parse(input, options.mode ?? "optimized");
}
function convert(input, optionsJson = "{}") {
return wasm.convert(input, optionsJson);
function convert(input, options = {}) {
return wasm.convert(input, options.mode ?? "optimized", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);
}
function breakscapeText(input, format = "bitmark++", location = "body") {
function breakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.breakscape_text(input, format, location);
}
function unbreakscapeText(input, format = "bitmark++", location = "body") {
function unbreakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.unbreakscape_text(input, format, location);
}
function info(infoType = "list", format = "text", bit = "", pretty = false, indent = 2) {
function info(options = {}) {
const infoType = options.infoType ?? "list";
const format = options.format ?? "text";
const bit = options.bit ?? "";
const pretty = options.pretty ?? false;
const indent = options.indent ?? 2;
return wasm.info(infoType, format, bit, pretty, indent);

@@ -75,0 +84,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADV9D,yBAA8B;;;AEEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;AFNA,IAAMA,eAAU,kCAAc,aAAe;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AAOvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,cAAsB,MAAc;AACrE,SAAO,KAAK,IAAI,OAAO,WAAW;AACpC;AASO,SAAS,MAAM,OAAe,cAAsB,MAAc;AACvE,SAAO,KAAK,MAAM,OAAO,WAAW;AACtC;AASO,SAAS,QAAQ,OAAe,cAAsB,MAAc;AACzE,SAAO,KAAK,QAAQ,OAAO,WAAW;AACxC;AAUO,SAAS,eAAe,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC7G,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AAUO,SAAS,iBAAiB,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC/G,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAYO,SAAS,KAAK,WAAmB,QAAQ,SAAiB,QAAQ,MAAc,IAAI,SAAkB,OAAO,SAAiB,GAAW;AAC9I,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
{"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.4\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADV9D,yBAA8B;;;AEEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;AFLA,IAAMA,eAAU,kCAAc,aAAe;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AASvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,UAAsB,CAAC,GAAW;AACnE,SAAO,KAAK,IAAI,OAAO,QAAQ,SAAS,KAAK;AAC/C;AASO,SAAS,MAAM,OAAe,UAAwB,CAAC,GAAW;AACvE,SAAO,KAAK,MAAM,OAAO,QAAQ,QAAQ,WAAW;AACtD;AASO,SAAS,QAAQ,OAAe,UAA0B,CAAC,GAAW;AAC3E,SAAO,KAAK,QAAQ,OAAO,QAAQ,QAAQ,aAAa,QAAQ,YAAY,OAAO,QAAQ,aAAa,OAAO,QAAQ,UAAU,OAAO,QAAQ,UAAU,CAAC;AAC7J;AASO,SAAS,eAAe,OAAe,UAA6B,CAAC,GAAW;AACrF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AASO,SAAS,iBAAiB,OAAe,UAA6B,CAAC,GAAW;AACvF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAQO,SAAS,KAAK,UAAuB,CAAC,GAAW;AACtD,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO;AAC3B,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
/**
* Output mode for JSON serialization.
*
* - `"optimized"` — omit keys whose values match their natural defaults.
* - `"full"` — include all keys enumerated from the bitmark configuration.
*/
type OutputMode = "optimized" | "full";
/**
* Lexer stage selector.
*
* - `"lex"` — combined lexer, text output (default).
* - `"lex-bitmark"` — bitmark-level only, text output.
* - `"lex-text"` — text-level only, text output.
* - `"lex-json"` — combined lexer, JSON array output.
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
* - `"lex-text-json"` — text-level only, JSON array output.
*/
type LexStage = "lex" | "lex-bitmark" | "lex-text" | "lex-json" | "lex-bitmark-json" | "lex-text-json";
/** Options for the {@link lex} function. */
interface LexOptions {
/** Selects the lexer pipeline stage (default: `"lex"`). */
stage?: LexStage;
}
/** Options for the {@link parse} function. */
interface ParseOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
}
/** Options for the {@link convert} function. */
interface ConvertOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
/** Include validation warnings in output (default: `false`). */
warnings?: boolean;
/** Output text as plain text — debug mode (default: `false`). */
plainText?: boolean;
/** Prettify JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/** Text format for breakscape / unbreakscape operations. */
type TextFormat = "bitmark++" | "plainText";
/** Text location for breakscape / unbreakscape operations. */
type TextLocation = "body" | "tag";
/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */
interface BreakscapeOptions {
/** Text format (default: `"bitmark++"`). */
format?: TextFormat;
/** Text location (default: `"body"`). */
location?: TextLocation;
}
/** Info query type for the {@link info} function. */
type InfoType = "list" | "bit" | "all" | "deprecated";
/** Output format for the {@link info} function. */
type InfoFormat = "text" | "json";
/** Options for the {@link info} function. */
interface InfoOptions {
/** Info query type (default: `"list"`). */
infoType?: InfoType;
/** Output format (default: `"text"`). */
format?: InfoFormat;
/** Bit name — required when `infoType` is `"bit"`. */
bit?: string;
/** Whether to pretty-print JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/**
* Get the version of the @gmb/bitmark-parser library.

@@ -11,6 +81,6 @@ *

* @param input - The bitmark source text.
* @param optionsJson - JSON string with options: stage.
* @param options - Lex options (e.g. `{ stage: "lex-bitmark" }`).
* @returns Token dump string (one token per line).
*/
declare function lex(input: string, optionsJson?: string): string;
declare function lex(input: string, options?: LexOptions): string;
/**

@@ -20,6 +90,6 @@ * Parse bitmark input text and return the reference JSON format.

* @param input - The bitmark source text.
* @param optionsJson - JSON string with options: mode.
* @param options - Parse options (e.g. `{ mode: "full" }`).
* @returns JSON string of the parsed bitmark document.
*/
declare function parse(input: string, optionsJson?: string): string;
declare function parse(input: string, options?: ParseOptions): string;
/**

@@ -29,6 +99,6 @@ * Auto-detect input format and convert between bitmark and JSON.

* @param input - Bitmark or JSON input text.
* @param optionsJson - JSON string with options: mode, warnings, plainText.
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
* @returns Converted output string.
*/
declare function convert(input: string, optionsJson?: string): string;
declare function convert(input: string, options?: ConvertOptions): string;
/**

@@ -38,7 +108,6 @@ * Breakscape text (escape bitmark special characters).

* @param input - The text to breakscape.
* @param format - Text format: `"bitmark++"` (default) or `"plainText"`.
* @param location - Text location: `"body"` (default) or `"tag"`.
* @param options - Breakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Breakscaped text.
*/
declare function breakscapeText(input: string, format?: string, location?: string): string;
declare function breakscapeText(input: string, options?: BreakscapeOptions): string;
/**

@@ -48,18 +117,13 @@ * Unbreakscape text (unescape bitmark special characters).

* @param input - The text to unbreakscape.
* @param format - Text format: `"bitmark++"` (default) or `"plainText"`.
* @param location - Text location: `"body"` (default) or `"tag"`.
* @param options - Unbreakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Unbreakscaped text.
*/
declare function unbreakscapeText(input: string, format?: string, location?: string): string;
declare function unbreakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Query information about supported bit types.
*
* @param infoType - Info type: `"list"`, `"bit"`, `"all"`, or `"deprecated"`.
* @param format - Output format: `"text"` (default) or `"json"`.
* @param bit - Bit name (required when `infoType` is `"bit"`).
* @param pretty - Whether to pretty-print JSON output.
* @param indent - Indent size for pretty-printing (default: 2).
* @param options - Info options (e.g. `{ infoType: "bit", format: "json", bit: "cloze" }`).
* @returns Information string.
*/
declare function info(infoType?: string, format?: string, bit?: string, pretty?: boolean, indent?: number): string;
declare function info(options?: InfoOptions): string;
/**

@@ -73,2 +137,2 @@ * Generate bitmark text from a JSON AST.

export { breakscapeText, convert, generate, info, lex, parse, unbreakscapeText, version };
export { type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type LexOptions, type LexStage, type OutputMode, type ParseOptions, type TextFormat, type TextLocation, breakscapeText, convert, generate, info, lex, parse, unbreakscapeText, version };
/**
* Output mode for JSON serialization.
*
* - `"optimized"` — omit keys whose values match their natural defaults.
* - `"full"` — include all keys enumerated from the bitmark configuration.
*/
type OutputMode = "optimized" | "full";
/**
* Lexer stage selector.
*
* - `"lex"` — combined lexer, text output (default).
* - `"lex-bitmark"` — bitmark-level only, text output.
* - `"lex-text"` — text-level only, text output.
* - `"lex-json"` — combined lexer, JSON array output.
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
* - `"lex-text-json"` — text-level only, JSON array output.
*/
type LexStage = "lex" | "lex-bitmark" | "lex-text" | "lex-json" | "lex-bitmark-json" | "lex-text-json";
/** Options for the {@link lex} function. */
interface LexOptions {
/** Selects the lexer pipeline stage (default: `"lex"`). */
stage?: LexStage;
}
/** Options for the {@link parse} function. */
interface ParseOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
}
/** Options for the {@link convert} function. */
interface ConvertOptions {
/** JSON output mode (default: `"optimized"`). */
mode?: OutputMode;
/** Include validation warnings in output (default: `false`). */
warnings?: boolean;
/** Output text as plain text — debug mode (default: `false`). */
plainText?: boolean;
/** Prettify JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/** Text format for breakscape / unbreakscape operations. */
type TextFormat = "bitmark++" | "plainText";
/** Text location for breakscape / unbreakscape operations. */
type TextLocation = "body" | "tag";
/** Options for the {@link breakscapeText} and {@link unbreakscapeText} functions. */
interface BreakscapeOptions {
/** Text format (default: `"bitmark++"`). */
format?: TextFormat;
/** Text location (default: `"body"`). */
location?: TextLocation;
}
/** Info query type for the {@link info} function. */
type InfoType = "list" | "bit" | "all" | "deprecated";
/** Output format for the {@link info} function. */
type InfoFormat = "text" | "json";
/** Options for the {@link info} function. */
interface InfoOptions {
/** Info query type (default: `"list"`). */
infoType?: InfoType;
/** Output format (default: `"text"`). */
format?: InfoFormat;
/** Bit name — required when `infoType` is `"bit"`. */
bit?: string;
/** Whether to pretty-print JSON output (default: `false`). */
pretty?: boolean;
/** Indent size for pretty-printing (default: `2`). */
indent?: number;
}
/**
* Get the version of the @gmb/bitmark-parser library.

@@ -11,6 +81,6 @@ *

* @param input - The bitmark source text.
* @param optionsJson - JSON string with options: stage.
* @param options - Lex options (e.g. `{ stage: "lex-bitmark" }`).
* @returns Token dump string (one token per line).
*/
declare function lex(input: string, optionsJson?: string): string;
declare function lex(input: string, options?: LexOptions): string;
/**

@@ -20,6 +90,6 @@ * Parse bitmark input text and return the reference JSON format.

* @param input - The bitmark source text.
* @param optionsJson - JSON string with options: mode.
* @param options - Parse options (e.g. `{ mode: "full" }`).
* @returns JSON string of the parsed bitmark document.
*/
declare function parse(input: string, optionsJson?: string): string;
declare function parse(input: string, options?: ParseOptions): string;
/**

@@ -29,6 +99,6 @@ * Auto-detect input format and convert between bitmark and JSON.

* @param input - Bitmark or JSON input text.
* @param optionsJson - JSON string with options: mode, warnings, plainText.
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
* @returns Converted output string.
*/
declare function convert(input: string, optionsJson?: string): string;
declare function convert(input: string, options?: ConvertOptions): string;
/**

@@ -38,7 +108,6 @@ * Breakscape text (escape bitmark special characters).

* @param input - The text to breakscape.
* @param format - Text format: `"bitmark++"` (default) or `"plainText"`.
* @param location - Text location: `"body"` (default) or `"tag"`.
* @param options - Breakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Breakscaped text.
*/
declare function breakscapeText(input: string, format?: string, location?: string): string;
declare function breakscapeText(input: string, options?: BreakscapeOptions): string;
/**

@@ -48,18 +117,13 @@ * Unbreakscape text (unescape bitmark special characters).

* @param input - The text to unbreakscape.
* @param format - Text format: `"bitmark++"` (default) or `"plainText"`.
* @param location - Text location: `"body"` (default) or `"tag"`.
* @param options - Unbreakscape options (e.g. `{ format: "plainText", location: "tag" }`).
* @returns Unbreakscaped text.
*/
declare function unbreakscapeText(input: string, format?: string, location?: string): string;
declare function unbreakscapeText(input: string, options?: BreakscapeOptions): string;
/**
* Query information about supported bit types.
*
* @param infoType - Info type: `"list"`, `"bit"`, `"all"`, or `"deprecated"`.
* @param format - Output format: `"text"` (default) or `"json"`.
* @param bit - Bit name (required when `infoType` is `"bit"`).
* @param pretty - Whether to pretty-print JSON output.
* @param indent - Indent size for pretty-printing (default: 2).
* @param options - Info options (e.g. `{ infoType: "bit", format: "json", bit: "cloze" }`).
* @returns Information string.
*/
declare function info(infoType?: string, format?: string, bit?: string, pretty?: boolean, indent?: number): string;
declare function info(options?: InfoOptions): string;
/**

@@ -73,2 +137,2 @@ * Generate bitmark text from a JSON AST.

export { breakscapeText, convert, generate, info, lex, parse, unbreakscapeText, version };
export { type BreakscapeOptions, type ConvertOptions, type InfoFormat, type InfoOptions, type InfoType, type LexOptions, type LexStage, type OutputMode, type ParseOptions, type TextFormat, type TextLocation, breakscapeText, convert, generate, info, lex, parse, unbreakscapeText, version };

@@ -7,3 +7,3 @@ // src/index.ts

"name": "@gmb/bitmark-parser",
"version": "3.0.1-alpha.3",
"version": "3.0.1-alpha.4",
"author": "Get More Brain Ltd <info@getmorebrain.com>",

@@ -20,18 +20,27 @@ "license": "ISC",

}
function lex(input, optionsJson = "{}") {
return wasm.lex(input, optionsJson);
function lex(input, options = {}) {
return wasm.lex(input, options.stage ?? "lex");
}
function parse(input, optionsJson = "{}") {
return wasm.parse(input, optionsJson);
function parse(input, options = {}) {
return wasm.parse(input, options.mode ?? "optimized");
}
function convert(input, optionsJson = "{}") {
return wasm.convert(input, optionsJson);
function convert(input, options = {}) {
return wasm.convert(input, options.mode ?? "optimized", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);
}
function breakscapeText(input, format = "bitmark++", location = "body") {
function breakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.breakscape_text(input, format, location);
}
function unbreakscapeText(input, format = "bitmark++", location = "body") {
function unbreakscapeText(input, options = {}) {
const format = options.format ?? "bitmark++";
const location = options.location ?? "body";
return wasm.unbreakscape_text(input, format, location);
}
function info(infoType = "list", format = "text", bit = "", pretty = false, indent = 2) {
function info(options = {}) {
const infoType = options.infoType ?? "list";
const format = options.format ?? "text";
const bit = options.bit ?? "";
const pretty = options.pretty ?? false;
const indent = options.indent ?? 2;
return wasm.info(infoType, format, bit, pretty, indent);

@@ -38,0 +47,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";AAEA,SAAS,qBAAqB;;;ACEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ADNA,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AAOvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,cAAsB,MAAc;AACrE,SAAO,KAAK,IAAI,OAAO,WAAW;AACpC;AASO,SAAS,MAAM,OAAe,cAAsB,MAAc;AACvE,SAAO,KAAK,MAAM,OAAO,WAAW;AACtC;AASO,SAAS,QAAQ,OAAe,cAAsB,MAAc;AACzE,SAAO,KAAK,QAAQ,OAAO,WAAW;AACxC;AAUO,SAAS,eAAe,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC7G,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AAUO,SAAS,iBAAiB,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC/G,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAYO,SAAS,KAAK,WAAmB,QAAQ,SAAiB,QAAQ,MAAc,IAAI,SAAkB,OAAO,SAAiB,GAAW;AAC9I,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
{"version":3,"sources":["../src/index.ts","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.js\";\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param options - Lex options (e.g. `{ stage: \"lex-bitmark\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string.\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.4\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";AAEA,SAAS,qBAAqB;;;ACEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ADLA,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AASvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,UAAsB,CAAC,GAAW;AACnE,SAAO,KAAK,IAAI,OAAO,QAAQ,SAAS,KAAK;AAC/C;AASO,SAAS,MAAM,OAAe,UAAwB,CAAC,GAAW;AACvE,SAAO,KAAK,MAAM,OAAO,QAAQ,QAAQ,WAAW;AACtD;AASO,SAAS,QAAQ,OAAe,UAA0B,CAAC,GAAW;AAC3E,SAAO,KAAK,QAAQ,OAAO,QAAQ,QAAQ,aAAa,QAAQ,YAAY,OAAO,QAAQ,aAAa,OAAO,QAAQ,UAAU,OAAO,QAAQ,UAAU,CAAC;AAC7J;AASO,SAAS,eAAe,OAAe,UAA6B,CAAC,GAAW;AACrF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AASO,SAAS,iBAAiB,OAAe,UAA6B,CAAC,GAAW;AACvF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAQO,SAAS,KAAK,UAAuB,CAAC,GAAW;AACtD,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO;AAC3B,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
{
"name": "@gmb/bitmark-parser",
"version": "3.0.1-alpha.3",
"version": "3.0.1-alpha.4",
"description": "A parser for bitmark text, powered by WebAssembly.",

@@ -5,0 +5,0 @@ "author": "Get More Brain Ltd <info@getmorebrain.com>",

@@ -5,3 +5,3 @@ /* tslint:disable */

export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
export const convert: (a: number, b: number, c: number, d: number, e: number) => void;
export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;

@@ -8,0 +8,0 @@ export const lex: (a: number, b: number, c: number, d: number, e: number) => void;

@@ -22,15 +22,13 @@ /* tslint:disable */

*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* `mode`: `"optimized"` (default) or `"full"`
*/
export function parse(input: string, options_json: string): string;
export function parse(input: string, mode: string): string;
/**
* Auto-detect input format and convert between bitmark and JSON.
*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* - `"warnings"`: `true` or `false` (default)
* - `"plainText"`: `true` or `false` (default)
* - `"pretty"`: `true` or `false` (default)
* - `"indent"`: number (default: 2)
* `mode`: `"optimized"` (default) or `"full"`
* `warnings`: whether to include validation warnings (default: false)
* `plain_text`: output text as plain text — debug mode (default: false)
* `pretty`: prettify JSON output (default: false)
* `indent`: indent size for pretty-printing (default: 2)
*

@@ -40,3 +38,3 @@ * Returns JSON if input is bitmark, or an error message if input is JSON

*/
export function convert(input: string, options_json: string): string;
export function convert(input: string, mode: string, warnings: boolean, plain_text: boolean, pretty: boolean, indent: number): string;
/**

@@ -56,4 +54,3 @@ * Query information about supported bit types.

*
* `options_json` is a JSON string with optional fields:
* - `"stage"`: selects the lexer pipeline:
* `stage` selects the lexer pipeline:
* - `"lex"` — combined (default)

@@ -66,2 +63,2 @@ * - `"lex-bitmark"` — bitmark-level only

*/
export function lex(input: string, options_json: string): string;
export function lex(input: string, stage: string): string;

@@ -159,9 +159,8 @@

*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* `mode`: `"optimized"` (default) or `"full"`
* @param {string} input
* @param {string} options_json
* @param {string} mode
* @returns {string}
*/
module.exports.parse = function(input, options_json) {
module.exports.parse = function(input, mode) {
let deferred3_0;

@@ -173,3 +172,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -191,8 +190,7 @@ wasm.parse(retptr, ptr0, len0, ptr1, len1);

*
* `options_json` is a JSON string with optional fields:
* - `"mode"`: `"optimized"` (default) or `"full"`
* - `"warnings"`: `true` or `false` (default)
* - `"plainText"`: `true` or `false` (default)
* - `"pretty"`: `true` or `false` (default)
* - `"indent"`: number (default: 2)
* `mode`: `"optimized"` (default) or `"full"`
* `warnings`: whether to include validation warnings (default: false)
* `plain_text`: output text as plain text — debug mode (default: false)
* `pretty`: prettify JSON output (default: false)
* `indent`: indent size for pretty-printing (default: 2)
*

@@ -202,6 +200,10 @@ * Returns JSON if input is bitmark, or an error message if input is JSON

* @param {string} input
* @param {string} options_json
* @param {string} mode
* @param {boolean} warnings
* @param {boolean} plain_text
* @param {boolean} pretty
* @param {number} indent
* @returns {string}
*/
module.exports.convert = function(input, options_json) {
module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
let deferred3_0;

@@ -213,5 +215,5 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;
wasm.convert(retptr, ptr0, len0, ptr1, len1);
wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);

@@ -270,4 +272,3 @@ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);

*
* `options_json` is a JSON string with optional fields:
* - `"stage"`: selects the lexer pipeline:
* `stage` selects the lexer pipeline:
* - `"lex"` — combined (default)

@@ -280,6 +281,6 @@ * - `"lex-bitmark"` — bitmark-level only

* @param {string} input
* @param {string} options_json
* @param {string} stage
* @returns {string}
*/
module.exports.lex = function(input, options_json) {
module.exports.lex = function(input, stage) {
let deferred3_0;

@@ -291,3 +292,3 @@ let deferred3_1;

const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;

@@ -294,0 +295,0 @@ wasm.lex(retptr, ptr0, len0, ptr1, len1);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet