md2x 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ "use strict";(()=>{var He=Object.create;var fe=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var ve=(r,e)=>()=>(r&&(e=r(r=0)),e);var X=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var je=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ze(e))!qe.call(r,i)&&i!==t&&fe(r,i,{get:()=>e[i],enumerable:!(n=Oe(e,i))||n.enumerable});return r};var Ge=(r,e,t)=>(t=r!=null?He(We(r)):{},je(e||!r||!r.__esModule?fe(t,"default",{value:r,enumerable:!0}):t,r));var me=X($=>{"use strict";p();$.byteLength=Ve;$.toByteArray=Je;$.fromByteArray=Qe;var x=[],y=[],Ye=typeof Uint8Array<"u"?Uint8Array:Array,J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(T=0,pe=J.length;T<pe;++T)x[T]=J[T],y[J.charCodeAt(T)]=T;var T,pe;y[45]=62;y[95]=63;function de(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Ve(r){var e=de(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Xe(r,e,t){return(e+t)*3/4-t}function Je(r){var e,t=de(r),n=t[0],i=t[1],o=new Ye(Xe(r,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=y[r.charCodeAt(c)]<<18|y[r.charCodeAt(c+1)]<<12|y[r.charCodeAt(c+2)]<<6|y[r.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=y[r.charCodeAt(c)]<<2|y[r.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=y[r.charCodeAt(c)]<<10|y[r.charCodeAt(c+1)]<<4|y[r.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Ke(r){return x[r>>18&63]+x[r>>12&63]+x[r>>6&63]+x[r&63]}function Ze(r,e,t){for(var n,i=[],o=e;o<t;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),i.push(Ke(n));return i.join("")}function Qe(r){for(var e,t=r.length,n=t%3,i=[],o=16383,s=0,a=t-n;s<a;s+=o)i.push(Ze(r,s,s+o>a?a:s+o));return n===1?(e=r[t-1],i.push(x[e>>2]+x[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(x[e>>10]+x[e>>4&63]+x[e<<2&63]+"=")),i.join("")}});var ge=X(K=>{p();K.read=function(r,e,t,n,i){var o,s,a=i*8-n-1,c=(1<<a)-1,f=c>>1,l=-7,h=t?i-1:0,w=t?-1:1,g=r[e+h];for(h+=w,o=g&(1<<-l)-1,g>>=-l,l+=a;l>0;o=o*256+r[e+h],h+=w,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=s*256+r[e+h],h+=w,l-=8);if(o===0)o=1-f;else{if(o===c)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-f}return(g?-1:1)*s*Math.pow(2,o-n)};K.write=function(r,e,t,n,i,o){var s,a,c,f=o*8-i-1,l=(1<<f)-1,h=l>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,N=n?1:-1,R=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+h>=1?e+=w/c:e+=w*Math.pow(2,1-h),e*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s=s+h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;r[t+g]=a&255,g+=N,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;r[t+g]=s&255,g+=N,s/=256,f-=8);r[t+g-N]|=R*128}});var De=X(L=>{"use strict";p();var Z=me(),M=ge(),ye=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;L.Buffer=u;L.SlowBuffer=ot;L.INSPECT_MAX_BYTES=50;var H=2147483647;L.kMaxLength=H;u.TYPED_ARRAY_SUPPORT=et();!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function et(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function I(r){if(r>H)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,u.prototype),e}function u(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return re(r)}return Be(r,e,t)}u.poolSize=8192;function Be(r,e,t){if(typeof r=="string")return rt(r,e);if(ArrayBuffer.isView(r))return nt(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(E(r,ArrayBuffer)||r&&E(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(E(r,SharedArrayBuffer)||r&&E(r.buffer,SharedArrayBuffer)))return ee(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return u.from(n,e,t);let i=it(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return u.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}u.from=function(r,e,t){return Be(r,e,t)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Ie(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function tt(r,e,t){return Ie(r),r<=0?I(r):e!==void 0?typeof t=="string"?I(r).fill(e,t):I(r).fill(e):I(r)}u.alloc=function(r,e,t){return tt(r,e,t)};function re(r){return Ie(r),I(r<0?0:ne(r)|0)}u.allocUnsafe=function(r){return re(r)};u.allocUnsafeSlow=function(r){return re(r)};function rt(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Fe(r,e)|0,n=I(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function Q(r){let e=r.length<0?0:ne(r.length)|0,t=I(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function nt(r){if(E(r,Uint8Array)){let e=new Uint8Array(r);return ee(e.buffer,e.byteOffset,e.byteLength)}return Q(r)}function ee(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,u.prototype),n}function it(r){if(u.isBuffer(r)){let e=ne(r.length)|0,t=I(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||oe(r.length)?I(0):Q(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Q(r.data)}function ne(r){if(r>=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.toString(16)+" bytes");return r|0}function ot(r){return+r!=r&&(r=0),u.alloc(+r)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype};u.compare=function(e,t){if(E(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),E(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==t[o]){n=e[o],i=t[o];break}return n<i?-1:i<n?1:0};u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=u.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){let s=e[n];if(E(s,Uint8Array))o+s.length>i.length?(u.isBuffer(s)||(s=u.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(u.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Fe(r,e){if(u.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||E(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return te(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Me(r).length;default:if(i)return n?-1:te(r).length;e=(""+e).toLowerCase(),i=!0}}u.byteLength=Fe;function st(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return gt(this,e,t);case"utf8":case"utf-8":return Re(this,e,t);case"ascii":return dt(this,e,t);case"latin1":case"binary":return mt(this,e,t);case"base64":return ft(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function U(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}u.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)U(this,t,t+1);return this};u.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)U(this,t,t+3),U(this,t+1,t+2);return this};u.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)U(this,t,t+7),U(this,t+1,t+6),U(this,t+2,t+5),U(this,t+3,t+4);return this};u.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Re(this,0,e):st.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.inspect=function(){let e="",t=L.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};ye&&(u.prototype[ye]=u.prototype.inspect);u.prototype.compare=function(e,t,n,i,o){if(E(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-t,c=Math.min(s,a),f=this.slice(i,o),l=e.slice(t,n);for(let h=0;h<c;++h)if(f[h]!==l[h]){s=f[h],a=l[h];break}return s<a?-1:a<s?1:0};function Ae(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,oe(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=u.from(e,n)),u.isBuffer(e))return e.length===0?-1:we(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):we(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function we(r,e,t,n,i){let o=1,s=r.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,s/=2,a/=2,t/=2}function c(l,h){return o===1?l[h]:l.readUInt16BE(h*o)}let f;if(i){let l=-1;for(f=t;f<s;f++)if(c(r,f)===c(e,l===-1?0:f-l)){if(l===-1&&(l=f),f-l+1===a)return l*o}else l!==-1&&(f-=f-l),l=-1}else for(t+a>s&&(t=s-a),f=t;f>=0;f--){let l=!0;for(let h=0;h<a;h++)if(c(r,f+h)!==c(e,h)){l=!1;break}if(l)return f}return-1}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};u.prototype.indexOf=function(e,t,n){return Ae(this,e,t,n,!0)};u.prototype.lastIndexOf=function(e,t,n){return Ae(this,e,t,n,!1)};function ut(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(e.substr(s*2,2),16);if(oe(a))return s;r[t+s]=a}return s}function at(r,e,t,n){return O(te(e,r.length-t),r,t,n)}function ct(r,e,t,n){return O(Bt(e),r,t,n)}function lt(r,e,t,n){return O(Me(e),r,t,n)}function ht(r,e,t,n){return O(It(e,r.length-t),r,t,n)}u.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return ut(this,e,t,n);case"utf8":case"utf-8":return at(this,e,t,n);case"ascii":case"latin1":case"binary":return ct(this,e,t,n);case"base64":return lt(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ft(r,e,t){return e===0&&t===r.length?Z.fromByteArray(r):Z.fromByteArray(r.slice(e,t))}function Re(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let o=r[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=t){let c,f,l,h;switch(a){case 1:o<128&&(s=o);break;case 2:c=r[i+1],(c&192)===128&&(h=(o&31)<<6|c&63,h>127&&(s=h));break;case 3:c=r[i+1],f=r[i+2],(c&192)===128&&(f&192)===128&&(h=(o&15)<<12|(c&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=r[i+1],f=r[i+2],l=r[i+3],(c&192)===128&&(f&192)===128&&(l&192)===128&&(h=(o&15)<<18|(c&63)<<12|(f&63)<<6|l&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return pt(n)}var xe=4096;function pt(r){let e=r.length;if(e<=xe)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=xe));return t}function dt(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function mt(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function gt(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let o=e;o<t;++o)i+=Ft[r[o]];return i}function yt(r,e,t){let n=r.slice(e,t),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,u.prototype),i};function d(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||d(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return i};u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||d(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i};u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e=e>>>0,t||d(e,1,this.length),this[e]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||d(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||d(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||d(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||d(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readBigUInt64LE=A(function(e){e=e>>>0,D(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&k(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});u.prototype.readBigUInt64BE=A(function(e){e=e>>>0,D(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&k(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});u.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||d(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};u.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||d(e,t,this.length);let i=t,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};u.prototype.readInt8=function(e,t){return e=e>>>0,t||d(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,t){e=e>>>0,t||d(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(e,t){e=e>>>0,t||d(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(e,t){return e=e>>>0,t||d(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,t){return e=e>>>0,t||d(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readBigInt64LE=A(function(e){e=e>>>0,D(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&k(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});u.prototype.readBigInt64BE=A(function(e){e=e>>>0,D(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&k(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});u.prototype.readFloatLE=function(e,t){return e=e>>>0,t||d(e,4,this.length),M.read(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,t){return e=e>>>0,t||d(e,4,this.length),M.read(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||d(e,8,this.length),M.read(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||d(e,8,this.length),M.read(this,e,!1,52,8)};function m(r,e,t,n,i,o){if(!u.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;m(this,e,t,n,a,0)}let o=1,s=0;for(this[t]=e&255;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;m(this,e,t,n,a,0)}let o=n-1,s=1;for(this[t+o]=e&255;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n};u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,1,255,0),this[t]=e&255,t+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function be(r,e,t,n,i){_e(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,t}function Te(r,e,t,n,i){_e(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=s,s=s>>8,r[t+2]=s,s=s>>8,r[t+1]=s,s=s>>8,r[t]=s,t+8}u.prototype.writeBigUInt64LE=A(function(e,t=0){return be(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeBigUInt64BE=A(function(e,t=0){return Te(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);m(this,e,t,n,c-1,-c)}let o=0,s=1,a=0;for(this[t]=e&255;++o<n&&(s*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n};u.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);m(this,e,t,n,c-1,-c)}let o=n-1,s=1,a=0;for(this[t+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n};u.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};u.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};u.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};u.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};u.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||m(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};u.prototype.writeBigInt64LE=A(function(e,t=0){return be(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});u.prototype.writeBigInt64BE=A(function(e,t=0){return Te(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ue(r,e,t,n,i,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ce(r,e,t,n,i){return e=+e,t=t>>>0,i||Ue(r,e,t,4,34028234663852886e22,-34028234663852886e22),M.write(r,e,t,n,23,4),t+4}u.prototype.writeFloatLE=function(e,t,n){return Ce(this,e,t,!0,n)};u.prototype.writeFloatBE=function(e,t,n){return Ce(this,e,t,!1,n)};function Se(r,e,t,n,i){return e=+e,t=t>>>0,i||Ue(r,e,t,8,17976931348623157e292,-17976931348623157e292),M.write(r,e,t,n,52,8),t+8}u.prototype.writeDoubleLE=function(e,t,n){return Se(this,e,t,!0,n)};u.prototype.writeDoubleBE=function(e,t,n){return Se(this,e,t,!1,n)};u.prototype.copy=function(e,t,n,i){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),o};u.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{let s=u.isBuffer(e)?e:u.from(e,i),a=s.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var _={};function ie(r,e,t){_[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}ie("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ie("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);ie("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Ee(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Ee(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ee(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function wt(r,e,t){D(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&k(e,r.length-(t+1))}function _e(r,e,t,n,i,o){if(r>t||r<e){let s=typeof e=="bigint"?"n":"",a;throw o>3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${t}${s}`,new _.ERR_OUT_OF_RANGE("value",a,r)}wt(n,i,o)}function D(r,e){if(typeof r!="number")throw new _.ERR_INVALID_ARG_TYPE(e,"number",r)}function k(r,e,t){throw Math.floor(r)!==r?(D(r,t),new _.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new _.ERR_BUFFER_OUT_OF_BOUNDS:new _.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var xt=/[^+/0-9A-Za-z-_]/g;function Et(r){if(r=r.split("=")[0],r=r.trim().replace(xt,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function te(r,e){e=e||1/0;let t,n=r.length,i=null,o=[];for(let s=0;s<n;++s){if(t=r.charCodeAt(s),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Bt(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function It(r,e){let t,n,i,o=[];for(let s=0;s<r.length&&!((e-=2)<0);++s)t=r.charCodeAt(s),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function Me(r){return Z.toByteArray(Et(r))}function O(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function E(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function oe(r){return r!==r}var Ft=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e})();function A(r){return typeof BigInt>"u"?At:r}function At(){throw new Error("BigInt not supported")}});var Le,p=ve(()=>{"use strict";Le=Ge(De(),1);globalThis.Buffer=Le.Buffer});p();p();p();function z(r){if(typeof document>"u")return bt(r);try{let e=document.createElement("template");return e.innerHTML=r,Rt(e.content),e.innerHTML}catch{return r}}function Rt(r){let e=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","AUDIO","VIDEO"]),t=[];for(Array.from(r.childNodes).forEach(n=>{n.nodeType===Node.ELEMENT_NODE?t.push(n):n.nodeType===Node.COMMENT_NODE&&n.remove()});t.length>0;){let n=t.pop();if(e.has(n.tagName)){n.remove();continue}let i=Array.from(n.attributes||[]);for(let o of i)(o.name.startsWith("on")||o.name==="href"&&o.value.trim().toLowerCase().startsWith("javascript:"))&&n.removeAttribute(o.name);Array.from(n.childNodes).forEach(o=>{o.nodeType===Node.ELEMENT_NODE?t.push(o):o.nodeType===Node.COMMENT_NODE&&o.remove()})}}function Ne(r){if(typeof document>"u")return Tt(r);let e=document.createElement("div");return e.innerHTML=r,e.textContent.trim().length>0||e.querySelector("*")!==null}function bt(r){let e=r;return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<iframe\b[\s\S]*?<\/iframe>/gi,"").replace(/<object\b[\s\S]*?<\/object>/gi,"").replace(/<embed\b[\s\S]*?<\/embed>/gi,"").replace(/<audio\b[\s\S]*?<\/audio>/gi,"").replace(/<video\b[\s\S]*?<\/video>/gi,""),e=e.replace(/\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),e=e.replace(/\shref\s*=\s*(["'])\s*javascript:[\s\S]*?\1/gi,' href="#"'),e}function Tt(r){let e=(r||"").replace(/<!--[\s\S]*?-->/g,"").replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").trim();return e?!!(e.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim().length>0||/<(img|svg|table|pre|code|hr|br|math|canvas|iframe|object|embed)\b/i.test(e)):!1}p();p();var W=class{constructor(e){this._initialized=!1;this.type=e}createContainer(){let e=document.createElement("div");return e.id="render-container-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),e.style.cssText="position: absolute; left: -9999px; top: -9999px;",document.body.appendChild(e),e}removeContainer(e){e&&e.parentNode&&e.parentNode.removeChild(e)}async initialize(e=null){this._initialized=!0}isInitialized(){return this._initialized}async render(e,t){throw new Error("render() must be implemented by subclass")}async mountToDom(e,t,n){let i=await this.render(e,t);if(!i||!i.base64){let s=document.createElement("div");return s.textContent=`Renderer returned empty result: ${this.type}`,n.appendChild(s),{root:s,cleanup:()=>{try{s.remove()}catch{}}}}let o=document.createElement("img");return o.style.maxWidth="100%",o.style.height="auto",o.alt=`${this.type} diagram`,o.src=`data:image/${i.format};base64,${i.base64}`,n.appendChild(o),{root:o,cleanup:()=>{try{o.remove()}catch{}}}}validateInput(e){if(!e||typeof e=="string"&&e.trim()==="")throw new Error(`Empty ${this.type} input provided`)}preprocessInput(e){return e}calculateCanvasScale(e){let n=e?.fontSize||12;return 14/16*(n/12)*4}async renderSvgToCanvas(e,t,n,i=null){return e=e.replace(/<style>/,"<style>foreignObject { overflow: visible; }"),new Promise((o,s)=>{let a=new Image;a.crossOrigin="Anonymous";let c=btoa(unescape(encodeURIComponent(e)));a.src=`data:image/svg+xml;base64,${c}`,a.onload=()=>{let f=document.createElement("canvas");f.width=t,f.height=n;let l=f.getContext("2d");i&&(l.font=`14px ${i}`),l.drawImage(a,0,0,t,n),o(f)},a.onerror=f=>{s(new Error("Failed to load SVG into image for rendering"))}})}};p();var ke=null;function Pe(){return ke?.fetch?ke.fetch:{fetchAsDataUrl:async()=>null}}var q=class extends W{constructor(){super("html")}async render(e,t){return this.validateInput(e),await this.renderHtmlToPng(e,t)}async convertRemoteImagesToBase64(e){let t=Pe(),n=e.querySelectorAll("img[src]"),i=Array.from(n).map(async o=>{let s=o.getAttribute("src");if(!s||s.startsWith("data:")||s.startsWith("blob:")||!s.startsWith("http://")&&!s.startsWith("https://"))return;let a=await t.fetchAsDataUrl(s);a&&o.setAttribute("src",a)});await Promise.all(i)}async renderHtmlToPng(e,t){let n=z(e);if(!Ne(n))return null;let i=t?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",o=this.calculateCanvasScale(t),s="http://www.w3.org/2000/svg",a=2e3*o,c=2e3*o,f=document.createElementNS(s,"svg");f.setAttribute("xmlns",s),f.setAttribute("width",String(a)),f.setAttribute("height",String(c));let l=document.createElementNS(s,"foreignObject");l.setAttribute("width",String(a)),l.setAttribute("height",String(c));let h=document.createElement("div");h.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),h.style.cssText=`display: inline-block; overflow: hidden; outline: 1px solid #ff0000; outline-offset: 0; transform: scale(${o}); transform-origin: top left;`;let w=document.createElement("div");w.style.cssText=`display: inline-block; font-family: ${i};`,w.innerHTML=n,await this.convertRemoteImagesToBase64(w),h.appendChild(w),l.appendChild(h),f.appendChild(l);let g=new XMLSerializer().serializeToString(f),N="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(g),R=new Image;R.src=N,await R.decode();let C=document.createElement("canvas");C.width=R.naturalWidth,C.height=R.naturalHeight;let P=C.getContext("2d",{willReadFrequently:!0});if(!P)throw new Error("Failed to get canvas 2D context");P.drawImage(R,0,0);let se=C.width,ue=C.height,j=P.getImageData(0,0,se,1).data,ae=1;for(let B=se-1;B>=0;B--){let b=B*4;if(j[b]>200&&j[b+1]<50&&j[b+2]<50){ae=B;break}}let G=P.getImageData(0,0,1,ue).data,ce=1;for(let B=ue-1;B>=0;B--){let b=B*4;if(G[b]>200&&G[b+1]<50&&G[b+2]<50){ce=B;break}}let le=Math.ceil(o),Y=Math.max(1,ae-le),V=Math.max(1,ce-le),S=document.createElement("canvas");S.width=Y,S.height=V;let he=S.getContext("2d");if(!he)throw new Error("Failed to get canvas 2D context");return he.drawImage(C,0,0,Y,V,0,0,Y,V),{base64:S.toDataURL("image/png").replace(/^data:image\/png;base64,/,""),width:S.width,height:S.height,format:"png"}}};var v=class extends q{async mountToDom(e,t,n){if(typeof e!="string")throw new Error("HTML input must be a string");this.validateInput(e);let i=z(e);return n.innerHTML=i,{root:n,cleanup:()=>{try{n.innerHTML=""}catch{}}}}};p();function Ut(){return globalThis}function Ct(){let r=Ut();return r.__md2x_renderer_registry__||(r.__md2x_renderer_registry__=new Map),r.__md2x_renderer_registry__}function $e(r){Ct().set(r.type,r)}$e(new v);})();
2
+ /*! Bundled license information:
3
+
4
+ ieee754/index.js:
5
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
6
+
7
+ buffer/index.js:
8
+ (*!
9
+ * The buffer module from node.js, for the browser.
10
+ *
11
+ * @author Feross Aboukhadijeh <https://feross.org>
12
+ * @license MIT
13
+ *)
14
+ */