@0xpolygonid/js-sdk 1.17.5 → 1.17.7

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.
@@ -638,7 +638,7 @@ var PolygonIdSdk = (function (exports) {
638
638
  return result;
639
639
  }
640
640
 
641
- const i$1=32,n$1=1,o$1=new Uint8Array(65),h$2="empty",l$2=32,w$2=BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");w$2-BigInt("1");function g$2(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return "m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}function v$2(t,e,i,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return "a"===s?n.call(t,i):n?n.value=i:e.set(t,i),i}const p$2=t=>t<w$2,b$3=(t,e)=>t.every(((t,i)=>t===e[i])),m$2=t=>t.slice().reverse(),x$2=t=>"0b"+t.reduce(((t,e)=>t+e.toString(2).padStart(8,"0")),""),A$2=(t,e)=>0!=(t[parseInt((e/8).toString())]&1<<e%8),I$2=(t,e)=>0!=(t[t.length-parseInt(""+e/8)-1]&1<<e%8),k$1=(t,e)=>{t[t.length-parseInt(""+e/8)-1]|=1<<e%8;},S$2="0123456789abcdef",R$1=t=>{const e=new Array(2*t.length);let i=0;return t.forEach((t=>{e[i]=S$2[parseInt((t>>4).toString(10))],e[i+1]=S$2[parseInt((15&t).toString(10))],i+=2;})),e.join("")},B$2=t=>new Uint8Array(2*t.length).map(((e,i)=>t.charCodeAt(i))),N$1=(t,e)=>{const i=new Array(t);for(let s=0;s<t;s+=1)i[s]=A$2(e,s);return i},U$1=t=>{const e=new ArrayBuffer(i$1*t.length),s=new Uint8Array(e);return t.forEach(((t,e)=>{s.set(t.value,e*i$1);})),s},K$1=t=>{const e=BigInt(256),s=new Uint8Array(i$1);let n=0;for(;t>BigInt(0);)s[31-n]=Number(t%e),t/=e,n+=1;return s};let V$1 = class V{constructor(t){if(t?.length){if(t.length!==i$1)throw new Error(`Expected 32 bytes, found ${t.length} bytes`);this.bytes=t;}else this.bytes=new Uint8Array(i$1);}get value(){return this.bytes}set value(t){if(t.length!==i$1)throw `Expected 32 bytes, found ${t.length} bytes`;this.bytes=m$2(t);}string(){return this.bigInt().toString(10)}hex(){return R$1(this.bytes)}equals(t){return b$3(this.value,t.value)}bigInt(){const t=m$2(this.value);return BigInt(x$2(t))}static fromString(t){try{return V.fromBigInt(BigInt(t))}catch(e){const i=JSON.parse(t),s=Uint8Array.from(Object.values(i.bytes));return new V(s)}}static fromBigInt(t){if(!p$2(t))throw new Error("NewBigIntFromHashBytes: Value not inside the Finite Field");const e=K$1(t);return new V(m$2(e))}static fromHex(e){return e?new V(b$5.decodeString(e)):M$2}toJSON(){return this.string()}};const M$2=new V$1,_$1=t=>{const i=$$2.hash(t);return V$1.fromBigInt(i)},J$1=(t,i)=>{const s=$$2.hash([...i,t]);return V$1.fromBigInt(s)},P$1=(t,e)=>{for(let i=t.length;i<e;i+=1)t.push(M$2);return t};var T$2,H$1;let j$1 = class j{constructor(t){T$2.set(this,void 0),H$1.set(this,void 0),this.prefix=t,v$2(this,T$2,{},"f"),v$2(this,H$1,M$2,"f");}async get(t){const e=new Uint8Array([...this.prefix,...t]);return g$2(this,T$2,"f")[e.toString()]?g$2(this,T$2,"f")[e.toString()]:void 0}async put(t,e){const i=new Uint8Array([...this.prefix,...t]);g$2(this,T$2,"f")[i.toString()]=e;}async getRoot(){return g$2(this,H$1,"f")}async setRoot(t){v$2(this,H$1,t,"f");}};T$2=new WeakMap,H$1=new WeakMap;const z$2=async(t,e)=>J$1(BigInt(1),[t.bigInt(),e.bigInt()]),C$2=(t,e,i)=>{const s=new Uint8Array(65),n=K$1(e.bigInt()),r=K$1(i.bigInt());s[0]=t;for(let t=1;t<33;t+=1)s[t]=n[t-1];for(let t=33;t<=65;t+=1)s[t]=r[t-33];return s};var q$1,F$1,D$1,G$1;let Q$1 = class Q{constructor(t,e){q$1.set(this,void 0),this.type=1,this.entry=[t,e],v$2(this,q$1,M$2,"f");}async getKey(){return g$2(this,q$1,"f")===M$2?await z$2(this.entry[0],this.entry[1]):g$2(this,q$1,"f")}get value(){return C$2(this.type,this.entry[0],this.entry[1])}get string(){return `Leaf I:${this.entry[0]} D:${this.entry[1]}`}};q$1=new WeakMap;let X$1 = class X{constructor(t,e){F$1.set(this,void 0),this.type=0,this.childL=t,this.childR=e,v$2(this,F$1,M$2,"f");}async getKey(){return g$2(this,F$1,"f")===M$2?_$1([this.childL.bigInt(),this.childR.bigInt()]):g$2(this,F$1,"f")}get value(){return C$2(this.type,this.childL,this.childR)}get string(){return `Middle L:${this.childL} R:${this.childR}`}};F$1=new WeakMap;let Y$1 = class Y{constructor(){D$1.set(this,void 0),this.type=2,v$2(this,D$1,M$2,"f");}async getKey(){return M$2}get value(){return o$1}get string(){return h$2}};D$1=new WeakMap;let Z$1 = class Z{constructor(t){this._prefix=t,G$1.set(this,void 0);const e=localStorage.getItem(R$1(t));if(e){const t=JSON.parse(e);v$2(this,G$1,new V$1(Uint8Array.from(t)),"f");}else v$2(this,G$1,M$2,"f");}async get(t){const e=new Uint8Array([...this._prefix,...t]),i=R$1(e),s=localStorage.getItem(i);if(null===s)return;const n=JSON.parse(s);switch(n.type){case 2:return new Y$1;case 0:const t=new V$1(Uint8Array.from(n.childL)),e=new V$1(Uint8Array.from(n.childR));return new X$1(t,e);case 1:const i=new V$1(Uint8Array.from(n.entry[0])),s=new V$1(Uint8Array.from(n.entry[1]));return new Q$1(i,s)}throw `error: value found for key ${R$1(e)} is not of type Node`}async put(t,e){const i=new Uint8Array([...this._prefix,...t]),s=R$1(i),n={type:e.type};e instanceof X$1?(n.childL=Array.from(e.childL.bytes),n.childR=Array.from(e.childR.bytes)):e instanceof Q$1&&(n.entry=[Array.from(e.entry[0].bytes),Array.from(e.entry[1].bytes)]);const r=JSON.stringify(n);localStorage.setItem(s,r);}async getRoot(){return g$2(this,G$1,"f")}async setRoot(t){v$2(this,G$1,t,"f"),localStorage.setItem(R$1(this._prefix),JSON.stringify(Array.from(t.bytes)));}};function tt$1(t){return new Promise(((e,i)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>i(t.error);}))}function et$1(t,e){const i=indexedDB.open(t);i.onupgradeneeded=()=>i.result.createObjectStore(e);const s=tt$1(i);return (t,i)=>s.then((s=>i(s.transaction(e,t).objectStore(e))))}let it$1;function st$1(){return it$1||(it$1=et$1("keyval-store","keyval")),it$1}function nt$1(t,e=st$1()){return e("readonly",(e=>tt$1(e.get(t))))}function rt$1(t,e,i=st$1()){return i("readwrite",(i=>(i.put(e,t),tt$1(i.transaction))))}var at$1;G$1=new WeakMap;let lt$2 = class lt{constructor(t,e){this._prefix=t,at$1.set(this,void 0),v$2(this,at$1,M$2,"f"),this._prefixHash=R$1(t),this._store=et$1(`${e??lt.storageName}-db`,lt.storageName);}async get(t){const e=new Uint8Array([...this._prefix,...t]),i=R$1(e),s=await nt$1(i,this._store);if(null!=s){if(2===s.type)return new Y$1;if(0===s.type){const t=new V$1(Uint8Array.from(s.childL.bytes)),e=new V$1(Uint8Array.from(s.childR.bytes));return new X$1(t,e)}if(1===s.type){const t=new V$1(Uint8Array.from(s.entry[0].bytes)),e=new V$1(Uint8Array.from(s.entry[1].bytes));return new Q$1(t,e)}throw new Error(`error: value found for key ${i} is not of type Node`)}}async put(t,e){const i=new Uint8Array([...this._prefix,...t]),s=R$1(i);await rt$1(s,e,this._store);}async getRoot(){if(!g$2(this,at$1,"f").equals(M$2))return g$2(this,at$1,"f");const t=await nt$1(this._prefixHash,this._store);return v$2(this,at$1,t?new V$1(t.bytes):M$2,"f"),g$2(this,at$1,"f")}async setRoot(t){await rt$1(this._prefixHash,t,this._store),v$2(this,at$1,t,"f");}};at$1=new WeakMap,lt$2.storageName="merkle-tree";const vt$1=t=>t.map((t=>t.bigInt())),pt$1=t=>{const e=vt$1(t.data.value);let i=!0;return e.forEach((t=>{p$2(t)||(i=!1);})),i},mt$1="Key not found in the MerkleTree",At$1="reached maximum level of the merkle tree",It$1="found an invalid node in the DB",Rt$1="the entry index already exists in the tree",Lt$1="Merkle Tree not writable",Bt$1="key not found";let Nt$1 = class Nt{constructor(t=M$2,e=[],i=M$2,s=M$2,n=!1,r=M$2,a=M$2,o=0){this.root=t,this.siblings=e,this.oldKey=i,this.oldValue=s,this.isOld0=n,this.key=r,this.value=a,this.fnc=o;}};let Ut$1 = class Ut{constructor(t=M$2,e=M$2,i=[],s=M$2,n=M$2,r=M$2,a=M$2,o=!1,h=0){this.oldRoot=t,this.newRoot=e,this.siblings=i,this.oldKey=s,this.oldValue=n,this.newKey=r,this.newValue=a,this.isOld0=o,this.fnc=h;}};const Et$1="non-existence proof being checked against hIndex equal to nodeAux";let Kt$1 = class Kt{constructor(t){this.existence=t?.existence??!1,this.depth=t?.siblings.length??0,this.nodeAux=t?.nodeAux;const{siblings:e,notEmpties:i}=this.reduceSiblings(t?.siblings);this.siblings=e,this.notEmpties=i;}bytes(){let t=2+this.notEmpties.length+l$2*this.siblings.length;void 0!==this.nodeAux&&(t+=64);const e=new ArrayBuffer(t),i=new Uint8Array(e);this.existence||(i[0]|=1),i[1]=this.depth,i.set(this.notEmpties,2);const s=U$1(this.siblings);return i.set(s,this.notEmpties.length+2),void 0!==this.nodeAux&&(i[0]|=2,i.set(this.nodeAux.key.value,i.length-64),i.set(this.nodeAux.value.value,i.length-32)),i}toJSON(){return {existence:this.existence,siblings:this.allSiblings().map((t=>t.toJSON())),nodeAux:this.nodeAux?{key:this.nodeAux.key.toJSON(),value:this.nodeAux.value.toJSON()}:void 0}}reduceSiblings(t){const e=[],i=new Uint8Array(30);if(!t)return {siblings:e,notEmpties:i};for(let s=0;s<t.length;s++){const n=t[s];JSON.stringify(t[s])!==JSON.stringify(M$2)&&(k$1(i,s),e.push(n));}return {notEmpties:i,siblings:e}}static fromJSON(t){let e;t.nodeAux&&(e={key:V$1.fromString(t.nodeAux.key),value:V$1.fromString(t.nodeAux.value)});const i=t.existence??!1,s=t.siblings.map((t=>V$1.fromString(t)));return new Kt({existence:i,nodeAux:e,siblings:s})}allSiblings(){return Kt.buildAllSiblings(this.depth,this.notEmpties,this.siblings)}static buildAllSiblings(t,e,i){let s=0;const n=[];for(let r=0;r<t;r+=1)I$2(e,r)?(n.push(i[s]),s+=1):n.push(M$2);return n}};const Mt$1=async(t,e,i,s)=>{try{const n=await Wt$1(e,i,s);return b$3(t.value,n.value)}catch(t){if(t===Et$1)return !1;throw t}},Wt$1=async(t,e,i)=>{const s=V$1.fromBigInt(e),n=V$1.fromBigInt(i);let r;if(t.existence)r=await z$2(s,n);else if(void 0===t.nodeAux)r=M$2;else {const e=t.nodeAux;if(b$3(s.value,e.key.value))throw Et$1;r=await z$2(e.key,e.value);}const a=t.allSiblings(),o=N$1(a.length,s.value);for(let t=a.length-1;t>=0;t-=1)r=o[t]?await new X$1(a[t],r).getKey():await new X$1(r,a[t]).getKey();return r};var $t$1,Ot$1,_t$1,Jt$1;let Pt$1 = class Pt{constructor(t,e,i){$t$1.set(this,void 0),Ot$1.set(this,void 0),_t$1.set(this,void 0),Jt$1.set(this,void 0),v$2(this,$t$1,t,"f"),v$2(this,_t$1,e,"f"),v$2(this,Jt$1,i,"f");}async root(){return g$2(this,Ot$1,"f")||v$2(this,Ot$1,await g$2(this,$t$1,"f").getRoot(),"f"),g$2(this,Ot$1,"f")}get maxLevels(){return g$2(this,Jt$1,"f")}async add(t,e){if(!g$2(this,_t$1,"f"))throw Lt$1;v$2(this,Ot$1,await this.root(),"f");const i=V$1.fromBigInt(t),s=V$1.fromBigInt(e),n=new Q$1(i,s),r=N$1(this.maxLevels,i.value),a=await this.addLeaf(n,g$2(this,Ot$1,"f"),0,r);v$2(this,Ot$1,a,"f"),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));}async updateNode(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(2===t.type)return await t.getKey();const e=await t.getKey();return await g$2(this,$t$1,"f").put(e.value,t),e}async addNode(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(2===t.type)return await t.getKey();const e=await t.getKey();return await g$2(this,$t$1,"f").put(e.value,t),e}async addEntry(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(!pt$1(t))throw "elements not inside the finite field over r";v$2(this,Ot$1,await g$2(this,$t$1,"f").getRoot(),"f");const e=await t.hIndex(),i=await t.hValue(),s=new Q$1(e,i),n=N$1(this.maxLevels,e.value),r=await this.addLeaf(s,g$2(this,Ot$1,"f"),0,n);v$2(this,Ot$1,r,"f"),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));}async pushLeaf(t,e,i,s,n){if(i>g$2(this,Jt$1,"f")-2)throw new Error(At$1);let r;if(s[i]===n[i]){const a=await this.pushLeaf(t,e,i+1,s,n);return r=s[i]?new X$1(new V$1,a):new X$1(a,new V$1),await this.addNode(r)}const a=await e.getKey(),o=await t.getKey();return r=s[i]?new X$1(a,o):new X$1(o,a),await this.addNode(t),await this.addNode(r)}async addLeaf(t,e,i,s){if(i>g$2(this,Jt$1,"f")-1)throw new Error(At$1);const n=await this.getNode(e);if(void 0===n)throw Bt$1;switch(n.type){case 2:return this.addNode(t);case 1:{const e=n.entry[0],r=t.entry[0];if(b$3(e.value,r.value))throw Rt$1;const a=N$1(this.maxLevels,e.value);return this.pushLeaf(t,n,i,s,a)}case 0:{let e;if(s[i]){const r=await this.addLeaf(t,n.childR,i+1,s);e=new X$1(n.childL,r);}else {const r=await this.addLeaf(t,n.childL,i+1,s);e=new X$1(r,n.childR);}return this.addNode(e)}default:throw It$1}}async get(t){const e=V$1.fromBigInt(t),i=N$1(this.maxLevels,e.value);let s=await this.root();const n=[];for(let t=0;t<this.maxLevels;t++){const e=await this.getNode(s);if(void 0===e)throw mt$1;switch(e.type){case 2:return {key:BigInt("0"),value:BigInt("0"),siblings:n};case 1:return {key:e.entry[0].bigInt(),value:e.entry[1].bigInt(),siblings:n};case 0:i[t]?(s=e.childR,n.push(e.childL)):(s=e.childL,n.push(e.childR));break;default:throw It$1}}throw new Error(At$1)}async update(t,e){if(!g$2(this,_t$1,"f"))throw Lt$1;if(!p$2(t))throw "key not inside the finite field";if(!p$2(e))throw "key not inside the finite field";const i=V$1.fromBigInt(t),s=V$1.fromBigInt(e),n=N$1(this.maxLevels,i.value),r=new Ut$1;r.fnc=1,r.oldRoot=await this.root(),r.oldKey=i,r.newKey=i,r.newValue=s;let a=await this.root();const o=[];for(let t=0;t<this.maxLevels;t+=1){const e=await this.getNode(a);if(void 0===e)throw Bt$1;switch(e.type){case 2:throw mt$1;case 1:if(b$3(i.value,e.entry[0].value)){r.oldValue=e.entry[1],r.siblings=P$1([...o],this.maxLevels);const t=new Q$1(i,s);await this.updateNode(t);const a=await this.recalculatePathUntilRoot(n,t,o);return v$2(this,Ot$1,a,"f"),await g$2(this,$t$1,"f").setRoot(a),r.newRoot=a,r}break;case 0:n[t]?(a=e.childR,o.push(e.childL)):(a=e.childL,o.push(e.childR));break;default:throw It$1}}throw mt$1}async getNode(t){return b$3(t.value,M$2.value)?new Y$1:await g$2(this,$t$1,"f").get(t.value)}async recalculatePathUntilRoot(t,e,i){for(let s=i.length-1;s>=0;s-=1){const n=await e.getKey();e=t[s]?new X$1(i[s],n):new X$1(n,i[s]),await this.addNode(e);}return await e.getKey()}async delete(t){if(!g$2(this,_t$1,"f"))throw Lt$1;const e=V$1.fromBigInt(t),i=N$1(this.maxLevels,e.value);let s=g$2(this,Ot$1,"f");const n=[];for(let t=0;t<g$2(this,Jt$1,"f");t+=1){const r=await this.getNode(s);if(void 0===r)throw Bt$1;switch(r.type){case 2:throw mt$1;case 1:if(b$3(e.bytes,r.entry[0].value))return void await this.rmAndUpload(i,e,n);throw mt$1;case 0:i[t]?(s=r.childR,n.push(r.childL)):(s=r.childL,n.push(r.childR));break;default:throw It$1}}throw mt$1}async rmAndUpload(t,e,i){if(0===i.length)return v$2(this,Ot$1,M$2,"f"),void await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));const s=i[i.length-1];i.length<2&&(v$2(this,Ot$1,i[0],"f"),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f")));for(let e=i.length-2;e>=0;e-=1){if(!b$3(i[e].value,M$2.value)){let n;n=t[e]?new X$1(i[e],s):new X$1(s,i[e]),await this.addNode(n);const r=await this.recalculatePathUntilRoot(t,n,i.slice(0,e));v$2(this,Ot$1,r,"f"),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));break}if(0===e){v$2(this,Ot$1,s,"f"),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));break}}}async recWalk(t,e){const i=await this.getNode(t);if(void 0===i)throw Bt$1;switch(i.type){case 2:case 1:await e(i);break;case 0:await e(i),await this.recWalk(i.childL,e),await this.recWalk(i.childR,e);break;default:throw It$1}}async walk(t,e){b$3(t.value,M$2.value)&&(t=await this.root()),await this.recWalk(t,e);}async generateCircomVerifierProof(t,e){const i=await this.generateSCVerifierProof(t,e);return i.siblings=P$1(i.siblings,this.maxLevels),i}async generateSCVerifierProof(t,e){b$3(e.value,M$2.value)&&(e=await this.root());const{proof:i,value:s}=await this.generateProof(t,e),n=new Nt$1;return n.root=e,n.siblings=i.allSiblings(),void 0!==i.nodeAux?(n.oldKey=i.nodeAux.key,n.oldValue=i.nodeAux.value):(n.oldKey=M$2,n.oldValue=M$2),n.key=V$1.fromBigInt(t),n.value=V$1.fromBigInt(s),i.existence?n.fnc=0:n.fnc=1,n}async generateProof(t,e){let i;const s=V$1.fromBigInt(t),n=N$1(this.maxLevels,s.value);e||(e=await this.root());let r=e,a=0,o=!1;const h=[];let l;for(a=0;a<this.maxLevels;a+=1){const t=await this.getNode(r);if(void 0===t)throw Bt$1;switch(t.type){case 2:return {proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:BigInt("0")};case 1:return b$3(s.value,t.entry[0].value)?(o=!0,{proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:t.entry[1].bigInt()}):(l={key:t.entry[0],value:t.entry[1]},{proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:t.entry[1].bigInt()});case 0:n[a]?(r=t.childR,i=t.childL):(r=t.childL,i=t.childR);break;default:throw It$1}h.push(i);}throw mt$1}async addAndGetCircomProof(t,e){const i=new Ut$1;i.fnc=2,i.oldRoot=await this.root();let s=BigInt("0"),n=BigInt("0"),r=[];try{const e=await this.get(t);s=e.key,n=e.value,r=e.siblings;}catch(t){if(t!==mt$1)throw t}if(void 0===s||void 0===n)throw "key/value undefined";return i.oldKey=V$1.fromBigInt(s),i.oldValue=V$1.fromBigInt(n),b$3(i.oldKey.value,M$2.value)&&(i.isOld0=!0),i.siblings=P$1(r,this.maxLevels),await this.add(t,e),i.newKey=V$1.fromBigInt(t),i.newValue=V$1.fromBigInt(e),i.newRoot=await this.root(),i}async graphViz(t){let e=0;await this.walk(t,(async t=>{const i=await t.getKey();let s,n;switch(t.type){case 2:break;case 1:console.log(`"${i.string()}" [style=filled]`);break;case 0:s=[t.childL.string(),t.childR.string()],n="",s.forEach(((t,i)=>{"0"===t&&(s[i]=`empty${e}`,n+=`"${s[i]}" [style=dashed,label=0];\n`,e+=1);})),console.log(`"${i.string()}" -> {"${s[1]}"}`),console.log(n);}})),console.log("}\n");}async printGraphViz(t){b$3(t.value,M$2.value)&&(t=await this.root()),console.log(`--------\nGraphViz of the MerkleTree with RootKey ${t.bigInt().toString(10)}\n`),await this.graphViz(M$2),console.log(`End of GraphViz of the MerkleTree with RootKey ${t.bigInt().toString(10)}\n--------\n`);}};$t$1=new WeakMap,Ot$1=new WeakMap,_t$1=new WeakMap,Jt$1=new WeakMap;
641
+ const i$1=32,n$1=1,o$1=new Uint8Array(65),h$2="empty",l$2=32,w$2=BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");w$2-BigInt("1");function g$2(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return "m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}function v$2(t,e,i,s,n){if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}const p$2=t=>t<w$2,b$3=(t,e)=>t.every(((t,i)=>t===e[i])),m$2=t=>t.slice().reverse(),x$2=t=>"0b"+t.reduce(((t,e)=>t+e.toString(2).padStart(8,"0")),""),I$2=(t,e)=>0!=(t[parseInt((e/8).toString())]&1<<e%8),k$1=(t,e)=>0!=(t[t.length-parseInt(""+e/8)-1]&1<<e%8),A$2=(t,e)=>{t[t.length-parseInt(""+e/8)-1]|=1<<e%8;},R$1="0123456789abcdef",S$2=t=>{const e=new Array(2*t.length);let i=0;return t.forEach((t=>{e[i]=R$1[parseInt((t>>4).toString(10))],e[i+1]=R$1[parseInt((15&t).toString(10))],i+=2;})),e.join("")},B$2=t=>new Uint8Array(2*t.length).map(((e,i)=>t.charCodeAt(i))),N$1=(t,e)=>{const i=new Array(t);for(let s=0;s<t;s+=1)i[s]=I$2(e,s);return i},U$1=t=>{const e=new ArrayBuffer(i$1*t.length),s=new Uint8Array(e);return t.forEach(((t,e)=>{s.set(t.value,e*i$1);})),s},K$1=t=>{const e=BigInt(256),s=new Uint8Array(i$1);let n=0;for(;t>BigInt(0);)s[31-n]=Number(t%e),t/=e,n+=1;return s};let V$1 = class V{constructor(t){if(t?.length){if(t.length!==i$1)throw new Error(`Expected 32 bytes, found ${t.length} bytes`);this.bytes=t;}else this.bytes=new Uint8Array(i$1);}get value(){return this.bytes}set value(t){if(t.length!==i$1)throw `Expected 32 bytes, found ${t.length} bytes`;this.bytes=m$2(t);}string(){return this.bigInt().toString(10)}hex(){return S$2(this.bytes)}equals(t){return b$3(this.value,t.value)}bigInt(){const t=m$2(this.value);return BigInt(x$2(t))}static fromString(t){try{return V.fromBigInt(BigInt(t))}catch(e){const i=JSON.parse(t),s=Uint8Array.from(Object.values(i.bytes));return new V(s)}}static fromBigInt(t){if(!p$2(t))throw new Error("NewBigIntFromHashBytes: Value not inside the Finite Field");const e=K$1(t);return new V(m$2(e))}static fromHex(e){return e?new V(b$5.decodeString(e)):M$2}toJSON(){return this.string()}};const M$2=new V$1,_$1=t=>{const i=$$2.hash(t);return V$1.fromBigInt(i)},P$1=(t,i)=>{const s=$$2.hash([...i,t]);return V$1.fromBigInt(s)},J$1=(t,e)=>{for(let i=t.length;i<e;i+=1)t.push(M$2);return t};var T$2,H$1;let j$1 = class j{constructor(t){T$2.set(this,void 0),H$1.set(this,void 0),this.prefix=t,v$2(this,T$2,{}),v$2(this,H$1,M$2);}async get(t){const e=new Uint8Array([...this.prefix,...t]);return g$2(this,T$2,"f")[e.toString()]?g$2(this,T$2,"f")[e.toString()]:void 0}async put(t,e){const i=new Uint8Array([...this.prefix,...t]);g$2(this,T$2,"f")[i.toString()]=e;}async getRoot(){return g$2(this,H$1,"f")}async setRoot(t){v$2(this,H$1,t);}};T$2=new WeakMap,H$1=new WeakMap;const z$2=async(t,e)=>P$1(BigInt(1),[t.bigInt(),e.bigInt()]),C$2=(t,e,i)=>{const s=new Uint8Array(65),n=K$1(e.bigInt()),r=K$1(i.bigInt());s[0]=t;for(let t=1;t<33;t+=1)s[t]=n[t-1];for(let t=33;t<=65;t+=1)s[t]=r[t-33];return s};var q$1,F$1,D$1,G$1;let Q$1 = class Q{constructor(t,e){q$1.set(this,void 0),this.type=1,this.entry=[t,e],v$2(this,q$1,M$2);}async getKey(){return g$2(this,q$1,"f")===M$2?await z$2(this.entry[0],this.entry[1]):g$2(this,q$1,"f")}get value(){return C$2(this.type,this.entry[0],this.entry[1])}get string(){return `Leaf I:${this.entry[0]} D:${this.entry[1]}`}};q$1=new WeakMap;let X$1 = class X{constructor(t,e){F$1.set(this,void 0),this.type=0,this.childL=t,this.childR=e,v$2(this,F$1,M$2);}async getKey(){return g$2(this,F$1,"f")===M$2?_$1([this.childL.bigInt(),this.childR.bigInt()]):g$2(this,F$1,"f")}get value(){return C$2(this.type,this.childL,this.childR)}get string(){return `Middle L:${this.childL} R:${this.childR}`}};F$1=new WeakMap;let Y$1 = class Y{constructor(){D$1.set(this,void 0),this.type=2,v$2(this,D$1,M$2);}async getKey(){return M$2}get value(){return o$1}get string(){return h$2}};D$1=new WeakMap;let Z$1 = class Z{constructor(t){this._prefix=t,G$1.set(this,void 0);const e=localStorage.getItem(S$2(t));if(e){const t=JSON.parse(e);v$2(this,G$1,new V$1(Uint8Array.from(t)));}else v$2(this,G$1,M$2);}async get(t){const e=new Uint8Array([...this._prefix,...t]),i=S$2(e),s=localStorage.getItem(i);if(null===s)return;const n=JSON.parse(s);switch(n.type){case 2:return new Y$1;case 0:const t=new V$1(Uint8Array.from(n.childL)),e=new V$1(Uint8Array.from(n.childR));return new X$1(t,e);case 1:const i=new V$1(Uint8Array.from(n.entry[0])),s=new V$1(Uint8Array.from(n.entry[1]));return new Q$1(i,s)}throw `error: value found for key ${S$2(e)} is not of type Node`}async put(t,e){const i=new Uint8Array([...this._prefix,...t]),s=S$2(i),n={type:e.type};e instanceof X$1?(n.childL=Array.from(e.childL.bytes),n.childR=Array.from(e.childR.bytes)):e instanceof Q$1&&(n.entry=[Array.from(e.entry[0].bytes),Array.from(e.entry[1].bytes)]);const r=JSON.stringify(n);localStorage.setItem(s,r);}async getRoot(){return g$2(this,G$1,"f")}async setRoot(t){v$2(this,G$1,t),localStorage.setItem(S$2(this._prefix),JSON.stringify(Array.from(t.bytes)));}};function tt$1(t){return new Promise(((e,i)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>i(t.error);}))}function et$1(t,e){const i=indexedDB.open(t);i.onupgradeneeded=()=>i.result.createObjectStore(e);const s=tt$1(i);return (t,i)=>s.then((s=>i(s.transaction(e,t).objectStore(e))))}let it$1;function st$1(){return it$1||(it$1=et$1("keyval-store","keyval")),it$1}function nt$1(t,e=st$1()){return e("readonly",(e=>tt$1(e.get(t))))}function rt$1(t,e,i=st$1()){return i("readwrite",(i=>(i.put(e,t),tt$1(i.transaction))))}var at$1;G$1=new WeakMap;let lt$2 = class lt{constructor(t,e){this._prefix=t,at$1.set(this,void 0),v$2(this,at$1,M$2),this._prefixHash=S$2(t),this._store=et$1(`${e??lt.storageName}-db`,lt.storageName);}async get(t){const e=new Uint8Array([...this._prefix,...t]),i=S$2(e),s=await nt$1(i,this._store);if(null!=s){if(2===s.type)return new Y$1;if(0===s.type){const t=new V$1(Uint8Array.from(s.childL.bytes)),e=new V$1(Uint8Array.from(s.childR.bytes));return new X$1(t,e)}if(1===s.type){const t=new V$1(Uint8Array.from(s.entry[0].bytes)),e=new V$1(Uint8Array.from(s.entry[1].bytes));return new Q$1(t,e)}throw new Error(`error: value found for key ${i} is not of type Node`)}}async put(t,e){const i=new Uint8Array([...this._prefix,...t]),s=S$2(i);await rt$1(s,e,this._store);}async getRoot(){if(!g$2(this,at$1,"f").equals(M$2))return g$2(this,at$1,"f");const t=await nt$1(this._prefixHash,this._store);return v$2(this,at$1,t?new V$1(t.bytes):M$2),g$2(this,at$1,"f")}async setRoot(t){await rt$1(this._prefixHash,t,this._store),v$2(this,at$1,t);}};at$1=new WeakMap,lt$2.storageName="merkle-tree";const vt$1=t=>t.map((t=>t.bigInt())),pt$1=t=>{const e=vt$1(t.data.value);let i=!0;return e.forEach((t=>{p$2(t)||(i=!1);})),i},mt$1="Key not found in the MerkleTree",It$1="reached maximum level of the merkle tree",kt$1="found an invalid node in the DB",St$1="the entry index already exists in the tree",Lt$1="Merkle Tree not writable",Bt$1="key not found";let Nt$1 = class Nt{constructor(t=M$2,e=[],i=M$2,s=M$2,n=!1,r=M$2,a=M$2,o=0){this.root=t,this.siblings=e,this.oldKey=i,this.oldValue=s,this.isOld0=n,this.key=r,this.value=a,this.fnc=o;}};let Ut$1 = class Ut{constructor(t=M$2,e=M$2,i=[],s=M$2,n=M$2,r=M$2,a=M$2,o=!1,h=0){this.oldRoot=t,this.newRoot=e,this.siblings=i,this.oldKey=s,this.oldValue=n,this.newKey=r,this.newValue=a,this.isOld0=o,this.fnc=h;}};const Et$1="non-existence proof being checked against hIndex equal to nodeAux";let Kt$1 = class Kt{constructor(t){this.existence=t?.existence??!1,this.depth=0,this.nodeAux=t?.nodeAux;const{siblings:e,notEmpties:i}=this.reduceSiblings(t?.siblings);this.siblings=e,this.notEmpties=i;}bytes(){let t=2+this.notEmpties.length+l$2*this.siblings.length;void 0!==this.nodeAux&&(t+=64);const e=new ArrayBuffer(t),i=new Uint8Array(e);this.existence||(i[0]|=1),i[1]=this.depth,i.set(this.notEmpties,2);const s=U$1(this.siblings);return i.set(s,this.notEmpties.length+2),void 0!==this.nodeAux&&(i[0]|=2,i.set(this.nodeAux.key.value,i.length-64),i.set(this.nodeAux.value.value,i.length-32)),i}toJSON(){return {existence:this.existence,siblings:this.allSiblings().map((t=>t.toJSON())),node_aux:this.nodeAux?{key:this.nodeAux.key.toJSON(),value:this.nodeAux.value.toJSON()}:void 0}}reduceSiblings(t){const e=[],i=new Uint8Array(30);if(!t)return {siblings:e,notEmpties:i};for(let s=0;s<t.length;s++){const n=t[s];JSON.stringify(t[s])!==JSON.stringify(M$2)&&(A$2(i,s),e.push(n),this.depth=s+1);}return {notEmpties:i,siblings:e}}static fromJSON(t){let e;const i=t.node_aux??t.nodeAux;i&&(e={key:V$1.fromString(i.key),value:V$1.fromString(i.value)});const s=t.existence??!1,n=t.siblings.map((t=>V$1.fromString(t)));return new Kt({existence:s,nodeAux:e,siblings:n})}allSiblings(){return Kt.buildAllSiblings(this.depth,this.notEmpties,this.siblings)}static buildAllSiblings(t,e,i){let s=0;const n=[];for(let r=0;r<t;r+=1)k$1(e,r)?(n.push(i[s]),s+=1):n.push(M$2);return n}};const Mt$1=async(t,e,i,s)=>{try{const n=await Wt$1(e,i,s);return b$3(t.value,n.value)}catch(t){if(t===Et$1)return !1;throw t}},Wt$1=async(t,e,i)=>{const s=V$1.fromBigInt(e),n=V$1.fromBigInt(i);let r;if(t.existence)r=await z$2(s,n);else if(void 0===t.nodeAux)r=M$2;else {const e=t.nodeAux;if(b$3(s.value,e.key.value))throw Et$1;r=await z$2(e.key,e.value);}const a=t.allSiblings(),o=N$1(a.length,s.value);for(let t=a.length-1;t>=0;t-=1)r=o[t]?await new X$1(a[t],r).getKey():await new X$1(r,a[t]).getKey();return r};var $t$1,Ot$1,_t$1,Pt$1;let Jt$1 = class Jt{constructor(t,e,i){$t$1.set(this,void 0),Ot$1.set(this,void 0),_t$1.set(this,void 0),Pt$1.set(this,void 0),v$2(this,$t$1,t),v$2(this,_t$1,e),v$2(this,Pt$1,i);}async root(){return g$2(this,Ot$1,"f")||v$2(this,Ot$1,await g$2(this,$t$1,"f").getRoot()),g$2(this,Ot$1,"f")}get maxLevels(){return g$2(this,Pt$1,"f")}async add(t,e){if(!g$2(this,_t$1,"f"))throw Lt$1;v$2(this,Ot$1,await this.root());const i=V$1.fromBigInt(t),s=V$1.fromBigInt(e),n=new Q$1(i,s),r=N$1(this.maxLevels,i.value),a=await this.addLeaf(n,g$2(this,Ot$1,"f"),0,r);v$2(this,Ot$1,a),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));}async updateNode(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(2===t.type)return await t.getKey();const e=await t.getKey();return await g$2(this,$t$1,"f").put(e.value,t),e}async addNode(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(2===t.type)return await t.getKey();const e=await t.getKey();return await g$2(this,$t$1,"f").put(e.value,t),e}async addEntry(t){if(!g$2(this,_t$1,"f"))throw Lt$1;if(!pt$1(t))throw "elements not inside the finite field over r";v$2(this,Ot$1,await g$2(this,$t$1,"f").getRoot());const e=await t.hIndex(),i=await t.hValue(),s=new Q$1(e,i),n=N$1(this.maxLevels,e.value),r=await this.addLeaf(s,g$2(this,Ot$1,"f"),0,n);v$2(this,Ot$1,r),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));}async pushLeaf(t,e,i,s,n){if(i>g$2(this,Pt$1,"f")-2)throw new Error(It$1);let r;if(s[i]===n[i]){const a=await this.pushLeaf(t,e,i+1,s,n);return r=s[i]?new X$1(new V$1,a):new X$1(a,new V$1),await this.addNode(r)}const a=await e.getKey(),o=await t.getKey();return r=s[i]?new X$1(a,o):new X$1(o,a),await this.addNode(t),await this.addNode(r)}async addLeaf(t,e,i,s){if(i>g$2(this,Pt$1,"f")-1)throw new Error(It$1);const n=await this.getNode(e);if(void 0===n)throw Bt$1;switch(n.type){case 2:return this.addNode(t);case 1:{const e=n.entry[0],r=t.entry[0];if(b$3(e.value,r.value))throw St$1;const a=N$1(this.maxLevels,e.value);return this.pushLeaf(t,n,i,s,a)}case 0:{let e;if(s[i]){const r=await this.addLeaf(t,n.childR,i+1,s);e=new X$1(n.childL,r);}else {const r=await this.addLeaf(t,n.childL,i+1,s);e=new X$1(r,n.childR);}return this.addNode(e)}default:throw kt$1}}async get(t){const e=V$1.fromBigInt(t),i=N$1(this.maxLevels,e.value);let s=await this.root();const n=[];for(let t=0;t<this.maxLevels;t++){const e=await this.getNode(s);if(void 0===e)throw mt$1;switch(e.type){case 2:return {key:BigInt("0"),value:BigInt("0"),siblings:n};case 1:return {key:e.entry[0].bigInt(),value:e.entry[1].bigInt(),siblings:n};case 0:i[t]?(s=e.childR,n.push(e.childL)):(s=e.childL,n.push(e.childR));break;default:throw kt$1}}throw new Error(It$1)}async update(t,e){if(!g$2(this,_t$1,"f"))throw Lt$1;if(!p$2(t))throw "key not inside the finite field";if(!p$2(e))throw "key not inside the finite field";const i=V$1.fromBigInt(t),s=V$1.fromBigInt(e),n=N$1(this.maxLevels,i.value),r=new Ut$1;r.fnc=1,r.oldRoot=await this.root(),r.oldKey=i,r.newKey=i,r.newValue=s;let a=await this.root();const o=[];for(let t=0;t<this.maxLevels;t+=1){const e=await this.getNode(a);if(void 0===e)throw Bt$1;switch(e.type){case 2:throw mt$1;case 1:if(b$3(i.value,e.entry[0].value)){r.oldValue=e.entry[1],r.siblings=J$1([...o],this.maxLevels);const t=new Q$1(i,s);await this.updateNode(t);const a=await this.recalculatePathUntilRoot(n,t,o);return v$2(this,Ot$1,a),await g$2(this,$t$1,"f").setRoot(a),r.newRoot=a,r}break;case 0:n[t]?(a=e.childR,o.push(e.childL)):(a=e.childL,o.push(e.childR));break;default:throw kt$1}}throw mt$1}async getNode(t){return b$3(t.value,M$2.value)?new Y$1:await g$2(this,$t$1,"f").get(t.value)}async recalculatePathUntilRoot(t,e,i){for(let s=i.length-1;s>=0;s-=1){const n=await e.getKey();e=t[s]?new X$1(i[s],n):new X$1(n,i[s]),await this.addNode(e);}return await e.getKey()}async delete(t){if(!g$2(this,_t$1,"f"))throw Lt$1;const e=V$1.fromBigInt(t),i=N$1(this.maxLevels,e.value);let s=g$2(this,Ot$1,"f");const n=[];for(let t=0;t<g$2(this,Pt$1,"f");t+=1){const r=await this.getNode(s);if(void 0===r)throw Bt$1;switch(r.type){case 2:throw mt$1;case 1:if(b$3(e.bytes,r.entry[0].value))return void await this.rmAndUpload(i,e,n);throw mt$1;case 0:i[t]?(s=r.childR,n.push(r.childL)):(s=r.childL,n.push(r.childR));break;default:throw kt$1}}throw mt$1}async rmAndUpload(t,e,i){if(0===i.length)return v$2(this,Ot$1,M$2),void await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));const s=i[i.length-1];i.length<2&&(v$2(this,Ot$1,i[0]),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f")));const n=await g$2(this,$t$1,"f").get(s.bytes);if(0===n?.type){let e;e=t[i.length-1]?new X$1(s,M$2):new X$1(M$2,s),await this.addNode(e);const n=await this.recalculatePathUntilRoot(t,e,i.slice(0,i.length-1));return v$2(this,Ot$1,n),void await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"))}for(let e=i.length-2;e>=0;e-=1){if(!b$3(i[e].value,M$2.value)){let n;n=t[e]?new X$1(i[e],s):new X$1(s,i[e]),await this.addNode(n);const r=await this.recalculatePathUntilRoot(t,n,i.slice(0,e));v$2(this,Ot$1,r),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));break}if(0===e){v$2(this,Ot$1,s),await g$2(this,$t$1,"f").setRoot(g$2(this,Ot$1,"f"));break}}}async recWalk(t,e){const i=await this.getNode(t);if(void 0===i)throw Bt$1;switch(i.type){case 2:case 1:await e(i);break;case 0:await e(i),await this.recWalk(i.childL,e),await this.recWalk(i.childR,e);break;default:throw kt$1}}async walk(t,e){b$3(t.value,M$2.value)&&(t=await this.root()),await this.recWalk(t,e);}async generateCircomVerifierProof(t,e){const i=await this.generateSCVerifierProof(t,e);return i.siblings=J$1(i.siblings,this.maxLevels),i}async generateSCVerifierProof(t,e){b$3(e.value,M$2.value)&&(e=await this.root());const{proof:i,value:s}=await this.generateProof(t,e),n=new Nt$1;return n.root=e,n.siblings=i.allSiblings(),void 0!==i.nodeAux?(n.oldKey=i.nodeAux.key,n.oldValue=i.nodeAux.value):(n.oldKey=M$2,n.oldValue=M$2),n.key=V$1.fromBigInt(t),n.value=V$1.fromBigInt(s),i.existence?n.fnc=0:n.fnc=1,n}async generateProof(t,e){let i;const s=V$1.fromBigInt(t),n=N$1(this.maxLevels,s.value);e||(e=await this.root());let r=e,a=0,o=!1;const h=[];let l;for(a=0;a<this.maxLevels;a+=1){const t=await this.getNode(r);if(void 0===t)throw Bt$1;switch(t.type){case 2:return {proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:BigInt("0")};case 1:return b$3(s.value,t.entry[0].value)?(o=!0,{proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:t.entry[1].bigInt()}):(l={key:t.entry[0],value:t.entry[1]},{proof:new Kt$1({existence:o,nodeAux:l,siblings:h}),value:t.entry[1].bigInt()});case 0:n[a]?(r=t.childR,i=t.childL):(r=t.childL,i=t.childR);break;default:throw kt$1}h.push(i);}throw mt$1}async addAndGetCircomProof(t,e){const i=new Ut$1;i.fnc=2,i.oldRoot=await this.root();let s=BigInt("0"),n=BigInt("0"),r=[];try{const e=await this.get(t);s=e.key,n=e.value,r=e.siblings;}catch(t){if(t!==mt$1)throw t}if(void 0===s||void 0===n)throw "key/value undefined";return i.oldKey=V$1.fromBigInt(s),i.oldValue=V$1.fromBigInt(n),b$3(i.oldKey.value,M$2.value)&&(i.isOld0=!0),i.siblings=J$1(r,this.maxLevels),await this.add(t,e),i.newKey=V$1.fromBigInt(t),i.newValue=V$1.fromBigInt(e),i.newRoot=await this.root(),i}async graphViz(t){let e=0;await this.walk(t,(async t=>{const i=await t.getKey();let s,n;switch(t.type){case 2:break;case 1:console.log(`"${i.string()}" [style=filled]`);break;case 0:s=[t.childL.string(),t.childR.string()],n="",s.forEach(((t,i)=>{"0"===t&&(s[i]=`empty${e}`,n+=`"${s[i]}" [style=dashed,label=0];\n`,e+=1);})),console.log(`"${i.string()}" -> {"${s[1]}"}`),console.log(n);}})),console.log("}\n");}async printGraphViz(t){b$3(t.value,M$2.value)&&(t=await this.root()),console.log(`--------\nGraphViz of the MerkleTree with RootKey ${t.bigInt().toString(10)}\n`),await this.graphViz(M$2),console.log(`End of GraphViz of the MerkleTree with RootKey ${t.bigInt().toString(10)}\n--------\n`);}};$t$1=new WeakMap,Ot$1=new WeakMap,_t$1=new WeakMap,Pt$1=new WeakMap;
642
642
 
643
643
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
644
644
 
@@ -2392,9 +2392,9 @@ var PolygonIdSdk = (function (exports) {
2392
2392
  // This is OK: `abstract` directory does not use noble-hashes.
2393
2393
  // User may opt-in into using different hashing library. This way, noble-hashes
2394
2394
  // won't be included into their bundle.
2395
- const _0n$a = BigInt(0);
2396
- const _1n$d = BigInt(1);
2397
- const _2n$9 = BigInt(2);
2395
+ const _0n$a = /* @__PURE__ */ BigInt(0);
2396
+ const _1n$d = /* @__PURE__ */ BigInt(1);
2397
+ const _2n$9 = /* @__PURE__ */ BigInt(2);
2398
2398
  function isBytes$1(a) {
2399
2399
  return (a instanceof Uint8Array ||
2400
2400
  (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));
@@ -2403,6 +2403,10 @@ var PolygonIdSdk = (function (exports) {
2403
2403
  if (!isBytes$1(item))
2404
2404
  throw new Error('Uint8Array expected');
2405
2405
  }
2406
+ function abool(title, value) {
2407
+ if (typeof value !== 'boolean')
2408
+ throw new Error(`${title} must be valid boolean, got "${value}".`);
2409
+ }
2406
2410
  // Array where index 0xf0 (240) is mapped to string 'f0'
2407
2411
  const hexes$1 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
2408
2412
  /**
@@ -2545,6 +2549,25 @@ var PolygonIdSdk = (function (exports) {
2545
2549
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
2546
2550
  return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
2547
2551
  }
2552
+ // Is positive bigint
2553
+ const isPosBig = (n) => typeof n === 'bigint' && _0n$a <= n;
2554
+ function inRange(n, min, max) {
2555
+ return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
2556
+ }
2557
+ /**
2558
+ * Asserts min <= n < max. NOTE: It's < max and not <= max.
2559
+ * @example
2560
+ * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)
2561
+ */
2562
+ function aInRange(title, n, min, max) {
2563
+ // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?
2564
+ // consider P=256n, min=0n, max=P
2565
+ // - a for min=0 would require -1: `inRange('x', x, -1n, P)`
2566
+ // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`
2567
+ // - our way is the cleanest: `inRange('x', x, 0n, P)
2568
+ if (!inRange(n, min, max))
2569
+ throw new Error(`expected valid ${title}: ${min} <= n < ${max}, got ${typeof n} ${n}`);
2570
+ }
2548
2571
  // Bit operations
2549
2572
  /**
2550
2573
  * Calculates amount of bits in a bigint.
@@ -2675,9 +2698,32 @@ var PolygonIdSdk = (function (exports) {
2675
2698
  // const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });
2676
2699
  // const z3 = validateObject(o, { test: 'boolean', z: 'bug' });
2677
2700
  // const z4 = validateObject(o, { a: 'boolean', z: 'bug' });
2701
+ /**
2702
+ * throws not implemented error
2703
+ */
2704
+ const notImplemented = () => {
2705
+ throw new Error('not implemented');
2706
+ };
2707
+ /**
2708
+ * Memoizes (caches) computation result.
2709
+ * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.
2710
+ */
2711
+ function memoized(fn) {
2712
+ const map = new WeakMap();
2713
+ return (arg, ...args) => {
2714
+ const val = map.get(arg);
2715
+ if (val !== undefined)
2716
+ return val;
2717
+ const computed = fn(arg, ...args);
2718
+ map.set(arg, computed);
2719
+ return computed;
2720
+ };
2721
+ }
2678
2722
 
2679
2723
  var ut$2 = /*#__PURE__*/Object.freeze({
2680
2724
  __proto__: null,
2725
+ aInRange: aInRange,
2726
+ abool: abool,
2681
2727
  abytes: abytes,
2682
2728
  bitGet: bitGet$1,
2683
2729
  bitLen: bitLen$1,
@@ -2692,7 +2738,10 @@ var PolygonIdSdk = (function (exports) {
2692
2738
  equalBytes: equalBytes$1,
2693
2739
  hexToBytes: hexToBytes$2,
2694
2740
  hexToNumber: hexToNumber$1,
2741
+ inRange: inRange,
2695
2742
  isBytes: isBytes$1,
2743
+ memoized: memoized,
2744
+ notImplemented: notImplemented,
2696
2745
  numberToBytesBE: numberToBytesBE$1,
2697
2746
  numberToBytesLE: numberToBytesLE$1,
2698
2747
  numberToHexUnpadded: numberToHexUnpadded$1,
@@ -2706,7 +2755,7 @@ var PolygonIdSdk = (function (exports) {
2706
2755
  // prettier-ignore
2707
2756
  const _0n$9 = BigInt(0), _1n$c = BigInt(1), _2n$8 = BigInt(2), _3n$3 = BigInt(3);
2708
2757
  // prettier-ignore
2709
- const _4n$1 = BigInt(4), _5n$2 = BigInt(5), _8n$2 = BigInt(8);
2758
+ const _4n$1 = BigInt(4), _5n$2 = BigInt(5), _8n$3 = BigInt(8);
2710
2759
  // prettier-ignore
2711
2760
  BigInt(9); BigInt(16);
2712
2761
  // Calculates a modulo b
@@ -2852,8 +2901,8 @@ var PolygonIdSdk = (function (exports) {
2852
2901
  };
2853
2902
  }
2854
2903
  // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)
2855
- if (P % _8n$2 === _5n$2) {
2856
- const c1 = (P - _5n$2) / _8n$2;
2904
+ if (P % _8n$3 === _5n$2) {
2905
+ const c1 = (P - _5n$2) / _8n$3;
2857
2906
  return function sqrt5mod8(Fp, n) {
2858
2907
  const n2 = Fp.mul(n, _2n$8);
2859
2908
  const v = Fp.pow(n2, c1);
@@ -2951,6 +3000,9 @@ var PolygonIdSdk = (function (exports) {
2951
3000
  * * a) denormalized operations like mulN instead of mul
2952
3001
  * * b) same object shape: never add or remove keys
2953
3002
  * * c) Object.freeze
3003
+ * NOTE: operations don't check 'isValid' for all elements for performance reasons,
3004
+ * it is caller responsibility to check this.
3005
+ * This is low-level code, please make sure you know what you doing.
2954
3006
  * @param ORDER prime positive bigint
2955
3007
  * @param bitLen how many bits the field consumes
2956
3008
  * @param isLE (def: false) if encoding / decoding should be in little-endian
@@ -3006,12 +3058,6 @@ var PolygonIdSdk = (function (exports) {
3006
3058
  });
3007
3059
  return Object.freeze(f);
3008
3060
  }
3009
- function FpSqrtEven(Fp, elm) {
3010
- if (!Fp.isOdd)
3011
- throw new Error(`Field doesn't have isOdd`);
3012
- const root = Fp.sqrt(elm);
3013
- return Fp.isOdd(root) ? Fp.neg(root) : root;
3014
- }
3015
3061
  /**
3016
3062
  * Returns total number of bytes consumed by the field element.
3017
3063
  * For example, 32 bytes for usual 256-bit weierstrass curve.
@@ -3065,6 +3111,10 @@ var PolygonIdSdk = (function (exports) {
3065
3111
  // Abelian group utilities
3066
3112
  const _0n$8 = BigInt(0);
3067
3113
  const _1n$b = BigInt(1);
3114
+ // Since points in different groups cannot be equal (different object constructor),
3115
+ // we can have single place to store precomputes
3116
+ const pointPrecomputes = new WeakMap();
3117
+ const pointWindowSizes = new WeakMap(); // This allows use make points immutable (nothing changes inside)
3068
3118
  // Elliptic curve multiplication of Point by scalar. Fragile.
3069
3119
  // Scalars should always be less than curve order: this should be checked inside of a curve itself.
3070
3120
  // Creates precomputation tables for fast multiplication:
@@ -3081,7 +3131,12 @@ var PolygonIdSdk = (function (exports) {
3081
3131
  const neg = item.negate();
3082
3132
  return condition ? neg : item;
3083
3133
  };
3134
+ const validateW = (W) => {
3135
+ if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
3136
+ throw new Error(`Wrong window size=${W}, should be [1..${bits}]`);
3137
+ };
3084
3138
  const opts = (W) => {
3139
+ validateW(W);
3085
3140
  const windows = Math.ceil(bits / W) + 1; // +1, because
3086
3141
  const windowSize = 2 ** (W - 1); // -1 because we skip zero
3087
3142
  return { windows, windowSize };
@@ -3181,19 +3236,25 @@ var PolygonIdSdk = (function (exports) {
3181
3236
  // which makes it less const-time: around 1 bigint multiply.
3182
3237
  return { p, f };
3183
3238
  },
3184
- wNAFCached(P, precomputesMap, n, transform) {
3185
- // @ts-ignore
3186
- const W = P._WINDOW_SIZE || 1;
3239
+ wNAFCached(P, n, transform) {
3240
+ const W = pointWindowSizes.get(P) || 1;
3187
3241
  // Calculate precomputes on a first run, reuse them after
3188
- let comp = precomputesMap.get(P);
3242
+ let comp = pointPrecomputes.get(P);
3189
3243
  if (!comp) {
3190
3244
  comp = this.precomputeWindow(P, W);
3191
- if (W !== 1) {
3192
- precomputesMap.set(P, transform(comp));
3193
- }
3245
+ if (W !== 1)
3246
+ pointPrecomputes.set(P, transform(comp));
3194
3247
  }
3195
3248
  return this.wNAF(W, comp, n);
3196
3249
  },
3250
+ // We calculate precomputes for elliptic curve point multiplication
3251
+ // using windowed method. This specifies window size and
3252
+ // stores precomputed values. Usually only base point would be precomputed.
3253
+ setWindowSize(P, W) {
3254
+ validateW(W);
3255
+ pointWindowSizes.set(P, W);
3256
+ pointPrecomputes.delete(P);
3257
+ },
3197
3258
  };
3198
3259
  }
3199
3260
  function validateBasic$1(curve) {
@@ -3219,7 +3280,7 @@ var PolygonIdSdk = (function (exports) {
3219
3280
  // Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y²
3220
3281
  // Be friendly to bad ECMAScript parsers by not using bigint literals
3221
3282
  // prettier-ignore
3222
- const _0n$7 = BigInt(0), _1n$a = BigInt(1), _2n$7 = BigInt(2), _8n$1 = BigInt(8);
3283
+ const _0n$7 = BigInt(0), _1n$a = BigInt(1), _2n$7 = BigInt(2), _8n$2 = BigInt(8);
3223
3284
  // verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex:
3224
3285
  const VERIFY_DEFAULT = { zip215: true };
3225
3286
  function validateOpts$2(curve) {
@@ -3238,7 +3299,13 @@ var PolygonIdSdk = (function (exports) {
3238
3299
  // Set defaults
3239
3300
  return Object.freeze({ ...opts });
3240
3301
  }
3241
- // It is not generic twisted curve for now, but ed25519/ed448 generic implementation
3302
+ /**
3303
+ * Creates Twisted Edwards curve with EdDSA signatures.
3304
+ * @example
3305
+ * import { Field } from '@noble/curves/abstract/modular';
3306
+ * // Before that, define BigInt-s: a, d, p, n, Gx, Gy, h
3307
+ * const curve = twistedEdwards({ a, d, Fp: Field(p), n, Gx, Gy, h })
3308
+ */
3242
3309
  function twistedEdwards(curveDef) {
3243
3310
  const CURVE = validateOpts$2(curveDef);
3244
3311
  const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE;
@@ -3257,28 +3324,59 @@ var PolygonIdSdk = (function (exports) {
3257
3324
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP
3258
3325
  const domain = CURVE.domain ||
3259
3326
  ((data, ctx, phflag) => {
3327
+ abool('phflag', phflag);
3260
3328
  if (ctx.length || phflag)
3261
3329
  throw new Error('Contexts/pre-hash are not supported');
3262
3330
  return data;
3263
3331
  }); // NOOP
3264
- const inBig = (n) => typeof n === 'bigint' && _0n$7 < n; // n in [1..]
3265
- const inRange = (n, max) => inBig(n) && inBig(max) && n < max; // n in [1..max-1]
3266
- const in0MaskRange = (n) => n === _0n$7 || inRange(n, MASK); // n in [0..MASK-1]
3267
- function assertInRange(n, max) {
3268
- // n in [1..max-1]
3269
- if (inRange(n, max))
3270
- return n;
3271
- throw new Error(`Expected valid scalar < ${max}, got ${typeof n} ${n}`);
3272
- }
3273
- function assertGE0(n) {
3274
- // n in [0..CURVE_ORDER-1]
3275
- return n === _0n$7 ? n : assertInRange(n, CURVE_ORDER); // GE = prime subgroup, not full group
3332
+ // 0 <= n < MASK
3333
+ // Coordinates larger than Fp.ORDER are allowed for zip215
3334
+ function aCoordinate(title, n) {
3335
+ aInRange('coordinate ' + title, n, _0n$7, MASK);
3276
3336
  }
3277
- const pointPrecomputes = new Map();
3278
- function isPoint(other) {
3337
+ function assertPoint(other) {
3279
3338
  if (!(other instanceof Point))
3280
3339
  throw new Error('ExtendedPoint expected');
3281
3340
  }
3341
+ // Converts Extended point to default (x, y) coordinates.
3342
+ // Can accept precomputed Z^-1 - for example, from invertBatch.
3343
+ const toAffineMemo = memoized((p, iz) => {
3344
+ const { ex: x, ey: y, ez: z } = p;
3345
+ const is0 = p.is0();
3346
+ if (iz == null)
3347
+ iz = is0 ? _8n$2 : Fp.inv(z); // 8 was chosen arbitrarily
3348
+ const ax = modP(x * iz);
3349
+ const ay = modP(y * iz);
3350
+ const zz = modP(z * iz);
3351
+ if (is0)
3352
+ return { x: _0n$7, y: _1n$a };
3353
+ if (zz !== _1n$a)
3354
+ throw new Error('invZ was invalid');
3355
+ return { x: ax, y: ay };
3356
+ });
3357
+ const assertValidMemo = memoized((p) => {
3358
+ const { a, d } = CURVE;
3359
+ if (p.is0())
3360
+ throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?
3361
+ // Equation in affine coordinates: ax² + y² = 1 + dx²y²
3362
+ // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y²
3363
+ const { ex: X, ey: Y, ez: Z, et: T } = p;
3364
+ const X2 = modP(X * X); // X²
3365
+ const Y2 = modP(Y * Y); // Y²
3366
+ const Z2 = modP(Z * Z); // Z²
3367
+ const Z4 = modP(Z2 * Z2); // Z⁴
3368
+ const aX2 = modP(X2 * a); // aX²
3369
+ const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z²
3370
+ const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y²
3371
+ if (left !== right)
3372
+ throw new Error('bad point: equation left != right (1)');
3373
+ // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T
3374
+ const XY = modP(X * Y);
3375
+ const ZT = modP(Z * T);
3376
+ if (XY !== ZT)
3377
+ throw new Error('bad point: equation left != right (2)');
3378
+ return true;
3379
+ });
3282
3380
  // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy).
3283
3381
  // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates
3284
3382
  class Point {
@@ -3287,14 +3385,11 @@ var PolygonIdSdk = (function (exports) {
3287
3385
  this.ey = ey;
3288
3386
  this.ez = ez;
3289
3387
  this.et = et;
3290
- if (!in0MaskRange(ex))
3291
- throw new Error('x required');
3292
- if (!in0MaskRange(ey))
3293
- throw new Error('y required');
3294
- if (!in0MaskRange(ez))
3295
- throw new Error('z required');
3296
- if (!in0MaskRange(et))
3297
- throw new Error('t required');
3388
+ aCoordinate('x', ex);
3389
+ aCoordinate('y', ey);
3390
+ aCoordinate('z', ez);
3391
+ aCoordinate('t', et);
3392
+ Object.freeze(this);
3298
3393
  }
3299
3394
  get x() {
3300
3395
  return this.toAffine().x;
@@ -3306,8 +3401,8 @@ var PolygonIdSdk = (function (exports) {
3306
3401
  if (p instanceof Point)
3307
3402
  throw new Error('extended point not allowed');
3308
3403
  const { x, y } = p || {};
3309
- if (!in0MaskRange(x) || !in0MaskRange(y))
3310
- throw new Error('invalid affine point');
3404
+ aCoordinate('x', x);
3405
+ aCoordinate('y', y);
3311
3406
  return new Point(x, y, _1n$a, modP(x * y));
3312
3407
  }
3313
3408
  static normalizeZ(points) {
@@ -3316,36 +3411,16 @@ var PolygonIdSdk = (function (exports) {
3316
3411
  }
3317
3412
  // "Private method", don't use it directly
3318
3413
  _setWindowSize(windowSize) {
3319
- this._WINDOW_SIZE = windowSize;
3320
- pointPrecomputes.delete(this);
3414
+ wnaf.setWindowSize(this, windowSize);
3321
3415
  }
3322
3416
  // Not required for fromHex(), which always creates valid points.
3323
3417
  // Could be useful for fromAffine().
3324
3418
  assertValidity() {
3325
- const { a, d } = CURVE;
3326
- if (this.is0())
3327
- throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?
3328
- // Equation in affine coordinates: ax² + y² = 1 + dx²y²
3329
- // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y²
3330
- const { ex: X, ey: Y, ez: Z, et: T } = this;
3331
- const X2 = modP(X * X); // X²
3332
- const Y2 = modP(Y * Y); // Y²
3333
- const Z2 = modP(Z * Z); // Z²
3334
- const Z4 = modP(Z2 * Z2); // Z⁴
3335
- const aX2 = modP(X2 * a); // aX²
3336
- const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z²
3337
- const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y²
3338
- if (left !== right)
3339
- throw new Error('bad point: equation left != right (1)');
3340
- // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T
3341
- const XY = modP(X * Y);
3342
- const ZT = modP(Z * T);
3343
- if (XY !== ZT)
3344
- throw new Error('bad point: equation left != right (2)');
3419
+ assertValidMemo(this);
3345
3420
  }
3346
3421
  // Compare one point to another.
3347
3422
  equals(other) {
3348
- isPoint(other);
3423
+ assertPoint(other);
3349
3424
  const { ex: X1, ey: Y1, ez: Z1 } = this;
3350
3425
  const { ex: X2, ey: Y2, ez: Z2 } = other;
3351
3426
  const X1Z2 = modP(X1 * Z2);
@@ -3386,7 +3461,7 @@ var PolygonIdSdk = (function (exports) {
3386
3461
  // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd
3387
3462
  // Cost: 9M + 1*a + 1*d + 7add.
3388
3463
  add(other) {
3389
- isPoint(other);
3464
+ assertPoint(other);
3390
3465
  const { a, d } = CURVE;
3391
3466
  const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this;
3392
3467
  const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other;
@@ -3429,11 +3504,13 @@ var PolygonIdSdk = (function (exports) {
3429
3504
  return this.add(other.negate());
3430
3505
  }
3431
3506
  wNAF(n) {
3432
- return wnaf.wNAFCached(this, pointPrecomputes, n, Point.normalizeZ);
3507
+ return wnaf.wNAFCached(this, n, Point.normalizeZ);
3433
3508
  }
3434
3509
  // Constant-time multiplication.
3435
3510
  multiply(scalar) {
3436
- const { p, f } = this.wNAF(assertInRange(scalar, CURVE_ORDER));
3511
+ const n = scalar;
3512
+ aInRange('scalar', n, _1n$a, CURVE_ORDER); // 1 <= scalar < L
3513
+ const { p, f } = this.wNAF(n);
3437
3514
  return Point.normalizeZ([p, f])[0];
3438
3515
  }
3439
3516
  // Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -3441,7 +3518,8 @@ var PolygonIdSdk = (function (exports) {
3441
3518
  // an exposed private key e.g. sig verification.
3442
3519
  // Does NOT allow scalars higher than CURVE.n.
3443
3520
  multiplyUnsafe(scalar) {
3444
- let n = assertGE0(scalar); // 0 <= scalar < CURVE.n
3521
+ const n = scalar;
3522
+ aInRange('scalar', n, _0n$7, CURVE_ORDER); // 0 <= scalar < L
3445
3523
  if (n === _0n$7)
3446
3524
  return I;
3447
3525
  if (this.equals(I) || n === _1n$a)
@@ -3465,18 +3543,7 @@ var PolygonIdSdk = (function (exports) {
3465
3543
  // Converts Extended point to default (x, y) coordinates.
3466
3544
  // Can accept precomputed Z^-1 - for example, from invertBatch.
3467
3545
  toAffine(iz) {
3468
- const { ex: x, ey: y, ez: z } = this;
3469
- const is0 = this.is0();
3470
- if (iz == null)
3471
- iz = is0 ? _8n$1 : Fp.inv(z); // 8 was chosen arbitrarily
3472
- const ax = modP(x * iz);
3473
- const ay = modP(y * iz);
3474
- const zz = modP(z * iz);
3475
- if (is0)
3476
- return { x: _0n$7, y: _1n$a };
3477
- if (zz !== _1n$a)
3478
- throw new Error('invZ was invalid');
3479
- return { x: ax, y: ay };
3546
+ return toAffineMemo(this, iz);
3480
3547
  }
3481
3548
  clearCofactor() {
3482
3549
  const { h: cofactor } = CURVE;
@@ -3490,18 +3557,16 @@ var PolygonIdSdk = (function (exports) {
3490
3557
  const { d, a } = CURVE;
3491
3558
  const len = Fp.BYTES;
3492
3559
  hex = ensureBytes$1('pointHex', hex, len); // copy hex to a new array
3560
+ abool('zip215', zip215);
3493
3561
  const normed = hex.slice(); // copy again, we'll manipulate it
3494
3562
  const lastByte = hex[len - 1]; // select last byte
3495
3563
  normed[len - 1] = lastByte & ~0x80; // clear last bit
3496
3564
  const y = bytesToNumberLE$1(normed);
3497
- if (y === _0n$7) ;
3498
- else {
3499
- // RFC8032 prohibits >= p, but ZIP215 doesn't
3500
- if (zip215)
3501
- assertInRange(y, MASK); // zip215=true [1..P-1] (2^255-19-1 for ed25519)
3502
- else
3503
- assertInRange(y, Fp.ORDER); // zip215=false [1..MASK-1] (2^256-1 for ed25519)
3504
- }
3565
+ // RFC8032 prohibits >= p, but ZIP215 doesn't
3566
+ // zip215=true: 0 <= y < MASK (2^256 for ed25519)
3567
+ // zip215=false: 0 <= y < P (2^255-19 for ed25519)
3568
+ const max = zip215 ? MASK : Fp.ORDER;
3569
+ aInRange('pointHex.y', y, _0n$7, max);
3505
3570
  // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case:
3506
3571
  // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a)
3507
3572
  const y2 = modP(y * y); // denominator is always non-0 mod p.
@@ -3576,7 +3641,7 @@ var PolygonIdSdk = (function (exports) {
3576
3641
  const R = G.multiply(r).toRawBytes(); // R = rG
3577
3642
  const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M)
3578
3643
  const s = modN(r + k * scalar); // S = (r + k * s) mod L
3579
- assertGE0(s); // 0 <= s < l
3644
+ aInRange('signature.s', s, _0n$7, CURVE_ORDER); // 0 <= s < l
3580
3645
  const res = concatBytes$2(R, numberToBytesLE$1(s, Fp.BYTES));
3581
3646
  return ensureBytes$1('result', res, nByteLength * 2); // 64-byte signature
3582
3647
  }
@@ -3586,6 +3651,8 @@ var PolygonIdSdk = (function (exports) {
3586
3651
  const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7.
3587
3652
  sig = ensureBytes$1('signature', sig, 2 * len); // An extended group equation is checked.
3588
3653
  msg = ensureBytes$1('message', msg);
3654
+ if (zip215 !== undefined)
3655
+ abool('zip215', zip215);
3589
3656
  if (prehash)
3590
3657
  msg = prehash(msg); // for ed25519ph, etc
3591
3658
  const s = bytesToNumberLE$1(sig.slice(len, 2 * len));
@@ -3643,12 +3710,14 @@ var PolygonIdSdk = (function (exports) {
3643
3710
  */
3644
3711
  const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');
3645
3712
  // √(-1) aka √(a) aka 2^((p-1)/4)
3646
- const ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');
3713
+ const ED25519_SQRT_M1 = /* @__PURE__ */ BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');
3647
3714
  // prettier-ignore
3648
- BigInt(0); const _1n$9 = BigInt(1), _2n$6 = BigInt(2), _5n$1 = BigInt(5);
3715
+ BigInt(0); const _1n$9 = BigInt(1), _2n$6 = BigInt(2); BigInt(3);
3649
3716
  // prettier-ignore
3650
- const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);
3717
+ const _5n$1 = BigInt(5), _8n$1 = BigInt(8);
3651
3718
  function ed25519_pow_2_252_3(x) {
3719
+ // prettier-ignore
3720
+ const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);
3652
3721
  const P = ED25519_P;
3653
3722
  const x2 = (x * x) % P;
3654
3723
  const b2 = (x2 * x) % P; // x^3, 11
@@ -3697,8 +3766,8 @@ var PolygonIdSdk = (function (exports) {
3697
3766
  x = mod$2(-x, P);
3698
3767
  return { isValid: useRoot1 || useRoot2, value: x };
3699
3768
  }
3700
- const Fp$3 = Field$1(ED25519_P, undefined, true);
3701
- const ed25519Defaults = {
3769
+ const Fp$3 = /* @__PURE__ */ (() => Field$1(ED25519_P, undefined, true))();
3770
+ const ed25519Defaults = /* @__PURE__ */ (() => ({
3702
3771
  // Param: a
3703
3772
  a: BigInt(-1), // Fp.create(-1) is proper; our way still works and is faster
3704
3773
  // d is equal to -121665/121666 over finite field.
@@ -3710,7 +3779,7 @@ var PolygonIdSdk = (function (exports) {
3710
3779
  // 2n**252n + 27742317777372353535851937790883648493n;
3711
3780
  n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'),
3712
3781
  // Cofactor
3713
- h: BigInt(8),
3782
+ h: _8n$1,
3714
3783
  // Base point (x, y) aka generator point
3715
3784
  Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),
3716
3785
  Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'),
@@ -3721,26 +3790,11 @@ var PolygonIdSdk = (function (exports) {
3721
3790
  // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.
3722
3791
  // Constant-time, u/√v
3723
3792
  uvRatio,
3724
- };
3725
- const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults);
3726
- // Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)
3727
- // NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since
3728
- // SageMath returns different root first and everything falls apart
3729
- const ELL2_C1 = (Fp$3.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic
3730
- Fp$3.pow(_2n$6, ELL2_C1); // 2. c2 = 2^c1
3731
- Fp$3.sqrt(Fp$3.neg(Fp$3.ONE)); // 3. c3 = sqrt(-1)
3732
- (Fp$3.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic
3733
- BigInt(486662);
3734
- FpSqrtEven(Fp$3, Fp$3.neg(BigInt(486664))); // sgn0(c1) MUST equal 0
3735
- // √(ad - 1)
3736
- BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');
3737
- // 1 / √(a-d)
3738
- BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');
3739
- // 1-d²
3740
- BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');
3741
- // (d-1)²
3742
- BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');
3743
- BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
3793
+ }))();
3794
+ /**
3795
+ * ed25519 curve with EdDSA signatures.
3796
+ */
3797
+ const ed25519 = /* @__PURE__ */ (() => twistedEdwards(ed25519Defaults))();
3744
3798
 
3745
3799
  /**
3746
3800
  * Provider for Ed25519 keys
@@ -3933,8 +3987,89 @@ var PolygonIdSdk = (function (exports) {
3933
3987
  */
3934
3988
  const sha256$3 = /* @__PURE__ */ wrapConstructor$1(() => new SHA256$1());
3935
3989
 
3990
+ // HMAC (RFC 2104)
3991
+ let HMAC$1 = class HMAC extends Hash$1 {
3992
+ constructor(hash, _key) {
3993
+ super();
3994
+ this.finished = false;
3995
+ this.destroyed = false;
3996
+ hash$1(hash);
3997
+ const key = toBytes$1(_key);
3998
+ this.iHash = hash.create();
3999
+ if (typeof this.iHash.update !== 'function')
4000
+ throw new Error('Expected instance of class which extends utils.Hash');
4001
+ this.blockLen = this.iHash.blockLen;
4002
+ this.outputLen = this.iHash.outputLen;
4003
+ const blockLen = this.blockLen;
4004
+ const pad = new Uint8Array(blockLen);
4005
+ // blockLen can be bigger than outputLen
4006
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
4007
+ for (let i = 0; i < pad.length; i++)
4008
+ pad[i] ^= 0x36;
4009
+ this.iHash.update(pad);
4010
+ // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
4011
+ this.oHash = hash.create();
4012
+ // Undo internal XOR && apply outer XOR
4013
+ for (let i = 0; i < pad.length; i++)
4014
+ pad[i] ^= 0x36 ^ 0x5c;
4015
+ this.oHash.update(pad);
4016
+ pad.fill(0);
4017
+ }
4018
+ update(buf) {
4019
+ exists$1(this);
4020
+ this.iHash.update(buf);
4021
+ return this;
4022
+ }
4023
+ digestInto(out) {
4024
+ exists$1(this);
4025
+ bytes$1(out, this.outputLen);
4026
+ this.finished = true;
4027
+ this.iHash.digestInto(out);
4028
+ this.oHash.update(out);
4029
+ this.oHash.digestInto(out);
4030
+ this.destroy();
4031
+ }
4032
+ digest() {
4033
+ const out = new Uint8Array(this.oHash.outputLen);
4034
+ this.digestInto(out);
4035
+ return out;
4036
+ }
4037
+ _cloneInto(to) {
4038
+ // Create new instance without calling constructor since key already in state and we don't know it.
4039
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
4040
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
4041
+ to = to;
4042
+ to.finished = finished;
4043
+ to.destroyed = destroyed;
4044
+ to.blockLen = blockLen;
4045
+ to.outputLen = outputLen;
4046
+ to.oHash = oHash._cloneInto(to.oHash);
4047
+ to.iHash = iHash._cloneInto(to.iHash);
4048
+ return to;
4049
+ }
4050
+ destroy() {
4051
+ this.destroyed = true;
4052
+ this.oHash.destroy();
4053
+ this.iHash.destroy();
4054
+ }
4055
+ };
4056
+ /**
4057
+ * HMAC: RFC2104 message authentication code.
4058
+ * @param hash - function that would be used e.g. sha256
4059
+ * @param key - message key
4060
+ * @param message - message data
4061
+ */
4062
+ const hmac$1 = (hash, key, message) => new HMAC$1(hash, key).update(message).digest();
4063
+ hmac$1.create = (hash, key) => new HMAC$1(hash, key);
4064
+
3936
4065
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3937
4066
  // Short Weierstrass curve. The formula is: y² = x³ + ax + b
4067
+ function validateSigVerOpts(opts) {
4068
+ if (opts.lowS !== undefined)
4069
+ abool('lowS', opts.lowS);
4070
+ if (opts.prehash !== undefined)
4071
+ abool('prehash', opts.prehash);
4072
+ }
3938
4073
  function validatePointOpts$1(curve) {
3939
4074
  const opts = validateBasic$1(curve);
3940
4075
  validateObject$1(opts, {
@@ -4059,16 +4194,12 @@ var PolygonIdSdk = (function (exports) {
4059
4194
  throw new Error('bad generator point: equation left != right');
4060
4195
  // Valid group elements reside in range 1..n-1
4061
4196
  function isWithinCurveOrder(num) {
4062
- return typeof num === 'bigint' && _0n$6 < num && num < CURVE.n;
4063
- }
4064
- function assertGE(num) {
4065
- if (!isWithinCurveOrder(num))
4066
- throw new Error('Expected valid bigint: 0 < bigint < curve.n');
4197
+ return inRange(num, _1n$8, CURVE.n);
4067
4198
  }
4068
4199
  // Validates if priv key is valid and converts it to bigint.
4069
4200
  // Supports options allowedPrivateKeyLengths and wrapPrivateKey.
4070
4201
  function normPrivateKeyToScalar(key) {
4071
- const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
4202
+ const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
4072
4203
  if (lengths && typeof key !== 'bigint') {
4073
4204
  if (isBytes$1(key))
4074
4205
  key = bytesToHex$2(key);
@@ -4088,15 +4219,61 @@ var PolygonIdSdk = (function (exports) {
4088
4219
  throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
4089
4220
  }
4090
4221
  if (wrapPrivateKey)
4091
- num = mod$2(num, n); // disabled by default, enabled for BLS
4092
- assertGE(num); // num in range [1..N-1]
4222
+ num = mod$2(num, N); // disabled by default, enabled for BLS
4223
+ aInRange('private key', num, _1n$8, N); // num in range [1..N-1]
4093
4224
  return num;
4094
4225
  }
4095
- const pointPrecomputes = new Map();
4096
4226
  function assertPrjPoint(other) {
4097
4227
  if (!(other instanceof Point))
4098
4228
  throw new Error('ProjectivePoint expected');
4099
4229
  }
4230
+ // Memoized toAffine / validity check. They are heavy. Points are immutable.
4231
+ // Converts Projective point to affine (x, y) coordinates.
4232
+ // Can accept precomputed Z^-1 - for example, from invertBatch.
4233
+ // (x, y, z) ∋ (x=x/z, y=y/z)
4234
+ const toAffineMemo = memoized((p, iz) => {
4235
+ const { px: x, py: y, pz: z } = p;
4236
+ // Fast-path for normalized points
4237
+ if (Fp.eql(z, Fp.ONE))
4238
+ return { x, y };
4239
+ const is0 = p.is0();
4240
+ // If invZ was 0, we return zero point. However we still want to execute
4241
+ // all operations, so we replace invZ with a random number, 1.
4242
+ if (iz == null)
4243
+ iz = is0 ? Fp.ONE : Fp.inv(z);
4244
+ const ax = Fp.mul(x, iz);
4245
+ const ay = Fp.mul(y, iz);
4246
+ const zz = Fp.mul(z, iz);
4247
+ if (is0)
4248
+ return { x: Fp.ZERO, y: Fp.ZERO };
4249
+ if (!Fp.eql(zz, Fp.ONE))
4250
+ throw new Error('invZ was invalid');
4251
+ return { x: ax, y: ay };
4252
+ });
4253
+ // NOTE: on exception this will crash 'cached' and no value will be set.
4254
+ // Otherwise true will be return
4255
+ const assertValidMemo = memoized((p) => {
4256
+ if (p.is0()) {
4257
+ // (0, 1, 0) aka ZERO is invalid in most contexts.
4258
+ // In BLS, ZERO can be serialized, so we allow it.
4259
+ // (0, 0, 0) is wrong representation of ZERO and is always invalid.
4260
+ if (CURVE.allowInfinityPoint && !Fp.is0(p.py))
4261
+ return;
4262
+ throw new Error('bad point: ZERO');
4263
+ }
4264
+ // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`
4265
+ const { x, y } = p.toAffine();
4266
+ // Check if x, y are valid field elements
4267
+ if (!Fp.isValid(x) || !Fp.isValid(y))
4268
+ throw new Error('bad point: x or y not FE');
4269
+ const left = Fp.sqr(y); // y²
4270
+ const right = weierstrassEquation(x); // x³ + ax + b
4271
+ if (!Fp.eql(left, right))
4272
+ throw new Error('bad point: equation left != right');
4273
+ if (!p.isTorsionFree())
4274
+ throw new Error('bad point: not in prime-order subgroup');
4275
+ return true;
4276
+ });
4100
4277
  /**
4101
4278
  * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)
4102
4279
  * Default Point works in 2d / affine coordinates: (x, y)
@@ -4113,6 +4290,7 @@ var PolygonIdSdk = (function (exports) {
4113
4290
  throw new Error('y required');
4114
4291
  if (pz == null || !Fp.isValid(pz))
4115
4292
  throw new Error('z required');
4293
+ Object.freeze(this);
4116
4294
  }
4117
4295
  // Does not validate if the point is on-curve.
4118
4296
  // Use fromHex instead, or call assertValidity() later.
@@ -4159,30 +4337,11 @@ var PolygonIdSdk = (function (exports) {
4159
4337
  }
4160
4338
  // "Private method", don't use it directly
4161
4339
  _setWindowSize(windowSize) {
4162
- this._WINDOW_SIZE = windowSize;
4163
- pointPrecomputes.delete(this);
4340
+ wnaf.setWindowSize(this, windowSize);
4164
4341
  }
4165
4342
  // A point on curve is valid if it conforms to equation.
4166
4343
  assertValidity() {
4167
- if (this.is0()) {
4168
- // (0, 1, 0) aka ZERO is invalid in most contexts.
4169
- // In BLS, ZERO can be serialized, so we allow it.
4170
- // (0, 0, 0) is wrong representation of ZERO and is always invalid.
4171
- if (CURVE.allowInfinityPoint && !Fp.is0(this.py))
4172
- return;
4173
- throw new Error('bad point: ZERO');
4174
- }
4175
- // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`
4176
- const { x, y } = this.toAffine();
4177
- // Check if x, y are valid field elements
4178
- if (!Fp.isValid(x) || !Fp.isValid(y))
4179
- throw new Error('bad point: x or y not FE');
4180
- const left = Fp.sqr(y); // y²
4181
- const right = weierstrassEquation(x); // x³ + ax + b
4182
- if (!Fp.eql(left, right))
4183
- throw new Error('bad point: equation left != right');
4184
- if (!this.isTorsionFree())
4185
- throw new Error('bad point: not in prime-order subgroup');
4344
+ assertValidMemo(this);
4186
4345
  }
4187
4346
  hasEvenY() {
4188
4347
  const { y } = this.toAffine();
@@ -4309,28 +4468,25 @@ var PolygonIdSdk = (function (exports) {
4309
4468
  return this.equals(Point.ZERO);
4310
4469
  }
4311
4470
  wNAF(n) {
4312
- return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {
4313
- const toInv = Fp.invertBatch(comp.map((p) => p.pz));
4314
- return comp.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
4315
- });
4471
+ return wnaf.wNAFCached(this, n, Point.normalizeZ);
4316
4472
  }
4317
4473
  /**
4318
4474
  * Non-constant-time multiplication. Uses double-and-add algorithm.
4319
4475
  * It's faster, but should only be used when you don't care about
4320
4476
  * an exposed private key e.g. sig verification, which works over *public* keys.
4321
4477
  */
4322
- multiplyUnsafe(n) {
4478
+ multiplyUnsafe(sc) {
4479
+ aInRange('scalar', sc, _0n$6, CURVE.n);
4323
4480
  const I = Point.ZERO;
4324
- if (n === _0n$6)
4481
+ if (sc === _0n$6)
4325
4482
  return I;
4326
- assertGE(n); // Will throw on 0
4327
- if (n === _1n$8)
4483
+ if (sc === _1n$8)
4328
4484
  return this;
4329
4485
  const { endo } = CURVE;
4330
4486
  if (!endo)
4331
- return wnaf.unsafeLadder(this, n);
4487
+ return wnaf.unsafeLadder(this, sc);
4332
4488
  // Apply endomorphism
4333
- let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
4489
+ let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
4334
4490
  let k1p = I;
4335
4491
  let k2p = I;
4336
4492
  let d = this;
@@ -4360,12 +4516,11 @@ var PolygonIdSdk = (function (exports) {
4360
4516
  * @returns New point
4361
4517
  */
4362
4518
  multiply(scalar) {
4363
- assertGE(scalar);
4364
- let n = scalar;
4519
+ const { endo, n: N } = CURVE;
4520
+ aInRange('scalar', scalar, _1n$8, N);
4365
4521
  let point, fake; // Fake point is used to const-time mult
4366
- const { endo } = CURVE;
4367
4522
  if (endo) {
4368
- const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
4523
+ const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
4369
4524
  let { p: k1p, f: f1p } = this.wNAF(k1);
4370
4525
  let { p: k2p, f: f2p } = this.wNAF(k2);
4371
4526
  k1p = wnaf.constTimeNegate(k1neg, k1p);
@@ -4375,7 +4530,7 @@ var PolygonIdSdk = (function (exports) {
4375
4530
  fake = f1p.add(f2p);
4376
4531
  }
4377
4532
  else {
4378
- const { p, f } = this.wNAF(n);
4533
+ const { p, f } = this.wNAF(scalar);
4379
4534
  point = p;
4380
4535
  fake = f;
4381
4536
  }
@@ -4399,20 +4554,7 @@ var PolygonIdSdk = (function (exports) {
4399
4554
  // Can accept precomputed Z^-1 - for example, from invertBatch.
4400
4555
  // (x, y, z) ∋ (x=x/z, y=y/z)
4401
4556
  toAffine(iz) {
4402
- const { px: x, py: y, pz: z } = this;
4403
- const is0 = this.is0();
4404
- // If invZ was 0, we return zero point. However we still want to execute
4405
- // all operations, so we replace invZ with a random number, 1.
4406
- if (iz == null)
4407
- iz = is0 ? Fp.ONE : Fp.inv(z);
4408
- const ax = Fp.mul(x, iz);
4409
- const ay = Fp.mul(y, iz);
4410
- const zz = Fp.mul(z, iz);
4411
- if (is0)
4412
- return { x: Fp.ZERO, y: Fp.ZERO };
4413
- if (!Fp.eql(zz, Fp.ONE))
4414
- throw new Error('invZ was invalid');
4415
- return { x: ax, y: ay };
4557
+ return toAffineMemo(this, iz);
4416
4558
  }
4417
4559
  isTorsionFree() {
4418
4560
  const { h: cofactor, isTorsionFree } = CURVE;
@@ -4431,10 +4573,12 @@ var PolygonIdSdk = (function (exports) {
4431
4573
  return this.multiplyUnsafe(CURVE.h);
4432
4574
  }
4433
4575
  toRawBytes(isCompressed = true) {
4576
+ abool('isCompressed', isCompressed);
4434
4577
  this.assertValidity();
4435
4578
  return toBytes(Point, this, isCompressed);
4436
4579
  }
4437
4580
  toHex(isCompressed = true) {
4581
+ abool('isCompressed', isCompressed);
4438
4582
  return bytesToHex$2(this.toRawBytes(isCompressed));
4439
4583
  }
4440
4584
  }
@@ -4464,14 +4608,18 @@ var PolygonIdSdk = (function (exports) {
4464
4608
  });
4465
4609
  return Object.freeze({ lowS: true, ...opts });
4466
4610
  }
4611
+ /**
4612
+ * Creates short weierstrass curve and ECDSA signature methods for it.
4613
+ * @example
4614
+ * import { Field } from '@noble/curves/abstract/modular';
4615
+ * // Before that, define BigInt-s: a, b, p, n, Gx, Gy
4616
+ * const curve = weierstrass({ a, b, Fp: Field(p), n, Gx, Gy, h: 1n })
4617
+ */
4467
4618
  function weierstrass$1(curveDef) {
4468
4619
  const CURVE = validateOpts$1(curveDef);
4469
4620
  const { Fp, n: CURVE_ORDER } = CURVE;
4470
4621
  const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32
4471
4622
  const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32
4472
- function isValidFieldElement(num) {
4473
- return _0n$6 < num && num < Fp.ORDER; // 0 is banned since it's not invertible FE
4474
- }
4475
4623
  function modN(a) {
4476
4624
  return mod$2(a, CURVE_ORDER);
4477
4625
  }
@@ -4484,6 +4632,7 @@ var PolygonIdSdk = (function (exports) {
4484
4632
  const a = point.toAffine();
4485
4633
  const x = Fp.toBytes(a.x);
4486
4634
  const cat = concatBytes$2;
4635
+ abool('isCompressed', isCompressed);
4487
4636
  if (isCompressed) {
4488
4637
  return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);
4489
4638
  }
@@ -4498,7 +4647,7 @@ var PolygonIdSdk = (function (exports) {
4498
4647
  // this.assertValidity() is done inside of fromHex
4499
4648
  if (len === compressedLen && (head === 0x02 || head === 0x03)) {
4500
4649
  const x = bytesToNumberBE$1(tail);
4501
- if (!isValidFieldElement(x))
4650
+ if (!inRange(x, _1n$8, Fp.ORDER))
4502
4651
  throw new Error('Point is not on curve');
4503
4652
  const y2 = weierstrassEquation(x); // y² = x³ + ax + b
4504
4653
  let y;
@@ -4559,11 +4708,8 @@ var PolygonIdSdk = (function (exports) {
4559
4708
  return new Signature(r, s);
4560
4709
  }
4561
4710
  assertValidity() {
4562
- // can use assertGE here
4563
- if (!isWithinCurveOrder(this.r))
4564
- throw new Error('r must be 0 < r < CURVE.n');
4565
- if (!isWithinCurveOrder(this.s))
4566
- throw new Error('s must be 0 < s < CURVE.n');
4711
+ aInRange('r', this.r, _1n$8, CURVE_ORDER); // r in [1..N]
4712
+ aInRange('s', this.s, _1n$8, CURVE_ORDER); // s in [1..N]
4567
4713
  }
4568
4714
  addRecoveryBit(recovery) {
4569
4715
  return new Signature(this.r, this.s, recovery);
@@ -4706,10 +4852,7 @@ var PolygonIdSdk = (function (exports) {
4706
4852
  * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.
4707
4853
  */
4708
4854
  function int2octets(num) {
4709
- if (typeof num !== 'bigint')
4710
- throw new Error('bigint expected');
4711
- if (!(_0n$6 <= num && num < ORDER_MASK))
4712
- throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
4855
+ aInRange(`num < 2^${CURVE.nBitLength}`, num, _0n$6, ORDER_MASK);
4713
4856
  // works with order, can have different size than numToField!
4714
4857
  return numberToBytesBE$1(num, CURVE.nByteLength);
4715
4858
  }
@@ -4726,6 +4869,7 @@ var PolygonIdSdk = (function (exports) {
4726
4869
  if (lowS == null)
4727
4870
  lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash
4728
4871
  msgHash = ensureBytes$1('msgHash', msgHash);
4872
+ validateSigVerOpts(opts);
4729
4873
  if (prehash)
4730
4874
  msgHash = ensureBytes$1('prehashed msgHash', hash(msgHash));
4731
4875
  // We can't later call bits2octets, since nested bits2int is broken for curves
@@ -4812,6 +4956,7 @@ var PolygonIdSdk = (function (exports) {
4812
4956
  publicKey = ensureBytes$1('publicKey', publicKey);
4813
4957
  if ('strict' in opts)
4814
4958
  throw new Error('options.strict was renamed to lowS');
4959
+ validateSigVerOpts(opts);
4815
4960
  const { lowS, prehash } = opts;
4816
4961
  let _sig = undefined;
4817
4962
  let P;
@@ -4869,81 +5014,6 @@ var PolygonIdSdk = (function (exports) {
4869
5014
  };
4870
5015
  }
4871
5016
 
4872
- // HMAC (RFC 2104)
4873
- let HMAC$1 = class HMAC extends Hash$1 {
4874
- constructor(hash, _key) {
4875
- super();
4876
- this.finished = false;
4877
- this.destroyed = false;
4878
- hash$1(hash);
4879
- const key = toBytes$1(_key);
4880
- this.iHash = hash.create();
4881
- if (typeof this.iHash.update !== 'function')
4882
- throw new Error('Expected instance of class which extends utils.Hash');
4883
- this.blockLen = this.iHash.blockLen;
4884
- this.outputLen = this.iHash.outputLen;
4885
- const blockLen = this.blockLen;
4886
- const pad = new Uint8Array(blockLen);
4887
- // blockLen can be bigger than outputLen
4888
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
4889
- for (let i = 0; i < pad.length; i++)
4890
- pad[i] ^= 0x36;
4891
- this.iHash.update(pad);
4892
- // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
4893
- this.oHash = hash.create();
4894
- // Undo internal XOR && apply outer XOR
4895
- for (let i = 0; i < pad.length; i++)
4896
- pad[i] ^= 0x36 ^ 0x5c;
4897
- this.oHash.update(pad);
4898
- pad.fill(0);
4899
- }
4900
- update(buf) {
4901
- exists$1(this);
4902
- this.iHash.update(buf);
4903
- return this;
4904
- }
4905
- digestInto(out) {
4906
- exists$1(this);
4907
- bytes$1(out, this.outputLen);
4908
- this.finished = true;
4909
- this.iHash.digestInto(out);
4910
- this.oHash.update(out);
4911
- this.oHash.digestInto(out);
4912
- this.destroy();
4913
- }
4914
- digest() {
4915
- const out = new Uint8Array(this.oHash.outputLen);
4916
- this.digestInto(out);
4917
- return out;
4918
- }
4919
- _cloneInto(to) {
4920
- // Create new instance without calling constructor since key already in state and we don't know it.
4921
- to || (to = Object.create(Object.getPrototypeOf(this), {}));
4922
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
4923
- to = to;
4924
- to.finished = finished;
4925
- to.destroyed = destroyed;
4926
- to.blockLen = blockLen;
4927
- to.outputLen = outputLen;
4928
- to.oHash = oHash._cloneInto(to.oHash);
4929
- to.iHash = iHash._cloneInto(to.iHash);
4930
- return to;
4931
- }
4932
- destroy() {
4933
- this.destroyed = true;
4934
- this.oHash.destroy();
4935
- this.iHash.destroy();
4936
- }
4937
- };
4938
- /**
4939
- * HMAC: RFC2104 message authentication code.
4940
- * @param hash - function that would be used e.g. sha256
4941
- * @param key - message key
4942
- * @param message - message data
4943
- */
4944
- const hmac$1 = (hash, key, message) => new HMAC$1(hash, key).update(message).digest();
4945
- hmac$1.create = (hash, key) => new HMAC$1(hash, key);
4946
-
4947
5017
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4948
5018
  // connects noble-curves to noble-hashes
4949
5019
  function getHash$1(hash) {
@@ -4993,6 +5063,9 @@ var PolygonIdSdk = (function (exports) {
4993
5063
  return root;
4994
5064
  }
4995
5065
  const Fp$2 = Field$1(secp256k1P$1, undefined, undefined, { sqrt: sqrtMod$1 });
5066
+ /**
5067
+ * secp256k1 short weierstrass curve and ECDSA signatures over it.
5068
+ */
4996
5069
  const secp256k1$1 = createCurve$1({
4997
5070
  a: BigInt(0), // equation params: a, b
4998
5071
  b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975
@@ -7048,11 +7121,6 @@ var PolygonIdSdk = (function (exports) {
7048
7121
  input = `0${input}`;
7049
7122
  }
7050
7123
 
7051
- if (minLength) {
7052
- const paddedLength = Math.max(input.length, minLength * 2);
7053
- input = input.padStart(paddedLength, '00');
7054
- }
7055
-
7056
7124
  return u8a$2.fromString(input.toLowerCase(), 'base16');
7057
7125
  }
7058
7126
  function decodeBase64url(s) {
@@ -7621,6 +7689,7 @@ var PolygonIdSdk = (function (exports) {
7621
7689
  exports.SupportedCurrencies = void 0;
7622
7690
  (function (SupportedCurrencies) {
7623
7691
  SupportedCurrencies["ETH"] = "ETH";
7692
+ SupportedCurrencies["MATIC"] = "MATIC";
7624
7693
  })(exports.SupportedCurrencies || (exports.SupportedCurrencies = {}));
7625
7694
  /**
7626
7695
  * DisplayMethodType type for display method
@@ -7681,11 +7750,11 @@ var PolygonIdSdk = (function (exports) {
7681
7750
  const notEmpties = ne instanceof Uint8Array ? ne : new Uint8Array(Object.values(ne));
7682
7751
  const siblingsHashes = obj?.mtp?.siblings.map((h) => V$1.fromString(JSON.stringify(h)));
7683
7752
  const allSiblings = Kt$1.buildAllSiblings(obj?.mtp?.depth, notEmpties, siblingsHashes);
7684
- let nodeAux = undefined;
7685
- if (obj.mtp.nodeAux) {
7753
+ let nodeAux = obj.mtp.nodeAux || obj.mtp.node_aux;
7754
+ if (nodeAux) {
7686
7755
  nodeAux = {
7687
- key: V$1.fromString(JSON.stringify(obj.mtp.nodeAux.key)),
7688
- value: V$1.fromString(JSON.stringify(obj.mtp.nodeAux.value))
7756
+ key: V$1.fromString(JSON.stringify(nodeAux.key)),
7757
+ value: V$1.fromString(JSON.stringify(nodeAux.value))
7689
7758
  };
7690
7759
  }
7691
7760
  mtp = new Kt$1({ existence: obj?.mtp.existence, nodeAux: nodeAux, siblings: allSiblings });
@@ -7773,7 +7842,7 @@ var PolygonIdSdk = (function (exports) {
7773
7842
  }
7774
7843
  }
7775
7844
 
7776
- const i=Object.freeze({ERRORS:{CONTEXT_NOT_DEFINED:new Error("error: context not defined on the object"),PARSED_CONTEXT_IS_NULL:new Error("error: parsed context is null"),TERM_IS_NOT_DEFINED:new Error("error: term is not defined"),NO_ID_ATTR:new Error("error: no @id attribute is defined"),CTX_TYP_IS_EMPTY:new Error("error: ctx type is empty"),FIELD_PATH_IS_EMPTY:new Error("error: filed path is empty"),UNEXPECTED_ARR_ELEMENT:new Error("error: unexpected array elements"),INVALID_REFERENCE_TYPE:new Error("error: invalid reference type"),MULTIPLE_PARENTS_FOUND:new Error("error: multiple parents found"),PARENT_NOT_FOUND:new Error("error: parent not found"),GRAPH_NOT_FOUND:new Error("error: graph not found"),QUAD_NOT_FOUND:new Error("error: quad not found"),MT_VALUE_INCORRECT_TYPE:new Error("error: incorrect type")},DEFAULT_GRAPH_NODE_NAME:"@default",DEFAULT_GRAPH_TERM_TYPE:"DefaultGraph",QUADS_FORMAT:"application/n-quads",DIGITS_ONLY_REGEX:/^\d+$/,Q:BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")});class o{constructor(t=$$2){this._hasher=t;}async hash(e){return this._hasher.hash(e)}async hashBytes(e){return this._hasher.hashBytes(e)}prime(){return i.Q}}const a=new o;var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l$1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u$1(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype;}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}});})),r}var c$1={exports:{}};c$1.exports=function(){var e=Math.imul,t=Math.clz32;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r,n=0;n<t.length;n++)(r=t[n]).enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t);}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return !1}}function c(){return c=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&l(i,r.prototype),i},c.apply(null,arguments)}function d(e){return -1!==Function.toString.call(e).indexOf("[native code]")}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){function r(){return c(e,arguments,s(this).constructor)}if(null===e||!d(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r);}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},h(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function m(e){var t=u();return function(){var r,n=s(e);if(t){var i=s(this).constructor;r=Reflect.construct(n,arguments,i);}else r=n.apply(this,arguments);return p(this,r)}}function y(e,t){return g(e)||v(e,t)||w(e,t)||_()}function g(e){if(Array.isArray(e))return e}function v(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e;}finally{try{a||null==r.return||r.return();}finally{if(s)throw i}}return o}}function w(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return "Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=w(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return {s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return {s:function(){r=r.call(e);},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e;},f:function(){try{a||null==r.return||r.return();}finally{if(s)throw o}}}}var T=function(e){var t=Math.abs,i=Math.max,s=Math.floor;function l(e,t){var r;if(n(this,l),(r=u.call(this,e)).sign=t,Object.setPrototypeOf(f(r),l.prototype),e>l.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return r}a(l,e);var u=m(l);return o(l,[{key:"toDebugString",value:function(){var e,t=["BigInt["],r=E(this);try{for(r.s();!(e=r.n()).done;){var n=e.value;t.push((n?(n>>>0).toString(16):n)+", ");}}catch(e){r.e(e);}finally{r.f();}return t.push("]"),t.join("")}},{key:"toString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10;if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(e&e-1)?l.__toStringBasePowerOfTwo(this,e):l.__toStringGeneric(this,e,!1)}},{key:"valueOf",value:function(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:"__copy",value:function(){for(var e=new l(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:"__trim",value:function(){for(var e=this.length,t=this[e-1];0===t;)t=this[--e-1],this.pop();return 0===e&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var e=0;e<this.length;e++)this[e]=0;}},{key:"__clzmsd",value:function(){return l.__clz30(this.__digit(this.length-1))}},{key:"__inplaceMultiplyAdd",value:function(e,t,r){r>this.length&&(r=this.length);for(var n=32767&e,i=e>>>15,o=0,a=t,s=0;s<r;s++){var u=this.__digit(s),c=32767&u,d=u>>>15,h=l.__imul(c,n),f=l.__imul(c,i),p=l.__imul(d,n),m=a+h+o;o=m>>>30,m&=1073741823,o+=(m+=((32767&f)<<15)+((32767&p)<<15))>>>30,a=l.__imul(d,i)+(f>>>15)+(p>>>15),this.__setDigit(s,1073741823&m);}if(0!==o||0!==a)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,r){for(var n,i=0,o=0;o<r;o++)i=(n=this.__halfDigit(t+o)+e.__halfDigit(o)+i)>>>15,this.__setHalfDigit(t+o,32767&n);return i}},{key:"__inplaceSub",value:function(e,t,r){var n=0;if(1&t){t>>=1;for(var i=this.__digit(t),o=32767&i,a=0;a<r-1>>>1;a++){var s=e.__digit(a),l=(i>>>15)-(32767&s)-n;n=1&l>>>15,this.__setDigit(t+a,(32767&l)<<15|32767&o),n=1&(o=(32767&(i=this.__digit(t+a+1)))-(s>>>15)-n)>>>15;}var u=e.__digit(a),c=(i>>>15)-(32767&u)-n;if(n=1&c>>>15,this.__setDigit(t+a,(32767&c)<<15|32767&o),t+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(32767&(i=this.__digit(t+a+1)))-(u>>>15)-n)>>>15,this.__setDigit(t+e.length,1073709056&i|32767&o));}else {t>>=1;for(var d=0;d<e.length-1;d++){var h=this.__digit(t+d),f=e.__digit(d),p=(32767&h)-(32767&f)-n,m=(h>>>15)-(f>>>15)-(n=1&p>>>15);n=1&m>>>15,this.__setDigit(t+d,(32767&m)<<15|32767&p);}var y=this.__digit(t+d),g=e.__digit(d),v=(32767&y)-(32767&g)-n;n=1&v>>>15;var w=0;0==(1&r)&&(n=1&(w=(y>>>15)-(g>>>15)-n)>>>15),this.__setDigit(t+d,(32767&w)<<15|32767&v);}return n}},{key:"__inplaceRightShift",value:function(e){if(0!==e){for(var t,r=this.__digit(0)>>>e,n=this.length-1,i=0;i<n;i++)t=this.__digit(i+1),this.__setDigit(i,1073741823&t<<30-e|r),r=t>>>e;this.__setDigit(n,r);}}},{key:"__digit",value:function(e){return this[e]}},{key:"__unsignedDigit",value:function(e){return this[e]>>>0}},{key:"__setDigit",value:function(e,t){this[e]=0|t;}},{key:"__setDigitGrow",value:function(e,t){this[e]=0|t;}},{key:"__halfDigitLength",value:function(){var e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:"__halfDigit",value:function(e){return 32767&this[e>>>1]>>>15*(1&e)}},{key:"__setHalfDigit",value:function(e,t){var r=e>>>1,n=this.__digit(r),i=1&e?32767&n|t<<15:1073709056&n|32767&t;this.__setDigit(r,i);}}],[{key:"BigInt",value:function(e){var t=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if(l.__isOneDigitInt(e))return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!t(e)||s(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var n=l.__fromString(e);if(null===n)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return n}if("boolean"==typeof e)return !0===e?l.__oneDigit(1,!1):l.__zero();if("object"===r(e)){if(e.constructor===l)return e;var i=l.__toPrimitive(e);return l.BigInt(i)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(e){var t=e.length;if(0===t)return 0;if(1===t){var r=e.__unsignedDigit(0);return e.sign?-r:r}var n=e.__digit(t-1),i=l.__clz30(n),o=30*t-i;if(1024<o)return e.sign?-1/0:1/0;var a=o-1,s=n,u=t-1,c=i+3,d=32===c?0:s<<c;d>>>=12;var h=c-12,f=12<=c?0:s<<20+c,p=20+c;for(0<h&&0<u&&(u--,d|=(s=e.__digit(u))>>>30-h,f=s<<h+2,p=h+2);0<p&&0<u;)u--,s=e.__digit(u),f|=30<=p?s<<p-30:s>>>30-p,p-=30;var m=l.__decideRounding(e,p,u,s);if((1===m||0===m&&1==(1&f))&&0==(f=f+1>>>0)&&0!=++d>>>20&&(d=0,1023<++a))return e.sign?-1/0:1/0;var y=e.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=y|a|d,l.__kBitConversionInts[0]=f,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(e){if(0===e.length)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:"bitwiseNot",value:function(e){return e.sign?l.__absoluteSubOne(e).__trim():l.__absoluteAddOne(e,!0)}},{key:"exponentiate",value:function(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return l.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&t.__digit(0))?l.unaryMinus(e):e;if(1<t.length)throw new RangeError("BigInt too big");var r=t.__unsignedDigit(0);if(1===r)return e;if(r>=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var n=1+(0|r/30),i=new l(n,e.sign&&0!=(1&r));i.__initializeDigits();var o=1<<r%30;return i.__setDigit(n-1,o),i}var a=null,s=e;for(0!=(1&r)&&(a=e),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(e,t){if(0===e.length)return e;if(0===t.length)return t;var r=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&r--;var n=new l(r,e.sign!==t.sign);n.__initializeDigits();for(var i=0;i<e.length;i++)l.__multiplyAccumulate(t,e.__digit(i),n,i);return n.__trim()}},{key:"divide",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(e,t))return l.__zero();var r,n=e.sign!==t.sign,i=t.__unsignedDigit(0);if(1===t.length&&32767>=i){if(1===i)return n===e.sign?e:l.unaryMinus(e);r=l.__absoluteDivSmall(e,i,null);}else r=l.__absoluteDivLarge(e,t,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(e,t))return e;var r=t.__unsignedDigit(0);if(1===t.length&&32767>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(e,r);return 0===n?l.__zero():l.__oneDigit(n,e.sign)}var i=l.__absoluteDivLarge(e,t,!1,!0);return i.sign=e.sign,i.__trim()}},{key:"add",value:function(e,t){var r=e.sign;return r===t.sign?l.__absoluteAdd(e,t,r):0<=l.__absoluteCompare(e,t)?l.__absoluteSub(e,t,r):l.__absoluteSub(t,e,!r)}},{key:"subtract",value:function(e,t){var r=e.sign;return r===t.sign?0<=l.__absoluteCompare(e,t)?l.__absoluteSub(e,t,r):l.__absoluteSub(t,e,!r):l.__absoluteAdd(e,t,r)}},{key:"leftShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?l.__rightShiftByAbsolute(e,t):l.__leftShiftByAbsolute(e,t)}},{key:"signedRightShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?l.__leftShiftByAbsolute(e,t):l.__rightShiftByAbsolute(e,t)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,t){return 0>l.__compareToBigInt(e,t)}},{key:"lessThanOrEqual",value:function(e,t){return 0>=l.__compareToBigInt(e,t)}},{key:"greaterThan",value:function(e,t){return 0<l.__compareToBigInt(e,t)}},{key:"greaterThanOrEqual",value:function(e,t){return 0<=l.__compareToBigInt(e,t)}},{key:"equal",value:function(e,t){if(e.sign!==t.sign)return !1;if(e.length!==t.length)return !1;for(var r=0;r<e.length;r++)if(e.__digit(r)!==t.__digit(r))return !1;return !0}},{key:"notEqual",value:function(e,t){return !l.equal(e,t)}},{key:"bitwiseAnd",value:function(e,t){if(!e.sign&&!t.sign)return l.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var r=i(e.length,t.length)+1,n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return n=l.__absoluteOr(n,o,n),l.__absoluteAddOne(n,!0,n).__trim()}if(e.sign){var a=[t,e];e=a[0],t=a[1];}return l.__absoluteAndNot(e,l.__absoluteSubOne(t)).__trim()}},{key:"bitwiseXor",value:function(e,t){if(!e.sign&&!t.sign)return l.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var r=i(e.length,t.length),n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return l.__absoluteXor(n,o,n).__trim()}var a=i(e.length,t.length)+1;if(e.sign){var s=[t,e];e=s[0],t=s[1];}var u=l.__absoluteSubOne(t,a);return u=l.__absoluteXor(u,e,u),l.__absoluteAddOne(u,!0,u).__trim()}},{key:"bitwiseOr",value:function(e,t){var r=i(e.length,t.length);if(!e.sign&&!t.sign)return l.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return n=l.__absoluteAnd(n,o,n),l.__absoluteAddOne(n,!0,n).__trim()}if(e.sign){var a=[t,e];e=a[0],t=a[1];}var s=l.__absoluteSubOne(t,r);return s=l.__absoluteAndNot(s,e,s),l.__absoluteAddOne(s,!0,s).__trim()}},{key:"asIntN",value:function(e,t){if(0===t.length)return t;if(0>(e=s(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return l.__zero();if(e>=l.__kMaxLengthBits)return t;var r=0|(e+29)/30;if(t.length<r)return t;var n=t.__unsignedDigit(r-1),i=1<<(e-1)%30;if(t.length===r&&n<i)return t;if((n&i)!==i)return l.__truncateToNBits(e,t);if(!t.sign)return l.__truncateAndSubFromPowerOfTwo(e,t,!0);if(0==(n&i-1)){for(var o=r-2;0<=o;o--)if(0!==t.__digit(o))return l.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===r&&n===i?t:l.__truncateToNBits(e,t)}return l.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:"asUintN",value:function(e,t){if(0===t.length)return t;if(0>(e=s(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return l.__zero();if(t.sign){if(e>l.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=l.__kMaxLengthBits)return t;var r=0|(e+29)/30;if(t.length<r)return t;var n=e%30;if(t.length==r){if(0===n)return t;if(0==t.__digit(r-1)>>>n)return t}return l.__truncateToNBits(e,t)}},{key:"ADD",value:function(e,t){if(e=l.__toPrimitive(e),t=l.__toPrimitive(t),"string"==typeof e)return "string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=l.__toNumeric(e),t=l.__toNumeric(t),l.__isBigInt(e)&&l.__isBigInt(t))return l.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,t){return l.__compare(e,t,0)}},{key:"LE",value:function(e,t){return l.__compare(e,t,1)}},{key:"GT",value:function(e,t){return l.__compare(e,t,2)}},{key:"GE",value:function(e,t){return l.__compare(e,t,3)}},{key:"EQ",value:function(e,t){for(;;){if(l.__isBigInt(e))return l.__isBigInt(t)?l.equal(e,t):l.EQ(t,e);if("number"==typeof e){if(l.__isBigInt(t))return l.__equalToNumber(t,e);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("string"==typeof e){if(l.__isBigInt(t))return null!==(e=l.__fromString(e))&&l.equal(e,t);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("boolean"==typeof e){if(l.__isBigInt(t))return l.__equalToNumber(t,+e);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("symbol"===r(e)){if(l.__isBigInt(t))return !1;if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else {if("object"!==r(e))return e==t;if("object"===r(t)&&t.constructor!==l)return e==t;e=l.__toPrimitive(e);}}}},{key:"NE",value:function(e,t){return !l.EQ(e,t)}},{key:"DataViewGetBigInt64",value:function(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return l.asIntN(64,l.DataViewGetBigUint64(e,t,r))}},{key:"DataViewGetBigUint64",value:function(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],n=y(r?[4,0]:[0,4],2),i=n[0],o=n[1],a=e.getUint32(t+i,r),s=e.getUint32(t+o,r),u=new l(3,!1);return u.__setDigit(0,1073741823&s),u.__setDigit(1,(268435455&a)<<2|s>>>30),u.__setDigit(2,a>>>28),u.__trim()}},{key:"DataViewSetBigInt64",value:function(e,t,r){var n=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3];l.DataViewSetBigUint64(e,t,r,n);}},{key:"DataViewSetBigUint64",value:function(e,t,r){var n=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3],i=0,o=0;if(0<(r=l.asUintN(64,r)).length&&(o=r.__digit(0),1<r.length)){var a=r.__digit(1);o|=a<<30,i=a>>>2,2<r.length&&(i|=r.__digit(2)<<28);}var s=y(n?[4,0]:[0,4],2),u=s[0],c=s[1];e.setUint32(t+u,i,n),e.setUint32(t+c,o,n);}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(e,t){var r=new l(1,t);return r.__setDigit(0,e),r}},{key:"__decideRounding",value:function(e,t,r,n){if(0<t)return -1;var i;if(0>t)i=-t-1;else {if(0===r)return -1;r--,n=e.__digit(r),i=29;}var o=1<<i;if(0==(n&o))return -1;if(0!=(n&(o-=1)))return 1;for(;0<r;)if(r--,0!==e.__digit(r))return 1;return 0}},{key:"__fromDouble",value:function(e){l.__kBitConversionDouble[0]=e;var t,r=(2047&l.__kBitConversionInts[1]>>>20)-1023,n=1+(0|r/30),i=new l(n,0>e),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=r%30,c=0;if(u<s){var d=s-u;c=d+32,t=o>>>d,o=o<<32-d|a>>>d,a<<=32-d;}else if(u===s)c=32,t=o,o=a,a=0;else {var h=u-s;c=32-h,t=o<<h|a>>>32-h,o=a<<h,a=0;}i.__setDigit(n-1,t);for(var f=n-2;0<=f;f--)0<c?(c-=30,t=o>>>2,o=o<<30|a>>>2,a<<=30):t=0,i.__setDigit(f,t);return i.__trim()}},{key:"__isWhitespace",value:function(e){return !!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}},{key:"__fromString",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0,n=e.length,i=0;if(i===n)return l.__zero();for(var o=e.charCodeAt(i);l.__isWhitespace(o);){if(++i===n)return l.__zero();o=e.charCodeAt(i);}if(43===o){if(++i===n)return null;o=e.charCodeAt(i),r=1;}else if(45===o){if(++i===n)return null;o=e.charCodeAt(i),r=-1;}if(0===t){if(t=10,48===o){if(++i===n)return l.__zero();if(88===(o=e.charCodeAt(i))||120===o){if(t=16,++i===n)return null;o=e.charCodeAt(i);}else if(79===o||111===o){if(t=8,++i===n)return null;o=e.charCodeAt(i);}else if(66===o||98===o){if(t=2,++i===n)return null;o=e.charCodeAt(i);}}}else if(16===t&&48===o){if(++i===n)return l.__zero();if(88===(o=e.charCodeAt(i))||120===o){if(++i===n)return null;o=e.charCodeAt(i);}}if(0!==r&&10!==t)return null;for(;48===o;){if(++i===n)return l.__zero();o=e.charCodeAt(i);}var a=n-i,s=l.__kMaxBitsPerChar[t],u=l.__kBitsPerCharTableMultiplier-1;if(a>1073741824/s)return null;var c=new l(0|(29+(s*a+u>>>l.__kBitsPerCharTableShift))/30,!1),d=10>t?t:10,h=10<t?t-10:0;if(0==(t&t-1)){s>>=l.__kBitsPerCharTableShift;var f=[],p=[],m=!1;do{for(var y,g=0,v=0;;){if(y=void 0,o-48>>>0<d)y=o-48;else {if(!((32|o)-97>>>0<h)){m=!0;break}y=(32|o)-87;}if(v+=s,g=g<<s|y,++i===n){m=!0;break}if(o=e.charCodeAt(i),30<v+s)break}f.push(g),p.push(v);}while(!m);l.__fillFromParts(c,f,p);}else {c.__initializeDigits();var w=!1,b=0;do{for(var _,E=0,T=1;;){if(_=void 0,o-48>>>0<d)_=o-48;else {if(!((32|o)-97>>>0<h)){w=!0;break}_=(32|o)-87;}var x=T*t;if(1073741823<x)break;if(T=x,E=E*t+_,b++,++i===n){w=!0;break}o=e.charCodeAt(i);}var I=0|(s*b+(u=30*l.__kBitsPerCharTableMultiplier-1)>>>l.__kBitsPerCharTableShift)/30;c.__inplaceMultiplyAdd(T,E,I);}while(!w)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i<n;i++)if(o=e.charCodeAt(i),!l.__isWhitespace(o))return null}return c.sign=-1===r,c.__trim()}},{key:"__fillFromParts",value:function(e,t,r){for(var n=0,i=0,o=0,a=t.length-1;0<=a;a--){var s=t[a],l=r[a];i|=s<<o,30===(o+=l)?(e.__setDigit(n++,i),o=0,i=0):30<o&&(e.__setDigit(n++,1073741823&i),i=s>>>l-(o-=30));}if(0!==i){if(n>=e.length)throw new Error("implementation bug");e.__setDigit(n++,i);}for(;n<e.length;n++)e.__setDigit(n,0);}},{key:"__toStringBasePowerOfTwo",value:function(e,t){var r=e.length,n=t-1,i=n=(15&(n=(51&(n=(85&n>>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=t-1,a=e.__digit(r-1),s=0|(30*r-l.__clz30(a)+i-1)/i;if(e.sign&&s++,268435456<s)throw new Error("string too long");for(var u=Array(s),c=s-1,d=0,h=0,f=0;f<r-1;f++){var p=e.__digit(f),m=(d|p<<h)&o;u[c--]=l.__kConversionChars[m];var y=i-h;for(d=p>>>y,h=30-y;h>=i;)u[c--]=l.__kConversionChars[d&o],d>>>=i,h-=i;}var g=(d|a<<h)&o;for(u[c--]=l.__kConversionChars[g],d=a>>>i-h;0!==d;)u[c--]=l.__kConversionChars[d&o],d>>>=i;if(e.sign&&(u[c--]="-"),-1!==c)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(e,t,r){var n=e.length;if(0===n)return "";if(1===n){var i=e.__unsignedDigit(0).toString(t);return !1===r&&e.sign&&(i="-"+i),i}var o,a,s=30*n-l.__clz30(e.__digit(n-1)),u=l.__kMaxBitsPerChar[t]-1,c=s*l.__kBitsPerCharTableMultiplier,d=1+(c=0|(c+=u-1)/u)>>1,h=l.exponentiate(l.__oneDigit(t,!1),l.__oneDigit(d,!1)),f=h.__unsignedDigit(0);if(1===h.length&&32767>=f){(o=new l(e.length,!1)).__initializeDigits();for(var p,m=0,y=2*e.length-1;0<=y;y--)p=m<<15|e.__halfDigit(y),o.__setHalfDigit(y,0|p/f),m=0|p%f;a=m.toString(t);}else {var g=l.__absoluteDivLarge(e,h,!0,!0);o=g.quotient;var v=g.remainder.__trim();a=l.__toStringGeneric(v,t,!0);}o.__trim();for(var w=l.__toStringGeneric(o,t,!0);a.length<d;)a="0"+a;return !1===r&&e.sign&&(w="-"+w),w+a}},{key:"__unequalSign",value:function(e){return e?-1:1}},{key:"__absoluteGreater",value:function(e){return e?-1:1}},{key:"__absoluteLess",value:function(e){return e?1:-1}},{key:"__compareToBigInt",value:function(e,t){var r=e.sign;if(r!==t.sign)return l.__unequalSign(r);var n=l.__absoluteCompare(e,t);return 0<n?l.__absoluteGreater(r):0>n?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(e,r){if(l.__isOneDigitInt(r)){var n=e.sign,i=0>r;if(n!==i)return l.__unequalSign(n);if(0===e.length){if(i)throw new Error("implementation bug");return 0===r?0:-1}if(1<e.length)return l.__absoluteGreater(n);var o=t(r),a=e.__unsignedDigit(0);return a>o?l.__absoluteGreater(n):a<o?l.__absoluteLess(n):0}return l.__compareToDouble(e,r)}},{key:"__compareToDouble",value:function(e,t){if(t!=t)return t;if(t===1/0)return -1;if(t===-1/0)return 1;var r=e.sign;if(r!==0>t)return l.__unequalSign(r);if(0===t)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return -1;l.__kBitConversionDouble[0]=t;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=e.length,a=e.__digit(o-1),s=l.__clz30(a),u=30*o-s,c=i+1;if(u<c)return l.__absoluteLess(r);if(u>c)return l.__absoluteGreater(r);var d=1048576|1048575&l.__kBitConversionInts[1],h=l.__kBitConversionInts[0],f=20,p=29-s;if(p!==(0|(u-1)%30))throw new Error("implementation bug");var m,y=0;if(p<f){var g=f-p;y=g+32,m=d>>>g,d=d<<32-g|h>>>g,h<<=32-g;}else if(p===f)y=32,m=d,d=h,h=0;else {var v=p-f;y=32-v,m=d<<v|h>>>32-v,d=h<<v,h=0;}if((a>>>=0)>(m>>>=0))return l.__absoluteGreater(r);if(a<m)return l.__absoluteLess(r);for(var w=o-2;0<=w;w--){0<y?(y-=30,m=d>>>2,d=d<<30|h>>>2,h<<=30):m=0;var b=e.__unsignedDigit(w);if(b>m)return l.__absoluteGreater(r);if(b<m)return l.__absoluteLess(r)}if(0!==d||0!==h){if(0===y)throw new Error("implementation bug");return l.__absoluteLess(r)}return 0}},{key:"__equalToNumber",value:function(e,r){return l.__isOneDigitInt(r)?0===r?0===e.length:1===e.length&&e.sign===0>r&&e.__unsignedDigit(0)===t(r):0===l.__compareToDouble(e,r)}},{key:"__comparisonResultToBool",value:function(e,t){return 0===t?0>e:1===t?0>=e:2===t?0<e:3===t?0<=e:void 0}},{key:"__compare",value:function(e,t,r){if(e=l.__toPrimitive(e),t=l.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(r){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(l.__isBigInt(e)&&"string"==typeof t)return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if("string"==typeof e&&l.__isBigInt(t))return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if(e=l.__toNumeric(e),t=l.__toNumeric(t),l.__isBigInt(e)){if(l.__isBigInt(t))return l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if("number"!=typeof t)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(e,t),r)}if("number"!=typeof e)throw new Error("implementation bug");if(l.__isBigInt(t))return l.__comparisonResultToBool(l.__compareToNumber(t,e),2^r);if("number"!=typeof t)throw new Error("implementation bug");return 0===r?e<t:1===r?e<=t:2===r?e>t:3===r?e>=t:void 0}},{key:"__absoluteAdd",value:function(e,t,r){if(e.length<t.length)return l.__absoluteAdd(t,e,r);if(0===e.length)return e;if(0===t.length)return e.sign===r?e:l.unaryMinus(e);var n=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&n++;for(var i,o=new l(n,r),a=0,s=0;s<t.length;s++)a=(i=e.__digit(s)+t.__digit(s)+a)>>>30,o.__setDigit(s,1073741823&i);for(;s<e.length;s++){var u=e.__digit(s)+a;a=u>>>30,o.__setDigit(s,1073741823&u);}return s<o.length&&o.__setDigit(s,a),o.__trim()}},{key:"__absoluteSub",value:function(e,t,r){if(0===e.length)return e;if(0===t.length)return e.sign===r?e:l.unaryMinus(e);for(var n,i=new l(e.length,r),o=0,a=0;a<t.length;a++)o=1&(n=e.__digit(a)-t.__digit(a)-o)>>>30,i.__setDigit(a,1073741823&n);for(;a<e.length;a++){var s=e.__digit(a)-o;o=1&s>>>30,i.__setDigit(a,1073741823&s);}return i.__trim()}},{key:"__absoluteAddOne",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length;null===r?r=new l(n,t):r.sign=t;for(var i,o=1,a=0;a<n;a++)o=(i=e.__digit(a)+o)>>>30,r.__setDigit(a,1073741823&i);return 0!==o&&r.__setDigitGrow(n,1),r}},{key:"__absoluteSubOne",value:function(e,t){for(var r,n=e.length,i=new l(t=t||n,!1),o=1,a=0;a<n;a++)o=1&(r=e.__digit(a)-o)>>>30,i.__setDigit(a,1073741823&r);if(0!==o)throw new Error("implementation bug");for(var s=n;s<t;s++)i.__setDigit(s,0);return i}},{key:"__absoluteAnd",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=o;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)&t.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteAndNot",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;n<i&&(o=n);var a=n;null===r?r=new l(a,!1):a=r.length;for(var s=0;s<o;s++)r.__setDigit(s,e.__digit(s)&~t.__digit(s));for(;s<n;s++)r.__setDigit(s,e.__digit(s));for(;s<a;s++)r.__setDigit(s,0);return r}},{key:"__absoluteOr",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=n;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)|t.__digit(c));for(;c<n;c++)r.__setDigit(c,e.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteXor",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=n;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)^t.__digit(c));for(;c<n;c++)r.__setDigit(c,e.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteCompare",value:function(e,t){var r=e.length-t.length;if(0!=r)return r;for(var n=e.length-1;0<=n&&e.__digit(n)===t.__digit(n);)n--;return 0>n?0:e.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(e,t,r,n){if(0!==t){for(var i=32767&t,o=t>>>15,a=0,s=0,u=0;u<e.length;u++,n++){var c=r.__digit(n),d=e.__digit(u),h=32767&d,f=d>>>15,p=l.__imul(h,i),m=l.__imul(h,o),y=l.__imul(f,i);a=(c+=s+p+a)>>>30,c&=1073741823,a+=(c+=((32767&m)<<15)+((32767&y)<<15))>>>30,s=l.__imul(f,o)+(m>>>15)+(y>>>15),r.__setDigit(n,1073741823&c);}for(;0!==a||0!==s;n++){var g=r.__digit(n);g+=a+s,s=0,a=g>>>30,r.__setDigit(n,1073741823&g);}}}},{key:"__internalMultiplyAdd",value:function(e,t,r,n,i){for(var o=r,a=0,s=0;s<n;s++){var u=e.__digit(s),c=l.__imul(32767&u,t),d=l.__imul(u>>>15,t),h=c+((32767&d)<<15)+a+o;o=h>>>30,a=d>>>15,i.__setDigit(s,1073741823&h);}if(i.length>n)for(i.__setDigit(n++,o+a);n<i.length;)i.__setDigit(n++,0);else if(0!==o+a)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;null===r&&(r=new l(e.length,!1));for(var n=0,i=2*e.length-1;0<=i;i-=2){var o=(n<<15|e.__halfDigit(i))>>>0,a=0|o/t,s=0|(o=((n=0|o%t)<<15|e.__halfDigit(i-1))>>>0)/t;n=0|o%t,r.__setDigit(i>>>1,a<<15|s);}return r}},{key:"__absoluteModSmall",value:function(e,t){for(var r=0,n=2*e.length-1;0<=n;n--)r=0|((r<<15|e.__halfDigit(n))>>>0)%t;return r}},{key:"__absoluteDivLarge",value:function(e,t,r,n){var i=t.__halfDigitLength(),o=t.length,a=e.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var u=new l(i+2>>>1,!1);u.__initializeDigits();var c=l.__clz15(t.__halfDigit(i-1));0<c&&(t=l.__specialLeftShift(t,c,0));for(var d=l.__specialLeftShift(e,c,1),h=t.__halfDigit(i-1),f=0,p=a;0<=p;p--){var m=32767,y=d.__halfDigit(p+i);if(y!==h){var g=(y<<15|d.__halfDigit(p+i-1))>>>0;m=0|g/h;for(var v=0|g%h,w=t.__halfDigit(i-2),b=d.__halfDigit(p+i-2);l.__imul(m,w)>>>0>(v<<16|b)>>>0&&(m--,!(32767<(v+=h))););}l.__internalMultiplyAdd(t,m,0,o,u);var _=d.__inplaceSub(u,p,i+1);0!==_&&(_=d.__inplaceAdd(t,p,i),d.__setHalfDigit(p+i,32767&d.__halfDigit(p+i)+_),m--),r&&(1&p?f=m<<15:s.__setDigit(p>>>1,f|m));}if(n)return d.__inplaceRightShift(c),r?{quotient:s,remainder:d}:d;if(r)return s;throw new Error("unreachable")}},{key:"__clz15",value:function(e){return l.__clz30(e)-15}},{key:"__specialLeftShift",value:function(e,t,r){var n=e.length,i=new l(n+r,!1);if(0===t){for(var o=0;o<n;o++)i.__setDigit(o,e.__digit(o));return 0<r&&i.__setDigit(n,0),i}for(var a,s=0,u=0;u<n;u++)a=e.__digit(u),i.__setDigit(u,1073741823&a<<t|s),s=a>>>30-t;return 0<r&&i.__setDigit(n,s),i}},{key:"__leftShiftByAbsolute",value:function(e,t){var r=l.__toShiftAmount(t);if(0>r)throw new RangeError("BigInt too big");var n=0|r/30,i=r%30,o=e.length,a=0!==i&&0!=e.__digit(o-1)>>>30-i,s=o+n+(a?1:0),u=new l(s,e.sign);if(0===i){for(var c=0;c<n;c++)u.__setDigit(c,0);for(;c<s;c++)u.__setDigit(c,e.__digit(c-n));}else {for(var d=0,h=0;h<n;h++)u.__setDigit(h,0);for(var f,p=0;p<o;p++)f=e.__digit(p),u.__setDigit(p+n,1073741823&f<<i|d),d=f>>>30-i;if(a)u.__setDigit(o+n,d);else if(0!==d)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(e,t){var r=e.length,n=e.sign,i=l.__toShiftAmount(t);if(0>i)return l.__rightShiftByMaximum(n);var o=0|i/30,a=i%30,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(e.__digit(o)&(1<<a)-1))u=!0;else for(var c=0;c<o;c++)if(0!==e.__digit(c)){u=!0;break}u&&0===a&&0==~e.__digit(r-1)&&s++;var d=new l(s,n);if(0===a){d.__setDigit(s-1,0);for(var h=o;h<r;h++)d.__setDigit(h-o,e.__digit(h));}else {for(var f,p=e.__digit(o)>>>a,m=r-o-1,y=0;y<m;y++)f=e.__digit(y+o+1),d.__setDigit(y,1073741823&f<<30-a|p),p=f>>>a;d.__setDigit(m,p);}return u&&(d=l.__absoluteAddOne(d,!0,d)),d.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(e){if(1<e.length)return -1;var t=e.__unsignedDigit(0);return t>l.__kMaxLengthBits?-1:t}},{key:"__toPrimitive",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==r(e))return e;if(e.constructor===l)return e;if("undefined"!=typeof Symbol&&"symbol"===r(Symbol.toPrimitive)){var n=e[Symbol.toPrimitive];if(n){var i=n(t);if("object"!==r(i))return i;throw new TypeError("Cannot convert object to primitive value")}}var o=e.valueOf;if(o){var a=o.call(e);if("object"!==r(a))return a}var s=e.toString;if(s){var u=s.call(e);if("object"!==r(u))return u}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(e){return l.__isBigInt(e)?e:+e}},{key:"__isBigInt",value:function(e){return "object"===r(e)&&null!==e&&e.constructor===l}},{key:"__truncateToNBits",value:function(e,t){for(var r=0|(e+29)/30,n=new l(r,t.sign),i=r-1,o=0;o<i;o++)n.__setDigit(o,t.__digit(o));var a=t.__digit(i);if(0!=e%30){var s=32-e%30;a=a<<s>>>s;}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(e,t,r){for(var n,i=Math.min,o=0|(e+29)/30,a=new l(o,r),s=0,u=o-1,c=0,d=i(u,t.length);s<d;s++)c=1&(n=0-t.__digit(s)-c)>>>30,a.__setDigit(s,1073741823&n);for(;s<u;s++)a.__setDigit(s,0|1073741823&-c);var h,f=u<t.length?t.__digit(u):0,p=e%30;if(0===p)h=0-f-c,h&=1073741823;else {var m=32-p,y=1<<32-m;h=y-(f=f<<m>>>m)-c,h&=y-1;}return a.__setDigit(u,h),a.__trim()}},{key:"__digitPow",value:function(e,t){for(var r=1;0<t;)1&t&&(r*=e),t>>>=1,e*=e;return r}},{key:"__isOneDigitInt",value:function(e){return (1073741823&e)===e}}]),l}(h(Array));return T.__kMaxLength=33554432,T.__kMaxLengthBits=T.__kMaxLength<<5,T.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],T.__kBitsPerCharTableShift=5,T.__kBitsPerCharTableMultiplier=1<<T.__kBitsPerCharTableShift,T.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],T.__kBitConversionBuffer=new ArrayBuffer(8),T.__kBitConversionDouble=new Float64Array(T.__kBitConversionBuffer),T.__kBitConversionInts=new Int32Array(T.__kBitConversionBuffer),T.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,r=Math.log;return 0===e?30:0|29-(0|r(e>>>0)/t)},T.__imul=e||function(e,t){return 0|e*t},T}();var d$1=l$1(c$1.exports);const h$1={};function f$2(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});for(const t of Object.getOwnPropertyNames(e)){const r=Object.getOwnPropertyDescriptor(e,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e,t,r));}for(const t of Object.getOwnPropertyNames(e.prototype)){const r=Object.getOwnPropertyDescriptor(e.prototype,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e.prototype,t,r));}p$1(t,e),p$1(`${t}.prototype`,e.prototype);}function p$1(e,t){const r=`%${e}%`;if(void 0!==h$1[r])throw new Error(`intrinsic ${e} already exists`);h$1[r]=t;}function m$1(e){return h$1[e]}var y$1,g$1;const v$1="slot-epochNanoSeconds",w$1="slot-timezone-identifier",b$2="slot-year",_="slot-month",E$1="slot-day",T$1="slot-hour",x$1="slot-minute",I$1="slot-second",S$1="slot-millisecond",R="slot-microsecond",k="slot-nanosecond",j="slot-calendar",D="slot-date-brand",N="slot-year-month-brand",O="slot-month-day-brand",C$1="slot-cached-instant",A$1="slot-time-zone",M$1="slot-years",L="slot-months",P="slot-weeks",B$1="slot-days",$="slot-hours",F="slot-minutes",U="slot-seconds",q="slot-milliseconds",Y="slot-microseconds",W$1="slot-nanoseconds",z$1="slot-calendar-identifier",G=new WeakMap,H=Symbol.for("@@Temporal__GetSlots");(y$1=globalThis)[H]||(y$1[H]=function(e){return G.get(e)});const J=globalThis[H],V=Symbol.for("@@Temporal__CreateSlots");(g$1=globalThis)[V]||(g$1[V]=function(e){G.set(e,Object.create(null));});const Q=globalThis[V];function Z(e,...t){if(!e||"object"!=typeof e)return !1;const r=J(e);return !!r&&t.every((e=>e in r))}function K(e,t){const r=J(e)?.[t];if(void 0===r)throw new TypeError(`Missing internal slot ${t}`);return r}function X(e,t,r){const n=J(e);if(void 0===n)throw new TypeError("Missing slots for the given container");if(n[t])throw new TypeError(`${t} already has set`);n[t]=r;}const ee=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,te=new RegExp("(?:"+[`(?:${ee.source})(?:\\/(?:${ee.source}))*`,"Etc/GMT(?:0|[-+]\\d{1,2})","GMT[-+]?0","EST5EDT","CST6CDT","MST7MDT","PST8PDT",/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source].join("|")+")"),re=/(?:[+\u2212-]\d{6}|\d{4})/,ne=/(?:0[1-9]|1[0-2])/,ie=/(?:0[1-9]|[12]\d|3[01])/,oe=new RegExp(`(${re.source})(?:-(${ne.source})-(${ie.source})|(${ne.source})(${ie.source}))`),ae=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,se=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,le=new RegExp(`([zZ])|${se.source}?`),ue=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,ce=new RegExp([`^${oe.source}`,`(?:(?:T|\\s+)${ae.source}(?:${le.source})?)?`,`(?:\\[!?(${te.source})\\])?`,`((?:${ue.source})*)$`].join(""),"i"),de=new RegExp([`^T?${ae.source}`,`(?:${le.source})?`,`(?:\\[!?${te.source}\\])?`,`((?:${ue.source})*)$`].join(""),"i"),he=new RegExp(`^(${re.source})-?(${ne.source})(?:\\[!?${te.source}\\])?((?:${ue.source})*)$`),fe=new RegExp(`^(?:--)?(${ne.source})-?(${ie.source})(?:\\[!?${te.source}\\])?((?:${ue.source})*)$`),pe=/(\d+)(?:[.,](\d{1,9}))?/,me=new RegExp(`(?:${pe.source}H)?(?:${pe.source}M)?(?:${pe.source}S)?`),ye=new RegExp(`^([+−-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${me.source})?$`,"i"),ge=Array.prototype.includes,ve=Array.prototype.push,we=globalThis.Intl.DateTimeFormat,be=Math.min,_e=Math.max,Ee=Math.abs,Te=Math.floor,xe=Math.sign,Ie=Math.trunc,Se=Number.isNaN,Re=Number.isFinite,ke=Number,je=String,De=Number.MAX_SAFE_INTEGER,Ne=Object.create,Oe=Object.getOwnPropertyDescriptor,Ce=Reflect.apply,Ae=Reflect.ownKeys,Me=d$1.BigInt(0),Le=d$1.BigInt(1),Pe=d$1.BigInt(60),Be=d$1.BigInt(24),$e=d$1.BigInt(1e3),Fe=d$1.BigInt(1e6),Ue=d$1.BigInt(1e9),qe=d$1.BigInt(-1),Ye=d$1.multiply(d$1.BigInt(3600),Ue),We=d$1.multiply(Pe,Ue),ze=d$1.multiply(Ye,Be),Ge=d$1.multiply(d$1.BigInt(-86400),d$1.BigInt(1e17)),He=d$1.multiply(d$1.BigInt(86400),d$1.BigInt(1e17)),Je=-271821,Ve=275760,Qe=d$1.multiply(d$1.BigInt(-388152),d$1.BigInt(1e13)),Ze=d$1.multiply(ze,d$1.BigInt(3660)),Ke=d$1.multiply(ze,d$1.BigInt(366)),Xe=d$1.multiply(ze,d$1.BigInt(14)),et=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function tt(e){return d$1.equal(e,Me)}function rt(e,t){const r=e[t];if(void 0!==r)return r}function nt(e,t,r){return Ce(e,t,arguments.length>2?r:[])}function it(e){return "object"==typeof e&&null!==e||"function"==typeof e}function ot(e){if("bigint"==typeof e)throw new TypeError("Cannot convert BigInt to number");return ke(e)}function at(e){const t=ot(e);if(Se(t)||0===t)return 0;if(!Re(t))return t;const r=Te(Ee(t));return 0===r?0:xe(t)*r}function st(e){if("number"!=typeof e||Se(e)||!Re(e))return !1;const t=Ee(e);return Te(t)===t}function lt$1(e){if("symbol"==typeof e)throw new TypeError("Cannot convert a Symbol value to a String");return je(e)}function ut$1(e){const t=ot(e);if(0===t)return 0;if(Se(t)||!Re(t))throw new RangeError("invalid number value");const r=Ie(t);return 0===r?0:r}function ct(e,t){const r=ut$1(e);if(r<=0){if(void 0!==t)throw new RangeError(`property '${t}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return r}function dt(e){const t=ot(e);if(!Re(t))throw new RangeError("infinity is out of range");if(!st(t))throw new RangeError(`unsupported fractional value ${e}`);return 0===t?0:t}function ht(e,t){return {quotient:d$1.divide(e,t),remainder:d$1.remainder(e,t)}}function ft(e){return d$1.lessThan(e,Me)}function pt(e){return tt(e)?0:ft(e)?-1:1}function mt(e){return d$1.lessThan(e,Me)?d$1.multiply(e,qe):e}const yt=new Map([["year",ut$1],["month",ct],["monthCode",lt$1],["day",ct],["hour",ut$1],["minute",ut$1],["second",ut$1],["millisecond",ut$1],["microsecond",ut$1],["nanosecond",ut$1],["years",dt],["months",dt],["weeks",dt],["days",dt],["hours",dt],["minutes",dt],["seconds",dt],["milliseconds",dt],["microseconds",dt],["nanoseconds",dt],["era",lt$1],["eraYear",at],["offset",lt$1]]),gt$1=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),vt=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],wt=new Map(vt.map((e=>[e[0],e[1]]))),bt=new Map(vt.map((([e,t])=>[t,e]))),_t=vt.map((([,e])=>e)),Et=Array.from(wt.keys()).sort(),Tt=new Map;function xt(e){let t=Tt.get(e);return void 0===t&&(t=new we("en-us",{timeZone:je(e),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Tt.set(e,t)),t}function It(e){if(null==e)throw new TypeError(`Expected object not ${e}`);return Object(e)}function St(e,t,r,n){if(null==t)return;const i=Ae(t);for(const o of i)if(!r.some((e=>Object.is(e,o)))&&Object.prototype.propertyIsEnumerable.call(t,o)){const r=t[o];if(n&&n.some((e=>Object.is(e,r))))continue;e[o]=r;}}function Rt(e){return Z(e,v$1)&&!Z(e,A$1,j)}function kt(e){return Z(e,w$1)}function jt(e){return Z(e,z$1)}function Dt(e){return Z(e,M$1,L,B$1,$,F,U,q,Y,W$1)}function Nt(e){return Z(e,D)}function Ot(e){return Z(e,T$1,x$1,I$1,S$1,R,k)&&!Z(e,b$2,_,E$1)}function Ct(e){return Z(e,b$2,_,E$1,T$1,x$1,I$1,S$1,R,k)}function At(e){return Z(e,N)}function Mt(e){return Z(e,O)}function Lt(e){return Z(e,v$1,A$1,j)}function Pt(e){if(Z(e,j)||Z(e,A$1))throw new TypeError("with() does not support a calendar or timeZone property");if(Ot(e))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if(void 0!==e.calendar)throw new TypeError("with() does not support a calendar property");if(void 0!==e.timeZone)throw new TypeError("with() does not support a timeZone property")}function Bt(e,t){return "never"===t?"":$t(Vr(e),t)}function $t(e,t){return "never"===t||"auto"===t&&"iso8601"===e?"":`[${"critical"===t?"!":""}u-ca=${e}]`}function Ft(e){const t=ce.exec(e);if(!t)throw new RangeError(`invalid ISO 8601 string: ${e}`);let r=t[1];if("−"===r[0]&&(r=`-${r.slice(1)}`),"-000000"===r)throw new RangeError(`invalid ISO 8601 string: ${e}`);const n=at(r),i=at(t[2]||t[4]),o=at(t[3]||t[5]),a=at(t[6]),s=void 0!==t[6],l=at(t[7]||t[10]);let u=at(t[8]||t[11]);60===u&&(u=59);const c=(t[9]||t[12])+"000000000",d=at(c.slice(0,3)),h=at(c.slice(3,6)),f=at(c.slice(6,9));let p,m=!1;if(t[13])p=void 0,m=!0;else if(t[14]&&t[15]){const e="-"===t[14]||"−"===t[14]?"-":"+",r=t[15]||"00",n=t[16]||"00",i=t[17]||"00";let o=t[18]||"0";if(p=`${e}${r}:${n}`,+o){for(;o.endsWith("0");)o=o.slice(0,-1);p+=`:${i}.${o}`;}else +i&&(p+=`:${i}`);"-00:00"===p&&(p="+00:00");}const y=t[19],g=t[20];let v;for(const[,e,t,r]of g.matchAll(ue))if("u-ca"===t)void 0===v&&(v=r);else if("!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);return li(n,i,o,a,l,u,d,h,f),{year:n,month:i,day:o,hasTime:s,hour:a,minute:l,second:u,millisecond:d,microsecond:h,nanosecond:f,ianaName:y,offset:p,z:m,calendar:v}}function Ut(e){const t=he.exec(e);let r,n,i,o;if(t){let o=t[1];if("−"===o[0]&&(o=`-${o.slice(1)}`),"-000000"===o)throw new RangeError(`invalid ISO 8601 string: ${e}`);r=at(o),n=at(t[2]);const a=t[3];for(const[,e,t,r]of a.matchAll(ue))if("u-ca"===t)void 0===i&&(i=r);else if("!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);if(void 0!==i&&"iso8601"!==i)throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else {let t;if(({year:r,month:n,calendar:i,day:o,z:t}=Ft(e)),t)throw new RangeError("Z designator not supported for PlainYearMonth")}return {year:r,month:n,calendar:i,referenceISODay:o}}function qt(e){const t=fe.exec(e);let r,n,i,o;if(t){r=at(t[1]),n=at(t[2]);const e=t[3];for(const[,t,r,n]of e.matchAll(ue))if("u-ca"===r)void 0===i&&(i=n);else if("!"===t)throw new RangeError(`Unrecognized annotation: !${r}=${n}`);if(void 0!==i&&"iso8601"!==i)throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else {let t;if(({month:r,day:n,calendar:i,year:o,z:t}=Ft(e)),t)throw new RangeError("Z designator not supported for PlainMonthDay")}return {month:r,day:n,calendar:i,referenceISOYear:o}}function Yt(e,t,r,n){let i=e,o=t,a=r;switch(n){case"reject":oi(i,o,a);break;case"constrain":({year:i,month:o,day:a}=ni(i,o,a));}return {year:i,month:o,day:a}}function Wt(e,t,r,n,i,o,a){let s=e,l=t,u=r,c=n,d=i,h=o;switch(a){case"reject":si(s,l,u,c,d,h);break;case"constrain":({hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}=function(e,t,r,n,i,o){return {hour:ri(e,0,23),minute:ri(t,0,59),second:ri(r,0,59),millisecond:ri(n,0,999),microsecond:ri(i,0,999),nanosecond:ri(o,0,999)}}(s,l,u,c,d,h));}return {hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}}function zt(e){if(!it(e))return function(e){const t=ye.exec(e);if(!t)throw new RangeError(`invalid duration: ${e}`);if(t.slice(2).every((e=>void 0===e)))throw new RangeError(`invalid duration: ${e}`);const r="-"===t[1]||"−"===t[1]?-1:1,n=void 0===t[2]?0:ut$1(t[2])*r,i=void 0===t[3]?0:ut$1(t[3])*r,o=void 0===t[4]?0:ut$1(t[4])*r,a=void 0===t[5]?0:ut$1(t[5])*r,s=void 0===t[6]?0:ut$1(t[6])*r,l=t[7],u=t[8],c=t[9],d=t[10],h=t[11];let f=0,p=0,m=0;if(void 0!==l){if(u??c??d??h)throw new RangeError("only the smallest unit can be fractional");m=3600*at((l+"000000000").slice(0,9))*r;}else if(f=void 0===u?0:ut$1(u)*r,void 0!==c){if(d??h)throw new RangeError("only the smallest unit can be fractional");m=60*at((c+"000000000").slice(0,9))*r;}else p=void 0===d?0:ut$1(d)*r,void 0!==h&&(m=at((h+"000000000").slice(0,9))*r);const y=m%1e3,g=Ie(m/1e3)%1e3,v=Ie(m/1e6)%1e3;return p+=Ie(m/1e9)%60,f+=Ie(m/6e10),di(n,i,o,a,s,f,p,v,g,y),{years:n,months:i,weeks:o,days:a,hours:s,minutes:f,seconds:p,milliseconds:v,microseconds:g,nanoseconds:y}}(lt$1(e));if(Dt(e))return {years:K(e,M$1),months:K(e,L),weeks:K(e,P),days:K(e,B$1),hours:K(e,$),minutes:K(e,F),seconds:K(e,U),milliseconds:K(e,q),microseconds:K(e,Y),nanoseconds:K(e,W$1)};const t={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};let r=function(e){if(!it(e))throw new TypeError("invalid duration-like");const t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0};let r=!1;for(const n of Et){const i=e[n];void 0!==i&&(r=!0,t[n]=dt(i));}if(!r)throw new TypeError("invalid duration-like");return t}(e);for(const e of Et){const n=r[e];void 0!==n&&(t[e]=n);}let{years:n,months:i,weeks:o,days:a,hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=t;return di(n,i,o,a,s,l,u,c,d,h),{years:n,months:i,weeks:o,days:a,hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}}function Gt(e){return void 0===e?"constrain":no(e,"overflow",["constrain","reject"],"constrain")}function Ht(e){return void 0===e?"compatible":no(e,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function Jt(e,t){return no(e,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],t)}function Vt(e,t){return void 0===e?t:no(e,"offset",["prefer","use","ignore","reject"],t)}function Qt(e){return no(e,"calendarName",["auto","always","never","critical"],"auto")}function Zt(e){let t=e.roundingIncrement;if(void 0===t)return 1;if(t=ot(t),!Re(t))throw new RangeError("roundingIncrement must be finite");const r=Ie(t);if(r<1||r>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return r}function Kt(e,t,r){const n=r?t:t-1;if(e>n)throw new RangeError(`roundingIncrement must be at least 1 and less than ${n}, not ${e}`);if(t%e!=0)throw new RangeError(`Rounding increment must divide evenly into ${t}`)}function Xt(e){const t=e.fractionalSecondDigits;if(void 0===t)return "auto";if("number"!=typeof t){if("auto"!==lt$1(t))throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return "auto"}const r=Te(t);if(!Re(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return r}function er(e,t){switch(e){case"minute":return {precision:"minute",unit:"minute",increment:1};case"second":return {precision:0,unit:"second",increment:1};case"millisecond":return {precision:3,unit:"millisecond",increment:1};case"microsecond":return {precision:6,unit:"microsecond",increment:1};case"nanosecond":return {precision:9,unit:"nanosecond",increment:1}}switch(t){case"auto":return {precision:t,unit:"nanosecond",increment:1};case 0:return {precision:t,unit:"second",increment:1};case 1:case 2:case 3:return {precision:t,unit:"millisecond",increment:10**(3-t)};case 4:case 5:case 6:return {precision:t,unit:"microsecond",increment:10**(6-t)};case 7:case 8:case 9:return {precision:t,unit:"nanosecond",increment:10**(9-t)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`)}}const tr=Symbol("~required~");function rr(e,t,r,n,i=[]){const o=[];for(const[,e,t]of vt)"datetime"!==r&&r!==t||o.push(e);o.push(...i);let a=n;a===tr?a=void 0:void 0!==a&&o.push(a);const s=[...o];for(const e of o){const t=bt.get(e);void 0!==t&&s.push(t);}let l=no(e,t,s,a);if(void 0===l&&n===tr)throw new RangeError(`${t} is required`);return wt.has(l)?wt.get(l):l}function nr(e){const t=e.relativeTo;if(void 0===t)return t;let r,n,i,o,a,s,l,u,c,d,h,f,p="option",m=!1;if(it(t)){if(Lt(t)||Nt(t))return t;if(Ct(t))return ln(t);d=Jr(t);const e=kr(d,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);e.push("timeZone","offset");const m=ar(t,e,[]),y=Ne(null);y.overflow="constrain",({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(d,m,y)),f=m.offset,void 0===f&&(p="wall"),h=m.timeZone,void 0!==h&&(h=nn(h));}else {let e,y;if(({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,calendar:d,ianaName:e,offset:f,z:y}=Ft(lt$1(t))),e)h=nn(e),y?p="exact":f||(p="wall"),m=!0;else if(y)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");if(d||(d="iso8601"),!io(d))throw new RangeError(`invalid calendar identifier ${d}`);d=oo(d);}return void 0===h?wr(r,n,i,d):Rr(yr(r,n,i,o,a,s,l,u,c,p,"option"===p?Rn(f):0,h,"compatible","reject",m),h,d)}function ir(e,t,r,n,i,o,a,s,l,u){for(const[c,d]of [["years",e],["months",t],["weeks",r],["days",n],["hours",i],["minutes",o],["seconds",a],["milliseconds",s],["microseconds",l],["nanoseconds",u]])if(0!==d)return wt.get(c);return "nanosecond"}function or(e,t){return _t.indexOf(e)>_t.indexOf(t)?t:e}function ar(e,t,r,{emptySourceErrorMessage:n}={emptySourceErrorMessage:"no supported properties found"}){const i=Ne(null);let o=!1;t.sort();for(const n of t){let t=e[n];if(void 0!==t)o=!0,yt.has(n)&&(t=yt.get(n)(t)),i[n]=t;else if("partial"!==r){if(ge.call(r,n))throw new TypeError(`required property '${n}' missing or undefined`);t=gt$1.get(n),i[n]=t;}}if("partial"===r&&!o)throw new TypeError(n);return i}function sr(e,t="complete"){const r=["hour","microsecond","millisecond","minute","nanosecond","second"],n=ar(e,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),i={};for(const e of r){const r=Oe(n,e);void 0!==r?i[e]=r.value:"complete"===t&&(i[e]=0);}return i}function lr(e,t){let r=e;if(it(r)){if(Nt(r))return r;if(Lt(r)&&(Gt(t),r=hn(K(r,A$1),K(r,C$1),K(r,j))),Ct(r))return Gt(t),wr(K(r,b$2),K(r,_),K(r,E$1),K(r,j));const e=Jr(r);return en(e,ar(r,kr(e,["day","month","monthCode","year"]),[]),t)}Gt(t);let{year:n,month:i,day:o,calendar:a,z:s}=function(e){return Ft(e)}(lt$1(r));if(s)throw new RangeError("Z designator not supported for PlainDate");if(a||(a="iso8601"),!io(a))throw new RangeError(`invalid calendar identifier ${a}`);return a=oo(a),wr(n,i,o,a)}function ur(e,t,r){let{hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=sr(t);const u=Gt(r),c=en(e,t,r),d=K(c,b$2),h=K(c,_),f=K(c,E$1);return ({hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=Wt(n,i,o,a,s,l,u)),{year:d,month:h,day:f,hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}}function cr(e,t){let r,n,i,o,a,s,l,u,c,d;if(it(e)){if(Ct(e))return e;if(Lt(e))return Gt(t),hn(K(e,A$1),K(e,C$1),K(e,j));if(Nt(e))return Gt(t),_r(K(e,b$2),K(e,_),K(e,E$1),0,0,0,0,0,0,K(e,j));d=Jr(e);const h=ar(e,kr(d,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(d,h,t));}else {let h;if(Gt(t),({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,calendar:d,z:h}=function(e){return Ft(e)}(lt$1(e))),h)throw new RangeError("Z designator not supported for PlainDateTime");if(li(r,n,i,o,a,s,l,u,c),d||(d="iso8601"),!io(d))throw new RangeError(`invalid calendar identifier ${d}`);d=oo(d);}return _r(r,n,i,o,a,s,l,u,c,d)}function dr(e){if(Dt(e))return e;let{years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=zt(e);return new(m$1("%Temporal.Duration%"))(t,r,n,i,o,a,s,l,u,c)}function hr(e){if(Rt(e))return e;if(Lt(e))return new(m$1("%Temporal.Instant%"))(K(e,v$1));const t=function(e){let{year:t,month:r,day:n,hour:i,minute:o,second:a,millisecond:s,microsecond:l,nanosecond:u,offset:c,z:d}=function(e){const t=Ft(e);if(!t.z&&!t.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return t}(e);if(!d&&!c)throw new RangeError("Temporal.Instant requires a time zone offset");const h=d?0:Rn(c);({year:t,month:r,day:n,hour:i,minute:o,second:a,millisecond:s,microsecond:l,nanosecond:u}=Hn(t,r,n,i,o,a,s,l,u-h));const f=On(t,r,n,i,o,a,s,l,u);if(null===f)throw new RangeError("DateTime outside of supported range");return f}(lt$1(e));return new(m$1("%Temporal.Instant%"))(t)}function fr(e,t){let r=e;if(it(r)){if(Mt(r))return r;let e,n;if(Z(r,j))e=K(r,j),n=!1;else {let t=r.calendar;n=void 0===t,void 0===t&&(t="iso8601"),e=Hr(t);}const i=ar(r,kr(e,["day","month","monthCode","year"]),[]);return n&&void 0!==i.month&&void 0===i.monthCode&&void 0===i.year&&(i.year=1972),rn(e,i,t)}Gt(t);let{month:n,day:i,referenceISOYear:o,calendar:a}=qt(lt$1(r));if(void 0===a&&(a="iso8601"),!io(a))throw new RangeError(`invalid calendar identifier ${a}`);return a=oo(a),void 0===o?(oi(1972,n,i),Tr(n,i,a)):rn(a,Tr(n,i,a,o))}function pr(e,t="constrain"){let r,n,i,o,a,s,l=e;if(it(l)){if(Ot(l))return l;if(Lt(l)&&(l=hn(K(l,A$1),K(l,C$1),K(l,j))),Ct(l))return new(m$1("%Temporal.PlainTime%"))(K(l,T$1),K(l,x$1),K(l,I$1),K(l,S$1),K(l,R),K(l,k));(({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=sr(l))),({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=Wt(r,n,i,o,a,s,t));}else (({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=function(e){const t=de.exec(e);let r,n,i,o,a,s,l;if(t){r=at(t[1]),n=at(t[2]||t[5]),i=at(t[3]||t[6]),60===i&&(i=59);const e=(t[4]||t[7])+"000000000";o=at(e.slice(0,3)),a=at(e.slice(3,6)),s=at(e.slice(6,9)),l=t[14];for(const[,e,t,r]of l.matchAll(ue))if("u-ca"!==t&&"!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);if(t[8])throw new RangeError("Z designator not supported for PlainTime")}else {let t,l;if(({hasTime:l,hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s,z:t}=Ft(e)),!l)throw new RangeError(`time is missing in string: ${e}`);if(t)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(e))return {hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s};try{const{month:t,day:r}=qt(e);oi(1972,t,r);}catch{try{const{year:t,month:r}=Ut(e);oi(t,r,1);}catch{return {hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}}}throw new RangeError(`invalid ISO 8601 time-only string ${e}; may need a T prefix`)}(lt$1(l)))),si(r,n,i,o,a,s);return new(m$1("%Temporal.PlainTime%"))(r,n,i,o,a,s)}function mr(e,t){if(it(e)){if(At(e))return e;const r=Jr(e);return tn(r,ar(e,kr(r,["month","monthCode","year"]),[]),t)}Gt(t);let{year:r,month:n,referenceISODay:i,calendar:o}=Ut(lt$1(e));if(void 0===o&&(o="iso8601"),!io(o))throw new RangeError(`invalid calendar identifier ${o}`);return o=oo(o),void 0===i?(oi(r,n,1),Ir(r,n,o)):tn(o,Ir(r,n,o,i))}function yr(e,t,r,n,i,o,a,s,l,u,c,h,f,p,y){const g=new(m$1("%Temporal.PlainDateTime%"))(e,t,r,n,i,o,a,s,l);if("wall"===u||"ignore"===p)return K(fn(h,g,f),v$1);if("exact"===u||"use"===p){const u=On(e,t,r,n,i,o,a,s,l);if(null===u)throw new RangeError("ZonedDateTime outside of supported range");return d$1.subtract(u,d$1.BigInt(c))}const b=mn(h,g);for(const e of b){const t=cn(h,e),r=d$1.toNumber(Li(d$1.BigInt(t),We,"halfExpand"));if(t===c||y&&r===c)return K(e,v$1)}if("reject"===p){const e=Dn(c),t=kt(h)?K(h,w$1):"time zone";throw new RangeError(`Offset ${e} is invalid for ${g.toString()} in ${t}`)}return K(pn(b,h,g,f),v$1)}function gr(e,t){let r,n,i,o,a,s,l,u,c,d,h,f,p,m,y=!1,g="option";if(it(e)){if(Lt(e))return e;f=Jr(e);const y=kr(f,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);y.push("timeZone","offset");const v=ar(e,y,["timeZone"]);d=nn(v.timeZone),h=v.offset,void 0===h&&(g="wall"),p=Ht(t),m=Vt(t,"reject"),({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(f,v,t));}else {let v,w;if(({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,ianaName:v,offset:h,z:w,calendar:f}=function(e){const t=Ft(e);if(!t.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return t}(lt$1(e))),d=nn(v),w?g="exact":h||(g="wall"),f||(f="iso8601"),!io(f))throw new RangeError(`invalid calendar identifier ${f}`);f=oo(f),y=!0,p=Ht(t),m=Vt(t,"reject"),Gt(t);}let v=0;return "option"===g&&(v=Rn(h)),Rr(yr(r,n,i,o,a,s,l,u,c,g,v,d,p,m,y),d,f)}function vr(e,t,r,n,i){oi(t,r,n),ai(t,r,n),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,n),X(e,j,i),X(e,D,!0);}function wr(e,t,r,n="iso8601"){const i=m$1("%Temporal.PlainDate%"),o=Ne(i.prototype);return vr(o,e,t,r,n),o}function br(e,t,r,n,i,o,a,s,l,u,c){li(t,r,n,i,o,a,s,l,u),ui(t,r,n,i,o,a,s,l,u),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,n),X(e,T$1,i),X(e,x$1,o),X(e,I$1,a),X(e,S$1,s),X(e,R,l),X(e,k,u),X(e,j,c);}function _r(e,t,r,n,i,o,a,s,l,u="iso8601"){const c=m$1("%Temporal.PlainDateTime%"),d=Ne(c.prototype);return br(d,e,t,r,n,i,o,a,s,l,u),d}function Er(e,t,r,n,i){oi(i,t,r),ai(i,t,r),Q(e),X(e,_,t),X(e,E$1,r),X(e,b$2,i),X(e,j,n),X(e,O,!0);}function Tr(e,t,r="iso8601",n=1972){const i=m$1("%Temporal.PlainMonthDay%"),o=Ne(i.prototype);return Er(o,e,t,r,n),o}function xr(e,t,r,n,i){oi(t,r,i),function(e,t){ii(e,Je,Ve),e===Je?ii(t,4,12):e===Ve&&ii(t,1,9);}(t,r),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,i),X(e,j,n),X(e,N,!0);}function Ir(e,t,r="iso8601",n=1){const i=m$1("%Temporal.PlainYearMonth%"),o=Ne(i.prototype);return xr(o,e,t,r,n),o}function Sr(e,t,r,n){ci(t),Q(e),X(e,v$1,t),X(e,A$1,r),X(e,j,n);const i=new(m$1("%Temporal.Instant%"))(K(e,v$1));X(e,C$1,i);}function Rr(e,t,r="iso8601"){const n=m$1("%Temporal.ZonedDateTime%"),i=Ne(n.prototype);return Sr(i,e,t,r),i}function kr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.fields%"),r,[t])}const r=nt(rt(e,"fields"),e,[t]),n=[];for(const e of r){if("string"!=typeof e)throw new TypeError("bad return from calendar.fields()");ve.call(n,e);}return n}function jr(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.mergeFields%"),n,[t,r])}const n=nt(rt(e,"mergeFields"),e,[t,r]);if(!it(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function Dr(e,t,r,n,i){let o=i;if("string"==typeof e){const i=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateAdd%"),i,[t,r,n])}void 0===o&&(o=rt(e,"dateAdd"));const a=Ce(o,e,[t,r,n]);if(!Nt(a))throw new TypeError("invalid result");return a}function Nr(e,t,r,n,i){let o=i;if("string"==typeof e){const i=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateUntil%"),i,[t,r,n])}void 0===o&&(o=rt(e,"dateUntil"));const a=Ce(o,e,[t,r,n]);if(!Dt(a))throw new TypeError("invalid result");return a}function Or(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.year%"),r,[t])}let r=nt(rt(e,"year"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar year result must be an integer");if(!st(r))throw new RangeError("calendar year result must be an integer");return r}function Cr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.month%"),r,[t])}let r=nt(rt(e,"month"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar month result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar month result must be a positive integer");return r}function Ar(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthCode%"),r,[t])}let r=nt(rt(e,"monthCode"),e,[t]);if("string"!=typeof r)throw new TypeError("calendar monthCode result must be a string");return r}function Mr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.day%"),r,[t])}const r=nt(rt(e,"day"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar day result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar day result must be a positive integer");return r}function Lr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.era%"),r,[t])}let r=nt(rt(e,"era"),e,[t]);if(void 0===r)return r;if("string"!=typeof r)throw new TypeError("calendar era result must be a string or undefined");return r}function Pr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.eraYear%"),r,[t])}let r=nt(rt(e,"eraYear"),e,[t]);if(void 0===r)return r;if("number"!=typeof r)throw new TypeError("calendar eraYear result must be an integer or undefined");if(!st(r))throw new RangeError("calendar eraYear result must be an integer or undefined");return r}function Br(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dayOfWeek%"),r,[t])}const r=nt(rt(e,"dayOfWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar dayOfWeek result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar dayOfWeek result must be a positive integer");return r}function $r(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dayOfYear%"),r,[t])}const r=nt(rt(e,"dayOfYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar dayOfYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar dayOfYear result must be a positive integer");return r}function Fr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.weekOfYear%"),r,[t])}const r=nt(rt(e,"weekOfYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar weekOfYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar weekOfYear result must be a positive integer");return r}function Ur(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.yearOfWeek%"),r,[t])}const r=nt(rt(e,"yearOfWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar yearOfWeek result must be an integer");if(!st(r))throw new RangeError("calendar yearOfWeek result must be an integer");return r}function qr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInWeek%"),r,[t])}const r=nt(rt(e,"daysInWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInWeek result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInWeek result must be a positive integer");return r}function Yr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInMonth%"),r,[t])}const r=nt(rt(e,"daysInMonth"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInMonth result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInMonth result must be a positive integer");return r}function Wr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInYear%"),r,[t])}const r=nt(rt(e,"daysInYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInYear result must be a positive integer");return r}function zr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthsInYear%"),r,[t])}const r=nt(rt(e,"monthsInYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar monthsInYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar monthsInYear result must be a positive integer");return r}function Gr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.inLeapYear%"),r,[t])}const r=nt(rt(e,"inLeapYear"),e,[t]);if("boolean"!=typeof r)throw new TypeError("calendar inLeapYear result must be a boolean");return r}function Hr(e){if(it(e)){if(Z(e,j))return K(e,j);if(!function(e){return !!jt(e)||"dateAdd"in e&&"dateFromFields"in e&&"dateUntil"in e&&"day"in e&&"dayOfWeek"in e&&"dayOfYear"in e&&"daysInMonth"in e&&"daysInWeek"in e&&"daysInYear"in e&&"fields"in e&&"id"in e&&"inLeapYear"in e&&"mergeFields"in e&&"month"in e&&"monthCode"in e&&"monthDayFromFields"in e&&"monthsInYear"in e&&"weekOfYear"in e&&"year"in e&&"yearMonthFromFields"in e&&"yearOfWeek"in e}(e))throw new TypeError("expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol");return e}const t=lt$1(e);if(io(t))return oo(t);let r;try{({calendar:r}=Ft(t));}catch{try{({calendar:r}=Ut(t));}catch{({calendar:r}=qt(t));}}if(r||(r="iso8601"),!io(r))throw new RangeError(`invalid calendar identifier ${r}`);return oo(r)}function Jr(e){if(Z(e,j))return K(e,j);const{calendar:t}=e;return void 0===t?"iso8601":Hr(t)}function Vr(e){if("string"==typeof e)return e;const t=e.id;if("string"!=typeof t)throw new TypeError("calendar.id should be a string");return t}function Qr(e){return it(e)?e:new(m$1("%Temporal.Calendar%"))(e)}function Zr(e,t){return e===t||Vr(e)===Vr(t)}function Kr(e,t,r){if(e===t)return;const n=Vr(e),i=Vr(t);if(n!==i)throw new RangeError(`cannot ${r} of ${n} and ${i} calendars`)}function Xr(e,t){if(e===t)return t;const r=Vr(e),n=Vr(t);if(r===n||"iso8601"===r)return t;if("iso8601"===n)return e;throw new RangeError("irreconcilable calendars")}function en(e,t,r,n){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateFromFields%"),n,[t,r])}const i=nt(n??rt(e,"dateFromFields"),e,[t,r]);if(!Nt(i))throw new TypeError("invalid result");return i}function tn(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.yearMonthFromFields%"),n,[t,r])}let n=nt(rt(e,"yearMonthFromFields"),e,[t,r]);if(!At(n))throw new TypeError("invalid result");return n}function rn(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthDayFromFields%"),n,[t,r])}let n=nt(rt(e,"monthDayFromFields"),e,[t,r]);if(!Mt(n))throw new TypeError("invalid result");return n}function nn(e){if(it(e)){if(Lt(e))return K(e,A$1);if(!function(e){return !!kt(e)||"getOffsetNanosecondsFor"in e&&"getPossibleInstantsFor"in e&&"id"in e}(e))throw new TypeError("expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol");return e}return function(e){const{ianaName:t,offset:r,z:n}=function(e){if(new RegExp(`^${te.source}$`,"i").test(e))return {ianaName:e};try{const t=Ft(e);if(t.z||t.offset||t.ianaName)return t}catch{}throw new RangeError(`Invalid time zone: ${e}`)}(e);return t?kn(t):n?"UTC":Dn(Rn(r))}(lt$1(e))}function on(e){if("string"==typeof e)return e;const t=e.id;if("string"!=typeof t)throw new TypeError("timeZone.id should be a string");return t}function an(e){return it(e)?e:new(m$1("%Temporal.TimeZone%"))(e)}function sn(e,t){return e===t||on(e)===on(t)}function ln(e){return wr(K(e,b$2),K(e,_),K(e,E$1),K(e,j))}function un(e){return new(m$1("%Temporal.PlainTime%"))(K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k))}function cn(e,t,r){if("string"==typeof e){const r=new(m$1("%Temporal.TimeZone%"))(e);return nt(m$1("%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%"),r,[t])}const n=nt(r??rt(e,"getOffsetNanosecondsFor"),e,[t]);if("number"!=typeof n)throw new TypeError("bad return from getOffsetNanosecondsFor");if(!st(n)||Ee(n)>=864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return n}function dn(e,t){return Dn(cn(e,t))}function hn(e,t,r){const n=K(t,v$1),i=cn(e,t);let{year:o,month:a,day:s,hour:l,minute:u,second:c,millisecond:d,microsecond:h,nanosecond:f}=Cn(n);return ({year:o,month:a,day:s,hour:l,minute:u,second:c,millisecond:d,microsecond:h,nanosecond:f}=Hn(o,a,s,l,u,c,d,h,f+i)),_r(o,a,s,l,u,c,d,h,f,r)}function fn(e,t,r){return pn(mn(e,t),e,t,r)}function pn(e,t,r,n){const i=m$1("%Temporal.Instant%"),o=e.length;if(1===o)return e[0];if(o)switch(n){case"compatible":case"earlier":return e[0];case"later":return e[o-1];case"reject":throw new RangeError("multiple instants found")}const a=K(r,b$2),s=K(r,_),l=K(r,E$1),u=K(r,T$1),c=K(r,x$1),h=K(r,I$1),f=K(r,S$1),p=K(r,R),y=K(r,k),g=On(a,s,l,u,c,h,f,p,y);if(null===g)throw new RangeError("DateTime outside of supported range");const v=new i(d$1.subtract(g,ze)),w=new i(d$1.add(g,ze)),D=cn(t,v),N=cn(t,w)-D;switch(n){case"earlier":{const e=K(r,j),n=m$1("%Temporal.PlainDateTime%"),i=ki(a,s,l,u,c,h,f,p,y,e,0,0,0,0,0,0,0,0,0,-N,void 0);return mn(t,new n(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond,i.microsecond,i.nanosecond,e))[0]}case"compatible":case"later":{const e=K(r,j),n=m$1("%Temporal.PlainDateTime%"),i=ki(a,s,l,u,c,h,f,p,y,e,0,0,0,0,0,0,0,0,0,N,void 0),o=mn(t,new n(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond,i.microsecond,i.nanosecond,e));return o[o.length-1]}case"reject":throw new RangeError("no such instant found")}}function mn(e,t,r){if("string"==typeof e){const r=new(m$1("%Temporal.TimeZone%"))(e);return nt(m$1("%Temporal.TimeZone.prototype.getPossibleInstantsFor%"),r,[t])}const n=nt(r??rt(e,"getPossibleInstantsFor"),e,[t]),i=[];for(const e of n){if(!Rt(e))throw new TypeError("bad return from getPossibleInstantsFor");ve.call(i,e);}return i}function yn(e){let t;return t=e<0||e>9999?(e<0?"-":"+")+`000000${Ee(e)}`.slice(-6):`0000${e}`.slice(-4),t}function gn(e){return `00${e}`.slice(-2)}function vn(e,t,r,n,i){if("minute"===i)return "";const o=`:${gn(e)}`;let a,s=1e6*t+1e3*r+n;if("auto"===i){if(0===s)return o;for(a=`${s}`.padStart(9,"0");"0"===a[a.length-1];)a=a.slice(0,-1);}else {if(0===i)return o;a=`${s}`.padStart(9,"0").slice(0,i);}return `${o}.${a}`}function wn(e,t,r){let n=t;void 0===n&&(n="UTC");const i=hn(n,e,"iso8601"),o=yn(K(i,b$2)),a=gn(K(i,_)),s=gn(K(i,E$1)),l=gn(K(i,T$1)),u=gn(K(i,x$1)),c=vn(K(i,I$1),K(i,S$1),K(i,R),K(i,k),r);let d="Z";return void 0!==t&&(d=Nn(cn(n,e))),`${o}-${a}-${s}T${l}:${u}${c}${d}`}function bn(e,t="auto",r){function n(e){return e<=De?e.toString(10):d$1.BigInt(e).toString(10)}const i=K(e,M$1),o=K(e,L),a=K(e,P),s=K(e,B$1),l=K(e,$),u=K(e,F);let c=K(e,U),h=K(e,q),f=K(e,Y),p=K(e,W$1);const m=Wn(i,o,a,s,l,u,c,h,f,p);if(r){const{unit:e,increment:t,roundingMode:n}=r;({seconds:c,milliseconds:h,microseconds:f,nanoseconds:p}=Wi(0,0,0,0,0,0,c,h,f,p,t,e,n));}const y=[];i&&y.push(`${n(Ee(i))}Y`),o&&y.push(`${n(Ee(o))}M`),a&&y.push(`${n(Ee(a))}W`),s&&y.push(`${n(Ee(s))}D`);const g=[];l&&g.push(`${n(Ee(l))}H`),u&&g.push(`${n(Ee(u))}M`);const v=[];let w,b,_,E,T=Vn(0,0,0,c,h,f,p,0);(({quotient:T,remainder:w}=ht(T,$e))),({quotient:T,remainder:b}=ht(T,$e)),({quotient:E,remainder:_}=ht(T,$e));const x=1e6*Ee(d$1.toNumber(_))+1e3*Ee(d$1.toNumber(b))+Ee(d$1.toNumber(w));let I;if("auto"===t){if(0!==x)for(I=`${x}`.padStart(9,"0");"0"===I[I.length-1];)I=I.slice(0,-1);}else 0!==t&&(I=`${x}`.padStart(9,"0").slice(0,t));return I&&v.unshift(".",I),d$1.equal(E,Me)&&!v.length&&"auto"===t||v.unshift(mt(E).toString()),v.length&&g.push(`${v.join("")}S`),g.length&&g.unshift("T"),y.length||g.length?`${m<0?"-":""}P${y.join("")}${g.join("")}`:"PT0S"}function _n(e,t="auto"){return `${yn(K(e,b$2))}-${gn(K(e,_))}-${gn(K(e,E$1))}${Bt(K(e,j),t)}`}function En(e,t,r="auto",n){let i=K(e,b$2),o=K(e,_),a=K(e,E$1),s=K(e,T$1),l=K(e,x$1),u=K(e,I$1),c=K(e,S$1),d=K(e,R),h=K(e,k);if(n){const{unit:e,increment:t,roundingMode:r}=n;({year:i,month:o,day:a,hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}=Bi(i,o,a,s,l,u,c,d,h,t,e,r));}return `${yn(i)}-${gn(o)}-${gn(a)}T${gn(s)}:${gn(l)}${vn(u,c,d,h,t)}${Bt(K(e,j),r)}`}function Tn(e,t="auto"){let r=`${gn(K(e,_))}-${gn(K(e,E$1))}`;const n=Vr(K(e,j));"always"!==t&&"critical"!==t&&"iso8601"===n||(r=`${yn(K(e,b$2))}-${r}`);const i=$t(n,t);return i&&(r+=i),r}function xn(e,t="auto"){let r=`${yn(K(e,b$2))}-${gn(K(e,_))}`;const n=Vr(K(e,j));"always"!==t&&"critical"!==t&&"iso8601"===n||(r+=`-${gn(K(e,E$1))}`);const i=$t(n,t);return i&&(r+=i),r}function In(e,t,r="auto",n="auto",i="auto",o){let a=K(e,C$1);if(o){const{unit:t,increment:r,roundingMode:n}=o,i=Pi(K(e,v$1),r,t,n);a=new(m$1("%Temporal.Instant%"))(i);}const s=K(e,A$1),l=hn(s,a,"iso8601");let u=`${yn(K(l,b$2))}-${gn(K(l,_))}-${gn(K(l,E$1))}T${gn(K(l,T$1))}:${gn(K(l,x$1))}${vn(K(l,I$1),K(l,S$1),K(l,R),K(l,k),t)}`;return "never"!==i&&(u+=Nn(cn(s,a))),"never"!==n&&(u+=`[${"critical"===n?"!":""}${on(s)}]`),u+=Bt(K(e,j),r),u}function Sn(e){return ao.test(je(e))}function Rn(e){const t=ao.exec(je(e));if(!t)throw new RangeError(`invalid time zone offset: ${e}`);return ("-"===t[1]||"−"===t[1]?-1:1)*(1e9*(60*(60*+t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+"000000000").slice(0,9))}function kn(e){return Sn(e)?Dn(Rn(e)):xt(je(e)).resolvedOptions().timeZone}function jn(e,t){const{year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=An(e,t),h=r%400,f=(r-h)/400,p=d$1.multiply(d$1.BigInt(146097),ze),m=On(h,n,i,o,a,s,l,u,c),y=d$1.add(m,d$1.multiply(p,d$1.BigInt(f)));return d$1.toNumber(d$1.subtract(y,t))}function Dn(e){const t=e<0?"-":"+",r=Ee(e),n=r%1e9,i=Te(r/1e9)%60,o=Te(r/6e10)%60,a=gn(Te(r/36e11)),s=gn(o),l=gn(i);let u="";if(n){let e=`${n}`.padStart(9,"0");for(;"0"===e[e.length-1];)e=e.slice(0,-1);u=`:${l}.${e}`;}else i&&(u=`:${l}`);return `${t}${a}:${s}${u}`}function Nn(e){let t=d$1.toNumber(Li(d$1.BigInt(e),We,"halfExpand"));const r=t<0?"-":"+";t=Ee(t);const n=t/6e10%60;return `${r}${gn(Te(t/36e11))}:${gn(n)}`}function On(e,t,r,n,i,o,a,s,l){const u=new Date;u.setUTCHours(n,i,o,a),u.setUTCFullYear(e,t-1,r);const c=u.getTime();if(Se(c))return null;let h=d$1.multiply(d$1.BigInt(c),Fe);return h=d$1.add(h,d$1.multiply(d$1.BigInt(s),$e)),h=d$1.add(h,d$1.BigInt(l)),d$1.lessThan(h,Ge)||d$1.greaterThan(h,He)?null:h}function Cn(e){const{quotient:t,remainder:r}=ht(e,Fe);let n=d$1.toNumber(t),i=d$1.toNumber(r);i<0&&(i+=1e6,n-=1);const o=Te(i/1e3)%1e3,a=i%1e3,s=new Date(n);return {epochMilliseconds:n,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),millisecond:s.getUTCMilliseconds(),microsecond:o,nanosecond:a}}function An(e,t){const{epochMilliseconds:r,millisecond:n,microsecond:i,nanosecond:o}=Cn(t),{year:a,month:s,day:l,hour:u,minute:c,second:d}=function(e,t){return function(e){const t=e.split(/[^\w]+/);if(7!==t.length)throw new RangeError(`expected 7 parts in "${e}`);const r=+t[0],n=+t[1];let i=+t[2];const o=t[3].toUpperCase();if("B"===o||"BC"===o)i=1-i;else if("A"!==o&&"AD"!==o)throw new RangeError(`Unknown era ${o} in "${e}`);let a=+t[4];24===a&&(a=0);const s=+t[5],l=+t[6];if(!(Re(i)&&Re(r)&&Re(n)&&Re(a)&&Re(s)&&Re(l)))throw new RangeError(`Invalid number in "${e}`);return {year:i,month:r,day:n,hour:a,minute:s,second:l}}(xt(e).format(new Date(t)))}(e,r);return Hn(a,s,l,u,c,d,n,i,o)}function Mn(e,t){return d$1.lessThan(e,t)?t:e}function Ln(){return d$1.add(Zi(),Ze)}function Pn(e,t){if(d$1.lessThan(t,Qe))return Pn(e,Qe);const r=d$1.add(t,Ke),n=Mn(Ln(),r);let i=Mn(Qe,t);const o=jn(e,i);let a=i,s=o;for(;o===s&&d$1.lessThan(d$1.BigInt(i),n);){if(a=d$1.add(i,Xe),d$1.greaterThan(a,He))return null;s=jn(e,a),o===s&&(i=a);}return o===s?null:so((t=>jn(e,t)),i,a,o,s)}function Bn(e,t){const r=Ln(),n=d$1.greaterThan(t,r),i=n?d$1.subtract(t,Ke):Qe;if("Africa/Casablanca"===e||"Africa/El_Aaiun"===e){const r=K(hr("2088-01-01T00Z"),v$1);if(d$1.lessThan(r,t))return Bn(e,r)}let o=d$1.subtract(t,Le);if(d$1.lessThan(o,Qe))return null;const a=jn(e,o);let s=o,l=a;for(;a===l&&d$1.greaterThan(o,i);){if(s=d$1.subtract(o,Xe),d$1.lessThan(s,Qe))return null;l=jn(e,s),a===l&&(o=s);}if(a===l){if(n){const t=d$1.subtract(r,ze);return Bn(e,t)}return null}return so((t=>jn(e,t)),s,o,l,a)}function $n(e){return void 0!==e&&!(e%4!=0||e%100==0&&e%400!=0)}function Fn(e,t){return {standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[$n(e)?"leapyear":"standard"][t-1]}function Un(e,t,r){const n=t+(t<3?10:-2),i=e-(t<3?1:0),o=Te(i/100),a=i-100*o,s=(r+Te(2.6*n-.2)+(a+Te(a/4))+(Te(o/4)-2*o))%7;return s+(s<=0?7:0)}function qn(e,t,r){let n=r;for(let r=t-1;r>0;r--)n+=Fn(e,r);return n}function Yn(e,t,r){const n=qn(e,t,r),i=Un(e,t,r)||7,o=Un(e,1,1),a=Te((n-i+10)/7);return a<1?5===o||6===o&&$n(e-1)?{week:53,year:e-1}:{week:52,year:e-1}:53===a&&($n(e)?366:365)-n<4-i?{week:1,year:e+1}:{week:a,year:e}}function Wn(e,t,r,n,i,o,a,s,l,u){for(const c of [e,t,r,n,i,o,a,s,l,u])if(0!==c)return c<0?-1:1;return 0}function zn(e,t){let r=e,n=t;if(!Re(r)||!Re(n))throw new RangeError("infinity is out of range");return n-=1,r+=Te(n/12),n%=12,n<0&&(n+=12),n+=1,{year:r,month:n}}function Gn(e,t,r){let n=e,i=t,o=r;if(!Re(o))throw new RangeError("infinity is out of range");({year:n,month:i}=zn(n,i));const a=146097;if(Ee(o)>a){const e=Ie(o/a);n+=400*e,o-=e*a;}let s=0,l=i>2?n:n-1;for(;s=$n(l)?366:365,o<-s;)n-=1,l-=1,o+=s;for(l+=1;s=$n(l)?366:365,o>s;)n+=1,l+=1,o-=s;for(;o<1;)(({year:n,month:i}=zn(n,i-1))),o+=Fn(n,i);for(;o>Fn(n,i);)o-=Fn(n,i),({year:n,month:i}=zn(n,i+1));return {year:n,month:i,day:o}}function Hn(e,t,r,n,i,o,a,s,l){const{deltaDays:u,hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:m}=Jn(n,i,o,a,s,l),{year:y,month:g,day:v}=Gn(e,t,r+u);return {year:y,month:g,day:v,hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:m}}function Jn(e,t,r,n,i,o){let a,s=d$1.BigInt(e),l=d$1.BigInt(t),u=d$1.BigInt(r),c=d$1.BigInt(n),h=d$1.BigInt(i),f=d$1.BigInt(o);return ({quotient:a,remainder:f}=Gi(f,$e)),h=d$1.add(h,a),({quotient:a,remainder:h}=Gi(h,$e)),c=d$1.add(c,a),({quotient:a,remainder:c}=Gi(c,$e)),u=d$1.add(u,a),({quotient:a,remainder:u}=Gi(u,Pe)),l=d$1.add(l,a),({quotient:a,remainder:l}=Gi(l,Pe)),s=d$1.add(s,a),({quotient:a,remainder:s}=Gi(s,Be)),{deltaDays:d$1.toNumber(a),hour:d$1.toNumber(s),minute:d$1.toNumber(l),second:d$1.toNumber(u),millisecond:d$1.toNumber(c),microsecond:d$1.toNumber(h),nanosecond:d$1.toNumber(f)}}function Vn(e,t,r,n,i,o,a,s){const l=d$1.BigInt(e);let u=d$1.BigInt(a);0!==e&&(u=d$1.subtract(d$1.BigInt(a),d$1.BigInt(s)));const c=d$1.add(d$1.BigInt(t),d$1.multiply(l,d$1.BigInt(24))),h=d$1.add(d$1.BigInt(r),d$1.multiply(c,Pe)),f=d$1.add(d$1.BigInt(n),d$1.multiply(h,Pe)),p=d$1.add(d$1.BigInt(i),d$1.multiply(f,$e)),m=d$1.add(d$1.BigInt(o),d$1.multiply(p,$e));return d$1.add(d$1.BigInt(u),d$1.multiply(m,$e))}function Qn(e,t){const r=m$1("%Temporal.Instant%"),n=xe(d$1.toNumber(e));let i=d$1.BigInt(e),o=864e11;if(0===n)return {days:0,nanoseconds:Me,dayLengthNs:o};if(!Lt(t)){let e;return ({quotient:e,remainder:i}=ht(i,d$1.BigInt(o))),{days:d$1.toNumber(e),nanoseconds:i,dayLengthNs:o}}const a=K(t,v$1),s=K(t,C$1),l=d$1.add(a,i),u=new r(l),c=K(t,A$1),h=K(t,j),f=hn(c,s,h),p=hn(c,u,h);let{days:y}=mi(K(f,b$2),K(f,_),K(f,E$1),K(f,T$1),K(f,x$1),K(f,I$1),K(f,S$1),K(f,R),K(f,k),K(p,b$2),K(p,_),K(p,E$1),K(p,T$1),K(p,x$1),K(p,I$1),K(p,S$1),K(p,R),K(p,k),h,"day",Ne(null)),g=ji(s,c,h,0,0,0,y,0,0,0,0,0,0),w=d$1.BigInt(y);if(1===n)for(;d$1.greaterThan(w,Me)&&d$1.greaterThan(g,l);)w=d$1.subtract(w,Le),g=ji(s,c,h,0,0,0,d$1.toNumber(w),0,0,0,0,0,0);i=d$1.subtract(l,g);let D=!1,N=new r(g);do{const e=ji(N,c,h,0,0,0,n,0,0,0,0,0,0),t=K(N,v$1);o=d$1.toNumber(d$1.subtract(e,t)),D=d$1.greaterThanOrEqual(d$1.multiply(d$1.subtract(i,d$1.BigInt(o)),d$1.BigInt(n)),Me),D&&(i=d$1.subtract(i,d$1.BigInt(o)),N=new r(e),w=d$1.add(w,d$1.BigInt(n)));}while(D);if(!tt(w)&&pt(w)!==n)throw new RangeError("Time zone or calendar converted nanoseconds into a number of days with the opposite sign");if(!tt(i)&&pt(i)!==n){if(ft(i)&&1===n)throw new Error("assert not reached");throw new RangeError("Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign")}if(d$1.greaterThanOrEqual(mt(i),mt(d$1.BigInt(o))))throw new Error("assert not reached");return {days:d$1.toNumber(w),nanoseconds:i,dayLengthNs:Ee(o)}}function Zn(e,t,r,n,i,o,a,s,l){let u=Kn(e,t,r,n,i,o,a,s,l);if("positive overflow"===u||"negative overflow"===u)throw new RangeError("Duration out of range");return u}function Kn(e,t,r,n,i,o,a,s,l){let u,c,h,f,p,m,y=e;if(Lt(l)){const e=ji(K(l,C$1),K(l,A$1),K(l,j),0,0,0,y,t,r,n,i,o,a),s=K(l,v$1);u=d$1.subtract(e,s);}else u=Vn(y,t,r,n,i,o,a,0);"year"===s||"month"===s||"week"===s||"day"===s?({days:y,nanoseconds:u}=Qn(u,l)):y=0;const g=d$1.lessThan(u,Me)?-1:1;switch(u=mt(u),c=h=f=p=m=Me,s){case"year":case"month":case"week":case"day":case"hour":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e)),({quotient:p,remainder:f}=ht(f,Pe)),({quotient:m,remainder:p}=ht(p,Pe));break;case"minute":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e)),({quotient:p,remainder:f}=ht(f,Pe));break;case"second":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e));break;case"millisecond":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e));break;case"microsecond":({quotient:c,remainder:u}=ht(u,$e));break;case"nanosecond":break;default:throw new Error("assert not reached")}const w=d$1.toNumber(m)*g,b=d$1.toNumber(p)*g,_=d$1.toNumber(f)*g,E=d$1.toNumber(h)*g,T=d$1.toNumber(c)*g,x=d$1.toNumber(u)*g;for(const e of [y,w,b,_,E,T,x])if(!Re(e))return 1===g?"positive overflow":"negative overflow";return {days:y,hours:w,minutes:b,seconds:_,milliseconds:E,microseconds:T,nanoseconds:x}}function Xn(e,t,r,n,i,o){const a=m$1("%Temporal.Duration%"),s=Wn(e,t,r,n,0,0,0,0,0,0);if(0===s)return {years:e,months:t,weeks:r,days:n};const l=d$1.BigInt(s);let u,c,h=d$1.BigInt(e),f=d$1.BigInt(t),p=d$1.BigInt(r),y=d$1.BigInt(n);o&&(c=lr(o),u=K(c,j));const g=new a(s),v=new a(0,s),w=new a(0,0,s);switch(i){case"year":break;case"month":{if(!u)throw new RangeError("a starting point is required for months balancing");let e,t;for("string"!=typeof u&&(e=rt(u,"dateAdd"),t=rt(u,"dateUntil"));!tt(h);){const r=Dr(u,c,g,void 0,e),n=Ne(null);n.largestUnit="month";const i=Nr(u,c,r,n,t),o=d$1.BigInt(K(i,L));c=r,f=d$1.add(f,o),h=d$1.subtract(h,l);}}break;case"week":{if(!u)throw new RangeError("a starting point is required for weeks balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;for(;!tt(h);){let t;(({relativeTo:c,days:t}=Ui(u,c,g,e))),y=d$1.add(y,d$1.BigInt(t)),h=d$1.subtract(h,l);}for(;!tt(f);){let t;(({relativeTo:c,days:t}=Ui(u,c,v,e))),y=d$1.add(y,d$1.BigInt(t)),f=d$1.subtract(f,l);}break}default:{if(tt(h)&&tt(f)&&tt(p))break;if(!u)throw new RangeError("a starting point is required for balancing calendar units");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;for(;!tt(h);){let t;(({relativeTo:c,days:t}=Ui(u,c,g,e))),y=d$1.add(y,d$1.BigInt(t)),h=d$1.subtract(h,l);}for(;!tt(f);){let t;(({relativeTo:c,days:t}=Ui(u,c,v,e))),y=d$1.add(y,d$1.BigInt(t)),f=d$1.subtract(f,l);}for(;!tt(p);){let t;(({relativeTo:c,days:t}=Ui(u,c,w,e))),y=d$1.add(y,d$1.BigInt(t)),p=d$1.subtract(p,l);}break}}return {years:d$1.toNumber(h),months:d$1.toNumber(f),weeks:d$1.toNumber(p),days:d$1.toNumber(y)}}function ei(e,t,r,n,i){if(Lt(e)){const o=K(e,C$1),a=K(e,A$1),s=K(e,j),l=cn(a,o),u=ji(o,a,s,t,r,n,i,0,0,0,0,0,0);return cn(a,new(m$1("%Temporal.Instant%"))(u))-l}return 0}function ti(e){return new(m$1("%Temporal.Duration%"))(-K(e,M$1),-K(e,L),-K(e,P),-K(e,B$1),-K(e,$),-K(e,F),-K(e,U),-K(e,q),-K(e,Y),-K(e,W$1))}function ri(e,t,r){return be(r,_e(t,e))}function ni(e,t,r){const n=ri(t,1,12);return {year:e,month:n,day:ri(r,1,Fn(e,n))}}function ii(e,t,r){if(e<t||e>r)throw new RangeError(`value out of range: ${t} <= ${e} <= ${r}`)}function oi(e,t,r){ii(t,1,12),ii(r,1,Fn(e,t));}function ai(e,t,r){ui(e,t,r,12,0,0,0,0,0);}function si(e,t,r,n,i,o){ii(e,0,23),ii(t,0,59),ii(r,0,59),ii(n,0,999),ii(i,0,999),ii(o,0,999);}function li(e,t,r,n,i,o,a,s,l){oi(e,t,r),si(n,i,o,a,s,l);}function ui(e,t,r,n,i,o,a,s,l){if(ii(e,Je,Ve),e===Je&&null==On(e,t,r+1,n,i,o,a,s,l-1)||e===Ve&&null==On(e,t,r-1,n,i,o,a,s,l+1))throw new RangeError("DateTime outside of supported range")}function ci(e){if(d$1.lessThan(e,Ge)||d$1.greaterThan(e,He))throw new RangeError("Instant outside of supported range")}function di(e,t,r,n,i,o,a,s,l,u){const c=Wn(e,t,r,n,i,o,a,s,l,u);for(const d of [e,t,r,n,i,o,a,s,l,u]){if(!Re(d))throw new RangeError("infinite values not allowed as duration fields");const e=xe(d);if(0!==e&&e!==c)throw new RangeError("mixed-sign values not allowed as duration fields")}}function hi(e,t,r,n,i,o,a){switch(a){case"year":case"month":{const s=-zi(e,t,r,n,i,o);if(0===s)return {years:0,months:0,weeks:0,days:0};const l={year:e,month:t,day:r},u={year:n,month:i,day:o};let c=u.year-l.year,d=xi(e,t,r,c,0,0,0,"constrain"),h=-zi(d.year,d.month,d.day,n,i,o);if(0===h)return "year"===a?{years:c,months:0,weeks:0,days:0}:{years:0,months:12*c,weeks:0,days:0};let f=u.month-l.month;if(h!==s&&(c-=s,f+=12*s),d=xi(e,t,r,c,f,0,0,"constrain"),h=-zi(d.year,d.month,d.day,n,i,o),0===h)return "year"===a?{years:c,months:f,weeks:0,days:0}:{years:0,months:f+12*c,weeks:0,days:0};h!==s&&(f-=s,f===-s&&(c-=s,f=11*s),d=xi(e,t,r,c,f,0,0,"constrain"));let p=0;return p=d.month===u.month?u.day-d.day:s<0?-d.day-(Fn(u.year,u.month)-u.day):u.day+(Fn(d.year,d.month)-d.day),"month"===a&&(f+=12*c,c=0),{years:c,months:f,weeks:0,days:p}}case"week":case"day":{let s,l,u;zi(e,t,r,n,i,o)<0?(l={year:e,month:t,day:r},s={year:n,month:i,day:o},u=1):(l={year:n,month:i,day:o},s={year:e,month:t,day:r},u=-1);let c=qn(s.year,s.month,s.day)-qn(l.year,l.month,l.day);for(let e=l.year;e<s.year;++e)c+=$n(e)?366:365;let d=0;return "week"===a&&(d=Te(c/7),c%=7),d*=u,c*=u,{years:0,months:0,weeks:d,days:c}}default:throw new Error("assert not reached")}}function fi(e,t,r,n,i,o,a,s,l,u,c,d){let h=a-e,f=s-t,p=l-r,m=u-n,y=c-i,g=d-o;const v=Wn(0,0,0,0,h,f,p,m,y,g);h*=v,f*=v,p*=v,m*=v,y*=v,g*=v;let w=0;if(({deltaDays:w,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}=Jn(h,f,p,m,y,g)),0!=w)throw new Error("assertion failure in DifferenceTime: _bt_.[[Days]] should be 0");return h*=v,f*=v,p*=v,m*=v,y*=v,g*=v,{hours:h,minutes:f,seconds:p,milliseconds:m,microseconds:y,nanoseconds:g}}function pi(e,t,r,n,i,o){const a=d$1.subtract(t,e);let s=0,l=0,u=d$1.toNumber(d$1.remainder(a,$e)),c=d$1.toNumber(d$1.remainder(d$1.divide(a,$e),$e)),h=d$1.toNumber(d$1.remainder(d$1.divide(a,Fe),$e)),f=d$1.toNumber(d$1.divide(a,Ue));return ({hours:s,minutes:l,seconds:f,milliseconds:h,microseconds:c,nanoseconds:u}=Wi(0,0,0,0,0,0,f,h,c,u,r,n,o)),Zn(0,s,l,f,h,c,u,i)}function mi(e,t,r,n,i,o,a,s,l,u,c,d,h,f,p,m,y,g,v,w,b){let _=e,E=t,T=r,{hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=fi(n,i,o,a,s,l,h,f,p,m,y,g);const D=Wn(0,0,0,0,x,I,S,R,k,j);zi(u,c,d,_,E,T)===-D&&(({year:_,month:E,day:T}=Gn(_,E,T-D)),({hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=Zn(-D,x,I,S,R,k,j,w)));const N=wr(_,E,T,v),O=wr(u,c,d,v),C=or("day",w),A=ro(b);A.largestUnit=C;let{years:M,months:L,weeks:P,days:B}=Nr(v,N,O,A);return ({days:B,hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=Zn(B,x,I,S,R,k,j,w)),{years:M,months:L,weeks:P,days:B,hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}}function yi(e,t,r,n,i,o){const a=d$1.subtract(t,e);if(d$1.equal(a,Me))return {years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};const s=m$1("%Temporal.Instant%"),l=new s(e),u=new s(t),c=hn(r,l,n),h=hn(r,u,n);let{years:f,months:p,weeks:y,days:g}=mi(K(c,b$2),K(c,_),K(c,E$1),K(c,T$1),K(c,x$1),K(c,I$1),K(c,S$1),K(c,R),K(c,k),K(h,b$2),K(h,_),K(h,E$1),K(h,T$1),K(h,x$1),K(h,I$1),K(h,S$1),K(h,R),K(h,k),n,i,o);const v=ji(l,r,n,f,p,y,0,0,0,0,0,0,0);let w=d$1.subtract(t,v);const j=Rr(v,r,n);({nanoseconds:w,days:g}=Qn(w,j));const{hours:D,minutes:N,seconds:O,milliseconds:C,microseconds:A,nanoseconds:M}=Zn(0,0,0,0,0,0,d$1.toNumber(w),"hour");return {years:f,months:p,weeks:y,days:g,hours:D,minutes:N,seconds:O,milliseconds:C,microseconds:A,nanoseconds:M}}function gi(e,t,r,n,i,o){const a=vt.reduce(((e,t)=>{const i=t[0],o=t[1],a=t[2];return "datetime"!==r&&a!==r||n.includes(o)||e.push(o,i),e}),[]);let s=rr(t,"largestUnit",r,"auto");if(n.includes(s))throw new RangeError(`largestUnit must be one of ${a.join(", ")}, not ${s}`);const l=Zt(t);let u=Jt(t,"trunc");"since"===e&&(u=function(e){switch(e){case"ceil":return "floor";case"floor":return "ceil";case"halfCeil":return "halfFloor";case"halfFloor":return "halfCeil";default:return e}}(u));const c=rr(t,"smallestUnit",r,i);if(n.includes(c))throw new RangeError(`smallestUnit must be one of ${a.join(", ")}, not ${c}`);const d=or(o,c);if("auto"===s&&(s=d),or(s,c)!==s)throw new RangeError(`largestUnit ${s} cannot be smaller than smallestUnit ${c}`);const h={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];return void 0!==h&&Kt(l,h,!1),{largestUnit:s,roundingIncrement:l,roundingMode:u,smallestUnit:c}}function vi(e,t,r,n){const i="since"===e?-1:1,o=hr(r),a=gi(e,ro(n),"time",[],"nanosecond","second"),s=K(t,v$1),l=K(o,v$1);let{hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=pi(s,l,a.roundingIncrement,a.smallestUnit,a.largestUnit,a.roundingMode);return new(m$1("%Temporal.Duration%"))(0,0,0,0,i*u,i*c,i*d,i*h,i*f,i*p)}function wi(e,t,r,n){const i="since"===e?-1:1,o=lr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"date",[],"day","day");s.largestUnit=l.largestUnit;let{years:u,months:c,weeks:d,days:h}=Nr(a,t,o,s);return "day"===l.smallestUnit&&1===l.roundingIncrement||({years:u,months:c,weeks:d,days:h}=Wi(u,c,d,h,0,0,0,0,0,0,l.roundingIncrement,l.smallestUnit,l.roundingMode,t)),new(m$1("%Temporal.Duration%"))(i*u,i*c,i*d,i*h,0,0,0,0,0,0)}function bi(e,t,r,n){const i="since"===e?-1:1,o=cr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"datetime",[],"nanosecond","day");let{years:u,months:c,weeks:d,days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=mi(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),K(o,b$2),K(o,_),K(o,E$1),K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),a,l.largestUnit,s);const D=ln(t);return ({years:u,months:c,weeks:d,days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=Wi(u,c,d,h,f,p,y,g,v,w,l.roundingIncrement,l.smallestUnit,l.roundingMode,D)),({days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=Zn(h,f,p,y,g,v,w,l.largestUnit)),new(m$1("%Temporal.Duration%"))(i*u,i*c,i*d,i*h,i*f,i*p,i*y,i*g,i*v,i*w)}function _i(e,t,r,n){const i="since"===e?-1:1,o=pr(r),a=gi(e,ro(n),"time",[],"nanosecond","hour");let{hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=fi(K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k));return ({hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=Wi(0,0,0,0,s,l,u,c,d,h,a.roundingIncrement,a.smallestUnit,a.roundingMode)),({hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=Zn(0,s,l,u,c,d,h,a.largestUnit)),new(m$1("%Temporal.Duration%"))(0,0,0,0,i*s,i*l,i*u,i*c,i*d,i*h)}function Ei(e,t,r,n){const i="since"===e?-1:1,o=mr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between months");const s=ro(n),l=gi(e,s,"date",["week","day"],"month","year");s.largestUnit=l.largestUnit;const u=kr(a,["monthCode","year"]),c=ar(t,u,[]);c.day=1;const d=en(a,c),h=ar(o,u,[]);h.day=1;const f=en(a,h);let{years:p,months:y}=Nr(a,d,f,s);return "month"===l.smallestUnit&&1===l.roundingIncrement||({years:p,months:y}=Wi(p,y,0,0,0,0,0,0,0,0,l.roundingIncrement,l.smallestUnit,l.roundingMode,d)),new(m$1("%Temporal.Duration%"))(i*p,i*y,0,0,0,0,0,0,0,0)}function Ti(e,t,r,n){const i="since"===e?-1:1,o=gr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"datetime",[],"nanosecond","hour");s.largestUnit=l.largestUnit;const u=K(t,v$1),c=K(o,v$1);let d,h,f,p,y,g,w,b,_,E;if("year"!==l.largestUnit&&"month"!==l.largestUnit&&"week"!==l.largestUnit&&"day"!==l.largestUnit)d=0,h=0,f=0,p=0,({hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=pi(u,c,l.roundingIncrement,l.smallestUnit,l.largestUnit,l.roundingMode));else {const e=K(t,A$1);if(!sn(e,K(o,A$1)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");(({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=yi(u,c,e,a,l.largestUnit,s))),({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=Wi(d,h,f,p,y,g,w,b,_,E,l.roundingIncrement,l.smallestUnit,l.roundingMode,t)),({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=Yi(d,h,f,p,y,g,w,b,_,E,l.roundingIncrement,l.smallestUnit,l.roundingMode,t));}return new(m$1("%Temporal.Duration%"))(i*d,i*h,i*f,i*p,i*y,i*g,i*w,i*b,i*_,i*E)}function xi(e,t,r,n,i,o,a,s){let l=e,u=t,c=r,d=o,h=a;return l+=n,u+=i,({year:l,month:u}=zn(l,u)),({year:l,month:u,day:c}=Yt(l,u,c,s)),h+=7*d,c+=h,({year:l,month:u,day:c}=Gn(l,u,c)),{year:l,month:u,day:c}}function Ii(e,t,r,n,i,o,a,s,l,u,c,d){let h=e,f=t,p=r,m=n,y=i,g=o;h+=a,f+=s,p+=l,m+=u,y+=c,g+=d;let v=0;return ({deltaDays:v,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}=Jn(h,f,p,m,y,g)),{deltaDays:v,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}}function Si(e,t,r,n,i,o,a,s,l,u,c,h,f,p,y,g,w,b,_,E,T){const x=or(ir(e,t,r,n,i,o,a,s,l,u),ir(c,h,f,p,y,g,w,b,_,E));let I,S,R,k,D,N,O,M,L,P;if(T)if(Nt(T)){const v=m$1("%Temporal.Duration%"),C=K(T,j),A=new v(e,t,r,n,0,0,0,0,0,0),B=new v(c,h,f,p,0,0,0,0,0,0),$="string"!=typeof C?rt(C,"dateAdd"):void 0,F=Dr(C,T,A,void 0,$),U=Dr(C,F,B,void 0,$),q=or("day",x),Y=Ne(null);Y.largestUnit=q,({years:I,months:S,weeks:R,days:k}=Nr(C,T,U,Y)),({days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=Zn(k,d$1.add(d$1.BigInt(i),d$1.BigInt(y)),d$1.add(d$1.BigInt(o),d$1.BigInt(g)),d$1.add(d$1.BigInt(a),d$1.BigInt(w)),d$1.add(d$1.BigInt(s),d$1.BigInt(b)),d$1.add(d$1.BigInt(l),d$1.BigInt(_)),d$1.add(d$1.BigInt(u),d$1.BigInt(E)),x));}else {const d=m$1("%Temporal.Instant%"),B=K(T,A$1),$=K(T,j),F=ji(K(T,C$1),B,$,e,t,r,n,i,o,a,s,l,u),U=ji(new d(F),B,$,c,h,f,p,y,g,w,b,_,E);"year"!==x&&"month"!==x&&"week"!==x&&"day"!==x?(I=0,S=0,R=0,k=0,({hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=pi(K(T,v$1),U,1,"nanosecond",x,"halfExpand"))):({years:I,months:S,weeks:R,days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=yi(K(T,v$1),U,B,$,x,Ne(null)));}else {if("year"===x||"month"===x||"week"===x)throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");I=S=R=0,({days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=Zn(n+p,d$1.add(d$1.BigInt(i),d$1.BigInt(y)),d$1.add(d$1.BigInt(o),d$1.BigInt(g)),d$1.add(d$1.BigInt(a),d$1.BigInt(w)),d$1.add(d$1.BigInt(s),d$1.BigInt(b)),d$1.add(d$1.BigInt(l),d$1.BigInt(_)),d$1.add(d$1.BigInt(u),d$1.BigInt(E)),x));}return di(I,S,R,k,D,N,O,M,L,P),{years:I,months:S,weeks:R,days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}}function Ri(e,t,r,n,i,o,a){let s=Me;s=d$1.add(s,d$1.BigInt(a)),s=d$1.add(s,d$1.multiply(d$1.BigInt(o),$e)),s=d$1.add(s,d$1.multiply(d$1.BigInt(i),Fe)),s=d$1.add(s,d$1.multiply(d$1.BigInt(n),Ue)),s=d$1.add(s,d$1.multiply(d$1.BigInt(r),d$1.BigInt(6e10))),s=d$1.add(s,d$1.multiply(d$1.BigInt(t),d$1.BigInt(36e11)));const l=d$1.add(e,s);return ci(l),l}function ki(e,t,r,n,i,o,a,s,l,u,c,d,h,f,p,y,g,v,w,T,x){let I=f,{deltaDays:S,hour:R,minute:k,second:j,millisecond:D,microsecond:N,nanosecond:O}=Ii(n,i,o,a,s,l,p,y,g,v,w,T);I+=S;const C=m$1("%Temporal.Duration%"),A=Dr(u,wr(e,t,r,u),new C(c,d,h,I,0,0,0,0,0,0),x);return {year:K(A,b$2),month:K(A,_),day:K(A,E$1),hour:R,minute:k,second:j,millisecond:D,microsecond:N,nanosecond:O}}function ji(e,t,r,n,i,o,a,s,l,u,c,d,h,f){const p=m$1("%Temporal.Duration%");if(0===Wn(n,i,o,a,0,0,0,0,0,0))return Ri(K(e,v$1),s,l,u,c,d,h);const y=hn(t,e,r),g=Dr(r,wr(K(y,b$2),K(y,_),K(y,E$1),r),new p(n,i,o,a,0,0,0,0,0,0),f),w=_r(K(g,b$2),K(g,_),K(g,E$1),K(y,T$1),K(y,x$1),K(y,I$1),K(y,S$1),K(y,R),K(y,k),r);return Ri(K(fn(t,w,"compatible"),v$1),s,l,u,c,d,h)}function Di(e,t,r,n){const i="subtract"===e?-1:1;let{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r);const y=nr(eo(n));return ({years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=Si(K(t,M$1),K(t,L),K(t,P),K(t,B$1),K(t,$),K(t,F),K(t,U),K(t,q),K(t,Y),K(t,W$1),i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,y)),new(m$1("%Temporal.Duration%"))(o,a,s,l,u,c,d,h,f,p)}function Ni(e,t,r){const n="subtract"===e?-1:1,{hours:i,minutes:o,seconds:a,milliseconds:s,microseconds:l,nanoseconds:u}=function(e,t){let r=zt(e);for(const e of t)if(0!==r[e])throw new RangeError(`Duration field ${e} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return r}(r,["years","months","weeks","days"]),c=Ri(K(t,v$1),n*i,n*o,n*a,n*s,n*l,n*u);return new(m$1("%Temporal.Instant%"))(c)}function Oi(e,t,r,n){const i="subtract"===e?-1:1,{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r),m=eo(n),y=K(t,j),{year:g,month:v,day:w,hour:D,minute:N,second:O,millisecond:C,microsecond:A,nanosecond:M}=ki(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),y,i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,m);return _r(g,v,w,D,N,O,C,A,M,y)}function Ci(e,t,r){const n="subtract"===e?-1:1,{hours:i,minutes:o,seconds:a,milliseconds:s,microseconds:l,nanoseconds:u}=zt(r);let{hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:y}=Ii(K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),n*i,n*o,n*a,n*s,n*l,n*u);return ({hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:y}=Wt(c,d,h,f,p,y,"reject")),new(m$1("%Temporal.PlainTime%"))(c,d,h,f,p,y)}function Ai(e,t,r,n){let i=zt(r);"subtract"===e&&(i={years:-i.years,months:-i.months,weeks:-i.weeks,days:-i.days,hours:-i.hours,minutes:-i.minutes,seconds:-i.seconds,milliseconds:-i.milliseconds,microseconds:-i.microseconds,nanoseconds:-i.nanoseconds});let{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=i;({days:l}=Zn(l,u,c,d,h,f,p,"day"));const y=eo(n),g=K(t,j),v=kr(g,["monthCode","year"]),w=ar(t,v,[]),b=Ne(null);St(b,w,[]),w.day=1;let _=en(g,w);const E=Wn(o,a,s,l,0,0,0,0,0,0),T=rt(g,"dateAdd"),x=m$1("%Temporal.Duration%");if(E<0){const e=Dr(g,_,new x(0,1,0,0,0,0,0,0,0,0),void 0,T),t=Dr(g,e,new x(0,0,0,-1,0,0,0,0,0,0),void 0,T);b.day=Mr(g,t),_=en(g,b);}const I=new x(o,a,s,l,0,0,0,0,0,0),S=ro(y);return tn(g,ar(Dr(g,_,I,y,T),v,[]),S)}function Mi(e,t,r,n){const i="subtract"===e?-1:1,{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r),m=eo(n),y=K(t,A$1),g=K(t,j);return Rr(ji(K(t,C$1),y,g,i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,m),y,g)}function Li(e,t,r){if(d$1.equal(t,Le))return e;let{quotient:n,remainder:i}=ht(e,t);if(d$1.equal(i,Me))return e;const o=d$1.lessThan(i,Me)?-1:1,a=mt(d$1.multiply(i,d$1.BigInt(2))),s=d$1.equal(a,t),l=d$1.greaterThan(a,t);switch(r){case"ceil":o>0&&(n=d$1.add(n,d$1.BigInt(o)));break;case"floor":o<0&&(n=d$1.add(n,d$1.BigInt(o)));break;case"expand":n=d$1.add(n,d$1.BigInt(o));break;case"trunc":break;case"halfCeil":(l||s&&o>0)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfFloor":(l||s&&o<0)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfExpand":(l||s)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfTrunc":l&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfEven":(l||s&&1===d$1.toNumber(d$1.remainder(mt(n),d$1.BigInt(2))))&&(n=d$1.add(n,d$1.BigInt(o)));}return d$1.multiply(n,t)}function Pi(e,t,r,n){let{remainder:i}=Gi(e,ze);const o=d$1.subtract(e,i),a=Li(i,d$1.BigInt(lo[r]*t),n);return d$1.add(o,a)}function Bi(e,t,r,n,i,o,a,s,l,u,c,d,h=864e11){const{deltaDays:f,hour:p,minute:m,second:y,millisecond:g,microsecond:v,nanosecond:w}=$i(n,i,o,a,s,l,u,c,d,h),{year:b,month:_,day:E}=Gn(e,t,r+f);return {year:b,month:_,day:E,hour:p,minute:m,second:y,millisecond:g,microsecond:v,nanosecond:w}}function $i(e,t,r,n,i,o,a,s,l,u=864e11){let c=Me;switch(s){case"day":case"hour":c=d$1.BigInt(e);case"minute":c=d$1.add(d$1.multiply(c,Pe),d$1.BigInt(t));case"second":c=d$1.add(d$1.multiply(c,Pe),d$1.BigInt(r));case"millisecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(n));case"microsecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(i));case"nanosecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(o));}const h="day"===s?u:lo[s],f=Li(c,d$1.BigInt(h*a),l),p=d$1.toNumber(d$1.divide(f,d$1.BigInt(h)));switch(s){case"day":return {deltaDays:p,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return Jn(p,0,0,0,0,0);case"minute":return Jn(e,p,0,0,0,0);case"second":return Jn(e,t,p,0,0,0);case"millisecond":return Jn(e,t,r,p,0,0);case"microsecond":return Jn(e,t,r,n,p,0);case"nanosecond":return Jn(e,t,r,n,i,p);default:throw new Error(`Invalid unit ${s}`)}}function Fi(e,t){return hi(K(e,b$2),K(e,_),K(e,E$1),K(t,b$2),K(t,_),K(t,E$1),"day").days}function Ui(e,t,r,n){const i=Dr(e,t,r,void 0,n);return {relativeTo:i,days:Fi(t,i)}}function qi(e,t,r,n,i){const o=K(e,A$1),a=K(e,j);return Rr(ji(K(e,C$1),o,a,t,r,n,i,0,0,0,0,0,0),o,a)}function Yi(e,t,r,n,i,o,a,s,l,u,c,h,f,p){let y=e,g=t,v=r,w=n,b=i,_=o,E=a,T=s,x=l,I=u;if(!Lt(p)||"year"===h||"month"===h||"week"===h||"day"===h||"nanosecond"===h&&1===c)return {years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I};let S=Vn(0,b,_,E,T,x,I,0);const R=xe(d$1.toNumber(S)),k=K(p,A$1),D=K(p,j),N=ji(K(p,C$1),k,D,y,g,v,w,0,0,0,0,0,0),O=ji(new(m$1("%Temporal.Instant%"))(N),k,D,0,0,0,R,0,0,0,0,0,0),M=d$1.subtract(O,N);return d$1.greaterThanOrEqual(d$1.multiply(d$1.subtract(S,M),d$1.BigInt(R)),Me)&&(({years:y,months:g,weeks:v,days:w}=Si(y,g,v,w,0,0,0,0,0,0,0,0,0,R,0,0,0,0,0,0,p)),S=Pi(d$1.subtract(S,M),c,h,f),({hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I}=Zn(0,0,0,0,0,0,d$1.toNumber(S),"hour"))),{years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I}}function Wi(e,t,r,n,i,o,a,s,l,u,c,h,f,p){let y=e,g=t,v=r,w=n,b=i,_=o,E=a,T=s,x=l,I=d$1.BigInt(u);const S=m$1("%Temporal.Duration%");let R,k,D,N,O=p;if(O){if(Lt(O))k=O,O=lr(O);else if(!Nt(O))throw new TypeError("starting point must be PlainDate or ZonedDateTime");R=K(O,j);}if("year"===h||"month"===h||"week"===h||"day"===h){let e,t,r;I=Vn(0,b,_,E,T,x,u,0),k&&(e=qi(k,y,g,v,w)),({days:t,nanoseconds:I,dayLengthNs:r}=Qn(I,e)),D=d$1.BigInt(r),w+=t,b=_=E=T=x=0;}switch(h){case"year":{if(!R)throw new RangeError("A starting point is required for years rounding");const e=new S(y),t="string"!=typeof R?rt(R,"dateAdd"):void 0,r=Dr(R,O,e,void 0,t),n=Dr(R,O,new S(y,g,v),void 0,t);O=r,w+=Fi(r,n);const i=Dr(R,O,new S(0,0,0,w),void 0,t),o=Ne(null);o.largestUnit="year";const a=Nr(R,O,i,o).years;y+=a;const s=O;O=Dr(R,O,new S(a),void 0,t),w-=Fi(s,O);const l=new S(w<0?-1:1);let{days:u}=Ui(R,O,l,t);u=Ee(u);const h=d$1.multiply(d$1.BigInt(u),D);I=d$1.add(d$1.add(d$1.multiply(h,d$1.BigInt(y)),d$1.multiply(d$1.BigInt(w),D)),I);const p=Li(I,d$1.multiply(h,d$1.BigInt(c)),f);N=Ji(I,h),y=d$1.toNumber(d$1.divide(p,h)),I=Me,g=v=w=0;break}case"month":{if(!R)throw new RangeError("A starting point is required for months rounding");const e=new S(y,g),t="string"!=typeof R?rt(R,"dateAdd"):void 0,r=Dr(R,O,e,void 0,t),n=Dr(R,O,new S(y,g,v),void 0,t);O=r,w+=Fi(r,n);const i=xe(w),o=new S(0,w<0?-1:1);let a;for(({relativeTo:O,days:a}=Ui(R,O,o,t));Ee(w)>=Ee(a);)g+=i,w-=a,({relativeTo:O,days:a}=Ui(R,O,o,t));a=Ee(a);const s=d$1.multiply(d$1.BigInt(a),D);I=d$1.add(d$1.add(d$1.multiply(s,d$1.BigInt(g)),d$1.multiply(d$1.BigInt(w),D)),I);const l=Li(I,d$1.multiply(s,d$1.BigInt(c)),f);N=Ji(I,s),g=d$1.toNumber(d$1.divide(l,s)),I=Me,v=w=0;break}case"week":{if(!R)throw new RangeError("A starting point is required for weeks rounding");const e=xe(w),t=new S(0,0,w<0?-1:1),r="string"!=typeof R?rt(R,"dateAdd"):void 0;let n;for(({relativeTo:O,days:n}=Ui(R,O,t,r));Ee(w)>=Ee(n);)v+=e,w-=n,({relativeTo:O,days:n}=Ui(R,O,t,r));n=Ee(n);const i=d$1.multiply(d$1.BigInt(n),D);I=d$1.add(d$1.add(d$1.multiply(i,d$1.BigInt(v)),d$1.multiply(d$1.BigInt(w),D)),I);const o=Li(I,d$1.multiply(i,d$1.BigInt(c)),f);N=Ji(I,i),v=d$1.toNumber(d$1.divide(o,i)),I=Me,w=0;break}case"day":{const e=D;I=d$1.add(d$1.multiply(e,d$1.BigInt(w)),I);const t=Li(I,d$1.multiply(e,d$1.BigInt(c)),f);N=Ji(I,e),w=d$1.toNumber(d$1.divide(t,e)),I=Me;break}case"hour":{const e=36e11;let t=d$1.multiply(d$1.BigInt(b),d$1.BigInt(36e11));t=d$1.add(t,d$1.multiply(d$1.BigInt(_),d$1.BigInt(6e10))),t=d$1.add(t,d$1.multiply(d$1.BigInt(E),Ue)),t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);b=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,_=E=T=x=0;break}case"minute":{const e=6e10;let t=d$1.multiply(d$1.BigInt(_),d$1.BigInt(6e10));t=d$1.add(t,d$1.multiply(d$1.BigInt(E),Ue)),t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);_=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,E=T=x=0;break}case"second":{const e=1e9;let t=d$1.multiply(d$1.BigInt(E),Ue);t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);E=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,T=x=0;break}case"millisecond":{const e=1e6;let t=d$1.multiply(d$1.BigInt(T),Fe);t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);T=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,x=0;break}case"microsecond":{const e=1e3;let t=d$1.multiply(d$1.BigInt(x),$e);t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);x=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me;break}case"nanosecond":N=d$1.toNumber(I),I=Li(d$1.BigInt(I),d$1.BigInt(c),f);}return {years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:d$1.toNumber(I),total:N}}function zi(e,t,r,n,i,o){for(const[a,s]of [[e,n],[t,i],[r,o]])if(a!==s)return Xi(a-s);return 0}function Gi(e,t){let{quotient:r,remainder:n}=ht(e,t);return d$1.lessThan(n,Me)&&(r=d$1.subtract(r,Le),n=d$1.add(n,t)),{quotient:r,remainder:n}}function Hi(e,t){const{quotient:r,remainder:n}=ht(e,t);return tt(n)||!ft(e)==!ft(t)?r:d$1.subtract(r,Le)}function Ji(e,t){const{quotient:r,remainder:n}=ht(e,t);return d$1.toNumber(r)+d$1.toNumber(n)/d$1.toNumber(t)}function Vi(e){const t=Qi(e);return void 0!==globalThis.BigInt?globalThis.BigInt(t.toString(10)):t}function Qi(e){let t=e;if("object"==typeof e){const r=e[Symbol.toPrimitive];r&&"function"==typeof r&&(t=Ce(r,e,["number"]));}if("number"==typeof t)throw new TypeError("cannot convert number to bigint");return "bigint"==typeof t?d$1.BigInt(t.toString(10)):d$1.BigInt(t)}const Zi=(()=>{let e=d$1.BigInt(Date.now()%1e6);return ()=>{const t=d$1.BigInt(Date.now()),r=d$1.add(d$1.multiply(t,Fe),e);return e=d$1.remainder(t,Fe),d$1.greaterThan(r,He)?He:d$1.lessThan(r,Ge)?Ge:r}})();function Ki(){return (new we).resolvedOptions().timeZone}function Xi(e){return e<0?-1:e>0?1:e}function eo(e){if(void 0===e)return Ne(null);if(it(e)&&null!==e)return e;throw new TypeError("Options parameter must be an object, not "+(null===e?"null":typeof e))}function to(e,t){const r=Ne(null);return r[e]=t,r}function ro(e){const t=Ne(null);return St(t,eo(e),[]),t}function no(e,t,r,n){let i=e[t];if(void 0!==i){if(i=lt$1(i),!r.includes(i))throw new RangeError(`${t} must be one of ${r.join(", ")}, not ${i}`);return i}return n}function io(e){return et.includes(oo(e))}function oo(e){return e.replace(/[A-Z]/g,(e=>{const t=e.charCodeAt(0);return String.fromCharCode(t+32)}))}const ao=new RegExp(`^${se.source}$`);function so(e,t,r,n=e(t),i=e(r)){let o=d$1.BigInt(t),a=d$1.BigInt(r),s=n,l=i;for(;d$1.greaterThan(d$1.subtract(a,o),Le);){const t=d$1.divide(d$1.add(o,a),d$1.BigInt(2)),r=e(t);if(r===s)o=t,s=r;else {if(r!==l)throw new Error(`invalid state in bisection ${s} - ${r} - ${l}`);a=t,l=r;}}return a}const lo={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},uo=Symbol("date"),co=Symbol("ym"),ho=Symbol("md"),fo=Symbol("time"),po=Symbol("datetime"),mo=Symbol("instant"),yo=Symbol("original"),go=Symbol("timezone"),vo=Symbol("calendar-id"),wo=Symbol("locale"),bo=Symbol("options"),_o=e=>({value:e,enumerable:!0,writable:!1,configurable:!0}),Eo=globalThis.Intl.DateTimeFormat,To=Object.assign,xo=Object.prototype.hasOwnProperty,Io=Reflect.apply;function So(e,t){let r=e[t];return "function"==typeof r&&(r=new Eo(e[wo],r(e[bo])),e[t]=r),r}function Ro(e,t={}){if(!(this instanceof Ro))return new Ro(e,t);const r=void 0!==t,n=r?To({},t):{},i=new Eo(e,n),o=i.resolvedOptions();if(r){const e=To({},o);for(const t in e)Io(xo,n,[t])||delete e[t];this[bo]=e;}else this[bo]=n;this[wo]=o.locale,this[yo]=i,this[go]=o.timeZone,this[vo]=o.calendar,this[uo]=Ao,this[co]=Oo,this[ho]=Co,this[fo]=No,this[po]=Mo,this[mo]=Lo;}Object.defineProperty(Ro,"name",{writable:!0,value:"DateTimeFormat"}),Ro.supportedLocalesOf=function(e,t){return Eo.supportedLocalesOf(e,t)};const ko={resolvedOptions:_o((function(){return this[yo].resolvedOptions()})),format:_o((function(e,...t){let{instant:r,formatter:n}=Uo(e,this);return r&&n?n.format(r.epochMilliseconds):this[yo].format(e,...t)})),formatRange:_o((function(e,t){if($o(e)||$o(t)){if(!Fo(e,t))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");const{instant:r,formatter:n}=Uo(e,this),{instant:i,formatter:o}=Uo(t,this);if(r&&i&&n&&o&&n===o)return n.formatRange(r.epochMilliseconds,i.epochMilliseconds)}return this[yo].formatRange(e,t)}))};"formatToParts"in Eo.prototype&&(ko.formatToParts=_o((function(e,...t){let{instant:r,formatter:n}=Uo(e,this);return r&&n?n.formatToParts(r.epochMilliseconds):this[yo].formatToParts(e,...t)}))),"formatRangeToParts"in Eo.prototype&&(ko.formatRangeToParts=_o((function(e,t){if($o(e)||$o(t)){if(!Fo(e,t))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");const{instant:r,formatter:n}=Uo(e,this),{instant:i,formatter:o}=Uo(t,this);if(r&&i&&n&&o&&n===o)return n.formatRangeToParts(r.epochMilliseconds,i.epochMilliseconds)}return this[yo].formatRangeToParts(e,t)}))),Ro.prototype=Object.create(Eo.prototype,ko),Object.defineProperty(Ro,"prototype",{writable:!1,enumerable:!1,configurable:!1});const jo=Ro;function Do(e={},t={}){const r=To({},e);for(const e of ["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[e]=e in t?t[e]:r[e],!1!==r[e]&&void 0!==r[e]||delete r[e];return r}function No(e){let t=Do(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return Bo(t)||(t=To({},t,{hour:"numeric",minute:"numeric",second:"numeric"})),t}function Oo(e){let t=Do(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "year"in t||"month"in t||(t=To(t,{year:"numeric",month:"numeric"})),t}function Co(e){let t=Do(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "month"in t||"day"in t||(t=To({},t,{month:"numeric",day:"numeric"})),t}function Ao(e){let t=Do(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric"})),t}function Mo(e){let t=Do(e,{timeZoneName:!1});return Bo(t)||Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function Lo(e){let t=e;return Bo(t)||Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function Po(e){return "year"in e||"month"in e||"day"in e||"weekday"in e||"dateStyle"in e}function Bo(e){return "hour"in e||"minute"in e||"second"in e||"timeStyle"in e||"dayPeriod"in e}function $o(e){return Nt(e)||Ot(e)||Ct(e)||Lt(e)||At(e)||Mt(e)||Rt(e)}function Fo(e,t){return !(!$o(e)||!$o(t)||Ot(e)&&!Ot(t)||Nt(e)&&!Nt(t)||Ct(e)&&!Ct(t)||Lt(e)&&!Lt(t)||At(e)&&!At(t)||Mt(e)&&!Mt(t)||Rt(e)&&!Rt(t))}function Uo(e,t){const r=m$1("%Temporal.PlainDateTime%");if(Ot(e)){const n=new r(1970,1,1,K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k),t[vo]);return {instant:fn(t[go],n,"compatible"),formatter:So(t,fo)}}if(At(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if(a!==t[vo])throw new RangeError(`cannot format PlainYearMonth with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,a);return {instant:fn(t[go],s,"compatible"),formatter:So(t,co)}}if(Mt(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if(a!==t[vo])throw new RangeError(`cannot format PlainMonthDay with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,a);return {instant:fn(t[go],s,"compatible"),formatter:So(t,ho)}}if(Nt(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if("iso8601"!==a&&a!==t[vo])throw new RangeError(`cannot format PlainDate with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,t[vo]);return {instant:fn(t[go],s,"compatible"),formatter:So(t,uo)}}if(Ct(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=K(e,T$1),s=K(e,x$1),l=K(e,I$1),u=K(e,S$1),c=K(e,R),d=K(e,k),h=Vr(K(e,j));if("iso8601"!==h&&h!==t[vo])throw new RangeError(`cannot format PlainDateTime with calendar ${h} in locale with calendar ${t[vo]}`);let f=e;return "iso8601"===h&&(f=new r(n,i,o,a,s,l,u,c,d,t[vo])),{instant:fn(t[go],f,"compatible"),formatter:So(t,po)}}if(Lt(e))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return Rt(e)?{instant:e,formatter:So(t,mo)}:{}}class qo{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");const t=Qi(e);ci(t),Q(this),X(this,v$1,t);}get epochSeconds(){if(!Rt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Ue))}get epochMilliseconds(){if(!Rt(this))throw new TypeError("invalid receiver");const e=d$1.BigInt(K(this,v$1));return d$1.toNumber(Hi(e,Fe))}get epochMicroseconds(){if(!Rt(this))throw new TypeError("invalid receiver");return Vi(Hi(d$1.BigInt(K(this,v$1)),$e))}get epochNanoseconds(){if(!Rt(this))throw new TypeError("invalid receiver");return Vi(d$1.BigInt(K(this,v$1)))}add(e){if(!Rt(this))throw new TypeError("invalid receiver");return Ni("add",this,e)}subtract(e){if(!Rt(this))throw new TypeError("invalid receiver");return Ni("subtract",this,e)}until(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return vi("until",this,e,t)}since(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return vi("since",this,e,t)}round(e){if(!Rt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr);Kt(r,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0);const o=Pi(K(this,v$1),r,i,n);return new qo(o)}equals(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,v$1),n=K(t,v$1);return d$1.equal(d$1.BigInt(r),d$1.BigInt(n))}toString(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i)throw new RangeError('smallestUnit must be a time unit other than "hour"');let o=t.timeZone;void 0!==o&&(o=nn(o));const{precision:a,unit:s,increment:l}=er(i,r),u=Pi(K(this,v$1),l,s,n);return wn(new qo(u),o,a)}toJSON(){if(!Rt(this))throw new TypeError("invalid receiver");return wn(this,void 0,"auto")}toLocaleString(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!Rt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument in toZonedDateTime");const t=e.calendar;if(void 0===t)throw new TypeError("missing calendar property in toZonedDateTime");const r=Hr(t),n=e.timeZone;if(void 0===n)throw new TypeError("missing timeZone property in toZonedDateTime");const i=nn(n);return Rr(K(this,v$1),i,r)}toZonedDateTimeISO(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=nn(e);return Rr(K(this,v$1),t,"iso8601")}static fromEpochSeconds(e){const t=ot(e),r=d$1.multiply(d$1.BigInt(t),Ue);return ci(r),new qo(r)}static fromEpochMilliseconds(e){const t=ot(e),r=d$1.multiply(d$1.BigInt(t),Fe);return ci(r),new qo(r)}static fromEpochMicroseconds(e){const t=Qi(e),r=d$1.multiply(t,$e);return ci(r),new qo(r)}static fromEpochNanoseconds(e){const t=Qi(e);return ci(t),new qo(t)}static from(e){return Rt(e)?new qo(K(e,v$1)):hr(e)}static compare(e,t){const r=hr(e),n=hr(t),i=K(r,v$1),o=K(n,v$1);return d$1.lessThan(i,o)?-1:d$1.greaterThan(i,o)?1:0}}f$2(qo,"Temporal.Instant");const Yo=Array.prototype.includes,Wo=Array.prototype.push,zo=globalThis.Intl.DateTimeFormat,Go=Array.prototype.sort,Ho=Math.abs,Jo=Math.floor,Vo=Object.create,Qo=Object.entries,Zo=Set,Ko=Reflect.ownKeys,Xo=Set.prototype.add,ea=Set.prototype.values,ta={};class ra{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");const t=lt$1(e);if(!io(t))throw new RangeError(`invalid calendar identifier ${t}`);Q(this),X(this,z$1,oo(t));}get id(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}dateFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].dateFromFields(e,r,n)}yearMonthFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].yearMonthFromFields(e,r,n)}monthDayFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].monthDayFromFields(e,r,n)}fields(e){if(!jt(this))throw new TypeError("invalid receiver");const t=[],r=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(const n of e){if("string"!=typeof n)throw new TypeError("invalid fields");if(!r.has(n))throw new RangeError(`invalid field name ${n}`);r.delete(n),Wo.call(t,n);}return ta[K(this,z$1)].fields(t)}mergeFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");const r=It(e),n=Vo(null);St(n,r,[],[void 0]);const i=It(t),o=Vo(null);St(o,i,[],[void 0]);const a=Ko(o),s=ta[K(this,z$1)].fieldKeysToIgnore(a),l=Vo(null),u=Ko(n);for(const e of u){let t;t=nt(Yo,s,[e])?o[e]:n[e],void 0!==t&&(l[e]=t);}return St(l,o,[]),l}dateAdd(e,t,r){if(!jt(this))throw new TypeError("invalid receiver");const n=lr(e),i=dr(t),o=Gt(eo(r)),{days:a}=Zn(K(i,B$1),K(i,$),K(i,F),K(i,U),K(i,q),K(i,Y),K(i,W$1),"day"),s=K(this,z$1);return ta[s].dateAdd(n,K(i,M$1),K(i,L),K(i,P),a,o,s)}dateUntil(e,t,r){if(!jt(this))throw new TypeError("invalid receiver");const n=lr(e),i=lr(t);let o=rr(eo(r),"largestUnit","date","auto");"auto"===o&&(o="day");const{years:a,months:s,weeks:l,days:u}=ta[K(this,z$1)].dateUntil(n,i,o);return new(m$1("%Temporal.Duration%"))(a,s,l,u,0,0,0,0,0,0)}year(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].year(t)}month(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");if(Mt(t))throw new TypeError("use monthCode on PlainMonthDay instead");return At(t)||(t=lr(t)),ta[K(this,z$1)].month(t)}monthCode(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||Mt(t)||(t=lr(t)),ta[K(this,z$1)].monthCode(t)}day(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return Mt(t)||(t=lr(t)),ta[K(this,z$1)].day(t)}era(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].era(t)}eraYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].eraYear(t)}dayOfWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].dayOfWeek(t)}dayOfYear(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].dayOfYear(t)}weekOfYear(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].weekOfYear(t)}yearOfWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].yearOfWeek(t)}daysInWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].daysInWeek(t)}daysInMonth(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].daysInMonth(t)}daysInYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].daysInYear(t)}monthsInYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].monthsInYear(t)}inLeapYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].inLeapYear(t)}toString(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}toJSON(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}static from(e){return Qr(Hr(e))}}function na(e){if(!e.startsWith("M"))throw new RangeError(`Invalid month code: ${e}. Month codes must start with M.`);const t=+e.slice(1);if(isNaN(t))throw new RangeError(`Invalid month code: ${e}`);return t}function ia(e,t=!1){return `M${e.toString().padStart(2,"0")}${t?"L":""}`}function oa(e,t,r=12){let{month:n,monthCode:i}=e;if(void 0===i){if(void 0===n)throw new TypeError("Either month or monthCode are required");"reject"===t&&ii(n,1,r),"constrain"===t&&(n=ri(n,1,r)),i=ia(n);}else {const e=na(i);if(void 0!==n&&n!==e)throw new RangeError(`monthCode ${i} and month ${n} must match if both are present`);if(i!==ia(e))throw new RangeError(`Invalid month code: ${i}`);if(n=e,n<1||n>r)throw new RangeError(`Invalid monthCode: ${i}`)}return {...e,month:n,monthCode:i}}f$2(ra,"Temporal.Calendar"),p$1("Temporal.Calendar.from",ra.from),p$1("Temporal.Calendar.prototype.dateAdd",ra.prototype.dateAdd),p$1("Temporal.Calendar.prototype.dateFromFields",ra.prototype.dateFromFields),p$1("Temporal.Calendar.prototype.dateUntil",ra.prototype.dateUntil),p$1("Temporal.Calendar.prototype.day",ra.prototype.day),p$1("Temporal.Calendar.prototype.dayOfWeek",ra.prototype.dayOfWeek),p$1("Temporal.Calendar.prototype.dayOfYear",ra.prototype.dayOfYear),p$1("Temporal.Calendar.prototype.daysInMonth",ra.prototype.daysInMonth),p$1("Temporal.Calendar.prototype.daysInWeek",ra.prototype.daysInWeek),p$1("Temporal.Calendar.prototype.daysInYear",ra.prototype.daysInYear),p$1("Temporal.Calendar.prototype.era",ra.prototype.era),p$1("Temporal.Calendar.prototype.eraYear",ra.prototype.eraYear),p$1("Temporal.Calendar.prototype.fields",ra.prototype.fields),p$1("Temporal.Calendar.prototype.inLeapYear",ra.prototype.inLeapYear),p$1("Temporal.Calendar.prototype.mergeFields",ra.prototype.mergeFields),p$1("Temporal.Calendar.prototype.month",ra.prototype.month),p$1("Temporal.Calendar.prototype.monthCode",ra.prototype.monthCode),p$1("Temporal.Calendar.prototype.monthDayFromFields",ra.prototype.monthDayFromFields),p$1("Temporal.Calendar.prototype.monthsInYear",ra.prototype.monthsInYear),p$1("Temporal.Calendar.prototype.weekOfYear",ra.prototype.weekOfYear),p$1("Temporal.Calendar.prototype.year",ra.prototype.year),p$1("Temporal.Calendar.prototype.yearMonthFromFields",ra.prototype.yearMonthFromFields),p$1("Temporal.Calendar.prototype.yearOfWeek",ra.prototype.yearOfWeek),ta.iso8601={dateFromFields(e,t,r){let n=ar(e,["day","month","monthCode","year"],["year","day"]);const i=Gt(t);n=oa(n);let{year:o,month:a,day:s}=n;return ({year:o,month:a,day:s}=Yt(o,a,s,i)),wr(o,a,s,r)},yearMonthFromFields(e,t,r){let n=ar(e,["month","monthCode","year"],["year"]);const i=Gt(t);n=oa(n);let{year:o,month:a}=n;return ({year:o,month:a}=function(e,t,r){let n=e,i=t;switch(r){case"reject":oi(n,i,1);break;case"constrain":({year:n,month:i}=ni(n,i));}return {year:n,month:i}}(o,a,i)),Ir(o,a,r,1)},monthDayFromFields(e,t,r){let n=ar(e,["day","month","monthCode","year"],["day"]);const i=Gt(t);if(void 0!==n.month&&void 0===n.year&&void 0===n.monthCode)throw new TypeError("either year or monthCode required with month");const o=void 0===n.monthCode;n=oa(n);let{month:a,day:s,year:l}=n;return ({month:a,day:s}=Yt(o?l:1972,a,s,i)),Tr(a,s,r,1972)},fields:e=>e,fieldKeysToIgnore(e){const t=new Zo;for(let r=0;r<e.length;r++){const n=e[r];nt(Xo,t,[n]),"month"===n?nt(Xo,t,["monthCode"]):"monthCode"===n&&nt(Xo,t,["month"]);}return [...nt(ea,t,[])]},dateAdd(e,t,r,n,i,o,a){let s=K(e,b$2),l=K(e,_),u=K(e,E$1);return ({year:s,month:l,day:u}=xi(s,l,u,t,r,n,i,o)),wr(s,l,u,a)},dateUntil:(e,t,r)=>hi(K(e,b$2),K(e,_),K(e,E$1),K(t,b$2),K(t,_),K(t,E$1),r),year:e=>K(e,b$2),era(){},eraYear(){},month:e=>K(e,_),monthCode:e=>ia(K(e,_)),day:e=>K(e,E$1),dayOfWeek:e=>Un(K(e,b$2),K(e,_),K(e,E$1)),dayOfYear:e=>qn(K(e,b$2),K(e,_),K(e,E$1)),weekOfYear:e=>Yn(K(e,b$2),K(e,_),K(e,E$1)).week,yearOfWeek:e=>Yn(K(e,b$2),K(e,_),K(e,E$1)).year,daysInWeek:()=>7,daysInMonth:e=>Fn(K(e,b$2),K(e,_)),daysInYear(e){let t=e;return Z(t,b$2)||(t=lr(t)),$n(K(t,b$2))?366:365},monthsInYear:()=>12,inLeapYear(e){let t=e;return Z(t,b$2)||(t=lr(t)),$n(K(t,b$2))}};class aa{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),void 0!==e){let t=0;for(const r of e.map.entries()){if(++t>aa.MAX_CACHE_ENTRIES)break;this.map.set(...r);}}}get(e){const t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report();}report(){}setObject(e){if(aa.objectMap.get(e))throw new RangeError("object already cached");aa.objectMap.set(e,this),this.report();}static getCacheForObject(e){let t=aa.objectMap.get(e);return t||(t=new aa,aa.objectMap.set(e,t)),t}}function sa({isoYear:e,isoMonth:t,isoDay:r}){return `${yn(e)}-${gn(t)}-${gn(r)}T00:00Z`}function la(e,t){return {years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}aa.objectMap=new WeakMap,aa.MAX_CACHE_ENTRIES=1e3;class ua{constructor(){this.eraLength="short",this.hasEra=!0,this.erasBeginMidYear=!1;}getFormatter(){return void 0===this.formatter&&(this.formatter=new zo(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,t){const{year:r,month:n,day:i}=e,o=JSON.stringify({func:"isoToCalendarDate",isoYear:r,isoMonth:n,isoDay:i,id:this.id}),a=t.get(o);if(a)return a;const s=this.getFormatter();let l,u;try{u=sa({isoYear:r,isoMonth:n,isoDay:i}),l=s.formatToParts(new Date(u));}catch(e){throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:r,isoMonth:n,isoDay:i})}`)}const c={};for(let{type:e,value:t}of l){if("year"===e&&(c.eraYear=+t),"relatedYear"===e&&(c.eraYear=+t),"month"===e){const e=/^([0-9]*)(.*?)$/.exec(t);if(!e||3!=e.length||!e[1]&&!e[2])throw new RangeError(`Unexpected month: ${t}`);if(c.month=e[1]?+e[1]:1,c.month<1)throw new RangeError(`Invalid month ${t} from ${u}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(c.month>13)throw new RangeError(`Invalid month ${t} from ${u}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(c.monthExtra=e[2]);}"day"===e&&(c.day=+t),this.hasEra&&"era"===e&&null!=t&&""!==t&&(t=t.split(" (")[0],c.era=t.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase());}if(void 0===c.eraYear)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){const{era:t,eraYear:r}=this.reviseIntlEra(c,e);c.era=t,c.eraYear=r;}this.checkIcuBugs&&this.checkIcuBugs(e);const d=this.adjustCalendarDate(c,t,"constrain",!0);if(void 0===d.year)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(void 0===d.month)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(void 0===d.day)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(o,d),["constrain","reject"].forEach((r=>{const n=JSON.stringify({func:"calendarToIsoDate",year:d.year,month:d.month,day:d.day,overflow:r,id:this.id});t.set(n,e);})),d}validateCalendarDate(e){const{era:t,month:r,year:n,day:i,eraYear:o,monthCode:a,monthExtra:s}=e;if(void 0!==s)throw new RangeError("Unexpected `monthExtra` value");if(void 0===n&&void 0===o)throw new TypeError("year or eraYear is required");if(void 0===r&&void 0===a)throw new TypeError("month or monthCode is required");if(void 0===i)throw new RangeError("Missing day");if(void 0!==a){if("string"!=typeof a)throw new RangeError("monthCode must be a string, not "+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw new RangeError(`Invalid monthCode: ${a}`)}if(this.constantEra){if(void 0!==t&&t!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${t}`);if(void 0!==o&&void 0!==n&&o!==n)throw new RangeError(`eraYear ${o} does not match year ${n}`)}if(this.hasEra&&void 0===e.era!=(void 0===e.eraYear))throw new RangeError("properties 'era' and 'eraYear' must be provided together")}adjustCalendarDate(e,t,r="constrain",n=!1){if("lunisolar"===this.calendarType)throw new RangeError("Override required for lunisolar calendars");let i=e;if(this.validateCalendarDate(i),this.constantEra){const{year:e,eraYear:t}=i;i={...i,era:this.constantEra,year:void 0!==e?e:t,eraYear:void 0!==t?t:e};}const o=this.monthsInYear(i,t);let{month:a,monthCode:s}=i;return ({month:a,monthCode:s}=oa(i,r,o)),{...i,month:a,monthCode:s}}regulateMonthDayNaive(e,t,r){const n=this.monthsInYear(e,r);let{month:i,day:o}=e;return "reject"===t?(ii(i,1,n),ii(o,1,this.maximumMonthLength(e))):(i=ri(i,1,n),o=ri(o,1,this.maximumMonthLength({...e,month:i}))),{...e,month:i,day:o}}calendarToIsoDate(e,t="constrain",r){const n=e;let i=this.adjustCalendarDate(e,r,t,!1);i=this.regulateMonthDayNaive(i,t,r);const{year:o,month:a,day:s}=i,l=JSON.stringify({func:"calendarToIsoDate",year:o,month:a,day:s,overflow:t,id:this.id});let u,c=r.get(l);if(c)return c;if(void 0!==n.year&&void 0!==n.month&&void 0!==n.day&&(n.year!==i.year||n.month!==i.month||n.day!==i.day)&&(u=JSON.stringify({func:"calendarToIsoDate",year:n.year,month:n.month,day:n.day,overflow:t,id:this.id}),c=r.get(u),c))return c;let d=this.estimateIsoDate({year:o,month:a,day:s});const h=e=>{let n=this.addDaysIso(d,e);if(i.day>this.minimumMonthLength(i)){let e=this.isoToCalendarDate(n,r);for(;e.month!==a||e.year!==o;){if("reject"===t)throw new RangeError(`day ${s} does not exist in month ${a} of year ${o}`);n=this.addDaysIso(n,-1),e=this.isoToCalendarDate(n,r);}}return n};let f=0,p=this.isoToCalendarDate(d,r),m=la(i,p);if(0!==m.years||0!==m.months||0!==m.days){const e=365*m.years+30*m.months+m.days;d=this.addDaysIso(d,e),p=this.isoToCalendarDate(d,r),m=la(i,p),0===m.years&&0===m.months?d=h(m.days):f=this.compareCalendarDates(i,p);}let y=8;for(;f;){d=this.addDaysIso(d,f*y);const e=p;p=this.isoToCalendarDate(d,r);const o=f;if(f=this.compareCalendarDates(i,p),f)if(m=la(i,p),0===m.years&&0===m.months)d=h(m.days),f=0;else if(o&&f!==o)if(y>1)y/=2;else {if("reject"===t)throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...n})}`);this.compareCalendarDates(p,e)>0&&(d=this.addDaysIso(d,-1)),f=0;}}if(r.set(l,d),u&&r.set(u,d),void 0===i.year||void 0===i.month||void 0===i.day||void 0===i.monthCode||this.hasEra&&(void 0===i.era||void 0===i.eraYear))throw new RangeError("Unexpected missing property");return d}temporalToCalendarDate(e,t){const r={year:K(e,b$2),month:K(e,_),day:K(e,E$1)};return this.isoToCalendarDate(r,t)}compareCalendarDates(e,t){const r=ar(e,["day","month","year"],["day","month","year"]),n=ar(t,["day","month","year"],["day","month","year"]);return r.year!==n.year?Xi(r.year-n.year):r.month!==n.month?Xi(r.month-n.month):r.day!==n.day?Xi(r.day-n.day):0}regulateDate(e,t="constrain",r){const n=this.calendarToIsoDate(e,t,r);return this.isoToCalendarDate(n,r)}addDaysIso(e,t){return xi(e.year,e.month,e.day,0,0,0,t,"constrain")}addDaysCalendar(e,t,r){const n=this.calendarToIsoDate(e,"constrain",r),i=this.addDaysIso(n,t);return this.isoToCalendarDate(i,r)}addMonthsCalendar(e,t,r,n){let i=e;const{day:o}=i;for(let e=0,r=Ho(t);e<r;e++){const{month:e}=i,r=i,a=t<0?-Math.max(o,this.daysInPreviousMonth(i,n)):this.daysInMonth(i,n),s=this.calendarToIsoDate(i,"constrain",n);let l=this.addDaysIso(s,a);if(i=this.isoToCalendarDate(l,n),t>0){const t=this.monthsInYear(r,n);for(;i.month-1!=e%t;)l=this.addDaysIso(l,-1),i=this.isoToCalendarDate(l,n);}i.day!==o&&(i=this.regulateDate({...i,day:o},"constrain",n));}if("reject"===r&&i.day!==o)throw new RangeError(`Day ${o} does not exist in resulting calendar month`);return i}addCalendar(e,{years:t=0,months:r=0,weeks:n=0,days:i=0},o,a){const{year:s,day:l,monthCode:u}=e,c=this.adjustCalendarDate({year:s+t,monthCode:u,day:l},a),d=this.addMonthsCalendar(c,r,o,a),h=i+7*n;return this.addDaysCalendar(d,h,a)}untilCalendar(e,t,r,n){let i=0,o=0,a=0,s=0;switch(r){case"day":i=this.calendarDaysUntil(e,t,n);break;case"week":{const r=this.calendarDaysUntil(e,t,n);i=r%7,o=(r-i)/7;break}case"month":case"year":{const o=this.compareCalendarDates(t,e);if(!o)return {years:0,months:0,weeks:0,days:0};const l=t.year-e.year,u=t.day-e.day;if("year"===r&&l){let r=0;t.monthCode>e.monthCode&&(r=1),t.monthCode<e.monthCode&&(r=-1),r||(r=Math.sign(u)),s=r*o<0?l-o:l;}let c,d=s?this.addCalendar(e,{years:s},"constrain",n):e;do{a+=o,c=d,d=this.addMonthsCalendar(c,o,"constrain",n),d.day!==e.day&&(d=this.regulateDate({...d,day:e.day},"constrain",n));}while(this.compareCalendarDates(t,d)*o>=0);a-=o,i=this.calendarDaysUntil(c,t,n);break}}return {years:s,months:a,weeks:o,days:i}}daysInMonth(e,t){const{day:r}=e,n=this.maximumMonthLength(e),i=this.minimumMonthLength(e);if(i===n)return i;const o=r<=n-i?n:i,a=this.calendarToIsoDate(e,"constrain",t),s=this.addDaysIso(a,o),l=this.isoToCalendarDate(s,t),u=this.addDaysIso(s,-l.day);return this.isoToCalendarDate(u,t).day}daysInPreviousMonth(e,t){const{day:r,month:n,year:i}=e;let o={year:n>1?i:i-1,month:n,day:1};const a=n>1?n-1:this.monthsInYear(o,t);o={...o,month:a};const s=this.minimumMonthLength(o),l=this.maximumMonthLength(o);if(s===l)return l;const u=this.calendarToIsoDate(e,"constrain",t),c=this.addDaysIso(u,-r);return this.isoToCalendarDate(c,t).day}startOfCalendarYear(e){return {year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return {year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,r){const n=this.calendarToIsoDate(e,"constrain",r),i=this.calendarToIsoDate(t,"constrain",r);return this.isoDaysUntil(n,i)}isoDaysUntil(e,t){return hi(e.year,e.month,e.day,t.year,t.month,t.day,"day").days}monthDayFromFields(e,t,r){let n,i,o,a,s,{monthCode:l,day:u}=e;if(void 0===l){let{year:n,era:i,eraYear:o}=e;if(void 0===n&&(void 0===i||void 0===o))throw new TypeError("when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required");({monthCode:l,day:u}=this.isoToCalendarDate(this.calendarToIsoDate(e,t,r),r));}const c=this.isoToCalendarDate({year:1972,month:12,day:31},r),d=c.monthCode>l||c.monthCode===l&&c.day>=u?c.year:c.year-1;for(let e=0;e<100;e++){const c=this.adjustCalendarDate({day:u,monthCode:l,year:d-e},r),h=this.calendarToIsoDate(c,"constrain",r),f=this.isoToCalendarDate(h,r);if(({year:n,month:i,day:o}=h),f.monthCode===l&&f.day===u)return {month:i,day:o,year:n};"constrain"===t&&(void 0===a||f.monthCode===a.monthCode&&f.day>a.day)&&(a=f,s=h);}if("constrain"===t&&void 0!==s)return s;throw new RangeError(`No recent ${this.id} year with monthCode ${l} and day ${u}`)}}class ca extends ua{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1;}inLeapYear(e){const{year:t}=e;return (7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,t){const{month:r,year:n}=e,i=this.getMonthCode(n,r),o=Qo(this.months).find((e=>e[1].monthCode===i));if(void 0===o)throw new RangeError(`unmatched Hebrew month: ${r}`);const a=o[1].days;return "number"==typeof a?a:a[t]}estimateIsoDate(e){const{year:t}=e;return {year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?6===t?ia(5,!0):ia(t<6?t:t-1):ia(t)}adjustCalendarDate(e,t,r="constrain",n=!1){let{year:i,eraYear:o,month:a,monthCode:s,day:l,monthExtra:u}=e;if(void 0===i&&void 0!==o&&(i=o),void 0===o&&void 0!==i&&(o=i),n){if(u){const e=this.months[u];if(!e)throw new RangeError(`Unrecognized month from formatToParts: ${u}`);a=this.inLeapYear({year:i})?e.leap:e.regular;}return s=this.getMonthCode(i,a),{year:i,month:a,day:l,era:void 0,eraYear:o,monthCode:s}}if(this.validateCalendarDate(e),void 0===a)if(s.endsWith("L")){if("M05L"!==s)throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${s}`);if(a=6,!this.inLeapYear({year:i})){if("reject"===r)throw new RangeError(`Hebrew monthCode M05L is invalid in year ${i} which is not a leap year`);a=6,s="M06";}}else {a=na(s),this.inLeapYear({year:i})&&a>=6&&a++;const e=this.monthsInYear({year:i});if(a<1||a>e)throw new RangeError(`Invalid monthCode: ${s}`)}else if("reject"===r?(ii(a,1,this.monthsInYear({year:i})),ii(l,1,this.maximumMonthLength({year:i,month:a}))):(a=ri(a,1,this.monthsInYear({year:i})),l=ri(l,1,this.maximumMonthLength({year:i,month:a}))),void 0===s)s=this.getMonthCode(i,a);else if(this.getMonthCode(i,a)!==s)throw new RangeError(`monthCode ${s} doesn't correspond to month ${a} in Hebrew year ${i}`);return {...e,day:l,month:a,monthCode:s,year:i,eraYear:o}}}class da extends ua{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah";}inLeapYear(e,t){return 30===this.daysInMonth({year:e.year,month:12,day:1},t)}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:Jo(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class ha extends da{constructor(){super(...arguments),this.id="islamic";}}class fa extends da{constructor(){super(...arguments),this.id="islamic-umalqura";}}class pa extends da{constructor(){super(...arguments),this.id="islamic-tbla";}}class ma extends da{constructor(){super(...arguments),this.id="islamic-civil";}}class ya extends da{constructor(){super(...arguments),this.id="islamic-rgsa";}}class ga extends da{constructor(){super(...arguments),this.id="islamicc";}}class va extends ua{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap";}inLeapYear(e,t){return ha.prototype.inLeapYear.call(this,e,t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 12===t?29:t<=6?31:30}maximumMonthLength(e){const{month:t}=e;return 12===t?30:t<=6?31:30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:t+621,month:1,day:1}}}class wa extends ua{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug="10/11/-79 Saka"!==new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"});}inLeapYear(e){return ba(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){const{month:t}=e;let r=this.months[t];if(void 0===r)throw new RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&r.leap&&(r=r.leap),r}estimateIsoDate(e){const t=this.adjustCalendarDate(e),r=this.getMonthInfo(t);return xi(t.year+78+(r.nextYear?1:0),r.month,r.day,0,0,0,t.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function ba(e){return e%4==0&&(e%100!=0||e%400==0)}class _a extends ua{constructor(e,t){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;const{eras:r,anchorEra:n}=function(e){let t,r=e;if(0===r.length)throw new RangeError("Invalid era data: eras are required");if(1===r.length&&r[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(1===r.length&&!r[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(r.filter((e=>null!=e.reverseOf)).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");r.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw new RangeError("Invalid era data: cannot have multiple anchor eras");t=e,e.anchorEpoch={year:e.hasYearZero?0:1};}else if(!e.name)throw new RangeError("If era name is blank, it must be the anchor era")})),r=r.filter((e=>e.name)),r.forEach((e=>{const{reverseOf:t}=e;if(t){const n=r.find((e=>e.name===t));if(void 0===n)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=n,e.anchorEpoch=n.anchorEpoch,e.isoEpoch=n.isoEpoch;}void 0===e.anchorEpoch.month&&(e.anchorEpoch.month=1),void 0===e.anchorEpoch.day&&(e.anchorEpoch.day=1);})),Go.call(r,((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return -1;if(!e.isoEpoch||!t.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return t.isoEpoch.year-e.isoEpoch.year}));const n=r[r.length-1].reverseOf;if(n&&n!==r[r.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return r.forEach(((e,t)=>{e.genericName="era"+(r.length-1-t);})),{eras:r,anchorEra:t||r[0]}}(t);this.anchorEra=n,this.eras=r;}inLeapYear(e){const{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return ba(t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 2===t?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){const t=(t,r)=>{const n=e[t];if(null!=n&&n!=r)throw new RangeError(`Input ${t} ${n} doesn't match calculated value ${r}`)},r=t=>{let r;const n={...e,year:t},i=this.eras.find(((e,i)=>{if(i===this.eras.length-1){if(e.reverseOf){if(t>0)throw new RangeError(`Signed year ${t} is invalid for era ${e.name}`);return r=e.anchorEpoch.year-t,!0}return r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0}return this.compareCalendarDates(n,e.anchorEpoch)>=0&&(r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0)}));if(!i)throw new RangeError(`Year ${t} was not matched by any era`);return {eraYear:r,era:i.name}};let{year:n,eraYear:i,era:o}=e;if(null!=n)(({eraYear:i,era:o}=r(n))),t("era",o),t("eraYear",i);else {if(null==i)throw new RangeError("Either `year` or `eraYear` and `era` are required");{const e=void 0===o?void 0:this.eras.find((e=>e.name===o||e.genericName===o));if(!e)throw new RangeError(`Era ${o} (ISO year ${i}) was not matched by any era`);if(i<1&&e.reverseOf)throw new RangeError(`Years in ${o} era must be positive, not ${n}`);n=e.reverseOf?e.anchorEpoch.year-i:i+e.anchorEpoch.year-(e.hasYearZero?0:1),t("year",n),({eraYear:i,era:o}=r(n));}}return {...e,year:n,eraYear:i,era:o}}adjustCalendarDate(e,t,r="constrain"){let n=e;const{month:i,monthCode:o}=n;return void 0===i&&(n={...n,month:na(o)}),this.validateCalendarDate(n),n=this.completeEraYear(n),super.adjustCalendarDate(n,t,r)}estimateIsoDate(e){const t=this.adjustCalendarDate(e),{year:r,month:n,day:i}=t,{anchorEra:o}=this;return Yt(r+o.isoEpoch.year-(o.hasYearZero?0:1),n,i,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug&&zi(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}}class Ea extends _a{constructor(e,t){super(e,t);}inLeapYear(e){const{year:t}=e;return (t+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){const{month:t}=e;return 13===t?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}}class Ta extends Ea{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}]);}}class xa extends Ea{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}]);}}class Ia extends Ea{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}]);}}class Sa extends _a{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0;}}class Ra extends _a{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0;}}class ka extends _a{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]);}reviseIntlEra(e){let{era:t,eraYear:r}=e;return "bc"!==t&&"b"!==t||(t="bce"),"ad"!==t&&"a"!==t||(t="ce"),{era:t,eraYear:r}}}class ja extends _a{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long",this.erasBeginMidYear=!0;}reviseIntlEra(e,t){const{era:r,eraYear:n}=e,{year:i}=t;return this.eras.find((e=>e.name===r))?{era:r,eraYear:n}:i<1?{era:"bce",eraYear:1-i}:{era:"ce",eraYear:i}}}class Da extends ua{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1;}inLeapYear(e,t){const r=this.getMonthList(e.year,t);return 13===Qo(r).length}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,t){if(void 0===e)throw new TypeError("Missing year");const r=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),n=t.get(r);if(n)return n;const i=this.getFormatter(),o=(e,t)=>{const r=sa({isoYear:e,isoMonth:2,isoDay:1}),n=new Date(r);n.setUTCDate(t+1);const o=i.formatToParts(n),a=o.find((e=>"month"===e.type)).value,s=+o.find((e=>"day"===e.type)).value;let l=o.find((e=>"relatedYear"===e.type));if(void 0===l)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+l.value,{calendarMonthString:a,calendarDay:s,calendarYearToVerify:l}};let a=17,{calendarMonthString:s,calendarDay:l,calendarYearToVerify:u}=o(e,a);"1"!==s&&(a+=29,({calendarMonthString:s,calendarDay:l}=o(e,a))),a-=l-5;const c={};let d,h,f=1,p=!1;do{(({calendarMonthString:s,calendarDay:l,calendarYearToVerify:u}=o(e,a))),d&&(c[h].daysInMonth=d+30-l),u!==e?p=!0:(c[s]={monthIndex:f++},a+=30),d=l,h=s;}while(!p);return c[h].daysInMonth=d+30-l,t.set(r,c),c}estimateIsoDate(e){const{year:t,month:r}=e;return {year:t,month:r>=12?12:r+1,day:1}}adjustCalendarDate(e,t,r="constrain",n=!1){let{year:i,month:o,monthExtra:a,day:s,monthCode:l,eraYear:u}=e;if(n){if(i=u,a&&"bis"!==a)throw new RangeError(`Unexpected leap month suffix: ${a}`);const e=ia(o,void 0!==a),r=`${o}${a||""}`,n=this.getMonthList(i,t)[r];if(void 0===n)throw new RangeError(`Unmatched month ${r} in Chinese year ${i}`);return o=n.monthIndex,{year:i,month:o,day:s,era:void 0,eraYear:u,monthCode:e}}if(this.validateCalendarDate(e),void 0===i&&(i=u),void 0===u&&(u=i),void 0===o){const e=this.getMonthList(i,t);let n=l.replace("L","bis").slice(1);"0"===n[0]&&(n=n.slice(1));let a=e[n];if(o=a&&a.monthIndex,void 0===o&&l.endsWith("L")&&"M13L"!=l&&"constrain"===r){let t=l.slice(1,-1);"0"===t[0]&&(t=t.slice(1)),a=e[t],a&&(o=a.monthIndex,l=ia(t));}if(void 0===o)throw new RangeError(`Unmatched month ${l} in Chinese year ${i}`)}else if(void 0===l){const e=this.getMonthList(i,t),n=Qo(e),a=n.length;"reject"===r?(ii(o,1,a),ii(s,1,this.maximumMonthLength())):(o=ri(o,1,a),s=ri(s,1,this.maximumMonthLength()));const u=n.find((([,e])=>e.monthIndex===o));if(void 0===u)throw new RangeError(`Invalid month ${o} in Chinese year ${i}`);l=ia(u[0].replace("bis",""),-1!==u[0].indexOf("bis"));}else {const e=this.getMonthList(i,t);let r=l.replace("L","bis").slice(1);"0"===r[0]&&(r=r.slice(1));const n=e[r];if(!n)throw new RangeError(`Unmatched monthCode ${l} in Chinese year ${i}`);if(o!==n.monthIndex)throw new RangeError(`monthCode ${l} doesn't correspond to month ${o} in Chinese year ${i}`)}return {...e,year:i,eraYear:u,month:o,monthCode:l,day:s}}}class Na extends Da{constructor(){super(...arguments),this.id="chinese";}}class Oa extends Da{constructor(){super(...arguments),this.id="dangi";}}class Ca{constructor(e){this.helper=e;}dateFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["day","month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.calendarToIsoDate(i,o,n),u=wr(a,s,l,r);return n.setObject(u),u}yearMonthFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.calendarToIsoDate({...i,day:1},o,n),u=Ir(a,s,r,l);return n.setObject(u),u}monthDayFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["day","month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.monthDayFromFields(i,o,n),u=Tr(s,l,r,a);return n.setObject(u),u}fields(e){let t=e;return Yo.call(t,"year")&&(t=[...t,"era","eraYear"]),t}fieldKeysToIgnore(e){const t=new Zo;for(let r=0;r<e.length;r++){const n=e[r];switch(nt(Xo,t,[n]),n){case"era":nt(Xo,t,["eraYear"]),nt(Xo,t,["year"]);break;case"eraYear":nt(Xo,t,["era"]),nt(Xo,t,["year"]);break;case"year":nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]);break;case"month":nt(Xo,t,["monthCode"]),this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));break;case"monthCode":nt(Xo,t,["month"]),this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));break;case"day":this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));}}return [...nt(ea,t,[])]}dateAdd(e,t,r,n,i,o,a){const s=aa.getCacheForObject(e),l=this.helper.temporalToCalendarDate(e,s),u=this.helper.addCalendar(l,{years:t,months:r,weeks:n,days:i},o,s),c=this.helper.calendarToIsoDate(u,"constrain",s),{year:d,month:h,day:f}=c,p=wr(d,h,f,a);return new aa(s).setObject(p),p}dateUntil(e,t,r){const n=aa.getCacheForObject(e),i=aa.getCacheForObject(t),o=this.helper.temporalToCalendarDate(e,n),a=this.helper.temporalToCalendarDate(t,i);return this.helper.untilCalendar(o,a,r,n)}year(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).year}month(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).month}day(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).day}era(e){if(!this.helper.hasEra)return;const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).era}eraYear(e){if(!this.helper.hasEra)return;const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).eraYear}monthCode(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).monthCode}dayOfWeek(e){return ta.iso8601.dayOfWeek(e)}dayOfYear(e){const t=aa.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,t),n=this.helper.startOfCalendarYear(r);return this.helper.calendarDaysUntil(n,r,t)+1}weekOfYear(e){return ta.iso8601.weekOfYear(e)}yearOfWeek(e){return ta.iso8601.yearOfWeek(e)}daysInWeek(e){return ta.iso8601.daysInWeek(e)}daysInMonth(e){const t=aa.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t),n=this.helper.maximumMonthLength(r);if(n===this.helper.minimumMonthLength(r))return n;const i=this.helper.startOfCalendarMonth(r),o=this.helper.addMonthsCalendar(i,1,"constrain",t);return this.helper.calendarDaysUntil(i,o,t)}daysInYear(e){let t=e;Z(t,b$2)||(t=lr(t));const r=aa.getCacheForObject(t),n=this.helper.temporalToCalendarDate(t,r),i=this.helper.startOfCalendarYear(n),o=this.helper.addCalendar(i,{years:1},"constrain",r);return this.helper.calendarDaysUntil(i,o,r)}monthsInYear(e){const t=aa.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t);return this.helper.monthsInYear(r,t)}inLeapYear(e){let t=e;Z(t,b$2)||(t=lr(t));const r=aa.getCacheForObject(t),n=this.helper.temporalToCalendarDate(t,r);return this.helper.inLeapYear(n,r)}}for(const e of [ca,va,Ia,Ta,xa,Na,Oa,Sa,wa,Ra,ka,ja,ha,fa,pa,ma,ya,ga]){const t=new e;ta[t.id]=new Ca(t);}class Aa{constructor(e,t,r,n="iso8601"){vr(this,ut$1(e),ut$1(t),ut$1(r),Hr(n));}get calendarId(){if(!Nt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get era(){if(!Nt(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get year(){if(!Nt(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!Nt(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!Nt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Nt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get dayOfWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return Br(K(this,j),this)}get dayOfYear(){if(!Nt(this))throw new TypeError("invalid receiver");return $r(K(this,j),this)}get weekOfYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Fr(K(this,j),this)}get yearOfWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return Ur(K(this,j),this)}get daysInWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return qr(K(this,j),this)}get daysInMonth(){if(!Nt(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get daysInYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get monthsInYear(){if(!Nt(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!Nt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),en(n,o,r)}withCalendar(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=Hr(e);return new Aa(K(this,b$2),K(this,_),K(this,E$1),t)}add(e,t){if(!Nt(this))throw new TypeError("invalid receiver");const r=dr(e),n=eo(t);return Dr(K(this,j),this,r,n)}subtract(e,t){if(!Nt(this))throw new TypeError("invalid receiver");const r=ti(dr(e)),n=eo(t);return Dr(K(this,j),this,r,n)}until(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return wi("until",this,e,t)}since(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return wi("since",this,e,t)}equals(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=lr(e);for(const e of [b$2,_,E$1])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Nt(this))throw new TypeError("invalid receiver");return _n(this,Qt(eo(e)))}toJSON(){if(!Nt(this))throw new TypeError("invalid receiver");return _n(this)}toLocaleString(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDate")}toPlainDateTime(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=K(this,b$2),r=K(this,_),n=K(this,E$1),i=K(this,j);if(void 0===e)return _r(t,r,n,0,0,0,0,0,0,i);const o=pr(e);return _r(t,r,n,K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),i)}toZonedDateTime(e){if(!Nt(this))throw new TypeError("invalid receiver");let t,r;if(it(e))if(kt(e))t=e;else {const n=e.timeZone;void 0===n?t=nn(e):(t=nn(n),r=e.plainTime);}else t=nn(e);const n=K(this,b$2),i=K(this,_),o=K(this,E$1),a=K(this,j);let s=0,l=0,u=0,c=0,d=0,h=0;return void 0!==r&&(r=pr(r),s=K(r,T$1),l=K(r,x$1),u=K(r,I$1),c=K(r,S$1),d=K(r,R),h=K(r,k)),Rr(K(fn(t,_r(n,i,o,s,l,u,c,d,h,a),"compatible"),v$1),t,a)}toPlainYearMonth(){if(!Nt(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Nt(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}getISOFields(){if(!Nt(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!Nt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Nt(e)?(Gt(r),wr(K(e,b$2),K(e,_),K(e,E$1),K(e,j))):lr(e,r)}static compare(e,t){const r=lr(e),n=lr(t);return zi(K(r,b$2),K(r,_),K(r,E$1),K(n,b$2),K(n,_),K(n,E$1))}}f$2(Aa,"Temporal.PlainDate");class Ma{constructor(e,t,r,n=0,i=0,o=0,a=0,s=0,l=0,u="iso8601"){br(this,ut$1(e),ut$1(t),ut$1(r),void 0===n?0:ut$1(n),void 0===i?0:ut$1(i),void 0===o?0:ut$1(o),void 0===a?0:ut$1(a),void 0===s?0:ut$1(s),void 0===l?0:ut$1(l),Hr(u));}get calendarId(){if(!Ct(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get year(){if(!Ct(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!Ct(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!Ct(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Ct(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get hour(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,T$1)}get minute(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,x$1)}get second(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,I$1)}get millisecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,S$1)}get microsecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,R)}get nanosecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,k)}get era(){if(!Ct(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get dayOfWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return Br(K(this,j),this)}get dayOfYear(){if(!Ct(this))throw new TypeError("invalid receiver");return $r(K(this,j),this)}get weekOfYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Fr(K(this,j),this)}get yearOfWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return Ur(K(this,j),this)}get daysInWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return qr(K(this,j),this)}get daysInYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get daysInMonth(){if(!Ct(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get monthsInYear(){if(!Ct(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!Ct(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);let o=ar(this,i,[]);o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]);const{year:a,month:s,day:l,hour:u,minute:c,second:d,millisecond:h,microsecond:f,nanosecond:p}=ur(n,o,r);return _r(a,s,l,u,c,d,h,f,p,n)}withPlainTime(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=K(this,b$2),r=K(this,_),n=K(this,E$1),i=K(this,j);if(void 0===e)return _r(t,r,n,0,0,0,0,0,0,i);const o=pr(e);return _r(t,r,n,K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),i)}withPlainDate(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1);let o=K(t,j);const a=K(this,T$1),s=K(this,x$1),l=K(this,I$1),u=K(this,S$1),c=K(this,R),d=K(this,k);return o=Xr(K(this,j),o),_r(r,n,i,a,s,l,u,c,d,o)}withCalendar(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=Hr(e);return new Ma(K(this,b$2),K(this,_),K(this,E$1),K(this,T$1),K(this,x$1),K(this,I$1),K(this,S$1),K(this,R),K(this,k),t)}add(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return Oi("add",this,e,t)}subtract(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return Oi("subtract",this,e,t)}until(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return bi("until",this,e,t)}since(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return bi("since",this,e,t)}round(e){if(!Ct(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr,["day"]),o={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];Kt(r,o,1===o);let a=K(this,b$2),s=K(this,_),l=K(this,E$1),u=K(this,T$1),c=K(this,x$1),d=K(this,I$1),h=K(this,S$1),f=K(this,R),p=K(this,k);return ({year:a,month:s,day:l,hour:u,minute:c,second:d,millisecond:h,microsecond:f,nanosecond:p}=Bi(a,s,l,u,c,d,h,f,p,r,i,n)),_r(a,s,l,u,c,d,h,f,p,K(this,j))}equals(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=cr(e);for(const e of [b$2,_,E$1,T$1,x$1,I$1,S$1,R,k])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=eo(e),r=Qt(t),n=Xt(t),i=Jt(t,"trunc"),o=rr(t,"smallestUnit","time",void 0);if("hour"===o)throw new RangeError('smallestUnit must be a time unit other than "hour"');const{precision:a,unit:s,increment:l}=er(o,n);return En(this,a,r,{unit:s,increment:l,roundingMode:i})}toJSON(){if(!Ct(this))throw new TypeError("invalid receiver");return En(this,"auto")}toLocaleString(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDateTime")}toZonedDateTime(e,t){if(!Ct(this))throw new TypeError("invalid receiver");const r=nn(e);return Rr(K(fn(r,this,Ht(eo(t))),v$1),r,K(this,j))}toPlainDate(){if(!Ct(this))throw new TypeError("invalid receiver");return ln(this)}toPlainYearMonth(){if(!Ct(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Ct(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}toPlainTime(){if(!Ct(this))throw new TypeError("invalid receiver");return un(this)}getISOFields(){if(!Ct(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoHour:K(this,T$1),isoMicrosecond:K(this,R),isoMillisecond:K(this,S$1),isoMinute:K(this,x$1),isoMonth:K(this,_),isoNanosecond:K(this,k),isoSecond:K(this,I$1),isoYear:K(this,b$2)}}getCalendar(){if(!Ct(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Ct(e)?(Gt(r),_r(K(e,b$2),K(e,_),K(e,E$1),K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k),K(e,j))):cr(e,r)}static compare(e,t){const r=cr(e),n=cr(t);for(const e of [b$2,_,E$1,T$1,x$1,I$1,S$1,R,k]){const t=K(r,e),i=K(n,e);if(t!==i)return Xi(t-i)}return 0}}f$2(Ma,"Temporal.PlainDateTime");class La{constructor(e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0,l=0,u=0){const c=void 0===e?0:dt(e),d=void 0===t?0:dt(t),h=void 0===r?0:dt(r),f=void 0===n?0:dt(n),p=void 0===i?0:dt(i),m=void 0===o?0:dt(o),y=void 0===a?0:dt(a),g=void 0===s?0:dt(s),v=void 0===l?0:dt(l),w=void 0===u?0:dt(u);di(c,d,h,f,p,m,y,g,v,w),Q(this),X(this,M$1,c),X(this,L,d),X(this,P,h),X(this,B$1,f),X(this,$,p),X(this,F,m),X(this,U,y),X(this,q,g),X(this,Y,v),X(this,W$1,w);}get years(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,M$1)}get months(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,L)}get weeks(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,P)}get days(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,B$1)}get hours(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,$)}get minutes(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,F)}get seconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,U)}get milliseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,q)}get microseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,Y)}get nanoseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,W$1)}get sign(){if(!Dt(this))throw new TypeError("invalid receiver");return Wn(K(this,M$1),K(this,L),K(this,P),K(this,B$1),K(this,$),K(this,F),K(this,U),K(this,q),K(this,Y),K(this,W$1))}get blank(){if(!Dt(this))throw new TypeError("invalid receiver");return 0===Wn(K(this,M$1),K(this,L),K(this,P),K(this,B$1),K(this,$),K(this,F),K(this,U),K(this,q),K(this,Y),K(this,W$1))}with(e){if(!Dt(this))throw new TypeError("invalid receiver");const t=ar(e,["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],"partial"),{years:r=K(this,M$1),months:n=K(this,L),weeks:i=K(this,P),days:o=K(this,B$1),hours:a=K(this,$),minutes:s=K(this,F),seconds:l=K(this,U),milliseconds:u=K(this,q),microseconds:c=K(this,Y),nanoseconds:d=K(this,W$1)}=t;return new La(r,n,i,o,a,s,l,u,c,d)}negated(){if(!Dt(this))throw new TypeError("invalid receiver");return ti(this)}abs(){if(!Dt(this))throw new TypeError("invalid receiver");return new La(Math.abs(K(this,M$1)),Math.abs(K(this,L)),Math.abs(K(this,P)),Math.abs(K(this,B$1)),Math.abs(K(this,$)),Math.abs(K(this,F)),Math.abs(K(this,U)),Math.abs(K(this,q)),Math.abs(K(this,Y)),Math.abs(K(this,W$1)))}add(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return Di("add",this,e,t)}subtract(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return Di("subtract",this,e,t)}round(e){if(!Dt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");let t=K(this,M$1),r=K(this,L),n=K(this,P),i=K(this,B$1),o=K(this,$),a=K(this,F),s=K(this,U),l=K(this,q),u=K(this,Y),c=K(this,W$1),h=ir(t,r,n,i,o,a,s,l,u,c);const f="string"==typeof e?to("smallestUnit",e):eo(e);let p=rr(f,"largestUnit","datetime",void 0,["auto"]),y=nr(f);const g=Zt(f),v=Jt(f,"halfExpand");let w=rr(f,"smallestUnit","datetime",void 0),b=!0;w||(b=!1,w="nanosecond"),h=or(h,w);let _=!0;if(p||(_=!1,p=h),"auto"===p&&(p=h),!b&&!_)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(or(p,w)!==p)throw new RangeError(`largestUnit ${p} cannot be smaller than smallestUnit ${w}`);const E={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[w];return void 0!==E&&Kt(g,E,!1),({years:t,months:r,weeks:n,days:i}=Xn(t,r,n,i,p,y)),({years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Wi(t,r,n,i,o,a,s,l,u,c,g,w,v,y)),({years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Yi(t,r,n,i,o,a,s,l,u,c,g,w,v,y)),({days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Zn(i,o,a,s,l,u,c,p,y)),({years:t,months:r,weeks:n,days:i}=function(e,t,r,n,i,o){const a=m$1("%Temporal.Duration%"),s=Wn(e,t,r,n,0,0,0,0,0,0);if(0===s)return {years:e,months:t,weeks:r,days:n};const l=d$1.BigInt(s);let u,c,h=d$1.BigInt(e),f=d$1.BigInt(t),p=d$1.BigInt(r),y=d$1.BigInt(n);o&&(c=lr(o),u=K(c,j));const g=new a(s),v=new a(0,s),w=new a(0,0,s);switch(i){case"year":{if(!u)throw new RangeError("a starting point is required for years balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r,n;for(({relativeTo:t,days:r}=Ui(u,c,g,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),h=d$1.add(h,l),c=t,({relativeTo:t,days:r}=Ui(u,c,g,e));for(({relativeTo:t,days:n}=Ui(u,c,v,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(n)));)y=d$1.subtract(y,d$1.BigInt(n)),f=d$1.add(f,l),c=t,({relativeTo:t,days:n}=Ui(u,c,v,e));t=Dr(u,c,g,void 0,e);const i="string"!=typeof u?rt(u,"dateUntil"):void 0,o=Ne(null);o.largestUnit="month";let a=Nr(u,c,t,o,i),s=K(a,L);for(;d$1.greaterThanOrEqual(mt(f),d$1.BigInt(Ee(s)));){f=d$1.subtract(f,d$1.BigInt(s)),h=d$1.add(h,l),c=t,t=Dr(u,c,g,void 0,e);const r=Ne(null);r.largestUnit="month",a=Nr(u,c,t,r,i),s=K(a,L);}break}case"month":{if(!u)throw new RangeError("a starting point is required for months balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r;for(({relativeTo:t,days:r}=Ui(u,c,v,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),f=d$1.add(f,l),c=t,({relativeTo:t,days:r}=Ui(u,c,v,e));break}case"week":{if(!u)throw new RangeError("a starting point is required for weeks balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r;for(({relativeTo:t,days:r}=Ui(u,c,w,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),p=d$1.add(p,l),c=t,({relativeTo:t,days:r}=Ui(u,c,w,e));break}}return {years:d$1.toNumber(h),months:d$1.toNumber(f),weeks:d$1.toNumber(p),days:d$1.toNumber(y)}}(t,r,n,i,p,y)),new La(t,r,n,i,o,a,s,l,u,c)}total(e){if(!Dt(this))throw new TypeError("invalid receiver");let t=K(this,M$1),r=K(this,L),n=K(this,P),i=K(this,B$1),o=K(this,$),a=K(this,F),s=K(this,U),l=K(this,q),u=K(this,Y),c=K(this,W$1);if(void 0===e)throw new TypeError("options argument is required");const d="string"==typeof e?to("unit",e):eo(e),h=nr(d),f=rr(d,"unit","datetime",tr);let p;(({years:t,months:r,weeks:n,days:i}=Xn(t,r,n,i,f,h))),Lt(h)&&(p=qi(h,t,r,n,0));let m=Kn(i,o,a,s,l,u,c,f,p);if("positive overflow"===m)return 1/0;if("negative overflow"===m)return -1/0;({days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=m);const{total:y}=Wi(t,r,n,i,o,a,s,l,u,c,1,f,"trunc",h);return y}toString(e){if(!Dt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i||"minute"===i)throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');const{precision:o,unit:a,increment:s}=er(i,r);return bn(this,o,{unit:a,increment:s,roundingMode:n})}toJSON(){if(!Dt(this))throw new TypeError("invalid receiver");return bn(this)}toLocaleString(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return "undefined"!=typeof Intl&&void 0!==Intl.DurationFormat?new Intl.DurationFormat(e,t).format(this):(console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),bn(this))}valueOf(){throw new TypeError("use compare() to compare Temporal.Duration")}static from(e){return Dt(e)?new La(K(e,M$1),K(e,L),K(e,P),K(e,B$1),K(e,$),K(e,F),K(e,U),K(e,q),K(e,Y),K(e,W$1)):dr(e)}static compare(e,t,r){const n=dr(e),i=dr(t),o=nr(eo(r)),a=K(n,M$1),s=K(n,L),l=K(n,P);let u=K(n,B$1);const c=K(n,$),h=K(n,F),f=K(n,U),p=K(n,q),m=K(n,Y);let y=K(n,W$1);const g=K(i,M$1),v=K(i,L),w=K(i,P);let b=K(i,B$1);const _=K(i,$),E=K(i,F),T=K(i,U),x=K(i,q),I=K(i,Y);let S=K(i,W$1);const R=ei(o,a,s,l,u),k=ei(o,g,v,w,b);0===a&&0===g&&0===s&&0===v&&0===l&&0===w||(({days:u}=Xn(a,s,l,u,"day",o)),({days:b}=Xn(g,v,w,b,"day",o)));const j=Vn(u,c,h,f,p,m,y,R),D=Vn(b,_,E,T,x,I,S,k);return Xi(d$1.toNumber(d$1.subtract(j,D)))}}f$2(La,"Temporal.Duration");const Pa=Object.create;class Ba{constructor(e,t,r="iso8601",n=1972){Er(this,ut$1(e),ut$1(t),Hr(r),ut$1(n));}get monthCode(){if(!Mt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Mt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get calendarId(){if(!Mt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}with(e,t){if(!Mt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),rn(n,o,r)}equals(e){if(!Mt(this))throw new TypeError("invalid receiver");const t=fr(e);for(const e of [_,E$1,b$2])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Mt(this))throw new TypeError("invalid receiver");return Tn(this,Qt(eo(e)))}toJSON(){if(!Mt(this))throw new TypeError("invalid receiver");return Tn(this)}toLocaleString(e,t){if(!Mt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use equals() to compare Temporal.PlainMonthDay")}toPlainDate(e){if(!Mt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("argument should be an object");const t=K(this,j),r=kr(t,["day","monthCode"]),n=ar(this,r,[]),i=kr(t,["year"]);let o=jr(t,n,ar(e,i,[]));o=ar(o,[...new Set([...r,...i])],[]);const a=Pa(null);return a.overflow="reject",en(t,o,a)}getISOFields(){if(!Mt(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!Mt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Mt(e)?(Gt(r),Tr(K(e,_),K(e,E$1),K(e,j),K(e,b$2))):fr(e,r)}}f$2(Ba,"Temporal.PlainMonthDay");const $a=()=>new(m$1("%Temporal.Instant%"))(Zi()),Fa=(e,t=Ki())=>{const r=nn(t),n=Hr(e);return hn(r,$a(),n)},Ua=(e=Ki())=>hn(nn(e),$a(),"iso8601"),qa=(e,t=Ki())=>{const r=nn(t),n=Hr(e);return Rr(Zi(),r,n)},Ya={instant:$a,plainDateTime:Fa,plainDateTimeISO:Ua,plainDate:(e,t=Ki())=>ln(Fa(e,t)),plainDateISO:(e=Ki())=>ln(Ua(e)),plainTimeISO:(e=Ki())=>un(Ua(e)),timeZoneId:()=>Ki(),zonedDateTime:qa,zonedDateTimeISO:(e=Ki())=>qa("iso8601",e),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(Ya,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});const Wa=Object.assign;function za(e,t,r){let n=K(e,T$1),i=K(e,x$1),o=K(e,I$1),a=K(e,S$1),s=K(e,R),l=K(e,k);if(r){const{unit:e,increment:t,roundingMode:u}=r;({hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=$i(n,i,o,a,s,l,t,e,u));}return `${gn(n)}:${gn(i)}${vn(o,a,s,l,t)}`}class Ga{constructor(e=0,t=0,r=0,n=0,i=0,o=0){const a=void 0===e?0:ut$1(e),s=void 0===t?0:ut$1(t),l=void 0===r?0:ut$1(r),u=void 0===n?0:ut$1(n),c=void 0===i?0:ut$1(i),d=void 0===o?0:ut$1(o);si(a,s,l,u,c,d),Q(this),X(this,T$1,a),X(this,x$1,s),X(this,I$1,l),X(this,S$1,u),X(this,R,c),X(this,k,d);}get hour(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,T$1)}get minute(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,x$1)}get second(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,I$1)}get millisecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,S$1)}get microsecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,R)}get nanosecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,k)}with(e,t){if(!Ot(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=Gt(eo(t)),n=sr(e,"partial"),i=sr(this);let{hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=Wa(i,n);return ({hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=Wt(o,a,s,l,u,c,r)),new Ga(o,a,s,l,u,c)}add(e){if(!Ot(this))throw new TypeError("invalid receiver");return Ci("add",this,e)}subtract(e){if(!Ot(this))throw new TypeError("invalid receiver");return Ci("subtract",this,e)}until(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return _i("until",this,e,t)}since(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return _i("since",this,e,t)}round(e){if(!Ot(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr);Kt(r,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1);let o=K(this,T$1),a=K(this,x$1),s=K(this,I$1),l=K(this,S$1),u=K(this,R),c=K(this,k);return ({hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=$i(o,a,s,l,u,c,r,i,n)),new Ga(o,a,s,l,u,c)}equals(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=pr(e);for(const e of [T$1,x$1,I$1,S$1,R,k])if(K(this,e)!==K(t,e))return !1;return !0}toString(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i)throw new RangeError('smallestUnit must be a time unit other than "hour"');const{precision:o,unit:a,increment:s}=er(i,r);return za(this,o,{unit:a,increment:s,roundingMode:n})}toJSON(){if(!Ot(this))throw new TypeError("invalid receiver");return za(this,"auto")}toLocaleString(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1),o=K(t,j);return _r(r,n,i,K(this,T$1),K(this,x$1),K(this,I$1),K(this,S$1),K(this,R),K(this,k),o)}toZonedDateTime(e){if(!Ot(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");const t=e.plainDate;if(void 0===t)throw new TypeError("missing date property");const r=lr(t),n=e.timeZone;if(void 0===n)throw new TypeError("missing timeZone property");const i=nn(n),o=K(r,b$2),a=K(r,_),s=K(r,E$1),l=K(r,j),u=K(this,T$1),c=K(this,x$1),d=K(this,I$1),h=K(this,S$1),f=K(this,R),p=K(this,k);return Rr(K(fn(i,new(m$1("%Temporal.PlainDateTime%"))(o,a,s,u,c,d,h,f,p,l),"compatible"),v$1),i,l)}getISOFields(){if(!Ot(this))throw new TypeError("invalid receiver");return {isoHour:K(this,T$1),isoMicrosecond:K(this,R),isoMillisecond:K(this,S$1),isoMinute:K(this,x$1),isoNanosecond:K(this,k),isoSecond:K(this,I$1)}}static from(e,t){const r=Gt(eo(t));return Ot(e)?new Ga(K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k)):pr(e,r)}static compare(e,t){const r=pr(e),n=pr(t);for(const e of [T$1,x$1,I$1,S$1,R,k]){const t=K(r,e),i=K(n,e);if(t!==i)return Xi(t-i)}return 0}}f$2(Ga,"Temporal.PlainTime");class Ha{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");const t=kn(e);Q(this),X(this,w$1,t);}get id(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}getOffsetNanosecondsFor(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);return Sn(r)?Rn(r):jn(r,K(t,v$1))}getOffsetStringFor(e){if(!kt(this))throw new TypeError("invalid receiver");return dn(this,hr(e))}getPlainDateTimeFor(e,t="iso8601"){if(!kt(this))throw new TypeError("invalid receiver");return hn(this,hr(e),Hr(t))}getInstantFor(e,t){if(!kt(this))throw new TypeError("invalid receiver");return fn(this,cr(e),Ht(eo(t)))}getPossibleInstantsFor(e){if(!kt(this))throw new TypeError("invalid receiver");const t=cr(e),r=m$1("%Temporal.Instant%"),n=K(this,w$1);if(Sn(n)){const e=On(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k));if(null===e)throw new RangeError("DateTime outside of supported range");const i=Rn(n);return [new r(d$1.subtract(e,d$1.BigInt(i)))]}const i=function(e,t,r,n,i,o,a,s,l,u){const c=On(t,r,n,i,o,a,s,l,u);if(null===c)throw new RangeError("DateTime outside of supported range");let h=d$1.subtract(c,ze);d$1.lessThan(h,Ge)&&(h=c);let f=d$1.add(c,ze);d$1.greaterThan(f,He)&&(f=c);const p=jn(e,h),m=jn(e,f);return (p===m?[p]:[p,m]).map((h=>{const f=d$1.subtract(c,d$1.BigInt(h)),p=An(e,f);if(t===p.year&&r===p.month&&n===p.day&&i===p.hour&&o===p.minute&&a===p.second&&s===p.millisecond&&l===p.microsecond&&u===p.nanosecond)return f})).filter((e=>void 0!==e))}(n,K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k));return i.map((e=>new r(e)))}getNextTransition(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);if(Sn(r)||"UTC"===r)return null;let n=K(t,v$1);const i=m$1("%Temporal.Instant%");return n=Pn(r,n),null===n?null:new i(n)}getPreviousTransition(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);if(Sn(r)||"UTC"===r)return null;let n=K(t,v$1);const i=m$1("%Temporal.Instant%");return n=Bn(r,n),null===n?null:new i(n)}toString(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}toJSON(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}static from(e){return an(nn(e))}}f$2(Ha,"Temporal.TimeZone"),p$1("Temporal.TimeZone.prototype.getOffsetNanosecondsFor",Ha.prototype.getOffsetNanosecondsFor),p$1("Temporal.TimeZone.prototype.getPossibleInstantsFor",Ha.prototype.getPossibleInstantsFor);const Ja=Object.create;class Va{constructor(e,t,r="iso8601",n=1){xr(this,ut$1(e),ut$1(t),Hr(r),ut$1(n));}get year(){if(!At(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!At(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!At(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get calendarId(){if(!At(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get era(){if(!At(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!At(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get daysInMonth(){if(!At(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get daysInYear(){if(!At(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get monthsInYear(){if(!At(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!At(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!At(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),tn(n,o,r)}add(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ai("add",this,e,t)}subtract(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ai("subtract",this,e,t)}until(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ei("until",this,e,t)}since(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ei("since",this,e,t)}equals(e){if(!At(this))throw new TypeError("invalid receiver");const t=mr(e);for(const e of [b$2,_,E$1])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!At(this))throw new TypeError("invalid receiver");return xn(this,Qt(eo(e)))}toJSON(){if(!At(this))throw new TypeError("invalid receiver");return xn(this)}toLocaleString(e,t){if(!At(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!At(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("argument should be an object");const t=K(this,j),r=kr(t,["monthCode","year"]),n=ar(this,r,[]),i=kr(t,["day"]);let o=jr(t,n,ar(e,i,[]));o=ar(o,[...new Set([...r,...i])],[]);const a=Ja(null);return a.overflow="reject",en(t,o,a)}getISOFields(){if(!At(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!At(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return At(e)?(Gt(r),Ir(K(e,b$2),K(e,_),K(e,j),K(e,E$1))):mr(e,r)}static compare(e,t){const r=mr(e),n=mr(t);return zi(K(r,b$2),K(r,_),K(r,E$1),K(n,b$2),K(n,_),K(n,E$1))}}f$2(Va,"Temporal.PlainYearMonth");const Qa=jo.prototype.resolvedOptions,Za=Object.create;class Ka{constructor(e,t,r="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");Sr(this,Qi(e),nn(t),Hr(r));}get calendarId(){if(!Lt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get timeZoneId(){if(!Lt(this))throw new TypeError("invalid receiver");return on(K(this,A$1))}get year(){if(!Lt(this))throw new TypeError("invalid receiver");return Or(K(this,j),Xa(this))}get month(){if(!Lt(this))throw new TypeError("invalid receiver");return Cr(K(this,j),Xa(this))}get monthCode(){if(!Lt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),Xa(this))}get day(){if(!Lt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),Xa(this))}get hour(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),T$1)}get minute(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),x$1)}get second(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),I$1)}get millisecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),S$1)}get microsecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),R)}get nanosecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),k)}get era(){if(!Lt(this))throw new TypeError("invalid receiver");return Lr(K(this,j),Xa(this))}get eraYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Pr(K(this,j),Xa(this))}get epochSeconds(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Ue))}get epochMilliseconds(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Fe))}get epochMicroseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return Vi(Hi(K(this,v$1),$e))}get epochNanoseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return Vi(K(this,v$1))}get dayOfWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return Br(K(this,j),Xa(this))}get dayOfYear(){if(!Lt(this))throw new TypeError("invalid receiver");return $r(K(this,j),Xa(this))}get weekOfYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Fr(K(this,j),Xa(this))}get yearOfWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return Ur(K(this,j),Xa(this))}get hoursInDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=m$1("%Temporal.PlainDateTime%"),r=K(e,b$2),n=K(e,_),i=K(e,E$1),o=new t(r,n,i,0,0,0,0,0,0),a=xi(r,n,i,0,0,0,1,"reject"),s=new t(a.year,a.month,a.day,0,0,0,0,0,0),l=K(this,A$1),u=K(fn(l,o,"compatible"),v$1),c=K(fn(l,s,"compatible"),v$1);return Ji(d$1.subtract(c,u),Ye)}get daysInWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return qr(K(this,j),Xa(this))}get daysInMonth(){if(!Lt(this))throw new TypeError("invalid receiver");return Yr(K(this,j),Xa(this))}get daysInYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Wr(K(this,j),Xa(this))}get monthsInYear(){if(!Lt(this))throw new TypeError("invalid receiver");return zr(K(this,j),Xa(this))}get inLeapYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Gr(K(this,j),Xa(this))}get offset(){if(!Lt(this))throw new TypeError("invalid receiver");return dn(K(this,A$1),K(this,C$1))}get offsetNanoseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return cn(K(this,A$1),K(this,C$1))}with(e,t){if(!Lt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid zoned-date-time-like");Pt(e);const r=eo(t),n=K(this,j);let i=kr(n,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);i.push("offset");let o=ar(this,i,["offset"]);o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,["offset"]);const a=Ht(r),s=Vt(r,"prefer");let{year:l,month:u,day:c,hour:d,minute:h,second:f,millisecond:p,microsecond:m,nanosecond:y}=ur(n,o,r);const g=Rn(o.offset),v=K(this,A$1);return Rr(yr(l,u,c,d,h,f,p,m,y,"option",g,v,a,s,!1),v,n)}withPlainDate(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1);let o=K(t,j);const a=Xa(this),s=K(a,T$1),l=K(a,x$1),u=K(a,I$1),c=K(a,S$1),d=K(a,R),h=K(a,k);o=Xr(K(this,j),o);const f=K(this,A$1);return Rr(K(fn(f,new(m$1("%Temporal.PlainDateTime%"))(r,n,i,s,l,u,c,d,h,o),"compatible"),v$1),f,o)}withPlainTime(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=m$1("%Temporal.PlainTime%"),r=void 0===e?new t:pr(e),n=Xa(this),i=K(n,b$2),o=K(n,_),a=K(n,E$1),s=K(this,j),l=K(r,T$1),u=K(r,x$1),c=K(r,I$1),d=K(r,S$1),h=K(r,R),f=K(r,k),p=K(this,A$1);return Rr(K(fn(p,new(m$1("%Temporal.PlainDateTime%"))(i,o,a,l,u,c,d,h,f,s),"compatible"),v$1),p,s)}withTimeZone(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=nn(e);return Rr(K(this,v$1),t,K(this,j))}withCalendar(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=Hr(e);return Rr(K(this,v$1),K(this,A$1),t)}add(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Mi("add",this,e,t)}subtract(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Mi("subtract",this,e,t)}until(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Ti("until",this,e,t)}since(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Ti("since",this,e,t)}round(e){if(!Lt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr,["day"]),o={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];Kt(r,o,1===o);const a=Xa(this);let s=K(a,b$2),l=K(a,_),u=K(a,E$1),c=K(a,T$1),h=K(a,x$1),f=K(a,I$1),p=K(a,S$1),y=K(a,R),g=K(a,k);const w=m$1("%Temporal.PlainDateTime%"),D=K(this,A$1),N=K(this,j),O=fn(D,new w(K(a,b$2),K(a,_),K(a,E$1),0,0,0,0,0,0),"compatible"),M=ji(O,D,N,0,0,0,1,0,0,0,0,0,0),L=d$1.subtract(M,d$1.BigInt(K(O,v$1)));if(d$1.lessThanOrEqual(L,Me))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero or negative length days");return ({year:s,month:l,day:u,hour:c,minute:h,second:f,millisecond:p,microsecond:y,nanosecond:g}=Bi(s,l,u,c,h,f,p,y,g,r,i,n,d$1.toNumber(L))),Rr(yr(s,l,u,c,h,f,p,y,g,"option",cn(D,K(this,C$1)),D,"compatible","prefer",!1),D,K(this,j))}equals(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=gr(e),r=K(this,v$1),n=K(t,v$1);return !!d$1.equal(d$1.BigInt(r),d$1.BigInt(n))&&!!sn(K(this,A$1),K(t,A$1))&&Zr(K(this,j),K(t,j))}toString(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Qt(t),n=Xt(t),i=function(e){return no(e,"offset",["auto","never"],"auto")}(t),o=Jt(t,"trunc"),a=rr(t,"smallestUnit","time",void 0);if("hour"===a)throw new RangeError('smallestUnit must be a time unit other than "hour"');const s=function(e){return no(e,"timeZoneName",["auto","never","critical"],"auto")}(t),{precision:l,unit:u,increment:c}=er(a,n);return In(this,l,r,s,i,{unit:u,increment:c,roundingMode:o})}toLocaleString(e,t){if(!Lt(this))throw new TypeError("invalid receiver");const r=eo(t),n=Za(null);if(St(n,r,["timeZone"]),void 0!==r.timeZone)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");void 0===n.year&&void 0===n.month&&void 0===n.day&&void 0===n.weekday&&void 0===n.dateStyle&&void 0===n.hour&&void 0===n.minute&&void 0===n.second&&void 0===n.timeStyle&&void 0===n.dayPeriod&&void 0===n.timeZoneName&&(n.timeZoneName="short");let i=on(K(this,A$1));if(Sn(i))throw new RangeError("toLocaleString does not support offset string time zones");i=kn(i),n.timeZone=i;const o=new jo(e,n),a=nt(Qa,o,[]).calendar,s=Vr(K(this,j));if("iso8601"!==s&&"iso8601"!==a&&a!==s)throw new RangeError(`cannot format ZonedDateTime with calendar ${s} in locale with calendar ${a}`);return o.format(K(this,C$1))}toJSON(){if(!Lt(this))throw new TypeError("invalid receiver");return In(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=m$1("%Temporal.PlainDateTime%"),r=K(this,j),n=new t(K(e,b$2),K(e,_),K(e,E$1),0,0,0,0,0,0,r),i=K(this,A$1);return Rr(K(fn(i,n,"compatible"),v$1),i,r)}toInstant(){if(!Lt(this))throw new TypeError("invalid receiver");return new(m$1("%Temporal.Instant%"))(K(this,v$1))}toPlainDate(){if(!Lt(this))throw new TypeError("invalid receiver");return ln(Xa(this))}toPlainTime(){if(!Lt(this))throw new TypeError("invalid receiver");return un(Xa(this))}toPlainDateTime(){if(!Lt(this))throw new TypeError("invalid receiver");return Xa(this)}toPlainYearMonth(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}getISOFields(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=K(this,A$1);return {calendar:K(this,j),isoDay:K(e,E$1),isoHour:K(e,T$1),isoMicrosecond:K(e,R),isoMillisecond:K(e,S$1),isoMinute:K(e,x$1),isoMonth:K(e,_),isoNanosecond:K(e,k),isoSecond:K(e,I$1),isoYear:K(e,b$2),offset:dn(t,K(this,C$1)),timeZone:t}}getCalendar(){if(!Lt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}getTimeZone(){if(!Lt(this))throw new TypeError("invalid receiver");return an(K(this,A$1))}static from(e,t){const r=eo(t);return Lt(e)?(Ht(r),Vt(r,"reject"),Gt(r),Rr(K(e,v$1),K(e,A$1),K(e,j))):gr(e,r)}static compare(e,t){const r=gr(e),n=gr(t),i=K(r,v$1),o=K(n,v$1);return d$1.lessThan(d$1.BigInt(i),d$1.BigInt(o))?-1:d$1.greaterThan(d$1.BigInt(i),d$1.BigInt(o))?1:0}}function Xa(e){return hn(K(e,A$1),K(e,C$1),K(e,j))}f$2(Ka,"Temporal.ZonedDateTime");var es=Object.freeze({__proto__:null,Calendar:ra,Duration:La,Instant:qo,Now:Ya,PlainDate:Aa,PlainDateTime:Ma,PlainMonthDay:Ba,PlainTime:Ga,PlainYearMonth:Va,TimeZone:Ha,ZonedDateTime:Ka});const ts=[qo,ra,Aa,Ma,La,Ba,Ga,Ha,Va,Ka];for(const e of ts){const t=Object.getOwnPropertyDescriptor(e,"prototype");(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t));}var rs,ns;!function(e){e.BlankNode="BlankNode",e.IRI="NamedNode",e.Literal="Literal",e.Undefined="Undefined";}(rs||(rs={})),function(e){e.Boolean="http://www.w3.org/2001/XMLSchema#boolean",e.Integer="http://www.w3.org/2001/XMLSchema#integer",e.NonNegativeInteger="http://www.w3.org/2001/XMLSchema#nonNegativeInteger",e.NonPositiveInteger="http://www.w3.org/2001/XMLSchema#nonPositiveInteger",e.NegativeInteger="http://www.w3.org/2001/XMLSchema#negativeInteger",e.PositiveInteger="http://www.w3.org/2001/XMLSchema#positiveInteger",e.DateTime="http://www.w3.org/2001/XMLSchema#dateTime",e.Double="http://www.w3.org/2001/XMLSchema#double";}(ns||(ns={}));const is=e=>e.toExponential(15).replace(/(\d)0*e\+?/,"$1E");function os(e){if(!e.graph.value)return i.DEFAULT_GRAPH_NODE_NAME;if("BlankNode"!==e.graph.termType)throw new Error("graph node is not of BlankNode type");return e.graph.value}const as=e=>e.sort(((e,t)=>e<t?-1:e>t?1:0)),ss=new TextEncoder,ls=e=>{const t=e/2n;return {min:t-e+1n,max:t}};const us=(e,t,r)=>{switch(e){case ns.Boolean:switch(t){case"false":case"0":return !1;case"true":case"1":return !0;default:throw new Error("incorrect boolean value")}case ns.Integer:case ns.NonNegativeInteger:case ns.NonPositiveInteger:case ns.NegativeInteger:case ns.PositiveInteger:const n=BigInt(t),{min:i,max:o}=function(e,t){switch(e){case ns.PositiveInteger:return {min:1n,max:t-1n};case ns.NonNegativeInteger:return {min:0n,max:t-1n};case ns.Integer:return ls(t);case ns.NegativeInteger:return {min:ls(t).min,max:-1n};case ns.NonPositiveInteger:return {min:ls(t).min,max:0n};default:throw new Error(`unsupported XSD type: ${e}`)}}(e,r);if(n>o)throw new Error(`integer exceeds maximum value: ${n}`);if(n<i)throw new Error(`integer is below minimum value: ${n}`);return n;case ns.DateTime:if(isNaN(Date.parse(t)))throw new Error(`error: error parsing time string ${t}`);return /^\d{4}-\d{2}-\d{2}$/.test(t)?es.Instant.from(new Date(t).toISOString()):es.Instant.from(t);case ns.Double:return is(parseFloat(t));default:return t}};var cs;const ds=new TextEncoder;class hs{constructor(e,t=a){this.value=e,this.h=t;}isString(){return "string"==typeof this.value}asString(){if(!this.isString())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value.toString()}isTime(){return this.value instanceof es.Instant}asTime(){if(!this.isTime())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}isNumber(){return "number"==typeof this.value}asNumber(){if(!this.isNumber())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}isBool(){return "boolean"==typeof this.value}asBool(){if(!this.isBool())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}mtEntry(){return hs.mkValueMtEntry(this.h,this.value)}isBigInt(){return "bigint"==typeof this.value}asBigInt(){if(!this.isBigInt())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}static async mkValueInt(e,t){return t>=0?BigInt(t):e.prime()+BigInt(t)}}cs=hs,hs.mkValueMtEntry=(e,t)=>{switch(typeof t){case"number":return hs.mkValueInt(e,t);case"string":return hs.mkValueString(e,t);case"boolean":return hs.mkValueBool(e,t);case"bigint":return hs.mkValueBigInt(e,t);default:if(t instanceof es.Instant)return hs.mkValueTime(e,t);throw new Error("error: unexpected type "+typeof t)}},hs.mkValueUInt=(e,t)=>BigInt.asUintN(64,t),hs.mkValueBool=(e,t)=>t?e.hash([BigInt.asIntN(64,BigInt(1))]):e.hash([BigInt.asIntN(64,BigInt(0))]),hs.mkValueString=(e,t)=>e.hashBytes(ds.encode(t)),hs.mkValueTime=async(e,t)=>cs.mkValueInt(e,t.epochNanoseconds),hs.mkValueBigInt=async(e,t)=>{const r=e.prime();if(t>=r)throw new Error(`value is too big: ${t}`);if(t<0n){const{min:e}=ls(r);if(t<e)throw new Error(`value is too small: ${t}`);return t+r}return t};var fs$2={},ps=class e{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r;}clone(){const{prefix:t,_existing:r,counter:n}=this;return new e(t,new Map(r),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return [...this._existing.keys()]}};
7845
+ const i=Object.freeze({ERRORS:{CONTEXT_NOT_DEFINED:new Error("error: context not defined on the object"),PARSED_CONTEXT_IS_NULL:new Error("error: parsed context is null"),TERM_IS_NOT_DEFINED:new Error("error: term is not defined"),NO_ID_ATTR:new Error("error: no @id attribute is defined"),CTX_TYP_IS_EMPTY:new Error("error: ctx type is empty"),FIELD_PATH_IS_EMPTY:new Error("error: filed path is empty"),UNEXPECTED_ARR_ELEMENT:new Error("error: unexpected array elements"),INVALID_REFERENCE_TYPE:new Error("error: invalid reference type"),MULTIPLE_PARENTS_FOUND:new Error("error: multiple parents found"),PARENT_NOT_FOUND:new Error("error: parent not found"),GRAPH_NOT_FOUND:new Error("error: graph not found"),QUAD_NOT_FOUND:new Error("error: quad not found"),MT_VALUE_INCORRECT_TYPE:new Error("error: incorrect type")},DEFAULT_GRAPH_NODE_NAME:"@default",DEFAULT_GRAPH_TERM_TYPE:"DefaultGraph",QUADS_FORMAT:"application/n-quads",DIGITS_ONLY_REGEX:/^\d+$/,Q:BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")});class o{constructor(t=$$2){this._hasher=t;}async hash(e){return this._hasher.hash(e)}async hashBytes(e){return this._hasher.hashBytes(e)}prime(){return i.Q}}const a=new o;var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l$1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u$1(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype;}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}});})),r}var c$1={exports:{}};c$1.exports=function(){var e=Math.imul,t=Math.clz32;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r,n=0;n<t.length;n++)(r=t[n]).enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t);}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return !1}}function c(){return c=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&l(i,r.prototype),i},c.apply(null,arguments)}function d(e){return -1!==Function.toString.call(e).indexOf("[native code]")}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){function r(){return c(e,arguments,s(this).constructor)}if(null===e||!d(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r);}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},h(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function m(e){var t=u();return function(){var r,n=s(e);if(t){var i=s(this).constructor;r=Reflect.construct(n,arguments,i);}else r=n.apply(this,arguments);return p(this,r)}}function y(e,t){return g(e)||v(e,t)||w(e,t)||_()}function g(e){if(Array.isArray(e))return e}function v(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),o.length!==t);a=!0);}catch(e){s=!0,i=e;}finally{try{a||null==r.return||r.return();}finally{if(s)throw i}}return o}}function w(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return "Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=w(e))||t){r&&(e=r);var n=0,i=function(){};return {s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return {s:function(){r=r.call(e);},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e;},f:function(){try{a||null==r.return||r.return();}finally{if(s)throw o}}}}var T=function(e){var t=Math.abs,i=Math.max,s=Math.floor;function l(e,t){var r;if(n(this,l),(r=u.call(this,e)).sign=t,Object.setPrototypeOf(f(r),l.prototype),e>l.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return r}a(l,e);var u=m(l);return o(l,[{key:"toDebugString",value:function(){var e,t=["BigInt["],r=E(this);try{for(r.s();!(e=r.n()).done;){var n=e.value;t.push((n?(n>>>0).toString(16):n)+", ");}}catch(e){r.e(e);}finally{r.f();}return t.push("]"),t.join("")}},{key:"toString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10;if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(e&e-1)?l.__toStringBasePowerOfTwo(this,e):l.__toStringGeneric(this,e,!1)}},{key:"valueOf",value:function(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:"__copy",value:function(){for(var e=new l(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:"__trim",value:function(){for(var e=this.length,t=this[e-1];0===t;)t=this[--e-1],this.pop();return 0===e&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var e=0;e<this.length;e++)this[e]=0;}},{key:"__clzmsd",value:function(){return l.__clz30(this.__digit(this.length-1))}},{key:"__inplaceMultiplyAdd",value:function(e,t,r){r>this.length&&(r=this.length);for(var n=32767&e,i=e>>>15,o=0,a=t,s=0;s<r;s++){var u=this.__digit(s),c=32767&u,d=u>>>15,h=l.__imul(c,n),f=l.__imul(c,i),p=l.__imul(d,n),m=a+h+o;o=m>>>30,m&=1073741823,o+=(m+=((32767&f)<<15)+((32767&p)<<15))>>>30,a=l.__imul(d,i)+(f>>>15)+(p>>>15),this.__setDigit(s,1073741823&m);}if(0!==o||0!==a)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,r){for(var n,i=0,o=0;o<r;o++)i=(n=this.__halfDigit(t+o)+e.__halfDigit(o)+i)>>>15,this.__setHalfDigit(t+o,32767&n);return i}},{key:"__inplaceSub",value:function(e,t,r){var n=0;if(1&t){t>>=1;for(var i=this.__digit(t),o=32767&i,a=0;a<r-1>>>1;a++){var s=e.__digit(a),l=(i>>>15)-(32767&s)-n;n=1&l>>>15,this.__setDigit(t+a,(32767&l)<<15|32767&o),n=1&(o=(32767&(i=this.__digit(t+a+1)))-(s>>>15)-n)>>>15;}var u=e.__digit(a),c=(i>>>15)-(32767&u)-n;if(n=1&c>>>15,this.__setDigit(t+a,(32767&c)<<15|32767&o),t+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(32767&(i=this.__digit(t+a+1)))-(u>>>15)-n)>>>15,this.__setDigit(t+e.length,1073709056&i|32767&o));}else {t>>=1;for(var d=0;d<e.length-1;d++){var h=this.__digit(t+d),f=e.__digit(d),p=(32767&h)-(32767&f)-n,m=(h>>>15)-(f>>>15)-(n=1&p>>>15);n=1&m>>>15,this.__setDigit(t+d,(32767&m)<<15|32767&p);}var y=this.__digit(t+d),g=e.__digit(d),v=(32767&y)-(32767&g)-n;n=1&v>>>15;var w=0;0==(1&r)&&(n=1&(w=(y>>>15)-(g>>>15)-n)>>>15),this.__setDigit(t+d,(32767&w)<<15|32767&v);}return n}},{key:"__inplaceRightShift",value:function(e){if(0!==e){for(var t,r=this.__digit(0)>>>e,n=this.length-1,i=0;i<n;i++)t=this.__digit(i+1),this.__setDigit(i,1073741823&t<<30-e|r),r=t>>>e;this.__setDigit(n,r);}}},{key:"__digit",value:function(e){return this[e]}},{key:"__unsignedDigit",value:function(e){return this[e]>>>0}},{key:"__setDigit",value:function(e,t){this[e]=0|t;}},{key:"__setDigitGrow",value:function(e,t){this[e]=0|t;}},{key:"__halfDigitLength",value:function(){var e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:"__halfDigit",value:function(e){return 32767&this[e>>>1]>>>15*(1&e)}},{key:"__setHalfDigit",value:function(e,t){var r=e>>>1,n=this.__digit(r),i=1&e?32767&n|t<<15:1073709056&n|32767&t;this.__setDigit(r,i);}}],[{key:"BigInt",value:function(e){var t=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if(l.__isOneDigitInt(e))return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!t(e)||s(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var n=l.__fromString(e);if(null===n)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return n}if("boolean"==typeof e)return !0===e?l.__oneDigit(1,!1):l.__zero();if("object"===r(e)){if(e.constructor===l)return e;var i=l.__toPrimitive(e);return l.BigInt(i)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(e){var t=e.length;if(0===t)return 0;if(1===t){var r=e.__unsignedDigit(0);return e.sign?-r:r}var n=e.__digit(t-1),i=l.__clz30(n),o=30*t-i;if(1024<o)return e.sign?-1/0:1/0;var a=o-1,s=n,u=t-1,c=i+3,d=32===c?0:s<<c;d>>>=12;var h=c-12,f=12<=c?0:s<<20+c,p=20+c;for(0<h&&0<u&&(u--,d|=(s=e.__digit(u))>>>30-h,f=s<<h+2,p=h+2);0<p&&0<u;)u--,s=e.__digit(u),f|=30<=p?s<<p-30:s>>>30-p,p-=30;var m=l.__decideRounding(e,p,u,s);if((1===m||0===m&&1==(1&f))&&0==(f=f+1>>>0)&&0!=++d>>>20&&(d=0,1023<++a))return e.sign?-1/0:1/0;var y=e.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=y|a|d,l.__kBitConversionInts[0]=f,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(e){if(0===e.length)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:"bitwiseNot",value:function(e){return e.sign?l.__absoluteSubOne(e).__trim():l.__absoluteAddOne(e,!0)}},{key:"exponentiate",value:function(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return l.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&t.__digit(0))?l.unaryMinus(e):e;if(1<t.length)throw new RangeError("BigInt too big");var r=t.__unsignedDigit(0);if(1===r)return e;if(r>=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var n=1+(0|r/30),i=new l(n,e.sign&&0!=(1&r));i.__initializeDigits();var o=1<<r%30;return i.__setDigit(n-1,o),i}var a=null,s=e;for(0!=(1&r)&&(a=e),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(e,t){if(0===e.length)return e;if(0===t.length)return t;var r=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&r--;var n=new l(r,e.sign!==t.sign);n.__initializeDigits();for(var i=0;i<e.length;i++)l.__multiplyAccumulate(t,e.__digit(i),n,i);return n.__trim()}},{key:"divide",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(e,t))return l.__zero();var r,n=e.sign!==t.sign,i=t.__unsignedDigit(0);if(1===t.length&&32767>=i){if(1===i)return n===e.sign?e:l.unaryMinus(e);r=l.__absoluteDivSmall(e,i,null);}else r=l.__absoluteDivLarge(e,t,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(e,t))return e;var r=t.__unsignedDigit(0);if(1===t.length&&32767>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(e,r);return 0===n?l.__zero():l.__oneDigit(n,e.sign)}var i=l.__absoluteDivLarge(e,t,!1,!0);return i.sign=e.sign,i.__trim()}},{key:"add",value:function(e,t){var r=e.sign;return r===t.sign?l.__absoluteAdd(e,t,r):0<=l.__absoluteCompare(e,t)?l.__absoluteSub(e,t,r):l.__absoluteSub(t,e,!r)}},{key:"subtract",value:function(e,t){var r=e.sign;return r===t.sign?0<=l.__absoluteCompare(e,t)?l.__absoluteSub(e,t,r):l.__absoluteSub(t,e,!r):l.__absoluteAdd(e,t,r)}},{key:"leftShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?l.__rightShiftByAbsolute(e,t):l.__leftShiftByAbsolute(e,t)}},{key:"signedRightShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?l.__leftShiftByAbsolute(e,t):l.__rightShiftByAbsolute(e,t)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,t){return 0>l.__compareToBigInt(e,t)}},{key:"lessThanOrEqual",value:function(e,t){return 0>=l.__compareToBigInt(e,t)}},{key:"greaterThan",value:function(e,t){return 0<l.__compareToBigInt(e,t)}},{key:"greaterThanOrEqual",value:function(e,t){return 0<=l.__compareToBigInt(e,t)}},{key:"equal",value:function(e,t){if(e.sign!==t.sign)return !1;if(e.length!==t.length)return !1;for(var r=0;r<e.length;r++)if(e.__digit(r)!==t.__digit(r))return !1;return !0}},{key:"notEqual",value:function(e,t){return !l.equal(e,t)}},{key:"bitwiseAnd",value:function(e,t){if(!e.sign&&!t.sign)return l.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var r=i(e.length,t.length)+1,n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return n=l.__absoluteOr(n,o,n),l.__absoluteAddOne(n,!0,n).__trim()}if(e.sign){var a=[t,e];e=a[0],t=a[1];}return l.__absoluteAndNot(e,l.__absoluteSubOne(t)).__trim()}},{key:"bitwiseXor",value:function(e,t){if(!e.sign&&!t.sign)return l.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var r=i(e.length,t.length),n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return l.__absoluteXor(n,o,n).__trim()}var a=i(e.length,t.length)+1;if(e.sign){var s=[t,e];e=s[0],t=s[1];}var u=l.__absoluteSubOne(t,a);return u=l.__absoluteXor(u,e,u),l.__absoluteAddOne(u,!0,u).__trim()}},{key:"bitwiseOr",value:function(e,t){var r=i(e.length,t.length);if(!e.sign&&!t.sign)return l.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var n=l.__absoluteSubOne(e,r),o=l.__absoluteSubOne(t);return n=l.__absoluteAnd(n,o,n),l.__absoluteAddOne(n,!0,n).__trim()}if(e.sign){var a=[t,e];e=a[0],t=a[1];}var s=l.__absoluteSubOne(t,r);return s=l.__absoluteAndNot(s,e,s),l.__absoluteAddOne(s,!0,s).__trim()}},{key:"asIntN",value:function(e,t){if(0===t.length)return t;if(0>(e=s(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return l.__zero();if(e>=l.__kMaxLengthBits)return t;var r=0|(e+29)/30;if(t.length<r)return t;var n=t.__unsignedDigit(r-1),i=1<<(e-1)%30;if(t.length===r&&n<i)return t;if((n&i)!==i)return l.__truncateToNBits(e,t);if(!t.sign)return l.__truncateAndSubFromPowerOfTwo(e,t,!0);if(0==(n&i-1)){for(var o=r-2;0<=o;o--)if(0!==t.__digit(o))return l.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===r&&n===i?t:l.__truncateToNBits(e,t)}return l.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:"asUintN",value:function(e,t){if(0===t.length)return t;if(0>(e=s(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return l.__zero();if(t.sign){if(e>l.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=l.__kMaxLengthBits)return t;var r=0|(e+29)/30;if(t.length<r)return t;var n=e%30;if(t.length==r){if(0===n)return t;if(0==t.__digit(r-1)>>>n)return t}return l.__truncateToNBits(e,t)}},{key:"ADD",value:function(e,t){if(e=l.__toPrimitive(e),t=l.__toPrimitive(t),"string"==typeof e)return "string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=l.__toNumeric(e),t=l.__toNumeric(t),l.__isBigInt(e)&&l.__isBigInt(t))return l.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,t){return l.__compare(e,t,0)}},{key:"LE",value:function(e,t){return l.__compare(e,t,1)}},{key:"GT",value:function(e,t){return l.__compare(e,t,2)}},{key:"GE",value:function(e,t){return l.__compare(e,t,3)}},{key:"EQ",value:function(e,t){for(;;){if(l.__isBigInt(e))return l.__isBigInt(t)?l.equal(e,t):l.EQ(t,e);if("number"==typeof e){if(l.__isBigInt(t))return l.__equalToNumber(t,e);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("string"==typeof e){if(l.__isBigInt(t))return null!==(e=l.__fromString(e))&&l.equal(e,t);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("boolean"==typeof e){if(l.__isBigInt(t))return l.__equalToNumber(t,+e);if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else if("symbol"===r(e)){if(l.__isBigInt(t))return !1;if("object"!==r(t))return e==t;t=l.__toPrimitive(t);}else {if("object"!==r(e))return e==t;if("object"===r(t)&&t.constructor!==l)return e==t;e=l.__toPrimitive(e);}}}},{key:"NE",value:function(e,t){return !l.EQ(e,t)}},{key:"DataViewGetBigInt64",value:function(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return l.asIntN(64,l.DataViewGetBigUint64(e,t,r))}},{key:"DataViewGetBigUint64",value:function(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],n=y(r?[4,0]:[0,4],2),i=n[0],o=n[1],a=e.getUint32(t+i,r),s=e.getUint32(t+o,r),u=new l(3,!1);return u.__setDigit(0,1073741823&s),u.__setDigit(1,(268435455&a)<<2|s>>>30),u.__setDigit(2,a>>>28),u.__trim()}},{key:"DataViewSetBigInt64",value:function(e,t,r){var n=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3];l.DataViewSetBigUint64(e,t,r,n);}},{key:"DataViewSetBigUint64",value:function(e,t,r){var n=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3],i=0,o=0;if(0<(r=l.asUintN(64,r)).length&&(o=r.__digit(0),1<r.length)){var a=r.__digit(1);o|=a<<30,i=a>>>2,2<r.length&&(i|=r.__digit(2)<<28);}var s=y(n?[4,0]:[0,4],2),u=s[0],c=s[1];e.setUint32(t+u,i,n),e.setUint32(t+c,o,n);}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(e,t){var r=new l(1,t);return r.__setDigit(0,e),r}},{key:"__decideRounding",value:function(e,t,r,n){if(0<t)return -1;var i;if(0>t)i=-t-1;else {if(0===r)return -1;r--,n=e.__digit(r),i=29;}var o=1<<i;if(0==(n&o))return -1;if(0!=(n&(o-=1)))return 1;for(;0<r;)if(r--,0!==e.__digit(r))return 1;return 0}},{key:"__fromDouble",value:function(e){l.__kBitConversionDouble[0]=e;var t,r=(2047&l.__kBitConversionInts[1]>>>20)-1023,n=1+(0|r/30),i=new l(n,0>e),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=r%30,c=0;if(u<s){var d=s-u;c=d+32,t=o>>>d,o=o<<32-d|a>>>d,a<<=32-d;}else if(u===s)c=32,t=o,o=a,a=0;else {var h=u-s;c=32-h,t=o<<h|a>>>32-h,o=a<<h,a=0;}i.__setDigit(n-1,t);for(var f=n-2;0<=f;f--)0<c?(c-=30,t=o>>>2,o=o<<30|a>>>2,a<<=30):t=0,i.__setDigit(f,t);return i.__trim()}},{key:"__isWhitespace",value:function(e){return !!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}},{key:"__fromString",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0,n=e.length,i=0;if(i===n)return l.__zero();for(var o=e.charCodeAt(i);l.__isWhitespace(o);){if(++i===n)return l.__zero();o=e.charCodeAt(i);}if(43===o){if(++i===n)return null;o=e.charCodeAt(i),r=1;}else if(45===o){if(++i===n)return null;o=e.charCodeAt(i),r=-1;}if(0===t){if(t=10,48===o){if(++i===n)return l.__zero();if(88===(o=e.charCodeAt(i))||120===o){if(t=16,++i===n)return null;o=e.charCodeAt(i);}else if(79===o||111===o){if(t=8,++i===n)return null;o=e.charCodeAt(i);}else if(66===o||98===o){if(t=2,++i===n)return null;o=e.charCodeAt(i);}}}else if(16===t&&48===o){if(++i===n)return l.__zero();if(88===(o=e.charCodeAt(i))||120===o){if(++i===n)return null;o=e.charCodeAt(i);}}if(0!==r&&10!==t)return null;for(;48===o;){if(++i===n)return l.__zero();o=e.charCodeAt(i);}var a=n-i,s=l.__kMaxBitsPerChar[t],u=l.__kBitsPerCharTableMultiplier-1;if(a>1073741824/s)return null;var c=new l(0|(29+(s*a+u>>>l.__kBitsPerCharTableShift))/30,!1),d=10>t?t:10,h=10<t?t-10:0;if(0==(t&t-1)){s>>=l.__kBitsPerCharTableShift;var f=[],p=[],m=!1;do{for(var y,g=0,v=0;;){if(y=void 0,o-48>>>0<d)y=o-48;else {if(!((32|o)-97>>>0<h)){m=!0;break}y=(32|o)-87;}if(v+=s,g=g<<s|y,++i===n){m=!0;break}if(o=e.charCodeAt(i),30<v+s)break}f.push(g),p.push(v);}while(!m);l.__fillFromParts(c,f,p);}else {c.__initializeDigits();var w=!1,b=0;do{for(var _,E=0,T=1;;){if(_=void 0,o-48>>>0<d)_=o-48;else {if(!((32|o)-97>>>0<h)){w=!0;break}_=(32|o)-87;}var x=T*t;if(1073741823<x)break;if(T=x,E=E*t+_,b++,++i===n){w=!0;break}o=e.charCodeAt(i);}var I=0|(s*b+(u=30*l.__kBitsPerCharTableMultiplier-1)>>>l.__kBitsPerCharTableShift)/30;c.__inplaceMultiplyAdd(T,E,I);}while(!w)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i<n;i++)if(o=e.charCodeAt(i),!l.__isWhitespace(o))return null}return c.sign=-1===r,c.__trim()}},{key:"__fillFromParts",value:function(e,t,r){for(var n=0,i=0,o=0,a=t.length-1;0<=a;a--){var s=t[a],l=r[a];i|=s<<o,30===(o+=l)?(e.__setDigit(n++,i),o=0,i=0):30<o&&(e.__setDigit(n++,1073741823&i),i=s>>>l-(o-=30));}if(0!==i){if(n>=e.length)throw new Error("implementation bug");e.__setDigit(n++,i);}for(;n<e.length;n++)e.__setDigit(n,0);}},{key:"__toStringBasePowerOfTwo",value:function(e,t){var r=e.length,n=t-1,i=n=(15&(n=(51&(n=(85&n>>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=t-1,a=e.__digit(r-1),s=0|(30*r-l.__clz30(a)+i-1)/i;if(e.sign&&s++,268435456<s)throw new Error("string too long");for(var u=Array(s),c=s-1,d=0,h=0,f=0;f<r-1;f++){var p=e.__digit(f),m=(d|p<<h)&o;u[c--]=l.__kConversionChars[m];var y=i-h;for(d=p>>>y,h=30-y;h>=i;)u[c--]=l.__kConversionChars[d&o],d>>>=i,h-=i;}var g=(d|a<<h)&o;for(u[c--]=l.__kConversionChars[g],d=a>>>i-h;0!==d;)u[c--]=l.__kConversionChars[d&o],d>>>=i;if(e.sign&&(u[c--]="-"),-1!==c)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(e,t,r){var n=e.length;if(0===n)return "";if(1===n){var i=e.__unsignedDigit(0).toString(t);return !1===r&&e.sign&&(i="-"+i),i}var o,a,s=30*n-l.__clz30(e.__digit(n-1)),u=l.__kMaxBitsPerChar[t]-1,c=s*l.__kBitsPerCharTableMultiplier,d=1+(c=0|(c+=u-1)/u)>>1,h=l.exponentiate(l.__oneDigit(t,!1),l.__oneDigit(d,!1)),f=h.__unsignedDigit(0);if(1===h.length&&32767>=f){(o=new l(e.length,!1)).__initializeDigits();for(var p,m=0,y=2*e.length-1;0<=y;y--)p=m<<15|e.__halfDigit(y),o.__setHalfDigit(y,0|p/f),m=0|p%f;a=m.toString(t);}else {var g=l.__absoluteDivLarge(e,h,!0,!0);o=g.quotient;var v=g.remainder.__trim();a=l.__toStringGeneric(v,t,!0);}o.__trim();for(var w=l.__toStringGeneric(o,t,!0);a.length<d;)a="0"+a;return !1===r&&e.sign&&(w="-"+w),w+a}},{key:"__unequalSign",value:function(e){return e?-1:1}},{key:"__absoluteGreater",value:function(e){return e?-1:1}},{key:"__absoluteLess",value:function(e){return e?1:-1}},{key:"__compareToBigInt",value:function(e,t){var r=e.sign;if(r!==t.sign)return l.__unequalSign(r);var n=l.__absoluteCompare(e,t);return 0<n?l.__absoluteGreater(r):0>n?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(e,r){if(l.__isOneDigitInt(r)){var n=e.sign,i=0>r;if(n!==i)return l.__unequalSign(n);if(0===e.length){if(i)throw new Error("implementation bug");return 0===r?0:-1}if(1<e.length)return l.__absoluteGreater(n);var o=t(r),a=e.__unsignedDigit(0);return a>o?l.__absoluteGreater(n):a<o?l.__absoluteLess(n):0}return l.__compareToDouble(e,r)}},{key:"__compareToDouble",value:function(e,t){if(t!=t)return t;if(t===1/0)return -1;if(t===-1/0)return 1;var r=e.sign;if(r!==0>t)return l.__unequalSign(r);if(0===t)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return -1;l.__kBitConversionDouble[0]=t;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=e.length,a=e.__digit(o-1),s=l.__clz30(a),u=30*o-s,c=i+1;if(u<c)return l.__absoluteLess(r);if(u>c)return l.__absoluteGreater(r);var d=1048576|1048575&l.__kBitConversionInts[1],h=l.__kBitConversionInts[0],f=20,p=29-s;if(p!==(0|(u-1)%30))throw new Error("implementation bug");var m,y=0;if(p<f){var g=f-p;y=g+32,m=d>>>g,d=d<<32-g|h>>>g,h<<=32-g;}else if(p===f)y=32,m=d,d=h,h=0;else {var v=p-f;y=32-v,m=d<<v|h>>>32-v,d=h<<v,h=0;}if((a>>>=0)>(m>>>=0))return l.__absoluteGreater(r);if(a<m)return l.__absoluteLess(r);for(var w=o-2;0<=w;w--){0<y?(y-=30,m=d>>>2,d=d<<30|h>>>2,h<<=30):m=0;var b=e.__unsignedDigit(w);if(b>m)return l.__absoluteGreater(r);if(b<m)return l.__absoluteLess(r)}if(0!==d||0!==h){if(0===y)throw new Error("implementation bug");return l.__absoluteLess(r)}return 0}},{key:"__equalToNumber",value:function(e,r){return l.__isOneDigitInt(r)?0===r?0===e.length:1===e.length&&e.sign===0>r&&e.__unsignedDigit(0)===t(r):0===l.__compareToDouble(e,r)}},{key:"__comparisonResultToBool",value:function(e,t){return 0===t?0>e:1===t?0>=e:2===t?0<e:3===t?0<=e:void 0}},{key:"__compare",value:function(e,t,r){if(e=l.__toPrimitive(e),t=l.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(r){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(l.__isBigInt(e)&&"string"==typeof t)return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if("string"==typeof e&&l.__isBigInt(t))return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if(e=l.__toNumeric(e),t=l.__toNumeric(t),l.__isBigInt(e)){if(l.__isBigInt(t))return l.__comparisonResultToBool(l.__compareToBigInt(e,t),r);if("number"!=typeof t)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(e,t),r)}if("number"!=typeof e)throw new Error("implementation bug");if(l.__isBigInt(t))return l.__comparisonResultToBool(l.__compareToNumber(t,e),2^r);if("number"!=typeof t)throw new Error("implementation bug");return 0===r?e<t:1===r?e<=t:2===r?e>t:3===r?e>=t:void 0}},{key:"__absoluteAdd",value:function(e,t,r){if(e.length<t.length)return l.__absoluteAdd(t,e,r);if(0===e.length)return e;if(0===t.length)return e.sign===r?e:l.unaryMinus(e);var n=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&n++;for(var i,o=new l(n,r),a=0,s=0;s<t.length;s++)a=(i=e.__digit(s)+t.__digit(s)+a)>>>30,o.__setDigit(s,1073741823&i);for(;s<e.length;s++){var u=e.__digit(s)+a;a=u>>>30,o.__setDigit(s,1073741823&u);}return s<o.length&&o.__setDigit(s,a),o.__trim()}},{key:"__absoluteSub",value:function(e,t,r){if(0===e.length)return e;if(0===t.length)return e.sign===r?e:l.unaryMinus(e);for(var n,i=new l(e.length,r),o=0,a=0;a<t.length;a++)o=1&(n=e.__digit(a)-t.__digit(a)-o)>>>30,i.__setDigit(a,1073741823&n);for(;a<e.length;a++){var s=e.__digit(a)-o;o=1&s>>>30,i.__setDigit(a,1073741823&s);}return i.__trim()}},{key:"__absoluteAddOne",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length;null===r?r=new l(n,t):r.sign=t;for(var i,o=1,a=0;a<n;a++)o=(i=e.__digit(a)+o)>>>30,r.__setDigit(a,1073741823&i);return 0!==o&&r.__setDigitGrow(n,1),r}},{key:"__absoluteSubOne",value:function(e,t){for(var r,n=e.length,i=new l(t=t||n,!1),o=1,a=0;a<n;a++)o=1&(r=e.__digit(a)-o)>>>30,i.__setDigit(a,1073741823&r);if(0!==o)throw new Error("implementation bug");for(var s=n;s<t;s++)i.__setDigit(s,0);return i}},{key:"__absoluteAnd",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=o;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)&t.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteAndNot",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;n<i&&(o=n);var a=n;null===r?r=new l(a,!1):a=r.length;for(var s=0;s<o;s++)r.__setDigit(s,e.__digit(s)&~t.__digit(s));for(;s<n;s++)r.__setDigit(s,e.__digit(s));for(;s<a;s++)r.__setDigit(s,0);return r}},{key:"__absoluteOr",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=n;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)|t.__digit(c));for(;c<n;c++)r.__setDigit(c,e.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteXor",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,i=t.length,o=i;if(n<i){o=n;var a=e,s=n;e=t,n=i,t=a,i=s;}var u=n;null===r?r=new l(u,!1):u=r.length;for(var c=0;c<o;c++)r.__setDigit(c,e.__digit(c)^t.__digit(c));for(;c<n;c++)r.__setDigit(c,e.__digit(c));for(;c<u;c++)r.__setDigit(c,0);return r}},{key:"__absoluteCompare",value:function(e,t){var r=e.length-t.length;if(0!=r)return r;for(var n=e.length-1;0<=n&&e.__digit(n)===t.__digit(n);)n--;return 0>n?0:e.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(e,t,r,n){if(0!==t){for(var i=32767&t,o=t>>>15,a=0,s=0,u=0;u<e.length;u++,n++){var c=r.__digit(n),d=e.__digit(u),h=32767&d,f=d>>>15,p=l.__imul(h,i),m=l.__imul(h,o),y=l.__imul(f,i);a=(c+=s+p+a)>>>30,c&=1073741823,a+=(c+=((32767&m)<<15)+((32767&y)<<15))>>>30,s=l.__imul(f,o)+(m>>>15)+(y>>>15),r.__setDigit(n,1073741823&c);}for(;0!==a||0!==s;n++){var g=r.__digit(n);g+=a+s,s=0,a=g>>>30,r.__setDigit(n,1073741823&g);}}}},{key:"__internalMultiplyAdd",value:function(e,t,r,n,i){for(var o=r,a=0,s=0;s<n;s++){var u=e.__digit(s),c=l.__imul(32767&u,t),d=l.__imul(u>>>15,t),h=c+((32767&d)<<15)+a+o;o=h>>>30,a=d>>>15,i.__setDigit(s,1073741823&h);}if(i.length>n)for(i.__setDigit(n++,o+a);n<i.length;)i.__setDigit(n++,0);else if(0!==o+a)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;null===r&&(r=new l(e.length,!1));for(var n=0,i=2*e.length-1;0<=i;i-=2){var o=(n<<15|e.__halfDigit(i))>>>0,a=0|o/t,s=0|(o=((n=0|o%t)<<15|e.__halfDigit(i-1))>>>0)/t;n=0|o%t,r.__setDigit(i>>>1,a<<15|s);}return r}},{key:"__absoluteModSmall",value:function(e,t){for(var r=0,n=2*e.length-1;0<=n;n--)r=0|((r<<15|e.__halfDigit(n))>>>0)%t;return r}},{key:"__absoluteDivLarge",value:function(e,t,r,n){var i=t.__halfDigitLength(),o=t.length,a=e.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var u=new l(i+2>>>1,!1);u.__initializeDigits();var c=l.__clz15(t.__halfDigit(i-1));0<c&&(t=l.__specialLeftShift(t,c,0));for(var d=l.__specialLeftShift(e,c,1),h=t.__halfDigit(i-1),f=0,p=a;0<=p;p--){var m=32767,y=d.__halfDigit(p+i);if(y!==h){var g=(y<<15|d.__halfDigit(p+i-1))>>>0;m=0|g/h;for(var v=0|g%h,w=t.__halfDigit(i-2),b=d.__halfDigit(p+i-2);l.__imul(m,w)>>>0>(v<<16|b)>>>0&&(m--,!(32767<(v+=h))););}l.__internalMultiplyAdd(t,m,0,o,u);var _=d.__inplaceSub(u,p,i+1);0!==_&&(_=d.__inplaceAdd(t,p,i),d.__setHalfDigit(p+i,32767&d.__halfDigit(p+i)+_),m--),r&&(1&p?f=m<<15:s.__setDigit(p>>>1,f|m));}if(n)return d.__inplaceRightShift(c),r?{quotient:s,remainder:d}:d;if(r)return s;throw new Error("unreachable")}},{key:"__clz15",value:function(e){return l.__clz30(e)-15}},{key:"__specialLeftShift",value:function(e,t,r){var n=e.length,i=new l(n+r,!1);if(0===t){for(var o=0;o<n;o++)i.__setDigit(o,e.__digit(o));return 0<r&&i.__setDigit(n,0),i}for(var a,s=0,u=0;u<n;u++)a=e.__digit(u),i.__setDigit(u,1073741823&a<<t|s),s=a>>>30-t;return 0<r&&i.__setDigit(n,s),i}},{key:"__leftShiftByAbsolute",value:function(e,t){var r=l.__toShiftAmount(t);if(0>r)throw new RangeError("BigInt too big");var n=0|r/30,i=r%30,o=e.length,a=0!==i&&0!=e.__digit(o-1)>>>30-i,s=o+n+(a?1:0),u=new l(s,e.sign);if(0===i){for(var c=0;c<n;c++)u.__setDigit(c,0);for(;c<s;c++)u.__setDigit(c,e.__digit(c-n));}else {for(var d=0,h=0;h<n;h++)u.__setDigit(h,0);for(var f,p=0;p<o;p++)f=e.__digit(p),u.__setDigit(p+n,1073741823&f<<i|d),d=f>>>30-i;if(a)u.__setDigit(o+n,d);else if(0!==d)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(e,t){var r=e.length,n=e.sign,i=l.__toShiftAmount(t);if(0>i)return l.__rightShiftByMaximum(n);var o=0|i/30,a=i%30,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(e.__digit(o)&(1<<a)-1))u=!0;else for(var c=0;c<o;c++)if(0!==e.__digit(c)){u=!0;break}u&&0===a&&0==~e.__digit(r-1)&&s++;var d=new l(s,n);if(0===a){d.__setDigit(s-1,0);for(var h=o;h<r;h++)d.__setDigit(h-o,e.__digit(h));}else {for(var f,p=e.__digit(o)>>>a,m=r-o-1,y=0;y<m;y++)f=e.__digit(y+o+1),d.__setDigit(y,1073741823&f<<30-a|p),p=f>>>a;d.__setDigit(m,p);}return u&&(d=l.__absoluteAddOne(d,!0,d)),d.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(e){if(1<e.length)return -1;var t=e.__unsignedDigit(0);return t>l.__kMaxLengthBits?-1:t}},{key:"__toPrimitive",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==r(e))return e;if(e.constructor===l)return e;if("undefined"!=typeof Symbol&&"symbol"===r(Symbol.toPrimitive)){var n=e[Symbol.toPrimitive];if(n){var i=n(t);if("object"!==r(i))return i;throw new TypeError("Cannot convert object to primitive value")}}var o=e.valueOf;if(o){var a=o.call(e);if("object"!==r(a))return a}var s=e.toString;if(s){var u=s.call(e);if("object"!==r(u))return u}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(e){return l.__isBigInt(e)?e:+e}},{key:"__isBigInt",value:function(e){return "object"===r(e)&&null!==e&&e.constructor===l}},{key:"__truncateToNBits",value:function(e,t){for(var r=0|(e+29)/30,n=new l(r,t.sign),i=r-1,o=0;o<i;o++)n.__setDigit(o,t.__digit(o));var a=t.__digit(i);if(0!=e%30){var s=32-e%30;a=a<<s>>>s;}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(e,t,r){for(var n,i=Math.min,o=0|(e+29)/30,a=new l(o,r),s=0,u=o-1,c=0,d=i(u,t.length);s<d;s++)c=1&(n=0-t.__digit(s)-c)>>>30,a.__setDigit(s,1073741823&n);for(;s<u;s++)a.__setDigit(s,0|1073741823&-c);var h,f=u<t.length?t.__digit(u):0,p=e%30;if(0===p)h=0-f-c,h&=1073741823;else {var m=32-p,y=1<<32-m;h=y-(f=f<<m>>>m)-c,h&=y-1;}return a.__setDigit(u,h),a.__trim()}},{key:"__digitPow",value:function(e,t){for(var r=1;0<t;)1&t&&(r*=e),t>>>=1,e*=e;return r}},{key:"__isOneDigitInt",value:function(e){return (1073741823&e)===e}}]),l}(h(Array));return T.__kMaxLength=33554432,T.__kMaxLengthBits=T.__kMaxLength<<5,T.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],T.__kBitsPerCharTableShift=5,T.__kBitsPerCharTableMultiplier=1<<T.__kBitsPerCharTableShift,T.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],T.__kBitConversionBuffer=new ArrayBuffer(8),T.__kBitConversionDouble=new Float64Array(T.__kBitConversionBuffer),T.__kBitConversionInts=new Int32Array(T.__kBitConversionBuffer),T.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,r=Math.log;return 0===e?30:0|29-(0|r(e>>>0)/t)},T.__imul=e||function(e,t){return 0|e*t},T}();var d$1=l$1(c$1.exports);const h$1={};function f$2(e,t){Object.defineProperty(e.prototype,Symbol.toStringTag,{value:t,writable:!1,enumerable:!1,configurable:!0});for(const t of Object.getOwnPropertyNames(e)){const r=Object.getOwnPropertyDescriptor(e,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e,t,r));}for(const t of Object.getOwnPropertyNames(e.prototype)){const r=Object.getOwnPropertyDescriptor(e.prototype,t);r.configurable&&r.enumerable&&(r.enumerable=!1,Object.defineProperty(e.prototype,t,r));}p$1(t,e),p$1(`${t}.prototype`,e.prototype);}function p$1(e,t){const r=`%${e}%`;if(void 0!==h$1[r])throw new Error(`intrinsic ${e} already exists`);h$1[r]=t;}function m$1(e){return h$1[e]}var y$1,g$1;const v$1="slot-epochNanoSeconds",w$1="slot-timezone-identifier",b$2="slot-year",_="slot-month",E$1="slot-day",T$1="slot-hour",x$1="slot-minute",I$1="slot-second",S$1="slot-millisecond",R="slot-microsecond",k="slot-nanosecond",j="slot-calendar",D="slot-date-brand",N="slot-year-month-brand",O="slot-month-day-brand",C$1="slot-cached-instant",A$1="slot-time-zone",M$1="slot-years",L="slot-months",P="slot-weeks",B$1="slot-days",$="slot-hours",F="slot-minutes",U="slot-seconds",q="slot-milliseconds",Y="slot-microseconds",W$1="slot-nanoseconds",z$1="slot-calendar-identifier",G=new WeakMap,H=Symbol.for("@@Temporal__GetSlots");(y$1=globalThis)[H]||(y$1[H]=function(e){return G.get(e)});const J=globalThis[H],V=Symbol.for("@@Temporal__CreateSlots");(g$1=globalThis)[V]||(g$1[V]=function(e){G.set(e,Object.create(null));});const Q=globalThis[V];function Z(e,...t){if(!e||"object"!=typeof e)return !1;const r=J(e);return !!r&&t.every((e=>e in r))}function K(e,t){const r=J(e)?.[t];if(void 0===r)throw new TypeError(`Missing internal slot ${t}`);return r}function X(e,t,r){const n=J(e);if(void 0===n)throw new TypeError("Missing slots for the given container");if(n[t])throw new TypeError(`${t} already has set`);n[t]=r;}const ee=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,te=new RegExp("(?:"+[`(?:${ee.source})(?:\\/(?:${ee.source}))*`,"Etc/GMT(?:0|[-+]\\d{1,2})","GMT[-+]?0","EST5EDT","CST6CDT","MST7MDT","PST8PDT",/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source].join("|")+")"),re=/(?:[+\u2212-]\d{6}|\d{4})/,ne=/(?:0[1-9]|1[0-2])/,ie=/(?:0[1-9]|[12]\d|3[01])/,oe=new RegExp(`(${re.source})(?:-(${ne.source})-(${ie.source})|(${ne.source})(${ie.source}))`),ae=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,se=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,le=new RegExp(`([zZ])|${se.source}?`),ue=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,ce=new RegExp([`^${oe.source}`,`(?:(?:T|\\s+)${ae.source}(?:${le.source})?)?`,`(?:\\[!?(${te.source})\\])?`,`((?:${ue.source})*)$`].join(""),"i"),de=new RegExp([`^T?${ae.source}`,`(?:${le.source})?`,`(?:\\[!?${te.source}\\])?`,`((?:${ue.source})*)$`].join(""),"i"),he=new RegExp(`^(${re.source})-?(${ne.source})(?:\\[!?${te.source}\\])?((?:${ue.source})*)$`),fe=new RegExp(`^(?:--)?(${ne.source})-?(${ie.source})(?:\\[!?${te.source}\\])?((?:${ue.source})*)$`),pe=/(\d+)(?:[.,](\d{1,9}))?/,me=new RegExp(`(?:${pe.source}H)?(?:${pe.source}M)?(?:${pe.source}S)?`),ye=new RegExp(`^([+−-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${me.source})?$`,"i"),ge=Array.prototype.includes,ve=Array.prototype.push,we=globalThis.Intl.DateTimeFormat,be=Math.min,_e=Math.max,Ee=Math.abs,Te=Math.floor,xe=Math.sign,Ie=Math.trunc,Se=Number.isNaN,Re=Number.isFinite,ke=Number,je=String,De=Number.MAX_SAFE_INTEGER,Ne=Object.create,Oe=Object.getOwnPropertyDescriptor,Ce=Reflect.apply,Ae=Reflect.ownKeys,Me=d$1.BigInt(0),Le=d$1.BigInt(1),Pe=d$1.BigInt(60),Be=d$1.BigInt(24),$e=d$1.BigInt(1e3),Fe=d$1.BigInt(1e6),Ue=d$1.BigInt(1e9),qe=d$1.BigInt(-1),Ye=d$1.multiply(d$1.BigInt(3600),Ue),We=d$1.multiply(Pe,Ue),ze=d$1.multiply(Ye,Be),Ge=d$1.multiply(d$1.BigInt(-86400),d$1.BigInt(1e17)),He=d$1.multiply(d$1.BigInt(86400),d$1.BigInt(1e17)),Je=-271821,Ve=275760,Qe=d$1.multiply(d$1.BigInt(-388152),d$1.BigInt(1e13)),Ze=d$1.multiply(ze,d$1.BigInt(3660)),Ke=d$1.multiply(ze,d$1.BigInt(366)),Xe=d$1.multiply(ze,d$1.BigInt(14)),et=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function tt(e){return d$1.equal(e,Me)}function rt(e,t){const r=e[t];if(void 0!==r)return r}function nt(e,t,r){return Ce(e,t,arguments.length>2?r:[])}function it(e){return "object"==typeof e&&null!==e||"function"==typeof e}function ot(e){if("bigint"==typeof e)throw new TypeError("Cannot convert BigInt to number");return ke(e)}function at(e){const t=ot(e);if(Se(t)||0===t)return 0;if(!Re(t))return t;const r=Te(Ee(t));return 0===r?0:xe(t)*r}function st(e){if("number"!=typeof e||Se(e)||!Re(e))return !1;const t=Ee(e);return Te(t)===t}function lt$1(e){if("symbol"==typeof e)throw new TypeError("Cannot convert a Symbol value to a String");return je(e)}function ut$1(e){const t=ot(e);if(0===t)return 0;if(Se(t)||!Re(t))throw new RangeError("invalid number value");const r=Ie(t);return 0===r?0:r}function ct(e,t){const r=ut$1(e);if(r<=0){if(void 0!==t)throw new RangeError(`property '${t}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return r}function dt(e){const t=ot(e);if(!Re(t))throw new RangeError("infinity is out of range");if(!st(t))throw new RangeError(`unsupported fractional value ${e}`);return 0===t?0:t}function ht(e,t){return {quotient:d$1.divide(e,t),remainder:d$1.remainder(e,t)}}function ft(e){return d$1.lessThan(e,Me)}function pt(e){return tt(e)?0:ft(e)?-1:1}function mt(e){return d$1.lessThan(e,Me)?d$1.multiply(e,qe):e}const yt=new Map([["year",ut$1],["month",ct],["monthCode",lt$1],["day",ct],["hour",ut$1],["minute",ut$1],["second",ut$1],["millisecond",ut$1],["microsecond",ut$1],["nanosecond",ut$1],["years",dt],["months",dt],["weeks",dt],["days",dt],["hours",dt],["minutes",dt],["seconds",dt],["milliseconds",dt],["microseconds",dt],["nanoseconds",dt],["era",lt$1],["eraYear",at],["offset",lt$1]]),gt$1=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),vt=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],wt=new Map(vt.map((e=>[e[0],e[1]]))),bt=new Map(vt.map((([e,t])=>[t,e]))),_t=vt.map((([,e])=>e)),Et=Array.from(wt.keys()).sort(),Tt=new Map;function xt(e){let t=Tt.get(e);return void 0===t&&(t=new we("en-us",{timeZone:je(e),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Tt.set(e,t)),t}function It(e){if(null==e)throw new TypeError(`Expected object not ${e}`);return Object(e)}function St(e,t,r,n){if(null==t)return;const i=Ae(t);for(const o of i)if(!r.some((e=>Object.is(e,o)))&&Object.prototype.propertyIsEnumerable.call(t,o)){const r=t[o];if(n&&n.some((e=>Object.is(e,r))))continue;e[o]=r;}}function Rt(e){return Z(e,v$1)&&!Z(e,A$1,j)}function kt(e){return Z(e,w$1)}function jt(e){return Z(e,z$1)}function Dt(e){return Z(e,M$1,L,B$1,$,F,U,q,Y,W$1)}function Nt(e){return Z(e,D)}function Ot(e){return Z(e,T$1,x$1,I$1,S$1,R,k)&&!Z(e,b$2,_,E$1)}function Ct(e){return Z(e,b$2,_,E$1,T$1,x$1,I$1,S$1,R,k)}function At(e){return Z(e,N)}function Mt(e){return Z(e,O)}function Lt(e){return Z(e,v$1,A$1,j)}function Pt(e){if(Z(e,j)||Z(e,A$1))throw new TypeError("with() does not support a calendar or timeZone property");if(Ot(e))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if(void 0!==e.calendar)throw new TypeError("with() does not support a calendar property");if(void 0!==e.timeZone)throw new TypeError("with() does not support a timeZone property")}function Bt(e,t){return "never"===t?"":$t(Vr(e),t)}function $t(e,t){return "never"===t||"auto"===t&&"iso8601"===e?"":`[${"critical"===t?"!":""}u-ca=${e}]`}function Ft(e){const t=ce.exec(e);if(!t)throw new RangeError(`invalid ISO 8601 string: ${e}`);let r=t[1];if("−"===r[0]&&(r=`-${r.slice(1)}`),"-000000"===r)throw new RangeError(`invalid ISO 8601 string: ${e}`);const n=at(r),i=at(t[2]||t[4]),o=at(t[3]||t[5]),a=at(t[6]),s=void 0!==t[6],l=at(t[7]||t[10]);let u=at(t[8]||t[11]);60===u&&(u=59);const c=(t[9]||t[12])+"000000000",d=at(c.slice(0,3)),h=at(c.slice(3,6)),f=at(c.slice(6,9));let p,m=!1;if(t[13])p=void 0,m=!0;else if(t[14]&&t[15]){const e="-"===t[14]||"−"===t[14]?"-":"+",r=t[15]||"00",n=t[16]||"00",i=t[17]||"00";let o=t[18]||"0";if(p=`${e}${r}:${n}`,+o){for(;o.endsWith("0");)o=o.slice(0,-1);p+=`:${i}.${o}`;}else +i&&(p+=`:${i}`);"-00:00"===p&&(p="+00:00");}const y=t[19],g=t[20];let v;for(const[,e,t,r]of g.matchAll(ue))if("u-ca"===t)void 0===v&&(v=r);else if("!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);return li(n,i,o,a,l,u,d,h,f),{year:n,month:i,day:o,hasTime:s,hour:a,minute:l,second:u,millisecond:d,microsecond:h,nanosecond:f,ianaName:y,offset:p,z:m,calendar:v}}function Ut(e){const t=he.exec(e);let r,n,i,o;if(t){let o=t[1];if("−"===o[0]&&(o=`-${o.slice(1)}`),"-000000"===o)throw new RangeError(`invalid ISO 8601 string: ${e}`);r=at(o),n=at(t[2]);const a=t[3];for(const[,e,t,r]of a.matchAll(ue))if("u-ca"===t)void 0===i&&(i=r);else if("!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);if(void 0!==i&&"iso8601"!==i)throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else {let t;if(({year:r,month:n,calendar:i,day:o,z:t}=Ft(e)),t)throw new RangeError("Z designator not supported for PlainYearMonth")}return {year:r,month:n,calendar:i,referenceISODay:o}}function qt(e){const t=fe.exec(e);let r,n,i,o;if(t){r=at(t[1]),n=at(t[2]);const e=t[3];for(const[,t,r,n]of e.matchAll(ue))if("u-ca"===r)void 0===i&&(i=n);else if("!"===t)throw new RangeError(`Unrecognized annotation: !${r}=${n}`);if(void 0!==i&&"iso8601"!==i)throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else {let t;if(({month:r,day:n,calendar:i,year:o,z:t}=Ft(e)),t)throw new RangeError("Z designator not supported for PlainMonthDay")}return {month:r,day:n,calendar:i,referenceISOYear:o}}function Yt(e,t,r,n){let i=e,o=t,a=r;switch(n){case"reject":oi(i,o,a);break;case"constrain":({year:i,month:o,day:a}=ni(i,o,a));}return {year:i,month:o,day:a}}function Wt(e,t,r,n,i,o,a){let s=e,l=t,u=r,c=n,d=i,h=o;switch(a){case"reject":si(s,l,u,c,d,h);break;case"constrain":({hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}=function(e,t,r,n,i,o){return {hour:ri(e,0,23),minute:ri(t,0,59),second:ri(r,0,59),millisecond:ri(n,0,999),microsecond:ri(i,0,999),nanosecond:ri(o,0,999)}}(s,l,u,c,d,h));}return {hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}}function zt(e){if(!it(e))return function(e){const t=ye.exec(e);if(!t)throw new RangeError(`invalid duration: ${e}`);if(t.slice(2).every((e=>void 0===e)))throw new RangeError(`invalid duration: ${e}`);const r="-"===t[1]||"−"===t[1]?-1:1,n=void 0===t[2]?0:ut$1(t[2])*r,i=void 0===t[3]?0:ut$1(t[3])*r,o=void 0===t[4]?0:ut$1(t[4])*r,a=void 0===t[5]?0:ut$1(t[5])*r,s=void 0===t[6]?0:ut$1(t[6])*r,l=t[7],u=t[8],c=t[9],d=t[10],h=t[11];let f=0,p=0,m=0;if(void 0!==l){if(u??c??d??h)throw new RangeError("only the smallest unit can be fractional");m=3600*at((l+"000000000").slice(0,9))*r;}else if(f=void 0===u?0:ut$1(u)*r,void 0!==c){if(d??h)throw new RangeError("only the smallest unit can be fractional");m=60*at((c+"000000000").slice(0,9))*r;}else p=void 0===d?0:ut$1(d)*r,void 0!==h&&(m=at((h+"000000000").slice(0,9))*r);const y=m%1e3,g=Ie(m/1e3)%1e3,v=Ie(m/1e6)%1e3;return p+=Ie(m/1e9)%60,f+=Ie(m/6e10),di(n,i,o,a,s,f,p,v,g,y),{years:n,months:i,weeks:o,days:a,hours:s,minutes:f,seconds:p,milliseconds:v,microseconds:g,nanoseconds:y}}(lt$1(e));if(Dt(e))return {years:K(e,M$1),months:K(e,L),weeks:K(e,P),days:K(e,B$1),hours:K(e,$),minutes:K(e,F),seconds:K(e,U),milliseconds:K(e,q),microseconds:K(e,Y),nanoseconds:K(e,W$1)};const t={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};let r=function(e){if(!it(e))throw new TypeError("invalid duration-like");const t={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0};let r=!1;for(const n of Et){const i=e[n];void 0!==i&&(r=!0,t[n]=dt(i));}if(!r)throw new TypeError("invalid duration-like");return t}(e);for(const e of Et){const n=r[e];void 0!==n&&(t[e]=n);}let{years:n,months:i,weeks:o,days:a,hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=t;return di(n,i,o,a,s,l,u,c,d,h),{years:n,months:i,weeks:o,days:a,hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}}function Gt(e){return void 0===e?"constrain":no(e,"overflow",["constrain","reject"],"constrain")}function Ht(e){return void 0===e?"compatible":no(e,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function Jt(e,t){return no(e,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],t)}function Vt(e,t){return void 0===e?t:no(e,"offset",["prefer","use","ignore","reject"],t)}function Qt(e){return no(e,"calendarName",["auto","always","never","critical"],"auto")}function Zt(e){let t=e.roundingIncrement;if(void 0===t)return 1;if(t=ot(t),!Re(t))throw new RangeError("roundingIncrement must be finite");const r=Ie(t);if(r<1||r>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return r}function Kt(e,t,r){const n=r?t:t-1;if(e>n)throw new RangeError(`roundingIncrement must be at least 1 and less than ${n}, not ${e}`);if(t%e!=0)throw new RangeError(`Rounding increment must divide evenly into ${t}`)}function Xt(e){const t=e.fractionalSecondDigits;if(void 0===t)return "auto";if("number"!=typeof t){if("auto"!==lt$1(t))throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return "auto"}const r=Te(t);if(!Re(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`);return r}function er(e,t){switch(e){case"minute":return {precision:"minute",unit:"minute",increment:1};case"second":return {precision:0,unit:"second",increment:1};case"millisecond":return {precision:3,unit:"millisecond",increment:1};case"microsecond":return {precision:6,unit:"microsecond",increment:1};case"nanosecond":return {precision:9,unit:"nanosecond",increment:1}}switch(t){case"auto":return {precision:t,unit:"nanosecond",increment:1};case 0:return {precision:t,unit:"second",increment:1};case 1:case 2:case 3:return {precision:t,unit:"millisecond",increment:10**(3-t)};case 4:case 5:case 6:return {precision:t,unit:"microsecond",increment:10**(6-t)};case 7:case 8:case 9:return {precision:t,unit:"nanosecond",increment:10**(9-t)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${t}`)}}const tr=Symbol("~required~");function rr(e,t,r,n,i=[]){const o=[];for(const[,e,t]of vt)"datetime"!==r&&r!==t||o.push(e);o.push(...i);let a=n;a===tr?a=void 0:void 0!==a&&o.push(a);const s=[...o];for(const e of o){const t=bt.get(e);void 0!==t&&s.push(t);}let l=no(e,t,s,a);if(void 0===l&&n===tr)throw new RangeError(`${t} is required`);return wt.has(l)?wt.get(l):l}function nr(e){const t=e.relativeTo;if(void 0===t)return t;let r,n,i,o,a,s,l,u,c,d,h,f,p="option",m=!1;if(it(t)){if(Lt(t)||Nt(t))return t;if(Ct(t))return ln(t);d=Jr(t);const e=kr(d,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);e.push("timeZone","offset");const m=ar(t,e,[]),y=Ne(null);y.overflow="constrain",({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(d,m,y)),f=m.offset,void 0===f&&(p="wall"),h=m.timeZone,void 0!==h&&(h=nn(h));}else {let e,y;if(({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,calendar:d,ianaName:e,offset:f,z:y}=Ft(lt$1(t))),e)h=nn(e),y?p="exact":f||(p="wall"),m=!0;else if(y)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");if(d||(d="iso8601"),!io(d))throw new RangeError(`invalid calendar identifier ${d}`);d=oo(d);}return void 0===h?wr(r,n,i,d):Rr(yr(r,n,i,o,a,s,l,u,c,p,"option"===p?Rn(f):0,h,"compatible","reject",m),h,d)}function ir(e,t,r,n,i,o,a,s,l,u){for(const[c,d]of [["years",e],["months",t],["weeks",r],["days",n],["hours",i],["minutes",o],["seconds",a],["milliseconds",s],["microseconds",l],["nanoseconds",u]])if(0!==d)return wt.get(c);return "nanosecond"}function or(e,t){return _t.indexOf(e)>_t.indexOf(t)?t:e}function ar(e,t,r,{emptySourceErrorMessage:n}={emptySourceErrorMessage:"no supported properties found"}){const i=Ne(null);let o=!1;t.sort();for(const n of t){let t=e[n];if(void 0!==t)o=!0,yt.has(n)&&(t=yt.get(n)(t)),i[n]=t;else if("partial"!==r){if(ge.call(r,n))throw new TypeError(`required property '${n}' missing or undefined`);t=gt$1.get(n),i[n]=t;}}if("partial"===r&&!o)throw new TypeError(n);return i}function sr(e,t="complete"){const r=["hour","microsecond","millisecond","minute","nanosecond","second"],n=ar(e,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),i={};for(const e of r){const r=Oe(n,e);void 0!==r?i[e]=r.value:"complete"===t&&(i[e]=0);}return i}function lr(e,t){let r=e;if(it(r)){if(Nt(r))return r;if(Lt(r)&&(Gt(t),r=hn(K(r,A$1),K(r,C$1),K(r,j))),Ct(r))return Gt(t),wr(K(r,b$2),K(r,_),K(r,E$1),K(r,j));const e=Jr(r);return en(e,ar(r,kr(e,["day","month","monthCode","year"]),[]),t)}Gt(t);let{year:n,month:i,day:o,calendar:a,z:s}=function(e){return Ft(e)}(lt$1(r));if(s)throw new RangeError("Z designator not supported for PlainDate");if(a||(a="iso8601"),!io(a))throw new RangeError(`invalid calendar identifier ${a}`);return a=oo(a),wr(n,i,o,a)}function ur(e,t,r){let{hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=sr(t);const u=Gt(r),c=en(e,t,r),d=K(c,b$2),h=K(c,_),f=K(c,E$1);return ({hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=Wt(n,i,o,a,s,l,u)),{year:d,month:h,day:f,hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}}function cr(e,t){let r,n,i,o,a,s,l,u,c,d;if(it(e)){if(Ct(e))return e;if(Lt(e))return Gt(t),hn(K(e,A$1),K(e,C$1),K(e,j));if(Nt(e))return Gt(t),_r(K(e,b$2),K(e,_),K(e,E$1),0,0,0,0,0,0,K(e,j));d=Jr(e);const h=ar(e,kr(d,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(d,h,t));}else {let h;if(Gt(t),({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,calendar:d,z:h}=function(e){return Ft(e)}(lt$1(e))),h)throw new RangeError("Z designator not supported for PlainDateTime");if(li(r,n,i,o,a,s,l,u,c),d||(d="iso8601"),!io(d))throw new RangeError(`invalid calendar identifier ${d}`);d=oo(d);}return _r(r,n,i,o,a,s,l,u,c,d)}function dr(e){if(Dt(e))return e;let{years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=zt(e);return new(m$1("%Temporal.Duration%"))(t,r,n,i,o,a,s,l,u,c)}function hr(e){if(Rt(e))return e;if(Lt(e))return new(m$1("%Temporal.Instant%"))(K(e,v$1));const t=function(e){let{year:t,month:r,day:n,hour:i,minute:o,second:a,millisecond:s,microsecond:l,nanosecond:u,offset:c,z:d}=function(e){const t=Ft(e);if(!t.z&&!t.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return t}(e);if(!d&&!c)throw new RangeError("Temporal.Instant requires a time zone offset");const h=d?0:Rn(c);({year:t,month:r,day:n,hour:i,minute:o,second:a,millisecond:s,microsecond:l,nanosecond:u}=Hn(t,r,n,i,o,a,s,l,u-h));const f=On(t,r,n,i,o,a,s,l,u);if(null===f)throw new RangeError("DateTime outside of supported range");return f}(lt$1(e));return new(m$1("%Temporal.Instant%"))(t)}function fr(e,t){let r=e;if(it(r)){if(Mt(r))return r;let e,n;if(Z(r,j))e=K(r,j),n=!1;else {let t=r.calendar;n=void 0===t,void 0===t&&(t="iso8601"),e=Hr(t);}const i=ar(r,kr(e,["day","month","monthCode","year"]),[]);return n&&void 0!==i.month&&void 0===i.monthCode&&void 0===i.year&&(i.year=1972),rn(e,i,t)}Gt(t);let{month:n,day:i,referenceISOYear:o,calendar:a}=qt(lt$1(r));if(void 0===a&&(a="iso8601"),!io(a))throw new RangeError(`invalid calendar identifier ${a}`);return a=oo(a),void 0===o?(oi(1972,n,i),Tr(n,i,a)):rn(a,Tr(n,i,a,o))}function pr(e,t="constrain"){let r,n,i,o,a,s,l=e;if(it(l)){if(Ot(l))return l;if(Lt(l)&&(l=hn(K(l,A$1),K(l,C$1),K(l,j))),Ct(l))return new(m$1("%Temporal.PlainTime%"))(K(l,T$1),K(l,x$1),K(l,I$1),K(l,S$1),K(l,R),K(l,k));(({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=sr(l))),({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=Wt(r,n,i,o,a,s,t));}else (({hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}=function(e){const t=de.exec(e);let r,n,i,o,a,s,l;if(t){r=at(t[1]),n=at(t[2]||t[5]),i=at(t[3]||t[6]),60===i&&(i=59);const e=(t[4]||t[7])+"000000000";o=at(e.slice(0,3)),a=at(e.slice(3,6)),s=at(e.slice(6,9)),l=t[14];for(const[,e,t,r]of l.matchAll(ue))if("u-ca"!==t&&"!"===e)throw new RangeError(`Unrecognized annotation: !${t}=${r}`);if(t[8])throw new RangeError("Z designator not supported for PlainTime")}else {let t,l;if(({hasTime:l,hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s,z:t}=Ft(e)),!l)throw new RangeError(`time is missing in string: ${e}`);if(t)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(e))return {hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s};try{const{month:t,day:r}=qt(e);oi(1972,t,r);}catch{try{const{year:t,month:r}=Ut(e);oi(t,r,1);}catch{return {hour:r,minute:n,second:i,millisecond:o,microsecond:a,nanosecond:s}}}throw new RangeError(`invalid ISO 8601 time-only string ${e}; may need a T prefix`)}(lt$1(l)))),si(r,n,i,o,a,s);return new(m$1("%Temporal.PlainTime%"))(r,n,i,o,a,s)}function mr(e,t){if(it(e)){if(At(e))return e;const r=Jr(e);return tn(r,ar(e,kr(r,["month","monthCode","year"]),[]),t)}Gt(t);let{year:r,month:n,referenceISODay:i,calendar:o}=Ut(lt$1(e));if(void 0===o&&(o="iso8601"),!io(o))throw new RangeError(`invalid calendar identifier ${o}`);return o=oo(o),void 0===i?(oi(r,n,1),Ir(r,n,o)):tn(o,Ir(r,n,o,i))}function yr(e,t,r,n,i,o,a,s,l,u,c,h,f,p,y){const g=new(m$1("%Temporal.PlainDateTime%"))(e,t,r,n,i,o,a,s,l);if("wall"===u||"ignore"===p)return K(fn(h,g,f),v$1);if("exact"===u||"use"===p){const u=On(e,t,r,n,i,o,a,s,l);if(null===u)throw new RangeError("ZonedDateTime outside of supported range");return d$1.subtract(u,d$1.BigInt(c))}const b=mn(h,g);for(const e of b){const t=cn(h,e),r=d$1.toNumber(Li(d$1.BigInt(t),We,"halfExpand"));if(t===c||y&&r===c)return K(e,v$1)}if("reject"===p){const e=Dn(c),t=kt(h)?K(h,w$1):"time zone";throw new RangeError(`Offset ${e} is invalid for ${g.toString()} in ${t}`)}return K(pn(b,h,g,f),v$1)}function gr(e,t){let r,n,i,o,a,s,l,u,c,d,h,f,p,m,y=!1,g="option";if(it(e)){if(Lt(e))return e;f=Jr(e);const y=kr(f,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);y.push("timeZone","offset");const v=ar(e,y,["timeZone"]);d=nn(v.timeZone),h=v.offset,void 0===h&&(g="wall"),p=Ht(t),m=Vt(t,"reject"),({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=ur(f,v,t));}else {let v,w;if(({year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c,ianaName:v,offset:h,z:w,calendar:f}=function(e){const t=Ft(e);if(!t.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return t}(lt$1(e))),d=nn(v),w?g="exact":h||(g="wall"),f||(f="iso8601"),!io(f))throw new RangeError(`invalid calendar identifier ${f}`);f=oo(f),y=!0,p=Ht(t),m=Vt(t,"reject"),Gt(t);}let v=0;return "option"===g&&(v=Rn(h)),Rr(yr(r,n,i,o,a,s,l,u,c,g,v,d,p,m,y),d,f)}function vr(e,t,r,n,i){oi(t,r,n),ai(t,r,n),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,n),X(e,j,i),X(e,D,!0);}function wr(e,t,r,n="iso8601"){const i=m$1("%Temporal.PlainDate%"),o=Ne(i.prototype);return vr(o,e,t,r,n),o}function br(e,t,r,n,i,o,a,s,l,u,c){li(t,r,n,i,o,a,s,l,u),ui(t,r,n,i,o,a,s,l,u),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,n),X(e,T$1,i),X(e,x$1,o),X(e,I$1,a),X(e,S$1,s),X(e,R,l),X(e,k,u),X(e,j,c);}function _r(e,t,r,n,i,o,a,s,l,u="iso8601"){const c=m$1("%Temporal.PlainDateTime%"),d=Ne(c.prototype);return br(d,e,t,r,n,i,o,a,s,l,u),d}function Er(e,t,r,n,i){oi(i,t,r),ai(i,t,r),Q(e),X(e,_,t),X(e,E$1,r),X(e,b$2,i),X(e,j,n),X(e,O,!0);}function Tr(e,t,r="iso8601",n=1972){const i=m$1("%Temporal.PlainMonthDay%"),o=Ne(i.prototype);return Er(o,e,t,r,n),o}function xr(e,t,r,n,i){oi(t,r,i),function(e,t){ii(e,Je,Ve),e===Je?ii(t,4,12):e===Ve&&ii(t,1,9);}(t,r),Q(e),X(e,b$2,t),X(e,_,r),X(e,E$1,i),X(e,j,n),X(e,N,!0);}function Ir(e,t,r="iso8601",n=1){const i=m$1("%Temporal.PlainYearMonth%"),o=Ne(i.prototype);return xr(o,e,t,r,n),o}function Sr(e,t,r,n){ci(t),Q(e),X(e,v$1,t),X(e,A$1,r),X(e,j,n);const i=new(m$1("%Temporal.Instant%"))(K(e,v$1));X(e,C$1,i);}function Rr(e,t,r="iso8601"){const n=m$1("%Temporal.ZonedDateTime%"),i=Ne(n.prototype);return Sr(i,e,t,r),i}function kr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.fields%"),r,[t])}const r=nt(rt(e,"fields"),e,[t]),n=[];for(const e of r){if("string"!=typeof e)throw new TypeError("bad return from calendar.fields()");ve.call(n,e);}return n}function jr(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.mergeFields%"),n,[t,r])}const n=nt(rt(e,"mergeFields"),e,[t,r]);if(!it(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function Dr(e,t,r,n,i){let o=i;if("string"==typeof e){const i=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateAdd%"),i,[t,r,n])}void 0===o&&(o=rt(e,"dateAdd"));const a=Ce(o,e,[t,r,n]);if(!Nt(a))throw new TypeError("invalid result");return a}function Nr(e,t,r,n,i){let o=i;if("string"==typeof e){const i=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateUntil%"),i,[t,r,n])}void 0===o&&(o=rt(e,"dateUntil"));const a=Ce(o,e,[t,r,n]);if(!Dt(a))throw new TypeError("invalid result");return a}function Or(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.year%"),r,[t])}let r=nt(rt(e,"year"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar year result must be an integer");if(!st(r))throw new RangeError("calendar year result must be an integer");return r}function Cr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.month%"),r,[t])}let r=nt(rt(e,"month"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar month result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar month result must be a positive integer");return r}function Ar(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthCode%"),r,[t])}let r=nt(rt(e,"monthCode"),e,[t]);if("string"!=typeof r)throw new TypeError("calendar monthCode result must be a string");return r}function Mr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.day%"),r,[t])}const r=nt(rt(e,"day"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar day result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar day result must be a positive integer");return r}function Lr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.era%"),r,[t])}let r=nt(rt(e,"era"),e,[t]);if(void 0===r)return r;if("string"!=typeof r)throw new TypeError("calendar era result must be a string or undefined");return r}function Pr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.eraYear%"),r,[t])}let r=nt(rt(e,"eraYear"),e,[t]);if(void 0===r)return r;if("number"!=typeof r)throw new TypeError("calendar eraYear result must be an integer or undefined");if(!st(r))throw new RangeError("calendar eraYear result must be an integer or undefined");return r}function Br(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dayOfWeek%"),r,[t])}const r=nt(rt(e,"dayOfWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar dayOfWeek result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar dayOfWeek result must be a positive integer");return r}function $r(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dayOfYear%"),r,[t])}const r=nt(rt(e,"dayOfYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar dayOfYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar dayOfYear result must be a positive integer");return r}function Fr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.weekOfYear%"),r,[t])}const r=nt(rt(e,"weekOfYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar weekOfYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar weekOfYear result must be a positive integer");return r}function Ur(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.yearOfWeek%"),r,[t])}const r=nt(rt(e,"yearOfWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar yearOfWeek result must be an integer");if(!st(r))throw new RangeError("calendar yearOfWeek result must be an integer");return r}function qr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInWeek%"),r,[t])}const r=nt(rt(e,"daysInWeek"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInWeek result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInWeek result must be a positive integer");return r}function Yr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInMonth%"),r,[t])}const r=nt(rt(e,"daysInMonth"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInMonth result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInMonth result must be a positive integer");return r}function Wr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.daysInYear%"),r,[t])}const r=nt(rt(e,"daysInYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar daysInYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar daysInYear result must be a positive integer");return r}function zr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthsInYear%"),r,[t])}const r=nt(rt(e,"monthsInYear"),e,[t]);if("number"!=typeof r)throw new TypeError("calendar monthsInYear result must be a positive integer");if(!st(r)||r<1)throw new RangeError("calendar monthsInYear result must be a positive integer");return r}function Gr(e,t){if("string"==typeof e){const r=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.inLeapYear%"),r,[t])}const r=nt(rt(e,"inLeapYear"),e,[t]);if("boolean"!=typeof r)throw new TypeError("calendar inLeapYear result must be a boolean");return r}function Hr(e){if(it(e)){if(Z(e,j))return K(e,j);if(!function(e){return !!jt(e)||"dateAdd"in e&&"dateFromFields"in e&&"dateUntil"in e&&"day"in e&&"dayOfWeek"in e&&"dayOfYear"in e&&"daysInMonth"in e&&"daysInWeek"in e&&"daysInYear"in e&&"fields"in e&&"id"in e&&"inLeapYear"in e&&"mergeFields"in e&&"month"in e&&"monthCode"in e&&"monthDayFromFields"in e&&"monthsInYear"in e&&"weekOfYear"in e&&"year"in e&&"yearMonthFromFields"in e&&"yearOfWeek"in e}(e))throw new TypeError("expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol");return e}const t=lt$1(e);if(io(t))return oo(t);let r;try{({calendar:r}=Ft(t));}catch{try{({calendar:r}=Ut(t));}catch{({calendar:r}=qt(t));}}if(r||(r="iso8601"),!io(r))throw new RangeError(`invalid calendar identifier ${r}`);return oo(r)}function Jr(e){if(Z(e,j))return K(e,j);const{calendar:t}=e;return void 0===t?"iso8601":Hr(t)}function Vr(e){if("string"==typeof e)return e;const t=e.id;if("string"!=typeof t)throw new TypeError("calendar.id should be a string");return t}function Qr(e){return it(e)?e:new(m$1("%Temporal.Calendar%"))(e)}function Zr(e,t){return e===t||Vr(e)===Vr(t)}function Kr(e,t,r){if(e===t)return;const n=Vr(e),i=Vr(t);if(n!==i)throw new RangeError(`cannot ${r} of ${n} and ${i} calendars`)}function Xr(e,t){if(e===t)return t;const r=Vr(e),n=Vr(t);if(r===n||"iso8601"===r)return t;if("iso8601"===n)return e;throw new RangeError("irreconcilable calendars")}function en(e,t,r,n){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.dateFromFields%"),n,[t,r])}const i=nt(rt(e,"dateFromFields"),e,[t,r]);if(!Nt(i))throw new TypeError("invalid result");return i}function tn(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.yearMonthFromFields%"),n,[t,r])}let n=nt(rt(e,"yearMonthFromFields"),e,[t,r]);if(!At(n))throw new TypeError("invalid result");return n}function rn(e,t,r){if("string"==typeof e){const n=new(m$1("%Temporal.Calendar%"))(e);return nt(m$1("%Temporal.Calendar.prototype.monthDayFromFields%"),n,[t,r])}let n=nt(rt(e,"monthDayFromFields"),e,[t,r]);if(!Mt(n))throw new TypeError("invalid result");return n}function nn(e){if(it(e)){if(Lt(e))return K(e,A$1);if(!function(e){return !!kt(e)||"getOffsetNanosecondsFor"in e&&"getPossibleInstantsFor"in e&&"id"in e}(e))throw new TypeError("expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol");return e}return function(e){const{ianaName:t,offset:r,z:n}=function(e){if(new RegExp(`^${te.source}$`,"i").test(e))return {ianaName:e};try{const t=Ft(e);if(t.z||t.offset||t.ianaName)return t}catch{}throw new RangeError(`Invalid time zone: ${e}`)}(e);return t?kn(t):n?"UTC":Dn(Rn(r))}(lt$1(e))}function on(e){if("string"==typeof e)return e;const t=e.id;if("string"!=typeof t)throw new TypeError("timeZone.id should be a string");return t}function an(e){return it(e)?e:new(m$1("%Temporal.TimeZone%"))(e)}function sn(e,t){return e===t||on(e)===on(t)}function ln(e){return wr(K(e,b$2),K(e,_),K(e,E$1),K(e,j))}function un(e){return new(m$1("%Temporal.PlainTime%"))(K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k))}function cn(e,t,r){if("string"==typeof e){const r=new(m$1("%Temporal.TimeZone%"))(e);return nt(m$1("%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%"),r,[t])}const n=nt(rt(e,"getOffsetNanosecondsFor"),e,[t]);if("number"!=typeof n)throw new TypeError("bad return from getOffsetNanosecondsFor");if(!st(n)||Ee(n)>=864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return n}function dn(e,t){return Dn(cn(e,t))}function hn(e,t,r){const n=K(t,v$1),i=cn(e,t);let{year:o,month:a,day:s,hour:l,minute:u,second:c,millisecond:d,microsecond:h,nanosecond:f}=Cn(n);return ({year:o,month:a,day:s,hour:l,minute:u,second:c,millisecond:d,microsecond:h,nanosecond:f}=Hn(o,a,s,l,u,c,d,h,f+i)),_r(o,a,s,l,u,c,d,h,f,r)}function fn(e,t,r){return pn(mn(e,t),e,t,r)}function pn(e,t,r,n){const i=m$1("%Temporal.Instant%"),o=e.length;if(1===o)return e[0];if(o)switch(n){case"compatible":case"earlier":return e[0];case"later":return e[o-1];case"reject":throw new RangeError("multiple instants found")}const a=K(r,b$2),s=K(r,_),l=K(r,E$1),u=K(r,T$1),c=K(r,x$1),h=K(r,I$1),f=K(r,S$1),p=K(r,R),y=K(r,k),g=On(a,s,l,u,c,h,f,p,y);if(null===g)throw new RangeError("DateTime outside of supported range");const v=new i(d$1.subtract(g,ze)),w=new i(d$1.add(g,ze)),D=cn(t,v),N=cn(t,w)-D;switch(n){case"earlier":{const e=K(r,j),n=m$1("%Temporal.PlainDateTime%"),i=ki(a,s,l,u,c,h,f,p,y,e,0,0,0,0,0,0,0,0,0,-N,void 0);return mn(t,new n(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond,i.microsecond,i.nanosecond,e))[0]}case"compatible":case"later":{const e=K(r,j),n=m$1("%Temporal.PlainDateTime%"),i=ki(a,s,l,u,c,h,f,p,y,e,0,0,0,0,0,0,0,0,0,N,void 0),o=mn(t,new n(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond,i.microsecond,i.nanosecond,e));return o[o.length-1]}case"reject":throw new RangeError("no such instant found")}}function mn(e,t,r){if("string"==typeof e){const r=new(m$1("%Temporal.TimeZone%"))(e);return nt(m$1("%Temporal.TimeZone.prototype.getPossibleInstantsFor%"),r,[t])}const n=nt(rt(e,"getPossibleInstantsFor"),e,[t]),i=[];for(const e of n){if(!Rt(e))throw new TypeError("bad return from getPossibleInstantsFor");ve.call(i,e);}return i}function yn(e){let t;return t=e<0||e>9999?(e<0?"-":"+")+`000000${Ee(e)}`.slice(-6):`0000${e}`.slice(-4),t}function gn(e){return `00${e}`.slice(-2)}function vn(e,t,r,n,i){if("minute"===i)return "";const o=`:${gn(e)}`;let a,s=1e6*t+1e3*r+n;if("auto"===i){if(0===s)return o;for(a=`${s}`.padStart(9,"0");"0"===a[a.length-1];)a=a.slice(0,-1);}else {if(0===i)return o;a=`${s}`.padStart(9,"0").slice(0,i);}return `${o}.${a}`}function wn(e,t,r){let n=t;void 0===n&&(n="UTC");const i=hn(n,e,"iso8601"),o=yn(K(i,b$2)),a=gn(K(i,_)),s=gn(K(i,E$1)),l=gn(K(i,T$1)),u=gn(K(i,x$1)),c=vn(K(i,I$1),K(i,S$1),K(i,R),K(i,k),r);let d="Z";return void 0!==t&&(d=Nn(cn(n,e))),`${o}-${a}-${s}T${l}:${u}${c}${d}`}function bn(e,t="auto",r){function n(e){return e<=De?e.toString(10):d$1.BigInt(e).toString(10)}const i=K(e,M$1),o=K(e,L),a=K(e,P),s=K(e,B$1),l=K(e,$),u=K(e,F);let c=K(e,U),h=K(e,q),f=K(e,Y),p=K(e,W$1);const m=Wn(i,o,a,s,l,u,c,h,f,p);if(r){const{unit:e,increment:t,roundingMode:n}=r;({seconds:c,milliseconds:h,microseconds:f,nanoseconds:p}=Wi(0,0,0,0,0,0,c,h,f,p,t,e,n));}const y=[];i&&y.push(`${n(Ee(i))}Y`),o&&y.push(`${n(Ee(o))}M`),a&&y.push(`${n(Ee(a))}W`),s&&y.push(`${n(Ee(s))}D`);const g=[];l&&g.push(`${n(Ee(l))}H`),u&&g.push(`${n(Ee(u))}M`);const v=[];let w,b,_,E,T=Vn(0,0,0,c,h,f,p,0);(({quotient:T,remainder:w}=ht(T,$e))),({quotient:T,remainder:b}=ht(T,$e)),({quotient:E,remainder:_}=ht(T,$e));const x=1e6*Ee(d$1.toNumber(_))+1e3*Ee(d$1.toNumber(b))+Ee(d$1.toNumber(w));let I;if("auto"===t){if(0!==x)for(I=`${x}`.padStart(9,"0");"0"===I[I.length-1];)I=I.slice(0,-1);}else 0!==t&&(I=`${x}`.padStart(9,"0").slice(0,t));return I&&v.unshift(".",I),d$1.equal(E,Me)&&!v.length&&"auto"===t||v.unshift(mt(E).toString()),v.length&&g.push(`${v.join("")}S`),g.length&&g.unshift("T"),y.length||g.length?`${m<0?"-":""}P${y.join("")}${g.join("")}`:"PT0S"}function _n(e,t="auto"){return `${yn(K(e,b$2))}-${gn(K(e,_))}-${gn(K(e,E$1))}${Bt(K(e,j),t)}`}function En(e,t,r="auto",n){let i=K(e,b$2),o=K(e,_),a=K(e,E$1),s=K(e,T$1),l=K(e,x$1),u=K(e,I$1),c=K(e,S$1),d=K(e,R),h=K(e,k);if(n){const{unit:e,increment:t,roundingMode:r}=n;({year:i,month:o,day:a,hour:s,minute:l,second:u,millisecond:c,microsecond:d,nanosecond:h}=Bi(i,o,a,s,l,u,c,d,h,t,e,r));}return `${yn(i)}-${gn(o)}-${gn(a)}T${gn(s)}:${gn(l)}${vn(u,c,d,h,t)}${Bt(K(e,j),r)}`}function Tn(e,t="auto"){let r=`${gn(K(e,_))}-${gn(K(e,E$1))}`;const n=Vr(K(e,j));"always"!==t&&"critical"!==t&&"iso8601"===n||(r=`${yn(K(e,b$2))}-${r}`);const i=$t(n,t);return i&&(r+=i),r}function xn(e,t="auto"){let r=`${yn(K(e,b$2))}-${gn(K(e,_))}`;const n=Vr(K(e,j));"always"!==t&&"critical"!==t&&"iso8601"===n||(r+=`-${gn(K(e,E$1))}`);const i=$t(n,t);return i&&(r+=i),r}function In(e,t,r="auto",n="auto",i="auto",o){let a=K(e,C$1);if(o){const{unit:t,increment:r,roundingMode:n}=o,i=Pi(K(e,v$1),r,t,n);a=new(m$1("%Temporal.Instant%"))(i);}const s=K(e,A$1),l=hn(s,a,"iso8601");let u=`${yn(K(l,b$2))}-${gn(K(l,_))}-${gn(K(l,E$1))}T${gn(K(l,T$1))}:${gn(K(l,x$1))}${vn(K(l,I$1),K(l,S$1),K(l,R),K(l,k),t)}`;return "never"!==i&&(u+=Nn(cn(s,a))),"never"!==n&&(u+=`[${"critical"===n?"!":""}${on(s)}]`),u+=Bt(K(e,j),r),u}function Sn(e){return ao.test(je(e))}function Rn(e){const t=ao.exec(je(e));if(!t)throw new RangeError(`invalid time zone offset: ${e}`);return ("-"===t[1]||"−"===t[1]?-1:1)*(1e9*(60*(60*+t[2]+ +(t[3]||0))+ +(t[4]||0))+ +((t[5]||0)+"000000000").slice(0,9))}function kn(e){return Sn(e)?Dn(Rn(e)):xt(je(e)).resolvedOptions().timeZone}function jn(e,t){const{year:r,month:n,day:i,hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=An(e,t),h=r%400,f=(r-h)/400,p=d$1.multiply(d$1.BigInt(146097),ze),m=On(h,n,i,o,a,s,l,u,c),y=d$1.add(m,d$1.multiply(p,d$1.BigInt(f)));return d$1.toNumber(d$1.subtract(y,t))}function Dn(e){const t=e<0?"-":"+",r=Ee(e),n=r%1e9,i=Te(r/1e9)%60,o=Te(r/6e10)%60,a=gn(Te(r/36e11)),s=gn(o),l=gn(i);let u="";if(n){let e=`${n}`.padStart(9,"0");for(;"0"===e[e.length-1];)e=e.slice(0,-1);u=`:${l}.${e}`;}else i&&(u=`:${l}`);return `${t}${a}:${s}${u}`}function Nn(e){let t=d$1.toNumber(Li(d$1.BigInt(e),We,"halfExpand"));const r=t<0?"-":"+";t=Ee(t);const n=t/6e10%60;return `${r}${gn(Te(t/36e11))}:${gn(n)}`}function On(e,t,r,n,i,o,a,s,l){const u=new Date;u.setUTCHours(n,i,o,a),u.setUTCFullYear(e,t-1,r);const c=u.getTime();if(Se(c))return null;let h=d$1.multiply(d$1.BigInt(c),Fe);return h=d$1.add(h,d$1.multiply(d$1.BigInt(s),$e)),h=d$1.add(h,d$1.BigInt(l)),d$1.lessThan(h,Ge)||d$1.greaterThan(h,He)?null:h}function Cn(e){const{quotient:t,remainder:r}=ht(e,Fe);let n=d$1.toNumber(t),i=d$1.toNumber(r);i<0&&(i+=1e6,n-=1);const o=Te(i/1e3)%1e3,a=i%1e3,s=new Date(n);return {epochMilliseconds:n,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),millisecond:s.getUTCMilliseconds(),microsecond:o,nanosecond:a}}function An(e,t){const{epochMilliseconds:r,millisecond:n,microsecond:i,nanosecond:o}=Cn(t),{year:a,month:s,day:l,hour:u,minute:c,second:d}=function(e,t){return function(e){const t=e.split(/[^\w]+/);if(7!==t.length)throw new RangeError(`expected 7 parts in "${e}`);const r=+t[0],n=+t[1];let i=+t[2];const o=t[3].toUpperCase();if("B"===o||"BC"===o)i=1-i;else if("A"!==o&&"AD"!==o)throw new RangeError(`Unknown era ${o} in "${e}`);let a=+t[4];24===a&&(a=0);const s=+t[5],l=+t[6];if(!(Re(i)&&Re(r)&&Re(n)&&Re(a)&&Re(s)&&Re(l)))throw new RangeError(`Invalid number in "${e}`);return {year:i,month:r,day:n,hour:a,minute:s,second:l}}(xt(e).format(new Date(t)))}(e,r);return Hn(a,s,l,u,c,d,n,i,o)}function Mn(e,t){return d$1.lessThan(e,t)?t:e}function Ln(){return d$1.add(Zi(),Ze)}function Pn(e,t){if(d$1.lessThan(t,Qe))return Pn(e,Qe);const r=d$1.add(t,Ke),n=Mn(Ln(),r);let i=Mn(Qe,t);const o=jn(e,i);let a=i,s=o;for(;o===s&&d$1.lessThan(d$1.BigInt(i),n);){if(a=d$1.add(i,Xe),d$1.greaterThan(a,He))return null;s=jn(e,a),o===s&&(i=a);}return o===s?null:so((t=>jn(e,t)),i,a,o,s)}function Bn(e,t){const r=Ln(),n=d$1.greaterThan(t,r),i=n?d$1.subtract(t,Ke):Qe;if("Africa/Casablanca"===e||"Africa/El_Aaiun"===e){const r=K(hr("2088-01-01T00Z"),v$1);if(d$1.lessThan(r,t))return Bn(e,r)}let o=d$1.subtract(t,Le);if(d$1.lessThan(o,Qe))return null;const a=jn(e,o);let s=o,l=a;for(;a===l&&d$1.greaterThan(o,i);){if(s=d$1.subtract(o,Xe),d$1.lessThan(s,Qe))return null;l=jn(e,s),a===l&&(o=s);}if(a===l){if(n){const t=d$1.subtract(r,ze);return Bn(e,t)}return null}return so((t=>jn(e,t)),s,o,l,a)}function $n(e){return void 0!==e&&!(e%4!=0||e%100==0&&e%400!=0)}function Fn(e,t){return {standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[$n(e)?"leapyear":"standard"][t-1]}function Un(e,t,r){const n=t+(t<3?10:-2),i=e-(t<3?1:0),o=Te(i/100),a=i-100*o,s=(r+Te(2.6*n-.2)+(a+Te(a/4))+(Te(o/4)-2*o))%7;return s+(s<=0?7:0)}function qn(e,t,r){let n=r;for(let r=t-1;r>0;r--)n+=Fn(e,r);return n}function Yn(e,t,r){const n=qn(e,t,r),i=Un(e,t,r)||7,o=Un(e,1,1),a=Te((n-i+10)/7);return a<1?5===o||6===o&&$n(e-1)?{week:53,year:e-1}:{week:52,year:e-1}:53===a&&($n(e)?366:365)-n<4-i?{week:1,year:e+1}:{week:a,year:e}}function Wn(e,t,r,n,i,o,a,s,l,u){for(const c of [e,t,r,n,i,o,a,s,l,u])if(0!==c)return c<0?-1:1;return 0}function zn(e,t){let r=e,n=t;if(!Re(r)||!Re(n))throw new RangeError("infinity is out of range");return n-=1,r+=Te(n/12),n%=12,n<0&&(n+=12),n+=1,{year:r,month:n}}function Gn(e,t,r){let n=e,i=t,o=r;if(!Re(o))throw new RangeError("infinity is out of range");({year:n,month:i}=zn(n,i));const a=146097;if(Ee(o)>a){const e=Ie(o/a);n+=400*e,o-=e*a;}let s=0,l=i>2?n:n-1;for(;s=$n(l)?366:365,o<-s;)n-=1,l-=1,o+=s;for(l+=1;s=$n(l)?366:365,o>s;)n+=1,l+=1,o-=s;for(;o<1;)(({year:n,month:i}=zn(n,i-1))),o+=Fn(n,i);for(;o>Fn(n,i);)o-=Fn(n,i),({year:n,month:i}=zn(n,i+1));return {year:n,month:i,day:o}}function Hn(e,t,r,n,i,o,a,s,l){const{deltaDays:u,hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:m}=Jn(n,i,o,a,s,l),{year:y,month:g,day:v}=Gn(e,t,r+u);return {year:y,month:g,day:v,hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:m}}function Jn(e,t,r,n,i,o){let a,s=d$1.BigInt(e),l=d$1.BigInt(t),u=d$1.BigInt(r),c=d$1.BigInt(n),h=d$1.BigInt(i),f=d$1.BigInt(o);return ({quotient:a,remainder:f}=Gi(f,$e)),h=d$1.add(h,a),({quotient:a,remainder:h}=Gi(h,$e)),c=d$1.add(c,a),({quotient:a,remainder:c}=Gi(c,$e)),u=d$1.add(u,a),({quotient:a,remainder:u}=Gi(u,Pe)),l=d$1.add(l,a),({quotient:a,remainder:l}=Gi(l,Pe)),s=d$1.add(s,a),({quotient:a,remainder:s}=Gi(s,Be)),{deltaDays:d$1.toNumber(a),hour:d$1.toNumber(s),minute:d$1.toNumber(l),second:d$1.toNumber(u),millisecond:d$1.toNumber(c),microsecond:d$1.toNumber(h),nanosecond:d$1.toNumber(f)}}function Vn(e,t,r,n,i,o,a,s){const l=d$1.BigInt(e);let u=d$1.BigInt(a);0!==e&&(u=d$1.subtract(d$1.BigInt(a),d$1.BigInt(s)));const c=d$1.add(d$1.BigInt(t),d$1.multiply(l,d$1.BigInt(24))),h=d$1.add(d$1.BigInt(r),d$1.multiply(c,Pe)),f=d$1.add(d$1.BigInt(n),d$1.multiply(h,Pe)),p=d$1.add(d$1.BigInt(i),d$1.multiply(f,$e)),m=d$1.add(d$1.BigInt(o),d$1.multiply(p,$e));return d$1.add(d$1.BigInt(u),d$1.multiply(m,$e))}function Qn(e,t){const r=m$1("%Temporal.Instant%"),n=xe(d$1.toNumber(e));let i=d$1.BigInt(e),o=864e11;if(0===n)return {days:0,nanoseconds:Me,dayLengthNs:o};if(!Lt(t)){let e;return ({quotient:e,remainder:i}=ht(i,d$1.BigInt(o))),{days:d$1.toNumber(e),nanoseconds:i,dayLengthNs:o}}const a=K(t,v$1),s=K(t,C$1),l=d$1.add(a,i),u=new r(l),c=K(t,A$1),h=K(t,j),f=hn(c,s,h),p=hn(c,u,h);let{days:y}=mi(K(f,b$2),K(f,_),K(f,E$1),K(f,T$1),K(f,x$1),K(f,I$1),K(f,S$1),K(f,R),K(f,k),K(p,b$2),K(p,_),K(p,E$1),K(p,T$1),K(p,x$1),K(p,I$1),K(p,S$1),K(p,R),K(p,k),h,"day",Ne(null)),g=ji(s,c,h,0,0,0,y,0,0,0,0,0,0),w=d$1.BigInt(y);if(1===n)for(;d$1.greaterThan(w,Me)&&d$1.greaterThan(g,l);)w=d$1.subtract(w,Le),g=ji(s,c,h,0,0,0,d$1.toNumber(w),0,0,0,0,0,0);i=d$1.subtract(l,g);let D=!1,N=new r(g);do{const e=ji(N,c,h,0,0,0,n,0,0,0,0,0,0),t=K(N,v$1);o=d$1.toNumber(d$1.subtract(e,t)),D=d$1.greaterThanOrEqual(d$1.multiply(d$1.subtract(i,d$1.BigInt(o)),d$1.BigInt(n)),Me),D&&(i=d$1.subtract(i,d$1.BigInt(o)),N=new r(e),w=d$1.add(w,d$1.BigInt(n)));}while(D);if(!tt(w)&&pt(w)!==n)throw new RangeError("Time zone or calendar converted nanoseconds into a number of days with the opposite sign");if(!tt(i)&&pt(i)!==n){if(ft(i)&&1===n)throw new Error("assert not reached");throw new RangeError("Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign")}if(d$1.greaterThanOrEqual(mt(i),mt(d$1.BigInt(o))))throw new Error("assert not reached");return {days:d$1.toNumber(w),nanoseconds:i,dayLengthNs:Ee(o)}}function Zn(e,t,r,n,i,o,a,s,l){let u=Kn(e,t,r,n,i,o,a,s,l);if("positive overflow"===u||"negative overflow"===u)throw new RangeError("Duration out of range");return u}function Kn(e,t,r,n,i,o,a,s,l){let u,c,h,f,p,m,y=e;if(Lt(l)){const e=ji(K(l,C$1),K(l,A$1),K(l,j),0,0,0,y,t,r,n,i,o,a),s=K(l,v$1);u=d$1.subtract(e,s);}else u=Vn(y,t,r,n,i,o,a,0);"year"===s||"month"===s||"week"===s||"day"===s?({days:y,nanoseconds:u}=Qn(u,l)):y=0;const g=d$1.lessThan(u,Me)?-1:1;switch(u=mt(u),c=h=f=p=m=Me,s){case"year":case"month":case"week":case"day":case"hour":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e)),({quotient:p,remainder:f}=ht(f,Pe)),({quotient:m,remainder:p}=ht(p,Pe));break;case"minute":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e)),({quotient:p,remainder:f}=ht(f,Pe));break;case"second":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e)),({quotient:f,remainder:h}=ht(h,$e));break;case"millisecond":(({quotient:c,remainder:u}=ht(u,$e))),({quotient:h,remainder:c}=ht(c,$e));break;case"microsecond":({quotient:c,remainder:u}=ht(u,$e));break;case"nanosecond":break;default:throw new Error("assert not reached")}const w=d$1.toNumber(m)*g,b=d$1.toNumber(p)*g,_=d$1.toNumber(f)*g,E=d$1.toNumber(h)*g,T=d$1.toNumber(c)*g,x=d$1.toNumber(u)*g;for(const e of [y,w,b,_,E,T,x])if(!Re(e))return 1===g?"positive overflow":"negative overflow";return {days:y,hours:w,minutes:b,seconds:_,milliseconds:E,microseconds:T,nanoseconds:x}}function Xn(e,t,r,n,i,o){const a=m$1("%Temporal.Duration%"),s=Wn(e,t,r,n,0,0,0,0,0,0);if(0===s)return {years:e,months:t,weeks:r,days:n};const l=d$1.BigInt(s);let u,c,h=d$1.BigInt(e),f=d$1.BigInt(t),p=d$1.BigInt(r),y=d$1.BigInt(n);o&&(c=lr(o),u=K(c,j));const g=new a(s),v=new a(0,s),w=new a(0,0,s);switch(i){case"year":break;case"month":{if(!u)throw new RangeError("a starting point is required for months balancing");let e,t;for("string"!=typeof u&&(e=rt(u,"dateAdd"),t=rt(u,"dateUntil"));!tt(h);){const r=Dr(u,c,g,void 0,e),n=Ne(null);n.largestUnit="month";const i=Nr(u,c,r,n,t),o=d$1.BigInt(K(i,L));c=r,f=d$1.add(f,o),h=d$1.subtract(h,l);}}break;case"week":{if(!u)throw new RangeError("a starting point is required for weeks balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;for(;!tt(h);){let t;(({relativeTo:c,days:t}=Ui(u,c,g,e))),y=d$1.add(y,d$1.BigInt(t)),h=d$1.subtract(h,l);}for(;!tt(f);){let t;(({relativeTo:c,days:t}=Ui(u,c,v,e))),y=d$1.add(y,d$1.BigInt(t)),f=d$1.subtract(f,l);}break}default:{if(tt(h)&&tt(f)&&tt(p))break;if(!u)throw new RangeError("a starting point is required for balancing calendar units");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;for(;!tt(h);){let t;(({relativeTo:c,days:t}=Ui(u,c,g,e))),y=d$1.add(y,d$1.BigInt(t)),h=d$1.subtract(h,l);}for(;!tt(f);){let t;(({relativeTo:c,days:t}=Ui(u,c,v,e))),y=d$1.add(y,d$1.BigInt(t)),f=d$1.subtract(f,l);}for(;!tt(p);){let t;(({relativeTo:c,days:t}=Ui(u,c,w,e))),y=d$1.add(y,d$1.BigInt(t)),p=d$1.subtract(p,l);}break}}return {years:d$1.toNumber(h),months:d$1.toNumber(f),weeks:d$1.toNumber(p),days:d$1.toNumber(y)}}function ei(e,t,r,n,i){if(Lt(e)){const o=K(e,C$1),a=K(e,A$1),s=K(e,j),l=cn(a,o),u=ji(o,a,s,t,r,n,i,0,0,0,0,0,0);return cn(a,new(m$1("%Temporal.Instant%"))(u))-l}return 0}function ti(e){return new(m$1("%Temporal.Duration%"))(-K(e,M$1),-K(e,L),-K(e,P),-K(e,B$1),-K(e,$),-K(e,F),-K(e,U),-K(e,q),-K(e,Y),-K(e,W$1))}function ri(e,t,r){return be(r,_e(t,e))}function ni(e,t,r){const n=ri(t,1,12);return {year:e,month:n,day:ri(r,1,Fn(e,n))}}function ii(e,t,r){if(e<t||e>r)throw new RangeError(`value out of range: ${t} <= ${e} <= ${r}`)}function oi(e,t,r){ii(t,1,12),ii(r,1,Fn(e,t));}function ai(e,t,r){ui(e,t,r,12,0,0,0,0,0);}function si(e,t,r,n,i,o){ii(e,0,23),ii(t,0,59),ii(r,0,59),ii(n,0,999),ii(i,0,999),ii(o,0,999);}function li(e,t,r,n,i,o,a,s,l){oi(e,t,r),si(n,i,o,a,s,l);}function ui(e,t,r,n,i,o,a,s,l){if(ii(e,Je,Ve),e===Je&&null==On(e,t,r+1,n,i,o,a,s,l-1)||e===Ve&&null==On(e,t,r-1,n,i,o,a,s,l+1))throw new RangeError("DateTime outside of supported range")}function ci(e){if(d$1.lessThan(e,Ge)||d$1.greaterThan(e,He))throw new RangeError("Instant outside of supported range")}function di(e,t,r,n,i,o,a,s,l,u){const c=Wn(e,t,r,n,i,o,a,s,l,u);for(const d of [e,t,r,n,i,o,a,s,l,u]){if(!Re(d))throw new RangeError("infinite values not allowed as duration fields");const e=xe(d);if(0!==e&&e!==c)throw new RangeError("mixed-sign values not allowed as duration fields")}}function hi(e,t,r,n,i,o,a){switch(a){case"year":case"month":{const s=-zi(e,t,r,n,i,o);if(0===s)return {years:0,months:0,weeks:0,days:0};const l={year:e,month:t,day:r},u={year:n,month:i,day:o};let c=u.year-l.year,d=xi(e,t,r,c,0,0,0,"constrain"),h=-zi(d.year,d.month,d.day,n,i,o);if(0===h)return "year"===a?{years:c,months:0,weeks:0,days:0}:{years:0,months:12*c,weeks:0,days:0};let f=u.month-l.month;if(h!==s&&(c-=s,f+=12*s),d=xi(e,t,r,c,f,0,0,"constrain"),h=-zi(d.year,d.month,d.day,n,i,o),0===h)return "year"===a?{years:c,months:f,weeks:0,days:0}:{years:0,months:f+12*c,weeks:0,days:0};h!==s&&(f-=s,f===-s&&(c-=s,f=11*s),d=xi(e,t,r,c,f,0,0,"constrain"));let p=0;return p=d.month===u.month?u.day-d.day:s<0?-d.day-(Fn(u.year,u.month)-u.day):u.day+(Fn(d.year,d.month)-d.day),"month"===a&&(f+=12*c,c=0),{years:c,months:f,weeks:0,days:p}}case"week":case"day":{let s,l,u;zi(e,t,r,n,i,o)<0?(l={year:e,month:t,day:r},s={year:n,month:i,day:o},u=1):(l={year:n,month:i,day:o},s={year:e,month:t,day:r},u=-1);let c=qn(s.year,s.month,s.day)-qn(l.year,l.month,l.day);for(let e=l.year;e<s.year;++e)c+=$n(e)?366:365;let d=0;return "week"===a&&(d=Te(c/7),c%=7),d*=u,c*=u,{years:0,months:0,weeks:d,days:c}}default:throw new Error("assert not reached")}}function fi(e,t,r,n,i,o,a,s,l,u,c,d){let h=a-e,f=s-t,p=l-r,m=u-n,y=c-i,g=d-o;const v=Wn(0,0,0,0,h,f,p,m,y,g);h*=v,f*=v,p*=v,m*=v,y*=v,g*=v;let w=0;if(({deltaDays:w,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}=Jn(h,f,p,m,y,g)),0!=w)throw new Error("assertion failure in DifferenceTime: _bt_.[[Days]] should be 0");return h*=v,f*=v,p*=v,m*=v,y*=v,g*=v,{hours:h,minutes:f,seconds:p,milliseconds:m,microseconds:y,nanoseconds:g}}function pi(e,t,r,n,i,o){const a=d$1.subtract(t,e);let s=0,l=0,u=d$1.toNumber(d$1.remainder(a,$e)),c=d$1.toNumber(d$1.remainder(d$1.divide(a,$e),$e)),h=d$1.toNumber(d$1.remainder(d$1.divide(a,Fe),$e)),f=d$1.toNumber(d$1.divide(a,Ue));return ({hours:s,minutes:l,seconds:f,milliseconds:h,microseconds:c,nanoseconds:u}=Wi(0,0,0,0,0,0,f,h,c,u,r,n,o)),Zn(0,s,l,f,h,c,u,i)}function mi(e,t,r,n,i,o,a,s,l,u,c,d,h,f,p,m,y,g,v,w,b){let _=e,E=t,T=r,{hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=fi(n,i,o,a,s,l,h,f,p,m,y,g);const D=Wn(0,0,0,0,x,I,S,R,k,j);zi(u,c,d,_,E,T)===-D&&(({year:_,month:E,day:T}=Gn(_,E,T-D)),({hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=Zn(-D,x,I,S,R,k,j,w)));const N=wr(_,E,T,v),O=wr(u,c,d,v),C=or("day",w),A=ro(b);A.largestUnit=C;let{years:M,months:L,weeks:P,days:B}=Nr(v,N,O,A);return ({days:B,hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}=Zn(B,x,I,S,R,k,j,w)),{years:M,months:L,weeks:P,days:B,hours:x,minutes:I,seconds:S,milliseconds:R,microseconds:k,nanoseconds:j}}function yi(e,t,r,n,i,o){const a=d$1.subtract(t,e);if(d$1.equal(a,Me))return {years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};const s=m$1("%Temporal.Instant%"),l=new s(e),u=new s(t),c=hn(r,l,n),h=hn(r,u,n);let{years:f,months:p,weeks:y,days:g}=mi(K(c,b$2),K(c,_),K(c,E$1),K(c,T$1),K(c,x$1),K(c,I$1),K(c,S$1),K(c,R),K(c,k),K(h,b$2),K(h,_),K(h,E$1),K(h,T$1),K(h,x$1),K(h,I$1),K(h,S$1),K(h,R),K(h,k),n,i,o);const v=ji(l,r,n,f,p,y,0,0,0,0,0,0,0);let w=d$1.subtract(t,v);const j=Rr(v,r,n);({nanoseconds:w,days:g}=Qn(w,j));const{hours:D,minutes:N,seconds:O,milliseconds:C,microseconds:A,nanoseconds:M}=Zn(0,0,0,0,0,0,d$1.toNumber(w),"hour");return {years:f,months:p,weeks:y,days:g,hours:D,minutes:N,seconds:O,milliseconds:C,microseconds:A,nanoseconds:M}}function gi(e,t,r,n,i,o){const a=vt.reduce(((e,t)=>{const i=t[0],o=t[1],a=t[2];return "datetime"!==r&&a!==r||n.includes(o)||e.push(o,i),e}),[]);let s=rr(t,"largestUnit",r,"auto");if(n.includes(s))throw new RangeError(`largestUnit must be one of ${a.join(", ")}, not ${s}`);const l=Zt(t);let u=Jt(t,"trunc");"since"===e&&(u=function(e){switch(e){case"ceil":return "floor";case"floor":return "ceil";case"halfCeil":return "halfFloor";case"halfFloor":return "halfCeil";default:return e}}(u));const c=rr(t,"smallestUnit",r,i);if(n.includes(c))throw new RangeError(`smallestUnit must be one of ${a.join(", ")}, not ${c}`);const d=or(o,c);if("auto"===s&&(s=d),or(s,c)!==s)throw new RangeError(`largestUnit ${s} cannot be smaller than smallestUnit ${c}`);const h={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[c];return void 0!==h&&Kt(l,h,!1),{largestUnit:s,roundingIncrement:l,roundingMode:u,smallestUnit:c}}function vi(e,t,r,n){const i="since"===e?-1:1,o=hr(r),a=gi(e,ro(n),"time",[],"nanosecond","second"),s=K(t,v$1),l=K(o,v$1);let{hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=pi(s,l,a.roundingIncrement,a.smallestUnit,a.largestUnit,a.roundingMode);return new(m$1("%Temporal.Duration%"))(0,0,0,0,i*u,i*c,i*d,i*h,i*f,i*p)}function wi(e,t,r,n){const i="since"===e?-1:1,o=lr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"date",[],"day","day");s.largestUnit=l.largestUnit;let{years:u,months:c,weeks:d,days:h}=Nr(a,t,o,s);return "day"===l.smallestUnit&&1===l.roundingIncrement||({years:u,months:c,weeks:d,days:h}=Wi(u,c,d,h,0,0,0,0,0,0,l.roundingIncrement,l.smallestUnit,l.roundingMode,t)),new(m$1("%Temporal.Duration%"))(i*u,i*c,i*d,i*h,0,0,0,0,0,0)}function bi(e,t,r,n){const i="since"===e?-1:1,o=cr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"datetime",[],"nanosecond","day");let{years:u,months:c,weeks:d,days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=mi(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),K(o,b$2),K(o,_),K(o,E$1),K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),a,l.largestUnit,s);const D=ln(t);return ({years:u,months:c,weeks:d,days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=Wi(u,c,d,h,f,p,y,g,v,w,l.roundingIncrement,l.smallestUnit,l.roundingMode,D)),({days:h,hours:f,minutes:p,seconds:y,milliseconds:g,microseconds:v,nanoseconds:w}=Zn(h,f,p,y,g,v,w,l.largestUnit)),new(m$1("%Temporal.Duration%"))(i*u,i*c,i*d,i*h,i*f,i*p,i*y,i*g,i*v,i*w)}function _i(e,t,r,n){const i="since"===e?-1:1,o=pr(r),a=gi(e,ro(n),"time",[],"nanosecond","hour");let{hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=fi(K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k));return ({hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=Wi(0,0,0,0,s,l,u,c,d,h,a.roundingIncrement,a.smallestUnit,a.roundingMode)),({hours:s,minutes:l,seconds:u,milliseconds:c,microseconds:d,nanoseconds:h}=Zn(0,s,l,u,c,d,h,a.largestUnit)),new(m$1("%Temporal.Duration%"))(0,0,0,0,i*s,i*l,i*u,i*c,i*d,i*h)}function Ei(e,t,r,n){const i="since"===e?-1:1,o=mr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between months");const s=ro(n),l=gi(e,s,"date",["week","day"],"month","year");s.largestUnit=l.largestUnit;const u=kr(a,["monthCode","year"]),c=ar(t,u,[]);c.day=1;const d=en(a,c),h=ar(o,u,[]);h.day=1;const f=en(a,h);let{years:p,months:y}=Nr(a,d,f,s);return "month"===l.smallestUnit&&1===l.roundingIncrement||({years:p,months:y}=Wi(p,y,0,0,0,0,0,0,0,0,l.roundingIncrement,l.smallestUnit,l.roundingMode,d)),new(m$1("%Temporal.Duration%"))(i*p,i*y,0,0,0,0,0,0,0,0)}function Ti(e,t,r,n){const i="since"===e?-1:1,o=gr(r),a=K(t,j);Kr(a,K(o,j),"compute difference between dates");const s=ro(n),l=gi(e,s,"datetime",[],"nanosecond","hour");s.largestUnit=l.largestUnit;const u=K(t,v$1),c=K(o,v$1);let d,h,f,p,y,g,w,b,_,E;if("year"!==l.largestUnit&&"month"!==l.largestUnit&&"week"!==l.largestUnit&&"day"!==l.largestUnit)d=0,h=0,f=0,p=0,({hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=pi(u,c,l.roundingIncrement,l.smallestUnit,l.largestUnit,l.roundingMode));else {const e=K(t,A$1);if(!sn(e,K(o,A$1)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");(({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=yi(u,c,e,a,l.largestUnit,s))),({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=Wi(d,h,f,p,y,g,w,b,_,E,l.roundingIncrement,l.smallestUnit,l.roundingMode,t)),({years:d,months:h,weeks:f,days:p,hours:y,minutes:g,seconds:w,milliseconds:b,microseconds:_,nanoseconds:E}=Yi(d,h,f,p,y,g,w,b,_,E,l.roundingIncrement,l.smallestUnit,l.roundingMode,t));}return new(m$1("%Temporal.Duration%"))(i*d,i*h,i*f,i*p,i*y,i*g,i*w,i*b,i*_,i*E)}function xi(e,t,r,n,i,o,a,s){let l=e,u=t,c=r,d=o,h=a;return l+=n,u+=i,({year:l,month:u}=zn(l,u)),({year:l,month:u,day:c}=Yt(l,u,c,s)),h+=7*d,c+=h,({year:l,month:u,day:c}=Gn(l,u,c)),{year:l,month:u,day:c}}function Ii(e,t,r,n,i,o,a,s,l,u,c,d){let h=e,f=t,p=r,m=n,y=i,g=o;h+=a,f+=s,p+=l,m+=u,y+=c,g+=d;let v=0;return ({deltaDays:v,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}=Jn(h,f,p,m,y,g)),{deltaDays:v,hour:h,minute:f,second:p,millisecond:m,microsecond:y,nanosecond:g}}function Si(e,t,r,n,i,o,a,s,l,u,c,h,f,p,y,g,w,b,_,E,T){const x=or(ir(e,t,r,n,i,o,a,s,l,u),ir(c,h,f,p,y,g,w,b,_,E));let I,S,R,k,D,N,O,M,L,P;if(T)if(Nt(T)){const v=m$1("%Temporal.Duration%"),C=K(T,j),A=new v(e,t,r,n,0,0,0,0,0,0),B=new v(c,h,f,p,0,0,0,0,0,0),$="string"!=typeof C?rt(C,"dateAdd"):void 0,F=Dr(C,T,A,void 0,$),U=Dr(C,F,B,void 0,$),q=or("day",x),Y=Ne(null);Y.largestUnit=q,({years:I,months:S,weeks:R,days:k}=Nr(C,T,U,Y)),({days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=Zn(k,d$1.add(d$1.BigInt(i),d$1.BigInt(y)),d$1.add(d$1.BigInt(o),d$1.BigInt(g)),d$1.add(d$1.BigInt(a),d$1.BigInt(w)),d$1.add(d$1.BigInt(s),d$1.BigInt(b)),d$1.add(d$1.BigInt(l),d$1.BigInt(_)),d$1.add(d$1.BigInt(u),d$1.BigInt(E)),x));}else {const d=m$1("%Temporal.Instant%"),B=K(T,A$1),$=K(T,j),F=ji(K(T,C$1),B,$,e,t,r,n,i,o,a,s,l,u),U=ji(new d(F),B,$,c,h,f,p,y,g,w,b,_,E);"year"!==x&&"month"!==x&&"week"!==x&&"day"!==x?(I=0,S=0,R=0,k=0,({hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=pi(K(T,v$1),U,1,"nanosecond",x,"halfExpand"))):({years:I,months:S,weeks:R,days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=yi(K(T,v$1),U,B,$,x,Ne(null)));}else {if("year"===x||"month"===x||"week"===x)throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");I=S=R=0,({days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}=Zn(n+p,d$1.add(d$1.BigInt(i),d$1.BigInt(y)),d$1.add(d$1.BigInt(o),d$1.BigInt(g)),d$1.add(d$1.BigInt(a),d$1.BigInt(w)),d$1.add(d$1.BigInt(s),d$1.BigInt(b)),d$1.add(d$1.BigInt(l),d$1.BigInt(_)),d$1.add(d$1.BigInt(u),d$1.BigInt(E)),x));}return di(I,S,R,k,D,N,O,M,L,P),{years:I,months:S,weeks:R,days:k,hours:D,minutes:N,seconds:O,milliseconds:M,microseconds:L,nanoseconds:P}}function Ri(e,t,r,n,i,o,a){let s=Me;s=d$1.add(s,d$1.BigInt(a)),s=d$1.add(s,d$1.multiply(d$1.BigInt(o),$e)),s=d$1.add(s,d$1.multiply(d$1.BigInt(i),Fe)),s=d$1.add(s,d$1.multiply(d$1.BigInt(n),Ue)),s=d$1.add(s,d$1.multiply(d$1.BigInt(r),d$1.BigInt(6e10))),s=d$1.add(s,d$1.multiply(d$1.BigInt(t),d$1.BigInt(36e11)));const l=d$1.add(e,s);return ci(l),l}function ki(e,t,r,n,i,o,a,s,l,u,c,d,h,f,p,y,g,v,w,T,x){let I=f,{deltaDays:S,hour:R,minute:k,second:j,millisecond:D,microsecond:N,nanosecond:O}=Ii(n,i,o,a,s,l,p,y,g,v,w,T);I+=S;const C=m$1("%Temporal.Duration%"),A=Dr(u,wr(e,t,r,u),new C(c,d,h,I,0,0,0,0,0,0),x);return {year:K(A,b$2),month:K(A,_),day:K(A,E$1),hour:R,minute:k,second:j,millisecond:D,microsecond:N,nanosecond:O}}function ji(e,t,r,n,i,o,a,s,l,u,c,d,h,f){const p=m$1("%Temporal.Duration%");if(0===Wn(n,i,o,a,0,0,0,0,0,0))return Ri(K(e,v$1),s,l,u,c,d,h);const y=hn(t,e,r),g=Dr(r,wr(K(y,b$2),K(y,_),K(y,E$1),r),new p(n,i,o,a,0,0,0,0,0,0),f),w=_r(K(g,b$2),K(g,_),K(g,E$1),K(y,T$1),K(y,x$1),K(y,I$1),K(y,S$1),K(y,R),K(y,k),r);return Ri(K(fn(t,w,"compatible"),v$1),s,l,u,c,d,h)}function Di(e,t,r,n){const i="subtract"===e?-1:1;let{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r);const y=nr(eo(n));return ({years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=Si(K(t,M$1),K(t,L),K(t,P),K(t,B$1),K(t,$),K(t,F),K(t,U),K(t,q),K(t,Y),K(t,W$1),i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,y)),new(m$1("%Temporal.Duration%"))(o,a,s,l,u,c,d,h,f,p)}function Ni(e,t,r){const n="subtract"===e?-1:1,{hours:i,minutes:o,seconds:a,milliseconds:s,microseconds:l,nanoseconds:u}=function(e,t){let r=zt(e);for(const e of t)if(0!==r[e])throw new RangeError(`Duration field ${e} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return r}(r,["years","months","weeks","days"]),c=Ri(K(t,v$1),n*i,n*o,n*a,n*s,n*l,n*u);return new(m$1("%Temporal.Instant%"))(c)}function Oi(e,t,r,n){const i="subtract"===e?-1:1,{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r),m=eo(n),y=K(t,j),{year:g,month:v,day:w,hour:D,minute:N,second:O,millisecond:C,microsecond:A,nanosecond:M}=ki(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),y,i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,m);return _r(g,v,w,D,N,O,C,A,M,y)}function Ci(e,t,r){const n="subtract"===e?-1:1,{hours:i,minutes:o,seconds:a,milliseconds:s,microseconds:l,nanoseconds:u}=zt(r);let{hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:y}=Ii(K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k),n*i,n*o,n*a,n*s,n*l,n*u);return ({hour:c,minute:d,second:h,millisecond:f,microsecond:p,nanosecond:y}=Wt(c,d,h,f,p,y,"reject")),new(m$1("%Temporal.PlainTime%"))(c,d,h,f,p,y)}function Ai(e,t,r,n){let i=zt(r);"subtract"===e&&(i={years:-i.years,months:-i.months,weeks:-i.weeks,days:-i.days,hours:-i.hours,minutes:-i.minutes,seconds:-i.seconds,milliseconds:-i.milliseconds,microseconds:-i.microseconds,nanoseconds:-i.nanoseconds});let{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=i;({days:l}=Zn(l,u,c,d,h,f,p,"day"));const y=eo(n),g=K(t,j),v=kr(g,["monthCode","year"]),w=ar(t,v,[]),b=Ne(null);St(b,w,[]),w.day=1;let _=en(g,w);const E=Wn(o,a,s,l,0,0,0,0,0,0),T=rt(g,"dateAdd"),x=m$1("%Temporal.Duration%");if(E<0){const e=Dr(g,_,new x(0,1,0,0,0,0,0,0,0,0),void 0,T),t=Dr(g,e,new x(0,0,0,-1,0,0,0,0,0,0),void 0,T);b.day=Mr(g,t),_=en(g,b);}const I=new x(o,a,s,l,0,0,0,0,0,0),S=ro(y);return tn(g,ar(Dr(g,_,I,y,T),v,[]),S)}function Mi(e,t,r,n){const i="subtract"===e?-1:1,{years:o,months:a,weeks:s,days:l,hours:u,minutes:c,seconds:d,milliseconds:h,microseconds:f,nanoseconds:p}=zt(r),m=eo(n),y=K(t,A$1),g=K(t,j);return Rr(ji(K(t,C$1),y,g,i*o,i*a,i*s,i*l,i*u,i*c,i*d,i*h,i*f,i*p,m),y,g)}function Li(e,t,r){if(d$1.equal(t,Le))return e;let{quotient:n,remainder:i}=ht(e,t);if(d$1.equal(i,Me))return e;const o=d$1.lessThan(i,Me)?-1:1,a=mt(d$1.multiply(i,d$1.BigInt(2))),s=d$1.equal(a,t),l=d$1.greaterThan(a,t);switch(r){case"ceil":o>0&&(n=d$1.add(n,d$1.BigInt(o)));break;case"floor":o<0&&(n=d$1.add(n,d$1.BigInt(o)));break;case"expand":n=d$1.add(n,d$1.BigInt(o));break;case"trunc":break;case"halfCeil":(l||s&&o>0)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfFloor":(l||s&&o<0)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfExpand":(l||s)&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfTrunc":l&&(n=d$1.add(n,d$1.BigInt(o)));break;case"halfEven":(l||s&&1===d$1.toNumber(d$1.remainder(mt(n),d$1.BigInt(2))))&&(n=d$1.add(n,d$1.BigInt(o)));}return d$1.multiply(n,t)}function Pi(e,t,r,n){let{remainder:i}=Gi(e,ze);const o=d$1.subtract(e,i),a=Li(i,d$1.BigInt(lo[r]*t),n);return d$1.add(o,a)}function Bi(e,t,r,n,i,o,a,s,l,u,c,d,h=864e11){const{deltaDays:f,hour:p,minute:m,second:y,millisecond:g,microsecond:v,nanosecond:w}=$i(n,i,o,a,s,l,u,c,d,h),{year:b,month:_,day:E}=Gn(e,t,r+f);return {year:b,month:_,day:E,hour:p,minute:m,second:y,millisecond:g,microsecond:v,nanosecond:w}}function $i(e,t,r,n,i,o,a,s,l,u=864e11){let c=Me;switch(s){case"day":case"hour":c=d$1.BigInt(e);case"minute":c=d$1.add(d$1.multiply(c,Pe),d$1.BigInt(t));case"second":c=d$1.add(d$1.multiply(c,Pe),d$1.BigInt(r));case"millisecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(n));case"microsecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(i));case"nanosecond":c=d$1.add(d$1.multiply(c,$e),d$1.BigInt(o));}const h="day"===s?u:lo[s],f=Li(c,d$1.BigInt(h*a),l),p=d$1.toNumber(d$1.divide(f,d$1.BigInt(h)));switch(s){case"day":return {deltaDays:p,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return Jn(p,0,0,0,0,0);case"minute":return Jn(e,p,0,0,0,0);case"second":return Jn(e,t,p,0,0,0);case"millisecond":return Jn(e,t,r,p,0,0);case"microsecond":return Jn(e,t,r,n,p,0);case"nanosecond":return Jn(e,t,r,n,i,p);default:throw new Error(`Invalid unit ${s}`)}}function Fi(e,t){return hi(K(e,b$2),K(e,_),K(e,E$1),K(t,b$2),K(t,_),K(t,E$1),"day").days}function Ui(e,t,r,n){const i=Dr(e,t,r,void 0,n);return {relativeTo:i,days:Fi(t,i)}}function qi(e,t,r,n,i){const o=K(e,A$1),a=K(e,j);return Rr(ji(K(e,C$1),o,a,t,r,n,i,0,0,0,0,0,0),o,a)}function Yi(e,t,r,n,i,o,a,s,l,u,c,h,f,p){let y=e,g=t,v=r,w=n,b=i,_=o,E=a,T=s,x=l,I=u;if(!Lt(p)||"year"===h||"month"===h||"week"===h||"day"===h||"nanosecond"===h&&1===c)return {years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I};let S=Vn(0,b,_,E,T,x,I,0);const R=xe(d$1.toNumber(S)),k=K(p,A$1),D=K(p,j),N=ji(K(p,C$1),k,D,y,g,v,w,0,0,0,0,0,0),O=ji(new(m$1("%Temporal.Instant%"))(N),k,D,0,0,0,R,0,0,0,0,0,0),M=d$1.subtract(O,N);return d$1.greaterThanOrEqual(d$1.multiply(d$1.subtract(S,M),d$1.BigInt(R)),Me)&&(({years:y,months:g,weeks:v,days:w}=Si(y,g,v,w,0,0,0,0,0,0,0,0,0,R,0,0,0,0,0,0,p)),S=Pi(d$1.subtract(S,M),c,h,f),({hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I}=Zn(0,0,0,0,0,0,d$1.toNumber(S),"hour"))),{years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:I}}function Wi(e,t,r,n,i,o,a,s,l,u,c,h,f,p){let y=e,g=t,v=r,w=n,b=i,_=o,E=a,T=s,x=l,I=d$1.BigInt(u);const S=m$1("%Temporal.Duration%");let R,k,D,N,O=p;if(O){if(Lt(O))k=O,O=lr(O);else if(!Nt(O))throw new TypeError("starting point must be PlainDate or ZonedDateTime");R=K(O,j);}if("year"===h||"month"===h||"week"===h||"day"===h){let e,t,r;I=Vn(0,b,_,E,T,x,u,0),k&&(e=qi(k,y,g,v,w)),({days:t,nanoseconds:I,dayLengthNs:r}=Qn(I,e)),D=d$1.BigInt(r),w+=t,b=_=E=T=x=0;}switch(h){case"year":{if(!R)throw new RangeError("A starting point is required for years rounding");const e=new S(y),t="string"!=typeof R?rt(R,"dateAdd"):void 0,r=Dr(R,O,e,void 0,t),n=Dr(R,O,new S(y,g,v),void 0,t);O=r,w+=Fi(r,n);const i=Dr(R,O,new S(0,0,0,w),void 0,t),o=Ne(null);o.largestUnit="year";const a=Nr(R,O,i,o).years;y+=a;const s=O;O=Dr(R,O,new S(a),void 0,t),w-=Fi(s,O);const l=new S(w<0?-1:1);let{days:u}=Ui(R,O,l,t);u=Ee(u);const h=d$1.multiply(d$1.BigInt(u),D);I=d$1.add(d$1.add(d$1.multiply(h,d$1.BigInt(y)),d$1.multiply(d$1.BigInt(w),D)),I);const p=Li(I,d$1.multiply(h,d$1.BigInt(c)),f);N=Ji(I,h),y=d$1.toNumber(d$1.divide(p,h)),I=Me,g=v=w=0;break}case"month":{if(!R)throw new RangeError("A starting point is required for months rounding");const e=new S(y,g),t="string"!=typeof R?rt(R,"dateAdd"):void 0,r=Dr(R,O,e,void 0,t),n=Dr(R,O,new S(y,g,v),void 0,t);O=r,w+=Fi(r,n);const i=xe(w),o=new S(0,w<0?-1:1);let a;for(({relativeTo:O,days:a}=Ui(R,O,o,t));Ee(w)>=Ee(a);)g+=i,w-=a,({relativeTo:O,days:a}=Ui(R,O,o,t));a=Ee(a);const s=d$1.multiply(d$1.BigInt(a),D);I=d$1.add(d$1.add(d$1.multiply(s,d$1.BigInt(g)),d$1.multiply(d$1.BigInt(w),D)),I);const l=Li(I,d$1.multiply(s,d$1.BigInt(c)),f);N=Ji(I,s),g=d$1.toNumber(d$1.divide(l,s)),I=Me,v=w=0;break}case"week":{if(!R)throw new RangeError("A starting point is required for weeks rounding");const e=xe(w),t=new S(0,0,w<0?-1:1),r="string"!=typeof R?rt(R,"dateAdd"):void 0;let n;for(({relativeTo:O,days:n}=Ui(R,O,t,r));Ee(w)>=Ee(n);)v+=e,w-=n,({relativeTo:O,days:n}=Ui(R,O,t,r));n=Ee(n);const i=d$1.multiply(d$1.BigInt(n),D);I=d$1.add(d$1.add(d$1.multiply(i,d$1.BigInt(v)),d$1.multiply(d$1.BigInt(w),D)),I);const o=Li(I,d$1.multiply(i,d$1.BigInt(c)),f);N=Ji(I,i),v=d$1.toNumber(d$1.divide(o,i)),I=Me,w=0;break}case"day":{const e=D;I=d$1.add(d$1.multiply(e,d$1.BigInt(w)),I);const t=Li(I,d$1.multiply(e,d$1.BigInt(c)),f);N=Ji(I,e),w=d$1.toNumber(d$1.divide(t,e)),I=Me;break}case"hour":{const e=36e11;let t=d$1.multiply(d$1.BigInt(b),d$1.BigInt(36e11));t=d$1.add(t,d$1.multiply(d$1.BigInt(_),d$1.BigInt(6e10))),t=d$1.add(t,d$1.multiply(d$1.BigInt(E),Ue)),t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);b=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,_=E=T=x=0;break}case"minute":{const e=6e10;let t=d$1.multiply(d$1.BigInt(_),d$1.BigInt(6e10));t=d$1.add(t,d$1.multiply(d$1.BigInt(E),Ue)),t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);_=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,E=T=x=0;break}case"second":{const e=1e9;let t=d$1.multiply(d$1.BigInt(E),Ue);t=d$1.add(t,d$1.multiply(d$1.BigInt(T),Fe)),t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);E=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,T=x=0;break}case"millisecond":{const e=1e6;let t=d$1.multiply(d$1.BigInt(T),Fe);t=d$1.add(t,d$1.multiply(d$1.BigInt(x),$e)),t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);T=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me,x=0;break}case"microsecond":{const e=1e3;let t=d$1.multiply(d$1.BigInt(x),$e);t=d$1.add(t,I),N=Ji(t,d$1.BigInt(e));const r=Li(t,d$1.BigInt(e*c),f);x=d$1.toNumber(d$1.divide(r,d$1.BigInt(e))),I=Me;break}case"nanosecond":N=d$1.toNumber(I),I=Li(d$1.BigInt(I),d$1.BigInt(c),f);}return {years:y,months:g,weeks:v,days:w,hours:b,minutes:_,seconds:E,milliseconds:T,microseconds:x,nanoseconds:d$1.toNumber(I),total:N}}function zi(e,t,r,n,i,o){for(const[a,s]of [[e,n],[t,i],[r,o]])if(a!==s)return Xi(a-s);return 0}function Gi(e,t){let{quotient:r,remainder:n}=ht(e,t);return d$1.lessThan(n,Me)&&(r=d$1.subtract(r,Le),n=d$1.add(n,t)),{quotient:r,remainder:n}}function Hi(e,t){const{quotient:r,remainder:n}=ht(e,t);return tt(n)||!ft(e)==!ft(t)?r:d$1.subtract(r,Le)}function Ji(e,t){const{quotient:r,remainder:n}=ht(e,t);return d$1.toNumber(r)+d$1.toNumber(n)/d$1.toNumber(t)}function Vi(e){const t=Qi(e);return void 0!==globalThis.BigInt?globalThis.BigInt(t.toString(10)):t}function Qi(e){let t=e;if("object"==typeof e){const r=e[Symbol.toPrimitive];r&&"function"==typeof r&&(t=Ce(r,e,["number"]));}if("number"==typeof t)throw new TypeError("cannot convert number to bigint");return "bigint"==typeof t?d$1.BigInt(t.toString(10)):d$1.BigInt(t)}const Zi=(()=>{let e=d$1.BigInt(Date.now()%1e6);return ()=>{const t=d$1.BigInt(Date.now()),r=d$1.add(d$1.multiply(t,Fe),e);return e=d$1.remainder(t,Fe),d$1.greaterThan(r,He)?He:d$1.lessThan(r,Ge)?Ge:r}})();function Ki(){return (new we).resolvedOptions().timeZone}function Xi(e){return e<0?-1:e>0?1:e}function eo(e){if(void 0===e)return Ne(null);if(it(e)&&null!==e)return e;throw new TypeError("Options parameter must be an object, not "+(null===e?"null":typeof e))}function to(e,t){const r=Ne(null);return r[e]=t,r}function ro(e){const t=Ne(null);return St(t,eo(e),[]),t}function no(e,t,r,n){let i=e[t];if(void 0!==i){if(i=lt$1(i),!r.includes(i))throw new RangeError(`${t} must be one of ${r.join(", ")}, not ${i}`);return i}return n}function io(e){return et.includes(oo(e))}function oo(e){return e.replace(/[A-Z]/g,(e=>{const t=e.charCodeAt(0);return String.fromCharCode(t+32)}))}const ao=new RegExp(`^${se.source}$`);function so(e,t,r,n=e(t),i=e(r)){let o=d$1.BigInt(t),a=d$1.BigInt(r),s=n,l=i;for(;d$1.greaterThan(d$1.subtract(a,o),Le);){const t=d$1.divide(d$1.add(o,a),d$1.BigInt(2)),r=e(t);if(r===s)o=t,s=r;else {if(r!==l)throw new Error(`invalid state in bisection ${s} - ${r} - ${l}`);a=t,l=r;}}return a}const lo={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},uo=Symbol("date"),co=Symbol("ym"),ho=Symbol("md"),fo=Symbol("time"),po=Symbol("datetime"),mo=Symbol("instant"),yo=Symbol("original"),go=Symbol("timezone"),vo=Symbol("calendar-id"),wo=Symbol("locale"),bo=Symbol("options"),_o=e=>({value:e,enumerable:!0,writable:!1,configurable:!0}),Eo=globalThis.Intl.DateTimeFormat,To=Object.assign,xo=Object.prototype.hasOwnProperty,Io=Reflect.apply;function So(e,t){let r=e[t];return "function"==typeof r&&(r=new Eo(e[wo],r(e[bo])),e[t]=r),r}function Ro(e,t={}){if(!(this instanceof Ro))return new Ro(e,t);const r=void 0!==t,n=r?To({},t):{},i=new Eo(e,n),o=i.resolvedOptions();if(r){const e=To({},o);for(const t in e)Io(xo,n,[t])||delete e[t];this[bo]=e;}else this[bo]=n;this[wo]=o.locale,this[yo]=i,this[go]=o.timeZone,this[vo]=o.calendar,this[uo]=Ao,this[co]=Oo,this[ho]=Co,this[fo]=No,this[po]=Mo,this[mo]=Lo;}Object.defineProperty(Ro,"name",{writable:!0,value:"DateTimeFormat"}),Ro.supportedLocalesOf=function(e,t){return Eo.supportedLocalesOf(e,t)};const ko={resolvedOptions:_o((function(){return this[yo].resolvedOptions()})),format:_o((function(e,...t){let{instant:r,formatter:n}=Uo(e,this);return r&&n?n.format(r.epochMilliseconds):this[yo].format(e,...t)})),formatRange:_o((function(e,t){if($o(e)||$o(t)){if(!Fo(e,t))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");const{instant:r,formatter:n}=Uo(e,this),{instant:i,formatter:o}=Uo(t,this);if(r&&i&&n&&o&&n===o)return n.formatRange(r.epochMilliseconds,i.epochMilliseconds)}return this[yo].formatRange(e,t)}))};"formatToParts"in Eo.prototype&&(ko.formatToParts=_o((function(e,...t){let{instant:r,formatter:n}=Uo(e,this);return r&&n?n.formatToParts(r.epochMilliseconds):this[yo].formatToParts(e,...t)}))),"formatRangeToParts"in Eo.prototype&&(ko.formatRangeToParts=_o((function(e,t){if($o(e)||$o(t)){if(!Fo(e,t))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");const{instant:r,formatter:n}=Uo(e,this),{instant:i,formatter:o}=Uo(t,this);if(r&&i&&n&&o&&n===o)return n.formatRangeToParts(r.epochMilliseconds,i.epochMilliseconds)}return this[yo].formatRangeToParts(e,t)}))),Ro.prototype=Object.create(Eo.prototype,ko),Object.defineProperty(Ro,"prototype",{writable:!1,enumerable:!1,configurable:!1});const jo=Ro;function Do(e={},t={}){const r=To({},e);for(const e of ["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[e]=e in t?t[e]:r[e],!1!==r[e]&&void 0!==r[e]||delete r[e];return r}function No(e){let t=Do(e,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return Bo(t)||(t=To({},t,{hour:"numeric",minute:"numeric",second:"numeric"})),t}function Oo(e){let t=Do(e,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "year"in t||"month"in t||(t=To(t,{year:"numeric",month:"numeric"})),t}function Co(e){let t=Do(e,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return "month"in t||"day"in t||(t=To({},t,{month:"numeric",day:"numeric"})),t}function Ao(e){let t=Do(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric"})),t}function Mo(e){let t=Do(e,{timeZoneName:!1});return Bo(t)||Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function Lo(e){let t=e;return Bo(t)||Po(t)||(t=To({},t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),t}function Po(e){return "year"in e||"month"in e||"day"in e||"weekday"in e||"dateStyle"in e}function Bo(e){return "hour"in e||"minute"in e||"second"in e||"timeStyle"in e||"dayPeriod"in e}function $o(e){return Nt(e)||Ot(e)||Ct(e)||Lt(e)||At(e)||Mt(e)||Rt(e)}function Fo(e,t){return !(!$o(e)||!$o(t)||Ot(e)&&!Ot(t)||Nt(e)&&!Nt(t)||Ct(e)&&!Ct(t)||Lt(e)&&!Lt(t)||At(e)&&!At(t)||Mt(e)&&!Mt(t)||Rt(e)&&!Rt(t))}function Uo(e,t){const r=m$1("%Temporal.PlainDateTime%");if(Ot(e)){const n=new r(1970,1,1,K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k),t[vo]);return {instant:fn(t[go],n,"compatible"),formatter:So(t,fo)}}if(At(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if(a!==t[vo])throw new RangeError(`cannot format PlainYearMonth with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,a);return {instant:fn(t[go],s,"compatible"),formatter:So(t,co)}}if(Mt(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if(a!==t[vo])throw new RangeError(`cannot format PlainMonthDay with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,a);return {instant:fn(t[go],s,"compatible"),formatter:So(t,ho)}}if(Nt(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=Vr(K(e,j));if("iso8601"!==a&&a!==t[vo])throw new RangeError(`cannot format PlainDate with calendar ${a} in locale with calendar ${t[vo]}`);const s=new r(n,i,o,12,0,0,0,0,0,t[vo]);return {instant:fn(t[go],s,"compatible"),formatter:So(t,uo)}}if(Ct(e)){const n=K(e,b$2),i=K(e,_),o=K(e,E$1),a=K(e,T$1),s=K(e,x$1),l=K(e,I$1),u=K(e,S$1),c=K(e,R),d=K(e,k),h=Vr(K(e,j));if("iso8601"!==h&&h!==t[vo])throw new RangeError(`cannot format PlainDateTime with calendar ${h} in locale with calendar ${t[vo]}`);let f=e;return "iso8601"===h&&(f=new r(n,i,o,a,s,l,u,c,d,t[vo])),{instant:fn(t[go],f,"compatible"),formatter:So(t,po)}}if(Lt(e))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return Rt(e)?{instant:e,formatter:So(t,mo)}:{}}class qo{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");const t=Qi(e);ci(t),Q(this),X(this,v$1,t);}get epochSeconds(){if(!Rt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Ue))}get epochMilliseconds(){if(!Rt(this))throw new TypeError("invalid receiver");const e=d$1.BigInt(K(this,v$1));return d$1.toNumber(Hi(e,Fe))}get epochMicroseconds(){if(!Rt(this))throw new TypeError("invalid receiver");return Vi(Hi(d$1.BigInt(K(this,v$1)),$e))}get epochNanoseconds(){if(!Rt(this))throw new TypeError("invalid receiver");return Vi(d$1.BigInt(K(this,v$1)))}add(e){if(!Rt(this))throw new TypeError("invalid receiver");return Ni("add",this,e)}subtract(e){if(!Rt(this))throw new TypeError("invalid receiver");return Ni("subtract",this,e)}until(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return vi("until",this,e,t)}since(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return vi("since",this,e,t)}round(e){if(!Rt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr);Kt(r,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0);const o=Pi(K(this,v$1),r,i,n);return new qo(o)}equals(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,v$1),n=K(t,v$1);return d$1.equal(d$1.BigInt(r),d$1.BigInt(n))}toString(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i)throw new RangeError('smallestUnit must be a time unit other than "hour"');let o=t.timeZone;void 0!==o&&(o=nn(o));const{precision:a,unit:s,increment:l}=er(i,r),u=Pi(K(this,v$1),l,s,n);return wn(new qo(u),o,a)}toJSON(){if(!Rt(this))throw new TypeError("invalid receiver");return wn(this,void 0,"auto")}toLocaleString(e,t){if(!Rt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!Rt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument in toZonedDateTime");const t=e.calendar;if(void 0===t)throw new TypeError("missing calendar property in toZonedDateTime");const r=Hr(t),n=e.timeZone;if(void 0===n)throw new TypeError("missing timeZone property in toZonedDateTime");const i=nn(n);return Rr(K(this,v$1),i,r)}toZonedDateTimeISO(e){if(!Rt(this))throw new TypeError("invalid receiver");const t=nn(e);return Rr(K(this,v$1),t,"iso8601")}static fromEpochSeconds(e){const t=ot(e),r=d$1.multiply(d$1.BigInt(t),Ue);return ci(r),new qo(r)}static fromEpochMilliseconds(e){const t=ot(e),r=d$1.multiply(d$1.BigInt(t),Fe);return ci(r),new qo(r)}static fromEpochMicroseconds(e){const t=Qi(e),r=d$1.multiply(t,$e);return ci(r),new qo(r)}static fromEpochNanoseconds(e){const t=Qi(e);return ci(t),new qo(t)}static from(e){return Rt(e)?new qo(K(e,v$1)):hr(e)}static compare(e,t){const r=hr(e),n=hr(t),i=K(r,v$1),o=K(n,v$1);return d$1.lessThan(i,o)?-1:d$1.greaterThan(i,o)?1:0}}f$2(qo,"Temporal.Instant");const Yo=Array.prototype.includes,Wo=Array.prototype.push,zo=globalThis.Intl.DateTimeFormat,Go=Array.prototype.sort,Ho=Math.abs,Jo=Math.floor,Vo=Object.create,Qo=Object.entries,Zo=Set,Ko=Reflect.ownKeys,Xo=Set.prototype.add,ea=Set.prototype.values,ta={};class ra{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");const t=lt$1(e);if(!io(t))throw new RangeError(`invalid calendar identifier ${t}`);Q(this),X(this,z$1,oo(t));}get id(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}dateFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].dateFromFields(e,r,n)}yearMonthFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].yearMonthFromFields(e,r,n)}monthDayFromFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid fields");const r=eo(t),n=K(this,z$1);return ta[n].monthDayFromFields(e,r,n)}fields(e){if(!jt(this))throw new TypeError("invalid receiver");const t=[],r=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(const n of e){if("string"!=typeof n)throw new TypeError("invalid fields");if(!r.has(n))throw new RangeError(`invalid field name ${n}`);r.delete(n),Wo.call(t,n);}return ta[K(this,z$1)].fields(t)}mergeFields(e,t){if(!jt(this))throw new TypeError("invalid receiver");const r=It(e),n=Vo(null);St(n,r,[],[void 0]);const i=It(t),o=Vo(null);St(o,i,[],[void 0]);const a=Ko(o),s=ta[K(this,z$1)].fieldKeysToIgnore(a),l=Vo(null),u=Ko(n);for(const e of u){let t;t=nt(Yo,s,[e])?o[e]:n[e],void 0!==t&&(l[e]=t);}return St(l,o,[]),l}dateAdd(e,t,r){if(!jt(this))throw new TypeError("invalid receiver");const n=lr(e),i=dr(t),o=Gt(eo(r)),{days:a}=Zn(K(i,B$1),K(i,$),K(i,F),K(i,U),K(i,q),K(i,Y),K(i,W$1),"day"),s=K(this,z$1);return ta[s].dateAdd(n,K(i,M$1),K(i,L),K(i,P),a,o,s)}dateUntil(e,t,r){if(!jt(this))throw new TypeError("invalid receiver");const n=lr(e),i=lr(t);let o=rr(eo(r),"largestUnit","date","auto");"auto"===o&&(o="day");const{years:a,months:s,weeks:l,days:u}=ta[K(this,z$1)].dateUntil(n,i,o);return new(m$1("%Temporal.Duration%"))(a,s,l,u,0,0,0,0,0,0)}year(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].year(t)}month(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");if(Mt(t))throw new TypeError("use monthCode on PlainMonthDay instead");return At(t)||(t=lr(t)),ta[K(this,z$1)].month(t)}monthCode(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||Mt(t)||(t=lr(t)),ta[K(this,z$1)].monthCode(t)}day(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return Mt(t)||(t=lr(t)),ta[K(this,z$1)].day(t)}era(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].era(t)}eraYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].eraYear(t)}dayOfWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].dayOfWeek(t)}dayOfYear(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].dayOfYear(t)}weekOfYear(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].weekOfYear(t)}yearOfWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].yearOfWeek(t)}daysInWeek(e){if(!jt(this))throw new TypeError("invalid receiver");const t=lr(e);return ta[K(this,z$1)].daysInWeek(t)}daysInMonth(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].daysInMonth(t)}daysInYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].daysInYear(t)}monthsInYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].monthsInYear(t)}inLeapYear(e){let t=e;if(!jt(this))throw new TypeError("invalid receiver");return At(t)||(t=lr(t)),ta[K(this,z$1)].inLeapYear(t)}toString(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}toJSON(){if(!jt(this))throw new TypeError("invalid receiver");return K(this,z$1)}static from(e){return Qr(Hr(e))}}function na(e){if(!e.startsWith("M"))throw new RangeError(`Invalid month code: ${e}. Month codes must start with M.`);const t=+e.slice(1);if(isNaN(t))throw new RangeError(`Invalid month code: ${e}`);return t}function ia(e,t=!1){return `M${e.toString().padStart(2,"0")}${t?"L":""}`}function oa(e,t,r=12){let{month:n,monthCode:i}=e;if(void 0===i){if(void 0===n)throw new TypeError("Either month or monthCode are required");"reject"===t&&ii(n,1,r),"constrain"===t&&(n=ri(n,1,r)),i=ia(n);}else {const e=na(i);if(void 0!==n&&n!==e)throw new RangeError(`monthCode ${i} and month ${n} must match if both are present`);if(i!==ia(e))throw new RangeError(`Invalid month code: ${i}`);if(n=e,n<1||n>r)throw new RangeError(`Invalid monthCode: ${i}`)}return {...e,month:n,monthCode:i}}f$2(ra,"Temporal.Calendar"),p$1("Temporal.Calendar.from",ra.from),p$1("Temporal.Calendar.prototype.dateAdd",ra.prototype.dateAdd),p$1("Temporal.Calendar.prototype.dateFromFields",ra.prototype.dateFromFields),p$1("Temporal.Calendar.prototype.dateUntil",ra.prototype.dateUntil),p$1("Temporal.Calendar.prototype.day",ra.prototype.day),p$1("Temporal.Calendar.prototype.dayOfWeek",ra.prototype.dayOfWeek),p$1("Temporal.Calendar.prototype.dayOfYear",ra.prototype.dayOfYear),p$1("Temporal.Calendar.prototype.daysInMonth",ra.prototype.daysInMonth),p$1("Temporal.Calendar.prototype.daysInWeek",ra.prototype.daysInWeek),p$1("Temporal.Calendar.prototype.daysInYear",ra.prototype.daysInYear),p$1("Temporal.Calendar.prototype.era",ra.prototype.era),p$1("Temporal.Calendar.prototype.eraYear",ra.prototype.eraYear),p$1("Temporal.Calendar.prototype.fields",ra.prototype.fields),p$1("Temporal.Calendar.prototype.inLeapYear",ra.prototype.inLeapYear),p$1("Temporal.Calendar.prototype.mergeFields",ra.prototype.mergeFields),p$1("Temporal.Calendar.prototype.month",ra.prototype.month),p$1("Temporal.Calendar.prototype.monthCode",ra.prototype.monthCode),p$1("Temporal.Calendar.prototype.monthDayFromFields",ra.prototype.monthDayFromFields),p$1("Temporal.Calendar.prototype.monthsInYear",ra.prototype.monthsInYear),p$1("Temporal.Calendar.prototype.weekOfYear",ra.prototype.weekOfYear),p$1("Temporal.Calendar.prototype.year",ra.prototype.year),p$1("Temporal.Calendar.prototype.yearMonthFromFields",ra.prototype.yearMonthFromFields),p$1("Temporal.Calendar.prototype.yearOfWeek",ra.prototype.yearOfWeek),ta.iso8601={dateFromFields(e,t,r){let n=ar(e,["day","month","monthCode","year"],["year","day"]);const i=Gt(t);n=oa(n);let{year:o,month:a,day:s}=n;return ({year:o,month:a,day:s}=Yt(o,a,s,i)),wr(o,a,s,r)},yearMonthFromFields(e,t,r){let n=ar(e,["month","monthCode","year"],["year"]);const i=Gt(t);n=oa(n);let{year:o,month:a}=n;return ({year:o,month:a}=function(e,t,r){let n=e,i=t;switch(r){case"reject":oi(n,i,1);break;case"constrain":({year:n,month:i}=ni(n,i));}return {year:n,month:i}}(o,a,i)),Ir(o,a,r,1)},monthDayFromFields(e,t,r){let n=ar(e,["day","month","monthCode","year"],["day"]);const i=Gt(t);if(void 0!==n.month&&void 0===n.year&&void 0===n.monthCode)throw new TypeError("either year or monthCode required with month");const o=void 0===n.monthCode;n=oa(n);let{month:a,day:s,year:l}=n;return ({month:a,day:s}=Yt(o?l:1972,a,s,i)),Tr(a,s,r,1972)},fields:e=>e,fieldKeysToIgnore(e){const t=new Zo;for(let r=0;r<e.length;r++){const n=e[r];nt(Xo,t,[n]),"month"===n?nt(Xo,t,["monthCode"]):"monthCode"===n&&nt(Xo,t,["month"]);}return [...nt(ea,t,[])]},dateAdd(e,t,r,n,i,o,a){let s=K(e,b$2),l=K(e,_),u=K(e,E$1);return ({year:s,month:l,day:u}=xi(s,l,u,t,r,n,i,o)),wr(s,l,u,a)},dateUntil:(e,t,r)=>hi(K(e,b$2),K(e,_),K(e,E$1),K(t,b$2),K(t,_),K(t,E$1),r),year:e=>K(e,b$2),era(){},eraYear(){},month:e=>K(e,_),monthCode:e=>ia(K(e,_)),day:e=>K(e,E$1),dayOfWeek:e=>Un(K(e,b$2),K(e,_),K(e,E$1)),dayOfYear:e=>qn(K(e,b$2),K(e,_),K(e,E$1)),weekOfYear:e=>Yn(K(e,b$2),K(e,_),K(e,E$1)).week,yearOfWeek:e=>Yn(K(e,b$2),K(e,_),K(e,E$1)).year,daysInWeek:()=>7,daysInMonth:e=>Fn(K(e,b$2),K(e,_)),daysInYear(e){let t=e;return Z(t,b$2)||(t=lr(t)),$n(K(t,b$2))?366:365},monthsInYear:()=>12,inLeapYear(e){let t=e;return Z(t,b$2)||(t=lr(t)),$n(K(t,b$2))}};class aa{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),void 0!==e){let t=0;for(const r of e.map.entries()){if(++t>aa.MAX_CACHE_ENTRIES)break;this.map.set(...r);}}}get(e){const t=this.map.get(e);return t&&(this.hits++,this.report()),this.calls++,t}set(e,t){this.map.set(e,t),this.misses++,this.report();}report(){}setObject(e){if(aa.objectMap.get(e))throw new RangeError("object already cached");aa.objectMap.set(e,this),this.report();}static getCacheForObject(e){let t=aa.objectMap.get(e);return t||(t=new aa,aa.objectMap.set(e,t)),t}}function sa({isoYear:e,isoMonth:t,isoDay:r}){return `${yn(e)}-${gn(t)}-${gn(r)}T00:00Z`}function la(e,t){return {years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}aa.objectMap=new WeakMap,aa.MAX_CACHE_ENTRIES=1e3;class ua{constructor(){this.eraLength="short",this.hasEra=!0,this.erasBeginMidYear=!1;}getFormatter(){return void 0===this.formatter&&(this.formatter=new zo(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,t){const{year:r,month:n,day:i}=e,o=JSON.stringify({func:"isoToCalendarDate",isoYear:r,isoMonth:n,isoDay:i,id:this.id}),a=t.get(o);if(a)return a;const s=this.getFormatter();let l,u;try{u=sa({isoYear:r,isoMonth:n,isoDay:i}),l=s.formatToParts(new Date(u));}catch(e){throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:r,isoMonth:n,isoDay:i})}`)}const c={};for(let{type:e,value:t}of l){if("year"===e&&(c.eraYear=+t),"relatedYear"===e&&(c.eraYear=+t),"month"===e){const e=/^([0-9]*)(.*?)$/.exec(t);if(!e||3!=e.length||!e[1]&&!e[2])throw new RangeError(`Unexpected month: ${t}`);if(c.month=e[1]?+e[1]:1,c.month<1)throw new RangeError(`Invalid month ${t} from ${u}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(c.month>13)throw new RangeError(`Invalid month ${t} from ${u}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);e[2]&&(c.monthExtra=e[2]);}"day"===e&&(c.day=+t),this.hasEra&&"era"===e&&null!=t&&""!==t&&(t=t.split(" (")[0],c.era=t.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase());}if(void 0===c.eraYear)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){const{era:t,eraYear:r}=this.reviseIntlEra(c,e);c.era=t,c.eraYear=r;}this.checkIcuBugs&&this.checkIcuBugs(e);const d=this.adjustCalendarDate(c,t,"constrain",!0);if(void 0===d.year)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(void 0===d.month)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(void 0===d.day)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return t.set(o,d),["constrain","reject"].forEach((r=>{const n=JSON.stringify({func:"calendarToIsoDate",year:d.year,month:d.month,day:d.day,overflow:r,id:this.id});t.set(n,e);})),d}validateCalendarDate(e){const{era:t,month:r,year:n,day:i,eraYear:o,monthCode:a,monthExtra:s}=e;if(void 0!==s)throw new RangeError("Unexpected `monthExtra` value");if(void 0===n&&void 0===o)throw new TypeError("year or eraYear is required");if(void 0===r&&void 0===a)throw new TypeError("month or monthCode is required");if(void 0===i)throw new RangeError("Missing day");if(void 0!==a){if("string"!=typeof a)throw new RangeError("monthCode must be a string, not "+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw new RangeError(`Invalid monthCode: ${a}`)}if(this.constantEra){if(void 0!==t&&t!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${t}`);if(void 0!==o&&void 0!==n&&o!==n)throw new RangeError(`eraYear ${o} does not match year ${n}`)}if(this.hasEra&&void 0===e.era!=(void 0===e.eraYear))throw new RangeError("properties 'era' and 'eraYear' must be provided together")}adjustCalendarDate(e,t,r="constrain",n=!1){if("lunisolar"===this.calendarType)throw new RangeError("Override required for lunisolar calendars");let i=e;if(this.validateCalendarDate(i),this.constantEra){const{year:e,eraYear:t}=i;i={...i,era:this.constantEra,year:void 0!==e?e:t,eraYear:void 0!==t?t:e};}const o=this.monthsInYear(i,t);let{month:a,monthCode:s}=i;return ({month:a,monthCode:s}=oa(i,r,o)),{...i,month:a,monthCode:s}}regulateMonthDayNaive(e,t,r){const n=this.monthsInYear(e,r);let{month:i,day:o}=e;return "reject"===t?(ii(i,1,n),ii(o,1,this.maximumMonthLength(e))):(i=ri(i,1,n),o=ri(o,1,this.maximumMonthLength({...e,month:i}))),{...e,month:i,day:o}}calendarToIsoDate(e,t="constrain",r){const n=e;let i=this.adjustCalendarDate(e,r,t,!1);i=this.regulateMonthDayNaive(i,t,r);const{year:o,month:a,day:s}=i,l=JSON.stringify({func:"calendarToIsoDate",year:o,month:a,day:s,overflow:t,id:this.id});let u,c=r.get(l);if(c)return c;if(void 0!==n.year&&void 0!==n.month&&void 0!==n.day&&(n.year!==i.year||n.month!==i.month||n.day!==i.day)&&(u=JSON.stringify({func:"calendarToIsoDate",year:n.year,month:n.month,day:n.day,overflow:t,id:this.id}),c=r.get(u),c))return c;let d=this.estimateIsoDate({year:o,month:a,day:s});const h=e=>{let n=this.addDaysIso(d,e);if(i.day>this.minimumMonthLength(i)){let e=this.isoToCalendarDate(n,r);for(;e.month!==a||e.year!==o;){if("reject"===t)throw new RangeError(`day ${s} does not exist in month ${a} of year ${o}`);n=this.addDaysIso(n,-1),e=this.isoToCalendarDate(n,r);}}return n};let f=0,p=this.isoToCalendarDate(d,r),m=la(i,p);if(0!==m.years||0!==m.months||0!==m.days){const e=365*m.years+30*m.months+m.days;d=this.addDaysIso(d,e),p=this.isoToCalendarDate(d,r),m=la(i,p),0===m.years&&0===m.months?d=h(m.days):f=this.compareCalendarDates(i,p);}let y=8;for(;f;){d=this.addDaysIso(d,f*y);const e=p;p=this.isoToCalendarDate(d,r);const o=f;if(f=this.compareCalendarDates(i,p),f)if(m=la(i,p),0===m.years&&0===m.months)d=h(m.days),f=0;else if(o&&f!==o)if(y>1)y/=2;else {if("reject"===t)throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...n})}`);this.compareCalendarDates(p,e)>0&&(d=this.addDaysIso(d,-1)),f=0;}}if(r.set(l,d),u&&r.set(u,d),void 0===i.year||void 0===i.month||void 0===i.day||void 0===i.monthCode||this.hasEra&&(void 0===i.era||void 0===i.eraYear))throw new RangeError("Unexpected missing property");return d}temporalToCalendarDate(e,t){const r={year:K(e,b$2),month:K(e,_),day:K(e,E$1)};return this.isoToCalendarDate(r,t)}compareCalendarDates(e,t){const r=ar(e,["day","month","year"],["day","month","year"]),n=ar(t,["day","month","year"],["day","month","year"]);return r.year!==n.year?Xi(r.year-n.year):r.month!==n.month?Xi(r.month-n.month):r.day!==n.day?Xi(r.day-n.day):0}regulateDate(e,t="constrain",r){const n=this.calendarToIsoDate(e,t,r);return this.isoToCalendarDate(n,r)}addDaysIso(e,t){return xi(e.year,e.month,e.day,0,0,0,t,"constrain")}addDaysCalendar(e,t,r){const n=this.calendarToIsoDate(e,"constrain",r),i=this.addDaysIso(n,t);return this.isoToCalendarDate(i,r)}addMonthsCalendar(e,t,r,n){let i=e;const{day:o}=i;for(let e=0,r=Ho(t);e<r;e++){const{month:e}=i,r=i,a=t<0?-Math.max(o,this.daysInPreviousMonth(i,n)):this.daysInMonth(i,n),s=this.calendarToIsoDate(i,"constrain",n);let l=this.addDaysIso(s,a);if(i=this.isoToCalendarDate(l,n),t>0){const t=this.monthsInYear(r,n);for(;i.month-1!=e%t;)l=this.addDaysIso(l,-1),i=this.isoToCalendarDate(l,n);}i.day!==o&&(i=this.regulateDate({...i,day:o},"constrain",n));}if("reject"===r&&i.day!==o)throw new RangeError(`Day ${o} does not exist in resulting calendar month`);return i}addCalendar(e,{years:t=0,months:r=0,weeks:n=0,days:i=0},o,a){const{year:s,day:l,monthCode:u}=e,c=this.adjustCalendarDate({year:s+t,monthCode:u,day:l},a),d=this.addMonthsCalendar(c,r,o,a),h=i+7*n;return this.addDaysCalendar(d,h,a)}untilCalendar(e,t,r,n){let i=0,o=0,a=0,s=0;switch(r){case"day":i=this.calendarDaysUntil(e,t,n);break;case"week":{const r=this.calendarDaysUntil(e,t,n);i=r%7,o=(r-i)/7;break}case"month":case"year":{const o=this.compareCalendarDates(t,e);if(!o)return {years:0,months:0,weeks:0,days:0};const l=t.year-e.year,u=t.day-e.day;if("year"===r&&l){let r=0;t.monthCode>e.monthCode&&(r=1),t.monthCode<e.monthCode&&(r=-1),r||(r=Math.sign(u)),s=r*o<0?l-o:l;}let c,d=s?this.addCalendar(e,{years:s},"constrain",n):e;do{a+=o,c=d,d=this.addMonthsCalendar(c,o,"constrain",n),d.day!==e.day&&(d=this.regulateDate({...d,day:e.day},"constrain",n));}while(this.compareCalendarDates(t,d)*o>=0);a-=o,i=this.calendarDaysUntil(c,t,n);break}}return {years:s,months:a,weeks:o,days:i}}daysInMonth(e,t){const{day:r}=e,n=this.maximumMonthLength(e),i=this.minimumMonthLength(e);if(i===n)return i;const o=r<=n-i?n:i,a=this.calendarToIsoDate(e,"constrain",t),s=this.addDaysIso(a,o),l=this.isoToCalendarDate(s,t),u=this.addDaysIso(s,-l.day);return this.isoToCalendarDate(u,t).day}daysInPreviousMonth(e,t){const{day:r,month:n,year:i}=e;let o={year:n>1?i:i-1,month:n,day:1};const a=n>1?n-1:this.monthsInYear(o,t);o={...o,month:a};const s=this.minimumMonthLength(o),l=this.maximumMonthLength(o);if(s===l)return l;const u=this.calendarToIsoDate(e,"constrain",t),c=this.addDaysIso(u,-r);return this.isoToCalendarDate(c,t).day}startOfCalendarYear(e){return {year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return {year:e.year,month:e.month,day:1}}calendarDaysUntil(e,t,r){const n=this.calendarToIsoDate(e,"constrain",r),i=this.calendarToIsoDate(t,"constrain",r);return this.isoDaysUntil(n,i)}isoDaysUntil(e,t){return hi(e.year,e.month,e.day,t.year,t.month,t.day,"day").days}monthDayFromFields(e,t,r){let n,i,o,a,s,{monthCode:l,day:u}=e;if(void 0===l){let{year:n,era:i,eraYear:o}=e;if(void 0===n&&(void 0===i||void 0===o))throw new TypeError("when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required");({monthCode:l,day:u}=this.isoToCalendarDate(this.calendarToIsoDate(e,t,r),r));}const c=this.isoToCalendarDate({year:1972,month:12,day:31},r),d=c.monthCode>l||c.monthCode===l&&c.day>=u?c.year:c.year-1;for(let e=0;e<100;e++){const c=this.adjustCalendarDate({day:u,monthCode:l,year:d-e},r),h=this.calendarToIsoDate(c,"constrain",r),f=this.isoToCalendarDate(h,r);if(({year:n,month:i,day:o}=h),f.monthCode===l&&f.day===u)return {month:i,day:o,year:n};"constrain"===t&&(void 0===a||f.monthCode===a.monthCode&&f.day>a.day)&&(a=f,s=h);}if("constrain"===t&&void 0!==s)return s;throw new RangeError(`No recent ${this.id} year with monthCode ${l} and day ${u}`)}}class ca extends ua{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1;}inLeapYear(e){const{year:t}=e;return (7*t+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,t){const{month:r,year:n}=e,i=this.getMonthCode(n,r),o=Qo(this.months).find((e=>e[1].monthCode===i));if(void 0===o)throw new RangeError(`unmatched Hebrew month: ${r}`);const a=o[1].days;return "number"==typeof a?a:a[t]}estimateIsoDate(e){const{year:t}=e;return {year:t-3760,month:1,day:1}}getMonthCode(e,t){return this.inLeapYear({year:e})?6===t?ia(5,!0):ia(t<6?t:t-1):ia(t)}adjustCalendarDate(e,t,r="constrain",n=!1){let{year:i,eraYear:o,month:a,monthCode:s,day:l,monthExtra:u}=e;if(void 0===i&&void 0!==o&&(i=o),void 0===o&&void 0!==i&&(o=i),n){if(u){const e=this.months[u];if(!e)throw new RangeError(`Unrecognized month from formatToParts: ${u}`);a=this.inLeapYear({year:i})?e.leap:e.regular;}return s=this.getMonthCode(i,a),{year:i,month:a,day:l,era:void 0,eraYear:o,monthCode:s}}if(this.validateCalendarDate(e),void 0===a)if(s.endsWith("L")){if("M05L"!==s)throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${s}`);if(a=6,!this.inLeapYear({year:i})){if("reject"===r)throw new RangeError(`Hebrew monthCode M05L is invalid in year ${i} which is not a leap year`);a=6,s="M06";}}else {a=na(s),this.inLeapYear({year:i})&&a>=6&&a++;const e=this.monthsInYear({year:i});if(a<1||a>e)throw new RangeError(`Invalid monthCode: ${s}`)}else if("reject"===r?(ii(a,1,this.monthsInYear({year:i})),ii(l,1,this.maximumMonthLength({year:i,month:a}))):(a=ri(a,1,this.monthsInYear({year:i})),l=ri(l,1,this.maximumMonthLength({year:i,month:a}))),void 0===s)s=this.getMonthCode(i,a);else if(this.getMonthCode(i,a)!==s)throw new RangeError(`monthCode ${s} doesn't correspond to month ${a} in Hebrew year ${i}`);return {...e,day:l,month:a,monthCode:s,year:i,eraYear:o}}}class da extends ua{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah";}inLeapYear(e,t){return 30===this.daysInMonth({year:e.year,month:12,day:1},t)}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:Jo(t*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class ha extends da{constructor(){super(...arguments),this.id="islamic";}}class fa extends da{constructor(){super(...arguments),this.id="islamic-umalqura";}}class pa extends da{constructor(){super(...arguments),this.id="islamic-tbla";}}class ma extends da{constructor(){super(...arguments),this.id="islamic-civil";}}class ya extends da{constructor(){super(...arguments),this.id="islamic-rgsa";}}class ga extends da{constructor(){super(...arguments),this.id="islamicc";}}class va extends ua{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap";}inLeapYear(e,t){return ha.prototype.inLeapYear.call(this,e,t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 12===t?29:t<=6?31:30}maximumMonthLength(e){const{month:t}=e;return 12===t?30:t<=6?31:30}estimateIsoDate(e){const{year:t}=this.adjustCalendarDate(e);return {year:t+621,month:1,day:1}}}class wa extends ua{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug="10/11/-79 Saka"!==new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"});}inLeapYear(e){return ba(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){const{month:t}=e;let r=this.months[t];if(void 0===r)throw new RangeError(`Invalid month: ${t}`);return this.inLeapYear(e)&&r.leap&&(r=r.leap),r}estimateIsoDate(e){const t=this.adjustCalendarDate(e),r=this.getMonthInfo(t);return xi(t.year+78+(r.nextYear?1:0),r.month,r.day,0,0,0,t.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function ba(e){return e%4==0&&(e%100!=0||e%400==0)}class _a extends ua{constructor(e,t){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;const{eras:r,anchorEra:n}=function(e){let t,r=e;if(0===r.length)throw new RangeError("Invalid era data: eras are required");if(1===r.length&&r[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(1===r.length&&!r[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(r.filter((e=>null!=e.reverseOf)).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");r.forEach((e=>{if(e.isAnchor||!e.anchorEpoch&&!e.reverseOf){if(t)throw new RangeError("Invalid era data: cannot have multiple anchor eras");t=e,e.anchorEpoch={year:e.hasYearZero?0:1};}else if(!e.name)throw new RangeError("If era name is blank, it must be the anchor era")})),r=r.filter((e=>e.name)),r.forEach((e=>{const{reverseOf:t}=e;if(t){const n=r.find((e=>e.name===t));if(void 0===n)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${t}`);e.reverseOf=n,e.anchorEpoch=n.anchorEpoch,e.isoEpoch=n.isoEpoch;}void 0===e.anchorEpoch.month&&(e.anchorEpoch.month=1),void 0===e.anchorEpoch.day&&(e.anchorEpoch.day=1);})),Go.call(r,((e,t)=>{if(e.reverseOf)return 1;if(t.reverseOf)return -1;if(!e.isoEpoch||!t.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return t.isoEpoch.year-e.isoEpoch.year}));const n=r[r.length-1].reverseOf;if(n&&n!==r[r.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return r.forEach(((e,t)=>{e.genericName="era"+(r.length-1-t);})),{eras:r,anchorEra:t||r[0]}}(t);this.anchorEra=n,this.eras=r;}inLeapYear(e){const{year:t}=this.estimateIsoDate({month:1,day:1,year:e.year});return ba(t)}monthsInYear(){return 12}minimumMonthLength(e){const{month:t}=e;return 2===t?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(t)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){const t=(t,r)=>{const n=e[t];if(null!=n&&n!=r)throw new RangeError(`Input ${t} ${n} doesn't match calculated value ${r}`)},r=t=>{let r;const n={...e,year:t},i=this.eras.find(((e,i)=>{if(i===this.eras.length-1){if(e.reverseOf){if(t>0)throw new RangeError(`Signed year ${t} is invalid for era ${e.name}`);return r=e.anchorEpoch.year-t,!0}return r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0}return this.compareCalendarDates(n,e.anchorEpoch)>=0&&(r=t-e.anchorEpoch.year+(e.hasYearZero?0:1),!0)}));if(!i)throw new RangeError(`Year ${t} was not matched by any era`);return {eraYear:r,era:i.name}};let{year:n,eraYear:i,era:o}=e;if(null!=n)(({eraYear:i,era:o}=r(n))),t("era",o),t("eraYear",i);else {if(null==i)throw new RangeError("Either `year` or `eraYear` and `era` are required");{const e=void 0===o?void 0:this.eras.find((e=>e.name===o||e.genericName===o));if(!e)throw new RangeError(`Era ${o} (ISO year ${i}) was not matched by any era`);if(i<1&&e.reverseOf)throw new RangeError(`Years in ${o} era must be positive, not ${n}`);n=e.reverseOf?e.anchorEpoch.year-i:i+e.anchorEpoch.year-(e.hasYearZero?0:1),t("year",n),({eraYear:i,era:o}=r(n));}}return {...e,year:n,eraYear:i,era:o}}adjustCalendarDate(e,t,r="constrain"){let n=e;const{month:i,monthCode:o}=n;return void 0===i&&(n={...n,month:na(o)}),this.validateCalendarDate(n),n=this.completeEraYear(n),super.adjustCalendarDate(n,t,r)}estimateIsoDate(e){const t=this.adjustCalendarDate(e),{year:r,month:n,day:i}=t,{anchorEra:o}=this;return Yt(r+o.isoEpoch.year-(o.hasYearZero?0:1),n,i,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug&&zi(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}}class Ea extends _a{constructor(e,t){super(e,t);}inLeapYear(e){const{year:t}=e;return (t+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){const{month:t}=e;return 13===t?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}}class Ta extends Ea{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}]);}}class xa extends Ea{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}]);}}class Ia extends Ea{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}]);}}class Sa extends _a{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0;}}class Ra extends _a{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0;}}class ka extends _a{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]);}reviseIntlEra(e){let{era:t,eraYear:r}=e;return "bc"!==t&&"b"!==t||(t="bce"),"ad"!==t&&"a"!==t||(t="ce"),{era:t,eraYear:r}}}class ja extends _a{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long",this.erasBeginMidYear=!0;}reviseIntlEra(e,t){const{era:r,eraYear:n}=e,{year:i}=t;return this.eras.find((e=>e.name===r))?{era:r,eraYear:n}:i<1?{era:"bce",eraYear:1-i}:{era:"ce",eraYear:i}}}class Da extends ua{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1;}inLeapYear(e,t){const r=this.getMonthList(e.year,t);return 13===Qo(r).length}monthsInYear(e,t){return this.inLeapYear(e,t)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,t){if(void 0===e)throw new TypeError("Missing year");const r=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),n=t.get(r);if(n)return n;const i=this.getFormatter(),o=(e,t)=>{const r=sa({isoYear:e,isoMonth:2,isoDay:1}),n=new Date(r);n.setUTCDate(t+1);const o=i.formatToParts(n),a=o.find((e=>"month"===e.type)).value,s=+o.find((e=>"day"===e.type)).value;let l=o.find((e=>"relatedYear"===e.type));if(void 0===l)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return l=+l.value,{calendarMonthString:a,calendarDay:s,calendarYearToVerify:l}};let a=17,{calendarMonthString:s,calendarDay:l,calendarYearToVerify:u}=o(e,a);"1"!==s&&(a+=29,({calendarMonthString:s,calendarDay:l}=o(e,a))),a-=l-5;const c={};let d,h,f=1,p=!1;do{(({calendarMonthString:s,calendarDay:l,calendarYearToVerify:u}=o(e,a))),d&&(c[h].daysInMonth=d+30-l),u!==e?p=!0:(c[s]={monthIndex:f++},a+=30),d=l,h=s;}while(!p);return c[h].daysInMonth=d+30-l,t.set(r,c),c}estimateIsoDate(e){const{year:t,month:r}=e;return {year:t,month:r>=12?12:r+1,day:1}}adjustCalendarDate(e,t,r="constrain",n=!1){let{year:i,month:o,monthExtra:a,day:s,monthCode:l,eraYear:u}=e;if(n){if(i=u,a&&"bis"!==a)throw new RangeError(`Unexpected leap month suffix: ${a}`);const e=ia(o,void 0!==a),r=`${o}${a||""}`,n=this.getMonthList(i,t)[r];if(void 0===n)throw new RangeError(`Unmatched month ${r} in Chinese year ${i}`);return o=n.monthIndex,{year:i,month:o,day:s,era:void 0,eraYear:u,monthCode:e}}if(this.validateCalendarDate(e),void 0===i&&(i=u),void 0===u&&(u=i),void 0===o){const e=this.getMonthList(i,t);let n=l.replace("L","bis").slice(1);"0"===n[0]&&(n=n.slice(1));let a=e[n];if(o=a&&a.monthIndex,void 0===o&&l.endsWith("L")&&"M13L"!=l&&"constrain"===r){let t=l.slice(1,-1);"0"===t[0]&&(t=t.slice(1)),a=e[t],a&&(o=a.monthIndex,l=ia(t));}if(void 0===o)throw new RangeError(`Unmatched month ${l} in Chinese year ${i}`)}else if(void 0===l){const e=this.getMonthList(i,t),n=Qo(e),a=n.length;"reject"===r?(ii(o,1,a),ii(s,1,this.maximumMonthLength())):(o=ri(o,1,a),s=ri(s,1,this.maximumMonthLength()));const u=n.find((([,e])=>e.monthIndex===o));if(void 0===u)throw new RangeError(`Invalid month ${o} in Chinese year ${i}`);l=ia(u[0].replace("bis",""),-1!==u[0].indexOf("bis"));}else {const e=this.getMonthList(i,t);let r=l.replace("L","bis").slice(1);"0"===r[0]&&(r=r.slice(1));const n=e[r];if(!n)throw new RangeError(`Unmatched monthCode ${l} in Chinese year ${i}`);if(o!==n.monthIndex)throw new RangeError(`monthCode ${l} doesn't correspond to month ${o} in Chinese year ${i}`)}return {...e,year:i,eraYear:u,month:o,monthCode:l,day:s}}}class Na extends Da{constructor(){super(...arguments),this.id="chinese";}}class Oa extends Da{constructor(){super(...arguments),this.id="dangi";}}class Ca{constructor(e){this.helper=e;}dateFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["day","month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.calendarToIsoDate(i,o,n),u=wr(a,s,l,r);return n.setObject(u),u}yearMonthFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.calendarToIsoDate({...i,day:1},o,n),u=Ir(a,s,r,l);return n.setObject(u),u}monthDayFromFields(e,t,r){const n=new aa,i=ar(e,this.fields(["day","month","monthCode","year"]),[]),o=Gt(t),{year:a,month:s,day:l}=this.helper.monthDayFromFields(i,o,n),u=Tr(s,l,r,a);return n.setObject(u),u}fields(e){let t=e;return Yo.call(t,"year")&&(t=[...t,"era","eraYear"]),t}fieldKeysToIgnore(e){const t=new Zo;for(let r=0;r<e.length;r++){const n=e[r];switch(nt(Xo,t,[n]),n){case"era":nt(Xo,t,["eraYear"]),nt(Xo,t,["year"]);break;case"eraYear":nt(Xo,t,["era"]),nt(Xo,t,["year"]);break;case"year":nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]);break;case"month":nt(Xo,t,["monthCode"]),this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));break;case"monthCode":nt(Xo,t,["month"]),this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));break;case"day":this.helper.erasBeginMidYear&&(nt(Xo,t,["era"]),nt(Xo,t,["eraYear"]));}}return [...nt(ea,t,[])]}dateAdd(e,t,r,n,i,o,a){const s=aa.getCacheForObject(e),l=this.helper.temporalToCalendarDate(e,s),u=this.helper.addCalendar(l,{years:t,months:r,weeks:n,days:i},o,s),c=this.helper.calendarToIsoDate(u,"constrain",s),{year:d,month:h,day:f}=c,p=wr(d,h,f,a);return new aa(s).setObject(p),p}dateUntil(e,t,r){const n=aa.getCacheForObject(e),i=aa.getCacheForObject(t),o=this.helper.temporalToCalendarDate(e,n),a=this.helper.temporalToCalendarDate(t,i);return this.helper.untilCalendar(o,a,r,n)}year(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).year}month(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).month}day(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).day}era(e){if(!this.helper.hasEra)return;const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).era}eraYear(e){if(!this.helper.hasEra)return;const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).eraYear}monthCode(e){const t=aa.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,t).monthCode}dayOfWeek(e){return ta.iso8601.dayOfWeek(e)}dayOfYear(e){const t=aa.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,t),n=this.helper.startOfCalendarYear(r);return this.helper.calendarDaysUntil(n,r,t)+1}weekOfYear(e){return ta.iso8601.weekOfYear(e)}yearOfWeek(e){return ta.iso8601.yearOfWeek(e)}daysInWeek(e){return ta.iso8601.daysInWeek(e)}daysInMonth(e){const t=aa.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t),n=this.helper.maximumMonthLength(r);if(n===this.helper.minimumMonthLength(r))return n;const i=this.helper.startOfCalendarMonth(r),o=this.helper.addMonthsCalendar(i,1,"constrain",t);return this.helper.calendarDaysUntil(i,o,t)}daysInYear(e){let t=e;Z(t,b$2)||(t=lr(t));const r=aa.getCacheForObject(t),n=this.helper.temporalToCalendarDate(t,r),i=this.helper.startOfCalendarYear(n),o=this.helper.addCalendar(i,{years:1},"constrain",r);return this.helper.calendarDaysUntil(i,o,r)}monthsInYear(e){const t=aa.getCacheForObject(e),r=this.helper.temporalToCalendarDate(e,t);return this.helper.monthsInYear(r,t)}inLeapYear(e){let t=e;Z(t,b$2)||(t=lr(t));const r=aa.getCacheForObject(t),n=this.helper.temporalToCalendarDate(t,r);return this.helper.inLeapYear(n,r)}}for(const e of [ca,va,Ia,Ta,xa,Na,Oa,Sa,wa,Ra,ka,ja,ha,fa,pa,ma,ya,ga]){const t=new e;ta[t.id]=new Ca(t);}class Aa{constructor(e,t,r,n="iso8601"){vr(this,ut$1(e),ut$1(t),ut$1(r),Hr(n));}get calendarId(){if(!Nt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get era(){if(!Nt(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get year(){if(!Nt(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!Nt(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!Nt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Nt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get dayOfWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return Br(K(this,j),this)}get dayOfYear(){if(!Nt(this))throw new TypeError("invalid receiver");return $r(K(this,j),this)}get weekOfYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Fr(K(this,j),this)}get yearOfWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return Ur(K(this,j),this)}get daysInWeek(){if(!Nt(this))throw new TypeError("invalid receiver");return qr(K(this,j),this)}get daysInMonth(){if(!Nt(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get daysInYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get monthsInYear(){if(!Nt(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!Nt(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!Nt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),en(n,o,r)}withCalendar(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=Hr(e);return new Aa(K(this,b$2),K(this,_),K(this,E$1),t)}add(e,t){if(!Nt(this))throw new TypeError("invalid receiver");const r=dr(e),n=eo(t);return Dr(K(this,j),this,r,n)}subtract(e,t){if(!Nt(this))throw new TypeError("invalid receiver");const r=ti(dr(e)),n=eo(t);return Dr(K(this,j),this,r,n)}until(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return wi("until",this,e,t)}since(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return wi("since",this,e,t)}equals(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=lr(e);for(const e of [b$2,_,E$1])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Nt(this))throw new TypeError("invalid receiver");return _n(this,Qt(eo(e)))}toJSON(){if(!Nt(this))throw new TypeError("invalid receiver");return _n(this)}toLocaleString(e,t){if(!Nt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDate")}toPlainDateTime(e){if(!Nt(this))throw new TypeError("invalid receiver");const t=K(this,b$2),r=K(this,_),n=K(this,E$1),i=K(this,j);if(void 0===e)return _r(t,r,n,0,0,0,0,0,0,i);const o=pr(e);return _r(t,r,n,K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),i)}toZonedDateTime(e){if(!Nt(this))throw new TypeError("invalid receiver");let t,r;if(it(e))if(kt(e))t=e;else {const n=e.timeZone;void 0===n?t=nn(e):(t=nn(n),r=e.plainTime);}else t=nn(e);const n=K(this,b$2),i=K(this,_),o=K(this,E$1),a=K(this,j);let s=0,l=0,u=0,c=0,d=0,h=0;return void 0!==r&&(r=pr(r),s=K(r,T$1),l=K(r,x$1),u=K(r,I$1),c=K(r,S$1),d=K(r,R),h=K(r,k)),Rr(K(fn(t,_r(n,i,o,s,l,u,c,d,h,a),"compatible"),v$1),t,a)}toPlainYearMonth(){if(!Nt(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Nt(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}getISOFields(){if(!Nt(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!Nt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Nt(e)?(Gt(r),wr(K(e,b$2),K(e,_),K(e,E$1),K(e,j))):lr(e,r)}static compare(e,t){const r=lr(e),n=lr(t);return zi(K(r,b$2),K(r,_),K(r,E$1),K(n,b$2),K(n,_),K(n,E$1))}}f$2(Aa,"Temporal.PlainDate");class Ma{constructor(e,t,r,n=0,i=0,o=0,a=0,s=0,l=0,u="iso8601"){br(this,ut$1(e),ut$1(t),ut$1(r),void 0===n?0:ut$1(n),void 0===i?0:ut$1(i),void 0===o?0:ut$1(o),void 0===a?0:ut$1(a),void 0===s?0:ut$1(s),void 0===l?0:ut$1(l),Hr(u));}get calendarId(){if(!Ct(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get year(){if(!Ct(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!Ct(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!Ct(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Ct(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get hour(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,T$1)}get minute(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,x$1)}get second(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,I$1)}get millisecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,S$1)}get microsecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,R)}get nanosecond(){if(!Ct(this))throw new TypeError("invalid receiver");return K(this,k)}get era(){if(!Ct(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get dayOfWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return Br(K(this,j),this)}get dayOfYear(){if(!Ct(this))throw new TypeError("invalid receiver");return $r(K(this,j),this)}get weekOfYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Fr(K(this,j),this)}get yearOfWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return Ur(K(this,j),this)}get daysInWeek(){if(!Ct(this))throw new TypeError("invalid receiver");return qr(K(this,j),this)}get daysInYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get daysInMonth(){if(!Ct(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get monthsInYear(){if(!Ct(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!Ct(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!Ct(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);let o=ar(this,i,[]);o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]);const{year:a,month:s,day:l,hour:u,minute:c,second:d,millisecond:h,microsecond:f,nanosecond:p}=ur(n,o,r);return _r(a,s,l,u,c,d,h,f,p,n)}withPlainTime(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=K(this,b$2),r=K(this,_),n=K(this,E$1),i=K(this,j);if(void 0===e)return _r(t,r,n,0,0,0,0,0,0,i);const o=pr(e);return _r(t,r,n,K(o,T$1),K(o,x$1),K(o,I$1),K(o,S$1),K(o,R),K(o,k),i)}withPlainDate(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1);let o=K(t,j);const a=K(this,T$1),s=K(this,x$1),l=K(this,I$1),u=K(this,S$1),c=K(this,R),d=K(this,k);return o=Xr(K(this,j),o),_r(r,n,i,a,s,l,u,c,d,o)}withCalendar(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=Hr(e);return new Ma(K(this,b$2),K(this,_),K(this,E$1),K(this,T$1),K(this,x$1),K(this,I$1),K(this,S$1),K(this,R),K(this,k),t)}add(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return Oi("add",this,e,t)}subtract(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return Oi("subtract",this,e,t)}until(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return bi("until",this,e,t)}since(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return bi("since",this,e,t)}round(e){if(!Ct(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr,["day"]),o={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];Kt(r,o,1===o);let a=K(this,b$2),s=K(this,_),l=K(this,E$1),u=K(this,T$1),c=K(this,x$1),d=K(this,I$1),h=K(this,S$1),f=K(this,R),p=K(this,k);return ({year:a,month:s,day:l,hour:u,minute:c,second:d,millisecond:h,microsecond:f,nanosecond:p}=Bi(a,s,l,u,c,d,h,f,p,r,i,n)),_r(a,s,l,u,c,d,h,f,p,K(this,j))}equals(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=cr(e);for(const e of [b$2,_,E$1,T$1,x$1,I$1,S$1,R,k])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Ct(this))throw new TypeError("invalid receiver");const t=eo(e),r=Qt(t),n=Xt(t),i=Jt(t,"trunc"),o=rr(t,"smallestUnit","time",void 0);if("hour"===o)throw new RangeError('smallestUnit must be a time unit other than "hour"');const{precision:a,unit:s,increment:l}=er(o,n);return En(this,a,r,{unit:s,increment:l,roundingMode:i})}toJSON(){if(!Ct(this))throw new TypeError("invalid receiver");return En(this,"auto")}toLocaleString(e,t){if(!Ct(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDateTime")}toZonedDateTime(e,t){if(!Ct(this))throw new TypeError("invalid receiver");const r=nn(e);return Rr(K(fn(r,this,Ht(eo(t))),v$1),r,K(this,j))}toPlainDate(){if(!Ct(this))throw new TypeError("invalid receiver");return ln(this)}toPlainYearMonth(){if(!Ct(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Ct(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}toPlainTime(){if(!Ct(this))throw new TypeError("invalid receiver");return un(this)}getISOFields(){if(!Ct(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoHour:K(this,T$1),isoMicrosecond:K(this,R),isoMillisecond:K(this,S$1),isoMinute:K(this,x$1),isoMonth:K(this,_),isoNanosecond:K(this,k),isoSecond:K(this,I$1),isoYear:K(this,b$2)}}getCalendar(){if(!Ct(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Ct(e)?(Gt(r),_r(K(e,b$2),K(e,_),K(e,E$1),K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k),K(e,j))):cr(e,r)}static compare(e,t){const r=cr(e),n=cr(t);for(const e of [b$2,_,E$1,T$1,x$1,I$1,S$1,R,k]){const t=K(r,e),i=K(n,e);if(t!==i)return Xi(t-i)}return 0}}f$2(Ma,"Temporal.PlainDateTime");class La{constructor(e=0,t=0,r=0,n=0,i=0,o=0,a=0,s=0,l=0,u=0){const c=void 0===e?0:dt(e),d=void 0===t?0:dt(t),h=void 0===r?0:dt(r),f=void 0===n?0:dt(n),p=void 0===i?0:dt(i),m=void 0===o?0:dt(o),y=void 0===a?0:dt(a),g=void 0===s?0:dt(s),v=void 0===l?0:dt(l),w=void 0===u?0:dt(u);di(c,d,h,f,p,m,y,g,v,w),Q(this),X(this,M$1,c),X(this,L,d),X(this,P,h),X(this,B$1,f),X(this,$,p),X(this,F,m),X(this,U,y),X(this,q,g),X(this,Y,v),X(this,W$1,w);}get years(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,M$1)}get months(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,L)}get weeks(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,P)}get days(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,B$1)}get hours(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,$)}get minutes(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,F)}get seconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,U)}get milliseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,q)}get microseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,Y)}get nanoseconds(){if(!Dt(this))throw new TypeError("invalid receiver");return K(this,W$1)}get sign(){if(!Dt(this))throw new TypeError("invalid receiver");return Wn(K(this,M$1),K(this,L),K(this,P),K(this,B$1),K(this,$),K(this,F),K(this,U),K(this,q),K(this,Y),K(this,W$1))}get blank(){if(!Dt(this))throw new TypeError("invalid receiver");return 0===Wn(K(this,M$1),K(this,L),K(this,P),K(this,B$1),K(this,$),K(this,F),K(this,U),K(this,q),K(this,Y),K(this,W$1))}with(e){if(!Dt(this))throw new TypeError("invalid receiver");const t=ar(e,["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],"partial"),{years:r=K(this,M$1),months:n=K(this,L),weeks:i=K(this,P),days:o=K(this,B$1),hours:a=K(this,$),minutes:s=K(this,F),seconds:l=K(this,U),milliseconds:u=K(this,q),microseconds:c=K(this,Y),nanoseconds:d=K(this,W$1)}=t;return new La(r,n,i,o,a,s,l,u,c,d)}negated(){if(!Dt(this))throw new TypeError("invalid receiver");return ti(this)}abs(){if(!Dt(this))throw new TypeError("invalid receiver");return new La(Math.abs(K(this,M$1)),Math.abs(K(this,L)),Math.abs(K(this,P)),Math.abs(K(this,B$1)),Math.abs(K(this,$)),Math.abs(K(this,F)),Math.abs(K(this,U)),Math.abs(K(this,q)),Math.abs(K(this,Y)),Math.abs(K(this,W$1)))}add(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return Di("add",this,e,t)}subtract(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return Di("subtract",this,e,t)}round(e){if(!Dt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");let t=K(this,M$1),r=K(this,L),n=K(this,P),i=K(this,B$1),o=K(this,$),a=K(this,F),s=K(this,U),l=K(this,q),u=K(this,Y),c=K(this,W$1),h=ir(t,r,n,i,o,a,s,l,u,c);const f="string"==typeof e?to("smallestUnit",e):eo(e);let p=rr(f,"largestUnit","datetime",void 0,["auto"]),y=nr(f);const g=Zt(f),v=Jt(f,"halfExpand");let w=rr(f,"smallestUnit","datetime",void 0),b=!0;w||(b=!1,w="nanosecond"),h=or(h,w);let _=!0;if(p||(_=!1,p=h),"auto"===p&&(p=h),!b&&!_)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(or(p,w)!==p)throw new RangeError(`largestUnit ${p} cannot be smaller than smallestUnit ${w}`);const E={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[w];return void 0!==E&&Kt(g,E,!1),({years:t,months:r,weeks:n,days:i}=Xn(t,r,n,i,p,y)),({years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Wi(t,r,n,i,o,a,s,l,u,c,g,w,v,y)),({years:t,months:r,weeks:n,days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Yi(t,r,n,i,o,a,s,l,u,c,g,w,v,y)),({days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=Zn(i,o,a,s,l,u,c,p,y)),({years:t,months:r,weeks:n,days:i}=function(e,t,r,n,i,o){const a=m$1("%Temporal.Duration%"),s=Wn(e,t,r,n,0,0,0,0,0,0);if(0===s)return {years:e,months:t,weeks:r,days:n};const l=d$1.BigInt(s);let u,c,h=d$1.BigInt(e),f=d$1.BigInt(t),p=d$1.BigInt(r),y=d$1.BigInt(n);o&&(c=lr(o),u=K(c,j));const g=new a(s),v=new a(0,s),w=new a(0,0,s);switch(i){case"year":{if(!u)throw new RangeError("a starting point is required for years balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r,n;for(({relativeTo:t,days:r}=Ui(u,c,g,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),h=d$1.add(h,l),c=t,({relativeTo:t,days:r}=Ui(u,c,g,e));for(({relativeTo:t,days:n}=Ui(u,c,v,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(n)));)y=d$1.subtract(y,d$1.BigInt(n)),f=d$1.add(f,l),c=t,({relativeTo:t,days:n}=Ui(u,c,v,e));t=Dr(u,c,g,void 0,e);const i="string"!=typeof u?rt(u,"dateUntil"):void 0,o=Ne(null);o.largestUnit="month";let a=Nr(u,c,t,o,i),s=K(a,L);for(;d$1.greaterThanOrEqual(mt(f),d$1.BigInt(Ee(s)));){f=d$1.subtract(f,d$1.BigInt(s)),h=d$1.add(h,l),c=t,t=Dr(u,c,g,void 0,e);const r=Ne(null);r.largestUnit="month",a=Nr(u,c,t,r,i),s=K(a,L);}break}case"month":{if(!u)throw new RangeError("a starting point is required for months balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r;for(({relativeTo:t,days:r}=Ui(u,c,v,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),f=d$1.add(f,l),c=t,({relativeTo:t,days:r}=Ui(u,c,v,e));break}case"week":{if(!u)throw new RangeError("a starting point is required for weeks balancing");const e="string"!=typeof u?rt(u,"dateAdd"):void 0;let t,r;for(({relativeTo:t,days:r}=Ui(u,c,w,e));d$1.greaterThanOrEqual(mt(y),d$1.BigInt(Ee(r)));)y=d$1.subtract(y,d$1.BigInt(r)),p=d$1.add(p,l),c=t,({relativeTo:t,days:r}=Ui(u,c,w,e));break}}return {years:d$1.toNumber(h),months:d$1.toNumber(f),weeks:d$1.toNumber(p),days:d$1.toNumber(y)}}(t,r,n,i,p,y)),new La(t,r,n,i,o,a,s,l,u,c)}total(e){if(!Dt(this))throw new TypeError("invalid receiver");let t=K(this,M$1),r=K(this,L),n=K(this,P),i=K(this,B$1),o=K(this,$),a=K(this,F),s=K(this,U),l=K(this,q),u=K(this,Y),c=K(this,W$1);if(void 0===e)throw new TypeError("options argument is required");const d="string"==typeof e?to("unit",e):eo(e),h=nr(d),f=rr(d,"unit","datetime",tr);let p;(({years:t,months:r,weeks:n,days:i}=Xn(t,r,n,i,f,h))),Lt(h)&&(p=qi(h,t,r,n,0));let m=Kn(i,o,a,s,l,u,c,f,p);if("positive overflow"===m)return 1/0;if("negative overflow"===m)return -1/0;({days:i,hours:o,minutes:a,seconds:s,milliseconds:l,microseconds:u,nanoseconds:c}=m);const{total:y}=Wi(t,r,n,i,o,a,s,l,u,c,1,f,"trunc",h);return y}toString(e){if(!Dt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i||"minute"===i)throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');const{precision:o,unit:a,increment:s}=er(i,r);return bn(this,o,{unit:a,increment:s,roundingMode:n})}toJSON(){if(!Dt(this))throw new TypeError("invalid receiver");return bn(this)}toLocaleString(e,t){if(!Dt(this))throw new TypeError("invalid receiver");return "undefined"!=typeof Intl&&void 0!==Intl.DurationFormat?new Intl.DurationFormat(e,t).format(this):(console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),bn(this))}valueOf(){throw new TypeError("use compare() to compare Temporal.Duration")}static from(e){return Dt(e)?new La(K(e,M$1),K(e,L),K(e,P),K(e,B$1),K(e,$),K(e,F),K(e,U),K(e,q),K(e,Y),K(e,W$1)):dr(e)}static compare(e,t,r){const n=dr(e),i=dr(t),o=nr(eo(r)),a=K(n,M$1),s=K(n,L),l=K(n,P);let u=K(n,B$1);const c=K(n,$),h=K(n,F),f=K(n,U),p=K(n,q),m=K(n,Y);let y=K(n,W$1);const g=K(i,M$1),v=K(i,L),w=K(i,P);let b=K(i,B$1);const _=K(i,$),E=K(i,F),T=K(i,U),x=K(i,q),I=K(i,Y);let S=K(i,W$1);const R=ei(o,a,s,l,u),k=ei(o,g,v,w,b);0===a&&0===g&&0===s&&0===v&&0===l&&0===w||(({days:u}=Xn(a,s,l,u,"day",o)),({days:b}=Xn(g,v,w,b,"day",o)));const j=Vn(u,c,h,f,p,m,y,R),D=Vn(b,_,E,T,x,I,S,k);return Xi(d$1.toNumber(d$1.subtract(j,D)))}}f$2(La,"Temporal.Duration");const Pa=Object.create;class Ba{constructor(e,t,r="iso8601",n=1972){Er(this,ut$1(e),ut$1(t),Hr(r),ut$1(n));}get monthCode(){if(!Mt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get day(){if(!Mt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),this)}get calendarId(){if(!Mt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}with(e,t){if(!Mt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["day","month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),rn(n,o,r)}equals(e){if(!Mt(this))throw new TypeError("invalid receiver");const t=fr(e);for(const e of [_,E$1,b$2])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!Mt(this))throw new TypeError("invalid receiver");return Tn(this,Qt(eo(e)))}toJSON(){if(!Mt(this))throw new TypeError("invalid receiver");return Tn(this)}toLocaleString(e,t){if(!Mt(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use equals() to compare Temporal.PlainMonthDay")}toPlainDate(e){if(!Mt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("argument should be an object");const t=K(this,j),r=kr(t,["day","monthCode"]),n=ar(this,r,[]),i=kr(t,["year"]);let o=jr(t,n,ar(e,i,[]));o=ar(o,[...new Set([...r,...i])],[]);const a=Pa(null);return a.overflow="reject",en(t,o,a)}getISOFields(){if(!Mt(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!Mt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return Mt(e)?(Gt(r),Tr(K(e,_),K(e,E$1),K(e,j),K(e,b$2))):fr(e,r)}}f$2(Ba,"Temporal.PlainMonthDay");const $a=()=>new(m$1("%Temporal.Instant%"))(Zi()),Fa=(e,t=Ki())=>{const r=nn(t),n=Hr(e);return hn(r,$a(),n)},Ua=(e=Ki())=>hn(nn(e),$a(),"iso8601"),qa=(e,t=Ki())=>{const r=nn(t),n=Hr(e);return Rr(Zi(),r,n)},Ya={instant:$a,plainDateTime:Fa,plainDateTimeISO:Ua,plainDate:(e,t=Ki())=>ln(Fa(e,t)),plainDateISO:(e=Ki())=>ln(Ua(e)),plainTimeISO:(e=Ki())=>un(Ua(e)),timeZoneId:()=>Ki(),zonedDateTime:qa,zonedDateTimeISO:(e=Ki())=>qa("iso8601",e),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(Ya,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});const Wa=Object.assign;function za(e,t,r){let n=K(e,T$1),i=K(e,x$1),o=K(e,I$1),a=K(e,S$1),s=K(e,R),l=K(e,k);if(r){const{unit:e,increment:t,roundingMode:u}=r;({hour:n,minute:i,second:o,millisecond:a,microsecond:s,nanosecond:l}=$i(n,i,o,a,s,l,t,e,u));}return `${gn(n)}:${gn(i)}${vn(o,a,s,l,t)}`}class Ga{constructor(e=0,t=0,r=0,n=0,i=0,o=0){const a=void 0===e?0:ut$1(e),s=void 0===t?0:ut$1(t),l=void 0===r?0:ut$1(r),u=void 0===n?0:ut$1(n),c=void 0===i?0:ut$1(i),d=void 0===o?0:ut$1(o);si(a,s,l,u,c,d),Q(this),X(this,T$1,a),X(this,x$1,s),X(this,I$1,l),X(this,S$1,u),X(this,R,c),X(this,k,d);}get hour(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,T$1)}get minute(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,x$1)}get second(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,I$1)}get millisecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,S$1)}get microsecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,R)}get nanosecond(){if(!Ot(this))throw new TypeError("invalid receiver");return K(this,k)}with(e,t){if(!Ot(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=Gt(eo(t)),n=sr(e,"partial"),i=sr(this);let{hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=Wa(i,n);return ({hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=Wt(o,a,s,l,u,c,r)),new Ga(o,a,s,l,u,c)}add(e){if(!Ot(this))throw new TypeError("invalid receiver");return Ci("add",this,e)}subtract(e){if(!Ot(this))throw new TypeError("invalid receiver");return Ci("subtract",this,e)}until(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return _i("until",this,e,t)}since(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return _i("since",this,e,t)}round(e){if(!Ot(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr);Kt(r,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1);let o=K(this,T$1),a=K(this,x$1),s=K(this,I$1),l=K(this,S$1),u=K(this,R),c=K(this,k);return ({hour:o,minute:a,second:s,millisecond:l,microsecond:u,nanosecond:c}=$i(o,a,s,l,u,c,r,i,n)),new Ga(o,a,s,l,u,c)}equals(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=pr(e);for(const e of [T$1,x$1,I$1,S$1,R,k])if(K(this,e)!==K(t,e))return !1;return !0}toString(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=eo(e),r=Xt(t),n=Jt(t,"trunc"),i=rr(t,"smallestUnit","time",void 0);if("hour"===i)throw new RangeError('smallestUnit must be a time unit other than "hour"');const{precision:o,unit:a,increment:s}=er(i,r);return za(this,o,{unit:a,increment:s,roundingMode:n})}toJSON(){if(!Ot(this))throw new TypeError("invalid receiver");return za(this,"auto")}toLocaleString(e,t){if(!Ot(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!Ot(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1),o=K(t,j);return _r(r,n,i,K(this,T$1),K(this,x$1),K(this,I$1),K(this,S$1),K(this,R),K(this,k),o)}toZonedDateTime(e){if(!Ot(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");const t=e.plainDate;if(void 0===t)throw new TypeError("missing date property");const r=lr(t),n=e.timeZone;if(void 0===n)throw new TypeError("missing timeZone property");const i=nn(n),o=K(r,b$2),a=K(r,_),s=K(r,E$1),l=K(r,j),u=K(this,T$1),c=K(this,x$1),d=K(this,I$1),h=K(this,S$1),f=K(this,R),p=K(this,k);return Rr(K(fn(i,new(m$1("%Temporal.PlainDateTime%"))(o,a,s,u,c,d,h,f,p,l),"compatible"),v$1),i,l)}getISOFields(){if(!Ot(this))throw new TypeError("invalid receiver");return {isoHour:K(this,T$1),isoMicrosecond:K(this,R),isoMillisecond:K(this,S$1),isoMinute:K(this,x$1),isoNanosecond:K(this,k),isoSecond:K(this,I$1)}}static from(e,t){const r=Gt(eo(t));return Ot(e)?new Ga(K(e,T$1),K(e,x$1),K(e,I$1),K(e,S$1),K(e,R),K(e,k)):pr(e,r)}static compare(e,t){const r=pr(e),n=pr(t);for(const e of [T$1,x$1,I$1,S$1,R,k]){const t=K(r,e),i=K(n,e);if(t!==i)return Xi(t-i)}return 0}}f$2(Ga,"Temporal.PlainTime");class Ha{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");const t=kn(e);Q(this),X(this,w$1,t);}get id(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}getOffsetNanosecondsFor(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);return Sn(r)?Rn(r):jn(r,K(t,v$1))}getOffsetStringFor(e){if(!kt(this))throw new TypeError("invalid receiver");return dn(this,hr(e))}getPlainDateTimeFor(e,t="iso8601"){if(!kt(this))throw new TypeError("invalid receiver");return hn(this,hr(e),Hr(t))}getInstantFor(e,t){if(!kt(this))throw new TypeError("invalid receiver");return fn(this,cr(e),Ht(eo(t)))}getPossibleInstantsFor(e){if(!kt(this))throw new TypeError("invalid receiver");const t=cr(e),r=m$1("%Temporal.Instant%"),n=K(this,w$1);if(Sn(n)){const e=On(K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k));if(null===e)throw new RangeError("DateTime outside of supported range");const i=Rn(n);return [new r(d$1.subtract(e,d$1.BigInt(i)))]}const i=function(e,t,r,n,i,o,a,s,l,u){const c=On(t,r,n,i,o,a,s,l,u);if(null===c)throw new RangeError("DateTime outside of supported range");let h=d$1.subtract(c,ze);d$1.lessThan(h,Ge)&&(h=c);let f=d$1.add(c,ze);d$1.greaterThan(f,He)&&(f=c);const p=jn(e,h),m=jn(e,f);return (p===m?[p]:[p,m]).map((h=>{const f=d$1.subtract(c,d$1.BigInt(h)),p=An(e,f);if(t===p.year&&r===p.month&&n===p.day&&i===p.hour&&o===p.minute&&a===p.second&&s===p.millisecond&&l===p.microsecond&&u===p.nanosecond)return f})).filter((e=>void 0!==e))}(n,K(t,b$2),K(t,_),K(t,E$1),K(t,T$1),K(t,x$1),K(t,I$1),K(t,S$1),K(t,R),K(t,k));return i.map((e=>new r(e)))}getNextTransition(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);if(Sn(r)||"UTC"===r)return null;let n=K(t,v$1);const i=m$1("%Temporal.Instant%");return n=Pn(r,n),null===n?null:new i(n)}getPreviousTransition(e){if(!kt(this))throw new TypeError("invalid receiver");const t=hr(e),r=K(this,w$1);if(Sn(r)||"UTC"===r)return null;let n=K(t,v$1);const i=m$1("%Temporal.Instant%");return n=Bn(r,n),null===n?null:new i(n)}toString(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}toJSON(){if(!kt(this))throw new TypeError("invalid receiver");return K(this,w$1)}static from(e){return an(nn(e))}}f$2(Ha,"Temporal.TimeZone"),p$1("Temporal.TimeZone.prototype.getOffsetNanosecondsFor",Ha.prototype.getOffsetNanosecondsFor),p$1("Temporal.TimeZone.prototype.getPossibleInstantsFor",Ha.prototype.getPossibleInstantsFor);const Ja=Object.create;class Va{constructor(e,t,r="iso8601",n=1){xr(this,ut$1(e),ut$1(t),Hr(r),ut$1(n));}get year(){if(!At(this))throw new TypeError("invalid receiver");return Or(K(this,j),this)}get month(){if(!At(this))throw new TypeError("invalid receiver");return Cr(K(this,j),this)}get monthCode(){if(!At(this))throw new TypeError("invalid receiver");return Ar(K(this,j),this)}get calendarId(){if(!At(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get era(){if(!At(this))throw new TypeError("invalid receiver");return Lr(K(this,j),this)}get eraYear(){if(!At(this))throw new TypeError("invalid receiver");return Pr(K(this,j),this)}get daysInMonth(){if(!At(this))throw new TypeError("invalid receiver");return Yr(K(this,j),this)}get daysInYear(){if(!At(this))throw new TypeError("invalid receiver");return Wr(K(this,j),this)}get monthsInYear(){if(!At(this))throw new TypeError("invalid receiver");return zr(K(this,j),this)}get inLeapYear(){if(!At(this))throw new TypeError("invalid receiver");return Gr(K(this,j),this)}with(e,t){if(!At(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid argument");Pt(e);const r=eo(t),n=K(this,j),i=kr(n,["month","monthCode","year"]);let o=ar(this,i,[]);return o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,[]),tn(n,o,r)}add(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ai("add",this,e,t)}subtract(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ai("subtract",this,e,t)}until(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ei("until",this,e,t)}since(e,t){if(!At(this))throw new TypeError("invalid receiver");return Ei("since",this,e,t)}equals(e){if(!At(this))throw new TypeError("invalid receiver");const t=mr(e);for(const e of [b$2,_,E$1])if(K(this,e)!==K(t,e))return !1;return Zr(K(this,j),K(t,j))}toString(e){if(!At(this))throw new TypeError("invalid receiver");return xn(this,Qt(eo(e)))}toJSON(){if(!At(this))throw new TypeError("invalid receiver");return xn(this)}toLocaleString(e,t){if(!At(this))throw new TypeError("invalid receiver");return new jo(e,t).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!At(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("argument should be an object");const t=K(this,j),r=kr(t,["monthCode","year"]),n=ar(this,r,[]),i=kr(t,["day"]);let o=jr(t,n,ar(e,i,[]));o=ar(o,[...new Set([...r,...i])],[]);const a=Ja(null);return a.overflow="reject",en(t,o,a)}getISOFields(){if(!At(this))throw new TypeError("invalid receiver");return {calendar:K(this,j),isoDay:K(this,E$1),isoMonth:K(this,_),isoYear:K(this,b$2)}}getCalendar(){if(!At(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}static from(e,t){const r=eo(t);return At(e)?(Gt(r),Ir(K(e,b$2),K(e,_),K(e,j),K(e,E$1))):mr(e,r)}static compare(e,t){const r=mr(e),n=mr(t);return zi(K(r,b$2),K(r,_),K(r,E$1),K(n,b$2),K(n,_),K(n,E$1))}}f$2(Va,"Temporal.PlainYearMonth");const Qa=jo.prototype.resolvedOptions,Za=Object.create;class Ka{constructor(e,t,r="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");Sr(this,Qi(e),nn(t),Hr(r));}get calendarId(){if(!Lt(this))throw new TypeError("invalid receiver");return Vr(K(this,j))}get timeZoneId(){if(!Lt(this))throw new TypeError("invalid receiver");return on(K(this,A$1))}get year(){if(!Lt(this))throw new TypeError("invalid receiver");return Or(K(this,j),Xa(this))}get month(){if(!Lt(this))throw new TypeError("invalid receiver");return Cr(K(this,j),Xa(this))}get monthCode(){if(!Lt(this))throw new TypeError("invalid receiver");return Ar(K(this,j),Xa(this))}get day(){if(!Lt(this))throw new TypeError("invalid receiver");return Mr(K(this,j),Xa(this))}get hour(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),T$1)}get minute(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),x$1)}get second(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),I$1)}get millisecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),S$1)}get microsecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),R)}get nanosecond(){if(!Lt(this))throw new TypeError("invalid receiver");return K(Xa(this),k)}get era(){if(!Lt(this))throw new TypeError("invalid receiver");return Lr(K(this,j),Xa(this))}get eraYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Pr(K(this,j),Xa(this))}get epochSeconds(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Ue))}get epochMilliseconds(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,v$1);return d$1.toNumber(Hi(e,Fe))}get epochMicroseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return Vi(Hi(K(this,v$1),$e))}get epochNanoseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return Vi(K(this,v$1))}get dayOfWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return Br(K(this,j),Xa(this))}get dayOfYear(){if(!Lt(this))throw new TypeError("invalid receiver");return $r(K(this,j),Xa(this))}get weekOfYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Fr(K(this,j),Xa(this))}get yearOfWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return Ur(K(this,j),Xa(this))}get hoursInDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=m$1("%Temporal.PlainDateTime%"),r=K(e,b$2),n=K(e,_),i=K(e,E$1),o=new t(r,n,i,0,0,0,0,0,0),a=xi(r,n,i,0,0,0,1,"reject"),s=new t(a.year,a.month,a.day,0,0,0,0,0,0),l=K(this,A$1),u=K(fn(l,o,"compatible"),v$1),c=K(fn(l,s,"compatible"),v$1);return Ji(d$1.subtract(c,u),Ye)}get daysInWeek(){if(!Lt(this))throw new TypeError("invalid receiver");return qr(K(this,j),Xa(this))}get daysInMonth(){if(!Lt(this))throw new TypeError("invalid receiver");return Yr(K(this,j),Xa(this))}get daysInYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Wr(K(this,j),Xa(this))}get monthsInYear(){if(!Lt(this))throw new TypeError("invalid receiver");return zr(K(this,j),Xa(this))}get inLeapYear(){if(!Lt(this))throw new TypeError("invalid receiver");return Gr(K(this,j),Xa(this))}get offset(){if(!Lt(this))throw new TypeError("invalid receiver");return dn(K(this,A$1),K(this,C$1))}get offsetNanoseconds(){if(!Lt(this))throw new TypeError("invalid receiver");return cn(K(this,A$1),K(this,C$1))}with(e,t){if(!Lt(this))throw new TypeError("invalid receiver");if(!it(e))throw new TypeError("invalid zoned-date-time-like");Pt(e);const r=eo(t),n=K(this,j);let i=kr(n,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);i.push("offset");let o=ar(this,i,["offset"]);o=jr(n,o,ar(e,i,"partial")),o=ar(o,i,["offset"]);const a=Ht(r),s=Vt(r,"prefer");let{year:l,month:u,day:c,hour:d,minute:h,second:f,millisecond:p,microsecond:m,nanosecond:y}=ur(n,o,r);const g=Rn(o.offset),v=K(this,A$1);return Rr(yr(l,u,c,d,h,f,p,m,y,"option",g,v,a,s,!1),v,n)}withPlainDate(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=lr(e),r=K(t,b$2),n=K(t,_),i=K(t,E$1);let o=K(t,j);const a=Xa(this),s=K(a,T$1),l=K(a,x$1),u=K(a,I$1),c=K(a,S$1),d=K(a,R),h=K(a,k);o=Xr(K(this,j),o);const f=K(this,A$1);return Rr(K(fn(f,new(m$1("%Temporal.PlainDateTime%"))(r,n,i,s,l,u,c,d,h,o),"compatible"),v$1),f,o)}withPlainTime(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=m$1("%Temporal.PlainTime%"),r=void 0===e?new t:pr(e),n=Xa(this),i=K(n,b$2),o=K(n,_),a=K(n,E$1),s=K(this,j),l=K(r,T$1),u=K(r,x$1),c=K(r,I$1),d=K(r,S$1),h=K(r,R),f=K(r,k),p=K(this,A$1);return Rr(K(fn(p,new(m$1("%Temporal.PlainDateTime%"))(i,o,a,l,u,c,d,h,f,s),"compatible"),v$1),p,s)}withTimeZone(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=nn(e);return Rr(K(this,v$1),t,K(this,j))}withCalendar(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=Hr(e);return Rr(K(this,v$1),K(this,A$1),t)}add(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Mi("add",this,e,t)}subtract(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Mi("subtract",this,e,t)}until(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Ti("until",this,e,t)}since(e,t){if(!Lt(this))throw new TypeError("invalid receiver");return Ti("since",this,e,t)}round(e){if(!Lt(this))throw new TypeError("invalid receiver");if(void 0===e)throw new TypeError("options parameter is required");const t="string"==typeof e?to("smallestUnit",e):eo(e),r=Zt(t),n=Jt(t,"halfExpand"),i=rr(t,"smallestUnit","time",tr,["day"]),o={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];Kt(r,o,1===o);const a=Xa(this);let s=K(a,b$2),l=K(a,_),u=K(a,E$1),c=K(a,T$1),h=K(a,x$1),f=K(a,I$1),p=K(a,S$1),y=K(a,R),g=K(a,k);const w=m$1("%Temporal.PlainDateTime%"),D=K(this,A$1),N=K(this,j),O=fn(D,new w(K(a,b$2),K(a,_),K(a,E$1),0,0,0,0,0,0),"compatible"),M=ji(O,D,N,0,0,0,1,0,0,0,0,0,0),L=d$1.subtract(M,d$1.BigInt(K(O,v$1)));if(d$1.lessThanOrEqual(L,Me))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero or negative length days");return ({year:s,month:l,day:u,hour:c,minute:h,second:f,millisecond:p,microsecond:y,nanosecond:g}=Bi(s,l,u,c,h,f,p,y,g,r,i,n,d$1.toNumber(L))),Rr(yr(s,l,u,c,h,f,p,y,g,"option",cn(D,K(this,C$1)),D,"compatible","prefer",!1),D,K(this,j))}equals(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=gr(e),r=K(this,v$1),n=K(t,v$1);return !!d$1.equal(d$1.BigInt(r),d$1.BigInt(n))&&!!sn(K(this,A$1),K(t,A$1))&&Zr(K(this,j),K(t,j))}toString(e){if(!Lt(this))throw new TypeError("invalid receiver");const t=eo(e),r=Qt(t),n=Xt(t),i=function(e){return no(e,"offset",["auto","never"],"auto")}(t),o=Jt(t,"trunc"),a=rr(t,"smallestUnit","time",void 0);if("hour"===a)throw new RangeError('smallestUnit must be a time unit other than "hour"');const s=function(e){return no(e,"timeZoneName",["auto","never","critical"],"auto")}(t),{precision:l,unit:u,increment:c}=er(a,n);return In(this,l,r,s,i,{unit:u,increment:c,roundingMode:o})}toLocaleString(e,t){if(!Lt(this))throw new TypeError("invalid receiver");const r=eo(t),n=Za(null);if(St(n,r,["timeZone"]),void 0!==r.timeZone)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");void 0===n.year&&void 0===n.month&&void 0===n.day&&void 0===n.weekday&&void 0===n.dateStyle&&void 0===n.hour&&void 0===n.minute&&void 0===n.second&&void 0===n.timeStyle&&void 0===n.dayPeriod&&void 0===n.timeZoneName&&(n.timeZoneName="short");let i=on(K(this,A$1));if(Sn(i))throw new RangeError("toLocaleString does not support offset string time zones");i=kn(i),n.timeZone=i;const o=new jo(e,n),a=nt(Qa,o,[]).calendar,s=Vr(K(this,j));if("iso8601"!==s&&"iso8601"!==a&&a!==s)throw new RangeError(`cannot format ZonedDateTime with calendar ${s} in locale with calendar ${a}`);return o.format(K(this,C$1))}toJSON(){if(!Lt(this))throw new TypeError("invalid receiver");return In(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=m$1("%Temporal.PlainDateTime%"),r=K(this,j),n=new t(K(e,b$2),K(e,_),K(e,E$1),0,0,0,0,0,0,r),i=K(this,A$1);return Rr(K(fn(i,n,"compatible"),v$1),i,r)}toInstant(){if(!Lt(this))throw new TypeError("invalid receiver");return new(m$1("%Temporal.Instant%"))(K(this,v$1))}toPlainDate(){if(!Lt(this))throw new TypeError("invalid receiver");return ln(Xa(this))}toPlainTime(){if(!Lt(this))throw new TypeError("invalid receiver");return un(Xa(this))}toPlainDateTime(){if(!Lt(this))throw new TypeError("invalid receiver");return Xa(this)}toPlainYearMonth(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,j);return tn(e,ar(this,kr(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!Lt(this))throw new TypeError("invalid receiver");const e=K(this,j);return rn(e,ar(this,kr(e,["day","monthCode"]),[]))}getISOFields(){if(!Lt(this))throw new TypeError("invalid receiver");const e=Xa(this),t=K(this,A$1);return {calendar:K(this,j),isoDay:K(e,E$1),isoHour:K(e,T$1),isoMicrosecond:K(e,R),isoMillisecond:K(e,S$1),isoMinute:K(e,x$1),isoMonth:K(e,_),isoNanosecond:K(e,k),isoSecond:K(e,I$1),isoYear:K(e,b$2),offset:dn(t,K(this,C$1)),timeZone:t}}getCalendar(){if(!Lt(this))throw new TypeError("invalid receiver");return Qr(K(this,j))}getTimeZone(){if(!Lt(this))throw new TypeError("invalid receiver");return an(K(this,A$1))}static from(e,t){const r=eo(t);return Lt(e)?(Ht(r),Vt(r,"reject"),Gt(r),Rr(K(e,v$1),K(e,A$1),K(e,j))):gr(e,r)}static compare(e,t){const r=gr(e),n=gr(t),i=K(r,v$1),o=K(n,v$1);return d$1.lessThan(d$1.BigInt(i),d$1.BigInt(o))?-1:d$1.greaterThan(d$1.BigInt(i),d$1.BigInt(o))?1:0}}function Xa(e){return hn(K(e,A$1),K(e,C$1),K(e,j))}f$2(Ka,"Temporal.ZonedDateTime");var es=Object.freeze({__proto__:null,Calendar:ra,Duration:La,Instant:qo,Now:Ya,PlainDate:Aa,PlainDateTime:Ma,PlainMonthDay:Ba,PlainTime:Ga,PlainYearMonth:Va,TimeZone:Ha,ZonedDateTime:Ka});const ts=[qo,ra,Aa,Ma,La,Ba,Ga,Ha,Va,Ka];for(const e of ts){const t=Object.getOwnPropertyDescriptor(e,"prototype");(t.configurable||t.enumerable||t.writable)&&(t.configurable=!1,t.enumerable=!1,t.writable=!1,Object.defineProperty(e,"prototype",t));}var rs,ns;!function(e){e.BlankNode="BlankNode",e.IRI="NamedNode",e.Literal="Literal",e.Undefined="Undefined";}(rs||(rs={})),function(e){e.Boolean="http://www.w3.org/2001/XMLSchema#boolean",e.Integer="http://www.w3.org/2001/XMLSchema#integer",e.NonNegativeInteger="http://www.w3.org/2001/XMLSchema#nonNegativeInteger",e.NonPositiveInteger="http://www.w3.org/2001/XMLSchema#nonPositiveInteger",e.NegativeInteger="http://www.w3.org/2001/XMLSchema#negativeInteger",e.PositiveInteger="http://www.w3.org/2001/XMLSchema#positiveInteger",e.DateTime="http://www.w3.org/2001/XMLSchema#dateTime",e.Double="http://www.w3.org/2001/XMLSchema#double";}(ns||(ns={}));const is=e=>e.toExponential(15).replace(/(\d)0*e\+?/,"$1E");function os(e){if(!e.graph.value)return i.DEFAULT_GRAPH_NODE_NAME;if("BlankNode"!==e.graph.termType)throw new Error("graph node is not of BlankNode type");return e.graph.value}const as=e=>e.sort(((e,t)=>e<t?-1:e>t?1:0)),ss=new TextEncoder,ls=e=>{const t=e/2n;return {min:t-e+1n,max:t}};const us=(e,t,r)=>{switch(e){case ns.Boolean:switch(t){case"false":case"0":return !1;case"true":case"1":return !0;default:throw new Error("incorrect boolean value")}case ns.Integer:case ns.NonNegativeInteger:case ns.NonPositiveInteger:case ns.NegativeInteger:case ns.PositiveInteger:const n=BigInt(t),{min:i,max:o}=function(e,t){switch(e){case ns.PositiveInteger:return {min:1n,max:t-1n};case ns.NonNegativeInteger:return {min:0n,max:t-1n};case ns.Integer:return ls(t);case ns.NegativeInteger:return {min:ls(t).min,max:-1n};case ns.NonPositiveInteger:return {min:ls(t).min,max:0n};default:throw new Error(`unsupported XSD type: ${e}`)}}(e,r);if(n>o)throw new Error(`integer exceeds maximum value: ${n}`);if(n<i)throw new Error(`integer is below minimum value: ${n}`);return n;case ns.DateTime:if(isNaN(Date.parse(t)))throw new Error(`error: error parsing time string ${t}`);return /^\d{4}-\d{2}-\d{2}$/.test(t)?es.Instant.from(new Date(t).toISOString()):es.Instant.from(t);case ns.Double:return is(parseFloat(t));default:return t}};var cs;const ds=new TextEncoder;class hs{constructor(e,t=a){this.value=e,this.h=t;}isString(){return "string"==typeof this.value}asString(){if(!this.isString())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value.toString()}isTime(){return this.value instanceof es.Instant}asTime(){if(!this.isTime())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}isNumber(){return "number"==typeof this.value}asNumber(){if(!this.isNumber())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}isBool(){return "boolean"==typeof this.value}asBool(){if(!this.isBool())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}mtEntry(){return hs.mkValueMtEntry(this.h,this.value)}isBigInt(){return "bigint"==typeof this.value}asBigInt(){if(!this.isBigInt())throw i.ERRORS.MT_VALUE_INCORRECT_TYPE;return this.value}static async mkValueInt(e,t){return t>=0?BigInt(t):e.prime()+BigInt(t)}}cs=hs,hs.mkValueMtEntry=(e,t)=>{switch(typeof t){case"number":return hs.mkValueInt(e,t);case"string":return hs.mkValueString(e,t);case"boolean":return hs.mkValueBool(e,t);case"bigint":return hs.mkValueBigInt(e,t);default:if(t instanceof es.Instant)return hs.mkValueTime(e,t);throw new Error("error: unexpected type "+typeof t)}},hs.mkValueUInt=(e,t)=>BigInt.asUintN(64,t),hs.mkValueBool=(e,t)=>t?e.hash([BigInt.asIntN(64,BigInt(1))]):e.hash([BigInt.asIntN(64,BigInt(0))]),hs.mkValueString=(e,t)=>e.hashBytes(ds.encode(t)),hs.mkValueTime=async(e,t)=>cs.mkValueInt(e,t.epochNanoseconds),hs.mkValueBigInt=async(e,t)=>{const r=e.prime();if(t>=r)throw new Error(`value is too big: ${t}`);if(t<0n){const{min:e}=ls(r);if(t<e)throw new Error(`value is too small: ${t}`);return t+r}return t};var fs$2={},ps=class e{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r;}clone(){const{prefix:t,_existing:r,counter:n}=this;return new e(t,new Map(r),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return [...this._existing.keys()]}};
7777
7846
  /*!
7778
7847
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
7779
7848
  */
@@ -7846,7 +7915,7 @@ var PolygonIdSdk = (function (exports) {
7846
7915
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
7847
7916
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7848
7917
  */
7849
- const dh=Vs,hh=Ml,fh=hl,ph=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e;}async resolve({activeCtx:e,context:t,documentLoader:r,base:n,cycles:i=new Set}){t&&uu(t)&&t["@context"]&&(t=t["@context"]),t=du(t);const o=[];for(const a of t){if(cu(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:r,base:n,cycles:i})),lu(t)?o.push(...t):o.push(t);continue}if(null===a){o.push(new pu({document:null}));continue}uu(a)||mu(t);const s=JSON.stringify(a);let l=this._get(s);l||(l=new pu({document:a}),this._cacheResolvedContext({key:s,resolved:l,tag:"static"})),o.push(l);}return o}_get(e){let t=this.perOpCache.get(e);if(!t){const r=this.sharedCache.get(e);r&&(t=r.get("static"),t&&this.perOpCache.set(e,t));}return t}_cacheResolvedContext({key:e,resolved:t,tag:r}){if(this.perOpCache.set(e,t),void 0!==r){let n=this.sharedCache.get(e);n||(n=new Map,this.sharedCache.set(e,n)),n.set(r,t);}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:r,base:n,cycles:i}){t=hu(n,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:i});yu({context:o,base:n=a.documentUrl||t});const s=await this.resolve({activeCtx:e,context:o,documentLoader:r,base:n,cycles:i});return this._cacheResolvedContext({key:t,resolved:s,tag:a.tag}),s}async _fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:n}){if(n.size>10)throw new fu("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(n.has(t))throw new fu("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let i,o;n.add(t);try{o=await r(t),i=o.document||null,cu(i)&&(i=JSON.parse(i));}catch(e){throw new fu("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!uu(i))throw new fu("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:t});return i="@context"in i?{"@context":i["@context"]}:{"@context":{}},o.contextUrl&&(lu(i["@context"])||(i["@context"]=[i["@context"]]),i["@context"].push(o.contextUrl)),{context:i,remoteDoc:o}}},mh=fh.IdentifierIssuer,yh=tl,gh=au,vh=gu,{expand:wh}=pc,{flatten:bh}=Dc,{fromRDF:_h}=Jc,{toRDF:Eh}=yd,{frameMergedOrDefault:Th,cleanupNull:xh}=kd,{isArray:Ih,isObject:Sh,isString:Rh}=Zs,{isSubjectReference:kh}=el,{expandIri:jh,getInitialContext:Dh,process:Nh,processingMode:Oh}=Uu,{compact:Ch,compactIri:Ah}=uh,{createNodeMap:Mh,createMergedNodeMap:Lh,mergeNodeMaps:Ph}=Sc,{logEventHandler:Bh,logWarningEventHandler:$h,safeEventHandler:Fh,setDefaultEventHandler:Uh,setupEventHandler:qh,strictEventHandler:Yh,unhandledEventHandler:Wh}=Eu,zh=function(e){const t={},r=new gh({max:100});function n(t,{documentLoader:r=e.documentLoader,...n}){if(t&&"compactionMap"in t)throw new yh('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new yh('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:r},n,t,{eventHandler:qh({options:t})})}return e.compact=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===i)throw new yh("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let a;(o=n(o,{base:Rh(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new mh("_:b"),contextResolver:new ph({sharedCache:r})})).link&&(o.skipExpansion=!0),o.compactToRelative||delete o.base,a=o.skipExpansion?t:await e.expand(t,o);const s=await e.processContext(Dh(o),i,o);let l=await Ch({activeCtx:s,element:a,options:o});o.compactArrays&&!o.graph&&Ih(l)?1===l.length?l=l[0]:0===l.length&&(l={}):o.graph&&Sh(l)&&(l=[l]),Sh(i)&&"@context"in i&&(i=i["@context"]),i=fh.clone(i),Ih(i)||(i=[i]);const u=i;i=[];for(let e=0;e<u.length;++e)(!Sh(u[e])||Object.keys(u[e]).length>0)&&i.push(u[e]);const c=i.length>0;if(1===i.length&&(i=i[0]),Ih(l)){const e=Ah({activeCtx:s,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},c&&(l["@context"]=i),l[e]=t;}else if(Sh(l)&&c){const e=l;l={"@context":i};for(const t in e)l[t]=e[t];}return l},e.expand=async function(t,i){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const o={},a=[];if("expandContext"in(i=n(i,{keepFreeFloatingNodes:!1,contextResolver:new ph({sharedCache:r})}))){const e=fh.clone(i.expandContext);Sh(e)&&"@context"in e?o.expandContext=e:o.expandContext={"@context":e},a.push(o.expandContext);}let s;if(Rh(t)){const r=await e.get(t,i);s=r.documentUrl,o.input=r.document,r.contextUrl&&(o.remoteContext={"@context":r.contextUrl},a.push(o.remoteContext));}else o.input=fh.clone(t);"base"in i||(i.base=s||"");let l=Dh(i);for(const e of a)l=await Nh({activeCtx:l,localCtx:e,options:i});let u=await wh({activeCtx:l,element:o.input,options:i});return Sh(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),Ih(u)||(u=[u]),u},e.flatten=async function(t,i,o){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");i="function"==typeof i?null:i||null,o=n(o,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const a=await e.expand(t,o),s=bh(a);if(null===i)return s;o.graph=!0,o.skipExpansion=!0;return await e.compact(s,i,o)},e.frame=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(o=n(o,{base:Rh(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new ph({sharedCache:r})}),Rh(i)){const t=await e.get(i,o);if(i=t.document,t.contextUrl){let e=i["@context"];e?Ih(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,i["@context"]=e;}}const a=i&&i["@context"]||{},s=await e.processContext(Dh(o),a,o);o.hasOwnProperty("omitGraph")||(o.omitGraph=Oh(s,1.1)),o.hasOwnProperty("pruneBlankNodeIdentifiers")||(o.pruneBlankNodeIdentifiers=Oh(s,1.1));const l=await e.expand(t,o),u={...o};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(i,u),d=Object.keys(i).map((e=>jh(s,e,{vocab:!0})));u.merged=!d.includes("@graph"),u.is11=Oh(s,1.1);const h=Th(l,c,u);u.graph=!o.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let f=await e.compact(h,a,u);return u.link={},f=xh(f,u),f},e.link=async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)},e.normalize=e.canonize=async function(t,i){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(i=n(i,{base:Rh(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new ph({sharedCache:r})}))){if("application/n-quads"!==i.inputFormat&&"application/nquads"!==i.inputFormat)throw new yh("Unknown canonicalization input format.","jsonld.CanonizeError");const e=vh.parse(t);return dh.canonize(e,i)}const o={...i};delete o.format,o.produceGeneralizedRdf=!1;const a=await e.toRDF(t,o);return dh.canonize(a,i)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=n(r,{format:Rh(e)?"application/n-quads":void 0});const{format:i}=r;let{rdfParser:o}=r;if(i){if(o=o||t[i],!o)throw new yh("Unknown input format.","jsonld.UnknownFormat",{format:i})}else o=()=>e;const a=await o(e);return _h(a,r)},e.toRDF=async function(t,i){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let o;o=(i=n(i,{base:Rh(t)?t:"",skipExpansion:!1,contextResolver:new ph({sharedCache:r})})).skipExpansion?t:await e.expand(t,i);const a=Eh(o,i);if(i.format){if("application/n-quads"===i.format||"application/nquads"===i.format)return vh.serialize(a);throw new yh("Unknown output format.","jsonld.UnknownFormat",{format:i.format})}return a},e.createNodeMap=async function(t,i){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");i=n(i,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const o=await e.expand(t,i);return Lh(o,i)},e.merge=async function(t,i,o){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!Ih(t))throw new TypeError('Could not merge, "docs" must be an array.');i="function"==typeof i?null:i||null,o=n(o,{contextResolver:new ph({sharedCache:r})});const a=await Promise.all(t.map((t=>{const r={...o};return e.expand(t,r)})));let s=!0;"mergeNodes"in o&&(s=o.mergeNodes);const l=o.issuer||new mh("_:b"),u={"@default":{}};for(let e=0;e<a.length;++e){const t=fh.relabelBlankNodes(a[e],{issuer:new mh("_:b"+e+"-")}),r=s||0===e?u:{"@default":{}};if(Mh(t,r,"@default",l),r!==u)for(const e in r){const t=r[e];if(!(e in u)){u[e]=t;continue}const n=u[e];for(const e in t)e in n||(n[e]=t[e]);}}const c=Ph(u),d=[],h=Object.keys(c).sort();for(let e=0;e<h.length;++e){const t=c[h[e]];kh(t)||d.push(t);}if(null===i)return d;o.graph=!0,o.skipExpansion=!0;return await e.compact(d,i,o)},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new yh("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,r){let n;n="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const i=await n(t);try{if(!i.document)throw new yh("No remote document found at the given URL.","jsonld.NullRemoteDocument");Rh(i.document)&&(i.document=JSON.parse(i.document));}catch(e){throw new yh("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,i){return i=n(i,{base:"",contextResolver:new ph({sharedCache:r})}),null===t?Dh(i):(t=fh.clone(t),Sh(t)&&"@context"in t||(t={"@context":t}),Nh({activeCtx:e,localCtx:t,options:i}))},e.getContextValue=Uu.getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new yh('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1));},e.registerRDFParser=function(e,r){t[e]=r;},e.unregisterRDFParser=function(e){delete t[e];},e.registerRDFParser("application/n-quads",vh.parse),e.registerRDFParser("application/nquads",vh.parse),e.url=El,e.logEventHandler=Bh,e.logWarningEventHandler=$h,e.safeEventHandler=Fh,e.setDefaultEventHandler=Uh,e.strictEventHandler=Yh,e.unhandledEventHandler=Wh,e.util=fh,Object.assign(e,fh),e.promises=e,e.RequestQueue=wl(),e.JsonLdProcessor=(lh||(lh=1,sh=e=>{class t{toString(){return "[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}),sh)(e),hh.setupGlobals(e),hh.setupDocumentLoaders(e),e},Gh=function(){return zh((function(){return Gh()}))};zh(Gh);var Hh=Gh;function Jh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vh={exports:{}};Vh.exports=function(){function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){if(!s&&Jh)return Jh(a);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,r,n);}return r[a].exports}for(var o=Jh,a=0;a<n.length;a++)i(n[a]);return i}return e}()({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",o="http://www.w3.org/2000/10/swap/";r.default={xsd:{decimal:`${i}decimal`,boolean:`${i}boolean`,double:`${i}double`,integer:`${i}integer`,string:`${i}string`},rdf:{type:`${n}type`,nil:`${n}nil`,first:`${n}first`,rest:`${n}rest`,langString:`${n}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${o}reify#forSome`,forAll:`${o}reify#forAll`},log:{implies:`${o}log#implies`}};},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Variable=r.Triple=r.Term=r.Quad=r.NamedNode=r.Literal=r.DefaultGraph=r.BlankNode=void 0,r.escapeQuotes=b,r.termFromId=g,r.termToId=v,r.unescapeQuotes=_;var n=i(e("./IRIs"));function i(e){return e&&e.__esModule?e:{default:e}}const{rdf:o,xsd:a}=n.default;let s,l=0;const u=/^"(.*".*)(?="[^"]*$)/,c={namedNode:E,blankNode:T,variable:I,literal:x,defaultGraph:S,quad:R,triple:R};r.default=c;class d{constructor(e){this.id=e;}get value(){return this.id}equals(e){return e instanceof d?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return {termType:this.termType,value:this.value}}}r.Term=d;class h extends d{get termType(){return "NamedNode"}}r.NamedNode=h;class f extends d{get termType(){return "Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return "^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof f?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return {termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}r.Literal=f;class p extends d{constructor(e){super(`_:${e}`);}get termType(){return "BlankNode"}get value(){return this.id.substr(2)}}r.BlankNode=p;class m extends d{constructor(e){super(`?${e}`);}get termType(){return "Variable"}get value(){return this.id.substr(1)}}r.Variable=m;class y extends d{constructor(){return super(""),s||this}get termType(){return "DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}function g(e,t,r){if(t=t||c,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===c)return new f(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const n=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,n-1),"@"===e[n+1]?e.substr(n+2):t.namedNode(e.substr(n+3)));case"[":e=JSON.parse(e);break;default:if(!r||!Array.isArray(e))return t.namedNode(e)}return t.quad(g(e[0],t,!0),g(e[1],t,!0),g(e[2],t,!0),e[3]&&g(e[3],t,!0))}function v(e,t){if("string"==typeof e)return e;if(e instanceof d&&"Quad"!==e.termType)return e.id;if(!e)return s.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return `_:${e.value}`;case"Variable":return `?${e.value}`;case"DefaultGraph":return "";case"Literal":return `"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==a.string?`^^${e.datatype.value}`:""}`;case"Quad":const r=[v(e.subject,!0),v(e.predicate,!0),v(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&r.push(v(e.graph,!0)),t?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${e.termType}`)}}r.DefaultGraph=y,s=new y;class w extends d{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s;}get termType(){return "Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return {termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return !!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function b(e){return e.replace(u,((e,t)=>`"${t.replace(/"/g,'""')}`))}function _(e){return e.replace(u,((e,t)=>`"${t.replace(/""/g,'"')}`))}function E(e){return new h(e)}function T(e){return new p(e||"n3-"+l++)}function x(e,t){if("string"==typeof t)return new f(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return ""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new f(`"${e}"`):new f(`"${e}"^^${r}`)}function I(e){return new m(e)}function S(){return s}function R(e,t,r,n){return new w(e,t,r,n)}r.Triple=r.Quad=w;},{"./IRIs":1}],3:[function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=o(e("queue-microtask")),i=o(e("./IRIs"));function o(e){return e&&e.__esModule?e:{default:e}}const{xsd:a}=i.default,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,l={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},u=/[\x00-\x20<>\\"\{\}\|\^\`]/,c={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},d=/$0^/;class h{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in c)&&this[e]instanceof RegExp&&(this[e]=d);}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0;}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this._comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this._comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const l=this._line,c=r[0];let d="",h="",f="",p=null,m=0,y=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(m=1,d="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(r))d="IRI",h=p[1];else if(p=this._iri.exec(r)){if(h=this._unescape(p[1]),null===h||u.test(h))return o(this);d="IRI";}else r.length>1&&"<"===r[1]?(d="<<",m=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d="inverse",m=2,h=">");break;case">":r.length>1&&">"===r[1]&&(d=">>",m=2);break;case"_":((p=this._blank.exec(r))||t&&(p=this._blank.exec(`${r} `)))&&(d="blank",f="_",h=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);}break;case"?":this._n3Mode&&(p=this._variable.exec(r))&&(d="var",h=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(r))?(d="langcode",h=p[1]):(p=this._keyword.exec(r))&&(d=p[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){d=".",m=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(r)||t&&(p=this._number.exec(`${r} `)))&&(d="literal",h=p[0],f="string"==typeof p[1]?a.double:"string"==typeof p[2]?a.decimal:a.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(r))?d=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(r))?(d="literal",h=p[0],f=a.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(r))?(d="abbreviation",h="a"):y=!0;break;case"=":this._n3Mode&&r.length>1&&(d="abbreviation",">"!==r[1]?(m=1,h="="):(m=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(m=1,d=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(d="{|",m=2):(d=c,m=1));break;case"|":r.length>=2&&"}"===r[1]&&(d="|}",m=2);break;default:y=!0;}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(r))?((p=this._prefixed.exec(r))||t&&(p=this._prefixed.exec(`${r} `)))&&(d="prefixed",f=p[1]||"",h=this._unescape(p[2])):(d="prefix",h=p[1]||"")),"^^"===this._previousMarker)switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d="";}if(!d)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const g=m||p[0].length,v=i(d,h,f,l,g);this.previousToken=v,this._previousMarker=d,r=r.substr(g,r.length);}function i(t,i,o,a,s){const l=r?n-r.length:n,u={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,u),u}function o(t){e(t._syntaxError(/^\S*/.exec(r)[0]));}}_unescape(e){let t=!1;const r=e.replace(s,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in l?l[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}n++;}this._literalClosingPos=e.length-r+1;}return {value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,r){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof r){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}(0, n.default)((()=>this._tokenizeToEnd(r,!0)));}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=t.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(r,!1)));})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(r,!0);})),e.on("error",r);}}r.default=h;}).call(this);}).call(this,e("buffer").Buffer);},{"./IRIs":1,buffer:15,"queue-microtask":19}],4:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=a(e("./N3Lexer")),i=a(e("./N3DataFactory")),o=a(e("./IRIs"));function a(e){return e&&e.__esModule?e:{default:e}}let s=0;class l{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&c(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),l=o||a;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||o||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new n.default({lineMode:l,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers;}static _resetBlankNodePrefix(){s=0;}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1];}else this._base="",this._basePath="";}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified));}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified);}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return !t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return "{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return "{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return "]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph);}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null;}return {token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return "}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r);}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return "."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return "prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return "]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return ","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph);}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return ">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH));}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=u;}_resolveIRI(e){return /^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return ("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return /^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return `${r}/${e.substr(n+1)}`;o=n+1;}}}a=e[++n];}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${s++}_`,this._prefixCallback=r||u,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n);},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=u):this._readCallback&&(this._readCallback=this._readCallback(t));}));}}function u(){}function c(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(o.default.rdf.first),e.RDF_REST=r(o.default.rdf.rest),e.RDF_NIL=r(o.default.rdf.nil),e.N3_FORALL=r(o.default.r.forAll),e.N3_FORSOME=r(o.default.r.forSome),e.ABBREVIATIONS={a:r(o.default.rdf.type),"=":r(o.default.owl.sameAs),">":r(o.default.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers");}r.default=l,c(l.prototype,i.default);},{"./IRIs":1,"./N3DataFactory":2,"./N3Lexer":3}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=u(e("./N3DataFactory")),o=s(e("./IRIs")),a=e("./N3Util");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (l=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}class c{constructor(e,t){this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._entities=Object.create(null),this._blankNodeIndex=0,t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||i.default,e&&this.addQuads(e);}_termFromId(e,t){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return (0, i.termFromId)(e,t)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&((0, a.isDefaultGraph)(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[(0, i.termToId)(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${(0, a.isDefaultGraph)(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:(0, i.termToId)(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t];}*_findInIndex(e,t,r,n,i,o,a,s){let l,u,c;const d=this._entities,h=this._termFromId(s,this._factory),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(u=e[t]){f[i]=this._termFromId(d[t],this._factory),r&&((l=u,u={})[r]=l[r]);for(const e in u)if(c=u[e]){f[o]=this._termFromId(d[e],this._factory);const t=n?n in c?[n]:[]:Object.keys(c);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]],this._factory),yield this._factory.quad(f.subject,f.predicate,f.object,h);}}}_loop(e,t){for(const r in e)t(r);}_loopByKey0(e,t,r){let n,i;if(n=e[t])for(i in n)r(i);}_loopByKey1(e,t,r){let n,i;for(n in e)i=e[n],i[t]&&r(n);}_loopBy2Keys(e,t,r,n){let i,o,a;if((i=e[t])&&(o=i[r]))for(a in o)n(a);}_countInIndex(e,t,r,n){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){r&&((i=o,o={})[r]=i[r]);for(const e in o)(a=o[e])&&(n?n in a&&s++:s+=Object.keys(a).length);}return s}_getGraphs(e){if(!d(e))return this._graphs;const t={};return t[e]=this._graphs[e],t}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)));}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);let o=this._graphs[n];o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r);const a=this._addToIndex(o.subjects,e,t,r);return this._addToIndex(o.predicates,t,r,e),this._addToIndex(o.objects,r,e,t),this._size=null,a}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}delete(e){return this.removeQuad(e),this}has(e,t,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}importStream(e){return e.on("data",(e=>{this.addQuad(e);})),e}removeQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);const o=this._graphs;let a,s,l;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(a=o[n])&&(s=a.subjects[e])&&(l=s[t])&&r in l))return !1;for(e in this._removeFromIndex(a.subjects,e,t,r),this._removeFromIndex(a.predicates,t,r,e),this._removeFromIndex(a.objects,r,e,t),null!==this._size&&this._size--,a.subjects)return !0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t]);}remove(e){return e.on("data",(e=>{this.removeQuad(e);})),e}removeMatches(e,t,r,i){const o=new n.Readable({objectMode:!0});return o._read=()=>{for(const n of this.readQuads(e,t,r,i))o.push(n);o.push(null);},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return [...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u;if(!(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(const e in o)(a=o[e])&&(s?u?yield*this._findInIndex(a.objects,u,s,l,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,s,l,null,"subject","predicate","object",e):l?yield*this._findInIndex(a.predicates,l,u,null,"predicate","object","subject",e):u?yield*this._findInIndex(a.objects,u,null,null,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",e));}match(e,t,r,n){return new h(this,e,t,r,n)}countQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u,c=0;if(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r)))return 0;for(const n in o)(a=o[n])&&(c+=e?r?this._countInIndex(a.objects,u,s,l):this._countInIndex(a.subjects,s,l,u):t?this._countInIndex(a.predicates,l,u,s):this._countInIndex(a.objects,u,s,l));return c}forEach(e,t,r,n,i){this.some((t=>(e(t),!1)),t,r,n,i);}every(e,t,r,n,i){let o=!1;const a=!this.some((t=>(o=!0,!e(t))),t,r,n,i);return o&&a}some(e,t,r,n,i){for(const o of this.readQuads(t,r,n,i))if(e(o))return !0;return !1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e);}),e,t,r),n}forSubjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.predicates,s,l,e):this._loopByKey1(a.subjects,s,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e));}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e);}),e,t,r),n}forPredicates(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.objects,l,s,e):this._loopByKey0(a.subjects,s,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e));}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e);}),e,t,r),n}forObjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.subjects,s,l,e):this._loopByKey1(a.objects,s,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e));}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e);}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,i);}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++;}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,o.default.rdf.rest,o.default.rdf.nil,null),a=e?[...i]:[];return i.forEach((t=>{const i=[];let s,l,u=!1;const c=t.graph;let d=t.subject;for(;d&&!u;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,f=null,p=null;for(let i=0;i<t.length&&!u;i++)r=t[i],r.graph.equals(c)?s?u=n(d,"has non-list arcs out"):r.predicate.value===o.default.rdf.first?h?u=n(d,"has multiple rdf:first arcs"):a.push(h=r):r.predicate.value===o.default.rdf.rest?f?u=n(d,"has multiple rdf:rest arcs"):a.push(f=r):e.length?u=n(d,"can't be subject and object"):(s=r,l="subject"):u=n(d,"not confined to single graph");for(let t=0;t<e.length&&!u;++t)r=e[t],s?u=n(d,"can't have coreferences"):r.predicate.value===o.default.rdf.rest?p?u=n(d,"has incoming rdf:rest arcs"):p=r:(s=r,l="object");h?i.unshift(h.object):u=n(d,"has no list head"),d=p&&p.subject;}u?e=!1:s&&(r[s[l].value]=i);})),e&&this.removeQuads(a),r}*[Symbol.iterator](){yield*this.readQuads();}}function d(e){return "string"==typeof e||e instanceof String}r.default=c;class h extends n.Readable{constructor(e,t,r,n,i){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:i});}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:i}=this,o=this._filtered=new c({factory:e._factory});for(const a of e.readQuads(i,n,r,t))o.addQuad(a);}return this._filtered}get size(){return this.filtered.size}_read(){for(const e of this)this.push(e);this.push(null);}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new h(this.filtered,e,t,r,n)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph);}}},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8,"readable-stream":38}],6:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Parser"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){let t,r;super({decodeStrings:!0}),this._readableState.objectMode=!0,new i.default(e).parse({on:(e,n)=>{switch(e){case"data":t=n;break;case"end":r=n;}}},((e,t)=>{e&&this.emit("error",e)||t&&this.push(t);}),((e,t)=>{this.emit("prefix",e,t);})),this._transform=(e,r,n)=>{t(e),n();},this._flush=e=>{r(),e();};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),this}}r.default=a;},{"./N3Parser":4,"readable-stream":38}],7:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Writer"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new i.default({write:(e,t,r)=>{this.push(e),r&&r();},end:e=>{this.push(null),e&&e();}},e);this._transform=(e,r,n)=>{t.addQuad(e,n);},this._flush=e=>{t.end(e);};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t);})),this}}r.default=a;},{"./N3Writer":9,"readable-stream":38}],8:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.inDefaultGraph=c,r.isBlankNode=a,r.isDefaultGraph=u,r.isLiteral=s,r.isNamedNode=o,r.isVariable=l,r.prefix=d,r.prefixes=h;var n=i(e("./N3DataFactory"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return !!e&&"NamedNode"===e.termType}function a(e){return !!e&&"BlankNode"===e.termType}function s(e){return !!e&&"Literal"===e.termType}function l(e){return !!e&&"Variable"===e.termType}function u(e){return !!e&&"DefaultGraph"===e.termType}function c(e){return u(e.graph)}function d(e,t){return h({"":e.value||e},t)("")}function h(e,t){const r=Object.create(null);for(const t in e)i(t,e[t]);function i(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e));}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||n.default,i}},{"./N3DataFactory":2}],9:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=l(e("./IRIs")),i=s(e("./N3DataFactory")),o=e("./N3Util");function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (a=function(e){return e?r:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const u=i.default.defaultGraph(),{rdf:c,xsd:d}=n.default,h=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,f=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,p={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class m extends i.Term{equals(e){return e===this}}class y{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else {let e="";this._outputStream={write(t,r,n){e+=t,n&&n();},end:t=>{t&&t(null,e);}},this._endStream=!0;}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=u,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${v(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length));}get _inDefaultGraph(){return u.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t);}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(u.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i);}catch(e){i&&i(e);}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i);}quadToString(e,t,r,n){return `${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return "Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),h.test(t)&&(t=t.replace(f,g));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(h.test(t)&&(t=t.replace(f,g)),e.language)return `"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===d.string)return `"${t}"`}else switch(e.datatype.value){case d.string:return `"${t}"`;case d.boolean:if("true"===t||"false"===t)return t;break;case d.integer:if(/^[+-]?\d+$/.test(t))return t;break;case d.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case d.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return `"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===c.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return `<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${(0, o.isDefaultGraph)(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,u,n):this._writeQuad(e,t,r,n||u,i);}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r);}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`);}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=v(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`);}this._write(r?"\n":"",t);}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new m("[]");case 1:if(r=i[0],!(r.object instanceof m))return new m(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=`, ${this._encodeObject(r.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new m(`${t}\n]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new m(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n);});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t();}}function g(e){let t=p[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function v(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}r.default=y;},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8}],10:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BlankNode",{enumerable:!0,get:function(){return c.BlankNode}}),Object.defineProperty(r,"DataFactory",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"DefaultGraph",{enumerable:!0,get:function(){return c.DefaultGraph}}),Object.defineProperty(r,"Lexer",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return c.Literal}}),Object.defineProperty(r,"NamedNode",{enumerable:!0,get:function(){return c.NamedNode}}),Object.defineProperty(r,"Parser",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"Quad",{enumerable:!0,get:function(){return c.Quad}}),Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"StreamParser",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"StreamWriter",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"Term",{enumerable:!0,get:function(){return c.Term}}),Object.defineProperty(r,"Triple",{enumerable:!0,get:function(){return c.Triple}}),r.Util=void 0,Object.defineProperty(r,"Variable",{enumerable:!0,get:function(){return c.Variable}}),Object.defineProperty(r,"Writer",{enumerable:!0,get:function(){return o.default}}),r.default=void 0,Object.defineProperty(r,"termFromId",{enumerable:!0,get:function(){return c.termFromId}}),Object.defineProperty(r,"termToId",{enumerable:!0,get:function(){return c.termToId}});var n=f(e("./N3Lexer")),i=f(e("./N3Parser")),o=f(e("./N3Writer")),a=f(e("./N3Store")),s=f(e("./N3StreamParser")),l=f(e("./N3StreamWriter")),u=h(e("./N3Util"));r.Util=u;var c=h(e("./N3DataFactory"));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (d=function(e){return e?r:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function f(e){return e&&e.__esModule?e:{default:e}}r.default={Lexer:n.default,Parser:i.default,Writer:o.default,Store:a.default,StreamParser:s.default,StreamWriter:l.default,Util:u,DataFactory:c.default,Term:c.Term,NamedNode:c.NamedNode,Literal:c.Literal,BlankNode:c.BlankNode,Variable:c.Variable,DefaultGraph:c.DefaultGraph,Quad:c.Quad,Triple:c.Triple,termFromId:c.termFromId,termToId:c.termToId};},{"./N3DataFactory":2,"./N3Lexer":3,"./N3Parser":4,"./N3Store":5,"./N3StreamParser":6,"./N3StreamWriter":7,"./N3Util":8,"./N3Writer":9}],11:[function(e,t,r){const{AbortController:n,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=n,t.exports.AbortSignal=i,t.exports.default=n;},{}],12:[function(e,t,r){r.byteLength=c,r.toByteArray=h,r.fromByteArray=m;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return -1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function d(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,n=u(e),a=n[0],s=n[1],l=new o(d(e,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(f(n));return i.join("")}function m(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,l=r-i;s<l;s+=a)o.push(p(e,s,s+a>l?l:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;},{}],13:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r];}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)};},{buffer:15}],14:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return !0;default:return !1}};function o(e){if(!e)return "utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return "utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return "utf16le";case"latin1":case"binary":return "latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function a(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function s(e){var t;switch(this.encoding=a(e),this.encoding){case"utf16le":this.text=p,this.end=m,t=4;break;case"utf8":this.fillLast=d,t=4;break;case"base64":this.text=y,this.end=g,t=3;break;default:return this.write=v,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t);}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n<r)return 0;var i=l(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function c(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function d(e){var t=this.lastTotal-this.lastNeed,r=c(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function h(e,t){var r=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function y(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function w(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return "";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return "";r=this.lastNeed,this.lastNeed=0;}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=f,s.prototype.text=h,s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length;};},{"safe-buffer":13}],15:[function(e,t,r){(function(t){(function(){var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return !1}}function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=m(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}function d(e){return u(e),a(e<0?0:0|y(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function f(e){for(var t=e.length<0?0:0|y(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return (n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,n}function m(e){if(s.isBuffer(e)){var t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function y(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e){return +e!=e&&(e=0),s.alloc(+e)}function v(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0;}}function w(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(t>>>=0))return "";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return D(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return j(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n;}function _(e,t,r,n,i){if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2;}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1;}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return -1}function T(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(Z(s))return a;e[r+a]=s;}return a}function x(e,t,r,n){return V(z(t,e.length-r),e,r,n)}function I(e,t,r,n){return V(G(t),e,r,n)}function S(e,t,r,n){return I(e,t,r,n)}function R(e,t,r,n){return V(J(t),e,r,n)}function k(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function j(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function D(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d;}return O(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=o(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return c(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(Q(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length;}return n},s.byteLength=v,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)b(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?D(this,0,e):w.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){o=u[d],a=c[d];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function O(e){var t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function A(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=W(e[o]);return i}function L(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function $(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i);}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i);}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i);}}else "number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else {var a=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%l];}return this};var q=/[^+/0-9A-Za-z-_]/g;function Y(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r);}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function G(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function H(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}function J(e){return t.toByteArray(Y(e))}function V(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}}).call(this);}).call(this,e("buffer").Buffer);},{"base64-js":12,buffer:15,ieee754:17}],16:[function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(e){console&&console.warn&&console.warn(e);}n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this);}t.exports=l,t.exports.once=b,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=d(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a(l);}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function m(e,t,r){var n=e._events;if(void 0===n)return [];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?w(i):g(i,i.length)}function y(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}function w(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function b(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r);}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments));}E(e,t,o,{once:!0}),"error"!==t&&_(e,i,{once:!0});}))}function _(e,t,r){"function"==typeof e.on&&E(e,"error",t,r);}function E(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o);}));}}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e;}}),l.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},l.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return !1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return !1;if("function"==typeof l)o(l,this,t);else {var u=l.length,c=g(l,u);for(r=0;r<u;++r)o(c[r],this,t);}return !0},l.prototype.addListener=function(e,t){return h(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return h(this,e,t,!0)},l.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,n,i,o,a;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():v(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t);}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return m(this,e,!0)},l.prototype.rawListeners=function(e){return m(this,e,!1)},l.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},l.prototype.listenerCount=y,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};},{}],17:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else {if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u;}return (f?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*m;};},{}],18:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a;}catch(e){n=a;}try{i="function"==typeof clearTimeout?clearTimeout:s;}catch(e){i=s;}}();var c,d=[],h=!1,f=-1;function p(){h&&c&&(h=!1,c.length?d=c.concat(d):f=-1,d.length&&m());}function m(){if(!h){var e=l(p);h=!0;for(var t=d.length;t;){for(c=d,d=[];++f<t;)c&&c[f].run();f=-1,t=d.length;}c=null,h=!1,u(e);}}function y(e,t){this.fun=e,this.array=t;}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new y(e,t)),1!==d.length||h||l(m);},y.prototype.run=function(){this.fun.apply(null,this.array);},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return []},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return "/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0};},{}],19:[function(e,t,r){(function(e){(function(){let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));}).call(this);}).call(this,void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],20:[function(e,t,r){const{AbortError:n,codes:i}=e("../../ours/errors"),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:s}=e("./utils"),l=e("./end-of-stream"),{ERR_INVALID_ARG_TYPE:u}=i,c=(e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new u(t,"AbortSignal",e)};t.exports.addAbortSignal=function(e,r){if(c(e,"signal"),!o(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const r=o(t)?()=>{t.destroy(new n(void 0,{cause:e.reason}));}:()=>{t[s](new n(void 0,{cause:e.reason}));};return e.aborted?r():(e.addEventListener("abort",r),l(t,(()=>e.removeEventListener("abort",r)))),t};},{"../../ours/errors":39,"./end-of-stream":26,"./utils":35}],21:[function(e,t,r){const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{inspect:l}=e("../../ours/util");t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0;}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length;}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length;}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0;}join(e){if(0===this.length)return "";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data;}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i;}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),r=e;let n=this.head,i=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(o(t,s,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),r-e),this.head=n,n.data=s.slice(e));break}o(t,s,r-e),e-=s.length,++i;}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}};},{"../../ours/primordials":40,"../../ours/util":41,buffer:15}],22:[function(e,t,r){const{pipeline:n}=e("./pipeline"),i=e("./duplex"),{destroyer:o}=e("./destroy"),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:d,isReadableStream:h}=e("./utils"),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=e("../../ours/errors"),y=e("./end-of-stream");t.exports=function(...e){if(0===e.length)throw new m("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t]);}for(let r=0;r<e.length;++r)if(a(e[r])||u(e[r])){if(r<e.length-1&&!(s(e[r])||h(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be readable");if(r>0&&!(l(e[r])||d(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,g,v,w,b;function _(e){const t=w;w=null,t?t(e):e?b.destroy(e):I||x||b.destroy();}const E=e[0],T=n(e,_),x=!!(l(E)||d(E)||c(E)),I=!!(s(T)||h(T)||c(T));if(b=new i({writableObjectMode:!(null==E||!E.writableObjectMode),readableObjectMode:!(null==T||!T.writableObjectMode),writable:x,readable:I}),x){if(a(E))b._write=function(e,t,n){E.write(e,t)?n():r=n;},b._final=function(e){E.end(),g=e;},E.on("drain",(function(){if(r){const e=r;r=null,e();}}));else if(u(E)){const e=(c(E)?E.writable:E).getWriter();b._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n();}catch(e){n(e);}},b._final=async function(t){try{await e.ready,e.close().catch((()=>{})),g=t;}catch(e){t(e);}};}const e=c(T)?T.readable:T;y(e,(()=>{if(g){const e=g;g=null,e();}}));}if(I)if(a(T))T.on("readable",(function(){if(v){const e=v;v=null,e();}})),T.on("end",(function(){b.push(null);})),b._read=function(){for(;;){const e=T.read();if(null===e)return void(v=b._read);if(!b.push(e))return}};else if(u(T)){const e=(c(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!b.push(t))return;if(r)return void b.push(null)}catch{return}};}return b._destroy=function(e,t){e||null===w||(e=new f),v=null,r=null,g=null,null===w?t(e):(w=t,a(T)&&o(T,e));},b};},{"../../ours/errors":39,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./pipeline":31,"./utils":35}],23:[function(e,t,r){const n=e("process/"),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=e("../../ours/errors"),{Symbol:s}=e("../../ours/primordials"),{kDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:d}=e("./utils"),h=s("kDestroy"),f=s("kConstruct");function p(e,t,r){e&&(t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e));}function m(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t);})),this)}function y(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(v,e);}try{e._destroy(t||null,o);}catch(t){o(t);}}function g(e,t){w(e,t),v(e);}function v(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close");}function w(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t));}function b(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable);}function _(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(w,e,t):w(e,t));}function E(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(T,e);}function T(e){let t=!1;function r(r){if(t)return void _(e,null!=r?r:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,r):r?_(e,r,!0):n.nextTick(x,e);}try{e._construct((e=>{n.nextTick(r,e);}));}catch(e){n.nextTick(r,e);}}function x(e){e.emit(f);}function I(e){return (null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close");}function R(e,t){e.emit("error",t),n.nextTick(S,e);}function k(e,t){e&&!u(e)&&(t||c(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):I(e)?e.abort():I(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(R,e,t):n.nextTick(S,e),e.destroyed||(e[l]=!0));}t.exports={construct:E,destroyer:k,destroy:m,undestroy:b,errorOrDestroy:_};},{"../../ours/errors":39,"../../ours/primordials":40,"./utils":35,"process/":18}],24:[function(e,t,r){const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=e("../../ours/primordials");t.exports=u;const s=e("./readable"),l=e("./writable");a(u.prototype,s.prototype),a(u,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const r=e[t];u.prototype[r]||(u.prototype[r]=l.prototype[r]);}}function u(e){if(!(this instanceof u))return new u(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0;}let c,d;function h(){return void 0===c&&(c={}),c}n(u.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e);}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(t){return d||(d=e("./duplexify")),d(t,"body")};},{"../../ours/primordials":40,"./duplexify":25,"./readable":32,"./writable":36}],25:[function(e,t,r){const n=e("process/"),i=e("buffer"),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:d}=e("./utils"),h=e("./end-of-stream"),{AbortError:f,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:m}}=e("../../ours/errors"),{destroyer:y}=e("./destroy"),g=e("./duplex"),v=e("./readable"),{createDeferredPromise:w}=e("../../ours/util"),b=e("./from"),_=globalThis.Blob||i.Blob,E=void 0!==_?function(e){return e instanceof _}:function(e){return !1},T=globalThis.AbortController||e("abort-controller").AbortController,{FunctionPrototypeCall:x}=e("../../ours/primordials");class I extends g{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0);}}function S(e){let{promise:t,resolve:r}=w();const i=new T,o=i.signal;return {value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(n.nextTick(s),a)return;if(o.aborted)throw new f(void 0,{cause:o.reason});(({promise:t,resolve:r}=w())),yield i;}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n});},final(e){const t=r;r=null,t({done:!0,cb:e});},destroy(e,t){i.abort(),t(e);}}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,r=e.writable;let n,i,s,l,u,c=!!o(t),d=!!a(r);function p(e){const t=l;l=null,t?t(e):e&&u.destroy(e);}return u=new I({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:c,writable:d}),d&&(h(r,(e=>{d=!1,e&&y(t,e),p(e);})),u._write=function(e,t,i){r.write(e,t)?i():n=i;},u._final=function(e){r.end(),i=e;},r.on("drain",(function(){if(n){const e=n;n=null,e();}})),r.on("finish",(function(){if(i){const e=i;i=null,e();}}))),c&&(h(t,(e=>{c=!1,e&&y(t,e),p(e);})),t.on("readable",(function(){if(s){const e=s;s=null,e();}})),t.on("end",(function(){u.push(null);})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,o){e||null===l||(e=new f),s=null,n=null,i=null,null===l?o(e):(l=o,y(r,e),y(t,e));},u}t.exports=function e(t,r){if(d(t))return t;if(u(t))return R({readable:t});if(c(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=S(t);if(s(e))return b(I,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const r=x(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{y(t,e);}));return t=new I({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null);}catch(t){n.nextTick(e,t);}}));},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(E(t))return e(t.arrayBuffer());if(s(t))return b(I,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return x(i,t,(t=>{null!=t&&e.push(t),e.push(null);}),(t=>{y(e,t);})),e=new I({objectMode:!0,writable:!1,read(){}})}throw new p(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./readable":32,"./utils":35,"abort-controller":11,buffer:15,"process/":18}],26:[function(e,t,r){const n=e("process/"),{AbortError:i,codes:o}=e("../../ours/errors"),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:u}=e("../../ours/util"),{validateAbortSignal:c,validateFunction:d,validateObject:h,validateBoolean:f}=e("../validators"),{Promise:p,PromisePrototypeThen:m}=e("../../ours/primordials"),{isClosed:y,isReadable:g,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:b,isReadableErrored:_,isWritable:E,isWritableNodeStream:T,isWritableStream:x,isWritableFinished:I,isWritableErrored:S,isNodeStream:R,willEmitClose:k,kIsClosedPromise:j}=e("./utils");function D(e){return e.setHeader&&"function"==typeof e.abort}const N=()=>{};function O(e,t,r){var o,f;if(2===arguments.length?(r=t,t=l):null==t?t=l:h(t,"options"),d(r,"callback"),c(t.signal,"options.signal"),r=u(r),w(e)||x(e))return C(e,t,r);if(!R(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const p=null!==(o=t.readable)&&void 0!==o?o:v(e),m=null!==(f=t.writable)&&void 0!==f?f:T(e),j=e._writableState,O=e._readableState,A=()=>{e.writable||P();};let M=k(e)&&v(e)===p&&T(e)===m,L=I(e,!1);const P=()=>{L=!0,e.destroyed&&(M=!1),(!M||e.readable&&!p)&&(p&&!B||r.call(e));};let B=b(e,!1);const $=()=>{B=!0,e.destroyed&&(M=!1),(!M||e.writable&&!m)&&(m&&!L||r.call(e));},F=t=>{r.call(e,t);};let U=y(e);const q=()=>{U=!0;const t=S(e)||_(e);return t&&"boolean"!=typeof t?r.call(e,t):p&&!B&&v(e,!0)&&!b(e,!1)?r.call(e,new s):!m||L||I(e,!1)?void r.call(e):r.call(e,new s)},Y=()=>{U=!0;const t=S(e)||_(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e);},W=()=>{e.req.on("finish",P);};D(e)?(e.on("complete",P),M||e.on("abort",q),e.req?W():e.on("request",W)):m&&!j&&(e.on("end",A),e.on("close",A)),M||"boolean"!=typeof e.aborted||e.on("aborted",q),e.on("end",$),e.on("finish",P),!1!==t.error&&e.on("error",F),e.on("close",q),U?n.nextTick(q):null!=j&&j.errorEmitted||null!=O&&O.errorEmitted?M||n.nextTick(Y):(p||M&&!g(e)||!L&&!1!==E(e))&&(m||M&&!E(e)||!B&&!1!==g(e))?O&&e.req&&e.aborted&&n.nextTick(Y):n.nextTick(Y);const z=()=>{r=N,e.removeListener("aborted",q),e.removeListener("complete",P),e.removeListener("abort",q),e.removeListener("request",W),e.req&&e.req.removeListener("finish",P),e.removeListener("end",A),e.removeListener("close",A),e.removeListener("finish",P),e.removeListener("end",$),e.removeListener("error",F),e.removeListener("close",q);};if(t.signal&&!U){const o=()=>{const n=r;z(),n.call(e,new i(void 0,{cause:t.signal.reason}));};if(t.signal.aborted)n.nextTick(o);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",o),n.apply(e,r);})),t.signal.addEventListener("abort",o);}}return z}function C(e,t,r){let o=!1,a=N;if(t.signal)if(a=()=>{o=!0,r.call(e,new i(void 0,{cause:t.signal.reason}));},t.signal.aborted)n.nextTick(a);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",a),n.apply(e,r);})),t.signal.addEventListener("abort",a);}const s=(...t)=>{o||n.nextTick((()=>r.apply(e,t)));};return m(e[j].promise,s,s),N}function A(e,t){var r;let n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=O(e,t,(e=>{n&&o(),e?i(e):r();}));}))}t.exports=O,t.exports.finished=A;},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./utils":35,"process/":18}],27:[function(e,t,r){const n=e("process/"),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=e("../../ours/errors").codes;function c(e,t,r){let c,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null);}});if(t&&t[o])d=!0,c=t[o]();else {if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,c=t[a]();}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;async function p(e){const t=null!=e,r="function"==typeof c.throw;if(t&&r){const{value:t,done:r}=await c.throw(e);if(await t,r)return}if("function"==typeof c.return){const{value:e}=await c.return();await e;}}async function m(){for(;;){try{const{value:e,done:t}=d?await c.next():c.next();if(t)h.push(null);else {const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new u;if(h.push(t))continue;f=!1;}}catch(e){h.destroy(e);}break}}return h._read=function(){f||(f=!0,m());},h._destroy=function(e,t){i(p(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)));},h}t.exports=c;},{"../../ours/errors":39,"../../ours/primordials":40,buffer:15,"process/":18}],28:[function(e,t,r){const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=e("../../ours/primordials"),{EventEmitter:o}=e("events");function a(e){o.call(this,e);}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r);}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause();}function i(){r.readable&&r.resume&&r.resume();}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",l),r.on("close",u));let a=!1;function l(){a||(a=!0,e.end());}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy());}function c(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e);}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d);}return s(r,"error",c),s(e,"error",c),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},t.exports={Stream:a,prependListener:s};},{"../../ours/primordials":40,events:16}],29:[function(e,t,r){const n=globalThis.AbortController||e("abort-controller").AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=e("../../ours/errors"),{validateAbortSignal:u,validateInteger:c,validateObject:d}=e("../validators"),h=e("../../ours/primordials").Symbol("kWeak"),{finished:f}=e("./end-of-stream"),p=e("./compose"),{addAbortSignalNoValidate:m}=e("./add-abort-signal"),{isWritable:y,isNodeStream:g}=e("./utils"),{ArrayPrototypePush:v,MathFloor:w,Number:b,NumberIsNaN:_,Promise:E,PromiseReject:T,PromisePrototypeThen:x,Symbol:I}=e("../../ours/primordials"),S=I("kEmpty"),R=I("kEof");function k(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),g(e)&&!y(e))throw new i("stream",e,"must be writable");const r=p(this,e);return null!=t&&t.signal&&m(t.signal,r),r}function j(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let r=1;return null!=(null==t?void 0:t.concurrency)&&(r=w(t.concurrency)),c(r,"concurrency",1),async function*(){var i,o;const a=new n,s=this,u=[],c=a.signal,d={signal:c},h=()=>a.abort();let f,p;null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h);let m=!1;function y(){m=!0;}async function g(){try{for await(let t of s){var n;if(m)return;if(c.aborted)throw new l;try{t=e(t,d);}catch(e){t=T(e);}t!==S&&("function"==typeof(null===(n=t)||void 0===n?void 0:n.catch)&&t.catch(y),u.push(t),f&&(f(),f=null),!m&&u.length&&u.length>=r&&await new E((e=>{p=e;})));}u.push(R);}catch(e){const t=T(e);x(t,void 0,y),u.push(t);}finally{var i;m=!0,f&&(f(),f=null),null==t||null===(i=t.signal)||void 0===i||i.removeEventListener("abort",h);}}g();try{for(;;){for(;u.length>0;){const e=await u[0];if(e===R)return;if(c.aborted)throw new l;e!==S&&(yield e),u.shift(),p&&(p(),p=null);}await new E((e=>{f=e;}));}}finally{a.abort(),m=!0,p&&(p(),p=null);}}.call(this)}function D(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l({cause:e.signal.reason});yield [t++,n];}}.call(this)}async function N(e,t=void 0){for await(const r of M.call(this,e,t))return !0;return !1}async function O(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return !await N.call(this,(async(...t)=>!await e(...t)),t)}async function C(e,t){for await(const r of M.call(this,e,t))return r}async function A(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r),S}for await(const e of j.call(this,r,t));}function M(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r)?t:S}return j.call(this,r,t)}class L extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value";}}async function P(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&u(r.signal,"options.signal");let a=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await f(this.destroy(e)),e}const s=new n,c=s.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this};r.signal.addEventListener("abort",(()=>s.abort()),e);}let p=!1;try{for await(const n of this){var m;if(p=!0,null!=r&&null!==(m=r.signal)&&void 0!==m&&m.aborted)throw new l;a?t=await e(t,n,{signal:c}):(t=n,a=!0);}if(!p&&!a)throw new L}finally{s.abort();}return t}async function B(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l(void 0,{cause:e.signal.reason});v(t,n);}return t}function $(e,t){const r=j.call(this,e,t);return async function*(){for await(const e of r)yield*e;}.call(this)}function F(e){if(e=b(e),_(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}function U(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;e--<=0&&(yield r);}}.call(this)}function q(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;if(!(e-- >0))return;yield r;}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:D,drop:U,filter:M,flatMap:$,map:j,take:q,compose:k},t.exports.promiseReturningOperators={every:O,forEach:A,reduce:P,toArray:B,some:N,find:C};},{"../../ours/errors":39,"../../ours/primordials":40,"../validators":37,"./add-abort-signal":20,"./compose":22,"./end-of-stream":26,"./utils":35,"abort-controller":11}],30:[function(e,t,r){const{ObjectSetPrototypeOf:n}=e("../../ours/primordials");t.exports=o;const i=e("./transform");function o(e){if(!(this instanceof o))return new o(e);i.call(this,e);}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e);};},{"../../ours/primordials":40,"./transform":34}],31:[function(e,t,r){const n=e("process/"),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a}=e("../../ours/primordials"),s=e("./end-of-stream"),{once:l}=e("../../ours/util"),u=e("./destroy"),c=e("./duplex"),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:p,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:g}=e("../../ours/errors"),{validateFunction:v,validateAbortSignal:w}=e("../validators"),{isIterable:b,isReadable:_,isReadableNodeStream:E,isNodeStream:T,isTransformStream:x,isWebStream:I,isReadableStream:S,isReadableEnded:R}=e("./utils"),k=globalThis.AbortController||e("abort-controller").AbortController;let j,D;function N(e,t,r){let n=!1;return e.on("close",(()=>{n=!0;})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new m("pipe")));},cleanup:s(e,{readable:t,writable:r},(e=>{n=!e;}))}}function O(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function C(e){if(b(e))return e;if(E(e))return A(e);throw new h("val",["Readable","Iterable","AsyncIterable"],e)}async function*A(t){D||(D=e("./readable")),yield*D.prototype[a].call(t);}async function M(e,t,r,{end:n}){let i,a=null;const l=e=>{if(e&&(i=e),a){const e=a;a=null,e();}},u=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e();};}));t.on("drain",l);const c=s(t,{readable:!1},l);try{t.writableNeedDrain&&await u();for await(const r of e)t.write(r)||await u();n&&t.end(),await u(),r();}catch(e){r(i!==e?d(i,e):e);}finally{c(),t.off("drain",l);}}async function L(e,t,r,{end:n}){x(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r();}catch(e){try{await i.abort(e),r(e);}catch(e){r(e);}}}function P(...e){return B(e,l(O(e)))}function B(t,r,o){if(1===t.length&&i(t[0])&&(t=t[0]),t.length<2)throw new p("streams");const a=new k,s=a.signal,l=null==o?void 0:o.signal,u=[];function d(){A(new g);}let m,y;w(l,"options.signal"),null==l||l.addEventListener("abort",d);const v=[];let R,D=0;function O(e){A(e,0==--D);}function A(e,t){if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||t){for(;v.length;)v.shift()(m);null==l||l.removeEventListener("abort",d),a.abort(),t&&(m||u.forEach((e=>e())),n.nextTick(r,m,y));}}for(let F=0;F<t.length;F++){const U=t[F],q=F<t.length-1,Y=F>0,W=q||!1!==(null==o?void 0:o.end),z=F===t.length-1;if(T(U)){if(W){const{destroy:H,cleanup:J}=N(U,q,Y);v.push(H),_(U)&&z&&u.push(J);}function G(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&O(e);}U.on("error",G),_(U)&&z&&u.push((()=>{U.removeListener("error",G);}));}if(0===F)if("function"==typeof U){if(R=U({signal:s}),!b(R))throw new f("Iterable, AsyncIterable or Stream","source",R)}else R=b(U)||E(U)||x(U)?U:c.from(U);else if("function"==typeof U){var P;if(R=x(R)?C(null===(P=R)||void 0===P?void 0:P.readable):C(R),R=U(R,{signal:s}),q){if(!b(R,!0))throw new f("AsyncIterable",`transform[${F-1}]`,R)}else {var B;j||(j=e("./passthrough"));const V=new j({objectMode:!0}),Q=null===(B=R)||void 0===B?void 0:B.then;if("function"==typeof Q)D++,Q.call(R,(e=>{y=e,null!=e&&V.write(e),W&&V.end(),n.nextTick(O);}),(e=>{V.destroy(e),n.nextTick(O,e);}));else if(b(R,!0))D++,M(R,V,O,{end:W});else {if(!S(R)&&!x(R))throw new f("AsyncIterable or Promise","destination",R);{const X=R.readable||R;D++,M(X,V,O,{end:W});}}R=V;const{destroy:Z,cleanup:K}=N(R,!1,!0);v.push(Z),z&&u.push(K);}}else if(T(U)){if(E(R)){D+=2;const ee=$(R,U,O,{end:W});_(U)&&z&&u.push(ee);}else if(x(R)||S(R)){const te=R.readable||R;D++,M(te,U,O,{end:W});}else {if(!b(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,M(R,U,O,{end:W});}R=U;}else if(I(U)){if(E(R))D++,L(C(R),U,O,{end:W});else if(S(R)||b(R))D++,L(R,U,O,{end:W});else {if(!x(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,L(R.readable,U,O,{end:W});}R=U;}else R=c.from(U);}return (null!=s&&s.aborted||null!=l&&l.aborted)&&n.nextTick(d),R}function $(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new y);})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end();}R(e)?n.nextTick(a):e.once("end",a);}else r();return s(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t);})),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:P};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./passthrough":30,"./readable":32,"./utils":35,"abort-controller":11,"process/":18}],32:[function(e,t,r){const n=e("process/"),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:d,SafeSet:h,SymbolAsyncIterator:f,Symbol:p}=e("../../ours/primordials");t.exports=$,$.ReadableState=B;const{EventEmitter:m}=e("events"),{Stream:y,prependListener:g}=e("./legacy"),{Buffer:v}=e("buffer"),{addAbortSignal:w}=e("./add-abort-signal"),b=e("./end-of-stream");let _=e("../../ours/util").debuglog("stream",(e=>{_=e;}));const E=e("./buffer_list"),T=e("./destroy"),{getHighWaterMark:x,getDefaultHighWaterMark:I}=e("./state"),{aggregateTwoErrors:S,codes:{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:j,ERR_STREAM_PUSH_AFTER_EOF:D,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:N}}=e("../../ours/errors"),{validateObject:O}=e("../validators"),C=p("kPaused"),{StringDecoder:A}=e("string_decoder"),M=e("./from");c($.prototype,y.prototype),c($,y);const L=()=>{},{errorOrDestroy:P}=T;function B(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.readableObjectMode)),this.highWaterMark=t?x(this,t,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[C]=null,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new A(t.encoding),this.encoding=t.encoding);}function $(t){if(!(this instanceof $))return new $(t);const r=this instanceof e("./duplex");this._readableState=new B(t,this,r),t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&!r&&w(t.signal,this)),y.call(this,t),T.construct(this,(()=>{this._readableState.needReadable&&J(this,this._readableState);}));}function F(e,t,r,n){_("readableAddChunk",t);const i=e._readableState;let o;if(i.objectMode||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=v.from(t,r).toString(i.encoding):(t=v.from(t,r),r=""))):t instanceof v?r="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new R("chunk",["string","Buffer","Uint8Array"],t))),o)P(e,o);else if(null===t)i.reading=!1,z(e,i);else if(i.objectMode||t&&t.length>0)if(n)if(i.endEmitted)P(e,new N);else {if(i.destroyed||i.errored)return !1;U(e,i,t,!0);}else if(i.ended)P(e,new D);else {if(i.destroyed||i.errored)return !1;i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?U(e,i,t,!1):J(e,i)):U(e,i,t,!1);}else n||(i.reading=!1,J(e,i));return !i.ended&&(i.length<i.highWaterMark||0===i.length)}function U(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&G(e)),J(e,t);}$.prototype.destroy=T.destroy,$.prototype._undestroy=T.undestroy,$.prototype._destroy=function(e,t){t(e);},$.prototype[m.captureRejectionSymbol]=function(e){this.destroy(e);},$.prototype.push=function(e,t){return F(this,e,t,!1)},$.prototype.unshift=function(e,t){return F(this,e,t,!0)},$.prototype.isPaused=function(){const e=this._readableState;return !0===e[C]||!1===e.flowing},$.prototype.setEncoding=function(e){const t=new A(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};const q=1073741824;function Y(e){if(e>q)throw new j("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}function W(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function z(e,t){if(_("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length);}t.ended=!0,t.sync?G(e):(t.needReadable=!1,t.emittedReadable=!0,H(e));}}function G(e){const t=e._readableState;_("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(_("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(H,e));}function H(e){const t=e._readableState;_("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,te(e);}function J(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(V,e,t));}function V(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const r=t.length;if(_("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1;}function Q(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(_("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(_("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume();}}function Z(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null);}function K(e){_("readable nexttick read 0"),e.read(0);}function X(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ee,e,t));}function ee(e,t){_("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),te(e),t.flowing&&!t.reading&&e.read(0);}function te(e){const t=e._readableState;for(_("flow",t.flowing);t.flowing&&null!==e.read(););}function re(e,t){"function"!=typeof e.read&&(e=$.wrap(e,{objectMode:!0}));const r=ne(e,t);return r.stream=e,r}async function*ne(e,t){let r,n=L;function i(t){this===e?(n(),n=L):n=t;}e.on("readable",i);const o=b(e,{writable:!1},(e=>{r=e?S(r,e):null,n(),n=L;}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else {if(r)throw r;if(null===r)return;await new d(i);}}}catch(e){throw r=S(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):T.destroyer(e,null);}}function ie(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function oe(e){const t=e._readableState;_("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ae,t,e));}function ae(e,t){if(_("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(se,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy();}}function se(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end();}let le;function ue(){return void 0===le&&(le={}),le}$.prototype.read=function(e){_("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=Y(e)),0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return _("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?oe(this):G(this),null;if(0===(e=W(e,t))&&t.ended)return 0===t.length&&oe(this),null;let n,i=t.needReadable;if(_("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,_("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,_("reading, ended or constructing",i);else if(i){_("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark);}catch(e){P(this,e);}t.sync=!1,t.reading||(e=W(r,t));}return n=e>0?ie(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&oe(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},$.prototype._read=function(e){throw new k("_read()")},$.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),_("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?v:s;function a(e,t){_("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,c());}function s(){_("onend"),e.end();}let l;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",a);let u=!1;function c(){_("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),l&&e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),u=!0,l&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&l();}function d(){u||(1===i.pipes.length&&i.pipes[0]===e?(_("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(_("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),l||(l=Q(r,e),e.on("drain",l));}function f(t){_("ondata");const r=e.write(t);_("dest.write",r),!1===r&&d();}function p(t){if(_("onerror",t),v(),e.removeListener("error",p),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?P(e,t):e.emit("error",t);}}function m(){e.removeListener("finish",y),v();}function y(){_("onfinish"),e.removeListener("close",m),v();}function v(){_("unpipe"),r.unpipe(e);}return r.on("data",f),g(e,"error",p),e.once("close",m),e.once("finish",y),e.emit("pipe",r),!0===e.writableNeedDrain?i.flowing&&d():i.flowing||(_("pipe resume"),r.resume()),e},$.prototype.unpipe=function(e){const t=this._readableState,r={hasUnpiped:!1};if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return -1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,r)),this},$.prototype.on=function(e,t){const r=y.prototype.on.call(this,e,t),i=this._readableState;return "data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,_("on readable",i.length,i.reading),i.length?G(this):i.reading||n.nextTick(K,this))),r},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){const r=y.prototype.removeListener.call(this,e,t);return "readable"===e&&n.nextTick(Z,this),r},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(e){const t=y.prototype.removeAllListeners.apply(this,arguments);return "readable"!==e&&void 0!==e||n.nextTick(Z,this),t},$.prototype.resume=function(){const e=this._readableState;return e.flowing||(_("resume"),e.flowing=!e.readableListening,X(this,e)),e[C]=!1,this},$.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},$.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause());})),e.on("end",(()=>{this.push(null);})),e.on("error",(e=>{P(this,e);})),e.on("close",(()=>{this.destroy();})),e.on("destroy",(()=>{this.destroy();})),this._read=()=>{t&&e.resume&&(t=!1,e.resume());};const r=u(e);for(let t=1;t<r.length;t++){const n=r[t];void 0===this[n]&&"function"==typeof e[n]&&(this[n]=e[n].bind(e));}return this},$.prototype[f]=function(){return re(this)},$.prototype.iterator=function(e){return void 0!==e&&O(e,"options"),re(this,e)},l($.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return !(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e);}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e);}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return !!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e);}},readableEnded:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.endEmitted}}}),l(B.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return !1!==this[C]},set(e){this[C]=!!e;}}}),$._fromList=ie,$.from=function(e,t){return M($,e,t)},$.fromWeb=function(e,t){return ue().newStreamReadableFromReadableStream(e,t)},$.toWeb=function(e,t){return ue().newReadableStreamFromStreamReadable(e,t)},$.wrap=function(e,t){var r,n;return new $({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r,...t,destroy(t,r){T.destroyer(e,t),r(t);}}).wrap(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./add-abort-signal":20,"./buffer_list":21,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18,string_decoder:14}],33:[function(e,t,r){const{MathFloor:n,NumberIsInteger:i}=e("../../ours/primordials"),{ERR_INVALID_ARG_VALUE:o}=e("../../ours/errors").codes;function a(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function s(e){return e?16:16384}function l(e,t,r,l){const u=a(t,l,r);if(null!=u){if(!i(u)||u<0)throw new o(l?`options.${r}`:"options.highWaterMark",u);return n(u)}return s(e.objectMode)}t.exports={getHighWaterMark:l,getDefaultHighWaterMark:s};},{"../../ours/errors":39,"../../ours/primordials":40}],34:[function(e,t,r){const{ObjectSetPrototypeOf:n,Symbol:i}=e("../../ours/primordials");t.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:o}=e("../../ours/errors").codes,a=e("./duplex"),{getHighWaterMark:s}=e("./state");n(u.prototype,a.prototype),n(u,a);const l=i("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d);}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e());}));}function d(){this._final!==c&&c.call(this);}u.prototype._final=c,u.prototype._transform=function(e,t,r){throw new o("_transform()")},u.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length<n.highWaterMark?r():this[l]=r);}));},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e();}};},{"../../ours/errors":39,"../../ours/primordials":40,"./duplex":24,"./state":33}],35:[function(e,t,r){const{Symbol:n,SymbolAsyncIterator:i,SymbolIterator:o,SymbolFor:a}=e("../../ours/primordials"),s=n("kDestroyed"),l=n("kIsErrored"),u=n("kIsReadable"),c=n("kIsDisturbed"),d=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var r;return !(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function p(e){var t;return !(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function m(e){return !(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return !(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function v(e){return !(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function w(e){return !(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function b(e){return g(e)||v(e)||w(e)}function _(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[o]:"function"==typeof e[i]||"function"==typeof e[o])}function E(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !!(e.destroyed||e[s]||null!=n&&n.destroyed)}function T(e){if(!p(e))return null;if(!0===e.writableEnded)return !0;const t=e._writableState;return (null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function x(e,t){if(!p(e))return null;if(!0===e.writableFinished)return !0;const r=e._writableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))}function I(e){if(!f(e))return null;if(!0===e.readableEnded)return !0;const t=e._readableState;return !(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function S(e,t){if(!f(e))return null;const r=e._readableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function R(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!E(e)&&f(e)&&e.readable&&!S(e)}function k(e){return "boolean"!=typeof(null==e?void 0:e.writable)?null:!E(e)&&p(e)&&e.writable&&!T(e)}function j(e,t){return y(e)?!(!E(e)&&(!1!==(null==t?void 0:t.readable)&&R(e)||!1!==(null==t?void 0:t.writable)&&k(e))):null}function D(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function N(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function O(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return "boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&C(e)?e._closed:null}function C(e){return "boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function A(e){return "boolean"==typeof e._sent100&&C(e)}function M(e){var t;return "boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)}function L(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !n&&A(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)}function P(e){var t;return !(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))}function B(e){var t,r,n,i,o,a,s,u,c,d;return !(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(a=e[l])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(s=e._readableState)||void 0===s?void 0:s.errorEmitted)&&void 0!==n?n:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))}t.exports={kDestroyed:s,isDisturbed:P,kIsDisturbed:c,isErrored:B,kIsErrored:l,isReadable:R,kIsReadable:u,kIsClosedPromise:d,kControllerErrorFunction:h,isClosed:O,isDestroyed:E,isDuplexNodeStream:m,isFinished:j,isIterable:_,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:I,isReadableFinished:S,isReadableErrored:N,isNodeStream:y,isWebStream:b,isWritable:k,isWritableNodeStream:p,isWritableStream:v,isWritableEnded:T,isWritableFinished:x,isWritableErrored:D,isServerRequest:M,isServerResponse:A,willEmitClose:L,isTransformStream:w};},{"../../ours/primordials":40}],36:[function(e,t,r){const n=e("process/"),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:h}=e("../../ours/primordials");t.exports=A,A.WritableState=O;const{EventEmitter:f}=e("events"),p=e("./legacy").Stream,{Buffer:m}=e("buffer"),y=e("./destroy"),{addAbortSignal:g}=e("./add-abort-signal"),{getHighWaterMark:v,getDefaultHighWaterMark:w}=e("./state"),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:T,ERR_STREAM_DESTROYED:x,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:S,ERR_STREAM_WRITE_AFTER_END:R,ERR_UNKNOWN_ENCODING:k}=e("../../ours/errors").codes,{errorOrDestroy:j}=y;function D(){}u(A.prototype,p.prototype),u(A,p);const N=d("kOnFinished");function O(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.writableObjectMode)),this.highWaterMark=t?v(this,t,"writableHighWaterMark",n):w(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!t||!1!==t.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,r),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,C(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[N]=[];}function C(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0;}function A(t){const r=this instanceof e("./duplex");if(!r&&!a(A,this))return new A(t);this._writableState=new O(t,this,r),t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&g(t.signal,this)),p.call(this,t),y.construct(this,(()=>{const e=this._writableState;e.writing||Y(this,e),H(this,e);}));}function M(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else {if(r){if("buffer"!==r&&!m.isEncoding(r))throw new k(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=D);}if(null===t)throw new S;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=m.from(t,r),r="buffer");else if(t instanceof m)r="buffer";else {if(!p._isUint8Array(t))throw new b("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer";}let a;return o.ending?a=new R:o.destroyed&&(a=new x("write")),a?(n.nextTick(i,a),j(e,a,!0),a):(o.pendingcb++,L(e,o,t,r,i))}function L(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}function P(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new x("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1;}function B(e,t,r,n){--t.pendingcb,n(r),q(t),j(e,r);}function $(e,t){const r=e._writableState,i=r.sync,o=r.writecb;"function"==typeof o?(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(B,e,r,t,o):B(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&Y(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(F,r.afterWriteTickInfo)):U(e,r,1,o))):j(e,new E);}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,U(e,t,r,n)}function U(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&q(t),H(e,t);}function q(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;const{chunk:n,callback:i}=e.buffered[r],o=e.objectMode?1:n.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new x("write"));}const r=e[N].splice(0);for(let t=0;t<r.length;t++){var n;r[t](null!==(n=e.errored)&&void 0!==n?n:new x("end"));}C(e);}function Y(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:r,bufferedIndex:n,objectMode:o}=t,a=r.length-n;if(!a)return;let s=n;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const n=t.allNoop?D:e=>{for(let t=s;t<r.length;++t)r[t].callback(e);},o=t.allNoop&&0===s?r:i(r,s);o.allBuffers=t.allBuffers,P(e,t,!0,t.length,o,"",n),C(t);}else {do{const{chunk:n,encoding:i,callback:a}=r[s];r[s++]=null,P(e,t,!1,o?1:n.length,n,i,a);}while(s<r.length&&!t.writing);s===r.length?C(t):s>256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s;}t.bufferProcessing=!1;}function W(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(e,t){let r=!1;function i(i){if(r)j(e,null!=i?i:E());else if(r=!0,t.pendingcb--,i){const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e](i);j(e,i,t.sync);}else W(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,n.nextTick(J,e,t));}t.sync=!0,t.pendingcb++;try{e._final(i);}catch(e){i(e);}t.sync=!1;}function G(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,z(e,t)));}function H(e,t,r){W(t)&&(G(e,t),0===t.pendingcb&&(r?(t.pendingcb++,n.nextTick(((e,t)=>{W(t)?J(e,t):t.pendingcb--;}),e,t)):W(t)&&(t.pendingcb++,J(e,t))));}function J(e,t){t.pendingcb--,t.finished=!0;const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy();}}O.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(A,h,{__proto__:null,value:function(e){return !!a(this,e)||this===A&&e&&e._writableState instanceof O}}),A.prototype.pipe=function(){j(this,new T);},A.prototype.write=function(e,t,r){return !0===M(this,e,t,r)},A.prototype.cork=function(){this._writableState.corked++;},A.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||Y(this,e));},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!m.isEncoding(e))throw new k(e);return this._writableState.defaultEncoding=e,this},A.prototype._write=function(e,t,r){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],r);},A.prototype._writev=null,A.prototype.end=function(e,t,r){const i=this._writableState;let a;if("function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e){const r=M(this,e,t);r instanceof o&&(a=r);}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new x("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof r&&(a||i.finished?n.nextTick(r,a):i[N].push(r)),this},l(A.prototype,{closed:{__proto__:null,get(){return !!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return !!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e);}},writable:{__proto__:null,get(){const e=this._writableState;return !(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e);}},writableFinished:{__proto__:null,get(){return !!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return !!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return !!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return !!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const V=y.destroy;let Q;function Z(){return void 0===Q&&(Q={}),Q}A.prototype.destroy=function(e,t){const r=this._writableState;return !r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N].length)&&n.nextTick(q,r),V.call(this,e,t),this},A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e);},A.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e);},A.fromWeb=function(e,t){return Z().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return Z().newWritableStreamFromStreamWritable(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"./add-abort-signal":20,"./destroy":23,"./duplex":24,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18}],37:[function(e,t,r){const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:y}=e("../ours/primordials"),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:v,ERR_INVALID_ARG_TYPE:w,ERR_INVALID_ARG_VALUE:b,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:E}}=e("../ours/errors"),{normalizeEncoding:T}=e("../ours/util"),{isAsyncFunction:x,isArrayBufferView:I}=e("../ours/util").types,S={};function R(e){return e===(0|e)}function k(e){return e===e>>>0}const j=/^[0-7]+$/,D="must be a 32-bit unsigned integer or an octal string";function N(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(j,e))throw new b(t,e,D);e=d(e,8);}return A(e,t),e}const O=g(((e,t,r=c,n=u)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=g(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),A=g(((e,t,r=!1)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(e<n||e>i)throw new _(t,`>= ${n} && <= ${i}`,e)}));function M(e,t){if("string"!=typeof e)throw new w(t,"string",e)}function L(e,t,r=void 0,n){if("number"!=typeof e)throw new w(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&l(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)}const P=g(((e,t,r)=>{if(!i(r,e)){const n=o(a(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new b(t,e,"must be one of: "+n)}}));function B(e,t){if("boolean"!=typeof e)throw new w(t,"boolean",e)}function $(e,t,r){return null!=e&&h(e,t)?e[t]:r}const F=g(((e,t,r=null)=>{const i=$(r,"allowArray",!1),o=$(r,"allowFunction",!1);if(!$(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new w(t,"Object",e)})),U=g(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new w(t,"a dictionary",e)})),q=g(((e,t,r=0)=>{if(!n(e))throw new w(t,"Array",e);if(e.length<r)throw new b(t,e,`must be longer than ${r}`)}));function Y(e,t){q(e,t);for(let r=0;r<e.length;r++)M(e[r],`${t}[${r}]`);}function W(e,t){q(e,t);for(let r=0;r<e.length;r++)B(e[r],`${t}[${r}]`);}function z(e,t="signal"){if(M(e,t),void 0===S[e]){if(void 0!==S[m(e)])throw new E(e+" (signals must use all capital letters)");throw new E(e)}}const G=g(((e,t="buffer")=>{if(!I(e))throw new w(t,["Buffer","TypedArray","DataView"],e)}));function H(e,t){const r=T(t),n=e.length;if("hex"===r&&n%2!=0)throw new b("encoding",t,`is invalid for data of length ${n}`)}function J(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e}const V=g(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new w(t,"AbortSignal",e)})),Q=g(((e,t)=>{if("function"!=typeof e)throw new w(t,"Function",e)})),Z=g(((e,t)=>{if("function"!=typeof e||x(e))throw new w(t,"Function",e)})),K=g(((e,t)=>{if(void 0!==e)throw new w(t,"undefined",e)}));function X(e,t,r){if(!i(r,e))throw new w(t,`('${o(r,"|")}')`,e)}const ee=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(e,t){if(void 0===e||!f(ee,e))throw new b(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function re(e){if("string"==typeof e)return te(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n<t;n++){const i=e[n];te(i,"hints"),r+=i,n!==t-1&&(r+=", ");}return r}throw new b("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:R,isUint32:k,parseFileMode:N,validateArray:q,validateStringArray:Y,validateBooleanArray:W,validateBoolean:B,validateBuffer:G,validateDictionary:U,validateEncoding:H,validateFunction:Q,validateInt32:C,validateInteger:O,validateNumber:L,validateObject:F,validateOneOf:P,validatePlainFunction:Z,validatePort:J,validateSignalName:z,validateString:M,validateUint32:A,validateUndefined:K,validateUnion:X,validateAbortSignal:V,validateLinkHeaderValue:re};},{"../ours/errors":39,"../ours/primordials":40,"../ours/util":41}],38:[function(e,t,r){const n=e("../stream"),i=e("../stream/promises"),o=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=o,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=n.Stream,t.exports.default=t.exports;},{"../stream":42,"../stream/promises":43}],39:[function(e,t,r){const{format:n,inspect:i,AggregateError:o}=e("./util"),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c="__node_internal_",d={};function h(e,t){if(!e)throw new d.ERR_INTERNAL_ASSERTION(t)}function f(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return `${e.slice(0,r)}${t}`}function p(e,t,r){if("function"==typeof t)return h(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return h(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}function m(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(p(e,t,r));}toString(){return `${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return `${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[s]=!0,d[e]=n;}function y(e){const t=c+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new a([t,e],t.message);return r.code=t.code,r}return e||t}class v extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new d.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError";}}m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",((e,t,r)=>{h("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],a=[],s=[];for(const e of t)h("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):u.test(e)?a.push(e):(h("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"));}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`;}}(a.length>0||s.length>0)&&(n+=" or ");}if(a.length>0){switch(a.length){case 1:n+=`an instance of ${a[0]}`;break;case 2:n+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`an instance of ${a.join(", ")}, or ${e}`;}}s.length>0&&(n+=" or ");}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`one of ${s.join(", ")}, or ${e}`;}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`;}else {let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`;}return n}),TypeError),m("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),m("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return `Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),m("ERR_MISSING_ARGS",((...e)=>{let t;h(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`;}}return `${t} must be specified`}),TypeError),m("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return h(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=f(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=f(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:v,aggregateTwoErrors:y(g),hideStackFrames:y,codes:d};},{"./util":41}],40:[function(e,t,r){t.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Uint8Array:Uint8Array};},{}],41:[function(e,t,r){const n=e("buffer"),i=Object.getPrototypeOf((async function(){})).constructor,o=globalThis.Blob||n.Blob,a=void 0!==o?function(e){return e instanceof o}:function(e){return !1};class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e;}}t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r));}},createDeferredPromise:function(){let e,t;return {promise:new Promise(((r,n)=>{e=r,t=n;})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)));})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return "f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return `"${e}"`;if(!e.includes("`")&&!e.includes("${"))return `\`${e}\``}return `'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return `${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return "{}"}},types:{isAsyncFunction:e=>e instanceof i,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:a},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom");},{buffer:15}],42:[function(e,t,r){const{Buffer:n}=e("buffer"),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=e("./ours/primordials"),{promisify:{custom:s}}=e("./ours/util"),{streamReturningOperators:l,promiseReturningOperators:u}=e("./internal/streams/operators"),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=e("./ours/errors"),d=e("./internal/streams/compose"),{pipeline:h}=e("./internal/streams/pipeline"),{destroyer:f}=e("./internal/streams/destroy"),p=e("./internal/streams/end-of-stream"),m=e("./stream/promises"),y=e("./internal/streams/utils"),g=t.exports=e("./internal/streams/legacy").Stream;g.isDisturbed=y.isDisturbed,g.isErrored=y.isErrored,g.isReadable=y.isReadable,g.Readable=e("./internal/streams/readable");for(const w of o(l)){const b=l[w];function _(...e){if(new.target)throw c();return g.Readable.from(a(b,this,e))}i(_,"name",{__proto__:null,value:b.name}),i(_,"length",{__proto__:null,value:b.length}),i(g.Readable.prototype,w,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0});}for(const E of o(u)){const T=u[E];function x(...e){if(new.target)throw c();return a(T,this,e)}i(x,"name",{__proto__:null,value:T.name}),i(x,"length",{__proto__:null,value:T.length}),i(g.Readable.prototype,E,{__proto__:null,value:x,enumerable:!1,configurable:!0,writable:!0});}g.Writable=e("./internal/streams/writable"),g.Duplex=e("./internal/streams/duplex"),g.Transform=e("./internal/streams/transform"),g.PassThrough=e("./internal/streams/passthrough"),g.pipeline=h;const{addAbortSignal:v}=e("./internal/streams/add-abort-signal");g.addAbortSignal=v,g.finished=p,g.destroy=f,g.compose=d,i(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(h,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)};},{"./internal/streams/add-abort-signal":20,"./internal/streams/compose":22,"./internal/streams/destroy":23,"./internal/streams/duplex":24,"./internal/streams/end-of-stream":26,"./internal/streams/legacy":28,"./internal/streams/operators":29,"./internal/streams/passthrough":30,"./internal/streams/pipeline":31,"./internal/streams/readable":32,"./internal/streams/transform":34,"./internal/streams/utils":35,"./internal/streams/writable":36,"./ours/errors":39,"./ours/primordials":40,"./ours/util":41,"./stream/promises":43,buffer:15}],43:[function(e,t,r){const{ArrayPrototypePop:n,Promise:i}=e("../ours/primordials"),{isIterable:o,isNodeStream:a,isWebStream:s}=e("../internal/streams/utils"),{pipelineImpl:l}=e("../internal/streams/pipeline"),{finished:u}=e("../internal/streams/end-of-stream");function c(...e){return new i(((t,r)=>{let i,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!a(c)&&!o(c)&&!s(c)){const t=n(e);i=t.signal,u=t.end;}l(e,((e,n)=>{e?r(e):t(n);}),{signal:i,end:u});}))}e("../../lib/stream.js"),t.exports={finished:u,pipeline:c};},{"../../lib/stream.js":42,"../internal/streams/end-of-stream":26,"../internal/streams/pipeline":31,"../internal/streams/utils":35,"../ours/primordials":40}]},{},[10])(10);var Qh=Vh.exports;class Zh{constructor(e,t){this.graphName=e,this.idx=t;}toString(){return `${this.graphName}:${this.idx}`}}class Kh{constructor(e,t){this.tp=e,this.val=t;}toString(){return JSON.stringify(this)}static getRefFromQuad(e){return e.termType===rs.IRI?new Kh(rs.IRI,e.value):e.termType===rs.BlankNode?new Kh(rs.BlankNode,e.value):new Kh(rs.Undefined,"")}}class Xh{async loadDocument(e,t=[]){const r=e.startsWith("http:"),n=e.startsWith("https:");if(!r&&!n)throw new rl('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:e});let i=null;const{res:o,body:a}=await rf({url:e}),s={contextUrl:null,documentUrl:e,document:a||null};if(o.status>=400)throw new rl(`URL "${e}" could not be dereferenced: ${o.statusText}`,"jsonld.InvalidUrl",{code:"loading document failed",url:e,httpStatusCode:o.status});const l=o.headers.get("link");let u=o.headers.get("location");const c=o.headers.get("content-type");if(l&&"application/ld+json"!==c&&"application/json"!==c){const t=hl.parseLinkHeader(l),r=t[vl.LINK_HEADER_CONTEXT];if(Array.isArray(r))throw new rl("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:e});r&&(s.contextUrl=r.target),i=t.alternate,i&&"application/ld+json"==i.type&&!(c||"").match(/^application\/(\w*\+)?json$/)&&(u=El.prependBase(e,i.target));}if((i||o.status>=300&&o.status<400)&&u){if(-1===t.length)throw new rl("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:e,httpStatusCode:o.status,redirects:t});if(-1!==t.indexOf(e))throw new rl("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:e,httpStatusCode:o.status,redirects:t});t.push(e);const r=new URL(u,e).href;return this.loadDocument(r,t)}return t.push(e),s}}const ef="cat";async function tf(e,t,r){if(!t&&!r)throw new rl("IPFS is not configured","jsonld.IPFSNotConfigured",{code:"loading document failed",url:nf+e});return null!==t?await async function(e,t){const r=new URL(function(e,t){const r="/api/v0";for(;e.endsWith("/");)e=e.slice(0,-1);return e.endsWith(r)||(e+=r),e+"/"+t}(t,ef));r.searchParams.append("arg",e);const{res:n,body:i}=await rf({url:r,method:"POST"});if(200!=n.status)throw new Error(`Error calling IPFS node: [${n.status}] ${n.statusText}\n${i}`);return {contextUrl:null,document:i||null,documentUrl:nf+e}}(e,t):await async function(e,t){const r=new Xh,n=await r.loadDocument(function(e,t){return function(e){for(;e.endsWith("/");)e=e.slice(0,-1);return e}(e)+"/ipfs/"+function(e){for(;e.startsWith("/");)e=e.slice(1);return e}(t)}(t,e),[]);return n.contextUrl=null,n.documentUrl=nf+e,n}(e,r)}async function rf({url:e,method:t}){const r={};void 0!==t&&(r.method=t);try{(e=new URL(e)).username&&e.password&&(r.headers={...r.headers??{},authorization:`Basic ${btoa(e.username+":"+e.password)}`},e=function(e){const t=new URL(e);return t.username="",t.password="",t.href}(e));const t=await fetch(e,r);if(t.status>=300&&t.status<400)return {res:t,body:null};const n=await t.text();return n&&n.length>0&&n.startsWith("{")?{res:t,body:JSON.parse(n)}:{res:t,body:n}}catch(t){if(t.response)return {res:t.response,body:null};throw new rl("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:e,cause:t})}}const nf="ipfs://";function of(e){return e?.hasher??a}function af(e){const t=e?.ipfsNodeURL??null,r=e?.ipfsGatewayURL??null;return e?.documentLoader??((e=null,t=null)=>async r=>{if(r.startsWith(nf)){const n=r.slice(nf.length);return await tf(n,e,t)}return (new Xh).loadDocument(r,[])})(t,r)}class sf{constructor(e=new Map){this.graphs=e;}static async fromDocument(e,t=af()){const r=await Hh.canonize(e,{format:i.QUADS_FORMAT,documentLoader:t}),n=new Qh.Parser({format:i.QUADS_FORMAT}).parse(r),o=new sf;for(const e of n){const t=e.graph.termType===i.DEFAULT_GRAPH_TERM_TYPE?i.DEFAULT_GRAPH_NODE_NAME:e.graph.value,r=o.graphs.get(t)??[];r.push(e),o.graphs.set(t,r);}return o}static getQuad(e,t){const r=e.graphs.get(t.graphName);if(!r)throw i.ERRORS.GRAPH_NOT_FOUND;if(t.idx>=r.length)throw i.ERRORS.QUAD_NOT_FOUND;return r[t.idx]}static iterGraphsOrdered(e,t){const r=[];for(const t of e.graphs.keys())r.push(t);r.sort(((e,t)=>e.localeCompare(t)));for(const n of r){t(n,e.graphs.get(n));}}static findParent(e,t){const r=sf.findParentInsideGraph(e,t);return r||sf.findGraphParent(e,t)}static findParentInsideGraph(e,t){const r=os(t);let n;const o=e.graphs.get(r);if(!o)return;const a=Kh.getRefFromQuad(t.subject);if(a.tp===rs.Undefined)return;let s=!1;for(let e=0;e<o.length;e++){const l=o[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&(a?.tp===u?.tp&&a?.val===u?.val)){if(s)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;s=!0,n=new Zh(r,e);}}return n}static findGraphParent(e,t){if(!t.graph)return;const r=Kh.getRefFromQuad(t.graph);if(r.tp===rs.Undefined)return;if(r.tp!==rs.BlankNode)throw new Error("graph parent can only be a blank node");let n,o=!1;for(const[a,s]of e.graphs)for(let e=0;e<s.length;e++){const l=s[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&r.toString()==u.toString()){if(o)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;o=!0,n=new Zh(a,e);}}if(o)return n;throw i.ERRORS.PARENT_NOT_FOUND}}sf.assertDatasetConsistency=e=>{for(const[t,r]of e.graphs)for(const e of r){if(!t)throw new Error("empty graph name");if(t===i.DEFAULT_GRAPH_NODE_NAME&&e.graph.id)throw new Error("graph should be nil for @default graph");if(!e.graph.id&&t!==i.DEFAULT_GRAPH_NODE_NAME)throw new Error("graph should not be nil for non-@default graph")}};class lf{constructor(e=[],t=a){this.parts=e,this.hasher=t;}reverse(){return this.parts.reverse()}append(e){this.parts=[...this.parts,...e];}prepend(e){this.parts=[...e,...this.parts];}async mtEntry(){const e=this.hasher??a,t=new Array(this.parts.length).fill(BigInt(0));for(let r=0;r<this.parts.length;r+=1){const n=this.parts[r];if("string"==typeof n){const i=ss.encode(n);t[r]=await e.hashBytes(i);}else {if("number"!=typeof n)throw new Error("error: unexpected type "+typeof n);t[r]=BigInt(n);}}return e.hash(t)}async pathFromContext(e,t,r){const n=JSON.parse(e);if(!n["@context"])throw i.ERRORS.CONTEXT_NOT_DEFINED;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=l[e];if(i.DIGITS_ONLY_REGEX.test(t))this.parts.push(parseInt(t));else {const e=s.mappings.get(t);if("object"!=typeof e)throw i.ERRORS.TERM_IS_NOT_DEFINED;const r=e["@id"];if(!r)throw i.ERRORS.NO_ID_ATTR;e["@context"]&&(s=await Hh.processContext(s,e,o)),this.parts.push(r);}}}async typeFromContext(e,t,r){const n=JSON.parse(e);if(!("@context"in n))throw i.ERRORS.PARSED_CONTEXT_IS_NULL;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=uf(s,l[e]);t.hasContext&&(s=await Hh.processContext(s,t.typeDef,o)),this.parts.push(t["@id"]);}return lf.getTypeMapping(s,l[l.length-1])}static getTypeMapping(e,t){let r="";const n=e.mappings.get("@type");n&&(r=n);const i=e.mappings.get(t);return i&&i["@type"]&&(r=i["@type"]),r}static async pathFromDocument(e,t,r,n,o){if(0===r.length)return [];const a=r[0],s=r.slice(1),l={documentLoader:af(o)};if(i.DIGITS_ONLY_REGEX.test(a)){return [parseInt(a),...await lf.pathFromDocument(e,t,s,!0,o)]}if("object"!=typeof t)throw new Error("error: expected type object got "+typeof t);if(Array.isArray(t)){if(!t.length)throw new Error("error: can't generate path on zero-sized array");if(!n)throw i.ERRORS.UNEXPECTED_ARR_ELEMENT;return lf.pathFromDocument(e,t[0],r,!1,o)}if("@context"in t)if(e)e=await Hh.processContext(e,t,l);else {const r=await Hh.processContext(null,null,l);e=await Hh.processContext(r,t,l);}const u=as(Object.keys(t)),c=e;for(const r in u){const n=u[r];if("@type"!==n){const t=e.mappings.get(n);if("object"!=typeof t)continue;if("@type"!==t["@id"])continue}let i=[];if(Array.isArray(t[n]))t[n].forEach((e=>{if("string"!=typeof e)throw new Error("error: @type value must be an array of strings: "+typeof e);i.push(e),i=as(i);}));else {if("string"!=typeof t[n])throw new Error("error: unexpected @type field type: "+typeof t[n]);i.push(t[n]);}for(const t of i){const r=c.mappings.get(t);"object"==typeof r&&"@context"in r&&(e=await Hh.processContext(e,r,l));}break}const d=uf(e,a);if(d.hasContext)if(e)e=await Hh.processContext(e,d.typeDef,l);else {const t=await Hh.processContext(null,null,l);e=await Hh.processContext(t,d.typeDef,l);}const h=await lf.pathFromDocument(e,t[a],s,!0,o);return [d["@id"],...h]}static async newPathFromCtx(e,t,r){const n=new lf([],of(r));return await n.pathFromContext(e,t,r),n}static async fromDocument(e,t,r,n){const o=JSON.parse(t),a=r.split(".");if(0===a.length)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const s=await lf.pathFromDocument(e,o,a,!1,n);return new lf(s,of(n))}static async newTypeFromContext(e,t,r){const n=new lf([],of(r));return await n.typeFromContext(e,t,r)}static async getTypeIDFromContext(e,t,r){const n=JSON.parse(e),i={documentLoader:af(r)},o=await Hh.processContext(null,null,i),a=(await Hh.processContext(o,n,i)).mappings.get(t);if(!a)throw new Error(`looks like ${t} is not a type`);const s=a["@id"];if(!s)throw new Error(`@id attribute is not found for type ${t}`);if("string"!=typeof s)throw new Error(`@id attribute is not a string for type ${t}`);return s}}function uf(e,t){const r=e.mappings.get(t);if("object"!=typeof r)throw i.ERRORS.TERM_IS_NOT_DEFINED;const n=r["@id"];if(!n)throw i.ERRORS.NO_ID_ATTR;if("string"!=typeof n)throw new Error("error: @id attr is not of type string: "+typeof n);return {"@id":n,hasContext:"@context"in r,typeDef:r}}lf.newPath=e=>{const t=new lf;return t.append(e),t},lf.getContextPathKey=async(e,t,r,n)=>{if(""===t)throw i.ERRORS.CTX_TYP_IS_EMPTY;if(""===r)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const o=await lf.newPathFromCtx(e,`${t}.${r}`,n),a=await lf.newPathFromCtx(e,t,n);return new lf(o.parts.slice(a.parts.length))};class cf{constructor(e){this.graph=os(e);const t=e.subject;switch(t.termType){case rs.IRI:this.subject={tp:rs.IRI,val:t.value};break;case rs.BlankNode:this.subject={tp:rs.BlankNode,val:t.value};break;default:throw new Error("invalid subject type")}if(e.predicate.termType!==rs.IRI)throw new Error("invalid predicate type");this.predicate=e.predicate.value;}toString(){return JSON.stringify(this)}}cf.countEntries=e=>{const t=new Map;for(const r of e){const e=new cf(r);let n=t.get(e.toString())??0;t.set(e.toString(),++n);}return t};class df{constructor(e=new Map,t=new Map,r=a){this.parents=e,this.children=t,this.hasher=r;}static getIriValue(e){if(e.predicate.termType===rs.IRI)return e.predicate.value;throw new Error("type is not IRI")}path(e,t,r){const n=new lf([],this.hasher);"number"==typeof r&&n.append([r]);const i=sf.getQuad(t,e),o=df.getIriValue(i);n.append([o]);let a=e;for(;;){const e=this.parents.get(a.toString());if(!e)break;const r=sf.getQuad(t,e),i=new cf(r),o=this.children.get(i.toString());if(!o)throw new Error("parent mapping not found");const s=sf.getQuad(t,a),l=Kh.getRefFromQuad(s.subject),u=o.get(l.toString());if("number"!=typeof u)throw new Error("child not found in parents mapping");const c=df.getIriValue(r);1===o.size?n.append([c]):n.append([u,c]),a=e;}return n.reverse(),n}static async newRelationship(e,t){const r=new df(new Map,new Map,t);return sf.iterGraphsOrdered(e,((t,n)=>{for(let i=0;i<n.length;i++){const o=n[i],a=sf.findParent(e,o);if(!a)continue;const s=new Zh(t,i);r.parents.set(s.toString(),a);const l=sf.getQuad(e,a),u=new cf(l);let c=r.children.get(u.toString());c||(c=new Map,r.children.set(u.toString(),c));const d=Kh.getRefFromQuad(o.subject);if("number"!=typeof c.get(d.toString())){const e=c.size;c.set(d.toString(),e);}}})),r}}class hf{constructor(e,t,r="",n=a){if(this.key=e,this.value=t,this.dataType=r,this.hasher=n,!e.parts.length)throw new Error("key length is zero");(e=>{switch(typeof e){case"boolean":case"string":case"bigint":case"number":return;case"object":if(e instanceof es.Instant)return}throw new Error(`unexpected value type ${typeof e}, expected boolean | number | Temporal.Instant | string`)})(t);}getHasher(){return this.hasher}getKeyMtEntry(){return this.key.mtEntry()}getValueMtEntry(){return hs.mkValueMtEntry(this.getHasher(),this.value)}async getKeyValueMTEntry(){return {k:await this.getKeyMtEntry(),v:await this.getValueMtEntry()}}static async fromDataSet(e,t=a){sf.assertDatasetConsistency(e);if(!e.graphs.get(i.DEFAULT_GRAPH_NODE_NAME).length)throw new Error("@default graph not found in dataset");const r=await df.newRelationship(e,t),n=[];return sf.iterGraphsOrdered(e,((i,o)=>{const a=cf.countEntries(o),s=new Map;for(let l=0;l<o.length;l++){let u="";const c=o[l],d=new Zh(i,l),h=new cf(c);let f;const p=c.object.termType,m=c.object.value;switch(p){case rs.Literal:u=c?.object?.datatype?.value,f=us(u,m,t.prime());break;case rs.IRI:if(!p)throw new Error("object IRI is nil");f=m;break;case rs.BlankNode:if(r.children.get(h.toString()))continue;throw new Error("BlankNode is not supported yet");case"Variable":f=m;break;default:throw new Error("unexpected Quad's Object type")}let y;switch(a.get(h.toString())){case 0:throw new Error("[assertion] key not found in counts");case 1:break;default:const e=h.toString();y=s.get(e)??0,s.set(e,y+1);}const g=r.path(d,e,y),v=new hf(g,f,u,t);n.push(v);}})),n}}hf.newRDFEntry=(e,t)=>{const r=new hf(e,t);switch(typeof t){case"number":case"string":case"boolean":r.value=t;break;default:if(!(t instanceof es.Instant))throw new Error("error: incorrect value type "+typeof t);r.value=t;}return r};class ff{constructor(e=null,i=null,o=a,s=new Map,l=null,u=af()){if(this.srcDoc=e,this.mt=i,this.hasher=o,this.entries=s,this.compacted=l,this.documentLoader=u,!i){const{db:e,writable:i,maxLevels:o}=((e="",n=!0,i=40)=>({db:new j$1(B$2(e)),writable:n,maxLevels:i}))();this.mt=new Pt$1(e,i,o);}}async proof(e){const t=await e.mtEntry(),{proof:r}=await this.mt.generateProof(t);if(r.existence){if(!this.entries.has(t.toString()))throw new Error("error: [assertion] no entry found while existence is true");const e=this.entries.get(t.toString());return {proof:r,value:new hs(e.value,this.hasher)}}return {proof:r}}mkValue(e){return new hs(e,this.hasher)}async resolveDocPath(e,t){const r=await lf.fromDocument(null,this.srcDoc,e,t);return r.hasher=this.hasher,r}async entry(e){const t=await e.mtEntry(),r=this.entries.get(t.toString());if(!r)throw new Error("entry not found");return r}async jsonLDType(e){return (await this.entry(e)).dataType}async root(){return this.mt.root()}rawValue(e){let t=e.parts,r=this.compacted;const n=[];for(;t.length>0;){const e=t[0];if("string"==typeof e){if(n.push(e),r=r[e]??r["@graph"][e],!r)throw new Error("value not found")}else {if("number"!=typeof e)throw new Error(`unexpected type of path ${n.join(" / ")}`);n.push(e.toString()),r=this.rvExtractArrayIdx(r,e);}t=t.slice(1);}return void 0!==r["@value"]?r["@value"]:r}rvExtractArrayIdx(e,t){if(!Array.isArray(e))throw new Error("expected array");if(t<0||t>=e.length)throw new Error("index is out of range");return e[t]}static async merklizeJSONLD(e,t){const r=of(t),n=af(t),i=new ff(e,null,r,new Map,null,n),o=JSON.parse(i.srcDoc),a=await sf.fromDocument(o,n),s=await hf.fromDataSet(a,r);for(const e of s){const t=await e.getKeyMtEntry();i.entries.set(t.toString(),e);}return await(async(e,t)=>{for(const r of t){const{k:t,v:n}=await r.getKeyValueMTEntry();await e.add(t,n);}})(i.mt,s),i.compacted=await Hh.compact(o,{},{documentLoader:n,base:null,compactArrays:!0,compactToRelative:!0}),i}static async hashValue(e,t){return this.hashValueWithHasher(a,e,t)}static async hashValueWithHasher(e,t,r){const n=((e,t)=>{const r=t===ns.Double;switch(typeof e){case"string":return r?is(parseFloat(e)):e;case"boolean":return `${e}`;case"number":return r?is(e):`${e}`;default:throw new Error("unsupported type")}})(r,t),i=us(t,n,e.prime());return await hs.mkValueMtEntry(e,i)}get options(){return {hasher:this.hasher,documentLoader:this.documentLoader}}}
7918
+ const dh=Vs,hh=Ml,fh=hl,ph=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e;}async resolve({activeCtx:e,context:t,documentLoader:r,base:n,cycles:i=new Set}){t&&uu(t)&&t["@context"]&&(t=t["@context"]),t=du(t);const o=[];for(const a of t){if(cu(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:r,base:n,cycles:i})),lu(t)?o.push(...t):o.push(t);continue}if(null===a){o.push(new pu({document:null}));continue}uu(a)||mu(t);const s=JSON.stringify(a);let l=this._get(s);l||(l=new pu({document:a}),this._cacheResolvedContext({key:s,resolved:l,tag:"static"})),o.push(l);}return o}_get(e){let t=this.perOpCache.get(e);if(!t){const r=this.sharedCache.get(e);r&&(t=r.get("static"),t&&this.perOpCache.set(e,t));}return t}_cacheResolvedContext({key:e,resolved:t,tag:r}){if(this.perOpCache.set(e,t),void 0!==r){let n=this.sharedCache.get(e);n||(n=new Map,this.sharedCache.set(e,n)),n.set(r,t);}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:r,base:n,cycles:i}){t=hu(n,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:i});yu({context:o,base:n=a.documentUrl||t});const s=await this.resolve({activeCtx:e,context:o,documentLoader:r,base:n,cycles:i});return this._cacheResolvedContext({key:t,resolved:s,tag:a.tag}),s}async _fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:n}){if(n.size>10)throw new fu("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(n.has(t))throw new fu("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let i,o;n.add(t);try{o=await r(t),i=o.document||null,cu(i)&&(i=JSON.parse(i));}catch(e){throw new fu("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!uu(i))throw new fu("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:t});return i="@context"in i?{"@context":i["@context"]}:{"@context":{}},o.contextUrl&&(lu(i["@context"])||(i["@context"]=[i["@context"]]),i["@context"].push(o.contextUrl)),{context:i,remoteDoc:o}}},mh=fh.IdentifierIssuer,yh=tl,gh=au,vh=gu,{expand:wh}=pc,{flatten:bh}=Dc,{fromRDF:_h}=Jc,{toRDF:Eh}=yd,{frameMergedOrDefault:Th,cleanupNull:xh}=kd,{isArray:Ih,isObject:Sh,isString:Rh}=Zs,{isSubjectReference:kh}=el,{expandIri:jh,getInitialContext:Dh,process:Nh,processingMode:Oh}=Uu,{compact:Ch,compactIri:Ah}=uh,{createNodeMap:Mh,createMergedNodeMap:Lh,mergeNodeMaps:Ph}=Sc,{logEventHandler:Bh,logWarningEventHandler:$h,safeEventHandler:Fh,setDefaultEventHandler:Uh,setupEventHandler:qh,strictEventHandler:Yh,unhandledEventHandler:Wh}=Eu,zh=function(e){const t={},r=new gh({max:100});function n(t,{documentLoader:r=e.documentLoader,...n}){if(t&&"compactionMap"in t)throw new yh('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new yh('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:r},n,t,{eventHandler:qh({options:t})})}return e.compact=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===i)throw new yh("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let a;(o=n(o,{base:Rh(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new mh("_:b"),contextResolver:new ph({sharedCache:r})})).link&&(o.skipExpansion=!0),o.compactToRelative||delete o.base,a=o.skipExpansion?t:await e.expand(t,o);const s=await e.processContext(Dh(o),i,o);let l=await Ch({activeCtx:s,element:a,options:o});o.compactArrays&&!o.graph&&Ih(l)?1===l.length?l=l[0]:0===l.length&&(l={}):o.graph&&Sh(l)&&(l=[l]),Sh(i)&&"@context"in i&&(i=i["@context"]),i=fh.clone(i),Ih(i)||(i=[i]);const u=i;i=[];for(let e=0;e<u.length;++e)(!Sh(u[e])||Object.keys(u[e]).length>0)&&i.push(u[e]);const c=i.length>0;if(1===i.length&&(i=i[0]),Ih(l)){const e=Ah({activeCtx:s,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},c&&(l["@context"]=i),l[e]=t;}else if(Sh(l)&&c){const e=l;l={"@context":i};for(const t in e)l[t]=e[t];}return l},e.expand=async function(t,i){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const o={},a=[];if("expandContext"in(i=n(i,{keepFreeFloatingNodes:!1,contextResolver:new ph({sharedCache:r})}))){const e=fh.clone(i.expandContext);Sh(e)&&"@context"in e?o.expandContext=e:o.expandContext={"@context":e},a.push(o.expandContext);}let s;if(Rh(t)){const r=await e.get(t,i);s=r.documentUrl,o.input=r.document,r.contextUrl&&(o.remoteContext={"@context":r.contextUrl},a.push(o.remoteContext));}else o.input=fh.clone(t);"base"in i||(i.base=s||"");let l=Dh(i);for(const e of a)l=await Nh({activeCtx:l,localCtx:e,options:i});let u=await wh({activeCtx:l,element:o.input,options:i});return Sh(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),Ih(u)||(u=[u]),u},e.flatten=async function(t,i,o){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");i="function"==typeof i?null:i||null,o=n(o,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const a=await e.expand(t,o),s=bh(a);if(null===i)return s;o.graph=!0,o.skipExpansion=!0;return await e.compact(s,i,o)},e.frame=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(o=n(o,{base:Rh(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new ph({sharedCache:r})}),Rh(i)){const t=await e.get(i,o);if(i=t.document,t.contextUrl){let e=i["@context"];e?Ih(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,i["@context"]=e;}}const a=i&&i["@context"]||{},s=await e.processContext(Dh(o),a,o);o.hasOwnProperty("omitGraph")||(o.omitGraph=Oh(s,1.1)),o.hasOwnProperty("pruneBlankNodeIdentifiers")||(o.pruneBlankNodeIdentifiers=Oh(s,1.1));const l=await e.expand(t,o),u={...o};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(i,u),d=Object.keys(i).map((e=>jh(s,e,{vocab:!0})));u.merged=!d.includes("@graph"),u.is11=Oh(s,1.1);const h=Th(l,c,u);u.graph=!o.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let f=await e.compact(h,a,u);return u.link={},f=xh(f,u),f},e.link=async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)},e.normalize=e.canonize=async function(t,i){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(i=n(i,{base:Rh(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new ph({sharedCache:r})}))){if("application/n-quads"!==i.inputFormat&&"application/nquads"!==i.inputFormat)throw new yh("Unknown canonicalization input format.","jsonld.CanonizeError");const e=vh.parse(t);return dh.canonize(e,i)}const o={...i};delete o.format,o.produceGeneralizedRdf=!1;const a=await e.toRDF(t,o);return dh.canonize(a,i)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=n(r,{format:Rh(e)?"application/n-quads":void 0});const{format:i}=r;let{rdfParser:o}=r;if(i){if(o=o||t[i],!o)throw new yh("Unknown input format.","jsonld.UnknownFormat",{format:i})}else o=()=>e;const a=await o(e);return _h(a,r)},e.toRDF=async function(t,i){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let o;o=(i=n(i,{base:Rh(t)?t:"",skipExpansion:!1,contextResolver:new ph({sharedCache:r})})).skipExpansion?t:await e.expand(t,i);const a=Eh(o,i);if(i.format){if("application/n-quads"===i.format||"application/nquads"===i.format)return vh.serialize(a);throw new yh("Unknown output format.","jsonld.UnknownFormat",{format:i.format})}return a},e.createNodeMap=async function(t,i){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");i=n(i,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const o=await e.expand(t,i);return Lh(o,i)},e.merge=async function(t,i,o){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!Ih(t))throw new TypeError('Could not merge, "docs" must be an array.');i="function"==typeof i?null:i||null,o=n(o,{contextResolver:new ph({sharedCache:r})});const a=await Promise.all(t.map((t=>{const r={...o};return e.expand(t,r)})));let s=!0;"mergeNodes"in o&&(s=o.mergeNodes);const l=o.issuer||new mh("_:b"),u={"@default":{}};for(let e=0;e<a.length;++e){const t=fh.relabelBlankNodes(a[e],{issuer:new mh("_:b"+e+"-")}),r=s||0===e?u:{"@default":{}};if(Mh(t,r,"@default",l),r!==u)for(const e in r){const t=r[e];if(!(e in u)){u[e]=t;continue}const n=u[e];for(const e in t)e in n||(n[e]=t[e]);}}const c=Ph(u),d=[],h=Object.keys(c).sort();for(let e=0;e<h.length;++e){const t=c[h[e]];kh(t)||d.push(t);}if(null===i)return d;o.graph=!0,o.skipExpansion=!0;return await e.compact(d,i,o)},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new yh("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,r){let n;n="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const i=await n(t);try{if(!i.document)throw new yh("No remote document found at the given URL.","jsonld.NullRemoteDocument");Rh(i.document)&&(i.document=JSON.parse(i.document));}catch(e){throw new yh("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,i){return i=n(i,{base:"",contextResolver:new ph({sharedCache:r})}),null===t?Dh(i):(t=fh.clone(t),Sh(t)&&"@context"in t||(t={"@context":t}),Nh({activeCtx:e,localCtx:t,options:i}))},e.getContextValue=Uu.getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new yh('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1));},e.registerRDFParser=function(e,r){t[e]=r;},e.unregisterRDFParser=function(e){delete t[e];},e.registerRDFParser("application/n-quads",vh.parse),e.registerRDFParser("application/nquads",vh.parse),e.url=El,e.logEventHandler=Bh,e.logWarningEventHandler=$h,e.safeEventHandler=Fh,e.setDefaultEventHandler=Uh,e.strictEventHandler=Yh,e.unhandledEventHandler=Wh,e.util=fh,Object.assign(e,fh),e.promises=e,e.RequestQueue=wl(),e.JsonLdProcessor=(lh||(lh=1,sh=e=>{class t{toString(){return "[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}),sh)(e),hh.setupGlobals(e),hh.setupDocumentLoaders(e),e},Gh=function(){return zh((function(){return Gh()}))};zh(Gh);var Hh=Gh;function Jh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vh={exports:{}};Vh.exports=function(){function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){if(!s&&Jh)return Jh(a);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,r,n);}return r[a].exports}for(var o=Jh,a=0;a<n.length;a++)i(n[a]);return i}return e}()({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",o="http://www.w3.org/2000/10/swap/";r.default={xsd:{decimal:`${i}decimal`,boolean:`${i}boolean`,double:`${i}double`,integer:`${i}integer`,string:`${i}string`},rdf:{type:`${n}type`,nil:`${n}nil`,first:`${n}first`,rest:`${n}rest`,langString:`${n}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${o}reify#forSome`,forAll:`${o}reify#forAll`},log:{implies:`${o}log#implies`}};},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Variable=r.Triple=r.Term=r.Quad=r.NamedNode=r.Literal=r.DefaultGraph=r.BlankNode=void 0,r.escapeQuotes=b,r.termFromId=g,r.termToId=v,r.unescapeQuotes=_;var n=i(e("./IRIs"));function i(e){return e&&e.__esModule?e:{default:e}}const{rdf:o,xsd:a}=n.default;let s,l=0;const u=/^"(.*".*)(?="[^"]*$)/,c={namedNode:E,blankNode:T,variable:I,literal:x,defaultGraph:S,quad:R,triple:R};r.default=c;class d{constructor(e){this.id=e;}get value(){return this.id}equals(e){return e instanceof d?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return {termType:this.termType,value:this.value}}}r.Term=d;class h extends d{get termType(){return "NamedNode"}}r.NamedNode=h;class f extends d{get termType(){return "Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return "^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof f?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return {termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}r.Literal=f;class p extends d{constructor(e){super(`_:${e}`);}get termType(){return "BlankNode"}get value(){return this.id.substr(2)}}r.BlankNode=p;class m extends d{constructor(e){super(`?${e}`);}get termType(){return "Variable"}get value(){return this.id.substr(1)}}r.Variable=m;class y extends d{constructor(){return super(""),s||this}get termType(){return "DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}function g(e,t,r){if(t=t||c,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===c)return new f(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const n=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,n-1),"@"===e[n+1]?e.substr(n+2):t.namedNode(e.substr(n+3)));case"[":e=JSON.parse(e);break;default:if(!r||!Array.isArray(e))return t.namedNode(e)}return t.quad(g(e[0],t,!0),g(e[1],t,!0),g(e[2],t,!0),e[3]&&g(e[3],t,!0))}function v(e,t){if("string"==typeof e)return e;if(e instanceof d&&"Quad"!==e.termType)return e.id;if(!e)return s.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return `_:${e.value}`;case"Variable":return `?${e.value}`;case"DefaultGraph":return "";case"Literal":return `"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==a.string?`^^${e.datatype.value}`:""}`;case"Quad":const r=[v(e.subject,!0),v(e.predicate,!0),v(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&r.push(v(e.graph,!0)),t?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${e.termType}`)}}r.DefaultGraph=y,s=new y;class w extends d{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s;}get termType(){return "Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return {termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return !!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function b(e){return e.replace(u,((e,t)=>`"${t.replace(/"/g,'""')}`))}function _(e){return e.replace(u,((e,t)=>`"${t.replace(/""/g,'"')}`))}function E(e){return new h(e)}function T(e){return new p(e||"n3-"+l++)}function x(e,t){if("string"==typeof t)return new f(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return ""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new f(`"${e}"`):new f(`"${e}"^^${r}`)}function I(e){return new m(e)}function S(){return s}function R(e,t,r,n){return new w(e,t,r,n)}r.Triple=r.Quad=w;},{"./IRIs":1}],3:[function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=o(e("queue-microtask")),i=o(e("./IRIs"));function o(e){return e&&e.__esModule?e:{default:e}}const{xsd:a}=i.default,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,l={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},u=/[\x00-\x20<>\\"\{\}\|\^\`]/,c={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},d=/$0^/;class h{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in c)&&this[e]instanceof RegExp&&(this[e]=d);}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0;}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this._comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this._comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const l=this._line,c=r[0];let d="",h="",f="",p=null,m=0,y=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(m=1,d="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(r))d="IRI",h=p[1];else if(p=this._iri.exec(r)){if(h=this._unescape(p[1]),null===h||u.test(h))return o(this);d="IRI";}else r.length>1&&"<"===r[1]?(d="<<",m=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d="inverse",m=2,h=">");break;case">":r.length>1&&">"===r[1]&&(d=">>",m=2);break;case"_":((p=this._blank.exec(r))||t&&(p=this._blank.exec(`${r} `)))&&(d="blank",f="_",h=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);}break;case"?":this._n3Mode&&(p=this._variable.exec(r))&&(d="var",h=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(r))?(d="langcode",h=p[1]):(p=this._keyword.exec(r))&&(d=p[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){d=".",m=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(r)||t&&(p=this._number.exec(`${r} `)))&&(d="literal",h=p[0],f="string"==typeof p[1]?a.double:"string"==typeof p[2]?a.decimal:a.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(r))?d=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(r))?(d="literal",h=p[0],f=a.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(r))?(d="abbreviation",h="a"):y=!0;break;case"=":this._n3Mode&&r.length>1&&(d="abbreviation",">"!==r[1]?(m=1,h="="):(m=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(m=1,d=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(d="{|",m=2):(d=c,m=1));break;case"|":r.length>=2&&"}"===r[1]&&(d="|}",m=2);break;default:y=!0;}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(r))?((p=this._prefixed.exec(r))||t&&(p=this._prefixed.exec(`${r} `)))&&(d="prefixed",f=p[1]||"",h=this._unescape(p[2])):(d="prefix",h=p[1]||"")),"^^"===this._previousMarker)switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d="";}if(!d)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const g=m||p[0].length,v=i(d,h,f,l,g);this.previousToken=v,this._previousMarker=d,r=r.substr(g,r.length);}function i(t,i,o,a,s){const l=r?n-r.length:n,u={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,u),u}function o(t){e(t._syntaxError(/^\S*/.exec(r)[0]));}}_unescape(e){let t=!1;const r=e.replace(s,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in l?l[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}n++;}this._literalClosingPos=e.length-r+1;}return {value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,r){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof r){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}(0, n.default)((()=>this._tokenizeToEnd(r,!0)));}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=t.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(r,!1)));})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(r,!0);})),e.on("error",r);}}r.default=h;}).call(this);}).call(this,e("buffer").Buffer);},{"./IRIs":1,buffer:15,"queue-microtask":19}],4:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=a(e("./N3Lexer")),i=a(e("./N3DataFactory")),o=a(e("./IRIs"));function a(e){return e&&e.__esModule?e:{default:e}}let s=0;class l{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&c(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),l=o||a;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||o||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new n.default({lineMode:l,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers;}static _resetBlankNodePrefix(){s=0;}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1];}else this._base="",this._basePath="";}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified));}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified);}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return !t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return "{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return "{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return "]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph);}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null;}return {token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return "}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r);}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return "."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return "prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return "]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return ","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph);}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return ">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH));}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=u;}_resolveIRI(e){return /^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return ("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return /^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return `${r}/${e.substr(n+1)}`;o=n+1;}}}a=e[++n];}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${s++}_`,this._prefixCallback=r||u,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n);},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=u):this._readCallback&&(this._readCallback=this._readCallback(t));}));}}function u(){}function c(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(o.default.rdf.first),e.RDF_REST=r(o.default.rdf.rest),e.RDF_NIL=r(o.default.rdf.nil),e.N3_FORALL=r(o.default.r.forAll),e.N3_FORSOME=r(o.default.r.forSome),e.ABBREVIATIONS={a:r(o.default.rdf.type),"=":r(o.default.owl.sameAs),">":r(o.default.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers");}r.default=l,c(l.prototype,i.default);},{"./IRIs":1,"./N3DataFactory":2,"./N3Lexer":3}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=u(e("./N3DataFactory")),o=s(e("./IRIs")),a=e("./N3Util");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (l=function(e){return e?r:t})(e)}function u(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}class c{constructor(e,t){this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._entities=Object.create(null),this._blankNodeIndex=0,t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||i.default,e&&this.addQuads(e);}_termFromId(e,t){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return (0, i.termFromId)(e,t)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&((0, a.isDefaultGraph)(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[(0, i.termToId)(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${(0, a.isDefaultGraph)(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:(0, i.termToId)(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t];}*_findInIndex(e,t,r,n,i,o,a,s){let l,u,c;const d=this._entities,h=this._termFromId(s,this._factory),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(u=e[t]){f[i]=this._termFromId(d[t],this._factory),r&&((l=u,u={})[r]=l[r]);for(const e in u)if(c=u[e]){f[o]=this._termFromId(d[e],this._factory);const t=n?n in c?[n]:[]:Object.keys(c);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]],this._factory),yield this._factory.quad(f.subject,f.predicate,f.object,h);}}}_loop(e,t){for(const r in e)t(r);}_loopByKey0(e,t,r){let n,i;if(n=e[t])for(i in n)r(i);}_loopByKey1(e,t,r){let n,i;for(n in e)i=e[n],i[t]&&r(n);}_loopBy2Keys(e,t,r,n){let i,o,a;if((i=e[t])&&(o=i[r]))for(a in o)n(a);}_countInIndex(e,t,r,n){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){r&&((i=o,o={})[r]=i[r]);for(const e in o)(a=o[e])&&(n?n in a&&s++:s+=Object.keys(a).length);}return s}_getGraphs(e){if(!d(e))return this._graphs;const t={};return t[e]=this._graphs[e],t}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)));}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);let o=this._graphs[n];o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r);const a=this._addToIndex(o.subjects,e,t,r);return this._addToIndex(o.predicates,t,r,e),this._addToIndex(o.objects,r,e,t),this._size=null,a}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}delete(e){return this.removeQuad(e),this}has(e,t,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}importStream(e){return e.on("data",(e=>{this.addQuad(e);})),e}removeQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);const o=this._graphs;let a,s,l;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(a=o[n])&&(s=a.subjects[e])&&(l=s[t])&&r in l))return !1;for(e in this._removeFromIndex(a.subjects,e,t,r),this._removeFromIndex(a.predicates,t,r,e),this._removeFromIndex(a.objects,r,e,t),null!==this._size&&this._size--,a.subjects)return !0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t]);}remove(e){return e.on("data",(e=>{this.removeQuad(e);})),e}removeMatches(e,t,r,i){const o=new n.Readable({objectMode:!0});return o._read=()=>{for(const n of this.readQuads(e,t,r,i))o.push(n);o.push(null);},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return [...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u;if(!(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(const e in o)(a=o[e])&&(s?u?yield*this._findInIndex(a.objects,u,s,l,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,s,l,null,"subject","predicate","object",e):l?yield*this._findInIndex(a.predicates,l,u,null,"predicate","object","subject",e):u?yield*this._findInIndex(a.objects,u,null,null,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",e));}match(e,t,r,n){return new h(this,e,t,r,n)}countQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u,c=0;if(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r)))return 0;for(const n in o)(a=o[n])&&(c+=e?r?this._countInIndex(a.objects,u,s,l):this._countInIndex(a.subjects,s,l,u):t?this._countInIndex(a.predicates,l,u,s):this._countInIndex(a.objects,u,s,l));return c}forEach(e,t,r,n,i){this.some((t=>(e(t),!1)),t,r,n,i);}every(e,t,r,n,i){let o=!1;const a=!this.some((t=>(o=!0,!e(t))),t,r,n,i);return o&&a}some(e,t,r,n,i){for(const o of this.readQuads(t,r,n,i))if(e(o))return !0;return !1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e);}),e,t,r),n}forSubjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.predicates,s,l,e):this._loopByKey1(a.subjects,s,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e));}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e);}),e,t,r),n}forPredicates(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.objects,l,s,e):this._loopByKey0(a.subjects,s,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e));}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e);}),e,t,r),n}forObjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.subjects,s,l,e):this._loopByKey1(a.objects,s,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e));}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e);}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,i);}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++;}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,o.default.rdf.rest,o.default.rdf.nil,null),a=e?[...i]:[];return i.forEach((t=>{const i=[];let s,l,u=!1;const c=t.graph;let d=t.subject;for(;d&&!u;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,f=null,p=null;for(let i=0;i<t.length&&!u;i++)r=t[i],r.graph.equals(c)?s?u=n(d,"has non-list arcs out"):r.predicate.value===o.default.rdf.first?h?u=n(d,"has multiple rdf:first arcs"):a.push(h=r):r.predicate.value===o.default.rdf.rest?f?u=n(d,"has multiple rdf:rest arcs"):a.push(f=r):e.length?u=n(d,"can't be subject and object"):(s=r,l="subject"):u=n(d,"not confined to single graph");for(let t=0;t<e.length&&!u;++t)r=e[t],s?u=n(d,"can't have coreferences"):r.predicate.value===o.default.rdf.rest?p?u=n(d,"has incoming rdf:rest arcs"):p=r:(s=r,l="object");h?i.unshift(h.object):u=n(d,"has no list head"),d=p&&p.subject;}u?e=!1:s&&(r[s[l].value]=i);})),e&&this.removeQuads(a),r}*[Symbol.iterator](){yield*this.readQuads();}}function d(e){return "string"==typeof e||e instanceof String}r.default=c;class h extends n.Readable{constructor(e,t,r,n,i){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:i});}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:i}=this,o=this._filtered=new c({factory:e._factory});for(const a of e.readQuads(i,n,r,t))o.addQuad(a);}return this._filtered}get size(){return this.filtered.size}_read(){for(const e of this)this.push(e);this.push(null);}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new h(this.filtered,e,t,r,n)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph);}}},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8,"readable-stream":38}],6:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Parser"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){let t,r;super({decodeStrings:!0}),this._readableState.objectMode=!0,new i.default(e).parse({on:(e,n)=>{switch(e){case"data":t=n;break;case"end":r=n;}}},((e,t)=>{e&&this.emit("error",e)||t&&this.push(t);}),((e,t)=>{this.emit("prefix",e,t);})),this._transform=(e,r,n)=>{t(e),n();},this._flush=e=>{r(),e();};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),this}}r.default=a;},{"./N3Parser":4,"readable-stream":38}],7:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Writer"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new i.default({write:(e,t,r)=>{this.push(e),r&&r();},end:e=>{this.push(null),e&&e();}},e);this._transform=(e,r,n)=>{t.addQuad(e,n);},this._flush=e=>{t.end(e);};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t);})),this}}r.default=a;},{"./N3Writer":9,"readable-stream":38}],8:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.inDefaultGraph=c,r.isBlankNode=a,r.isDefaultGraph=u,r.isLiteral=s,r.isNamedNode=o,r.isVariable=l,r.prefix=d,r.prefixes=h;var n=i(e("./N3DataFactory"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return !!e&&"NamedNode"===e.termType}function a(e){return !!e&&"BlankNode"===e.termType}function s(e){return !!e&&"Literal"===e.termType}function l(e){return !!e&&"Variable"===e.termType}function u(e){return !!e&&"DefaultGraph"===e.termType}function c(e){return u(e.graph)}function d(e,t){return h({"":e.value||e},t)("")}function h(e,t){const r=Object.create(null);for(const t in e)i(t,e[t]);function i(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e));}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||n.default,i}},{"./N3DataFactory":2}],9:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=l(e("./IRIs")),i=s(e("./N3DataFactory")),o=e("./N3Util");function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (a=function(e){return e?r:t})(e)}function s(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const u=i.default.defaultGraph(),{rdf:c,xsd:d}=n.default,h=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,f=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,p={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class m extends i.Term{equals(e){return e===this}}class y{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else {let e="";this._outputStream={write(t,r,n){e+=t,n&&n();},end:t=>{t&&t(null,e);}},this._endStream=!0;}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=u,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${v(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length));}get _inDefaultGraph(){return u.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t);}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(u.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i);}catch(e){i&&i(e);}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i);}quadToString(e,t,r,n){return `${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return "Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),h.test(t)&&(t=t.replace(f,g));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(h.test(t)&&(t=t.replace(f,g)),e.language)return `"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===d.string)return `"${t}"`}else switch(e.datatype.value){case d.string:return `"${t}"`;case d.boolean:if("true"===t||"false"===t)return t;break;case d.integer:if(/^[+-]?\d+$/.test(t))return t;break;case d.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case d.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return `"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===c.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return `<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${(0, o.isDefaultGraph)(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,u,n):this._writeQuad(e,t,r,n||u,i);}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r);}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`);}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=v(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`);}this._write(r?"\n":"",t);}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new m("[]");case 1:if(r=i[0],!(r.object instanceof m))return new m(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=`, ${this._encodeObject(r.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new m(`${t}\n]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new m(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n);});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t();}}function g(e){let t=p[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function v(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}r.default=y;},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8}],10:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BlankNode",{enumerable:!0,get:function(){return c.BlankNode}}),Object.defineProperty(r,"DataFactory",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"DefaultGraph",{enumerable:!0,get:function(){return c.DefaultGraph}}),Object.defineProperty(r,"Lexer",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return c.Literal}}),Object.defineProperty(r,"NamedNode",{enumerable:!0,get:function(){return c.NamedNode}}),Object.defineProperty(r,"Parser",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"Quad",{enumerable:!0,get:function(){return c.Quad}}),Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"StreamParser",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"StreamWriter",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"Term",{enumerable:!0,get:function(){return c.Term}}),Object.defineProperty(r,"Triple",{enumerable:!0,get:function(){return c.Triple}}),r.Util=void 0,Object.defineProperty(r,"Variable",{enumerable:!0,get:function(){return c.Variable}}),Object.defineProperty(r,"Writer",{enumerable:!0,get:function(){return o.default}}),r.default=void 0,Object.defineProperty(r,"termFromId",{enumerable:!0,get:function(){return c.termFromId}}),Object.defineProperty(r,"termToId",{enumerable:!0,get:function(){return c.termToId}});var n=f(e("./N3Lexer")),i=f(e("./N3Parser")),o=f(e("./N3Writer")),a=f(e("./N3Store")),s=f(e("./N3StreamParser")),l=f(e("./N3StreamWriter")),u=h(e("./N3Util"));r.Util=u;var c=h(e("./N3DataFactory"));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (d=function(e){return e?r:t})(e)}function h(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function f(e){return e&&e.__esModule?e:{default:e}}r.default={Lexer:n.default,Parser:i.default,Writer:o.default,Store:a.default,StreamParser:s.default,StreamWriter:l.default,Util:u,DataFactory:c.default,Term:c.Term,NamedNode:c.NamedNode,Literal:c.Literal,BlankNode:c.BlankNode,Variable:c.Variable,DefaultGraph:c.DefaultGraph,Quad:c.Quad,Triple:c.Triple,termFromId:c.termFromId,termToId:c.termToId};},{"./N3DataFactory":2,"./N3Lexer":3,"./N3Parser":4,"./N3Store":5,"./N3StreamParser":6,"./N3StreamWriter":7,"./N3Util":8,"./N3Writer":9}],11:[function(e,t,r){const{AbortController:n,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=n,t.exports.AbortSignal=i,t.exports.default=n;},{}],12:[function(e,t,r){r.byteLength=c,r.toByteArray=h,r.fromByteArray=m;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return -1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function d(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,n=u(e),a=n[0],s=n[1],l=new o(d(e,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(f(n));return i.join("")}function m(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,l=r-i;s<l;s+=a)o.push(p(e,s,s+a>l?l:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;},{}],13:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r];}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)};},{buffer:15}],14:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return !0;default:return !1}};function o(e){if(!e)return "utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return "utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return "utf16le";case"latin1":case"binary":return "latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function a(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function s(e){var t;switch(this.encoding=a(e),this.encoding){case"utf16le":this.text=p,this.end=m,t=4;break;case"utf8":this.fillLast=d,t=4;break;case"base64":this.text=y,this.end=g,t=3;break;default:return this.write=v,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t);}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n<r)return 0;var i=l(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function c(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function d(e){var t=this.lastTotal-this.lastNeed,r=c(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function h(e,t){var r=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function m(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function y(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function w(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return "";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return "";r=this.lastNeed,this.lastNeed=0;}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=f,s.prototype.text=h,s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length;};},{"safe-buffer":13}],15:[function(e,t,r){(function(t){(function(){var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return !1}}function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=m(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}function d(e){return u(e),a(e<0?0:0|y(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function f(e){for(var t=e.length<0?0:0|y(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return (n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,n}function m(e){if(s.isBuffer(e)){var t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function y(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e){return +e!=e&&(e=0),s.alloc(+e)}function v(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0;}}function w(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(t>>>=0))return "";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return D(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return j(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n;}function _(e,t,r,n,i){if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2;}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1;}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return -1}function T(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(Z(s))return a;e[r+a]=s;}return a}function x(e,t,r,n){return V(z(t,e.length-r),e,r,n)}function I(e,t,r,n){return V(G(t),e,r,n)}function S(e,t,r,n){return I(e,t,r,n)}function R(e,t,r,n){return V(J(t),e,r,n)}function k(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function j(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function D(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d;}return O(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=o(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return c(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(Q(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length;}return n},s.byteLength=v,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)b(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?D(this,0,e):w.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){o=u[d],a=c[d];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else {if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return T(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function O(e){var t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function A(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=W(e[o]);return i}function L(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function $(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i);}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i);}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i);}}else "number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else {var a=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%l];}return this};var q=/[^+/0-9A-Za-z-_]/g;function Y(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r);}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function G(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function H(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}function J(e){return t.toByteArray(Y(e))}function V(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}}).call(this);}).call(this,e("buffer").Buffer);},{"base64-js":12,buffer:15,ieee754:17}],16:[function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(e){console&&console.warn&&console.warn(e);}n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this);}t.exports=l,t.exports.once=b,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=d(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a(l);}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function m(e,t,r){var n=e._events;if(void 0===n)return [];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?w(i):g(i,i.length)}function y(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}function w(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function b(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r);}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments));}E(e,t,o,{once:!0}),"error"!==t&&_(e,i,{once:!0});}))}function _(e,t,r){"function"==typeof e.on&&E(e,"error",t,r);}function E(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o);}));}}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e;}}),l.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},l.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return !1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return !1;if("function"==typeof l)o(l,this,t);else {var u=l.length,c=g(l,u);for(r=0;r<u;++r)o(c[r],this,t);}return !0},l.prototype.addListener=function(e,t){return h(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return h(this,e,t,!0)},l.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,n,i,o,a;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():v(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t);}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return m(this,e,!0)},l.prototype.rawListeners=function(e){return m(this,e,!1)},l.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},l.prototype.listenerCount=y,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};},{}],17:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else {if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u;}return (f?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*m;};},{}],18:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a;}catch(e){n=a;}try{i="function"==typeof clearTimeout?clearTimeout:s;}catch(e){i=s;}}();var c,d=[],h=!1,f=-1;function p(){h&&c&&(h=!1,c.length?d=c.concat(d):f=-1,d.length&&m());}function m(){if(!h){var e=l(p);h=!0;for(var t=d.length;t;){for(c=d,d=[];++f<t;)c&&c[f].run();f=-1,t=d.length;}c=null,h=!1,u(e);}}function y(e,t){this.fun=e,this.array=t;}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new y(e,t)),1!==d.length||h||l(m);},y.prototype.run=function(){this.fun.apply(null,this.array);},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return []},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return "/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0};},{}],19:[function(e,t,r){(function(e){(function(){let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));}).call(this);}).call(this,void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],20:[function(e,t,r){const{AbortError:n,codes:i}=e("../../ours/errors"),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:s}=e("./utils"),l=e("./end-of-stream"),{ERR_INVALID_ARG_TYPE:u}=i,c=(e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new u(t,"AbortSignal",e)};t.exports.addAbortSignal=function(e,r){if(c(e,"signal"),!o(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const r=o(t)?()=>{t.destroy(new n(void 0,{cause:e.reason}));}:()=>{t[s](new n(void 0,{cause:e.reason}));};return e.aborted?r():(e.addEventListener("abort",r),l(t,(()=>e.removeEventListener("abort",r)))),t};},{"../../ours/errors":39,"./end-of-stream":26,"./utils":35}],21:[function(e,t,r){const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{inspect:l}=e("../../ours/util");t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0;}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length;}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length;}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0;}join(e){if(0===this.length)return "";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data;}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i;}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),r=e;let n=this.head,i=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(o(t,s,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),r-e),this.head=n,n.data=s.slice(e));break}o(t,s,r-e),e-=s.length,++i;}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}};},{"../../ours/primordials":40,"../../ours/util":41,buffer:15}],22:[function(e,t,r){const{pipeline:n}=e("./pipeline"),i=e("./duplex"),{destroyer:o}=e("./destroy"),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:d,isReadableStream:h}=e("./utils"),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=e("../../ours/errors"),y=e("./end-of-stream");t.exports=function(...e){if(0===e.length)throw new m("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t]);}for(let r=0;r<e.length;++r)if(a(e[r])||u(e[r])){if(r<e.length-1&&!(s(e[r])||h(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be readable");if(r>0&&!(l(e[r])||d(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,g,v,w,b;function _(e){const t=w;w=null,t?t(e):e?b.destroy(e):I||x||b.destroy();}const E=e[0],T=n(e,_),x=!!(l(E)||d(E)||c(E)),I=!!(s(T)||h(T)||c(T));if(b=new i({writableObjectMode:!(null==E||!E.writableObjectMode),readableObjectMode:!(null==T||!T.writableObjectMode),writable:x,readable:I}),x){if(a(E))b._write=function(e,t,n){E.write(e,t)?n():r=n;},b._final=function(e){E.end(),g=e;},E.on("drain",(function(){if(r){const e=r;r=null,e();}}));else if(u(E)){const e=(c(E)?E.writable:E).getWriter();b._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n();}catch(e){n(e);}},b._final=async function(t){try{await e.ready,e.close().catch((()=>{})),g=t;}catch(e){t(e);}};}const e=c(T)?T.readable:T;y(e,(()=>{if(g){const e=g;g=null,e();}}));}if(I)if(a(T))T.on("readable",(function(){if(v){const e=v;v=null,e();}})),T.on("end",(function(){b.push(null);})),b._read=function(){for(;;){const e=T.read();if(null===e)return void(v=b._read);if(!b.push(e))return}};else if(u(T)){const e=(c(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!b.push(t))return;if(r)return void b.push(null)}catch{return}};}return b._destroy=function(e,t){e||null===w||(e=new f),v=null,r=null,g=null,null===w?t(e):(w=t,a(T)&&o(T,e));},b};},{"../../ours/errors":39,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./pipeline":31,"./utils":35}],23:[function(e,t,r){const n=e("process/"),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=e("../../ours/errors"),{Symbol:s}=e("../../ours/primordials"),{kDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:d}=e("./utils"),h=s("kDestroy"),f=s("kConstruct");function p(e,t,r){e&&(t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e));}function m(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t);})),this)}function y(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(v,e);}try{e._destroy(t||null,o);}catch(t){o(t);}}function g(e,t){w(e,t),v(e);}function v(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close");}function w(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t));}function b(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable);}function _(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(w,e,t):w(e,t));}function E(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(T,e);}function T(e){let t=!1;function r(r){if(t)return void _(e,null!=r?r:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,r):r?_(e,r,!0):n.nextTick(x,e);}try{e._construct((e=>{n.nextTick(r,e);}));}catch(e){n.nextTick(r,e);}}function x(e){e.emit(f);}function I(e){return (null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close");}function R(e,t){e.emit("error",t),n.nextTick(S,e);}function k(e,t){e&&!u(e)&&(t||c(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):I(e)?e.abort():I(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(R,e,t):n.nextTick(S,e),e.destroyed||(e[l]=!0));}t.exports={construct:E,destroyer:k,destroy:m,undestroy:b,errorOrDestroy:_};},{"../../ours/errors":39,"../../ours/primordials":40,"./utils":35,"process/":18}],24:[function(e,t,r){const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=e("../../ours/primordials");t.exports=u;const s=e("./readable"),l=e("./writable");a(u.prototype,s.prototype),a(u,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const r=e[t];u.prototype[r]||(u.prototype[r]=l.prototype[r]);}}function u(e){if(!(this instanceof u))return new u(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0;}let c,d;function h(){return void 0===c&&(c={}),c}n(u.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e);}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(t){return d||(d=e("./duplexify")),d(t,"body")};},{"../../ours/primordials":40,"./duplexify":25,"./readable":32,"./writable":36}],25:[function(e,t,r){const n=e("process/"),i=e("buffer"),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:d}=e("./utils"),h=e("./end-of-stream"),{AbortError:f,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:m}}=e("../../ours/errors"),{destroyer:y}=e("./destroy"),g=e("./duplex"),v=e("./readable"),{createDeferredPromise:w}=e("../../ours/util"),b=e("./from"),_=globalThis.Blob||i.Blob,E=void 0!==_?function(e){return e instanceof _}:function(e){return !1},T=globalThis.AbortController||e("abort-controller").AbortController,{FunctionPrototypeCall:x}=e("../../ours/primordials");class I extends g{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0);}}function S(e){let{promise:t,resolve:r}=w();const i=new T,o=i.signal;return {value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(n.nextTick(s),a)return;if(o.aborted)throw new f(void 0,{cause:o.reason});(({promise:t,resolve:r}=w())),yield i;}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n});},final(e){const t=r;r=null,t({done:!0,cb:e});},destroy(e,t){i.abort(),t(e);}}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,r=e.writable;let n,i,s,l,u,c=!!o(t),d=!!a(r);function p(e){const t=l;l=null,t?t(e):e&&u.destroy(e);}return u=new I({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:c,writable:d}),d&&(h(r,(e=>{d=!1,e&&y(t,e),p(e);})),u._write=function(e,t,i){r.write(e,t)?i():n=i;},u._final=function(e){r.end(),i=e;},r.on("drain",(function(){if(n){const e=n;n=null,e();}})),r.on("finish",(function(){if(i){const e=i;i=null,e();}}))),c&&(h(t,(e=>{c=!1,e&&y(t,e),p(e);})),t.on("readable",(function(){if(s){const e=s;s=null,e();}})),t.on("end",(function(){u.push(null);})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,o){e||null===l||(e=new f),s=null,n=null,i=null,null===l?o(e):(l=o,y(r,e),y(t,e));},u}t.exports=function e(t,r){if(d(t))return t;if(u(t))return R({readable:t});if(c(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=S(t);if(s(e))return b(I,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const r=x(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{y(t,e);}));return t=new I({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null);}catch(t){n.nextTick(e,t);}}));},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(E(t))return e(t.arrayBuffer());if(s(t))return b(I,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return x(i,t,(t=>{null!=t&&e.push(t),e.push(null);}),(t=>{y(e,t);})),e=new I({objectMode:!0,writable:!1,read(){}})}throw new p(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./readable":32,"./utils":35,"abort-controller":11,buffer:15,"process/":18}],26:[function(e,t,r){const n=e("process/"),{AbortError:i,codes:o}=e("../../ours/errors"),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:u}=e("../../ours/util"),{validateAbortSignal:c,validateFunction:d,validateObject:h,validateBoolean:f}=e("../validators"),{Promise:p,PromisePrototypeThen:m}=e("../../ours/primordials"),{isClosed:y,isReadable:g,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:b,isReadableErrored:_,isWritable:E,isWritableNodeStream:T,isWritableStream:x,isWritableFinished:I,isWritableErrored:S,isNodeStream:R,willEmitClose:k,kIsClosedPromise:j}=e("./utils");function D(e){return e.setHeader&&"function"==typeof e.abort}const N=()=>{};function O(e,t,r){var o,f;if(2===arguments.length?(r=t,t=l):null==t?t=l:h(t,"options"),d(r,"callback"),c(t.signal,"options.signal"),r=u(r),w(e)||x(e))return C(e,t,r);if(!R(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const p=null!==(o=t.readable)&&void 0!==o?o:v(e),m=null!==(f=t.writable)&&void 0!==f?f:T(e),j=e._writableState,O=e._readableState,A=()=>{e.writable||P();};let M=k(e)&&v(e)===p&&T(e)===m,L=I(e,!1);const P=()=>{L=!0,e.destroyed&&(M=!1),(!M||e.readable&&!p)&&(p&&!B||r.call(e));};let B=b(e,!1);const $=()=>{B=!0,e.destroyed&&(M=!1),(!M||e.writable&&!m)&&(m&&!L||r.call(e));},F=t=>{r.call(e,t);};let U=y(e);const q=()=>{U=!0;const t=S(e)||_(e);return t&&"boolean"!=typeof t?r.call(e,t):p&&!B&&v(e,!0)&&!b(e,!1)?r.call(e,new s):!m||L||I(e,!1)?void r.call(e):r.call(e,new s)},Y=()=>{U=!0;const t=S(e)||_(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e);},W=()=>{e.req.on("finish",P);};D(e)?(e.on("complete",P),M||e.on("abort",q),e.req?W():e.on("request",W)):m&&!j&&(e.on("end",A),e.on("close",A)),M||"boolean"!=typeof e.aborted||e.on("aborted",q),e.on("end",$),e.on("finish",P),!1!==t.error&&e.on("error",F),e.on("close",q),U?n.nextTick(q):null!=j&&j.errorEmitted||null!=O&&O.errorEmitted?M||n.nextTick(Y):(p||M&&!g(e)||!L&&!1!==E(e))&&(m||M&&!E(e)||!B&&!1!==g(e))?O&&e.req&&e.aborted&&n.nextTick(Y):n.nextTick(Y);const z=()=>{r=N,e.removeListener("aborted",q),e.removeListener("complete",P),e.removeListener("abort",q),e.removeListener("request",W),e.req&&e.req.removeListener("finish",P),e.removeListener("end",A),e.removeListener("close",A),e.removeListener("finish",P),e.removeListener("end",$),e.removeListener("error",F),e.removeListener("close",q);};if(t.signal&&!U){const o=()=>{const n=r;z(),n.call(e,new i(void 0,{cause:t.signal.reason}));};if(t.signal.aborted)n.nextTick(o);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",o),n.apply(e,r);})),t.signal.addEventListener("abort",o);}}return z}function C(e,t,r){let o=!1,a=N;if(t.signal)if(a=()=>{o=!0,r.call(e,new i(void 0,{cause:t.signal.reason}));},t.signal.aborted)n.nextTick(a);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",a),n.apply(e,r);})),t.signal.addEventListener("abort",a);}const s=(...t)=>{o||n.nextTick((()=>r.apply(e,t)));};return m(e[j].promise,s,s),N}function A(e,t){var r;let n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=O(e,t,(e=>{n&&o(),e?i(e):r();}));}))}t.exports=O,t.exports.finished=A;},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./utils":35,"process/":18}],27:[function(e,t,r){const n=e("process/"),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=e("../../ours/errors").codes;function c(e,t,r){let c,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null);}});if(t&&t[o])d=!0,c=t[o]();else {if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,c=t[a]();}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;async function p(e){const t=null!=e,r="function"==typeof c.throw;if(t&&r){const{value:t,done:r}=await c.throw(e);if(await t,r)return}if("function"==typeof c.return){const{value:e}=await c.return();await e;}}async function m(){for(;;){try{const{value:e,done:t}=d?await c.next():c.next();if(t)h.push(null);else {const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new u;if(h.push(t))continue;f=!1;}}catch(e){h.destroy(e);}break}}return h._read=function(){f||(f=!0,m());},h._destroy=function(e,t){i(p(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)));},h}t.exports=c;},{"../../ours/errors":39,"../../ours/primordials":40,buffer:15,"process/":18}],28:[function(e,t,r){const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=e("../../ours/primordials"),{EventEmitter:o}=e("events");function a(e){o.call(this,e);}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r);}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause();}function i(){r.readable&&r.resume&&r.resume();}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",l),r.on("close",u));let a=!1;function l(){a||(a=!0,e.end());}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy());}function c(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e);}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d);}return s(r,"error",c),s(e,"error",c),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},t.exports={Stream:a,prependListener:s};},{"../../ours/primordials":40,events:16}],29:[function(e,t,r){const n=globalThis.AbortController||e("abort-controller").AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=e("../../ours/errors"),{validateAbortSignal:u,validateInteger:c,validateObject:d}=e("../validators"),h=e("../../ours/primordials").Symbol("kWeak"),{finished:f}=e("./end-of-stream"),p=e("./compose"),{addAbortSignalNoValidate:m}=e("./add-abort-signal"),{isWritable:y,isNodeStream:g}=e("./utils"),{ArrayPrototypePush:v,MathFloor:w,Number:b,NumberIsNaN:_,Promise:E,PromiseReject:T,PromisePrototypeThen:x,Symbol:I}=e("../../ours/primordials"),S=I("kEmpty"),R=I("kEof");function k(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),g(e)&&!y(e))throw new i("stream",e,"must be writable");const r=p(this,e);return null!=t&&t.signal&&m(t.signal,r),r}function j(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let r=1;return null!=(null==t?void 0:t.concurrency)&&(r=w(t.concurrency)),c(r,"concurrency",1),async function*(){var i,o;const a=new n,s=this,u=[],c=a.signal,d={signal:c},h=()=>a.abort();let f,p;null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h);let m=!1;function y(){m=!0;}async function g(){try{for await(let t of s){var n;if(m)return;if(c.aborted)throw new l;try{t=e(t,d);}catch(e){t=T(e);}t!==S&&("function"==typeof(null===(n=t)||void 0===n?void 0:n.catch)&&t.catch(y),u.push(t),f&&(f(),f=null),!m&&u.length&&u.length>=r&&await new E((e=>{p=e;})));}u.push(R);}catch(e){const t=T(e);x(t,void 0,y),u.push(t);}finally{var i;m=!0,f&&(f(),f=null),null==t||null===(i=t.signal)||void 0===i||i.removeEventListener("abort",h);}}g();try{for(;;){for(;u.length>0;){const e=await u[0];if(e===R)return;if(c.aborted)throw new l;e!==S&&(yield e),u.shift(),p&&(p(),p=null);}await new E((e=>{f=e;}));}}finally{a.abort(),m=!0,p&&(p(),p=null);}}.call(this)}function D(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l({cause:e.signal.reason});yield [t++,n];}}.call(this)}async function N(e,t=void 0){for await(const r of M.call(this,e,t))return !0;return !1}async function O(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return !await N.call(this,(async(...t)=>!await e(...t)),t)}async function C(e,t){for await(const r of M.call(this,e,t))return r}async function A(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r),S}for await(const e of j.call(this,r,t));}function M(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r)?t:S}return j.call(this,r,t)}class L extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value";}}async function P(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&u(r.signal,"options.signal");let a=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await f(this.destroy(e)),e}const s=new n,c=s.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this};r.signal.addEventListener("abort",(()=>s.abort()),e);}let p=!1;try{for await(const n of this){var m;if(p=!0,null!=r&&null!==(m=r.signal)&&void 0!==m&&m.aborted)throw new l;a?t=await e(t,n,{signal:c}):(t=n,a=!0);}if(!p&&!a)throw new L}finally{s.abort();}return t}async function B(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l(void 0,{cause:e.signal.reason});v(t,n);}return t}function $(e,t){const r=j.call(this,e,t);return async function*(){for await(const e of r)yield*e;}.call(this)}function F(e){if(e=b(e),_(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}function U(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;e--<=0&&(yield r);}}.call(this)}function q(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;if(!(e-- >0))return;yield r;}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:D,drop:U,filter:M,flatMap:$,map:j,take:q,compose:k},t.exports.promiseReturningOperators={every:O,forEach:A,reduce:P,toArray:B,some:N,find:C};},{"../../ours/errors":39,"../../ours/primordials":40,"../validators":37,"./add-abort-signal":20,"./compose":22,"./end-of-stream":26,"./utils":35,"abort-controller":11}],30:[function(e,t,r){const{ObjectSetPrototypeOf:n}=e("../../ours/primordials");t.exports=o;const i=e("./transform");function o(e){if(!(this instanceof o))return new o(e);i.call(this,e);}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e);};},{"../../ours/primordials":40,"./transform":34}],31:[function(e,t,r){const n=e("process/"),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a}=e("../../ours/primordials"),s=e("./end-of-stream"),{once:l}=e("../../ours/util"),u=e("./destroy"),c=e("./duplex"),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:p,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:g}=e("../../ours/errors"),{validateFunction:v,validateAbortSignal:w}=e("../validators"),{isIterable:b,isReadable:_,isReadableNodeStream:E,isNodeStream:T,isTransformStream:x,isWebStream:I,isReadableStream:S,isReadableEnded:R}=e("./utils"),k=globalThis.AbortController||e("abort-controller").AbortController;let j,D;function N(e,t,r){let n=!1;return e.on("close",(()=>{n=!0;})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new m("pipe")));},cleanup:s(e,{readable:t,writable:r},(e=>{n=!e;}))}}function O(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function C(e){if(b(e))return e;if(E(e))return A(e);throw new h("val",["Readable","Iterable","AsyncIterable"],e)}async function*A(t){D||(D=e("./readable")),yield*D.prototype[a].call(t);}async function M(e,t,r,{end:n}){let i,a=null;const l=e=>{if(e&&(i=e),a){const e=a;a=null,e();}},u=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e();};}));t.on("drain",l);const c=s(t,{readable:!1},l);try{t.writableNeedDrain&&await u();for await(const r of e)t.write(r)||await u();n&&t.end(),await u(),r();}catch(e){r(i!==e?d(i,e):e);}finally{c(),t.off("drain",l);}}async function L(e,t,r,{end:n}){x(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r();}catch(e){try{await i.abort(e),r(e);}catch(e){r(e);}}}function P(...e){return B(e,l(O(e)))}function B(t,r,o){if(1===t.length&&i(t[0])&&(t=t[0]),t.length<2)throw new p("streams");const a=new k,s=a.signal,l=null==o?void 0:o.signal,u=[];function d(){A(new g);}let m,y;w(l,"options.signal"),null==l||l.addEventListener("abort",d);const v=[];let R,D=0;function O(e){A(e,0==--D);}function A(e,t){if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||t){for(;v.length;)v.shift()(m);null==l||l.removeEventListener("abort",d),a.abort(),t&&(m||u.forEach((e=>e())),n.nextTick(r,m,y));}}for(let F=0;F<t.length;F++){const U=t[F],q=F<t.length-1,Y=F>0,W=q||!1!==(null==o?void 0:o.end),z=F===t.length-1;if(T(U)){if(W){const{destroy:H,cleanup:J}=N(U,q,Y);v.push(H),_(U)&&z&&u.push(J);}function G(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&O(e);}U.on("error",G),_(U)&&z&&u.push((()=>{U.removeListener("error",G);}));}if(0===F)if("function"==typeof U){if(R=U({signal:s}),!b(R))throw new f("Iterable, AsyncIterable or Stream","source",R)}else R=b(U)||E(U)||x(U)?U:c.from(U);else if("function"==typeof U){var P;if(R=x(R)?C(null===(P=R)||void 0===P?void 0:P.readable):C(R),R=U(R,{signal:s}),q){if(!b(R,!0))throw new f("AsyncIterable",`transform[${F-1}]`,R)}else {var B;j||(j=e("./passthrough"));const V=new j({objectMode:!0}),Q=null===(B=R)||void 0===B?void 0:B.then;if("function"==typeof Q)D++,Q.call(R,(e=>{y=e,null!=e&&V.write(e),W&&V.end(),n.nextTick(O);}),(e=>{V.destroy(e),n.nextTick(O,e);}));else if(b(R,!0))D++,M(R,V,O,{end:W});else {if(!S(R)&&!x(R))throw new f("AsyncIterable or Promise","destination",R);{const X=R.readable||R;D++,M(X,V,O,{end:W});}}R=V;const{destroy:Z,cleanup:K}=N(R,!1,!0);v.push(Z),z&&u.push(K);}}else if(T(U)){if(E(R)){D+=2;const ee=$(R,U,O,{end:W});_(U)&&z&&u.push(ee);}else if(x(R)||S(R)){const te=R.readable||R;D++,M(te,U,O,{end:W});}else {if(!b(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,M(R,U,O,{end:W});}R=U;}else if(I(U)){if(E(R))D++,L(C(R),U,O,{end:W});else if(S(R)||b(R))D++,L(R,U,O,{end:W});else {if(!x(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,L(R.readable,U,O,{end:W});}R=U;}else R=c.from(U);}return (null!=s&&s.aborted||null!=l&&l.aborted)&&n.nextTick(d),R}function $(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new y);})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end();}R(e)?n.nextTick(a):e.once("end",a);}else r();return s(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t);})),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:P};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./passthrough":30,"./readable":32,"./utils":35,"abort-controller":11,"process/":18}],32:[function(e,t,r){const n=e("process/"),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:d,SafeSet:h,SymbolAsyncIterator:f,Symbol:p}=e("../../ours/primordials");t.exports=$,$.ReadableState=B;const{EventEmitter:m}=e("events"),{Stream:y,prependListener:g}=e("./legacy"),{Buffer:v}=e("buffer"),{addAbortSignal:w}=e("./add-abort-signal"),b=e("./end-of-stream");let _=e("../../ours/util").debuglog("stream",(e=>{_=e;}));const E=e("./buffer_list"),T=e("./destroy"),{getHighWaterMark:x,getDefaultHighWaterMark:I}=e("./state"),{aggregateTwoErrors:S,codes:{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:j,ERR_STREAM_PUSH_AFTER_EOF:D,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:N}}=e("../../ours/errors"),{validateObject:O}=e("../validators"),C=p("kPaused"),{StringDecoder:A}=e("string_decoder"),M=e("./from");c($.prototype,y.prototype),c($,y);const L=()=>{},{errorOrDestroy:P}=T;function B(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.readableObjectMode)),this.highWaterMark=t?x(this,t,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[C]=null,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new A(t.encoding),this.encoding=t.encoding);}function $(t){if(!(this instanceof $))return new $(t);const r=this instanceof e("./duplex");this._readableState=new B(t,this,r),t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&!r&&w(t.signal,this)),y.call(this,t),T.construct(this,(()=>{this._readableState.needReadable&&J(this,this._readableState);}));}function F(e,t,r,n){_("readableAddChunk",t);const i=e._readableState;let o;if(i.objectMode||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=v.from(t,r).toString(i.encoding):(t=v.from(t,r),r=""))):t instanceof v?r="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new R("chunk",["string","Buffer","Uint8Array"],t))),o)P(e,o);else if(null===t)i.reading=!1,z(e,i);else if(i.objectMode||t&&t.length>0)if(n)if(i.endEmitted)P(e,new N);else {if(i.destroyed||i.errored)return !1;U(e,i,t,!0);}else if(i.ended)P(e,new D);else {if(i.destroyed||i.errored)return !1;i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?U(e,i,t,!1):J(e,i)):U(e,i,t,!1);}else n||(i.reading=!1,J(e,i));return !i.ended&&(i.length<i.highWaterMark||0===i.length)}function U(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&G(e)),J(e,t);}$.prototype.destroy=T.destroy,$.prototype._undestroy=T.undestroy,$.prototype._destroy=function(e,t){t(e);},$.prototype[m.captureRejectionSymbol]=function(e){this.destroy(e);},$.prototype.push=function(e,t){return F(this,e,t,!1)},$.prototype.unshift=function(e,t){return F(this,e,t,!0)},$.prototype.isPaused=function(){const e=this._readableState;return !0===e[C]||!1===e.flowing},$.prototype.setEncoding=function(e){const t=new A(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};const q=1073741824;function Y(e){if(e>q)throw new j("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}function W(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function z(e,t){if(_("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length);}t.ended=!0,t.sync?G(e):(t.needReadable=!1,t.emittedReadable=!0,H(e));}}function G(e){const t=e._readableState;_("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(_("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(H,e));}function H(e){const t=e._readableState;_("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,te(e);}function J(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(V,e,t));}function V(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const r=t.length;if(_("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1;}function Q(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(_("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(_("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume();}}function Z(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null);}function K(e){_("readable nexttick read 0"),e.read(0);}function X(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ee,e,t));}function ee(e,t){_("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),te(e),t.flowing&&!t.reading&&e.read(0);}function te(e){const t=e._readableState;for(_("flow",t.flowing);t.flowing&&null!==e.read(););}function re(e,t){"function"!=typeof e.read&&(e=$.wrap(e,{objectMode:!0}));const r=ne(e,t);return r.stream=e,r}async function*ne(e,t){let r,n=L;function i(t){this===e?(n(),n=L):n=t;}e.on("readable",i);const o=b(e,{writable:!1},(e=>{r=e?S(r,e):null,n(),n=L;}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else {if(r)throw r;if(null===r)return;await new d(i);}}}catch(e){throw r=S(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):T.destroyer(e,null);}}function ie(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function oe(e){const t=e._readableState;_("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ae,t,e));}function ae(e,t){if(_("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(se,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy();}}function se(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end();}let le;function ue(){return void 0===le&&(le={}),le}$.prototype.read=function(e){_("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=Y(e)),0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return _("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?oe(this):G(this),null;if(0===(e=W(e,t))&&t.ended)return 0===t.length&&oe(this),null;let n,i=t.needReadable;if(_("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,_("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,_("reading, ended or constructing",i);else if(i){_("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark);}catch(e){P(this,e);}t.sync=!1,t.reading||(e=W(r,t));}return n=e>0?ie(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&oe(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},$.prototype._read=function(e){throw new k("_read()")},$.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),_("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?v:s;function a(e,t){_("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,c());}function s(){_("onend"),e.end();}let l;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",a);let u=!1;function c(){_("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),l&&e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),u=!0,l&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&l();}function d(){u||(1===i.pipes.length&&i.pipes[0]===e?(_("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(_("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),l||(l=Q(r,e),e.on("drain",l));}function f(t){_("ondata");const r=e.write(t);_("dest.write",r),!1===r&&d();}function p(t){if(_("onerror",t),v(),e.removeListener("error",p),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?P(e,t):e.emit("error",t);}}function m(){e.removeListener("finish",y),v();}function y(){_("onfinish"),e.removeListener("close",m),v();}function v(){_("unpipe"),r.unpipe(e);}return r.on("data",f),g(e,"error",p),e.once("close",m),e.once("finish",y),e.emit("pipe",r),!0===e.writableNeedDrain?i.flowing&&d():i.flowing||(_("pipe resume"),r.resume()),e},$.prototype.unpipe=function(e){const t=this._readableState,r={hasUnpiped:!1};if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return -1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,r)),this},$.prototype.on=function(e,t){const r=y.prototype.on.call(this,e,t),i=this._readableState;return "data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,_("on readable",i.length,i.reading),i.length?G(this):i.reading||n.nextTick(K,this))),r},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){const r=y.prototype.removeListener.call(this,e,t);return "readable"===e&&n.nextTick(Z,this),r},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(e){const t=y.prototype.removeAllListeners.apply(this,arguments);return "readable"!==e&&void 0!==e||n.nextTick(Z,this),t},$.prototype.resume=function(){const e=this._readableState;return e.flowing||(_("resume"),e.flowing=!e.readableListening,X(this,e)),e[C]=!1,this},$.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},$.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause());})),e.on("end",(()=>{this.push(null);})),e.on("error",(e=>{P(this,e);})),e.on("close",(()=>{this.destroy();})),e.on("destroy",(()=>{this.destroy();})),this._read=()=>{t&&e.resume&&(t=!1,e.resume());};const r=u(e);for(let t=1;t<r.length;t++){const n=r[t];void 0===this[n]&&"function"==typeof e[n]&&(this[n]=e[n].bind(e));}return this},$.prototype[f]=function(){return re(this)},$.prototype.iterator=function(e){return void 0!==e&&O(e,"options"),re(this,e)},l($.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return !(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e);}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e);}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return !!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e);}},readableEnded:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.endEmitted}}}),l(B.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return !1!==this[C]},set(e){this[C]=!!e;}}}),$._fromList=ie,$.from=function(e,t){return M($,e,t)},$.fromWeb=function(e,t){return ue().newStreamReadableFromReadableStream(e,t)},$.toWeb=function(e,t){return ue().newReadableStreamFromStreamReadable(e,t)},$.wrap=function(e,t){var r,n;return new $({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r,...t,destroy(t,r){T.destroyer(e,t),r(t);}}).wrap(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./add-abort-signal":20,"./buffer_list":21,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18,string_decoder:14}],33:[function(e,t,r){const{MathFloor:n,NumberIsInteger:i}=e("../../ours/primordials"),{ERR_INVALID_ARG_VALUE:o}=e("../../ours/errors").codes;function a(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function s(e){return e?16:16384}function l(e,t,r,l){const u=a(t,l,r);if(null!=u){if(!i(u)||u<0)throw new o(l?`options.${r}`:"options.highWaterMark",u);return n(u)}return s(e.objectMode)}t.exports={getHighWaterMark:l,getDefaultHighWaterMark:s};},{"../../ours/errors":39,"../../ours/primordials":40}],34:[function(e,t,r){const{ObjectSetPrototypeOf:n,Symbol:i}=e("../../ours/primordials");t.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:o}=e("../../ours/errors").codes,a=e("./duplex"),{getHighWaterMark:s}=e("./state");n(u.prototype,a.prototype),n(u,a);const l=i("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d);}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e());}));}function d(){this._final!==c&&c.call(this);}u.prototype._final=c,u.prototype._transform=function(e,t,r){throw new o("_transform()")},u.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length<n.highWaterMark?r():this[l]=r);}));},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e();}};},{"../../ours/errors":39,"../../ours/primordials":40,"./duplex":24,"./state":33}],35:[function(e,t,r){const{Symbol:n,SymbolAsyncIterator:i,SymbolIterator:o,SymbolFor:a}=e("../../ours/primordials"),s=n("kDestroyed"),l=n("kIsErrored"),u=n("kIsReadable"),c=n("kIsDisturbed"),d=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var r;return !(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function p(e){var t;return !(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function m(e){return !(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return !(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function v(e){return !(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function w(e){return !(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function b(e){return g(e)||v(e)||w(e)}function _(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[o]:"function"==typeof e[i]||"function"==typeof e[o])}function E(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !!(e.destroyed||e[s]||null!=n&&n.destroyed)}function T(e){if(!p(e))return null;if(!0===e.writableEnded)return !0;const t=e._writableState;return (null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function x(e,t){if(!p(e))return null;if(!0===e.writableFinished)return !0;const r=e._writableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))}function I(e){if(!f(e))return null;if(!0===e.readableEnded)return !0;const t=e._readableState;return !(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function S(e,t){if(!f(e))return null;const r=e._readableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function R(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!E(e)&&f(e)&&e.readable&&!S(e)}function k(e){return "boolean"!=typeof(null==e?void 0:e.writable)?null:!E(e)&&p(e)&&e.writable&&!T(e)}function j(e,t){return y(e)?!(!E(e)&&(!1!==(null==t?void 0:t.readable)&&R(e)||!1!==(null==t?void 0:t.writable)&&k(e))):null}function D(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function N(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function O(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return "boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&C(e)?e._closed:null}function C(e){return "boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function A(e){return "boolean"==typeof e._sent100&&C(e)}function M(e){var t;return "boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)}function L(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !n&&A(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)}function P(e){var t;return !(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))}function B(e){var t,r,n,i,o,a,s,u,c,d;return !(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(a=e[l])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(s=e._readableState)||void 0===s?void 0:s.errorEmitted)&&void 0!==n?n:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))}t.exports={kDestroyed:s,isDisturbed:P,kIsDisturbed:c,isErrored:B,kIsErrored:l,isReadable:R,kIsReadable:u,kIsClosedPromise:d,kControllerErrorFunction:h,isClosed:O,isDestroyed:E,isDuplexNodeStream:m,isFinished:j,isIterable:_,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:I,isReadableFinished:S,isReadableErrored:N,isNodeStream:y,isWebStream:b,isWritable:k,isWritableNodeStream:p,isWritableStream:v,isWritableEnded:T,isWritableFinished:x,isWritableErrored:D,isServerRequest:M,isServerResponse:A,willEmitClose:L,isTransformStream:w};},{"../../ours/primordials":40}],36:[function(e,t,r){const n=e("process/"),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:h}=e("../../ours/primordials");t.exports=A,A.WritableState=O;const{EventEmitter:f}=e("events"),p=e("./legacy").Stream,{Buffer:m}=e("buffer"),y=e("./destroy"),{addAbortSignal:g}=e("./add-abort-signal"),{getHighWaterMark:v,getDefaultHighWaterMark:w}=e("./state"),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:T,ERR_STREAM_DESTROYED:x,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:S,ERR_STREAM_WRITE_AFTER_END:R,ERR_UNKNOWN_ENCODING:k}=e("../../ours/errors").codes,{errorOrDestroy:j}=y;function D(){}u(A.prototype,p.prototype),u(A,p);const N=d("kOnFinished");function O(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.writableObjectMode)),this.highWaterMark=t?v(this,t,"writableHighWaterMark",n):w(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!t||!1!==t.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,r),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,C(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[N]=[];}function C(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0;}function A(t){const r=this instanceof e("./duplex");if(!r&&!a(A,this))return new A(t);this._writableState=new O(t,this,r),t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&g(t.signal,this)),p.call(this,t),y.construct(this,(()=>{const e=this._writableState;e.writing||Y(this,e),H(this,e);}));}function M(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else {if(r){if("buffer"!==r&&!m.isEncoding(r))throw new k(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=D);}if(null===t)throw new S;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=m.from(t,r),r="buffer");else if(t instanceof m)r="buffer";else {if(!p._isUint8Array(t))throw new b("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer";}let a;return o.ending?a=new R:o.destroyed&&(a=new x("write")),a?(n.nextTick(i,a),j(e,a,!0),a):(o.pendingcb++,L(e,o,t,r,i))}function L(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}function P(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new x("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1;}function B(e,t,r,n){--t.pendingcb,n(r),q(t),j(e,r);}function $(e,t){const r=e._writableState,i=r.sync,o=r.writecb;"function"==typeof o?(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(B,e,r,t,o):B(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&Y(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(F,r.afterWriteTickInfo)):U(e,r,1,o))):j(e,new E);}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,U(e,t,r,n)}function U(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&q(t),H(e,t);}function q(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;const{chunk:n,callback:i}=e.buffered[r],o=e.objectMode?1:n.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new x("write"));}const r=e[N].splice(0);for(let t=0;t<r.length;t++){var n;r[t](null!==(n=e.errored)&&void 0!==n?n:new x("end"));}C(e);}function Y(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:r,bufferedIndex:n,objectMode:o}=t,a=r.length-n;if(!a)return;let s=n;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const n=t.allNoop?D:e=>{for(let t=s;t<r.length;++t)r[t].callback(e);},o=t.allNoop&&0===s?r:i(r,s);o.allBuffers=t.allBuffers,P(e,t,!0,t.length,o,"",n),C(t);}else {do{const{chunk:n,encoding:i,callback:a}=r[s];r[s++]=null,P(e,t,!1,o?1:n.length,n,i,a);}while(s<r.length&&!t.writing);s===r.length?C(t):s>256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s;}t.bufferProcessing=!1;}function W(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(e,t){let r=!1;function i(i){if(r)j(e,null!=i?i:E());else if(r=!0,t.pendingcb--,i){const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e](i);j(e,i,t.sync);}else W(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,n.nextTick(J,e,t));}t.sync=!0,t.pendingcb++;try{e._final(i);}catch(e){i(e);}t.sync=!1;}function G(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,z(e,t)));}function H(e,t,r){W(t)&&(G(e,t),0===t.pendingcb&&(r?(t.pendingcb++,n.nextTick(((e,t)=>{W(t)?J(e,t):t.pendingcb--;}),e,t)):W(t)&&(t.pendingcb++,J(e,t))));}function J(e,t){t.pendingcb--,t.finished=!0;const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy();}}O.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(A,h,{__proto__:null,value:function(e){return !!a(this,e)||this===A&&e&&e._writableState instanceof O}}),A.prototype.pipe=function(){j(this,new T);},A.prototype.write=function(e,t,r){return !0===M(this,e,t,r)},A.prototype.cork=function(){this._writableState.corked++;},A.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||Y(this,e));},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!m.isEncoding(e))throw new k(e);return this._writableState.defaultEncoding=e,this},A.prototype._write=function(e,t,r){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],r);},A.prototype._writev=null,A.prototype.end=function(e,t,r){const i=this._writableState;let a;if("function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e){const r=M(this,e,t);r instanceof o&&(a=r);}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new x("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof r&&(a||i.finished?n.nextTick(r,a):i[N].push(r)),this},l(A.prototype,{closed:{__proto__:null,get(){return !!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return !!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e);}},writable:{__proto__:null,get(){const e=this._writableState;return !(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e);}},writableFinished:{__proto__:null,get(){return !!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return !!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return !!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return !!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const V=y.destroy;let Q;function Z(){return void 0===Q&&(Q={}),Q}A.prototype.destroy=function(e,t){const r=this._writableState;return !r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N].length)&&n.nextTick(q,r),V.call(this,e,t),this},A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e);},A.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e);},A.fromWeb=function(e,t){return Z().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return Z().newWritableStreamFromStreamWritable(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"./add-abort-signal":20,"./destroy":23,"./duplex":24,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18}],37:[function(e,t,r){const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:y}=e("../ours/primordials"),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:v,ERR_INVALID_ARG_TYPE:w,ERR_INVALID_ARG_VALUE:b,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:E}}=e("../ours/errors"),{normalizeEncoding:T}=e("../ours/util"),{isAsyncFunction:x,isArrayBufferView:I}=e("../ours/util").types,S={};function R(e){return e===(0|e)}function k(e){return e===e>>>0}const j=/^[0-7]+$/,D="must be a 32-bit unsigned integer or an octal string";function N(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(j,e))throw new b(t,e,D);e=d(e,8);}return A(e,t),e}const O=g(((e,t,r=c,n=u)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=g(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),A=g(((e,t,r=!1)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(e<n||e>i)throw new _(t,`>= ${n} && <= ${i}`,e)}));function M(e,t){if("string"!=typeof e)throw new w(t,"string",e)}function L(e,t,r=void 0,n){if("number"!=typeof e)throw new w(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&l(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)}const P=g(((e,t,r)=>{if(!i(r,e)){const n=o(a(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new b(t,e,"must be one of: "+n)}}));function B(e,t){if("boolean"!=typeof e)throw new w(t,"boolean",e)}function $(e,t,r){return null!=e&&h(e,t)?e[t]:r}const F=g(((e,t,r=null)=>{const i=$(r,"allowArray",!1),o=$(r,"allowFunction",!1);if(!$(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new w(t,"Object",e)})),U=g(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new w(t,"a dictionary",e)})),q=g(((e,t,r=0)=>{if(!n(e))throw new w(t,"Array",e);if(e.length<r)throw new b(t,e,`must be longer than ${r}`)}));function Y(e,t){q(e,t);for(let r=0;r<e.length;r++)M(e[r],`${t}[${r}]`);}function W(e,t){q(e,t);for(let r=0;r<e.length;r++)B(e[r],`${t}[${r}]`);}function z(e,t="signal"){if(M(e,t),void 0===S[e]){if(void 0!==S[m(e)])throw new E(e+" (signals must use all capital letters)");throw new E(e)}}const G=g(((e,t="buffer")=>{if(!I(e))throw new w(t,["Buffer","TypedArray","DataView"],e)}));function H(e,t){const r=T(t),n=e.length;if("hex"===r&&n%2!=0)throw new b("encoding",t,`is invalid for data of length ${n}`)}function J(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e}const V=g(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new w(t,"AbortSignal",e)})),Q=g(((e,t)=>{if("function"!=typeof e)throw new w(t,"Function",e)})),Z=g(((e,t)=>{if("function"!=typeof e||x(e))throw new w(t,"Function",e)})),K=g(((e,t)=>{if(void 0!==e)throw new w(t,"undefined",e)}));function X(e,t,r){if(!i(r,e))throw new w(t,`('${o(r,"|")}')`,e)}const ee=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(e,t){if(void 0===e||!f(ee,e))throw new b(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function re(e){if("string"==typeof e)return te(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n<t;n++){const i=e[n];te(i,"hints"),r+=i,n!==t-1&&(r+=", ");}return r}throw new b("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:R,isUint32:k,parseFileMode:N,validateArray:q,validateStringArray:Y,validateBooleanArray:W,validateBoolean:B,validateBuffer:G,validateDictionary:U,validateEncoding:H,validateFunction:Q,validateInt32:C,validateInteger:O,validateNumber:L,validateObject:F,validateOneOf:P,validatePlainFunction:Z,validatePort:J,validateSignalName:z,validateString:M,validateUint32:A,validateUndefined:K,validateUnion:X,validateAbortSignal:V,validateLinkHeaderValue:re};},{"../ours/errors":39,"../ours/primordials":40,"../ours/util":41}],38:[function(e,t,r){const n=e("../stream"),i=e("../stream/promises"),o=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=o,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=n.Stream,t.exports.default=t.exports;},{"../stream":42,"../stream/promises":43}],39:[function(e,t,r){const{format:n,inspect:i,AggregateError:o}=e("./util"),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c="__node_internal_",d={};function h(e,t){if(!e)throw new d.ERR_INTERNAL_ASSERTION(t)}function f(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return `${e.slice(0,r)}${t}`}function p(e,t,r){if("function"==typeof t)return h(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return h(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}function m(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(p(e,t,r));}toString(){return `${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return `${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[s]=!0,d[e]=n;}function y(e){const t=c+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new a([t,e],t.message);return r.code=t.code,r}return e||t}class v extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new d.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError";}}m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",((e,t,r)=>{h("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],a=[],s=[];for(const e of t)h("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):u.test(e)?a.push(e):(h("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"));}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`;}}(a.length>0||s.length>0)&&(n+=" or ");}if(a.length>0){switch(a.length){case 1:n+=`an instance of ${a[0]}`;break;case 2:n+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`an instance of ${a.join(", ")}, or ${e}`;}}s.length>0&&(n+=" or ");}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`one of ${s.join(", ")}, or ${e}`;}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`;}else {let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`;}return n}),TypeError),m("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),m("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return `Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),m("ERR_MISSING_ARGS",((...e)=>{let t;h(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`;}}return `${t} must be specified`}),TypeError),m("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return h(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=f(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=f(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:v,aggregateTwoErrors:y(g),hideStackFrames:y,codes:d};},{"./util":41}],40:[function(e,t,r){t.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Uint8Array:Uint8Array};},{}],41:[function(e,t,r){const n=e("buffer"),i=Object.getPrototypeOf((async function(){})).constructor,o=globalThis.Blob||n.Blob,a=void 0!==o?function(e){return e instanceof o}:function(e){return !1};class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e;}}t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r));}},createDeferredPromise:function(){let e,t;return {promise:new Promise(((r,n)=>{e=r,t=n;})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)));})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return "f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return `"${e}"`;if(!e.includes("`")&&!e.includes("${"))return `\`${e}\``}return `'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return `${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return "{}"}},types:{isAsyncFunction:e=>e instanceof i,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:a},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom");},{buffer:15}],42:[function(e,t,r){const{Buffer:n}=e("buffer"),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=e("./ours/primordials"),{promisify:{custom:s}}=e("./ours/util"),{streamReturningOperators:l,promiseReturningOperators:u}=e("./internal/streams/operators"),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=e("./ours/errors"),d=e("./internal/streams/compose"),{pipeline:h}=e("./internal/streams/pipeline"),{destroyer:f}=e("./internal/streams/destroy"),p=e("./internal/streams/end-of-stream"),m=e("./stream/promises"),y=e("./internal/streams/utils"),g=t.exports=e("./internal/streams/legacy").Stream;g.isDisturbed=y.isDisturbed,g.isErrored=y.isErrored,g.isReadable=y.isReadable,g.Readable=e("./internal/streams/readable");for(const w of o(l)){const b=l[w];function _(...e){if(new.target)throw c();return g.Readable.from(a(b,this,e))}i(_,"name",{__proto__:null,value:b.name}),i(_,"length",{__proto__:null,value:b.length}),i(g.Readable.prototype,w,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0});}for(const E of o(u)){const T=u[E];function x(...e){if(new.target)throw c();return a(T,this,e)}i(x,"name",{__proto__:null,value:T.name}),i(x,"length",{__proto__:null,value:T.length}),i(g.Readable.prototype,E,{__proto__:null,value:x,enumerable:!1,configurable:!0,writable:!0});}g.Writable=e("./internal/streams/writable"),g.Duplex=e("./internal/streams/duplex"),g.Transform=e("./internal/streams/transform"),g.PassThrough=e("./internal/streams/passthrough"),g.pipeline=h;const{addAbortSignal:v}=e("./internal/streams/add-abort-signal");g.addAbortSignal=v,g.finished=p,g.destroy=f,g.compose=d,i(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(h,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)};},{"./internal/streams/add-abort-signal":20,"./internal/streams/compose":22,"./internal/streams/destroy":23,"./internal/streams/duplex":24,"./internal/streams/end-of-stream":26,"./internal/streams/legacy":28,"./internal/streams/operators":29,"./internal/streams/passthrough":30,"./internal/streams/pipeline":31,"./internal/streams/readable":32,"./internal/streams/transform":34,"./internal/streams/utils":35,"./internal/streams/writable":36,"./ours/errors":39,"./ours/primordials":40,"./ours/util":41,"./stream/promises":43,buffer:15}],43:[function(e,t,r){const{ArrayPrototypePop:n,Promise:i}=e("../ours/primordials"),{isIterable:o,isNodeStream:a,isWebStream:s}=e("../internal/streams/utils"),{pipelineImpl:l}=e("../internal/streams/pipeline"),{finished:u}=e("../internal/streams/end-of-stream");function c(...e){return new i(((t,r)=>{let i,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!a(c)&&!o(c)&&!s(c)){const t=n(e);i=t.signal,u=t.end;}l(e,((e,n)=>{e?r(e):t(n);}),{signal:i,end:u});}))}e("../../lib/stream.js"),t.exports={finished:u,pipeline:c};},{"../../lib/stream.js":42,"../internal/streams/end-of-stream":26,"../internal/streams/pipeline":31,"../internal/streams/utils":35,"../ours/primordials":40}]},{},[10])(10);var Qh=Vh.exports;class Zh{constructor(e,t){this.graphName=e,this.idx=t;}toString(){return `${this.graphName}:${this.idx}`}}class Kh{constructor(e,t){this.tp=e,this.val=t;}toString(){return JSON.stringify(this)}static getRefFromQuad(e){return e.termType===rs.IRI?new Kh(rs.IRI,e.value):e.termType===rs.BlankNode?new Kh(rs.BlankNode,e.value):new Kh(rs.Undefined,"")}}class Xh{async loadDocument(e,t=[]){const r=e.startsWith("http:"),n=e.startsWith("https:");if(!r&&!n)throw new rl('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:e});let i=null;const{res:o,body:a}=await rf({url:e}),s={contextUrl:null,documentUrl:e,document:a||null};if(o.status>=400)throw new rl(`URL "${e}" could not be dereferenced: ${o.statusText}`,"jsonld.InvalidUrl",{code:"loading document failed",url:e,httpStatusCode:o.status});const l=o.headers.get("link");let u=o.headers.get("location");const c=o.headers.get("content-type");if(l&&"application/ld+json"!==c&&"application/json"!==c){const t=hl.parseLinkHeader(l),r=t[vl.LINK_HEADER_CONTEXT];if(Array.isArray(r))throw new rl("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:e});r&&(s.contextUrl=r.target),i=t.alternate,i&&"application/ld+json"==i.type&&!(c||"").match(/^application\/(\w*\+)?json$/)&&(u=El.prependBase(e,i.target));}if((i||o.status>=300&&o.status<400)&&u){if(-1===t.length)throw new rl("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:e,httpStatusCode:o.status,redirects:t});if(-1!==t.indexOf(e))throw new rl("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:e,httpStatusCode:o.status,redirects:t});t.push(e);const r=new URL(u,e).href;return this.loadDocument(r,t)}return t.push(e),s}}const ef="cat";async function tf(e,t,r){if(!t&&!r)throw new rl("IPFS is not configured","jsonld.IPFSNotConfigured",{code:"loading document failed",url:nf+e});return null!==t?await async function(e,t){const r=new URL(function(e,t){const r="/api/v0";for(;e.endsWith("/");)e=e.slice(0,-1);return e.endsWith(r)||(e+=r),e+"/"+t}(t,ef));r.searchParams.append("arg",e);const{res:n,body:i}=await rf({url:r,method:"POST"});if(200!=n.status)throw new Error(`Error calling IPFS node: [${n.status}] ${n.statusText}\n${i}`);return {contextUrl:null,document:i||null,documentUrl:nf+e}}(e,t):await async function(e,t){const r=new Xh,n=await r.loadDocument(function(e,t){return function(e){for(;e.endsWith("/");)e=e.slice(0,-1);return e}(e)+"/ipfs/"+function(e){for(;e.startsWith("/");)e=e.slice(1);return e}(t)}(t,e),[]);return n.contextUrl=null,n.documentUrl=nf+e,n}(e,r)}async function rf({url:e,method:t}){const r={};void 0!==t&&(r.method=t);try{(e=new URL(e)).username&&e.password&&(r.headers={...r.headers??{},authorization:`Basic ${btoa(e.username+":"+e.password)}`},e=function(e){const t=new URL(e);return t.username="",t.password="",t.href}(e));const t=await fetch(e,r);if(t.status>=300&&t.status<400)return {res:t,body:null};const n=await t.text();return n&&n.length>0&&n.startsWith("{")?{res:t,body:JSON.parse(n)}:{res:t,body:n}}catch(t){if(t.response)return {res:t.response,body:null};throw new rl("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:e,cause:t})}}const nf="ipfs://";function of(e){return e?.hasher??a}function af(e){const t=e?.ipfsNodeURL??null,r=e?.ipfsGatewayURL??null;return e?.documentLoader??((e=null,t=null)=>async r=>{if(r.startsWith(nf)){const n=r.slice(nf.length);return await tf(n,e,t)}return (new Xh).loadDocument(r,[])})(t,r)}class sf{constructor(e=new Map){this.graphs=e;}static async fromDocument(e,t=af()){const r=await Hh.canonize(e,{format:i.QUADS_FORMAT,documentLoader:t}),n=new Qh.Parser({format:i.QUADS_FORMAT}).parse(r),o=new sf;for(const e of n){const t=e.graph.termType===i.DEFAULT_GRAPH_TERM_TYPE?i.DEFAULT_GRAPH_NODE_NAME:e.graph.value,r=o.graphs.get(t)??[];r.push(e),o.graphs.set(t,r);}return o}static getQuad(e,t){const r=e.graphs.get(t.graphName);if(!r)throw i.ERRORS.GRAPH_NOT_FOUND;if(t.idx>=r.length)throw i.ERRORS.QUAD_NOT_FOUND;return r[t.idx]}static iterGraphsOrdered(e,t){const r=[];for(const t of e.graphs.keys())r.push(t);r.sort(((e,t)=>e.localeCompare(t)));for(const n of r){t(n,e.graphs.get(n));}}static findParent(e,t){const r=sf.findParentInsideGraph(e,t);return r||sf.findGraphParent(e,t)}static findParentInsideGraph(e,t){const r=os(t);let n;const o=e.graphs.get(r);if(!o)return;const a=Kh.getRefFromQuad(t.subject);if(a.tp===rs.Undefined)return;let s=!1;for(let e=0;e<o.length;e++){const l=o[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&(a?.tp===u?.tp&&a?.val===u?.val)){if(s)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;s=!0,n=new Zh(r,e);}}return n}static findGraphParent(e,t){if(!t.graph)return;const r=Kh.getRefFromQuad(t.graph);if(r.tp===rs.Undefined)return;if(r.tp!==rs.BlankNode)throw new Error("graph parent can only be a blank node");let n,o=!1;for(const[a,s]of e.graphs)for(let e=0;e<s.length;e++){const l=s[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&r.toString()==u.toString()){if(o)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;o=!0,n=new Zh(a,e);}}if(o)return n;throw i.ERRORS.PARENT_NOT_FOUND}}sf.assertDatasetConsistency=e=>{for(const[t,r]of e.graphs)for(const e of r){if(!t)throw new Error("empty graph name");if(t===i.DEFAULT_GRAPH_NODE_NAME&&e.graph.id)throw new Error("graph should be nil for @default graph");if(!e.graph.id&&t!==i.DEFAULT_GRAPH_NODE_NAME)throw new Error("graph should not be nil for non-@default graph")}};class lf{constructor(e=[],t=a){this.parts=e,this.hasher=t;}reverse(){return this.parts.reverse()}append(e){this.parts=[...this.parts,...e];}prepend(e){this.parts=[...e,...this.parts];}async mtEntry(){const e=this.hasher??a,t=new Array(this.parts.length).fill(BigInt(0));for(let r=0;r<this.parts.length;r+=1){const n=this.parts[r];if("string"==typeof n){const i=ss.encode(n);t[r]=await e.hashBytes(i);}else {if("number"!=typeof n)throw new Error("error: unexpected type "+typeof n);t[r]=BigInt(n);}}return e.hash(t)}async pathFromContext(e,t,r){const n=JSON.parse(e);if(!n["@context"])throw i.ERRORS.CONTEXT_NOT_DEFINED;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=l[e];if(i.DIGITS_ONLY_REGEX.test(t))this.parts.push(parseInt(t));else {const e=s.mappings.get(t);if("object"!=typeof e)throw i.ERRORS.TERM_IS_NOT_DEFINED;const r=e["@id"];if(!r)throw i.ERRORS.NO_ID_ATTR;e["@context"]&&(s=await Hh.processContext(s,e,o)),this.parts.push(r);}}}async typeFromContext(e,t,r){const n=JSON.parse(e);if(!("@context"in n))throw i.ERRORS.PARSED_CONTEXT_IS_NULL;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=uf(s,l[e]);t.hasContext&&(s=await Hh.processContext(s,t.typeDef,o)),this.parts.push(t["@id"]);}return lf.getTypeMapping(s,l[l.length-1])}static getTypeMapping(e,t){let r="";const n=e.mappings.get("@type");n&&(r=n);const i=e.mappings.get(t);return i&&i["@type"]&&(r=i["@type"]),r}static async pathFromDocument(e,t,r,n,o){if(0===r.length)return [];const a=r[0],s=r.slice(1),l={documentLoader:af(o)};if(i.DIGITS_ONLY_REGEX.test(a)){return [parseInt(a),...await lf.pathFromDocument(e,t,s,!0,o)]}if("object"!=typeof t)throw new Error("error: expected type object got "+typeof t);if(Array.isArray(t)){if(!t.length)throw new Error("error: can't generate path on zero-sized array");if(!n)throw i.ERRORS.UNEXPECTED_ARR_ELEMENT;return lf.pathFromDocument(e,t[0],r,!1,o)}if("@context"in t)if(e)e=await Hh.processContext(e,t,l);else {const r=await Hh.processContext(null,null,l);e=await Hh.processContext(r,t,l);}const u=as(Object.keys(t)),c=e;for(const r in u){const n=u[r];if("@type"!==n){const t=e.mappings.get(n);if("object"!=typeof t)continue;if("@type"!==t["@id"])continue}let i=[];if(Array.isArray(t[n]))t[n].forEach((e=>{if("string"!=typeof e)throw new Error("error: @type value must be an array of strings: "+typeof e);i.push(e),i=as(i);}));else {if("string"!=typeof t[n])throw new Error("error: unexpected @type field type: "+typeof t[n]);i.push(t[n]);}for(const t of i){const r=c.mappings.get(t);"object"==typeof r&&"@context"in r&&(e=await Hh.processContext(e,r,l));}break}const d=uf(e,a);if(d.hasContext)if(e)e=await Hh.processContext(e,d.typeDef,l);else {const t=await Hh.processContext(null,null,l);e=await Hh.processContext(t,d.typeDef,l);}const h=await lf.pathFromDocument(e,t[a],s,!0,o);return [d["@id"],...h]}static async newPathFromCtx(e,t,r){const n=new lf([],of(r));return await n.pathFromContext(e,t,r),n}static async fromDocument(e,t,r,n){const o=JSON.parse(t),a=r.split(".");if(0===a.length)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const s=await lf.pathFromDocument(e,o,a,!1,n);return new lf(s,of(n))}static async newTypeFromContext(e,t,r){const n=new lf([],of(r));return await n.typeFromContext(e,t,r)}static async getTypeIDFromContext(e,t,r){const n=JSON.parse(e),i={documentLoader:af(r)},o=await Hh.processContext(null,null,i),a=(await Hh.processContext(o,n,i)).mappings.get(t);if(!a)throw new Error(`looks like ${t} is not a type`);const s=a["@id"];if(!s)throw new Error(`@id attribute is not found for type ${t}`);if("string"!=typeof s)throw new Error(`@id attribute is not a string for type ${t}`);return s}}function uf(e,t){const r=e.mappings.get(t);if("object"!=typeof r)throw i.ERRORS.TERM_IS_NOT_DEFINED;const n=r["@id"];if(!n)throw i.ERRORS.NO_ID_ATTR;if("string"!=typeof n)throw new Error("error: @id attr is not of type string: "+typeof n);return {"@id":n,hasContext:"@context"in r,typeDef:r}}lf.newPath=e=>{const t=new lf;return t.append(e),t},lf.getContextPathKey=async(e,t,r,n)=>{if(""===t)throw i.ERRORS.CTX_TYP_IS_EMPTY;if(""===r)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const o=await lf.newPathFromCtx(e,`${t}.${r}`,n),a=await lf.newPathFromCtx(e,t,n);return new lf(o.parts.slice(a.parts.length))};class cf{constructor(e){this.graph=os(e);const t=e.subject;switch(t.termType){case rs.IRI:this.subject={tp:rs.IRI,val:t.value};break;case rs.BlankNode:this.subject={tp:rs.BlankNode,val:t.value};break;default:throw new Error("invalid subject type")}if(e.predicate.termType!==rs.IRI)throw new Error("invalid predicate type");this.predicate=e.predicate.value;}toString(){return JSON.stringify(this)}}cf.countEntries=e=>{const t=new Map;for(const r of e){const e=new cf(r);let n=t.get(e.toString())??0;t.set(e.toString(),++n);}return t};class df{constructor(e=new Map,t=new Map,r=a){this.parents=e,this.children=t,this.hasher=r;}static getIriValue(e){if(e.predicate.termType===rs.IRI)return e.predicate.value;throw new Error("type is not IRI")}path(e,t,r){const n=new lf([],this.hasher);"number"==typeof r&&n.append([r]);const i=sf.getQuad(t,e),o=df.getIriValue(i);n.append([o]);let a=e;for(;;){const e=this.parents.get(a.toString());if(!e)break;const r=sf.getQuad(t,e),i=new cf(r),o=this.children.get(i.toString());if(!o)throw new Error("parent mapping not found");const s=sf.getQuad(t,a),l=Kh.getRefFromQuad(s.subject),u=o.get(l.toString());if("number"!=typeof u)throw new Error("child not found in parents mapping");const c=df.getIriValue(r);1===o.size?n.append([c]):n.append([u,c]),a=e;}return n.reverse(),n}static async newRelationship(e,t){const r=new df(new Map,new Map,t);return sf.iterGraphsOrdered(e,((t,n)=>{for(let i=0;i<n.length;i++){const o=n[i],a=sf.findParent(e,o);if(!a)continue;const s=new Zh(t,i);r.parents.set(s.toString(),a);const l=sf.getQuad(e,a),u=new cf(l);let c=r.children.get(u.toString());c||(c=new Map,r.children.set(u.toString(),c));const d=Kh.getRefFromQuad(o.subject);if("number"!=typeof c.get(d.toString())){const e=c.size;c.set(d.toString(),e);}}})),r}}class hf{constructor(e,t,r="",n=a){if(this.key=e,this.value=t,this.dataType=r,this.hasher=n,!e.parts.length)throw new Error("key length is zero");(e=>{switch(typeof e){case"boolean":case"string":case"bigint":case"number":return;case"object":if(e instanceof es.Instant)return}throw new Error(`unexpected value type ${typeof e}, expected boolean | number | Temporal.Instant | string`)})(t);}getHasher(){return this.hasher}getKeyMtEntry(){return this.key.mtEntry()}getValueMtEntry(){return hs.mkValueMtEntry(this.getHasher(),this.value)}async getKeyValueMTEntry(){return {k:await this.getKeyMtEntry(),v:await this.getValueMtEntry()}}static async fromDataSet(e,t=a){sf.assertDatasetConsistency(e);if(!e.graphs.get(i.DEFAULT_GRAPH_NODE_NAME).length)throw new Error("@default graph not found in dataset");const r=await df.newRelationship(e,t),n=[];return sf.iterGraphsOrdered(e,((i,o)=>{const a=cf.countEntries(o),s=new Map;for(let l=0;l<o.length;l++){let u="";const c=o[l],d=new Zh(i,l),h=new cf(c);let f;const p=c.object.termType,m=c.object.value;switch(p){case rs.Literal:u=c?.object?.datatype?.value,f=us(u,m,t.prime());break;case rs.IRI:if(!p)throw new Error("object IRI is nil");f=m;break;case rs.BlankNode:if(r.children.get(h.toString()))continue;throw new Error("BlankNode is not supported yet");case"Variable":f=m;break;default:throw new Error("unexpected Quad's Object type")}let y;switch(a.get(h.toString())){case 0:throw new Error("[assertion] key not found in counts");case 1:break;default:const e=h.toString();y=s.get(e)??0,s.set(e,y+1);}const g=r.path(d,e,y),v=new hf(g,f,u,t);n.push(v);}})),n}}hf.newRDFEntry=(e,t)=>{const r=new hf(e,t);switch(typeof t){case"number":case"string":case"boolean":r.value=t;break;default:if(!(t instanceof es.Instant))throw new Error("error: incorrect value type "+typeof t);r.value=t;}return r};class ff{constructor(e=null,i=null,o=a,s=new Map,l=null,u=af()){if(this.srcDoc=e,this.mt=i,this.hasher=o,this.entries=s,this.compacted=l,this.documentLoader=u,!i){const{db:e,writable:i,maxLevels:o}=((e="",n=!0,i=40)=>({db:new j$1(B$2(e)),writable:n,maxLevels:i}))();this.mt=new Jt$1(e,i,o);}}async proof(e){const t=await e.mtEntry(),{proof:r}=await this.mt.generateProof(t);if(r.existence){if(!this.entries.has(t.toString()))throw new Error("error: [assertion] no entry found while existence is true");const e=this.entries.get(t.toString());return {proof:r,value:new hs(e.value,this.hasher)}}return {proof:r}}mkValue(e){return new hs(e,this.hasher)}async resolveDocPath(e,t){const r=await lf.fromDocument(null,this.srcDoc,e,t);return r.hasher=this.hasher,r}async entry(e){const t=await e.mtEntry(),r=this.entries.get(t.toString());if(!r)throw new Error("entry not found");return r}async jsonLDType(e){return (await this.entry(e)).dataType}async root(){return this.mt.root()}rawValue(e){let t=e.parts,r=this.compacted;const n=[];for(;t.length>0;){const e=t[0];if("string"==typeof e){if(n.push(e),r=r[e]??r["@graph"][e],!r)throw new Error("value not found")}else {if("number"!=typeof e)throw new Error(`unexpected type of path ${n.join(" / ")}`);n.push(e.toString()),r=this.rvExtractArrayIdx(r,e);}t=t.slice(1);}return void 0!==r["@value"]?r["@value"]:r}rvExtractArrayIdx(e,t){if(!Array.isArray(e))throw new Error("expected array");if(t<0||t>=e.length)throw new Error("index is out of range");return e[t]}static async merklizeJSONLD(e,t){const r=of(t),n=af(t),i=new ff(e,null,r,new Map,null,n),o=JSON.parse(i.srcDoc),a=await sf.fromDocument(o,n),s=await hf.fromDataSet(a,r);for(const e of s){const t=await e.getKeyMtEntry();i.entries.set(t.toString(),e);}return await(async(e,t)=>{for(const r of t){const{k:t,v:n}=await r.getKeyValueMTEntry();await e.add(t,n);}})(i.mt,s),i.compacted=await Hh.compact(o,{},{documentLoader:n,base:null,compactArrays:!0,compactToRelative:!0}),i}static async hashValue(e,t){return this.hashValueWithHasher(a,e,t)}static async hashValueWithHasher(e,t,r){const n=((e,t)=>{const r=t===ns.Double;switch(typeof e){case"string":return r?is(parseFloat(e)):e;case"boolean":return `${e}`;case"number":return r?is(e):`${e}`;default:throw new Error("unsupported type")}})(r,t),i=us(t,n,e.prime());return await hs.mkValueMtEntry(e,i)}get options(){return {hasher:this.hasher,documentLoader:this.documentLoader}}}
7850
7919
 
7851
7920
  var index = /*#__PURE__*/Object.freeze({
7852
7921
  __proto__: null,
@@ -20634,16 +20703,6 @@ var PolygonIdSdk = (function (exports) {
20634
20703
  rnds[6] = rnds[6] & 0x0f | 0x40;
20635
20704
  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
20636
20705
 
20637
- if (buf) {
20638
- offset = offset || 0;
20639
-
20640
- for (let i = 0; i < 16; ++i) {
20641
- buf[offset + i] = rnds[i];
20642
- }
20643
-
20644
- return buf;
20645
- }
20646
-
20647
20706
  return unsafeStringify(rnds);
20648
20707
  }
20649
20708
 
@@ -30178,7 +30237,7 @@ var PolygonIdSdk = (function (exports) {
30178
30237
  /**
30179
30238
  * The current version of Ethers.
30180
30239
  */
30181
- const version = "6.13.1";
30240
+ const version = "6.13.2";
30182
30241
 
30183
30242
  /**
30184
30243
  * Property helper functions.
@@ -30403,7 +30462,7 @@ var PolygonIdSdk = (function (exports) {
30403
30462
  expectedCount: expectedCount
30404
30463
  });
30405
30464
  }
30406
- const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
30465
+ ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
30407
30466
  try {
30408
30467
  // General test for normalize
30409
30468
  /* c8 ignore start */
@@ -30425,14 +30484,6 @@ var PolygonIdSdk = (function (exports) {
30425
30484
  catch (error) { }
30426
30485
  return accum;
30427
30486
  }, []);
30428
- /**
30429
- * Throws if the normalization %%form%% is not supported.
30430
- */
30431
- function assertNormalize(form) {
30432
- assert$2(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
30433
- operation: "String.prototype.normalize", info: { form }
30434
- });
30435
- }
30436
30487
  /**
30437
30488
  * Many classes use file-scoped values to guard the constructor,
30438
30489
  * making it effectively private. This facilitates that pattern
@@ -31077,10 +31128,6 @@ var PolygonIdSdk = (function (exports) {
31077
31128
  */
31078
31129
  function toUtf8Bytes(str, form) {
31079
31130
  assertArgument(typeof (str) === "string", "invalid string value", "str", str);
31080
- if (form != null) {
31081
- assertNormalize(form);
31082
- str = str.normalize(form);
31083
- }
31084
31131
  let result = [];
31085
31132
  for (let i = 0; i < str.length; i++) {
31086
31133
  const c = str.charCodeAt(i);
@@ -38128,7 +38175,6 @@ var PolygonIdSdk = (function (exports) {
38128
38175
  let {V} = node;
38129
38176
  if (V) { // this is a valid emoji (so far)
38130
38177
  emoji = V;
38131
- if (eaten) eaten.push(...cps.slice(pos).reverse()); // (optional) copy input, used for ens_tokenize()
38132
38178
  cps.length = pos; // truncate
38133
38179
  }
38134
38180
  }
@@ -38195,7 +38241,7 @@ var PolygonIdSdk = (function (exports) {
38195
38241
  * as the wildcard resolution.
38196
38242
  */
38197
38243
  function dnsEncode(name, _maxLength) {
38198
- const length = (_maxLength != null) ? _maxLength : 63;
38244
+ const length = _maxLength ;
38199
38245
  assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length);
38200
38246
  return hexlify(concat(ensNameSplit(name).map((comp) => {
38201
38247
  assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name);
@@ -48190,7 +48236,7 @@ var PolygonIdSdk = (function (exports) {
48190
48236
  // If the network changed: calling again will also fail
48191
48237
  // If unsupported: likely destroyed
48192
48238
  if (isError(error, "CANCELLED") || isError(error, "BAD_DATA") ||
48193
- isError(error, "NETWORK_ERROR" )) {
48239
+ isError(error, "NETWORK_ERROR")) {
48194
48240
  if (error.info == null) {
48195
48241
  error.info = {};
48196
48242
  }
@@ -49409,45 +49455,29 @@ var PolygonIdSdk = (function (exports) {
49409
49455
  throw new Error(exports.CircuitError.EmptyQueryValue);
49410
49456
  }
49411
49457
  validateValueArraySize(maxArrSize) {
49412
- switch (this.values.length) {
49413
- case 0: {
49414
- const zeroArrSizeOps = [exports.Operators.NOOP, exports.Operators.SD, exports.Operators.NULLIFY];
49415
- if (!zeroArrSizeOps.includes(this.operator)) {
49416
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49417
- }
49418
- return;
49419
- }
49420
- case 1: {
49421
- const oneArrSizeOps = [
49422
- exports.Operators.EQ,
49423
- exports.Operators.LT,
49424
- exports.Operators.GT,
49425
- exports.Operators.NE,
49426
- exports.Operators.LTE,
49427
- exports.Operators.GTE,
49428
- exports.Operators.EXISTS
49429
- ];
49430
- if (!oneArrSizeOps.includes(this.operator)) {
49431
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49432
- }
49433
- return;
49434
- }
49435
- case 2: {
49436
- const twoArrSizeOps = [exports.Operators.BETWEEN, exports.Operators.NONBETWEEN];
49437
- if (!twoArrSizeOps.includes(this.operator)) {
49438
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49439
- }
49440
- return;
49441
- }
49442
- default: {
49443
- const maxArrSizeOps = [exports.Operators.IN, exports.Operators.NIN];
49444
- if (!maxArrSizeOps.includes(this.operator)) {
49445
- throw new Error(exports.CircuitError.InvalidOperationType);
49446
- }
49447
- if (!this.values.length || this.values.length > maxArrSize) {
49448
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49449
- }
49450
- }
49458
+ if ([exports.Operators.NOOP, exports.Operators.SD, exports.Operators.NULLIFY].includes(this.operator) &&
49459
+ this.values.length !== 0) {
49460
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49461
+ }
49462
+ else if ([
49463
+ exports.Operators.EQ,
49464
+ exports.Operators.LT,
49465
+ exports.Operators.GT,
49466
+ exports.Operators.NE,
49467
+ exports.Operators.LTE,
49468
+ exports.Operators.GTE,
49469
+ exports.Operators.EXISTS
49470
+ ].includes(this.operator) &&
49471
+ this.values.length !== 1) {
49472
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49473
+ }
49474
+ else if ([exports.Operators.BETWEEN, exports.Operators.NONBETWEEN].includes(this.operator) &&
49475
+ this.values.length !== 2) {
49476
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49477
+ }
49478
+ else if ([exports.Operators.IN, exports.Operators.NIN].includes(this.operator) &&
49479
+ this.values.length > maxArrSize) {
49480
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49451
49481
  }
49452
49482
  }
49453
49483
  }
@@ -53184,18 +53214,12 @@ var PolygonIdSdk = (function (exports) {
53184
53214
  let nodeAux = undefined;
53185
53215
  const siblings = mtp.siblings?.map((s) => s.toString());
53186
53216
  if (mtp.auxExistence) {
53187
- const auxIndex = BigInt(mtp.auxIndex.toString());
53188
- const auxValue = BigInt(mtp.auxValue.toString());
53189
53217
  nodeAux = {
53190
- key: auxIndex.toString(),
53191
- value: auxValue.toString()
53218
+ key: mtp.auxIndex.toString(),
53219
+ value: mtp.auxValue.toString()
53192
53220
  };
53193
53221
  }
53194
- return Kt$1.fromJSON({
53195
- existence: mtp.existence,
53196
- nodeAux,
53197
- siblings
53198
- });
53222
+ return Kt$1.fromJSON({ existence: mtp.existence, node_aux: nodeAux, siblings });
53199
53223
  }
53200
53224
  }
53201
53225
 
@@ -53485,7 +53509,7 @@ var PolygonIdSdk = (function (exports) {
53485
53509
  const treesMeta = [];
53486
53510
  MERKLE_TREE_TYPES.forEach((t) => {
53487
53511
  const treeId = identifier.concat('+' + t.toString());
53488
- const tree = new Pt$1(new j$1(B$2(treeId)), true, this.mtDepth);
53512
+ const tree = new Jt$1(new j$1(B$2(treeId)), true, this.mtDepth);
53489
53513
  const metaInfo = { treeId, identifier: identifier, type: t };
53490
53514
  this._data[identifier].push({ tree, metaInfo });
53491
53515
  treesMeta.push(metaInfo);
@@ -53711,7 +53735,7 @@ var PolygonIdSdk = (function (exports) {
53711
53735
  /** get merkle tree from the local storage */
53712
53736
  async getMerkleTreeByIdentifierAndType(identifier, mtType) {
53713
53737
  const resultMeta = this.getMeta(identifier, mtType);
53714
- return new Pt$1(new Z$1(B$2(resultMeta.treeId)), true, this._mtDepth);
53738
+ return new Jt$1(new Z$1(B$2(resultMeta.treeId)), true, this._mtDepth);
53715
53739
  }
53716
53740
  getMeta(identifier, mtType) {
53717
53741
  const meta = localStorage.getItem(MerkleTreeLocalStorage.storageKeyMeta);
@@ -53729,7 +53753,7 @@ var PolygonIdSdk = (function (exports) {
53729
53753
  /** adds to merkle tree in the local storage */
53730
53754
  async addToMerkleTree(identifier, mtType, hindex, hvalue) {
53731
53755
  const resultMeta = this.getMeta(identifier, mtType);
53732
- const tree = new Pt$1(new Z$1(B$2(resultMeta.treeId)), true, this._mtDepth);
53756
+ const tree = new Jt$1(new Z$1(B$2(resultMeta.treeId)), true, this._mtDepth);
53733
53757
  await tree.add(hindex, hvalue);
53734
53758
  }
53735
53759
  /** binds merkle tree in the local storage to the new identifiers */
@@ -53857,7 +53881,7 @@ var PolygonIdSdk = (function (exports) {
53857
53881
  if (!resultMeta) {
53858
53882
  throw err;
53859
53883
  }
53860
- return new Pt$1(new lt$2(B$2(resultMeta.treeId)), true, this._mtDepth);
53884
+ return new Jt$1(new lt$2(B$2(resultMeta.treeId)), true, this._mtDepth);
53861
53885
  }
53862
53886
  /** adds to merkle tree in the indexed db storage */
53863
53887
  async addToMerkleTree(identifier, mtType, hindex, hvalue) {
@@ -53869,7 +53893,7 @@ var PolygonIdSdk = (function (exports) {
53869
53893
  if (!resultMeta) {
53870
53894
  throw new Error(`Merkle tree not found for identifier ${identifier} and type ${mtType}`);
53871
53895
  }
53872
- const tree = new Pt$1(new lt$2(B$2(resultMeta.treeId)), true, this._mtDepth);
53896
+ const tree = new Jt$1(new lt$2(B$2(resultMeta.treeId)), true, this._mtDepth);
53873
53897
  await tree.add(hindex, hvalue);
53874
53898
  }
53875
53899
  /** binds merkle tree in the indexed db storage to the new identifiers */
@@ -54284,13 +54308,8 @@ var PolygonIdSdk = (function (exports) {
54284
54308
  * @returns {RevocationStatus} RevocationStatus
54285
54309
  */
54286
54310
  const toRevocationStatus = ({ issuer, mtp }) => {
54287
- const p = Kt$1.fromJSON({
54288
- nodeAux: mtp.node_aux,
54289
- existence: mtp.existence,
54290
- siblings: mtp.siblings
54291
- });
54292
54311
  return {
54293
- mtp: p,
54312
+ mtp: Kt$1.fromJSON(mtp),
54294
54313
  issuer
54295
54314
  };
54296
54315
  };
@@ -54525,7 +54544,7 @@ var PolygonIdSdk = (function (exports) {
54525
54544
  };
54526
54545
  return mkProof();
54527
54546
  case NodeType.Middle:
54528
- if (A$2(key.bytes, depth)) {
54547
+ if (I$2(key.bytes, depth)) {
54529
54548
  nextKey = n.children[1];
54530
54549
  siblings.push(n.children[0]);
54531
54550
  }
@@ -55182,7 +55201,7 @@ var PolygonIdSdk = (function (exports) {
55182
55201
  nodes[sl].children = [node.entry[0], node.entry[1], hashOfOne];
55183
55202
  const pathKey = node.entry[0];
55184
55203
  for (let i = sl - 1; i >= 0; i--) {
55185
- const isRight = A$2(pathKey.bytes, i);
55204
+ const isRight = I$2(pathKey.bytes, i);
55186
55205
  nodes[i].children = new Array(2);
55187
55206
  if (isRight) {
55188
55207
  nodes[i].children[0] = siblings[i];
@@ -67587,7 +67606,7 @@ var PolygonIdSdk = (function (exports) {
67587
67606
  ))
67588
67607
  );
67589
67608
 
67590
- if (isExpNegative) {
67609
+ {
67591
67610
  f.addCode(
67592
67611
  c.call(ftmPrefix + "_conjugate", res, res),
67593
67612
  );
@@ -69545,28 +69564,6 @@ var PolygonIdSdk = (function (exports) {
69545
69564
  let instance;
69546
69565
  let memory;
69547
69566
 
69548
- if (self) {
69549
- self.onmessage = function(e) {
69550
- let data;
69551
- if (e.data) {
69552
- data = e.data;
69553
- } else {
69554
- data = e;
69555
- }
69556
-
69557
- if (data[0].cmd == "INIT") {
69558
- init(data[0]).then(function() {
69559
- self.postMessage(data.result);
69560
- });
69561
- } else if (data[0].cmd == "TERMINATE") {
69562
- self.close();
69563
- } else {
69564
- const res = runTask(data);
69565
- self.postMessage(res);
69566
- }
69567
- };
69568
- }
69569
-
69570
69567
  async function init(data) {
69571
69568
  const code = new Uint8Array(data.code);
69572
69569
  const wasmModule = await WebAssembly.compile(code);
@@ -72047,14 +72044,12 @@ var PolygonIdSdk = (function (exports) {
72047
72044
  globalThis.curve_bn128 = null;
72048
72045
 
72049
72046
  async function buildBn128(singleThread, plugins) {
72050
- if ((!singleThread) && (globalThis.curve_bn128)) return globalThis.curve_bn128;
72047
+ if ((globalThis.curve_bn128)) return globalThis.curve_bn128;
72051
72048
 
72052
72049
  const moduleBuilder = new ModuleBuilder();
72053
72050
  moduleBuilder.setMemory(25);
72054
72051
  buildBn128$1(moduleBuilder);
72055
72052
 
72056
- if (plugins) plugins(moduleBuilder);
72057
-
72058
72053
  const bn128wasm = {};
72059
72054
 
72060
72055
  bn128wasm.code = moduleBuilder.build();
@@ -72082,7 +72077,7 @@ var PolygonIdSdk = (function (exports) {
72082
72077
  n8q: 32,
72083
72078
  n8r: 32,
72084
72079
  cofactorG2: e("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d", 16),
72085
- singleThread: singleThread ? true : false
72080
+ singleThread: false
72086
72081
  };
72087
72082
 
72088
72083
  const curve = await buildEngine(params);
@@ -72093,7 +72088,7 @@ var PolygonIdSdk = (function (exports) {
72093
72088
  }
72094
72089
  };
72095
72090
 
72096
- if (!singleThread) {
72091
+ {
72097
72092
  globalThis.curve_bn128 = curve;
72098
72093
  }
72099
72094
 
@@ -72103,14 +72098,12 @@ var PolygonIdSdk = (function (exports) {
72103
72098
  globalThis.curve_bls12381 = null;
72104
72099
 
72105
72100
  async function buildBls12381(singleThread, plugins) {
72106
- if ((!singleThread) && (globalThis.curve_bls12381)) return globalThis.curve_bls12381;
72101
+ if ((globalThis.curve_bls12381)) return globalThis.curve_bls12381;
72107
72102
 
72108
72103
  const moduleBuilder = new ModuleBuilder();
72109
72104
  moduleBuilder.setMemory(25);
72110
72105
  buildBls12381$1(moduleBuilder);
72111
72106
 
72112
- if (plugins) plugins(moduleBuilder);
72113
-
72114
72107
  const bls12381wasm = {};
72115
72108
 
72116
72109
  bls12381wasm.code = moduleBuilder.build();
@@ -72140,7 +72133,7 @@ var PolygonIdSdk = (function (exports) {
72140
72133
  n8r: 32,
72141
72134
  cofactorG1: e("0x396c8c005555e1568c00aaab0000aaab", 16),
72142
72135
  cofactorG2: e("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5", 16),
72143
- singleThread: singleThread ? true : false
72136
+ singleThread: false
72144
72137
  };
72145
72138
 
72146
72139
  const curve = await buildEngine(params);
@@ -72151,7 +72144,7 @@ var PolygonIdSdk = (function (exports) {
72151
72144
  }
72152
72145
  };
72153
72146
 
72154
- if (!singleThread) {
72147
+ {
72155
72148
  globalThis.curve_bls12381 = curve;
72156
72149
  }
72157
72150
 
@@ -72168,9 +72161,9 @@ var PolygonIdSdk = (function (exports) {
72168
72161
  let curve;
72169
72162
  const normName = normalizeName(name);
72170
72163
  if (["BN128", "BN254", "ALTBN128"].indexOf(normName) >= 0) {
72171
- curve = await buildBn128(singleThread, plugins);
72164
+ curve = await buildBn128();
72172
72165
  } else if (["BLS12381"].indexOf(normName) >= 0) {
72173
- curve = await buildBls12381(singleThread, plugins);
72166
+ curve = await buildBls12381();
72174
72167
  } else {
72175
72168
  throw new Error(`Curve not supported: ${name}`);
72176
72169
  }
@@ -73073,8 +73066,8 @@ var PolygonIdSdk = (function (exports) {
73073
73066
  o = {
73074
73067
  type: "file",
73075
73068
  fileName: o,
73076
- cacheSize: b || DEFAULT_CACHE_SIZE,
73077
- pageSize: c || DEFAULT_PAGE_SIZE
73069
+ cacheSize: DEFAULT_CACHE_SIZE,
73070
+ pageSize: DEFAULT_PAGE_SIZE
73078
73071
  };
73079
73072
  }
73080
73073
  if (o.type == "file") {
@@ -73153,7 +73146,7 @@ var PolygonIdSdk = (function (exports) {
73153
73146
 
73154
73147
  async function createBinFile(fileName, type, version, nSections, cacheSize, pageSize) {
73155
73148
 
73156
- const fd = await createOverride(fileName, cacheSize, pageSize);
73149
+ const fd = await createOverride(fileName);
73157
73150
 
73158
73151
  const buff = new Uint8Array(4);
73159
73152
  for (let i=0; i<4; i++) buff[i] = type.charCodeAt(i);
@@ -73197,7 +73190,7 @@ var PolygonIdSdk = (function (exports) {
73197
73190
 
73198
73191
  async function endReadSection(fd, noCheck) {
73199
73192
  if (typeof fd.readingSection === "undefined") throw new Error("Not reading a section");
73200
- if (!noCheck) {
73193
+ {
73201
73194
  if (fd.pos-fd.readingSection.p != fd.readingSection.size) throw new Error("Invalid section size reading");
73202
73195
  }
73203
73196
  delete fd.readingSection;