@cbortech/cbor 0.26.7 → 0.26.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +0 -19
- package/README.md +0 -19
- package/dist/ast/CborByteString.d.ts +11 -0
- package/dist/ast/CborTextString.d.ts +16 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -1
- package/dist/cddl/index.cjs +1 -1
- package/dist/cddl/index.js +1 -1
- package/dist/cdn/index.cjs +2 -2
- package/dist/cdn/index.cjs.map +1 -1
- package/dist/cdn/index.d.ts +2 -0
- package/dist/cdn/index.js +26 -26
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/serialize-utils.d.ts +35 -14
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/mapEntries-BJzyBUH5.cjs +13 -0
- package/dist/mapEntries-BJzyBUH5.cjs.map +1 -0
- package/dist/{mapEntries-DxrDre2P.js → mapEntries-Ci_dppP6.js} +1151 -1373
- package/dist/mapEntries-Ci_dppP6.js.map +1 -0
- package/dist/{schema-t_bdPk8_.cjs → schema-DgnkH0P6.cjs} +3 -3
- package/dist/{schema-t_bdPk8_.cjs.map → schema-DgnkH0P6.cjs.map} +1 -1
- package/dist/{schema-Bofmsptw.js → schema-y8G5mDIS.js} +3 -3
- package/dist/{schema-Bofmsptw.js.map → schema-y8G5mDIS.js.map} +1 -1
- package/dist/tokenizer-BD08xbyd.cjs +36 -0
- package/dist/tokenizer-BD08xbyd.cjs.map +1 -0
- package/dist/{tokenizer-CeuixxXi.js → tokenizer-N-vAvRdj.js} +350 -14
- package/dist/tokenizer-N-vAvRdj.js.map +1 -0
- package/dist/types.d.ts +14 -7
- package/package.json +1 -2
- package/dist/mapEntries-D2NyeCX3.cjs +0 -17
- package/dist/mapEntries-D2NyeCX3.cjs.map +0 -1
- package/dist/mapEntries-DxrDre2P.js.map +0 -1
- package/dist/tokenizer-CeuixxXi.js.map +0 -1
- package/dist/tokenizer-EciPlN0n.cjs +0 -30
- package/dist/tokenizer-EciPlN0n.cjs.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const e=require("./tokenizer-BD08xbyd.cjs");var t=Symbol.for(`cbor.tag`),n=class{valueOf(){return null}toJSON(){return null}},r=class{valueOf(){}toJSON(){}};function i(e){if(!c(e))return;let n=e[t];return typeof n==`bigint`?n:void 0}function a(e,i){let a;switch(typeof e){case`number`:a=new Number(e);break;case`string`:a=new String(e);break;case`boolean`:a=new Boolean(e);break;case`bigint`:a=Object(e);break;case`undefined`:a=new r;break;case`object`:if(e===null){a=new n;break}a=e;break;default:throw TypeError(`setCborTag: cannot tag value of type ${typeof e}`)}return a[t]=i,a}function o(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof n)return null;if(!(e instanceof r))return typeof e==`object`&&e&&delete e[t],e}function s(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof n)return null;if(!(e instanceof r))return e}function c(e){return typeof e==`object`&&!!e}var l=class{constructor(){}static symbol=t;static Null=n;static Undefined=r;static get(e){return i(e)}static set(e,t){return a(e,t)}static remove(e){return o(e)}static getValue(e){return s(e)}},u=Symbol(`cbor.omit`),d=class e{value;constructor(e){if(!Number.isInteger(e)||e<0||e>255)throw RangeError(`Simple value must be an integer in 0–255`);this.value=e}valueOf(){return this.value}toJSON(){throw TypeError(`simple(${this.value}) cannot be serialized to JSON`)}static is(t){return t instanceof e}static get(t){return t instanceof e?t.value:void 0}},f=`getFloat16`in DataView.prototype&&`setFloat16`in DataView.prototype,p=new DataView(new ArrayBuffer(8));function m(e){p.setFloat64(0,e,!1);let t=p.getUint32(0,!1),n=p.getUint32(4,!1),r=t>>>31&1,i=t>>>20&2047,a=t&1048575;if(i===2047){if(a===0&&n===0)return r<<15|31744;let e=a>>10|(n===0?0:1)||1;return r<<15|31744|e&1023}let o=i-1023+15;if(o>=31)return r<<15|31744;let s,c,l;if(o<=0){if(o<-10)return r<<15;let e=1<<20|a,t=11-o;t<=20?(s=e>>t&1023,c=e>>t-1&1,l=(e&(1<<t-1)-1)!=0||n!==0):(s=0,c=1,l=a!==0||n!==0)}else s=a>>10,c=a>>9&1,l=(a&511)!=0||n!==0;if(c!==0&&(l||s&1)&&s++,s>=1024){let e=o<=0?1:o+1;return e>=31?r<<15|31744:r<<15|e<<10}let u=o<=0?0:o;return r<<15|u<<10|s}function h(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023;return n===31?r===0?t?-1/0:1/0:NaN:n===0?r===0?t?-0:0:(t?-1:1)*2**-14*(r/1024):(t?-1:1)*2**(n-15)*(1+r/1024)}var ee=f?(e,t,n,r)=>{e.setFloat16(t,n,r)}:(e,t,n,r)=>{e.setUint16(t,m(n),r)},g=new DataView(new ArrayBuffer(8)),_=new Uint8Array(g.buffer),v=new TextEncoder,te=typeof v.encodeInto==`function`;function ne(e){return e<=23?1:e<=255?2:e<=65535?3:e<=4294967295?5:9}function re(e){return e===`i`?1:[2,3,5,9][e]}var ie=class{buf;len=0;constructor(e=256){this.buf=new Uint8Array(e)}_ensure(e){let t=this.len+e;if(t<=this.buf.length)return;let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Uint8Array(n);r.set(this.buf),this.buf=r}writeByte(e){this._ensure(1),this.buf[this.len++]=e}writeBytes(e){this._ensure(e.length),this.buf.set(e,this.len),this.len+=e.length}writeUint16(e){this._ensure(2);let t=this.buf;t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeUint32(e){this._ensure(4);let t=this.buf;t[this.len++]=e>>>24&255,t[this.len++]=e>>>16&255,t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeBigUint64(e){g.setBigUint64(0,e,!1),this._ensure(8),this.buf.set(_,this.len),this.len+=8}writeFloat16(e){ee(g,0,e,!1),this._ensure(2);let t=this.buf;t[this.len++]=_[0],t[this.len++]=_[1]}writeFloat32(e){g.setFloat32(0,e,!1),this._ensure(4);let t=this.buf;t[this.len++]=_[0],t[this.len++]=_[1],t[this.len++]=_[2],t[this.len++]=_[3]}writeFloat64(e){g.setFloat64(0,e,!1),this._ensure(8),this.buf.set(_,this.len),this.len+=8}writeTextString(e,t,n){if(!te){let r=v.encode(t);y(this,e,r.length,n),this.writeBytes(r);return}let r=n===void 0?ne(t.length):re(n);this._ensure(9+3*t.length);let{written:i}=v.encodeInto(t,this.buf.subarray(this.len+r)),a=n===void 0?ne(i):r;a!==r&&this.buf.copyWithin(this.len+a,this.len+r,this.len+r+i),y(this,e,i,n),this.len+=i}finish(){return this.buf.slice(0,this.len)}},ae=[255n,65535n,4294967295n,18446744073709551615n];function oe(e){return e===`i`?23n:ae[e]}function y(e,t,n,r){if(r===void 0&&typeof n==`number`&&n<4294967296){n<=23?e.writeByte(t<<5|n):n<=255?(e.writeByte(t<<5|24),e.writeByte(n)):n<=65535?(e.writeByte(t<<5|25),e.writeUint16(n)):(e.writeByte(t<<5|26),e.writeUint32(n));return}let i=typeof n==`number`?BigInt(n):n;if(r!==void 0){if(r===`i`){if(i>23n)throw RangeError(`value ${i} does not fit in immediate encoding _i (max 23)`);e.writeByte(t<<5|Number(i));return}if(i>ae[r])throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${ae[r]})`);let n=24+r;e.writeByte(t<<5|n),n===24?e.writeByte(Number(i)):n===25?e.writeUint16(Number(i)):n===26?e.writeUint32(Number(i)):e.writeBigUint64(i);return}i<=23n?e.writeByte(t<<5|Number(i)):i<=255n?(e.writeByte(t<<5|24),e.writeByte(Number(i))):i<=65535n?(e.writeByte(t<<5|25),e.writeUint16(Number(i))):i<=4294967295n?(e.writeByte(t<<5|26),e.writeUint32(Number(i))):(e.writeByte(t<<5|27),e.writeBigUint64(i))}function se(e,t,n){let r=new ie(9);return y(r,e,t,n),r.finish()}var ce=new DataView(new ArrayBuffer(4));function le(e){return Object.is(h(m(e)),e)}function ue(e){return ce.setFloat32(0,e,!1),Object.is(ce.getFloat32(0,!1),e)}function b(e){return le(e)?`half`:ue(e)?`single`:`double`}function de(e){return{...e,preserveComments:e.preserveComments??!0,preserveByteString:e.preserveByteString??!0,preserveRawString:e.preserveRawString??!0,preserveConcatenation:e.preserveConcatenation??!0,preserveNumberFormat:e.preserveNumberFormat??!0,preserveAppSequence:e.preserveAppSequence??!0,preserveBlankLines:e.preserveBlankLines??!0}}var x=class t{start;end;comments;blankLineBefore;appSeqSource;appSeqComments;appSeqEncodingEdits;appSeqEncodingEditsComplete;appSeqInnerEnd;appSeqSourceFeatures;warnings;_defaults;get _containsCdnContainer(){return!1}toCBOR(e){let t=this._defaults?{...this._defaults,...e}:e,n=new ie;return this._encode(n,t),n.finish()}toCDN(t){let n=this._defaults?{...this._defaults,...t}:t;n?.preserveAll&&(n=de(n));let r=this._toCDN(n,0),i=n?.preserveComments;if(!i||e.v(n)===null)return r;let a=typeof i==`string`?i:void 0,{ownLines:o,inlinePrefix:s}=e.x(this,``,a),c=this.comments?.trailing??[],l=c.length===0?r:`${r} ${c.map(t=>e.a(t,a).trimEnd()).join(` `)}`;return[...o,`${s}${l}`].join(`
|
|
2
|
+
`)}toEDN(e){return this.toCDN(e)}toJS(e){let t=this._defaults?{...this._defaults,...e}:e,n=this._toJS(t);if(!t?.reviver)return n;let r=t.reviver.call({"":n},``,n);return r===u?void 0:r}toHexDump(e){let t=this._defaults?{...this._defaults,...e}:e,n=t?.indent??3,r=typeof n==`string`?n:` `.repeat(n),i=(t?.commentStyle??`--`)+` `,a=this._toHexDump(0,t),o=0;for(let e of a){let t=e.depth*r.length+e.hex.length;t>o&&(o=t)}let s=o+2;return a.map(e=>(r.repeat(e.depth)+e.hex).padEnd(s)+i+e.comment).join(`
|
|
3
|
+
`)}_encode(e,n){if(this._toCBOR!==t.prototype._toCBOR){e.writeBytes(this._toCBOR(n));return}this._encodeTo(e,n)}_encodeTo(e,n){if(this._toCBOR===t.prototype._toCBOR)throw TypeError(`CborItem subclass must implement _encodeTo() or _toCBOR()`);e.writeBytes(this._toCBOR(n))}_toCBOR(e){let t=new ie;return this._encodeTo(t,e),t.finish()}_toHexDump(t,n){return[{depth:t,hex:e.T(this._toCBOR()),comment:this._toCDN(n,0)}]}},S=class extends x{value;encodingWidth;ednSource;constructor(e,t){if(super(),this.value=BigInt(e),this.value<0n)throw RangeError(`CborUint value must be non-negative`);if(this.value>18446744073709551615n)throw RangeError(`CborUint value exceeds maximum uint64`);this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource}_encodeTo(e,t){y(e,0,this.value,this.encodingWidth)}_toCDN(t,n){let r=e._(t,this.encodingWidth,()=>e.i(this.value));if(t?.preserveNumberFormat&&this.ednSource!==void 0)return this.ednSource+r;let i=this.value;switch(t?.intFormat){case`hex`:return`0x${i.toString(16)}${r}`;case`octal`:return`0o${i.toString(8)}${r}`;case`binary`:return`0b${i.toString(2)}${r}`;default:return i.toString()+r}}_toJS(e){let t=e?.integerAs??`auto`;return t===`bigint`?this.value:t===`number`||this.value<=BigInt(2**53-1)?Number(this.value):this.value}},C=class extends x{argument;encodingWidth;ednSource;constructor(e,t){super();let n=BigInt(e);if(n>=0n)throw RangeError(`CborNint value must be negative`);if(n<-18446744073709551616n)throw RangeError(`CborNint value exceeds minimum int64`);this.argument=-1n-n,this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource}get value(){return-1n-this.argument}_encodeTo(e,t){y(e,1,this.argument,this.encodingWidth)}_toCDN(t,n){let r=e._(t,this.encodingWidth,()=>e.i(this.argument));if(t?.preserveNumberFormat&&this.ednSource!==void 0)return this.ednSource+r;let i=this.argument+1n;switch(t?.intFormat){case`hex`:return`-0x${i.toString(16)}${r}`;case`octal`:return`-0o${i.toString(8)}${r}`;case`binary`:return`-0b${i.toString(2)}${r}`;default:return this.value.toString()+r}}_toJS(e){let t=this.value,n=e?.integerAs??`auto`;return n===`bigint`?t:n===`number`||t>=BigInt(-(2**53-1))?Number(t):t}},fe=new DataView(new ArrayBuffer(8));function pe(e){let t=e.startsWith(`-`),n=e.slice(t?3:2),r=n.search(/[pP]/);if(r===-1)throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);let i=n.slice(0,r),a=n.slice(r+1);if(!/^[+-]?\d+$/.test(a))throw SyntaxError(`EDN parse error: hex float has invalid or missing exponent: ${e}`);let o=parseInt(a,10),s=i.indexOf(`.`),c;if(s===-1){if(!/^[0-9a-fA-F]+$/.test(i))throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);c=parseInt(i,16)}else{let t=i.slice(0,s),n=i.slice(s+1);if(t===``&&n===``)throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);if(t!==``&&!/^[0-9a-fA-F]+$/.test(t)||n!==``&&!/^[0-9a-fA-F]+$/.test(n))throw SyntaxError(`EDN parse error: hex float has invalid mantissa: ${e}`);c=(t===``?0:parseInt(t,16))+(n===``?0:parseInt(n,16)/16**n.length)}let l=c*2**o;return t?-l:l}function me(e){if(isNaN(e))return`NaN`;if(!isFinite(e))return e>0?`Infinity`:`-Infinity`;let t=Object.is(e,-0)||e<0,n=Math.abs(e);if(n===0)return t?`-0x0p+0`:`0x0p+0`;fe.setFloat64(0,n,!1);let r=fe.getUint32(0,!1),i=fe.getUint32(4,!1),a=r>>>20&2047,o=r&1048575,s=i,c=(o.toString(16).padStart(5,`0`)+s.toString(16).padStart(8,`0`)).replace(/0+$/,``),l=c===``?``:`.${c}`,u,d;a===0?(u=`0`,d=-1022):(u=`1`,d=a-1023);let f=d>=0?`+${d}`:`${d}`,p=`0x${u}${l}p${f}`;return t?`-${p}`:p}var w=class extends x{value;precision;ednSource;literalSource;rawBits;constructor(e,t){super(),this.value=e,this.precision=t?.precision,this.rawBits=t?.rawBits,this.literalSource=t?.literalSource}_encodeTo(e,t){let n=this.precision??b(this.value),r=Number.isNaN(this.value)?this.rawBits:void 0;n===`half`?(e.writeByte(249),r?.length===2?e.writeBytes(r):e.writeFloat16(this.value)):n===`single`?(e.writeByte(250),r?.length===4?e.writeBytes(r):e.writeFloat32(this.value)):(e.writeByte(251),r?.length===8?e.writeBytes(r):e.writeFloat64(this.value))}_toCDN(t,n){let r=t?.encodingIndicators??`auto`;if(t?.appStrings!==!1&&this.ednSource!==void 0&&(e.v(t)!==null||!/[\r\n]/.test(this.ednSource))){let e=this.ednSource;if(r===`never`)return e.replace(/_[0-3i]$/,``);if(r===`always`){if(/_[0-3i]$/.test(e))return e;let t=this.precision??b(this.value);return e+(t===`half`?`_1`:t===`single`?`_2`:`_3`)}return e}if(t?.preserveNumberFormat&&this.literalSource!==void 0){let t=this.literalSource;if(r===`never`)return t.replace(/_[0-7i]$/,``);if(r===`always`){if(/_[0-7i]$/.test(t))return t;let n=b(this.value);return t+e.u(this.value,this.precision,n,`always`)}return t}let i=b(this.value);return(t?.floatFormat===`hex`?me(this.value):e.d(this.value))+e.u(this.value,this.precision,i,r)}_toJS(e){return this.value}},T=class extends x{tag;content;encodingWidth;ednSource;constructor(e,t,n){if(super(),this.tag=BigInt(e),this.tag<0n)throw RangeError(`CborTag tag number must be non-negative`);this.content=t,this.encodingWidth=n?.encodingWidth,this.ednSource=n?.ednSource}get _containsCdnContainer(){return this.content._containsCdnContainer}_encodeTo(e,t){y(e,6,this.tag,this.encodingWidth),this.content._encode(e,t)}_toCDN(t,n){let r=e._(t,this.encodingWidth,()=>e.i(this.tag));return`${t?.preserveNumberFormat&&this.ednSource!==void 0?this.ednSource:this.tag.toString()}${r}${e.g(this.content,this,t,n,e=>this.content._toCDN(t,e),`(`,`)`)}`}_toHexDump(t,n){let r=[{depth:t,hex:e.T(se(6,this.tag,this.encodingWidth)),comment:`Tag ${this.tag}`}];return r.push(...this.content._toHexDump(t+1,{...n,appStrings:!1})),r}_toJS(e){let t=this.content._toJS(e);return e?.stripTags?t:l.set(t,this.tag)}};function he(t,n,r){if(t!==void 0)return n?.preserveComments||r===void 0?t:e.S(t,r)}var E=class extends x{indefiniteLength=!1;value;ednEncoding;encodingWidth;ednSource;ednCommentSyntax;ednParts;constructor(e,t){super(),this.value=e,this.ednEncoding=t?.ednEncoding??`hex`,this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource,this.ednCommentSyntax=t?.ednCommentSyntax,this.ednParts=t?.ednParts}_encodeTo(e,t){y(e,2,this.value.length,this.encodingWidth),e.writeBytes(this.value)}_toCDN(t,n){let r=e.v(t);if(t?.preserveConcatenation&&r!==null&&this.ednParts!==void 0&&this.ednParts.length>1){let i=e._(t,this.encodingWidth,()=>e.i(BigInt(this.value.length))),a=t?.bstrEncoding??this.ednEncoding;t?.appStrings===!1&&a!==`hex`&&(a=`hex`);let o=this.ednParts.map(n=>{let r=t?.preserveByteString?he(n.source,t,n.commentSyntax):void 0;return r===void 0?e.y(n.bytes,a,t?.sqstr):r});return o[o.length-1]+=i,e.h(o,r,n,t?.preserveComments?e.o(this.comments?.dangling,this.ednParts,typeof t.preserveComments==`string`?t.preserveComments:void 0):void 0)}let i=t?.preserveByteString?he(this.ednSource,t,this.ednCommentSyntax):void 0;if(i!==void 0&&(r!==null||!/[\r\n]/.test(i)))return/_[0-3i]$/.test(i)?(t?.encodingIndicators??`auto`)===`never`?i.replace(/_[0-3i]$/,``):i:i+e._(t,this.encodingWidth,()=>e.i(BigInt(this.value.length)));let a=e._(t,this.encodingWidth,()=>e.i(BigInt(this.value.length))),o=t?.bstrEncoding??this.ednEncoding;return t?.appStrings===!1&&o!==`hex`&&(o=`hex`),e.y(this.value,o,t?.sqstr)+a}_toJS(e){return this.value}},D=class extends x{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(95);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_toCDN(t,n){if((t?.encodingIndicators??`auto`)===`never`){let e=this.chunks.reduce((e,t)=>e+t.value.length,0),r=new Uint8Array(e),i=0;for(let e of this.chunks)r.set(e.value,i),i+=e.value.length;return new E(r)._toCDN(t,n)}return this.chunks.length===0?`''_`:e.b({node:this,options:t,depth:n,openChar:`(`,closeChar:`)`,count:this.chunks.length,indefiniteLength:!0,encodingWidth:void 0,hasEntryComments:()=>this.chunks.some(e.p),renderEntry:e=>this.chunks[e]._toCDN(t,n+1),entryLeadingNode:e=>this.chunks[e],entryTrailing:(t,n)=>e.f(this.chunks[t],n)})}_toHexDump(t,n){let r=[{depth:t,hex:e.C(95),comment:`Start indefinite-length byte string`}];for(let e of this.chunks)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.C(255),comment:`"break"`}),r}_toJS(e){let t=this.chunks.reduce((e,t)=>e+t.value.length,0),n=new Uint8Array(t),r=0;for(let e of this.chunks)n.set(e.value,r),r+=e.value.length;return n}},O=class extends x{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(127);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_toCDN(t,n){return(t?.encodingIndicators??`auto`)===`never`?new z(this.chunks.map(e=>e.value).join(``))._toCDN(t,n):this.chunks.length===0?`""_`:e.b({node:this,options:t,depth:n,openChar:`(`,closeChar:`)`,count:this.chunks.length,indefiniteLength:!0,encodingWidth:void 0,hasEntryComments:()=>this.chunks.some(e.p),renderEntry:e=>this.chunks[e]._toCDN(t,n+1),entryLeadingNode:e=>this.chunks[e],entryTrailing:(t,n)=>e.f(this.chunks[t],n)})}_toHexDump(t,n){let r=[{depth:t,hex:e.C(127),comment:`Start indefinite-length text string`}];for(let e of this.chunks)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.C(255),comment:`"break"`}),r}_toJS(e){return this.chunks.map(e=>e.value).join(``)}},k=class extends x{items;indefiniteLength;encodingWidth;constructor(e,t){super(),this.items=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(159);for(let n of this.items)n._encode(e,t);e.writeByte(255);return}y(e,4,this.items.length,this.encodingWidth);for(let n of this.items)n._encode(e,t)}_toCDN(t,n){return e.b({node:this,options:t,depth:n,openChar:`[`,closeChar:`]`,count:this.items.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:()=>this.items.some(e.p),renderEntry:e=>this.items[e]._toCDN(t,n+1),entryIsLeaf:e=>!this.items[e]._containsCdnContainer,entryLeadingNode:e=>this.items[e],entryTrailing:(t,n)=>e.f(this.items[t],n)})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.C(159),comment:`Start indefinite-length array`}];for(let e of this.items)r.push(...e._toHexDump(t+1,n));return r.push({depth:t,hex:e.C(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.T(se(4,BigInt(this.items.length),this.encodingWidth)),comment:`Array of length ${this.items.length}`}];for(let e of this.items)r.push(...e._toHexDump(t+1,n));return r}_toJS(e){let t=e?.reviver;if(!t)return this.items.map(t=>t._toJS(e));let n=e?{...e,reviver:void 0}:void 0,r=this.items.map(e=>e._toJS(n)),i=0;for(let n=0;n<this.items.length;n++){let a=n-i,o=this.items[n]._toJS(e),s=t.call(r,String(n),o);s===u||e?.undefinedOmits&&s===void 0?(r.splice(a,1),i++):r[a]=s}return r}},A=class extends x{entries;indefiniteLength;encodingWidth;constructor(e,t){super(),this.entries=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(191);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t);e.writeByte(255);return}y(e,5,this.entries.length,this.encodingWidth);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t)}_toCDN(t,n){return e.b({node:this,options:t,depth:n,openChar:`{`,closeChar:`}`,count:this.entries.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:()=>this.entries.some(([t,n])=>e.p(t)||e.p(n)),renderEntry:(e,r)=>{let[i,a]=this.entries[e];return`${i._toCDN(t,n+1)}${r}${a._toCDN(t,n+1)}`},entryIsLeaf:e=>{let[t,n]=this.entries[e];return!t._containsCdnContainer&&!n._containsCdnContainer},entryLeadingNode:e=>this.entries[e][0],entryTrailing:(e,t)=>{let[n,r]=this.entries[e];return ge([...n.comments?.trailing??[],...r.comments?.leading??[],...r.comments?.trailing??[]],t)}})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.C(191),comment:`Start indefinite-length map`}];for(let[e,i]of this.entries)r.push(...e._toHexDump(t+1,n)),r.push(...i._toHexDump(t+1,n));return r.push({depth:t,hex:e.C(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.T(se(5,BigInt(this.entries.length),this.encodingWidth)),comment:`Map of length ${this.entries.length}`}];for(let[e,i]of this.entries)r.push(...e._toHexDump(t+1,n)),r.push(...i._toHexDump(t+1,n));return r}_toJS(e){let t=e?.reviver,n=()=>{let n=$.from(this.entries,([t,n])=>[t._toJS(e),n._toJS(e)]);if(!t)return n;let r=e?.undefinedOmits;for(let e=0;e<n.length;e++){let[i,a]=n[e],o=t.call(n,i,a);o===u||r&&o===void 0?n.splice(e--,1):n[e]=[i,o]}return n};return e?.mapAs===`entries`?n():e?.mapAs===`object`||this.entries.every(([e])=>e instanceof z)?(()=>{let n=e?{...e,reviver:void 0}:void 0,r={};for(let[e,t]of this.entries){let i=e instanceof z?e.value:e.toCDN(),a=t._toJS(n);i===`__proto__`?Object.defineProperty(r,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):r[i]=a}if(!t)return r;let i=new Map;for(let e=0;e<this.entries.length;e++){let[t]=this.entries[e];i.set(t instanceof z?t.value:t.toCDN(),e)}for(let n=0;n<this.entries.length;n++){let[a,o]=this.entries[n],s=a instanceof z?a.value:a.toCDN();if(i.get(s)!==n)continue;let c=o._toJS(e),l=t.call(r,s,c);l===u||e?.undefinedOmits&&l===void 0?delete r[s]:s===`__proto__`?Object.defineProperty(r,s,{value:l,writable:!0,enumerable:!0,configurable:!0}):r[s]=l}return r})():n()}};function ge(t,n){return t.length===0?``:` `+t.map(t=>e.a(t,n).trimEnd()).join(` `)}var j=class e extends x{value;ednSource;constructor(e,t){if(super(),!Number.isInteger(e)||e<0||e>255)throw RangeError(`CborSimple value must be an integer in 0–255`);this.value=e,this.ednSource=t?.ednSource}static FALSE=new e(20);static TRUE=new e(21);static NULL=new e(22);static UNDEFINED=new e(23);_encodeTo(e,t){if(this.value<=23){e.writeByte(224|this.value);return}e.writeByte(248),e.writeByte(this.value)}_toCDN(e,t){if(e?.preserveNumberFormat&&this.ednSource!==void 0)return`simple(${this.ednSource})`;switch(this.value){case 20:return`false`;case 21:return`true`;case 22:return`null`;case 23:return`undefined`;default:return`simple(${this.value})`}}_toJS(e){switch(this.value){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return new d(this.value)}}},M=class extends x{items;encodingWidth;constructor(e,t){super(),this.items=e,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return this.items.some(e=>e._containsCdnContainer)}_content(e){let t=new ie;for(let n of this.items)n._encode(t,e);return t.finish()}_encodeTo(e,t){let n=this._content(t);y(e,2,n.length,this.encodingWidth),e.writeBytes(n)}_toCDN(t,n){return e.b({node:this,options:t,depth:n,openChar:`<<`,closeChar:`>>`,count:this.items.length,indefiniteLength:!1,encodingWidth:this.encodingWidth,eiPosition:`close`,canonicalCount:()=>BigInt(this._content(t).length),hasEntryComments:()=>this.items.some(e.p),renderEntry:e=>this.items[e]._toCDN(t,n+1),entryLeadingNode:e=>this.items[e],entryTrailing:(t,n)=>e.f(this.items[t],n)})}_toHexDump(t,n){let r=this._content().length,i=[{depth:t,hex:e.T(se(2,BigInt(r),this.encodingWidth)),comment:`Embedded CBOR sequence, ${r} byte${r===1?``:`s`}`}];for(let e of this.items)i.push(...e._toHexDump(t+1,n));return i}_toJS(e){return this._content()}};function _e(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===`
|
|
4
|
+
`||r===`\r`){n++;continue}if(r===`#`){for(;n<e.length&&e[n]!==`
|
|
5
|
+
`;)n++;continue}if(r===`/`){let t=e[n+1]??``;if(t===`/`){for(;n<e.length&&e[n]!==`
|
|
6
|
+
`;)n++;continue}if(t===`*`){for(n+=2;n<e.length&&!(e[n]===`*`&&(e[n+1]??``)===`/`);)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n+=2;continue}for(n++;n<e.length&&e[n]!==`/`;)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n++;continue}t+=r,n++}return t}var ve=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,ye=`0123456789ABCDEFGHIJKLMNOPQRSTUV`;function be(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===61;)t--;return e.slice(0,t)}function xe(e,t,n){let r=be(e).toUpperCase(),i=r.length%8;if(i===1||i===3||i===6)throw SyntaxError(`invalid base32 length: ${r.length} characters`);let a=new Uint8Array(128).fill(255);for(let e=0;e<t.length;e++)a[t.charCodeAt(e)]=e;let o=new Uint8Array(Math.floor(r.length*5/8)),s=0,c=0,l=0;for(let e of r){let t=e.charCodeAt(0),n=t<128?a[t]:255;if(n===255)throw SyntaxError(`invalid character in byte string: ${JSON.stringify(e)}`);s=s<<5|n,c+=5,c>=8&&(c-=8,o[l++]=s>>c&255)}if(c>0&&s&(1<<c)-1){let e=`non-zero trailing bits in base32 input`;if(n)n(e);else throw SyntaxError(e)}return o}var Se={appStringPrefixes:[`b32`],parseAppString(e,t,n){return new E(xe(_e(t),ve,n),{ednEncoding:`base32`})}},Ce={appStringPrefixes:[`h32`],parseAppString(e,t,n){return new E(xe(_e(t),ye,n),{ednEncoding:`base32hex`})}};function we(e,t){let n=e.indexOf(`=`),r=n>=0?e.slice(0,n):e,i=n>=0?e.slice(n):``;if(/[^A-Za-z0-9+/\-_]/.test(r)){let e=[...r].find(e=>!/[A-Za-z0-9+/\-_]/.test(e))??``;throw SyntaxError(`invalid character ${JSON.stringify(e)} in base64 data`)}if(i&&!/^=+$/.test(i))throw SyntaxError(`invalid character after base64 '=' padding`);let a=r.length%4;if(a===1)throw SyntaxError(`invalid base64 length: ${r.length} data characters (length mod 4 = 1 is never valid)`);let o=a===0?0:4-a;if(i.length>o){let e=`base64 has ${i.length} '=' character${i.length>1?`s`:``} but the data length (${r.length}) requires at most ${o}`;if(t)t(e);else throw SyntaxError(e)}if(i.length>0&&i.length<o){let e=`base64 has ${i.length} '=' character${i.length>1?`s`:``} but needs exactly ${o} — use full padding or no padding at all`;if(t)t(e);else throw SyntaxError(e)}if(a!==0&&r.length>0){let e=r[r.length-1].replace(`-`,`+`).replace(`_`,`/`),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(n>=0&&n&(a===2?15:3)){let e=`base64 has non-zero trailing bits in the final quantum (RFC 4648 §3.5)`;if(t)t(e);else throw SyntaxError(e)}}let s=r.replace(/-/g,`+`).replace(/_/g,`/`)+`=`.repeat(o);if(typeof Uint8Array.fromBase64==`function`)return Uint8Array.fromBase64(s,{alphabet:`base64`,lastChunkHandling:`loose`});let c=atob(s),l=new Uint8Array(c.length);for(let e=0;e<c.length;e++)l[e]=c.charCodeAt(e);return l}var Te=999n,Ee=class extends T{constructor(e,t){let n=t.length===1&&t[0]instanceof z?t[0]:new k(t);super(Te,new k([new z(e),n]))}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=this.content,i=r.items[0].value,a=r.items[1];return a instanceof z?`${i}${e.c(a.value)}`:`${i}<<${a.items.map(e=>e._toCDN(t,n)).join(`, `)}>>`}},N=class extends x{inner;ednSource;constructor(e,t){super(),this.inner=e,this.ednSource=t}get _containsCdnContainer(){return this.inner._containsCdnContainer}_encodeTo(e,t){this.inner._encode(e,t)}_toCDN(t,n){let r=t?.encodingIndicators??`auto`;return t?.appStrings!==!1&&r===`auto`&&(e.v(t)!==null||!/[\r\n]/.test(this.ednSource))?this.ednSource:this.inner._toCDN(t,n)}_toJS(e){return this.inner._toJS(e)}},De=888n;function Oe(t,n,r,i){return r?[...(t.comments?.trailing??[]).map(t=>e.a(t,i)),...(n.comments?.leading??[]).map(t=>e.a(t,i))]:[]}function ke(t,n,r,i){return r===null||!n.some(e=>e.length>0)?t.join(` + `):e.h(t,r,i,n)}function Ae(t,n,r,i){if(t===void 0)return;let a=n?.preserveComments||i===void 0?t:e.S(t,i);return Me(a,r)?a:void 0}function je(e,t){return e!==void 0&&Me(e,t)}function Me(e,t){return t!==null||!/[\r\n]/.test(e)}var P=class t extends T{realBoundary;fromByteLiteral;literalSource;constructor(e,t){Array.isArray(e)?(super(De,new k(e)),this.fromByteLiteral=!1,this.literalSource=void 0,this.realBoundary=t):(super(De,j.NULL),this.fromByteLiteral=e??!1,this.literalSource=t,this.realBoundary=void 0)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);if(this.content instanceof j)return`...`;if(this.content instanceof k){let r=!!t?.preserveConcatenation;if(r||t?.preserveByteString&&!this._hasRealConcatenation()){let e=this._renderPreservedBytesElision(t,n);if(e!==void 0)return e}if(!r||this.realBoundary===void 0){let e=this._compactHexElided();if(e!==void 0)return e}let i=this.content.items,a=i.map(e=>r?this._renderFragment(e,t,n):e._toCDN(t,n)),o=!!t?.preserveComments,s=typeof t?.preserveComments==`string`?t.preserveComments:void 0;return ke(a,i.slice(1).map((e,t)=>Oe(i[t],e,o,s)),e.v(t),n)}return super._toCDN(t,n)}_hasRealConcatenation(){return this.realBoundary?.some((e,t)=>t>0&&e)?!0:this.content.items.some(e=>e instanceof E&&e.ednParts!==void 0&&e.ednParts.length>1)}_renderFragment(t,n,r){let i=e.v(n),a=!!n?.preserveComments,o=typeof n?.preserveComments==`string`?n.preserveComments:void 0;if(t instanceof E&&t.ednParts!==void 0&&t.ednParts.length>1){let s=n?.appStrings===!1?`hex`:n?.bstrEncoding??t.ednEncoding;return ke(t.ednParts.map(t=>{let r=n?.preserveByteString?Ae(t.source,n,i,t.commentSyntax):void 0;return r===void 0?e.y(t.bytes,s,n?.sqstr):r}),a?e.o(t.comments?.dangling,t.ednParts,o)??[]:[],i,r)}if(t instanceof z&&t.ednParts!==void 0&&t.ednParts.length>1){let s=n?.preserveRawString?t.ednPartSources:void 0;return ke(t.ednParts.map((t,n)=>{let r=s?.[n];return je(r,i)?r:e.l(t)}),a?e.o(t.comments?.dangling,t.ednPartSpans,o)??[]:[],i,r)}return t._toCDN(n,r)}_compactHexElided(){let n=this.content.items,r=``,i=!1;for(let a of n)if(a instanceof E)r+=e.w(a.value),i=!0;else if(a instanceof t&&a.content instanceof j)r+=`...`;else return;if(i)return`h'${r}'`}_renderPreservedBytesElision(n,r){if(this.realBoundary===void 0)return;let i=this.realBoundary,a=this.content.items,o=[],s=[],c=[],l=e=>{c.length>0&&(o.push(c),s.push(e??[]),c=[])},u=!!n?.preserveComments,d=typeof n?.preserveComments==`string`?n.preserveComments:void 0;for(let n=0;n<a.length;n++){let r=a[n];if(n>0&&i[n]&&l(Oe(a[n-1],r,u,d)),r instanceof t&&r.content instanceof j)c.push({ellipsis:!0,fromByteLiteral:r.fromByteLiteral,literalSource:r.literalSource});else if(r instanceof E)if(r.ednParts!==void 0&&r.ednParts.length>1){let[t,...n]=r.ednParts;c.push({bytes:t.bytes,source:t.source,commentSyntax:t.commentSyntax});let i=u?e.o(r.comments?.dangling,r.ednParts,d):void 0;n.forEach((e,t)=>{l(i?.[t]),c.push({bytes:e.bytes,source:e.source,commentSyntax:e.commentSyntax})})}else c.push({bytes:r.value,source:r.ednSource,commentSyntax:r.ednCommentSyntax});else return}if(c.length>0&&o.push(c),o.length===0)return;let f=n?.appStrings===!1?`hex`:n?.bstrEncoding??`hex`,p=e.v(n);return ke(o.map(t=>{if(n?.preserveByteString)for(let e of t){if(!(`ellipsis`in e))continue;let t=Ae(e.literalSource,n,p,`full`);if(t!==void 0)return t}let r=t.filter(e=>!(`ellipsis`in e));if(r.length===0)return t.some(e=>`ellipsis`in e&&e.fromByteLiteral)?`h'...'`:`...`;if(t.length===1){let t=r[0],i=n?.preserveByteString?Ae(t.source,n,p,t.commentSyntax):void 0;return i===void 0?e.y(t.bytes,f,n?.sqstr):i}return`h'${t.map(t=>`ellipsis`in t?`...`:e.w(t.bytes)).join(``)}'`}),s,p,r)}},Ne=2n,Pe=3n,Fe=18446744073709551615n,Ie=-18446744073709551616n;function Le(e){if(e<0n)throw RangeError(`bigintToBytes requires a non-negative value`);if(e===0n)return new Uint8Array;let t=e.toString(16);t.length%2!=0&&(t=`0`+t);let n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}function Re(e){let t=0n;for(let n of e)t=t<<8n|BigInt(n);return t}var ze=class extends T{bigValue;constructor(e){if(e<=Fe)throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);super(Ne,new E(Le(e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},Be=class extends T{bigValue;constructor(e){if(e>=Ie)throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);super(Pe,new E(Le(-1n-e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},F=new TextEncoder,Ve=new TextDecoder(`utf-8`,{fatal:!0}),He=new TextDecoder(`utf-8`,{fatal:!1});function Ue(t,n){let r=new e.t(t,{offset:n?.offset,skipRS:n?._skipRS}),i=new st(r,n??{}).parse();return(n?.preserveComments||n?.preserveAll)&&(et(i,r.comments,t),L(i)),i}function We(e){let t=e,n;return/[_][0-7i]$/.test(e)&&(n=e[e.length-1],t=e.slice(0,-2)),{numStr:t,rawSuffix:n}}function Ge(e){return e.startsWith(`-`)?-BigInt(e.slice(1)):BigInt(e)}function I(e){if(e!==void 0)return qe([e.appSeqSourceFeatures,Ke(e)])}function Ke(e){if(e instanceof E)return{byteString:!0,concatenation:e.ednParts!==void 0&&e.ednParts.length>1};if(e instanceof z){let t=e.ednParts!==void 0,n=e.ednPartSources?.filter(e=>e!==void 0).length??0,r=t?e.ednParts.reduce((t,n,r)=>{let i=e.ednPartSources?.[r]!==void 0,a=e.ednPartIsByteString?.[r]??!1;return i||!a?t:t+1},0):0,i=(t?e.ednParts.length:0)-n-r;return{byteString:r>0,textString:e.quotedEdnSource!==void 0||i>0,rawString:e.ednSource!==void 0||n>0,concatenation:t&&e.ednParts.length>1}}if(e instanceof k)return qe(e.items.map(I));if(e instanceof A)return qe(e.entries.flatMap(([e,t])=>[I(e),I(t)]));if(e instanceof T)return I(e.content);if(e instanceof D||e instanceof O||e instanceof M)return qe((e instanceof M?e.items:e.chunks).map(I))}function qe(e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return{byteString:t.some(e=>e.byteString),textString:t.some(e=>e.textString),rawString:t.some(e=>e.rawString),concatenation:t.some(e=>e.concatenation)}}function Je(e,t){if(e.endsWith(`_i`)||e.endsWith(`_0`)){let n=`_0 and _i encoding indicators are not valid for floating-point values`;if(t)t(n),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${n}`)}else if(/[_][4567]$/.test(e)){let n=e[e.length-1],r=n===`7`?`indefinite-length encoding (_7) is not valid for floating-point values`:`encoding indicator _${n} (AI ${Number(n)+24}) is reserved and not valid`;if(t)t(r),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${r}`)}if(e===`NaN`)return{value:NaN,precision:void 0};if(e===`Infinity`)return{value:1/0,precision:void 0};if(e===`-Infinity`)return{value:-1/0,precision:void 0};let n=e,r;return e.endsWith(`_1`)?(r=`half`,n=e.slice(0,-2)):e.endsWith(`_2`)?(r=`single`,n=e.slice(0,-2)):e.endsWith(`_3`)&&(r=`double`,n=e.slice(0,-2)),/^-?0[xX]/.test(n)?{value:pe(n),precision:r}:{value:parseFloat(n),precision:r}}var Ye=/\r?\n[ \t]*\r?\n/;function Xe(e,t,n){return Ye.test(e.slice(t,n))}function Ze(e,t,n,r){let i=[];for(let a=t;a<e.length;a++){let t=e[a];if(t.start>=r)break;t.start>=n&&t.end<=r&&i.push({...t,start:t.start-n,end:t.end-n})}return i}function Qe(e,t,n,r){if(n.end!==void 0)return{start:(/_[0-7i]$/.test(e.slice(Math.max(0,n.end-2),n.end))?n.end-2:n.end)-t,end:n.end-t,always:r,never:``}}function $e(t,n,r){if(r instanceof S){let i=Qe(t,n,r,`_${r.encodingWidth??e.i(r.value)}`);return i?[i]:[]}if(r instanceof C){let i=Qe(t,n,r,`_${r.encodingWidth??e.i(r.argument)}`);return i?[i]:[]}if(r instanceof w){let e=r.precision??b(r.value),i=Qe(t,n,r,e===`half`?`_1`:e===`single`?`_2`:`_3`);return i?[i]:[]}if(r instanceof E){let i=Qe(t,n,r,`_${r.encodingWidth??e.i(BigInt(r.value.length))}`);return i?[i]:[]}if(r instanceof z){let i=Qe(t,n,r,`_${r.encodingWidth??e.i(BigInt(F.encode(r.value).length))}`);return i?[i]:[]}if(r instanceof k){let i=[];if(r.indefiniteLength)return;if(r.start!==void 0){let a=new e.t(t,{offset:r.start}),o=a.consume(),s=a.peek(),c=s.type===`ENCODING_INDICATOR`,l=`_${r.encodingWidth??e.i(BigInt(r.items.length))}`,u=t[o.endOffset]??``,d=!c&&/[+\-.0-9A-Z_a-z]/.test(u)?` `:``;i.push({start:(c?s.offset:o.endOffset)-n,end:(c?s.endOffset:o.endOffset)-n,always:l+d,never:``})}for(let e of r.items){let r=$e(t,n,e);if(r===void 0)return;i.push(...r)}return i}}function et(e,t,n){if(t.length===0)return;let r=tt(e),i=rt(n),a=[...r].sort((e,t)=>e.start-t.start||t.end-e.end),o=[...r].sort((e,t)=>e.end-t.end||e.start-t.start),s=[...t].sort((e,t)=>e.start-t.start),c=[],l=0;for(let e of s){let t={...e},r=0,s=o.length;for(;r<s;){let t=r+s>>1;o[t].end<=e.start?r=t+1:s=t}let u=r>0?o[r-1]:void 0,d=u?n.slice(u.end,e.start):``;if(u&&i(u.end)===e.line&&!d.includes(`:`)){nt(u.node,`trailing`,t);continue}for(;l<a.length&&a[l].start<e.start;){let e=a[l++];for(;c.length>0&&c[c.length-1].end<=e.start;)c.pop();c.push(e)}for(;c.length>0&&c[c.length-1].end<=e.start;)c.pop();let f=c.length>0?c[c.length-1]:void 0;for(r=0,s=a.length;r<s;){let t=r+s>>1;a[t].start<e.end?r=t+1:s=t}let p=r<a.length?a[r]:void 0;if((!f||p&&p.end<=f.end)&&p){t.sameLine=i(e.end)===i(p.start),nt(p.node,`leading`,t);continue}f&&nt(f.node,`dangling`,t)}}function tt(e){let t=[],n=e=>{if(e.start!==void 0&&e.end!==void 0&&t.push({node:e,start:e.start,end:e.end}),e instanceof k||e instanceof M){for(let t of e.items)n(t);return}if(e instanceof A){for(let[t,r]of e.entries)n(t),n(r);return}if(e instanceof D||e instanceof O){for(let t of e.chunks)n(t);return}e instanceof T&&n(e.content)};return n(e),t}function nt(e,t,n){e.comments??={},e.comments[t]??=[],e.comments[t].push(n)}function L(e){if(e instanceof P){if(e.content instanceof k){let t=e.content.items;for(let e of t)L(e);let n=t[t.length-1],r=n?.comments?.trailing;r!==void 0&&r.length>0&&!e.comments?.trailing?.length&&(e.comments??={},e.comments.trailing=r,n.comments.trailing=void 0)}return}if(e instanceof k||e instanceof M){for(let t of e.items)L(t);return}if(e instanceof A){for(let[t,n]of e.entries)L(t),L(n);return}if(e instanceof D||e instanceof O){for(let t of e.chunks)L(t);return}e instanceof T&&L(e.content)}function rt(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
7
|
+
`&&t.push(n+1);return n=>{let r=Math.max(0,Math.min(e.length,n));r>0&&r===e.length&&r--;let i=0,a=t.length-1;for(;i<=a;){let e=i+a>>1;t[e]<=r?i=e+1:a=e-1}return a+1}}var it=e=>`import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`,at=(e,t)=>`install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`,R=e=>`'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`,ot=new Map([[`b32`,it(`b32`)],[`h32`,it(`h32`)],[`same`,it(`same`)],[`hash`,at(`hash`,`@cbortech/hash-extension`)],[`uuid`,at(`uuid`,`@cbortech/uuid-extension`)],[`UUID`,at(`uuid`,`@cbortech/uuid-extension`)],[`dt`,R(`dt`)],[`DT`,R(`dt`)],[`ip`,R(`ip`)],[`IP`,R(`ip`)],[`cri`,R(`cri`)],[`CRI`,R(`cri`)],[`t1`,R(`t1`)],[`b1`,R(`b1`)],[`ilbs`,R(`ilbs`)],[`ilts`,R(`ilts`)],[`float`,R(`float`)]]),st=class{t;_options;extByPrefix;extByTag;unresolvedExtension;_pendingWarnings=[];_hintedPrefixes=new Set;constructor(t,n){this.t=t,this._options=n,this.extByPrefix=new Map,this.extByTag=new Map,this.unresolvedExtension=n.unresolvedExtension??`cpa999`;let r=Z(n.builtinExtensions);for(let e of[...r,...n.extensions??[]]){for(let t of e.appStringPrefixes??[])this.extByPrefix.set(t,e);for(let t of e.tagNumbers??[])this.extByTag.set(t,e)}this.t.onEscapeWarning=(t,n,r,i,a)=>{let o={message:t,offset:n,line:r,column:i,endOffset:a};if(this._pendingWarnings.push(o),this._options.onWarning?this._options.onWarning(o):this._options.silent||console.warn(`CDN strict violation at line ${r}, column ${i}: ${t}`),this._options.strict!==!1)throw new e.D(t,{offset:n,line:r,column:i,endOffset:a})}}parse(){let e=this.parseValue();if(this._options.allowTrailing)return e;let t=this.t.peek();if(t.type!==`EOF`)for(this._warnOrFail(`unexpected token after value: ${JSON.stringify(t.value)}`,t),this._pendingWarnings.length>0&&(e.warnings??=[],e.warnings.push(...this._pendingWarnings),this._pendingWarnings=[]);this.t.peek().type!==`EOF`;)this.t.consume();return e}parseValue(){let e=this.t.peek().offset,t=this._parseValueNode();if(this.t.peek().type===`UNDERSCORE`){let e=this.t.consume();this._warnOrFail(`bare _ is not a valid encoding indicator; use _0, _1, _2, _3, or _i`,e)}if(this._pendingWarnings.length>0){t.warnings??=[];for(let e of this._pendingWarnings)t.warnings.push(e);this._pendingWarnings=[]}return t.start=e,t.end=this.t.lastEndOffset,t}_parseValueNode(){let e=this.t.peek();switch(e.type){case`INTEGER`:return this.parseIntegerOrTag();case`FLOAT`:return this.parseFloat();case`TSTR`:case`RAWSTRING`:return this.parseString();case`BYTES_HEX`:case`SQSTR`:case`BYTES_B64`:return this.t.consume(),this._parseBytesConcat(this._decodeBytesToken(e),e.type,e.raw,e.offset,e.endOffset);case`EMPTY_INDEF_BYTES`:return this.t.consume(),new D([]);case`EMPTY_INDEF_TEXT`:return this.t.consume(),new O([]);case`TRUE`:return this.t.consume(),new j(21);case`FALSE`:return this.t.consume(),new j(20);case`NULL`:return this.t.consume(),new j(22);case`UNDEFINED`:return this.t.consume(),new j(23);case`SIMPLE`:return this.parseSimple();case`LBRACKET`:return this.parseArray();case`LBRACE`:return this.parseMap();case`LPAREN`:return this.parseIndefGroup();case`LT_LT`:return this.parseEmbeddedCBOR();case`APP_STRING`:{this.t.consume();let t,n=``;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e),n=e.raw}let r=this.extByPrefix.get(e.appPrefix);if(!r?.parseAppString){if(r||this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ee(e.appPrefix,[new z(e.value)]);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}{let i=this._pendingWarnings.length;try{let i=r.parseAppString(e.appPrefix,e.value,this._extOnError(e),t===void 0?void 0:{encodingWidth:t});return t!==void 0&&this._applyEiToResult(i,t,e),r.preserveAppSeqSource===`optional`?(i.appSeqSource=e.raw+n,i):i instanceof E&&Object.getPrototypeOf(i)===E.prototype&&i.ednSource===void 0?new E(i.value,{ednEncoding:i.ednEncoding,encodingWidth:i.encodingWidth,ednSource:e.raw+n,ednCommentSyntax:r===Se||r===Ce?`full`:void 0}):(i instanceof w&&i.ednSource===void 0&&(i.ednSource=e.raw+n),i)}catch(t){if(this._options.strict!==!1)throw t;return this._pendingWarnings.length===i&&this._warn(t instanceof Error?t.message:String(t),e),new Ee(e.appPrefix,[new z(e.value)])}}}case`APP_SEQUENCE`:{let t=this.t.comments.length;this.t.consume();let n=[];for(;this.t.peek().type!==`GT_GT`;){if(this.t.peek().type===`EOF`&&this._fail(`unterminated ${e.appPrefix}<<...>>`,e),n.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek());n.push(this.parseValue())}this.expect(`GT_GT`);let r,i;this.t.peek().type===`ENCODING_INDICATOR`&&(i=this.t.consume(),r=this._resolveEncodingWidth(i.value,i));let a=this.extByPrefix.get(e.appPrefix);if(!a){if(this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ee(e.appPrefix,n);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}a.parseAppSequence||this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`,e);{let o=this._pendingWarnings.length;try{let o=a.parseAppSequence(e.appPrefix,n,this._extOnError(e));r!==void 0&&this._applyEiToResult(o,r,i??e);let s=this.t.source.slice(e.offset,this.t.lastEndOffset);if(a.preserveAppSeqSource===`optional`)o.appSeqSource=s,o.appSeqComments=Ze(this.t.comments,t,e.offset,this.t.lastEndOffset),n.length===1&&(n[0].end!==void 0&&(o.appSeqInnerEnd=n[0].end-e.offset),o.appSeqSourceFeatures=I(n[0]));else if(o instanceof w)o.ednSource===void 0&&(o.ednSource=s);else if(a.preserveAppSeqSource)return new N(o,s);return o}catch(t){if(this._options.strict!==!1)throw t;return this._pendingWarnings.length===o&&this._warn(t instanceof Error?t.message:String(t),e),new Ee(e.appPrefix,n)}}}case`ELLIPSIS`:{if(this.t.consume(),this.t.peek().type!==`PLUS`)return new P;let e=[new P];for(;this.t.peek().type===`PLUS`;)this.t.consume(),e.push(this.parseValue());return new P(e,e.map(()=>!0))}case`BYTES_HEX_ELIDED`:return this.t.consume(),this._parseHexElidedConcat(e);default:this._fail(`unexpected token: ${JSON.stringify(e.value)}`,e)}}parseIntegerOrTag(){let t=this.t.comments.length,n=this.t.consume(),{numStr:r,rawSuffix:i}=We(n.value),a=i===void 0?n.endOffset:n.endOffset-2,o=n.endOffset,s=i===void 0?this.consumeEncodingIndicator(void 0,e=>{a=e.offset,o=e.endOffset}):this._resolveEncodingWidth(i,n),c=Ge(r),l=i===void 0?n.raw:n.raw.slice(0,-2);if(c>18446744073709551615n)return this.t.peek().type===`LPAREN`&&this._fail(`tag number exceeds maximum uint64`,n),new ze(c);if(c<-18446744073709551616n)return new Be(c);if(s!==void 0){let e=c>=0n?c:-(c+1n);s=this._validateEncodingFit(e,s,n)}let u=c>=0n?new S(c,{encodingWidth:s,ednSource:l}):new C(c,{encodingWidth:s,ednSource:l});if(this.t.peek().type===`LPAREN`){u instanceof S||this._fail(`tag number must be non-negative`,n),this.t.consume();let r=this._pendingWarnings.splice(0),i=this.parseValue();this.expect(`RPAREN`);let c=u.value,d=this.extByTag.get(c);if(d?.parseTag){let u=d.parseTag(c,i);if(u!==void 0){if(u instanceof T&&(s!==void 0&&u.encodingWidth===void 0&&(u.encodingWidth=s),u.ednSource===void 0&&(u.ednSource=l),d.preserveAppSeqSource===`optional`&&u.appSeqSource===void 0)){u.appSeqSource=this.t.source.slice(n.offset,this.t.lastEndOffset),u.appSeqComments=Ze(this.t.comments,t,n.offset,this.t.lastEndOffset);let r=u.encodingWidth??e.i(u.tag),s=$e(this.t.source,n.offset,u.content);u.appSeqEncodingEdits=[{start:a-n.offset,end:o-n.offset,always:`_${r}`,never:``},...s??[]],s===void 0&&(u.appSeqEncodingEditsComplete=!1),u.appSeqSourceFeatures=I(i)}return r.length>0&&(u.warnings??=[],u.warnings.push(...r)),u}}let f=new T(c,i,{encodingWidth:s,ednSource:l});return r.length>0&&(f.warnings??=[],f.warnings.push(...r)),f}return u}parseFloat(){let e=this.t.consume(),t=t=>this._warnOrFail(t,e),{value:n,precision:r}=Je(e.value,t);if(r===`half`||r===`single`){let e=r===`half`?h(m(n)):Math.fround(n);Object.is(n,e)||isNaN(n)&&isNaN(e)||t(`${n} cannot be exactly represented as ${r===`half`?`f16 (_1)`:`f32 (_2)`}; use _3 or remove the indicator`)}return new w(n,{precision:r,literalSource:e.raw})}parseString(){let e=this.t.consume();if(this.t.peek().type!==`PLUS`){let t=this.consumeEncodingIndicator(()=>BigInt(F.encode(e.value).length));return e.type===`RAWSTRING`?new z(e.value,{ednSource:e.raw,...t===void 0?{}:{encodingWidth:t}}):new z(e.value,{quotedEdnSource:e.raw,...t===void 0?{}:{encodingWidth:t}})}let t=!1,n=[e.type===`RAWSTRING`?{text:e.value,source:e.raw,start:e.offset,end:e.endOffset}:{text:e.value,start:e.offset,end:e.endOffset}];for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();e.type===`ELLIPSIS`?(this.t.consume(),n.push({ellipsis:!0,start:e.offset,end:e.endOffset}),t=!0):e.type===`TSTR`||e.type===`RAWSTRING`?(this.t.consume(),n.push(e.type===`RAWSTRING`?{text:e.value,source:e.raw,start:e.offset,end:e.endOffset}:{text:e.value,start:e.offset,end:e.endOffset})):this._isBytesToken(e.type)?(this.t.consume(),n.push({text:this._decodeUtf8(this._decodeBytesToken(e),e),isByteString:!0,start:e.offset,end:e.endOffset})):this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`,e)}if(!t){let e=n.map(e=>`text`in e?e.text:``),t=n.map(e=>`text`in e?e.source:void 0),r=n.map(e=>`text`in e?e.isByteString??!1:!1),i=n.map(e=>({start:e.start,end:e.end})),a=e.join(``),o=this.consumeEncodingIndicator(()=>BigInt(F.encode(a).length));return new z(a,{ednParts:e,ednPartSpans:i,...t.some(e=>e!==void 0)?{ednPartSources:t}:{},...r.some(e=>e)?{ednPartIsByteString:r}:{},...o===void 0?{}:{encodingWidth:o}})}let r=[],i=[],a=()=>{let e=i.map(e=>e.text),t=e.join(``);if(t!==``){let n=i.map(e=>e.source),a=i.map(e=>e.isByteString??!1),o=new z(t,{ednParts:e,ednPartSpans:i.map(e=>({start:e.start,end:e.end})),...n.some(e=>e!==void 0)?{ednPartSources:n}:{},...a.some(e=>e)?{ednPartIsByteString:a}:{}});o.start=i[0].start,o.end=i[i.length-1].end,r.push(o)}i.length=0};for(let e of n)if(`ellipsis`in e){a();let t=new P;t.start=e.start,t.end=e.end,r.push(t)}else i.push(e);return a(),new P(r)}_isBytesToken(e){return e===`BYTES_HEX`||e===`SQSTR`||e===`BYTES_B64`}_hexToBytes(t,n){try{return e.E(t)}catch(t){if(t instanceof e.D||!(t instanceof SyntaxError))throw t;this._fail(t.message,n)}}_decodeBytesToken(t){let n=e=>this._warnOrFail(e,t);switch(t.type){case`SQSTR`:{let e=t._sqstrBytes;return e===void 0?this._hexToBytes(t.value,t):e}case`BYTES_HEX`:return this._hexToBytes(t.value,t);case`BYTES_B64`:try{return we(t.value,n)}catch(n){if(n instanceof e.D||!(n instanceof SyntaxError))throw n;this._fail(n.message,t)}default:this._fail(`expected byte string token`,t)}}_decodeUtf8(e,t){if(this._options.allowInvalidUtf8)return He.decode(e);try{return Ve.decode(e)}catch{return this._warnOrFail(`byte string in text concatenation is not valid UTF-8`,t),He.decode(e)}}_tokenTypeToCdnEncoding(e){return e===`BYTES_B64`?`base64`:`hex`}_tokenTypeToCommentSyntax(e){if(e===`BYTES_HEX`)return`full`;if(e===`BYTES_B64`)return`hash-only`}_parseBytesConcat(e,t,n,r,i){if(this.t.peek().type!==`PLUS`){let r=this.consumeEncodingIndicator(()=>BigInt(e.length));return new E(e,{ednEncoding:this._tokenTypeToCdnEncoding(t),ednSource:n,ednCommentSyntax:this._tokenTypeToCommentSyntax(t),...r===void 0?{}:{encodingWidth:r}})}let a=[{bytes:e,source:n,commentSyntax:this._tokenTypeToCommentSyntax(t),real:!1,start:r,end:i}],o=this._consumeByteEllipsisChain(a);return this._buildFromByteAtoms(o,this._tokenTypeToCdnEncoding(t))}_parseHexElidedConcat(e){let t=this._consumeByteEllipsisChain(this._elidedHexAtoms(e.value,e));return this._buildFromByteAtoms(t,`hex`)}_consumeByteEllipsisChain(e){let t=e;for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();if(e.type===`ELLIPSIS`)this.t.consume(),t.push({ellipsis:!0,real:!0,fromByteLiteral:!1,start:e.offset,end:e.endOffset});else if(e.type===`BYTES_HEX_ELIDED`){this.t.consume();let n=this._elidedHexAtoms(e.value,e);n.length>0&&(n[0].real=!0),t.push(...n)}else this._isBytesToken(e.type)?(this.t.consume(),t.push({bytes:this._decodeBytesToken(e),source:e.raw,commentSyntax:this._tokenTypeToCommentSyntax(e.type),real:!0,start:e.offset,end:e.endOffset})):e.type===`TSTR`||e.type===`RAWSTRING`?(this.t.consume(),this._warnOrFail(`text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead`,e),t.push({bytes:F.encode(e.value),real:!0,start:e.offset,end:e.endOffset})):this._fail(`expected byte string after +, got ${JSON.stringify(e.value)}`,e)}return t}_elidedHexAtoms(e,t){let n=e.split(`...`),r=[];for(let e=0;e<n.length;e++)e>0&&r.push({ellipsis:!0,real:!1,fromByteLiteral:!0,literalSource:t.raw,start:t.offset,end:t.endOffset}),n[e].length>0&&r.push({bytes:this._hexToBytes(n[e],t),commentSyntax:`full`,real:!1,start:t.offset,end:t.endOffset});return r}_buildFromByteAtoms(e,t){if(!e.some(e=>`ellipsis`in e)){let n=e,r=this._concatBytes(n.map(e=>e.bytes)),i=this.consumeEncodingIndicator(()=>BigInt(r.length));return new E(r,{ednEncoding:t,ednParts:n,...i===void 0?{}:{encodingWidth:i}})}let n=[],r=[],i=[],a=()=>{if(i.length>0){let e=new E(this._concatBytes(i.map(e=>e.bytes)),{...i.length>1?{ednParts:i.map(({bytes:e,source:t,commentSyntax:n,start:r,end:i})=>({bytes:e,source:t,commentSyntax:n,start:r,end:i}))}:{ednSource:i[0].source,ednCommentSyntax:i[0].commentSyntax}});e.start=i[0].start,e.end=i[i.length-1].end,n.push(e),r.push(i[0].real),i.length=0}};for(let t of e)if(`ellipsis`in t){a();let e=new P(t.fromByteLiteral,t.literalSource);e.start=t.start,e.end=t.end,n.push(e),r.push(t.real)}else i.push(t);return a(),new P(n,r)}_concatBytes(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}parseSimple(){this.t.consume(),this.expect(`LPAREN`);let e=this.t.peek();e.type!==`INTEGER`&&this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`,e),this.t.consume();let{numStr:t}=We(e.value),n=Number(Ge(t));return this.expect(`RPAREN`),new j(n,{ednSource:e.raw})}parseEmbeddedCBOR(){this.t.consume();let e=[];for(;this.t.peek().type!==`GT_GT`;){if(e.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek());e.push(this.parseValue())}this.expect(`GT_GT`);let t;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e)}return new M(e,{encodingWidth:t})}parseArray(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[],a=this.t.lastEndOffset;for(;this.t.peek().type!==`RBRACKET`;){if(i.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACKET`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`array items must be separated by "," or whitespace`,this.t.peek());let e=this.parseValue();Xe(this.t.source,a,e.start)&&(e.blankLineBefore=!0),a=e.end,i.push(e)}this.expect(`RBRACKET`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let o=new k(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(o.warnings??=[],o.warnings.push(...r)),o}parseMap(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[],a=this.t.lastEndOffset;for(;this.t.peek().type!==`RBRACE`;){if(i.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACE`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`map entries must be separated by "," or whitespace`,this.t.peek());let e=this.parseValue();Xe(this.t.source,a,e.start)&&(e.blankLineBefore=!0),this.expect(`COLON`);let t=this.parseValue();a=t.end,i.push([e,t])}this.expect(`RBRACE`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let o=new A(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(o.warnings??=[],o.warnings.push(...r)),o}parseIndefGroup(){this.t.consume();let e=this.t.peek();if(e.type===`UNDERSCORE`)this.t.consume();else if(e.type===`ENCODING_INDICATOR`&&e.value===`7`)this.t.consume(),this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,e);else if(e.type===`ENCODING_INDICATOR`){let e=this.t.consume(),t=`encoding indicator _${e.value} is not valid in an indefinite string group; use _`;this._warnOrFail(t,e)}else e.type!==`RPAREN`&&this._warnOrFail(`indefinite string group is missing _ after (; interpreting as (_ ...)`,e);let t=this._pendingWarnings.splice(0),n=[],r=this.t.lastEndOffset;for(;this.t.peek().type!==`RPAREN`;){if(n.length>0)if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RPAREN`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`indefinite string chunks must be separated by "," or whitespace`,this.t.peek());let e=this.parseValue();Xe(this.t.source,r,e.start)&&(e.blankLineBefore=!0),r=e.end,n.push(e)}this.expect(`RPAREN`),n.length===0&&this._fail(`empty indefinite group (_ ) is ambiguous; use ''_ for bytes or ""_ for text`);let i=n[0];if(i instanceof E){let e=new D(n.map((e,t)=>{if(e instanceof E)return e;this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`)}));return t.length>0&&(e.warnings=t),e}if(i instanceof z){let e=new O(n.map((e,t)=>{if(e instanceof z)return e;this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`)}));return t.length>0&&(e.warnings=t),e}this._fail(`indefinite group chunks must be byte strings or text strings`)}consumeEncodingIndicator(e,t){if(this.t.peek().type===`ENCODING_INDICATOR`){let n=this.t.consume();t?.(n);let r=this._resolveEncodingWidth(n.value,n);return r!==void 0&&e!==void 0&&(r=this._validateEncodingFit(e(),r,n)),r}}expect(e){let t=this.t.consume();return t.type!==e&&this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`,t),t}_applyEiToResult(e,t,n){if(e instanceof w){let r=t===1?`half`:t===2?`single`:t===3?`double`:void 0;if(r===void 0)this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`,n);else if(e.precision!==r){if(r!==`double`){let t=r===`half`?h(m(e.value)):Math.fround(e.value);!Object.is(t,e.value)&&!isNaN(e.value)&&this._warnOrFail(`${e.value} cannot be exactly represented as ${r===`half`?`float16 (_1)`:`float32 (_2)`}`,n)}e.precision=r}}else if(e instanceof S){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.value,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof C){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.argument,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof E){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.value.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof z){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(F.encode(e.value).length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof k){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.items.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof A){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.entries.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof T){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.tag,t,n);r!==void 0&&(e.encodingWidth=r)}}else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`,n)}_validateEncodingFit(e,t,n){let r=oe(t);if(e<=r)return t;let i=`value ${e} does not fit in encoding indicator ${t===`i`?`_i (max 23)`:`_${t} (max ${r})`}`;this._warnOrFail(i,n)}_resolveEncodingWidth(e,t){if(e===`4`||e===`5`||e===`6`){let n=`encoding indicator _${e} (AI ${Number(e)+24}) is reserved and not valid`;this._warnOrFail(n,t);return}if(e===`7`){this._warnOrFail(`indefinite-length encoding (_7) is not valid here; use [_ ...] or {_ ...} for indefinite collections`,t);return}return e===`i`?`i`:Number(e)}_extOnError(e){return t=>this._warnOrFail(t,e)}_warnOrFail(e,t){this._warn(e,t),this._options.strict!==!1&&this._fail(e,t)}_hintMissingExtension(e,t){let n=ot.get(e);if(n===void 0||this._hintedPrefixes.has(e))return;this._hintedPrefixes.add(e);let r=`app-string prefix '${e}' requires an extension that is not enabled; ${n}`;this._options.onWarning?this._options.onWarning({message:r,...ct(t),hint:!0}):this._options.silent||console.warn(`CDN: ${r}`)}_warn(e,t){let n={message:e};if(t!==void 0&&Object.assign(n,ct(t)),this._pendingWarnings.push(n),this._options.onWarning)this._options.onWarning(n);else if(!this._options.silent){let n=t?` at line ${t.line}, column ${t.col}`:``;console.warn(`CDN strict violation${n}: ${e}`)}}_fail(t,n){throw new e.D(t,n?ct(n):void 0)}};function ct(e){return{offset:e.offset,line:e.line,column:e.col,endOffset:e.endOffset}}var lt=new TextEncoder,ut=!1,z=class extends x{indefiniteLength=!1;value;encodingWidth;ednParts;ednSource;quotedEdnSource;ednPartSources;ednPartIsByteString;ednPartSpans;constructor(e,t){super(),this.value=e,this.encodingWidth=t?.encodingWidth,this.ednParts=t?.ednParts,this.ednSource=t?.ednSource,this.quotedEdnSource=t?.quotedEdnSource,this.ednPartSources=t?.ednPartSources,this.ednPartIsByteString=t?.ednPartIsByteString,this.ednPartSpans=t?.ednPartSpans}_encodeTo(e,t){e.writeTextString(3,this.value,this.encodingWidth)}_toCDN(t,n){let r=e._(t,this.encodingWidth,()=>e.i(BigInt(lt.encode(this.value).length)));return dt(this.value,r,t,n,this.ednParts,this.ednSource,this.quotedEdnSource,this.ednPartSources,this.ednPartSpans,this.comments?.dangling)}_toJS(e){return this.value}};function dt(t,n,r,i,a,o,s,c,l,u){let d=e.v(r);if(r?.preserveRawString&&o!==void 0&&(d!==null||!/[\r\n]/.test(o)))return o+n;if(r?.preserveTextString&&s!==void 0&&(d!==null||!/[\r\n]/.test(s)))return s+n;if(d===null)return e.l(t)+n;let f=r?.preserveRawString?c:void 0,p=f?.some(e=>e!==void 0)??!1,{cdn:m,newline:h}=pt(r),ee=r?.preserveConcatenation&&a!==void 0&&(a.length>1||p)?a:void 0;if(!m&&!h&&ee===void 0)return e.l(t)+n;let g=m?gt(t):null;if(ee!==void 0&&(g===null||p)){let t=r?.preserveComments?e.o(u,l,typeof r.preserveComments==`string`?r.preserveComments:void 0):void 0,a=[];for(let[e,n]of ee.entries()){let r=f?.[e];if(r!==void 0)a.push({text:n,contentDepth:0,source:r});else if(h){let e=new Map;for(let{point:t,contentDepth:r}of ht(n,0))e.set(t,r);a.push(...wt(n,e))}else a.push({text:n,contentDepth:0});let i=t?.[e];i&&i.length>0&&(a[a.length-1].commentsAfter=i)}return ft(a,n,d,i)}let _=new Map;if(g!==null)for(let{point:e,contentDepth:t}of g)_.set(e,t);if(h){let e=g===null?ht(t,0):_t(t);for(let{point:t,contentDepth:n}of e)_.has(t)||_.set(t,n)}let v=wt(t,_);return v.length<=1?e.l(t)+n:ft(v,n,d,i)}function ft(t,n,r,i){let a=t.map(({text:r,source:i},a)=>{let o=i??e.l(r);return a===t.length-1?o+n:o}),o=a[0];for(let n=1;n<a.length;n++){let s=e.m(r,i+1+t[n].contentDepth);o+=` +
|
|
8
|
+
`;for(let e of t[n-1].commentsAfter??[])o+=`${s}${e}\n`;o+=`${s}${a[n]}`}return o}function pt(e){let t=e?.splitCdn===void 0||e?.splitNewline===void 0?mt(e?.textStringFormat??[]):[];return{cdn:e?.splitCdn??t.includes(`cdn`),newline:e?.splitNewline??t.includes(`newline`)}}function mt(e){return e.map(e=>e===`cboredn`?(ut||(ut=!0,console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")),`cdn`):e)}function ht(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];i===`\r`?e[r+1]===`
|
|
9
|
+
`?(n.push({point:r+2,contentDepth:t}),r++):n.push({point:r+1,contentDepth:t}):i===`
|
|
10
|
+
`&&n.push({point:r+1,contentDepth:t})}return n}function gt(t){try{Ue(t)}catch{return null}let n=[],r=new e.t(t),i=0,a=null,o=!1,s=0;for(;;){let e=r.consume();if(e.type===`EOF`)break;let c=!1;if(o||(o=!0,e.offset>0&&St(r.comments,0,e.offset)&&n.push({point:e.offset,contentDepth:i})),a!==null){if(a.kind===`opener`&&yt.has(e.type)){a.point=e.endOffset,s=e.endOffset;continue}else a.kind===`opener`&&xt.has(e.type)&&Ct(t,a.point,e.offset)?c=!0:n.push({point:e.offset,contentDepth:a.contentDepth});a=null}bt.has(e.type)?(i++,a={point:e.endOffset,contentDepth:i,kind:`opener`}):xt.has(e.type)?(i=Math.max(0,i-1),c||n.push({point:e.offset,contentDepth:i})):e.type===`COMMA`&&(a={point:e.endOffset,contentDepth:i,kind:`comma`}),s=e.endOffset}let c=r.comments.find(e=>e.start>=s);return c!==void 0&&n.push({point:c.start,contentDepth:i}),n}function _t(t){let n=[],r=new e.t(t),i=0;for(;;){let e=r.consume();if(e.type===`EOF`)break;if(bt.has(e.type))i++;else if(xt.has(e.type))i=Math.max(0,i-1);else if(e.type!==`COMMA`){if(e.type===`TSTR`){let r=t.slice(e.offset,e.endOffset);for(let t of vt(r))n.push({point:e.offset+t,contentDepth:i+1})}else if(e.type===`RAWSTRING`){let r=t.slice(e.offset,e.endOffset);for(let{point:t}of ht(r,0))n.push({point:e.offset+t,contentDepth:i+1})}}}return n}function vt(e){let t=[],n=1,r=e.length-1;for(;n<r;){let r=e[n];if(r===`\\`){let r=e[n+1];if(r===`n`||r===`r`)t.push(n+2),n+=2;else if(r===`u`)if(e[n+2]===`{`){let t=e.indexOf(`}`,n+3);n=t>=0?t+1:n+2}else n+=6;else n+=2}else r===`\r`?e[n+1]===`
|
|
11
|
+
`?(t.push(n+2),n+=2):(t.push(n+1),n++):(r===`
|
|
12
|
+
`&&t.push(n+1),n++)}return t}var yt=new Set([`ENCODING_INDICATOR`,`UNDERSCORE`]),bt=new Set([`LBRACKET`,`LBRACE`,`LPAREN`,`LT_LT`]),xt=new Set([`RBRACKET`,`RBRACE`,`RPAREN`,`GT_GT`]);function St(e,t,n){return e.some(e=>e.start>=t&&e.end<=n)}function Ct(e,t,n){return/^[\t\n\r ]*$/.test(e.slice(t,n))}function wt(e,t){let n=[...t].filter(([t])=>t>0&&t<e.length).sort(([e],[t])=>e-t);if(n.length===0)return[{text:e,contentDepth:0}];let r=[],i=0,a=0;for(let[t,o]of n)t!==i&&(r.push({text:e.slice(i,t),contentDepth:a}),i=t,a=o);return i<e.length&&r.push({text:e.slice(i),contentDepth:a}),r}function B(e){if(Number.isInteger(e))return new Date(e*1e3).toISOString().replace(/\.000Z$/,`Z`);let t=Math.round(e*1e3);if(t/1e3===e)return new Date(t).toISOString().replace(/\.000Z$/,`Z`);let n=Math.floor(e),r=e-n,i=new Date(n*1e3).toISOString().replace(/\.\d+Z$/,``),a=r.toString(),o=a.indexOf(`.`),s=o>=0?a.slice(o+1):`0`;for(;s.length<3;)s+=`0`;return`${i}.${s}Z`}var Tt=new TextDecoder(`utf-8`,{fatal:!0});function Et(e){if(e.length!==1)throw SyntaxError(`dt<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof E)return Tt.decode(t.value);throw SyntaxError(`dt<<...>>: expected a text string or byte string`)}var Dt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;function Ot(e,t){if(!Dt.test(e)){let n=`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;if(t)t(n);else throw SyntaxError(n)}let n=e.match(/^(.+T\d{2}:\d{2}:\d{2})(\.\d+)(Z|[+-]\d{2}:\d{2})$/i),r,i;n?(r=n[1]+n[3],i=parseFloat(`0`+n[2])):(r=e,i=void 0);let a=Date.parse(r);if(isNaN(a))throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);if(i===void 0){let e=a/1e3;return e>=0?new At(BigInt(e)):new jt(BigInt(e))}return new Mt(a/1e3+i)}var kt=1n,At=class extends S{constructor(e,t){super(e,t)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e._(t,this.encodingWidth,()=>e.i(this.value));return e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.n(this.appSeqSource,r,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${B(Number(this.value))}'${r}`}},jt=class extends C{constructor(e,t){super(e,t)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e._(t,this.encodingWidth,()=>e.i(this.argument));return e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.n(this.appSeqSource,r,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${B(Number(this.value))}'${r}`}},Mt=class extends w{constructor(e,t){super(e,t)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=b(this.value),i=e.u(this.value,this.precision,r,t?.encodingIndicators??`auto`);return e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.n(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${B(this.value)}'${i}`}},Nt=class extends T{constructor(e,t){super(kt,typeof e==`string`?Ot(e):e,t)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e.s(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(r===`verbatim`)return this.appSeqSource;if(r===`source`)return e.r(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(r===`structural`)return super._toCDN({...t,appStrings:!1},n);let i=e._(t,this.encodingWidth,()=>e.i(kt));if(r===`adjusted`)return e.n(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments);let a=this.content;return(a instanceof w?a.precision!==void 0&&a.precision!==b(a.value):a.encodingWidth!==void 0)?super._toCDN({...t,appStrings:!1},n):`DT'${B(a instanceof w?a.value:Number(a.value))}'${i}`}},Pt=class extends Nt{constructor(e,t){super(e,t)}_toJS(e){let t=this.content,n=t instanceof w?t.value*1e3:Number(t.value)*1e3;return new Date(n)}};function Ft(e){let t=e?.jsDate??!1;function n(e){return t?new Pt(e):new Nt(e)}let r={appStringPrefixes:[`dt`,`DT`],tagNumbers:[kt],preserveAppSeqSource:`optional`,parseAppString(e,t,r){return e===`DT`?n(t):Ot(t,r)},parseAppSequence(e,t,r){let i=Et(t);return e===`DT`?n(i):Ot(i,r)},parseTag(e,n){if(e!==1n)return;let r;if(n instanceof S)r=new At(n.value,{encodingWidth:n.encodingWidth,ednSource:n.ednSource});else if(n instanceof C)r=new jt(n.value,{encodingWidth:n.encodingWidth,ednSource:n.ednSource});else if(n instanceof w)r=new Mt(n.value,{precision:n.precision,literalSource:n.literalSource});else return;return r.start=n.start,r.end=n.end,t?new Pt(r):new Nt(r)}};return t&&(r.fromJS=(e,t)=>{if(e instanceof Date)return new Pt(B(e.getTime()/1e3))},r.isJSType=e=>e instanceof Date),r}var It=Ft(),Lt=Ft({jsDate:!0});function Rt(e){let t=e.split(`.`);if(t.length!==4)throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);let n=new Uint8Array(4);for(let e=0;e<4;e++){let r=t[e];if(!/^\d+$/.test(r)||r.length>1&&r[0]===`0`)throw SyntaxError(`ip: invalid IPv4 octet: ${JSON.stringify(r)}`);let i=parseInt(r,10);if(i>255)throw SyntaxError(`ip: IPv4 octet out of range: ${i}`);n[e]=i}return n}function zt(e){let t=new Uint8Array(16);if(e===`::`)return t;let n=e,r=null,i=e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);i&&(n=i[1],n.endsWith(`:`)&&(n+=`:`),r=Rt(i[2]));let a=n.split(`::`);if(a.length>2)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let o=a.length===2,s=a[0]?a[0].split(`:`):[],c=o&&a[1]?a[1].split(`:`):[],l=r?6:8;if(!o&&s.length!==l||o&&s.length+c.length>=l)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let u=l-s.length-c.length,d=[...s,...Array(u).fill(`0`),...c],f=0;for(let e of d){if(!/^[0-9a-fA-F]{1,4}$/.test(e))throw SyntaxError(`ip: invalid IPv6 group: ${JSON.stringify(e)}`);let n=parseInt(e,16);t[f++]=n>>8&255,t[f++]=n&255}return r&&t.set(r,12),t}function Bt(e){return Array.from(e).join(`.`)}function Vt(e){let t=e.slice(0,10).every(e=>e===0)&&e[10]===255&&e[11]===255?Bt(e.slice(12)):null,n=t?6:8,r=[];for(let t=0;t<n*2;t+=2)r.push(e[t]<<8|e[t+1]);let i=-1,a=0,o=0;for(;o<n;)if(r[o]===0){let e=o+1;for(;e<n&&r[e]===0;)e++;e-o>a&&(i=o,a=e-o),o=e}else o++;a<2&&(i=-1);let s=e=>e.toString(16),c;return c=i===-1?r.map(s).join(`:`):`${r.slice(0,i).map(s).join(`:`)}::${r.slice(i+a).map(s).join(`:`)}`,t?`${c}:${t}`:c}var Ht=`ip`,V=`IP`,H=52n,Ut=54n,Wt=new TextDecoder(`utf-8`,{fatal:!0});function Gt(e){if(e.length!==1)throw SyntaxError(`ip<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof E)return Wt.decode(t.value);throw SyntaxError(`ip<<...>>: expected a text string or byte string`)}function Kt(e){return/^\d/.test(e)&&e.includes(`.`)&&!e.includes(`:`)?{bytes:Rt(e),isV4:!0}:{bytes:zt(e),isV4:!1}}function qt(e){if(e.length===4)return Bt(e);if(e.length===16)return Vt(e);throw SyntaxError(`ip: unexpected byte length: ${e.length}`)}function Jt(e,t){let n=new Uint8Array(e.length);n.set(e);let r=Math.floor(t/8),i=t%8;i>0&&r<e.length&&(n[r]&=255<<8-i&255);for(let t=r+ +(i>0);t<e.length;t++)n[t]=0;let a=Math.ceil(t/8);for(;a>0&&n[a-1]===0;)a--;return n.slice(0,a)}function Yt(e,t){let n=new Uint8Array(t);return n.set(e),n}var Xt=class extends E{_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e._(t,this.encodingWidth,()=>e.i(BigInt(this.value.length)));return e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.n(this.appSeqSource,r,t,this.appSeqInnerEnd,this.appSeqComments):`${Ht}'${qt(this.value)}'${r}`}},Zt=class extends k{_isV4;constructor(e,t,n){super([new S(BigInt(e)),new E(t)]),this._isV4=n}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);if(e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`)return e.n(this.appSeqSource,``,t,this.appSeqInnerEnd,this.appSeqComments);let r=Number(this.items[0].value),i=this.items[1].value;return`${Ht}'${qt(Yt(i,this._isV4?4:16))}/${r}'`}},Qt=class extends T{constructor(e,t){super(e,t)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e.s(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(r===`verbatim`)return this.appSeqSource;if(r===`source`)return e.r(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(r===`structural`)return super._toCDN(t,n);if(r===`adjusted`){let n=e._(t,this.encodingWidth,()=>e.i(this.tag));return e.n(this.appSeqSource,n,t,this.appSeqInnerEnd,this.appSeqComments)}let i=this.tag===H?4:16,a=this.content;if(a instanceof E){if(a.encodingWidth!==void 0)return super._toCDN(t,n);let r=e._(t,this.encodingWidth,()=>e.i(this.tag));return`${V}'${qt(a.value)}'${r}`}if(a instanceof k&&a.items.length===2&&a.items[0]instanceof S&&a.items[1]instanceof E){if(a.encodingWidth!==void 0||a.items[0].encodingWidth!==void 0||a.items[1].encodingWidth!==void 0)return super._toCDN(t,n);let r=Number(a.items[0].value),o=Yt(a.items[1].value,i),s=e._(t,this.encodingWidth,()=>e.i(this.tag));return`${V}'${qt(o)}/${r}'${s}`}return super._toCDN(t,n)}};function $t(e,t){let n=t.indexOf(`/`);if(n===-1){let{bytes:n,isV4:r}=Kt(t);return e===V?new Qt(r?H:Ut,new E(n)):new Xt(n)}let r=t.slice(0,n),i=t.slice(n+1);if(!/^\d+$/.test(i))throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);let a=parseInt(i,10),{bytes:o,isV4:s}=Kt(r),c=s?32:128;if(a>c)throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s?`IPv4`:`IPv6`}`);let l=Jt(o,a);return e===V?new Qt(s?H:Ut,new k([new S(BigInt(a)),new E(l)])):new Zt(a,l,s)}var en={appStringPrefixes:[Ht,V],tagNumbers:[H,Ut],preserveAppSeqSource:`optional`,parseAppString(e,t){return $t(e,t)},parseAppSequence(e,t){return $t(e,Gt(t))},parseTag(e,t){if(!(e!==H&&e!==Ut)&&(t instanceof E||t instanceof k))return new Qt(e,t)}},tn=`cri`,nn=`CRI`,rn=99n,an=new Map([[`coap`,-1n],[`coaps`,-2n],[`http`,-3n],[`https`,-4n],[`urn`,-5n],[`did`,-6n],[`coap+tcp`,-7n],[`coaps+tcp`,-8n],[`coap+ws`,-25n],[`coaps+ws`,-26n]]),on=new Map([...an.entries()].map(([e,t])=>[t,e]));function U(e){try{return decodeURIComponent(e)}catch{return e}}var sn=new TextEncoder,cn=new TextDecoder(`utf-8`,{fatal:!0});function ln(e){return Array.from(sn.encode(e),e=>`%${e.toString(16).toUpperCase().padStart(2,`0`)}`).join(``)}function W(e,t){let n=``;for(let r of e)n+=t(r)?r:ln(r);return n}function un(e){return/[A-Za-z0-9\-._~]/.test(e)}function dn(e){return/[!$&'()*+,;=]/.test(e)}function fn(e){return un(e)||dn(e)||e===`:`||e===`@`}function pn(e){return(fn(e)||e===`/`||e===`?`)&&e!==`&`}function mn(e){return fn(e)||e===`/`||e===`?`}function hn(e){return un(e)||dn(e)||e===`:`}function gn(e){return un(e)||dn(e)}function _n(e){let t=[],n=e,r=n.indexOf(`@`);r>=0&&(t.push(j.FALSE),t.push(new z(U(n.slice(0,r)))),n=n.slice(r+1));let i,a=null;if(n.startsWith(`[`)){let e=n.indexOf(`]`);if(e<0)throw SyntaxError(`cri: unterminated IPv6 bracket in authority`);i=n.slice(1,e);let r=n.slice(e+1);if(r.startsWith(`:`))a=r.slice(1);else if(r.length>0)throw SyntaxError(`cri: unexpected characters after ']' in authority`);t.push(new E(zt(i)))}else{let e=n.lastIndexOf(`:`);if(e>=0?(i=n.slice(0,e),a=n.slice(e+1)):i=n,i!==``)if(/^\d{1,3}(\.\d{1,3}){3}$/.test(i))t.push(new E(Rt(i)));else for(let e of i.toLowerCase().split(`.`))t.push(new z(e))}if(a!==null&&a!==``){if(!/^\d+$/.test(a))throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);let e=parseInt(a,10);if(e>65535)throw SyntaxError(`cri: port ${e} out of range`);t.push(new S(BigInt(e)))}return new k(t)}function vn(e){let t=e.items,n=0,r=``;if(n<t.length&&t[n]instanceof j&&t[n].value===20){n++;let e=t[n++];r+=W(e.value,hn)+`@`}if(n>=t.length)return r;let i=t[n];if(i instanceof E){n++;let{length:e}=i.value;if(e===4)r+=Bt(i.value);else if(e===16)r+=`[`+Vt(i.value)+`]`;else throw Error(`cri: unexpected host-ip byte length: ${e}`);n<t.length&&t[n]instanceof z&&(r+=`%25${W(t[n++].value,gn)}`)}else{let e=[];for(;n<t.length&&t[n]instanceof z;)e.push(W(t[n++].value,gn));r+=e.join(`.`)}return n<t.length&&t[n]instanceof S&&(r+=`:`+t[n].value.toString()),r}function yn(e){let t=e.slice(2),n=t.indexOf(`/`),r,i;return n>=0?(r=t.slice(0,n),i=t.slice(n+1).split(`/`).map(e=>new z(U(e)))):(r=t,i=[]),{authority:_n(r),pathSegments:i}}function bn(e){let t=e,n=null,r=t.indexOf(`#`);r>=0&&(n=U(t.slice(r+1)),t=t.slice(0,r));let i=null,a=t.indexOf(`?`);if(a>=0){let e=t.slice(a+1);t=t.slice(0,a),i=e.split(`&`).map(e=>new z(U(e)))}let o=[],s=/^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);if(s){let e=s[1].toLowerCase(),t=s[2],n=an.get(e);if(o.push(n===void 0?new z(e):new C(n)),t.startsWith(`//`)){let{authority:e,pathSegments:n}=yn(t);o.push(e,new k(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new z(U(e)));o.push(j.NULL,new k(e))}else{let e=t.split(`/`).map(e=>new z(U(e)));o.push(j.TRUE,new k(e))}}else if(t.startsWith(`//`)){let{authority:e,pathSegments:n}=yn(t);o.push(j.FALSE,e,new k(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new z(U(e)));o.push(j.TRUE,new k(e))}else if(t===``)o.push(new S(0n));else{let n=1n,r=t,i=!1;for(r.startsWith(`./`)&&(i=!0,r=r.slice(2));r.startsWith(`../`);)n++,r=r.slice(3);if(r===`..`?(n++,r=``):r===`.`&&(r=``),n===1n&&!i&&r!==``&&r.split(`/`)[0].includes(`:`))throw SyntaxError(`cri: invalid relative-path reference — first segment must not contain ':' without a './' prefix (RFC 3986 §3.3): ${JSON.stringify(e)}`);let a=r===``?[]:r.split(`/`).map(e=>new z(U(e)));o.push(new S(n),new k(a))}if(i!==null&&o.push(new k(i)),n!==null&&(i===null&&o.push(j.NULL),o.push(new z(n))),n!==null&&i===null&&o.splice(o.length-2,1),i===null&&n===null){let e=o[o.length-1];e instanceof k&&e.items.length===0&&o.pop()}return o.length===1&&o[0]instanceof S&&o[0].value===0n?[]:o}function G(e,t){let n=t,r=``;if(n<e.length){let t=e[n];if(t instanceof k){if(n++,t.items.length>0){let e=t.items.map(e=>{if(!(e instanceof z))throw Error(`cri: query item must be a text string`);return W(e.value,pn)});r+=`?`+e.join(`&`)}}else t instanceof j&&t.value===22&&n++}return n<e.length&&e[n]instanceof z&&(r+=`#`+W(e[n].value,mn)),r}function xn(e){return e.items.map(e=>{if(!(e instanceof z))throw Error(`cri: path segment must be a text string`);return W(e.value,fn)})}function Sn(e){if(e.length===0)return``;let t=0,n=e[t++];if(n instanceof C||n instanceof z){let r;if(n instanceof C){let e=on.get(n.value);if(e===void 0)throw Error(`cri: unrecognised scheme-id ${n.value}`);r=e+`:`}else r=n.value+`:`;if(t>=e.length)return r;let i=e[t++],a=``,o=!1;if(i instanceof k)a=`//`+vn(i),o=!0;else if(i instanceof j)if(i.value===22)o=!0;else if(i.value===21)o=!1;else throw Error(`cri: unexpected no-authority value: simple(${i.value})`);else throw Error(`cri: unexpected type for authority element`);let s=``;if(t<e.length&&e[t]instanceof k){let n=e[t++];n.items.length>0&&(s=(o?`/`:``)+xn(n).join(`/`))}return r+a+s+G(e,t)}if(n instanceof j&&n.value===20){if(t>=e.length||!(e[t]instanceof k))throw Error(`cri: network-path reference requires an authority array`);let n=vn(e[t++]),r=``;if(t<e.length&&e[t]instanceof k){let n=e[t++];n.items.length>0&&(r=`/`+xn(n).join(`/`))}return`//`+n+r+G(e,t)}if(n instanceof j&&n.value===21){let n=`/`;if(t<e.length&&e[t]instanceof k){let r=e[t++];n=`/`+xn(r).join(`/`)}return n+G(e,t)}if(n instanceof S){let r=n.value;if(r===0n)return G(e,t);let i=r===1n?``:`../`.repeat(Number(r)-1),a;if(t<e.length&&e[t]instanceof k){let n=e[t++];if(n.items.length>0){let e=xn(n);a=(r===1n&&e[0].includes(`:`)?`./`:i)+e.join(`/`)}else a=i===``?`./`:i}else a=i===``?`./`:i;return a+G(e,t)}throw Error(`cri: unrecognised first element type in CRI array`)}var Cn=class extends k{_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e._(t,this.encodingWidth,()=>e.i(BigInt(this.items.length)));if(e.s(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`)return e.n(this.appSeqSource,r,t,this.appSeqInnerEnd,this.appSeqComments);try{return`${tn}'${Sn(this.items)}'${r}`}catch{return super._toCDN(t,n)}}},wn=class extends T{constructor(e){super(rn,e)}_toCDN(t,n){if(t?.appStrings===!1)return super._toCDN(t,n);let r=e.s(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(r===`verbatim`)return this.appSeqSource;if(r===`source`)return e.r(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(r===`structural`)return super._toCDN({...t,appStrings:!1},n);try{let i=this.content;if(i.encodingWidth!==void 0)return super._toCDN(t,n);let a=e._(t,this.encodingWidth,()=>e.i(rn));return r===`adjusted`?e.n(this.appSeqSource,a,t,this.appSeqInnerEnd,this.appSeqComments):`${nn}'${Sn(i.items)}'${a}`}catch{return super._toCDN(t,n)}}};function Tn(e){if(e.length!==1)throw SyntaxError(`cri<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof E)return cn.decode(t.value);throw SyntaxError(`cri<<...>>: expected a text string or byte string`)}function En(e,t){let n=new Cn(bn(t));return e===nn?new wn(n):n}var Dn={appStringPrefixes:[tn,nn],tagNumbers:[rn],preserveAppSeqSource:`optional`,parseAppString(e,t){return En(e,t)},parseAppSequence(e,t){return En(e,Tn(t))},parseTag(e,t){if(e!==99n||!(t instanceof k))return;let n=new Cn(t.items,{indefiniteLength:t.indefiniteLength,encodingWidth:t.encodingWidth});return n.start=t.start,n.end=t.end,new wn(n)}},On=18446744073709551615n,kn=-18446744073709551616n,An={tagNumbers:[Ne,Pe],parseTag(e,t){if(t instanceof E){if(e===2n){let e=Re(t.value);return e>On?new ze(e):void 0}if(e===3n){let e=-1n-Re(t.value);return e<kn?new Be(e):void 0}}}};function jn(e,t){if(e===24&&t<=23n)return 0;if(e===25&&t<=255n)return 1;if(e===26&&t<=65535n)return 2;if(e===27&&t<=4294967295n)return 3}function Mn(e,t){if(e===24&&t<=23)return 0;if(e===25&&t<=255)return 1;if(e===26&&t<=65535)return 2;if(e===27&&t<=4294967295)return 3}var Nn=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),Pn=new TextDecoder(`utf-8`,{fatal:!1,ignoreBOM:!0});function K(e){throw Error(`CBOR decode error: ${e}`)}function Fn(e,t,n){let r={message:e,offset:t};if(n?.onWarning?n.onWarning(r):n?.silent||console.warn(`CBOR strict violation at offset ${t}: ${e}`),n?.strict!==!1)throw Error(`CBOR decode error: ${e}`);return r}function q(e,t){e.warnings??=[],e.warnings.push(t)}function J(t){if(t instanceof S)return[`u`,String(t.value)];if(t instanceof C)return[`n`,String(t.value)];if(t instanceof z)return[`t`,t.value];if(t instanceof O)return[`t`,t.chunks.map(e=>e.value).join(``)];if(t instanceof E)return[`b`,e.w(t.value)];if(t instanceof D){let n=``;for(let r of t.chunks)n+=e.w(r.value);return[`b`,n]}if(t instanceof w)return isNaN(t.value)?[`f`,`NaN`]:Object.is(t.value,-0)?[`f`,`-0`]:[`f`,String(t.value)];if(t instanceof j)return[`s`,t.value];if(t instanceof k)return[`A`,t.items.map(J)];if(t instanceof A){let e=t.entries.map(([e,t])=>[J(e),J(t)]);if(e.length<=1)return[`M`,e];let n=e.map(e=>[JSON.stringify(e[0]),e]);return n.sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0])),[`M`,n.map(e=>e[1])]}return t instanceof T?[`G`,String(t.tag),J(t.content)]:[`c`,e.w(t.toCBOR())]}function In(t){if(t instanceof S)return`u`+t.value;if(t instanceof C)return`n`+t.value;if(t instanceof z)return`t`+t.value;if(t instanceof O){let e=`t`;for(let n of t.chunks)e+=n.value;return e}if(t instanceof E)return`b`+e.w(t.value);if(t instanceof D){let n=`b`;for(let r of t.chunks)n+=e.w(r.value);return n}return t instanceof w?isNaN(t.value)?`fNaN`:Object.is(t.value,-0)?`f-0`:`f`+t.value:t instanceof j?`s`+t.value:JSON.stringify(J(t))}var Ln=Array.from({length:24},(e,t)=>BigInt(t)),Rn;function zn(e){return e===void 0?Rn??=Z(void 0).filter(e=>e.parseTag!==void 0):Z(e).filter(e=>e.parseTag!==void 0)}function Bn(e,t){for(let n=0;n<t;n++)if(e[n]>=128)return;return String.fromCharCode.apply(null,e)}function Vn(e,t,n){if(n<=23)return{value:Ln[n],nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&K(`unexpected end of input`),{value:BigInt(e.getUint8(t)),nextOffset:t+1};case 25:return t+2>e.byteLength&&K(`unexpected end of input`),{value:BigInt(e.getUint16(t,!1)),nextOffset:t+2};case 26:return t+4>e.byteLength&&K(`unexpected end of input`),{value:BigInt(e.getUint32(t,!1)),nextOffset:t+4};case 27:return t+8>e.byteLength&&K(`unexpected end of input`),{value:e.getBigUint64(t,!1),nextOffset:t+8};default:K(`reserved additional info value: ${n}`)}}function Hn(e,t,n){if(n<=23)return{value:n,nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&K(`unexpected end of input`),{value:e.getUint8(t),nextOffset:t+1};case 25:return t+2>e.byteLength&&K(`unexpected end of input`),{value:e.getUint16(t,!1),nextOffset:t+2};case 26:return t+4>e.byteLength&&K(`unexpected end of input`),{value:e.getUint32(t,!1),nextOffset:t+4};case 27:{t+8>e.byteLength&&K(`unexpected end of input`);let n=e.getUint32(t,!1),r=e.getUint32(t+4,!1);return{value:n*4294967296+r,nextOffset:t+8}}default:K(`reserved additional info value: ${n}`)}}function Un(e,t,n,r,i,a){let o=[],s=t;for(;;){if(s>=e.byteLength&&K(`unexpected end of indefinite ${i}`),e.getUint8(s)===255){s++;break}let t=Y(e,s,n,r);a(t.value)||K(`indefinite-length ${i} chunk must be a definite ${i}`),o.push(t.value),s=t.nextOffset}return{chunks:o,nextOffset:s}}function Wn(e,t,n,r){let i=In(e);t.has(i)&&n.push(Fn(`duplicate map key at offset ${e.start}`,e.start,r)),t.add(i)}function Y(e,t,n,r){let i=t,a=Kn(e,t,n,r);return a.value.start=i,a.value.end=a.nextOffset,a}function Gn(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n).slice()}function Kn(e,t,n,r){t>=e.byteLength&&K(`unexpected end of input`);let i=e.getUint8(t++),a=i>>5,o=i&31;switch(a){case 0:{let{value:n,nextOffset:r}=Vn(e,t,o);return{value:new S(n,{encodingWidth:jn(o,n)}),nextOffset:r}}case 1:{let{value:n,nextOffset:r}=Vn(e,t,o),i=jn(o,n);return{value:new C(-1n-n,{encodingWidth:i}),nextOffset:r}}case 2:{if(o===31){let{chunks:i,nextOffset:a}=Un(e,t,n,r,`byte string`,e=>e instanceof E);return{value:new D(i),nextOffset:a}}let{value:i,nextOffset:a}=Hn(e,t,o),s=Mn(o,i);return a+i>e.byteLength&&K(`byte string extends beyond input`),{value:new E(new Uint8Array(e.buffer,e.byteOffset+a,i).slice(),{encodingWidth:s}),nextOffset:a+i}}case 3:{if(o===31){let{chunks:i,nextOffset:a}=Un(e,t,n,r,`text string`,e=>e instanceof z);return{value:new O(i),nextOffset:a}}let{value:i,nextOffset:a}=Hn(e,t,o),s=Mn(o,i);a+i>e.byteLength&&K(`text string extends beyond input`);let c=new Uint8Array(e.buffer,e.byteOffset+a,i),l,u,d=i<64?Bn(c,i):void 0;if(d!==void 0)l=d;else try{l=Nn.decode(c)}catch{u=Fn(`invalid UTF-8 sequence in text string`,a,n),l=Pn.decode(c)}let f=new z(l,{encodingWidth:s});return u&&q(f,u),{value:f,nextOffset:a+i}}case 4:{if(o===31){let i=[],a=t;for(;;){if(a>=e.byteLength&&K(`unexpected end of indefinite array`),e.getUint8(a)===255){a++;break}let t=Y(e,a,n,r);i.push(t.value),a=t.nextOffset}return{value:new k(i,{indefiniteLength:!0}),nextOffset:a}}let{value:i,nextOffset:a}=Hn(e,t,o),s=Mn(o,i),c=[],l=a;for(let t=0;t<i;t++){let t=Y(e,l,n,r);c.push(t.value),l=t.nextOffset}return{value:new k(c,{encodingWidth:s}),nextOffset:l}}case 5:{if(o===31){let i=[],a=new Set,o=[],s=t;for(;;){if(s>=e.byteLength&&K(`unexpected end of indefinite map`),e.getUint8(s)===255){s++;break}let t=Y(e,s,n,r);Wn(t.value,a,o,n),s=t.nextOffset;let c=Y(e,s,n,r);s=c.nextOffset,i.push([t.value,c.value])}let c=new A(i,{indefiniteLength:!0});for(let e of o)q(c,e);return{value:c,nextOffset:s}}let{value:i,nextOffset:a}=Hn(e,t,o),s=Mn(o,i),c=[],l=new Set,u=[],d=a;for(let t=0;t<i;t++){let t=Y(e,d,n,r);Wn(t.value,l,u,n),d=t.nextOffset;let i=Y(e,d,n,r);d=i.nextOffset,c.push([t.value,i.value])}let f=new A(c,{encodingWidth:s});for(let e of u)q(f,e);return{value:f,nextOffset:d}}case 6:{o===31&&K(`tags cannot use indefinite-length encoding`);let{value:i,nextOffset:a}=Vn(e,t,o),s=jn(o,i),c=Y(e,a,n,r);for(let e of r){let t=e.parseTag(i,c.value,n);if(t!==void 0)return t instanceof T&&s!==void 0&&(t.encodingWidth=s),{value:t,nextOffset:c.nextOffset}}return{value:new T(i,c.value,{encodingWidth:s}),nextOffset:c.nextOffset}}case 7:if(o<=19)return{value:new j(o),nextOffset:t};if(o===20)return{value:new j(20),nextOffset:t};if(o===21)return{value:new j(21),nextOffset:t};if(o===22)return{value:new j(22),nextOffset:t};if(o===23)return{value:new j(23),nextOffset:t};if(o===24){t+1>e.byteLength&&K(`unexpected end of input`);let r=e.getUint8(t);if(r<32){let e=Fn(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`,t-1,n),i=new j(r);return q(i,e),{value:i,nextOffset:t+1}}return{value:new j(r),nextOffset:t+1}}if(o===25){t+2>e.byteLength&&K(`unexpected end of input`);let n=h(e.getUint16(t,!1));return{value:new w(n,{precision:`half`,rawBits:Number.isNaN(n)?Gn(e,t,2):void 0}),nextOffset:t+2}}if(o===26){t+4>e.byteLength&&K(`unexpected end of input`);let n=e.getFloat32(t,!1);return{value:new w(n,{precision:`single`,rawBits:Number.isNaN(n)?Gn(e,t,4):void 0}),nextOffset:t+4}}if(o===27){t+8>e.byteLength&&K(`unexpected end of input`);let n=e.getFloat64(t,!1);return{value:new w(n,{precision:`double`,rawBits:Number.isNaN(n)?Gn(e,t,8):void 0}),nextOffset:t+8}}return o<31&&K(`reserved additional info value in major type 7: ${o}`),K(`unexpected break code outside indefinite-length item`)}return K(`unknown major type: ${a}`)}function qn(e){if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`expected ArrayBufferView or ArrayBufferLike`)}function Jn(e,t){let n=qn(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),i=t?.offset??0;if(!Number.isInteger(i)||i<0||i>r.byteLength)throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);let a=zn(t?.builtinExtensions),o=t?.extensions?.length?[...t.extensions.filter(e=>e.parseTag!==void 0),...a]:a,{value:s,nextOffset:c}=Y(r,i,t,o);if(!t?.allowTrailing&&c!==r.byteLength){q(s,Fn(`${r.byteLength-c} trailing byte(s) after end of CBOR item`,c,t));let e={strict:!1,silent:!0},n=c;for(;n<r.byteLength;)({nextOffset:n}=Y(r,n,e,o))}return s}var Yn=24n,Xn={tagNumbers:[Yn],parseTag(e,t,n){if(e!==24n||!(t instanceof E))return;let r=(t.end??t.value.length)-t.value.length,i=n?{extensions:n.extensions,builtinExtensions:n.builtinExtensions,strict:n.strict,onWarning:n.onWarning?e=>n.onWarning({...e,offset:e.offset+r}):void 0,silent:n.silent}:void 0;try{return new T(Yn,new M([Jn(t.value,i)],{encodingWidth:t.encodingWidth}))}catch(e){if(i?.strict!==!1)throw e;let t=`tag 24 content is not valid CBOR: ${e instanceof Error?e.message:String(e)}`,a={message:t,offset:r};n?.onWarning?n.onWarning(a):n?.silent||console.warn(`CBOR strict violation at offset ${a.offset}: ${t}`);return}}};function Zn(e){return e instanceof P&&!(e.content instanceof k)}function Qn(e){let t=!1,n=!1,r=!1,i;for(let a of e){let e;if(Zn(a))e=!0,r=!0;else if(a instanceof z)e=!1,t=!0;else if(a instanceof E)e=!1,n=!0;else return!1;if(e===i)return!1;i=e}return r&&!(t&&n)}var $n={tagNumbers:[De],parseTag(e,t){if(e===888n){if(t instanceof j&&t.value===22)return new P;if(t instanceof k&&Qn(t.items))return new P(t.items)}}},er=new TextEncoder,tr=new TextDecoder(`utf-8`,{fatal:!0}),nr=new TextDecoder(`utf-8`,{fatal:!1}),rr=Symbol(`ellipsis`);function ir(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function ar(e,t,n){if(t instanceof N){ar(e,t.inner,n);return}if(t instanceof P){if(t.content instanceof k)for(let r of t.content.items)ar(e,r,n);else n.push(rr);return}if(t instanceof z){n.push(er.encode(t.value));return}if(t instanceof E){n.push(t.value);return}if(t instanceof O){n.push(er.encode(t.chunks.map(e=>e.value).join(``)));return}if(t instanceof D){n.push(ir(t.chunks.map(e=>e.value)));return}throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`)}function or(e,t){try{return tr.decode(e)}catch{let n=`t1 concatenation result is not valid UTF-8`;if(t)t(n);else throw SyntaxError(n);return nr.decode(e)}}function sr(e,t,n){let r=[];for(let n of t)ar(e,n,r);let i=e===`t1`,a=[],o=!1,s=[],c=()=>{if(s.length===0)return;let e=ir(s);s.length=0,e.length!==0&&a.push(i?new z(or(e,n)):new E(e))};for(let e of r)e===rr?(c(),a[a.length-1]instanceof P||(a.push(new P),o=!0)):s.push(e);if(!o){let e=ir(s);return i?new z(or(e,n)):new E(e)}return c(),a.length===1?new P:new P(a)}function cr(e){return{appStringPrefixes:[e],preserveAppSeqSource:!0,parseAppString(t,n,r){return sr(e,[new z(n)],r)},parseAppSequence(t,n,r){return sr(e,n,r)}}}var lr=cr(`t1`),ur=cr(`b1`),dr=new TextEncoder,fr=new TextDecoder(`utf-8`,{fatal:!0}),pr=new TextDecoder(`utf-8`,{fatal:!1});function mr(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function hr(e,t,n){let r=e===`ilts`,i=[],a=[];for(let o of t){if(o instanceof N&&(o=o.inner),o instanceof P)throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);let t,s,c;if(o instanceof z)t=o.value,c=o.encodingWidth;else if(o instanceof E)s=o.value,c=o.encodingWidth;else if(o instanceof O)t=o.chunks.map(e=>e.value).join(``);else if(o instanceof D)s=mr(o.chunks.map(e=>e.value));else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);if(r){let e;if(t!==void 0)e=t;else try{e=fr.decode(s)}catch{let t=`ilts chunk is not valid UTF-8`;if(n)n(t);else throw SyntaxError(t);e=pr.decode(s)}a.push(new z(e,c===void 0?void 0:{encodingWidth:c}))}else{let e=s??dr.encode(t);i.push(new E(e,c===void 0?void 0:{encodingWidth:c}))}}return r?new O(a):new D(i)}function gr(t){return{appStringPrefixes:[t],preserveAppSeqSource:!0,parseAppString(n,r,i){return new N(hr(t,[new z(r)],i),`${t}${e.c(r)}`)},parseAppSequence(e,n,r){return hr(t,n,r)}}}var _r=gr(`ilbs`),vr=gr(`ilts`),yr=class extends w{_bits;constructor(e){super(h(e),{precision:`half`}),this._bits=e&65535}_toCBOR(){return new Uint8Array([249,this._bits>>8&255,this._bits&255])}},br=class extends w{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),{precision:`single`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(5);return e[0]=250,e.set(this._raw,1),e}},xr=class extends w{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat64(0,!1),{precision:`double`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(9);return e[0]=251,e.set(this._raw,1),e}};function X(e){if(e.length===2)return new yr(e[0]<<8|e[1]);if(e.length===4)return new br(e);if(e.length===8)return new xr(e);throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`)}function Sr(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i;if(n===31)i=t<<31|2139095040|r<<13;else if(n===0&&r===0)i=t<<31;else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;i=t<<31|112-n<<23|(e&511)<<14}else i=t<<31|n+112<<23|r<<13;let a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,i>>>0,!1),a}function Cr(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i=new Uint8Array(8),a=new DataView(i.buffer);if(n===31)a.setUint32(0,(t<<31|2146435072|r<<10)>>>0,!1),a.setUint32(4,0,!1);else if(n===0&&r===0)a.setUint32(0,t<<31>>>0,!1),a.setUint32(4,0,!1);else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;a.setUint32(0,(t<<31|1008-n<<20|(e&511)<<11)>>>0,!1),a.setUint32(4,0,!1)}else a.setUint32(0,(t<<31|n+1008<<20|r<<10)>>>0,!1),a.setUint32(4,0,!1);return i}function wr(e){let t=new DataView(e.buffer,e.byteOffset).getUint32(0,!1),n=t>>>31&1,r=t>>>23&255,i=t&8388607,a=new Uint8Array(8),o=new DataView(a.buffer);if(r===255)o.setUint32(0,(n<<31|2146435072|i>>>3)>>>0,!1),o.setUint32(4,(i&7)<<29,!1);else if(r===0&&i===0)o.setUint32(0,n<<31>>>0,!1),o.setUint32(4,0,!1);else{let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1);o.setFloat64(0,t,!1)}return a}function Tr(e,t,n){let r=e.length===2?1:e.length===4?2:3;if(r===1){let n=e[0]<<8|e[1];if(t===2)return new br(Sr(n));if(t===3)return new xr(Cr(n))}if(r===2){if(t===3)return new xr(wr(e));if(t===1){let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),r=m(t);return!Object.is(h(r),t)&&!isNaN(t)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new yr(r)}}if(r===3){let r=new DataView(e.buffer,e.byteOffset).getFloat64(0,!1);if(t===1){let e=m(r);return!Object.is(h(e),r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new yr(e)}if(t===2){let e=Math.fround(r);!Object.is(e,r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float32 (_2)`);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!1),new br(t)}}return X(e)}var Er={appStringPrefixes:[`float`],parseAppString(t,n,r,i){let a=_e(n);if(!/^[0-9a-fA-F]*$/.test(a))throw SyntaxError(`float'...' contains non-hex characters`);if(a.length%2!=0)throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);let o=e.E(a),s=i?.encodingWidth;if(s===void 0)return X(o);if(s!==1&&s!==2&&s!==3){let e=`float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;if(r)return r(e),X(o);throw SyntaxError(e)}return s===(o.length===2?1:o.length===4?2:3)?X(o):Tr(o,s,r??(e=>{throw SyntaxError(e)}))},parseAppSequence(e,t,n){if(t.length===0)throw SyntaxError(`float<<...>> requires exactly one byte-string item`);if(t.length>1){let e=`float<<...>> expects 1 item; got ${t.length} — using first`;if(n)n(e);else throw SyntaxError(e)}if(!(t[0]instanceof E))throw SyntaxError(`float<<...>> item must be a byte string`);return X(t[0].value)}},Dr=[An,Xn,$n],Or=[It,en,Dn,lr,ur,_r,vr,Er],kr;function Z(e){return e===void 0?kr??=[...Dr,...Or]:e===!1?Dr:[...Dr,...e]}var Ar;function jr(e){if(e===void 0){if(Ar)return Ar;let e=Z(void 0);return Ar={fromJS:e.filter(e=>e.fromJS!==void 0),parseTag:e.filter(e=>e.parseTag!==void 0)}}let t=Z(e);return{fromJS:t.filter(e=>e.fromJS!==void 0),parseTag:t.filter(e=>e.parseTag!==void 0)}}function Mr(e){let t=e?.extensions,n=jr(e?.builtinExtensions);return t?.length?{fromJS:[...t.filter(e=>e.fromJS!==void 0),...n.fromJS],parseTag:[...t.filter(e=>e.parseTag!==void 0),...n.parseTag]}:n}function Nr(e,t){if(t?.replacer){let{replacer:n,...r}=t,i=Fr(e,n,r.extensions,r.undefinedOmits,r.builtinExtensions);return i===u?j.UNDEFINED:Nr(i,Object.keys(r).length>0?r:void 0)}return Q(e,t,!0,Mr(t))}function Q(e,t,n,r){for(let n of r.fromJS){let r=n.fromJS(e,t??{});if(r!==void 0)return r}if(n&&typeof e==`object`&&e&&l.symbol in e){let n=e[l.symbol],i=Q(e,t,!1,r);for(let e of r.parseTag){let t=e.parseTag(n,i);if(t!==void 0)return t}return new T(n,i)}if(e instanceof l.Null)return j.NULL;if(e instanceof l.Undefined)return j.UNDEFINED;if(e instanceof d)return new j(e.value);if(e===null)return j.NULL;if(e===void 0)return j.UNDEFINED;if(e===!0)return j.TRUE;if(e===!1)return j.FALSE;if(typeof e==`bigint`)return e>18446744073709551615n?new ze(e):e<-18446744073709551616n?new Be(e):e>=0n?new S(e):new C(e);if(typeof e==`number`)return(t?.encodeIntegerAs??`int`)===`int`&&Number.isInteger(e)&&!Object.is(e,-0)?e>=0?new S(BigInt(e)):new C(BigInt(e)):new w(e);if(typeof e==`string`)return new z(e);if(e instanceof Number||e instanceof Boolean||e instanceof String||Object.prototype.toString.call(e)===`[object BigInt]`)return Q(e.valueOf(),t,!1,r);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new E(new Uint8Array(e));if(ArrayBuffer.isView(e))return e instanceof Uint8Array&&t?.uint8ArrayAs===`array`?new k(Array.from(e,e=>new S(BigInt(e)))):new E(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e instanceof $)return new A([...e].map(([e,n])=>[Q(e,t,!0,r),Q(n,t,!0,r)]));if(Array.isArray(e))return new k(e.map(e=>Q(e,t,!0,r)));if(typeof e==`object`){let n=[];for(let[i,a]of Object.entries(e))n.push([new z(i),Q(a,t,!0,r)]);return new A(n)}throw TypeError(`fromJS: unsupported value type: ${typeof e}`)}function Pr(e){return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||e instanceof Number||e instanceof Boolean||e instanceof String||Object.prototype.toString.call(e)===`[object BigInt]`||e instanceof l.Null||e instanceof l.Undefined||e instanceof d}function Fr(e,t,n,r,i){let a=[...n??[],...Z(i)].filter(e=>e.isJSType!==void 0);function o(e){return e===u||r===!0&&e===void 0}if(Array.isArray(t)){let n=t.map(String);function s(e){if(typeof e!=`object`||!e)return e;if(e instanceof $)return $.from(e,([e,t])=>[e,s(t)]);if(Array.isArray(e))return e.map(s);if(l.symbol in e||Pr(e)||a.some(t=>t.isJSType(e)))return e;let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){let t=e.toJSON;if(typeof t==`function`)return s(t.call(e))}let r={};for(let t of n)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=s(e[t]));return r}return s(e)}let c=t;function d(e,t,n){if(typeof e==`object`&&e&&!(e instanceof $)){let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let n=e.toJSON;typeof n==`function`&&(e=n.call(e,t))}}if(e=c.call(n,t,e),typeof e==`object`&&e){if(l.symbol in e)return e;if(e instanceof $){let t=new $;for(let[n,r]of e){let i=d(r,n,e);o(i)||t.push([n,i])}return t}if(Array.isArray(e))return e.map((t,n)=>{let r=d(t,String(n),e);return o(r)?null:r});if(Pr(e)||a.some(t=>t.isJSType(e)))return e;let t={};for(let n of Object.keys(e)){let r=d(e[n],n,e);o(r)||(t[n]=r)}return t}return e}return d(e,``,{"":e})}var $=class extends Array{toJSON(){let e={};for(let[t,n]of this){let r=typeof t==`string`?t:Nr(t).toCDN();r===`__proto__`?Object.defineProperty(e,r,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[r]=n}return e}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return en}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return It}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return vr}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return u}});
|
|
13
|
+
//# sourceMappingURL=mapEntries-BJzyBUH5.cjs.map
|