@learncard/core 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/README.md +89 -0
- package/dist/core.cjs.development.js +48753 -0
- package/dist/core.cjs.development.js.map +7 -0
- package/dist/core.cjs.production.min.js +896 -0
- package/dist/core.cjs.production.min.js.map +7 -0
- package/dist/core.d.ts +232 -0
- package/dist/core.esm.js +48756 -0
- package/dist/core.esm.js.map +7 -0
- package/dist/didkit/README.md +89 -0
- package/dist/didkit/didkit_wasm.d.ts +222 -0
- package/dist/didkit/didkit_wasm.js +1070 -0
- package/dist/didkit/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit/didkit_wasm_bg.wasm.d.ts +48 -0
- package/dist/didkit/package.json +15 -0
- package/dist/didkit_wasm.d.ts +222 -0
- package/dist/didkit_wasm.js +1070 -0
- package/dist/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit_wasm_bg.wasm.d.ts +48 -0
- package/dist/index.js +7 -0
- package/dist/package.json +15 -0
- package/package.json +54 -0
@@ -0,0 +1,896 @@
|
|
1
|
+
var gA=Object.create;var Na=Object.defineProperty,yA=Object.defineProperties,vA=Object.getOwnPropertyDescriptor,wA=Object.getOwnPropertyDescriptors,xA=Object.getOwnPropertyNames,xl=Object.getOwnPropertySymbols,mg=Object.getPrototypeOf,u0=Object.prototype.hasOwnProperty,bg=Object.prototype.propertyIsEnumerable,_A=Reflect.get;var l0=Math.pow,pg=(r,e,t)=>e in r?Na(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ne=(r,e)=>{for(var t in e||(e={}))u0.call(e,t)&&pg(r,t,e[t]);if(xl)for(var t of xl(e))bg.call(e,t)&&pg(r,t,e[t]);return r},me=(r,e)=>yA(r,wA(e)),o=(r,e)=>Na(r,"name",{value:e,configurable:!0});var ft=(r,e)=>{var t={};for(var n in r)u0.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&xl)for(var n of xl(r))e.indexOf(n)<0&&bg.call(r,n)&&(t[n]=r[n]);return t};var Tt=(r,e)=>()=>(r&&(e=r(r=0)),e);var de=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Mt=(r,e)=>{for(var t in e)Na(r,t,{get:e[t],enumerable:!0})},gg=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xA(e))!u0.call(r,i)&&i!==t&&Na(r,i,{get:()=>e[i],enumerable:!(n=vA(e,i))||n.enumerable});return r};var ze=(r,e,t)=>(t=r!=null?gA(mg(r)):{},gg(e||!r||!r.__esModule?Na(t,"default",{value:r,enumerable:!0}):t,r)),yg=r=>gg(Na({},"__esModule",{value:!0}),r);var h0=(r,e,t)=>_A(mg(r),t,e);var M=(r,e,t)=>new Promise((n,i)=>{var s=f=>{try{c(t.next(f))}catch(l){i(l)}},a=f=>{try{c(t.throw(f))}catch(l){i(l)}},c=f=>f.done?n(f.value):Promise.resolve(f.value).then(s,a);c((t=t.apply(r,e)).next())});var Ms=de(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});var OA="[object ArrayBuffer]",Xr=class{static isArrayBuffer(e){return Object.prototype.toString.call(e)===OA}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e).slice().buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=Xr.toUint8Array(e),i=Xr.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[s])return!1;return!0}static concat(...e){if(Array.isArray(e[0])){let t=e[0],n=0;for(let a of t)n+=a.byteLength;let i=new Uint8Array(n),s=0;for(let a of t){let c=this.toUint8Array(a);i.set(c,s),s+=c.length}return e[1]?this.toView(i,e[1]):i.buffer}else return this.concat(e)}};o(Xr,"BufferSourceConverter");var ff=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){let t=Xr.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}};o(ff,"Utf8Converter");var Yr=class{static toString(e,t=!1){let n=Xr.toArrayBuffer(e),i=new DataView(n),s="";for(let a=0;a<n.byteLength;a+=2){let c=i.getUint16(a,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}};o(Yr,"Utf16Converter");var Ln=class{static isHex(e){return typeof e=="string"&&/^[a-z0-9]+$/i.test(e)}static isBase64(e){return typeof e=="string"&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}static isBase64Url(e){return typeof e=="string"&&/^[a-zA-Z0-9-_]+$/i.test(e)}static ToString(e,t="utf8"){let n=Xr.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Yr.toString(n,!0);case"utf16":case"utf16be":return Yr.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Yr.fromString(e,!0);case"utf16":case"utf16be":return Yr.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Xr.toUint8Array(e);if(typeof btoa!="undefined"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob!="undefined"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=Ln.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return ff.fromString(e);case"utf16":case"utf16be":return Yr.fromString(e);case"utf16le":case"usc2":return Yr.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=Ln.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return ff.toString(e);case"utf16":case"utf16be":return Yr.toString(e);case"utf16le":case"usc2":return Yr.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let t=Xr.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){let t=Xr.toUint8Array(e),n="",i=[],s=t.length;for(let a=0;a<s;a++){let c=t[a].toString(16).padStart(2,"0");i.push(c)}return i.join(n)}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){let s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return Yr.toString(e,t)}static FromUtf16String(e,t=!1){return Yr.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}};o(Ln,"Convert");Ln.DEFAULT_UTF8_ENCODING="utf8";function PA(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let s in i)t[s]=i[s]}return t}o(PA,"assign");function RA(...r){let e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e),n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(let s of i)t[n++]=s}),t.buffer}o(RA,"combine");function UA(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}o(UA,"isEqual");No.BufferSourceConverter=Xr;No.Convert=Ln;No.assign=PA;No.combine=RA;No.isEqual=UA});var Dy=de((AR,Pl)=>{var gy,yy,vy,wy,xy,_y,Ay,Ey,Sy,Nl,x0,Cy,ky,Ty,Ja,My,By,Iy,Ny,Oy,Py,Ry,Uy,Ly,Ol;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(t(e,t(n)))}):typeof Pl=="object"&&typeof Pl.exports=="object"?r(t(e,t(Pl.exports))):r(t(e));function t(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,a){return n[s]=i?i(s,a):a}}o(t,"createExporter")})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};gy=o(function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function s(){this.constructor=n}o(s,"__"),n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},"__extends"),yy=Object.assign||function(n){for(var i,s=1,a=arguments.length;s<a;s++){i=arguments[s];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])}return n},vy=o(function(n,i){var s={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.indexOf(a)<0&&(s[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,a=Object.getOwnPropertySymbols(n);c<a.length;c++)i.indexOf(a[c])<0&&Object.prototype.propertyIsEnumerable.call(n,a[c])&&(s[a[c]]=n[a[c]]);return s},"__rest"),wy=o(function(n,i,s,a){var c=arguments.length,f=c<3?i:a===null?a=Object.getOwnPropertyDescriptor(i,s):a,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(n,i,s,a);else for(var h=n.length-1;h>=0;h--)(l=n[h])&&(f=(c<3?l(f):c>3?l(i,s,f):l(i,s))||f);return c>3&&f&&Object.defineProperty(i,s,f),f},"__decorate"),xy=o(function(n,i){return function(s,a){i(s,a,n)}},"__param"),_y=o(function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},"__metadata"),Ay=o(function(n,i,s,a){function c(f){return f instanceof s?f:new s(function(l){l(f)})}return o(c,"adopt"),new(s||(s=Promise))(function(f,l){function h(x){try{v(a.next(x))}catch(y){l(y)}}o(h,"fulfilled");function d(x){try{v(a.throw(x))}catch(y){l(y)}}o(d,"rejected");function v(x){x.done?f(x.value):c(x.value).then(h,d)}o(v,"step"),v((a=a.apply(n,i||[])).next())})},"__awaiter"),Ey=o(function(n,i){var s={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},a,c,f,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(v){return function(x){return d([v,x])}}function d(v){if(a)throw new TypeError("Generator is already executing.");for(;s;)try{if(a=1,c&&(f=v[0]&2?c.return:v[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,v[1])).done)return f;switch(c=0,f&&(v=[v[0]&2,f.value]),v[0]){case 0:case 1:f=v;break;case 4:return s.label++,{value:v[1],done:!1};case 5:s.label++,c=v[1],v=[0];continue;case 7:v=s.ops.pop(),s.trys.pop();continue;default:if(f=s.trys,!(f=f.length>0&&f[f.length-1])&&(v[0]===6||v[0]===2)){s=0;continue}if(v[0]===3&&(!f||v[1]>f[0]&&v[1]<f[3])){s.label=v[1];break}if(v[0]===6&&s.label<f[1]){s.label=f[1],f=v;break}if(f&&s.label<f[2]){s.label=f[2],s.ops.push(v);break}f[2]&&s.ops.pop(),s.trys.pop();continue}v=i.call(n,s)}catch(x){v=[6,x],c=0}finally{a=f=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}},"__generator"),Sy=o(function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&Ol(i,n,s)},"__exportStar"),Ol=Object.create?function(n,i,s,a){a===void 0&&(a=s);var c=Object.getOwnPropertyDescriptor(i,s);(!c||("get"in c?!i.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,c)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]},Nl=o(function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],a=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&a>=n.length&&(n=void 0),{value:n&&n[a++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},"__values"),x0=o(function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var a=s.call(n),c,f=[],l;try{for(;(i===void 0||i-- >0)&&!(c=a.next()).done;)f.push(c.value)}catch(h){l={error:h}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(l)throw l.error}}return f},"__read"),Cy=o(function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(x0(arguments[i]));return n},"__spread"),ky=o(function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var a=Array(n),c=0,i=0;i<s;i++)for(var f=arguments[i],l=0,h=f.length;l<h;l++,c++)a[c]=f[l];return a},"__spreadArrays"),Ty=o(function(n,i,s){if(s||arguments.length===2)for(var a=0,c=i.length,f;a<c;a++)(f||!(a in i))&&(f||(f=Array.prototype.slice.call(i,0,a)),f[a]=i[a]);return n.concat(f||Array.prototype.slice.call(i))},"__spreadArray"),Ja=o(function(n){return this instanceof Ja?(this.v=n,this):new Ja(n)},"__await"),My=o(function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=s.apply(n,i||[]),c,f=[];return c={},l("next"),l("throw"),l("return"),c[Symbol.asyncIterator]=function(){return this},c;function l(_){a[_]&&(c[_]=function(U){return new Promise(function(E,L){f.push([_,U,E,L])>1||h(_,U)})})}function h(_,U){try{d(a[_](U))}catch(E){y(f[0][3],E)}}function d(_){_.value instanceof Ja?Promise.resolve(_.value.v).then(v,x):y(f[0][2],_)}function v(_){h("next",_)}function x(_){h("throw",_)}function y(_,U){_(U),f.shift(),f.length&&h(f[0][0],f[0][1])}},"__asyncGenerator"),By=o(function(n){var i,s;return i={},a("next"),a("throw",function(c){throw c}),a("return"),i[Symbol.iterator]=function(){return this},i;function a(c,f){i[c]=n[c]?function(l){return(s=!s)?{value:Ja(n[c](l)),done:c==="return"}:f?f(l):l}:f}},"__asyncDelegator"),Iy=o(function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof Nl=="function"?Nl(n):n[Symbol.iterator](),s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s);function a(f){s[f]=n[f]&&function(l){return new Promise(function(h,d){l=n[f](l),c(h,d,l.done,l.value)})}}function c(f,l,h,d){Promise.resolve(d).then(function(v){f({value:v,done:h})},l)}},"__asyncValues"),Ny=o(function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n},"__makeTemplateObject");var t=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};Oy=o(function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&Ol(i,n,s);return t(i,n),i},"__importStar"),Py=o(function(n){return n&&n.__esModule?n:{default:n}},"__importDefault"),Ry=o(function(n,i,s,a){if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!a:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?a:s==="a"?a.call(n):a?a.value:i.get(n)},"__classPrivateFieldGet"),Uy=o(function(n,i,s,a,c){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!c:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?c.call(n,s):c?c.value=s:i.set(n,s),s},"__classPrivateFieldSet"),Ly=o(function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},"__classPrivateFieldIn"),r("__extends",gy),r("__assign",yy),r("__rest",vy),r("__decorate",wy),r("__param",xy),r("__metadata",_y),r("__awaiter",Ay),r("__generator",Ey),r("__exportStar",Sy),r("__createBinding",Ol),r("__values",Nl),r("__read",x0),r("__spread",Cy),r("__spreadArrays",ky),r("__spreadArray",Ty),r("__await",Ja),r("__asyncGenerator",My),r("__asyncDelegator",By),r("__asyncValues",Iy),r("__makeTemplateObject",Ny),r("__importStar",Oy),r("__importDefault",Py),r("__classPrivateFieldGet",Ry),r("__classPrivateFieldSet",Uy),r("__classPrivateFieldIn",Ly)})});function QE(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=i}var c=r.length,f=r.charAt(0),l=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var _=0,U=0,E=0,L=y.length;E!==L&&y[E]===0;)E++,_++;for(var H=(L-E)*h+1>>>0,F=new Uint8Array(H);E!==L;){for(var j=y[E],D=0,B=H-1;(j!==0||D<U)&&B!==-1;B--,D++)j+=256*F[B]>>>0,F[B]=j%c>>>0,j=j/c>>>0;if(j!==0)throw new Error("Non-zero carry");U=D,E++}for(var R=H-U;R!==H&&F[R]===0;)R++;for(var Y=f.repeat(_);R<H;++R)Y+=r.charAt(F[R]);return Y}o(d,"encode");function v(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var _=0;if(y[_]!==" "){for(var U=0,E=0;y[_]===f;)U++,_++;for(var L=(y.length-_)*l+1>>>0,H=new Uint8Array(L);y[_];){var F=t[y.charCodeAt(_)];if(F===255)return;for(var j=0,D=L-1;(F!==0||j<E)&&D!==-1;D--,j++)F+=c*H[D]>>>0,H[D]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");E=j,_++}if(y[_]!==" "){for(var B=L-E;B!==L&&H[B]===0;)B++;for(var R=new Uint8Array(U+(L-B)),Y=U;B!==L;)R[Y++]=H[B++];return R}}}o(v,"decodeUnsafe");function x(y){var _=v(y);if(_)return _;throw new Error(`Non-${e} character`)}return o(x,"decode"),{encode:d,decodeUnsafe:v,decode:x}}var eS,tS,bv,gv=Tt(()=>{o(QE,"base");eS=QE,tS=eS,bv=tS});var cu={};Mt(cu,{coerce:()=>wn,empty:()=>yv,equals:()=>T0,fromHex:()=>nS,fromString:()=>M0,isBinary:()=>iS,toHex:()=>rS,toString:()=>B0});var yv,rS,nS,T0,wn,iS,M0,B0,Zs=Tt(()=>{yv=new Uint8Array(0),rS=o(r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),"toHex"),nS=o(r=>{let e=r.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):yv},"fromHex"),T0=o((r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},"equals"),wn=o(r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},"coerce"),iS=o(r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),"isBinary"),M0=o(r=>new TextEncoder().encode(r),"fromString"),B0=o(r=>new TextDecoder().decode(r),"toString")});var Th,Mh,Bh,vv,Ih,Nh,Qs,sS,oS,Bt,pi=Tt(()=>{gv();Zs();Th=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};o(Th,"Encoder");Mh=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){return vv(this,e)}};o(Mh,"Decoder");Bh=class{constructor(e){this.decoders=e}or(e){return vv(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};o(Bh,"ComposedDecoder");vv=o((r,e)=>new Bh(ne(ne({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e})),"or"),Ih=class{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Th(e,t,n),this.decoder=new Mh(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};o(Ih,"Codec");Nh=o(({name:r,prefix:e,encode:t,decode:n})=>new Ih(r,e,t,n),"from"),Qs=o(({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:i}=bv(t,e);return Nh({prefix:r,name:e,encode:n,decode:s=>wn(i(s))})},"baseX"),sS=o((r,e,t,n)=>{let i={};for(let h=0;h<e.length;++h)i[e[h]]=h;let s=r.length;for(;r[s-1]==="=";)--s;let a=new Uint8Array(s*t/8|0),c=0,f=0,l=0;for(let h=0;h<s;++h){let d=i[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|d,c+=t,c>=8&&(c-=8,a[l++]=255&f>>c)}if(c>=t||255&f<<8-c)throw new SyntaxError("Unexpected end of data");return a},"decode"),oS=o((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,s="",a=0,c=0;for(let f=0;f<r.length;++f)for(c=c<<8|r[f],a+=8;a>t;)a-=t,s+=e[i&c>>a];if(a&&(s+=e[i&c<<t-a]),n)for(;s.length*t&7;)s+="=";return s},"encode"),Bt=o(({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Nh({prefix:e,name:r,encode(i){return oS(i,n,t)},decode(i){return sS(i,n,t,r)}}),"rfc4648")});var I0={};Mt(I0,{identity:()=>aS});var aS,wv=Tt(()=>{pi();Zs();aS=Nh({prefix:"\0",name:"identity",encode:r=>B0(r),decode:r=>M0(r)})});var N0={};Mt(N0,{base2:()=>cS});var cS,xv=Tt(()=>{pi();cS=Bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var O0={};Mt(O0,{base8:()=>fS});var fS,_v=Tt(()=>{pi();fS=Bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var P0={};Mt(P0,{base10:()=>uS});var uS,Av=Tt(()=>{pi();uS=Qs({prefix:"9",name:"base10",alphabet:"0123456789"})});var R0={};Mt(R0,{base16:()=>lS,base16upper:()=>hS});var lS,hS,Ev=Tt(()=>{pi();lS=Bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hS=Bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var U0={};Mt(U0,{base32:()=>ic,base32hex:()=>bS,base32hexpad:()=>yS,base32hexpadupper:()=>vS,base32hexupper:()=>gS,base32pad:()=>pS,base32padupper:()=>mS,base32upper:()=>dS,base32z:()=>wS});var ic,dS,pS,mS,bS,gS,yS,vS,wS,L0=Tt(()=>{pi();ic=Bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),dS=Bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),pS=Bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),mS=Bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bS=Bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),gS=Bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yS=Bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vS=Bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),wS=Bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var D0={};Mt(D0,{base36:()=>jo,base36upper:()=>xS});var jo,xS,Oh=Tt(()=>{pi();jo=Qs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),xS=Qs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var K0={};Mt(K0,{base58btc:()=>mi,base58flickr:()=>_S});var mi,_S,$0=Tt(()=>{pi();mi=Qs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_S=Qs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var F0={};Mt(F0,{base64:()=>AS,base64pad:()=>ES,base64url:()=>Sv,base64urlpad:()=>SS});var AS,ES,Sv,SS,H0=Tt(()=>{pi();AS=Bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ES=Bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sv=Bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),SS=Bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function Tv(r,e,t){e=e||[],t=t||0;for(var n=t;r>=MS;)e[t++]=r&255|Cv,r/=128;for(;r&TS;)e[t++]=r&255|Cv,r>>>=7;return e[t]=r|0,Tv.bytes=t-n+1,e}function q0(r,n){var t=0,n=n||0,i=0,s=n,a,c=r.length;do{if(s>=c)throw q0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=i<28?(a&kv)<<i:(a&kv)*Math.pow(2,i),i+=7}while(a>=IS);return q0.bytes=s-n,t}var CS,Cv,kS,TS,MS,BS,IS,kv,NS,OS,PS,RS,US,LS,DS,KS,$S,FS,HS,qS,fu,Mv=Tt(()=>{CS=Tv,Cv=128,kS=127,TS=~kS,MS=Math.pow(2,31);o(Tv,"encode");BS=q0,IS=128,kv=127;o(q0,"read");NS=Math.pow(2,7),OS=Math.pow(2,14),PS=Math.pow(2,21),RS=Math.pow(2,28),US=Math.pow(2,35),LS=Math.pow(2,42),DS=Math.pow(2,49),KS=Math.pow(2,56),$S=Math.pow(2,63),FS=o(function(r){return r<NS?1:r<OS?2:r<PS?3:r<RS?4:r<US?5:r<LS?6:r<DS?7:r<KS?8:r<$S?9:10},"length"),HS={encode:CS,decode:BS,encodingLength:FS},qS=HS,fu=qS});var oc={};Mt(oc,{decode:()=>sc,encodeTo:()=>Vo,encodingLength:()=>Go});var sc,Vo,Go,Ph=Tt(()=>{Mv();sc=o(r=>[fu.decode(r),fu.decode.bytes],"decode"),Vo=o((r,e,t=0)=>(fu.encode(r,e,t),e),"encodeTo"),Go=o(r=>fu.encodingLength(r),"encodingLength")});var Jo={};Mt(Jo,{Digest:()=>eo,create:()=>to,decode:()=>uu,equals:()=>z0});var to,uu,z0,eo,ac=Tt(()=>{Zs();Ph();to=o((r,e)=>{let t=e.byteLength,n=Go(r),i=n+Go(t),s=new Uint8Array(i+t);return Vo(r,s,0),Vo(t,s,n),s.set(e,i),new eo(r,t,e,s)},"create"),uu=o(r=>{let e=wn(r),[t,n]=sc(e),[i,s]=sc(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new eo(t,i,a,e)},"decode"),z0=o((r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&T0(r.bytes,e.bytes),"equals"),eo=class{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};o(eo,"Digest")});var Uh={};Mt(Uh,{Hasher:()=>lu,from:()=>Rh});var Rh,lu,j0=Tt(()=>{ac();Rh=o(({name:r,code:e,encode:t})=>new lu(r,e,t),"from"),lu=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(n=>to(this.code,n))}else throw Error("Unknown type, must be binary type")}};o(lu,"Hasher")});var V0={};Mt(V0,{sha256:()=>Wo,sha512:()=>zS});var Bv,Wo,zS,hu=Tt(()=>{j0();Bv=o(r=>e=>M(void 0,null,function*(){return new Uint8Array(yield crypto.subtle.digest(r,e))}),"sha"),Wo=Rh({name:"sha2-256",code:18,encode:Bv("SHA-256")}),zS=Rh({name:"sha2-512",code:19,encode:Bv("SHA-512")})});var G0={};Mt(G0,{identity:()=>Lh});var Iv,jS,Nv,VS,Lh,J0=Tt(()=>{Zs();ac();Iv=0,jS="identity",Nv=wn,VS=o(r=>to(Iv,Nv(r)),"digest"),Lh={code:Iv,name:jS,encode:Nv,digest:VS}});var W0={};Mt(W0,{code:()=>JS,decode:()=>YS,encode:()=>WS,name:()=>GS});var GS,JS,WS,YS,Ov=Tt(()=>{Zs();GS="raw",JS=85,WS=o(r=>wn(r),"encode"),YS=o(r=>wn(r),"decode")});var Y0={};Mt(Y0,{code:()=>e9,decode:()=>r9,encode:()=>t9,name:()=>QS});var XS,ZS,QS,e9,t9,r9,Pv=Tt(()=>{XS=new TextEncoder,ZS=new TextDecoder,QS="json",e9=512,t9=o(r=>XS.encode(JSON.stringify(r)),"encode"),r9=o(r=>JSON.parse(ZS.decode(r)),"decode")});var Ne,n9,i9,s9,du,o9,Rv,Uv,Dh,Kh,a9,c9,f9,Xi=Tt(()=>{Ph();ac();$0();L0();Zs();Ne=class{constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Kh,byteLength:Kh,code:Dh,version:Dh,multihash:Dh,bytes:Dh,_baseCache:Kh,asCID:Kh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==du)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==o9)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ne.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=to(e,t);return Ne.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&z0(this.multihash,e.multihash)}toString(e){let{bytes:t,version:n,_baseCache:i}=this;switch(n){case 0:return i9(t,i,e||mi.encoder);default:return s9(t,i,e||ic.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return c9(/^0\.0/,f9),!!(e&&(e[Uv]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof Ne)return e;if(e!=null&&e.asCID===e){let{version:t,code:n,multihash:i,bytes:s}=e;return new Ne(t,n,i,s||Rv(t,n,i.bytes))}else if(e!=null&&e[Uv]===!0){let{version:t,multihash:n,code:i}=e,s=uu(n);return Ne.create(t,i,s)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==du)throw new Error(`Version 0 CID must use dag-pb (code: ${du}) block encoding`);return new Ne(e,t,n,n.bytes)}case 1:{let i=Rv(e,t,n.bytes);return new Ne(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ne.create(0,du,e)}static createV1(e,t){return Ne.create(1,e,t)}static decode(e){let[t,n]=Ne.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Ne.inspectBytes(e),n=t.size-t.multihashSize,i=wn(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=i.subarray(t.multihashSize-t.digestSize),a=new eo(t.multihashCode,t.digestSize,s,i);return[t.version===0?Ne.createV0(a):Ne.createV1(t.codec,a),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=o(()=>{let[d,v]=sc(e.subarray(t));return t+=v,d},"next"),i=n(),s=du;if(i===18?(i=0,t=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=t,c=n(),f=n(),l=t+f,h=l-a;return{version:i,codec:s,multihashCode:c,digestSize:f,multihashSize:h,size:l}}static parse(e,t){let[n,i]=n9(e,t),s=Ne.decode(i);return s._baseCache.set(n,e),s}};o(Ne,"CID");n9=o((r,e)=>{switch(r[0]){case"Q":{let t=e||mi;return[mi.prefix,t.decode(`${mi.prefix}${r}`)]}case mi.prefix:{let t=e||mi;return[mi.prefix,t.decode(r)]}case ic.prefix:{let t=e||ic;return[ic.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},"parseCIDtoBytes"),i9=o((r,e,t)=>{let{prefix:n}=t;if(n!==mi.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return i},"toStringV0"),s9=o((r,e,t)=>{let{prefix:n}=t,i=e.get(n);if(i==null){let s=t.encode(r);return e.set(n,s),s}else return i},"toStringV1"),du=112,o9=18,Rv=o((r,e,t)=>{let n=Go(r),i=n+Go(e),s=new Uint8Array(i+t.byteLength);return Vo(r,s,0),Vo(e,s,n),s.set(t,i),s},"encodeCID"),Uv=Symbol.for("@ipld/js-cid/CID"),Dh={writable:!1,configurable:!1,enumerable:!0},Kh={writable:!1,enumerable:!1,configurable:!1},a9="0.0.0-dev",c9=o((r,e)=>{if(r.test(a9))console.warn(e);else throw new Error(e)},"deprecate"),f9=`CID.isCID(v) is deprecated and will be removed in the next major release.
|
2
|
+
Following code pattern:
|
3
|
+
|
4
|
+
if (CID.isCID(value)) {
|
5
|
+
doSomethingWithCID(value)
|
6
|
+
}
|
7
|
+
|
8
|
+
Is replaced with:
|
9
|
+
|
10
|
+
const cid = CID.asCID(value)
|
11
|
+
if (cid) {
|
12
|
+
// Make sure to use cid instead of value
|
13
|
+
doSomethingWithCID(cid)
|
14
|
+
}
|
15
|
+
`});var X0=Tt(()=>{Xi();Ph();Zs();j0();ac()});var Lv={};Mt(Lv,{CID:()=>Ne,bases:()=>cc,bytes:()=>cu,codecs:()=>l9,digest:()=>Jo,hasher:()=>Uh,hashes:()=>u9,varint:()=>oc});var cc,u9,l9,$h=Tt(()=>{wv();xv();_v();Av();Ev();L0();Oh();$0();H0();hu();J0();Ov();Pv();X0();cc=ne(ne(ne(ne(ne(ne(ne(ne(ne({},I0),N0),O0),P0),R0),U0),D0),K0),F0),u9=ne(ne({},V0),G0),l9={raw:W0,json:Y0}});var $v=de(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});function d9(r,e){var t=r>>>16&65535,n=r&65535,i=e>>>16&65535,s=e&65535;return n*s+(t*s+n*i<<16>>>0)|0}o(d9,"imulShim");tn.mul=Math.imul||d9;function p9(r,e){return r+e|0}o(p9,"add");tn.add=p9;function m9(r,e){return r-e|0}o(m9,"sub");tn.sub=m9;function b9(r,e){return r<<e|r>>>32-e}o(b9,"rotl");tn.rotl=b9;function g9(r,e){return r<<32-e|r>>>e}o(g9,"rotr");tn.rotr=g9;function y9(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}o(y9,"isIntegerShim");tn.isInteger=Number.isInteger||y9;tn.MAX_SAFE_INTEGER=9007199254740991;tn.isSafeInteger=function(r){return tn.isInteger(r)&&r>=-tn.MAX_SAFE_INTEGER&&r<=tn.MAX_SAFE_INTEGER}});var Yo=de(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});var Fv=$v();function v9(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}o(v9,"readInt16BE");Ve.readInt16BE=v9;function w9(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}o(w9,"readUint16BE");Ve.readUint16BE=w9;function x9(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}o(x9,"readInt16LE");Ve.readInt16LE=x9;function _9(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}o(_9,"readUint16LE");Ve.readUint16LE=_9;function Hv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}o(Hv,"writeUint16BE");Ve.writeUint16BE=Hv;Ve.writeInt16BE=Hv;function qv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}o(qv,"writeUint16LE");Ve.writeUint16LE=qv;Ve.writeInt16LE=qv;function Q0(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}o(Q0,"readInt32BE");Ve.readInt32BE=Q0;function em(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}o(em,"readUint32BE");Ve.readUint32BE=em;function tm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}o(tm,"readInt32LE");Ve.readInt32LE=tm;function rm(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}o(rm,"readUint32LE");Ve.readUint32LE=rm;function qh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}o(qh,"writeUint32BE");Ve.writeUint32BE=qh;Ve.writeInt32BE=qh;function zh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}o(zh,"writeUint32LE");Ve.writeUint32LE=zh;Ve.writeInt32LE=zh;function A9(r,e){e===void 0&&(e=0);var t=Q0(r,e),n=Q0(r,e+4);return t*4294967296+n-(n>>31)*4294967296}o(A9,"readInt64BE");Ve.readInt64BE=A9;function E9(r,e){e===void 0&&(e=0);var t=em(r,e),n=em(r,e+4);return t*4294967296+n}o(E9,"readUint64BE");Ve.readUint64BE=E9;function S9(r,e){e===void 0&&(e=0);var t=tm(r,e),n=tm(r,e+4);return n*4294967296+t-(t>>31)*4294967296}o(S9,"readInt64LE");Ve.readInt64LE=S9;function C9(r,e){e===void 0&&(e=0);var t=rm(r,e),n=rm(r,e+4);return n*4294967296+t}o(C9,"readUint64LE");Ve.readUint64LE=C9;function zv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),qh(r/4294967296>>>0,e,t),qh(r>>>0,e,t+4),e}o(zv,"writeUint64BE");Ve.writeUint64BE=zv;Ve.writeInt64BE=zv;function jv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),zh(r>>>0,e,t),zh(r/4294967296>>>0,e,t+4),e}o(jv,"writeUint64LE");Ve.writeUint64LE=jv;Ve.writeInt64LE=jv;function k9(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=r/8+t-1;s>=t;s--)n+=e[s]*i,i*=256;return n}o(k9,"readUintBE");Ve.readUintBE=k9;function T9(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=t;s<t+r/8;s++)n+=e[s]*i,i*=256;return n}o(T9,"readUintLE");Ve.readUintLE=T9;function M9(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Fv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=r/8+n-1;s>=n;s--)t[s]=e/i&255,i*=256;return t}o(M9,"writeUintBE");Ve.writeUintBE=M9;function B9(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Fv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+r/8;s++)t[s]=e/i&255,i*=256;return t}o(B9,"writeUintLE");Ve.writeUintLE=B9;function I9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}o(I9,"readFloat32BE");Ve.readFloat32BE=I9;function N9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}o(N9,"readFloat32LE");Ve.readFloat32LE=N9;function O9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}o(O9,"readFloat64BE");Ve.readFloat64BE=O9;function P9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}o(P9,"readFloat64LE");Ve.readFloat64LE=P9;function R9(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}o(R9,"writeFloat32BE");Ve.writeFloat32BE=R9;function U9(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}o(U9,"writeFloat32LE");Ve.writeFloat32LE=U9;function L9(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}o(L9,"writeFloat64BE");Ve.writeFloat64BE=L9;function D9(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}o(D9,"writeFloat64LE");Ve.writeFloat64LE=D9});var xn=de(nm=>{"use strict";Object.defineProperty(nm,"__esModule",{value:!0});function K9(r){for(var e=0;e<r.length;e++)r[e]=0;return r}o(K9,"wipe");nm.wipe=K9});var Gv=de(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var Vh=Yo(),jh=xn();ro.DIGEST_LENGTH=32;ro.BLOCK_SIZE=64;var Vv=function(){function r(){this.digestLength=ro.DIGEST_LENGTH,this.blockSize=ro.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return o(r,"SHA256"),r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){jh.wipe(this._buffer),jh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(im(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=im(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,s=t<<3,a=t%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c<a-8;c++)this._buffer[c]=0;Vh.writeUint32BE(i,this._buffer,a-8),Vh.writeUint32BE(s,this._buffer,a-4),im(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(var c=0;c<this.digestLength/4;c++)Vh.writeUint32BE(this._state[c],e,c*4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){jh.wipe(e.state),e.buffer&&jh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();ro.SHA256=Vv;var $9=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function im(r,e,t,n,i){for(;i>=64;){for(var s=e[0],a=e[1],c=e[2],f=e[3],l=e[4],h=e[5],d=e[6],v=e[7],x=0;x<16;x++){var y=n+x*4;r[x]=Vh.readUint32BE(t,y)}for(var x=16;x<64;x++){var _=r[x-2],U=(_>>>17|_<<32-17)^(_>>>19|_<<32-19)^_>>>10;_=r[x-15];var E=(_>>>7|_<<32-7)^(_>>>18|_<<32-18)^_>>>3;r[x]=(U+r[x-7]|0)+(E+r[x-16]|0)}for(var x=0;x<64;x++){var U=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&d)|0)+(v+($9[x]+r[x]|0)|0)|0,E=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&a^s&c^a&c)|0;v=d,d=h,h=l,l=f+U|0,f=c,c=a,a=s,s=U+E|0}e[0]+=s,e[1]+=a,e[2]+=c,e[3]+=f,e[4]+=l,e[5]+=h,e[6]+=d,e[7]+=v,n+=64,i-=64}return n}o(im,"hashBlocks");function F9(r){var e=new Vv;e.update(r);var t=e.digest();return e.clean(),t}o(F9,"hash");ro.hash=F9});var sm=de((gL,Gh)=>{(function(){"use strict";var r="input is invalid type",e="finalize already called",t=typeof window=="object",n=t?window:{};n.JS_SHA3_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",s=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?n=global:i&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&typeof Gh=="object"&&Gh.exports,c=typeof define=="function"&&define.amd,f=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",l="0123456789abcdef".split(""),h=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],v=[1,256,65536,16777216],x=[6,1536,393216,100663296],y=[0,8,16,24],_=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],U=[224,256,384,512],E=[128,256],L=["hex","buffer","arrayBuffer","array","digest"],H={"128":168,"256":136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(A){return Object.prototype.toString.call(A)==="[object Array]"}),f&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(A){return typeof A=="object"&&A.buffer&&A.buffer.constructor===ArrayBuffer});for(var F=o(function(A,X,Q){return function(P){return new V(A,X,A).update(P)[Q]()}},"createOutputMethod"),j=o(function(A,X,Q){return function(P,O){return new V(A,X,O).update(P)[Q]()}},"createShakeOutputMethod"),D=o(function(A,X,Q){return function(P,O,z,W){return w["cshake"+A].update(P,O,z,W)[Q]()}},"createCshakeOutputMethod"),B=o(function(A,X,Q){return function(P,O,z,W){return w["kmac"+A].update(P,O,z,W)[Q]()}},"createKmacOutputMethod"),R=o(function(A,X,Q,P){for(var O=0;O<L.length;++O){var z=L[O];A[z]=X(Q,P,z)}return A},"createOutputMethods"),Y=o(function(A,X){var Q=F(A,X,"hex");return Q.create=function(){return new V(A,X,A)},Q.update=function(P){return Q.create().update(P)},R(Q,F,A,X)},"createMethod"),b=o(function(A,X){var Q=j(A,X,"hex");return Q.create=function(P){return new V(A,X,P)},Q.update=function(P,O){return Q.create(O).update(P)},R(Q,j,A,X)},"createShakeMethod"),u=o(function(A,X){var Q=H[A],P=D(A,X,"hex");return P.create=function(O,z,W){return!z&&!W?w["shake"+A].create(O):new V(A,X,O).bytepad([z,W],Q)},P.update=function(O,z,W,re){return P.create(z,W,re).update(O)},R(P,D,A,X)},"createCshakeMethod"),p=o(function(A,X){var Q=H[A],P=B(A,X,"hex");return P.create=function(O,z,W){return new K(A,X,z).bytepad(["KMAC",W],Q).bytepad([O],Q)},P.update=function(O,z,W,re){return P.create(O,W,re).update(z)},R(P,B,A,X)},"createKmacMethod"),m=[{name:"keccak",padding:v,bits:U,createMethod:Y},{name:"sha3",padding:x,bits:U,createMethod:Y},{name:"shake",padding:h,bits:E,createMethod:b},{name:"cshake",padding:d,bits:E,createMethod:u},{name:"kmac",padding:d,bits:E,createMethod:p}],w={},S=[],N=0;N<m.length;++N)for(var I=m[N],k=I.bits,g=0;g<k.length;++g){var C=I.name+"_"+k[g];if(S.push(C),w[C]=I.createMethod(k[g],I.padding),I.name!=="sha3"){var Z=I.name+k[g];S.push(Z),w[Z]=w[C]}}function V(A,X,Q){this.blocks=[],this.s=[],this.padding=X,this.outputBits=Q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(A<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Q>>5,this.extraBytes=(Q&31)>>3;for(var P=0;P<50;++P)this.s[P]=0}o(V,"Keccak"),V.prototype.update=function(A){if(this.finalized)throw new Error(e);var X,Q=typeof A;if(Q!=="string"){if(Q==="object"){if(A===null)throw new Error(r);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(r)}else throw new Error(r);X=!0}for(var P=this.blocks,O=this.byteCount,z=A.length,W=this.blockCount,re=0,le=this.s,oe,J;re<z;){if(this.reset)for(this.reset=!1,P[0]=this.block,oe=1;oe<W+1;++oe)P[oe]=0;if(X)for(oe=this.start;re<z&&oe<O;++re)P[oe>>2]|=A[re]<<y[oe++&3];else for(oe=this.start;re<z&&oe<O;++re)J=A.charCodeAt(re),J<128?P[oe>>2]|=J<<y[oe++&3]:J<2048?(P[oe>>2]|=(192|J>>6)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]):J<55296||J>=57344?(P[oe>>2]|=(224|J>>12)<<y[oe++&3],P[oe>>2]|=(128|J>>6&63)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]):(J=65536+((J&1023)<<10|A.charCodeAt(++re)&1023),P[oe>>2]|=(240|J>>18)<<y[oe++&3],P[oe>>2]|=(128|J>>12&63)<<y[oe++&3],P[oe>>2]|=(128|J>>6&63)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]);if(this.lastByteIndex=oe,oe>=O){for(this.start=oe-O,this.block=P[W],oe=0;oe<W;++oe)le[oe]^=P[oe];fe(le),this.reset=!0}else this.start=oe}return this},V.prototype.encode=function(A,X){var Q=A&255,P=1,O=[Q];for(A=A>>8,Q=A&255;Q>0;)O.unshift(Q),A=A>>8,Q=A&255,++P;return X?O.push(P):O.unshift(P),this.update(O),O.length},V.prototype.encodeString=function(A){var X,Q=typeof A;if(Q!=="string"){if(Q==="object"){if(A===null)throw new Error(r);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(r)}else throw new Error(r);X=!0}var P=0,O=A.length;if(X)P=O;else for(var z=0;z<A.length;++z){var W=A.charCodeAt(z);W<128?P+=1:W<2048?P+=2:W<55296||W>=57344?P+=3:(W=65536+((W&1023)<<10|A.charCodeAt(++z)&1023),P+=4)}return P+=this.encode(P*8),this.update(A),P},V.prototype.bytepad=function(A,X){for(var Q=this.encode(X),P=0;P<A.length;++P)Q+=this.encodeString(A[P]);var O=X-Q%X,z=[];return z.length=O,this.update(z),this},V.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var A=this.blocks,X=this.lastByteIndex,Q=this.blockCount,P=this.s;if(A[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(A[0]=A[Q],X=1;X<Q+1;++X)A[X]=0;for(A[Q-1]|=2147483648,X=0;X<Q;++X)P[X]^=A[X];fe(P)}},V.prototype.toString=V.prototype.hex=function(){this.finalize();for(var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W="",re;z<Q;){for(O=0;O<A&&z<Q;++O,++z)re=X[O],W+=l[re>>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];z%A===0&&(fe(X),O=0)}return P&&(re=X[O],W+=l[re>>4&15]+l[re&15],P>1&&(W+=l[re>>12&15]+l[re>>8&15]),P>2&&(W+=l[re>>20&15]+l[re>>16&15])),W},V.prototype.arrayBuffer=function(){this.finalize();var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W=this.outputBits>>3,re;P?re=new ArrayBuffer(Q+1<<2):re=new ArrayBuffer(W);for(var le=new Uint32Array(re);z<Q;){for(O=0;O<A&&z<Q;++O,++z)le[z]=X[O];z%A===0&&fe(X)}return P&&(le[O]=X[O],re=re.slice(0,W)),re},V.prototype.buffer=V.prototype.arrayBuffer,V.prototype.digest=V.prototype.array=function(){this.finalize();for(var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W=[],re,le;z<Q;){for(O=0;O<A&&z<Q;++O,++z)re=z<<2,le=X[O],W[re]=le&255,W[re+1]=le>>8&255,W[re+2]=le>>16&255,W[re+3]=le>>24&255;z%A===0&&fe(X)}return P&&(re=z<<2,le=X[O],W[re]=le&255,P>1&&(W[re+1]=le>>8&255),P>2&&(W[re+2]=le>>16&255)),W};function K(A,X,Q){V.call(this,A,X,Q)}o(K,"Kmac"),K.prototype=new V,K.prototype.finalize=function(){return this.encode(this.outputBits,!0),V.prototype.finalize.call(this)};var fe=o(function(A){var X,Q,P,O,z,W,re,le,oe,J,pe,ee,ce,$,ie,be,ke,Ie,Xe,dn,te,G,T,q,se,ae,he,ge,rt,Pe,Ee,nt,Ge,it,So,dt,pt,Co,mt,bt,ko,gt,yt,To,vt,wt,Mo,xt,_t,Bo,At,Et,Io,St,Ct,xs,_s,As,Es,Ss,Cs,ks,Ts;for(P=0;P<48;P+=2)O=A[0]^A[10]^A[20]^A[30]^A[40],z=A[1]^A[11]^A[21]^A[31]^A[41],W=A[2]^A[12]^A[22]^A[32]^A[42],re=A[3]^A[13]^A[23]^A[33]^A[43],le=A[4]^A[14]^A[24]^A[34]^A[44],oe=A[5]^A[15]^A[25]^A[35]^A[45],J=A[6]^A[16]^A[26]^A[36]^A[46],pe=A[7]^A[17]^A[27]^A[37]^A[47],ee=A[8]^A[18]^A[28]^A[38]^A[48],ce=A[9]^A[19]^A[29]^A[39]^A[49],X=ee^(W<<1|re>>>31),Q=ce^(re<<1|W>>>31),A[0]^=X,A[1]^=Q,A[10]^=X,A[11]^=Q,A[20]^=X,A[21]^=Q,A[30]^=X,A[31]^=Q,A[40]^=X,A[41]^=Q,X=O^(le<<1|oe>>>31),Q=z^(oe<<1|le>>>31),A[2]^=X,A[3]^=Q,A[12]^=X,A[13]^=Q,A[22]^=X,A[23]^=Q,A[32]^=X,A[33]^=Q,A[42]^=X,A[43]^=Q,X=W^(J<<1|pe>>>31),Q=re^(pe<<1|J>>>31),A[4]^=X,A[5]^=Q,A[14]^=X,A[15]^=Q,A[24]^=X,A[25]^=Q,A[34]^=X,A[35]^=Q,A[44]^=X,A[45]^=Q,X=le^(ee<<1|ce>>>31),Q=oe^(ce<<1|ee>>>31),A[6]^=X,A[7]^=Q,A[16]^=X,A[17]^=Q,A[26]^=X,A[27]^=Q,A[36]^=X,A[37]^=Q,A[46]^=X,A[47]^=Q,X=J^(O<<1|z>>>31),Q=pe^(z<<1|O>>>31),A[8]^=X,A[9]^=Q,A[18]^=X,A[19]^=Q,A[28]^=X,A[29]^=Q,A[38]^=X,A[39]^=Q,A[48]^=X,A[49]^=Q,$=A[0],ie=A[1],wt=A[11]<<4|A[10]>>>28,Mo=A[10]<<4|A[11]>>>28,ge=A[20]<<3|A[21]>>>29,rt=A[21]<<3|A[20]>>>29,Ss=A[31]<<9|A[30]>>>23,Cs=A[30]<<9|A[31]>>>23,gt=A[40]<<18|A[41]>>>14,yt=A[41]<<18|A[40]>>>14,it=A[2]<<1|A[3]>>>31,So=A[3]<<1|A[2]>>>31,be=A[13]<<12|A[12]>>>20,ke=A[12]<<12|A[13]>>>20,xt=A[22]<<10|A[23]>>>22,_t=A[23]<<10|A[22]>>>22,Pe=A[33]<<13|A[32]>>>19,Ee=A[32]<<13|A[33]>>>19,ks=A[42]<<2|A[43]>>>30,Ts=A[43]<<2|A[42]>>>30,St=A[5]<<30|A[4]>>>2,Ct=A[4]<<30|A[5]>>>2,dt=A[14]<<6|A[15]>>>26,pt=A[15]<<6|A[14]>>>26,Ie=A[25]<<11|A[24]>>>21,Xe=A[24]<<11|A[25]>>>21,Bo=A[34]<<15|A[35]>>>17,At=A[35]<<15|A[34]>>>17,nt=A[45]<<29|A[44]>>>3,Ge=A[44]<<29|A[45]>>>3,q=A[6]<<28|A[7]>>>4,se=A[7]<<28|A[6]>>>4,xs=A[17]<<23|A[16]>>>9,_s=A[16]<<23|A[17]>>>9,Co=A[26]<<25|A[27]>>>7,mt=A[27]<<25|A[26]>>>7,dn=A[36]<<21|A[37]>>>11,te=A[37]<<21|A[36]>>>11,Et=A[47]<<24|A[46]>>>8,Io=A[46]<<24|A[47]>>>8,To=A[8]<<27|A[9]>>>5,vt=A[9]<<27|A[8]>>>5,ae=A[18]<<20|A[19]>>>12,he=A[19]<<20|A[18]>>>12,As=A[29]<<7|A[28]>>>25,Es=A[28]<<7|A[29]>>>25,bt=A[38]<<8|A[39]>>>24,ko=A[39]<<8|A[38]>>>24,G=A[48]<<14|A[49]>>>18,T=A[49]<<14|A[48]>>>18,A[0]=$^~be&Ie,A[1]=ie^~ke&Xe,A[10]=q^~ae&ge,A[11]=se^~he&rt,A[20]=it^~dt&Co,A[21]=So^~pt&mt,A[30]=To^~wt&xt,A[31]=vt^~Mo&_t,A[40]=St^~xs&As,A[41]=Ct^~_s&Es,A[2]=be^~Ie&dn,A[3]=ke^~Xe&te,A[12]=ae^~ge&Pe,A[13]=he^~rt&Ee,A[22]=dt^~Co&bt,A[23]=pt^~mt&ko,A[32]=wt^~xt&Bo,A[33]=Mo^~_t&At,A[42]=xs^~As&Ss,A[43]=_s^~Es&Cs,A[4]=Ie^~dn&G,A[5]=Xe^~te&T,A[14]=ge^~Pe&nt,A[15]=rt^~Ee&Ge,A[24]=Co^~bt>,A[25]=mt^~ko&yt,A[34]=xt^~Bo&Et,A[35]=_t^~At&Io,A[44]=As^~Ss&ks,A[45]=Es^~Cs&Ts,A[6]=dn^~G&$,A[7]=te^~T&ie,A[16]=Pe^~nt&q,A[17]=Ee^~Ge&se,A[26]=bt^~gt&it,A[27]=ko^~yt&So,A[36]=Bo^~Et&To,A[37]=At^~Io&vt,A[46]=Ss^~ks&St,A[47]=Cs^~Ts&Ct,A[8]=G^~$&be,A[9]=T^~ie&ke,A[18]=nt^~q&ae,A[19]=Ge^~se&he,A[28]=gt^~it&dt,A[29]=yt^~So&pt,A[38]=Et^~To&wt,A[39]=Io^~vt&Mo,A[48]=ks^~St&xs,A[49]=Ts^~Ct&_s,A[0]^=_[P],A[1]^=_[P+1]},"f");if(a)Gh.exports=w;else{for(N=0;N<S.length;++N)n[S[N]]=w[S[N]];c&&define(function(){return w})}})()});var Jv=de((yL,H9)=>{H9.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var Wv=de(()=>{});var _n=de((Yv,om)=>{(function(r,e){"use strict";function t(b,u){if(!b)throw new Error(u||"Assertion failed")}o(t,"assert");function n(b,u){b.super_=u;var p=o(function(){},"TempCtor");p.prototype=u.prototype,b.prototype=new p,b.prototype.constructor=b}o(n,"inherits");function i(b,u,p){if(i.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((u==="le"||u==="be")&&(p=u,u=10),this._init(b||0,u||10,p||"be"))}o(i,"BN"),typeof r=="object"?r.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?s=window.Buffer:s=Wv().Buffer}catch(b){}i.isBN=o(function(u){return u instanceof i?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===i.wordSize&&Array.isArray(u.words)},"isBN"),i.max=o(function(u,p){return u.cmp(p)>0?u:p},"max"),i.min=o(function(u,p){return u.cmp(p)<0?u:p},"min"),i.prototype._init=o(function(u,p,m){if(typeof u=="number")return this._initNumber(u,p,m);if(typeof u=="object")return this._initArray(u,p,m);p==="hex"&&(p=16),t(p===(p|0)&&p>=2&&p<=36),u=u.toString().replace(/\s+/g,"");var w=0;u[0]==="-"&&(w++,this.negative=1),w<u.length&&(p===16?this._parseHex(u,w,m):(this._parseBase(u,p,w),m==="le"&&this._initArray(this.toArray(),p,m)))},"init"),i.prototype._initNumber=o(function(u,p,m){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(t(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),p,m)},"_initNumber"),i.prototype._initArray=o(function(u,p,m){if(t(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S,N,I=0;if(m==="be")for(w=u.length-1,S=0;w>=0;w-=3)N=u[w]|u[w-1]<<8|u[w-2]<<16,this.words[S]|=N<<I&67108863,this.words[S+1]=N>>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);else if(m==="le")for(w=0,S=0;w<u.length;w+=3)N=u[w]|u[w+1]<<8|u[w+2]<<16,this.words[S]|=N<<I&67108863,this.words[S+1]=N>>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);return this.strip()},"_initArray");function a(b,u){var p=b.charCodeAt(u);return p>=65&&p<=70?p-55:p>=97&&p<=102?p-87:p-48&15}o(a,"parseHex4Bits");function c(b,u,p){var m=a(b,p);return p-1>=u&&(m|=a(b,p-1)<<4),m}o(c,"parseHexByte"),i.prototype._parseHex=o(function(u,p,m){this.length=Math.ceil((u.length-p)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S=0,N=0,I;if(m==="be")for(w=u.length-1;w>=p;w-=2)I=c(u,p,w)<<S,this.words[N]|=I&67108863,S>=18?(S-=18,N+=1,this.words[N]|=I>>>26):S+=8;else{var k=u.length-p;for(w=k%2===0?p+1:p;w<u.length;w+=2)I=c(u,p,w)<<S,this.words[N]|=I&67108863,S>=18?(S-=18,N+=1,this.words[N]|=I>>>26):S+=8}this.strip()},"_parseHex");function f(b,u,p,m){for(var w=0,S=Math.min(b.length,p),N=u;N<S;N++){var I=b.charCodeAt(N)-48;w*=m,I>=49?w+=I-49+10:I>=17?w+=I-17+10:w+=I}return w}o(f,"parseBase"),i.prototype._parseBase=o(function(u,p,m){this.words=[0],this.length=1;for(var w=0,S=1;S<=67108863;S*=p)w++;w--,S=S/p|0;for(var N=u.length-m,I=N%w,k=Math.min(N,N-I)+m,g=0,C=m;C<k;C+=w)g=f(u,C,C+w,p),this.imuln(S),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(I!==0){var Z=1;for(g=f(u,C,u.length,p),C=0;C<I;C++)Z*=p;this.imuln(Z),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},"_parseBase"),i.prototype.copy=o(function(u){u.words=new Array(this.length);for(var p=0;p<this.length;p++)u.words[p]=this.words[p];u.length=this.length,u.negative=this.negative,u.red=this.red},"copy"),i.prototype.clone=o(function(){var u=new i(null);return this.copy(u),u},"clone"),i.prototype._expand=o(function(u){for(;this.length<u;)this.words[this.length++]=0;return this},"_expand"),i.prototype.strip=o(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),i.prototype._normSign=o(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),i.prototype.inspect=o(function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"},"inspect");var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=o(function(u,p){u=u||10,p=p|0||1;var m;if(u===16||u==="hex"){m="";for(var w=0,S=0,N=0;N<this.length;N++){var I=this.words[N],k=((I<<w|S)&16777215).toString(16);S=I>>>24-w&16777215,S!==0||N!==this.length-1?m=l[6-k.length]+k+m:m=k+m,w+=2,w>=26&&(w-=26,N--)}for(S!==0&&(m=S.toString(16)+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(u===(u|0)&&u>=2&&u<=36){var g=h[u],C=d[u];m="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var V=Z.modn(C).toString(u);Z=Z.idivn(C),Z.isZero()?m=V+m:m=l[g-V.length]+V+m}for(this.isZero()&&(m="0"+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}t(!1,"Base should be between 2 and 36")},"toString"),i.prototype.toNumber=o(function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},"toNumber"),i.prototype.toJSON=o(function(){return this.toString(16)},"toJSON"),i.prototype.toBuffer=o(function(u,p){return t(typeof s!="undefined"),this.toArrayLike(s,u,p)},"toBuffer"),i.prototype.toArray=o(function(u,p){return this.toArrayLike(Array,u,p)},"toArray"),i.prototype.toArrayLike=o(function(u,p,m){var w=this.byteLength(),S=m||Math.max(1,w);t(w<=S,"byte array longer than desired length"),t(S>0,"Requested array length <= 0"),this.strip();var N=p==="le",I=new u(S),k,g,C=this.clone();if(N){for(g=0;!C.isZero();g++)k=C.andln(255),C.iushrn(8),I[g]=k;for(;g<S;g++)I[g]=0}else{for(g=0;g<S-w;g++)I[g]=0;for(g=0;!C.isZero();g++)k=C.andln(255),C.iushrn(8),I[S-g-1]=k}return I},"toArrayLike"),Math.clz32?i.prototype._countBits=o(function(u){return 32-Math.clz32(u)},"_countBits"):i.prototype._countBits=o(function(u){var p=u,m=0;return p>=4096&&(m+=13,p>>>=13),p>=64&&(m+=7,p>>>=7),p>=8&&(m+=4,p>>>=4),p>=2&&(m+=2,p>>>=2),m+p},"_countBits"),i.prototype._zeroBits=o(function(u){if(u===0)return 26;var p=u,m=0;return(p&8191)===0&&(m+=13,p>>>=13),(p&127)===0&&(m+=7,p>>>=7),(p&15)===0&&(m+=4,p>>>=4),(p&3)===0&&(m+=2,p>>>=2),(p&1)===0&&m++,m},"_zeroBits"),i.prototype.bitLength=o(function(){var u=this.words[this.length-1],p=this._countBits(u);return(this.length-1)*26+p},"bitLength");function v(b){for(var u=new Array(b.bitLength()),p=0;p<u.length;p++){var m=p/26|0,w=p%26;u[p]=(b.words[m]&1<<w)>>>w}return u}o(v,"toBitArray"),i.prototype.zeroBits=o(function(){if(this.isZero())return 0;for(var u=0,p=0;p<this.length;p++){var m=this._zeroBits(this.words[p]);if(u+=m,m!==26)break}return u},"zeroBits"),i.prototype.byteLength=o(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),i.prototype.toTwos=o(function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},"toTwos"),i.prototype.fromTwos=o(function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},"fromTwos"),i.prototype.isNeg=o(function(){return this.negative!==0},"isNeg"),i.prototype.neg=o(function(){return this.clone().ineg()},"neg"),i.prototype.ineg=o(function(){return this.isZero()||(this.negative^=1),this},"ineg"),i.prototype.iuor=o(function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var p=0;p<u.length;p++)this.words[p]=this.words[p]|u.words[p];return this.strip()},"iuor"),i.prototype.ior=o(function(u){return t((this.negative|u.negative)===0),this.iuor(u)},"ior"),i.prototype.or=o(function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},"or"),i.prototype.uor=o(function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},"uor"),i.prototype.iuand=o(function(u){var p;this.length>u.length?p=u:p=this;for(var m=0;m<p.length;m++)this.words[m]=this.words[m]&u.words[m];return this.length=p.length,this.strip()},"iuand"),i.prototype.iand=o(function(u){return t((this.negative|u.negative)===0),this.iuand(u)},"iand"),i.prototype.and=o(function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},"and"),i.prototype.uand=o(function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},"uand"),i.prototype.iuxor=o(function(u){var p,m;this.length>u.length?(p=this,m=u):(p=u,m=this);for(var w=0;w<m.length;w++)this.words[w]=p.words[w]^m.words[w];if(this!==p)for(;w<p.length;w++)this.words[w]=p.words[w];return this.length=p.length,this.strip()},"iuxor"),i.prototype.ixor=o(function(u){return t((this.negative|u.negative)===0),this.iuxor(u)},"ixor"),i.prototype.xor=o(function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},"xor"),i.prototype.uxor=o(function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},"uxor"),i.prototype.inotn=o(function(u){t(typeof u=="number"&&u>=0);var p=Math.ceil(u/26)|0,m=u%26;this._expand(p),m>0&&p--;for(var w=0;w<p;w++)this.words[w]=~this.words[w]&67108863;return m>0&&(this.words[w]=~this.words[w]&67108863>>26-m),this.strip()},"inotn"),i.prototype.notn=o(function(u){return this.clone().inotn(u)},"notn"),i.prototype.setn=o(function(u,p){t(typeof u=="number"&&u>=0);var m=u/26|0,w=u%26;return this._expand(m+1),p?this.words[m]=this.words[m]|1<<w:this.words[m]=this.words[m]&~(1<<w),this.strip()},"setn"),i.prototype.iadd=o(function(u){var p;if(this.negative!==0&&u.negative===0)return this.negative=0,p=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,p=this.isub(u),u.negative=1,p._normSign();var m,w;this.length>u.length?(m=this,w=u):(m=u,w=this);for(var S=0,N=0;N<w.length;N++)p=(m.words[N]|0)+(w.words[N]|0)+S,this.words[N]=p&67108863,S=p>>>26;for(;S!==0&&N<m.length;N++)p=(m.words[N]|0)+S,this.words[N]=p&67108863,S=p>>>26;if(this.length=m.length,S!==0)this.words[this.length]=S,this.length++;else if(m!==this)for(;N<m.length;N++)this.words[N]=m.words[N];return this},"iadd"),i.prototype.add=o(function(u){var p;return u.negative!==0&&this.negative===0?(u.negative=0,p=this.sub(u),u.negative^=1,p):u.negative===0&&this.negative!==0?(this.negative=0,p=u.sub(this),this.negative=1,p):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},"add"),i.prototype.isub=o(function(u){if(u.negative!==0){u.negative=0;var p=this.iadd(u);return u.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var m=this.cmp(u);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,S;m>0?(w=this,S=u):(w=u,S=this);for(var N=0,I=0;I<S.length;I++)p=(w.words[I]|0)-(S.words[I]|0)+N,N=p>>26,this.words[I]=p&67108863;for(;N!==0&&I<w.length;I++)p=(w.words[I]|0)+N,N=p>>26,this.words[I]=p&67108863;if(N===0&&I<w.length&&w!==this)for(;I<w.length;I++)this.words[I]=w.words[I];return this.length=Math.max(this.length,I),w!==this&&(this.negative=1),this.strip()},"isub"),i.prototype.sub=o(function(u){return this.clone().isub(u)},"sub");function x(b,u,p){p.negative=u.negative^b.negative;var m=b.length+u.length|0;p.length=m,m=m-1|0;var w=b.words[0]|0,S=u.words[0]|0,N=w*S,I=N&67108863,k=N/67108864|0;p.words[0]=I;for(var g=1;g<m;g++){for(var C=k>>>26,Z=k&67108863,V=Math.min(g,u.length-1),K=Math.max(0,g-b.length+1);K<=V;K++){var fe=g-K|0;w=b.words[fe]|0,S=u.words[K]|0,N=w*S+Z,C+=N/67108864|0,Z=N&67108863}p.words[g]=Z|0,k=C|0}return k!==0?p.words[g]=k|0:p.length--,p.strip()}o(x,"smallMulTo");var y=o(function(u,p,m){var w=u.words,S=p.words,N=m.words,I=0,k,g,C,Z=w[0]|0,V=Z&8191,K=Z>>>13,fe=w[1]|0,A=fe&8191,X=fe>>>13,Q=w[2]|0,P=Q&8191,O=Q>>>13,z=w[3]|0,W=z&8191,re=z>>>13,le=w[4]|0,oe=le&8191,J=le>>>13,pe=w[5]|0,ee=pe&8191,ce=pe>>>13,$=w[6]|0,ie=$&8191,be=$>>>13,ke=w[7]|0,Ie=ke&8191,Xe=ke>>>13,dn=w[8]|0,te=dn&8191,G=dn>>>13,T=w[9]|0,q=T&8191,se=T>>>13,ae=S[0]|0,he=ae&8191,ge=ae>>>13,rt=S[1]|0,Pe=rt&8191,Ee=rt>>>13,nt=S[2]|0,Ge=nt&8191,it=nt>>>13,So=S[3]|0,dt=So&8191,pt=So>>>13,Co=S[4]|0,mt=Co&8191,bt=Co>>>13,ko=S[5]|0,gt=ko&8191,yt=ko>>>13,To=S[6]|0,vt=To&8191,wt=To>>>13,Mo=S[7]|0,xt=Mo&8191,_t=Mo>>>13,Bo=S[8]|0,At=Bo&8191,Et=Bo>>>13,Io=S[9]|0,St=Io&8191,Ct=Io>>>13;m.negative=u.negative^p.negative,m.length=19,k=Math.imul(V,he),g=Math.imul(V,ge),g=g+Math.imul(K,he)|0,C=Math.imul(K,ge);var xs=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(xs>>>26)|0,xs&=67108863,k=Math.imul(A,he),g=Math.imul(A,ge),g=g+Math.imul(X,he)|0,C=Math.imul(X,ge),k=k+Math.imul(V,Pe)|0,g=g+Math.imul(V,Ee)|0,g=g+Math.imul(K,Pe)|0,C=C+Math.imul(K,Ee)|0;var _s=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(_s>>>26)|0,_s&=67108863,k=Math.imul(P,he),g=Math.imul(P,ge),g=g+Math.imul(O,he)|0,C=Math.imul(O,ge),k=k+Math.imul(A,Pe)|0,g=g+Math.imul(A,Ee)|0,g=g+Math.imul(X,Pe)|0,C=C+Math.imul(X,Ee)|0,k=k+Math.imul(V,Ge)|0,g=g+Math.imul(V,it)|0,g=g+Math.imul(K,Ge)|0,C=C+Math.imul(K,it)|0;var As=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(As>>>26)|0,As&=67108863,k=Math.imul(W,he),g=Math.imul(W,ge),g=g+Math.imul(re,he)|0,C=Math.imul(re,ge),k=k+Math.imul(P,Pe)|0,g=g+Math.imul(P,Ee)|0,g=g+Math.imul(O,Pe)|0,C=C+Math.imul(O,Ee)|0,k=k+Math.imul(A,Ge)|0,g=g+Math.imul(A,it)|0,g=g+Math.imul(X,Ge)|0,C=C+Math.imul(X,it)|0,k=k+Math.imul(V,dt)|0,g=g+Math.imul(V,pt)|0,g=g+Math.imul(K,dt)|0,C=C+Math.imul(K,pt)|0;var Es=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Es>>>26)|0,Es&=67108863,k=Math.imul(oe,he),g=Math.imul(oe,ge),g=g+Math.imul(J,he)|0,C=Math.imul(J,ge),k=k+Math.imul(W,Pe)|0,g=g+Math.imul(W,Ee)|0,g=g+Math.imul(re,Pe)|0,C=C+Math.imul(re,Ee)|0,k=k+Math.imul(P,Ge)|0,g=g+Math.imul(P,it)|0,g=g+Math.imul(O,Ge)|0,C=C+Math.imul(O,it)|0,k=k+Math.imul(A,dt)|0,g=g+Math.imul(A,pt)|0,g=g+Math.imul(X,dt)|0,C=C+Math.imul(X,pt)|0,k=k+Math.imul(V,mt)|0,g=g+Math.imul(V,bt)|0,g=g+Math.imul(K,mt)|0,C=C+Math.imul(K,bt)|0;var Ss=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,k=Math.imul(ee,he),g=Math.imul(ee,ge),g=g+Math.imul(ce,he)|0,C=Math.imul(ce,ge),k=k+Math.imul(oe,Pe)|0,g=g+Math.imul(oe,Ee)|0,g=g+Math.imul(J,Pe)|0,C=C+Math.imul(J,Ee)|0,k=k+Math.imul(W,Ge)|0,g=g+Math.imul(W,it)|0,g=g+Math.imul(re,Ge)|0,C=C+Math.imul(re,it)|0,k=k+Math.imul(P,dt)|0,g=g+Math.imul(P,pt)|0,g=g+Math.imul(O,dt)|0,C=C+Math.imul(O,pt)|0,k=k+Math.imul(A,mt)|0,g=g+Math.imul(A,bt)|0,g=g+Math.imul(X,mt)|0,C=C+Math.imul(X,bt)|0,k=k+Math.imul(V,gt)|0,g=g+Math.imul(V,yt)|0,g=g+Math.imul(K,gt)|0,C=C+Math.imul(K,yt)|0;var Cs=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,k=Math.imul(ie,he),g=Math.imul(ie,ge),g=g+Math.imul(be,he)|0,C=Math.imul(be,ge),k=k+Math.imul(ee,Pe)|0,g=g+Math.imul(ee,Ee)|0,g=g+Math.imul(ce,Pe)|0,C=C+Math.imul(ce,Ee)|0,k=k+Math.imul(oe,Ge)|0,g=g+Math.imul(oe,it)|0,g=g+Math.imul(J,Ge)|0,C=C+Math.imul(J,it)|0,k=k+Math.imul(W,dt)|0,g=g+Math.imul(W,pt)|0,g=g+Math.imul(re,dt)|0,C=C+Math.imul(re,pt)|0,k=k+Math.imul(P,mt)|0,g=g+Math.imul(P,bt)|0,g=g+Math.imul(O,mt)|0,C=C+Math.imul(O,bt)|0,k=k+Math.imul(A,gt)|0,g=g+Math.imul(A,yt)|0,g=g+Math.imul(X,gt)|0,C=C+Math.imul(X,yt)|0,k=k+Math.imul(V,vt)|0,g=g+Math.imul(V,wt)|0,g=g+Math.imul(K,vt)|0,C=C+Math.imul(K,wt)|0;var ks=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(ks>>>26)|0,ks&=67108863,k=Math.imul(Ie,he),g=Math.imul(Ie,ge),g=g+Math.imul(Xe,he)|0,C=Math.imul(Xe,ge),k=k+Math.imul(ie,Pe)|0,g=g+Math.imul(ie,Ee)|0,g=g+Math.imul(be,Pe)|0,C=C+Math.imul(be,Ee)|0,k=k+Math.imul(ee,Ge)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(ce,Ge)|0,C=C+Math.imul(ce,it)|0,k=k+Math.imul(oe,dt)|0,g=g+Math.imul(oe,pt)|0,g=g+Math.imul(J,dt)|0,C=C+Math.imul(J,pt)|0,k=k+Math.imul(W,mt)|0,g=g+Math.imul(W,bt)|0,g=g+Math.imul(re,mt)|0,C=C+Math.imul(re,bt)|0,k=k+Math.imul(P,gt)|0,g=g+Math.imul(P,yt)|0,g=g+Math.imul(O,gt)|0,C=C+Math.imul(O,yt)|0,k=k+Math.imul(A,vt)|0,g=g+Math.imul(A,wt)|0,g=g+Math.imul(X,vt)|0,C=C+Math.imul(X,wt)|0,k=k+Math.imul(V,xt)|0,g=g+Math.imul(V,_t)|0,g=g+Math.imul(K,xt)|0,C=C+Math.imul(K,_t)|0;var Ts=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Ts>>>26)|0,Ts&=67108863,k=Math.imul(te,he),g=Math.imul(te,ge),g=g+Math.imul(G,he)|0,C=Math.imul(G,ge),k=k+Math.imul(Ie,Pe)|0,g=g+Math.imul(Ie,Ee)|0,g=g+Math.imul(Xe,Pe)|0,C=C+Math.imul(Xe,Ee)|0,k=k+Math.imul(ie,Ge)|0,g=g+Math.imul(ie,it)|0,g=g+Math.imul(be,Ge)|0,C=C+Math.imul(be,it)|0,k=k+Math.imul(ee,dt)|0,g=g+Math.imul(ee,pt)|0,g=g+Math.imul(ce,dt)|0,C=C+Math.imul(ce,pt)|0,k=k+Math.imul(oe,mt)|0,g=g+Math.imul(oe,bt)|0,g=g+Math.imul(J,mt)|0,C=C+Math.imul(J,bt)|0,k=k+Math.imul(W,gt)|0,g=g+Math.imul(W,yt)|0,g=g+Math.imul(re,gt)|0,C=C+Math.imul(re,yt)|0,k=k+Math.imul(P,vt)|0,g=g+Math.imul(P,wt)|0,g=g+Math.imul(O,vt)|0,C=C+Math.imul(O,wt)|0,k=k+Math.imul(A,xt)|0,g=g+Math.imul(A,_t)|0,g=g+Math.imul(X,xt)|0,C=C+Math.imul(X,_t)|0,k=k+Math.imul(V,At)|0,g=g+Math.imul(V,Et)|0,g=g+Math.imul(K,At)|0,C=C+Math.imul(K,Et)|0;var Qp=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Qp>>>26)|0,Qp&=67108863,k=Math.imul(q,he),g=Math.imul(q,ge),g=g+Math.imul(se,he)|0,C=Math.imul(se,ge),k=k+Math.imul(te,Pe)|0,g=g+Math.imul(te,Ee)|0,g=g+Math.imul(G,Pe)|0,C=C+Math.imul(G,Ee)|0,k=k+Math.imul(Ie,Ge)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Xe,Ge)|0,C=C+Math.imul(Xe,it)|0,k=k+Math.imul(ie,dt)|0,g=g+Math.imul(ie,pt)|0,g=g+Math.imul(be,dt)|0,C=C+Math.imul(be,pt)|0,k=k+Math.imul(ee,mt)|0,g=g+Math.imul(ee,bt)|0,g=g+Math.imul(ce,mt)|0,C=C+Math.imul(ce,bt)|0,k=k+Math.imul(oe,gt)|0,g=g+Math.imul(oe,yt)|0,g=g+Math.imul(J,gt)|0,C=C+Math.imul(J,yt)|0,k=k+Math.imul(W,vt)|0,g=g+Math.imul(W,wt)|0,g=g+Math.imul(re,vt)|0,C=C+Math.imul(re,wt)|0,k=k+Math.imul(P,xt)|0,g=g+Math.imul(P,_t)|0,g=g+Math.imul(O,xt)|0,C=C+Math.imul(O,_t)|0,k=k+Math.imul(A,At)|0,g=g+Math.imul(A,Et)|0,g=g+Math.imul(X,At)|0,C=C+Math.imul(X,Et)|0,k=k+Math.imul(V,St)|0,g=g+Math.imul(V,Ct)|0,g=g+Math.imul(K,St)|0,C=C+Math.imul(K,Ct)|0;var e0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(e0>>>26)|0,e0&=67108863,k=Math.imul(q,Pe),g=Math.imul(q,Ee),g=g+Math.imul(se,Pe)|0,C=Math.imul(se,Ee),k=k+Math.imul(te,Ge)|0,g=g+Math.imul(te,it)|0,g=g+Math.imul(G,Ge)|0,C=C+Math.imul(G,it)|0,k=k+Math.imul(Ie,dt)|0,g=g+Math.imul(Ie,pt)|0,g=g+Math.imul(Xe,dt)|0,C=C+Math.imul(Xe,pt)|0,k=k+Math.imul(ie,mt)|0,g=g+Math.imul(ie,bt)|0,g=g+Math.imul(be,mt)|0,C=C+Math.imul(be,bt)|0,k=k+Math.imul(ee,gt)|0,g=g+Math.imul(ee,yt)|0,g=g+Math.imul(ce,gt)|0,C=C+Math.imul(ce,yt)|0,k=k+Math.imul(oe,vt)|0,g=g+Math.imul(oe,wt)|0,g=g+Math.imul(J,vt)|0,C=C+Math.imul(J,wt)|0,k=k+Math.imul(W,xt)|0,g=g+Math.imul(W,_t)|0,g=g+Math.imul(re,xt)|0,C=C+Math.imul(re,_t)|0,k=k+Math.imul(P,At)|0,g=g+Math.imul(P,Et)|0,g=g+Math.imul(O,At)|0,C=C+Math.imul(O,Et)|0,k=k+Math.imul(A,St)|0,g=g+Math.imul(A,Ct)|0,g=g+Math.imul(X,St)|0,C=C+Math.imul(X,Ct)|0;var t0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(t0>>>26)|0,t0&=67108863,k=Math.imul(q,Ge),g=Math.imul(q,it),g=g+Math.imul(se,Ge)|0,C=Math.imul(se,it),k=k+Math.imul(te,dt)|0,g=g+Math.imul(te,pt)|0,g=g+Math.imul(G,dt)|0,C=C+Math.imul(G,pt)|0,k=k+Math.imul(Ie,mt)|0,g=g+Math.imul(Ie,bt)|0,g=g+Math.imul(Xe,mt)|0,C=C+Math.imul(Xe,bt)|0,k=k+Math.imul(ie,gt)|0,g=g+Math.imul(ie,yt)|0,g=g+Math.imul(be,gt)|0,C=C+Math.imul(be,yt)|0,k=k+Math.imul(ee,vt)|0,g=g+Math.imul(ee,wt)|0,g=g+Math.imul(ce,vt)|0,C=C+Math.imul(ce,wt)|0,k=k+Math.imul(oe,xt)|0,g=g+Math.imul(oe,_t)|0,g=g+Math.imul(J,xt)|0,C=C+Math.imul(J,_t)|0,k=k+Math.imul(W,At)|0,g=g+Math.imul(W,Et)|0,g=g+Math.imul(re,At)|0,C=C+Math.imul(re,Et)|0,k=k+Math.imul(P,St)|0,g=g+Math.imul(P,Ct)|0,g=g+Math.imul(O,St)|0,C=C+Math.imul(O,Ct)|0;var r0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(r0>>>26)|0,r0&=67108863,k=Math.imul(q,dt),g=Math.imul(q,pt),g=g+Math.imul(se,dt)|0,C=Math.imul(se,pt),k=k+Math.imul(te,mt)|0,g=g+Math.imul(te,bt)|0,g=g+Math.imul(G,mt)|0,C=C+Math.imul(G,bt)|0,k=k+Math.imul(Ie,gt)|0,g=g+Math.imul(Ie,yt)|0,g=g+Math.imul(Xe,gt)|0,C=C+Math.imul(Xe,yt)|0,k=k+Math.imul(ie,vt)|0,g=g+Math.imul(ie,wt)|0,g=g+Math.imul(be,vt)|0,C=C+Math.imul(be,wt)|0,k=k+Math.imul(ee,xt)|0,g=g+Math.imul(ee,_t)|0,g=g+Math.imul(ce,xt)|0,C=C+Math.imul(ce,_t)|0,k=k+Math.imul(oe,At)|0,g=g+Math.imul(oe,Et)|0,g=g+Math.imul(J,At)|0,C=C+Math.imul(J,Et)|0,k=k+Math.imul(W,St)|0,g=g+Math.imul(W,Ct)|0,g=g+Math.imul(re,St)|0,C=C+Math.imul(re,Ct)|0;var n0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(n0>>>26)|0,n0&=67108863,k=Math.imul(q,mt),g=Math.imul(q,bt),g=g+Math.imul(se,mt)|0,C=Math.imul(se,bt),k=k+Math.imul(te,gt)|0,g=g+Math.imul(te,yt)|0,g=g+Math.imul(G,gt)|0,C=C+Math.imul(G,yt)|0,k=k+Math.imul(Ie,vt)|0,g=g+Math.imul(Ie,wt)|0,g=g+Math.imul(Xe,vt)|0,C=C+Math.imul(Xe,wt)|0,k=k+Math.imul(ie,xt)|0,g=g+Math.imul(ie,_t)|0,g=g+Math.imul(be,xt)|0,C=C+Math.imul(be,_t)|0,k=k+Math.imul(ee,At)|0,g=g+Math.imul(ee,Et)|0,g=g+Math.imul(ce,At)|0,C=C+Math.imul(ce,Et)|0,k=k+Math.imul(oe,St)|0,g=g+Math.imul(oe,Ct)|0,g=g+Math.imul(J,St)|0,C=C+Math.imul(J,Ct)|0;var i0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(i0>>>26)|0,i0&=67108863,k=Math.imul(q,gt),g=Math.imul(q,yt),g=g+Math.imul(se,gt)|0,C=Math.imul(se,yt),k=k+Math.imul(te,vt)|0,g=g+Math.imul(te,wt)|0,g=g+Math.imul(G,vt)|0,C=C+Math.imul(G,wt)|0,k=k+Math.imul(Ie,xt)|0,g=g+Math.imul(Ie,_t)|0,g=g+Math.imul(Xe,xt)|0,C=C+Math.imul(Xe,_t)|0,k=k+Math.imul(ie,At)|0,g=g+Math.imul(ie,Et)|0,g=g+Math.imul(be,At)|0,C=C+Math.imul(be,Et)|0,k=k+Math.imul(ee,St)|0,g=g+Math.imul(ee,Ct)|0,g=g+Math.imul(ce,St)|0,C=C+Math.imul(ce,Ct)|0;var s0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(s0>>>26)|0,s0&=67108863,k=Math.imul(q,vt),g=Math.imul(q,wt),g=g+Math.imul(se,vt)|0,C=Math.imul(se,wt),k=k+Math.imul(te,xt)|0,g=g+Math.imul(te,_t)|0,g=g+Math.imul(G,xt)|0,C=C+Math.imul(G,_t)|0,k=k+Math.imul(Ie,At)|0,g=g+Math.imul(Ie,Et)|0,g=g+Math.imul(Xe,At)|0,C=C+Math.imul(Xe,Et)|0,k=k+Math.imul(ie,St)|0,g=g+Math.imul(ie,Ct)|0,g=g+Math.imul(be,St)|0,C=C+Math.imul(be,Ct)|0;var o0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(o0>>>26)|0,o0&=67108863,k=Math.imul(q,xt),g=Math.imul(q,_t),g=g+Math.imul(se,xt)|0,C=Math.imul(se,_t),k=k+Math.imul(te,At)|0,g=g+Math.imul(te,Et)|0,g=g+Math.imul(G,At)|0,C=C+Math.imul(G,Et)|0,k=k+Math.imul(Ie,St)|0,g=g+Math.imul(Ie,Ct)|0,g=g+Math.imul(Xe,St)|0,C=C+Math.imul(Xe,Ct)|0;var a0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(a0>>>26)|0,a0&=67108863,k=Math.imul(q,At),g=Math.imul(q,Et),g=g+Math.imul(se,At)|0,C=Math.imul(se,Et),k=k+Math.imul(te,St)|0,g=g+Math.imul(te,Ct)|0,g=g+Math.imul(G,St)|0,C=C+Math.imul(G,Ct)|0;var c0=(I+k|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(c0>>>26)|0,c0&=67108863,k=Math.imul(q,St),g=Math.imul(q,Ct),g=g+Math.imul(se,St)|0,C=Math.imul(se,Ct);var f0=(I+k|0)+((g&8191)<<13)|0;return I=(C+(g>>>13)|0)+(f0>>>26)|0,f0&=67108863,N[0]=xs,N[1]=_s,N[2]=As,N[3]=Es,N[4]=Ss,N[5]=Cs,N[6]=ks,N[7]=Ts,N[8]=Qp,N[9]=e0,N[10]=t0,N[11]=r0,N[12]=n0,N[13]=i0,N[14]=s0,N[15]=o0,N[16]=a0,N[17]=c0,N[18]=f0,I!==0&&(N[19]=I,m.length++),m},"comb10MulTo");Math.imul||(y=x);function _(b,u,p){p.negative=u.negative^b.negative,p.length=b.length+u.length;for(var m=0,w=0,S=0;S<p.length-1;S++){var N=w;w=0;for(var I=m&67108863,k=Math.min(S,u.length-1),g=Math.max(0,S-b.length+1);g<=k;g++){var C=S-g,Z=b.words[C]|0,V=u.words[g]|0,K=Z*V,fe=K&67108863;N=N+(K/67108864|0)|0,fe=fe+I|0,I=fe&67108863,N=N+(fe>>>26)|0,w+=N>>>26,N&=67108863}p.words[S]=I,m=N,N=w}return m!==0?p.words[S]=m:p.length--,p.strip()}o(_,"bigMulTo");function U(b,u,p){var m=new E;return m.mulp(b,u,p)}o(U,"jumboMulTo"),i.prototype.mulTo=o(function(u,p){var m,w=this.length+u.length;return this.length===10&&u.length===10?m=y(this,u,p):w<63?m=x(this,u,p):w<1024?m=_(this,u,p):m=U(this,u,p),m},"mulTo");function E(b,u){this.x=b,this.y=u}o(E,"FFTM"),E.prototype.makeRBT=o(function(u){for(var p=new Array(u),m=i.prototype._countBits(u)-1,w=0;w<u;w++)p[w]=this.revBin(w,m,u);return p},"makeRBT"),E.prototype.revBin=o(function(u,p,m){if(u===0||u===m-1)return u;for(var w=0,S=0;S<p;S++)w|=(u&1)<<p-S-1,u>>=1;return w},"revBin"),E.prototype.permute=o(function(u,p,m,w,S,N){for(var I=0;I<N;I++)w[I]=p[u[I]],S[I]=m[u[I]]},"permute"),E.prototype.transform=o(function(u,p,m,w,S,N){this.permute(N,u,p,m,w,S);for(var I=1;I<S;I<<=1)for(var k=I<<1,g=Math.cos(2*Math.PI/k),C=Math.sin(2*Math.PI/k),Z=0;Z<S;Z+=k)for(var V=g,K=C,fe=0;fe<I;fe++){var A=m[Z+fe],X=w[Z+fe],Q=m[Z+fe+I],P=w[Z+fe+I],O=V*Q-K*P;P=V*P+K*Q,Q=O,m[Z+fe]=A+Q,w[Z+fe]=X+P,m[Z+fe+I]=A-Q,w[Z+fe+I]=X-P,fe!==k&&(O=g*V-C*K,K=g*K+C*V,V=O)}},"transform"),E.prototype.guessLen13b=o(function(u,p){var m=Math.max(p,u)|1,w=m&1,S=0;for(m=m/2|0;m;m=m>>>1)S++;return 1<<S+1+w},"guessLen13b"),E.prototype.conjugate=o(function(u,p,m){if(!(m<=1))for(var w=0;w<m/2;w++){var S=u[w];u[w]=u[m-w-1],u[m-w-1]=S,S=p[w],p[w]=-p[m-w-1],p[m-w-1]=-S}},"conjugate"),E.prototype.normalize13b=o(function(u,p){for(var m=0,w=0;w<p/2;w++){var S=Math.round(u[2*w+1]/p)*8192+Math.round(u[2*w]/p)+m;u[w]=S&67108863,S<67108864?m=0:m=S/67108864|0}return u},"normalize13b"),E.prototype.convert13b=o(function(u,p,m,w){for(var S=0,N=0;N<p;N++)S=S+(u[N]|0),m[2*N]=S&8191,S=S>>>13,m[2*N+1]=S&8191,S=S>>>13;for(N=2*p;N<w;++N)m[N]=0;t(S===0),t((S&-8192)===0)},"convert13b"),E.prototype.stub=o(function(u){for(var p=new Array(u),m=0;m<u;m++)p[m]=0;return p},"stub"),E.prototype.mulp=o(function(u,p,m){var w=2*this.guessLen13b(u.length,p.length),S=this.makeRBT(w),N=this.stub(w),I=new Array(w),k=new Array(w),g=new Array(w),C=new Array(w),Z=new Array(w),V=new Array(w),K=m.words;K.length=w,this.convert13b(u.words,u.length,I,w),this.convert13b(p.words,p.length,C,w),this.transform(I,N,k,g,w,S),this.transform(C,N,Z,V,w,S);for(var fe=0;fe<w;fe++){var A=k[fe]*Z[fe]-g[fe]*V[fe];g[fe]=k[fe]*V[fe]+g[fe]*Z[fe],k[fe]=A}return this.conjugate(k,g,w),this.transform(k,g,K,N,w,S),this.conjugate(K,N,w),this.normalize13b(K,w),m.negative=u.negative^p.negative,m.length=u.length+p.length,m.strip()},"mulp"),i.prototype.mul=o(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),this.mulTo(u,p)},"mul"),i.prototype.mulf=o(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),U(this,u,p)},"mulf"),i.prototype.imul=o(function(u){return this.clone().mulTo(u,this)},"imul"),i.prototype.imuln=o(function(u){t(typeof u=="number"),t(u<67108864);for(var p=0,m=0;m<this.length;m++){var w=(this.words[m]|0)*u,S=(w&67108863)+(p&67108863);p>>=26,p+=w/67108864|0,p+=S>>>26,this.words[m]=S&67108863}return p!==0&&(this.words[m]=p,this.length++),this},"imuln"),i.prototype.muln=o(function(u){return this.clone().imuln(u)},"muln"),i.prototype.sqr=o(function(){return this.mul(this)},"sqr"),i.prototype.isqr=o(function(){return this.imul(this.clone())},"isqr"),i.prototype.pow=o(function(u){var p=v(u);if(p.length===0)return new i(1);for(var m=this,w=0;w<p.length&&p[w]===0;w++,m=m.sqr());if(++w<p.length)for(var S=m.sqr();w<p.length;w++,S=S.sqr())p[w]!==0&&(m=m.mul(S));return m},"pow"),i.prototype.iushln=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=67108863>>>26-p<<26-p,S;if(p!==0){var N=0;for(S=0;S<this.length;S++){var I=this.words[S]&w,k=(this.words[S]|0)-I<<p;this.words[S]=k|N,N=I>>>26-p}N&&(this.words[S]=N,this.length++)}if(m!==0){for(S=this.length-1;S>=0;S--)this.words[S+m]=this.words[S];for(S=0;S<m;S++)this.words[S]=0;this.length+=m}return this.strip()},"iushln"),i.prototype.ishln=o(function(u){return t(this.negative===0),this.iushln(u)},"ishln"),i.prototype.iushrn=o(function(u,p,m){t(typeof u=="number"&&u>=0);var w;p?w=(p-p%26)/26:w=0;var S=u%26,N=Math.min((u-S)/26,this.length),I=67108863^67108863>>>S<<S,k=m;if(w-=N,w=Math.max(0,w),k){for(var g=0;g<N;g++)k.words[g]=this.words[g];k.length=N}if(N!==0)if(this.length>N)for(this.length-=N,g=0;g<this.length;g++)this.words[g]=this.words[g+N];else this.words[0]=0,this.length=1;var C=0;for(g=this.length-1;g>=0&&(C!==0||g>=w);g--){var Z=this.words[g]|0;this.words[g]=C<<26-S|Z>>>S,C=Z&I}return k&&C!==0&&(k.words[k.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},"iushrn"),i.prototype.ishrn=o(function(u,p,m){return t(this.negative===0),this.iushrn(u,p,m)},"ishrn"),i.prototype.shln=o(function(u){return this.clone().ishln(u)},"shln"),i.prototype.ushln=o(function(u){return this.clone().iushln(u)},"ushln"),i.prototype.shrn=o(function(u){return this.clone().ishrn(u)},"shrn"),i.prototype.ushrn=o(function(u){return this.clone().iushrn(u)},"ushrn"),i.prototype.testn=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return!1;var S=this.words[m];return!!(S&w)},"testn"),i.prototype.imaskn=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(p!==0&&m++,this.length=Math.min(m,this.length),p!==0){var w=67108863^67108863>>>p<<p;this.words[this.length-1]&=w}return this.strip()},"imaskn"),i.prototype.maskn=o(function(u){return this.clone().imaskn(u)},"maskn"),i.prototype.iaddn=o(function(u){return t(typeof u=="number"),t(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},"iaddn"),i.prototype._iaddn=o(function(u){this.words[0]+=u;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},"_iaddn"),i.prototype.isubn=o(function(u){if(t(typeof u=="number"),t(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this.strip()},"isubn"),i.prototype.addn=o(function(u){return this.clone().iaddn(u)},"addn"),i.prototype.subn=o(function(u){return this.clone().isubn(u)},"subn"),i.prototype.iabs=o(function(){return this.negative=0,this},"iabs"),i.prototype.abs=o(function(){return this.clone().iabs()},"abs"),i.prototype._ishlnsubmul=o(function(u,p,m){var w=u.length+m,S;this._expand(w);var N,I=0;for(S=0;S<u.length;S++){N=(this.words[S+m]|0)+I;var k=(u.words[S]|0)*p;N-=k&67108863,I=(N>>26)-(k/67108864|0),this.words[S+m]=N&67108863}for(;S<this.length-m;S++)N=(this.words[S+m]|0)+I,I=N>>26,this.words[S+m]=N&67108863;if(I===0)return this.strip();for(t(I===-1),I=0,S=0;S<this.length;S++)N=-(this.words[S]|0)+I,I=N>>26,this.words[S]=N&67108863;return this.negative=1,this.strip()},"_ishlnsubmul"),i.prototype._wordDiv=o(function(u,p){var m=this.length-u.length,w=this.clone(),S=u,N=S.words[S.length-1]|0,I=this._countBits(N);m=26-I,m!==0&&(S=S.ushln(m),w.iushln(m),N=S.words[S.length-1]|0);var k=w.length-S.length,g;if(p!=="mod"){g=new i(null),g.length=k+1,g.words=new Array(g.length);for(var C=0;C<g.length;C++)g.words[C]=0}var Z=w.clone()._ishlnsubmul(S,1,k);Z.negative===0&&(w=Z,g&&(g.words[k]=1));for(var V=k-1;V>=0;V--){var K=(w.words[S.length+V]|0)*67108864+(w.words[S.length+V-1]|0);for(K=Math.min(K/N|0,67108863),w._ishlnsubmul(S,K,V);w.negative!==0;)K--,w.negative=0,w._ishlnsubmul(S,1,V),w.isZero()||(w.negative^=1);g&&(g.words[V]=K)}return g&&g.strip(),w.strip(),p!=="div"&&m!==0&&w.iushrn(m),{div:g||null,mod:w}},"_wordDiv"),i.prototype.divmod=o(function(u,p,m){if(t(!u.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var w,S,N;return this.negative!==0&&u.negative===0?(N=this.neg().divmod(u,p),p!=="mod"&&(w=N.div.neg()),p!=="div"&&(S=N.mod.neg(),m&&S.negative!==0&&S.iadd(u)),{div:w,mod:S}):this.negative===0&&u.negative!==0?(N=this.divmod(u.neg(),p),p!=="mod"&&(w=N.div.neg()),{div:w,mod:N.mod}):(this.negative&u.negative)!==0?(N=this.neg().divmod(u.neg(),p),p!=="div"&&(S=N.mod.neg(),m&&S.negative!==0&&S.isub(u)),{div:N.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new i(0),mod:this}:u.length===1?p==="div"?{div:this.divn(u.words[0]),mod:null}:p==="mod"?{div:null,mod:new i(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new i(this.modn(u.words[0]))}:this._wordDiv(u,p)},"divmod"),i.prototype.div=o(function(u){return this.divmod(u,"div",!1).div},"div"),i.prototype.mod=o(function(u){return this.divmod(u,"mod",!1).mod},"mod"),i.prototype.umod=o(function(u){return this.divmod(u,"mod",!0).mod},"umod"),i.prototype.divRound=o(function(u){var p=this.divmod(u);if(p.mod.isZero())return p.div;var m=p.div.negative!==0?p.mod.isub(u):p.mod,w=u.ushrn(1),S=u.andln(1),N=m.cmp(w);return N<0||S===1&&N===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},"divRound"),i.prototype.modn=o(function(u){t(u<=67108863);for(var p=(1<<26)%u,m=0,w=this.length-1;w>=0;w--)m=(p*m+(this.words[w]|0))%u;return m},"modn"),i.prototype.idivn=o(function(u){t(u<=67108863);for(var p=0,m=this.length-1;m>=0;m--){var w=(this.words[m]|0)+p*67108864;this.words[m]=w/u|0,p=w%u}return this.strip()},"idivn"),i.prototype.divn=o(function(u){return this.clone().idivn(u)},"divn"),i.prototype.egcd=o(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),N=new i(0),I=new i(1),k=0;p.isEven()&&m.isEven();)p.iushrn(1),m.iushrn(1),++k;for(var g=m.clone(),C=p.clone();!p.isZero();){for(var Z=0,V=1;(p.words[0]&V)===0&&Z<26;++Z,V<<=1);if(Z>0)for(p.iushrn(Z);Z-- >0;)(w.isOdd()||S.isOdd())&&(w.iadd(g),S.isub(C)),w.iushrn(1),S.iushrn(1);for(var K=0,fe=1;(m.words[0]&fe)===0&&K<26;++K,fe<<=1);if(K>0)for(m.iushrn(K);K-- >0;)(N.isOdd()||I.isOdd())&&(N.iadd(g),I.isub(C)),N.iushrn(1),I.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(N),S.isub(I)):(m.isub(p),N.isub(w),I.isub(S))}return{a:N,b:I,gcd:m.iushln(k)}},"egcd"),i.prototype._invmp=o(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),N=m.clone();p.cmpn(1)>0&&m.cmpn(1)>0;){for(var I=0,k=1;(p.words[0]&k)===0&&I<26;++I,k<<=1);if(I>0)for(p.iushrn(I);I-- >0;)w.isOdd()&&w.iadd(N),w.iushrn(1);for(var g=0,C=1;(m.words[0]&C)===0&&g<26;++g,C<<=1);if(g>0)for(m.iushrn(g);g-- >0;)S.isOdd()&&S.iadd(N),S.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(S)):(m.isub(p),S.isub(w))}var Z;return p.cmpn(1)===0?Z=w:Z=S,Z.cmpn(0)<0&&Z.iadd(u),Z},"_invmp"),i.prototype.gcd=o(function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var p=this.clone(),m=u.clone();p.negative=0,m.negative=0;for(var w=0;p.isEven()&&m.isEven();w++)p.iushrn(1),m.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;m.isEven();)m.iushrn(1);var S=p.cmp(m);if(S<0){var N=p;p=m,m=N}else if(S===0||m.cmpn(1)===0)break;p.isub(m)}while(!0);return m.iushln(w)},"gcd"),i.prototype.invm=o(function(u){return this.egcd(u).a.umod(u)},"invm"),i.prototype.isEven=o(function(){return(this.words[0]&1)===0},"isEven"),i.prototype.isOdd=o(function(){return(this.words[0]&1)===1},"isOdd"),i.prototype.andln=o(function(u){return this.words[0]&u},"andln"),i.prototype.bincn=o(function(u){t(typeof u=="number");var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return this._expand(m+1),this.words[m]|=w,this;for(var S=w,N=m;S!==0&&N<this.length;N++){var I=this.words[N]|0;I+=S,S=I>>>26,I&=67108863,this.words[N]=I}return S!==0&&(this.words[N]=S,this.length++),this},"bincn"),i.prototype.isZero=o(function(){return this.length===1&&this.words[0]===0},"isZero"),i.prototype.cmpn=o(function(u){var p=u<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this.strip();var m;if(this.length>1)m=1;else{p&&(u=-u),t(u<=67108863,"Number is too big");var w=this.words[0]|0;m=w===u?0:w<u?-1:1}return this.negative!==0?-m|0:m},"cmpn"),i.prototype.cmp=o(function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var p=this.ucmp(u);return this.negative!==0?-p|0:p},"cmp"),i.prototype.ucmp=o(function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var p=0,m=this.length-1;m>=0;m--){var w=this.words[m]|0,S=u.words[m]|0;if(w!==S){w<S?p=-1:w>S&&(p=1);break}}return p},"ucmp"),i.prototype.gtn=o(function(u){return this.cmpn(u)===1},"gtn"),i.prototype.gt=o(function(u){return this.cmp(u)===1},"gt"),i.prototype.gten=o(function(u){return this.cmpn(u)>=0},"gten"),i.prototype.gte=o(function(u){return this.cmp(u)>=0},"gte"),i.prototype.ltn=o(function(u){return this.cmpn(u)===-1},"ltn"),i.prototype.lt=o(function(u){return this.cmp(u)===-1},"lt"),i.prototype.lten=o(function(u){return this.cmpn(u)<=0},"lten"),i.prototype.lte=o(function(u){return this.cmp(u)<=0},"lte"),i.prototype.eqn=o(function(u){return this.cmpn(u)===0},"eqn"),i.prototype.eq=o(function(u){return this.cmp(u)===0},"eq"),i.red=o(function(u){return new R(u)},"red"),i.prototype.toRed=o(function(u){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},"toRed"),i.prototype.fromRed=o(function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),i.prototype._forceRed=o(function(u){return this.red=u,this},"_forceRed"),i.prototype.forceRed=o(function(u){return t(!this.red,"Already a number in reduction context"),this._forceRed(u)},"forceRed"),i.prototype.redAdd=o(function(u){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},"redAdd"),i.prototype.redIAdd=o(function(u){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},"redIAdd"),i.prototype.redSub=o(function(u){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},"redSub"),i.prototype.redISub=o(function(u){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},"redISub"),i.prototype.redShl=o(function(u){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},"redShl"),i.prototype.redMul=o(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},"redMul"),i.prototype.redIMul=o(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},"redIMul"),i.prototype.redSqr=o(function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),i.prototype.redISqr=o(function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),i.prototype.redSqrt=o(function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),i.prototype.redInvm=o(function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),i.prototype.redNeg=o(function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),i.prototype.redPow=o(function(u){return t(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)},"redPow");var L={k256:null,p224:null,p192:null,p25519:null};function H(b,u){this.name=b,this.p=new i(u,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(H,"MPrime"),H.prototype._tmp=o(function(){var u=new i(null);return u.words=new Array(Math.ceil(this.n/13)),u},"_tmp"),H.prototype.ireduce=o(function(u){var p=u,m;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),m=p.bitLength();while(m>this.n);var w=m<this.n?-1:p.ucmp(this.p);return w===0?(p.words[0]=0,p.length=1):w>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},"ireduce"),H.prototype.split=o(function(u,p){u.iushrn(this.n,0,p)},"split"),H.prototype.imulK=o(function(u){return u.imul(this.k)},"imulK");function F(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(F,"K256"),n(F,H),F.prototype.split=o(function(u,p){for(var m=4194303,w=Math.min(u.length,9),S=0;S<w;S++)p.words[S]=u.words[S];if(p.length=w,u.length<=9){u.words[0]=0,u.length=1;return}var N=u.words[9];for(p.words[p.length++]=N&m,S=10;S<u.length;S++){var I=u.words[S]|0;u.words[S-10]=(I&m)<<4|N>>>22,N=I}N>>>=22,u.words[S-10]=N,N===0&&u.length>10?u.length-=10:u.length-=9},"split"),F.prototype.imulK=o(function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var p=0,m=0;m<u.length;m++){var w=u.words[m]|0;p+=w*977,u.words[m]=p&67108863,p=w*64+(p/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u},"imulK");function j(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(j,"P224"),n(j,H);function D(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(D,"P192"),n(D,H);function B(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(B,"P25519"),n(B,H),B.prototype.imulK=o(function(u){for(var p=0,m=0;m<u.length;m++){var w=(u.words[m]|0)*19+p,S=w&67108863;w>>>=26,u.words[m]=S,p=w}return p!==0&&(u.words[u.length++]=p),u},"imulK"),i._prime=o(function(u){if(L[u])return L[u];var p;if(u==="k256")p=new F;else if(u==="p224")p=new j;else if(u==="p192")p=new D;else if(u==="p25519")p=new B;else throw new Error("Unknown prime "+u);return L[u]=p,p},"prime");function R(b){if(typeof b=="string"){var u=i._prime(b);this.m=u.p,this.prime=u}else t(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}o(R,"Red"),R.prototype._verify1=o(function(u){t(u.negative===0,"red works only with positives"),t(u.red,"red works only with red numbers")},"_verify1"),R.prototype._verify2=o(function(u,p){t((u.negative|p.negative)===0,"red works only with positives"),t(u.red&&u.red===p.red,"red works only with red numbers")},"_verify2"),R.prototype.imod=o(function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},"imod"),R.prototype.neg=o(function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},"neg"),R.prototype.add=o(function(u,p){this._verify2(u,p);var m=u.add(p);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},"add"),R.prototype.iadd=o(function(u,p){this._verify2(u,p);var m=u.iadd(p);return m.cmp(this.m)>=0&&m.isub(this.m),m},"iadd"),R.prototype.sub=o(function(u,p){this._verify2(u,p);var m=u.sub(p);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},"sub"),R.prototype.isub=o(function(u,p){this._verify2(u,p);var m=u.isub(p);return m.cmpn(0)<0&&m.iadd(this.m),m},"isub"),R.prototype.shl=o(function(u,p){return this._verify1(u),this.imod(u.ushln(p))},"shl"),R.prototype.imul=o(function(u,p){return this._verify2(u,p),this.imod(u.imul(p))},"imul"),R.prototype.mul=o(function(u,p){return this._verify2(u,p),this.imod(u.mul(p))},"mul"),R.prototype.isqr=o(function(u){return this.imul(u,u.clone())},"isqr"),R.prototype.sqr=o(function(u){return this.mul(u,u)},"sqr"),R.prototype.sqrt=o(function(u){if(u.isZero())return u.clone();var p=this.m.andln(3);if(t(p%2===1),p===3){var m=this.m.add(new i(1)).iushrn(2);return this.pow(u,m)}for(var w=this.m.subn(1),S=0;!w.isZero()&&w.andln(1)===0;)S++,w.iushrn(1);t(!w.isZero());var N=new i(1).toRed(this),I=N.redNeg(),k=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new i(2*g*g).toRed(this);this.pow(g,k).cmp(I)!==0;)g.redIAdd(I);for(var C=this.pow(g,w),Z=this.pow(u,w.addn(1).iushrn(1)),V=this.pow(u,w),K=S;V.cmp(N)!==0;){for(var fe=V,A=0;fe.cmp(N)!==0;A++)fe=fe.redSqr();t(A<K);var X=this.pow(C,new i(1).iushln(K-A-1));Z=Z.redMul(X),C=X.redSqr(),V=V.redMul(C),K=A}return Z},"sqrt"),R.prototype.invm=o(function(u){var p=u._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},"invm"),R.prototype.pow=o(function(u,p){if(p.isZero())return new i(1).toRed(this);if(p.cmpn(1)===0)return u.clone();var m=4,w=new Array(1<<m);w[0]=new i(1).toRed(this),w[1]=u;for(var S=2;S<w.length;S++)w[S]=this.mul(w[S-1],u);var N=w[0],I=0,k=0,g=p.bitLength()%26;for(g===0&&(g=26),S=p.length-1;S>=0;S--){for(var C=p.words[S],Z=g-1;Z>=0;Z--){var V=C>>Z&1;if(N!==w[0]&&(N=this.sqr(N)),V===0&&I===0){k=0;continue}I<<=1,I|=V,k++,!(k!==m&&(S!==0||Z!==0))&&(N=this.mul(N,w[I]),k=0,I=0)}g=26}return N},"pow"),R.prototype.convertTo=o(function(u){var p=u.umod(this.m);return p===u?p.clone():p},"convertTo"),R.prototype.convertFrom=o(function(u){var p=u.clone();return p.red=null,p},"convertFrom"),i.mont=o(function(u){return new Y(u)},"mont");function Y(b){R.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"Mont"),n(Y,R),Y.prototype.convertTo=o(function(u){return this.imod(u.ushln(this.shift))},"convertTo"),Y.prototype.convertFrom=o(function(u){var p=this.imod(u.mul(this.rinv));return p.red=null,p},"convertFrom"),Y.prototype.imul=o(function(u,p){if(u.isZero()||p.isZero())return u.words[0]=0,u.length=1,u;var m=u.imul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),N=S;return S.cmp(this.m)>=0?N=S.isub(this.m):S.cmpn(0)<0&&(N=S.iadd(this.m)),N._forceRed(this)},"imul"),Y.prototype.mul=o(function(u,p){if(u.isZero()||p.isZero())return new i(0)._forceRed(this);var m=u.mul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),N=S;return S.cmp(this.m)>=0?N=S.isub(this.m):S.cmpn(0)<0&&(N=S.iadd(this.m)),N._forceRed(this)},"mul"),Y.prototype.invm=o(function(u){var p=this.imod(u._invmp(this.m).mul(this.r2));return p._forceRed(this)},"invm")})(typeof om=="undefined"||om,Yv)});var no=de((xL,Zv)=>{Zv.exports=Xv;function Xv(r,e){if(!r)throw new Error(e||"Assertion failed")}o(Xv,"assert");Xv.equal=o(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual")});var am=de(t2=>{"use strict";var Jh=t2;function q9(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r!="string"){for(var n=0;n<r.length;n++)t[n]=r[n]|0;return t}if(e==="hex"){r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r);for(var n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var n=0;n<r.length;n++){var i=r.charCodeAt(n),s=i>>8,a=i&255;s?t.push(s,a):t.push(a)}return t}o(q9,"toArray");Jh.toArray=q9;function Qv(r){return r.length===1?"0"+r:r}o(Qv,"zero2");Jh.zero2=Qv;function e2(r){for(var e="",t=0;t<r.length;t++)e+=Qv(r[t].toString(16));return e}o(e2,"toHex");Jh.toHex=e2;Jh.encode=o(function(e,t){return t==="hex"?e2(e):e},"encode")});var rn=de(r2=>{"use strict";var Vn=r2,z9=_n(),j9=no(),Wh=am();Vn.assert=j9;Vn.toArray=Wh.toArray;Vn.zero2=Wh.zero2;Vn.toHex=Wh.toHex;Vn.encode=Wh.encode;function V9(r,e,t){var n=new Array(Math.max(r.bitLength(),t)+1);n.fill(0);for(var i=1<<e+1,s=r.clone(),a=0;a<n.length;a++){var c,f=s.andln(i-1);s.isOdd()?(f>(i>>1)-1?c=(i>>1)-f:c=f,s.isubn(c)):c=0,n[a]=c,s.iushrn(1)}return n}o(V9,"getNAF");Vn.getNAF=V9;function G9(r,e){var t=[[],[]];r=r.clone(),e=e.clone();for(var n=0,i=0,s;r.cmpn(-n)>0||e.cmpn(-i)>0;){var a=r.andln(3)+n&3,c=e.andln(3)+i&3;a===3&&(a=-1),c===3&&(c=-1);var f;(a&1)===0?f=0:(s=r.andln(7)+n&7,(s===3||s===5)&&c===2?f=-a:f=a),t[0].push(f);var l;(c&1)===0?l=0:(s=e.andln(7)+i&7,(s===3||s===5)&&a===2?l=-c:l=c),t[1].push(l),2*n===f+1&&(n=1-n),2*i===l+1&&(i=1-i),r.iushrn(1),e.iushrn(1)}return t}o(G9,"getJSF");Vn.getJSF=G9;function J9(r,e,t){var n="_"+e;r.prototype[e]=o(function(){return this[n]!==void 0?this[n]:this[n]=t.call(this)},"cachedProperty")}o(J9,"cachedProperty");Vn.cachedProperty=J9;function W9(r){return typeof r=="string"?Vn.toArray(r,"hex"):r}o(W9,"parseBytes");Vn.parseBytes=W9;function Y9(r){return new z9(r,"hex","le")}o(Y9,"intFromLE");Vn.intFromLE=Y9});var lm=de((EL,um)=>{var cm;um.exports=o(function(e){return cm||(cm=new io(null)),cm.generate(e)},"rand");function io(r){this.rand=r}o(io,"Rand");um.exports.Rand=io;io.prototype.generate=o(function(e){return this._rand(e)},"generate");io.prototype._rand=o(function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"_rand");if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?io.prototype._rand=o(function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t},"_rand"):self.msCrypto&&self.msCrypto.getRandomValues?io.prototype._rand=o(function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t},"_rand"):typeof window=="object"&&(io.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(fm=require("crypto"),typeof fm.randomBytes!="function")throw new Error("Not supported");io.prototype._rand=o(function(e){return fm.randomBytes(e)},"_rand")}catch(r){}var fm});var mu=de((SL,n2)=>{"use strict";var Xo=_n(),pu=rn(),Yh=pu.getNAF,X9=pu.getJSF,Xh=pu.assert;function so(r,e){this.type=r,this.p=new Xo(e.p,16),this.red=e.prime?Xo.red(e.prime):Xo.mont(this.p),this.zero=new Xo(0).toRed(this.red),this.one=new Xo(1).toRed(this.red),this.two=new Xo(2).toRed(this.red),this.n=e.n&&new Xo(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(so,"BaseCurve");n2.exports=so;so.prototype.point=o(function(){throw new Error("Not implemented")},"point");so.prototype.validate=o(function(){throw new Error("Not implemented")},"validate");so.prototype._fixedNafMul=o(function(e,t){Xh(e.precomputed);var n=e._getDoubles(),i=Yh(t,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var a=[],c,f;for(c=0;c<i.length;c+=n.step){f=0;for(var l=c+n.step-1;l>=c;l--)f=(f<<1)+i[l];a.push(f)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),v=s;v>0;v--){for(c=0;c<a.length;c++)f=a[c],f===v?d=d.mixedAdd(n.points[c]):f===-v&&(d=d.mixedAdd(n.points[c].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");so.prototype._wnafMul=o(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var s=i.points,a=Yh(t,n,this._bitLength),c=this.jpoint(null,null,null),f=a.length-1;f>=0;f--){for(var l=0;f>=0&&a[f]===0;f--)l++;if(f>=0&&l++,c=c.dblp(l),f<0)break;var h=a[f];Xh(h!==0),e.type==="affine"?h>0?c=c.mixedAdd(s[h-1>>1]):c=c.mixedAdd(s[-h-1>>1].neg()):h>0?c=c.add(s[h-1>>1]):c=c.add(s[-h-1>>1].neg())}return e.type==="affine"?c.toP():c},"_wnafMul");so.prototype._wnafMulAdd=o(function(e,t,n,i,s){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h,d,v;for(h=0;h<i;h++){v=t[h];var x=v._getNAFPoints(e);a[h]=x.wnd,c[h]=x.points}for(h=i-1;h>=1;h-=2){var y=h-1,_=h;if(a[y]!==1||a[_]!==1){f[y]=Yh(n[y],a[y],this._bitLength),f[_]=Yh(n[_],a[_],this._bitLength),l=Math.max(f[y].length,l),l=Math.max(f[_].length,l);continue}var U=[t[y],null,null,t[_]];t[y].y.cmp(t[_].y)===0?(U[1]=t[y].add(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg())):t[y].y.cmp(t[_].y.redNeg())===0?(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].add(t[_].neg())):(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],L=X9(n[y],n[_]);for(l=Math.max(L[0].length,l),f[y]=new Array(l),f[_]=new Array(l),d=0;d<l;d++){var H=L[0][d]|0,F=L[1][d]|0;f[y][d]=E[(H+1)*3+(F+1)],f[_][d]=0,c[y]=U}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var R=!0;for(d=0;d<i;d++)D[d]=f[d][h]|0,D[d]!==0&&(R=!1);if(!R)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?v=c[d][Y-1>>1]:Y<0&&(v=c[d][-Y-1>>1].neg()),v.type==="affine"?j=j.mixedAdd(v):j=j.add(v))}}for(h=0;h<i;h++)c[h]=null;return s?j:j.toP()},"_wnafMulAdd");function An(r,e){this.curve=r,this.type=e,this.precomputed=null}o(An,"BasePoint");so.BasePoint=An;An.prototype.eq=o(function(){throw new Error("Not implemented")},"eq");An.prototype.validate=o(function(){return this.curve.validate(this)},"validate");so.prototype.decodePoint=o(function(e,t){e=pu.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?Xh(e[e.length-1]%2===0):e[0]===7&&Xh(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");An.prototype.encodeCompressed=o(function(e){return this.encode(e,!0)},"encodeCompressed");An.prototype._encode=o(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");An.prototype.encode=o(function(e,t){return pu.encode(this._encode(t),e)},"encode");An.prototype.precompute=o(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");An.prototype._hasDoubles=o(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");An.prototype._getDoubles=o(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");An.prototype._getNAFPoints=o(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),s=1;s<n;s++)t[s]=t[s-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");An.prototype._getBeta=o(function(){return null},"_getBeta");An.prototype.dblp=o(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp")});var bu=de((CL,hm)=>{typeof Object.create=="function"?hm.exports=o(function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):hm.exports=o(function(e,t){if(t){e.super_=t;var n=o(function(){},"TempCtor");n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},"inherits")});var s2=de((kL,i2)=>{"use strict";var Z9=rn(),It=_n(),dm=bu(),fc=mu(),Q9=Z9.assert;function En(r){fc.call(this,"short",r),this.a=new It(r.a,16).toRed(this.red),this.b=new It(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}o(En,"ShortCurve");dm(En,fc);i2.exports=En;En.prototype._getEndomorphism=o(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new It(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new It(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?n=s[0]:(n=s[1],Q9(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(c){return{a:new It(c.a,16),b:new It(c.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");En.prototype._getEndoRoots=o(function(e){var t=e===this.p?this.red:It.mont(e),n=new It(2).toRed(t).redInvm(),i=n.redNeg(),s=new It(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[a,c]},"_getEndoRoots");En.prototype._getEndoBasis=o(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new It(1),a=new It(0),c=new It(0),f=new It(1),l,h,d,v,x,y,_,U=0,E,L;n.cmpn(0)!==0;){var H=i.div(n);E=i.sub(H.mul(n)),L=c.sub(H.mul(s));var F=f.sub(H.mul(a));if(!d&&E.cmp(t)<0)l=_.neg(),h=s,d=E.neg(),v=L;else if(d&&++U===2)break;_=E,i=n,n=E,c=s,s=L,f=a,a=F}x=E.neg(),y=L;var j=d.sqr().add(v.sqr()),D=x.sqr().add(y.sqr());return D.cmp(j)>=0&&(x=l,y=h),d.negative&&(d=d.neg(),v=v.neg()),x.negative&&(x=x.neg(),y=y.neg()),[{a:d,b:v},{a:x,b:y}]},"_getEndoBasis");En.prototype._endoSplit=o(function(e){var t=this.endo.basis,n=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),f=a.mul(i.a),l=s.mul(n.b),h=a.mul(i.b),d=e.sub(c).sub(f),v=l.add(h).neg();return{k1:d,k2:v}},"_endoSplit");En.prototype.pointFromX=o(function(e,t){e=new It(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");En.prototype.validate=o(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate");En.prototype._endoWnafMulAdd=o(function(e,t,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var c=this._endoSplit(t[a]),f=e[a],l=f._getBeta();c.k1.negative&&(c.k1.ineg(),f=f.neg(!0)),c.k2.negative&&(c.k2.ineg(),l=l.neg(!0)),i[a*2]=f,i[a*2+1]=l,s[a*2]=c.k1,s[a*2+1]=c.k2}for(var h=this._wnafMulAdd(1,i,s,a*2,n),d=0;d<a*2;d++)i[d]=null,s[d]=null;return h},"_endoWnafMulAdd");function Xt(r,e,t,n){fc.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new It(e,16),this.y=new It(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(Xt,"Point");dm(Xt,fc.BasePoint);En.prototype.point=o(function(e,t,n){return new Xt(this,e,t,n)},"point");En.prototype.pointFromJSON=o(function(e,t){return Xt.fromJSON(this,e,t)},"pointFromJSON");Xt.prototype._getBeta=o(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");Xt.prototype.toJSON=o(function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},"toJSON");Xt.fromJSON=o(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function s(c){return e.point(c[0],c[1],n)}o(s,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},"fromJSON");Xt.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");Xt.prototype.isInfinity=o(function(){return this.inf},"isInfinity");Xt.prototype.add=o(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");Xt.prototype.dbl=o(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},"dbl");Xt.prototype.getX=o(function(){return this.x.fromRed()},"getX");Xt.prototype.getY=o(function(){return this.y.fromRed()},"getY");Xt.prototype.mul=o(function(e){return e=new It(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");Xt.prototype.mulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},"mulAdd");Xt.prototype.jmulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},"jmulAdd");Xt.prototype.eq=o(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");Xt.prototype.neg=o(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=o(function(s){return s.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");Xt.prototype.toJ=o(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function cr(r,e,t,n){fc.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new It(0)):(this.x=new It(e,16),this.y=new It(t,16),this.z=new It(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(cr,"JPoint");dm(cr,fc.BasePoint);En.prototype.jpoint=o(function(e,t,n){return new cr(this,e,t,n)},"jpoint");cr.prototype.toP=o(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");cr.prototype.neg=o(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");cr.prototype.add=o(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),f=i.redSub(s),l=a.redSub(c);if(f.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),d=h.redMul(f),v=i.redMul(h),x=l.redSqr().redIAdd(d).redISub(v).redISub(v),y=l.redMul(v.redISub(x)).redISub(a.redMul(d)),_=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(x,y,_)},"add");cr.prototype.mixedAdd=o(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),c=n.redSub(i),f=s.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),h=l.redMul(c),d=n.redMul(l),v=f.redSqr().redIAdd(h).redISub(d).redISub(d),x=f.redMul(d.redISub(v)).redISub(s.redMul(h)),y=this.z.redMul(c);return this.curve.jpoint(v,x,y)},"mixedAdd");cr.prototype.dblp=o(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,s=this.curve.tinv,a=this.x,c=this.y,f=this.z,l=f.redSqr().redSqr(),h=c.redAdd(c);for(t=0;t<e;t++){var d=a.redSqr(),v=h.redSqr(),x=v.redSqr(),y=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),_=a.redMul(v),U=y.redSqr().redISub(_.redAdd(_)),E=_.redISub(U),L=y.redMul(E);L=L.redIAdd(L).redISub(x);var H=h.redMul(f);t+1<e&&(l=l.redMul(x)),a=U,f=H,h=L}return this.curve.jpoint(a,h.redMul(s),f)},"dblp");cr.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");cr.prototype._zeroDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i),l=f.redSqr().redISub(c).redISub(c),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),v=this.y.redSqr(),x=v.redSqr(),y=this.x.redAdd(v).redSqr().redISub(d).redISub(x);y=y.redIAdd(y);var _=d.redAdd(d).redIAdd(d),U=_.redSqr(),E=x.redIAdd(x);E=E.redIAdd(E),E=E.redIAdd(E),e=U.redISub(y).redISub(y),t=_.redMul(y.redISub(e)).redISub(E),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");cr.prototype._threeDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=f.redSqr().redISub(c).redISub(c);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),v=this.y.redSqr(),x=this.x.redMul(v),y=this.x.redSub(d).redMul(this.x.redAdd(d));y=y.redAdd(y).redIAdd(y);var _=x.redIAdd(x);_=_.redIAdd(_);var U=_.redAdd(_);e=y.redSqr().redISub(U),n=this.y.redAdd(this.z).redSqr().redISub(v).redISub(d);var E=v.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E),t=y.redMul(_.redISub(e)).redISub(E)}return this.curve.jpoint(e,t,n)},"_threeDbl");cr.prototype._dbl=o(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,s=i.redSqr().redSqr(),a=t.redSqr(),c=n.redSqr(),f=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(c),d=f.redSqr().redISub(h.redAdd(h)),v=h.redISub(d),x=c.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=f.redMul(v).redISub(x),_=n.redAdd(n).redMul(i);return this.curve.jpoint(d,y,_)},"_dbl");cr.prototype.trpl=o(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),c=this.x.redAdd(t).redSqr().redISub(e).redISub(i);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(a);var f=c.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=s.redIAdd(c).redSqr().redISub(a).redISub(f).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var v=this.x.redMul(f).redISub(d);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.y.redMul(h.redMul(l.redISub(h)).redISub(c.redMul(f)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=this.z.redAdd(c).redSqr().redISub(n).redISub(f);return this.curve.jpoint(v,x,y)},"trpl");cr.prototype.mul=o(function(e,t){return e=new It(e,t),this.curve._wnafMul(this,e)},"mul");cr.prototype.eq=o(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),s=n.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");cr.prototype.eqXToP=o(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP");cr.prototype.inspect=o(function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},"inspect");cr.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity")});var c2=de((TL,a2)=>{"use strict";var uc=_n(),o2=bu(),Zh=mu(),e7=rn();function lc(r){Zh.call(this,"mont",r),this.a=new uc(r.a,16).toRed(this.red),this.b=new uc(r.b,16).toRed(this.red),this.i4=new uc(4).toRed(this.red).redInvm(),this.two=new uc(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}o(lc,"MontCurve");o2(lc,Zh);a2.exports=lc;lc.prototype.validate=o(function(e){var t=e.normalize().x,n=t.redSqr(),i=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t),s=i.redSqrt();return s.redSqr().cmp(i)===0},"validate");function Zt(r,e,t){Zh.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new uc(e,16),this.z=new uc(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(Zt,"Point");o2(Zt,Zh.BasePoint);lc.prototype.decodePoint=o(function(e,t){return this.point(e7.toArray(e,t),1)},"decodePoint");lc.prototype.point=o(function(e,t){return new Zt(this,e,t)},"point");lc.prototype.pointFromJSON=o(function(e){return Zt.fromJSON(this,e)},"pointFromJSON");Zt.prototype.precompute=o(function(){},"precompute");Zt.prototype._encode=o(function(){return this.getX().toArray("be",this.curve.p.byteLength())},"_encode");Zt.fromJSON=o(function(e,t){return new Zt(e,t[0],t[1]||e.one)},"fromJSON");Zt.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");Zt.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity");Zt.prototype.dbl=o(function(){var e=this.x.redAdd(this.z),t=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=t.redSub(i),a=t.redMul(i),c=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,c)},"dbl");Zt.prototype.add=o(function(){throw new Error("Not supported on Montgomery curve")},"add");Zt.prototype.diffAdd=o(function(e,t){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),c=a.redMul(n),f=s.redMul(i),l=t.z.redMul(c.redAdd(f).redSqr()),h=t.x.redMul(c.redISub(f).redSqr());return this.curve.point(l,h)},"diffAdd");Zt.prototype.mul=o(function(e){for(var t=e.clone(),n=this,i=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var c=a.length-1;c>=0;c--)a[c]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},"mul");Zt.prototype.mulAdd=o(function(){throw new Error("Not supported on Montgomery curve")},"mulAdd");Zt.prototype.jumlAdd=o(function(){throw new Error("Not supported on Montgomery curve")},"jumlAdd");Zt.prototype.eq=o(function(e){return this.getX().cmp(e.getX())===0},"eq");Zt.prototype.normalize=o(function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},"normalize");Zt.prototype.getX=o(function(){return this.normalize(),this.x.fromRed()},"getX")});var l2=de((ML,u2)=>{"use strict";var t7=rn(),Zi=_n(),f2=bu(),Qh=mu(),r7=t7.assert;function bi(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Qh.call(this,"edwards",r),this.a=new Zi(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Zi(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Zi(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),r7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}o(bi,"EdwardsCurve");f2(bi,Qh);u2.exports=bi;bi.prototype._mulA=o(function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},"_mulA");bi.prototype._mulC=o(function(e){return this.oneC?e:this.c.redMul(e)},"_mulC");bi.prototype.jpoint=o(function(e,t,n,i){return this.point(e,t,n,i)},"jpoint");bi.prototype.pointFromX=o(function(e,t){e=new Zi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var f=c.fromRed().isOdd();return(t&&!f||!t&&f)&&(c=c.redNeg()),this.point(e,c)},"pointFromX");bi.prototype.pointFromY=o(function(e,t){e=new Zi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==t&&(c=c.redNeg()),this.point(c,e)},"pointFromY");bi.prototype.validate=o(function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),i=t.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return i.cmp(s)===0},"validate");function ut(r,e,t,n,i){Qh.BasePoint.call(this,r,"projective"),e===null&&t===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Zi(e,16),this.y=new Zi(t,16),this.z=n?new Zi(n,16):this.curve.one,this.t=i&&new Zi(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(ut,"Point");f2(ut,Qh.BasePoint);bi.prototype.pointFromJSON=o(function(e){return ut.fromJSON(this,e)},"pointFromJSON");bi.prototype.point=o(function(e,t,n,i){return new ut(this,e,t,n,i)},"point");ut.fromJSON=o(function(e,t){return new ut(e,t[0],t[1],t[2])},"fromJSON");ut.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");ut.prototype.isInfinity=o(function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},"isInfinity");ut.prototype._extDbl=o(function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),c=a.redSub(n),f=i.redSub(t),l=s.redMul(c),h=a.redMul(f),d=s.redMul(f),v=c.redMul(a);return this.curve.point(l,h,v,d)},"_extDbl");ut.prototype._projDbl=o(function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),i,s,a,c,f,l;if(this.curve.twisted){c=this.curve._mulA(t);var h=c.redAdd(n);this.zOne?(i=e.redSub(t).redSub(n).redMul(h.redSub(this.curve.two)),s=h.redMul(c.redSub(n)),a=h.redSqr().redSub(h).redSub(h)):(f=this.z.redSqr(),l=h.redSub(f).redISub(f),i=e.redSub(t).redISub(n).redMul(l),s=h.redMul(c.redSub(n)),a=h.redMul(l))}else c=t.redAdd(n),f=this.curve._mulC(this.z).redSqr(),l=c.redSub(f).redSub(f),i=this.curve._mulC(e.redISub(c)).redMul(l),s=this.curve._mulC(c).redMul(t.redISub(n)),a=c.redMul(l);return this.curve.point(i,s,a)},"_projDbl");ut.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},"dbl");ut.prototype._extAdd=o(function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),c=s.redSub(i),f=s.redAdd(i),l=n.redAdd(t),h=a.redMul(c),d=f.redMul(l),v=a.redMul(l),x=c.redMul(f);return this.curve.point(h,d,x,v)},"_extAdd");ut.prototype._projAdd=o(function(e){var t=this.z.redMul(e.z),n=t.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(s),c=n.redSub(a),f=n.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),h=t.redMul(c).redMul(l),d,v;return this.curve.twisted?(d=t.redMul(f).redMul(s.redSub(this.curve._mulA(i))),v=c.redMul(f)):(d=t.redMul(f).redMul(s.redSub(i)),v=this.curve._mulC(c).redMul(f)),this.curve.point(h,d,v)},"_projAdd");ut.prototype.add=o(function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},"add");ut.prototype.mul=o(function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},"mul");ut.prototype.mulAdd=o(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},"mulAdd");ut.prototype.jmulAdd=o(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},"jmulAdd");ut.prototype.normalize=o(function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},"normalize");ut.prototype.neg=o(function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},"neg");ut.prototype.getX=o(function(){return this.normalize(),this.x.fromRed()},"getX");ut.prototype.getY=o(function(){return this.normalize(),this.y.fromRed()},"getY");ut.prototype.eq=o(function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},"eq");ut.prototype.eqXToP=o(function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),this.x.cmp(t)===0)return!0}},"eqXToP");ut.prototype.toP=ut.prototype.normalize;ut.prototype.mixedAdd=ut.prototype.add});var pm=de(h2=>{"use strict";var ed=h2;ed.base=mu();ed.short=s2();ed.mont=c2();ed.edwards=l2()});var Gn=de(at=>{"use strict";var n7=no(),i7=bu();at.inherits=i7;function s7(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}o(s7,"isSurrogatePair");function o7(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),i=0;i<r.length;i+=2)t.push(parseInt(r[i]+r[i+1],16))}else for(var n=0,i=0;i<r.length;i++){var s=r.charCodeAt(i);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):s7(r,i)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++i)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}else for(i=0;i<r.length;i++)t[i]=r[i]|0;return t}o(o7,"toArray");at.toArray=o7;function a7(r){for(var e="",t=0;t<r.length;t++)e+=p2(r[t].toString(16));return e}o(a7,"toHex");at.toHex=a7;function d2(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}o(d2,"htonl");at.htonl=d2;function c7(r,e){for(var t="",n=0;n<r.length;n++){var i=r[n];e==="little"&&(i=d2(i)),t+=m2(i.toString(16))}return t}o(c7,"toHex32");at.toHex32=c7;function p2(r){return r.length===1?"0"+r:r}o(p2,"zero2");at.zero2=p2;function m2(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}o(m2,"zero8");at.zero8=m2;function f7(r,e,t,n){var i=t-e;n7(i%4===0);for(var s=new Array(i/4),a=0,c=e;a<s.length;a++,c+=4){var f;n==="big"?f=r[c]<<24|r[c+1]<<16|r[c+2]<<8|r[c+3]:f=r[c+3]<<24|r[c+2]<<16|r[c+1]<<8|r[c],s[a]=f>>>0}return s}o(f7,"join32");at.join32=f7;function u7(r,e){for(var t=new Array(r.length*4),n=0,i=0;n<r.length;n++,i+=4){var s=r[n];e==="big"?(t[i]=s>>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}o(u7,"split32");at.split32=u7;function l7(r,e){return r>>>e|r<<32-e}o(l7,"rotr32");at.rotr32=l7;function h7(r,e){return r<<e|r>>>32-e}o(h7,"rotl32");at.rotl32=h7;function d7(r,e){return r+e>>>0}o(d7,"sum32");at.sum32=d7;function p7(r,e,t){return r+e+t>>>0}o(p7,"sum32_3");at.sum32_3=p7;function m7(r,e,t,n){return r+e+t+n>>>0}o(m7,"sum32_4");at.sum32_4=m7;function b7(r,e,t,n,i){return r+e+t+n+i>>>0}o(b7,"sum32_5");at.sum32_5=b7;function g7(r,e,t,n){var i=r[e],s=r[e+1],a=n+s>>>0,c=(a<n?1:0)+t+i;r[e]=c>>>0,r[e+1]=a}o(g7,"sum64");at.sum64=g7;function y7(r,e,t,n){var i=e+n>>>0,s=(i<e?1:0)+r+t;return s>>>0}o(y7,"sum64_hi");at.sum64_hi=y7;function v7(r,e,t,n){var i=e+n;return i>>>0}o(v7,"sum64_lo");at.sum64_lo=v7;function w7(r,e,t,n,i,s,a,c){var f=0,l=e;l=l+n>>>0,f+=l<e?1:0,l=l+s>>>0,f+=l<s?1:0,l=l+c>>>0,f+=l<c?1:0;var h=r+t+i+a+f;return h>>>0}o(w7,"sum64_4_hi");at.sum64_4_hi=w7;function x7(r,e,t,n,i,s,a,c){var f=e+n+s+c;return f>>>0}o(x7,"sum64_4_lo");at.sum64_4_lo=x7;function _7(r,e,t,n,i,s,a,c,f,l){var h=0,d=e;d=d+n>>>0,h+=d<e?1:0,d=d+s>>>0,h+=d<s?1:0,d=d+c>>>0,h+=d<c?1:0,d=d+l>>>0,h+=d<l?1:0;var v=r+t+i+a+f+h;return v>>>0}o(_7,"sum64_5_hi");at.sum64_5_hi=_7;function A7(r,e,t,n,i,s,a,c,f,l){var h=e+n+s+c+l;return h>>>0}o(A7,"sum64_5_lo");at.sum64_5_lo=A7;function E7(r,e,t){var n=e<<32-t|r>>>t;return n>>>0}o(E7,"rotr64_hi");at.rotr64_hi=E7;function S7(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}o(S7,"rotr64_lo");at.rotr64_lo=S7;function C7(r,e,t){return r>>>t}o(C7,"shr64_hi");at.shr64_hi=C7;function k7(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}o(k7,"shr64_lo");at.shr64_lo=k7});var hc=de(g2=>{"use strict";var b2=Gn(),T7=no();function td(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}o(td,"BlockHash");g2.BlockHash=td;td.prototype.update=o(function(e,t){if(e=b2.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=b2.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},"update");td.prototype.digest=o(function(e){return this.update(this._pad()),T7(this.pending===null),this._digest(e)},"digest");td.prototype._pad=o(function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,i=new Array(n+this.padLength);i[0]=128;for(var s=1;s<n;s++)i[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)i[s++]=0;i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=e>>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a<this.padLength;a++)i[s++]=0;return i},"pad")});var mm=de(Qi=>{"use strict";var M7=Gn(),gi=M7.rotr32;function B7(r,e,t,n){if(r===0)return y2(e,t,n);if(r===1||r===3)return w2(e,t,n);if(r===2)return v2(e,t,n)}o(B7,"ft_1");Qi.ft_1=B7;function y2(r,e,t){return r&e^~r&t}o(y2,"ch32");Qi.ch32=y2;function v2(r,e,t){return r&e^r&t^e&t}o(v2,"maj32");Qi.maj32=v2;function w2(r,e,t){return r^e^t}o(w2,"p32");Qi.p32=w2;function I7(r){return gi(r,2)^gi(r,13)^gi(r,22)}o(I7,"s0_256");Qi.s0_256=I7;function N7(r){return gi(r,6)^gi(r,11)^gi(r,25)}o(N7,"s1_256");Qi.s1_256=N7;function O7(r){return gi(r,7)^gi(r,18)^r>>>3}o(O7,"g0_256");Qi.g0_256=O7;function P7(r){return gi(r,17)^gi(r,19)^r>>>10}o(P7,"g1_256");Qi.g1_256=P7});var A2=de((PL,_2)=>{"use strict";var dc=Gn(),R7=hc(),U7=mm(),bm=dc.rotl32,gu=dc.sum32,L7=dc.sum32_5,D7=U7.ft_1,x2=R7.BlockHash,K7=[1518500249,1859775393,2400959708,3395469782];function yi(){if(!(this instanceof yi))return new yi;x2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}o(yi,"SHA1");dc.inherits(yi,x2);_2.exports=yi;yi.blockSize=512;yi.outSize=160;yi.hmacStrength=80;yi.padLength=64;yi.prototype._update=o(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=bm(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var s=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],l=this.h[4];for(i=0;i<n.length;i++){var h=~~(i/20),d=L7(bm(s,5),D7(h,a,c,f),l,n[i],K7[h]);l=f,f=c,c=bm(a,30),a=s,s=d}this.h[0]=gu(this.h[0],s),this.h[1]=gu(this.h[1],a),this.h[2]=gu(this.h[2],c),this.h[3]=gu(this.h[3],f),this.h[4]=gu(this.h[4],l)},"_update");yi.prototype._digest=o(function(e){return e==="hex"?dc.toHex32(this.h,"big"):dc.split32(this.h,"big")},"digest")});var gm=de((RL,S2)=>{"use strict";var pc=Gn(),$7=hc(),mc=mm(),F7=no(),Jn=pc.sum32,H7=pc.sum32_4,q7=pc.sum32_5,z7=mc.ch32,j7=mc.maj32,V7=mc.s0_256,G7=mc.s1_256,J7=mc.g0_256,W7=mc.g1_256,E2=$7.BlockHash,Y7=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function vi(){if(!(this instanceof vi))return new vi;E2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Y7,this.W=new Array(64)}o(vi,"SHA256");pc.inherits(vi,E2);S2.exports=vi;vi.blockSize=512;vi.outSize=256;vi.hmacStrength=192;vi.padLength=64;vi.prototype._update=o(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=H7(W7(n[i-2]),n[i-7],J7(n[i-15]),n[i-16]);var s=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],l=this.h[4],h=this.h[5],d=this.h[6],v=this.h[7];for(F7(this.k.length===n.length),i=0;i<n.length;i++){var x=q7(v,G7(l),z7(l,h,d),this.k[i],n[i]),y=Jn(V7(s),j7(s,a,c));v=d,d=h,h=l,l=Jn(f,x),f=c,c=a,a=s,s=Jn(x,y)}this.h[0]=Jn(this.h[0],s),this.h[1]=Jn(this.h[1],a),this.h[2]=Jn(this.h[2],c),this.h[3]=Jn(this.h[3],f),this.h[4]=Jn(this.h[4],l),this.h[5]=Jn(this.h[5],h),this.h[6]=Jn(this.h[6],d),this.h[7]=Jn(this.h[7],v)},"_update");vi.prototype._digest=o(function(e){return e==="hex"?pc.toHex32(this.h,"big"):pc.split32(this.h,"big")},"digest")});var T2=de((UL,k2)=>{"use strict";var ym=Gn(),C2=gm();function es(){if(!(this instanceof es))return new es;C2.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}o(es,"SHA224");ym.inherits(es,C2);k2.exports=es;es.blockSize=512;es.outSize=224;es.hmacStrength=192;es.padLength=64;es.prototype._digest=o(function(e){return e==="hex"?ym.toHex32(this.h.slice(0,7),"big"):ym.split32(this.h.slice(0,7),"big")},"digest")});var xm=de((LL,N2)=>{"use strict";var Fr=Gn(),X7=hc(),Z7=no(),wi=Fr.rotr64_hi,xi=Fr.rotr64_lo,M2=Fr.shr64_hi,B2=Fr.shr64_lo,oo=Fr.sum64,vm=Fr.sum64_hi,wm=Fr.sum64_lo,Q7=Fr.sum64_4_hi,eC=Fr.sum64_4_lo,tC=Fr.sum64_5_hi,rC=Fr.sum64_5_lo,I2=X7.BlockHash,nC=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Wn(){if(!(this instanceof Wn))return new Wn;I2.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=nC,this.W=new Array(160)}o(Wn,"SHA512");Fr.inherits(Wn,I2);N2.exports=Wn;Wn.blockSize=1024;Wn.outSize=512;Wn.hmacStrength=192;Wn.padLength=128;Wn.prototype._prepareBlock=o(function(e,t){for(var n=this.W,i=0;i<32;i++)n[i]=e[t+i];for(;i<n.length;i+=2){var s=pC(n[i-4],n[i-3]),a=mC(n[i-4],n[i-3]),c=n[i-14],f=n[i-13],l=hC(n[i-30],n[i-29]),h=dC(n[i-30],n[i-29]),d=n[i-32],v=n[i-31];n[i]=Q7(s,a,c,f,l,h,d,v),n[i+1]=eC(s,a,c,f,l,h,d,v)}},"_prepareBlock");Wn.prototype._update=o(function(e,t){this._prepareBlock(e,t);var n=this.W,i=this.h[0],s=this.h[1],a=this.h[2],c=this.h[3],f=this.h[4],l=this.h[5],h=this.h[6],d=this.h[7],v=this.h[8],x=this.h[9],y=this.h[10],_=this.h[11],U=this.h[12],E=this.h[13],L=this.h[14],H=this.h[15];Z7(this.k.length===n.length);for(var F=0;F<n.length;F+=2){var j=L,D=H,B=uC(v,x),R=lC(v,x),Y=iC(v,x,y,_,U,E),b=sC(v,x,y,_,U,E),u=this.k[F],p=this.k[F+1],m=n[F],w=n[F+1],S=tC(j,D,B,R,Y,b,u,p,m,w),N=rC(j,D,B,R,Y,b,u,p,m,w);j=cC(i,s),D=fC(i,s),B=oC(i,s,a,c,f,l),R=aC(i,s,a,c,f,l);var I=vm(j,D,B,R),k=wm(j,D,B,R);L=U,H=E,U=y,E=_,y=v,_=x,v=vm(h,d,S,N),x=wm(d,d,S,N),h=f,d=l,f=a,l=c,a=i,c=s,i=vm(S,N,I,k),s=wm(S,N,I,k)}oo(this.h,0,i,s),oo(this.h,2,a,c),oo(this.h,4,f,l),oo(this.h,6,h,d),oo(this.h,8,v,x),oo(this.h,10,y,_),oo(this.h,12,U,E),oo(this.h,14,L,H)},"_update");Wn.prototype._digest=o(function(e){return e==="hex"?Fr.toHex32(this.h,"big"):Fr.split32(this.h,"big")},"digest");function iC(r,e,t,n,i){var s=r&t^~r&i;return s<0&&(s+=4294967296),s}o(iC,"ch64_hi");function sC(r,e,t,n,i,s){var a=e&n^~e&s;return a<0&&(a+=4294967296),a}o(sC,"ch64_lo");function oC(r,e,t,n,i){var s=r&t^r&i^t&i;return s<0&&(s+=4294967296),s}o(oC,"maj64_hi");function aC(r,e,t,n,i,s){var a=e&n^e&s^n&s;return a<0&&(a+=4294967296),a}o(aC,"maj64_lo");function cC(r,e){var t=wi(r,e,28),n=wi(e,r,2),i=wi(e,r,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(cC,"s0_512_hi");function fC(r,e){var t=xi(r,e,28),n=xi(e,r,2),i=xi(e,r,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(fC,"s0_512_lo");function uC(r,e){var t=wi(r,e,14),n=wi(r,e,18),i=wi(e,r,9),s=t^n^i;return s<0&&(s+=4294967296),s}o(uC,"s1_512_hi");function lC(r,e){var t=xi(r,e,14),n=xi(r,e,18),i=xi(e,r,9),s=t^n^i;return s<0&&(s+=4294967296),s}o(lC,"s1_512_lo");function hC(r,e){var t=wi(r,e,1),n=wi(r,e,8),i=M2(r,e,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(hC,"g0_512_hi");function dC(r,e){var t=xi(r,e,1),n=xi(r,e,8),i=B2(r,e,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(dC,"g0_512_lo");function pC(r,e){var t=wi(r,e,19),n=wi(e,r,29),i=M2(r,e,6),s=t^n^i;return s<0&&(s+=4294967296),s}o(pC,"g1_512_hi");function mC(r,e){var t=xi(r,e,19),n=xi(e,r,29),i=B2(r,e,6),s=t^n^i;return s<0&&(s+=4294967296),s}o(mC,"g1_512_lo")});var R2=de((DL,P2)=>{"use strict";var _m=Gn(),O2=xm();function ts(){if(!(this instanceof ts))return new ts;O2.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}o(ts,"SHA384");_m.inherits(ts,O2);P2.exports=ts;ts.blockSize=1024;ts.outSize=384;ts.hmacStrength=192;ts.padLength=128;ts.prototype._digest=o(function(e){return e==="hex"?_m.toHex32(this.h.slice(0,12),"big"):_m.split32(this.h.slice(0,12),"big")},"digest")});var U2=de(bc=>{"use strict";bc.sha1=A2();bc.sha224=T2();bc.sha256=gm();bc.sha384=R2();bc.sha512=xm()});var H2=de(F2=>{"use strict";var Zo=Gn(),bC=hc(),rd=Zo.rotl32,L2=Zo.sum32,yu=Zo.sum32_3,D2=Zo.sum32_4,$2=bC.BlockHash;function _i(){if(!(this instanceof _i))return new _i;$2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}o(_i,"RIPEMD160");Zo.inherits(_i,$2);F2.ripemd160=_i;_i.blockSize=512;_i.outSize=160;_i.hmacStrength=192;_i.padLength=64;_i.prototype._update=o(function(e,t){for(var n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],f=n,l=i,h=s,d=a,v=c,x=0;x<80;x++){var y=L2(rd(D2(n,K2(x,i,s,a),e[vC[x]+t],gC(x)),xC[x]),c);n=c,c=a,a=rd(s,10),s=i,i=y,y=L2(rd(D2(f,K2(79-x,l,h,d),e[wC[x]+t],yC(x)),_C[x]),v),f=v,v=d,d=rd(h,10),h=l,l=y}y=yu(this.h[1],s,d),this.h[1]=yu(this.h[2],a,v),this.h[2]=yu(this.h[3],c,f),this.h[3]=yu(this.h[4],n,l),this.h[4]=yu(this.h[0],i,h),this.h[0]=y},"update");_i.prototype._digest=o(function(e){return e==="hex"?Zo.toHex32(this.h,"little"):Zo.split32(this.h,"little")},"digest");function K2(r,e,t,n){return r<=15?e^t^n:r<=31?e&t|~e&n:r<=47?(e|~t)^n:r<=63?e&n|t&~n:e^(t|~n)}o(K2,"f");function gC(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}o(gC,"K");function yC(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}o(yC,"Kh");var vC=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],wC=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],xC=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],_C=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var z2=de((FL,q2)=>{"use strict";var AC=Gn(),EC=no();function gc(r,e,t){if(!(this instanceof gc))return new gc(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(AC.toArray(e,t))}o(gc,"Hmac");q2.exports=gc;gc.prototype._init=o(function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),EC(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},"init");gc.prototype.update=o(function(e,t){return this.inner.update(e,t),this},"update");gc.prototype.digest=o(function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},"digest")});var vu=de(j2=>{var fr=j2;fr.utils=Gn();fr.common=hc();fr.sha=U2();fr.ripemd=H2();fr.hmac=z2();fr.sha1=fr.sha.sha1;fr.sha256=fr.sha.sha256;fr.sha224=fr.sha.sha224;fr.sha384=fr.sha.sha384;fr.sha512=fr.sha.sha512;fr.ripemd160=fr.ripemd.ripemd160});var G2=de((qL,V2)=>{V2.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var nd=de(Y2=>{"use strict";var Em=Y2,ao=vu(),Am=pm(),SC=rn(),J2=SC.assert;function W2(r){r.type==="short"?this.curve=new Am.short(r):r.type==="edwards"?this.curve=new Am.edwards(r):this.curve=new Am.mont(r),this.g=this.curve.g,this.n=this.curve.n,this.hash=r.hash,J2(this.g.validate(),"Invalid curve"),J2(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(W2,"PresetCurve");Em.PresetCurve=W2;function co(r,e){Object.defineProperty(Em,r,{configurable:!0,enumerable:!0,get:function(){var t=new W2(e);return Object.defineProperty(Em,r,{configurable:!0,enumerable:!0,value:t}),t}})}o(co,"defineCurve");co("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ao.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});co("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ao.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});co("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ao.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});co("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ao.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});co("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ao.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});co("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ao.sha256,gRed:!1,g:["9"]});co("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ao.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var Sm;try{Sm=G2()}catch(r){Sm=void 0}co("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ao.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",Sm]})});var Q2=de((jL,Z2)=>{"use strict";var CC=vu(),Qo=am(),X2=no();function fo(r){if(!(this instanceof fo))return new fo(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Qo.toArray(r.entropy,r.entropyEnc||"hex"),t=Qo.toArray(r.nonce,r.nonceEnc||"hex"),n=Qo.toArray(r.pers,r.persEnc||"hex");X2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}o(fo,"HmacDRBG");Z2.exports=fo;fo.prototype._init=o(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");fo.prototype._hmac=o(function(){return new CC.hmac(this.hash,this.K)},"hmac");fo.prototype._update=o(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");fo.prototype.reseed=o(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=Qo.toArray(e,t),n=Qo.toArray(n,i),X2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");fo.prototype.generate=o(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=Qo.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(n),this._reseed++,Qo.encode(a,t)},"generate")});var tw=de((VL,ew)=>{"use strict";var kC=_n(),TC=rn(),Cm=TC.assert;function yr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}o(yr,"KeyPair");ew.exports=yr;yr.fromPublic=o(function(e,t,n){return t instanceof yr?t:new yr(e,{pub:t,pubEnc:n})},"fromPublic");yr.fromPrivate=o(function(e,t,n){return t instanceof yr?t:new yr(e,{priv:t,privEnc:n})},"fromPrivate");yr.prototype.validate=o(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");yr.prototype.getPublic=o(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");yr.prototype.getPrivate=o(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");yr.prototype._importPrivate=o(function(e,t){this.priv=new kC(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");yr.prototype._importPublic=o(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Cm(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Cm(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");yr.prototype.derive=o(function(e){return e.validate()||Cm(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");yr.prototype.sign=o(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");yr.prototype.verify=o(function(e,t){return this.ec.verify(e,t,this)},"verify");yr.prototype.inspect=o(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect")});var iw=de((GL,nw)=>{"use strict";var id=_n(),Mm=rn(),MC=Mm.assert;function sd(r,e){if(r instanceof sd)return r;this._importDER(r,e)||(MC(r.r&&r.s,"Signature without r or s"),this.r=new id(r.r,16),this.s=new id(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}o(sd,"Signature");nw.exports=sd;function BC(){this.place=0}o(BC,"Position");function km(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s<n;s++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}o(km,"getLength");function rw(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}o(rw,"rmPadding");sd.prototype._importDER=o(function(e,t){e=Mm.toArray(e,t);var n=new BC;if(e[n.place++]!==48)return!1;var i=km(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var s=km(e,n);if(s===!1)return!1;var a=e.slice(n.place,s+n.place);if(n.place+=s,e[n.place++]!==2)return!1;var c=km(e,n);if(c===!1||e.length!==c+n.place)return!1;var f=e.slice(n.place,c+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;return this.r=new id(a),this.s=new id(f),this.recoveryParam=null,!0},"_importDER");function Tm(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}o(Tm,"constructLength");sd.prototype.toDER=o(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=rw(t),n=rw(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Tm(i,t.length),i=i.concat(t),i.push(2),Tm(i,n.length);var s=i.concat(n),a=[48];return Tm(a,s.length),a=a.concat(s),Mm.encode(a,e)},"toDER")});var cw=de((JL,aw)=>{"use strict";var ea=_n(),sw=Q2(),IC=rn(),Bm=nd(),NC=lm(),ow=IC.assert,Im=tw(),od=iw();function Sn(r){if(!(this instanceof Sn))return new Sn(r);typeof r=="string"&&(ow(Object.prototype.hasOwnProperty.call(Bm,r),"Unknown curve "+r),r=Bm[r]),r instanceof Bm.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}o(Sn,"EC");aw.exports=Sn;Sn.prototype.keyPair=o(function(e){return new Im(this,e)},"keyPair");Sn.prototype.keyFromPrivate=o(function(e,t){return Im.fromPrivate(this,e,t)},"keyFromPrivate");Sn.prototype.keyFromPublic=o(function(e,t){return Im.fromPublic(this,e,t)},"keyFromPublic");Sn.prototype.genKeyPair=o(function(e){e||(e={});for(var t=new sw({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||NC(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ea(2));;){var s=new ea(t.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair");Sn.prototype._truncateToN=o(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Sn.prototype.sign=o(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new ea(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),f=new sw({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new ea(1)),h=0;;h++){var d=i.k?i.k(h):new ea(f.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var v=this.g.mul(d);if(!v.isInfinity()){var x=v.getX(),y=x.umod(this.n);if(y.cmpn(0)!==0){var _=d.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),_.cmpn(0)!==0){var U=(v.getY().isOdd()?1:0)|(x.cmp(y)!==0?2:0);return i.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),U^=1),new od({r:y,s:_,recoveryParam:U})}}}}}},"sign");Sn.prototype.verify=o(function(e,t,n,i){e=this._truncateToN(new ea(e,16)),n=this.keyFromPublic(n,i),t=new od(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(e).umod(this.n),l=c.mul(s).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(s)):(h=this.g.mulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(s)===0)},"verify");Sn.prototype.recoverPubKey=function(r,e,t,n){ow((3&t)===t,"The recovery param is more than two bits"),e=new od(e,n);var i=this.n,s=new ea(r),a=e.r,c=e.s,f=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var h=e.r.invm(i),d=i.sub(s).mul(h).umod(i),v=c.mul(h).umod(i);return this.g.mulAdd(d,a,v)};Sn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new od(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(r,e,i)}catch(a){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")}});var hw=de((WL,lw)=>{"use strict";var wu=rn(),uw=wu.assert,fw=wu.parseBytes,yc=wu.cachedProperty;function Qt(r,e){this.eddsa=r,this._secret=fw(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=fw(e.pub)}o(Qt,"KeyPair");Qt.fromPublic=o(function(e,t){return t instanceof Qt?t:new Qt(e,{pub:t})},"fromPublic");Qt.fromSecret=o(function(e,t){return t instanceof Qt?t:new Qt(e,{secret:t})},"fromSecret");Qt.prototype.secret=o(function(){return this._secret},"secret");yc(Qt,"pubBytes",o(function(){return this.eddsa.encodePoint(this.pub())},"pubBytes"));yc(Qt,"pub",o(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())},"pub"));yc(Qt,"privBytes",o(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i},"privBytes"));yc(Qt,"priv",o(function(){return this.eddsa.decodeInt(this.privBytes())},"priv"));yc(Qt,"hash",o(function(){return this.eddsa.hash().update(this.secret()).digest()},"hash"));yc(Qt,"messagePrefix",o(function(){return this.hash().slice(this.eddsa.encodingLength)},"messagePrefix"));Qt.prototype.sign=o(function(e){return uw(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},"sign");Qt.prototype.verify=o(function(e,t){return this.eddsa.verify(e,t,this)},"verify");Qt.prototype.getSecret=o(function(e){return uw(this._secret,"KeyPair is public only"),wu.encode(this.secret(),e)},"getSecret");Qt.prototype.getPublic=o(function(e){return wu.encode(this.pubBytes(),e)},"getPublic");lw.exports=Qt});var pw=de((YL,dw)=>{"use strict";var OC=_n(),ad=rn(),PC=ad.assert,cd=ad.cachedProperty,RC=ad.parseBytes;function ta(r,e){this.eddsa=r,typeof e!="object"&&(e=RC(e)),Array.isArray(e)&&(e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),PC(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof OC&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(ta,"Signature");cd(ta,"S",o(function(){return this.eddsa.decodeInt(this.Sencoded())},"S"));cd(ta,"R",o(function(){return this.eddsa.decodePoint(this.Rencoded())},"R"));cd(ta,"Rencoded",o(function(){return this.eddsa.encodePoint(this.R())},"Rencoded"));cd(ta,"Sencoded",o(function(){return this.eddsa.encodeInt(this.S())},"Sencoded"));ta.prototype.toBytes=o(function(){return this.Rencoded().concat(this.Sencoded())},"toBytes");ta.prototype.toHex=o(function(){return ad.encode(this.toBytes(),"hex").toUpperCase()},"toHex");dw.exports=ta});var vw=de((XL,yw)=>{"use strict";var UC=vu(),LC=nd(),vc=rn(),DC=vc.assert,bw=vc.parseBytes,gw=hw(),mw=pw();function Hr(r){if(DC(r==="ed25519","only tested with ed25519 so far"),!(this instanceof Hr))return new Hr(r);r=LC[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=UC.sha512}o(Hr,"EDDSA");yw.exports=Hr;Hr.prototype.sign=o(function(e,t){e=bw(e);var n=this.keyFromSecret(t),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),a=this.encodePoint(s),c=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),f=i.add(c).umod(this.curve.n);return this.makeSignature({R:s,S:f,Rencoded:a})},"sign");Hr.prototype.verify=o(function(e,t,n){e=bw(e),t=this.makeSignature(t);var i=this.keyFromPublic(n),s=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S()),c=t.R().add(i.pub().mul(s));return c.eq(a)},"verify");Hr.prototype.hashInt=o(function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return vc.intFromLE(e.digest()).umod(this.curve.n)},"hashInt");Hr.prototype.keyFromPublic=o(function(e){return gw.fromPublic(this,e)},"keyFromPublic");Hr.prototype.keyFromSecret=o(function(e){return gw.fromSecret(this,e)},"keyFromSecret");Hr.prototype.makeSignature=o(function(e){return e instanceof mw?e:new mw(this,e)},"makeSignature");Hr.prototype.encodePoint=o(function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},"encodePoint");Hr.prototype.decodePoint=o(function(e){e=vc.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),i=(e[t]&128)!==0,s=vc.intFromLE(n);return this.curve.pointFromY(s,i)},"decodePoint");Hr.prototype.encodeInt=o(function(e){return e.toArray("le",this.encodingLength)},"encodeInt");Hr.prototype.decodeInt=o(function(e){return vc.intFromLE(e)},"decodeInt");Hr.prototype.isPoint=o(function(e){return e instanceof this.pointClass},"isPoint")});var xw=de(ww=>{"use strict";var ra=ww;ra.version=Jv().version;ra.utils=rn();ra.rand=lm();ra.curve=pm();ra.curves=nd();ra.ec=cw();ra.eddsa=vw()});var Aw=de(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var _w=65536,KC=function(){function r(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self!="undefined"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return o(r,"BrowserRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),n=0;n<t.length;n+=_w)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,_w)));return t},r}();Nm.BrowserRandomSource=KC});var Ew=de(Om=>{"use strict";Object.defineProperty(Om,"__esModule",{value:!0});var $C=xn(),FC=function(){function r(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof require!="undefined"){var e=require("crypto");e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return o(r,"NodeRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var n=new Uint8Array(e),i=0;i<n.length;i++)n[i]=t[i];return $C.wipe(t),n},r}();Om.NodeRandomSource=FC});var Sw=de(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var HC=Aw(),qC=Ew(),zC=function(){function r(){if(this.isAvailable=!1,this.name="",this._source=new HC.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new qC.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return o(r,"SystemRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},r}();Pm.SystemRandomSource=zC});var wc=de(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});var jC=Sw(),VC=Yo(),Cw=xn();Yn.defaultRandomSource=new jC.SystemRandomSource;function Rm(r,e){return e===void 0&&(e=Yn.defaultRandomSource),e.randomBytes(r)}o(Rm,"randomBytes");Yn.randomBytes=Rm;function GC(r){r===void 0&&(r=Yn.defaultRandomSource);var e=Rm(4,r),t=VC.readUint32LE(e);return Cw.wipe(e),t}o(GC,"randomUint32");Yn.randomUint32=GC;var kw="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function Tw(r,e,t){if(e===void 0&&(e=kw),t===void 0&&(t=Yn.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var n="",i=e.length,s=256-256%i;r>0;){for(var a=Rm(Math.ceil(r*256/s),t),c=0;c<a.length&&r>0;c++){var f=a[c];f<s&&(n+=e.charAt(f%i),r--)}Cw.wipe(a)}return n}o(Tw,"randomString");Yn.randomString=Tw;function JC(r,e,t){e===void 0&&(e=kw),t===void 0&&(t=Yn.defaultRandomSource);var n=Math.ceil(r/(Math.log(e.length)/Math.LN2));return Tw(n,e,t)}o(JC,"randomStringForEntropy");Yn.randomStringForEntropy=JC});var Iw=de(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});var _c=Yo(),xc=xn();rs.DIGEST_LENGTH=64;rs.BLOCK_SIZE=128;var Bw=function(){function r(){this.digestLength=rs.DIGEST_LENGTH,this.blockSize=rs.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return o(r,"SHA512"),r.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){xc.wipe(this._buffer),xc.wipe(this._tempHi),xc.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<rs.BLOCK_SIZE&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(Um(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=Um(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,s=t<<3,a=t%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c<a-8;c++)this._buffer[c]=0;_c.writeUint32BE(i,this._buffer,a-8),_c.writeUint32BE(s,this._buffer,a-4),Um(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,a),this._finished=!0}for(var c=0;c<this.digestLength/8;c++)_c.writeUint32BE(this._stateHi[c],e,c*8),_c.writeUint32BE(this._stateLo[c],e,c*8+4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){xc.wipe(e.stateHi),xc.wipe(e.stateLo),e.buffer&&xc.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();rs.SHA512=Bw;var Mw=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function Um(r,e,t,n,i,s,a){for(var c=t[0],f=t[1],l=t[2],h=t[3],d=t[4],v=t[5],x=t[6],y=t[7],_=n[0],U=n[1],E=n[2],L=n[3],H=n[4],F=n[5],j=n[6],D=n[7],B,R,Y,b,u,p,m,w;a>=128;){for(var S=0;S<16;S++){var N=8*S+s;r[S]=_c.readUint32BE(i,N),e[S]=_c.readUint32BE(i,N+4)}for(var S=0;S<80;S++){var I=c,k=f,g=l,C=h,Z=d,V=v,K=x,fe=y,A=_,X=U,Q=E,P=L,O=H,z=F,W=j,re=D;if(B=y,R=D,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=(d>>>14|H<<32-14)^(d>>>18|H<<32-18)^(H>>>41-32|d<<32-(41-32)),R=(H>>>14|d<<32-14)^(H>>>18|d<<32-18)^(d>>>41-32|H<<32-(41-32)),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=d&v^~d&x,R=H&F^~H&j,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=Mw[S*2],R=Mw[S*2+1],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=r[S%16],R=e[S%16],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,Y=m&65535|w<<16,b=u&65535|p<<16,B=Y,R=b,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=(c>>>28|_<<32-28)^(_>>>34-32|c<<32-(34-32))^(_>>>39-32|c<<32-(39-32)),R=(_>>>28|c<<32-28)^(c>>>34-32|_<<32-(34-32))^(c>>>39-32|_<<32-(39-32)),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=c&f^c&l^f&l,R=_&U^_&E^U&E,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,fe=m&65535|w<<16,re=u&65535|p<<16,B=C,R=P,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=Y,R=b,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,C=m&65535|w<<16,P=u&65535|p<<16,f=I,l=k,h=g,d=C,v=Z,x=V,y=K,c=fe,U=A,E=X,L=Q,H=P,F=O,j=z,D=W,_=re,S%16===15)for(var N=0;N<16;N++)B=r[N],R=e[N],u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=r[(N+9)%16],R=e[(N+9)%16],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,Y=r[(N+1)%16],b=e[(N+1)%16],B=(Y>>>1|b<<32-1)^(Y>>>8|b<<32-8)^Y>>>7,R=(b>>>1|Y<<32-1)^(b>>>8|Y<<32-8)^(b>>>7|Y<<32-7),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,Y=r[(N+14)%16],b=e[(N+14)%16],B=(Y>>>19|b<<32-19)^(b>>>61-32|Y<<32-(61-32))^Y>>>6,R=(b>>>19|Y<<32-19)^(Y>>>61-32|b<<32-(61-32))^(b>>>6|Y<<32-6),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,r[N]=m&65535|w<<16,e[N]=u&65535|p<<16}B=c,R=_,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[0],R=n[0],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[0]=c=m&65535|w<<16,n[0]=_=u&65535|p<<16,B=f,R=U,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[1],R=n[1],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[1]=f=m&65535|w<<16,n[1]=U=u&65535|p<<16,B=l,R=E,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[2],R=n[2],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[2]=l=m&65535|w<<16,n[2]=E=u&65535|p<<16,B=h,R=L,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[3],R=n[3],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[3]=h=m&65535|w<<16,n[3]=L=u&65535|p<<16,B=d,R=H,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[4],R=n[4],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[4]=d=m&65535|w<<16,n[4]=H=u&65535|p<<16,B=v,R=F,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[5],R=n[5],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[5]=v=m&65535|w<<16,n[5]=F=u&65535|p<<16,B=x,R=j,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[6],R=n[6],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[6]=x=m&65535|w<<16,n[6]=j=u&65535|p<<16,B=y,R=D,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[7],R=n[7],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[7]=y=m&65535|w<<16,n[7]=D=u&65535|p<<16,s+=128,a-=128}return s}o(Um,"hashBlocks");function WC(r){var e=new Bw;e.update(r);var t=e.digest();return e.clean(),t}o(WC,"hash");rs.hash=WC});var fd=de(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});var YC=wc(),xu=Iw(),Uw=xn();Jt.SIGNATURE_LENGTH=64;Jt.PUBLIC_KEY_LENGTH=32;Jt.SECRET_KEY_LENGTH=64;Jt.SEED_LENGTH=32;function Te(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}o(Te,"gf");var XC=new Uint8Array(32);XC[0]=9;var Km=Te(),Ac=Te([1]),ZC=Te([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),QC=Te([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Nw=Te([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Ow=Te([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),ek=Te([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function uo(r,e){for(var t=0;t<16;t++)r[t]=e[t]|0}o(uo,"set25519");function Lm(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}o(Lm,"car25519");function Lw(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var s=n&(r[i]^e[i]);r[i]^=s,e[i]^=s}}o(Lw,"sel25519");function _u(r,e){for(var t=Te(),n=Te(),i=0;i<16;i++)n[i]=e[i];Lm(n),Lm(n),Lm(n);for(var s=0;s<2;s++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,Lw(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}o(_u,"pack25519");function Dw(r,e){for(var t=0,n=0;n<32;n++)t|=r[n]^e[n];return(1&t-1>>>8)-1}o(Dw,"verify32");function Pw(r,e){var t=new Uint8Array(32),n=new Uint8Array(32);return _u(t,r),_u(n,e),Dw(t,n)}o(Pw,"neq25519");function Kw(r){var e=new Uint8Array(32);return _u(e,r),e[0]&1}o(Kw,"par25519");function tk(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(tk,"unpack25519");function na(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}o(na,"add");function sa(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}o(sa,"sub");function ot(r,e,t){var n,i,s=0,a=0,c=0,f=0,l=0,h=0,d=0,v=0,x=0,y=0,_=0,U=0,E=0,L=0,H=0,F=0,j=0,D=0,B=0,R=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,k=0,g=0,C=t[0],Z=t[1],V=t[2],K=t[3],fe=t[4],A=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],W=t[11],re=t[12],le=t[13],oe=t[14],J=t[15];n=e[0],s+=n*C,a+=n*Z,c+=n*V,f+=n*K,l+=n*fe,h+=n*A,d+=n*X,v+=n*Q,x+=n*P,y+=n*O,_+=n*z,U+=n*W,E+=n*re,L+=n*le,H+=n*oe,F+=n*J,n=e[1],a+=n*C,c+=n*Z,f+=n*V,l+=n*K,h+=n*fe,d+=n*A,v+=n*X,x+=n*Q,y+=n*P,_+=n*O,U+=n*z,E+=n*W,L+=n*re,H+=n*le,F+=n*oe,j+=n*J,n=e[2],c+=n*C,f+=n*Z,l+=n*V,h+=n*K,d+=n*fe,v+=n*A,x+=n*X,y+=n*Q,_+=n*P,U+=n*O,E+=n*z,L+=n*W,H+=n*re,F+=n*le,j+=n*oe,D+=n*J,n=e[3],f+=n*C,l+=n*Z,h+=n*V,d+=n*K,v+=n*fe,x+=n*A,y+=n*X,_+=n*Q,U+=n*P,E+=n*O,L+=n*z,H+=n*W,F+=n*re,j+=n*le,D+=n*oe,B+=n*J,n=e[4],l+=n*C,h+=n*Z,d+=n*V,v+=n*K,x+=n*fe,y+=n*A,_+=n*X,U+=n*Q,E+=n*P,L+=n*O,H+=n*z,F+=n*W,j+=n*re,D+=n*le,B+=n*oe,R+=n*J,n=e[5],h+=n*C,d+=n*Z,v+=n*V,x+=n*K,y+=n*fe,_+=n*A,U+=n*X,E+=n*Q,L+=n*P,H+=n*O,F+=n*z,j+=n*W,D+=n*re,B+=n*le,R+=n*oe,Y+=n*J,n=e[6],d+=n*C,v+=n*Z,x+=n*V,y+=n*K,_+=n*fe,U+=n*A,E+=n*X,L+=n*Q,H+=n*P,F+=n*O,j+=n*z,D+=n*W,B+=n*re,R+=n*le,Y+=n*oe,b+=n*J,n=e[7],v+=n*C,x+=n*Z,y+=n*V,_+=n*K,U+=n*fe,E+=n*A,L+=n*X,H+=n*Q,F+=n*P,j+=n*O,D+=n*z,B+=n*W,R+=n*re,Y+=n*le,b+=n*oe,u+=n*J,n=e[8],x+=n*C,y+=n*Z,_+=n*V,U+=n*K,E+=n*fe,L+=n*A,H+=n*X,F+=n*Q,j+=n*P,D+=n*O,B+=n*z,R+=n*W,Y+=n*re,b+=n*le,u+=n*oe,p+=n*J,n=e[9],y+=n*C,_+=n*Z,U+=n*V,E+=n*K,L+=n*fe,H+=n*A,F+=n*X,j+=n*Q,D+=n*P,B+=n*O,R+=n*z,Y+=n*W,b+=n*re,u+=n*le,p+=n*oe,m+=n*J,n=e[10],_+=n*C,U+=n*Z,E+=n*V,L+=n*K,H+=n*fe,F+=n*A,j+=n*X,D+=n*Q,B+=n*P,R+=n*O,Y+=n*z,b+=n*W,u+=n*re,p+=n*le,m+=n*oe,w+=n*J,n=e[11],U+=n*C,E+=n*Z,L+=n*V,H+=n*K,F+=n*fe,j+=n*A,D+=n*X,B+=n*Q,R+=n*P,Y+=n*O,b+=n*z,u+=n*W,p+=n*re,m+=n*le,w+=n*oe,S+=n*J,n=e[12],E+=n*C,L+=n*Z,H+=n*V,F+=n*K,j+=n*fe,D+=n*A,B+=n*X,R+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*W,m+=n*re,w+=n*le,S+=n*oe,N+=n*J,n=e[13],L+=n*C,H+=n*Z,F+=n*V,j+=n*K,D+=n*fe,B+=n*A,R+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*W,w+=n*re,S+=n*le,N+=n*oe,I+=n*J,n=e[14],H+=n*C,F+=n*Z,j+=n*V,D+=n*K,B+=n*fe,R+=n*A,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*W,S+=n*re,N+=n*le,I+=n*oe,k+=n*J,n=e[15],F+=n*C,j+=n*Z,D+=n*V,B+=n*K,R+=n*fe,Y+=n*A,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*W,N+=n*re,I+=n*le,k+=n*oe,g+=n*J,s+=38*j,a+=38*D,c+=38*B,f+=38*R,l+=38*Y,h+=38*b,d+=38*u,v+=38*p,x+=38*m,y+=38*w,_+=38*S,U+=38*N,E+=38*I,L+=38*k,H+=38*g,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),r[0]=s,r[1]=a,r[2]=c,r[3]=f,r[4]=l,r[5]=h,r[6]=d,r[7]=v,r[8]=x,r[9]=y,r[10]=_,r[11]=U,r[12]=E,r[13]=L,r[14]=H,r[15]=F}o(ot,"mul");function ia(r,e){ot(r,e,e)}o(ia,"square");function $w(r,e){var t=Te(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=253;n>=0;n--)ia(t,t),n!==2&&n!==4&&ot(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}o($w,"inv25519");function rk(r,e){var t=Te(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=250;n>=0;n--)ia(t,t),n!==1&&ot(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}o(rk,"pow2523");function $m(r,e){var t=Te(),n=Te(),i=Te(),s=Te(),a=Te(),c=Te(),f=Te(),l=Te(),h=Te();sa(t,r[1],r[0]),sa(h,e[1],e[0]),ot(t,t,h),na(n,r[0],r[1]),na(h,e[0],e[1]),ot(n,n,h),ot(i,r[3],e[3]),ot(i,i,QC),ot(s,r[2],e[2]),na(s,s,s),sa(a,n,t),sa(c,s,i),na(f,s,i),na(l,n,t),ot(r[0],a,c),ot(r[1],l,f),ot(r[2],f,c),ot(r[3],a,l)}o($m,"edadd");function Rw(r,e,t){for(var n=0;n<4;n++)Lw(r[n],e[n],t)}o(Rw,"cswap");function Hm(r,e){var t=Te(),n=Te(),i=Te();$w(i,e[2]),ot(t,e[0],i),ot(n,e[1],i),_u(r,n),r[31]^=Kw(t)<<7}o(Hm,"pack");function Fw(r,e,t){uo(r[0],Km),uo(r[1],Ac),uo(r[2],Ac),uo(r[3],Km);for(var n=255;n>=0;--n){var i=t[n/8|0]>>(n&7)&1;Rw(r,e,i),$m(e,r),$m(r,r),Rw(r,e,i)}}o(Fw,"scalarmult");function qm(r,e){var t=[Te(),Te(),Te(),Te()];uo(t[0],Nw),uo(t[1],Ow),uo(t[2],Ac),ot(t[3],Nw,Ow),Fw(r,t,e)}o(qm,"scalarbase");function Hw(r){if(r.length!==Jt.SEED_LENGTH)throw new Error("ed25519: seed must be "+Jt.SEED_LENGTH+" bytes");var e=xu.hash(r);e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];qm(n,e),Hm(t,n);var i=new Uint8Array(64);return i.set(r),i.set(t,32),{publicKey:t,secretKey:i}}o(Hw,"generateKeyPairFromSeed");Jt.generateKeyPairFromSeed=Hw;function nk(r){var e=YC.randomBytes(32,r),t=Hw(e);return Uw.wipe(e),t}o(nk,"generateKeyPair");Jt.generateKeyPair=nk;function ik(r){if(r.length!==Jt.SECRET_KEY_LENGTH)throw new Error("ed25519: secret key must be "+Jt.SECRET_KEY_LENGTH+" bytes");return new Uint8Array(r.subarray(32))}o(ik,"extractPublicKeyFromSecretKey");Jt.extractPublicKeyFromSecretKey=ik;var Dm=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function qw(r,e){var t,n,i,s;for(n=63;n>=32;--n){for(t=0,i=n-32,s=n-12;i<s;++i)e[i]+=t-16*e[n]*Dm[i-(n-32)],t=Math.floor((e[i]+128)/256),e[i]-=t*256;e[i]+=t,e[n]=0}for(t=0,i=0;i<32;i++)e[i]+=t-(e[31]>>4)*Dm[i],t=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=t*Dm[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,r[n]=e[n]&255}o(qw,"modL");function Fm(r){for(var e=new Float64Array(64),t=0;t<64;t++)e[t]=r[t];for(var t=0;t<64;t++)r[t]=0;qw(r,e)}o(Fm,"reduce");function sk(r,e){var t=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=xu.hash(r.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;var s=new Uint8Array(64);s.set(i.subarray(32),32);var a=new xu.SHA512;a.update(s.subarray(32)),a.update(e);var c=a.digest();a.clean(),Fm(c),qm(n,c),Hm(s,n),a.reset(),a.update(s.subarray(0,32)),a.update(r.subarray(32)),a.update(e);var f=a.digest();Fm(f);for(var l=0;l<32;l++)t[l]=c[l];for(var l=0;l<32;l++)for(var h=0;h<32;h++)t[l+h]+=f[l]*i[h];return qw(s.subarray(32),t),s}o(sk,"sign");Jt.sign=sk;function zw(r,e){var t=Te(),n=Te(),i=Te(),s=Te(),a=Te(),c=Te(),f=Te();return uo(r[2],Ac),tk(r[1],e),ia(i,r[1]),ot(s,i,ZC),sa(i,i,r[2]),na(s,r[2],s),ia(a,s),ia(c,a),ot(f,c,a),ot(t,f,i),ot(t,t,s),rk(t,t),ot(t,t,i),ot(t,t,s),ot(t,t,s),ot(r[0],t,s),ia(n,r[0]),ot(n,n,s),Pw(n,i)&&ot(r[0],r[0],ek),ia(n,r[0]),ot(n,n,s),Pw(n,i)?-1:(Kw(r[0])===e[31]>>7&&sa(r[0],Km,r[0]),ot(r[3],r[0],r[1]),0)}o(zw,"unpackneg");function ok(r,e,t){var n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(t.length!==Jt.SIGNATURE_LENGTH)throw new Error("ed25519: signature must be "+Jt.SIGNATURE_LENGTH+" bytes");if(zw(s,r))return!1;var a=new xu.SHA512;a.update(t.subarray(0,32)),a.update(r),a.update(e);var c=a.digest();return Fm(c),Fw(i,s,c),qm(s,t.subarray(32)),$m(i,s),Hm(n,i),!Dw(t,n)}o(ok,"verify");Jt.verify=ok;function ak(r){var e=[Te(),Te(),Te(),Te()];if(zw(e,r))throw new Error("Ed25519: invalid public key");var t=Te(),n=Te(),i=e[1];na(t,Ac,i),sa(n,Ac,i),$w(n,n),ot(t,t,n);var s=new Uint8Array(32);return _u(s,t),s}o(ak,"convertPublicKeyToX25519");Jt.convertPublicKeyToX25519=ak;function ck(r){var e=xu.hash(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(e.subarray(0,32));return Uw.wipe(e),t}o(ck,"convertSecretKeyToX25519");Jt.convertSecretKeyToX25519=ck});var Vw=de((sD,jw)=>{"use strict";jw.exports=o(function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{let s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;let s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"},"serialize")});var Yw=de(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});var fk=wc(),uk=xn();qr.PUBLIC_KEY_LENGTH=32;qr.SECRET_KEY_LENGTH=32;qr.SHARED_KEY_LENGTH=32;function Ai(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}o(Ai,"gf");var Gw=new Uint8Array(32);Gw[0]=9;var lk=Ai([56129,1]);function zm(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}o(zm,"car25519");function Au(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var s=n&(r[i]^e[i]);r[i]^=s,e[i]^=s}}o(Au,"sel25519");function hk(r,e){for(var t=Ai(),n=Ai(),i=0;i<16;i++)n[i]=e[i];zm(n),zm(n),zm(n);for(var s=0;s<2;s++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,Au(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}o(hk,"pack25519");function dk(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(dk,"unpack25519");function ud(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}o(ud,"add");function ld(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}o(ld,"sub");function ns(r,e,t){var n,i,s=0,a=0,c=0,f=0,l=0,h=0,d=0,v=0,x=0,y=0,_=0,U=0,E=0,L=0,H=0,F=0,j=0,D=0,B=0,R=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,k=0,g=0,C=t[0],Z=t[1],V=t[2],K=t[3],fe=t[4],A=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],W=t[11],re=t[12],le=t[13],oe=t[14],J=t[15];n=e[0],s+=n*C,a+=n*Z,c+=n*V,f+=n*K,l+=n*fe,h+=n*A,d+=n*X,v+=n*Q,x+=n*P,y+=n*O,_+=n*z,U+=n*W,E+=n*re,L+=n*le,H+=n*oe,F+=n*J,n=e[1],a+=n*C,c+=n*Z,f+=n*V,l+=n*K,h+=n*fe,d+=n*A,v+=n*X,x+=n*Q,y+=n*P,_+=n*O,U+=n*z,E+=n*W,L+=n*re,H+=n*le,F+=n*oe,j+=n*J,n=e[2],c+=n*C,f+=n*Z,l+=n*V,h+=n*K,d+=n*fe,v+=n*A,x+=n*X,y+=n*Q,_+=n*P,U+=n*O,E+=n*z,L+=n*W,H+=n*re,F+=n*le,j+=n*oe,D+=n*J,n=e[3],f+=n*C,l+=n*Z,h+=n*V,d+=n*K,v+=n*fe,x+=n*A,y+=n*X,_+=n*Q,U+=n*P,E+=n*O,L+=n*z,H+=n*W,F+=n*re,j+=n*le,D+=n*oe,B+=n*J,n=e[4],l+=n*C,h+=n*Z,d+=n*V,v+=n*K,x+=n*fe,y+=n*A,_+=n*X,U+=n*Q,E+=n*P,L+=n*O,H+=n*z,F+=n*W,j+=n*re,D+=n*le,B+=n*oe,R+=n*J,n=e[5],h+=n*C,d+=n*Z,v+=n*V,x+=n*K,y+=n*fe,_+=n*A,U+=n*X,E+=n*Q,L+=n*P,H+=n*O,F+=n*z,j+=n*W,D+=n*re,B+=n*le,R+=n*oe,Y+=n*J,n=e[6],d+=n*C,v+=n*Z,x+=n*V,y+=n*K,_+=n*fe,U+=n*A,E+=n*X,L+=n*Q,H+=n*P,F+=n*O,j+=n*z,D+=n*W,B+=n*re,R+=n*le,Y+=n*oe,b+=n*J,n=e[7],v+=n*C,x+=n*Z,y+=n*V,_+=n*K,U+=n*fe,E+=n*A,L+=n*X,H+=n*Q,F+=n*P,j+=n*O,D+=n*z,B+=n*W,R+=n*re,Y+=n*le,b+=n*oe,u+=n*J,n=e[8],x+=n*C,y+=n*Z,_+=n*V,U+=n*K,E+=n*fe,L+=n*A,H+=n*X,F+=n*Q,j+=n*P,D+=n*O,B+=n*z,R+=n*W,Y+=n*re,b+=n*le,u+=n*oe,p+=n*J,n=e[9],y+=n*C,_+=n*Z,U+=n*V,E+=n*K,L+=n*fe,H+=n*A,F+=n*X,j+=n*Q,D+=n*P,B+=n*O,R+=n*z,Y+=n*W,b+=n*re,u+=n*le,p+=n*oe,m+=n*J,n=e[10],_+=n*C,U+=n*Z,E+=n*V,L+=n*K,H+=n*fe,F+=n*A,j+=n*X,D+=n*Q,B+=n*P,R+=n*O,Y+=n*z,b+=n*W,u+=n*re,p+=n*le,m+=n*oe,w+=n*J,n=e[11],U+=n*C,E+=n*Z,L+=n*V,H+=n*K,F+=n*fe,j+=n*A,D+=n*X,B+=n*Q,R+=n*P,Y+=n*O,b+=n*z,u+=n*W,p+=n*re,m+=n*le,w+=n*oe,S+=n*J,n=e[12],E+=n*C,L+=n*Z,H+=n*V,F+=n*K,j+=n*fe,D+=n*A,B+=n*X,R+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*W,m+=n*re,w+=n*le,S+=n*oe,N+=n*J,n=e[13],L+=n*C,H+=n*Z,F+=n*V,j+=n*K,D+=n*fe,B+=n*A,R+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*W,w+=n*re,S+=n*le,N+=n*oe,I+=n*J,n=e[14],H+=n*C,F+=n*Z,j+=n*V,D+=n*K,B+=n*fe,R+=n*A,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*W,S+=n*re,N+=n*le,I+=n*oe,k+=n*J,n=e[15],F+=n*C,j+=n*Z,D+=n*V,B+=n*K,R+=n*fe,Y+=n*A,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*W,N+=n*re,I+=n*le,k+=n*oe,g+=n*J,s+=38*j,a+=38*D,c+=38*B,f+=38*R,l+=38*Y,h+=38*b,d+=38*u,v+=38*p,x+=38*m,y+=38*w,_+=38*S,U+=38*N,E+=38*I,L+=38*k,H+=38*g,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),r[0]=s,r[1]=a,r[2]=c,r[3]=f,r[4]=l,r[5]=h,r[6]=d,r[7]=v,r[8]=x,r[9]=y,r[10]=_,r[11]=U,r[12]=E,r[13]=L,r[14]=H,r[15]=F}o(ns,"mul");function Eu(r,e){ns(r,e,e)}o(Eu,"square");function pk(r,e){for(var t=Ai(),n=0;n<16;n++)t[n]=e[n];for(var n=253;n>=0;n--)Eu(t,t),n!==2&&n!==4&&ns(t,t,e);for(var n=0;n<16;n++)r[n]=t[n]}o(pk,"inv25519");function jm(r,e){for(var t=new Uint8Array(32),n=new Float64Array(80),i=Ai(),s=Ai(),a=Ai(),c=Ai(),f=Ai(),l=Ai(),h=0;h<31;h++)t[h]=r[h];t[31]=r[31]&127|64,t[0]&=248,dk(n,e);for(var h=0;h<16;h++)s[h]=n[h];i[0]=c[0]=1;for(var h=254;h>=0;--h){var d=t[h>>>3]>>>(h&7)&1;Au(i,s,d),Au(a,c,d),ud(f,i,a),ld(i,i,a),ud(a,s,c),ld(s,s,c),Eu(c,f),Eu(l,i),ns(i,a,i),ns(a,s,f),ud(f,i,a),ld(i,i,a),Eu(s,i),ld(a,c,l),ns(i,a,lk),ud(i,i,c),ns(a,a,i),ns(i,c,l),ns(c,s,n),Eu(s,f),Au(i,s,d),Au(a,c,d)}for(var h=0;h<16;h++)n[h+16]=i[h],n[h+32]=a[h],n[h+48]=s[h],n[h+64]=c[h];var v=n.subarray(32),x=n.subarray(16);pk(v,v),ns(x,x,v);var y=new Uint8Array(32);return hk(y,x),y}o(jm,"scalarMult");qr.scalarMult=jm;function Jw(r){return jm(r,Gw)}o(Jw,"scalarMultBase");qr.scalarMultBase=Jw;function Ww(r){if(r.length!==qr.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+qr.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(r),t=Jw(e);return{publicKey:t,secretKey:e}}o(Ww,"generateKeyPairFromSeed");qr.generateKeyPairFromSeed=Ww;function mk(r){var e=fk.randomBytes(32,r),t=Ww(e);return uk.wipe(e),t}o(mk,"generateKeyPair");qr.generateKeyPair=mk;function bk(r,e,t){if(t===void 0&&(t=!1),r.length!==qr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==qr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var n=jm(r,e);if(t){for(var i=0,s=0;s<n.length;s++)i|=n[s];if(i===0)throw new Error("X25519: invalid shared key")}return n}o(bk,"sharedKey");qr.sharedKey=bk});var Gm=de(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var vr=Yo(),Vm=xn(),gk=20;function yk(r,e,t){for(var n=1634760805,i=857760878,s=2036477234,a=1797285236,c=t[3]<<24|t[2]<<16|t[1]<<8|t[0],f=t[7]<<24|t[6]<<16|t[5]<<8|t[4],l=t[11]<<24|t[10]<<16|t[9]<<8|t[8],h=t[15]<<24|t[14]<<16|t[13]<<8|t[12],d=t[19]<<24|t[18]<<16|t[17]<<8|t[16],v=t[23]<<24|t[22]<<16|t[21]<<8|t[20],x=t[27]<<24|t[26]<<16|t[25]<<8|t[24],y=t[31]<<24|t[30]<<16|t[29]<<8|t[28],_=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],E=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,F=i,j=s,D=a,B=c,R=f,Y=l,b=h,u=d,p=v,m=x,w=y,S=_,N=U,I=E,k=L,g=0;g<gk;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,F=F+R|0,N^=F,N=N>>>32-16|N<<16,p=p+N|0,R^=p,R=R>>>32-12|R<<12,j=j+Y|0,I^=j,I=I>>>32-16|I<<16,m=m+I|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,k^=D,k=k>>>32-16|k<<16,w=w+k|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,I^=j,I=I>>>32-8|I<<8,m=m+I|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,k^=D,k=k>>>32-8|k<<8,w=w+k|0,b^=w,b=b>>>32-7|b<<7,F=F+R|0,N^=F,N=N>>>32-8|N<<8,p=p+N|0,R^=p,R=R>>>32-7|R<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+R|0,k^=H,k=k>>>32-16|k<<16,m=m+k|0,R^=m,R=R>>>32-12|R<<12,F=F+Y|0,S^=F,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,N^=j,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,I^=D,I=I>>>32-16|I<<16,p=p+I|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,N^=j,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,I^=D,I=I>>>32-8|I<<8,p=p+I|0,B^=p,B=B>>>32-7|B<<7,F=F+Y|0,S^=F,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+R|0,k^=H,k=k>>>32-8|k<<8,m=m+k|0,R^=m,R=R>>>32-7|R<<7;vr.writeUint32LE(H+n|0,r,0),vr.writeUint32LE(F+i|0,r,4),vr.writeUint32LE(j+s|0,r,8),vr.writeUint32LE(D+a|0,r,12),vr.writeUint32LE(B+c|0,r,16),vr.writeUint32LE(R+f|0,r,20),vr.writeUint32LE(Y+l|0,r,24),vr.writeUint32LE(b+h|0,r,28),vr.writeUint32LE(u+d|0,r,32),vr.writeUint32LE(p+v|0,r,36),vr.writeUint32LE(m+x|0,r,40),vr.writeUint32LE(w+y|0,r,44),vr.writeUint32LE(S+_|0,r,48),vr.writeUint32LE(N+U|0,r,52),vr.writeUint32LE(I+E|0,r,56),vr.writeUint32LE(k+L|0,r,60)}o(yk,"core");function Xw(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=i}for(var c=new Uint8Array(64),f=0;f<t.length;f+=64){yk(c,s,r);for(var l=f;l<f+64&&l<t.length;l++)n[l]=t[l]^c[l-f];wk(s,0,a)}return Vm.wipe(c),i===0&&Vm.wipe(s),n}o(Xw,"streamXOR");hd.streamXOR=Xw;function vk(r,e,t,n){return n===void 0&&(n=0),Vm.wipe(t),Xw(r,e,t,t,n)}o(vk,"stream");hd.stream=vk;function wk(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}o(wk,"incrementCounter")});var t6=de(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});var lo=Yo(),Zw=xn(),xk=Gm(),_k=20;function Qw(r,e,t,n){if(e.length!==24)throw new Error("XChaCha20 nonce must be 24 bytes");var i=e6(r,e.subarray(0,16),new Uint8Array(32)),s=new Uint8Array(12);s.set(e.subarray(16),4);var a=xk.streamXOR(i,s,t,n);return Zw.wipe(i),a}o(Qw,"streamXOR");Su.streamXOR=Qw;function Ak(r,e,t){return Zw.wipe(t),Qw(r,e,t,t)}o(Ak,"stream");Su.stream=Ak;function e6(r,e,t){for(var n=1634760805,i=857760878,s=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],v=r[23]<<24|r[22]<<16|r[21]<<8|r[20],x=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],_=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],E=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,F=i,j=s,D=a,B=c,R=f,Y=l,b=h,u=d,p=v,m=x,w=y,S=_,N=U,I=E,k=L,g=0;g<_k;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,F=F+R|0,N^=F,N=N>>>32-16|N<<16,p=p+N|0,R^=p,R=R>>>32-12|R<<12,j=j+Y|0,I^=j,I=I>>>32-16|I<<16,m=m+I|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,k^=D,k=k>>>32-16|k<<16,w=w+k|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,I^=j,I=I>>>32-8|I<<8,m=m+I|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,k^=D,k=k>>>32-8|k<<8,w=w+k|0,b^=w,b=b>>>32-7|b<<7,F=F+R|0,N^=F,N=N>>>32-8|N<<8,p=p+N|0,R^=p,R=R>>>32-7|R<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+R|0,k^=H,k=k>>>32-16|k<<16,m=m+k|0,R^=m,R=R>>>32-12|R<<12,F=F+Y|0,S^=F,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,N^=j,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,I^=D,I=I>>>32-16|I<<16,p=p+I|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,N^=j,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,I^=D,I=I>>>32-8|I<<8,p=p+I|0,B^=p,B=B>>>32-7|B<<7,F=F+Y|0,S^=F,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+R|0,k^=H,k=k>>>32-8|k<<8,m=m+k|0,R^=m,R=R>>>32-7|R<<7;return lo.writeUint32LE(H,t,0),lo.writeUint32LE(F,t,4),lo.writeUint32LE(j,t,8),lo.writeUint32LE(D,t,12),lo.writeUint32LE(S,t,16),lo.writeUint32LE(N,t,20),lo.writeUint32LE(I,t,24),lo.writeUint32LE(k,t,28),t}o(e6,"hchacha");Su.hchacha=e6});var Jm=de(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});function Ek(r,e,t){return~(r-1)&e|r-1&t}o(Ek,"select");Ec.select=Ek;function Sk(r,e){return(r|0)-(e|0)-1>>>31&1}o(Sk,"lessOrEqual");Ec.lessOrEqual=Sk;function r6(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}o(r6,"compare");Ec.compare=r6;function Ck(r,e){return r.length===0||e.length===0?!1:r6(r,e)!==0}o(Ck,"equal");Ec.equal=Ck});var i6=de(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});var kk=Jm(),dd=xn();is.DIGEST_LENGTH=16;var n6=function(){function r(e){this.digestLength=is.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var t=e[0]|e[1]<<8;this._r[0]=t&8191;var n=e[2]|e[3]<<8;this._r[1]=(t>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var a=e[8]|e[9]<<8;this._r[4]=(s>>>4|a<<12)&255,this._r[5]=a>>>1&8190;var c=e[10]|e[11]<<8;this._r[6]=(a>>>14|c<<2)&8191;var f=e[12]|e[13]<<8;this._r[7]=(c>>>11|f<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(f>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return o(r,"Poly1305"),r.prototype._blocks=function(e,t,n){for(var i=this._fin?0:2048,s=this._h[0],a=this._h[1],c=this._h[2],f=this._h[3],l=this._h[4],h=this._h[5],d=this._h[6],v=this._h[7],x=this._h[8],y=this._h[9],_=this._r[0],U=this._r[1],E=this._r[2],L=this._r[3],H=this._r[4],F=this._r[5],j=this._r[6],D=this._r[7],B=this._r[8],R=this._r[9];n>=16;){var Y=e[t+0]|e[t+1]<<8;s+=Y&8191;var b=e[t+2]|e[t+3]<<8;a+=(Y>>>13|b<<3)&8191;var u=e[t+4]|e[t+5]<<8;c+=(b>>>10|u<<6)&8191;var p=e[t+6]|e[t+7]<<8;f+=(u>>>7|p<<9)&8191;var m=e[t+8]|e[t+9]<<8;l+=(p>>>4|m<<12)&8191,h+=m>>>1&8191;var w=e[t+10]|e[t+11]<<8;d+=(m>>>14|w<<2)&8191;var S=e[t+12]|e[t+13]<<8;v+=(w>>>11|S<<5)&8191;var N=e[t+14]|e[t+15]<<8;x+=(S>>>8|N<<8)&8191,y+=N>>>5|i;var I=0,k=I;k+=s*_,k+=a*(5*R),k+=c*(5*B),k+=f*(5*D),k+=l*(5*j),I=k>>>13,k&=8191,k+=h*(5*F),k+=d*(5*H),k+=v*(5*L),k+=x*(5*E),k+=y*(5*U),I+=k>>>13,k&=8191;var g=I;g+=s*U,g+=a*_,g+=c*(5*R),g+=f*(5*B),g+=l*(5*D),I=g>>>13,g&=8191,g+=h*(5*j),g+=d*(5*F),g+=v*(5*H),g+=x*(5*L),g+=y*(5*E),I+=g>>>13,g&=8191;var C=I;C+=s*E,C+=a*U,C+=c*_,C+=f*(5*R),C+=l*(5*B),I=C>>>13,C&=8191,C+=h*(5*D),C+=d*(5*j),C+=v*(5*F),C+=x*(5*H),C+=y*(5*L),I+=C>>>13,C&=8191;var Z=I;Z+=s*L,Z+=a*E,Z+=c*U,Z+=f*_,Z+=l*(5*R),I=Z>>>13,Z&=8191,Z+=h*(5*B),Z+=d*(5*D),Z+=v*(5*j),Z+=x*(5*F),Z+=y*(5*H),I+=Z>>>13,Z&=8191;var V=I;V+=s*H,V+=a*L,V+=c*E,V+=f*U,V+=l*_,I=V>>>13,V&=8191,V+=h*(5*R),V+=d*(5*B),V+=v*(5*D),V+=x*(5*j),V+=y*(5*F),I+=V>>>13,V&=8191;var K=I;K+=s*F,K+=a*H,K+=c*L,K+=f*E,K+=l*U,I=K>>>13,K&=8191,K+=h*_,K+=d*(5*R),K+=v*(5*B),K+=x*(5*D),K+=y*(5*j),I+=K>>>13,K&=8191;var fe=I;fe+=s*j,fe+=a*F,fe+=c*H,fe+=f*L,fe+=l*E,I=fe>>>13,fe&=8191,fe+=h*U,fe+=d*_,fe+=v*(5*R),fe+=x*(5*B),fe+=y*(5*D),I+=fe>>>13,fe&=8191;var A=I;A+=s*D,A+=a*j,A+=c*F,A+=f*H,A+=l*L,I=A>>>13,A&=8191,A+=h*E,A+=d*U,A+=v*_,A+=x*(5*R),A+=y*(5*B),I+=A>>>13,A&=8191;var X=I;X+=s*B,X+=a*D,X+=c*j,X+=f*F,X+=l*H,I=X>>>13,X&=8191,X+=h*L,X+=d*E,X+=v*U,X+=x*_,X+=y*(5*R),I+=X>>>13,X&=8191;var Q=I;Q+=s*R,Q+=a*B,Q+=c*D,Q+=f*j,Q+=l*F,I=Q>>>13,Q&=8191,Q+=h*H,Q+=d*L,Q+=v*E,Q+=x*U,Q+=y*_,I+=Q>>>13,Q&=8191,I=(I<<2)+I|0,I=I+k|0,k=I&8191,I=I>>>13,g+=I,s=k,a=g,c=C,f=Z,l=V,h=K,d=fe,v=A,x=X,y=Q,t+=16,n-=16}this._h[0]=s,this._h[1]=a,this._h[2]=c,this._h[3]=f,this._h[4]=l,this._h[5]=h,this._h[6]=d,this._h[7]=v,this._h[8]=x,this._h[9]=y},r.prototype.finish=function(e,t){t===void 0&&(t=0);var n=new Uint16Array(10),i,s,a,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=1<<13,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,a=this._h[0]+this._pad[0],this._h[0]=a&65535,c=1;c<8;c++)a=(this._h[c]+this._pad[c]|0)+(a>>>16)|0,this._h[c]=a&65535;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s<i;s++)this._buffer[this._leftover+s]=e[t+s];if(n-=i,t+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,t,i),t+=i,n-=i),n){for(var s=0;s<n;s++)this._buffer[this._leftover+s]=e[t+s];this._leftover+=n}return this},r.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},r.prototype.clean=function(){return dd.wipe(this._buffer),dd.wipe(this._r),dd.wipe(this._h),dd.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},r}();is.Poly1305=n6;function Tk(r,e){var t=new n6(r);t.update(e);var n=t.digest();return t.clean(),n}o(Tk,"oneTimeAuth");is.oneTimeAuth=Tk;function Mk(r,e){return r.length!==is.DIGEST_LENGTH||e.length!==is.DIGEST_LENGTH?!1:kk.equal(r,e)}o(Mk,"equal");is.equal=Mk});var a6=de(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});var pd=Gm(),Bk=i6(),Cu=xn(),s6=Yo(),Ik=Jm();ss.KEY_LENGTH=32;ss.NONCE_LENGTH=12;ss.TAG_LENGTH=16;var o6=new Uint8Array(16),Nk=function(){function r(e){if(this.nonceLength=ss.NONCE_LENGTH,this.tagLength=ss.TAG_LENGTH,e.length!==ss.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return o(r,"ChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);pd.stream(this._key,s,a,4);var c=t.length+this.tagLength,f;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");f=i}else f=new Uint8Array(c);return pd.streamXOR(this._key,s,t,f,4),this._authenticate(f.subarray(f.length-this.tagLength,f.length),a,f.subarray(0,f.length-this.tagLength),n),Cu.wipe(s),f},r.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);pd.stream(this._key,s,a,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,a,t.subarray(0,t.length-this.tagLength),n),!Ik.equal(c,t.subarray(t.length-this.tagLength,t.length)))return null;var f=t.length-this.tagLength,l;if(i){if(i.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(f);return pd.streamXOR(this._key,s,t.subarray(0,t.length-this.tagLength),l,4),Cu.wipe(s),l},r.prototype.clean=function(){return Cu.wipe(this._key),this},r.prototype._authenticate=function(e,t,n,i){var s=new Bk.Poly1305(t);i&&(s.update(i),i.length%16>0&&s.update(o6.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(o6.subarray(n.length%16));var a=new Uint8Array(8);i&&s6.writeUint64LE(i.length,a),s.update(a),s6.writeUint64LE(n.length,a),s.update(a);for(var c=s.digest(),f=0;f<c.length;f++)e[f]=c[f];s.clean(),Cu.wipe(c),Cu.wipe(a)},r}();ss.ChaCha20Poly1305=Nk});var u6=de(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});var c6=t6(),f6=a6(),ku=xn();os.KEY_LENGTH=32;os.NONCE_LENGTH=24;os.TAG_LENGTH=16;var Ok=function(){function r(e){if(this.nonceLength=os.NONCE_LENGTH,this.tagLength=os.TAG_LENGTH,e.length!==os.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return o(r,"XChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");var s=c6.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var c=new f6.ChaCha20Poly1305(s),f=c.seal(a,t,n,i);return ku.wipe(s),ku.wipe(a),c.clean(),f},r.prototype.open=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=c6.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var c=new f6.ChaCha20Poly1305(s),f=c.open(a,t,n,i);return ku.wipe(s),ku.wipe(a),c.clean(),f},r.prototype.clean=function(){return ku.wipe(this._key),this},r}();os.XChaCha20Poly1305=Ok});var Qn=de(($K,Z3)=>{Z3.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}});var Uu=de((FK,Q3)=>{Q3.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}});var rx=de(lr=>{var ex=lr,Od=4294967292,Pd=4294967293,_1=4294967294,tx=4294967295,ve=[0,1,3,7,15,31,63,127,255,511,1023],bo=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],QT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),cn=[];QT.forEach(r=>{cn.push(r.charCodeAt(0))});lr.utf8={encode(r){let e=[];return r.forEach(t=>{if(t>=0&&t<=127)e.push(t);else if(t<=2047)e.push(192+(t>>6&ve[5])),e.push(128+(t&ve[6]));else if(t<55296||t>57343&&t<=65535)e.push(224+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]));else if(t>=65536&&t<=1114111){let n=t>>16&ve[5];e.push(240+(n>>2)),e.push(128+((n&ve[2])<<4)+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]))}else throw new RangeError(`utf8.encode: character out of range: char: ${t}`)}),Buffer.from(e)},decode(r,e){function t(y,_){if((_&192)!==128)return Pd;let U=((y&ve[5])<<6)+(_&ve[6]);return U<128?Od:U}o(t,"bytes2");function n(y,_,U){if((U&192)!==128||(_&192)!==128)return Pd;let E=((y&ve[4])<<12)+((_&ve[6])<<6)+(U&ve[6]);return E<2048?Od:E>=55296&&E<=57343?_1:E}o(n,"bytes3");function i(y,_,U,E){if((E&192)!==128||(U&192)!==128||(_&192)!==128)return Pd;let L=(((y&ve[3])<<2)+(_>>4&ve[2])<<16)+((_&ve[4])<<12)+((U&ve[6])<<6)+(E&ve[6]);return L<65536?Od:L>1114111?_1:L}o(i,"bytes4");let s,a,c,f,l,h,d=r.length,v=e?3:0,x=[];for(;v<d;){a=r[v],s=tx;let y=!0;for(;y;){if(a>=0&&a<=127){s=a,h=1;break}if(c=v+1,c<d&&a>=194&&a<=223){s=t(a,r[c]),h=2;break}if(f=v+2,f<d&&a>=224&&a<=239){s=n(a,r[c],r[f]),h=3;break}if(l=v+3,l<d&&a>=240&&a<=244){s=i(a,r[c],r[f],r[l]),h=4;break}break}if(s>1114111){let _=`byte[${v}]`;throw s===tx?new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${_}`):s===Pd?new RangeError(`utf8.decode: illegal trailing byte found at: ${_}`):s===_1?new RangeError(`utf8.decode: code point out of range found at: ${_}`):s===Od?new RangeError(`utf8.decode: non-shortest form found at: ${_}`):new RangeError(`utf8.decode: unrecognized error found at: ${_}`)}x.push(s),v+=h}return x}};lr.utf16be={encode(r){let e=[],t,n,i;for(let s=0;s<r.length;s+=1)if(t=r[s],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t>>8&ve[8]),e.push(t&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n>>8&ve[8]),e.push(n&ve[8]),e.push(i>>8&ve[8]),e.push(i&ve[8]);else throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${s}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,s=0,a,c,f,l,h,d;for(;i<n;){for(;;){if(f=i+1,f<n){if(h=(r[i]<<8)+r[f],h<55296||h>57343){a=h,c=2;break}if(l=i+3,l<n&&(d=(r[i+2]<<8)+r[l],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),c=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${i}]`)}t[s++]=a,i+=c}return t}};lr.utf16le={encode(r){let e=[],t,n,i;for(let s=0;s<r.length;s+=1)if(t=r[s],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t&ve[8]),e.push(t>>8&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n&ve[8]),e.push(n>>8&ve[8]),e.push(i&ve[8]),e.push(i>>8&ve[8]);else throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${s}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,s=0,a,c,f,l,h,d;for(;i<n;){for(;;){if(f=i+1,f<n){if(h=(r[f]<<8)+r[i],h<55296||h>57343){a=h,c=2;break}if(l=i+3,l<n&&(d=(r[l]<<8)+r[i+2],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),c=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${i}]`)}t[s++]=a,i+=c}return t}};lr.utf32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${t/4}]: ${n}`);e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n]<<24)+(r[n+1]<<16)+(r[n+2]<<8)+r[n+3];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};lr.utf32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${t/4}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n+3]<<24)+(r[n+2]<<16)+(r[n+1]<<8)+r[n];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};lr.uint7={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${t}]: ${r[t]}`);e[t]=r[t]}return e}};lr.uint8={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1)e[t]=r[t];return e}};lr.uint16be={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${t/2}]: ${n}`);e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t]<<8)+r[t+1]);return e}};lr.uint16le={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${t/2}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t+1]<<8)+r[t]);return e}};lr.uint32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t]<<24)+(r[t+1]<<16)+(r[t+2]<<8)+r[t+3]);return e}};lr.uint32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t+3]<<24)+(r[t+2]<<16)+(r[t+1]<<8)+r[t]);return e}};lr.string={encode(r){return ex.utf16le.encode(r).toString("utf16le")},decode(r){return ex.utf16le.decode(Buffer.from(r,"utf16le"),0)}};lr.escaped={encode(r){let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if(n===96)e.push(n),e.push(n);else if(n===10)e.push(n);else if(n>=32&&n<=126)e.push(n);else{let i="";if(n>=0&&n<=31)i+=`\`x${bo[n]}`;else if(n>=127&&n<=255)i+=`\`x${bo[n]}`;else if(n>=256&&n<=65535)i+=`\`u${bo[n>>8&ve[8]]}${bo[n&ve[8]]}`;else if(n>=65536&&n<=4294967295){i+="`u{";let a=n>>24&ve[8];a>0&&(i+=bo[a]),i+=`${bo[n>>16&ve[8]]+bo[n>>8&ve[8]]+bo[n&ve[8]]}}`}else throw new Error("escape.encode(char): char > 0xffffffff not allowed");Buffer.from(i).forEach(a=>{e.push(a)})}}return Buffer.from(e)},decode(r){function e(d){return d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102}o(e,"isHex");function t(d,v,x){let y={char:null,nexti:d+2,error:!0};if(d+1<v&&e(x[d])&&e(x[d+1])){let _=String.fromCodePoint(x[d],x[d+1]);y.char=parseInt(_,16),Number.isNaN(y.char)||(y.error=!1)}return y}o(t,"getx");function n(d,v,x){let y={char:null,nexti:d+4,error:!0};if(d+3<v&&e(x[d])&&e(x[d+1])&&e(x[d+2])&&e(x[d+3])){let _=String.fromCodePoint(x[d],x[d+1],x[d+2],x[d+3]);y.char=parseInt(_,16),Number.isNaN(y.char)||(y.error=!1)}return y}o(n,"getu");function i(d,v,x){let y={char:null,nexti:d+4,error:!0},_="";for(;d<v&&e(x[d]);)_+=String.fromCodePoint(x[d]),d+=1;return y.char=parseInt(_,16),x[d]===125&&!Number.isNaN(y.char)&&(y.error=!1),y.nexti=d+1,y}o(i,"getU");let s=[],a=r.length,c,f,l,h=0;for(;h<a;){for(;;){if(l=!0,r[h]!==96){s.push(r[h]),h+=1,l=!1;break}if(c=h+1,c>=a)break;if(r[c]===96){s.push(96),h+=2,l=!1;break}if(r[c]===120){if(f=t(c+1,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}if(r[c]===117){if(r[c+1]===123){if(f=i(c+2,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}if(f=n(c+1,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}break}if(l)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${h}]`)}return s}};var Lu=13,Mn=10;lr.lineEnds={crlf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Lu:t+1<r.length&&r[t+1]===Mn?t+=2:t+=1,e.push(Lu),e.push(Mn);break;case Mn:e.push(Lu),e.push(Mn),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==Mn&&(e.push(Lu),e.push(Mn)),e},lf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Lu:t+1<r.length&&r[t+1]===Mn?t+=2:t+=1,e.push(Mn);break;case Mn:e.push(Mn),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==Mn&&e.push(Mn),e}};lr.base64={encode(r){if(r.length===0)return Buffer.alloc(0);let e,t,n,i=r.length%3;i=i>0?3-i:0;let s=(r.length+i)/3,a=Buffer.alloc(s*4);i>0&&(s-=1),e=0,t=0;for(let c=0;c<s;c+=1)n=r[e++]<<16,n+=r[e++]<<8,n+=r[e++],a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[n>>6&ve[6]],a[t++]=cn[n&ve[6]];if(i===0)return a;if(i===1)return n=r[e++]<<16,n+=r[e]<<8,a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[n>>6&ve[6]],a[t]=cn[64],a;if(i===2)return n=r[e]<<16,a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[64],a[t]=cn[64],a},decode(r){function e(h){let d=[],v=0;for(let x=0;x<h.length;x+=1){let y=h[x],_=!0;for(;_&&!(y===32||y===9||y===10||y===13);){if(y>=65&&y<=90){d.push(y-65);break}if(y>=97&&y<=122){d.push(y-71);break}if(y>=48&&y<=57){d.push(y+4);break}if(y===43){d.push(62);break}if(y===47){d.push(63);break}if(y===61){d.push(64),v+=1;break}throw new RangeError(`base64.decode: invalid character buf[${x}]: ${y}`)}}if(d.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${d.length}`);switch(v){case 0:break;case 1:if(d[d.length-1]!==64)throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(d[d.length-1]!==64||d[d.length-2]!==64)throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${v}`)}return{tail:v,buf:Buffer.from(d)}}if(o(e,"validate"),r.length===0)return Buffer.alloc(0);let t=e(r),{tail:n}=t,i=t.buf,s,a,c,f=i.length/4,l=Buffer.alloc(f*3-n);n>0&&(f-=1),a=0,s=0;for(let h=0;h<f;h+=1)c=i[s++]<<18,c+=i[s++]<<12,c+=i[s++]<<6,c+=i[s++],l[a++]=c>>16&ve[8],l[a++]=c>>8&ve[8],l[a++]=c&ve[8];return n===1&&(c=i[s++]<<18,c+=i[s++]<<12,c+=i[s]<<6,l[a++]=c>>16&ve[8],l[a]=c>>8&ve[8]),n===2&&(c=i[s++]<<18,c+=i[s++]<<12,l[a]=c>>16&ve[8]),l},toString(r){if(r.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${r.length}`);let e="",t=0;function n(s,a,c,f){switch(t){case 76:e+=`\r
|
16
|
+
${s}${a}${c}${f}`,t=4;break;case 75:e+=`${s}\r
|
17
|
+
${a}${c}${f}`,t=3;break;case 74:e+=`${s+a}\r
|
18
|
+
${c}${f}`,t=2;break;case 73:e+=`${s+a+c}\r
|
19
|
+
${f}`,t=1;break;default:e+=s+a+c+f,t+=4;break}}o(n,"buildLine");function i(s){return s>=65&&s<=90||s>=97&&s<=122||s>=48&&s<=57||s===43||s===47||s===61}o(i,"validate");for(let s=0;s<r.length;s+=4){for(let a=s;a<s+4;a+=1)if(!i(r[a]))throw new RangeError(`base64.toString: buf[${a}]: ${r[a]} : not valid base64 character code`);n(String.fromCharCode(r[s]),String.fromCharCode(r[s+1]),String.fromCharCode(r[s+2]),String.fromCharCode(r[s+3]))}return e}}});var C1=de(Ku=>{var nx=Ku,et=rx(),Du="UTF8",E1="UTF16",Si="UTF16BE",fs="UTF16LE",S1="UTF32",Ci="UTF32BE",us="UTF32LE",Nc="UINT7",ix="ASCII",sx="BINARY",Oc="UINT8",ox="UINT16",Rd="UINT16LE",Pc="UINT16BE",ax="UINT32",Ud="UINT32LE",Rc="UINT32BE",Ld="ESCAPED",go="STRING",eM=o(function(e){e.type=Du;let t=e.data;e.bom=0,t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191&&(e.bom=3)},"bom8"),tM=o(function(e){let t=e.data;switch(e.bom=0,e.type){case E1:e.type=Si,t.length>=2&&(t[0]===254&&t[1]===255?e.bom=2:t[0]===255&&t[1]===254&&(e.type=fs,e.bom=2));break;case Si:if(e.type=Si,t.length>=2){if(t[0]===254&&t[1]===255)e.bom=2;else if(t[0]===255&&t[1]===254)throw new TypeError(`src type: "${Si}" specified but BOM is for "${fs}"`)}break;case fs:if(e.type=fs,t.length>=0){if(t[0]===254&&t[1]===255)throw new TypeError(`src type: "${fs}" specified but BOM is for "${Si}"`);t[0]===255&&t[1]===254&&(e.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${e.type}" unrecognized`)}},"bom16"),rM=o(function(e){let t=e.data;switch(e.bom=0,e.type){case S1:e.type=Ci,t.length>=4&&(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255&&(e.bom=4),t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0&&(e.type=us,e.bom=4));break;case Ci:if(e.type=Ci,t.length>=4&&(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255&&(e.bom=4),t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0))throw new TypeError(`src type: ${Ci} specified but BOM is for ${us}"`);break;case us:if(e.type=us,t.length>=4){if(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255)throw new TypeError(`src type: "${us}" specified but BOM is for "${Ci}"`);t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0&&(e.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${e.type}" unrecognized`)}},"bom32"),nM=o(function(e,t){function n(s){let a={type:"",base64:!1},f=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(s);return f&&(f[2]&&(a.type=f[2].toUpperCase()),f[1]&&(a.base64=!0)),a}if(o(n,"getType"),typeof e!="string"||e==="")throw new TypeError(`type: "${e}" not recognized`);let i=n(e.toUpperCase());if(i.base64){if(i.type===go)throw new TypeError(`type: "${e} "BASE64:" prefix not allowed with type ${go}`);if(Buffer.isBuffer(t))i.data=et.base64.decode(t);else if(typeof t=="string"){let s=Buffer.from(t,"ascii");i.data=et.base64.decode(s)}else throw new TypeError(`type: "${e} unrecognized data type: typeof(data): ${typeof t}`)}else i.data=t;switch(i.type){case Du:eM(i);break;case E1:case Si:case fs:tM(i);break;case S1:case Ci:case us:rM(i);break;case ox:i.type=Pc;break;case ax:i.type=Rc;break;case ix:i.type=Nc;break;case sx:i.type=Oc;break;case Nc:case Oc:case Rd:case Pc:case Ud:case Rc:case go:case Ld:break;default:throw new TypeError(`type: "${e}" not recognized`)}if(i.type===go){if(typeof i.data!="string")throw new TypeError(`type: "${e}" but data is not a string`)}else if(!Buffer.isBuffer(i.data))throw new TypeError(`type: "${e}" but data is not a Buffer`);return i},"validateSrc"),iM=o(function(e,t){function n(s){let a,c,f={crlf:!1,lf:!1,base64:!1,type:""},l=!0;for(;l;){if(c=s,a=s.slice(0,5),a==="CRLF:"){f.crlf=!0,c=s.slice(5);break}if(a=s.slice(0,3),a==="LF:"){f.lf=!0,c=s.slice(3);break}break}return a=c.split(":"),a.length===1?f.type=a[0]:a.length===2&&a[1]==="BASE64"&&(f.base64=!0,f.type=a[0]),f}if(o(n,"getType"),!Array.isArray(t))throw new TypeError(`dst chars: not array: "${typeof t}`);if(typeof e!="string")throw new TypeError(`dst type: not string: "${typeof e}`);let i=n(e.toUpperCase());switch(i.type){case Du:case Si:case fs:case Ci:case us:case Nc:case Oc:case Rd:case Pc:case Ud:case Rc:case Ld:break;case go:if(i.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${go}`);break;case ix:i.type=Nc;break;case sx:i.type=Oc;break;case E1:i.type=Si;break;case S1:i.type=Ci;break;case ox:i.type=Pc;break;case ax:i.type=Rc;break;default:throw new TypeError(`dst type unrecognized: "${e}" : must have form [crlf:|lf:]type[:base64]`)}return i},"validateDst"),A1=o(function(e,t){switch(e){case Du:return et.utf8.encode(t);case Si:return et.utf16be.encode(t);case fs:return et.utf16le.encode(t);case Ci:return et.utf32be.encode(t);case us:return et.utf32le.encode(t);case Nc:return et.uint7.encode(t);case Oc:return et.uint8.encode(t);case Pc:return et.uint16be.encode(t);case Rd:return et.uint16le.encode(t);case Rc:return et.uint32be.encode(t);case Ud:return et.uint32le.encode(t);case go:return et.string.encode(t);case Ld:return et.escaped.encode(t);default:throw new TypeError(`encode type "${e}" not recognized`)}},"encode"),sM=o(function(e){switch(e.type){case Du:return et.utf8.decode(e.data,e.bom);case fs:return et.utf16le.decode(e.data,e.bom);case Si:return et.utf16be.decode(e.data,e.bom);case Ci:return et.utf32be.decode(e.data,e.bom);case us:return et.utf32le.decode(e.data,e.bom);case Nc:return et.uint7.decode(e.data);case Oc:return et.uint8.decode(e.data);case Pc:return et.uint16be.decode(e.data);case Rd:return et.uint16le.decode(e.data);case Rc:return et.uint32be.decode(e.data);case Ud:return et.uint32le.decode(e.data);case go:return et.string.decode(e.data);case Ld:return et.escaped.decode(e.data);default:throw new TypeError(`decode type "${e.type}" not recognized`)}},"decode");Ku.decode=o(function(e,t){let n=nM(e,t);return sM(n)},"exportsDecode");Ku.encode=o(function(e,t){let n,i,s=iM(e,t);return s.crlf?(n=et.lineEnds.crlf(t),i=A1(s.type,n)):s.lf?(n=et.lineEnds.lf(t),i=A1(s.type,n)):i=A1(s.type,t),s.base64&&(i=et.base64.encode(i)),i},"exportsEncode");Ku.convert=o(function(e,t,n){return nx.encode(n,nx.decode(e,t))},"convert")});var k1=de((zK,cx)=>{cx.exports=o(function(){return`/* This file automatically generated by jsonToless() and LESS. */
|
20
|
+
.apg-mono {
|
21
|
+
font-family: monospace;
|
22
|
+
}
|
23
|
+
.apg-active {
|
24
|
+
font-weight: bold;
|
25
|
+
color: #000000;
|
26
|
+
}
|
27
|
+
.apg-match {
|
28
|
+
font-weight: bold;
|
29
|
+
color: #264BFF;
|
30
|
+
}
|
31
|
+
.apg-empty {
|
32
|
+
font-weight: bold;
|
33
|
+
color: #0fbd0f;
|
34
|
+
}
|
35
|
+
.apg-nomatch {
|
36
|
+
font-weight: bold;
|
37
|
+
color: #FF4000;
|
38
|
+
}
|
39
|
+
.apg-lh-match {
|
40
|
+
font-weight: bold;
|
41
|
+
color: #1A97BA;
|
42
|
+
}
|
43
|
+
.apg-lb-match {
|
44
|
+
font-weight: bold;
|
45
|
+
color: #5F1687;
|
46
|
+
}
|
47
|
+
.apg-remainder {
|
48
|
+
font-weight: bold;
|
49
|
+
color: #999999;
|
50
|
+
}
|
51
|
+
.apg-ctrl-char {
|
52
|
+
font-weight: bolder;
|
53
|
+
font-style: italic;
|
54
|
+
font-size: 0.6em;
|
55
|
+
}
|
56
|
+
.apg-line-end {
|
57
|
+
font-weight: bold;
|
58
|
+
color: #000000;
|
59
|
+
}
|
60
|
+
.apg-error {
|
61
|
+
font-weight: bold;
|
62
|
+
color: #FF4000;
|
63
|
+
}
|
64
|
+
.apg-phrase {
|
65
|
+
color: #000000;
|
66
|
+
background-color: #8caae6;
|
67
|
+
}
|
68
|
+
.apg-empty-phrase {
|
69
|
+
color: #0fbd0f;
|
70
|
+
}
|
71
|
+
table.apg-state {
|
72
|
+
font-family: monospace;
|
73
|
+
margin-top: 5px;
|
74
|
+
font-size: 11px;
|
75
|
+
line-height: 130%;
|
76
|
+
text-align: left;
|
77
|
+
border: 1px solid black;
|
78
|
+
border-collapse: collapse;
|
79
|
+
}
|
80
|
+
table.apg-state th,
|
81
|
+
table.apg-state td {
|
82
|
+
text-align: left;
|
83
|
+
border: 1px solid black;
|
84
|
+
border-collapse: collapse;
|
85
|
+
}
|
86
|
+
table.apg-state th:nth-last-child(2),
|
87
|
+
table.apg-state td:nth-last-child(2) {
|
88
|
+
text-align: right;
|
89
|
+
}
|
90
|
+
table.apg-state caption {
|
91
|
+
font-size: 125%;
|
92
|
+
line-height: 130%;
|
93
|
+
font-weight: bold;
|
94
|
+
text-align: left;
|
95
|
+
}
|
96
|
+
table.apg-stats {
|
97
|
+
font-family: monospace;
|
98
|
+
margin-top: 5px;
|
99
|
+
font-size: 11px;
|
100
|
+
line-height: 130%;
|
101
|
+
text-align: right;
|
102
|
+
border: 1px solid black;
|
103
|
+
border-collapse: collapse;
|
104
|
+
}
|
105
|
+
table.apg-stats th,
|
106
|
+
table.apg-stats td {
|
107
|
+
text-align: right;
|
108
|
+
border: 1px solid black;
|
109
|
+
border-collapse: collapse;
|
110
|
+
}
|
111
|
+
table.apg-stats caption {
|
112
|
+
font-size: 125%;
|
113
|
+
line-height: 130%;
|
114
|
+
font-weight: bold;
|
115
|
+
text-align: left;
|
116
|
+
}
|
117
|
+
table.apg-trace {
|
118
|
+
font-family: monospace;
|
119
|
+
margin-top: 5px;
|
120
|
+
font-size: 11px;
|
121
|
+
line-height: 130%;
|
122
|
+
text-align: right;
|
123
|
+
border: 1px solid black;
|
124
|
+
border-collapse: collapse;
|
125
|
+
}
|
126
|
+
table.apg-trace caption {
|
127
|
+
font-size: 125%;
|
128
|
+
line-height: 130%;
|
129
|
+
font-weight: bold;
|
130
|
+
text-align: left;
|
131
|
+
}
|
132
|
+
table.apg-trace th,
|
133
|
+
table.apg-trace td {
|
134
|
+
text-align: right;
|
135
|
+
border: 1px solid black;
|
136
|
+
border-collapse: collapse;
|
137
|
+
}
|
138
|
+
table.apg-trace th:last-child,
|
139
|
+
table.apg-trace th:nth-last-child(2),
|
140
|
+
table.apg-trace td:last-child,
|
141
|
+
table.apg-trace td:nth-last-child(2) {
|
142
|
+
text-align: left;
|
143
|
+
}
|
144
|
+
table.apg-grammar {
|
145
|
+
font-family: monospace;
|
146
|
+
margin-top: 5px;
|
147
|
+
font-size: 11px;
|
148
|
+
line-height: 130%;
|
149
|
+
text-align: right;
|
150
|
+
border: 1px solid black;
|
151
|
+
border-collapse: collapse;
|
152
|
+
}
|
153
|
+
table.apg-grammar caption {
|
154
|
+
font-size: 125%;
|
155
|
+
line-height: 130%;
|
156
|
+
font-weight: bold;
|
157
|
+
text-align: left;
|
158
|
+
}
|
159
|
+
table.apg-grammar th,
|
160
|
+
table.apg-grammar td {
|
161
|
+
text-align: right;
|
162
|
+
border: 1px solid black;
|
163
|
+
border-collapse: collapse;
|
164
|
+
}
|
165
|
+
table.apg-grammar th:last-child,
|
166
|
+
table.apg-grammar td:last-child {
|
167
|
+
text-align: left;
|
168
|
+
}
|
169
|
+
table.apg-rules {
|
170
|
+
font-family: monospace;
|
171
|
+
margin-top: 5px;
|
172
|
+
font-size: 11px;
|
173
|
+
line-height: 130%;
|
174
|
+
text-align: right;
|
175
|
+
border: 1px solid black;
|
176
|
+
border-collapse: collapse;
|
177
|
+
}
|
178
|
+
table.apg-rules caption {
|
179
|
+
font-size: 125%;
|
180
|
+
line-height: 130%;
|
181
|
+
font-weight: bold;
|
182
|
+
text-align: left;
|
183
|
+
}
|
184
|
+
table.apg-rules th,
|
185
|
+
table.apg-rules td {
|
186
|
+
text-align: right;
|
187
|
+
border: 1px solid black;
|
188
|
+
border-collapse: collapse;
|
189
|
+
}
|
190
|
+
table.apg-rules a {
|
191
|
+
color: #003399 !important;
|
192
|
+
}
|
193
|
+
table.apg-rules a:hover {
|
194
|
+
color: #8caae6 !important;
|
195
|
+
}
|
196
|
+
table.apg-attrs {
|
197
|
+
font-family: monospace;
|
198
|
+
margin-top: 5px;
|
199
|
+
font-size: 11px;
|
200
|
+
line-height: 130%;
|
201
|
+
text-align: center;
|
202
|
+
border: 1px solid black;
|
203
|
+
border-collapse: collapse;
|
204
|
+
}
|
205
|
+
table.apg-attrs caption {
|
206
|
+
font-size: 125%;
|
207
|
+
line-height: 130%;
|
208
|
+
font-weight: bold;
|
209
|
+
text-align: left;
|
210
|
+
}
|
211
|
+
table.apg-attrs th,
|
212
|
+
table.apg-attrs td {
|
213
|
+
text-align: center;
|
214
|
+
border: 1px solid black;
|
215
|
+
border-collapse: collapse;
|
216
|
+
}
|
217
|
+
table.apg-attrs th:nth-child(1),
|
218
|
+
table.apg-attrs th:nth-child(2),
|
219
|
+
table.apg-attrs th:nth-child(3) {
|
220
|
+
text-align: right;
|
221
|
+
}
|
222
|
+
table.apg-attrs td:nth-child(1),
|
223
|
+
table.apg-attrs td:nth-child(2),
|
224
|
+
table.apg-attrs td:nth-child(3) {
|
225
|
+
text-align: right;
|
226
|
+
}
|
227
|
+
table.apg-attrs a {
|
228
|
+
color: #003399 !important;
|
229
|
+
}
|
230
|
+
table.apg-attrs a:hover {
|
231
|
+
color: #8caae6 !important;
|
232
|
+
}
|
233
|
+
`},"emittcss")});var ha=de(tr=>{var Vr=Uu(),T1=C1(),oM=k1(),Nt=Qn(),yo="utilities.js: ",ls=tr,la=o(function(r,e,t){let n,i=e,s=!0;for(;s;){if(r<=0){i=0,n=0;break}if(typeof i!="number"){i=0,n=r;break}if(i>=r){i=r,n=r;break}if(typeof t!="number"){n=r;break}if(n=i+t,n>r){n=r;break}break}return{beg:i,end:n}},"getBounds");tr.htmlToPage=function(r,e){let t;if(typeof r!="string")throw new Error(`${yo}htmlToPage: input HTML is not a string`);typeof e!="string"?t="htmlToPage":t=e;let n="";return n+=`<!DOCTYPE html>
|
234
|
+
`,n+=`<html lang="en">
|
235
|
+
`,n+=`<head>
|
236
|
+
`,n+=`<meta charset="utf-8">
|
237
|
+
`,n+=`<title>${t}</title>
|
238
|
+
`,n+=`<style>
|
239
|
+
`,n+=oM(),n+=`</style>
|
240
|
+
`,n+=`</head>
|
241
|
+
<body>
|
242
|
+
`,n+=`<p>${new Date}</p>
|
243
|
+
`,n+=r,n+=`</body>
|
244
|
+
</html>
|
245
|
+
`,n};tr.parserResultToHtml=function(r,e){let t=null;typeof e=="string"&&e!==""&&(t=e);let n,i;r.success===!0?n=`<span class="${Vr.CLASS_MATCH}">true</span>`:n=`<span class="${Vr.CLASS_NOMATCH}">false</span>`,r.state===Nt.EMPTY?i=`<span class="${Vr.CLASS_EMPTY}">EMPTY</span>`:r.state===Nt.MATCH?i=`<span class="${Vr.CLASS_MATCH}">MATCH</span>`:r.state===Nt.NOMATCH?i=`<span class="${Vr.CLASS_NOMATCH}">NOMATCH</span>`:i=`<span class="${Vr.CLASS_NOMATCH}">unrecognized</span>`;let s="";return s+=`<table class="${Vr.CLASS_STATE}">
|
246
|
+
`,t&&(s+=`<caption>${t}</caption>
|
247
|
+
`),s+=`<tr><th>state item</th><th>value</th><th>description</th></tr>
|
248
|
+
`,s+=`<tr><td>parser success</td><td>${n}</td>
|
249
|
+
`,s+=`<td><span class="${Vr.CLASS_MATCH}">true</span> if the parse succeeded,
|
250
|
+
`,s+=` <span class="${Vr.CLASS_NOMATCH}">false</span> otherwise`,s+=`<br><i>NOTE: for success, entire string must be matched</i></td></tr>
|
251
|
+
`,s+=`<tr><td>parser state</td><td>${i}</td>
|
252
|
+
`,s+=`<td><span class="${Vr.CLASS_EMPTY}">EMPTY</span>, `,s+=`<span class="${Vr.CLASS_MATCH}">MATCH</span> or
|
253
|
+
`,s+=`<span class="${Vr.CLASS_NOMATCH}">NOMATCH</span></td></tr>
|
254
|
+
`,s+=`<tr><td>string length</td><td>${r.length}</td><td>length of the input (sub)string</td></tr>
|
255
|
+
`,s+=`<tr><td>matched length</td><td>${r.matched}</td><td>number of input string characters matched</td></tr>
|
256
|
+
`,s+=`<tr><td>max matched</td><td>${r.maxMatched}</td><td>maximum number of input string characters matched</td></tr>
|
257
|
+
`,s+=`<tr><td>max tree depth</td><td>${r.maxTreeDepth}</td><td>maximum depth of the parse tree reached</td></tr>
|
258
|
+
`,s+=`<tr><td>node hits</td><td>${r.nodeHits}</td><td>number of parse tree node hits (opcode function calls)</td></tr>
|
259
|
+
`,s+=`<tr><td>input length</td><td>${r.inputLength}</td><td>length of full input string</td></tr>
|
260
|
+
`,s+=`<tr><td>sub-string begin</td><td>${r.subBegin}</td><td>sub-string first character index</td></tr>
|
261
|
+
`,s+=`<tr><td>sub-string end</td><td>${r.subEnd}</td><td>sub-string end-of-string index</td></tr>
|
262
|
+
`,s+=`<tr><td>sub-string length</td><td>${r.subLength}</td><td>sub-string length</td></tr>
|
263
|
+
`,s+=`</table>
|
264
|
+
`,s};tr.charsToString=function(r,e,t){let n,i;if(typeof e=="number"){if(e>=r.length)return"";n=e<0?0:e}else n=0;if(typeof t=="number"){if(t<=0)return"";i=t>r.length-n?r.length:n+t}else i=r.length;return n<i?T1.encode("UTF16LE",r.slice(n,i)).toString("utf16le"):""};tr.stringToChars=function(r){return T1.decode("STRING",r)};tr.opcodeToString=function(r){let e="unknown";switch(r){case Nt.ALT:e="ALT";break;case Nt.CAT:e="CAT";break;case Nt.RNM:e="RNM";break;case Nt.UDT:e="UDT";break;case Nt.AND:e="AND";break;case Nt.NOT:e="NOT";break;case Nt.REP:e="REP";break;case Nt.TRG:e="TRG";break;case Nt.TBS:e="TBS";break;case Nt.TLS:e="TLS";break;case Nt.BKR:e="BKR";break;case Nt.BKA:e="BKA";break;case Nt.BKN:e="BKN";break;case Nt.ABG:e="ABG";break;case Nt.AEN:e="AEN";break;default:throw new Error("unrecognized opcode")}return e};tr.stateToString=function(r){let e="unknown";switch(r){case Nt.ACTIVE:e="ACTIVE";break;case Nt.MATCH:e="MATCH";break;case Nt.EMPTY:e="EMPTY";break;case Nt.NOMATCH:e="NOMATCH";break;default:throw new Error("unrecognized state")}return e};tr.asciiChars=["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"," ","!",""","#","$","%","&","'","(",")","*","+",",","-",".","/","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","[","\","]","^","_","`","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","{","|","}","~","DEL"];tr.charToHex=function(r){let e=r.toString(16).toUpperCase();switch(e.length){case 1:case 3:case 7:e=`0${e}`;break;case 2:case 6:e=`00${e}`;break;case 4:break;case 5:e=`000${e}`;break;default:throw new Error("unrecognized option")}return e};tr.charsToDec=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToDec: input must be an array of integers`);let i=la(r.length,e,t);if(i.end>i.beg){n+=r[i.beg];for(let s=i.beg+1;s<i.end;s+=1)n+=`,${r[s]}`}return n};tr.charsToHex=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToHex: input must be an array of integers`);let i=la(r.length,e,t);if(i.end>i.beg){n+=`\\x${ls.charToHex(r[i.beg])}`;for(let s=i.beg+1;s<i.end;s+=1)n+=`,\\x${ls.charToHex(r[s])}`}return n};tr.charsToHtmlEntities=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToHex: input must be an array of integers`);let i=la(r.length,e,t);if(i.end>i.beg)for(let s=i.beg;s<i.end;s+=1)n+=`&#x${r[s].toString(16)};`;return n};function aM(r){return!(r>=55296&&r<=57343||r>1114111)}o(aM,"isUnicode");tr.charsToUnicode=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToUnicode: input must be an array of integers`);let i=la(r.length,e,t);if(i.end>i.beg)for(let s=i.beg;s<i.end;s+=1)aM(r[s])?n+=`&#${r[s]};`:n+=` U+${ls.charToHex(r[s])}`;return n};tr.charsToJsUnicode=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToJsUnicode: input must be an array of integers`);let i=la(r.length,e,t);if(i.end>i.beg){n+=`\\u${ls.charToHex(r[i.beg])}`;for(let s=i.beg+1;s<i.end;s+=1)n+=`,\\u${ls.charToHex(r[s])}`}return n};tr.charsToAscii=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${yo}charsToAscii: input must be an array of integers`);let i=la(r.length,e,t);for(let s=i.beg;s<i.end;s+=1){let a=r[s];a>=32&&a<=126?n+=String.fromCharCode(a):n+=`\\x${ls.charToHex(a)}`}return n};tr.charsToAsciiHtml=function(r,e,t){if(!Array.isArray(r))throw new Error(`${yo}charsToAsciiHtml: input must be an array of integers`);let n="",i,s=la(r.length,e,t);for(let a=s.beg;a<s.end;a+=1)i=r[a],i<32||i===127?n+=`<span class="${Vr.CLASS_CTRLCHAR}">${ls.asciiChars[i]}</span>`:i>127?n+=`<span class="${Vr.CLASS_CTRLCHAR}">U+${ls.charToHex(i)}</span>`:n+=ls.asciiChars[i];return n};tr.stringToAsciiHtml=function(r){let e=T1.decode("STRING",r);return this.charsToAsciiHtml(e)}});var ux=de((VK,fx)=>{fx.exports=o(function(){let e=Qn(),t=ha(),n="ast.js: ",i=this,s=null,a=null,c=null,f=0,l=[],h=[],d=[],v=[];this.callbacks=[],this.astObject="astObject",this.init=o(function(_,U,E){d.length=0,v.length=0,l.length=0,f=0,s=_,a=U,c=E;let L,H=[];for(L=0;L<s.length;L+=1)H.push(s[L].lower);for(L=0;L<a.length;L+=1)H.push(a[L].lower);for(f=s.length+a.length,L=0;L<f;L+=1)l[L]=!1,h[L]=null;for(let F in i.callbacks){let j=F.toLowerCase();if(L=H.indexOf(j),L<0)throw new Error(`${n}init: node '${F}' not a rule or udt name`);typeof i.callbacks[F]=="function"&&(l[L]=!0,h[L]=i.callbacks[F]),i.callbacks[F]===!0&&(l[L]=!0)}},"init"),this.ruleDefined=o(function(_){return l[_]!==!1},"ruleDefined"),this.udtDefined=o(function(_){return l[s.length+_]!==!1},"udtDefined"),this.down=o(function(_,U){let E=v.length;return d.push(E),v.push({name:U,thisIndex:E,thatIndex:null,state:e.SEM_PRE,callbackIndex:_,phraseIndex:null,phraseLength:null,stack:d.length}),E},"down"),this.up=o(function(_,U,E,L){let H=v.length,F=d.pop();return v.push({name:U,thisIndex:H,thatIndex:F,state:e.SEM_POST,callbackIndex:_,phraseIndex:E,phraseLength:L,stack:d.length}),v[F].thatIndex=H,v[F].phraseIndex=E,v[F].phraseLength=L,H},"up"),this.translate=o(function(_){let U,E,L;for(let H=0;H<v.length;H+=1)L=v[H],E=h[L.callbackIndex],L.state===e.SEM_PRE?E!==null&&(U=E(e.SEM_PRE,c,L.phraseIndex,L.phraseLength,_),U===e.SEM_SKIP&&(H=L.thatIndex)):E!==null&&E(e.SEM_POST,c,L.phraseIndex,L.phraseLength,_)},"translate"),this.setLength=o(function(_){v.length=_,_>0?d.length=v[_-1].stack:d.length=0},"setLength"),this.getLength=o(function(){return v.length},"getLength");function x(y){let _="";for(let U=0;U<y;U+=1)_+=" ";return _}o(x,"indent"),this.toXml=o(function(_){let U=t.charsToDec,E="decimal integer character codes";if(typeof mode=="string"&&_.length>=3){let F=_.slice(0,3).toLowerCase();F==="asc"?(U=t.charsToAscii,E="ASCII for printing characters, hex for non-printing"):F==="hex"?(U=t.charsToHex,E="hexidecimal integer character codes"):F==="uni"&&(U=t.charsToUnicode,E="Unicode UTF-32 integer character codes")}let L="",H=0;return L+=`<?xml version="1.0" encoding="utf-8"?>
|
265
|
+
`,L+=`<root nodes="${v.length/2}" characters="${c.length}">
|
266
|
+
`,L+=`<!-- input string, ${E} -->
|
267
|
+
`,L+=x(H+2),L+=U(c),L+=`
|
268
|
+
`,v.forEach(F=>{F.state===e.SEM_PRE?(H+=1,L+=x(H),L+=`<node name="${F.name}" index="${F.phraseIndex}" length="${F.phraseLength}">
|
269
|
+
`,L+=x(H+2),L+=U(c,F.phraseIndex,F.phraseLength),L+=`
|
270
|
+
`):(L+=x(H),L+=`</node><!-- name="${F.name}" -->
|
271
|
+
`,H-=1)}),L+=`</root>
|
272
|
+
`,L},"toSml"),this.phrases=o(function(){let _={},U,E;for(U=0;U<v.length;U+=1)E=v[U],E.state===e.SEM_PRE&&(Array.isArray(_[E.name])||(_[E.name]=[]),_[E.name].push({index:E.phraseIndex,length:E.phraseLength}));return _},"phrases")},"exportsAst")});var M1=de((GK,lx)=>{lx.exports=o(function(){let e="circular-buffer.js: ",t=-1,n=0;this.init=o(function(s){if(typeof s!="number"||s<=0)throw new Error(`${e}init: circular buffer size must an integer > 0`);n=Math.ceil(s),t=-1},"init"),this.increment=o(function(){return t+=1,(t+n)%n},"increment"),this.maxSize=o(function(){return n},"maxSize"),this.items=o(function(){return t+1},"items"),this.getListIndex=o(function(s){return t===-1||s<0||s>t||t-s>=n?-1:(s+n)%n},"getListIndex"),this.forEach=o(function(s){if(t!==-1){if(t<n){for(let a=0;a<=t;a+=1)s(a,a);return}for(let a=t-n+1;a<=t;a+=1){let c=(a+n)%n;s(c,a)}}},"forEach")},"exportsCircularBuffer")});var dx=de((JK,hx)=>{hx.exports=o(function(){let e=Qn(),t=ha(),n="parser.js: ",i=this,s;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let a=null,c=null,f,l,h,d,v=0,x=0,y=0,_=null,U=null,E=null,L=null,H=null,F=0,j=1/0,D=1/0,B=o(function(G,T,q){let se=`${n}evaluateRule(): `;if(G>=E.length)throw new Error(`${se}rule index: ${G} out of range`);if(T>=h)throw new Error(`${se}phrase index: ${T} out of range`);let{length:ae}=a;a.push({type:e.RNM,index:G}),s(ae,T,q),a.pop()},"evaluateRule"),R=o(function(te,G,T){let q=`${n}evaluateUdt(): `;if(te>=L.length)throw new Error(`${q}udt index: ${te} out of range`);if(G>=h)throw new Error(`${q}phrase index: ${G} out of range`);let{length:se}=a;a.push({type:e.UDT,empty:L[te].empty,index:te}),s(se,G,T),a.pop()},"evaluateUdt"),Y=o(function(){v=0,x=0,y=0,F=0,d=[{lookAround:e.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],E=null,L=null,c=null,f=0,l=0,h=0,_=null,U=null,H=null,a=null},"clear"),b=o(function(){let te=[],G=o(function(){let q={};E.forEach(se=>{se.isBkr&&(q[se.lower]=null)}),L.length>0&&L.forEach(se=>{se.isBkr&&(q[se.lower]=null)}),te.push(q)},"init"),T=o(function(){let q=te[te.length-1],se={};for(let ae in q)se[ae]=q[ae];return se},"copy");this.push=o(function(){te.push(T())},"push"),this.pop=o(function(se){let ae=se;if(ae||(ae=te.length-1),ae<1||ae>te.length)throw new Error(`${n}backRef.pop(): bad length: ${ae}`);return te.length=ae,te[te.length-1]},"pop"),this.length=o(function(){return te.length},"length"),this.savePhrase=o(function(se,ae,he){te[te.length-1][se]={phraseIndex:ae,phraseLength:he}},"savePhrase"),this.getPhrase=function(q){return te[te.length-1][q]},G()},"backRef"),u=o(function(){let G=this;this.state=e.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=d[d.length-1],this.uFrame=new b,this.pFrame=new b,this.evaluateRule=B,this.evaluateUdt=R,this.refresh=o(function(){G.state=e.ACTIVE,G.phraseLength=0,G.lookAround=d[d.length-1]},"refresh")},"systemData"),p=o(function(){return d[d.length-1]},"lookAroundValue"),m=o(function(){return d.length>1},"inLookAround"),w=o(function(){return d[d.length-1].lookAround===e.LOOKAROUND_BEHIND},"inLookBehind"),S=o(function(){let te=`${n}initializeAst(): `,G=!0;for(;G;){if(i.ast===void 0){i.ast=null;break}if(i.ast===null)break;if(i.ast.astObject!=="astObject")throw new Error(`${te}ast object not recognized`);break}i.ast!==null&&i.ast.init(E,L,c)},"initializeAst"),N=o(function(){let te=`${n}initializeTrace(): `,G=!0;for(;G;){if(i.trace===void 0){i.trace=null;break}if(i.trace===null)break;if(i.trace.traceObject!=="traceObject")throw new Error(`${te}trace object not recognized`);break}i.trace!==null&&i.trace.init(E,L,c)},"initializeTrace"),I=o(function(){let te=`${n}initializeStats(): `,G=!0;for(;G;){if(i.stats===void 0){i.stats=null;break}if(i.stats===null)break;if(i.stats.statsObject!=="statsObject")throw new Error(`${te}stats object not recognized`);break}i.stats!==null&&i.stats.init(E,L)},"initializeStats"),k=o(function(te){let G=`${n}initializeGrammar(): `;if(!te)throw new Error(`${G}grammar object undefined`);if(te.grammarObject!=="grammarObject")throw new Error(`${G}bad grammar object`);E=te.rules,L=te.udts},"initializeGrammar"),g=o(function(te){let G=`${n}initializeStartRule(): `,T=null;if(typeof te=="number"){if(te>=E.length)throw new Error(`${G}start rule index too large: max: ${E.length}: index: ${te}`);T=te}else if(typeof te=="string"){let q=te.toLowerCase();for(let se=0;se<E.length;se+=1)if(q===E[se].lower){T=E[se].index;break}if(T===null)throw new Error(`${G}start rule name '${te}' not recognized`)}else throw new Error(`${G}type of start rule '${typeof te}' not recognized`);return T},"initializeStartRule"),C=o(function(G,T,q){let se=`${n}initializeInputChars(): `,ae=G,he=T,ge=q;if(ae===void 0)throw new Error(`${se}input string is undefined`);if(ae===null)throw new Error(`${se}input string is null`);if(typeof ae=="string")ae=t.stringToChars(ae);else if(!Array.isArray(ae))throw new Error(`${se}input string is not a string or array`);if(ae.length>0&&typeof ae[0]!="number")throw new Error(`${se}input string not an array of integers`);if(typeof he!="number")he=0;else if(he=Math.floor(he),he<0||he>ae.length)throw new Error(`${se}input beginning index out of range: ${he}`);if(typeof ge!="number")ge=ae.length-he;else if(ge=Math.floor(ge),ge<0||ge>ae.length-he)throw new Error(`${se}input length out of range: ${ge}`);c=ae,f=he,l=ge,h=f+l},"initializeInputChars"),Z=o(function(){let te=`${n}initializeCallbacks(): `,G;for(_=[],U=[],G=0;G<E.length;G+=1)_[G]=null;for(G=0;G<L.length;G+=1)U[G]=null;let T,q=[];for(G=0;G<E.length;G+=1)q.push(E[G].lower);for(G=0;G<L.length;G+=1)q.push(L[G].lower);for(let se in i.callbacks){if(G=q.indexOf(se.toLowerCase()),G<0)throw new Error(`${te}syntax callback '${se}' not a rule or udt name`);if(T=i.callbacks[se],T||(T=null),typeof T=="function"||T===null)G<E.length?_[G]=T:U[G-E.length]=T;else throw new Error(`${te}syntax callback[${se}] must be function reference or 'false' (false/null/undefined/etc.)`)}for(G=0;G<L.length;G+=1)if(U[G]===null)throw new Error(`${te}all UDT callbacks must be defined. UDT callback[${L[G].lower}] not a function reference`)},"initializeCallbacks");this.setMaxTreeDepth=function(te){if(typeof te!="number")throw new Error(`parser: max tree depth must be integer > 0: ${te}`);if(j=Math.floor(te),j<=0)throw new Error(`parser: max tree depth must be integer > 0: ${te}`)},this.setMaxNodeHits=function(te){if(typeof te!="number")throw new Error(`parser: max node hits must be integer > 0: ${te}`);if(D=Math.floor(te),D<=0)throw new Error(`parser: max node hits must be integer > 0: ${te}`)};let V=o(function(te,G,T){let q,se=`${n}parse(): `;k(te);let ae=g(G);Z(),N(),I(),S();let he=new u;switch(T!=null&&(H=T),a=[{type:e.RNM,index:ae}],s(0,f,he),a=null,he.state){case e.ACTIVE:throw new Error(`${se}final state should never be 'ACTIVE'`);case e.NOMATCH:q=!1;break;case e.EMPTY:case e.MATCH:he.phraseLength===l?q=!0:q=!1;break;default:throw new Error("unrecognized state")}return{success:q,state:he.state,length:l,matched:he.phraseLength,maxMatched:F,maxTreeDepth:x,nodeHits:y,inputLength:c.length,subBegin:f,subEnd:h,subLength:l}},"privateParse");this.parseSubstring=o(function(G,T,q,se,ae,he){return Y(),C(q,se,ae),V(G,T,he)},"parseSubstring"),this.parse=o(function(G,T,q,se){return Y(),C(q,0,q.length),V(G,T,se)},"parse");let K=o(function(te,G,T){let q=a[te];for(let se=0;se<q.children.length&&(s(q.children[se],G,T),T.state===e.NOMATCH);se+=1);},"opALT"),fe=o(function(te,G,T){let q,se,ae,he,ge=a[te],rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(se=i.ast.getLength()),q=!0,ae=G,he=0;for(let Ee=0;Ee<ge.children.length;Ee+=1)if(s(ge.children[Ee],ae,T),T.state===e.NOMATCH){q=!1;break}else ae+=T.phraseLength,he+=T.phraseLength;q?(T.state=he===0?e.EMPTY:e.MATCH,T.phraseLength=he):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(se))},"opCAT"),A=o(function(te,G,T){let q,se,ae,he,ge=a[te];se=G,ae=0,he=0;let rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(se>=h||(s(te+1,se,T),T.state===e.NOMATCH)||T.state===e.EMPTY||(he+=1,ae+=T.phraseLength,se+=T.phraseLength,he===ge.max)););T.state===e.EMPTY||he>=ge.min?(T.state=ae===0?e.EMPTY:e.MATCH,T.phraseLength=ae):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREP"),X=o(function(te,G,T,q){if(G.phraseLength>T){let se=`${n}opRNM(${te.name}): callback function error: `;throw se+=`sysData.phraseLength: ${G.phraseLength}`,se+=` must be <= remaining chars: ${T}`,new Error(se)}switch(G.state){case e.ACTIVE:if(q!==!0)throw new Error(`${n}opRNM(${te.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:G.phraseLength=0;break;case e.MATCH:G.phraseLength===0&&(G.state=e.EMPTY);break;case e.NOMATCH:G.phraseLength=0;break;default:throw new Error(`${n}opRNM(${te.name}): callback function return error. Unrecognized return state: ${G.state}`)}},"validateRnmCallbackResult"),Q=o(function(te,G,T){let q,se,ae,he,ge,rt,Pe=a[te],Ee=E[Pe.index],nt=_[Ee.index],Ge=!m();if(Ge&&(se=i.ast&&i.ast.ruleDefined(Pe.index),se&&(q=i.ast.getLength(),i.ast.down(Pe.index,E[Pe.index].name)),he=T.uFrame.length(),ge=T.pFrame.length(),T.uFrame.push(),T.pFrame.push(),rt=T.pFrame,T.pFrame=new b),nt===null)ae=a,a=Ee.opcodes,s(0,G,T),a=ae;else{let it=h-G;T.ruleIndex=Ee.index,nt(T,c,G,H),X(Ee,T,it,!0),T.state===e.ACTIVE&&(ae=a,a=Ee.opcodes,s(0,G,T),a=ae,T.ruleIndex=Ee.index,nt(T,c,G,H),X(Ee,T,it,!1))}Ge&&(se&&(T.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(Pe.index,Ee.name,G,T.phraseLength)),T.pFrame=rt,T.state===e.NOMATCH?(T.uFrame.pop(he),T.pFrame.pop(ge)):Ee.isBkr&&(T.pFrame.savePhrase(Ee.lower,G,T.phraseLength),T.uFrame.savePhrase(Ee.lower,G,T.phraseLength)))},"opRNM"),P=o(function(te,G,T){if(G.phraseLength>T){let q=`${n}opUDT(${te.name}): callback function error: `;throw q+=`sysData.phraseLength: ${G.phraseLength}`,q+=` must be <= remaining chars: ${T}`,new Error(q)}switch(G.state){case e.ACTIVE:throw new Error(`${n}opUDT(${te.name}): callback function return error. ACTIVE state not allowed.`);case e.EMPTY:if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);G.phraseLength=0;break;case e.MATCH:if(G.phraseLength===0){if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);G.state=e.EMPTY}break;case e.NOMATCH:G.phraseLength=0;break;default:throw new Error(`${n}opUDT(${te.name}): callback function return error. Unrecognized return state: ${G.state}`)}},"validateUdtCallbackResult"),O=o(function(te,G,T){let q,se,ae,he,ge,rt,Pe=a[te],Ee=L[Pe.index];T.UdtIndex=Ee.index;let nt=!m();nt&&(ae=i.ast&&i.ast.udtDefined(Pe.index),ae&&(se=E.length+Pe.index,q=i.ast.getLength(),i.ast.down(se,Ee.name)),he=T.uFrame.length(),ge=T.pFrame.length(),T.uFrame.push(),T.pFrame.push(),rt=T.pFrame,T.pFrame=new b);let Ge=h-G;U[Pe.index](T,c,G,H),P(Ee,T,Ge),nt&&(ae&&(T.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(se,Ee.name,G,T.phraseLength)),T.pFrame=rt,T.state===e.NOMATCH?(T.uFrame.pop(he),T.pFrame.pop(ge)):Ee.isBkr&&(T.pFrame.savePhrase(Ee.lower,G,T.phraseLength),T.uFrame.savePhrase(Ee.lower,G,T.phraseLength)))},"opUDT"),z=o(function(te,G,T){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:G,charsEnd:h,charsLength:l}),h=c.length,l=c.length-f,s(te+1,G,T);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,T.phraseLength=0,T.state){case e.EMPTY:T.state=e.EMPTY;break;case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${T.state}`)}},"opAND"),W=o(function(te,G,T){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:G,charsEnd:h,charsLength:l}),h=c.length,l=c.length-f,s(te+1,G,T);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${T.state}`)}},"opNOT"),re=o(function(te,G,T){let q=a[te];T.state=e.NOMATCH,G<h&&q.min<=c[G]&&c[G]<=q.max&&(T.state=e.MATCH,T.phraseLength=1)},"opTRG"),le=o(function(te,G,T){let q,se=a[te],ae=se.string.length;if(T.state=e.NOMATCH,G+ae<=h){for(q=0;q<ae;q+=1)if(c[G+q]!==se.string[q])return;T.state=e.MATCH,T.phraseLength=ae}},"opTBS"),oe=o(function(te,G,T){let q,se,ae=a[te];T.state=e.NOMATCH;let he=ae.string.length;if(he===0){T.state=e.EMPTY;return}if(G+he<=h){for(q=0;q<he;q+=1)if(se=c[G+q],se>=65&&se<=90&&(se+=32),se!==ae.string[q])return;T.state=e.MATCH,T.phraseLength=he}},"opTLS"),J=o(function(te,G,T){T.state=e.NOMATCH,T.phraseLength=0,T.state=G===0?e.EMPTY:e.NOMATCH},"opABG"),pe=o(function(te,G,T){T.state=e.NOMATCH,T.phraseLength=0,T.state=G===c.length?e.EMPTY:e.NOMATCH},"opAEN"),ee=o(function(te,G,T){let q,se,ae,he,ge=a[te];T.state=e.NOMATCH,ge.index<E.length?he=E[ge.index].lower:he=L[ge.index-E.length].lower;let rt=ge.bkrMode===e.BKR_MODE_PM?T.pFrame.getPhrase(he):T.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(rt===null)return;let Ee=rt.phraseIndex,nt=rt.phraseLength;if(nt===0){T.state=e.EMPTY;return}if(G+nt<=h){if(Pe){for(q=0;q<nt;q+=1)if(se=c[G+q],ae=c[Ee+q],se>=65&&se<=90&&(se+=32),ae>=65&&ae<=90&&(ae+=32),se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}else for(q=0;q<nt;q+=1)if(se=c[G+q],ae=c[Ee+q],se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}},"opBKR"),ce=o(function(te,G,T){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:G}),s(te+1,G,T),d.pop(),T.phraseLength=0,T.state){case e.EMPTY:T.state=e.EMPTY;break;case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${T.state}`)}},"opBKA"),$=o(function(te,G,T){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:G}),s(te+1,G,T),d.pop(),T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opBKN: invalid state ${T.state}`)}},"opBKN"),ie=o(function(te,G,T){let q,se,ae,he,ge=a[te],rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(se=i.ast.getLength()),q=!0,ae=G,he=0;for(let Ee=ge.children.length-1;Ee>=0;Ee-=1)if(s(ge.children[Ee],ae,T),ae-=T.phraseLength,he+=T.phraseLength,T.state===e.NOMATCH){q=!1;break}q?(T.state=he===0?e.EMPTY:e.MATCH,T.phraseLength=he):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(se))},"opCATBehind"),be=o(function(te,G,T){let q,se,ae,he,ge=a[te];se=G,ae=0,he=0;let rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(se<=0||(s(te+1,se,T),T.state===e.NOMATCH)||T.state===e.EMPTY||(he+=1,ae+=T.phraseLength,se-=T.phraseLength,he===ge.max)););T.state===e.EMPTY||he>=ge.min?(T.state=ae===0?e.EMPTY:e.MATCH,T.phraseLength=ae):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREPBehind"),ke=o(function(te,G,T){let q=a[te];if(T.state=e.NOMATCH,T.phraseLength=0,G>0){let se=c[G-1];q.min<=se&&se<=q.max&&(T.state=e.MATCH,T.phraseLength=1)}},"opTRGBehind"),Ie=o(function(te,G,T){let q,se=a[te];T.state=e.NOMATCH;let ae=se.string.length,he=G-ae;if(he>=0){for(q=0;q<ae;q+=1)if(c[he+q]!==se.string[q])return;T.state=e.MATCH,T.phraseLength=ae}},"opTBSBehind"),Xe=o(function(te,G,T){let q,se=a[te];T.state=e.NOMATCH;let ae=se.string.length;if(ae===0){T.state=e.EMPTY;return}let he=G-ae;if(he>=0){for(let ge=0;ge<ae;ge+=1)if(q=c[he+ge],q>=65&&q<=90&&(q+=32),q!==se.string[ge])return;T.state=e.MATCH,T.phraseLength=ae}},"opTLSBehind"),dn=o(function(te,G,T){let q,se,ae,he,ge=a[te];T.state=e.NOMATCH,T.phraseLength=0,ge.index<E.length?he=E[ge.index].lower:he=L[ge.index-E.length].lower;let rt=ge.bkrMode===e.BKR_MODE_PM?T.pFrame.getPhrase(he):T.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(rt===null)return;let Ee=rt.phraseIndex,nt=rt.phraseLength;if(nt===0){T.state=e.EMPTY,T.phraseLength=0;return}let Ge=G-nt;if(Ge>=0){if(Pe){for(q=0;q<nt;q+=1)if(se=c[Ge+q],ae=c[Ee+q],se>=65&&se<=90&&(se+=32),ae>=65&&ae<=90&&(ae+=32),se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}else for(q=0;q<nt;q+=1)if(se=c[Ge+q],ae=c[Ee+q],se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}},"opBKRBehind");s=o(function(G,T,q){let se=!0,ae=a[G];if(y+=1,y>D)throw new Error(`parser: maximum number of node hits exceeded: ${D}`);if(v+=1,v>x&&(x=v,x>j))throw new Error(`parser: maximum parse tree depth exceeded: ${j}`);if(q.refresh(),i.trace!==null){let he=p();i.trace.down(ae,q.state,T,q.phraseLength,he.anchor,he.lookAround)}if(w())switch(ae.type){case e.ALT:K(G,T,q);break;case e.CAT:ie(G,T,q);break;case e.REP:be(G,T,q);break;case e.RNM:Q(G,T,q);break;case e.UDT:O(G,T,q);break;case e.AND:z(G,T,q);break;case e.NOT:W(G,T,q);break;case e.TRG:ke(G,T,q);break;case e.TBS:Ie(G,T,q);break;case e.TLS:Xe(G,T,q);break;case e.BKR:dn(G,T,q);break;case e.BKA:ce(G,T,q);break;case e.BKN:$(G,T,q);break;case e.ABG:J(G,T,q);break;case e.AEN:pe(G,T,q);break;default:se=!1;break}else switch(ae.type){case e.ALT:K(G,T,q);break;case e.CAT:fe(G,T,q);break;case e.REP:A(G,T,q);break;case e.RNM:Q(G,T,q);break;case e.UDT:O(G,T,q);break;case e.AND:z(G,T,q);break;case e.NOT:W(G,T,q);break;case e.TRG:re(G,T,q);break;case e.TBS:le(G,T,q);break;case e.TLS:oe(G,T,q);break;case e.BKR:ee(G,T,q);break;case e.BKA:ce(G,T,q);break;case e.BKN:$(G,T,q);break;case e.ABG:J(G,T,q);break;case e.AEN:pe(G,T,q);break;default:se=!1;break}if(!m()&&T+q.phraseLength>F&&(F=T+q.phraseLength),i.stats!==null&&i.stats.collect(ae,q),i.trace!==null){let he=p();i.trace.up(ae,q.state,T,q.phraseLength,he.anchor,he.lookAround)}return v-=1,se},"opExecuteFunc")},"parser")});var mx=de((WK,px)=>{px.exports=o(function(){let e=Qn(),t=ha(),n=Uu(),i="stats.js: ",s=[],a=[],c=[],f,l=[],h=[];this.statsObject="statsObject";let d="stats",v=o(function(D,B){return D.lower<B.lower?-1:D.lower>B.lower?1:0},"sortAlpha"),x=o(function(D,B){return D.total<B.total?1:D.total>B.total?-1:v(D,B)},"sortHits"),y=o(function(D,B){return D.index<B.index?-1:D.index>B.index?1:0},"sortIndex"),_=o(function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},"EmptyStat"),U=o(function(){c.length=0,f=new _,c[e.ALT]=new _,c[e.CAT]=new _,c[e.REP]=new _,c[e.RNM]=new _,c[e.TRG]=new _,c[e.TBS]=new _,c[e.TLS]=new _,c[e.UDT]=new _,c[e.AND]=new _,c[e.NOT]=new _,c[e.BKR]=new _,c[e.BKA]=new _,c[e.BKN]=new _,c[e.ABG]=new _,c[e.AEN]=new _,l.length=0;for(let D=0;D<s.length;D+=1)l.push({empty:0,match:0,nomatch:0,total:0,name:s[D].name,lower:s[D].lower,index:s[D].index});if(a.length>0){h.length=0;for(let D=0;D<a.length;D+=1)h.push({empty:0,match:0,nomatch:0,total:0,name:a[D].name,lower:a[D].lower,index:a[D].index})}},"clear"),E=o(function(D,B){switch(D.total+=1,B){case e.EMPTY:D.empty+=1;break;case e.MATCH:D.match+=1;break;case e.NOMATCH:D.nomatch+=1;break;default:throw new Error(`${i}collect(): incStat(): unrecognized state: ${B}`)}},"incStat"),L=o(function(D,B){let R="";return R+="<tr>",R+=`<td class="${n.CLASS_ACTIVE}">${D}</td>`,R+=`<td class="${n.CLASS_EMPTY}">${B.empty}</td>`,R+=`<td class="${n.CLASS_MATCH}">${B.match}</td>`,R+=`<td class="${n.CLASS_NOMATCH}">${B.nomatch}</td>`,R+=`<td class="${n.CLASS_ACTIVE}">${B.total}</td>`,R+=`</tr>
|
273
|
+
`,R},"displayRow"),H=o(function(){let D="";return D+=L("ALT",c[e.ALT]),D+=L("CAT",c[e.CAT]),D+=L("REP",c[e.REP]),D+=L("RNM",c[e.RNM]),D+=L("TRG",c[e.TRG]),D+=L("TBS",c[e.TBS]),D+=L("TLS",c[e.TLS]),D+=L("UDT",c[e.UDT]),D+=L("AND",c[e.AND]),D+=L("NOT",c[e.NOT]),D+=L("BKR",c[e.BKR]),D+=L("BKA",c[e.BKA]),D+=L("BKN",c[e.BKN]),D+=L("ABG",c[e.ABG]),D+=L("AEN",c[e.AEN]),D+=L("totals",f),D},"displayOpsOnly"),F=o(function(){let D="";D+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
274
|
+
`,D+=`<tr><th>rules</th><th></th><th></th><th></th><th></th></tr>
|
275
|
+
`;for(let B=0;B<s.length;B+=1)l[B].total>0&&(D+="<tr>",D+=`<td class="${n.CLASS_ACTIVE}">${l[B].name}</td>`,D+=`<td class="${n.CLASS_EMPTY}">${l[B].empty}</td>`,D+=`<td class="${n.CLASS_MATCH}">${l[B].match}</td>`,D+=`<td class="${n.CLASS_NOMATCH}">${l[B].nomatch}</td>`,D+=`<td class="${n.CLASS_ACTIVE}">${l[B].total}</td>`,D+=`</tr>
|
276
|
+
`);if(a.length>0){D+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
277
|
+
`,D+=`<tr><th>udts</th><th></th><th></th><th></th><th></th></tr>
|
278
|
+
`;for(let B=0;B<a.length;B+=1)h[B].total>0&&(D+="<tr>",D+=`<td class="${n.CLASS_ACTIVE}">${h[B].name}</td>`,D+=`<td class="${n.CLASS_EMPTY}">${h[B].empty}</td>`,D+=`<td class="${n.CLASS_MATCH}">${h[B].match}</td>`,D+=`<td class="${n.CLASS_NOMATCH}">${h[B].nomatch}</td>`,D+=`<td class="${n.CLASS_ACTIVE}">${h[B].total}</td>`,D+=`</tr>
|
279
|
+
`)}return D},"displayRules");this.validate=o(function(D){let B=!1;return typeof D=="string"&&d===D&&(B=!0),B},"validate"),this.init=o(function(D,B){s=D,a=B,U()},"init"),this.collect=o(function(D,B){E(f,B.state,B.phraseLength),E(c[D.type],B.state,B.phraseLength),D.type===e.RNM&&E(l[D.index],B.state,B.phraseLength),D.type===e.UDT&&E(h[D.index],B.state,B.phraseLength)},"collect"),this.toHtml=o(function(D,B){let R="";R+=`<table class="${n.CLASS_STATS}">
|
280
|
+
`,typeof B=="string"&&(R+=`<caption>${B}</caption>
|
281
|
+
`),R+=`<tr><th class="${n.CLASS_ACTIVE}">ops</th>
|
282
|
+
`,R+=`<th class="${n.CLASS_EMPTY}">EMPTY</th>
|
283
|
+
`,R+=`<th class="${n.CLASS_MATCH}">MATCH</th>
|
284
|
+
`,R+=`<th class="${n.CLASS_NOMATCH}">NOMATCH</th>
|
285
|
+
`,R+=`<th class="${n.CLASS_ACTIVE}">totals</th></tr>
|
286
|
+
`;let Y=!0;for(;Y;){if(D===void 0){R+=H();break}if(D===null){R+=H();break}if(D==="ops"){R+=H();break}if(D==="index"){l.sort(y),h.length>0&&h.sort(y),R+=H(),R+=F();break}if(D==="hits"){l.sort(x),h.length>0&&h.sort(y),R+=H(),R+=F();break}if(D==="alpha"){l.sort(v),h.length>0&&h.sort(v),R+=H(),R+=F();break}break}return R+=`</table>
|
287
|
+
`,R},"toHtml"),this.toHtmlPage=o(function(D,B,R){return t.htmlToPage(this.toHtml(D,B),R)},"toHtmlPage")},"statsFunc")});var gx=de((YK,bx)=>{bx.exports=o(function(){let e=ha(),t=Uu(),n=new(M1()),i=Qn(),s="trace.js: ",a=this,c=16,f=10,l=8,h=32,d=80,v=5,x=[],y=5e3,_=-1,U=0,E=0,L=[],H=null,F=null,j=null,D=[],B=[],R=`<span class="${t.CLASS_LINEEND}">•</span>`,Y=`<span class="${t.CLASS_LINEEND}">…</span>`,b=`<span class="${t.CLASS_EMPTY}">𝜺</span>`,u=o(function(){let P=o(function(z){D[i.ALT]=z,D[i.CAT]=z,D[i.REP]=z,D[i.TLS]=z,D[i.TBS]=z,D[i.TRG]=z,D[i.AND]=z,D[i.NOT]=z,D[i.BKR]=z,D[i.BKA]=z,D[i.BKN]=z,D[i.ABG]=z,D[i.AEN]=z},"setOperators"),O=0;for(let z in a.filter.operators)O+=1;if(O===0){P(!1);return}for(let z in a.filter.operators){let W=z.toUpperCase();if(W==="<ALL>"){P(!0);return}if(W==="<NONE>"){P(!1);return}}P(!1);for(let z in a.filter.operators){let W=z.toUpperCase();if(W==="ALT")D[i.ALT]=a.filter.operators[z]===!0;else if(W==="CAT")D[i.CAT]=a.filter.operators[z]===!0;else if(W==="REP")D[i.REP]=a.filter.operators[z]===!0;else if(W==="AND")D[i.AND]=a.filter.operators[z]===!0;else if(W==="NOT")D[i.NOT]=a.filter.operators[z]===!0;else if(W==="TLS")D[i.TLS]=a.filter.operators[z]===!0;else if(W==="TBS")D[i.TBS]=a.filter.operators[z]===!0;else if(W==="TRG")D[i.TRG]=a.filter.operators[z]===!0;else if(W==="BKR")D[i.BKR]=a.filter.operators[z]===!0;else if(W==="BKA")D[i.BKA]=a.filter.operators[z]===!0;else if(W==="BKN")D[i.BKN]=a.filter.operators[z]===!0;else if(W==="ABG")D[i.ABG]=a.filter.operators[z]===!0;else if(W==="AEN")D[i.AEN]=a.filter.operators[z]===!0;else throw new Error(`${s}initOpratorFilter: '${z}' not a valid operator name. Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`)}},"initOperatorFilter"),p=o(function(){let P=o(function(re){D[i.RNM]=re,D[i.UDT]=re;let le=F.length+j.length;B.length=0;for(let oe=0;oe<le;oe+=1)B.push(re)},"setRules"),O,z,W=[];for(z=0;z<F.length;z+=1)W.push(F[z].lower);for(z=0;z<j.length;z+=1)W.push(j[z].lower);B.length=0,O=0;for(let re in a.filter.rules)O+=1;if(O===0){P(!0);return}for(let re in a.filter.rules){let le=re.toLowerCase();if(le==="<all>"){P(!0);return}if(le==="<none>"){P(!1);return}}P(!1),D[i.RNM]=!0,D[i.UDT]=!0;for(let re in a.filter.rules){let le=re.toLowerCase();if(z=W.indexOf(le),z<0)throw new Error(`${s}initRuleFilter: '${re}' not a valid rule or udt name`);B[z]=a.filter.rules[re]===!0}},"initRuleFilter");this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(P,O){if(_=-1,typeof P=="number"&&P>0)y=Math.ceil(P);else{y=0;return}typeof O=="number"&&(_=Math.floor(O),_<0&&(_=-1))},this.getMaxRecords=function(){return y},this.getLastRecord=function(){return _},this.init=function(P,O,z){x.length=0,L.length=0,U=0,E=0,H=z,F=P,j=O,u(),p(),n.init(y)};let m=o(function(P){let O=!1;return P.type===i.RNM?D[P.type]&&B[P.index]?O=!0:O=!1:P.type===i.UDT?D[P.type]&&B[F.length+P.index]?O=!0:O=!1:O=D[P.type],O},"filterOps"),w=o(function(P){return _===-1||P<=_},"filterRecords");this.down=function(P,O,z,W,re,le){w(U)&&m(P)&&(L.push(U),x[n.increment()]={dirUp:!1,depth:E,thisLine:U,thatLine:void 0,opcode:P,state:O,phraseIndex:z,phraseLength:W,lookAnchor:re,lookAround:le},U+=1,E+=1)},this.up=function(P,O,z,W,re,le){if(w(U)&&m(P)){let oe=U,J=L.pop(),pe=n.getListIndex(J);pe!==-1&&(x[pe].thatLine=oe),E-=1,x[n.increment()]={dirUp:!0,depth:E,thisLine:oe,thatLine:J,opcode:P,state:O,phraseIndex:z,phraseLength:W,lookAnchor:re,lookAround:le},U+=1}};let S=o(function(){function P(T,q){let se,ae,he;if(q)switch(T.op={id:q.type,name:e.opcodeToString(q.type)},T.opData=void 0,q.type){case i.RNM:T.opData=F[q.index].name;break;case i.UDT:T.opData=j[q.index].name;break;case i.BKR:q.index<F.length?se=F[q.index].name:se=j[q.index-F.length].name,ae=q.bkrCase===i.BKR_MODE_CI?"%i":"%s",he=q.bkrMode===i.BKR_MODE_UM?"%u":"%p",T.opData=`\\\\${ae}${he}${se}`;break;case i.TLS:T.opData=[];for(let ge=0;ge<q.string.length;ge+=1)T.opData.push(q.string[ge]);break;case i.TBS:T.opData=[];for(let ge=0;ge<q.string.length;ge+=1)T.opData.push(q.string[ge]);break;case i.TRG:T.opData=[q.min,q.max];break;case i.REP:T.opData=[q.min,q.max];break;default:throw new Error("unrecognized opcode")}else T.op={id:void 0,name:void 0},T.opData=void 0}o(P,"nodeOpcode");function O(T,q,se){return T===i.MATCH?{index:q,length:se}:T===i.NOMATCH?{index:q,length:0}:T===i.EMPTY?{index:q,length:0}:null}o(O,"nodePhrase");let z=-1;function W(T,q,se){let ae={id:z++,branch:-1,parent:T,up:!1,down:!1,depth:se,children:[]};return q?(ae.down=!0,ae.state={id:q.state,name:e.stateToString(q.state)},ae.phrase=null,P(ae,q.opcode)):(ae.state={id:void 0,name:void 0},ae.phrase=O(),P(ae,void 0)),ae}o(W,"nodeDown");function re(T,q){q&&(T.up=!0,T.state={id:q.state,name:e.stateToString(q.state)},T.phrase=O(q.state,q.phraseIndex,q.phraseLength),T.down||P(T,q.opcode))}o(re,"nodeUp");let le=0,oe=-1,J=1;function pe(T){if(oe+=1,T.branch=J,oe>E&&(E=oe),T.children.length===0)le+=1;else for(let q=0;q<T.children.length;q+=1)q>0&&(J+=1),T.children[q].leftMost=!1,T.children[q].rightMost=!1,T.leftMost&&(T.children[q].leftMost=q===0),T.rightMost&&(T.children[q].rightMost=q===T.children.length-1),pe(T.children[q]);oe-=1}o(pe,"walk");function ee(T,q){let se,ae={};if(ae.id=T.id,ae.branch=T.branch,ae.leftMost=T.leftMost,ae.rightMost=T.rightMost,se=T.state.name?T.state.name:"ACTIVE",ae.state={id:T.state.id,name:se},se=T.op.name?T.op.name:"?",ae.op={id:T.op.id,name:se},typeof T.opData=="string")ae.opData=T.opData;else if(Array.isArray(T.opData)){ae.opData=[];for(let he=0;he<T.opData.length;he+=1)ae.opData[he]=T.opData[he]}else ae.opData=void 0;T.phrase?ae.phrase={index:T.phrase.index,length:T.phrase.length}:ae.phrase=null,ae.depth=T.depth,ae.children=[];for(let he=0;he<T.children.length;he+=1){let ge=he!==T.children.length-1;ae.children[he]=ee(T.children[he],q,ge)}return ae}o(ee,"display");let ce=[],$,ie,be,ke,Ie=!0,Xe=W(null,null,-1);for(ce.push(Xe),ie=Xe,n.forEach(T=>{if(ke=x[T],Ie&&(Ie=!1,ke.depth>0)){let q=ke.dirUp?ke.depth+1:ke.depth;for(let se=0;se<q;se+=1)be=ie,ie=W(ie,null,se),ce.push(ie),be.children.push(ie)}ke.dirUp?(ie=ce.pop(),re(ie,ke),ie=ce[ce.length-1]):(be=ie,ie=W(ie,ke,ke.depth),ce.push(ie),be.children.push(ie))});ce.length>1;)ie=ce.pop(),re(ie,null);if(Xe.children.length===0)throw new Error("trace.toTree(): parse tree has no nodes");if(ce.length===0)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");$=Xe.children[0];let dn=$;for(;$&&!$.down&&!$.up;)dn=$,$=$.children[0];$=dn,$.leftMost=!0,$.rightMost=!0,pe($),$.branch=0;let te={};te.string=[];for(let T=0;T<H.length;T+=1)te.string[T]=H[T];te.rules=[];for(let T=0;T<F.length;T+=1)te.rules[T]=F[T].name;te.udts=[];for(let T=0;T<j.length;T+=1)te.udts[T]=j[T].name;te.id={},te.id.ALT={id:i.ALT,name:"ALT"},te.id.CAT={id:i.CAT,name:"CAT"},te.id.REP={id:i.REP,name:"REP"},te.id.RNM={id:i.RNM,name:"RNM"},te.id.TLS={id:i.TLS,name:"TLS"},te.id.TBS={id:i.TBS,name:"TBS"},te.id.TRG={id:i.TRG,name:"TRG"},te.id.UDT={id:i.UDT,name:"UDT"},te.id.AND={id:i.AND,name:"AND"},te.id.NOT={id:i.NOT,name:"NOT"},te.id.BKR={id:i.BKR,name:"BKR"},te.id.BKA={id:i.BKA,name:"BKA"},te.id.BKN={id:i.BKN,name:"BKN"},te.id.ABG={id:i.ABG,name:"ABG"},te.id.AEN={id:i.AEN,name:"AEN"},te.id.ACTIVE={id:i.ACTIVE,name:"ACTIVE"},te.id.MATCH={id:i.MATCH,name:"MATCH"},te.id.EMPTY={id:i.EMPTY,name:"EMPTY"},te.id.NOMATCH={id:i.NOMATCH,name:"NOMATCH"},te.treeDepth=E,te.leafNodes=le;let G;return $.down?$.up?G="none":G="right":$.up?G="left":G="both",te.branchesIncomplete=G,te.tree=ee($,$.depth,!1),te},"toTreeObj");this.toTree=function(P){let O=S();return P?JSON.stringify(O):O},this.toHtmlPage=function(P,O,z){return e.htmlToPage(this.toHtml(P,O),z)};let N=o(function(P,O){let z;switch(P){case c:z="hexidecimal";break;case f:z="decimal";break;case l:z="ASCII";break;case h:z="UNICODE";break;default:throw new Error(`${s}htmlHeader: unrecognized mode: ${P}`)}let W="";return W+=`<p>display mode: ${z}</p>
|
288
|
+
`,W+=`<table class="${t.CLASS_TRACE}">
|
289
|
+
`,typeof O=="string"&&(W+=`<caption>${O}</caption>`),W},"htmlHeader"),I=o(function(){let P="";return P+=`</table>
|
290
|
+
`,P+=`<p class="${t.CLASS_MONOSPACE}">legend:<br>
|
291
|
+
`,P+=`(a) - line number<br>
|
292
|
+
`,P+=`(b) - matching line number<br>
|
293
|
+
`,P+=`(c) - phrase offset<br>
|
294
|
+
`,P+=`(d) - phrase length<br>
|
295
|
+
`,P+=`(e) - tree depth<br>
|
296
|
+
`,P+=`(f) - operator state<br>
|
297
|
+
`,P+=` - <span class="${t.CLASS_ACTIVE}">↓</span> phrase opened<br>
|
298
|
+
`,P+=` - <span class="${t.CLASS_MATCH}">↑M</span> phrase matched<br>
|
299
|
+
`,P+=` - <span class="${t.CLASS_EMPTY}">↑E</span> empty phrase matched<br>
|
300
|
+
`,P+=` - <span class="${t.CLASS_NOMATCH}">↑N</span> phrase not matched<br>
|
301
|
+
`,P+=`operator - ALT, CAT, REP, RNM, TRG, TLS, TBS<sup>†</sup>, UDT, AND, NOT, BKA, BKN, BKR, ABG, AEN<sup>‡</sup><br>
|
302
|
+
`,P+=`phrase - up to ${d} characters of the phrase being matched<br>
|
303
|
+
`,P+=` - <span class="${t.CLASS_MATCH}">matched characters</span><br>
|
304
|
+
`,P+=` - <span class="${t.CLASS_LOOKAHEAD}">matched characters in look ahead mode</span><br>
|
305
|
+
`,P+=` - <span class="${t.CLASS_LOOKBEHIND}">matched characters in look behind mode</span><br>
|
306
|
+
`,P+=` - <span class="${t.CLASS_REMAINDER}">remainder characters(not yet examined by parser)</span><br>
|
307
|
+
`,P+=` - <span class="${t.CLASS_CTRLCHAR}">control characters, TAB, LF, CR, etc. (ASCII mode only)</span><br>
|
308
|
+
`,P+=` - ${b} empty string<br>
|
309
|
+
`,P+=` - ${R} end of input string<br>
|
310
|
+
`,P+=` - ${Y} input string display truncated<br>
|
311
|
+
`,P+=`</p>
|
312
|
+
`,P+=`<p class="${t.CLASS_MONOSPACE}">
|
313
|
+
`,P+=`<sup>†</sup>original ABNF operators:<br>
|
314
|
+
`,P+=`ALT - alternation<br>
|
315
|
+
`,P+=`CAT - concatenation<br>
|
316
|
+
`,P+=`REP - repetition<br>
|
317
|
+
`,P+=`RNM - rule name<br>
|
318
|
+
`,P+=`TRG - terminal range<br>
|
319
|
+
`,P+=`TLS - terminal literal string (case insensitive)<br>
|
320
|
+
`,P+=`TBS - terminal binary string (case sensitive)<br>
|
321
|
+
`,P+=`<br>
|
322
|
+
`,P+=`<sup>‡</sup>super set SABNF operators:<br>
|
323
|
+
`,P+=`UDT - user-defined terminal<br>
|
324
|
+
`,P+=`AND - positive look ahead<br>
|
325
|
+
`,P+=`NOT - negative look ahead<br>
|
326
|
+
`,P+=`BKA - positive look behind<br>
|
327
|
+
`,P+=`BKN - negative look behind<br>
|
328
|
+
`,P+=`BKR - back reference<br>
|
329
|
+
`,P+=`ABG - anchor - begin of input string<br>
|
330
|
+
`,P+=`AEN - anchor - end of input string<br>
|
331
|
+
`,P+=`</p>
|
332
|
+
`,P},"htmlFooter");this.indent=function(P){let O="";for(let z=0;z<P;z+=1)O+=".";return O};let k=o(function(P,O){let z="";if(O.type===i.TRG)if(P===c||P===h){let W=O.min.toString(16).toUpperCase();W.length%2!==0&&(W=`0${W}`),z+=P===c?"%x":"U+",z+=W,W=O.max.toString(16).toUpperCase(),W.length%2!==0&&(W=`0${W}`),z+=`–${W}`}else z=`%d${O.min.toString(10)}–${O.max.toString(10)}`;return z},"displayTrg"),g=o(function(P,O){let z="";if(O.type===i.REP)if(P===c){let W=O.min.toString(16).toUpperCase();W.length%2!==0&&(W=`0${W}`),z=`x${W}`,O.max<1/0?(W=O.max.toString(16).toUpperCase(),W.length%2!==0&&(W=`0${W}`)):W="inf",z+=`–${W}`}else O.max<1/0?z=`${O.min.toString(10)}–${O.max.toString(10)}`:z=`${O.min.toString(10)}–inf`;return z},"displayRep"),C=o(function(P,O){let z="";if(O.type===i.TBS){let W=Math.min(O.string.length,v*2);if(P===c||P===h){z+=P===c?"%x":"U+";for(let re=0;re<W;re+=1){let le;re>0&&(z+="."),le=O.string[re].toString(16).toUpperCase(),le.length%2!==0&&(le=`0${le}`),z+=le}}else{z="%d";for(let re=0;re<W;re+=1)re>0&&(z+="."),z+=O.string[re].toString(10)}W<O.string.length&&(z+=Y)}return z},"displayTbs"),Z=o(function(P,O){let z="";if(O.type===i.TLS){let W=Math.min(O.string.length,v);if(P===c||P===f){let re,le,oe;P===c?(z="%x",oe=16):(z="%d",oe=10);for(let J=0;J<W;J+=1)J>0&&(z+="."),le=O.string[J],le>=97&&le<=122?(re=le-32,z+=`${re.toString(oe)}/${le.toString(oe)}`.toUpperCase()):le>=65&&le<=90?(re=le,le+=32,z+=`${re.toString(oe)}/${le.toString(oe)}`.toUpperCase()):z+=le.toString(oe).toUpperCase();W<O.string.length&&(z+=Y)}else{z='"';for(let re=0;re<W;re+=1)z+=e.asciiChars[O.string[re]];W<O.string.length&&(z+=Y),z+='"'}}return z},"displayTls"),V=o(function(P,O,z,W,re){if(W===0)return"";let le="",oe=re?",":"";switch(P){case c:le=oe+e.charsToHex(O,z,W);break;case f:if(re)return`,${e.charsToDec(O,z,W)}`;le=oe+e.charsToDec(O,z,W);break;case h:le=e.charsToUnicode(O,z,W);break;case l:default:le=e.charsToAsciiHtml(O,z,W);break}return le},"subPhrase"),K=o(function(P,O,z,W,re,le){let oe="",J,pe,ee,ce,$=R,ie=`<span class="${t.CLASS_LOOKBEHIND}">`,be=`<span class="${t.CLASS_REMAINDER}">`,ke="</span>",Ie=!1;switch(z){case i.EMPTY:oe+=b;case i.NOMATCH:case i.MATCH:case i.ACTIVE:J=W-re,pe=le-J,ee=le,ce=O.length-ee;break;default:throw new Error("unrecognized state")}return $=R,pe>d?(pe=d,$=Y,ce=0):pe+ce>d&&($=Y,ce=d-pe),pe>0&&(oe+=ie,oe+=V(P,O,J,pe,Ie),oe+=ke,Ie=!0),ce>0&&(oe+=be,oe+=V(P,O,ee,ce,Ie),oe+=ke),oe+$},"displayBehind"),fe=o(function(P,O,z,W,re,le){let oe="",J,pe,ee,ce,$=R,ie=`<span class="${t.CLASS_REMAINDER}">`,be="</span>",ke=!1;switch(z){case i.EMPTY:oe+=b;case i.NOMATCH:case i.ACTIVE:J=W,pe=0,ee=W,ce=O.length-ee;break;case i.MATCH:J=W,pe=re,ee=W+pe,ce=O.length-ee;break;default:throw new Error("unrecognized state")}return $=R,pe>d?(pe=d,$=Y,ce=0):pe+ce>d&&($=Y,ce=d-pe),pe>0&&(oe+=le,oe+=V(P,O,J,pe,ke),oe+=be,ke=!0),ce>0&&(oe+=ie,oe+=V(P,O,ee,ce,ke),oe+=be),oe+$},"displayForward"),A=o(function(P,O,z,W,re){let le=`<span class="${t.CLASS_LOOKAHEAD}">`;return fe(P,O,z,W,re,le)},"displayAhead"),X=o(function(P,O,z,W,re){let le=`<span class="${t.CLASS_MATCH}">`;return fe(P,O,z,W,re,le)},"displayNone"),Q=o(function(P){if(F===null)return"";let O="",z,W,re,le,oe,J;return O+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",O+=`<th>operator</th><th>phrase</th></tr>
|
333
|
+
`,n.forEach(pe=>{let ee=x[pe];switch(z=ee.thisLine,W=ee.thatLine!==void 0?ee.thatLine:"--",re=!1,le=!1,oe=!1,ee.lookAround===i.LOOKAROUND_AHEAD&&(re=!0,oe=!0,J=ee.lookAnchor),(ee.opcode.type===i.AND||ee.opcode.type===i.NOT)&&(re=!0,oe=!0,J=ee.phraseIndex),ee.lookAround===i.LOOKAROUND_BEHIND&&(le=!0,oe=!0,J=ee.lookAnchor),(ee.opcode.type===i.BKA||ee.opcode.type===i.BKN)&&(le=!0,oe=!0,J=ee.phraseIndex),O+="<tr>",O+=`<td>${z}</td><td>${W}</td>`,O+=`<td>${ee.phraseIndex}</td>`,O+=`<td>${ee.phraseLength}</td>`,O+=`<td>${ee.depth}</td>`,O+="<td>",ee.state){case i.ACTIVE:O+=`<span class="${t.CLASS_ACTIVE}">↓ </span>`;break;case i.MATCH:O+=`<span class="${t.CLASS_MATCH}">↑M</span>`;break;case i.NOMATCH:O+=`<span class="${t.CLASS_NOMATCH}">↑N</span>`;break;case i.EMPTY:O+=`<span class="${t.CLASS_EMPTY}">↑E</span>`;break;default:O+=`<span class="${t.CLASS_ACTIVE}">--</span>`;break}if(O+="</td>",O+="<td>",O+=a.indent(ee.depth),re?O+=`<span class="${t.CLASS_LOOKAHEAD}">`:le&&(O+=`<span class="${t.CLASS_LOOKBEHIND}">`),O+=e.opcodeToString(ee.opcode.type),ee.opcode.type===i.RNM&&(O+=`(${F[ee.opcode.index].name}) `),ee.opcode.type===i.BKR){let ce=ee.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",$=ee.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";O+=`(\\${ce}${$}${F[ee.opcode.index].name}) `}ee.opcode.type===i.UDT&&(O+=`(${j[ee.opcode.index].name}) `),ee.opcode.type===i.TRG&&(O+=`(${k(P,ee.opcode)}) `),ee.opcode.type===i.TBS&&(O+=`(${C(P,ee.opcode)}) `),ee.opcode.type===i.TLS&&(O+=`(${Z(P,ee.opcode)}) `),ee.opcode.type===i.REP&&(O+=`(${g(P,ee.opcode)}) `),oe&&(O+="</span>"),O+="</td>",O+="<td>",le?O+=K(P,H,ee.state,ee.phraseIndex,ee.phraseLength,J):re?O+=A(P,H,ee.state,ee.phraseIndex,ee.phraseLength):O+=X(P,H,ee.state,ee.phraseIndex,ee.phraseLength),O+=`</td></tr>
|
334
|
+
`}),O+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",O+=`<th>operator</th><th>phrase</th></tr>
|
335
|
+
`,O+=`</table>
|
336
|
+
`,O},"htmlTable");this.toHtml=function(P,O){let z=l;if(typeof P=="string"&&P.length>=3){let re=P.toLowerCase().slice(0,3);re==="hex"?z=c:re==="dec"?z=f:re==="uni"&&(z=h)}let W="";return W+=N(z,O),W+=Q(z),W+=I(),W}},"exportTrace")});var da=de((XK,yx)=>{yx.exports={ast:ux(),circular:M1(),ids:Qn(),parser:dx(),stats:mx(),trace:gx(),utils:ha(),emitcss:k1(),style:Uu()}});var wx=de((ZK,vx)=>{vx.exports=o(function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"file",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"line",lower:"line",index:1,isBkr:!1},this.rules[2]={name:"line-text",lower:"line-text",index:2,isBkr:!1},this.rules[3]={name:"last-line",lower:"last-line",index:3,isBkr:!1},this.rules[4]={name:"valid",lower:"valid",index:4,isBkr:!1},this.rules[5]={name:"invalid",lower:"invalid",index:5,isBkr:!1},this.rules[6]={name:"end",lower:"end",index:6,isBkr:!1},this.rules[7]={name:"CRLF",lower:"crlf",index:7,isBkr:!1},this.rules[8]={name:"LF",lower:"lf",index:8,isBkr:!1},this.rules[9]={name:"CR",lower:"cr",index:9,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,3]},this.rules[0].opcodes[1]={type:3,min:0,max:1/0},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:3,min:0,max:1},this.rules[0].opcodes[4]={type:4,index:3},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:0,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:5},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3]},this.rules[3].opcodes[2]={type:4,index:4},this.rules[3].opcodes[3]={type:4,index:5},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:32,max:126},this.rules[4].opcodes[2]={type:6,string:[9]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[5].opcodes[1]={type:5,min:0,max:8},this.rules[5].opcodes[2]={type:5,min:11,max:12},this.rules[5].opcodes[3]={type:5,min:14,max:31},this.rules[5].opcodes[4]={type:5,min:127,max:4294967295},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:6,string:[13,10]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:6,string:[10]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:6,string:[13]},this.toString=o(function(){let t="";return t+=`file = *line [last-line]
|
337
|
+
`,t+=`line = line-text end
|
338
|
+
`,t+=`line-text = *(valid/invalid)
|
339
|
+
`,t+=`last-line = 1*(valid/invalid)
|
340
|
+
`,t+=`valid = %d32-126 / %d9
|
341
|
+
`,t+=`invalid = %d0-8 / %d11-12 /%d14-31 / %x7f-ffffffff
|
342
|
+
`,t+=`end = CRLF / LF / CR
|
343
|
+
`,t+=`CRLF = %d13.10
|
344
|
+
`,t+=`LF = %d10
|
345
|
+
`,t+=`CR = %d13
|
346
|
+
`,t},"toString")},"grammar")});var _x=de(xx=>{var wr=Qn(),cM=ha();function fM(r,e,t,n,i){return r===wr.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:i.textLength,endType:i.endType,invalidChars:i.invalidCount}),wr.SEM_OK}o(fM,"semLine");function uM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.textLength=n),wr.SEM_OK}o(uM,"semLineText");function lM(r,e,t,n,i){return r===wr.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.strict?(i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:n,endType:"none",invalidChars:i.invalidCount}),i.errors.push({line:i.lineNo,char:t+n,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(e.push(10),i.lines.push({lineNo:i.lines.length,beginChar:t,length:n+1,textLength:n,endType:"LF",invalidChars:i.invalidCount})),wr.SEM_OK}o(lM,"semLastLine");function hM(r,e,t,n,i){return r===wr.SEM_PRE&&i.errors.push({line:i.lineNo,char:t,msg:`invalid character found '\\x${cM.charToHex(e[t])}'`}),wr.SEM_OK}o(hM,"semInvalid");function dM(r,e,t,n,i){return r===wr.SEM_POST&&(i.lineNo+=1),wr.SEM_OK}o(dM,"semEnd");function pM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="LF",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),wr.SEM_OK}o(pM,"semLF");function mM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="CR",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),wr.SEM_OK}o(mM,"semCR");function bM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="CRLF"),wr.SEM_OK}o(bM,"semCRLF");var hs=[];hs.line=fM;hs["line-text"]=uM;hs["last-line"]=lM;hs.invalid=hM;hs.end=dM;hs.lf=pM;hs.cr=mM;hs.crlf=bM;xx.callbacks=hs});var Ex=de((e$,Ax)=>{Ax.exports=o(function(e,t,n,i){let s="scanner.js: ",a=da(),c=new(wx()),{callbacks:f}=_x(),l=[],h=new a.parser;if(h.ast=new a.ast,h.ast.callbacks=f,i){if(i.traceObject!=="traceObject")throw new TypeError(`${s}trace argument is not a trace object`);h.trace=i}if(h.parse(c,"file",e).success!==!0){t.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});return}let v={lines:l,lineNo:0,errors:t,strict:!!n};return h.ast.translate(v),l},"exports")});var Cx=de((t$,Sx)=>{Sx.exports=o(function(){let e="syntax-callbacks.js: ",t=da(),n=t.ids,i,s=o(function(Z,V,K,fe){switch(Z.state){case n.ACTIVE:fe.altStack=[],fe.repCount=0;break;case n.EMPTY:fe.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:fe.ruleCount===0&&fe.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${e}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${e}synFile: unrecognized case.`)}},"synFile"),a=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;case n.EMPTY:throw new Error(`${e}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:K.ruleCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRule"),c=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleError"),f=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleNameError"),l=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synDefinedAsError"),h=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAndOp"),d=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synNotOp"),v=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Positive look-behind operator(&&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkaOp"),x=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Negative look-behind operator(!!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBknOp"),y=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Beginning of string anchor(%^) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAbgOp"),_=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"End of string anchor(%$) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAenOp"),U=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(K.strict){let fe=t.utils.charsToString(Z,V,C.phraseLength);K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`Back reference operator(${fe}) found - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkrOp"),E=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(K.strict){let fe=t.utils.charsToString(Z,V,C.phraseLength);K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`UDT operator found(${fe}) - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synUdtOp"),L=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.tlsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsOpen"),H=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsString"),F=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synStringTab"),j=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsClose"),D=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.clsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsOpen"),B=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsString"),R=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsClose"),Y=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.prosValOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValOpen"),b=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValString"),u=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValClose"),p=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:V,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupOpen"),m=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=K.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=K.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupClose"),w=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:V,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionOpen"),S=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=K.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=K.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionClose"),N=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.basicError===!1&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBasicElementError"),I=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(C.phraseLength===1&&K.strict){let fe=Z[V]===13?"CR":"LF";K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`Line end '${fe}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEnd"),k=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEndError"),g=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.repCount+=1;break;case n.MATCH:K.repCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRepetition");this.callbacks=[],this.callbacks.andop=h,this.callbacks.basicelementerr=N,this.callbacks.clsclose=R,this.callbacks.clsopen=D,this.callbacks.clsstring=B,this.callbacks.definedaserror=l,this.callbacks.file=s,this.callbacks.groupclose=m,this.callbacks.groupopen=p,this.callbacks.lineenderror=k,this.callbacks.lineend=I,this.callbacks.notop=d,this.callbacks.optionclose=S,this.callbacks.optionopen=w,this.callbacks.prosvalclose=u,this.callbacks.prosvalopen=Y,this.callbacks.prosvalstring=b,this.callbacks.repetition=g,this.callbacks.rule=a,this.callbacks.ruleerror=c,this.callbacks.rulenameerror=f,this.callbacks.stringtab=F,this.callbacks.tlsclose=j,this.callbacks.tlsopen=L,this.callbacks.tlsstring=H,this.callbacks.udtop=E,this.callbacks.bkaop=v,this.callbacks.bknop=x,this.callbacks.bkrop=U,this.callbacks.abgop=y,this.callbacks.aenop=_},"exports")});var Tx=de((r$,kx)=>{kx.exports=o(function(){let e=da(),t=e.ids,n=o(function(){this.names=[],this.add=o(function(ee){let ce=-1;return this.get(ee)===-1&&(ce={name:ee,lower:ee.toLowerCase(),index:this.names.length},this.names.push(ce)),ce},"add"),this.get=o(function(ee){let ce=-1,$=ee.toLowerCase();for(let ie=0;ie<this.names.length;ie+=1)if(this.names[ie].lower===$){ce=this.names[ie];break}return ce},"get")},"NameList"),i=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1)$=10*$+pe[ie]-48;return $},"decnum"),s=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1)$=2*$+pe[ie]-48;return $},"binnum"),a=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1){let be=pe[ie];if(be>=48&&be<=57)be-=48;else if(be>=65&&be<=70)be-=55;else if(be>=97&&be<=102)be-=87;else throw new Error("hexnum out of range");$=16*$+be}return $},"hexnum");function c(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)$.ruleNames=new n,$.udtNames=new n,$.rules=[],$.udts=[],$.rulesLineMap=[],$.opcodes=[],$.altStack=[],$.topStack=null,$.topRule=null;else if(J===t.SEM_POST){let be;$.rules.forEach(ke=>{ke.isBkr=!1,ke.opcodes.forEach(Ie=>{Ie.type===t.RNM&&(be=$.ruleNames.get(Ie.index.name),be===-1?($.errors.push({line:$.findLine($.lines,Ie.index.phraseIndex,$.charsLength),char:Ie.index.phraseIndex,msg:`Rule name '${Ie.index.name}' used but not defined.`}),Ie.index=-1):Ie.index=be.index)})}),$.udts.forEach(ke=>{ke.isBkr=!1}),$.rules.forEach(ke=>{ke.opcodes.forEach(Ie=>{Ie.type===t.BKR&&(ke.hasBkr=!0,be=$.ruleNames.get(Ie.index.name),be!==-1?($.rules[be.index].isBkr=!0,Ie.index=be.index):(be=$.udtNames.get(Ie.index.name),be!==-1?($.udts[be.index].isBkr=!0,Ie.index=$.rules.length+be.index):($.errors.push({line:$.findLine($.lines,Ie.index.phraseIndex,$.charsLength),char:Ie.index.phraseIndex,msg:`Back reference name '${Ie.index.name}' refers to undefined rule or unamed UDT.`}),Ie.index=-1)))})})}return ie}o(c,"semFile");function f(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.altStack.length=0,$.topStack=null,$.rulesLineMap.push({line:$.findLine($.lines,ee,$.charsLength),char:ee})),ie}o(f,"semRule");function l(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)$.ruleName="",$.definedas="";else if(J===t.SEM_POST){let be;$.definedas==="="?(be=$.ruleNames.add($.ruleName),be===-1?($.definedas=null,$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`Rule name '${$.ruleName}' previously defined.`})):($.topRule={name:be.name,lower:be.lower,opcodes:[],index:be.index},$.rules.push($.topRule),$.opcodes=$.topRule.opcodes)):(be=$.ruleNames.get($.ruleName),be===-1?($.definedas=null,$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`Rule name '${$.ruleName}' for incremental alternate not previously defined.`})):($.topRule=$.rules[be.index],$.opcodes=$.topRule.opcodes))}return ie}o(l,"semRuleLookup");function h(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)for(;;){if($.definedas===null){ie=t.SEM_SKIP;break}if($.topStack===null){if($.definedas==="="){$.topStack={alt:{type:t.ALT,children:[]},cat:null},$.altStack.push($.topStack),$.opcodes.push($.topStack.alt);break}$.topStack={alt:$.opcodes[0],cat:null},$.altStack.push($.topStack);break}$.topStack={alt:{type:t.ALT,children:[]},cat:null},$.altStack.push($.topStack),$.opcodes.push($.topStack.alt);break}else J===t.SEM_POST&&($.altStack.pop(),$.altStack.length>0?$.topStack=$.altStack[$.altStack.length-1]:$.topStack=null);return ie}o(h,"semAlternation");function d(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.topStack.alt.children.push($.opcodes.length),$.topStack.cat={type:t.CAT,children:[]},$.opcodes.push($.topStack.cat)):J===t.SEM_POST&&($.topStack.cat=null),ie}o(d,"semConcatenation");function v(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&$.topStack.cat.children.push($.opcodes.length),ie}o(v,"semRepetition");function x(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.REP,min:0,max:1,char:ee}),ie}o(x,"semOptionOpen");function y(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.ruleName=e.utils.charsToString(pe,ee,ce)),ie}o(y,"semRuleName");function _(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.definedas="="),ie}o(_,"semDefined");function U(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.definedas="=/"),ie}o(U,"semIncAlt");function E(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.min=0,$.max=1/0,$.topRep={type:t.REP,min:0,max:1/0},$.opcodes.push($.topRep)):J===t.SEM_POST&&($.min>$.max&&$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`repetition min cannot be greater than max: min: ${$.min}: max: ${$.max}`}),$.topRep.min=$.min,$.topRep.max=$.max),ie}o(E,"semRepOp");function L(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=i(pe,ee,ce)),ie}o(L,"semRepMin");function H(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce)),ie}o(H,"semRepMax");function F(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce),$.min=$.max),ie}o(F,"semRepMinMax");function j(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.AND}),ie}o(j,"semAndOp");function D(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.NOT}),ie}o(D,"semNotOp");function B(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.RNM,index:{phraseIndex:ee,name:e.utils.charsToString(pe,ee,ce)}}),ie}o(B,"semRnmOp");function R(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.ABG}),ie}o(R,"semAbgOp");function Y(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.AEN}),ie}o(Y,"semAenOp");function b(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.BKA}),ie}o(b,"semBkaOp");function u(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.BKN}),ie}o(u,"semBknOp");function p(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.ci=!0,$.cs=!1,$.um=!0,$.pm=!1):J===t.SEM_POST&&$.opcodes.push({type:t.BKR,bkrCase:$.cs===!0?t.BKR_MODE_CS:t.BKR_MODE_CI,bkrMode:$.pm===!0?t.BKR_MODE_PM:t.BKR_MODE_UM,index:{phraseIndex:$.bkrname.phraseIndex,name:e.utils.charsToString(pe,$.bkrname.phraseIndex,$.bkrname.phraseLength)}}),ie}o(p,"semBkrOp");function m(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.ci=!0),ie}o(m,"semBkrCi");function w(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.cs=!0),ie}o(w,"semBkrCs");function S(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.um=!0),ie}o(S,"semBkrUm");function N(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.pm=!0),ie}o(N,"semBkrPm");function I(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.bkrname={phraseIndex:ee,phraseLength:ce}),ie}o(I,"semBkrName");function k(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST){let be=e.utils.charsToString(pe,ee,ce),ke=$.udtNames.add(be);if(ke===-1){if(ke=$.udtNames.get(be),ke===-1)throw new Error("semUdtEmpty: name look up error")}else $.udts.push({name:ke.name,lower:ke.lower,index:ke.index,empty:!0});$.opcodes.push({type:t.UDT,empty:!0,index:ke.index})}return ie}o(k,"semUdtEmpty");function g(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST){let be=e.utils.charsToString(pe,ee,ce),ke=$.udtNames.add(be);if(ke===-1){if(ke=$.udtNames.get(be),ke===-1)throw new Error("semUdtNonEmpty: name look up error")}else $.udts.push({name:ke.name,lower:ke.lower,index:ke.index,empty:!1});$.opcodes.push({type:t.UDT,empty:!1,index:ke.index,syntax:null,semantic:null})}return ie}o(g,"semUdtNonEmpty");function C(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.tlscase=!0),ie}o(C,"semTlsOp");function Z(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&ce>0&&(pe[ee+1]===83||pe[ee+1]===115)&&($.tlscase=!1),ie}o(Z,"semTlsCase");function V(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST)if($.tlscase){let be=pe.slice(ee,ee+ce);for(let ke=0;ke<be.length;ke+=1)be[ke]>=65&&be[ke]<=90&&(be[ke]+=32);$.opcodes.push({type:t.TLS,string:be})}else $.opcodes.push({type:t.TBS,string:pe.slice(ee,ee+ce)});return ie}o(V,"semTlsString");function K(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&(ce<=2?$.opcodes.push({type:t.TLS,string:[]}):$.opcodes.push({type:t.TBS,string:pe.slice(ee+1,ee+ce-1)})),ie}o(K,"semClsOp");function fe(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?$.tbsstr=[]:J===t.SEM_POST&&$.opcodes.push({type:t.TBS,string:$.tbsstr}),ie}o(fe,"semTbsOp");function A(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.min=0,$.max=0):J===t.SEM_POST&&($.min>$.max&&$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${$.min}: max: ${$.max}`}),$.opcodes.push({type:t.TRG,min:$.min,max:$.max})),ie}o(A,"semTrgOp");function X(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=i(pe,ee,ce)),ie}o(X,"semDmin");function Q(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce)),ie}o(Q,"semDmax");function P(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=s(pe,ee,ce)),ie}o(P,"semBmin");function O(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=s(pe,ee,ce)),ie}o(O,"semBmax");function z(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=a(pe,ee,ce)),ie}o(z,"semXmin");function W(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=a(pe,ee,ce)),ie}o(W,"semXmax");function re(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(i(pe,ee,ce)),ie}o(re,"semDstring");function le(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(s(pe,ee,ce)),ie}o(le,"semBstring");function oe(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(a(pe,ee,ce)),ie}o(oe,"semXstring"),this.callbacks=[],this.callbacks.abgop=R,this.callbacks.aenop=Y,this.callbacks.alternation=h,this.callbacks.andop=j,this.callbacks.bmax=O,this.callbacks.bmin=P,this.callbacks.bkaop=b,this.callbacks.bknop=u,this.callbacks.bkrop=p,this.callbacks["bkr-name"]=I,this.callbacks.bstring=le,this.callbacks.clsop=K,this.callbacks.ci=m,this.callbacks.cs=w,this.callbacks.um=S,this.callbacks.pm=N,this.callbacks.concatenation=d,this.callbacks.defined=_,this.callbacks.dmax=Q,this.callbacks.dmin=X,this.callbacks.dstring=re,this.callbacks.file=c,this.callbacks.incalt=U,this.callbacks.notop=D,this.callbacks.optionopen=x,this.callbacks["rep-max"]=H,this.callbacks["rep-min"]=L,this.callbacks["rep-min-max"]=F,this.callbacks.repetition=v,this.callbacks.repop=E,this.callbacks.rnmop=B,this.callbacks.rule=f,this.callbacks.rulelookup=l,this.callbacks.rulename=y,this.callbacks.tbsop=fe,this.callbacks.tlscase=Z,this.callbacks.tlsstring=V,this.callbacks.tlsop=C,this.callbacks.trgop=A,this.callbacks["udt-empty"]=k,this.callbacks["udt-non-empty"]=g,this.callbacks.xmax=W,this.callbacks.xmin=z,this.callbacks.xstring=oe},"exports")});var Bx=de((n$,Mx)=>{Mx.exports=o(function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=o(function(){let t="";return t+=`;
|
347
|
+
`,t+=`; ABNF for JavaScript APG 2.0 SABNF
|
348
|
+
`,t+=`; RFC 5234 with some restrictions and additions.
|
349
|
+
`,t+=`; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation
|
350
|
+
`,t+=`; - accepts %s"string" as a case-sensitive string
|
351
|
+
`,t+=`; - accepts %i"string" as a case-insensitive string
|
352
|
+
`,t+=`; - accepts "string" as a case-insensitive string
|
353
|
+
`,t+=`;
|
354
|
+
`,t+=`; Some restrictions:
|
355
|
+
`,t+=`; 1. Rules must begin at first character of each line.
|
356
|
+
`,t+=`; Indentations on first rule and rules thereafter are not allowed.
|
357
|
+
`,t+=`; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.
|
358
|
+
`,t+=`; 3. Prose values, i.e. <prose value>, are accepted as valid grammar syntax.
|
359
|
+
`,t+=`; However, a working parser cannot be generated from them.
|
360
|
+
`,t+=`;
|
361
|
+
`,t+=`; Super set (SABNF) additions:
|
362
|
+
`,t+=`; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.
|
363
|
+
`,t+=`; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found
|
364
|
+
`,t+=`; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found
|
365
|
+
`,t+=`; e.g. &%d13 or &rule or !(A / B)
|
366
|
+
`,t+=`; 2. User-Defined Terminals (UDT) of the form, u_name and e_name are accepted.
|
367
|
+
`,t+=`; 'name' is alpha followed by alpha/num/hyphen just like a rule name.
|
368
|
+
`,t+=`; u_name may be used as an element but no rule definition is given.
|
369
|
+
`,t+=`; e.g. rule = A / u_myUdt
|
370
|
+
`,t+=`; A = "a"
|
371
|
+
`,t+=`; would be a valid grammar.
|
372
|
+
`,t+=`; 3. Case-sensitive, single-quoted strings are accepted.
|
373
|
+
`,t+=`; e.g. 'abc' would be equivalent to %d97.98.99
|
374
|
+
`,t+=`; (kept for backward compatibility, but superseded by %s"abc")
|
375
|
+
`,t+=`; New 12/26/2015
|
376
|
+
`,t+=`; 4. Look-behind operators are accepted as element prefixes.
|
377
|
+
`,t+=`; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found
|
378
|
+
`,t+=`; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found
|
379
|
+
`,t+=`; e.g. &&%d13 or &&rule or !!(A / B)
|
380
|
+
`,t+=`; 5. Back reference operators, i.e. \\rulename, are accepted.
|
381
|
+
`,t+=`; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts
|
382
|
+
`,t+=`; to match is a phrase previously matched by the rule 'rulename'.
|
383
|
+
`,t+=`; There are two modes of previous phrase matching - the parent-frame mode and the universal mode.
|
384
|
+
`,t+=`; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.
|
385
|
+
`,t+=`; In parent-frame mode, \\rulename matches only the last match found on the parent's frame or parse tree level.
|
386
|
+
`,t+=`; Back reference modifiers can be used to specify case and mode.
|
387
|
+
`,t+=`; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA
|
388
|
+
`,t+=`; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.
|
389
|
+
`,t+=`; Modifiers %u and %p determine universal mode and parent frame mode, respectively.
|
390
|
+
`,t+=`; Case and mode modifiers can appear in any order, e.g. \\%s%pA === \\%p%sA.
|
391
|
+
`,t+=`; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.
|
392
|
+
`,t+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
|
393
|
+
`,t+=`; 8. String end anchor, AEN(%$) matches the end of the input string location.
|
394
|
+
`,t+=`; Returns EMPTY or NOMATCH. Never consumes any characters.
|
395
|
+
`,t+=`;
|
396
|
+
`,t+=`File = *(BlankLine / Rule / RuleError)
|
397
|
+
`,t+=`BlankLine = *(%d32/%d9) [comment] LineEnd
|
398
|
+
`,t+=`Rule = RuleLookup owsp Alternation ((owsp LineEnd)
|
399
|
+
`,t+=` / (LineEndError LineEnd))
|
400
|
+
`,t+=`RuleLookup = RuleNameTest owsp DefinedAsTest
|
401
|
+
`,t+=`RuleNameTest = RuleName/RuleNameError
|
402
|
+
`,t+=`RuleName = alphanum
|
403
|
+
`,t+=`RuleNameError = 1*(%d33-60/%d62-126)
|
404
|
+
`,t+=`DefinedAsTest = DefinedAs / DefinedAsError
|
405
|
+
`,t+=`DefinedAsError = 1*2%d33-126
|
406
|
+
`,t+=`DefinedAs = IncAlt / Defined
|
407
|
+
`,t+=`Defined = %d61
|
408
|
+
`,t+=`IncAlt = %d61.47
|
409
|
+
`,t+=`RuleError = 1*(%d32-126 / %d9 / LineContinue) LineEnd
|
410
|
+
`,t+=`LineEndError = 1*(%d32-126 / %d9 / LineContinue)
|
411
|
+
`,t+=`Alternation = Concatenation *(owsp AltOp Concatenation)
|
412
|
+
`,t+=`Concatenation = Repetition *(CatOp Repetition)
|
413
|
+
`,t+=`Repetition = [Modifier] (Group / Option / BasicElement / BasicElementErr)
|
414
|
+
`,t+=`Modifier = (Predicate [RepOp])
|
415
|
+
`,t+=` / RepOp
|
416
|
+
`,t+=`Predicate = BkaOp
|
417
|
+
`,t+=` / BknOp
|
418
|
+
`,t+=` / AndOp
|
419
|
+
`,t+=` / NotOp
|
420
|
+
`,t+=`BasicElement = UdtOp
|
421
|
+
`,t+=` / RnmOp
|
422
|
+
`,t+=` / TrgOp
|
423
|
+
`,t+=` / TbsOp
|
424
|
+
`,t+=` / TlsOp
|
425
|
+
`,t+=` / ClsOp
|
426
|
+
`,t+=` / BkrOp
|
427
|
+
`,t+=` / AbgOp
|
428
|
+
`,t+=` / AenOp
|
429
|
+
`,t+=` / ProsVal
|
430
|
+
`,t+=`BasicElementErr = 1*(%d33-40/%d42-46/%d48-92/%d94-126)
|
431
|
+
`,t+=`Group = GroupOpen Alternation (GroupClose / GroupError)
|
432
|
+
`,t+=`GroupError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
|
433
|
+
`,t+=`GroupOpen = %d40 owsp
|
434
|
+
`,t+=`GroupClose = owsp %d41
|
435
|
+
`,t+=`Option = OptionOpen Alternation (OptionClose / OptionError)
|
436
|
+
`,t+=`OptionError = 1*(%d33-40/%d42-46/%d48-92/%d94-126) ; same as BasicElementErr
|
437
|
+
`,t+=`OptionOpen = %d91 owsp
|
438
|
+
`,t+=`OptionClose = owsp %d93
|
439
|
+
`,t+=`RnmOp = alphanum
|
440
|
+
`,t+=`BkrOp = %d92 [bkrModifier] bkr-name
|
441
|
+
`,t+=`bkrModifier = (cs [um / pm]) / (ci [um / pm]) / (um [cs /ci]) / (pm [cs / ci])
|
442
|
+
`,t+=`cs = '%s'
|
443
|
+
`,t+=`ci = '%i'
|
444
|
+
`,t+=`um = '%u'
|
445
|
+
`,t+=`pm = '%p'
|
446
|
+
`,t+=`bkr-name = uname / ename / rname
|
447
|
+
`,t+=`rname = alphanum
|
448
|
+
`,t+=`uname = %d117.95 alphanum
|
449
|
+
`,t+=`ename = %d101.95 alphanum
|
450
|
+
`,t+=`UdtOp = udt-empty
|
451
|
+
`,t+=` / udt-non-empty
|
452
|
+
`,t+=`udt-non-empty = %d117.95 alphanum
|
453
|
+
`,t+=`udt-empty = %d101.95 alphanum
|
454
|
+
`,t+=`RepOp = (rep-min StarOp rep-max)
|
455
|
+
`,t+=` / (rep-min StarOp)
|
456
|
+
`,t+=` / (StarOp rep-max)
|
457
|
+
`,t+=` / StarOp
|
458
|
+
`,t+=` / rep-min-max
|
459
|
+
`,t+=`AltOp = %d47 owsp
|
460
|
+
`,t+=`CatOp = wsp
|
461
|
+
`,t+=`StarOp = %d42
|
462
|
+
`,t+=`AndOp = %d38
|
463
|
+
`,t+=`NotOp = %d33
|
464
|
+
`,t+=`BkaOp = %d38.38
|
465
|
+
`,t+=`BknOp = %d33.33
|
466
|
+
`,t+=`AbgOp = %d37.94
|
467
|
+
`,t+=`AenOp = %d37.36
|
468
|
+
`,t+=`TrgOp = %d37 ((Dec dmin %d45 dmax) / (Hex xmin %d45 xmax) / (Bin bmin %d45 bmax))
|
469
|
+
`,t+=`TbsOp = %d37 ((Dec dString *(%d46 dString)) / (Hex xString *(%d46 xString)) / (Bin bString *(%d46 bString)))
|
470
|
+
`,t+=`TlsOp = TlsCase TlsOpen TlsString TlsClose
|
471
|
+
`,t+=`TlsCase = ["%i" / "%s"]
|
472
|
+
`,t+=`TlsOpen = %d34
|
473
|
+
`,t+=`TlsClose = %d34
|
474
|
+
`,t+=`TlsString = *(%d32-33/%d35-126/StringTab)
|
475
|
+
`,t+=`StringTab = %d9
|
476
|
+
`,t+=`ClsOp = ClsOpen ClsString ClsClose
|
477
|
+
`,t+=`ClsOpen = %d39
|
478
|
+
`,t+=`ClsClose = %d39
|
479
|
+
`,t+=`ClsString = *(%d32-38/%d40-126/StringTab)
|
480
|
+
`,t+=`ProsVal = ProsValOpen ProsValString ProsValClose
|
481
|
+
`,t+=`ProsValOpen = %d60
|
482
|
+
`,t+=`ProsValString = *(%d32-61/%d63-126/StringTab)
|
483
|
+
`,t+=`ProsValClose = %d62
|
484
|
+
`,t+=`rep-min = rep-num
|
485
|
+
`,t+=`rep-min-max = rep-num
|
486
|
+
`,t+=`rep-max = rep-num
|
487
|
+
`,t+=`rep-num = 1*(%d48-57)
|
488
|
+
`,t+=`dString = dnum
|
489
|
+
`,t+=`xString = xnum
|
490
|
+
`,t+=`bString = bnum
|
491
|
+
`,t+=`Dec = (%d68/%d100)
|
492
|
+
`,t+=`Hex = (%d88/%d120)
|
493
|
+
`,t+=`Bin = (%d66/%d98)
|
494
|
+
`,t+=`dmin = dnum
|
495
|
+
`,t+=`dmax = dnum
|
496
|
+
`,t+=`bmin = bnum
|
497
|
+
`,t+=`bmax = bnum
|
498
|
+
`,t+=`xmin = xnum
|
499
|
+
`,t+=`xmax = xnum
|
500
|
+
`,t+=`dnum = 1*(%d48-57)
|
501
|
+
`,t+=`bnum = 1*%d48-49
|
502
|
+
`,t+=`xnum = 1*(%d48-57 / %d65-70 / %d97-102)
|
503
|
+
`,t+=`;
|
504
|
+
`,t+=`; Basics
|
505
|
+
`,t+=`alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)
|
506
|
+
`,t+=`owsp = *space
|
507
|
+
`,t+=`wsp = 1*space
|
508
|
+
`,t+=`space = %d32
|
509
|
+
`,t+=` / %d9
|
510
|
+
`,t+=` / comment
|
511
|
+
`,t+=` / LineContinue
|
512
|
+
`,t+=`comment = %d59 *(%d32-126 / %d9)
|
513
|
+
`,t+=`LineEnd = %d13.10
|
514
|
+
`,t+=` / %d10
|
515
|
+
`,t+=` / %d13
|
516
|
+
`,t+=`LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)
|
517
|
+
`,t},"toString")},"grammar")});var Nx=de((i$,Ix)=>{Ix.exports=o(function(){let e="parser: ",t=da(),n=t.ids,i=new(Cx()),s=new(Tx()),a=new(Bx()),c=new t.parser;c.ast=new t.ast,c.callbacks=i.callbacks,c.ast.callbacks=s.callbacks;let f=o(function(v,x,y){if(x<0||x>=y)return-1;for(let _=0;_<v.length;_+=1)if(x>=v[_].beginChar&&x<v[_].beginChar+v[_].length)return _;return-1},"findLine"),l=o(function(v,x){let y=-1;if(x<v.length){for(let _=x;_<v.length;_+=1)if(v[_]!==null){y=v[_];break}}return y},"translateIndex"),h=o(function(v){v.forEach(x=>{let y=[],_=[],U=0;x.opcodes.forEach(E=>{E.type===n.ALT&&E.children.length===1||E.type===n.CAT&&E.children.length===1||E.type===n.REP&&E.min===1&&E.max===1?_.push(null):(_.push(U),y.push(E),U+=1)}),_.push(U),y.forEach(E=>{if(E.type===n.ALT||E.type===n.CAT)for(let L=0;L<E.children.length;L+=1)E.children[L]=l(_,E.children[L])}),x.opcodes=y})},"reduceOpcodes");this.syntax=o(function(v,x,y,_,U){if(U){if(U.traceObject!=="traceObject")throw new TypeError(`${e}trace argument is not a trace object`);c.trace=U}let E={};E.errors=y,E.strict=!!_,E.lines=x,E.findLine=f,E.charsLength=v.length,E.ruleCount=0,c.parse(a,"file",v,E).success||y.push({line:0,char:0,msg:"syntax analysis of input grammar failed"})},"syntax"),this.semantic=o(function(v,x,y){let _={};return _.errors=y,_.lines=x,_.findLine=f,_.charsLength=v.length,c.ast.translate(_),y.length?null:(h(_.rules),{rules:_.rules,udts:_.udts,lineMap:_.rulesLineMap})},"semantic"),this.generateSource=o(function(v,x,y,_,U){let E="",L,H,F,j=0,D=1/0,B=0,R=[],Y=[],b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,k=0,g=0,C=0,Z=0,V=0,K=0,fe=0;y.forEach(Q=>{R.push(Q.lower),j+=Q.opcodes.length,Q.opcodes.forEach(P=>{switch(P.type){case n.ALT:b+=1;break;case n.CAT:u+=1;break;case n.RNM:p+=1;break;case n.UDT:m+=1;break;case n.REP:w+=1;break;case n.AND:S+=1;break;case n.NOT:N+=1;break;case n.BKA:Z+=1;break;case n.BKN:V+=1;break;case n.BKR:C+=1;break;case n.ABG:K+=1;break;case n.AEN:fe+=1;break;case n.TLS:for(I+=1,L=0;L<P.string.length;L+=1)P.string[L]<D&&(D=P.string[L]),P.string[L]>B&&(B=P.string[L]);break;case n.TBS:for(k+=1,L=0;L<P.string.length;L+=1)P.string[L]<D&&(D=P.string[L]),P.string[L]>B&&(B=P.string[L]);break;case n.TRG:g+=1,P.min<D&&(D=P.min),P.max>B&&(B=P.max);break;default:throw new Error("generateSource: unrecognized opcode")}})}),R.sort(),_.length>0&&(_.forEach(Q=>{Y.push(Q.lower)}),Y.sort());let A="module.exports";U&&typeof U=="string"&&(A=`let ${U}`),E+=`// copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved<br>
|
518
|
+
`,E+=`// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
|
519
|
+
`,E+=`//
|
520
|
+
`,E+=`// Generated by apg-js, Version 4.0.0 [apg-js](https://github.com/ldthomas/apg-js)
|
521
|
+
`,E+=`${A} = function grammar(){
|
522
|
+
`,E+=" // ```\n",E+=` // SUMMARY
|
523
|
+
`,E+=` // rules = ${y.length}
|
524
|
+
`,E+=` // udts = ${_.length}
|
525
|
+
`,E+=` // opcodes = ${j}
|
526
|
+
`,E+=` // --- ABNF original opcodes
|
527
|
+
`,E+=` // ALT = ${b}
|
528
|
+
`,E+=` // CAT = ${u}
|
529
|
+
`,E+=` // REP = ${w}
|
530
|
+
`,E+=` // RNM = ${p}
|
531
|
+
`,E+=` // TLS = ${I}
|
532
|
+
`,E+=` // TBS = ${k}
|
533
|
+
`,E+=` // TRG = ${g}
|
534
|
+
`,E+=` // --- SABNF superset opcodes
|
535
|
+
`,E+=` // UDT = ${m}
|
536
|
+
`,E+=` // AND = ${S}
|
537
|
+
`,E+=` // NOT = ${N}
|
538
|
+
`,E+=` // BKA = ${Z}
|
539
|
+
`,E+=` // BKN = ${V}
|
540
|
+
`,E+=` // BKR = ${C}
|
541
|
+
`,E+=` // ABG = ${K}
|
542
|
+
`,E+=` // AEN = ${fe}
|
543
|
+
`,E+=" // characters = [",I+k+g===0?E+=" none defined ]":E+=`${D} - ${B}]`,m>0&&(E+=" + user defined"),E+=`
|
544
|
+
`,E+=" // ```\n",E+=` /* OBJECT IDENTIFIER (for internal parser use) */
|
545
|
+
`,E+=` this.grammarObject = 'grammarObject';
|
546
|
+
`,E+=`
|
547
|
+
`,E+=` /* RULES */
|
548
|
+
`,E+=` this.rules = [];
|
549
|
+
`,y.forEach((Q,P)=>{let O=" this.rules[";O+=P,O+="] = {name: '",O+=Q.name,O+="', lower: '",O+=Q.lower,O+="', index: ",O+=Q.index,O+=", isBkr: ",O+=Q.isBkr,O+=`};
|
550
|
+
`,E+=O}),E+=`
|
551
|
+
`,E+=` /* UDTS */
|
552
|
+
`,E+=` this.udts = [];
|
553
|
+
`,_.length>0&&_.forEach((Q,P)=>{let O=" this.udts[";O+=P,O+="] = {name: '",O+=Q.name,O+="', lower: '",O+=Q.lower,O+="', index: ",O+=Q.index,O+=", empty: ",O+=Q.empty,O+=", isBkr: ",O+=Q.isBkr,O+=`};
|
554
|
+
`,E+=O}),E+=`
|
555
|
+
`,E+=` /* OPCODES */
|
556
|
+
`,y.forEach((Q,P)=>{P>0&&(E+=`
|
557
|
+
`),E+=` /* ${Q.name} */
|
558
|
+
`,E+=` this.rules[${P}].opcodes = [];
|
559
|
+
`,Q.opcodes.forEach((O,z)=>{let W;switch(O.type){case n.ALT:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, children: [${O.children.toString()}]};// ALT
|
560
|
+
`;break;case n.CAT:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, children: [${O.children.toString()}]};// CAT
|
561
|
+
`;break;case n.RNM:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, index: ${O.index}};// RNM(${y[O.index].name})
|
562
|
+
`;break;case n.BKR:O.index>=y.length?(H=_[O.index-y.length].name,F=_[O.index-y.length].lower):(H=y[O.index].name,F=y[O.index].lower),W="%i",O.bkrCase===n.BKR_MODE_CS&&(W="%s"),O.bkrMode===n.BKR_MODE_UM?W+="%u":W+="%p",H=W+H,E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, index: ${O.index}, lower: '${F}', bkrCase: ${O.bkrCase}, bkrMode: ${O.bkrMode}};// BKR(\\${H})
|
563
|
+
`;break;case n.UDT:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, empty: ${O.empty}, index: ${O.index}};// UDT(${_[O.index].name})
|
564
|
+
`;break;case n.REP:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, min: ${O.min}, max: ${O.max}};// REP
|
565
|
+
`;break;case n.AND:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// AND
|
566
|
+
`;break;case n.NOT:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// NOT
|
567
|
+
`;break;case n.ABG:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// ABG(%^)
|
568
|
+
`;break;case n.AEN:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// AEN(%$)
|
569
|
+
`;break;case n.BKA:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// BKA
|
570
|
+
`;break;case n.BKN:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// BKN
|
571
|
+
`;break;case n.TLS:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, string: [${O.string.toString()}]};// TLS
|
572
|
+
`;break;case n.TBS:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, string: [${O.string.toString()}]};// TBS
|
573
|
+
`;break;case n.TRG:E+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, min: ${O.min}, max: ${O.max}};// TRG
|
574
|
+
`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}})}),E+=`
|
575
|
+
`,E+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",E+=` this.toString = function toString(){
|
576
|
+
`,E+=` let str = "";
|
577
|
+
`;let X;return x.forEach(Q=>{let P=Q.beginChar+Q.length;X="",E+=' str += "';for(let O=Q.beginChar;O<P;O+=1){switch(v[O]){case 9:X=" ";break;case 10:X="\\n";break;case 13:X="\\r";break;case 34:X='\\"';break;case 92:X="\\\\";break;default:X=String.fromCharCode(v[O]);break}E+=X}E+=`";
|
578
|
+
`}),E+=` return str;
|
579
|
+
`,E+=` }
|
580
|
+
`,E+=`}
|
581
|
+
`,E},"generateSource"),this.generateObject=o(function(v,x,y){let _={},U=[],E=[],L=v.slice(0);return _.grammarObject="grammarObject",x.forEach(H=>{U.push(H.lower)}),U.sort(),y.length>0&&(y.forEach(H=>{E.push(H.lower)}),E.sort()),_.callbacks=[],U.forEach(H=>{_.callbacks[H]=!1}),y.length>0&&E.forEach(H=>{_.callbacks[H]=!1}),_.rules=x,_.udts=y,_.toString=o(function(){return L},"toStringFunc"),_},"generateObject")},"exportParser")});var Px=de((s$,Ox)=>{Ox.exports=o(function(){let e=Qn(),t="rule-attributes.js",n=null;function i(b){return b.left||b.nested||b.right||b.cyclic?!1:b.empty}o(i,"isEmptyOnly");function s(b){return!!(b.left||b.nested||b.right||b.cyclic)}o(s,"isRecursive");function a(b,u){let p=0,m=0,w=0;for(p=0;p<u;p+=1)if(b[p].nested)return!0;for(p=0;p<u;p+=1)if(b[p].right&&!b[p].leaf){for(m=p+1;m<u;m+=1)if(!i(b[m]))return!0}for(p=u-1;p>=0;p-=1)if(b[p].left&&!b[p].leaf){for(m=p-1;m>=0;m-=1)if(!i(b[m]))return!0}for(p=0;p<u;p+=1)if(!b[p].empty&&!s(b[p])){for(m=p+1;m<u;m+=1)if(s(b[m])){for(w=m+1;w<u;w+=1)if(!b[w].empty&&!s(b[w]))return!0}}return!1}o(a,"isCatNested");function c(b,u){for(let p=0;p<u;p+=1)if(!b[p].cyclic)return!1;return!0}o(c,"isCatCyclic");function f(b,u){for(let p=0;p<u;p+=1){if(b[p].left)return!0;if(!b[p].empty)return!1}return!1}o(f,"isCatLeft");function l(b,u){for(let p=u-1;p>=0;p-=1){if(b[p].right)return!0;if(!b[p].empty)return!1}return!1}o(l,"isCatRight");function h(b,u){for(let p=0;p<u;p+=1)if(!b[p].empty)return!1;return!0}o(h,"isCatEmpty");function d(b,u){for(let p=0;p<u;p+=1)if(!b[p].finite)return!1;return!0}o(d,"isCatFinite");function v(b,u,p,m){let w=0,S=u[p],N=S.children.length,I=[];for(w=0;w<N;w+=1)I.push(b.attrGen());for(w=0;w<N;w+=1)_(b,u,S.children[w],I[w]);m.left=f(I,N),m.right=l(I,N),m.nested=a(I,N),m.empty=h(I,N),m.finite=d(I,N),m.cyclic=c(I,N)}o(v,"cat");function x(b,u,p,m){let w=0,S=u[p],N=S.children.length,I=[];for(w=0;w<N;w+=1)I.push(b.attrGen());for(w=0;w<N;w+=1)_(b,u,S.children[w],I[w]);for(m.left=!1,m.right=!1,m.nested=!1,m.empty=!1,m.finite=!1,m.cyclic=!1,w=0;w<N;w+=1)I[w].left&&(m.left=!0),I[w].nested&&(m.nested=!0),I[w].right&&(m.right=!0),I[w].empty&&(m.empty=!0),I[w].finite&&(m.finite=!0),I[w].cyclic&&(m.cyclic=!0)}o(x,"alt");function y(b,u,p,m){let w=u[p];w.index>=b.ruleCount?(m.empty=b.udts[w.index-b.ruleCount].empty,m.finite=!0):(U(b,w.index,m),m.left=!1,m.nested=!1,m.right=!1,m.cyclic=!1)}o(y,"bkr");function _(b,u,p,m){b.attrInit(m);let w=u[p];switch(w.type){case e.ALT:x(b,u,p,m);break;case e.CAT:v(b,u,p,m);break;case e.REP:_(b,u,p+1,m),w.min===0&&(m.empty=!0,m.finite=!0);break;case e.RNM:U(b,u[p].index,m);break;case e.BKR:y(b,u,p,m);break;case e.AND:case e.NOT:case e.BKA:case e.BKN:_(b,u,p+1,m),m.empty=!0;break;case e.TLS:m.empty=!u[p].string.length,m.finite=!0,m.cyclic=!1;break;case e.TBS:case e.TRG:m.empty=!1,m.finite=!0,m.cyclic=!1;break;case e.UDT:m.empty=w.empty,m.finite=!0,m.cyclic=!1;break;case e.ABG:case e.AEN:m.empty=!0,m.finite=!0,m.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${w}`)}}o(_,"opEval");function U(b,u,p){let m=b.attrsWorking[u];m.isComplete?b.attrCopy(p,m):m.isOpen?u===b.startRule?u===b.startRule&&(p.left=!0,p.right=!0,p.cyclic=!0,p.leaf=!0):p.finite=!0:(m.isOpen=!0,_(b,m.rule.opcodes,0,p),m.left=p.left,m.right=p.right,m.nested=p.nested,m.empty=p.empty,m.finite=p.finite,m.cyclic=p.cyclic,m.leaf=!1,m.isOpen=!1,m.isComplete=!0)}o(U,"ruleAttrsEval");let E=o(b=>{n=b;let u=0,p=0,m=n.attrGen();for(u=0;u<n.ruleCount;u+=1){for(p=0;p<n.ruleCount;p+=1)n.attrInit(n.attrsWorking[p]);n.startRule=u,U(n,u,m),n.attrCopy(n.attrs[u],n.attrsWorking[u])}n.attributesComplete=!0;let w=null;for(u=0;u<n.ruleCount;u+=1)if(w=n.attrs[u],w.left||!w.finite||w.cyclic){let S=n.attrGen(w.rule);n.attrCopy(S,w),n.attrsErrors.push(S),n.attrsErrorCount+=1}},"ruleAttributes"),L=o(b=>b?"t":"f","truth"),H=o(b=>b?"e":"f","tError"),F=o(b=>b?"t":"e","fError"),j=o((b,u,p,m)=>{let w=`${b}:${u}:`;return w+=`${H(p.left)} `,w+=`${L(p.nested)} `,w+=`${L(p.right)} `,w+=`${H(p.cyclic)} `,w+=`${F(p.finite)} `,w+=`${L(p.empty)}:`,w+=`${n.typeToString(m.recursiveType)}:`,w+=m.recursiveType===e.ATTR_MR?m.groupNumber:"-",w+=`:${p.rule.name}
|
582
|
+
`,w},"showAttr"),D=o(()=>{let b=`LEGEND - t=true, f=false, e=error
|
583
|
+
`;return b+=`sequence:rule index:left nested right cyclic finite empty:type:group number:rule name
|
584
|
+
`,b},"showLegend"),B=o(()=>{let b=null,u=null,p="";if(p+=`RULE ATTRIBUTES WITH ERRORS
|
585
|
+
`,p+=D(),n.attrsErrorCount)for(let m=0;m<n.attrsErrorCount;m+=1)b=n.attrsErrors[m],u=n.ruleDeps[b.rule.index],p+=j(m,b.rule.index,b,u);else p+=`<none>
|
586
|
+
`;return p},"showAttributeErrors"),R=o(b=>{let u=0,p=0,m=null,w=null,S="",{ruleIndexes:N}=n;for(b===97?N=n.ruleAlphaIndexes:b===116&&(N=n.ruleTypeIndexes),u=0;u<n.ruleCount;u+=1)p=N[u],m=n.attrs[p],w=n.ruleDeps[p],S+=j(u,p,m,w);return S},"show");return{ruleAttributes:E,showAttributes:o((b="index")=>{if(!n.attributesComplete)throw new Error(`${t}:showAttributes: attributes not available`);let u="",p=`RULE ATTRIBUTES
|
587
|
+
`;return b.charCodeAt(0)===97?(u+=`alphabetical by rule name
|
588
|
+
`,u+=p,u+=D(),u+=R(97)):b.charCodeAt(0)===116?(u+=`ordered by rule type
|
589
|
+
`,u+=p,u+=D(),u+=R(116)):(u+=`ordered by rule index
|
590
|
+
`,u+=p,u+=D(),u+=R()),u},"showAttributes"),showAttributeErrors:B}},"exportRuleAttributes")()});var Ux=de((o$,Rx)=>{Rx.exports=(()=>{let r=Qn(),e=null,t=o((a,c,f,l)=>{let h=0,d=0,v=c[f];l[f]=!0;let x=v.rule.opcodes;for(h=0;h<x.length;h+=1){let y=x[h];if(y.type===r.RNM)for(v.refersTo[y.index]=!0,l[y.index]||t(a,c,y.index,l),d=0;d<a;d+=1)c[y.index].refersTo[d]&&(v.refersTo[d]=!0);else y.type===r.UDT?v.refersToUdt[y.index]=!0:y.type===r.BKR&&(y.index<a?(v.refersTo[y.index]=!0,l[y.index]||t(a,c,y.index,l)):v.refersToUdt[a-y.index]=!0)}},"scan"),n=o(a=>{e=a;let c=0,f=0,l=0,h=null,d=null,v=!1;e.dependenciesComplete=!1;let x=e.falseArray(e.ruleCount);for(c=0;c<e.ruleCount;c+=1)e.falsifyArray(x),t(e.ruleCount,e.ruleDeps,c,x);for(c=0;c<e.ruleCount;c+=1)for(f=0;f<e.ruleCount;f+=1)c!==f&&e.ruleDeps[f].refersTo[c]&&(e.ruleDeps[c].referencedBy[f]=!0);for(c=0;c<e.ruleCount;c+=1)e.ruleDeps[c].recursiveType=r.ATTR_N,e.ruleDeps[c].refersTo[c]&&(e.ruleDeps[c].recursiveType=r.ATTR_R);for(l=-1,c=0;c<e.ruleCount;c+=1)if(h=e.ruleDeps[c],h.recursiveType===r.ATTR_R)for(v=!0,f=0;f<e.ruleCount;f+=1)c!==f&&(d=e.ruleDeps[f],d.recursiveType===r.ATTR_R&&h.refersTo[f]&&d.refersTo[c]&&(v&&(l+=1,h.recursiveType=r.ATTR_MR,h.groupNumber=l,v=!1),d.recursiveType=r.ATTR_MR,d.groupNumber=l));e.isMutuallyRecursive=l>-1,e.ruleAlphaIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesType),e.isMutuallyRecursive&&e.ruleTypeIndexes.sort(e.compRulesGroup),e.udtCount&&e.udtAlphaIndexes.sort(e.compUdtsAlpha),e.dependenciesComplete=!0},"ruleDependencies"),i=o((a=null)=>{let c=0,f=0,l=0,h=0,d=e.ruleCount-1,v=e.udtCount-1,x=100,y="",_="",U="=> ",E="<= ",L=!1,H=null,{ruleIndexes:F}=e,{udtIndexes:j}=e;for(a===97?(F=e.ruleAlphaIndexes,j=e.udtAlphaIndexes):a===116&&(F=e.ruleTypeIndexes,j=e.udtAlphaIndexes),c=0;c<e.ruleCount;c+=1){for(H=e.ruleDeps[F[c]],_=`${F[c]}:${e.typeToString(H.recursiveType)}:`,e.isMutuallyRecursive&&(_+=H.groupNumber>-1?H.groupNumber:"-",_+=":"),_+=" ",y+=`${_+e.rules[F[c]].name}
|
591
|
+
`,L=!0,l=0,h=y.length,y+=_,f=0;f<e.ruleCount;f+=1)H.refersTo[F[f]]&&(L?(y+=U,L=!1,y+=e.ruleDeps[F[f]].rule.name):y+=`, ${e.ruleDeps[F[f]].rule.name}`,l+=1),y.length-h>x&&f!==d&&(y+=`
|
592
|
+
${_}${U}`,h=y.length);if(e.udtCount)for(f=0;f<e.udtCount;f+=1)H.refersToUdt[j[f]]&&(L?(y+=U,L=!1,y+=e.udts[j[f]].name):y+=`, ${e.udts[j[f]].name}`,l+=1),y.length-h>x&&f!==v&&(y+=`
|
593
|
+
${_}${U}`,h=y.length);for(l===0&&(y+=`=> <none>
|
594
|
+
`),L===!1&&(y+=`
|
595
|
+
`),L=!0,l=0,h=y.length,y+=_,f=0;f<e.ruleCount;f+=1)H.referencedBy[F[f]]&&(L?(y+=E,L=!1,y+=e.ruleDeps[F[f]].rule.name):y+=`, ${e.ruleDeps[F[f]].rule.name}`,l+=1),y.length-h>x&&f!==d&&(y+=`
|
596
|
+
${_}${U}`,h=y.length);l===0&&(y+=`<= <none>
|
597
|
+
`),L===!1&&(y+=`
|
598
|
+
`),y+=`
|
599
|
+
`}return y},"show");return{ruleDependencies:n,showRuleDependencies:o((a="index")=>{let c=`RULE DEPENDENCIES(index:type:[group number:])
|
600
|
+
`;return c+=`=> refers to rule names
|
601
|
+
`,c+=`<= referenced by rule names
|
602
|
+
`,e.dependenciesComplete&&(a.charCodeAt(0)===97?(c+=`alphabetical by rule name
|
603
|
+
`,c+=i(97)):a.charCodeAt(0)===116?(c+=`ordered by rule type
|
604
|
+
`,c+=i(116)):(c+=`ordered by rule index
|
605
|
+
`,c+=i(null))),c},"showRuleDependencies")}})()});var Dx=de((a$,Lx)=>{Lx.exports=o(function(){let e=Qn(),{ruleAttributes:t,showAttributes:n,showAttributeErrors:i}=Px(),{ruleDependencies:s,showRuleDependencies:a}=Ux();class c{constructor(h,d){this.rules=h,this.udts=d,this.ruleCount=h.length,this.udtCount=d.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let v=0;v<this.ruleCount;v+=1)this.attrs.push(this.attrGen(this.rules[v])),this.attrsWorking.push(this.attrGen(this.rules[v])),this.ruleDeps.push(this.rdGen(h[v],this.ruleCount,this.udtCount));this.compRulesAlpha=this.compRulesAlpha.bind(this),this.compUdtsAlpha=this.compUdtsAlpha.bind(this),this.compRulesType=this.compRulesType.bind(this),this.compRulesGroup=this.compRulesGroup.bind(this)}attrGen(h){return{left:!1,nested:!1,right:!1,empty:!1,finite:!1,cyclic:!1,leaf:!1,isOpen:!1,isComplete:!1,rule:h}}attrInit(h){h.left=!1,h.nested=!1,h.right=!1,h.empty=!1,h.finite=!1,h.cyclic=!1,h.leaf=!1,h.isOpen=!1,h.isComplete=!1}attrCopy(h,d){h.left=d.left,h.nested=d.nested,h.right=d.right,h.empty=d.empty,h.finite=d.finite,h.cyclic=d.cyclic,h.leaf=d.leaf,h.isOpen=d.isOpen,h.isComplete=d.isComplete,h.rule=d.rule}rdGen(h,d,v){return{rule:h,recursiveType:e.ATTR_N,groupNumber:-1,refersTo:this.falseArray(d),refersToUdt:this.falseArray(v),referencedBy:this.falseArray(d)}}typeToString(h){switch(h){case e.ATTR_N:return" N";case e.ATTR_R:return" R";case e.ATTR_MR:return"MR";default:return"UNKNOWN"}}falseArray(h){let d=[];if(h>0)for(let v=0;v<h;v+=1)d.push(!1);return d}falsifyArray(h){for(let d=0;d<h.length;d+=1)h[d]=!1}indexArray(h){let d=[];if(h>0)for(let v=0;v<h;v+=1)d.push(v);return d}compRulesAlpha(h,d){return this.rules[h].lower<this.rules[d].lower?-1:this.rules[h].lower>this.rules[d].lower?1:0}compUdtsAlpha(h,d){return this.udts[h].lower<this.udts[d].lower?-1:this.udts[h].lower>this.udts[d].lower?1:0}compRulesType(h,d){return this.ruleDeps[h].recursiveType<this.ruleDeps[d].recursiveType?-1:this.ruleDeps[h].recursiveType>this.ruleDeps[d].recursiveType?1:0}compRulesGroup(h,d){if(this.ruleDeps[h].recursiveType===e.ATTR_MR&&this.ruleDeps[d].recursiveType===e.ATTR_MR){if(this.ruleDeps[h].groupNumber<this.ruleDeps[d].groupNumber)return-1;if(this.ruleDeps[h].groupNumber>this.ruleDeps[d].groupNumber)return 1}return 0}}return o(c,"State"),{attributes:o(function(h=[],d=[],v=[],x=[]){let y=new c(h,d);return s(y),t(y),y.attrsErrorCount&&x.push({line:0,char:0,msg:`${y.attrsErrorCount} attribute errors`}),y.attrsErrorCount},"attributes"),showAttributes:n,showAttributeErrors:i,showRuleDependencies:a}},"exportAttributes")()});var $x=de((c$,Kx)=>{Kx.exports=o(function(){let e="show-rules.js";return o(function(i=[],s=[],a="index"){let c="showRules",f=[],l=[],h=[],d=[],v=i,x=s,y=i.length,_=s.length,U="RULE/UDT NAMES",E;function L(F,j){return v[F].lower<v[j].lower?-1:v[F].lower>v[j].lower?1:0}o(L,"compRulesAlpha");function H(F,j){return x[F].lower<x[j].lower?-1:x[F].lower>x[j].lower?1:0}if(o(H,"compUdtsAlpha"),!(Array.isArray(i)&&i.length))throw new Error(`${e}:${c}: rules arg must be array with length > 0`);if(!Array.isArray(s))throw new Error(`${e}:${c}: udts arg must be array`);for(E=0;E<y;E+=1)h.push(E);if(f=h.slice(0),f.sort(L),_){for(E=0;E<_;E+=1)d.push(E);l=d.slice(0),l.sort(H)}if(a.charCodeAt(0)===97){for(U+=` - alphabetical by rule/UDT name
|
606
|
+
`,E=0;E<y;E+=1)U+=`${E}: ${f[E]}: ${v[f[E]].name}
|
607
|
+
`;if(_)for(E=0;E<_;E+=1)U+=`${E}: ${l[E]}: ${x[l[E]].name}
|
608
|
+
`}else{for(U+=` - ordered by rule/UDT index
|
609
|
+
`,E=0;E<y;E+=1)U+=`${E}: ${v[E].name}
|
610
|
+
`;if(_)for(E=0;E<_;E+=1)U+=`${E}: ${x[E].name}
|
611
|
+
`}return U},"showRules")},"exports")()});var Hx=de((f$,Fx)=>{Fx.exports=o(function(e){let t="api.js: ",n=this,i=da(),s=C1(),a=Ex(),c=new(Nx()),{attributes:f,showAttributes:l,showAttributeErrors:h,showRuleDependencies:d}=Dx(),v=$x(),x=o(function(b,u,p){let N=`<span class="${i.style.CLASS_CTRLCHAR}">`,I="</span>",k=`<span class="${i.style.CLASS_NOMATCH}">`,g="</span>",C,Z="",V=!0;for(;V&&!(!Array.isArray(b)||b.length===0);){if(typeof u!="number")throw new Error("abnfToHtml: beg must be type number");if(u>=b.length)break;typeof p!="number"||u+p>=b.length?C=b.length:C=u+p;let K=0;for(let fe=u;fe<C;fe+=1){let A=b[fe];if(A>=32&&A<=126)switch(K===1?(Z+=I,K=0):K===2&&(Z+=g,K=0),A){case 32:Z+=" ";break;case 60:Z+="<";break;case 62:Z+=">";break;case 38:Z+="&";break;case 34:Z+=""";break;case 39:Z+="'";break;case 92:Z+="\";break;default:Z+=String.fromCharCode(A);break}else A===9||A===10||A===13?(K===0?(Z+=N,K=1):K===2&&(Z+=g+N,K=1),A===9&&(Z+="TAB"),A===10&&(Z+="LF"),A===13&&(Z+="CR")):(K===0?(Z+=k,K=2):K===1&&(Z+=I+k,K=2),Z+=`\\x${i.utils.charToHex(A)}`)}K===2&&(Z+=g),K===1&&(Z+=I);break}return Z},"abnfToHtml"),y=o(function(b,u,p){let m="";for(let w=u;w<u+p;w+=1){let S=b[w];if(S>=32&&S<=126)m+=String.fromCharCode(S);else switch(S){case 9:m+="\\t";break;case 10:m+="\\n";break;case 13:m+="\\r";break;default:m+="\\unknown";break}}return m},"abnfToAscii"),_=o(function(b){let u="Annotated Input Grammar";return b.forEach(p=>{u+=`
|
612
|
+
`,u+=`line no: ${p.lineNo}`,u+=` : char index: ${p.beginChar}`,u+=` : length: ${p.length}`,u+=` : abnf: ${y(n.chars,p.beginChar,p.length)}`}),u+=`
|
613
|
+
`,u},"linesToAscii"),U=o(function(b){let u="";return u+=`<table class="${i.style.CLASS_GRAMMAR}">
|
614
|
+
`,u+=`<caption>Annotated Input Grammar</caption>
|
615
|
+
`,u+="<tr>",u+="<th>line<br>no.</th><th>first<br>char</th><th><br>length</th><th><br>text</th>",u+=`</tr>
|
616
|
+
`,b.forEach(m=>{u+="<tr>",u+=`<td>${m.lineNo}`,u+=`</td><td>${m.beginChar}`,u+=`</td><td>${m.length}`,u+=`</td><td>${x(n.chars,m.beginChar,m.length)}`,u+="</td>",u+=`</tr>
|
617
|
+
`}),u+=`</table>
|
618
|
+
`,u},"linesToHtml"),E=o(function(b,u,p,m){let[w]=i,S="",N=`<span class="${w.CLASS_NOMATCH}">»</span>`;return S+=`<p><table class="${w.CLASS_GRAMMAR}">
|
619
|
+
`,m&&typeof m=="string"&&(S+=`<caption>${m}</caption>
|
620
|
+
`),S+=`<tr><th>line<br>no.</th><th>line<br>offset</th><th>error<br>offset</th><th><br>text</th></tr>
|
621
|
+
`,b.forEach(I=>{let k,g,C,Z,V,K="",fe="";u.length===0?(V=N,g=0):(k=u[I.line],C=k.beginChar,I.char>C&&(K=x(p,C,I.char-C)),C=I.char,Z=k.beginChar+k.length,C<Z&&(fe=x(p,C,Z-C)),V=K+N+fe,g=I.char-k.beginChar,S+="<tr>",S+=`<td>${I.line}</td><td>${k.beginChar}</td><td>${g}</td><td>${V}</td>`,S+=`</tr>
|
622
|
+
`,S+="<tr>",S+=`<td colspan="3"></td><td>↑: ${i.utils.stringToAsciiHtml(I.msg)}</td>`,S+=`</tr>
|
623
|
+
`)}),S+=`</table></p>
|
624
|
+
`,S},"errorsToHtml"),L=o(function(b,u,p){let m,w,S,N;return m="",b.forEach(I=>{w=u[I.line],m+=`${w.lineNo}: `,m+=`${w.beginChar}: `,m+=`${I.char-w.beginChar}: `,S=w.beginChar,N=I.char-w.beginChar,m+=y(p,S,N),m+=" >> ",S=I.char,N=w.beginChar+w.length-I.char,m+=y(p,S,N),m+=`
|
625
|
+
`,m+=`${w.lineNo}: `,m+=`${w.beginChar}: `,m+=`${I.char-w.beginChar}: `,m+="error: ",m+=I.msg,m+=`
|
626
|
+
`}),m},"errorsToAscii"),H=!1,F=!1,j=!1,D=!1,B=0,R;if(this.errors=[],Buffer.isBuffer(e))this.chars=s.decode("BINARY",e);else if(Array.isArray(e))this.chars=e.slice();else if(typeof e=="string")this.chars=s.decode("STRING",e);else throw new Error(`${t}input source is not a string, byte Buffer or character array`);this.sabnf=s.encode("STRING",this.chars),this.scan=o(function(b,u){this.lines=a(this.chars,this.errors,b,u),H=!0},"scan"),this.parse=o(function(b,u){if(!H)throw new Error(`${t}grammar not scanned`);c.syntax(this.chars,this.lines,this.errors,b,u),F=!0},"parse"),this.translate=o(function(){if(!F)throw new Error(`${t}grammar not scanned and parsed`);let b=c.semantic(this.chars,this.lines,this.errors);this.errors.length===0&&(this.rules=b.rules,this.udts=b.udts,R=b.lineMap,j=!0)},"translate"),this.attributes=o(function(){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return B=f(this.rules,this.udts,R,this.errors),D=!0,B},"attrs"),this.generate=o(function(b){if(this.lines=a(this.chars,this.errors,b),this.errors.length||(c.syntax(this.chars,this.lines,this.errors,b),this.errors.length))return;let u=c.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=u.rules,this.udts=u.udts,R=u.lineMap,B=f(this.rules,this.udts,R,this.errors),D=!0)},"generate"),this.displayRules=o(function(b="index"){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return v(this.rules,this.udts,b)},"displayRules"),this.displayRuleDependencies=o(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return d(b)},"displayRuleDependencies"),this.displayAttributes=o(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return B&&h(b),l(b)},"displayAttributes"),this.displayAttributeErrors=o(function(){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return h()},"displayAttributeErrors"),this.toSource=o(function(b){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return c.generateSource(this.chars,this.lines,this.rules,this.udts,b)},"toSource"),this.toObject=o(function(){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return c.generateObject(this.sabnf,this.rules,this.udts)},"toObject"),this.errorsToAscii=o(function(){return L(this.errors,this.lines,this.chars)},"errorsToAsciiFunc"),this.errorsToHtml=o(function(b){return E(this.errors,this.lines,this.chars,b)},"errorsToHtmlFunc"),this.linesToAscii=o(function(){return _(this.lines)},"linesToAsciiFunc"),this.linesToHtml=o(function(){return U(this.lines)},"linesToHtmlFunc")},"api")});var K5=de((GF,D5)=>{D5.exports=X1;var L5=128,zM=127,jM=~zM,VM=Math.pow(2,31);function X1(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw X1.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=VM;)e[t++]=r&255|L5,r/=128;for(;r&jM;)e[t++]=r&255|L5,r>>>=7;return e[t]=r|0,X1.bytes=t-n+1,e}o(X1,"encode")});var H5=de((JF,F5)=>{F5.exports=Z1;var GM=128,$5=127;function Z1(r,n){var t=0,n=n||0,i=0,s=n,a,c=r.length;do{if(s>=c||i>49)throw Z1.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=i<28?(a&$5)<<i:(a&$5)*Math.pow(2,i),i+=7}while(a>=GM);return Z1.bytes=s-n,t}o(Z1,"read")});var z5=de((WF,q5)=>{var JM=Math.pow(2,7),WM=Math.pow(2,14),YM=Math.pow(2,21),XM=Math.pow(2,28),ZM=Math.pow(2,35),QM=Math.pow(2,42),eB=Math.pow(2,49),tB=Math.pow(2,56),rB=Math.pow(2,63);q5.exports=function(r){return r<JM?1:r<WM?2:r<YM?3:r<XM?4:r<ZM?5:r<QM?6:r<eB?7:r<tB?8:r<rB?9:10}});var Ju=de((YF,j5)=>{j5.exports={encode:K5(),decode:H5(),encodingLength:z5()}});var G5=de((XF,V5)=>{"use strict";function nB(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var n=0;n<r.length;n++){var i=r.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var a=r.length,c=r.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var y=0,_=0,U=0,E=x.length;U!==E&&x[U]===0;)U++,y++;for(var L=(E-U)*l+1>>>0,H=new Uint8Array(L);U!==E;){for(var F=x[U],j=0,D=L-1;(F!==0||j<_)&&D!==-1;D--,j++)F+=256*H[D]>>>0,H[D]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");_=j,U++}for(var B=L-_;B!==L&&H[B]===0;)B++;for(var R=c.repeat(y);B<L;++B)R+=r.charAt(H[B]);return R}o(h,"encode");function d(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var y=0;if(x[y]!==" "){for(var _=0,U=0;x[y]===c;)_++,y++;for(var E=(x.length-y)*f+1>>>0,L=new Uint8Array(E);x[y];){var H=e[x.charCodeAt(y)];if(H===255)return;for(var F=0,j=E-1;(H!==0||F<U)&&j!==-1;j--,F++)H+=a*L[j]>>>0,L[j]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,y++}if(x[y]!==" "){for(var D=E-U;D!==E&&L[D]===0;)D++;for(var B=new Uint8Array(_+(E-D)),R=_;D!==E;)B[R++]=L[D++];return B}}}o(d,"decodeUnsafe");function v(x){var y=d(x);if(y)return y;throw new Error("Non-base"+a+" character")}return o(v,"decode"),{encode:h,decodeUnsafe:d,decode:v}}o(nB,"base");V5.exports=nB});var Zd=de((ZF,J5)=>{"use strict";var iB=new TextDecoder,sB=o(r=>iB.decode(r),"decodeText"),oB=new TextEncoder,aB=o(r=>oB.encode(r),"encodeText");function cB(r,e){let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(cB,"concat");J5.exports={decodeText:sB,encodeText:aB,concat:cB}});var Y5=de((QF,W5)=>{"use strict";var{encodeText:fB}=Zd(),Qd=class{constructor(e,t,n,i){this.name=e,this.code=t,this.codeBuf=fB(this.code),this.alphabet=i,this.codec=n(i)}encode(e){return this.codec.encode(e)}decode(e){for(let t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}};o(Qd,"Base");W5.exports=Qd});var Z5=de((eH,X5)=>{"use strict";var uB=o((r,e,t)=>{let n={};for(let l=0;l<e.length;++l)n[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,c=0,f=0;for(let l=0;l<i;++l){let h=n[r[l]];if(h===void 0)throw new SyntaxError("Invalid character "+r[l]);c=c<<t|h,a+=t,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},"decode"),lB=o((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,s="",a=0,c=0;for(let f=0;f<r.length;++f)for(c=c<<8|r[f],a+=8;a>t;)a-=t,s+=e[i&c>>a];if(a&&(s+=e[i&c<<t-a]),n)for(;s.length*t&7;)s+="=";return s},"encode"),hB=o(r=>e=>({encode(t){return lB(t,e,r)},decode(t){return uB(t,e,r)}}),"rfc4648");X5.exports={rfc4648:hB}});var r4=de((tH,t4)=>{"use strict";var Wu=G5(),dB=Y5(),{rfc4648:dr}=Z5(),{decodeText:pB,encodeText:mB}=Zd(),bB=o(()=>({encode:pB,decode:mB}),"identity"),Q5=[["identity","\0",bB,""],["base2","0",dr(1),"01"],["base8","7",dr(3),"01234567"],["base10","9",Wu,"0123456789"],["base16","f",dr(4),"0123456789abcdef"],["base16upper","F",dr(4),"0123456789ABCDEF"],["base32hex","v",dr(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",dr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",dr(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",dr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",dr(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",dr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",dr(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",dr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",dr(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",Wu,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",Wu,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",Wu,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",Wu,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],e4=Q5.reduce((r,e)=>(r[e[0]]=new dB(e[0],e[1],e[2],e[3]),r),{}),gB=Q5.reduce((r,e)=>(r[e[1]]=e4[e[0]],r),{});t4.exports={names:e4,codes:gB}});var s4=de((ds,i4)=>{"use strict";var Hc=r4(),{encodeText:yB,decodeText:ep,concat:n4}=Zd();function vB(r,e){if(!e)throw new Error("requires an encoded Uint8Array");let{name:t,codeBuf:n}=ya(r);return AB(t,e),n4([n,e],n.length+e.length)}o(vB,"multibase");function wB(r,e){let t=ya(r),n=yB(t.encode(e));return n4([t.codeBuf,n],t.codeBuf.length+n.length)}o(wB,"encode");function xB(r){r instanceof Uint8Array&&(r=ep(r));let e=r[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(e)&&(r=r.toLowerCase()),ya(r[0]).decode(r.substring(1))}o(xB,"decode");function _B(r){if(r instanceof Uint8Array&&(r=ep(r)),Object.prototype.toString.call(r)!=="[object String]")return!1;try{return ya(r[0]).name}catch(e){return!1}}o(_B,"isEncoded");function AB(r,e){ya(r).decode(ep(e))}o(AB,"validEncode");function ya(r){if(Object.prototype.hasOwnProperty.call(Hc.names,r))return Hc.names[r];if(Object.prototype.hasOwnProperty.call(Hc.codes,r))return Hc.codes[r];throw new Error(`Unsupported encoding: ${r}`)}o(ya,"encoding");function EB(r){return r instanceof Uint8Array&&(r=ep(r)),ya(r[0])}o(EB,"encodingFromData");ds=i4.exports=vB;ds.encode=wB;ds.decode=xB;ds.isEncoded=_B;ds.encoding=ya;ds.encodingFromData=EB;var SB=Object.freeze(Hc.names),CB=Object.freeze(Hc.codes);ds.names=SB;ds.codes=CB});var a4=de((rH,o4)=>{"use strict";function kB(r,e){for(let t=0;t<r.byteLength;t++){if(r[t]<e[t])return-1;if(r[t]>e[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength<e.byteLength?-1:0}o(kB,"compare");o4.exports=kB});var f4=de((nH,c4)=>{"use strict";function TB(r,e){e||(e=r.reduce((i,s)=>i+s.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(TB,"concat");c4.exports=TB});var l4=de((iH,u4)=>{"use strict";function MB(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}o(MB,"equals");u4.exports=MB});var eb=de((sH,m4)=>{"use strict";var{bases:h4}=($h(),yg(Lv));function p4(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}o(p4,"createCodec");var d4=p4("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),Q1=p4("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),BB=ne({utf8:d4,"utf-8":d4,hex:h4.base16,latin1:Q1,ascii:Q1,binary:Q1},h4);m4.exports=BB});var g4=de((oH,b4)=>{"use strict";var IB=eb();function NB(r,e="utf8"){let t=IB[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}o(NB,"fromString");b4.exports=NB});var v4=de((aH,y4)=>{"use strict";var OB=eb();function PB(r,e="utf8"){let t=OB[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}o(PB,"toString");y4.exports=PB});var x4=de((cH,w4)=>{"use strict";function RB(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r[n]^e[n];return t}o(RB,"xor");w4.exports=RB});var tb=de((fH,_4)=>{"use strict";var UB=a4(),LB=f4(),DB=l4(),KB=g4(),$B=v4(),FB=x4();_4.exports={compare:UB,concat:LB,equals:DB,fromString:KB,toString:$B,xor:FB}});var A4=de(Mi=>{"use strict";var HB=Mi&&Mi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),qB=Mi&&Mi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),zB=Mi&&Mi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HB(e,r,t);return qB(e,r),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.keyToDidDoc=void 0;var jB=zB(tb());function VB(r,e){let t=`did:key:${e}`,n=`${t}#${e}`;return{id:t,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:t,publicKeyBase58:jB.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}o(VB,"keyToDidDoc");Mi.keyToDidDoc=VB});var E4=de(Bi=>{"use strict";var GB=Bi&&Bi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),JB=Bi&&Bi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),WB=Bi&&Bi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&GB(e,r,t);return JB(e,r),e};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.keyToDidDoc=void 0;var rb=WB(tb()),YB=fd();function XB(r){let e=new Uint8Array(r.length+2);return e[0]=236,e[1]=1,e.set(r,2),`z${rb.toString(e,"base58btc")}`}o(XB,"encodeKey");function ZB(r,e){let t=`did:key:${e}`,n=`${t}#${e}`,i=YB.convertPublicKeyToX25519(r),s=`${t}#${XB(i)}`;return{id:t,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:rb.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:s,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:rb.toString(i,"base58btc")}]}}o(ZB,"keyToDidDoc");Bi.keyToDidDoc=ZB});var M4=de(On=>{"use strict";var QB=On&&On.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),eI=On&&On.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),k4=On&&On.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&QB(e,r,t);return eI(e,r),e},T4=On&&On.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(On,"__esModule",{value:!0});var S4=T4(Ju()),tI=T4(s4()),rI=k4(A4()),nI=k4(E4()),iI="application/did+ld+json",C4="application/did+json",sI={231:rI,237:nI};On.default={getResolver:()=>({key:(r,e,t,n)=>M(On,null,function*(){let i=n.accept||C4,s={didResolutionMetadata:{contentType:i},didDocument:null,didDocumentMetadata:{}};try{let a=tI.default.decode(e.id),c=S4.default.decode(a),f=a.slice(S4.default.decode.bytes),l=yield sI[c].keyToDidDoc(f,e.id);i===iI?(l["@context"]="https://w3id.org/did/v1",s.didDocument=l):i===C4?s.didDocument=l:(delete s.didResolutionMetadata.contentType,s.didResolutionMetadata.error="representationNotSupported")}catch(a){s.didResolutionMetadata.error="invalidDid",s.didResolutionMetadata.message=a.toString()}return s})})}});var I4=de((dH,B4)=>{"use strict";B4.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&function(s){return function(a){return function(c,f){var l={key:c,value:a[c]},h={key:f,value:a[f]};return s(l,h)}}}(e.cmp),i=[];return o(function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var c,f;if(Array.isArray(a)){for(f="[",c=0;c<a.length;c++)c&&(f+=","),f+=s(a[c])||"null";return f+"]"}if(a===null)return"null";if(i.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=i.push(a)-1,h=Object.keys(a).sort(n&&n(a));for(f="",c=0;c<h.length;c++){var d=h[c],v=s(a[d]);!v||(f&&(f+=","),f+=JSON.stringify(d)+":"+v)}return i.splice(l,1),"{"+f+"}"}},"stringify")(r)}});var Nb=de((il,Gc)=>{var II=200,s8="__lodash_hash_undefined__",o8=9007199254740991,Sb="[object Arguments]",NI="[object Array]",a8="[object Boolean]",c8="[object Date]",OI="[object Error]",Cb="[object Function]",f8="[object GeneratorFunction]",up="[object Map]",u8="[object Number]",kb="[object Object]",J4="[object Promise]",l8="[object RegExp]",lp="[object Set]",h8="[object String]",d8="[object Symbol]",vb="[object WeakMap]",p8="[object ArrayBuffer]",hp="[object DataView]",m8="[object Float32Array]",b8="[object Float64Array]",g8="[object Int8Array]",y8="[object Int16Array]",v8="[object Int32Array]",w8="[object Uint8Array]",x8="[object Uint8ClampedArray]",_8="[object Uint16Array]",A8="[object Uint32Array]",PI=/[\\^$.*+?()[\]{}|]/g,RI=/\w*$/,UI=/^\[object .+?Constructor\]$/,LI=/^(?:0|[1-9]\d*)$/,lt={};lt[Sb]=lt[NI]=lt[p8]=lt[hp]=lt[a8]=lt[c8]=lt[m8]=lt[b8]=lt[g8]=lt[y8]=lt[v8]=lt[up]=lt[u8]=lt[kb]=lt[l8]=lt[lp]=lt[h8]=lt[d8]=lt[w8]=lt[x8]=lt[_8]=lt[A8]=!0;lt[OI]=lt[Cb]=lt[vb]=!1;var DI=typeof global=="object"&&global&&global.Object===Object&&global,KI=typeof self=="object"&&self&&self.Object===Object&&self,ms=DI||KI||Function("return this")(),E8=typeof il=="object"&&il&&!il.nodeType&&il,W4=E8&&typeof Gc=="object"&&Gc&&!Gc.nodeType&&Gc,$I=W4&&W4.exports===E8;function FI(r,e){return r.set(e[0],e[1]),r}o(FI,"addMapEntry");function HI(r,e){return r.add(e),r}o(HI,"addSetEntry");function qI(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}o(qI,"arrayEach");function zI(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}o(zI,"arrayPush");function S8(r,e,t,n){var i=-1,s=r?r.length:0;for(n&&s&&(t=r[++i]);++i<s;)t=e(t,r[i],i,r);return t}o(S8,"arrayReduce");function jI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}o(jI,"baseTimes");function VI(r,e){return r==null?void 0:r[e]}o(VI,"getValue");function C8(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch(t){}return e}o(C8,"isHostObject");function Y4(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}o(Y4,"mapToArray");function Tb(r,e){return function(t){return r(e(t))}}o(Tb,"overArg");function X4(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}o(X4,"setToArray");var GI=Array.prototype,JI=Function.prototype,dp=Object.prototype,yb=ms["__core-js_shared__"],Z4=function(){var r=/[^.]+$/.exec(yb&&yb.keys&&yb.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),k8=JI.toString,Ao=dp.hasOwnProperty,pp=dp.toString,WI=RegExp("^"+k8.call(Ao).replace(PI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Q4=$I?ms.Buffer:void 0,e8=ms.Symbol,t8=ms.Uint8Array,YI=Tb(Object.getPrototypeOf,Object),XI=Object.create,ZI=dp.propertyIsEnumerable,QI=GI.splice,r8=Object.getOwnPropertySymbols,eN=Q4?Q4.isBuffer:void 0,tN=Tb(Object.keys,Object),wb=Yc(ms,"DataView"),sl=Yc(ms,"Map"),xb=Yc(ms,"Promise"),_b=Yc(ms,"Set"),Ab=Yc(ms,"WeakMap"),ol=Yc(Object,"create"),rN=Aa(wb),nN=Aa(sl),iN=Aa(xb),sN=Aa(_b),oN=Aa(Ab),n8=e8?e8.prototype:void 0,i8=n8?n8.valueOf:void 0;function _a(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(_a,"Hash");function aN(){this.__data__=ol?ol(null):{}}o(aN,"hashClear");function cN(r){return this.has(r)&&delete this.__data__[r]}o(cN,"hashDelete");function fN(r){var e=this.__data__;if(ol){var t=e[r];return t===s8?void 0:t}return Ao.call(e,r)?e[r]:void 0}o(fN,"hashGet");function uN(r){var e=this.__data__;return ol?e[r]!==void 0:Ao.call(e,r)}o(uN,"hashHas");function lN(r,e){var t=this.__data__;return t[r]=ol&&e===void 0?s8:e,this}o(lN,"hashSet");_a.prototype.clear=aN;_a.prototype.delete=cN;_a.prototype.get=fN;_a.prototype.has=uN;_a.prototype.set=lN;function bs(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(bs,"ListCache");function hN(){this.__data__=[]}o(hN,"listCacheClear");function dN(r){var e=this.__data__,t=mp(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():QI.call(e,t,1),!0}o(dN,"listCacheDelete");function pN(r){var e=this.__data__,t=mp(e,r);return t<0?void 0:e[t][1]}o(pN,"listCacheGet");function mN(r){return mp(this.__data__,r)>-1}o(mN,"listCacheHas");function bN(r,e){var t=this.__data__,n=mp(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}o(bN,"listCacheSet");bs.prototype.clear=hN;bs.prototype.delete=dN;bs.prototype.get=pN;bs.prototype.has=mN;bs.prototype.set=bN;function Jc(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(Jc,"MapCache");function gN(){this.__data__={hash:new _a,map:new(sl||bs),string:new _a}}o(gN,"mapCacheClear");function yN(r){return bp(this,r).delete(r)}o(yN,"mapCacheDelete");function vN(r){return bp(this,r).get(r)}o(vN,"mapCacheGet");function wN(r){return bp(this,r).has(r)}o(wN,"mapCacheHas");function xN(r,e){return bp(this,r).set(r,e),this}o(xN,"mapCacheSet");Jc.prototype.clear=gN;Jc.prototype.delete=yN;Jc.prototype.get=vN;Jc.prototype.has=wN;Jc.prototype.set=xN;function Wc(r){this.__data__=new bs(r)}o(Wc,"Stack");function _N(){this.__data__=new bs}o(_N,"stackClear");function AN(r){return this.__data__.delete(r)}o(AN,"stackDelete");function EN(r){return this.__data__.get(r)}o(EN,"stackGet");function SN(r){return this.__data__.has(r)}o(SN,"stackHas");function CN(r,e){var t=this.__data__;if(t instanceof bs){var n=t.__data__;if(!sl||n.length<II-1)return n.push([r,e]),this;t=this.__data__=new Jc(n)}return t.set(r,e),this}o(CN,"stackSet");Wc.prototype.clear=_N;Wc.prototype.delete=AN;Wc.prototype.get=EN;Wc.prototype.has=SN;Wc.prototype.set=CN;function kN(r,e){var t=Bb(r)||XN(r)?jI(r.length,String):[],n=t.length,i=!!n;for(var s in r)(e||Ao.call(r,s))&&!(i&&(s=="length"||GN(s,n)))&&t.push(s);return t}o(kN,"arrayLikeKeys");function T8(r,e,t){var n=r[e];(!(Ao.call(r,e)&&N8(n,t))||t===void 0&&!(e in r))&&(r[e]=t)}o(T8,"assignValue");function mp(r,e){for(var t=r.length;t--;)if(N8(r[t][0],e))return t;return-1}o(mp,"assocIndexOf");function TN(r,e){return r&&M8(e,Ib(e),r)}o(TN,"baseAssign");function Eb(r,e,t,n,i,s,a){var c;if(n&&(c=s?n(r,i,s,a):n(r)),c!==void 0)return c;if(!gp(r))return r;var f=Bb(r);if(f){if(c=zN(r),!e)return FN(r,c)}else{var l=xa(r),h=l==Cb||l==f8;if(QN(r))return PN(r,e);if(l==kb||l==Sb||h&&!s){if(C8(r))return s?r:{};if(c=jN(h?{}:r),!e)return HN(r,TN(c,r))}else{if(!lt[l])return s?r:{};c=VN(r,l,Eb,e)}}a||(a=new Wc);var d=a.get(r);if(d)return d;if(a.set(r,c),!f)var v=t?qN(r):Ib(r);return qI(v||r,function(x,y){v&&(y=x,x=r[y]),T8(c,y,Eb(x,e,t,n,y,r,a))}),c}o(Eb,"baseClone");function MN(r){return gp(r)?XI(r):{}}o(MN,"baseCreate");function BN(r,e,t){var n=e(r);return Bb(r)?n:zI(n,t(r))}o(BN,"baseGetAllKeys");function IN(r){return pp.call(r)}o(IN,"baseGetTag");function NN(r){if(!gp(r)||WN(r))return!1;var e=P8(r)||C8(r)?WI:UI;return e.test(Aa(r))}o(NN,"baseIsNative");function ON(r){if(!I8(r))return tN(r);var e=[];for(var t in Object(r))Ao.call(r,t)&&t!="constructor"&&e.push(t);return e}o(ON,"baseKeys");function PN(r,e){if(e)return r.slice();var t=new r.constructor(r.length);return r.copy(t),t}o(PN,"cloneBuffer");function Mb(r){var e=new r.constructor(r.byteLength);return new t8(e).set(new t8(r)),e}o(Mb,"cloneArrayBuffer");function RN(r,e){var t=e?Mb(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}o(RN,"cloneDataView");function UN(r,e,t){var n=e?t(Y4(r),!0):Y4(r);return S8(n,FI,new r.constructor)}o(UN,"cloneMap");function LN(r){var e=new r.constructor(r.source,RI.exec(r));return e.lastIndex=r.lastIndex,e}o(LN,"cloneRegExp");function DN(r,e,t){var n=e?t(X4(r),!0):X4(r);return S8(n,HI,new r.constructor)}o(DN,"cloneSet");function KN(r){return i8?Object(i8.call(r)):{}}o(KN,"cloneSymbol");function $N(r,e){var t=e?Mb(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}o($N,"cloneTypedArray");function FN(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}o(FN,"copyArray");function M8(r,e,t,n){t||(t={});for(var i=-1,s=e.length;++i<s;){var a=e[i],c=n?n(t[a],r[a],a,t,r):void 0;T8(t,a,c===void 0?r[a]:c)}return t}o(M8,"copyObject");function HN(r,e){return M8(r,B8(r),e)}o(HN,"copySymbols");function qN(r){return BN(r,Ib,B8)}o(qN,"getAllKeys");function bp(r,e){var t=r.__data__;return JN(e)?t[typeof e=="string"?"string":"hash"]:t.map}o(bp,"getMapData");function Yc(r,e){var t=VI(r,e);return NN(t)?t:void 0}o(Yc,"getNative");var B8=r8?Tb(r8,Object):rO,xa=IN;(wb&&xa(new wb(new ArrayBuffer(1)))!=hp||sl&&xa(new sl)!=up||xb&&xa(xb.resolve())!=J4||_b&&xa(new _b)!=lp||Ab&&xa(new Ab)!=vb)&&(xa=o(function(r){var e=pp.call(r),t=e==kb?r.constructor:void 0,n=t?Aa(t):void 0;if(n)switch(n){case rN:return hp;case nN:return up;case iN:return J4;case sN:return lp;case oN:return vb}return e},"getTag"));function zN(r){var e=r.length,t=r.constructor(e);return e&&typeof r[0]=="string"&&Ao.call(r,"index")&&(t.index=r.index,t.input=r.input),t}o(zN,"initCloneArray");function jN(r){return typeof r.constructor=="function"&&!I8(r)?MN(YI(r)):{}}o(jN,"initCloneObject");function VN(r,e,t,n){var i=r.constructor;switch(e){case p8:return Mb(r);case a8:case c8:return new i(+r);case hp:return RN(r,n);case m8:case b8:case g8:case y8:case v8:case w8:case x8:case _8:case A8:return $N(r,n);case up:return UN(r,n,t);case u8:case h8:return new i(r);case l8:return LN(r);case lp:return DN(r,n,t);case d8:return KN(r)}}o(VN,"initCloneByTag");function GN(r,e){return e=e==null?o8:e,!!e&&(typeof r=="number"||LI.test(r))&&r>-1&&r%1==0&&r<e}o(GN,"isIndex");function JN(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}o(JN,"isKeyable");function WN(r){return!!Z4&&Z4 in r}o(WN,"isMasked");function I8(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||dp;return r===t}o(I8,"isPrototype");function Aa(r){if(r!=null){try{return k8.call(r)}catch(e){}try{return r+""}catch(e){}}return""}o(Aa,"toSource");function YN(r){return Eb(r,!0,!0)}o(YN,"cloneDeep");function N8(r,e){return r===e||r!==r&&e!==e}o(N8,"eq");function XN(r){return ZN(r)&&Ao.call(r,"callee")&&(!ZI.call(r,"callee")||pp.call(r)==Sb)}o(XN,"isArguments");var Bb=Array.isArray;function O8(r){return r!=null&&eO(r.length)&&!P8(r)}o(O8,"isArrayLike");function ZN(r){return tO(r)&&O8(r)}o(ZN,"isArrayLikeObject");var QN=eN||nO;function P8(r){var e=gp(r)?pp.call(r):"";return e==Cb||e==f8}o(P8,"isFunction");function eO(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=o8}o(eO,"isLength");function gp(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}o(gp,"isObject");function tO(r){return!!r&&typeof r=="object"}o(tO,"isObjectLike");function Ib(r){return O8(r)?kN(r):ON(r)}o(Ib,"keys");function rO(){return[]}o(rO,"stubArray");function nO(){return!1}o(nO,"stubFalse");Gc.exports=YN});var g_=de((gs,b_)=>{var m_=typeof self!="undefined"?self:gs,$p=function(){function r(){this.fetch=!1,this.DOMException=m_.DOMException}return o(r,"F"),r.prototype=m_,new r}();(function(r){var e=function(t){var n={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(b){return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function i(b){return b&&DataView.prototype.isPrototypeOf(b)}if(o(i,"isDataView"),n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(b){return b&&s.indexOf(Object.prototype.toString.call(b))>-1};function c(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(b))throw new TypeError("Invalid character in header field name");return b.toLowerCase()}o(c,"normalizeName");function f(b){return typeof b!="string"&&(b=String(b)),b}o(f,"normalizeValue");function l(b){var u={next:function(){var p=b.shift();return{done:p===void 0,value:p}}};return n.iterable&&(u[Symbol.iterator]=function(){return u}),u}o(l,"iteratorFor");function h(b){this.map={},b instanceof h?b.forEach(function(u,p){this.append(p,u)},this):Array.isArray(b)?b.forEach(function(u){this.append(u[0],u[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(u){this.append(u,b[u])},this)}o(h,"Headers"),h.prototype.append=function(b,u){b=c(b),u=f(u);var p=this.map[b];this.map[b]=p?p+", "+u:u},h.prototype.delete=function(b){delete this.map[c(b)]},h.prototype.get=function(b){return b=c(b),this.has(b)?this.map[b]:null},h.prototype.has=function(b){return this.map.hasOwnProperty(c(b))},h.prototype.set=function(b,u){this.map[c(b)]=f(u)},h.prototype.forEach=function(b,u){for(var p in this.map)this.map.hasOwnProperty(p)&&b.call(u,this.map[p],p,this)},h.prototype.keys=function(){var b=[];return this.forEach(function(u,p){b.push(p)}),l(b)},h.prototype.values=function(){var b=[];return this.forEach(function(u){b.push(u)}),l(b)},h.prototype.entries=function(){var b=[];return this.forEach(function(u,p){b.push([p,u])}),l(b)},n.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function d(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}o(d,"consumed");function v(b){return new Promise(function(u,p){b.onload=function(){u(b.result)},b.onerror=function(){p(b.error)}})}o(v,"fileReaderReady");function x(b){var u=new FileReader,p=v(u);return u.readAsArrayBuffer(b),p}o(x,"readBlobAsArrayBuffer");function y(b){var u=new FileReader,p=v(u);return u.readAsText(b),p}o(y,"readBlobAsText");function _(b){for(var u=new Uint8Array(b),p=new Array(u.length),m=0;m<u.length;m++)p[m]=String.fromCharCode(u[m]);return p.join("")}o(_,"readArrayBufferAsText");function U(b){if(b.slice)return b.slice(0);var u=new Uint8Array(b.byteLength);return u.set(new Uint8Array(b)),u.buffer}o(U,"bufferClone");function E(){return this.bodyUsed=!1,this._initBody=function(b){this._bodyInit=b,b?typeof b=="string"?this._bodyText=b:n.blob&&Blob.prototype.isPrototypeOf(b)?this._bodyBlob=b:n.formData&&FormData.prototype.isPrototypeOf(b)?this._bodyFormData=b:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)?this._bodyText=b.toString():n.arrayBuffer&&n.blob&&i(b)?(this._bodyArrayBuffer=U(b.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(b)||a(b))?this._bodyArrayBuffer=U(b):this._bodyText=b=Object.prototype.toString.call(b):this._bodyText="",this.headers.get("content-type")||(typeof b=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(x)}),this.text=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(j)}),this.json=function(){return this.text().then(JSON.parse)},this}o(E,"Body");var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(b){var u=b.toUpperCase();return L.indexOf(u)>-1?u:b}o(H,"normalizeMethod");function F(b,u){u=u||{};var p=u.body;if(b instanceof F){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,u.headers||(this.headers=new h(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!p&&b._bodyInit!=null&&(p=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=u.credentials||this.credentials||"same-origin",(u.headers||!this.headers)&&(this.headers=new h(u.headers)),this.method=H(u.method||this.method||"GET"),this.mode=u.mode||this.mode||null,this.signal=u.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&p)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(p)}o(F,"Request"),F.prototype.clone=function(){return new F(this,{body:this._bodyInit})};function j(b){var u=new FormData;return b.trim().split("&").forEach(function(p){if(p){var m=p.split("="),w=m.shift().replace(/\+/g," "),S=m.join("=").replace(/\+/g," ");u.append(decodeURIComponent(w),decodeURIComponent(S))}}),u}o(j,"decode");function D(b){var u=new h,p=b.replace(/\r?\n[\t ]+/g," ");return p.split(/\r?\n/).forEach(function(m){var w=m.split(":"),S=w.shift().trim();if(S){var N=w.join(":").trim();u.append(S,N)}}),u}o(D,"parseHeaders"),E.call(F.prototype);function B(b,u){u||(u={}),this.type="default",this.status=u.status===void 0?200:u.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in u?u.statusText:"OK",this.headers=new h(u.headers),this.url=u.url||"",this._initBody(b)}o(B,"Response"),E.call(B.prototype),B.prototype.clone=function(){return new B(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},B.error=function(){var b=new B(null,{status:0,statusText:""});return b.type="error",b};var R=[301,302,303,307,308];B.redirect=function(b,u){if(R.indexOf(u)===-1)throw new RangeError("Invalid status code");return new B(null,{status:u,headers:{location:b}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(b){t.DOMException=function(u,p){this.message=u,this.name=p;var m=Error(u);this.stack=m.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function Y(b,u){return new Promise(function(p,m){var w=new F(b,u);if(w.signal&&w.signal.aborted)return m(new t.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function N(){S.abort()}o(N,"abortXhr"),S.onload=function(){var I={status:S.status,statusText:S.statusText,headers:D(S.getAllResponseHeaders()||"")};I.url="responseURL"in S?S.responseURL:I.headers.get("X-Request-URL");var k="response"in S?S.response:S.responseText;p(new B(k,I))},S.onerror=function(){m(new TypeError("Network request failed"))},S.ontimeout=function(){m(new TypeError("Network request failed"))},S.onabort=function(){m(new t.DOMException("Aborted","AbortError"))},S.open(w.method,w.url,!0),w.credentials==="include"?S.withCredentials=!0:w.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&n.blob&&(S.responseType="blob"),w.headers.forEach(function(I,k){S.setRequestHeader(k,I)}),w.signal&&(w.signal.addEventListener("abort",N),S.onreadystatechange=function(){S.readyState===4&&w.signal.removeEventListener("abort",N)}),S.send(typeof w._bodyInit=="undefined"?null:w._bodyInit)})}return o(Y,"fetch"),Y.polyfill=!0,r.fetch||(r.fetch=Y,r.Headers=h,r.Request=F,r.Response=B),t.Headers=h,t.Request=F,t.Response=B,t.fetch=Y,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})($p);$p.fetch.ponyfill=!0;delete $p.fetch.polyfill;var nf=$p;gs=nf.fetch;gs.default=nf.fetch;gs.fetch=nf.fetch;gs.Headers=nf.Headers;gs.Request=nf.Request;gs.Response=nf.Response;b_.exports=gs});var v_=de((CG,Fp)=>{"use strict";var{AbortController:y_,AbortSignal:BO}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;Fp.exports=y_;Fp.exports.AbortSignal=BO;Fp.exports.default=y_});var B_=de((YG,M_)=>{"use strict";var PO=function(){function r(t,n){if(typeof t!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+t+"."));this._batchLoadFn=t,this._maxBatchSize=DO(n),this._batchScheduleFn=KO(n),this._cacheKeyFn=$O(n),this._cacheMap=FO(n),this._batch=null}o(r,"DataLoader");var e=r.prototype;return e.load=o(function(n){if(n==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(n)+"."));var i=UO(this),s=this._cacheMap,a=this._cacheKeyFn(n);if(s){var c=s.get(a);if(c){var f=i.cacheHits||(i.cacheHits=[]);return new Promise(function(h){f.push(function(){h(c)})})}}i.keys.push(n);var l=new Promise(function(h,d){i.callbacks.push({resolve:h,reject:d})});return s&&s.set(a,l),l},"load"),e.loadMany=o(function(n){if(!T_(n))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+n+"."));for(var i=[],s=0;s<n.length;s++)i.push(this.load(n[s]).catch(function(a){return a}));return Promise.all(i)},"loadMany"),e.clear=o(function(n){var i=this._cacheMap;if(i){var s=this._cacheKeyFn(n);i.delete(s)}return this},"clear"),e.clearAll=o(function(){var n=this._cacheMap;return n&&n.clear(),this},"clearAll"),e.prime=o(function(n,i){var s=this._cacheMap;if(s){var a=this._cacheKeyFn(n);if(s.get(a)===void 0){var c;i instanceof Error?(c=Promise.reject(i),c.catch(function(){})):c=Promise.resolve(i),s.set(a,c)}}return this},"prime"),r}(),RO=typeof process=="object"&&typeof process.nextTick=="function"?function(r){Wb||(Wb=Promise.resolve()),Wb.then(function(){process.nextTick(r)})}:typeof setImmediate=="function"?function(r){setImmediate(r)}:function(r){setTimeout(r)},Wb;function UO(r){var e=r._batch;if(e!==null&&!e.hasDispatched&&e.keys.length<r._maxBatchSize&&(!e.cacheHits||e.cacheHits.length<r._maxBatchSize))return e;var t={hasDispatched:!1,keys:[],callbacks:[]};return r._batch=t,r._batchScheduleFn(function(){LO(r,t)}),t}o(UO,"getCurrentBatch");function LO(r,e){if(e.hasDispatched=!0,e.keys.length===0){Yb(e);return}var t=r._batchLoadFn(e.keys);if(!t||typeof t.then!="function")return k_(r,e,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(t)+".")));t.then(function(n){if(!T_(n))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(n)+"."));if(n.length!==e.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(`
|
627
|
+
|
628
|
+
Keys:
|
629
|
+
`+String(e.keys))+(`
|
630
|
+
|
631
|
+
Values:
|
632
|
+
`+String(n)));Yb(e);for(var i=0;i<e.callbacks.length;i++){var s=n[i];s instanceof Error?e.callbacks[i].reject(s):e.callbacks[i].resolve(s)}}).catch(function(n){k_(r,e,n)})}o(LO,"dispatchBatch");function k_(r,e,t){Yb(e);for(var n=0;n<e.keys.length;n++)r.clear(e.keys[n]),e.callbacks[n].reject(t)}o(k_,"failedDispatch");function Yb(r){if(r.cacheHits)for(var e=0;e<r.cacheHits.length;e++)r.cacheHits[e]()}o(Yb,"resolveCacheHits");function DO(r){var e=!r||r.batch!==!1;if(!e)return 1;var t=r&&r.maxBatchSize;if(t===void 0)return 1/0;if(typeof t!="number"||t<1)throw new TypeError("maxBatchSize must be a positive number: "+t);return t}o(DO,"getValidMaxBatchSize");function KO(r){var e=r&&r.batchScheduleFn;if(e===void 0)return RO;if(typeof e!="function")throw new TypeError("batchScheduleFn must be a function: "+e);return e}o(KO,"getValidBatchScheduleFn");function $O(r){var e=r&&r.cacheKeyFn;if(e===void 0)return function(t){return t};if(typeof e!="function")throw new TypeError("cacheKeyFn must be a function: "+e);return e}o($O,"getValidCacheKeyFn");function FO(r){var e=!r||r.cache!==!1;if(!e)return null;var t=r&&r.cacheMap;if(t===void 0)return new Map;if(t!==null){var n=["get","set","delete","clear"],i=n.filter(function(s){return t&&typeof t[s]!="function"});if(i.length!==0)throw new TypeError("Custom cacheMap missing methods: "+i.join(", "))}return t}o(FO,"getValidCacheMap");function T_(r){return typeof r=="object"&&r!==null&&typeof r.length=="number"&&(r.length===0||r.length>0&&Object.prototype.hasOwnProperty.call(r,r.length-1))}o(T_,"isArrayLike");M_.exports=PO});var F_=de((dJ,$_)=>{"use strict";$_.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var V_=de((pJ,j_)=>{"use strict";var z_="%[a-f0-9]{2}",H_=new RegExp(z_,"gi"),q_=new RegExp("("+z_+")+","gi");function og(r,e){try{return decodeURIComponent(r.join(""))}catch(i){}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],og(t),og(n))}o(og,"decodeComponents");function sP(r){try{return decodeURIComponent(r)}catch(n){for(var e=r.match(H_),t=1;t<e.length;t++)r=og(e,t).join(""),e=r.match(H_);return r}}o(sP,"decode");function oP(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=q_.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(c){var n=sP(t[0]);n!==t[0]&&(e[t[0]]=n)}t=q_.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var a=i[s];r=r.replace(new RegExp(a,"g"),e[a])}return r}o(oP,"customDecodeURIComponent");j_.exports=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return oP(r)}}});var J_=de((mJ,G_)=>{"use strict";G_.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var Y_=de((bJ,W_)=>{"use strict";W_.exports=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),s=0;s<n.length;s++){var a=n[s],c=r[a];(i?e.indexOf(a)!==-1:e(a,c,r))&&(t[a]=c)}return t}});var iA=de(Wr=>{"use strict";var aP=F_(),cP=V_(),Z_=J_(),fP=Y_(),uP=o(r=>r==null,"isNullOrUndefined"),ag=Symbol("encodeFragmentIdentifier");function lP(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{let i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),"[",i,"]"].join("")]:[...t,[Ft(e,r),"[",Ft(i,r),"]=",Ft(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),"[]"].join("")]:[...t,[Ft(e,r),"[]=",Ft(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),":list="].join("")]:[...t,[Ft(e,r),":list=",Ft(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Ft(t,r),e,Ft(i,r)].join("")]:[[n,Ft(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,Ft(e,r)]:[...t,[Ft(e,r),"=",Ft(n,r)].join("")]}}o(lP,"encoderForArrayFormat");function hP(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"comma":case"separator":return(t,n,i)=>{let s=typeof n=="string"&&n.includes(r.arrayFormatSeparator),a=typeof n=="string"&&!s&&ws(n,r).includes(r.arrayFormatSeparator);n=a?ws(n,r):n;let c=s||a?n.split(r.arrayFormatSeparator).map(f=>ws(f,r)):n===null?n:ws(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){i[t]=n&&ws(n,r);return}let a=n===null?[]:n.split(r.arrayFormatSeparator).map(c=>ws(c,r));if(i[t]===void 0){i[t]=a;return}i[t]=[].concat(i[t],a)};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[].concat(i[t],n)}}}o(hP,"parserForArrayFormat");function Q_(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}o(Q_,"validateArrayFormatSeparator");function Ft(r,e){return e.encode?e.strict?aP(r):encodeURIComponent(r):r}o(Ft,"encode");function ws(r,e){return e.decode?cP(r):r}o(ws,"decode");function eA(r){return Array.isArray(r)?r.sort():typeof r=="object"?eA(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}o(eA,"keysSorter");function tA(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}o(tA,"removeHash");function dP(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}o(dP,"getHash");function rA(r){r=tA(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}o(rA,"extract");function X_(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}o(X_,"parseValue");function nA(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),Q_(e.arrayFormatSeparator);let t=hP(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(let i of r.split("&")){if(i==="")continue;let[s,a]=Z_(e.decode?i.replace(/\+/g," "):i,"=");a=a===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?a:ws(a,e),t(ws(s,e),a,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let a of Object.keys(s))s[a]=X_(s[a],e);else n[i]=X_(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let a=n[s];return Boolean(a)&&typeof a=="object"&&!Array.isArray(a)?i[s]=eA(a):i[s]=a,i},Object.create(null))}o(nA,"parse");Wr.extract=rA;Wr.parse=nA;Wr.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),Q_(e.arrayFormatSeparator);let t=o(a=>e.skipNull&&uP(r[a])||e.skipEmptyString&&r[a]==="","shouldFilter"),n=lP(e),i={};for(let a of Object.keys(r))t(a)||(i[a]=r[a]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(a=>{let c=r[a];return c===void 0?"":c===null?Ft(a,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Ft(a,e)+"[]":c.reduce(n(a),[]).join("&"):Ft(a,e)+"="+Ft(c,e)}).filter(a=>a.length>0).join("&")};Wr.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,n]=Z_(r,"#");return Object.assign({url:t.split("?")[0]||"",query:nA(rA(r),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ws(n,e)}:{})};Wr.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[ag]:!0},e);let t=tA(r.url).split("?")[0]||"",n=Wr.extract(r.url),i=Wr.parse(n,{sort:!1}),s=Object.assign(i,r.query),a=Wr.stringify(s,e);a&&(a=`?${a}`);let c=dP(r.url);return r.fragmentIdentifier&&(c=`#${e[ag]?Ft(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${a}${c}`};Wr.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[ag]:!1},t);let{url:n,query:i,fragmentIdentifier:s}=Wr.parseUrl(r,t);return Wr.stringifyUrl({url:n,query:fP(i,e),fragmentIdentifier:s},t)};Wr.exclude=(r,e,t)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return Wr.pick(r,n,t)}});var AP={};Mt(AP,{createWallet:()=>dg,walletFromKey:()=>bA});module.exports=yg(AP);function _l(r){var e=0,t=r.length,n=[];if(t%2)throw new Error("invalid hex:"+r);for(;e<t;e+=2)n.push(parseInt(r.substr(e,2),16));return new Uint8Array(n)}o(_l,"toUint8Array");var Ce,vg=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});vg.decode();var Al=null;function Oa(){return(Al===null||Al.buffer!==Ce.memory.buffer)&&(Al=new Uint8Array(Ce.memory.buffer)),Al}o(Oa,"getUint8Memory0");function Ui(r,e){return vg.decode(Oa().subarray(r,r+e))}o(Ui,"getStringFromWasm0");var Li=new Array(32).fill(void 0);Li.push(void 0,null,!0,!1);var cf=Li.length;function Ue(r){cf===Li.length&&Li.push(Li.length+1);let e=cf;return cf=Li[e],Li[e]=r,e}o(Ue,"addHeapObject");function Me(r){return Li[r]}o(Me,"getObject");function AA(r){r<36||(Li[r]=cf,cf=r)}o(AA,"dropObject");function Di(r){let e=Me(r);return AA(r),e}o(Di,"takeObject");var Pt=0,Sl=new TextEncoder("utf-8"),EA=typeof Sl.encodeInto=="function"?function(r,e){return Sl.encodeInto(r,e)}:function(r,e){let t=Sl.encode(r);return e.set(t),{read:r.length,written:t.length}};function sr(r,e,t){if(t===void 0){let c=Sl.encode(r),f=e(c.length);return Oa().subarray(f,f+c.length).set(c),Pt=c.length,f}let n=r.length,i=e(n),s=Oa(),a=0;for(;a<n;a++){let c=r.charCodeAt(a);if(c>127)break;s[i+a]=c}if(a!==n){a!==0&&(r=r.slice(a)),i=t(i,n,n=a+r.length*3);let c=Oa().subarray(i+a,i+n);a+=EA(r,c).written}return Pt=a,i}o(sr,"passStringToWasm0");function SA(r){return r==null}o(SA,"isLikeNone");var El=null;function Pr(){return(El===null||El.buffer!==Ce.memory.buffer)&&(El=new Int32Array(Ce.memory.buffer)),El}o(Pr,"getInt32Memory0");function d0(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){let i=r.length,s="[";i>0&&(s+=d0(r[0]));for(let a=1;a<i;a++)s+=", "+d0(r[a]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(i){return"Object"}return r instanceof Error?`${r.name}: ${r.message}
|
633
|
+
${r.stack}`:n}o(d0,"debugString");function CA(r,e,t,n){let i={a:r,b:e,cnt:1,dtor:t},s=o((...a)=>{i.cnt++;let c=i.a;i.a=0;try{return n(c,i.b,...a)}finally{--i.cnt===0?Ce.__wbindgen_export_2.get(i.dtor)(c,i.b):i.a=c}},"real");return s.original=i,s}o(CA,"makeMutClosure");function kA(r,e,t){Ce._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(r,e,Ue(t))}o(kA,"__wbg_adapter_24");function TA(r,e){let t=e(r.length*1);return Oa().set(r,t/1),Pt=r.length,t}o(TA,"passArray8ToWasm0");function wg(r){try{let c=Ce.__wbindgen_add_to_stack_pointer(-16),f=TA(r,Ce.__wbindgen_malloc),l=Pt;Ce.generateEd25519KeyFromBytes(c,f,l);var e=Pr()[c/4+0],t=Pr()[c/4+1],n=Pr()[c/4+2],i=Pr()[c/4+3],s=e,a=t;if(i)throw s=0,a=0,Di(n);return Ui(s,a)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(s,a)}}o(wg,"generateEd25519KeyFromBytes");function xg(r,e){try{let f=Ce.__wbindgen_add_to_stack_pointer(-16),l=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),h=Pt,d=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),v=Pt;Ce.keyToDID(f,l,h,d,v);var t=Pr()[f/4+0],n=Pr()[f/4+1],i=Pr()[f/4+2],s=Pr()[f/4+3],a=t,c=n;if(s)throw a=0,c=0,Di(i);return Ui(a,c)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(a,c)}}o(xg,"keyToDID");function Cl(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.keyToVerificationMethod(t,n,i,s);return Di(a)}o(Cl,"keyToVerificationMethod");function _g(r,e,t){let n=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Pt,s=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Pt,c=sr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt,l=Ce.issueCredential(n,i,s,a,c,f);return Di(l)}o(_g,"issueCredential");function Ag(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.verifyCredential(t,n,i,s);return Di(a)}o(Ag,"verifyCredential");function Eg(r,e,t){let n=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Pt,s=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Pt,c=sr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt,l=Ce.issuePresentation(n,i,s,a,c,f);return Di(l)}o(Eg,"issuePresentation");function Sg(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.verifyPresentation(t,n,i,s);return Di(a)}o(Sg,"verifyPresentation");function mr(r,e){try{return r.apply(this,e)}catch(t){Ce.__wbindgen_exn_store(Ue(t))}}o(mr,"handleError");function MA(r,e){return Oa().subarray(r/1,r/1+e)}o(MA,"getArrayU8FromWasm0");function BA(r,e,t,n){Ce.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(r,e,Ue(t),Ue(n))}o(BA,"__wbg_adapter_108");function IA(r,e){return M(this,null,function*(){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return yield WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=yield r.arrayBuffer();return yield WebAssembly.instantiate(t,e)}else{let t=yield WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}})}o(IA,"load");function Cg(r){return M(this,null,function*(){let e={};e.wbg={},e.wbg.__wbindgen_string_new=function(i,s){let a=Ui(i,s);return Ue(a)},e.wbg.__wbindgen_object_drop_ref=function(i){Di(i)},e.wbg.__wbindgen_cb_drop=function(i){let s=Di(i).original;return s.cnt--==1?(s.a=0,!0):!1},e.wbg.__wbindgen_object_clone_ref=function(i){let s=Me(i);return Ue(s)},e.wbg.__wbg_fetch_811d43d6bdcad5b1=function(i){let s=fetch(Me(i));return Ue(s)},e.wbg.__wbg_fetch_bf56e2a9f0644e3f=function(i,s){let a=Me(i).fetch(Me(s));return Ue(a)},e.wbg.__wbg_new_89d7f088c1c45353=function(){return mr(function(){let i=new Headers;return Ue(i)},arguments)},e.wbg.__wbg_append_f4f93bc73c45ee3e=function(){return mr(function(i,s,a,c,f){Me(i).append(Ui(s,a),Ui(c,f))},arguments)},e.wbg.__wbindgen_string_get=function(i,s){let a=Me(s),c=typeof a=="string"?a:void 0;var f=SA(c)?0:sr(c,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),l=Pt;Pr()[i/4+1]=l,Pr()[i/4+0]=f},e.wbg.__wbg_instanceof_Response_ccfeb62399355bcd=function(i){return Me(i)instanceof Response},e.wbg.__wbg_url_06c0f822d68d195c=function(i,s){let a=Me(s).url,c=sr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt;Pr()[i/4+1]=f,Pr()[i/4+0]=c},e.wbg.__wbg_status_600fd8b881393898=function(i){return Me(i).status},e.wbg.__wbg_headers_9e7f2c05a9b962ea=function(i){let s=Me(i).headers;return Ue(s)},e.wbg.__wbg_arrayBuffer_5a99283a3954c850=function(){return mr(function(i){let s=Me(i).arrayBuffer();return Ue(s)},arguments)},e.wbg.__wbg_newwithstrandinit_fd99688f189f053e=function(){return mr(function(i,s,a){let c=new Request(Ui(i,s),Me(a));return Ue(c)},arguments)},e.wbg.__wbindgen_is_object=function(i){let s=Me(i);return typeof s=="object"&&s!==null},e.wbg.__wbg_self_86b4b13392c7af56=function(){return mr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_crypto_b8c92eaac23d0d80=function(i){let s=Me(i).crypto;return Ue(s)},e.wbg.__wbg_msCrypto_9ad6677321a08dd8=function(i){let s=Me(i).msCrypto;return Ue(s)},e.wbg.__wbindgen_is_undefined=function(i){return Me(i)===void 0},e.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81=function(){return Ue(n)},e.wbg.__wbg_require_f5521a5b85ad2542=function(i,s,a){let c=Me(i).require(Ui(s,a));return Ue(c)},e.wbg.__wbg_getRandomValues_dd27e6b0652b3236=function(i){let s=Me(i).getRandomValues;return Ue(s)},e.wbg.__wbg_getRandomValues_e57c9b75ddead065=function(i,s){Me(i).getRandomValues(Me(s))},e.wbg.__wbg_randomFillSync_d2ba53160aec6aba=function(i,s,a){Me(i).randomFillSync(MA(s,a))},e.wbg.__wbindgen_is_function=function(i){return typeof Me(i)=="function"},e.wbg.__wbg_newnoargs_e23b458e372830de=function(i,s){let a=new Function(Ui(i,s));return Ue(a)},e.wbg.__wbg_next_cabb70b365520721=function(i){let s=Me(i).next;return Ue(s)},e.wbg.__wbg_next_bf3d83fc18df496e=function(){return mr(function(i){let s=Me(i).next();return Ue(s)},arguments)},e.wbg.__wbg_done_040f966faa9a72b3=function(i){return Me(i).done},e.wbg.__wbg_value_419afbd9b9574c4c=function(i){let s=Me(i).value;return Ue(s)},e.wbg.__wbg_iterator_4832ef1f15b0382b=function(){return Ue(Symbol.iterator)},e.wbg.__wbg_get_a9cab131e3152c49=function(){return mr(function(i,s){let a=Reflect.get(Me(i),Me(s));return Ue(a)},arguments)},e.wbg.__wbg_call_ae78342adc33730a=function(){return mr(function(i,s){let a=Me(i).call(Me(s));return Ue(a)},arguments)},e.wbg.__wbg_new_36359baae5a47e27=function(){let i=new Object;return Ue(i)},e.wbg.__wbg_call_3ed288a247f13ea5=function(){return mr(function(i,s,a){let c=Me(i).call(Me(s),Me(a));return Ue(c)},arguments)},e.wbg.__wbg_getTime_bffb1c09df09618b=function(i){return Me(i).getTime()},e.wbg.__wbg_new0_0ff7eb5c1486f3ec=function(){let i=new Date;return Ue(i)},e.wbg.__wbg_new_37705eed627d5ed9=function(i,s){try{var a={a:i,b:s},c=o((l,h)=>{let d=a.a;a.a=0;try{return BA(d,a.b,l,h)}finally{a.a=d}},"cb0");let f=new Promise(c);return Ue(f)}finally{a.a=a.b=0}},e.wbg.__wbg_resolve_a9a87bdd64e9e62c=function(i){let s=Promise.resolve(Me(i));return Ue(s)},e.wbg.__wbg_then_ce526c837d07b68f=function(i,s){let a=Me(i).then(Me(s));return Ue(a)},e.wbg.__wbg_then_842e65b843962f56=function(i,s,a){let c=Me(i).then(Me(s),Me(a));return Ue(c)},e.wbg.__wbg_self_99737b4dcdf6f0d8=function(){return mr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_window_9b61fbbf3564c4fb=function(){return mr(function(){let i=window.window;return Ue(i)},arguments)},e.wbg.__wbg_globalThis_8e275ef40caea3a3=function(){return mr(function(){let i=globalThis.globalThis;return Ue(i)},arguments)},e.wbg.__wbg_global_5de1e0f82bddcd27=function(){return mr(function(){let i=global.global;return Ue(i)},arguments)},e.wbg.__wbg_buffer_7af23f65f6c64548=function(i){let s=Me(i).buffer;return Ue(s)},e.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974=function(i,s,a){let c=new Uint8Array(Me(i),s>>>0,a>>>0);return Ue(c)},e.wbg.__wbg_new_cc9018bd6f283b6f=function(i){let s=new Uint8Array(Me(i));return Ue(s)},e.wbg.__wbg_set_f25e869e4565d2a2=function(i,s,a){Me(i).set(Me(s),a>>>0)},e.wbg.__wbg_length_0acb1cf9bbaf8519=function(i){return Me(i).length},e.wbg.__wbg_newwithlength_8f0657faca9f1422=function(i){let s=new Uint8Array(i>>>0);return Ue(s)},e.wbg.__wbg_subarray_da527dbd24eafb6b=function(i,s,a){let c=Me(i).subarray(s>>>0,a>>>0);return Ue(c)},e.wbg.__wbg_has_ce995ec88636803d=function(){return mr(function(i,s){return Reflect.has(Me(i),Me(s))},arguments)},e.wbg.__wbg_set_93b1c87ee2af852e=function(){return mr(function(i,s,a){return Reflect.set(Me(i),Me(s),Me(a))},arguments)},e.wbg.__wbg_stringify_c760003feffcc1f2=function(){return mr(function(i){let s=JSON.stringify(Me(i));return Ue(s)},arguments)},e.wbg.__wbindgen_debug_string=function(i,s){let a=d0(Me(s)),c=sr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt;Pr()[i/4+1]=f,Pr()[i/4+0]=c},e.wbg.__wbindgen_throw=function(i,s){throw new Error(Ui(i,s))},e.wbg.__wbindgen_memory=function(){let i=Ce.memory;return Ue(i)},e.wbg.__wbindgen_closure_wrapper10902=function(i,s,a){let c=CA(i,s,3717,kA);return Ue(c)},(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:t,module:n}=yield IA(yield r,e);return Ce=t.exports,Cg.__wbindgen_wasm_module=n,Ce})}o(Cg,"init");var kg=Cg;var Tg=!1,NA=o((r="https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy")=>M(void 0,null,function*(){if(!Tg)return Tg=!0,kg(r)}),"init"),p0=NA;var $e=ze(Ms()),ui=ze(Ms());var zi={};Mt(zi,{Any:()=>$n,BaseBlock:()=>Rt,BaseStringBlock:()=>Pa,BitString:()=>Ki,BmpString:()=>Rs,Boolean:()=>Ns,CharacterString:()=>zs,Choice:()=>Ro,Constructed:()=>Ht,DATE:()=>$a,DateTime:()=>Ha,Duration:()=>qa,EndOfContent:()=>Ra,Enumerated:()=>Os,GeneralString:()=>qs,GeneralizedTime:()=>js,GraphicString:()=>Hs,HexBlock:()=>ai,IA5String:()=>Fs,Integer:()=>or,Null:()=>pn,NumericString:()=>Ls,ObjectIdentifier:()=>Ps,OctetString:()=>Kn,Primitive:()=>oi,PrintableString:()=>Ds,RawData:()=>Tl,RelativeObjectIdentifier:()=>Ka,Repeated:()=>Vs,Sequence:()=>Cr,Set:()=>kr,TIME:()=>za,TeletexString:()=>Ks,TimeOfDay:()=>Fa,UTCTime:()=>Fi,UniversalString:()=>Us,Utf8String:()=>Zr,ValueBlock:()=>Yt,VideotexString:()=>$s,ViewWriter:()=>Po,VisibleString:()=>$i,compareSchema:()=>Is,fromBER:()=>qi,verifySchema:()=>YA});var je=ze(Ms());function Oo(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}o(Oo,"utilFromBase");function Bs(r,e,t=-1){let n=t,i=r,s=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(r<a){let f;if(n<0)f=new ArrayBuffer(c),s=c;else{if(n<c)return new ArrayBuffer(0);f=new ArrayBuffer(n),s=n}let l=new Uint8Array(f);for(let h=c-1;h>=0;h--){let d=Math.pow(2,h*e);l[s-h-1]=Math.floor(i/d),i-=l[s-h-1]*d}return f}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(Bs,"utilToBase");function kl(...r){let e=0,t=0;for(let s of r)e+=s.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let s of r)i.set(s,t),t+=s.length;return i}o(kl,"utilConcatView");function m0(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let c=r[0]===255&&r[1]&128,f=r[0]===0&&(r[1]&128)===0;(c||f)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=r[0]&128;let n=Oo(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=r[c];return s[0]&=127,Oo(s,8)-n}o(m0,"utilDecodeTC");function Mg(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,c=Bs(a,8,n),f=new Uint8Array(c);return f[0]|=128,c}let i=Bs(e,8,n),s=new Uint8Array(i);if(s[0]&128){let a=i.slice(0),c=new Uint8Array(a);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let f=0;f<a.byteLength;f++)s[f+1]=c[f];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(Mg,"utilEncodeTC");function Bg(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}o(Bg,"isEqualBuffer");function Rr(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,i=new Array(n);for(let a=0;a<n;a++)i[a]="0";return i.join("").concat(t)}o(Rr,"padNumber");var NP=Math.log(2);function Ml(){if(typeof BigInt=="undefined")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Ml,"assertBigInt");function g0(r){let e=0,t=0;for(let i=0;i<r.length;i++)e+=r[i].byteLength;let n=new Uint8Array(e);for(let i=0;i<r.length;i++){let s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}o(g0,"concat");function Hi(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(Hi,"checkBufferParams");var Po=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return g0(this.items)}};o(Po,"ViewWriter");var uf=[new Uint8Array([1])],Ig="0123456789",b0="name",Ng="valueHexView",DA="isHexOnly",KA="idBlock",$A="tagClass",FA="tagNumber",HA="isConstructed",qA="fromBER",zA="toBER",jA="local",Ur="",Fn=new ArrayBuffer(0),Bl=new Uint8Array(0),Sf="EndOfContent",Pg="OCTET STRING",Rg="BIT STRING";function ai(r){var e;return e=o(class extends r{constructor(...n){var i;super(...n);let s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?je.BufferSourceConverter.toUint8Array(s.valueHex):Bl}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Hi(this,a,i,s))return-1;let c=i+s;return this.valueHexView=a.subarray(i,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),i)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Fn)}toJSON(){return me(ne({},super.toJSON()),{isHexOnly:this.isHexOnly,valueHex:je.Convert.ToHex(this.valueHexView)})}},"Some"),e.NAME="hexBlock",e}o(ai,"HexBlock");var si=class{constructor({blockLength:e=0,error:t=Ur,warnings:n=[],valueBeforeDecode:i=Bl}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=je.BufferSourceConverter.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:je.Convert.ToHex(this.valueBeforeDecodeView)}}};o(si,"LocalBaseBlock");si.NAME="baseBlock";var Yt=class extends si{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};o(Yt,"ValueBlock");Yt.NAME="valueBlock";var lf=class extends ai(si){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?je.BufferSourceConverter.toUint8Array(e.valueHex):Bl,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Fn}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){let i=Bs(this.tagNumber,7),s=new Uint8Array(i),a=i.byteLength,c=new Uint8Array(a+1);if(c[0]=t|31,!e){for(let f=0;f<a-1;f++)c[f+1]=s[f]|128;c[a]=s[a-1]}return c.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;let c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let f=1,l=this.valueHexView=new Uint8Array(255),h=255;for(;s[f]&128;){if(l[f-1]=s[f]&127,f++,f>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(f===h){h+=255;let v=new Uint8Array(h);for(let x=0;x<l.length;x++)v[x]=l[x];l=this.valueHexView=new Uint8Array(h)}}this.blockLength=f+1,l[f-1]=s[f]&127;let d=new Uint8Array(f);for(let v=0;v<f;v++)d[v]=l[v];l=this.valueHexView=new Uint8Array(f),l.set(d),this.blockLength<=9?this.tagNumber=Oo(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return me(ne({},super.toJSON()),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})}};o(lf,"LocalIdentificationBlock");lf.NAME="identificationBlock";var hf=class extends si{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;let a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let c=t+1,f=i.subarray(c,c+a);return f[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Oo(f,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let i=Bs(this.length,8);if(i.byteLength>127)return this.error="Too big length",Fn;if(t=new ArrayBuffer(i.byteLength+1),e)return t;let s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)n[a+1]=s[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return me(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})}};o(hf,"LocalLengthBlock");hf.NAME="lengthBlock";var _e={},Rt=class extends si{constructor(a={},s){var c=a,{name:e=Ur,optional:t=!1,primitiveSchema:n}=c,i=ft(c,["name","optional","primitiveSchema"]);super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new lf(i),this.lenBlock=new hf(i),this.valueBlock=s?new s(i):new Yt(i)}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,t){let n=t||new Po;t||Ug(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(s)}return t?Fn:n.final()}toJSON(){let e=me(ne({},super.toJSON()),{idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional});return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():je.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Bg(t,n)}};o(Rt,"BaseBlock");Rt.NAME="BaseBlock";function Ug(r){if(r instanceof _e.Constructed)for(let e of r.valueBlock.value)Ug(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}o(Ug,"prepareIndefiniteForm");var Pa=class extends Rt{constructor(i={},n){var s=i,{value:e=Ur}=s,t=ft(s,["value"]);super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};o(Pa,"BaseStringBlock");Pa.NAME="BaseStringBlock";var df=class extends ai(Yt){constructor(n={}){var i=n,{isHexOnly:e=!0}=i,t=ft(i,["isHexOnly"]);super(t),this.isHexOnly=e}};o(df,"LocalPrimitiveValueBlock");df.NAME="PrimitiveValueBlock";var Lg,oi=class extends Rt{constructor(e={}){super(e,df),this.idBlock.isConstructed=!1}};o(oi,"Primitive");Lg=oi;_e.Primitive=Lg;oi.NAME="PRIMITIVE";function VA(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}o(VA,"localChangeType");function ja(r,e=0,t=r.length){let n=e,i=new Rt({},Yt),s=new si;if(!Hi(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,t-=i.idBlock.blockLength,c=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let f=Rt;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};f=_e.EndOfContent;break;case 1:f=_e.Boolean;break;case 2:f=_e.Integer;break;case 3:f=_e.BitString;break;case 4:f=_e.OctetString;break;case 5:f=_e.Null;break;case 6:f=_e.ObjectIdentifier;break;case 10:f=_e.Enumerated;break;case 12:f=_e.Utf8String;break;case 13:f=_e.RelativeObjectIdentifier;break;case 14:f=_e.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:f=_e.Sequence;break;case 17:f=_e.Set;break;case 18:f=_e.NumericString;break;case 19:f=_e.PrintableString;break;case 20:f=_e.TeletexString;break;case 21:f=_e.VideotexString;break;case 22:f=_e.IA5String;break;case 23:f=_e.UTCTime;break;case 24:f=_e.GeneralizedTime;break;case 25:f=_e.GraphicString;break;case 26:f=_e.VisibleString;break;case 27:f=_e.GeneralString;break;case 28:f=_e.UniversalString;break;case 29:f=_e.CharacterString;break;case 30:f=_e.BmpString;break;case 31:f=_e.DATE;break;case 32:f=_e.TimeOfDay;break;case 33:f=_e.DateTime;break;case 34:f=_e.Duration;break;default:{let l=i.idBlock.isConstructed?new _e.Constructed:new _e.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:f=i.idBlock.isConstructed?_e.Constructed:_e.Primitive}return i=VA(i,f),c=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:c,result:i}}o(ja,"localFromBER");function qi(r){if(!r.byteLength){let e=new Rt({},Yt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ja(je.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}o(qi,"fromBER");function GA(r,e){return r?1:e}o(GA,"checkLen");var Dn=class extends Yt{constructor(i={}){var s=i,{value:e=[],isIndefiniteForm:t=!1}=s,n=ft(s,["value","isIndefiniteForm"]);super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;GA(this.isIndefiniteForm,n)>0;){let a=ja(i,s,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===Sf)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Sf?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){let n=t||new Po;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Fn:n.final()}toJSON(){let e=me(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(let t of this.value)e.value.push(t.toJSON());return e}};o(Dn,"LocalConstructedValueBlock");Dn.NAME="ConstructedValueBlock";var Dg,Ht=class extends Rt{constructor(e={}){super(e,Dn),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
634
|
+
`).map(i=>` ${i}`).join(`
|
635
|
+
`));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
636
|
+
${e.join(`
|
637
|
+
`)}`:`${t} :`}};o(Ht,"Constructed");Dg=Ht;_e.Constructed=Dg;Ht.NAME="CONSTRUCTED";var pf=class extends Yt{fromBER(e,t,n){return t}toBER(e){return Fn}};o(pf,"LocalEndOfContentValueBlock");pf.override="EndOfContentValueBlock";var Kg,Ra=class extends Rt{constructor(e={}){super(e,pf),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};o(Ra,"EndOfContent");Kg=Ra;_e.EndOfContent=Kg;Ra.NAME=Sf;var $g,pn=class extends Rt{constructor(e={}){super(e,Yt),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let i=new Uint8Array(n);i[0]=5,i[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};o(pn,"Null");$g=pn;_e.Null=$g;pn.NAME="NULL";var mf=class extends ai(Yt){constructor(n={}){var i=n,{value:e}=i,t=ft(i,["value"]);super(t),t.valueHex?this.valueHexView=je.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);return Hi(this,i,t,n)?(this.valueHexView=i.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,m0.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return me(ne({},super.toJSON()),{value:this.value})}};o(mf,"LocalBooleanValueBlock");mf.NAME="BooleanValueBlock";var Fg,Ns=class extends Rt{constructor(e={}){super(e,mf),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};o(Ns,"Boolean");Fg=Ns;_e.Boolean=Fg;Ns.NAME="BOOLEAN";var bf=class extends ai(Dn){constructor(n={}){var i=n,{isConstructed:e=!1}=i,t=ft(i,["isConstructed"]);super(t),this.isConstructed=e}fromBER(e,t,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Dn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let s=0;s<this.value.length;s++){let a=this.value[s].constructor.NAME;if(a===Sf){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Pg)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,t,n),this.blockLength=n;return i}toBER(e,t){return this.isConstructed?Dn.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return me(ne({},super.toJSON()),{isConstructed:this.isConstructed})}};o(bf,"LocalOctetStringValueBlock");bf.NAME="OctetStringValueBlock";var Hg,Kn=class extends Rt{constructor(i={}){var s=i,{idBlock:e={},lenBlock:t={}}=s,n=ft(s,["idBlock","lenBlock"]);var a,c;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((c=n.value)===null||c===void 0)&&c.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:me(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),bf),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(s.byteLength){let a=ja(s,0,s.byteLength);a.offset!==-1&&a.offset===n&&(this.valueBlock.value=[a.result])}}catch(a){}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ht.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof Kn&&e.push(t.valueBlock.valueHexView);return je.BufferSourceConverter.concat(e)}};o(Kn,"OctetString");Hg=Kn;_e.OctetString=Hg;Kn.NAME=Pg;var gf=class extends ai(Dn){constructor(i={}){var s=i,{unusedBits:e=0,isConstructed:t=!1}=s,n=ft(s,["unusedBits","isConstructed"]);super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let i=-1;if(this.isConstructed){if(i=Dn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let c of this.value){let f=c.constructor.NAME;if(f===Sf){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(f!==Rg)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let l=c.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return i}let s=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,s,t,n))return-1;let a=s.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let c=a.subarray(1);try{if(c.byteLength){let f=ja(c,0,c.byteLength);f.offset!==-1&&f.offset===n-1&&(this.value=[f.result])}}catch(f){}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return Dn.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Fn;let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return me(ne({},super.toJSON()),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})}};o(gf,"LocalBitStringValueBlock");gf.NAME="BitStringValueBlock";var qg,Ki=class extends Rt{constructor(i={}){var s=i,{idBlock:e={},lenBlock:t={}}=s,n=ft(s,["idBlock","lenBlock"]);var a,c;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((c=n.value)===null||c===void 0)&&c.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:me(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),gf),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ht.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let i of t)e.push(i.toString(2).padStart(8,"0"));let n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};o(Ki,"BitString");qg=Ki;_e.BitString=qg;Ki.NAME=Rg;var zg;function JA(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),a=s.length-1,c=i.slice(0),f=c.length-1,l=0,h=f<a?a:f,d=0;for(let v=h;v>=0;v--,d++){switch(!0){case d<c.length:l=s[a-d]+c[f-d]+t[0];break;default:l=s[a-d]+t[0]}switch(t[0]=l/10,!0){case d>=s.length:s=kl(new Uint8Array([l%10]),s);break;default:s[a-d]=l%10}}return t[0]>0&&(s=kl(t,s)),s}o(JA,"viewAdd");function Og(r){if(r>=uf.length)for(let e=uf.length;e<=r;e++){let t=new Uint8Array([0]),n=uf[e-1].slice(0);for(let i=n.length-1;i>=0;i--){let s=new Uint8Array([(n[i]<<1)+t[0]]);t[0]=s[0]/10,n[i]=s[0]%10}t[0]>0&&(n=kl(t,n)),uf.push(n)}return uf[r]}o(Og,"power2");function WA(r,e){let t=0,n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),a=s.length-1,c=i.slice(0),f=c.length-1,l,h=0;for(let d=f;d>=0;d--,h++)switch(l=s[a-h]-c[f-h]-t,!0){case l<0:t=1,s[a-h]=l+10;break;default:t=0,s[a-h]=l}if(t>0)for(let d=a-f+1;d>=0;d--,h++)if(l=s[a-h]-t,l<0)t=1,s[a-h]=l+10;else{t=0,s[a-h]=l;break}return s.slice()}o(WA,"viewSub");var Ua=class extends ai(Yt){constructor(n={}){var i=n,{value:e}=i,t=ft(i,["value"]);super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=m0.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Mg(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,i=0){let s=this.fromBER(e,t,n);if(s===-1)return s;let a=this.valueHexView;return a[0]===0&&(a[1]&128)!==0?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),s}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let i=super.fromBER(e,t,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return me(ne({},super.toJSON()),{valueDec:this.valueDec})}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,i,s=this.valueHexView,a="",c=!1;for(let f=s.byteLength-1;f>=0;f--){i=s[f];for(let l=0;l<8;l++){if((i&1)===1)switch(n){case e:t=WA(Og(n),t),a="-";break;default:t=JA(t,Og(n))}n++,i>>=1}}for(let f=0;f<t.length;f++)t[f]&&(c=!0),c&&(a+=Ig.charAt(t[f]));return c===!1&&(a+=Ig.charAt(0)),a}};o(Ua,"LocalIntegerValueBlock");zg=Ua;Ua.NAME="IntegerValueBlock";Object.defineProperty(zg.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var jg,or=class extends Rt{constructor(e={}){super(e,Ua),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Ml(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Ml();let t=BigInt(e),n=new Po,i=t.toString(16).replace(/^-/,""),s=new Uint8Array(je.Convert.FromHex(i));if(t<0){let c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;let l=BigInt(`0x${je.Convert.ToHex(c)}`)+t,h=je.BufferSourceConverter.toUint8Array(je.Convert.FromHex(l.toString(16)));h[0]|=128,n.write(h)}else s[0]&128&&n.write(new Uint8Array([0])),n.write(s);return new or({valueHex:n.final()})}convertToDER(){let e=new or({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new or({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};o(or,"Integer");jg=or;_e.Integer=jg;or.NAME="INTEGER";var Vg,Os=class extends or{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};o(Os,"Enumerated");Vg=Os;_e.Enumerated=Vg;Os.NAME="ENUMERATED";var La=class extends ai(Yt){constructor(i={}){var s=i,{valueDec:e=-1,isFirstSid:t=!1}=s,n=ft(s,["valueDec","isFirstSid"]);super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,(s[c]&128)!==0);c++);let a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Oo(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Ml();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let t=Bs(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Fn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)n[a]=i[a]|128;n[s]=i[s]}return n}toString(){let e="";if(this.isHexOnly)e=je.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return me(ne({},super.toJSON()),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})}};o(La,"LocalSidValueBlock");La.NAME="sidBlock";var yf=class extends Yt{constructor(n={}){var i=n,{value:e=Ur}=i,t=ft(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let s=new La;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,Fn;t.push(i)}return g0(t)}fromString(e){this.value=[];let t=0,n=0,i="",s=!1;do if(n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1,s){let a=this.value[0],c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}let f=parseInt(i,10);if(isNaN(f))return;a.valueDec=f+c,s=!1}else{let a=new La;if(i>Number.MAX_SAFE_INTEGER){Ml();let c=BigInt(i);a.valueBigInt=c}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!0),this.value.push(a)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){let e=me(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};o(yf,"LocalObjectIdentifierValueBlock");yf.NAME="ObjectIdentifierValueBlock";var Gg,Ps=class extends Rt{constructor(e={}){super(e,yf),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return me(ne({},super.toJSON()),{value:this.getValue()})}};o(Ps,"ObjectIdentifier");Gg=Ps;_e.ObjectIdentifier=Gg;Ps.NAME="OBJECT IDENTIFIER";var Da=class extends ai(si){constructor(n={}){var i=n,{valueDec:e=0}=i,t=ft(i,["valueDec"]);super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,(s[c]&128)!==0);c++);let a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Oo(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let t=Bs(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Fn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)n[a]=i[a]|128;n[s]=i[s]}return n.buffer}toString(){let e="";return this.isHexOnly?e=je.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return me(ne({},super.toJSON()),{valueDec:this.valueDec})}};o(Da,"LocalRelativeSidValueBlock");Da.NAME="relativeSidBlock";var vf=class extends Yt{constructor(n={}){var i=n,{value:e=Ur}=i,t=ft(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let s=new Da;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e,t){let n=[];for(let i=0;i<this.value.length;i++){let s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,Fn;n.push(s)}return g0(n)}fromString(e){this.value=[];let t=0,n=0,i="";do{n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1;let s=new Da;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(i=`{${i}}`),e+=i}return e}toJSON(){let e=me(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};o(vf,"LocalRelativeObjectIdentifierValueBlock");vf.NAME="RelativeObjectIdentifierValueBlock";var Jg,Ka=class extends Rt{constructor(e={}){super(e,vf),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return me(ne({},super.toJSON()),{value:this.getValue()})}};o(Ka,"RelativeObjectIdentifier");Jg=Ka;_e.RelativeObjectIdentifier=Jg;Ka.NAME="RelativeObjectIdentifier";var Wg,Cr=class extends Ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};o(Cr,"Sequence");Wg=Cr;_e.Sequence=Wg;Cr.NAME="SEQUENCE";var Yg,kr=class extends Ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};o(kr,"Set");Yg=kr;_e.Set=Yg;kr.NAME="SET";var wf=class extends ai(Yt){constructor(t={}){var e=ft(t,[]);super(e),this.isHexOnly=!0,this.value=Ur}toJSON(){return me(ne({},super.toJSON()),{value:this.value})}};o(wf,"LocalStringValueBlock");wf.NAME="StringValueBlock";var xf=class extends wf{};o(xf,"LocalSimpleStringValueBlock");xf.NAME="SimpleStringValueBlock";var br=class extends Pa{constructor(t={}){var e=ft(t,[]);super(e,xf)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}};o(br,"LocalSimpleStringBlock");br.NAME="SIMPLE STRING";var _f=class extends br{fromBuffer(e){this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=je.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=je.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf8String(e)),this.valueBlock.value=e}};o(_f,"LocalUtf8StringValueBlock");_f.NAME="Utf8StringValueBlock";var Xg,Zr=class extends _f{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};o(Zr,"Utf8String");Xg=Zr;_e.Utf8String=Xg;Zr.NAME="UTF8String";var Af=class extends br{fromBuffer(e){this.valueBlock.value=je.Convert.ToUtf16String(e),this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf16String(e))}};o(Af,"LocalBmpStringValueBlock");Af.NAME="BmpStringValueBlock";var Zg,Rs=class extends Af{constructor(t={}){var e=ft(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};o(Rs,"BmpString");Zg=Rs;_e.BmpString=Zg;Rs.NAME="BMPString";var Ef=class extends br{fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let i=0;i<t;i++){let s=Bs(e.charCodeAt(i),8),a=new Uint8Array(s);if(a.length>4)continue;let c=4-a.length;for(let f=a.length-1;f>=0;f--)n[i*4+f+c]=a[f]}this.valueBlock.value=e}};o(Ef,"LocalUniversalStringValueBlock");Ef.NAME="UniversalStringValueBlock";var Qg,Us=class extends Ef{constructor(t={}){var e=ft(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};o(Us,"UniversalString");Qg=Us;_e.UniversalString=Qg;Us.NAME="UniversalString";var ey,Ls=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};o(Ls,"NumericString");ey=Ls;_e.NumericString=ey;Ls.NAME="NumericString";var ty,Ds=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};o(Ds,"PrintableString");ty=Ds;_e.PrintableString=ty;Ds.NAME="PrintableString";var ry,Ks=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};o(Ks,"TeletexString");ry=Ks;_e.TeletexString=ry;Ks.NAME="TeletexString";var ny,$s=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};o($s,"VideotexString");ny=$s;_e.VideotexString=ny;$s.NAME="VideotexString";var iy,Fs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};o(Fs,"IA5String");iy=Fs;_e.IA5String=iy;Fs.NAME="IA5String";var sy,Hs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};o(Hs,"GraphicString");sy=Hs;_e.GraphicString=sy;Hs.NAME="GraphicString";var oy,$i=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};o($i,"VisibleString");oy=$i;_e.VisibleString=oy;$i.NAME="VisibleString";var ay,qs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};o(qs,"GeneralString");ay=qs;_e.GeneralString=ay;qs.NAME="GeneralString";var cy,zs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};o(zs,"CharacterString");cy=zs;_e.CharacterString=cy;zs.NAME="CharacterString";var fy,Fi=class extends $i{constructor(i={}){var s=i,{value:e,valueDate:t}=s,n=ft(s,["value","valueDate"]);if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let a=0;a<e.length;a++)this.valueBlock.valueHexView[a]=e.charCodeAt(a)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=Rr(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Rr(this.month,2),t[2]=Rr(this.day,2),t[3]=Rr(this.hour,2),t[4]=Rr(this.minute,2),t[5]=Rr(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return me(ne({},super.toJSON()),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})}};o(Fi,"UTCTime");fy=Fi;_e.UTCTime=fy;Fi.NAME="UTCTime";var uy,js=class extends Fi{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,n="",i="",s=0,a,c=0,f=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let d=new Number(e[e.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,v=n.indexOf("+"),x="";if(v===-1&&(v=n.indexOf("-"),d=-1),v!==-1){if(x=n.substring(v+1),n=n.substring(0,v),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let y=parseInt(x.substring(0,2),10);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");if(c=d*y,x.length===4){if(y=parseInt(x.substring(2,4),10),isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");f=d*y}}}let l=n.indexOf(".");if(l===-1&&(l=n.indexOf(",")),l!==-1){let d=new Number(`0${n.substring(l)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");s=d.valueOf(),i=n.substring(0,l)}else i=n;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*s;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*s;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=1e3*s;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}let h=a.exec(i);if(h===null)throw new Error("Wrong input string for conversion");for(let d=1;d<h.length;d++)switch(d){case 1:this.year=parseInt(h[d],10);break;case 2:this.month=parseInt(h[d],10);break;case 3:this.day=parseInt(h[d],10);break;case 4:this.hour=parseInt(h[d],10)+c;break;case 5:this.minute=parseInt(h[d],10)+f;break;case 6:this.second=parseInt(h[d],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push(Rr(this.year,4)),t.push(Rr(this.month,2)),t.push(Rr(this.day,2)),t.push(Rr(this.hour,2)),t.push(Rr(this.minute,2)),t.push(Rr(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Rr(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return me(ne({},super.toJSON()),{millisecond:this.millisecond})}};o(js,"GeneralizedTime");uy=js;_e.GeneralizedTime=uy;js.NAME="GeneralizedTime";var ly,$a=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};o($a,"DATE");ly=$a;_e.DATE=ly;$a.NAME="DATE";var hy,Fa=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};o(Fa,"TimeOfDay");hy=Fa;_e.TimeOfDay=hy;Fa.NAME="TimeOfDay";var dy,Ha=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};o(Ha,"DateTime");dy=Ha;_e.DateTime=dy;Ha.NAME="DateTime";var py,qa=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};o(qa,"Duration");py=qa;_e.Duration=py;qa.NAME="Duration";var my,za=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};o(za,"TIME");my=za;_e.TIME=my;za.NAME="TIME";var $n=class{constructor({name:e=Ur,optional:t=!1}={}){this.name=e,this.optional=t}};o($n,"Any");var Ro=class extends $n{constructor(n={}){var i=n,{value:e=[]}=i,t=ft(i,["value"]);super(t),this.value=e}};o(Ro,"Choice");var Vs=class extends $n{constructor(i={}){var s=i,{value:e=new $n,local:t=!1}=s,n=ft(s,["value","local"]);super(n),this.value=e,this.local=t}};o(Vs,"Repeated");var Tl=class{constructor({data:e=Bl}={}){this.dataView=je.BufferSourceConverter.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=je.BufferSourceConverter.toUint8Array(e)}fromBER(e,t,n){let i=t+n;return this.dataView=je.BufferSourceConverter.toUint8Array(e).subarray(t,i),i}toBER(e){return this.dataView.slice().buffer}};o(Tl,"RawData");function Is(r,e,t){if(t instanceof Ro){for(let s=0;s<t.value.length;s++)if(Is(r,e,t.value[s]).verified)return{verified:!0,result:r};{let s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(b0)&&(s.name=t.name),s}}if(t instanceof $n)return t.hasOwnProperty(b0)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(KA in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(qA in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(zA in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty($A)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(FA)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(HA)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(DA in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(Ng in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let s=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:r};for(let c=0;c<s.length;c++)if(s[c]!==a[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(r[t.name]=e)),t instanceof _e.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof Vs&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let f=!0;for(let l=0;l<t.valueBlock.value.length;l++)f=f&&(t.valueBlock.value[l].optional||!1);return f?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let f=0;f<c;f++)if(f-s>=e.valueBlock.value.length){if(t.valueBlock.value[f].optional===!1){let l={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],l.name=t.name)),l}}else if(t.valueBlock.value[0]instanceof Vs){if(a=Is(r,e.valueBlock.value[f],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),a;if(b0 in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let l={};jA in t.valueBlock.value[0]&&t.valueBlock.value[0].local?l=e:l=r,typeof l[t.valueBlock.value[0].name]=="undefined"&&(l[t.valueBlock.value[0].name]=[]),l[t.valueBlock.value[0].name].push(e.valueBlock.value[f])}}else if(a=Is(r,e.valueBlock.value[f-s],t.valueBlock.value[f]),a.verified===!1)if(t.valueBlock.value[f].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),a;if(a.verified===!1){let f={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],f.name=t.name)),f}return{verified:!0,result:r}}if(t.primitiveSchema&&Ng in e.valueBlock){let s=ja(e.valueBlock.valueHexView);if(s.offset===-1){let a={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],a.name=t.name)),a}return Is(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}o(Is,"compareSchema");function YA(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let t=ja(je.BufferSourceConverter.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:Is(t.result,t.result,e)}o(YA,"verifySchema");var Ut;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(Ut||(Ut={}));var Se;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(Se||(Se={}));var XA={fromASN:r=>r instanceof pn?null:r.valueBeforeDecode,toASN:r=>{if(r===null)return new pn;let e=qi(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Il={fromASN:r=>r.valueBlock.valueHex.byteLength>4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new or({value:r})},ZA={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new Os({value:r})};var QA={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new Ki({valueHex:r})},eE={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Ps({value:r})},tE={fromASN:r=>r.valueBlock.value,toASN:r=>new Ns({value:r})},rE={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new Kn({valueHex:r})};function mn(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}o(mn,"createStringConverter");var nE=mn(Zr),iE=mn(Rs),sE=mn(Us),oE=mn(Ls),aE=mn(Ds),cE=mn(Ks),fE=mn($s),uE=mn(Fs),lE=mn(Hs),hE=mn($i),dE=mn(qs),pE=mn(zs),mE={fromASN:r=>r.toDate(),toASN:r=>new Fi({valueDate:r})},bE={fromASN:r=>r.toDate(),toASN:r=>new js({valueDate:r})},gE={fromASN:r=>null,toASN:r=>new pn};function Va(r){switch(r){case Se.Any:return XA;case Se.BitString:return QA;case Se.BmpString:return iE;case Se.Boolean:return tE;case Se.CharacterString:return pE;case Se.Enumerated:return ZA;case Se.GeneralString:return dE;case Se.GeneralizedTime:return bE;case Se.GraphicString:return lE;case Se.IA5String:return uE;case Se.Integer:return Il;case Se.Null:return gE;case Se.NumericString:return oE;case Se.ObjectIdentifier:return eE;case Se.OctetString:return rE;case Se.PrintableString:return aE;case Se.TeletexString:return cE;case Se.UTCTime:return mE;case Se.UniversalString:return sE;case Se.Utf8String:return nE;case Se.VideotexString:return fE;case Se.VisibleString:return hE;default:return null}}o(Va,"defaultConverter");var yE=ze(Ms());var vE=ze(Ms());function bn(r){return r&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:bn(r.prototype):!!(r&&r.toASN&&r.fromASN)}o(bn,"isConvertible");function v0(r){var e;if(r){let t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:v0(t)}return!1}o(v0,"isTypeOfArray");function by(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}o(by,"isArrayEqual");var Cf=class{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e){var t,n,i;let s=this.items.get(e);if(!s)throw new Error(`Cannot get schema for '${(i=(n=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:e}' target`);return s}cache(e){let t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){let t={type:Ut.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(t,n),t.items=Object.assign({},t.items,n.items)),t}create(e,t){let n=this.items.get(e)||this.createDefault(e),i=[];for(let s in n.items){let a=n.items[s],c=t?s:"",f;if(typeof a.type=="number"){let h=Se[a.type],d=zi[h];if(!d)throw new Error(`Cannot get ASN1 class by name '${h}'`);f=new d({name:c})}else bn(a.type)?f=new a.type().toSchema(c):a.optional?this.get(a.type).type===Ut.Choice?f=new $n({name:c}):(f=this.create(a.type,!1),f.name=c):f=new $n({name:c});let l=!!a.optional||a.defaultValue!==void 0;if(a.repeated){f.name="";let h=a.repeated==="set"?kr:Cr;f=new h({name:"",value:[new Vs({name:c,value:f})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||bn(a.type)){let h=a.repeated?Ht:oi;i.push(new h({name:c,optional:l,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);let h=!!a.repeated,d=h?f:this.get(a.type).schema;d=d.valueBlock?d.valueBlock.value:d.value,i.push(new Ht({name:h?"":c,optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:d}))}else i.push(new Ht({optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:[f]}));else f.optional=l,i.push(f)}switch(n.type){case Ut.Sequence:return new Cr({value:i,name:""});case Ut.Set:return new kr({value:i,name:""});case Ut.Choice:return new Ro({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};o(Cf,"AsnSchemaStorage");var Tr=new Cf;var Uo=o(r=>e=>{let t;Tr.has(e)?t=Tr.get(e):(t=Tr.createDefault(e),Tr.set(e,t)),Object.assign(t,r)},"AsnType"),Je=o(r=>(e,t)=>{let n;Tr.has(e.constructor)?n=Tr.get(e.constructor):(n=Tr.createDefault(e.constructor),Tr.set(e.constructor,n));let i=Object.assign({},r);if(typeof i.type=="number"&&!i.converter){let s=Va(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);i.converter=s}n.items[t]=i},"AsnProp");var Ga=class extends Error{constructor(){super(...arguments),this.schemas=[]}};o(Ga,"AsnSchemaValidationError");var We=class{static parse(e,t){let n;if(e instanceof ArrayBuffer)n=e;else if(typeof Buffer!="undefined"&&Buffer.isBuffer(e))n=new Uint8Array(e).buffer;else if(ArrayBuffer.isView(e)||e.buffer instanceof ArrayBuffer)n=e.buffer;else throw new TypeError("Wrong type of 'data' argument");let i=qi(n);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var n;try{if(bn(t))return new t().fromASN(e);let i=Tr.get(t);Tr.cache(t);let s=i.schema;if(e.constructor===Ht&&i.type!==Ut.Choice){s=new Ht({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(let f in i.items)delete e[f]}let a=Is(e,e,s);if(!a.verified)throw new Ga(`Data does not match to ${t.name} ASN1 schema. ${a.result.error}`);let c=new t;if(v0(t))if(typeof i.itemType=="number"){let f=Va(i.itemType);if(!f)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,l=>f.fromASN(l))}else return t.from(e.valueBlock.value,f=>this.fromASN(f,i.itemType));for(let f in i.items){if(!e[f])continue;let l=i.items[f];if(typeof l.type=="number"||bn(l.type)){let h=(n=l.converter)!==null&&n!==void 0?n:bn(l.type)?new l.type:null;if(!h)throw new Error("Converter is empty");if(l.repeated)if(l.implicit){let d=l.repeated==="sequence"?Cr:kr,v=new d;v.valueBlock=e[f].valueBlock;let x=qi(v.toBER(!1)).result.valueBlock.value;c[f]=Array.from(x,y=>h.fromASN(y))}else c[f]=Array.from(e[f],d=>h.fromASN(d));else{let d=e[f];if(l.implicit){let v;if(bn(l.type))v=new l.type().toSchema("");else{let x=Se[l.type],y=zi[x];if(!y)throw new Error(`Cannot get '${x}' class from asn1js module`);v=new y}v.valueBlock=d.valueBlock,d=qi(v.toBER(!1)).result}c[f]=h.fromASN(d)}}else l.repeated?c[f]=Array.from(e[f],h=>this.fromASN(h,l.type)):c[f]=this.fromASN(e[f],l.type)}return c}catch(i){throw i instanceof Ga&&i.schemas.push(t.name),i}}};o(We,"AsnParser");var Ye=class{static serialize(e){return e instanceof Rt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&bn(e.constructor))return e.toASN();let t=e.constructor,n=Tr.get(t);Tr.cache(t);let i=[];if(n.itemType)if(typeof n.itemType=="number"){let a=Va(n.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(c=>a.toASN(c))}else i=e.map(a=>this.toAsnItem({type:n.itemType},"[]",t,a));else for(let a in n.items){let c=n.items[a],f=e[a];if(f===void 0||c.defaultValue===f||typeof c.defaultValue=="object"&&typeof f=="object"&&by(this.serialize(c.defaultValue),this.serialize(f)))continue;let l=Ye.toAsnItem(c,a,t,f);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||bn(c.type))){let h={};h.valueHex=l instanceof pn?l.valueBeforeDecode:l.valueBlock.toBER(),i.push(new oi(ne({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context}},h)))}else i.push(new Ht({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:l.valueBlock.value}));else i.push(new Ht({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[l]}));else c.repeated?i=i.concat(l):i.push(l)}let s;switch(n.type){case Ut.Sequence:s=new Cr({value:i});break;case Ut.Set:s=new kr({value:i});break;case Ut.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,t,n,i){let s;if(typeof e.type=="number"){let a=e.converter;if(!a)throw new Error(`Property '${t}' doesn't have converter for type ${Se[e.type]} in schema '${n.name}'`);if(e.repeated){let c=Array.from(i,l=>a.toASN(l)),f=e.repeated==="sequence"?Cr:kr;s=new f({value:c})}else s=a.toASN(i)}else if(e.repeated){let a=Array.from(i,f=>this.toASN(f)),c=e.repeated==="sequence"?Cr:kr;s=new c({value:a})}else s=this.toASN(i);return s}};o(Ye,"AsnSerializer");var w0=ze(Ms());var Lo=class{static serialize(e){return Ye.serialize(e)}static parse(e,t){return We.parse(e,t)}static toString(e){let t=w0.BufferSourceConverter.isBufferSource(e)?w0.BufferSourceConverter.toArrayBuffer(e):Lo.serialize(e),n=qi(t);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}};o(Lo,"AsnConvert");var Ky=ze(Dy(),1),{__extends:gr,__assign:ER,__rest:SR,__decorate:Re,__param:CR,__metadata:kR,__awaiter:$y,__generator:Rl,__exportStar:TR,__createBinding:MR,__values:Do,__read:Qr,__spread:BR,__spreadArrays:IR,__spreadArray:Hn,__await:Ul,__asyncGenerator:Fy,__asyncDelegator:NR,__asyncValues:Hy,__makeTemplateObject:OR,__importStar:PR,__importDefault:RR,__classPrivateFieldGet:UR,__classPrivateFieldSet:LR,__classPrivateFieldIn:DR}=Ky.default;var Ko=class extends Error{constructor(e,t){super(t?`${e}. See the inner exception for more details.`:e),this.message=e,this.innerError=t}};o(Ko,"JsonError");var Ll=class extends Ko{constructor(e,t,n){super(t,n),this.schema=e}};o(Ll,"TransformError");var $o=class extends Ll{constructor(e,t,n){super(e,`JSON doesn't match to '${e.target.name}' schema. ${t}`,n)}};o($o,"ParserError");var zn=class extends Ko{};o(zn,"ValidationError");var Wa=class extends Ko{constructor(e,t,n){super(`Cannot serialize by '${e}' schema. ${t}`,n),this.schemaName=e}};o(Wa,"SerializerError");var kf=class extends $o{constructor(e,t,n={}){super(e,"Some keys doesn't match to schema"),this.keys=t,this.errors=n}};o(kf,"KeyError");var Lt;(function(r){r[r.Any=0]="Any",r[r.Boolean=1]="Boolean",r[r.Number=2]="Number",r[r.String=3]="String"})(Lt||(Lt={}));function wE(r,e){switch(e){case Lt.Boolean:return typeof r=="boolean";case Lt.Number:return typeof r=="number";case Lt.String:return typeof r=="string"}return!0}o(wE,"checkType");function ql(r,e){if(!wE(r,e))throw new TypeError(`Value must be ${Lt[e]}`)}o(ql,"throwIfTypeIsWrong");function zl(r){return r&&r.prototype?r.prototype.toJSON&&r.prototype.fromJSON?!0:zl(r.prototype):!!(r&&r.toJSON&&r.fromJSON)}o(zl,"isConvertible");var Dl=class{constructor(){this.items=new Map}has(e){return this.items.has(e)||!!this.findParentSchema(e)}get(e){let t=this.items.get(e)||this.findParentSchema(e);if(!t)throw new Error("Cannot get schema for current target");return t}create(e){let t={names:{}},n=this.findParentSchema(e);if(n){Object.assign(t,n),t.names={};for(let i in n.names)t.names[i]=Object.assign({},n.names[i])}return t.target=e,t}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};o(Dl,"JsonSchemaStorage");var Bf="default",qn=new Dl,Kl=class{constructor(e){this.pattern=new RegExp(e)}validate(e){let t=new RegExp(this.pattern.source,this.pattern.flags);if(typeof e!="string")throw new zn("Incoming value must be string");if(!t.exec(e))throw new zn(`Value doesn't match to pattern '${t.toString()}'`)}};o(Kl,"PatternValidation");var $l=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(ql(e,Lt.Number),!(this.min<=e&&e<=this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new zn(`Value doesn't match to diapason [${t},${n}]`)}}};o($l,"InclusiveValidation");var Fl=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(ql(e,Lt.Number),!(this.min<e&&e<this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new zn(`Value doesn't match to diapason (${t},${n})`)}}};o(Fl,"ExclusiveValidation");var Tf=class{constructor(e,t,n){this.length=e,this.minLength=t,this.maxLength=n}validate(e){if(this.length!==void 0){if(e.length!==this.length)throw new zn(`Value length must be exactly ${this.length}.`);return}if(this.minLength!==void 0&&e.length<this.minLength)throw new zn(`Value length must be more than ${this.minLength}.`);if(this.maxLength!==void 0&&e.length>this.maxLength)throw new zn(`Value length must be less than ${this.maxLength}.`)}};o(Tf,"LengthValidation");var Hl=class{constructor(e){this.enumeration=e}validate(e){if(ql(e,Lt.String),!this.enumeration.includes(e))throw new zn(`Value must be one of ${this.enumeration.map(t=>`'${t}'`).join(", ")}`)}};o(Hl,"EnumerationValidation");var Mf=class{static checkValues(e,t){let n=Array.isArray(e)?e:[e];for(let i of n)for(let s of t.validations)s instanceof Tf&&t.repeated?s.validate(e):s.validate(i)}static checkTypes(e,t){if(t.repeated&&!Array.isArray(e))throw new TypeError("Value must be Array");if(typeof t.type=="number"){let n=Array.isArray(e)?e:[e];for(let i of n)ql(i,t.type)}}static getSchemaByName(e,t=Bf){return ne(ne({},e.names[Bf]),e.names[t])}};o(Mf,"JsonTransform");var Mr=class extends Mf{static serialize(e,t,n,i){let s=this.toJSON(e,t);return JSON.stringify(s,n,i)}static toJSON(e,t={}){let n,i=t.targetSchema,s=t.schemaName||Bf;if(zl(e))return e.toJSON();if(Array.isArray(e)){n=[];for(let a of e)n.push(this.toJSON(a,t))}else if(typeof e=="object"){if(i&&!qn.has(i))throw new Ko("Cannot get schema for `targetSchema` param");if(i=i||e.constructor,qn.has(i)){let a=qn.get(i);n={};let c=this.getSchemaByName(a,s);for(let f in c)try{let l=c[f],h=e[f],d;if(l.optional&&h===void 0||l.defaultValue!==void 0&&h===l.defaultValue)continue;if(!l.optional&&h===void 0)throw new Wa(i.name,`Property '${f}' is required.`);typeof l.type=="number"?l.converter?l.repeated?d=h.map(v=>l.converter.toJSON(v,e)):d=l.converter.toJSON(h,e):d=h:l.repeated?d=h.map(v=>this.toJSON(v,{schemaName:s})):d=this.toJSON(h,{schemaName:s}),this.checkTypes(d,l),this.checkValues(d,l),n[l.name||f]=d}catch(l){throw l instanceof Wa?l:new Wa(a.target.name,`Property '${f}' is wrong. ${l.message}`,l)}}else{n={};for(let a in e)n[a]=this.toJSON(e[a],{schemaName:s})}}else n=e;return n}};o(Mr,"JsonSerializer");var Vt=class extends Mf{static parse(e,t){let n=JSON.parse(e);return this.fromJSON(n,t)}static fromJSON(e,t){let n=t.targetSchema,i=t.schemaName||Bf,s=new n;if(zl(s))return s.fromJSON(e);let a=qn.get(n),c=this.getSchemaByName(a,i),f={};t.strictProperty&&!Array.isArray(e)&&Vt.checkStrictProperty(e,c,a);for(let h in c)try{let d=c[h],v=d.name||h,x=e[v];if(x===void 0&&(d.optional||d.defaultValue!==void 0))continue;if(!d.optional&&x===void 0)throw new $o(a,`Property '${v}' is required.`);if(this.checkTypes(x,d),this.checkValues(x,d),typeof d.type=="number")d.converter?d.repeated?s[h]=x.map(y=>d.converter.fromJSON(y,s)):s[h]=d.converter.fromJSON(x,s):s[h]=x;else{let y=me(ne({},t),{targetSchema:d.type,schemaName:i});d.repeated?s[h]=x.map(_=>this.fromJSON(_,y)):s[h]=this.fromJSON(x,y)}}catch(d){if(d instanceof $o||(d=new $o(a,`Property '${h}' is wrong. ${d.message}`,d)),t.strictAllKeys)f[h]=d;else throw d}let l=Object.keys(f);if(l.length)throw new kf(a,l,f);return s}static checkStrictProperty(e,t,n){let i=Object.keys(e),s=Object.keys(t),a=[];for(let c of i)s.indexOf(c)===-1&&a.push(c);if(a.length)throw new kf(n,a)}};o(Vt,"JsonParser");function xE(r){let e=[];return r.pattern&&e.push(new Kl(r.pattern)),(r.type===Lt.Number||r.type===Lt.Any)&&((r.minInclusive!==void 0||r.maxInclusive!==void 0)&&e.push(new $l(r.minInclusive,r.maxInclusive)),(r.minExclusive!==void 0||r.maxExclusive!==void 0)&&e.push(new Fl(r.minExclusive,r.maxExclusive)),r.enumeration!==void 0&&e.push(new Hl(r.enumeration))),(r.type===Lt.String||r.repeated||r.type===Lt.Any)&&(r.length!==void 0||r.minLength!==void 0||r.maxLength!==void 0)&&e.push(new Tf(r.length,r.minLength,r.maxLength)),e}o(xE,"getValidations");var qt=o((r={})=>(e,t)=>{let n=`Cannot set type for ${t} property of ${e.constructor.name} schema`,i;qn.has(e.constructor)?(i=qn.get(e.constructor),i.target!==e.constructor&&(i=qn.create(e.constructor),qn.set(e.constructor,i))):(i=qn.create(e.constructor),qn.set(e.constructor,i));let s={type:Lt.Any,validations:[]},a=Object.assign(s,r);if(a.validations=xE(a),typeof a.type!="number"&&!qn.has(a.type)&&!zl(a.type))throw new Error(`${n}. Assigning type doesn't have schema.`);let c;Array.isArray(r.schema)?c=r.schema:c=[r.schema||Bf];for(let f of c){i.names[f]||(i.names[f]={});let l=i.names[f];l[t]=a}},"JsonProp");var Lr=class extends Error{};o(Lr,"CryptoError");var Gs=class extends Lr{};o(Gs,"AlgorithmError");var gn=class extends Lr{constructor(e){super(`Unsupported operation: ${e?`${e}`:""}`)}};o(gn,"UnsupportedOperationError");var Oe=class extends Lr{};o(Oe,"OperationError");var jl=class extends Lr{constructor(e){super(`${e}: Missing required property`)}};o(jl,"RequiredPropertyError");function _E(r){return typeof r=="object"&&"kty"in r}o(_E,"isJWK");var zt=class{digest(...e){return M(this,null,function*(){return this.checkDigest.apply(this,e),this.onDigest.apply(this,e)})}checkDigest(e,t){this.checkAlgorithmName(e)}onDigest(e,t){return M(this,null,function*(){throw new gn("digest")})}generateKey(...e){return M(this,null,function*(){return this.checkGenerateKey.apply(this,e),this.onGenerateKey.apply(this,e)})}checkGenerateKey(e,t,n,...i){if(this.checkAlgorithmName(e),this.checkGenerateKeyParams(e),!(n&&n.length))throw new TypeError("Usages cannot be empty when creating a key.");let s;Array.isArray(this.usages)?s=this.usages:s=this.usages.privateKey.concat(this.usages.publicKey),this.checkKeyUsages(n,s)}checkGenerateKeyParams(e){}onGenerateKey(e,t,n,...i){return M(this,null,function*(){throw new gn("generateKey")})}sign(...e){return M(this,null,function*(){return this.checkSign.apply(this,e),this.onSign.apply(this,e)})}checkSign(e,t,n,...i){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"sign")}onSign(e,t,n,...i){return M(this,null,function*(){throw new gn("sign")})}verify(...e){return M(this,null,function*(){return this.checkVerify.apply(this,e),this.onVerify.apply(this,e)})}checkVerify(e,t,n,i,...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"verify")}onVerify(e,t,n,i,...s){return M(this,null,function*(){throw new gn("verify")})}encrypt(...e){return M(this,null,function*(){return this.checkEncrypt.apply(this,e),this.onEncrypt.apply(this,e)})}checkEncrypt(e,t,n,i={},...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"encrypt":void 0)}onEncrypt(e,t,n,...i){return M(this,null,function*(){throw new gn("encrypt")})}decrypt(...e){return M(this,null,function*(){return this.checkDecrypt.apply(this,e),this.onDecrypt.apply(this,e)})}checkDecrypt(e,t,n,i={},...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"decrypt":void 0)}onDecrypt(e,t,n,...i){return M(this,null,function*(){throw new gn("decrypt")})}deriveBits(...e){return M(this,null,function*(){return this.checkDeriveBits.apply(this,e),this.onDeriveBits.apply(this,e)})}checkDeriveBits(e,t,n,i={},...s){if(this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"deriveBits":void 0),n%8!==0)throw new Oe("length: Is not multiple of 8")}onDeriveBits(e,t,n,...i){return M(this,null,function*(){throw new gn("deriveBits")})}exportKey(...e){return M(this,null,function*(){return this.checkExportKey.apply(this,e),this.onExportKey.apply(this,e)})}checkExportKey(e,t,...n){if(this.checkKeyFormat(e),this.checkCryptoKey(t),!t.extractable)throw new Lr("key: Is not extractable")}onExportKey(e,t,...n){return M(this,null,function*(){throw new gn("exportKey")})}importKey(...e){return M(this,null,function*(){return this.checkImportKey.apply(this,e),this.onImportKey.apply(this,e)})}checkImportKey(e,t,n,i,s,...a){this.checkKeyFormat(e),this.checkKeyData(e,t),this.checkAlgorithmName(n),this.checkImportParams(n),Array.isArray(this.usages)&&this.checkKeyUsages(s,this.usages)}onImportKey(e,t,n,i,s,...a){return M(this,null,function*(){throw new gn("importKey")})}checkAlgorithmName(e){if(e.name.toLowerCase()!==this.name.toLowerCase())throw new Gs("Unrecognized name")}checkAlgorithmParams(e){}checkDerivedKeyParams(e){}checkKeyUsages(e,t){for(let n of e)if(t.indexOf(n)===-1)throw new TypeError("Cannot create a key using the specified key usages")}checkCryptoKey(e,t){if(this.checkAlgorithmName(e.algorithm),t&&e.usages.indexOf(t)===-1)throw new Lr("key does not match that of operation")}checkRequiredProperty(e,t){if(!(t in e))throw new jl(t)}checkHashAlgorithm(e,t){for(let n of t)if(n.toLowerCase()===e.name.toLowerCase())return;throw new Oe(`hash: Must be one of ${t.join(", ")}`)}checkImportParams(e){}checkKeyFormat(e){switch(e){case"raw":case"pkcs8":case"spki":case"jwk":break;default:throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'")}}checkKeyData(e,t){if(!t)throw new TypeError("keyData: Cannot be empty on empty on key importing");if(e==="jwk"){if(!_E(t))throw new TypeError("keyData: Is not JsonWebToken")}else if(!$e.BufferSourceConverter.isBufferSource(t))throw new TypeError("keyData: Is not ArrayBufferView or ArrayBuffer")}prepareData(e){return $e.BufferSourceConverter.toArrayBuffer(e)}};o(zt,"ProviderCrypto");var ji=class extends zt{checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");switch(e.length){case 128:case 192:case 256:break;default:throw new TypeError("length: Must be 128, 192, or 256")}}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};o(ji,"AesProvider");var If=class extends ji{constructor(){super(...arguments),this.name="AES-CBC",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes")}};o(If,"AesCbcProvider");var Nf=class extends ji{constructor(){super(...arguments),this.name="AES-CMAC",this.usages=["sign","verify"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};o(Nf,"AesCmacProvider");var Of=class extends ji{constructor(){super(...arguments),this.name="AES-CTR",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"counter"),!(e.counter instanceof ArrayBuffer||ArrayBuffer.isView(e.counter)))throw new TypeError("counter: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.counter.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes");if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};o(Of,"AesCtrProvider");var Pf=class extends ji{constructor(){super(...arguments),this.name="AES-ECB",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}};o(Pf,"AesEcbProvider");var Rf=class extends ji{constructor(){super(...arguments),this.name="AES-GCM",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength<1)throw new Oe("iv: Must have length more than 0 and less than 2^64 - 1");switch("tagLength"in e||(e.tagLength=128),e.tagLength){case 32:case 64:case 96:case 104:case 112:case 120:case 128:break;default:throw new Oe("tagLength: Must be one of 32, 64, 96, 104, 112, 120 or 128")}}};o(Rf,"AesGcmProvider");var Uf=class extends ji{constructor(){super(...arguments),this.name="AES-KW",this.usages=["wrapKey","unwrapKey"]}};o(Uf,"AesKwProvider");var Ya=class extends zt{constructor(){super(...arguments),this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.ivSize){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==this.ivSize)throw new TypeError(`iv: Must have length ${this.ivSize} bytes`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");if(e.length!==this.keySizeBits)throw new Oe(`algorithm.length: Must be ${this.keySizeBits}`)}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};o(Ya,"DesProvider");var Xa=class extends zt{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"]}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"publicExponent"),!(e.publicExponent&&e.publicExponent instanceof Uint8Array))throw new TypeError("publicExponent: Missing or not a Uint8Array");let t=$e.Convert.ToBase64(e.publicExponent);if(!(t==="Aw=="||t==="AQAB"))throw new TypeError("publicExponent: Must be [3] or [1,0,1]");if(this.checkRequiredProperty(e,"modulusLength"),e.modulusLength%8||e.modulusLength<256||e.modulusLength>16384)throw new TypeError("The modulus length must be a multiple of 8 bits and >= 256 and <= 16384")}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o(Xa,"RsaProvider");var Lf=class extends Xa{constructor(){super(...arguments),this.name="RSASSA-PKCS1-v1_5",this.usages={privateKey:["sign"],publicKey:["verify"]}}};o(Lf,"RsaSsaProvider");var Df=class extends Xa{constructor(){super(...arguments),this.name="RSA-PSS",this.usages={privateKey:["sign"],publicKey:["verify"]}}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"saltLength"),typeof e.saltLength!="number")throw new TypeError("saltLength: Is not a Number");if(e.saltLength<0)throw new RangeError("saltLength: Must be positive number")}};o(Df,"RsaPssProvider");var Kf=class extends Xa{constructor(){super(...arguments),this.name="RSA-OAEP",this.usages={privateKey:["decrypt","unwrapKey"],publicKey:["encrypt","wrapKey"]}}checkAlgorithmParams(e){if(e.label&&!(e.label instanceof ArrayBuffer||ArrayBuffer.isView(e.label)))throw new TypeError("label: Is not of type '(ArrayBuffer or ArrayBufferView)'")}};o(Kf,"RsaOaepProvider");var Za=class extends zt{checkGenerateKeyParams(e){this.checkRequiredProperty(e,"namedCurve"),this.checkNamedCurve(e.namedCurve)}checkNamedCurve(e){for(let t of this.namedCurves)if(t.toLowerCase()===e.toLowerCase())return;throw new Oe(`namedCurve: Must be one of ${this.namedCurves.join(", ")}`)}};o(Za,"EllipticProvider");var $f=class extends Za{constructor(){super(...arguments),this.name="ECDSA",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o($f,"EcdsaProvider");var AE=["secret","private","public"],Vi=class{static create(e,t,n,i){let s=new this;return s.algorithm=e,s.type=t,s.extractable=n,s.usages=i,s}static isKeyType(e){return AE.indexOf(e)!==-1}get[Symbol.toStringTag](){return"CryptoKey"}};o(Vi,"CryptoKey");var Qa=class extends Za{constructor(){super(...arguments),this.name="ECDH",this.usages={privateKey:["deriveBits","deriveKey"],publicKey:[]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"public"),!(e.public instanceof Vi))throw new TypeError("public: Is not a CryptoKey");if(e.public.type!=="public")throw new Oe("public: Is not a public key");if(e.public.algorithm.name!==this.name)throw new Oe(`public: Is not ${this.name} key`)}};o(Qa,"EcdhProvider");var Ff=class extends Qa{constructor(){super(...arguments),this.name="ECDH-ES",this.namedCurves=["X25519","X448"]}};o(Ff,"EcdhEsProvider");var Hf=class extends Za{constructor(){super(...arguments),this.name="EdDSA",this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["Ed25519","Ed448"]}};o(Hf,"EdDsaProvider");var Xf=o(class{constructor(e){e&&(this.value=e)}},"ObjectIdentifier");Re([Je({type:Se.ObjectIdentifier})],Xf.prototype,"value",void 0);Xf=Re([Uo({type:Ut.Choice})],Xf);var ci=class{constructor(e){Object.assign(this,e)}};o(ci,"AlgorithmIdentifier");Re([Je({type:Se.ObjectIdentifier})],ci.prototype,"algorithm",void 0);Re([Je({type:Se.Any,optional:!0})],ci.prototype,"parameters",void 0);var Gi=class{constructor(){this.version=0,this.privateKeyAlgorithm=new ci,this.privateKey=new ArrayBuffer(0)}};o(Gi,"PrivateKeyInfo");Re([Je({type:Se.Integer})],Gi.prototype,"version",void 0);Re([Je({type:ci})],Gi.prototype,"privateKeyAlgorithm",void 0);Re([Je({type:Se.OctetString})],Gi.prototype,"privateKey",void 0);Re([Je({type:Se.Any,optional:!0})],Gi.prototype,"attributes",void 0);var ec=class{constructor(){this.publicKeyAlgorithm=new ci,this.publicKey=new ArrayBuffer(0)}};o(ec,"PublicKeyInfo");Re([Je({type:ci})],ec.prototype,"publicKeyAlgorithm",void 0);Re([Je({type:Se.BitString})],ec.prototype,"publicKey",void 0);var jn={fromJSON:r=>$e.Convert.FromBase64Url(r),toJSON:r=>$e.Convert.ToBase64Url(new Uint8Array(r))},fi={fromASN:r=>{let e=r.valueBlock.valueHex;return new Uint8Array(e)[0]?r.valueBlock.valueHex:r.valueBlock.valueHex.slice(1)},toASN:r=>{let e=new Uint8Array(r)[0]>127?(0,$e.combine)(new Uint8Array([0]).buffer,r):r;return new or({valueHex:e})}};var Dr=class{constructor(){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0)}};o(Dr,"RsaPrivateKey");Re([Je({type:Se.Integer,converter:Il})],Dr.prototype,"version",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"n",converter:jn})],Dr.prototype,"modulus",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"e",converter:jn})],Dr.prototype,"publicExponent",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"d",converter:jn})],Dr.prototype,"privateExponent",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"p",converter:jn})],Dr.prototype,"prime1",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"q",converter:jn})],Dr.prototype,"prime2",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"dp",converter:jn})],Dr.prototype,"exponent1",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"dq",converter:jn})],Dr.prototype,"exponent2",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"qi",converter:jn})],Dr.prototype,"coefficient",void 0);Re([Je({type:Se.Any,optional:!0})],Dr.prototype,"otherPrimeInfos",void 0);var tc=class{constructor(){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0)}};o(tc,"RsaPublicKey");Re([Je({type:Se.Integer,converter:fi}),qt({name:"n",converter:jn})],tc.prototype,"modulus",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"e",converter:jn})],tc.prototype,"publicExponent",void 0);var rc=o(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){let e=new Uint8Array(this.value);if(e[0]!==4)throw new Lr("Wrong ECPoint. Current version supports only Uncompressed (0x04) point");e=new Uint8Array(this.value.slice(1));let t=e.length/2,n=0;return{x:$e.Convert.ToBase64Url(e.buffer.slice(n,n+t)),y:$e.Convert.ToBase64Url(e.buffer.slice(n+t,n+t+t))}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");if(!("y"in e))throw new Error("y: Missing required property");let t=$e.Convert.FromBase64Url(e.x),n=$e.Convert.FromBase64Url(e.y),i=(0,$e.combine)(new Uint8Array([4]).buffer,t,n);return this.value=new Uint8Array(i).buffer,this}},"EcPublicKey");Re([Je({type:Se.OctetString})],rc.prototype,"value",void 0);rc=Re([Uo({type:Ut.Choice})],rc);var Js=class{constructor(){this.version=1,this.privateKey=new ArrayBuffer(0)}fromJSON(e){if(!("d"in e))throw new Error("d: Missing required property");if(this.privateKey=$e.Convert.FromBase64Url(e.d),"x"in e){let t=new rc;t.fromJSON(e),this.publicKey=Ye.toASN(t).valueBlock.valueHex}return this}toJSON(){let e={};return e.d=$e.Convert.ToBase64Url(this.privateKey),this.publicKey&&Object.assign(e,new rc(this.publicKey).toJSON()),e}};o(Js,"EcPrivateKey");Re([Je({type:Se.Integer,converter:Il})],Js.prototype,"version",void 0);Re([Je({type:Se.OctetString})],Js.prototype,"privateKey",void 0);Re([Je({context:0,type:Se.Any,optional:!0})],Js.prototype,"parameters",void 0);Re([Je({context:1,type:Se.BitString,optional:!0})],Js.prototype,"publicKey",void 0);var _0={fromASN:r=>{let e=new Uint8Array(r.valueBlock.valueHex);return e[0]===0?e.buffer.slice(1):e.buffer},toASN:r=>{let e=new Uint8Array(r);if(e[0]>127){let t=new Uint8Array(e.length+1);return t.set(e,1),new or({valueHex:t.buffer})}return new or({valueHex:r})}},EE=Object.freeze({__proto__:null,AsnIntegerWithoutPaddingConverter:_0}),Ws=class{static decodePoint(e,t){let n=$e.BufferSourceConverter.toUint8Array(e);if(n.length===0||n[0]!==4)throw new Error("Only uncompressed point format supported");let i=(n.length-1)/2;if(i!==Math.ceil(t/8))throw new Error("Point does not match field size");let s=n.slice(1,i+1),a=n.slice(i+1,i+1+i);return{x:s,y:a}}static encodePoint(e,t){let n=Math.ceil(t/8);if(e.x.byteLength!==n||e.y.byteLength!==n)throw new Error("X,Y coordinates don't match point size criteria");let i=$e.BufferSourceConverter.toUint8Array(e.x),s=$e.BufferSourceConverter.toUint8Array(e.y),a=new Uint8Array(n*2+1);return a[0]=4,a.set(i,1),a.set(s,n+1),a}static getSize(e){return Math.ceil(e/8)}static encodeSignature(e,t){let n=this.getSize(t),i=$e.BufferSourceConverter.toUint8Array(e.r),s=$e.BufferSourceConverter.toUint8Array(e.s),a=new Uint8Array(n*2);return a.set(this.padStart(i,n)),a.set(this.padStart(s,n),n),a}static decodeSignature(e,t){let n=this.getSize(t),i=$e.BufferSourceConverter.toUint8Array(e);if(i.length!==n*2)throw new Error("Incorrect size of the signature");let s=i.slice(0,n),a=i.slice(n);return{r:this.trimStart(s),s:this.trimStart(a)}}static trimStart(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;return t===0?e:e.slice(t,e.length)}static padStart(e,t){if(t===e.length)return e;let n=new Uint8Array(t);return n.set(e,t-e.length),n}};o(Ws,"EcUtils");var Ys=class{constructor(){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0)}static fromWebCryptoSignature(e){let t=e.byteLength/2,n=Ws.decodeSignature(e,t*8),i=new Ys;return i.r=$e.BufferSourceConverter.toArrayBuffer(n.r),i.s=$e.BufferSourceConverter.toArrayBuffer(n.s),i}toWebCryptoSignature(e){return e!=null||(e=Math.max(this.r.byteLength,this.s.byteLength)*8),Ws.encodeSignature(this,e).buffer}};o(Ys,"EcDsaSignature");Re([Je({type:Se.Integer,converter:_0})],Ys.prototype,"r",void 0);Re([Je({type:Se.Integer,converter:_0})],Ys.prototype,"s",void 0);var qf=class extends Gi{};o(qf,"OneAsymmetricKey");Re([Je({context:1,implicit:!0,type:Se.BitString,optional:!0})],qf.prototype,"publicKey",void 0);var Gl=o(class{constructor(){this.value=new ArrayBuffer(0)}fromJSON(e){if(!e.d)throw new Error("d: Missing required property");return this.value=$e.Convert.FromBase64Url(e.d),this}toJSON(){return{d:$e.Convert.ToBase64Url(this.value)}}},"EdPrivateKey");Re([Je({type:Se.OctetString})],Gl.prototype,"value",void 0);Gl=Re([Uo({type:Ut.Choice})],Gl);var Jl=o(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){return{x:$e.Convert.ToBase64Url(this.value)}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");return this.value=$e.Convert.FromBase64Url(e.x),this}},"EdPublicKey");Re([Je({type:Se.BitString})],Jl.prototype,"value",void 0);Jl=Re([Uo({type:Ut.Choice})],Jl);var Wl=o(class{},"CurvePrivateKey");Re([Je({type:Se.OctetString}),qt({type:Lt.String,converter:jn})],Wl.prototype,"d",void 0);Wl=Re([Uo({type:Ut.Choice})],Wl);var qy="1.2.840.10045.3.1.7",Yl="1.3.132.0",zy=`${Yl}.34`,jy=`${Yl}.35`,Vy=`${Yl}.10`,Br="1.3.36.3.3.2.8.1.1",Gy=`${Br}.1`,Jy=`${Br}.2`,Wy=`${Br}.3`,Yy=`${Br}.4`,Xy=`${Br}.5`,Zy=`${Br}.6`,Qy=`${Br}.7`,ev=`${Br}.8`,tv=`${Br}.9`,rv=`${Br}.10`,nv=`${Br}.11`,iv=`${Br}.12`,sv=`${Br}.13`,ov=`${Br}.14`,SE="1.3.101.110",CE="1.3.101.111",kE="1.3.101.112",TE="1.3.101.113",Ae=Object.freeze({__proto__:null,converters:EE,get ObjectIdentifier(){return Xf},AlgorithmIdentifier:ci,PrivateKeyInfo:Gi,PublicKeyInfo:ec,RsaPrivateKey:Dr,RsaPublicKey:tc,EcPrivateKey:Js,get EcPublicKey(){return rc},EcDsaSignature:Ys,OneAsymmetricKey:qf,get EdPrivateKey(){return Gl},get EdPublicKey(){return Jl},get CurvePrivateKey(){return Wl},idSecp256r1:qy,idEllipticCurve:Yl,idSecp384r1:zy,idSecp521r1:jy,idSecp256k1:Vy,idVersionOne:Br,idBrainpoolP160r1:Gy,idBrainpoolP160t1:Jy,idBrainpoolP192r1:Wy,idBrainpoolP192t1:Yy,idBrainpoolP224r1:Xy,idBrainpoolP224t1:Zy,idBrainpoolP256r1:Qy,idBrainpoolP256t1:ev,idBrainpoolP320r1:tv,idBrainpoolP320t1:rv,idBrainpoolP384r1:nv,idBrainpoolP384t1:iv,idBrainpoolP512r1:sv,idBrainpoolP512t1:ov,idX25519:SE,idX448:CE,idEd25519:kE,idEd448:TE}),st=class{constructor(){}static register(e){let t=new Xf;t.value=e.id;let n=Lo.serialize(t);this.items.push(me(ne({},e),{raw:n})),this.names.push(e.name)}static find(e){e=e.toUpperCase();for(let t of this.items)if(t.name.toUpperCase()===e||t.id.toUpperCase()===e)return t;return null}static get(e){let t=this.find(e);if(!t)throw new Error(`Unsupported EC named curve '${e}'`);return t}};o(st,"EcCurves");st.items=[];st.names=[];st.register({name:"P-256",id:qy,size:256});st.register({name:"P-384",id:zy,size:384});st.register({name:"P-521",id:jy,size:521});st.register({name:"K-256",id:Vy,size:256});st.register({name:"brainpoolP160r1",id:Gy,size:160});st.register({name:"brainpoolP160t1",id:Jy,size:160});st.register({name:"brainpoolP192r1",id:Wy,size:192});st.register({name:"brainpoolP192t1",id:Yy,size:192});st.register({name:"brainpoolP224r1",id:Xy,size:224});st.register({name:"brainpoolP224t1",id:Zy,size:224});st.register({name:"brainpoolP256r1",id:Qy,size:256});st.register({name:"brainpoolP256t1",id:ev,size:256});st.register({name:"brainpoolP320r1",id:tv,size:320});st.register({name:"brainpoolP320t1",id:rv,size:320});st.register({name:"brainpoolP384r1",id:nv,size:384});st.register({name:"brainpoolP384t1",id:iv,size:384});st.register({name:"brainpoolP512r1",id:sv,size:512});st.register({name:"brainpoolP512t1",id:ov,size:512});var zf=class extends zt{constructor(){super(...arguments),this.name="HMAC",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["sign","verify"]}getDefaultLength(e){switch(e.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":return 512;default:throw new Error(`Unknown algorithm name '${e}'`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),"length"in e){if(typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new RangeError("length: Number is out of range")}}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o(zf,"HmacProvider");var jf=class extends zt{constructor(){super(...arguments),this.name="PBKDF2",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveBits","deriveKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!(e.salt instanceof ArrayBuffer||ArrayBuffer.isView(e.salt)))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"iterations"),typeof e.iterations!="number")throw new TypeError("iterations: Is not a Number");if(e.iterations<1)throw new TypeError("iterations: Is less than 1")}checkImportKey(e,t,n,i,s,...a){if(super.checkImportKey(e,t,n,i,s),i)throw new SyntaxError("extractable: Must be 'false'")}};o(jf,"Pbkdf2Provider");var Vf=class extends zt{constructor(){super(...arguments),this.name="HKDF",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveKey","deriveBits"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!$e.BufferSourceConverter.isBufferSource(e.salt))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"info"),!$e.BufferSourceConverter.isBufferSource(e.info))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'")}checkImportKey(e,t,n,i,s,...a){if(super.checkImportKey(e,t,n,i,s),i)throw new SyntaxError("extractable: Must be 'false'")}};o(Vf,"HkdfProvider");var Gf=class extends zt{constructor(){super(...arguments),this.usages=[],this.defaultLength=0}digest(...e){return e[0]=ne({length:this.defaultLength},e[0]),super.digest.apply(this,e)}checkDigest(e,t){super.checkDigest(e,t);let n=e.length||0;if(typeof n!="number")throw new TypeError("length: Is not a Number");if(n<0)throw new TypeError("length: Is negative")}};o(Gf,"ShakeProvider");var Jf=class extends Gf{constructor(){super(...arguments),this.name="shake128",this.defaultLength=16}};o(Jf,"Shake128Provider");var Wf=class extends Gf{constructor(){super(...arguments),this.name="shake256",this.defaultLength=32}};o(Wf,"Shake256Provider");var Yf=class{get[Symbol.toStringTag](){return"Crypto"}randomUUID(){let e=this.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=$e.Convert.ToHex(e).toLowerCase();return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16)}`}};o(Yf,"Crypto");var Vl=class{constructor(){this.items={}}get(e){return this.items[e.toLowerCase()]||null}set(e){this.items[e.name.toLowerCase()]=e}removeAt(e){let t=this.get(e.toLowerCase());return t&&delete this.items[e],t}has(e){return!!this.get(e)}get length(){return Object.keys(this.items).length}get algorithms(){let e=[];for(let t in this.items){let n=this.items[t];e.push(n.name)}return e.sort()}};o(Vl,"ProviderStorage");var Fo=class{constructor(){this.providers=new Vl}static isHashedAlgorithm(e){return!!(e&&typeof e=="object"&&"name"in e&&"hash"in e)}get[Symbol.toStringTag](){return"SubtleCrypto"}digest(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"digest");let[t,n,...i]=e,s=this.prepareAlgorithm(t),a=$e.BufferSourceConverter.toArrayBuffer(n);return yield this.getProvider(s.name).digest(s,a,...i)})}generateKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"generateKey");let[t,n,i,...s]=e,a=this.prepareAlgorithm(t),c=this.getProvider(a.name);return yield c.generateKey(me(ne({},a),{name:c.name}),n,i,...s)})}sign(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"sign");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.sign(me(ne({},a),{name:f.name}),n,c,...s)})}verify(...e){return M(this,null,function*(){this.checkRequiredArguments(e,4,"verify");let[t,n,i,s,...a]=e;this.checkCryptoKey(n);let c=this.prepareAlgorithm(t),f=$e.BufferSourceConverter.toArrayBuffer(s),l=$e.BufferSourceConverter.toArrayBuffer(i),h=this.getProvider(c.name);return yield h.verify(me(ne({},c),{name:h.name}),n,l,f,...a)})}encrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"encrypt");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.encrypt(me(ne({},a),{name:f.name}),n,c,{keyUsage:!0},...s)})}decrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"decrypt");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.decrypt(me(ne({},a),{name:f.name}),n,c,{keyUsage:!0},...s)})}deriveBits(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"deriveBits");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=this.getProvider(a.name);return yield c.deriveBits(me(ne({},a),{name:c.name}),n,i,{keyUsage:!0},...s)})}deriveKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"deriveKey");let[t,n,i,s,a,...c]=e,f=this.prepareAlgorithm(i);this.getProvider(f.name).checkDerivedKeyParams(f);let h=this.prepareAlgorithm(t),d=this.getProvider(h.name);d.checkCryptoKey(n,"deriveKey");let v=yield d.deriveBits(me(ne({},h),{name:d.name}),n,i.length||512,{keyUsage:!1},...c);return this.importKey("raw",v,i,s,a,...c)})}exportKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"exportKey");let[t,n,...i]=e;return this.checkCryptoKey(n),yield this.getProvider(n.algorithm.name).exportKey(t,n,...i)})}importKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"importKey");let[t,n,i,s,a,...c]=e,f=this.prepareAlgorithm(i),l=this.getProvider(f.name);if(["pkcs8","spki","raw"].indexOf(t)!==-1){let h=$e.BufferSourceConverter.toArrayBuffer(n);return l.importKey(t,h,me(ne({},f),{name:l.name}),s,a,...c)}else if(!n.kty)throw new TypeError("keyData: Is not JSON");return l.importKey(t,n,me(ne({},f),{name:l.name}),s,a,...c)})}wrapKey(e,t,n,i,...s){return M(this,null,function*(){let a=yield this.exportKey(e,t,...s);if(e==="jwk"){let h=JSON.stringify(a);a=$e.Convert.FromUtf8String(h)}let c=this.prepareAlgorithm(i),f=$e.BufferSourceConverter.toArrayBuffer(a),l=this.getProvider(c.name);return l.encrypt(me(ne({},c),{name:l.name}),n,f,{keyUsage:!1},...s)})}unwrapKey(e,t,n,i,s,a,c,...f){return M(this,null,function*(){let l=this.prepareAlgorithm(i),h=$e.BufferSourceConverter.toArrayBuffer(t),d=this.getProvider(l.name),v=yield d.decrypt(me(ne({},l),{name:d.name}),n,h,{keyUsage:!1},...f);if(e==="jwk")try{v=JSON.parse($e.Convert.ToUtf8String(v))}catch(x){let y=new TypeError("wrappedKey: Is not a JSON");throw y.internal=x,y}return this.importKey(e,v,s,a,c,...f)})}checkRequiredArguments(e,t,n){if(e.length<t)throw new TypeError(`Failed to execute '${n}' on 'SubtleCrypto': ${t} arguments required, but only ${e.length} present`)}prepareAlgorithm(e){if(typeof e=="string")return{name:e};if(Fo.isHashedAlgorithm(e)){let t=ne({},e);return t.hash=this.prepareAlgorithm(e.hash),t}return ne({},e)}getProvider(e){let t=this.providers.get(e);if(!t)throw new Gs("Unrecognized name");return t}checkCryptoKey(e){if(!(e instanceof Vi))throw new TypeError("Key is not of type 'CryptoKey'")}};o(Fo,"SubtleCrypto");var hi=ze(require("crypto")),Be=ze(require("crypto")),uv=ze(require("process"));var yn=ze(Ms());var E0={fromJSON:r=>Buffer.from(yn.Convert.FromBase64Url(r)),toJSON:r=>yn.Convert.ToBase64Url(r)},vn=class extends Vi{constructor(){super(...arguments),this.data=Buffer.alloc(0),this.algorithm={name:""},this.extractable=!1,this.type="secret",this.usages=[],this.kty="oct",this.alg=""}};o(vn,"CryptoKey");Re([qt({name:"ext",type:Lt.Boolean,optional:!0})],vn.prototype,"extractable",void 0);Re([qt({name:"key_ops",type:Lt.String,repeated:!0,optional:!0})],vn.prototype,"usages",void 0);Re([qt({type:Lt.String})],vn.prototype,"kty",void 0);Re([qt({type:Lt.String,optional:!0})],vn.prototype,"alg",void 0);var Zf=class extends vn{constructor(){super(...arguments),this.kty="oct",this.type="secret"}};o(Zf,"SymmetricKey");var Ji=class extends vn{};o(Ji,"AsymmetricKey");var Ir=class extends Zf{get alg(){switch(this.algorithm.name.toUpperCase()){case"AES-CBC":return`A${this.algorithm.length}CBC`;case"AES-CTR":return`A${this.algorithm.length}CTR`;case"AES-GCM":return`A${this.algorithm.length}GCM`;case"AES-KW":return`A${this.algorithm.length}KW`;case"AES-CMAC":return`A${this.algorithm.length}CMAC`;case"AES-ECB":return`A${this.algorithm.length}ECB`;default:throw new Gs("Unsupported algorithm name")}}set alg(e){}};o(Ir,"AesCryptoKey");Re([qt({name:"k",converter:E0})],Ir.prototype,"data",void 0);var lv=new WeakMap;function xe(r){let e=lv.get(r);if(!e)throw new Oe("Cannot get CryptoKey from secure storage");return e}o(xe,"getCryptoKey");function Le(r){let e=Vi.create(r.algorithm,r.type,r.extractable,r.usages);return Object.freeze(e),lv.set(e,r),e}o(Le,"setCryptoKey");var Ze=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Ir;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){if(!(t instanceof Ir))throw new Error("key: Is not AesCryptoKey");switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:Ir});break;case"raw":a=new Ir,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}switch(a.algorithm=n,a.algorithm.length=a.data.length<<3,a.extractable=i,a.usages=s,a.algorithm.length){case 128:case 192:case 256:break;default:throw new Oe("keyData: Is wrong key length")}return a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"AES-CBC":return this.encryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.encryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.encryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.encryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.encryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof Ir))throw new Error("key: Is not AesCryptoKey");switch(e.name.toUpperCase()){case"AES-CBC":return this.decryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.decryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.decryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.decryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.decryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ctr`,t.data,Buffer.from(e.counter)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ctr`,t.data,new Uint8Array(e.counter)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-gcm`,t.data,Buffer.from(e.iv),{authTagLength:(e.tagLength||128)>>3});e.additionalData&&i.setAAD(Buffer.from(e.additionalData));let s=i.update(n);return s=Buffer.concat([s,i.final(),i.getAuthTag()]),new Uint8Array(s).buffer})}static decryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-gcm`,t.data,new Uint8Array(e.iv)),s=(e.tagLength||128)>>3,a=n.slice(0,n.length-s),c=n.slice(n.length-s);e.additionalData&&i.setAAD(Buffer.from(e.additionalData)),i.setAuthTag(c);let f=i.update(a);return f=Buffer.concat([f,i.final()]),new Uint8Array(f).buffer})}static encryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}};o(Ze,"AesCrypto");Ze.AES_KW_IV=Buffer.from("A6A6A6A6A6A6A6A6","hex");var Xl=class extends If{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(Xl,"AesCbcProvider");var S0=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),av=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135]),Ho=16;function cv(r){let e=Buffer.alloc(r.length),t=r.length-1;for(let n=0;n<t;n++)e[n]=r[n]<<1,r[n+1]&128&&(e[n]+=1);return e[t]=r[t]<<1,e}o(cv,"bitShiftLeft");function nc(r,e){let t=Math.min(r.length,e.length),n=Buffer.alloc(t);for(let i=0;i<t;i++)n[i]=r[i]^e[i];return n}o(nc,"xor");function A0(r,e){let t=hi.createCipheriv(`aes${r.length<<3}`,r,S0),n=t.update(e);return t.final(),n}o(A0,"aes");function fv(r,e){let t=Buffer.alloc(Ho),n=e*Ho,i=n+Ho;return r.copy(t,0,n,i),t}o(fv,"getMessageBlock");function BE(r,e){let t=Buffer.alloc(Ho),n=e*Ho,i=r.length;return t.fill(0),r.copy(t,0,n,i),t[i-n]=128,t}o(BE,"getPaddedMessageBlock");function IE(r){let e=A0(r,S0),t=cv(e);e[0]&128&&(t=nc(t,av));let n=cv(t);return t[0]&128&&(n=nc(n,av)),{subkey1:t,subkey2:n}}o(IE,"generateSubkeys");function NE(r,e){let t=IE(r),n=Math.ceil(e.length/Ho),i,s;n===0?(n=1,i=!1):i=e.length%Ho===0;let a=n-1;i?s=nc(fv(e,a),t.subkey1):s=nc(BE(e,a),t.subkey2);let c=S0,f;for(let l=0;l<a;l++)f=nc(c,fv(e,l)),c=A0(r,f);return f=nc(s,c),A0(r,f)}o(NE,"aesCmac");var Zl=class extends Nf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onSign(e,t,n){return M(this,null,function*(){let i=NE(xe(t).data,Buffer.from(n));return new Uint8Array(i).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let s=yield this.sign(e,t,i);return Buffer.from(n).compare(Buffer.from(s))===0})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(Zl,"AesCmacProvider");var Ql=class extends Of{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(Ql,"AesCtrProvider");var eh=class extends Rf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(eh,"AesGcmProvider");var th=class extends Uf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(th,"AesKwProvider");var rh=class extends Pf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Ir))throw new TypeError("key: Is not a AesCryptoKey")}};o(rh,"AesEcbProvider");var li=class extends Zf{get alg(){switch(this.algorithm.name.toUpperCase()){case"DES-CBC":return"DES-CBC";case"DES-EDE3-CBC":return"3DES-CBC";default:throw new Gs("Unsupported algorithm name")}}set alg(e){}};o(li,"DesCryptoKey");Re([qt({name:"k",converter:E0})],li.prototype,"data",void 0);var en=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new li;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:li});break;case"raw":a=new li,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm=n,a.extractable=i,a.usages=s,a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"DES-CBC":return this.encryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.encryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof li))throw new Error("key: Is not DesCryptoKey");switch(e.name.toUpperCase()){case"DES-CBC":return this.decryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.decryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-ede3-cbc",t.data,Buffer.from(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-ede3-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}};o(en,"DesCrypto");var nh=class extends Ya{constructor(){super(...arguments),this.keySizeBits=64,this.ivSize=8,this.name="DES-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield en.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return en.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return en.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return en.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield en.importKey(e,t,{name:this.name,length:this.keySizeBits},i,s);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof li))throw new TypeError("key: Is not a DesCryptoKey")}};o(nh,"DesCbcProvider");var ih=class extends Ya{constructor(){super(...arguments),this.keySizeBits=192,this.ivSize=8,this.name="DES-EDE3-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield en.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return en.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return en.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return en.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield en.importKey(e,t,{name:this.name,length:this.keySizeBits},i,s);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof li))throw new TypeError("key: Is not a DesCryptoKey")}};o(ih,"DesEde3CbcProvider");function hv(r){switch(r.name.toUpperCase()){case"RSA-OAEP":{let e=/(\d+)$/.exec(r.hash.name)[1];return`RSA-OAEP${e!=="1"?`-${e}`:""}`}case"RSASSA-PKCS1-V1_5":return`RS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PSS":return`PS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PKCS1":return"RS1";default:throw new Oe("algorithm: Is not recognized")}}o(hv,"getJwkAlgorithm");var Wi=class extends Ji{constructor(){super(...arguments),this.type="private"}getKey(){let e=We.parse(this.data,Ae.PrivateKeyInfo);return We.parse(e.privateKey,Ae.RsaPrivateKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:hv(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){let t=Vt.fromJSON(e,{targetSchema:Ae.RsaPrivateKey}),n=new Ae.PrivateKeyInfo;n.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.privateKeyAlgorithm.parameters=null,n.privateKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};o(Wi,"RsaPrivateKey");var Yi=class extends Ji{constructor(){super(...arguments),this.type="public"}getKey(){let e=We.parse(this.data,Ae.PublicKeyInfo);return We.parse(e.publicKey,Ae.RsaPublicKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:hv(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){let t=Vt.fromJSON(e,{targetSchema:Ae.RsaPublicKey}),n=new Ae.PublicKeyInfo;n.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.publicKeyAlgorithm.parameters=null,n.publicKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};o(Yi,"RsaPublicKey");var Dt=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Wi;i.algorithm=e,i.extractable=t,i.usages=n.filter(l=>this.privateKeyUsages.indexOf(l)!==-1);let s=new Yi;s.algorithm=e,s.extractable=!0,s.usages=n.filter(l=>this.publicKeyUsages.indexOf(l)!==-1);let a=Buffer.concat([Buffer.alloc(4-e.publicExponent.byteLength,0),Buffer.from(e.publicExponent)]).readInt32BE(0),c=Be.default.generateKeyPairSync("rsa",{modulusLength:e.modulusLength,publicExponent:a,publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=c.privateKey,s.data=c.publicKey,{privateKey:i,publicKey:s}})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":if(t.d){let c=Vt.fromJSON(t,{targetSchema:Ae.RsaPrivateKey});return this.importPrivateKey(c,n,i,s)}else{let c=Vt.fromJSON(t,{targetSchema:Ae.RsaPublicKey});return this.importPublicKey(c,n,i,s)}case"spki":{let a=We.parse(new Uint8Array(t),Ae.PublicKeyInfo),c=We.parse(a.publicKey,Ae.RsaPublicKey);return this.importPublicKey(c,n,i,s)}case"pkcs8":{let a=We.parse(new Uint8Array(t),Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.RsaPrivateKey);return this.importPrivateKey(c,n,i,s)}default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static sign(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.signRsa(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static verify(e,t,n,i){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.verifySSA(e,t,i,n);default:throw new Oe("algorithm: Is not recognized")}})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.encryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.decryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static importPrivateKey(e,t,n,i){let s=new Ae.PrivateKeyInfo;s.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",s.privateKeyAlgorithm.parameters=null,s.privateKey=Ye.serialize(e);let a=new Wi;return a.data=Buffer.from(Ye.serialize(s)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static importPublicKey(e,t,n,i){let s=new Ae.PublicKeyInfo;s.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",s.publicKeyAlgorithm.parameters=null,s.publicKey=Ye.serialize(e);let a=new Yi;return a.data=Buffer.from(Ye.serialize(s)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static getCryptoAlgorithm(e){switch(e.hash.name.toUpperCase()){case"SHA-1":return"RSA-SHA1";case"SHA-256":return"RSA-SHA256";case"SHA-384":return"RSA-SHA384";case"SHA-512":return"RSA-SHA512";case"SHA3-256":return"RSA-SHA3-256";case"SHA3-384":return"RSA-SHA3-384";case"SHA3-512":return"RSA-SHA3-512";default:throw new Oe("algorithm.hash: Is not recognized")}}static signRsa(e,t,n){let i=this.getCryptoAlgorithm(t.algorithm),s=Be.default.createSign(i);s.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
638
|
+
${t.data.toString("base64")}
|
639
|
+
-----END PRIVATE KEY-----`);let a={key:t.pem};e.name.toUpperCase()==="RSA-PSS"&&(a.padding=Be.default.constants.RSA_PKCS1_PSS_PADDING,a.saltLength=e.saltLength);let c=s.sign(a);return new Uint8Array(c).buffer}static verifySSA(e,t,n,i){let s=this.getCryptoAlgorithm(t.algorithm),a=Be.default.createVerify(s);a.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
640
|
+
${t.data.toString("base64")}
|
641
|
+
-----END PUBLIC KEY-----`);let c={key:t.pem};return e.name.toUpperCase()==="RSA-PSS"&&(c.padding=Be.default.constants.RSA_PKCS1_PSS_PADDING,c.saltLength=e.saltLength),a.verify(c,i)}static encryptOAEP(e,t,n){let i={key:`-----BEGIN PUBLIC KEY-----
|
642
|
+
${t.data.toString("base64")}
|
643
|
+
-----END PUBLIC KEY-----`,padding:Be.default.constants.RSA_PKCS1_OAEP_PADDING};return e.label,new Uint8Array(Be.default.publicEncrypt(i,n)).buffer}static decryptOAEP(e,t,n){let i={key:`-----BEGIN PRIVATE KEY-----
|
644
|
+
${t.data.toString("base64")}
|
645
|
+
-----END PRIVATE KEY-----`,padding:Be.default.constants.RSA_PKCS1_OAEP_PADDING};return e.label,new Uint8Array(Be.default.privateDecrypt(i,n)).buffer}};o(Dt,"RsaCrypto");Dt.publicKeyUsages=["verify","encrypt","wrapKey"];Dt.privateKeyUsages=["sign","decrypt","unwrapKey"];var sh=class extends Lf{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Dt.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return Dt.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return Dt.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return Dt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Dt.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Wi||n instanceof Yi))throw new TypeError("key: Is not RSA CryptoKey")}};o(sh,"RsaSsaProvider");var oh=class extends Df{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Dt.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return Dt.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return Dt.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return Dt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Dt.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Wi||n instanceof Yi))throw new TypeError("key: Is not RSA CryptoKey")}};o(oh,"RsaPssProvider");var ar=class{static size(e){switch(e.name.toUpperCase()){case"SHA-1":return 160;case"SHA-256":case"SHA3-256":return 256;case"SHA-384":case"SHA3-384":return 384;case"SHA-512":case"SHA3-512":return 512;default:throw new Error("Unrecognized name")}}static getAlgorithmName(e){switch(e.name.toUpperCase()){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512";case"SHA3-256":return"sha3-256";case"SHA3-384":return"sha3-384";case"SHA3-512":return"sha3-512";default:throw new Error("Unrecognized name")}}static digest(e,t){let n=this.getAlgorithmName(e),i=Be.default.createHash(n).update(Buffer.from(t)).digest();return new Uint8Array(i).buffer}};o(ar,"ShaCrypto");var ah=class extends Kf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Dt.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onEncrypt(e,t,n){return M(this,null,function*(){let i=xe(t),s=new Uint8Array(n),a=Math.ceil(i.algorithm.modulusLength>>3),c=ar.size(i.algorithm.hash)>>3,f=s.byteLength,l=a-f-2*c-2;if(f>a-2*c-2)throw new Error("Data too large");let h=new Uint8Array(a),d=h.subarray(1,c+1),v=h.subarray(c+1);v.set(s,c+l+1);let x=Be.default.createHash(i.algorithm.hash.name.replace("-","")).update(ui.BufferSourceConverter.toUint8Array(e.label||new Uint8Array(0))).digest();v.set(x,0),v[c+l]=1,Be.default.randomFillSync(d);let y=this.mgf1(i.algorithm.hash,d,v.length);for(let E=0;E<v.length;E++)v[E]^=y[E];let _=this.mgf1(i.algorithm.hash,v,d.length);for(let E=0;E<d.length;E++)d[E]^=_[E];i.pem||(i.pem=`-----BEGIN PUBLIC KEY-----
|
646
|
+
${i.data.toString("base64")}
|
647
|
+
-----END PUBLIC KEY-----`);let U=Be.default.publicEncrypt({key:i.pem,padding:Be.default.constants.RSA_NO_PADDING},Buffer.from(h));return new Uint8Array(U).buffer})}onDecrypt(e,t,n){return M(this,null,function*(){let i=xe(t),s=Math.ceil(i.algorithm.modulusLength>>3),a=ar.size(i.algorithm.hash)>>3;if(n.byteLength!==s)throw new Error("Bad data");i.pem||(i.pem=`-----BEGIN PRIVATE KEY-----
|
648
|
+
${i.data.toString("base64")}
|
649
|
+
-----END PRIVATE KEY-----`);let f=Be.default.privateDecrypt({key:i.pem,padding:Be.default.constants.RSA_NO_PADDING},Buffer.from(n)),l=f[0],h=f.subarray(1,a+1),d=f.subarray(a+1);if(l!==0)throw new Error("Decryption failed");let v=this.mgf1(i.algorithm.hash,d,h.length);for(let U=0;U<h.length;U++)h[U]^=v[U];let x=this.mgf1(i.algorithm.hash,h,d.length);for(let U=0;U<d.length;U++)d[U]^=x[U];let y=Be.default.createHash(i.algorithm.hash.name.replace("-","")).update(ui.BufferSourceConverter.toUint8Array(e.label||new Uint8Array(0))).digest();for(let U=0;U<a;U++)if(y[U]!==d[U])throw new Error("Decryption failed");let _=a;for(;_<d.length;_++){let U=d[_];if(U===1)break;if(U!==0)throw new Error("Decryption failed")}if(_===d.length)throw new Error("Decryption failed");return f=d.subarray(_+1),new Uint8Array(f).buffer})}onExportKey(e,t){return M(this,null,function*(){return Dt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Dt.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Wi||n instanceof Yi))throw new TypeError("key: Is not RSA CryptoKey")}mgf1(e,t,n=0){let i=ar.size(e)>>3,s=new Uint8Array(n),a=new Uint8Array(4),c=Math.ceil(n/i);for(let f=0;f<c;f++){a[0]=f>>>24,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f&255;let l=s.subarray(f*i),h=Be.default.createHash(e.name.replace("-","")).update(t).update(a).digest();h.length>l.length&&(h=h.subarray(0,l.length)),l.set(h)}return s}};o(ah,"RsaOaepProvider");var ch=class extends zt{constructor(){super(...arguments),this.name="RSAES-PKCS1-v1_5",this.usages={publicKey:["encrypt","wrapKey"],privateKey:["decrypt","unwrapKey"]}}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Dt.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"publicExponent"),!(e.publicExponent&&e.publicExponent instanceof Uint8Array))throw new TypeError("publicExponent: Missing or not a Uint8Array");let t=yn.Convert.ToBase64(e.publicExponent);if(!(t==="Aw=="||t==="AQAB"))throw new TypeError("publicExponent: Must be [3] or [1,0,1]");switch(this.checkRequiredProperty(e,"modulusLength"),e.modulusLength){case 1024:case 2048:case 4096:break;default:throw new TypeError("modulusLength: Must be 1024, 2048, or 4096")}}onEncrypt(e,t,n){return M(this,null,function*(){let i=this.toCryptoOptions(t),s=hi.publicEncrypt(i,new Uint8Array(n));return new Uint8Array(s).buffer})}onDecrypt(e,t,n){return M(this,null,function*(){let i=this.toCryptoOptions(t),s=hi.privateDecrypt(i,new Uint8Array(n));return new Uint8Array(s).buffer})}onExportKey(e,t){return M(this,null,function*(){return Dt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Dt.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Wi||n instanceof Yi))throw new TypeError("key: Is not RSA CryptoKey")}toCryptoOptions(e){let t=e.type.toUpperCase();return{key:`-----BEGIN ${t} KEY-----
|
650
|
+
${xe(e).data.toString("base64")}
|
651
|
+
-----END ${t} KEY-----`,padding:hi.constants.RSA_PKCS1_PADDING}}};o(ch,"RsaEsProvider");var OE={"1.2.840.10045.3.1.7":"P-256","P-256":"1.2.840.10045.3.1.7","1.3.132.0.34":"P-384","P-384":"1.3.132.0.34","1.3.132.0.35":"P-521","P-521":"1.3.132.0.35","1.3.132.0.10":"K-256","K-256":"1.3.132.0.10",brainpoolP160r1:"1.3.36.3.3.2.8.1.1.1","1.3.36.3.3.2.8.1.1.1":"brainpoolP160r1",brainpoolP160t1:"1.3.36.3.3.2.8.1.1.2","1.3.36.3.3.2.8.1.1.2":"brainpoolP160t1",brainpoolP192r1:"1.3.36.3.3.2.8.1.1.3","1.3.36.3.3.2.8.1.1.3":"brainpoolP192r1",brainpoolP192t1:"1.3.36.3.3.2.8.1.1.4","1.3.36.3.3.2.8.1.1.4":"brainpoolP192t1",brainpoolP224r1:"1.3.36.3.3.2.8.1.1.5","1.3.36.3.3.2.8.1.1.5":"brainpoolP224r1",brainpoolP224t1:"1.3.36.3.3.2.8.1.1.6","1.3.36.3.3.2.8.1.1.6":"brainpoolP224t1",brainpoolP256r1:"1.3.36.3.3.2.8.1.1.7","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1",brainpoolP256t1:"1.3.36.3.3.2.8.1.1.8","1.3.36.3.3.2.8.1.1.8":"brainpoolP256t1",brainpoolP320r1:"1.3.36.3.3.2.8.1.1.9","1.3.36.3.3.2.8.1.1.9":"brainpoolP320r1",brainpoolP320t1:"1.3.36.3.3.2.8.1.1.10","1.3.36.3.3.2.8.1.1.10":"brainpoolP320t1",brainpoolP384r1:"1.3.36.3.3.2.8.1.1.11","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1",brainpoolP384t1:"1.3.36.3.3.2.8.1.1.12","1.3.36.3.3.2.8.1.1.12":"brainpoolP384t1",brainpoolP512r1:"1.3.36.3.3.2.8.1.1.13","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1",brainpoolP512t1:"1.3.36.3.3.2.8.1.1.14","1.3.36.3.3.2.8.1.1.14":"brainpoolP512t1"};function Qf(r){let e=OE[r];if(!e)throw new Oe(`Cannot convert WebCrypto named curve '${r}' to OID`);return e}o(Qf,"getOidByNamedCurve$1");var qo=class extends Ji{constructor(){super(...arguments),this.type="private"}getKey(){let e=We.parse(this.data,Ae.PrivateKeyInfo);return We.parse(e.privateKey,Ae.EcPrivateKey)}toJSON(){let e=this.getKey(),t={kty:"EC",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=new Ae.PrivateKeyInfo;t.privateKeyAlgorithm.algorithm="1.2.840.10045.2.1",t.privateKeyAlgorithm.parameters=Ye.serialize(new Ae.ObjectIdentifier(Qf(e.crv)));let n=Vt.fromJSON(e,{targetSchema:Ae.EcPrivateKey});return t.privateKey=Ye.serialize(n),this.data=Buffer.from(Ye.serialize(t)),this}};o(qo,"EcPrivateKey");var zo=class extends Ji{constructor(){super(...arguments),this.type="public"}getKey(){let e=We.parse(this.data,Ae.PublicKeyInfo);return new Ae.EcPublicKey(e.publicKey)}toJSON(){let e=this.getKey(),t={kty:"EC",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=Vt.fromJSON(e,{targetSchema:Ae.EcPublicKey}),n=new Ae.PublicKeyInfo;return n.publicKeyAlgorithm.algorithm="1.2.840.10045.2.1",n.publicKeyAlgorithm.parameters=Ye.serialize(new Ae.ObjectIdentifier(Qf(e.crv))),n.publicKey=Ye.toASN(t).valueHex,this.data=Buffer.from(Ye.serialize(n)),this}};o(zo,"EcPublicKey");var fh=class extends zt{constructor(){super(...arguments),this.name="SHA-1",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(fh,"Sha1Provider");var uh=class extends zt{constructor(){super(...arguments),this.name="SHA-256",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(uh,"Sha256Provider");var lh=class extends zt{constructor(){super(...arguments),this.name="SHA-384",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(lh,"Sha384Provider");var hh=class extends zt{constructor(){super(...arguments),this.name="SHA-512",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(hh,"Sha512Provider");var dh=class extends zt{constructor(){super(...arguments),this.name="SHA3-256",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(dh,"Sha3256Provider");var ph=class extends zt{constructor(){super(...arguments),this.name="SHA3-384",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(ph,"Sha3384Provider");var mh=class extends zt{constructor(){super(...arguments),this.name="SHA3-512",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return ar.digest(e,t)})}};o(mh,"Sha3512Provider");var Kr=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new qo;i.algorithm=e,i.extractable=t,i.usages=n.filter(f=>this.privateKeyUsages.indexOf(f)!==-1);let s=new zo;s.algorithm=e,s.extractable=!0,s.usages=n.filter(f=>this.publicKeyUsages.indexOf(f)!==-1);let a=Be.default.generateKeyPairSync("ec",{namedCurve:this.getOpenSSLNamedCurve(e.namedCurve),publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=a.privateKey,s.data=a.publicKey,{privateKey:i,publicKey:s}})}static sign(e,t,n){return M(this,null,function*(){let i=ar.getAlgorithmName(e.hash),s=Be.default.createSign(i);s.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
652
|
+
${t.data.toString("base64")}
|
653
|
+
-----END PRIVATE KEY-----`);let a={key:t.pem},c=s.sign(a),f=We.parse(c,Ae.EcDsaSignature);return Ws.encodeSignature(f,st.get(t.algorithm.namedCurve).size).buffer})}static verify(e,t,n,i){return M(this,null,function*(){let s=ar.getAlgorithmName(e.hash),a=Be.default.createVerify(s);a.update(Buffer.from(i)),t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
654
|
+
${t.data.toString("base64")}
|
655
|
+
-----END PUBLIC KEY-----`);let c={key:t.pem},f=new Ae.EcDsaSignature,l=st.get(t.algorithm.namedCurve),h=Ws.decodeSignature(n,l.size);f.r=yn.BufferSourceConverter.toArrayBuffer(h.r),f.s=yn.BufferSourceConverter.toArrayBuffer(h.s);let d=Buffer.from(Ye.serialize(f));return a.verify(c,d)})}static deriveBits(e,t,n){return M(this,null,function*(){let i=this.getOpenSSLNamedCurve(t.algorithm.namedCurve),s=Be.default.createECDH(i),a=We.parse(t.data,Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.EcPrivateKey);s.setPrivateKey(Buffer.from(c.privateKey));let f=We.parse(e.public.data,Ae.PublicKeyInfo),l=s.computeSecret(Buffer.from(f.publicKey));return new Uint8Array(l).buffer.slice(0,n>>3)})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;case"raw":return We.parse(t.data,Ae.PublicKeyInfo).publicKey;default:throw new Oe("format: Must be 'jwk', 'raw', pkcs8' or 'spki'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":if(t.d){let c=Vt.fromJSON(t,{targetSchema:Ae.EcPrivateKey});return this.importPrivateKey(c,n,i,s)}else{let c=Vt.fromJSON(t,{targetSchema:Ae.EcPublicKey});return this.importPublicKey(c,n,i,s)}case"raw":{let a=new Ae.EcPublicKey(t);return this.importPublicKey(a,n,i,s)}case"spki":{let a=We.parse(new Uint8Array(t),Ae.PublicKeyInfo),c=new Ae.EcPublicKey(a.publicKey);return this.assertKeyParameters(a.publicKeyAlgorithm.parameters,n.namedCurve),this.importPublicKey(c,n,i,s)}case"pkcs8":{let a=We.parse(new Uint8Array(t),Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.EcPrivateKey);return this.assertKeyParameters(a.privateKeyAlgorithm.parameters,n.namedCurve),this.importPrivateKey(c,n,i,s)}default:throw new Oe("format: Must be 'jwk', 'raw', 'pkcs8' or 'spki'")}})}static assertKeyParameters(e,t){if(!e)throw new Lr("Key info doesn't have required parameters");let n="";try{n=We.parse(e,Ae.ObjectIdentifier).value}catch(i){throw new Lr("Cannot read key info parameters")}if(Qf(t)!==n)throw new Lr("Key info parameter doesn't match to named curve")}static importPrivateKey(e,t,n,i){return M(this,null,function*(){let s=new Ae.PrivateKeyInfo;s.privateKeyAlgorithm.algorithm="1.2.840.10045.2.1",s.privateKeyAlgorithm.parameters=Ye.serialize(new Ae.ObjectIdentifier(Qf(t.namedCurve))),s.privateKey=Ye.serialize(e);let a=new qo;return a.data=Buffer.from(Ye.serialize(s)),a.algorithm=Object.assign({},t),a.extractable=n,a.usages=i,a})}static importPublicKey(e,t,n,i){return M(this,null,function*(){let s=new Ae.PublicKeyInfo;s.publicKeyAlgorithm.algorithm="1.2.840.10045.2.1";let a=Qf(t.namedCurve);s.publicKeyAlgorithm.parameters=Ye.serialize(new Ae.ObjectIdentifier(a)),s.publicKey=e.value;let c=new zo;return c.data=Buffer.from(Ye.serialize(s)),c.algorithm=Object.assign({},t),c.extractable=n,c.usages=i,c})}static getOpenSSLNamedCurve(e){switch(e.toUpperCase()){case"P-256":return"prime256v1";case"K-256":return"secp256k1";case"P-384":return"secp384r1";case"P-521":return"secp521r1";default:return e}}};o(Kr,"EcCrypto");Kr.publicKeyUsages=["verify"];Kr.privateKeyUsages=["sign","deriveKey","deriveBits"];var bh=class extends $f{constructor(){super(...arguments),this.namedCurves=st.names,this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kr.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return Kr.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return Kr.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return Kr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Kr.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof qo||n instanceof zo))throw new TypeError("key: Is not EC CryptoKey")}};o(bh,"EcdsaProvider");var gh=class extends Qa{constructor(){super(...arguments),this.namedCurves=st.names}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kr.generateKey(me(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onExportKey(e,t){return M(this,null,function*(){return Kr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Kr.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof qo||n instanceof zo))throw new TypeError("key: Is not EC CryptoKey")}onDeriveBits(e,t,n){return M(this,null,function*(){return yield Kr.deriveBits(me(ne({},e),{public:xe(e.public)}),xe(t),n)})}};o(gh,"EcdhProvider");var PE={[Ae.idEd448]:"Ed448",ed448:Ae.idEd448,[Ae.idX448]:"X448",x448:Ae.idX448,[Ae.idEd25519]:"Ed25519",ed25519:Ae.idEd25519,[Ae.idX25519]:"X25519",x25519:Ae.idX25519};function dv(r){let e=PE[r.toLowerCase()];if(!e)throw new Oe(`Cannot convert WebCrypto named curve '${r}' to OID`);return e}o(dv,"getOidByNamedCurve");var eu=class extends Ji{constructor(){super(...arguments),this.type="private"}getKey(){let e=We.parse(this.data,Ae.PrivateKeyInfo);return We.parse(e.privateKey,Ae.CurvePrivateKey)}toJSON(){let e=this.getKey(),t={kty:"OKP",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=new Ae.PrivateKeyInfo;t.privateKeyAlgorithm.algorithm=dv(e.crv);let n=Vt.fromJSON(e,{targetSchema:Ae.CurvePrivateKey});return t.privateKey=Ye.serialize(n),this.data=Buffer.from(Ye.serialize(t)),this}};o(eu,"EdPrivateKey");var tu=class extends Ji{constructor(){super(...arguments),this.type="public"}getKey(){return We.parse(this.data,Ae.PublicKeyInfo).publicKey}toJSON(){let e=this.getKey(),t={kty:"OKP",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,{x:yn.Convert.ToBase64Url(e)})}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");if(!e.x)throw new Oe("Cannot get property from JWK. Property 'x' is required");let t=new Ae.PublicKeyInfo;return t.publicKeyAlgorithm.algorithm=dv(e.crv),t.publicKey=yn.Convert.FromBase64Url(e.x),this.data=Buffer.from(Ye.serialize(t)),this}};o(tu,"EdPublicKey");var $r=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new eu;i.algorithm=e,i.extractable=t,i.usages=n.filter(l=>this.privateKeyUsages.indexOf(l)!==-1);let s=new tu;s.algorithm=e,s.extractable=!0,s.usages=n.filter(l=>this.publicKeyUsages.indexOf(l)!==-1);let a=e.namedCurve.toLowerCase(),c=Be.default.generateKeyPairSync(a,{publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=c.privateKey,s.data=c.publicKey,{privateKey:i,publicKey:s}})}static sign(e,t,n){return M(this,null,function*(){t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
656
|
+
${t.data.toString("base64")}
|
657
|
+
-----END PRIVATE KEY-----`);let i={key:t.pem},s=Be.default.sign(null,Buffer.from(n),i);return ui.BufferSourceConverter.toArrayBuffer(s)})}static verify(e,t,n,i){return M(this,null,function*(){t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
658
|
+
${t.data.toString("base64")}
|
659
|
+
-----END PUBLIC KEY-----`);let s={key:t.pem};return Be.default.verify(null,Buffer.from(i),s,Buffer.from(n))})}static deriveBits(e,t,n){return M(this,null,function*(){let i=Be.default.createPublicKey({key:e.public.data,format:"der",type:"spki"}),s=Be.default.createPrivateKey({key:t.data,format:"der",type:"pkcs8"}),a=Be.default.diffieHellman({publicKey:i,privateKey:s});return new Uint8Array(a).buffer.slice(0,n>>3)})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;case"raw":return We.parse(t.data,Ae.PublicKeyInfo).publicKey;default:throw new Oe("format: Must be 'jwk', 'raw', pkcs8' or 'spki'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":{let a=t;if(a.d){let c=Vt.fromJSON(t,{targetSchema:Ae.CurvePrivateKey});return this.importPrivateKey(c,n,i,s)}else{if(!a.x)throw new TypeError("keyData: Cannot get required 'x' filed");return this.importPublicKey(yn.Convert.FromBase64Url(a.x),n,i,s)}}case"raw":return this.importPublicKey(t,n,i,s);case"spki":{let a=We.parse(new Uint8Array(t),Ae.PublicKeyInfo);return this.importPublicKey(a.publicKey,n,i,s)}case"pkcs8":{let a=We.parse(new Uint8Array(t),Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.CurvePrivateKey);return this.importPrivateKey(c,n,i,s)}default:throw new Oe("format: Must be 'jwk', 'raw', 'pkcs8' or 'spki'")}})}static importPrivateKey(e,t,n,i){let s=new eu;return s.fromJSON({crv:t.namedCurve,d:yn.Convert.ToBase64Url(e.d)}),s.algorithm=Object.assign({},t),s.extractable=n,s.usages=i,s}static importPublicKey(e,t,n,i){return M(this,null,function*(){let s=new tu;return s.fromJSON({crv:t.namedCurve,x:yn.Convert.ToBase64Url(e)}),s.algorithm=Object.assign({},t),s.extractable=n,s.usages=i,s})}};o($r,"EdCrypto");$r.publicKeyUsages=["verify"];$r.privateKeyUsages=["sign","deriveKey","deriveBits"];var yh=class extends Hf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield $r.generateKey({name:this.name,namedCurve:e.namedCurve.replace(/^ed/i,"Ed")},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return $r.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return $r.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return $r.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield $r.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}};o(yh,"EdDsaProvider");var vh=class extends Ff{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield $r.generateKey({name:this.name,namedCurve:e.namedCurve.toUpperCase()},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onDeriveBits(e,t,n){return M(this,null,function*(){return yield $r.deriveBits(me(ne({},e),{public:xe(e.public)}),xe(t),n)})}onExportKey(e,t){return M(this,null,function*(){return $r.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield $r.importKey(e,t,me(ne({},n),{name:this.name}),i,s);return Le(a)})}};o(vh,"EcdhEsProvider");var ru=class extends vn{};o(ru,"PbkdfCryptoKey");var wh=class extends jf{onDeriveBits(e,t,n){return M(this,null,function*(){return new Promise((i,s)=>{let a=ui.BufferSourceConverter.toArrayBuffer(e.salt),c=e.hash.name.replace("-","");Be.default.pbkdf2(xe(t).data,Buffer.from(a),e.iterations,n>>3,c,(f,l)=>{f?s(f):i(new Uint8Array(l).buffer)})})})}onImportKey(e,t,n,i,s){return M(this,null,function*(){if(e==="raw"){let a=new ru;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=!1,a.usages=s,Le(a)}throw new Oe("format: Must be 'raw'")})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof ru))throw new TypeError("key: Is not PBKDF CryptoKey")}};o(wh,"Pbkdf2Provider");var Xs=class extends vn{get alg(){return`HS${this.algorithm.hash.name.toUpperCase().replace("SHA-","")}`}set alg(e){}};o(Xs,"HmacCryptoKey");Re([qt({name:"k",converter:E0})],Xs.prototype,"data",void 0);var xh=class extends zf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=(e.length||this.getDefaultLength(e.hash.name))>>3<<3,s=new Xs;return s.algorithm=me(ne({},e),{length:i,name:this.name}),s.extractable=t,s.usages=n,s.data=Be.default.randomBytes(i>>3),Le(s)})}onSign(e,t,n){return M(this,null,function*(){let i=ar.getAlgorithmName(t.algorithm.hash),s=Be.default.createHmac(i,xe(t).data).update(Buffer.from(n)).digest();return new Uint8Array(s).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let s=ar.getAlgorithmName(t.algorithm.hash);return Be.default.createHmac(s,xe(t).data).update(Buffer.from(i)).digest().compare(Buffer.from(n))===0})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:Xs});break;case"raw":a=new Xs,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm={hash:{name:n.hash.name},name:this.name,length:a.data.length<<3},a.extractable=i,a.usages=s,Le(a)})}onExportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(xe(t));case"raw":return new Uint8Array(xe(t).data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Xs))throw new TypeError("key: Is not HMAC CryptoKey")}};o(xh,"HmacProvider");var nu=class extends vn{};o(nu,"HkdfCryptoKey");var _h=class extends Vf{onImportKey(e,t,n,i,s){return M(this,null,function*(){if(e.toLowerCase()!=="raw")throw new Oe("Operation not supported");let a=new nu;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=i,a.usages=s,Le(a)})}onDeriveBits(e,t,n){return M(this,null,function*(){let i=e.hash.name.replace("-",""),s=Be.default.createHash(i).digest().length,a=n/8,c=ui.BufferSourceConverter.toUint8Array(e.info),f=Be.default.createHmac(i,ui.BufferSourceConverter.toUint8Array(e.salt)).update(ui.BufferSourceConverter.toUint8Array(xe(t).data)).digest(),l=[Buffer.alloc(0)],h=Math.ceil(a/s)+1;for(let d=1;d<h;++d)l.push(Be.default.createHmac(i,f).update(Buffer.concat([l[d-1],c,Buffer.from([d])])).digest());return Buffer.concat(l).slice(0,a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof nu))throw new TypeError("key: Is not HKDF CryptoKey")}};o(_h,"HkdfProvider");var iu=class{static digest(e,t){let n=Be.default.createHash(e.name.toLowerCase(),{outputLength:e.length}).update(Buffer.from(t)).digest();return new Uint8Array(n).buffer}};o(iu,"ShakeCrypto");var Ah=class extends Jf{onDigest(e,t){return M(this,null,function*(){return iu.digest(e,t)})}};o(Ah,"Shake128Provider");var Eh=class extends Wf{onDigest(e,t){return M(this,null,function*(){return iu.digest(e,t)})}};o(Eh,"Shake256Provider");var Sh=class extends Fo{constructor(){var e;super(),this.providers.set(new Xl),this.providers.set(new Ql),this.providers.set(new eh),this.providers.set(new Zl),this.providers.set(new th),this.providers.set(new rh),this.providers.set(new nh),this.providers.set(new ih),this.providers.set(new sh),this.providers.set(new oh),this.providers.set(new ah),this.providers.set(new ch),this.providers.set(new bh),this.providers.set(new gh),this.providers.set(new fh),this.providers.set(new uh),this.providers.set(new lh),this.providers.set(new hh),this.providers.set(new wh),this.providers.set(new xh),this.providers.set(new _h);let t=(e=/^v(\d+)/.exec(uv.version))===null||e===void 0?void 0:e[1];t&&parseInt(t,10)>=12&&(this.providers.set(new Ah),this.providers.set(new Eh));let n=hi.getHashes();n.includes("sha3-256")&&this.providers.set(new dh),n.includes("sha3-384")&&this.providers.set(new ph),n.includes("sha3-512")&&this.providers.set(new mh),t&&parseInt(t,10)>=14&&(this.providers.set(new yh),this.providers.set(new vh))}};o(Sh,"SubtleCrypto");var su=class extends Yf{constructor(){super(...arguments),this.subtle=new Sh}getRandomValues(e){if(!ArrayBuffer.isView(e))throw new TypeError("Failed to execute 'getRandomValues' on 'Crypto': parameter 1 is not of type 'ArrayBufferView'");let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return Be.default.randomFillSync(t),e}};o(su,"Crypto");function RE(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node!="undefined"}o(RE,"isNodejs");var C0;RE()?C0=new su:C0=window.crypto;var Ch=C0;var UE=o((r,e)=>M(void 0,null,function*(){return ou(r.contents,{plugins:[...r.plugins,e]})}),"addPluginToWallet"),LE=o((r,e)=>M(void 0,null,function*(){return ou([...r.contents,e],r)}),"addToWallet"),DE=o((r,e)=>M(void 0,null,function*(){let t=JSON.parse(JSON.stringify(r.contents)),n=t.find(i=>i.id===e);return ou(t.filter(i=>i.id!==n.id),r)}),"removeFromWallet"),KE=o((r,e)=>Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.bind(r,r)])),"bindMethods"),ou=o((...t)=>M(void 0,[...t],function*(r=[],e={}){let{plugins:n=[]}=e,{pluginMethods:i,pluginConstants:s}=n.reduce(({pluginMethods:c,pluginConstants:f},l)=>{let h=ne(ne({},c),l.pluginMethods),d=ne(ne({},f),l.pluginConstants);return{pluginMethods:h,pluginConstants:d}},{pluginMethods:{},pluginConstants:{}}),a={contents:[...r],add:function(c){return LE(this,c)},remove:function(c){return DE(this,c)},status:"UNLOCKED",plugins:n,pluginMethods:i,pluginConstants:s,addPlugin:function(c){return UE(this,c)}};return i&&(a.pluginMethods=KE(a,i)),a}),"generateWallet");function $E(r,e){try{var t=r()}catch(n){return e(n)}return t&&t.then?t.then(void 0,e):t}o($E,"_catch");function FE(){let r=new Map;return function(e,t){try{let i=function(a){if(n)return a;let c=r.get(e.didUrl);return c!==void 0?c:Promise.resolve(t()).then(function(f){var l;return((l=f.didResolutionMetadata)==null?void 0:l.error)!=="notFound"&&r.set(e.didUrl,f),f})};o(i,"_temp2");let n,s=function(){if(e.params&&e.params["no-cache"]==="true")return n=1,Promise.resolve(t())}();return Promise.resolve(s&&s.then?s.then(i):i(s))}catch(n){return Promise.reject(n)}}}o(FE,"inMemoryCache");function HE(r,e){return e()}o(HE,"noCache");var qE="(?:%[0-9a-fA-F]{2})",pv=`(?:[a-zA-Z0-9._-]|${qE})`,zE="([a-z0-9]+)",jE=`((?:${pv}*:)*(${pv}+))`,mv="[a-zA-Z0-9_.:%-]",VE=`;${mv}+=${mv}*`,GE=`((${VE})*)`,JE="(/[^#?]*)?",WE="([?][^#]*)?",YE="(#.*)?",XE=new RegExp(`^did:${zE}:${jE}${GE}${JE}${WE}${YE}$`);function k0(r){if(r===""||!r)return null;let e=r.match(XE);if(e){let t={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:r};if(e[4]){let n=e[4].slice(1).split(";");t.params={};for(let i of n){let s=i.split("=");t.params[s[0]]=s[1]}}return e[6]&&(t.path=e[6]),e[7]&&(t.query=e[7].slice(1)),e[8]&&(t.fragment=e[8].slice(1)),t}return null}o(k0,"parse");var kh={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function ZE(r){return function(e,t,n){try{return Promise.resolve($E(function(){return Promise.resolve(r(e,t,n)).then(function(i){return me(ne({},kh),{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i})})},function(i){return me(ne({},kh),{didResolutionMetadata:{error:"notFound",message:i.toString()}})}))}catch(i){return Promise.reject(i)}}}o(ZE,"wrapLegacyResolver");var au=class{constructor(e={},t={}){this.registry=void 0,this.cache=void 0,this.registry=e,this.cache=t.cache===!0?FE():t.cache||HE,t.legacyResolvers&&Object.keys(t.legacyResolvers).map(n=>{this.registry[n]||(this.registry[n]=ZE(t.legacyResolvers[n]))})}resolve(e,t={}){try{let n=this,i=k0(e);if(i===null)return Promise.resolve(me(ne({},kh),{didResolutionMetadata:{error:"invalidDid"}}));let s=n.registry[i.method];return s?Promise.resolve(n.cache(i,()=>s(i.did,i,n,t))):Promise.resolve(me(ne({},kh),{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(n){return Promise.reject(n)}}};o(au,"Resolver");function di(r,e){e||(e=r.reduce((i,s)=>i+s.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(di,"concat");$h();function Kv(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}o(Kv,"createCodec");var Dv=Kv("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),Z0=Kv("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),h9=ne({utf8:Dv,"utf-8":Dv,hex:cc.base16,latin1:Z0,ascii:Z0,binary:Z0},cc),Fh=h9;function Gt(r,e="utf8"){let t=Fh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}o(Gt,"fromString");function jt(r,e="utf8"){let t=Fh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}o(jt,"toString");$h();var Qm=ze(Gv()),y6=ze(sm()),e1=ze(xw()),bd=ze(fd()),v6=ze(Vw()),Tu=ze(Yw()),t1=ze(u6()),r1=ze(wc());function Cn(r){return jt(r,"base64url")}o(Cn,"bytesToBase64url");function zr(r){let e=r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return Gt(e,"base64url")}o(zr,"base64ToBytes");function n1(r){return Gt(r,"base58btc")}o(n1,"base58ToBytes");function Ym(r){let e=r.startsWith("0x")?r.substring(2):r;return Gt(e.toLowerCase(),"base16")}o(Ym,"hexToBytes");function Xm(r){return Cn(Gt(r))}o(Xm,"encodeBase64url");function w6(r){return jt(zr(r))}o(w6,"decodeBase64url");function oa(r){return jt(r,"base16")}o(oa,"bytesToHex");function x6(r){return Gt(r)}o(x6,"stringToBytes");function Pk({r,s:e,recoveryParam:t},n){let i=new Uint8Array(n?65:64);if(i.set(Gt(r,"base16"),0),i.set(Gt(e,"base16"),32),n){if(typeof t=="undefined")throw new Error("Signer did not return a recoveryParam");i[64]=t}return Cn(i)}o(Pk,"toJose");function Rk(r){let e=zr(r);if(e.length<64||e.length>65)throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`);let t=oa(e.slice(0,32)),n=oa(e.slice(32,64)),i=e.length===65?e[64]:void 0;return{r:t,s:n,recoveryParam:i}}o(Rk,"fromJose");function _6(r,e){return di([zr(r),zr(e)])}o(_6,"toSealed");var Uk=/^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/,Lk=/^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/,Dk=/^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;function Kk(r){if(typeof r=="string"){if(Uk.test(r))return Ym(r);if(Lk.test(r))return n1(r);if(Dk.test(r))return zr(r);throw TypeError("bad_key: Invalid private key format")}else{if(r instanceof Uint8Array)return r;throw TypeError("bad_key: Invalid private key format")}}o(Kk,"parseKey");function A6(r){let e=typeof r=="string"?Gt(r):r;return(0,Qm.hash)(e)}o(A6,"sha256");function $k(r){return new Uint8Array(y6.keccak_256.arrayBuffer(r))}o($k,"keccak");function Fk(r){let e=Gt(r.slice(2),"base16");return`0x${jt($k(e).slice(-20),"base16")}`}o(Fk,"toEthereumAddress");function Zm(r,e=new Uint8Array(4)){let t=Gt(r.toString(),"base10");return e.set(t,4-t.length),e}o(Zm,"writeUint32BE");var Wm=o(r=>di([Zm(r.length),r]),"lengthAndInput");function E6(r,e,t,n,i){if(e!==256)throw new Error(`Unsupported key length: ${e}`);let s=di([Wm(Gt(t)),Wm(typeof n=="undefined"?new Uint8Array(0):n),Wm(typeof i=="undefined"?new Uint8Array(0):i),Zm(e)]);return(0,Qm.hash)(di([Zm(1),r,s]))}o(E6,"concatKDF");var pD=new e1.ec("secp256k1");function S6(r){let e=Kk(r);if(e.length!==64)throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${e.length}`);return function(t){try{let n=typeof t=="string"?x6(t):t,i=(0,bd.sign)(e,n);return Promise.resolve(Cn(i))}catch(n){return Promise.reject(n)}}}o(S6,"EdDSASigner");function C6(r){return typeof r=="object"&&"r"in r&&"s"in r}o(C6,"instanceOfEcdsaSignature");function l6(r){return o(function(t,n){try{return Promise.resolve(n(t)).then(function(i){if(C6(i))return Pk(i,r);if(r&&typeof Rk(i).recoveryParam=="undefined")throw new Error("not_supported: ES256K-R not supported when signer doesn't provide a recovery param");return i})}catch(i){return Promise.reject(i)}},"sign")}o(l6,"ES256KSignerAlg");function h6(){return o(function(e,t){try{return Promise.resolve(t(e)).then(function(n){if(C6(n))throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");return n})}catch(n){return Promise.reject(n)}},"sign")}o(h6,"Ed25519SignerAlg");var Hk={ES256K:l6(),"ES256K-R":l6(!0),Ed25519:h6(),EdDSA:h6()};function qk(r){let e=Hk[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}o(qk,"SignerAlg");var i1=new e1.ec("secp256k1");function md(r,e=!1){let t=zr(r);if(t.length!==(e?65:64))throw new Error("wrong signature length");let n=oa(t.slice(0,32)),i=oa(t.slice(32,64)),s={r:n,s:i};return e&&(s.recoveryParam=t[64]),s}o(md,"toSignatureObject");function s1(r){if(r.publicKeyBase58)return n1(r.publicKeyBase58);if(r.publicKeyBase64)return zr(r.publicKeyBase64);if(r.publicKeyHex)return Ym(r.publicKeyHex);if(r.publicKeyJwk&&r.publicKeyJwk.crv==="secp256k1"&&r.publicKeyJwk.x&&r.publicKeyJwk.y)return Ym(i1.keyFromPublic({x:oa(zr(r.publicKeyJwk.x)),y:oa(zr(r.publicKeyJwk.y))}).getPublic("hex"));if(r.publicKeyMultibase){let{base16:e,base58btc:t,base64:n,base64url:i}=cc;return e.decoder.or(t.decoder.or(n.decoder.or(i.decoder))).decode(r.publicKeyMultibase)}return new Uint8Array}o(s1,"extractPublicKeyBytes");function zk(r,e,t){let n=A6(r),i=md(e),s=t.filter(({ethereumAddress:f,blockchainAccountId:l})=>typeof f=="undefined"&&typeof l=="undefined"),a=t.filter(({ethereumAddress:f,blockchainAccountId:l})=>typeof f!="undefined"||typeof l!==void 0),c=s.find(f=>{try{let l=s1(f);return i1.keyFromPublic(l).verify(n,i)}catch(l){return!1}});if(!c&&a.length>0&&(c=k6(r,e,a)),!c)throw new Error("invalid_signature: Signature invalid for JWT");return c}o(zk,"verifyES256K");function k6(r,e,t){let n;if(e.length>86)n=[md(e,!0)];else{let a=md(e,!1);n=[me(ne({},a),{recoveryParam:0}),me(ne({},a),{recoveryParam:1})]}let i=o(a=>{let c=A6(r),f=i1.recoverPubKey(c,a,a.recoveryParam),l=f.encode("hex"),h=f.encode("hex",!0),d=Fk(l);return t.find(x=>{var y,_,U;let E=oa(s1(x));return E===l||E===h||((y=x.ethereumAddress)==null?void 0:y.toLowerCase())===d||((_=x.blockchainAccountId)==null||(U=_.split("@eip155"))==null?void 0:U[0].toLowerCase())===d})},"checkSignatureAgainstSigner"),s=n.map(i).filter(a=>typeof a!="undefined");if(s.length===0)throw new Error("invalid_signature: Signature invalid for JWT");return s[0]}o(k6,"verifyRecoverableES256K");function d6(r,e,t){let n=x6(r),i=zr(e),s=t.find(a=>(0,bd.verify)(s1(a),n,i));if(!s)throw new Error("invalid_signature: Signature invalid for JWT");return s}o(d6,"verifyEd25519");var jk={ES256K:zk,"ES256K-R":k6,Ed25519:d6,EdDSA:d6};function T6(r){let e=jk[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}o(T6,"VerifierAlgorithm");T6.toSignatureObject=md;var M6=o(function(r,e,t={},n={}){try{t.alg||(t.alg=Vk);let i=typeof r=="string"?r:p6(r,n.canonicalize),s=[p6(t,n.canonicalize),i].join("."),a=qk(t.alg);return Promise.resolve(a(s,e)).then(function(c){return[s,c].join(".")})}catch(i){return Promise.reject(i)}},"createJWS");var Vk="ES256K";function p6(r,e=!1){return Xm(e?(0,v6.default)(r):JSON.stringify(r))}o(p6,"encodeSection");function Gk(r){let e=r.match(/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(e)return{header:JSON.parse(w6(e[1])),payload:e[2],signature:e[3],data:`${e[1]}.${e[2]}`};throw new Error("invalid_argument: Incorrect format JWS")}o(Gk,"decodeJWS");function Jk({header:r,data:e,signature:t},n){return Array.isArray(n)||(n=[n]),T6(r.alg)(e,t,n)}o(Jk,"verifyJWSDecoded");function B6(r,e){let t=Gk(r);return Jk(t,e)}o(B6,"verifyJWS");function Wk(r,e,t){for(var n;;){var i=r();if(ho(i)&&(i=i.v),!i)return s;if(i.then){n=0;break}var s=t();if(s&&s.then)if(ho(s))s=s.s;else{n=1;break}if(e){var a=e();if(a&&a.then&&!ho(a)){n=2;break}}}var c=new aa,f=Wt.bind(null,c,2);return(n===0?i.then(h):n===1?s.then(l):a.then(d)).then(void 0,f),c;function l(v){s=v;do{if(e&&(a=e(),a&&a.then&&!ho(a))){a.then(d).then(void 0,f);return}if(i=r(),!i||ho(i)&&!i.v){Wt(c,1,s);return}if(i.then){i.then(h).then(void 0,f);return}s=t(),ho(s)&&(s=s.v)}while(!s||!s.then);s.then(l).then(void 0,f)}o(l,"_resumeAfterBody");function h(v){v?(s=t(),s&&s.then?s.then(l).then(void 0,f):l(s)):Wt(c,1,s)}o(h,"_resumeAfterTest");function d(){(i=r())?i.then?i.then(h).then(void 0,f):h(i):Wt(c,1,s)}o(d,"_resumeAfterUpdate")}o(Wk,"_for");var I6=o(function(r,e){try{let n=function(l){if(c===null)throw new Error("failure: Failed to decrypt");return c};o(n,"_temp5");let t;Zk(r);let i=JSON.parse(w6(r.protected));if(i.enc!==e.enc)throw new Error(`not_supported: Decrypter does not supported: '${i.enc}'`);let s=_6(r.ciphertext,r.tag),a=new Uint8Array(Buffer.from(r.aad?`${r.protected}.${r.aad}`:r.protected)),c=null,f=function(){return i.alg==="dir"&&e.alg==="dir"?Promise.resolve(e.decrypt(s,zr(r.iv),a)).then(function(l){c=l}):function(){if(!r.recipients||r.recipients.length===0)throw new Error("bad_jwe: missing recipients");{let l=0;return Wk(function(){return!c&&l<r.recipients.length},function(){return l++},function(){let h=r.recipients[l];Object.assign(h.header,i);let d=function(){if(h.header.alg===e.alg)return Promise.resolve(e.decrypt(s,zr(r.iv),a,h)).then(function(v){c=v})}();if(d&&d.then)return d.then(function(){})})}}()}();return Promise.resolve(f&&f.then?f.then(n):n(f))}catch(t){return Promise.reject(t)}},"decryptJWE"),m6=typeof Symbol!="undefined"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Wt(r,e,t){if(!r.s){if(t instanceof aa)if(t.s)e&1&&(e=t.s),t=t.v;else{t.o=Wt.bind(null,r,e);return}if(t&&t.then){t.then(Wt.bind(null,r,e),Wt.bind(null,r,2));return}r.s=e,r.v=t;let n=r.o;n&&n(r)}}o(Wt,"_settle");var aa=function(){function r(){}return o(r,"_Pact"),r.prototype.then=function(e,t){let n=new r,i=this.s;if(i){let s=i&1?e:t;if(s){try{Wt(n,1,s(this.v))}catch(a){Wt(n,2,a)}return n}else return this}return this.o=function(s){try{let a=s.v;s.s&1?Wt(n,1,e?e(a):a):t?Wt(n,1,t(a)):Wt(n,2,a)}catch(a){Wt(n,2,a)}},n},r}();function ho(r){return r instanceof aa&&r.s&1}o(ho,"_isSettledPact");function Yk(r,e,t){var n=-1,i,s;function a(c){try{for(;++n<r.length&&(!t||!t());)if(c=e(n),c&&c.then)if(ho(c))c=c.v;else{c.then(a,s||(s=Wt.bind(null,i=new aa,2)));return}i?Wt(i,1,c):i=c}catch(f){Wt(i||(i=new aa),2,f)}}return o(a,"_cycle"),a(),i}o(Yk,"_forTo");function Xk(r,e,t){if(typeof r[m6]=="function"){let h=function(d){try{for(;!(i=n.next()).done&&(!t||!t());)if(d=e(i.value),d&&d.then)if(ho(d))d=d.v;else{d.then(h,a||(a=Wt.bind(null,s=new aa,2)));return}s?Wt(s,1,d):s=d}catch(v){Wt(s||(s=new aa),2,v)}};o(h,"_cycle");var n=r[m6](),i,s,a;if(h(),n.return){var c=o(function(d){try{i.done||n.return()}catch(v){}return d},"_fixup");if(s&&s.then)return s.then(c,function(d){throw c(d)});c()}return s}if(!("length"in r))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<r.length;l++)f.push(r[l]);return Yk(f,function(h){return e(f[h])},t)}o(Xk,"_forOf");function Zk(r){if(!(r.protected&&r.iv&&r.ciphertext&&r.tag))throw new Error("bad_jwe: missing properties");r.recipients&&r.recipients.map(e=>{if(!(e.header&&e.encrypted_key))throw new Error("bad_jwe: malformed recipients")})}o(Zk,"validateJWE");function b6({ciphertext:r,tag:e,iv:t,protectedHeader:n,recipient:i},s){let a={protected:n,iv:Cn(t),ciphertext:Cn(r),tag:Cn(e)};return s&&(a.aad=Cn(s)),i&&(a.recipients=[i]),a}o(b6,"encodeJWE");var N6=o(function(r,e,t={},n){try{if(e[0].alg==="dir"){if(e.length>1)throw new Error('not_supported: Can only do "dir" encryption to one key.');return Promise.resolve(e[0].encrypt(r,t,n)).then(function(i){return b6(i,n)})}else{let i=e[0].enc;if(!e.reduce((f,l)=>f&&l.enc===i,!0))throw new Error("invalid_argument: Incompatible encrypters passed");let s,a,c=Xk(e,function(f){let l=function(){return s?Promise.resolve(f.encryptCek==null?void 0:f.encryptCek(s)).then(function(h){if(h){var d,v;(d=a)==null||(v=d.recipients)==null||v.push(h)}}):Promise.resolve(f.encrypt(r,t,n)).then(function(h){s=h.cek,a=b6(h,n)})}();if(l&&l.then)return l.then(function(){})});return Promise.resolve(c&&c.then?c.then(function(){return a}):a)}}catch(i){return Promise.reject(i)}},"createJWE");var O6=o(function(r,e){try{let t=o(function(i){try{return Promise.resolve(e.resolve(i)).then(function({didResolutionMetadata:s,didDocument:a}){var c;if(s!=null&&s.error||a==null)throw new Error(`resolver_error: Could not resolve ${i}: ${s.error}, ${s.message}`);if(!a.keyAgreement)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);let l=((c=a.keyAgreement)==null?void 0:c.map(h=>typeof h=="string"?[...a.publicKey||[],...a.verificationMethod||[]].find(d=>d.id===h):h).filter(h=>typeof h!="undefined")).filter(h=>h.type==="X25519KeyAgreementKey2019"&&Boolean(h.publicKeyBase58));if(!l.length)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);return l.map(h=>eT(n1(h.publicKeyBase58),h.id))})}catch(s){return Promise.reject(s)}},"encryptersForDID"),n=r.map(i=>t(i));return Promise.resolve(Promise.all(n)).then(function(i){return[].concat(...i)})}catch(t){return Promise.reject(t)}},"resolveX25519Encrypters");function P6(r){let e=new t1.XChaCha20Poly1305(r);return(t,n)=>{let i=(0,r1.randomBytes)(e.nonceLength),s=e.seal(i,t,n);return{ciphertext:s.subarray(0,s.length-e.tagLength),tag:s.subarray(s.length-e.tagLength),iv:i}}}o(P6,"xc20pEncrypter");function Qk(r){let e=o(function(s,a={},c){try{let f=Xm(JSON.stringify(Object.assign({alg:i},a,{enc:n}))),l=new Uint8Array(Buffer.from(c?`${f}.${Cn(c)}`:f));return Promise.resolve(me(ne({},t(s,l)),{protectedHeader:f}))}catch(f){return Promise.reject(f)}},"encrypt"),t=P6(r),n="XC20P",i="dir";return{alg:i,enc:n,encrypt:e}}o(Qk,"xc20pDirEncrypter");function g6(r){let e=o(function(n,i,s){try{return Promise.resolve(t.open(i,n,s))}catch(a){return Promise.reject(a)}},"decrypt"),t=new t1.XChaCha20Poly1305(r);return{alg:"dir",enc:"XC20P",decrypt:e}}o(g6,"xc20pDirDecrypter");function eT(r,e){let t=o(function(c,f={},l){try{Object.assign(f,{alg:void 0});let h=(0,r1.randomBytes)(32);return Promise.resolve(Qk(h).encrypt(c,f,l)).then(function(d){return Promise.resolve(n(h)).then(function(v){return me(ne({},d),{recipient:v,cek:h})})})}catch(h){return Promise.reject(h)}},"encrypt"),n=o(function(c){try{let f=(0,Tu.generateKeyPair)(),l=(0,Tu.sharedKey)(f.secretKey,r),h=E6(l,s,i),d=P6(h)(c),v={encrypted_key:Cn(d.ciphertext),header:{alg:i,iv:Cn(d.iv),tag:Cn(d.tag),epk:{kty:"OKP",crv:a,x:Cn(f.publicKey)}}};return e&&(v.header.kid=e),Promise.resolve(v)}catch(f){return Promise.reject(f)}},"encryptCek"),i="ECDH-ES+XC20PKW",s=256,a="X25519";return{alg:i,enc:"XC20P",encrypt:t,encryptCek:n}}o(eT,"x25519Encrypter");function tT(r){if(!(r&&r.epk&&r.iv&&r.tag))throw new Error("bad_jwe: malformed header")}o(tT,"validateHeader");function R6(r){let e=o(function(s,a,c,f){try{let d=function(){let _=E6(x,n,t),U=_6(f.encrypted_key,f.header.tag);return Promise.resolve(g6(_).decrypt(U,zr(f.header.iv))).then(function(E){return E===null?null:g6(E).decrypt(s,a,c)})};o(d,"_temp4");var l,h;if(tT((l=f)==null?void 0:l.header),f=f,((h=f.header.epk)==null?void 0:h.crv)!==i||typeof f.header.epk.x=="undefined")return Promise.resolve(null);let v=zr(f.header.epk.x),x,y=function(){if(r instanceof Uint8Array)x=(0,Tu.sharedKey)(r,v);else return Promise.resolve(r(v)).then(function(_){x=_})}();return Promise.resolve(y&&y.then?y.then(d):d(y))}catch(d){return Promise.reject(d)}},"decrypt"),t="ECDH-ES+XC20PKW",n=256,i="X25519";return{alg:t,enc:"XC20P",decrypt:e}}o(R6,"x25519Decrypter");X0();var gd=o(({enumerable:r=!0,configurable:e=!1}={})=>({enumerable:r,configurable:e,writable:!1}),"readonly"),o1=o(function*(r,e){if(r!=null&&!(r instanceof Uint8Array))for(let[t,n]of Object.entries(r)){let i=[...e,t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,a]of n.entries()){let c=[...i,s],f=Ne.asCID(a);f?yield[c.join("/"),f]:typeof a=="object"&&(yield*o1(a,c))}else{let s=Ne.asCID(n);s?yield[i.join("/"),s]:yield*o1(n,i)}}},"links"),a1=o(function*(r,e){if(r!=null)for(let[t,n]of Object.entries(r)){let i=[...e,t];if(yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ne.asCID(n))if(Array.isArray(n))for(let[s,a]of n.entries()){let c=[...i,s];yield c.join("/"),typeof a=="object"&&!Ne.asCID(a)&&(yield*a1(a,c))}else yield*a1(n,i)}},"tree"),rT=o((r,e)=>{let t=r;for(let[n,i]of e.entries()){if(t=t[i],t==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(a=>`[${JSON.stringify(a)}]`).join("")}`);let s=Ne.asCID(t);if(s)return{value:s,remaining:e.slice(n+1).join("/")}}return{value:t}},"get"),yd=class{constructor({cid:e,bytes:t,value:n}){if(!e||!t||typeof n=="undefined")throw new Error("Missing required argument");this.cid=e,this.bytes=t,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:gd(),bytes:gd(),value:gd(),asBlock:gd()})}links(){return o1(this.value,[])}tree(){return a1(this.value,[])}get(e="/"){return rT(this.value,e.split("/").filter(Boolean))}};o(yd,"Block");var ca=o(n=>M(void 0,[n],function*({value:r,codec:e,hasher:t}){if(typeof r=="undefined")throw new Error('Missing required argument "value"');if(!e||!t)throw new Error("Missing required argument: codec or hasher");let i=e.encode(r),s=yield t.digest(i),a=Ne.create(1,e.code,s);return new yd({value:r,bytes:i,cid:a})}),"encode");Xi();hu();J0();H0();var cs={};Mt(cs,{code:()=>y1,decode:()=>w1,encode:()=>v1,name:()=>DT});var nT=["string","number","bigint","symbol"],iT=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function U6(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(nT.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(sT(r))return"Buffer";let t=oT(r);return t||"Object"}o(U6,"is");function sT(r){return r&&r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer.call(null,r)}o(sT,"isBuffer");function oT(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(iT.includes(e))return e}o(oT,"getObjectType");var ue=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};o(ue,"Type");ue.uint=new ue(0,"uint",!0);ue.negint=new ue(1,"negint",!0);ue.bytes=new ue(2,"bytes",!0);ue.string=new ue(3,"string",!0);ue.array=new ue(4,"array",!1);ue.map=new ue(5,"map",!1);ue.tag=new ue(6,"tag",!1);ue.float=new ue(7,"float",!0);ue.false=new ue(7,"false",!0);ue.true=new ue(7,"true",!0);ue.null=new ue(7,"null",!0);ue.undefined=new ue(7,"undefined",!0);ue.break=new ue(7,"break",!0);var we=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};o(we,"Token");var Sc=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",aT=new TextDecoder,cT=new TextEncoder;function vd(r){return Sc&&globalThis.Buffer.isBuffer(r)}o(vd,"isBuffer");function f1(r){return r instanceof Uint8Array?vd(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}o(f1,"asU8A");var $6=Sc?(r,e,t)=>t-e>64?globalThis.Buffer.from(r.subarray(e,t)).toString("utf8"):D6(r,e,t):(r,e,t)=>t-e>64?aT.decode(r.subarray(e,t)):D6(r,e,t),F6=Sc?r=>r.length>64?globalThis.Buffer.from(r):L6(r):r=>r.length>64?cT.encode(r):L6(r),Ei=o(r=>Uint8Array.from(r),"fromArray"),Cc=Sc?(r,e,t)=>vd(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),H6=Sc?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),f1(globalThis.Buffer.concat(r,e))):(r,e)=>{let t=new Uint8Array(e),n=0;for(let i of r)n+i.length>t.length&&(i=i.subarray(0,t.length-n)),t.set(i,n),n+=i.length;return t},q6=Sc?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r);function z6(r,e){if(vd(r)&&vd(e))return r.compare(e);for(let t=0;t<r.length;t++)if(r[t]!==e[t])return r[t]<e[t]?-1:1;return 0}o(z6,"compare");function L6(r,e=1/0){let t,n=r.length,i=null,s=[];for(let a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}o(L6,"utf8ToBytes");function D6(r,e,t){let n=[];for(;e<t;){let i=r[e],s=null,a=i>239?4:i>223?3:i>191?2:1;if(e+a<=t){let c,f,l,h;switch(a){case 1:i<128&&(s=i);break;case 2:c=r[e+1],(c&192)===128&&(h=(i&31)<<6|c&63,h>127&&(s=h));break;case 3:c=r[e+1],f=r[e+2],(c&192)===128&&(f&192)===128&&(h=(i&15)<<12|(c&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=r[e+1],f=r[e+2],l=r[e+3],(c&192)===128&&(f&192)===128&&(l&192)===128&&(h=(i&15)<<18|(c&63)<<12|(f&63)<<6|l&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),e+=a}return fT(n)}o(D6,"utf8Slice");var K6=4096;function fT(r){let e=r.length;if(e<=K6)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=K6));return t}o(fT,"decodeCodePointsArray");var uT=256,kc=class{constructor(e=uT){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=t.length-(this.maxCursor-this.cursor)-1;t.set(e,i)}else{if(t){let i=t.length-(this.maxCursor-this.cursor)-1;i<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=q6(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Cc(n,0,this.cursor)}else t=H6(this.chunks,this.cursor);return e&&this.reset(),t}};o(kc,"Bl");var De="CBOR decode error:",u1="CBOR encode error:",Mu=[];Mu[23]=1;Mu[24]=2;Mu[25]=3;Mu[26]=5;Mu[27]=9;function as(r,e,t){if(r.length-e<t)throw new Error(`${De} not enough data for type`)}o(as,"assertEnoughData");var er=[24,256,65536,4294967296,BigInt("18446744073709551616")];function nn(r,e,t){as(r,e,1);let n=r[e];if(t.strict===!0&&n<er[0])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(nn,"readUint8");function sn(r,e,t){as(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<er[1])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(sn,"readUint16");function on(r,e,t){as(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<er[2])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(on,"readUint32");function an(r,e,t){as(r,e,8);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3],i=r[e+4]*16777216+(r[e+5]<<16)+(r[e+6]<<8)+r[e+7],s=(BigInt(n)<<BigInt(32))+BigInt(i);if(t.strict===!0&&s<er[3])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(t.allowBigInt===!0)return s;throw new Error(`${De} integers outside of the safe integer range are not supported`)}o(an,"readUint64");function j6(r,e,t,n){return new we(ue.uint,nn(r,e+1,n),2)}o(j6,"decodeUint8");function V6(r,e,t,n){return new we(ue.uint,sn(r,e+1,n),3)}o(V6,"decodeUint16");function G6(r,e,t,n){return new we(ue.uint,on(r,e+1,n),5)}o(G6,"decodeUint32");function J6(r,e,t,n){return new we(ue.uint,an(r,e+1,n),9)}o(J6,"decodeUint64");function kn(r,e){return ur(r,0,e.value)}o(kn,"encodeUint");function ur(r,e,t){if(t<er[0]){let n=Number(t);r.push([e|n])}else if(t<er[1]){let n=Number(t);r.push([e|24,n])}else if(t<er[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<er[3]){let n=Number(t);r.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(t);if(n<er[4]){let i=[e|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=s&255,s=s>>8,i[7]=s&255,s=s>>8,i[6]=s&255,s=s>>8,i[5]=s&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,r.push(i)}else throw new Error(`${De} encountered BigInt larger than allowable range`)}}o(ur,"encodeUintValue");kn.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");ur.encodedSize=o(function(e){return e<er[0]?1:e<er[1]?2:e<er[2]?3:e<er[3]?5:9},"encodedSize");kn.compareTokens=o(function(e,t){return e.value<t.value?-1:e.value>t.value?1:0},"compareTokens");function W6(r,e,t,n){return new we(ue.negint,-1-nn(r,e+1,n),2)}o(W6,"decodeNegint8");function Y6(r,e,t,n){return new we(ue.negint,-1-sn(r,e+1,n),3)}o(Y6,"decodeNegint16");function X6(r,e,t,n){return new we(ue.negint,-1-on(r,e+1,n),5)}o(X6,"decodeNegint32");var l1=BigInt(-1),Z6=BigInt(1);function Q6(r,e,t,n){let i=an(r,e+1,n);if(typeof i!="bigint"){let s=-1-i;if(s>=Number.MIN_SAFE_INTEGER)return new we(ue.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${De} integers outside of the safe integer range are not supported`);return new we(ue.negint,l1-BigInt(i),9)}o(Q6,"decodeNegint64");function wd(r,e){let t=e.value,n=typeof t=="bigint"?t*l1-Z6:t*-1-1;ur(r,e.type.majorEncoded,n)}o(wd,"encodeNegint");wd.encodedSize=o(function(e){let t=e.value,n=typeof t=="bigint"?t*l1-Z6:t*-1-1;return n<er[0]?1:n<er[1]?2:n<er[2]?3:n<er[3]?5:9},"encodedSize");wd.compareTokens=o(function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},"compareTokens");function Bu(r,e,t,n){as(r,e,t+n);let i=Cc(r,e+t,e+t+n);return new we(ue.bytes,i,t+n)}o(Bu,"toToken");function e3(r,e,t,n){return Bu(r,e,1,t)}o(e3,"decodeBytesCompact");function t3(r,e,t,n){return Bu(r,e,2,nn(r,e+1,n))}o(t3,"decodeBytes8");function r3(r,e,t,n){return Bu(r,e,3,sn(r,e+1,n))}o(r3,"decodeBytes16");function n3(r,e,t,n){return Bu(r,e,5,on(r,e+1,n))}o(n3,"decodeBytes32");function i3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer bytes lengths not supported`);return Bu(r,e,9,i)}o(i3,"decodeBytes64");function xd(r){return r.encodedBytes===void 0&&(r.encodedBytes=r.type===ue.string?F6(r.value):r.value),r.encodedBytes}o(xd,"tokenBytes");function Tc(r,e){let t=xd(e);ur(r,e.type.majorEncoded,t.length),r.push(t)}o(Tc,"encodeBytes");Tc.encodedSize=o(function(e){let t=xd(e);return ur.encodedSize(t.length)+t.length},"encodedSize");Tc.compareTokens=o(function(e,t){return hT(xd(e),xd(t))},"compareTokens");function hT(r,e){return r.length<e.length?-1:r.length>e.length?1:z6(r,e)}o(hT,"compareBytes");function Iu(r,e,t,n,i){let s=t+n;as(r,e,s);let a=new we(ue.string,$6(r,e+t,e+s),s);return i.retainStringBytes===!0&&(a.byteValue=Cc(r,e+t,e+s)),a}o(Iu,"toToken");function s3(r,e,t,n){return Iu(r,e,1,t,n)}o(s3,"decodeStringCompact");function o3(r,e,t,n){return Iu(r,e,2,nn(r,e+1,n),n)}o(o3,"decodeString8");function a3(r,e,t,n){return Iu(r,e,3,sn(r,e+1,n),n)}o(a3,"decodeString16");function c3(r,e,t,n){return Iu(r,e,5,on(r,e+1,n),n)}o(c3,"decodeString32");function f3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer string lengths not supported`);return Iu(r,e,9,i,n)}o(f3,"decodeString64");var u3=Tc;function Mc(r,e,t,n){return new we(ue.array,n,t)}o(Mc,"toToken");function l3(r,e,t,n){return Mc(r,e,1,t)}o(l3,"decodeArrayCompact");function h3(r,e,t,n){return Mc(r,e,2,nn(r,e+1,n))}o(h3,"decodeArray8");function d3(r,e,t,n){return Mc(r,e,3,sn(r,e+1,n))}o(d3,"decodeArray16");function p3(r,e,t,n){return Mc(r,e,5,on(r,e+1,n))}o(p3,"decodeArray32");function m3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer array lengths not supported`);return Mc(r,e,9,i)}o(m3,"decodeArray64");function b3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return Mc(r,e,1,1/0)}o(b3,"decodeArrayIndefinite");function _d(r,e){ur(r,ue.array.majorEncoded,e.value)}o(_d,"encodeArray");_d.compareTokens=kn.compareTokens;_d.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");function Bc(r,e,t,n){return new we(ue.map,n,t)}o(Bc,"toToken");function g3(r,e,t,n){return Bc(r,e,1,t)}o(g3,"decodeMapCompact");function y3(r,e,t,n){return Bc(r,e,2,nn(r,e+1,n))}o(y3,"decodeMap8");function v3(r,e,t,n){return Bc(r,e,3,sn(r,e+1,n))}o(v3,"decodeMap16");function w3(r,e,t,n){return Bc(r,e,5,on(r,e+1,n))}o(w3,"decodeMap32");function x3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer map lengths not supported`);return Bc(r,e,9,i)}o(x3,"decodeMap64");function _3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return Bc(r,e,1,1/0)}o(_3,"decodeMapIndefinite");function Ad(r,e){ur(r,ue.map.majorEncoded,e.value)}o(Ad,"encodeMap");Ad.compareTokens=kn.compareTokens;Ad.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");function A3(r,e,t,n){return new we(ue.tag,t,1)}o(A3,"decodeTagCompact");function E3(r,e,t,n){return new we(ue.tag,nn(r,e+1,n),2)}o(E3,"decodeTag8");function S3(r,e,t,n){return new we(ue.tag,sn(r,e+1,n),3)}o(S3,"decodeTag16");function C3(r,e,t,n){return new we(ue.tag,on(r,e+1,n),5)}o(C3,"decodeTag32");function k3(r,e,t,n){return new we(ue.tag,an(r,e+1,n),9)}o(k3,"decodeTag64");function Ed(r,e){ur(r,ue.tag.majorEncoded,e.value)}o(Ed,"encodeTag");Ed.compareTokens=kn.compareTokens;Ed.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");var yT=20,vT=21,wT=22,xT=23;function T3(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${De} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(ue.null,null,1):new we(ue.undefined,void 0,1)}o(T3,"decodeUndefined");function M3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return new we(ue.break,void 0,1)}o(M3,"decodeBreak");function h1(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${De} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${De} Infinity values are not supported`)}return new we(ue.float,r,e)}o(h1,"createToken");function B3(r,e,t,n){return h1(d1(r,e+1),3,n)}o(B3,"decodeFloat16");function I3(r,e,t,n){return h1(p1(r,e+1),5,n)}o(I3,"decodeFloat32");function N3(r,e,t,n){return h1(U3(r,e+1),9,n)}o(N3,"decodeFloat64");function Sd(r,e,t){let n=e.value;if(n===!1)r.push([ue.float.majorEncoded|yT]);else if(n===!0)r.push([ue.float.majorEncoded|vT]);else if(n===null)r.push([ue.float.majorEncoded|wT]);else if(n===void 0)r.push([ue.float.majorEncoded|xT]);else{let i,s=!1;(!t||t.float64!==!0)&&(P3(n),i=d1(Xn,1),n===i||Number.isNaN(n)?(Xn[0]=249,r.push(Xn.slice(0,3)),s=!0):(R3(n),i=p1(Xn,1),n===i&&(Xn[0]=250,r.push(Xn.slice(0,5)),s=!0))),s||(_T(n),i=U3(Xn,1),Xn[0]=251,r.push(Xn.slice(0,9)))}}o(Sd,"encodeFloat");Sd.encodedSize=o(function(e,t){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!t||t.float64!==!0){P3(n);let i=d1(Xn,1);if(n===i||Number.isNaN(n))return 3;if(R3(n),i=p1(Xn,1),n===i)return 5}return 9},"encodedSize");var O3=new ArrayBuffer(9),Tn=new DataView(O3,1),Xn=new Uint8Array(O3,0);function P3(r){if(r===1/0)Tn.setUint16(0,31744,!1);else if(r===-1/0)Tn.setUint16(0,64512,!1);else if(Number.isNaN(r))Tn.setUint16(0,32256,!1);else{Tn.setFloat32(0,r);let e=Tn.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)Tn.setUint16(0,31744,!1);else if(t===0)Tn.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let i=t-127;i<-24?Tn.setUint16(0,0):i<-14?Tn.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Tn.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}o(P3,"encodeFloat16");function d1(r,e){if(r.length-e<2)throw new Error(`${De} not enough data for float16`);let t=(r[e]<<8)+r[e+1];if(t===31744)return 1/0;if(t===64512)return-1/0;if(t===32256)return NaN;let n=t>>10&31,i=t&1023,s;return n===0?s=i*l0(2,-24):n!==31?s=(i+1024)*l0(2,n-25):s=i===0?1/0:NaN,t&32768?-s:s}o(d1,"readFloat16");function R3(r){Tn.setFloat32(0,r,!1)}o(R3,"encodeFloat32");function p1(r,e){if(r.length-e<4)throw new Error(`${De} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}o(p1,"readFloat32");function _T(r){Tn.setFloat64(0,r,!1)}o(_T,"encodeFloat64");function U3(r,e){if(r.length-e<8)throw new Error(`${De} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}o(U3,"readFloat64");Sd.compareTokens=kn.compareTokens;function Qe(r,e,t){throw new Error(`${De} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}o(Qe,"invalidMinor");function Cd(r){return()=>{throw new Error(`${De} ${r}`)}}o(Cd,"errorer");var ye=[];for(let r=0;r<=23;r++)ye[r]=Qe;ye[24]=j6;ye[25]=V6;ye[26]=G6;ye[27]=J6;ye[28]=Qe;ye[29]=Qe;ye[30]=Qe;ye[31]=Qe;for(let r=32;r<=55;r++)ye[r]=Qe;ye[56]=W6;ye[57]=Y6;ye[58]=X6;ye[59]=Q6;ye[60]=Qe;ye[61]=Qe;ye[62]=Qe;ye[63]=Qe;for(let r=64;r<=87;r++)ye[r]=e3;ye[88]=t3;ye[89]=r3;ye[90]=n3;ye[91]=i3;ye[92]=Qe;ye[93]=Qe;ye[94]=Qe;ye[95]=Cd("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)ye[r]=s3;ye[120]=o3;ye[121]=a3;ye[122]=c3;ye[123]=f3;ye[124]=Qe;ye[125]=Qe;ye[126]=Qe;ye[127]=Cd("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)ye[r]=l3;ye[152]=h3;ye[153]=d3;ye[154]=p3;ye[155]=m3;ye[156]=Qe;ye[157]=Qe;ye[158]=Qe;ye[159]=b3;for(let r=160;r<=183;r++)ye[r]=g3;ye[184]=y3;ye[185]=v3;ye[186]=w3;ye[187]=x3;ye[188]=Qe;ye[189]=Qe;ye[190]=Qe;ye[191]=_3;for(let r=192;r<=215;r++)ye[r]=A3;ye[216]=E3;ye[217]=S3;ye[218]=C3;ye[219]=k3;ye[220]=Qe;ye[221]=Qe;ye[222]=Qe;ye[223]=Qe;for(let r=224;r<=243;r++)ye[r]=Cd("simple values are not supported");ye[244]=Qe;ye[245]=Qe;ye[246]=Qe;ye[247]=T3;ye[248]=Cd("simple values are not supported");ye[249]=B3;ye[250]=I3;ye[251]=N3;ye[252]=Qe;ye[253]=Qe;ye[254]=Qe;ye[255]=M3;var Zn=[];for(let r=0;r<24;r++)Zn[r]=new we(ue.uint,r,1);for(let r=-1;r>=-24;r--)Zn[31-r]=new we(ue.negint,r,1);Zn[64]=new we(ue.bytes,new Uint8Array(0),1);Zn[96]=new we(ue.string,"",1);Zn[128]=new we(ue.array,0,1);Zn[160]=new we(ue.map,0,1);Zn[244]=new we(ue.false,!1,1);Zn[245]=new we(ue.true,!0,1);Zn[246]=new we(ue.null,null,1);function L3(r){switch(r.type){case ue.false:return Ei([244]);case ue.true:return Ei([245]);case ue.null:return Ei([246]);case ue.bytes:return r.value.length?void 0:Ei([64]);case ue.string:return r.value===""?Ei([96]):void 0;case ue.array:return r.value===0?Ei([128]):void 0;case ue.map:return r.value===0?Ei([160]):void 0;case ue.uint:return r.value<24?Ei([Number(r.value)]):void 0;case ue.negint:if(r.value>=-24)return Ei([31-Number(r.value)])}}o(L3,"quickEncodeToken");var ET={float64:!1,mapSorter:kT,quickEncodeToken:L3};function ST(){let r=[];return r[ue.uint.major]=kn,r[ue.negint.major]=wd,r[ue.bytes.major]=Tc,r[ue.string.major]=u3,r[ue.array.major]=_d,r[ue.map.major]=Ad,r[ue.tag.major]=Ed,r[ue.float.major]=Sd,r}o(ST,"makeCborEncoders");var D3=ST(),m1=new kc,ua=class{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${u1} object contains circular references`);return new ua(t,e)}};o(ua,"Ref");var po={null:new we(ue.null,null),undefined:new we(ue.undefined,void 0),true:new we(ue.true,!0),false:new we(ue.false,!1),emptyArray:new we(ue.array,0),emptyMap:new we(ue.map,0)},mo={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new we(ue.float,r):r>=0?new we(ue.uint,r):new we(ue.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new we(ue.uint,r):new we(ue.negint,r)},Uint8Array(r,e,t,n){return new we(ue.bytes,r)},string(r,e,t,n){return new we(ue.string,r)},boolean(r,e,t,n){return r?po.true:po.false},null(r,e,t,n){return po.null},undefined(r,e,t,n){return po.undefined},ArrayBuffer(r,e,t,n){return new we(ue.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new we(ue.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[po.emptyArray,new we(ue.break)]:po.emptyArray;n=ua.createCheck(n,r);let i=[],s=0;for(let a of r)i[s++]=kd(a,t,n);return t.addBreakTokens?[new we(ue.array,r.length),i,new we(ue.break)]:[new we(ue.array,r.length),i]},Object(r,e,t,n){let i=e!=="Object",s=i?r.keys():Object.keys(r),a=i?r.size:s.length;if(!a)return t.addBreakTokens===!0?[po.emptyMap,new we(ue.break)]:po.emptyMap;n=ua.createCheck(n,r);let c=[],f=0;for(let l of s)c[f++]=[kd(l,t,n),kd(i?r.get(l):r[l],t,n)];return CT(c,t),t.addBreakTokens?[new we(ue.map,a),c,new we(ue.break)]:[new we(ue.map,a),c]}};mo.Map=mo.Object;mo.Buffer=mo.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))mo[`${r}Array`]=mo.DataView;function kd(r,e={},t){let n=U6(r),i=e&&e.typeEncoders&&e.typeEncoders[n]||mo[n];if(typeof i=="function"){let a=i(r,n,e,t);if(a!=null)return a}let s=mo[n];if(!s)throw new Error(`${u1} unsupported type: ${n}`);return s(r,n,e,t)}o(kd,"objectToTokens");function CT(r,e){e.mapSorter&&r.sort(e.mapSorter)}o(CT,"sortMapEntries");function kT(r,e){let t=Array.isArray(r[0])?r[0][0]:r[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(t.type!==n.type)return t.type.compare(n.type);let i=t.type.major,s=D3[i].compareTokens(t,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}o(kT,"mapSorter");function K3(r,e,t,n){if(Array.isArray(e))for(let i of e)K3(r,i,t,n);else t[e.type.major](r,e,n)}o(K3,"tokensToEncoded");function TT(r,e,t){let n=kd(r,t);if(!Array.isArray(n)&&t.quickEncodeToken){let i=t.quickEncodeToken(n);if(i)return i;let s=e[n.type.major];if(s.encodedSize){let a=s.encodedSize(n,t),c=new kc(a);if(s(c,n,t),c.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return f1(c.chunks[0])}}return m1.reset(),K3(m1,n,e,t),m1.toBytes(!0)}o(TT,"encodeCustom");function b1(r,e){return e=Object.assign({},ET,e),TT(r,D3,e)}o(b1,"encode");var MT={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Td=class{constructor(e,t={}){this.pos=0,this.data=e,this.options=t}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],t=Zn[e];if(t===void 0){let n=ye[e];if(!n)throw new Error(`${De} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;t=n(this.data,this.pos,i,this.options)}return this.pos+=t.encodedLength,t}};o(Td,"Tokeniser");var Nu=Symbol.for("DONE"),Md=Symbol.for("BREAK");function BT(r,e,t){let n=[];for(let i=0;i<r.value;i++){let s=Ou(e,t);if(s===Md){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed array`)}if(s===Nu)throw new Error(`${De} found array but not enough entries (got ${i}, expected ${r.value})`);n[i]=s}return n}o(BT,"tokenToArray");function IT(r,e,t){let n=t.useMaps===!0,i=n?void 0:{},s=n?new Map:void 0;for(let a=0;a<r.value;a++){let c=Ou(e,t);if(c===Md){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed map`)}if(c===Nu)throw new Error(`${De} found map but not enough entries (got ${a} [no key], expected ${r.value})`);if(n!==!0&&typeof c!="string")throw new Error(`${De} non-string keys not supported (got ${typeof c})`);let f=Ou(e,t);if(f===Nu)throw new Error(`${De} found map but not enough entries (got ${a} [no value], expected ${r.value})`);n?s.set(c,f):i[c]=f}return n?s:i}o(IT,"tokenToMap");function Ou(r,e){if(r.done())return Nu;let t=r.next();if(t.type===ue.break)return Md;if(t.type.terminal)return t.value;if(t.type===ue.array)return BT(t,r,e);if(t.type===ue.map)return IT(t,r,e);if(t.type===ue.tag){if(e.tags&&typeof e.tags[t.value]=="function"){let n=Ou(r,e);return e.tags[t.value](n)}throw new Error(`${De} tag not supported (${t.value})`)}throw new Error("unsupported")}o(Ou,"tokensToObject");function g1(r,e){if(!(r instanceof Uint8Array))throw new Error(`${De} data to decode must be a Uint8Array`);e=Object.assign({},MT,e);let t=e.tokenizer||new Td(r,e),n=Ou(t,e);if(n===Nu)throw new Error(`${De} did not find any content to decode`);if(n===Md)throw new Error(`${De} got unexpected break`);if(!t.done())throw new Error(`${De} too many terminals, data makes no sense`);return n}o(g1,"decode");Xi();var $3=42;function OT(r){if(r.asCID!==r)return null;let e=Ne.asCID(r);if(!e)return null;let t=new Uint8Array(e.bytes.byteLength+1);return t.set(e.bytes,1),[new we(ue.tag,$3),new we(ue.bytes,t)]}o(OT,"cidEncoder");function PT(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}o(PT,"undefinedEncoder");function RT(r){if(Number.isNaN(r))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(r===1/0||r===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}o(RT,"numberEncoder");var UT={float64:!0,typeEncoders:{Object:OT,undefined:PT,number:RT}};function LT(r){if(r[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ne.decode(r.subarray(1))}o(LT,"cidDecoder");var F3={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};F3.tags[$3]=LT;var DT="dag-cbor",y1=113,v1=o(r=>b1(r,UT),"encode"),w1=o(r=>g1(r,F3),"decode");var KT=24;function H3(r){return M(this,null,function*(){let e=yield ca({value:r,codec:cs,hasher:Wo});return{cid:e.cid,linkedBlock:e.bytes}})}o(H3,"encodePayload");function $T(r,e=KT){let t=(e-r.length%e)%e,n=new Uint8Array(r.length+t);return n.set(r,0),n}o($T,"pad");function FT(r){return M(this,null,function*(){return(yield ca({value:r,codec:cs,hasher:Lh})).cid})}o(FT,"encodeIdentityCID");function HT(r){if(r=Ne.asCID(r),r.code!==y1)throw new Error("CID codec must be dag-cbor");if(r.multihash.code!==Lh.code)throw new Error("CID must use identity multihash");return w1(r.multihash.digest)}o(HT,"decodeIdentityCID");function q3(r,e){return M(this,null,function*(){return $T((yield FT(r)).bytes,e)})}o(q3,"prepareCleartext");function z3(r){return HT(Ne.decodeFirst(r)[0])}o(z3,"decodeCleartext");var j3=Symbol("abortable"),Bd=Symbol("aborted");function V3(r,e){if(e.aborted)return Promise.reject(Bd);let t,n=new Promise((i,s)=>{t=s});return e.addEventListener("abort",()=>{t(Bd)}),Promise.race([r,n])}o(V3,"abortable");var G3=o((r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),"nanoid");var Id="utils_abort_request";var Nr;(function(r){r[r.PARSE_ERROR=-32700]="PARSE_ERROR",r[r.INVALID_REQUEST=-32600]="INVALID_REQUEST",r[r.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",r[r.INVALID_PARAMS=-32602]="INVALID_PARAMS",r[r.INTERNAL_ERROR=-32603]="INTERNAL_ERROR"})(Nr||(Nr={}));var J3={[Nr.PARSE_ERROR]:"Parse error",[Nr.INVALID_REQUEST]:"Invalid request",[Nr.METHOD_NOT_FOUND]:"Method not found",[Nr.INVALID_PARAMS]:"Invalid params",[Nr.INTERNAL_ERROR]:"Internal error"};function qT(r){return-32e3>=r&&r>=-32099}o(qT,"isServerError");function Nd(r){var e;return(e=J3[r.toString()])!=null?e:qT(r)?"Server error":"Application error"}o(Nd,"getErrorMessage");var jr=class extends Error{static fromObject(e){return new jr(e.code,e.message,e.data)}toObject(){return{code:this.code,data:this.data,message:this.message}}constructor(e,t,n){super(),Object.setPrototypeOf(this,jr.prototype),this.code=e,this.data=n,this.message=t!=null?t:Nd(e)}};o(jr,"RPCError");function Pu(r){let e=J3[r];return o(function(n){return new jr(r,e,n)},"createError")}o(Pu,"createErrorFactory");var zT=Pu(Nr.PARSE_ERROR),CK=Pu(Nr.INVALID_REQUEST),kK=Pu(Nr.METHOD_NOT_FOUND),TK=Pu(Nr.INVALID_PARAMS),MK=Pu(Nr.INTERNAL_ERROR);function jT(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(jT,"_checkPrivateRedeclaration");function VT(r,e){return e.get?e.get.call(r):e.value}o(VT,"_classApplyDescriptorGet");function GT(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(GT,"_classApplyDescriptorSet");function W3(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(W3,"_classExtractFieldDescriptor");function x1(r,e){var t=W3(r,e,"get");return VT(r,t)}o(x1,"_classPrivateFieldGet");function JT(r,e,t){jT(r,e),e.set(r,t)}o(JT,"_classPrivateFieldInit");function WT(r,e,t){var n=W3(r,e,"set");return GT(r,n,t),t}o(WT,"_classPrivateFieldSet");var Ru=new WeakMap,Ic=class{get connection(){return x1(this,Ru)}createID(){return G3()}request(e,t=void 0,n={}){let{signal:i}=n;if(i!=null&&i.aborted)return Promise.reject(Bd);let s=this.createID(),a=x1(this,Ru).send({jsonrpc:"2.0",id:s,method:e,params:t}).then(c=>{if(c==null)throw new Error("Missing response");if(c.error!=null)throw jr.fromObject(c.error);return c.result});return i==null?a:(i.addEventListener("abort",()=>{this.notify(Id,{id:s})}),V3(a,i))}notify(e,t=void 0){return M(this,null,function*(){yield x1(this,Ru).send({jsonrpc:"2.0",method:e,params:t})})}constructor(e){JT(this,Ru,{writable:!0,value:void 0}),WT(this,Ru,e)}};o(Ic,"RPCClient");function Y3(r,e){return{jsonrpc:"2.0",id:r,error:{code:e,message:Nd(e)}}}o(Y3,"createErrorResponse");function YT(r,e,t){console.warn("Unhandled handler error",e,t)}o(YT,"fallbackOnHandlerError");function XT(r,e){console.warn("Unhandled invalid message",e)}o(XT,"fallbackOnInvalidMessage");function ZT(r,e){console.warn("Unhandled notification",e)}o(ZT,"fallbackOnNotification");function X3(r,e={}){var c,f,l;let t=(c=e.onHandlerError)!=null?c:YT,n=(f=e.onInvalidMessage)!=null?f:XT,i=(l=e.onNotification)!=null?l:ZT,s={};function a(h,d){var v,x;if(d.method===Id){let y=(v=d.params)==null?void 0:v.id;y!=null&&((x=s[y])==null||x.abort())}else i(h,d)}return o(a,"handleNotification"),o(function(d,v){return M(this,null,function*(){var _,U,E;let x=v.id;if(v.jsonrpc!=="2.0"||v.method==null)return x==null?(n(d,v),null):Y3(x,Nr.INVALID_REQUEST);let y=r[v.method];if(y==null)return x==null?(a(d,v),null):Y3(x,Nr.METHOD_NOT_FOUND);try{let L;if(x!=null&&y[j3]){let F=new AbortController;s[x]=F,L=y(d,v.params,{signal:F.signal})}else L=y(d,v.params,{});let H=L==null?L:typeof L.then=="function"?yield L:L;return x==null||((_=s[x])==null?void 0:_.signal.aborted)?null:{jsonrpc:"2.0",id:x,result:H}}catch(L){if(x==null||((U=s[x])==null?void 0:U.signal.aborted))return t(d,v,L),null;let H;if(L instanceof jr)H=L.toObject();else{t(d,v,L);let F=(E=L.code)!=null?E:-32e3;H={code:F,message:L.message||Nd(F)}}return{jsonrpc:"2.0",id:x,error:H}}finally{x!=null&&delete s[x]}})},"handleRequest")}o(X3,"createHandler");Xi();var C5=ze(Hx(),1),Ar=ze(da(),1);function B1(){return B1=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},B1.apply(this,arguments)}o(B1,"_extends");var I1={name:"chainId",regex:"[-:a-zA-Z0-9]{5,41}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"}}}},gM={name:"accountId",regex:"[-:a-zA-Z0-9]{7,106}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"},2:{name:"address",regex:"[a-zA-Z0-9]{1,64}"}}}},N1={name:"assetName",regex:"[-:a-zA-Z0-9]{5,73}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,64}"}}}},yM={name:"assetType",regex:"[-:a-zA-Z0-9]{11,115}",parameters:{delimiter:"/",values:{0:I1,1:N1}}},vM={name:"assetId",regex:"[-:a-zA-Z0-9]{13,148}",parameters:{delimiter:"/",values:{0:I1,1:N1,2:{name:"tokenId",regex:"[-a-zA-Z0-9]{1,32}"}}}},$u={"2":I1,"10":gM,"19":{assetName:N1,assetType:yM,assetId:vM}};function qx(r,e){return r.split(e.parameters.delimiter)}o(qx,"splitParams");function Fu(r,e){var t=qx(r,e),n={};return t.forEach(function(i,s){n[e.parameters.values[s].name]=i}),n}o(Fu,"getParams");function Uc(r,e){return Object.values(e.parameters.values).map(function(t){var n=r[t.name];return typeof n=="string"?n:Uc(n,t)}).join(e.parameters.delimiter)}o(Uc,"joinParams");function Hu(r,e){if(!new RegExp(e.regex).test(r))return!1;var t=qx(r,e);if(t.length!==Object.keys(e.parameters.values).length)return!1;var n=t.map(function(i,s){return new RegExp(e.parameters.values[s].regex).test(i)}).filter(function(i){return!!i});return n.length===t.length}o(Hu,"isValidId");var vo=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}o(r,"ChainId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();vo.spec=$u["2"];var pa=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.address=t.address}o(r,"AccountId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);var i=Fu(n,this.spec),s=i.namespace,a=i.reference,c=i.address,f=new vo({namespace:s,reference:a});return new r({chainId:f,address:c}).toJSON()},"parse"),r.format=o(function(n){var i=new vo(n.chainId),s=B1({},i.toJSON(),{address:n.address});return Uc(s,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),address:this.address}},"toJSON"),r}();pa.spec=$u["10"];var O1=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}o(r,"AssetName"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();O1.spec=$u["19"].assetName;var wM=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.assetName=new O1(t.assetName)}o(r,"AssetType"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName}},"toJSON"),r}();wM.spec=$u["19"].assetType;var xM=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.assetName=new O1(t.assetName),this.tokenId=t.tokenId}o(r,"AssetId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName.toJSON(),tokenId:this.tokenId}},"toJSON"),r}();xM.spec=$u["19"].assetId;var zx="logger/5.6.0";var jx=!1,Vx=!1,Dd={debug:1,default:2,info:2,warning:3,error:4,off:5},Gx=Dd.default,P1=null;function _M(){try{let r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(t){r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}o(_M,"_checkNormalize");var Jx=_M(),R1;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(R1||(R1={}));var ei;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(ei||(ei={}));var Wx="0123456789abcdef",He=class{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){let n=e.toLowerCase();Dd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Gx>Dd[n])&&console.log.apply(console,t)}debug(...e){this._log(He.levels.DEBUG,e)}info(...e){this._log(He.levels.INFO,e)}warn(...e){this._log(He.levels.WARNING,e)}makeError(e,t,n){if(Vx)return this.makeError("censored error",t,{});t||(t=He.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(f=>{let l=n[f];try{if(l instanceof Uint8Array){let h="";for(let d=0;d<l.length;d++)h+=Wx[l[d]>>4],h+=Wx[l[d]&15];i.push(f+"=Uint8Array(0x"+h+")")}else i.push(f+"="+JSON.stringify(l))}catch(h){i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);let s=e,a="";switch(t){case ei.NUMERIC_FAULT:{a="NUMERIC_FAULT";let f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":a+="-"+f;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case ei.CALL_EXCEPTION:case ei.INSUFFICIENT_FUNDS:case ei.MISSING_NEW:case ei.NONCE_EXPIRED:case ei.REPLACEMENT_UNDERPRICED:case ei.TRANSACTION_REPLACED:case ei.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let c=new Error(e);return c.reason=s,c.code=t,Object.keys(n).forEach(function(f){c[f]=n[f]}),c}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,He.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,i){e||this.throwError(t,n,i)}assertArgument(e,t,n,i){e||this.throwArgumentError(t,n,i)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),Jx&&this.throwError("platform missing String.prototype.normalize",He.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Jx})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n?n=": "+n:n="",e<t&&this.throwError("missing argument"+n,He.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,He.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",He.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return P1||(P1=new He(zx)),P1}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),jx){if(!e)return;this.globalLogger().throwError("error censorship permanent",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Vx=!!e,jx=!!t}static setLogLevel(e){let t=Dd[e.toLowerCase()];if(t==null){He.globalLogger().warn("invalid log level - "+e);return}Gx=t}static from(e){return new He(e)}};o(He,"Logger");He.errors=ei;He.levels=R1;var Yx="bytes/5.6.1";var Kt=new He(Yx);function Zx(r){return!!r.toHexString}o(Zx,"isHexable");function Lc(r){return r.slice||(r.slice=function(){let e=Array.prototype.slice.call(arguments);return Lc(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}o(Lc,"addSlice");function Qx(r){return ti(r)&&!(r.length%2)||L1(r)}o(Qx,"isBytesLike");function Xx(r){return typeof r=="number"&&r==r&&r%1===0}o(Xx,"isInteger");function L1(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!Xx(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){let t=r[e];if(!Xx(t)||t<0||t>=256)return!1}return!0}o(L1,"isBytes");function kt(r,e){if(e||(e={}),typeof r=="number"){Kt.checkSafeUint53(r,"invalid arrayify value");let t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),Lc(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Zx(r)&&(r=r.toHexString()),ti(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Kt.throwArgumentError("hex data is odd-length","value",r));let n=[];for(let i=0;i<t.length;i+=2)n.push(parseInt(t.substring(i,i+2),16));return Lc(new Uint8Array(n))}return L1(r)?Lc(new Uint8Array(r)):Kt.throwArgumentError("invalid arrayify value","value",r)}o(kt,"arrayify");function D1(r){let e=r.map(i=>kt(i)),t=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(t);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Lc(n)}o(D1,"concat");function AM(r,e){r=kt(r),r.length>e&&Kt.throwArgumentError("value out of range","value",arguments[0]);let t=new Uint8Array(e);return t.set(r,e-r.length),Lc(t)}o(AM,"zeroPad");function ti(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}o(ti,"isHexString");var U1="0123456789abcdef";function xr(r,e){if(e||(e={}),typeof r=="number"){Kt.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=U1[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Zx(r))return r.toHexString();if(ti(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":Kt.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(L1(r)){let t="0x";for(let n=0;n<r.length;n++){let i=r[n];t+=U1[(i&240)>>4]+U1[i&15]}return t}return Kt.throwArgumentError("invalid hexlify value","value",r)}o(xr,"hexlify");function Kd(r){if(typeof r!="string")r=xr(r);else if(!ti(r)||r.length%2)return null;return(r.length-2)/2}o(Kd,"hexDataLength");function $d(r,e,t){return typeof r!="string"?r=xr(r):(!ti(r)||r.length%2)&&Kt.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}o($d,"hexDataSlice");function wo(r,e){for(typeof r!="string"?r=xr(r):ti(r)||Kt.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&Kt.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}o(wo,"hexZeroPad");function Fd(r){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Qx(r)){let t=kt(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=xr(t.slice(0,32)),e.s=xr(t.slice(32,64))):t.length===65?(e.r=xr(t.slice(0,32)),e.s=xr(t.slice(32,64)),e.v=t[64]):Kt.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:Kt.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=xr(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){let i=AM(kt(e._vs),32);e._vs=xr(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Kt.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),i[0]&=127;let a=xr(i);e.s==null?e.s=a:e.s!==a&&Kt.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?Kt.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Kt.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!ti(e.r)?Kt.throwArgumentError("signature missing or invalid r","signature",r):e.r=wo(e.r,32),e.s==null||!ti(e.s)?Kt.throwArgumentError("signature missing or invalid s","signature",r):e.s=wo(e.s,32);let t=kt(e.s);t[0]>=128&&Kt.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);let n=xr(t);e._vs&&(ti(e._vs)||Kt.throwArgumentError("signature invalid _vs","signature",r),e._vs=wo(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Kt.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}o(Fd,"splitSignature");var t5=ze(_n());var e5="bignumber/5.6.0";var EM=t5.default.BN,x$=new He(e5);function K1(r){return new EM(r,36).toString(16)}o(K1,"_base36To16");var r5=ze(sm());function Dc(r){return"0x"+r5.default.keccak_256(kt(r))}o(Dc,"keccak256");var n5="address/5.6.0";var qu=new He(n5);function i5(r){ti(r,20)||qu.throwArgumentError("invalid address","address",r),r=r.toLowerCase();let e=r.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);let n=kt(Dc(t));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}o(i5,"getChecksumAddress");var kM=9007199254740991;function TM(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}o(TM,"log10");var $1={};for(let r=0;r<10;r++)$1[String(r)]=String(r);for(let r=0;r<26;r++)$1[String.fromCharCode(65+r)]=String(10+r);var s5=Math.floor(TM(kM));function MM(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(n=>$1[n]).join("");for(;e.length>=s5;){let n=e.substring(0,s5);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}o(MM,"ibanChecksum");function o5(r){let e=null;if(typeof r!="string"&&qu.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=i5(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&qu.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==MM(r)&&qu.throwArgumentError("bad icap checksum","address",r),e=K1(r.substring(4));e.length<40;)e="0"+e;e=i5("0x"+e)}else qu.throwArgumentError("invalid address","address",r);return e}o(o5,"getAddress");var a5="properties/5.6.0";var D$=new He(a5);function Kc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}o(Kc,"defineReadOnly");var c5="strings/5.6.0";var f5=new He(c5),zu;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(zu||(zu={}));var ma;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(ma||(ma={}));function BM(r,e,t,n,i){return f5.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}o(BM,"errorFunc");function u5(r,e,t,n,i){if(r===ma.BAD_PREFIX||r===ma.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===ma.OVERRUN?t.length-e-1:0}o(u5,"ignoreFunc");function IM(r,e,t,n,i){return r===ma.OVERLONG?(n.push(i),0):(n.push(65533),u5(r,e,t,n,i))}o(IM,"replaceFunc");var NM=Object.freeze({error:BM,ignore:u5,replace:IM});function ju(r,e=zu.current){e!=zu.current&&(f5.checkNormalize(),r=r.normalize(e));let t=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192),t.push(i&63|128);else if((i&64512)==55296){n++;let s=r.charCodeAt(n);if(n>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let a=65536+((i&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return kt(t)}o(ju,"toUtf8Bytes");var l5=`Ethereum Signed Message:
|
660
|
+
`;function F1(r){return typeof r=="string"&&(r=ju(r)),Dc(D1([ju(l5),ju(String(r.length)),r]))}o(F1,"hashMessage");var Ke=ze(_n()),ki=ze(vu());function $c(r,e,t){return t={path:e,exports:{},require:function(n,i){return OM(n,i==null?t.path:i)}},r(t,t.exports),t.exports}o($c,"createCommonjsModule");function OM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}o(OM,"commonjsRequire");var j1=d5;function d5(r,e){if(!r)throw new Error(e||"Assertion failed")}o(d5,"assert");d5.equal=o(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual");var ri=$c(function(r,e){"use strict";var t=e;function n(a,c){if(Array.isArray(a))return a.slice();if(!a)return[];var f=[];if(typeof a!="string"){for(var l=0;l<a.length;l++)f[l]=a[l]|0;return f}if(c==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var l=0;l<a.length;l+=2)f.push(parseInt(a[l]+a[l+1],16))}else for(var l=0;l<a.length;l++){var h=a.charCodeAt(l),d=h>>8,v=h&255;d?f.push(d,v):f.push(v)}return f}o(n,"toArray"),t.toArray=n;function i(a){return a.length===1?"0"+a:a}o(i,"zero2"),t.zero2=i;function s(a){for(var c="",f=0;f<a.length;f++)c+=i(a[f].toString(16));return c}o(s,"toHex"),t.toHex=s,t.encode=o(function(c,f){return f==="hex"?s(c):c},"encode")}),fn=$c(function(r,e){"use strict";var t=e;t.assert=j1,t.toArray=ri.toArray,t.zero2=ri.zero2,t.toHex=ri.toHex,t.encode=ri.encode;function n(f,l,h){var d=new Array(Math.max(f.bitLength(),h)+1);d.fill(0);for(var v=1<<l+1,x=f.clone(),y=0;y<d.length;y++){var _,U=x.andln(v-1);x.isOdd()?(U>(v>>1)-1?_=(v>>1)-U:_=U,x.isubn(_)):_=0,d[y]=_,x.iushrn(1)}return d}o(n,"getNAF"),t.getNAF=n;function i(f,l){var h=[[],[]];f=f.clone(),l=l.clone();for(var d=0,v=0,x;f.cmpn(-d)>0||l.cmpn(-v)>0;){var y=f.andln(3)+d&3,_=l.andln(3)+v&3;y===3&&(y=-1),_===3&&(_=-1);var U;(y&1)===0?U=0:(x=f.andln(7)+d&7,(x===3||x===5)&&_===2?U=-y:U=y),h[0].push(U);var E;(_&1)===0?E=0:(x=l.andln(7)+v&7,(x===3||x===5)&&y===2?E=-_:E=_),h[1].push(E),2*d===U+1&&(d=1-d),2*v===E+1&&(v=1-v),f.iushrn(1),l.iushrn(1)}return h}o(i,"getJSF"),t.getJSF=i;function s(f,l,h){var d="_"+l;f.prototype[l]=o(function(){return this[d]!==void 0?this[d]:this[d]=h.call(this)},"cachedProperty")}o(s,"cachedProperty"),t.cachedProperty=s;function a(f){return typeof f=="string"?t.toArray(f,"hex"):f}o(a,"parseBytes"),t.parseBytes=a;function c(f){return new Ke.default(f,"hex","le")}o(c,"intFromLE"),t.intFromLE=c}),zd=fn.getNAF,PM=fn.getJSF,jd=fn.assert;function _o(r,e){this.type=r,this.p=new Ke.default(e.p,16),this.red=e.prime?Ke.default.red(e.prime):Ke.default.mont(this.p),this.zero=new Ke.default(0).toRed(this.red),this.one=new Ke.default(1).toRed(this.red),this.two=new Ke.default(2).toRed(this.red),this.n=e.n&&new Ke.default(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(_o,"BaseCurve");var ba=_o;_o.prototype.point=o(function(){throw new Error("Not implemented")},"point");_o.prototype.validate=o(function(){throw new Error("Not implemented")},"validate");_o.prototype._fixedNafMul=o(function(e,t){jd(e.precomputed);var n=e._getDoubles(),i=zd(t,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var a=[],c,f;for(c=0;c<i.length;c+=n.step){f=0;for(var l=c+n.step-1;l>=c;l--)f=(f<<1)+i[l];a.push(f)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),v=s;v>0;v--){for(c=0;c<a.length;c++)f=a[c],f===v?d=d.mixedAdd(n.points[c]):f===-v&&(d=d.mixedAdd(n.points[c].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");_o.prototype._wnafMul=o(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var s=i.points,a=zd(t,n,this._bitLength),c=this.jpoint(null,null,null),f=a.length-1;f>=0;f--){for(var l=0;f>=0&&a[f]===0;f--)l++;if(f>=0&&l++,c=c.dblp(l),f<0)break;var h=a[f];jd(h!==0),e.type==="affine"?h>0?c=c.mixedAdd(s[h-1>>1]):c=c.mixedAdd(s[-h-1>>1].neg()):h>0?c=c.add(s[h-1>>1]):c=c.add(s[-h-1>>1].neg())}return e.type==="affine"?c.toP():c},"_wnafMul");_o.prototype._wnafMulAdd=o(function(e,t,n,i,s){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h,d,v;for(h=0;h<i;h++){v=t[h];var x=v._getNAFPoints(e);a[h]=x.wnd,c[h]=x.points}for(h=i-1;h>=1;h-=2){var y=h-1,_=h;if(a[y]!==1||a[_]!==1){f[y]=zd(n[y],a[y],this._bitLength),f[_]=zd(n[_],a[_],this._bitLength),l=Math.max(f[y].length,l),l=Math.max(f[_].length,l);continue}var U=[t[y],null,null,t[_]];t[y].y.cmp(t[_].y)===0?(U[1]=t[y].add(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg())):t[y].y.cmp(t[_].y.redNeg())===0?(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].add(t[_].neg())):(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],L=PM(n[y],n[_]);for(l=Math.max(L[0].length,l),f[y]=new Array(l),f[_]=new Array(l),d=0;d<l;d++){var H=L[0][d]|0,F=L[1][d]|0;f[y][d]=E[(H+1)*3+(F+1)],f[_][d]=0,c[y]=U}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var R=!0;for(d=0;d<i;d++)D[d]=f[d][h]|0,D[d]!==0&&(R=!1);if(!R)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?v=c[d][Y-1>>1]:Y<0&&(v=c[d][-Y-1>>1].neg()),v.type==="affine"?j=j.mixedAdd(v):j=j.add(v))}}for(h=0;h<i;h++)c[h]=null;return s?j:j.toP()},"_wnafMulAdd");function In(r,e){this.curve=r,this.type=e,this.precomputed=null}o(In,"BasePoint");_o.BasePoint=In;In.prototype.eq=o(function(){throw new Error("Not implemented")},"eq");In.prototype.validate=o(function(){return this.curve.validate(this)},"validate");_o.prototype.decodePoint=o(function(e,t){e=fn.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?jd(e[e.length-1]%2===0):e[0]===7&&jd(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");In.prototype.encodeCompressed=o(function(e){return this.encode(e,!0)},"encodeCompressed");In.prototype._encode=o(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");In.prototype.encode=o(function(e,t){return fn.encode(this._encode(t),e)},"encode");In.prototype.precompute=o(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");In.prototype._hasDoubles=o(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");In.prototype._getDoubles=o(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");In.prototype._getNAFPoints=o(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),s=1;s<n;s++)t[s]=t[s-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");In.prototype._getBeta=o(function(){return null},"_getBeta");In.prototype.dblp=o(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp");var V1=$c(function(r){typeof Object.create=="function"?r.exports=o(function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):r.exports=o(function(t,n){if(n){t.super_=n;var i=o(function(){},"TempCtor");i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}},"inherits")}),RM=fn.assert;function Nn(r){ba.call(this,"short",r),this.a=new Ke.default(r.a,16).toRed(this.red),this.b=new Ke.default(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}o(Nn,"ShortCurve");V1(Nn,ba);var UM=Nn;Nn.prototype._getEndomorphism=o(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Ke.default(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new Ke.default(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?n=s[0]:(n=s[1],RM(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(c){return{a:new Ke.default(c.a,16),b:new Ke.default(c.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");Nn.prototype._getEndoRoots=o(function(e){var t=e===this.p?this.red:Ke.default.mont(e),n=new Ke.default(2).toRed(t).redInvm(),i=n.redNeg(),s=new Ke.default(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[a,c]},"_getEndoRoots");Nn.prototype._getEndoBasis=o(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new Ke.default(1),a=new Ke.default(0),c=new Ke.default(0),f=new Ke.default(1),l,h,d,v,x,y,_,U=0,E,L;n.cmpn(0)!==0;){var H=i.div(n);E=i.sub(H.mul(n)),L=c.sub(H.mul(s));var F=f.sub(H.mul(a));if(!d&&E.cmp(t)<0)l=_.neg(),h=s,d=E.neg(),v=L;else if(d&&++U===2)break;_=E,i=n,n=E,c=s,s=L,f=a,a=F}x=E.neg(),y=L;var j=d.sqr().add(v.sqr()),D=x.sqr().add(y.sqr());return D.cmp(j)>=0&&(x=l,y=h),d.negative&&(d=d.neg(),v=v.neg()),x.negative&&(x=x.neg(),y=y.neg()),[{a:d,b:v},{a:x,b:y}]},"_getEndoBasis");Nn.prototype._endoSplit=o(function(e){var t=this.endo.basis,n=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),f=a.mul(i.a),l=s.mul(n.b),h=a.mul(i.b),d=e.sub(c).sub(f),v=l.add(h).neg();return{k1:d,k2:v}},"_endoSplit");Nn.prototype.pointFromX=o(function(e,t){e=new Ke.default(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");Nn.prototype.validate=o(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate");Nn.prototype._endoWnafMulAdd=o(function(e,t,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var c=this._endoSplit(t[a]),f=e[a],l=f._getBeta();c.k1.negative&&(c.k1.ineg(),f=f.neg(!0)),c.k2.negative&&(c.k2.ineg(),l=l.neg(!0)),i[a*2]=f,i[a*2+1]=l,s[a*2]=c.k1,s[a*2+1]=c.k2}for(var h=this._wnafMulAdd(1,i,s,a*2,n),d=0;d<a*2;d++)i[d]=null,s[d]=null;return h},"_endoWnafMulAdd");function rr(r,e,t,n){ba.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ke.default(e,16),this.y=new Ke.default(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(rr,"Point");V1(rr,ba.BasePoint);Nn.prototype.point=o(function(e,t,n){return new rr(this,e,t,n)},"point");Nn.prototype.pointFromJSON=o(function(e,t){return rr.fromJSON(this,e,t)},"pointFromJSON");rr.prototype._getBeta=o(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");rr.prototype.toJSON=o(function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},"toJSON");rr.fromJSON=o(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function s(c){return e.point(c[0],c[1],n)}o(s,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},"fromJSON");rr.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");rr.prototype.isInfinity=o(function(){return this.inf},"isInfinity");rr.prototype.add=o(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");rr.prototype.dbl=o(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},"dbl");rr.prototype.getX=o(function(){return this.x.fromRed()},"getX");rr.prototype.getY=o(function(){return this.y.fromRed()},"getY");rr.prototype.mul=o(function(e){return e=new Ke.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");rr.prototype.mulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},"mulAdd");rr.prototype.jmulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},"jmulAdd");rr.prototype.eq=o(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");rr.prototype.neg=o(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=o(function(s){return s.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");rr.prototype.toJ=o(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function hr(r,e,t,n){ba.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ke.default(0)):(this.x=new Ke.default(e,16),this.y=new Ke.default(t,16),this.z=new Ke.default(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(hr,"JPoint");V1(hr,ba.BasePoint);Nn.prototype.jpoint=o(function(e,t,n){return new hr(this,e,t,n)},"jpoint");hr.prototype.toP=o(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");hr.prototype.neg=o(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");hr.prototype.add=o(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),f=i.redSub(s),l=a.redSub(c);if(f.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),d=h.redMul(f),v=i.redMul(h),x=l.redSqr().redIAdd(d).redISub(v).redISub(v),y=l.redMul(v.redISub(x)).redISub(a.redMul(d)),_=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(x,y,_)},"add");hr.prototype.mixedAdd=o(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),c=n.redSub(i),f=s.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),h=l.redMul(c),d=n.redMul(l),v=f.redSqr().redIAdd(h).redISub(d).redISub(d),x=f.redMul(d.redISub(v)).redISub(s.redMul(h)),y=this.z.redMul(c);return this.curve.jpoint(v,x,y)},"mixedAdd");hr.prototype.dblp=o(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,s=this.curve.tinv,a=this.x,c=this.y,f=this.z,l=f.redSqr().redSqr(),h=c.redAdd(c);for(t=0;t<e;t++){var d=a.redSqr(),v=h.redSqr(),x=v.redSqr(),y=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),_=a.redMul(v),U=y.redSqr().redISub(_.redAdd(_)),E=_.redISub(U),L=y.redMul(E);L=L.redIAdd(L).redISub(x);var H=h.redMul(f);t+1<e&&(l=l.redMul(x)),a=U,f=H,h=L}return this.curve.jpoint(a,h.redMul(s),f)},"dblp");hr.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");hr.prototype._zeroDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i),l=f.redSqr().redISub(c).redISub(c),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),v=this.y.redSqr(),x=v.redSqr(),y=this.x.redAdd(v).redSqr().redISub(d).redISub(x);y=y.redIAdd(y);var _=d.redAdd(d).redIAdd(d),U=_.redSqr(),E=x.redIAdd(x);E=E.redIAdd(E),E=E.redIAdd(E),e=U.redISub(y).redISub(y),t=_.redMul(y.redISub(e)).redISub(E),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");hr.prototype._threeDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=f.redSqr().redISub(c).redISub(c);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),v=this.y.redSqr(),x=this.x.redMul(v),y=this.x.redSub(d).redMul(this.x.redAdd(d));y=y.redAdd(y).redIAdd(y);var _=x.redIAdd(x);_=_.redIAdd(_);var U=_.redAdd(_);e=y.redSqr().redISub(U),n=this.y.redAdd(this.z).redSqr().redISub(v).redISub(d);var E=v.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E),t=y.redMul(_.redISub(e)).redISub(E)}return this.curve.jpoint(e,t,n)},"_threeDbl");hr.prototype._dbl=o(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,s=i.redSqr().redSqr(),a=t.redSqr(),c=n.redSqr(),f=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(c),d=f.redSqr().redISub(h.redAdd(h)),v=h.redISub(d),x=c.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=f.redMul(v).redISub(x),_=n.redAdd(n).redMul(i);return this.curve.jpoint(d,y,_)},"_dbl");hr.prototype.trpl=o(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),c=this.x.redAdd(t).redSqr().redISub(e).redISub(i);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(a);var f=c.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=s.redIAdd(c).redSqr().redISub(a).redISub(f).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var v=this.x.redMul(f).redISub(d);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.y.redMul(h.redMul(l.redISub(h)).redISub(c.redMul(f)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=this.z.redAdd(c).redSqr().redISub(n).redISub(f);return this.curve.jpoint(v,x,y)},"trpl");hr.prototype.mul=o(function(e,t){return e=new Ke.default(e,t),this.curve._wnafMul(this,e)},"mul");hr.prototype.eq=o(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),s=n.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");hr.prototype.eqXToP=o(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP");hr.prototype.inspect=o(function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},"inspect");hr.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity");var Hd=$c(function(r,e){"use strict";var t=e;t.base=ba,t.short=UM,t.mont=null,t.edwards=null}),qd=$c(function(r,e){"use strict";var t=e,n=fn.assert;function i(c){c.type==="short"?this.curve=new Hd.short(c):c.type==="edwards"?this.curve=new Hd.edwards(c):this.curve=new Hd.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(i,"PresetCurve"),t.PresetCurve=i;function s(c,f){Object.defineProperty(t,c,{configurable:!0,enumerable:!0,get:function(){var l=new i(f);return Object.defineProperty(t,c,{configurable:!0,enumerable:!0,value:l}),l}})}o(s,"defineCurve"),s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ki.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ki.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ki.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ki.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ki.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ki.default.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ki.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch(c){a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ki.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function xo(r){if(!(this instanceof xo))return new xo(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ri.toArray(r.entropy,r.entropyEnc||"hex"),t=ri.toArray(r.nonce,r.nonceEnc||"hex"),n=ri.toArray(r.pers,r.persEnc||"hex");j1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}o(xo,"HmacDRBG");var p5=xo;xo.prototype._init=o(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");xo.prototype._hmac=o(function(){return new ki.default.hmac(this.hash,this.K)},"hmac");xo.prototype._update=o(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");xo.prototype.reseed=o(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=ri.toArray(e,t),n=ri.toArray(n,i),j1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");xo.prototype.generate=o(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=ri.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(n),this._reseed++,ri.encode(a,t)},"generate");var z1=fn.assert;function _r(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}o(_r,"KeyPair");var G1=_r;_r.fromPublic=o(function(e,t,n){return t instanceof _r?t:new _r(e,{pub:t,pubEnc:n})},"fromPublic");_r.fromPrivate=o(function(e,t,n){return t instanceof _r?t:new _r(e,{priv:t,privEnc:n})},"fromPrivate");_r.prototype.validate=o(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");_r.prototype.getPublic=o(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");_r.prototype.getPrivate=o(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");_r.prototype._importPrivate=o(function(e,t){this.priv=new Ke.default(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");_r.prototype._importPublic=o(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?z1(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&z1(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");_r.prototype.derive=o(function(e){return e.validate()||z1(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");_r.prototype.sign=o(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");_r.prototype.verify=o(function(e,t){return this.ec.verify(e,t,this)},"verify");_r.prototype.inspect=o(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect");var LM=fn.assert;function Vd(r,e){if(r instanceof Vd)return r;this._importDER(r,e)||(LM(r.r&&r.s,"Signature without r or s"),this.r=new Ke.default(r.r,16),this.s=new Ke.default(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}o(Vd,"Signature");var Gd=Vd;function DM(){this.place=0}o(DM,"Position");function H1(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s<n;s++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}o(H1,"getLength");function h5(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}o(h5,"rmPadding");Vd.prototype._importDER=o(function(e,t){e=fn.toArray(e,t);var n=new DM;if(e[n.place++]!==48)return!1;var i=H1(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var s=H1(e,n);if(s===!1)return!1;var a=e.slice(n.place,s+n.place);if(n.place+=s,e[n.place++]!==2)return!1;var c=H1(e,n);if(c===!1||e.length!==c+n.place)return!1;var f=e.slice(n.place,c+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;return this.r=new Ke.default(a),this.s=new Ke.default(f),this.recoveryParam=null,!0},"_importDER");function q1(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}o(q1,"constructLength");Vd.prototype.toDER=o(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=h5(t),n=h5(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];q1(i,t.length),i=i.concat(t),i.push(2),q1(i,n.length);var s=i.concat(n),a=[48];return q1(a,s.length),a=a.concat(s),fn.encode(a,e)},"toDER");var KM=o(function(){throw new Error("unsupported")},"rand"),m5=fn.assert;function Bn(r){if(!(this instanceof Bn))return new Bn(r);typeof r=="string"&&(m5(Object.prototype.hasOwnProperty.call(qd,r),"Unknown curve "+r),r=qd[r]),r instanceof qd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}o(Bn,"EC");var $M=Bn;Bn.prototype.keyPair=o(function(e){return new G1(this,e)},"keyPair");Bn.prototype.keyFromPrivate=o(function(e,t){return G1.fromPrivate(this,e,t)},"keyFromPrivate");Bn.prototype.keyFromPublic=o(function(e,t){return G1.fromPublic(this,e,t)},"keyFromPublic");Bn.prototype.genKeyPair=o(function(e){e||(e={});for(var t=new p5({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||KM(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Ke.default(2));;){var s=new Ke.default(t.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair");Bn.prototype._truncateToN=o(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Bn.prototype.sign=o(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Ke.default(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),f=new p5({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Ke.default(1)),h=0;;h++){var d=i.k?i.k(h):new Ke.default(f.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var v=this.g.mul(d);if(!v.isInfinity()){var x=v.getX(),y=x.umod(this.n);if(y.cmpn(0)!==0){var _=d.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),_.cmpn(0)!==0){var U=(v.getY().isOdd()?1:0)|(x.cmp(y)!==0?2:0);return i.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),U^=1),new Gd({r:y,s:_,recoveryParam:U})}}}}}},"sign");Bn.prototype.verify=o(function(e,t,n,i){e=this._truncateToN(new Ke.default(e,16)),n=this.keyFromPublic(n,i),t=new Gd(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(e).umod(this.n),l=c.mul(s).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(s)):(h=this.g.mulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(s)===0)},"verify");Bn.prototype.recoverPubKey=function(r,e,t,n){m5((3&t)===t,"The recovery param is more than two bits"),e=new Gd(e,n);var i=this.n,s=new Ke.default(r),a=e.r,c=e.s,f=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var h=e.r.invm(i),d=i.sub(s).mul(h).umod(i),v=c.mul(h).umod(i);return this.g.mulAdd(d,a,v)};Bn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new Gd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(r,e,i)}catch(a){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var FM=$c(function(r,e){"use strict";var t=e;t.version="6.5.4",t.utils=fn,t.rand=function(){throw new Error("unsupported")},t.curve=Hd,t.curves=qd,t.ec=$M,t.eddsa=null}),b5=FM.ec;var g5="signing-key/5.6.1";var W1=new He(g5),J1=null;function Ti(){return J1||(J1=new b5("secp256k1")),J1}o(Ti,"getCurve");var Jd=class{constructor(e){Kc(this,"curve","secp256k1"),Kc(this,"privateKey",xr(e)),Kd(this.privateKey)!==32&&W1.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=Ti().keyFromPrivate(kt(this.privateKey));Kc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Kc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Kc(this,"_isSigningKey",!0)}_addPoint(e){let t=Ti().keyFromPublic(kt(this.publicKey)),n=Ti().keyFromPublic(kt(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let t=Ti().keyFromPrivate(kt(this.privateKey)),n=kt(e);n.length!==32&&W1.throwArgumentError("bad digest length","digest",e);let i=t.sign(n,{canonical:!0});return Fd({recoveryParam:i.recoveryParam,r:wo("0x"+i.r.toString(16),32),s:wo("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let t=Ti().keyFromPrivate(kt(this.privateKey)),n=Ti().keyFromPublic(kt(Y1(e)));return wo("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};o(Jd,"SigningKey");function y5(r,e){let t=Fd(e),n={r:kt(t.r),s:kt(t.s)};return"0x"+Ti().recoverPubKey(kt(r),n,t.recoveryParam).encode("hex",!1)}o(y5,"recoverPublicKey");function Y1(r,e){let t=kt(r);if(t.length===32){let n=new Jd(t);return e?"0x"+Ti().keyFromPrivate(t).getPublic(!0,"hex"):n.publicKey}else{if(t.length===33)return e?xr(t):"0x"+Ti().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ti().keyFromPublic(t).getPublic(!0,"hex"):xr(t)}return W1.throwArgumentError("invalid public or private key","key","[REDACTED]")}o(Y1,"computePublicKey");var v5="transactions/5.6.0";var yF=new He(v5),w5;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(w5||(w5={}));function x5(r){let e=Y1(r);return o5($d(Dc($d(e,1)),12))}o(x5,"computeAddress");function _5(r,e){return x5(y5(kt(r),e))}o(_5,"recoverAddress");var A5="wallet/5.6.0";var kF=new He(A5);function E5(r,e){return _5(F1(r),e)}o(E5,"verifyMessage");hu();var HM=`
|
661
|
+
sign-in-with-ethereum =
|
662
|
+
domain %s" wants you to sign in with your Ethereum account:" LF
|
663
|
+
address LF
|
664
|
+
LF
|
665
|
+
[ statement LF ]
|
666
|
+
LF
|
667
|
+
%s"URI: " URI LF
|
668
|
+
%s"Version: " version LF
|
669
|
+
%s"Nonce: " nonce LF
|
670
|
+
%s"Issued At: " issued-at
|
671
|
+
[ LF %s"Expiration Time: " expiration-time ]
|
672
|
+
[ LF %s"Not Before: " not-before ]
|
673
|
+
[ LF %s"Request ID: " request-id ]
|
674
|
+
[ LF %s"Chain ID: " chain-id ]
|
675
|
+
[ LF %s"Resources:"
|
676
|
+
resources ]
|
677
|
+
|
678
|
+
domain = dnsauthority
|
679
|
+
|
680
|
+
address = "0x" 40*40HEXDIG
|
681
|
+
; Must also conform to captilization
|
682
|
+
; checksum encoding specified in EIP-55
|
683
|
+
; where applicable (EOAs).
|
684
|
+
|
685
|
+
statement = *( reserved / unreserved / " " )
|
686
|
+
; The purpose is to exclude LF (line breaks).
|
687
|
+
|
688
|
+
version = "1"
|
689
|
+
|
690
|
+
nonce = 8*( ALPHA / DIGIT )
|
691
|
+
|
692
|
+
issued-at = date-time
|
693
|
+
expiration-time = date-time
|
694
|
+
not-before = date-time
|
695
|
+
|
696
|
+
request-id = *pchar
|
697
|
+
|
698
|
+
chain-id = 1*DIGIT
|
699
|
+
; See EIP-155 for valid CHAIN_IDs.
|
700
|
+
|
701
|
+
resources = *( LF resource )
|
702
|
+
|
703
|
+
resource = "- " URI
|
704
|
+
|
705
|
+
; ------------------------------------------------------------------------------
|
706
|
+
; RFC 3986
|
707
|
+
|
708
|
+
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
709
|
+
|
710
|
+
hier-part = "//" authority path-abempty
|
711
|
+
/ path-absolute
|
712
|
+
/ path-rootless
|
713
|
+
/ path-empty
|
714
|
+
|
715
|
+
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
716
|
+
|
717
|
+
authority = [ userinfo "@" ] host [ ":" port ]
|
718
|
+
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
719
|
+
host = IP-literal / IPv4address / reg-name
|
720
|
+
port = *DIGIT
|
721
|
+
|
722
|
+
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
723
|
+
|
724
|
+
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
725
|
+
|
726
|
+
IPv6address = 6( h16 ":" ) ls32
|
727
|
+
/ "::" 5( h16 ":" ) ls32
|
728
|
+
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
729
|
+
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
730
|
+
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
731
|
+
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
732
|
+
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
733
|
+
/ [ *5( h16 ":" ) h16 ] "::" h16
|
734
|
+
/ [ *6( h16 ":" ) h16 ] "::"
|
735
|
+
|
736
|
+
h16 = 1*4HEXDIG
|
737
|
+
ls32 = ( h16 ":" h16 ) / IPv4address
|
738
|
+
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
739
|
+
dec-octet = DIGIT ; 0-9
|
740
|
+
/ %x31-39 DIGIT ; 10-99
|
741
|
+
/ "1" 2DIGIT ; 100-199
|
742
|
+
/ "2" %x30-34 DIGIT ; 200-249
|
743
|
+
/ "25" %x30-35 ; 250-255
|
744
|
+
|
745
|
+
reg-name = *( unreserved / pct-encoded / sub-delims )
|
746
|
+
|
747
|
+
path-abempty = *( "/" segment )
|
748
|
+
path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
749
|
+
path-rootless = segment-nz *( "/" segment )
|
750
|
+
path-empty = 0pchar
|
751
|
+
|
752
|
+
segment = *pchar
|
753
|
+
segment-nz = 1*pchar
|
754
|
+
|
755
|
+
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
756
|
+
|
757
|
+
query = *( pchar / "/" / "?" )
|
758
|
+
|
759
|
+
fragment = *( pchar / "/" / "?" )
|
760
|
+
|
761
|
+
pct-encoded = "%" HEXDIG HEXDIG
|
762
|
+
|
763
|
+
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
764
|
+
reserved = gen-delims / sub-delims
|
765
|
+
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
|
766
|
+
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
767
|
+
/ "*" / "+" / "," / ";" / "="
|
768
|
+
|
769
|
+
; ------------------------------------------------------------------------------
|
770
|
+
; RFC 4501
|
771
|
+
|
772
|
+
dnsauthority = host [ ":" port ]
|
773
|
+
; See RFC 3986 for the
|
774
|
+
; definition of "host" and "port".
|
775
|
+
|
776
|
+
; ------------------------------------------------------------------------------
|
777
|
+
; RFC 3339
|
778
|
+
|
779
|
+
date-fullyear = 4DIGIT
|
780
|
+
date-month = 2DIGIT ; 01-12
|
781
|
+
date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
|
782
|
+
; month/year
|
783
|
+
time-hour = 2DIGIT ; 00-23
|
784
|
+
time-minute = 2DIGIT ; 00-59
|
785
|
+
time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
|
786
|
+
; rules
|
787
|
+
time-secfrac = "." 1*DIGIT
|
788
|
+
time-numoffset = ("+" / "-") time-hour ":" time-minute
|
789
|
+
time-offset = "Z" / time-numoffset
|
790
|
+
|
791
|
+
partial-time = time-hour ":" time-minute ":" time-second
|
792
|
+
[time-secfrac]
|
793
|
+
full-date = date-fullyear "-" date-month "-" date-mday
|
794
|
+
full-time = partial-time time-offset
|
795
|
+
|
796
|
+
date-time = full-date "T" full-time
|
797
|
+
|
798
|
+
; ------------------------------------------------------------------------------
|
799
|
+
; RFC 5234
|
800
|
+
|
801
|
+
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
|
802
|
+
LF = %x0A
|
803
|
+
; linefeed
|
804
|
+
DIGIT = %x30-39
|
805
|
+
; 0-9
|
806
|
+
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
807
|
+
`,Wd=class{constructor(e){this.domain=void 0,this.address=void 0,this.statement=void 0,this.uri=void 0,this.version=void 0,this.nonce=void 0,this.issuedAt=void 0,this.expirationTime=void 0,this.notBefore=void 0,this.requestId=void 0,this.chainId=void 0,this.resources=void 0;let t=new C5.default(HM);if(t.generate(),t.errors.length)throw console.error(t.errorsToAscii()),console.error(t.linesToAscii()),console.log(t.displayAttributeErrors()),new Error("ABNF grammar has errors");let n=t.toObject(),i=new Ar.default.parser;i.ast=new Ar.default.ast;let s=Ar.default.ids,a=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.domain=Ar.default.utils.charsToString(j,D,B)),Y},"domain");i.ast.callbacks.domain=a;let c=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.address=Ar.default.utils.charsToString(j,D,B)),Y},"address");i.ast.callbacks.address=c;let f=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.statement=Ar.default.utils.charsToString(j,D,B)),Y},"statement");i.ast.callbacks.statement=f;let l=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.uri||(R.uri=Ar.default.utils.charsToString(j,D,B))),Y},"uri");i.ast.callbacks.uri=l;let h=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.version=Ar.default.utils.charsToString(j,D,B)),Y},"version");i.ast.callbacks.version=h;let d=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.chainId=Ar.default.utils.charsToString(j,D,B)),Y},"chainId");i.ast.callbacks["chain-id"]=d;let v=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.nonce=Ar.default.utils.charsToString(j,D,B)),Y},"nonce");i.ast.callbacks.nonce=v;let x=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.issuedAt=Ar.default.utils.charsToString(j,D,B)),Y},"issuedAt");i.ast.callbacks["issued-at"]=x;let y=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.expirationTime=Ar.default.utils.charsToString(j,D,B)),Y},"expirationTime");i.ast.callbacks["expiration-time"]=y;let _=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.notBefore=Ar.default.utils.charsToString(j,D,B)),Y},"notBefore");i.ast.callbacks["not-before"]=_;let U=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.requestId=Ar.default.utils.charsToString(j,D,B)),Y},"requestId");i.ast.callbacks["request-id"]=U;let E=o(function(F,j,D,B,R){let Y=s.SEM_OK;return F===s.SEM_PRE&&(R.resources=Ar.default.utils.charsToString(j,D,B).slice(3).split(`
|
808
|
+
- `)),Y},"resources");i.ast.callbacks.resources=E;let L=i.parse(n,"sign-in-with-ethereum",e);if(!L.success)throw new Error(`Invalid message: ${JSON.stringify(L)}`);let H={};i.ast.translate(H);for(let[F,j]of Object.entries(H))this[F]=j}};o(Wd,"ParsedMessage");var S5;(function(r){r.INVALID_SIGNATURE="Invalid signature.",r.EXPIRED_MESSAGE="Expired message.",r.MALFORMED_SESSION="Malformed session."})(S5||(S5={}));var Yd;(function(r){r.PERSONAL_SIGNATURE="Personal signature"})(Yd||(Yd={}));var Fc=class{constructor(e){if(this.domain=void 0,this.address=void 0,this.statement=void 0,this.uri=void 0,this.version=void 0,this.nonce=void 0,this.issuedAt=void 0,this.expirationTime=void 0,this.notBefore=void 0,this.requestId=void 0,this.chainId=void 0,this.resources=void 0,this.signature=void 0,this.type=void 0,typeof e=="string"){let t=new Wd(e);this.domain=t.domain,this.address=t.address,this.statement=t.statement,this.uri=t.uri,this.version=t.version,this.nonce=t.nonce,this.issuedAt=t.issuedAt,this.expirationTime=t.expirationTime,this.notBefore=t.notBefore,this.requestId=t.requestId,this.chainId=t.chainId,this.resources=t.resources}else Object.assign(this,e)}static fromCacao(e){let t=pa.parse(e.p.iss.replace("did:pkh:","")),n=new Fc({domain:e.p.domain,address:t.address,uri:e.p.aud,version:e.p.version,chainId:new vo(t.chainId).reference});return e.p.statement&&(n.statement=e.p.statement),e.p.nonce&&(n.nonce=e.p.nonce),e.p.iat&&(n.issuedAt=e.p.iat),e.p.exp&&(n.expirationTime=e.p.exp),e.p.nbf&&(n.notBefore=e.p.nbf),e.p.requestId&&(n.requestId=e.p.requestId),e.p.resources&&(n.resources=e.p.resources),e.s&&(e.s.s&&(n.signature=e.s.s),e.s.t==="eip191"&&(n.type=Yd.PERSONAL_SIGNATURE)),n}toMessage(){let e=`${this.domain} wants you to sign in with your Ethereum account:`,t=`URI: ${this.uri}`,n=[e,this.address].join(`
|
809
|
+
`),i=`Version: ${this.version}`;this.nonce||(this.nonce=(Math.random()+1).toString(36).substring(4));let s=`Nonce: ${this.nonce}`,a=[t,i,s];if(this.issuedAt=this.issuedAt?this.issuedAt:new Date().toISOString(),a.push(`Issued At: ${this.issuedAt}`),this.expirationTime){let f=`Expiration Time: ${this.expirationTime}`;a.push(f)}this.notBefore&&a.push(`Not Before: ${this.notBefore}`),this.requestId&&a.push(`Request ID: ${this.requestId}`),this.chainId&&a.push(`Chain ID: ${this.chainId}`),this.resources&&a.push(["Resources:",...this.resources.map(f=>`- ${f}`)].join(`
|
810
|
+
`));let c=a.join(`
|
811
|
+
`);return this.statement&&(n=[n,this.statement].join(`
|
812
|
+
|
813
|
+
`)),[n,c].join(`
|
814
|
+
|
815
|
+
`)}signMessage(){let e;switch(this.type){case Yd.PERSONAL_SIGNATURE:{e=this.toMessage();break}default:{e=this.toMessage();break}}return e}};o(Fc,"SiweMessage");var Vu;(function(r){function e(i){let s={h:{t:"eip4361"},p:{domain:i.domain,iat:i.issuedAt,iss:`did:pkh:eip155:${i.chainId}:${i.address}`,aud:i.uri,version:i.version,nonce:i.nonce}};return i.signature&&(s.s={t:"eip191",s:i.signature}),i.notBefore&&(s.p.nbf=i.notBefore),i.expirationTime&&(s.p.exp=i.expirationTime),i.statement&&(s.p.statement=i.statement),i.requestId&&(s.p.requestId=i.requestId),i.resources&&(s.p.resources=i.resources),s}o(e,"fromSiweMessage"),r.fromSiweMessage=e;function t(i,s={}){var a;if(i.h.t==="eip4361"&&((a=i.s)==null?void 0:a.t)==="eip191")return n(i,s);throw new Error("Unsupported CACAO signature type")}o(t,"verify"),r.verify=t;function n(i,s){if(!i.s)throw new Error("CACAO does not have a signature");let a=s.atTime?s.atTime.getTime():Date.now();if(Date.parse(i.p.iat)>a||Date.parse(i.p.nbf)>a)throw new Error("CACAO is not valid yet");if(Date.parse(i.p.exp)<a)throw new Error("CACAO has expired");let c=Fc.fromCacao(i),f=i.s.s,l=E5(c.toMessage(),f),h=pa.parse(i.p.iss.replace("did:pkh:","")).address;if(l.toLowerCase()!==h.toLowerCase())throw new Error("Signature does not belong to issuer")}o(n,"verifyEIP191Signature"),r.verifyEIP191Signature=n})(Vu||(Vu={}));var Gu;(function(r){let e=o(function(t){try{return Promise.resolve(ca({value:t,codec:cs,hasher:Wo}))}catch(n){return Promise.reject(n)}},"fromCacao");r.fromCacao=e})(Gu||(Gu={}));var k5=ze(wc(),1);function T5(){return jt((0,k5.randomBytes)(16),"base64")}o(T5,"randomString");var M5="base64pad",B5="base64url";function I5(r){return jt(r,M5)}o(I5,"encodeBase64");function N5(r){return jt(r,B5)}o(N5,"encodeBase64Url");function O5(r){return Gt(r,M5)}o(O5,"decodeBase64");function Xd(r){return JSON.parse(jt(Gt(r,B5)))}o(Xd,"base64urlToJSON");function P5(r){if(r.signatures.length>1)throw new Error("Cant convert to compact jws");return`${r.signatures[0].protected}.${r.payload}.${r.signatures[0].signature}`}o(P5,"fromDagJWS");function R5(r,e){if(e){let t=e.toISOString().split(".")[0]+"Z";return`${r}?versionTime=${t}`}else return r}o(R5,"didWithTime");function U5(r){return r?Array.isArray(r)?r:[r]:[]}o(U5,"extractControllers");function qM(r){return"registry"in r&&"cache"in r}o(qM,"isResolver");var ga=class{constructor({provider:e,resolver:t={},resolverOptions:n,capability:i,parent:s}={}){if(e!=null&&(this._client=new Ic(e)),i){if(this._capability=i,this._parentId=this._capability.p.iss,s&&this._parentId!==s)throw new Error("Capability issuer and parent not equal")}else s&&(this._parentId=s);this.setResolver(t,n)}get capability(){if(!this._capability)throw new Error("DID has no capability attached");return this._capability}get hasCapability(){return this._capability!=null}get parent(){if(!this._parentId)throw new Error("DID has no parent DID");return this._parentId}get hasParent(){return this._parentId!=null}get id(){if(this._id==null)throw new Error("DID is not authenticated");return this._id}get authenticated(){return this._id!=null}withCapability(e){var t;return new ga({provider:(t=this._client)==null?void 0:t.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Ic(e);else if(this._client.connection!==e)throw new Error("A different provider is already set, create a new DID instance to use another provider")}setResolver(e,t){this._resolver=qM(e)?e:new au(e,t)}authenticate(){return M(this,arguments,function*({provider:e,paths:t=[],aud:n}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let i=T5(),s=yield this._client.request("did_authenticate",{nonce:i,aud:n,paths:t}),{kid:a}=yield this.verifyJWS(s),c=Xd(s.payload);if(!a.includes(c.did))throw new Error("Invalid authencation response, kid mismatch");if(c.nonce!==i)throw new Error("Invalid authencation response, wrong nonce");if(c.aud!==n)throw new Error("Invalid authencation response, wrong aud");if(c.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=c.did,this._id})}createJWS(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");if(this._capability){let s=yield Gu.fromCacao(this._capability),a=Ne.asCID(s.cid);if(!a)throw new Error("Capability CID of the JWS cannot be set to the capability payload cid as they are incompatible");t.protected=t.protected||{},t.protected.cap=`ipfs://${a==null?void 0:a.toString()}`}let{jws:i}=yield this._client.request("did_createJWS",me(ne({did:this._id},t),{payload:e}));return i})}createDagJWS(n){return M(this,arguments,function*(e,t={}){let{cid:i,linkedBlock:s}=yield H3(e),a=N5(i.bytes);Object.assign(t,{linkedBlock:I5(s)});let c=yield this.createJWS(a,t),f=Ne.asCID(i);if(!f)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(c.link=f,this._capability){let l=yield Gu.fromCacao(this._capability);return{jws:c,linkedBlock:s,cacaoBlock:l.bytes}}return{jws:c,linkedBlock:s}})}verifyJWS(n){return M(this,arguments,function*(e,t={}){var h,d,v,x,y,_,U;typeof e!="string"&&(e=P5(e));let i=Xd(e.split(".")[0]).kid;if(!i)throw new Error('No "kid" found in jws');let s=yield this.resolve(i);if(!t.disableTimecheck){let E=(h=s.didDocumentMetadata)==null?void 0:h.nextUpdate;if(E){let H=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,F=new Date(E).valueOf()+H;if(!(t.atTime&&t.atTime.getTime()<F))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${i}`)}let L=(d=s.didDocumentMetadata)==null?void 0:d.updated;if(L&&t.atTime&&t.atTime.getTime()<new Date(L).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${i}`)}let c=(v=s.didDocument)==null?void 0:v.id;if(t.issuer&&t.issuer===((x=t.capability)==null?void 0:x.p.iss)&&c===t.capability.p.aud)Vu.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(t.issuer&&t.issuer!==c){let E=R5(t.issuer,t.atTime),H=(y=(yield this.resolve(E)).didDocument)==null?void 0:y.controller,F=U5(H);if(((_=t.capability)==null?void 0:_.s)&&t.capability.p.aud===c&&F.includes(t.capability.p.iss))Vu.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(!(c?F.includes(c):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${i}`)}let f=((U=s.didDocument)==null?void 0:U.verificationMethod)||[];B6(e,f);let l;try{l=Xd(e.split(".")[1])}catch(E){}return{kid:i,payload:l,didResolutionResult:s}})}createJWE(i,s){return M(this,arguments,function*(e,t,n={}){let a=yield O6(t,this._resolver);return N6(e,a,n.protectedHeader,n.aad)})}createDagJWE(i,s){return M(this,arguments,function*(e,t,n={}){let a=yield q3(e);return this.createJWE(a,t,n)})}decryptJWE(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");let{cleartext:i}=yield this._client.request("did_decryptJWE",me(ne({did:this._id},t),{jwe:e}));return O5(i)})}decryptDagJWE(e){return M(this,null,function*(){let t=yield this.decryptJWE(e);return z3(t)})}resolve(e){return M(this,null,function*(){let t=yield this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:n,message:i}=t.didResolutionMetadata,s=i?`, ${i}`:"";throw new Error(`Failed to resolve ${e}: ${n}${s}`)}return t})}};o(ga,"DID");var cA=ze(M4());var tp=ze(fd(),1);var R4=ze(I4(),1);var oI="base64pad";function N4(r){return JSON.parse((0,R4.default)(r))}o(N4,"toStableObject");function aI(r){let e=new Uint8Array(r.length+2);return e[0]=237,e[1]=1,e.set(r,2),`did:key:z${jt(e,"base58btc")}`}o(aI,"encodeDID");function O4(r){let[e,t,n]=r.split(".");return{payload:t,signatures:[{protected:e,signature:n}]}}o(O4,"toGeneralJWS");var P4=o((i,s,a,...c)=>M(void 0,[i,s,a,...c],function*(r,e,t,n={}){let f=`${e}#${e.split(":")[2]}`,l=S6(t),h=N4(Object.assign(n,{kid:f,alg:"EdDSA"}));return M6(typeof r=="string"?r:N4(r),l,h)}),"sign"),cI={did_authenticate:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){let s=yield P4({did:r,aud:t.aud,nonce:t.nonce,paths:t.paths,exp:Math.floor(Date.now()/1e3)+600},r,e);return O4(s)}),did_createJWS:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){if(t.did.split("#")[0]!==r)throw new jr(4100,`Unknown DID: ${r}`);let a=yield P4(t.payload,r,e,t.protected);return{jws:O4(a)}}),did_decryptJWE:(t,n)=>M(void 0,[t,n],function*({secretKey:r},e){let i=R6((0,tp.convertSecretKeyToX25519)(r));try{let s=yield I6(e.jwe,i);return{cleartext:jt(s,oI)}}catch(s){throw new jr(-32e3,s.message)}})},Yu=class{constructor(e){let{secretKey:t,publicKey:n}=(0,tp.generateKeyPairFromSeed)(e),i=aI(n),s=X3(cI);this._handle=a=>M(this,null,function*(){return yield s({did:i,secretKey:t},a)})}get isDidProvider(){return!0}send(e){return M(this,null,function*(){return yield this._handle(e)})}};o(Yu,"Ed25519Provider");Xi();Oh();var U4={tile:0,"caip10-link":1,model:2,MID:3};function fI(r){let e=U4[r];if(typeof e!="undefined")return e;throw new Error(`No stream type registered for name ${r}`)}o(fI,"codeByName");function uI(r){let e=Object.entries(U4).find(([,t])=>t===r);if(e)return e[0];throw new Error(`No stream type registered for index ${r}`)}o(uI,"nameByCode");var Gr=class{};o(Gr,"StreamType");Gr.nameByCode=uI;Gr.codeByName=fI;var lb=ze(Ju(),1);function un(r){let e,t,n;return typeof r=="object"?(e=r.hashFunction,t=r.expiring,n=r.tags):e=r,(i,s,a)=>{if(a.value!=null)a.value=L4(a.value,e,t,n);else if(a.get!=null)a.get=L4(a.get,e,t,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}o(un,"Memoize");var nb=new Map;function L4(r,e,t=0,n){let i=Symbol("__memoized_map__");return function(...s){let a;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let c=this[i];if(Array.isArray(n))for(let f of n)nb.has(f)?nb.get(f).push(c):nb.set(f,[c]);if(e||s.length>0||t>0){let f;e===!0?f=s.map(d=>d.toString()).join("!"):e?f=e.apply(this,s):f=s[0];let l=`${f}__timestamp`,h=!1;if(t>0)if(!c.has(l))h=!0;else{let d=c.get(l);h=Date.now()-d>t}c.has(f)&&!h?a=c.get(f):(a=r.apply(this,s),c.set(f,a),t>0&&c.set(l,Date.now()))}else{let f=this;c.has(f)?a=c.get(f):(a=r.apply(this,s),c.set(f,a))}return a}}o(L4,"getNewFunction");Xi();var ib=ze(Ju(),1);ac();function Ii(r){let e=ib.default.decode(r),t=ib.default.decode.bytes,n=r.slice(t);return[e,n,t]}o(Ii,"readVarint");function lI(r){return r===0||r===1}o(lI,"isCidVersion");function sb(r){let e=ob(r);if(e instanceof Error)throw e;return e}o(sb,"readCid");function ob(r){let[e,t]=Ii(r);if(!lI(e))return new Error(`Unknown CID version ${e}`);let[n,i]=Ii(t),[,s,a]=Ii(i),[c,,f]=Ii(s),l=i.slice(0,a+f+c),h=i.slice(a+f+c);return[Ne.create(e,n,uu(l)),h]}o(ob,"readCidNoThrow");Xi();Oh();hu();var ab=ze(Ju(),1);var Qu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Pn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},D4=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qc,Zu;function hI(r){let e=fb(r);if(e instanceof Error)throw e;return e}o(hI,"fromBytes");function fb(r){let[e,t]=Ii(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ii(t),s=ob(i);if(s instanceof Error)return s;let[a,c]=s;return c.length>0?new Error("Invalid StreamID: contains commit"):new Fe(n,a)}o(fb,"fromBytesNoThrow");function dI(r){let e=$4(r);if(e instanceof Error)throw e;return e}o(dI,"fromString");function $4(r){let e=r.replace("ceramic://","").replace("/ceramic/",""),t=e.includes("commit")?e.split("?")[0]:e,n=jo.decode(t);return fb(n)}o($4,"fromStringNoThrow");var K4=Symbol.for("@ceramicnetwork/streamid/StreamID"),Fe=class{constructor(e,t){if(this._tag=K4,qc.set(this,void 0),Zu.set(this,void 0),!(e||e===0))throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");D4(this,qc,typeof e=="string"?Gr.codeByName(e):e,"f"),D4(this,Zu,typeof t=="string"?Ne.parse(t):t,"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===K4}static fromGenesis(e,t){return M(this,null,function*(){let n=yield ca({value:t,codec:cs,hasher:Wo});return new Fe(e,n.cid)})}get type(){return Xu(this,qc,"f")}get typeName(){return Gr.nameByCode(Xu(this,qc,"f"))}get cid(){return Xu(this,Zu,"f")}get bytes(){let e=ab.default.encode(206),t=ab.default.encode(this.type);return di([e,t,this.cid.bytes])}get baseID(){return new Fe(Xu(this,qc,"f"),Xu(this,Zu,"f"))}equals(e){return Fe.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return jo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(qc=new WeakMap,Zu=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(Fe,"StreamID");Fe.fromBytes=hI;Fe.fromBytesNoThrow=fb;Fe.fromString=dI;Fe.fromStringNoThrow=$4;Qu([un(),Pn("design:type",String),Pn("design:paramtypes",[])],Fe.prototype,"typeName",null);Qu([un(),Pn("design:type",Uint8Array),Pn("design:paramtypes",[])],Fe.prototype,"bytes",null);Qu([un(),Pn("design:type",Fe),Pn("design:paramtypes",[])],Fe.prototype,"baseID",null);Qu([un(),Pn("design:type",Function),Pn("design:paramtypes",[]),Pn("design:returntype",String)],Fe.prototype,"toString",null);Qu([un(),Pn("design:type",Function),Pn("design:paramtypes",[]),Pn("design:returntype",String)],Fe.prototype,"toUrl",null);var jc=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Jr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ub=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ps=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zc,va,el;function pI(r){let e=hb(r);if(e instanceof Error)throw e;return e}o(pI,"fromBytes");function hb(r){let[e,t]=Ii(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ii(t),s=sb(i);if(s instanceof Error)return s;let[a,c]=s;if(c.length===0)return new Error("No commit information provided");if(c.length===1)return new tt(n,a,c[0]);{let[f]=sb(c);return new tt(n,a,f)}}o(hb,"fromBytesNoThrow");function mI(r){try{return typeof r=="string"?Ne.parse(r):Ne.asCID(r)}catch(e){return}}o(mI,"parseCID");function bI(r,e=null){if(!e)return null;let t=mI(e);if(t)return r.equals(t)?null:t;if(String(e)==="0")return null;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}o(bI,"parseCommit");function gI(r){let e=H4(r);if(e instanceof Error)throw e;return e}o(gI,"fromString");function H4(r){let e=r.replace("ceramic://","").replace("/ceramic/","");if(e.includes("commit")){let t=e.split("?")[1].split("=")[1],n=e.split("?")[0];return q4(Fe.fromString(n),t)}else return hb(jo.decode(e))}o(H4,"fromStringNoThrow");var F4=Symbol.for("@ceramicnetwork/streamid/CommitID");function q4(r,e){return new tt(r.type,r.cid,e)}o(q4,"make");var tt=class{constructor(e,t,n=null){if(this._tag=F4,zc.set(this,void 0),va.set(this,void 0),el.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");ub(this,zc,typeof e=="string"?Gr.codeByName(e):e,"f"),ub(this,va,typeof t=="string"?Ne.parse(t):t,"f"),ub(this,el,bI(ps(this,va,"f"),n),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===F4}get baseID(){return new Fe(ps(this,zc,"f"),ps(this,va,"f"))}get type(){return ps(this,zc,"f")}get typeName(){return Gr.nameByCode(ps(this,zc,"f"))}get cid(){return ps(this,va,"f")}get commit(){return ps(this,el,"f")||ps(this,va,"f")}get bytes(){var i;let e=lb.default.encode(206),t=lb.default.encode(this.type),n=((i=ps(this,el,"f"))==null?void 0:i.bytes)||new Uint8Array([0]);return di([e,t,this.cid.bytes,n])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return jo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(zc=new WeakMap,va=new WeakMap,el=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(tt,"CommitID");tt.fromBytes=pI;tt.fromBytesNoThrow=hb;tt.fromString=gI;tt.fromStringNoThrow=H4;tt.make=q4;jc([un(),Jr("design:type",Fe),Jr("design:paramtypes",[])],tt.prototype,"baseID",null);jc([un(),Jr("design:type",String),Jr("design:paramtypes",[])],tt.prototype,"typeName",null);jc([un(),Jr("design:type",Ne),Jr("design:paramtypes",[])],tt.prototype,"commit",null);jc([un(),Jr("design:type",Uint8Array),Jr("design:paramtypes",[])],tt.prototype,"bytes",null);jc([un(),Jr("design:type",Function),Jr("design:paramtypes",[]),Jr("design:returntype",String)],tt.prototype,"toString",null);jc([un(),Jr("design:type",Function),Jr("design:paramtypes",[]),Jr("design:returntype",String)],tt.prototype,"toUrl",null);var ni;(function(r){function e(t){if(Fe.isInstance(t))return t;if(tt.isInstance(t))return t;if(t instanceof Uint8Array){let n=tt.fromBytesNoThrow(t);return n instanceof Error?Fe.fromBytes(t):n}else if(typeof t=="string"){let n=tt.fromStringNoThrow(t);return n instanceof Error?Fe.fromString(t):n}else throw new Error("Can not build CommitID or StreamID")}o(e,"from"),r.from=e})(ni||(ni={}));var z4="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",rp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var db={};Mt(db,{JsonPatchError:()=>Ot,_areEquals:()=>nl,applyOperation:()=>wa,applyPatch:()=>fp,applyReducer:()=>_I,deepClone:()=>wI,getValueByPointer:()=>ap,validate:()=>V4,validator:()=>cp});var yI=function(){var r=o(function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)},"extendStatics");return function(e,t){r(e,t);function n(){this.constructor=e}o(n,"__"),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vI=Object.prototype.hasOwnProperty;function ip(r,e){return vI.call(r,e)}o(ip,"hasOwnProperty");function sp(r){if(Array.isArray(r)){for(var e=new Array(r.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(r);var n=[];for(var i in r)ip(r,i)&&n.push(i);return n}o(sp,"_objectKeys");function pr(r){switch(typeof r){case"object":return JSON.parse(JSON.stringify(r));case"undefined":return null;default:return r}}o(pr,"_deepClone");function op(r){for(var e=0,t=r.length,n;e<t;){if(n=r.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}o(op,"isInteger");function Ni(r){return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}o(Ni,"escapePathComponent");function tl(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}o(tl,"unescapePathComponent");function np(r){if(r===void 0)return!0;if(r){if(Array.isArray(r)){for(var e=0,t=r.length;e<t;e++)if(np(r[e]))return!0}else if(typeof r=="object"){for(var n=sp(r),i=n.length,s=0;s<i;s++)if(np(r[n[s]]))return!0}}return!1}o(np,"hasUndefined");function j4(r,e){var t=[r];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i!="undefined"&&t.push(n+": "+i)}return t.join(`
|
816
|
+
`)}o(j4,"patchErrorMessageFormatter");var rl=function(r){yI(e,r);function e(t,n,i,s,a){var c=this.constructor,f=r.call(this,j4(t,{name:n,index:i,operation:s,tree:a}))||this;return f.name=n,f.index=i,f.operation=s,f.tree=a,Object.setPrototypeOf(f,c.prototype),f.message=j4(t,{name:n,index:i,operation:s,tree:a}),f}return o(e,"PatchError"),e}(Error);var Ot=rl,wI=pr,Vc={add:function(r,e,t){return r[e]=this.value,{newDocument:t}},remove:function(r,e,t){var n=r[e];return delete r[e],{newDocument:t,removed:n}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:function(r,e,t){var n=ap(t,this.path);n&&(n=pr(n));var i=wa(t,{op:"remove",path:this.from}).removed;return wa(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:n}},copy:function(r,e,t){var n=ap(t,this.from);return wa(t,{op:"add",path:this.path,value:pr(n)}),{newDocument:t}},test:function(r,e,t){return{newDocument:t,test:nl(r[e],this.value)}},_get:function(r,e,t){return this.value=r[e],{newDocument:t}}},xI={add:function(r,e,t){return op(e)?r.splice(e,0,this.value):r[e]=this.value,{newDocument:t,index:e}},remove:function(r,e,t){var n=r.splice(e,1);return{newDocument:t,removed:n[0]}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:Vc.move,copy:Vc.copy,test:Vc.test,_get:Vc._get};function ap(r,e){if(e=="")return r;var t={op:"_get",path:e};return wa(r,t),t.value}o(ap,"getValueByPointer");function wa(r,e,t,n,i,s){if(t===void 0&&(t=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),s===void 0&&(s=0),t&&(typeof t=="function"?t(e,0,r,e.path):cp(e,0)),e.path===""){var a={newDocument:r};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=r,a;if(e.op==="move"||e.op==="copy")return a.newDocument=ap(r,e.from),e.op==="move"&&(a.removed=r),a;if(e.op==="test"){if(a.test=nl(r,e.value),a.test===!1)throw new Ot("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a.newDocument=r,a}else{if(e.op==="remove")return a.removed=r,a.newDocument=null,a;if(e.op==="_get")return e.value=r,a;if(t)throw new Ot("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,r);return a}}else{n||(r=pr(r));var c=e.path||"",f=c.split("/"),l=r,h=1,d=f.length,v=void 0,x=void 0,y=void 0;for(typeof t=="function"?y=t:y=cp;;){if(x=f[h],x&&x.indexOf("~")!=-1&&(x=tl(x)),i&&(x=="__proto__"||x=="prototype"&&h>0&&f[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&v===void 0&&(l[x]===void 0?v=f.slice(0,h).join("/"):h==d-1&&(v=e.path),v!==void 0&&y(e,0,r,v)),h++,Array.isArray(l)){if(x==="-")x=l.length;else{if(t&&!op(x))throw new Ot("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,r);op(x)&&(x=~~x)}if(h>=d){if(t&&e.op==="add"&&x>l.length)throw new Ot("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,r);var a=xI[e.op].call(e,l,x,r);if(a.test===!1)throw new Ot("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a}}else if(h>=d){var a=Vc[e.op].call(e,l,x,r);if(a.test===!1)throw new Ot("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a}if(l=l[x],t&&h<d&&(!l||typeof l!="object"))throw new Ot("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,r)}}}o(wa,"applyOperation");function fp(r,e,t,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new Ot("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(r=pr(r));for(var s=new Array(e.length),a=0,c=e.length;a<c;a++)s[a]=wa(r,e[a],t,!0,i,a),r=s[a].newDocument;return s.newDocument=r,s}o(fp,"applyPatch");function _I(r,e,t){var n=wa(r,e);if(n.test===!1)throw new Ot("Test operation failed","TEST_OPERATION_FAILED",t,e,r);return n.newDocument}o(_I,"applyReducer");function cp(r,e,t,n){if(typeof r!="object"||r===null||Array.isArray(r))throw new Ot("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,r,t);if(Vc[r.op]){if(typeof r.path!="string")throw new Ot("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,r,t);if(r.path.indexOf("/")!==0&&r.path.length>0)throw new Ot('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,r,t);if((r.op==="move"||r.op==="copy")&&typeof r.from!="string")throw new Ot("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&r.value===void 0)throw new Ot("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&np(r.value))throw new Ot("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,r,t);if(t){if(r.op=="add"){var i=r.path.split("/").length,s=n.split("/").length;if(i!==s+1&&i!==s)throw new Ot("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,r,t)}else if(r.op==="replace"||r.op==="remove"||r.op==="_get"){if(r.path!==n)throw new Ot("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,r,t)}else if(r.op==="move"||r.op==="copy"){var a={op:"_get",path:r.from,value:void 0},c=V4([a],t);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ot("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,r,t)}}}else throw new Ot("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,r,t)}o(cp,"validator");function V4(r,e,t){try{if(!Array.isArray(r))throw new Ot("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)fp(pr(e),pr(r),t||!0);else{t=t||cp;for(var n=0;n<r.length;n++)t(r[n],n,e,void 0)}}catch(i){if(i instanceof Ot)return i;throw i}}o(V4,"validate");function nl(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){var t=Array.isArray(r),n=Array.isArray(e),i,s,a;if(t&&n){if(s=r.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!nl(r[i],e[i]))return!1;return!0}if(t!=n)return!1;var c=Object.keys(r);if(s=c.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(c[i]))return!1;for(i=s;i--!==0;)if(a=c[i],!nl(r[a],e[a]))return!1;return!0}return r!==r&&e!==e}o(nl,"_areEquals");var gb={};Mt(gb,{compare:()=>BI,generate:()=>pb,observe:()=>MI,unobserve:()=>TI});var mb=new WeakMap,AI=function(){function r(e){this.observers=new Map,this.obj=e}return o(r,"Mirror"),r}(),EI=function(){function r(e,t){this.callback=e,this.observer=t}return o(r,"ObserverInfo"),r}();function SI(r){return mb.get(r)}o(SI,"getMirror");function CI(r,e){return r.observers.get(e)}o(CI,"getObserverFromMirror");function kI(r,e){r.observers.delete(e.callback)}o(kI,"removeObserverFromMirror");function TI(r,e){e.unobserve()}o(TI,"unobserve");function MI(r,e){var t=[],n,i=SI(r);if(!i)i=new AI(r),mb.set(r,i);else{var s=CI(i,e);n=s&&s.observer}if(n)return n;if(n={},i.value=pr(r),e){n.callback=e,n.next=null;var a=o(function(){pb(n)},"dirtyCheck"),c=o(function(){clearTimeout(n.next),n.next=setTimeout(a)},"fastCheck");typeof window!="undefined"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=t,n.object=r,n.unobserve=function(){pb(n),clearTimeout(n.next),kI(i,n),typeof window!="undefined"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},i.observers.set(e,new EI(e,n)),n}o(MI,"observe");function pb(r,e){e===void 0&&(e=!1);var t=mb.get(r.object);bb(t.value,r.object,r.patches,"",e),r.patches.length&&fp(t.value,r.patches);var n=r.patches;return n.length>0&&(r.patches=[],r.callback&&r.callback(n)),n}o(pb,"generate");function bb(r,e,t,n,i){if(e!==r){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=sp(e),a=sp(r),c=!1,f=!1,l=a.length-1;l>=0;l--){var h=a[l],d=r[h];if(ip(e,h)&&!(e[h]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var v=e[h];typeof d=="object"&&d!=null&&typeof v=="object"&&v!=null&&Array.isArray(d)===Array.isArray(v)?bb(d,v,t,n+"/"+Ni(h),i):d!==v&&(c=!0,i&&t.push({op:"test",path:n+"/"+Ni(h),value:pr(d)}),t.push({op:"replace",path:n+"/"+Ni(h),value:pr(v)}))}else Array.isArray(r)===Array.isArray(e)?(i&&t.push({op:"test",path:n+"/"+Ni(h),value:pr(d)}),t.push({op:"remove",path:n+"/"+Ni(h)}),f=!0):(i&&t.push({op:"test",path:n,value:r}),t.push({op:"replace",path:n,value:e}),c=!0)}if(!(!f&&s.length==a.length))for(var l=0;l<s.length;l++){var h=s[l];!ip(r,h)&&e[h]!==void 0&&t.push({op:"add",path:n+"/"+Ni(h),value:pr(e[h])})}}}o(bb,"_generate");function BI(r,e,t){t===void 0&&(t=!1);var n=[];return bb(r,e,n,"",t),n}o(BI,"compare");var G4=Object.assign({},db,gb,{JsonPatchError:rl,deepClone:pr,escapePathComponent:Ni,unescapePathComponent:tl});var S_=ze(wc(),1);var Er;(function(r){r[r.PREFER_CACHE=0]="PREFER_CACHE",r[r.SYNC_ALWAYS=1]="SYNC_ALWAYS",r[r.NEVER_SYNC=2]="NEVER_SYNC"})(Er||(Er={}));var Dp=ze(Nb(),1);function qe(r){return typeof r=="function"}o(qe,"isFunction");function Xc(r){var e=o(function(n){Error.call(n),n.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}o(Xc,"createErrorClass");var yp=Xc(function(r){return o(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
817
|
+
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
818
|
+
`):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function Ea(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}o(Ea,"arrRemove");var Eo=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return o(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,n,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=Do(a),f=c.next();!f.done;f=c.next()){var l=f.value;l.remove(this)}}catch(_){e={error:_}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if(qe(h))try{h()}catch(_){s=_ instanceof yp?_.errors:[_]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=Do(d),x=v.next();!x.done;x=v.next()){var y=x.value;try{R8(y)}catch(_){s=s!=null?s:[],_ instanceof yp?s=Hn(Hn([],Qr(s)),Qr(_.errors)):s.push(_)}}}catch(_){n={error:_}}finally{try{x&&!x.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(s)throw new yp(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)R8(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ea(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Ea(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Ob=Eo.EMPTY;function vp(r){return r instanceof Eo||r&&"closed"in r&&qe(r.remove)&&qe(r.add)&&qe(r.unsubscribe)}o(vp,"isSubscription");function R8(r){qe(r)?r():r.unsubscribe()}o(R8,"execFinalizer");var ii={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Zc={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Zc.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,Hn([r,e],Qr(t))):setTimeout.apply(void 0,Hn([r,e],Qr(t)))},clearTimeout:function(r){var e=Zc.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function wp(r){Zc.setTimeout(function(){var e=ii.onUnhandledError;if(e)e(r);else throw r})}o(wp,"reportUnhandledError");function Pb(){}o(Pb,"noop");var U8=function(){return Rb("C",void 0,void 0)}();function L8(r){return Rb("E",void 0,r)}o(L8,"errorNotification");function D8(r){return Rb("N",r,void 0)}o(D8,"nextNotification");function Rb(r,e,t){return{kind:r,value:e,error:t}}o(Rb,"createNotification");var Sa=null;function Qc(r){if(ii.useDeprecatedSynchronousErrorHandling){var e=!Sa;if(e&&(Sa={errorThrown:!1,error:null}),r(),e){var t=Sa,n=t.errorThrown,i=t.error;if(Sa=null,n)throw i}}else r()}o(Qc,"errorContext");function K8(r){ii.useDeprecatedSynchronousErrorHandling&&Sa&&(Sa.errorThrown=!0,Sa.error=r)}o(K8,"captureError");var al=function(r){gr(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,vp(t)&&t.add(n)):n.destination=aO,n}return o(e,"Subscriber"),e.create=function(t,n,i){return new _p(t,n,i)},e.prototype.next=function(t){this.isStopped?Lb(D8(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Lb(L8(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Lb(U8,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Eo);var iO=Function.prototype.bind;function Ub(r,e){return iO.call(r,e)}o(Ub,"bind");var sO=function(){function r(e){this.partialObserver=e}return o(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){xp(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){xp(n)}else xp(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){xp(t)}},r}(),_p=function(r){gr(e,r);function e(t,n,i){var s=r.call(this)||this,a;if(qe(t)||!t)a={next:t!=null?t:void 0,error:n!=null?n:void 0,complete:i!=null?i:void 0};else{var c;s&&ii.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&Ub(t.next,c),error:t.error&&Ub(t.error,c),complete:t.complete&&Ub(t.complete,c)}):a=t}return s.destination=new sO(a),s}return o(e,"SafeSubscriber"),e}(al);function xp(r){ii.useDeprecatedSynchronousErrorHandling?K8(r):wp(r)}o(xp,"handleUnhandledError");function oO(r){throw r}o(oO,"defaultErrorHandler");function Lb(r,e){var t=ii.onStoppedNotification;t&&Zc.setTimeout(function(){return t(r,e)})}o(Lb,"handleStoppedNotification");var aO={closed:!0,next:Pb,error:oO,complete:Pb};var ef=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function tf(r){return r}o(tf,"identity");function $8(r){return r.length===0?tf:r.length===1?r[0]:o(function(t){return r.reduce(function(n,i){return i(n)},t)},"piped")}o($8,"pipeFromArray");var ct=function(){function r(e){e&&(this._subscribe=e)}return o(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,s=fO(e)?e:new _p(e,t,n);return Qc(function(){var a=i,c=a.operator,f=a.source;s.add(c?c.call(s,f):f?i._subscribe(s):i._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=F8(t),new t(function(i,s){var a=new _p({next:function(c){try{e(c)}catch(f){s(f),a.unsubscribe()}},error:s,complete:i});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[ef]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return $8(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=F8(e),new e(function(n,i){var s;t.subscribe(function(a){return s=a},function(a){return i(a)},function(){return n(s)})})},r.create=function(e){return new r(e)},r}();function F8(r){var e;return(e=r!=null?r:ii.Promise)!==null&&e!==void 0?e:Promise}o(F8,"getPromiseCtor");function cO(r){return r&&qe(r.next)&&qe(r.error)&&qe(r.complete)}o(cO,"isObserver");function fO(r){return r&&r instanceof al||cO(r)&&vp(r)}o(fO,"isSubscriber");function uO(r){return qe(r==null?void 0:r.lift)}o(uO,"hasLift");function nr(r){return function(e){if(uO(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}o(nr,"operate");function ir(r,e,t,n,i){return new lO(r,e,t,n,i)}o(ir,"createOperatorSubscriber");var lO=function(r){gr(e,r);function e(t,n,i,s,a,c){var f=r.call(this,t)||this;return f.onFinalize=a,f.shouldUnsubscribe=c,f._next=n?function(l){try{n(l)}catch(h){t.error(h)}}:r.prototype._next,f._error=s?function(l){try{s(l)}catch(h){t.error(h)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=i?function(){try{i()}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._complete,f}return o(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(al);var H8=Xc(function(r){return o(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Db=function(r){gr(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return o(e,"Subject"),e.prototype.lift=function(t){var n=new q8(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new H8},e.prototype.next=function(t){var n=this;Qc(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Do(n.currentObservers),c=a.next();!c.done;c=a.next()){var f=c.value;f.next(t)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;Qc(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;Qc(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,s=i.hasError,a=i.isStopped,c=i.observers;return s||a?Ob:(this.currentObservers=null,c.push(t),new Eo(function(){n.currentObservers=null,Ea(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n.thrownError,a=n.isStopped;i?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new ct;return t.source=this,t},e.create=function(t,n){return new q8(t,n)},e}(ct);var q8=function(r){gr(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return o(e,"AnonymousSubject"),e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Ob},e}(Db);var Kb=function(r){gr(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return o(e,"BehaviorSubject"),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,s=t._value;if(n)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Db);var $b={now:function(){return($b.delegate||Date).now()},delegate:void 0};var z8=function(r){gr(e,r);function e(t,n){return r.call(this)||this}return o(e,"Action"),e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e}(Eo);var cl={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=cl.delegate;return i!=null&&i.setInterval?i.setInterval.apply(i,Hn([r,e],Qr(t))):setInterval.apply(void 0,Hn([r,e],Qr(t)))},clearInterval:function(r){var e=cl.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0};var j8=function(r){gr(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return o(e,"AsyncAction"),e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),cl.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;cl.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,s;try{this.work(t)}catch(a){i=!0,s=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ea(s,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(z8);var Fb=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return o(r,"Scheduler"),r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=$b.now,r}();var V8=function(r){gr(e,r);function e(t,n){n===void 0&&(n=Fb.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return o(e,"AsyncScheduler"),e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(Fb);var hO=new V8(j8),G8=hO;var Ap=new ct(function(r){return r.complete()});function Ep(r){return r&&qe(r.schedule)}o(Ep,"isScheduler");function J8(r){return r[r.length-1]}o(J8,"last");function W8(r){return Ep(J8(r))?r.pop():void 0}o(W8,"popScheduler");function Y8(r,e){return typeof J8(r)=="number"?r.pop():e}o(Y8,"popNumber");var rf=o(function(r){return r&&typeof r.length=="number"&&typeof r!="function"},"isArrayLike");function Sp(r){return qe(r==null?void 0:r.then)}o(Sp,"isPromise");function Cp(r){return qe(r[ef])}o(Cp,"isInteropObservable");function kp(r){return Symbol.asyncIterator&&qe(r==null?void 0:r[Symbol.asyncIterator])}o(kp,"isAsyncIterable");function Tp(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}o(Tp,"createInvalidObservableTypeError");function dO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}o(dO,"getSymbolIterator");var Mp=dO();function Bp(r){return qe(r==null?void 0:r[Mp])}o(Bp,"isIterable");function Ip(r){return Fy(this,arguments,o(function(){var t,n,i,s;return Rl(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Ul(t.read())];case 3:return n=a.sent(),i=n.value,s=n.done,s?[4,Ul(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ul(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}o(Ip,"readableStreamLikeToAsyncGenerator");function Np(r){return qe(r==null?void 0:r.getReader)}o(Np,"isReadableStreamLike");function Sr(r){if(r instanceof ct)return r;if(r!=null){if(Cp(r))return pO(r);if(rf(r))return mO(r);if(Sp(r))return bO(r);if(kp(r))return X8(r);if(Bp(r))return gO(r);if(Np(r))return yO(r)}throw Tp(r)}o(Sr,"innerFrom");function pO(r){return new ct(function(e){var t=r[ef]();if(qe(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}o(pO,"fromInteropObservable");function mO(r){return new ct(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}o(mO,"fromArrayLike");function bO(r){return new ct(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,wp)})}o(bO,"fromPromise");function gO(r){return new ct(function(e){var t,n;try{for(var i=Do(r),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}o(gO,"fromIterable");function X8(r){return new ct(function(e){vO(r,e).catch(function(t){return e.error(t)})})}o(X8,"fromAsyncIterable");function yO(r){return X8(Ip(r))}o(yO,"fromReadableStreamLike");function vO(r,e){var t,n,i,s;return $y(this,void 0,void 0,function(){var a,c;return Rl(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),t=Hy(r),f.label=1;case 1:return[4,t.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=f.sent(),i={error:c},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}o(vO,"process");function Rn(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var s=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(s),!i)return s}o(Rn,"executeSchedule");function Op(r,e){return e===void 0&&(e=0),nr(function(t,n){t.subscribe(ir(n,function(i){return Rn(n,r,function(){return n.next(i)},e)},function(){return Rn(n,r,function(){return n.complete()},e)},function(i){return Rn(n,r,function(){return n.error(i)},e)}))})}o(Op,"observeOn");function Pp(r,e){return e===void 0&&(e=0),nr(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}o(Pp,"subscribeOn");function Z8(r,e){return Sr(r).pipe(Pp(e),Op(e))}o(Z8,"scheduleObservable");function Q8(r,e){return Sr(r).pipe(Pp(e),Op(e))}o(Q8,"schedulePromise");function e_(r,e){return new ct(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}o(e_,"scheduleArray");function t_(r,e){return new ct(function(t){var n;return Rn(t,e,function(){n=r[Mp](),Rn(t,e,function(){var i,s,a;try{i=n.next(),s=i.value,a=i.done}catch(c){t.error(c);return}a?t.complete():t.next(s)},0,!0)}),function(){return qe(n==null?void 0:n.return)&&n.return()}})}o(t_,"scheduleIterable");function Rp(r,e){if(!r)throw new Error("Iterable cannot be null");return new ct(function(t){Rn(t,e,function(){var n=r[Symbol.asyncIterator]();Rn(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}o(Rp,"scheduleAsyncIterable");function r_(r,e){return Rp(Ip(r),e)}o(r_,"scheduleReadableStreamLike");function n_(r,e){if(r!=null){if(Cp(r))return Z8(r,e);if(rf(r))return e_(r,e);if(Sp(r))return Q8(r,e);if(kp(r))return Rp(r,e);if(Bp(r))return t_(r,e);if(Np(r))return r_(r,e)}throw Tp(r)}o(n_,"scheduled");function i_(r,e){return e?n_(r,e):Sr(r)}o(i_,"from");var Up=Xc(function(r){return o(function(){r(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl")});function s_(r){return r instanceof Date&&!isNaN(r)}o(s_,"isValidDate");function Lp(r,e){return nr(function(t,n){var i=0;t.subscribe(ir(n,function(s){n.next(r.call(e,s,i++))}))})}o(Lp,"map");var wO=Array.isArray;function xO(r,e){return wO(e)?r.apply(void 0,Hn([],Qr(e))):r(e)}o(xO,"callOrApply");function o_(r){return Lp(function(e){return xO(r,e)})}o(o_,"mapOneOrManyArgs");function a_(r,e,t,n,i,s,a,c){var f=[],l=0,h=0,d=!1,v=o(function(){d&&!f.length&&!l&&e.complete()},"checkComplete"),x=o(function(_){return l<n?y(_):f.push(_)},"outerNext"),y=o(function(_){s&&e.next(_),l++;var U=!1;Sr(t(_,h++)).subscribe(ir(e,function(E){i==null||i(E),s?x(E):e.next(E)},function(){U=!0},void 0,function(){if(U)try{l--;for(var E=o(function(){var L=f.shift();a?Rn(e,a,function(){return y(L)}):y(L)},"_loop_1");f.length&&l<n;)E();v()}catch(L){e.error(L)}}))},"doInnerSub");return r.subscribe(ir(e,x,function(){d=!0,v()})),function(){c==null||c()}}o(a_,"mergeInternals");function fl(r,e,t){return t===void 0&&(t=1/0),qe(e)?fl(function(n,i){return Lp(function(s,a){return e(n,s,i,a)})(Sr(r(n,i)))},t):(typeof e=="number"&&(t=e),nr(function(n,i){return a_(n,i,r,t)}))}o(fl,"mergeMap");function c_(r){return r===void 0&&(r=1/0),fl(tf,r)}o(c_,"mergeAll");var _O=["addListener","removeListener"],AO=["addEventListener","removeEventListener"],EO=["on","off"];function ul(r,e,t,n){if(qe(t)&&(n=t,t=void 0),n)return ul(r,e,t).pipe(o_(n));var i=Qr(kO(r)?AO.map(function(c){return function(f){return r[c](e,f,t)}}):SO(r)?_O.map(f_(r,e)):CO(r)?EO.map(f_(r,e)):[],2),s=i[0],a=i[1];if(!s&&rf(r))return fl(function(c){return ul(c,e,t)})(Sr(r));if(!s)throw new TypeError("Invalid event target");return new ct(function(c){var f=o(function(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];return c.next(1<l.length?l:l[0])},"handler");return s(f),function(){return a(f)}})}o(ul,"fromEvent");function f_(r,e){return function(t){return function(n){return r[t](e,n)}}}o(f_,"toCommonHandlerRegistry");function SO(r){return qe(r.addListener)&&qe(r.removeListener)}o(SO,"isNodeStyleEventEmitter");function CO(r){return qe(r.on)&&qe(r.off)}o(CO,"isJQueryStyleEventEmitter");function kO(r){return qe(r.addEventListener)&&qe(r.removeEventListener)}o(kO,"isEventTarget");function ll(r,e,t){r===void 0&&(r=0),t===void 0&&(t=G8);var n=-1;return e!=null&&(Ep(e)?t=e:n=e),new ct(function(i){var s=s_(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},s)})}o(ll,"timer");function Hb(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=W8(r),n=Y8(r,1/0),i=r;return i.length?i.length===1?Sr(i[0]):c_(n)(i_(i,t)):Ap}o(Hb,"merge");function u_(r,e){return nr(function(t,n){var i=0;t.subscribe(ir(n,function(s){return r.call(e,s,i++)&&n.next(s)}))})}o(u_,"filter");function l_(r){return nr(function(e,t){var n=!1;e.subscribe(ir(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}o(l_,"defaultIfEmpty");function h_(r){return r<=0?function(){return Ap}:nr(function(e,t){var n=0;e.subscribe(ir(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}o(h_,"take");function d_(r){return r===void 0&&(r=TO),nr(function(e,t){var n=!1;e.subscribe(ir(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}o(d_,"throwIfEmpty");function TO(){return new Up}o(TO,"defaultErrorFactory");function qb(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?u_(function(i,s){return r(i,s,n)}):tf,h_(1),t?l_(e):d_(function(){return new Up}))}}o(qb,"first");var MO={leading:!0,trailing:!1};function zb(r,e){return e===void 0&&(e=MO),nr(function(t,n){var i=e.leading,s=e.trailing,a=!1,c=null,f=null,l=!1,h=o(function(){f==null||f.unsubscribe(),f=null,s&&(x(),l&&n.complete())},"endThrottling"),d=o(function(){f=null,l&&n.complete()},"cleanupThrottling"),v=o(function(y){return f=Sr(r(y)).subscribe(ir(n,h,d))},"startThrottle"),x=o(function(){if(a){a=!1;var y=c;c=null,n.next(y),!l&&v(y)}},"send");t.subscribe(ir(n,function(y){a=!0,c=y,!(f&&!f.closed)&&(i?x():v(y))},function(){l=!0,!(s&&a&&f&&!f.closed)&&n.complete()}))})}o(zb,"throttle");var p_;(function(r){r[r.GENESIS=0]="GENESIS",r[r.PARTIAL=1]="PARTIAL",r[r.SIGNED=2]="SIGNED"})(p_||(p_={}));var ka;(function(r){r[r.NOT_REQUESTED=0]="NOT_REQUESTED",r[r.PENDING=1]="PENDING",r[r.PROCESSING=2]="PROCESSING",r[r.ANCHORED=3]="ANCHORED",r[r.FAILED=4]="FAILED"})(ka||(ka={}));var jb;(function(r){r[r.GENESIS=0]="GENESIS",r[r.SIGNED=1]="SIGNED",r[r.ANCHOR=2]="ANCHOR"})(jb||(jb={}));var Ca=class extends ct{constructor(e,t){super(n=>{e.subscribe(n)}),this.state$=e,this._context=t}get id(){return new Fe(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,Dp.default)((n=e==null?void 0:e.metadata)!=null?n:t)}get content(){var n;let{next:e,content:t}=this.state$.value;return(0,Dp.default)((n=e==null?void 0:e.content)!=null?n:t)}get controllers(){return this.metadata.controllers}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return tt.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>tt.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===jb.ANCHOR).map(({cid:e})=>tt.make(this.id,e))}get state(){return(0,Dp.default)(this.state$.value)}sync(){return M(this,arguments,function*(e={}){e=ne({sync:Er.PREFER_CACHE},e);let t=yield this.api.loadStream(this.id,e);this.state$.next(t.state)})}requestAnchor(){return M(this,null,function*(){return this.api.requestAnchor(this.id)})}};o(Ca,"Stream");function Kp(){return r=>{}}o(Kp,"StreamStatic");var __=ze(g_(),1);var Hp=ze(v_(),1);function w_(){globalThis.AbortController||(globalThis.AbortController=Hp.AbortController),globalThis.AbortSignal||(globalThis.AbortSignal=Hp.AbortSignal)}o(w_,"polyfillAbortController");w_();function x_(r){let e=new AbortController;if(r.length===0)throw Error("Need abort signals to create a merged abort signal");return r.some(t=>t.aborted)?(e.abort(),e.signal):(Hb(...r.map(t=>ul(t,"abort"))).pipe(qb()).subscribe(()=>{e.abort()}),e.signal)}o(x_,"mergeAbortSignals");var hl=class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=ll(e).subscribe(()=>{t.abort()})}clear(){var e;(e=this._subscription)==null||e.unsubscribe()}};o(hl,"TimedAbortSignal");var IO=60*1e3*3;function ln(t){return M(this,arguments,function*(r,e={}){e.body&&Object.assign(e,{body:JSON.stringify(e.body),headers:{"Content-Type":"application/json"}});let n=e.timeout||IO,i=new hl(n);e.signal=e.signal?x_([e.signal,i.signal]):i.signal;let s=yield(0,__.default)(r,e).finally(()=>i.clear());if(!s.ok){let a=yield s.text();throw new Error(`HTTP request to '${r}' failed with status '${s.statusText}': ${a}`)}return s.json()})}o(ln,"fetchJson");var dl=ze(Nb(),1);Xi();function Oi(r){let e=Ne.asCID(r);if(e)return e;if(typeof r=="string")return Ne.parse(r);if(r instanceof Uint8Array)return Ne.decode(r);throw new Error(`${r} cannot be converted to a CID`)}o(Oi,"toCID");var ht=class{static streamIdFromState(e){return new Fe(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,dl.default)(e);return ht.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=jt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=jt(t.cacaoBlock,"base64")),t):(ht.isSignedCommit(e)&&(t.link=t.link.toString()),ht.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),t)}static deserializeCommit(e){let t=(0,dl.default)(e);return ht.isSignedCommitContainer(t)?(t.jws.link=Oi(t.jws.link),t.linkedBlock=Gt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Gt(t.cacaoBlock,"base64")),t):(ht.isSignedCommit(t)&&(t.link=Oi(t.link)),ht.isAnchorCommit(t)&&(t.proof=Oi(t.proof)),t.id&&(t.id=Oi(t.id)),t.prev&&(t.prev=Oi(t.prev)),t)}static serializeState(e){let t=(0,dl.default)(e);return t.log=t.log.map(n=>me(ne({},n),{cid:n.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=ka[t.anchorStatus]),t.anchorScheduledFor!=null&&(t.anchorScheduledFor=new Date(t.anchorScheduledFor).toISOString()),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),t.lastAnchored!=null&&(t.lastAnchored=t.lastAnchored.toString()),t.doctype=Gr.nameByCode(t.type),t}static deserializeState(e){let t=(0,dl.default)(e);t.doctype&&(t.type=Gr.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(i=>me(ne({},i),{cid:Oi(i.cid)})),t.anchorProof&&(t.anchorProof.txHash=Oi(t.anchorProof.txHash),t.anchorProof.root=Oi(t.anchorProof.root));let n=!0;return t.anchorStatus&&(t.anchorStatus=ka[t.anchorStatus],n=t.anchorStatus!==ka.FAILED&&t.anchorStatus!==ka.ANCHORED),t.anchorScheduledFor&&(n?t.anchorScheduledFor=Date.parse(t.anchorScheduledFor):delete t.anchorScheduledFor),t.lastAnchored&&(t.lastAnchored=Oi(t.lastAnchored)),t}static statesEqual(e,t){return JSON.stringify(ht.serializeState(e))===JSON.stringify(ht.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let n in t.log)if(!e.log[n].cid.equals(t.log[n].cid))return!1;return e.anchorStatus==t.anchorStatus}static convertCommitToSignedCommitContainer(e,t){return M(this,null,function*(){if(ht.isSignedCommit(e)){let n=yield t.block.get(e.link);return{jws:e,linkedBlock:n}}return e})}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}};o(ht,"StreamUtils");function A_(r){if(typeof r=="string"&&r.includes("@")){let[e,t]=r.split("@");if(!e||!t)throw new Error("Invalid accountId provided");return new pa({address:e,chainId:t})}return new pa(r)}o(A_,"normalizeAccountId");var pl=class extends Kb{next(e){let t=this.value;ht.statesEqual(t,e)||super.next(e)}};o(pl,"StreamStateSubject");var NO=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},ys,Vb={anchor:!0,publish:!0,pin:!0,sync:Er.PREFER_CACHE},OO={sync:Er.PREFER_CACHE},E_={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function Gb(r,e){var n;if(typeof(r==null?void 0:r.schema)=="string")try{tt.fromString(r.schema)}catch(i){throw new Error("Schema must be a CommitID")}let t={controllers:r==null?void 0:r.controllers,family:r==null?void 0:r.family,schema:(n=r==null?void 0:r.schema)==null?void 0:n.toString(),tags:r==null?void 0:r.tags};if(e)r!=null&&r.deterministic||(t.unique=jt((0,S_.randomBytes)(12),"base64")),r!=null&&r.forbidControllerChange&&(t.forbidControllerChange=!0);else{if((r==null?void 0:r.deterministic)!==void 0||(r==null?void 0:r.unique)!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if((r==null?void 0:r.forbidControllerChange)!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(t).forEach(i=>t[i]===void 0&&delete t[i]),t}o(Gb,"headerFromMetadata");function C_(r){return M(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(C_,"_ensureAuthenticated");function qp(r,e){return M(this,null,function*(){return yield C_(r),r.did.createDagJWS(e)})}o(qp,"_signDagJWS");function Jb(){return M(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(Jb,"throwReadOnlyError");var hn=ys=o(class extends Ca{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}static create(s,a,c){return M(this,arguments,function*(e,t,n,i={}){i=ne(ne({},Vb),i),!(n!=null&&n.deterministic)&&i.syncTimeoutSeconds==null&&(i.syncTimeoutSeconds=0);let f=i.asDID?{did:i.asDID}:e,l=yield ys.makeGenesis(f,t,n);return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,l,i)})}static createFromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){var c;n=ne(ne({},Vb),n),((c=t.header)==null?void 0:c.unique)&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=t.data?yield qp(e,t):t;return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,a,n)})}static deterministic(i,s){return M(this,arguments,function*(e,t,n={}){if(n=ne(ne({},Vb),n),t=me(ne({},t),{deterministic:!0}),t.family==null&&t.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=yield ys.makeGenesis(e,null,t);return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,a,n)})}static load(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},OO),n);let a=ni.from(t);if(a.type!=ys.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${ys.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}update(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},E_),n);let a=n.asDID?{did:n.asDID}:this.api,c=yield this.makeCommit(a,e,t),f=yield this.api.applyCommit(this.id,c,n);this.state$.next(f.state)})}patch(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},E_),t);let s={header:Gb(this.metadata,!1),data:e,prev:this.tip,id:this.state$.id.cid},a=yield qp(this.api,s),c=yield this.api.applyCommit(this.id,a,t);this.state$.next(c.state)})}makeReadOnly(){this.update=Jb,this.patch=Jb,this.sync=Jb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}makeCommit(e,t,n){return M(this,null,function*(){var c;let i=Gb(n,!1);if(t==null&&(t=this.content),i.controllers&&((c=i.controllers)==null?void 0:c.length)!==1)throw new Error("Exactly one controller must be specified");let s=G4.compare(this.content,t),a={header:i,data:s,prev:this.tip,id:this.state.log[0].cid};return qp(e,a)})}static makeGenesis(e,t,n){return M(this,null,function*(){var a;if(n||(n={}),!n.controllers||n.controllers.length===0)if(e.did)yield C_(e),n.controllers=[e.did.hasParent?e.did.parent:e.did.id];else throw new Error("No controllers specified");if(((a=n.controllers)==null?void 0:a.length)!==1)throw new Error("Exactly one controller must be specified");let i=Gb(n,!0);if((n==null?void 0:n.deterministic)&&t)throw new Error("Initial content must be null when creating a deterministic Tile document");if(t==null){let c={header:i};return v1(c),c}return qp(e,{data:t,header:i})})}},"TileDocument");hn.STREAM_TYPE_NAME="tile";hn.STREAM_TYPE_ID=0;hn=ys=NO([Kp()],hn);var P_=ze(B_(),1);function HO(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(HO,"_checkPrivateRedeclaration");function qO(r,e){return e.get?e.get.call(r):e.value}o(qO,"_classApplyDescriptorGet");function zO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(zO,"_classApplyDescriptorSet");function O_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(O_,"_classExtractFieldDescriptor");function Xb(r,e){var t=O_(r,e,"get");return qO(r,t)}o(Xb,"_classPrivateFieldGet");function I_(r,e,t){HO(r,e),e.set(r,t)}o(I_,"_classPrivateFieldInit");function N_(r,e,t){var n=O_(r,e,"set");return zO(r,n,t),t}o(N_,"_classPrivateFieldSet");function jO(r){return typeof r=="string"||tt.isInstance(r)||Fe.isInstance(r)?{streamId:r}:{streamId:r.streamId,genesis:r.genesis}}o(jO,"keyToQuery");function Zb(r){return typeof r=="string"?ni.from(r).toString():tt.isInstance(r)||Fe.isInstance(r)?r.toString():r.streamId.toString()}o(Zb,"keyToString");function eg(r){return M(this,null,function*(){let e=yield hn.makeGenesis({},null,me(ne({},r),{deterministic:!0})),t=yield Fe.fromGenesis("tile",e);return{genesis:e,streamId:t}})}o(eg,"getDeterministicQuery");var VO=o(()=>Promise.resolve([]),"tempBatchLoadFn"),zp=new WeakMap,Qb=new WeakMap,Un=class extends P_.default{cache(e){if(!Xb(this,Qb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}create(e,t,n){return M(this,null,function*(){let i=yield hn.create(Xb(this,zp),e,t,n);return this.cache(i),i})}deterministic(e,t){return M(this,null,function*(){let n=yield eg(e);try{return yield h0(Un.prototype,this,"load").call(this,n)}catch(i){let s=yield hn.createFromGenesis(Xb(this,zp),n.genesis,t);return this.cache(s),s}})}load(e){return M(this,null,function*(){return yield h0(Un.prototype,this,"load").call(this,e)})}update(e,t,n,i){return M(this,null,function*(){let s=Zb(e);this.clear(s);let a=yield this.load({streamId:s});return yield a.update(t,n,i),a})}constructor(e){super(VO,{cache:!0,cacheKeyFn:Zb,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),I_(this,zp,{writable:!0,value:void 0}),I_(this,Qb,{writable:!0,value:void 0}),this._batchLoadFn=t=>M(this,null,function*(){e.cache||this.clearAll();let n=yield e.ceramic.multiQuery(t.map(jO),e.multiqueryTimeout);return t.map(i=>{let s=Zb(i),a=n[s];return a||new Error(`Failed to load stream: ${s}`)})}),N_(this,zp,e.ceramic),N_(this,Qb,!!e.cache)}};o(Un,"TileLoader");function GO(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(GO,"_checkPrivateRedeclaration");function JO(r,e){return e.get?e.get.call(r):e.value}o(JO,"_classApplyDescriptorGet");function WO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(WO,"_classApplyDescriptorSet");function U_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(U_,"_classExtractFieldDescriptor");function Ta(r,e){var t=U_(r,e,"get");return JO(r,t)}o(Ta,"_classPrivateFieldGet");function R_(r,e,t){GO(r,e),e.set(r,t)}o(R_,"_classPrivateFieldInit");function tg(r,e,t){var n=U_(r,e,"set");return WO(r,n,t),t}o(tg,"_classPrivateFieldSet");var sf=new WeakMap,of=new WeakMap,af=class{get aliases(){return Ta(this,sf)}get loader(){return Ta(this,of)}getDefinitionID(e){var t;return(t=Ta(this,sf).definitions[e])!=null?t:null}getSchemaURL(e){var t;return(t=Ta(this,sf).schemas[e])!=null?t:null}getTileID(e){var t;return(t=Ta(this,sf).tiles[e])!=null?t:null}loadTile(e){return M(this,null,function*(){let t=this.getTileID(e);if(t==null)throw new Error(`Tile alias "${e}" is not defined`);return yield Ta(this,of).load(t)})}createTile(i,s){return M(this,arguments,function*(e,t,n={}){let a=this.getSchemaURL(e);if(a==null)throw new Error(`Schema alias "${e}" is not defined`);let h=n,{controller:c}=h,f=ft(h,["controller"]),l={schema:a};return c!=null&&(l.controllers=[c]),yield Ta(this,of).create(t,l,f)})}constructor(e){if(R_(this,sf,{writable:!0,value:void 0}),R_(this,of,{writable:!0,value:void 0}),tg(this,sf,e.aliases),e.loader!=null)tg(this,of,e.loader);else{if(e.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");tg(this,of,new Un({ceramic:e.ceramic,cache:e.cache}))}}};o(af,"DataModel");function YO(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(YO,"_checkPrivateRedeclaration");function XO(r,e){return e.get?e.get.call(r):e.value}o(XO,"_classApplyDescriptorGet");function ZO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(ZO,"_classApplyDescriptorSet");function L_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(L_,"_classExtractFieldDescriptor");function Pi(r,e){var t=L_(r,e,"get");return XO(r,t)}o(Pi,"_classPrivateFieldGet");function jp(r,e,t){YO(r,e),e.set(r,t)}o(jp,"_classPrivateFieldInit");function Vp(r,e,t){var n=L_(r,e,"set");return ZO(r,n,t),t}o(Vp,"_classPrivateFieldSet");var Gp=new WeakMap,Ma=new WeakMap,rg=new WeakMap,Jp=new WeakMap,ml=class{_createValuePromise(){Vp(this,rg,new Promise((e,t)=>{Vp(this,Jp,{resolve:e,reject:t})}))}change(e){return new Promise((t,n)=>{let i=o(s=>M(this,null,function*(){try{let a=yield e(s);t(),this._next(a)}catch(a){n(a),this._next(s)}}),"run");Pi(this,Ma).push({reject:n,run:i}),Pi(this,Ma).length===1&&this._start()})}changeContent(e){return M(this,null,function*(){let t=o(n=>M(this,null,function*(){return yield n.update(e(n.content),n.metadata),n}),"mutation");return yield this.change(t)})}get(){return M(this,null,function*(){return Pi(this,Ma).length===0?yield Pi(this,Gp).call(this):yield Pi(this,rg)})}_start(){return M(this,null,function*(){try{let e=yield Pi(this,Gp).call(this);this._next(e)}catch(e){Pi(this,Ma).forEach(t=>{t.reject(e)}),Vp(this,Ma,[]),Pi(this,Jp).reject(e),this._createValuePromise()}})}_next(e){let t=Pi(this,Ma).shift();t==null?this._end(e):t.run(e)}_end(e){Pi(this,Jp).resolve(e),this._createValuePromise()}constructor(e){jp(this,Gp,{writable:!0,value:void 0}),jp(this,Ma,{writable:!0,value:[]}),jp(this,rg,{writable:!0,value:void 0}),jp(this,Jp,{writable:!0,value:void 0}),Vp(this,Gp,e),this._createValuePromise()}};o(ml,"TileProxy");var QO=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function eP(r){return QO.test(r)}o(eP,"isDIDstring");function tP(r){if(!eP(r))throw new Error(`Invalid DID: ${r}`)}o(tP,"assertDIDstring");function ng(r){return tP(r),{controllers:[r],family:"IDX"}}o(ng,"getIDXMetadata");function rP(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(rP,"_checkPrivateRedeclaration");function nP(r,e){return e.get?e.get.call(r):e.value}o(nP,"_classApplyDescriptorGet");function iP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(iP,"_classApplyDescriptorSet");function D_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(D_,"_classExtractFieldDescriptor");function $t(r,e){var t=D_(r,e,"get");return nP(r,t)}o($t,"_classPrivateFieldGet");function bl(r,e,t){rP(r,e),e.set(r,t)}o(bl,"_classPrivateFieldInit");function Wp(r,e,t){var n=D_(r,e,"set");return iP(r,n,t),t}o(Wp,"_classPrivateFieldSet");var vs=new WeakMap,Yp=new WeakMap,ig=new WeakMap,Ri=new WeakMap,Xp=new WeakMap,gl=class{get authenticated(){return $t(this,vs).did!=null}get ceramic(){return $t(this,vs)}get id(){if($t(this,Yp)!=null)return $t(this,Yp);if($t(this,vs).did==null)throw new Error("Ceramic instance is not authenticated");return $t(this,vs).did.hasParent?$t(this,vs).did.parent:$t(this,vs).did.id}get loader(){return $t(this,Ri)}get model(){return $t(this,Xp)}has(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return(yield this.getRecordID(n,t))!=null})}get(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return yield this.getRecord(n,t)})}getMultiple(e,t){return M(this,null,function*(){var c,f,l;let n=this.getDefinitionID(e),i=yield Promise.all(t.map(h=>M(this,null,function*(){let{genesis:d,streamId:v}=yield eg(ng(h));return{genesis:d,streamId:v.toString(),paths:[n]}}))),s=yield $t(this,vs).multiQuery(i),a=[];for(let h of i){let d=(f=(c=s[h.streamId])==null?void 0:c.content)==null?void 0:f[n],v=d?s[Fe.fromString(d).toString()]:null;a.push((l=v==null?void 0:v.content)!=null?l:null)}return a})}set(i,s){return M(this,arguments,function*(e,t,n={}){var l;let a=this.getDefinitionID(e),[c,f]=yield this._setRecordOnly(a,t,n);return c&&(yield this._setReference((l=n.controller)!=null?l:this.id,a,f)),f})}merge(i,s){return M(this,arguments,function*(e,t,n={}){let a=this.getDefinitionID(e),c=yield this.getRecord(a),f=c?ne(ne({},c),t):t;return yield this.setRecord(a,f,n)})}setAll(n){return M(this,arguments,function*(e,t={}){var c;let i=Object.entries(e).map(h=>M(this,[h],function*([f,l]){let d=this.getDefinitionID(f),[v,x]=yield this._setRecordOnly(d,l,t);return[v,d,x]})),a=(yield Promise.all(i)).reduce((f,[l,h,d])=>(l&&(f[h]=d.toUrl()),f),{});return yield this._setReferences((c=t.controller)!=null?c:this.id,a),a})}setDefaults(n){return M(this,arguments,function*(e,t={}){var f,l;let i=(f=yield this.getIndex())!=null?f:{},s=Object.entries(e).map(([h,d])=>[this.getDefinitionID(h),d]).filter(h=>i[h[0]]==null).map(v=>M(this,[v],function*([h,d]){let x=yield this.getDefinition(h),y=yield this._createRecord(x,d,t);return{[h]:y.toUrl()}})),c=(yield Promise.all(s)).reduce((h,d)=>Object.assign(h,d),{});return yield this._setReferences((l=t.controller)!=null?l:this.id,c),c})}remove(n){return M(this,arguments,function*(e,t=this.id){yield this._getIndexProxy(t).changeContent(i=>(i!=null&&delete i[this.getDefinitionID(e)],i))})}getIndex(){return M(this,arguments,function*(e=this.id){let t=this.authenticated&&e===this.id?yield this._getIndexProxy(e).get():yield this._getIDXDoc(e);return t?t.content:null})}iterator(e){let t,n=0;return{[Symbol.asyncIterator](){return this},next:()=>M(this,null,function*(){if(t==null){let c=yield this.getIndex(e);t=Object.entries(c!=null?c:{})}if(n===t.length)return{done:!0,value:null};let[i,s]=t[n++],a=yield $t(this,Ri).load(s);return{done:!1,value:{key:i,id:s,record:a.content}}})}}_createIDXDoc(e){return M(this,null,function*(){return yield $t(this,Ri).deterministic(ng(e))})}_getIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)return null;if(t.metadata.schema!==rp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getOwnIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)yield t.update({},{schema:rp});else if(t.metadata.schema!==rp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getIndexProxy(e){let t=$t(this,ig)[e];return t==null&&(t=new ml(()=>M(this,null,function*(){return yield this._getOwnIDXDoc(e)})),$t(this,ig)[e]=t),t}getDefinitionID(e){var t;return(t=$t(this,Xp).getDefinitionID(e))!=null?t:e}getDefinition(e){return M(this,null,function*(){let t=yield $t(this,Ri).load(e);if(t.metadata.schema!==z4)throw new Error("Invalid document: schema is not Definition");return me(ne({},t.content),{id:t.id})})}getRecordID(e,t){return M(this,null,function*(){var i;let n=yield this.getIndex(t!=null?t:this.id);return(i=n==null?void 0:n[e])!=null?i:null})}getRecordDocument(e,t){return M(this,null,function*(){let n=yield this.getRecordID(e,t);return n?yield $t(this,Ri).load(n):null})}getRecord(e,t){return M(this,null,function*(){let n=yield this.getRecordDocument(e,t);return n?n.content:null})}setRecord(i,s){return M(this,arguments,function*(e,t,n={}){var f;let[a,c]=yield this._setRecordOnly(e,t,n);return a&&(yield this._setReference((f=n.controller)!=null?f:this.id,e,c)),c})}_setRecordOnly(e,t,n){return M(this,null,function*(){var s;let i=yield this.getRecordID(e,(s=n.controller)!=null?s:this.id);if(i==null){let a=yield this.getDefinition(e),c=yield this._createRecord(a,t,n);return[!0,c]}else{let a=yield $t(this,Ri).update(i,t);return[!1,a.id]}})}_createRecord(s,a,c){return M(this,arguments,function*(e,t,{controller:n,pin:i}){let f=yield $t(this,Ri).deterministic({controllers:[n!=null?n:this.id],family:e.id.toString()},{pin:i});return yield f.update(t,{schema:e.schema}),f.id})}_setReference(e,t,n){return M(this,null,function*(){yield this._getIndexProxy(e).changeContent(i=>me(ne({},i),{[t]:n.toUrl()}))})}_setReferences(e,t){return M(this,null,function*(){Object.keys(t).length!==0&&(yield this._getIndexProxy(e).changeContent(n=>ne(ne({},n),t)))})}constructor(e){bl(this,vs,{writable:!0,value:void 0}),bl(this,Yp,{writable:!0,value:void 0}),bl(this,ig,{writable:!0,value:{}}),bl(this,Ri,{writable:!0,value:void 0}),bl(this,Xp,{writable:!0,value:void 0});let{cache:t,ceramic:n,id:i,loader:s,model:a}=e;Wp(this,vs,n),Wp(this,Yp,i),Wp(this,Ri,s!=null?s:new Un({ceramic:n,cache:t})),Wp(this,Xp,a instanceof af?a:new af({loader:$t(this,Ri),aliases:a}))}};o(gl,"DIDDataStore");function sg(r){return typeof r=="string"?Fe.fromString(r):r}o(sg,"typeStreamID");function K_(r,e){return e?r.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):r}o(K_,"combineURLs");var sA=ze(iA(),1),Or=class extends ct{constructor(e,t,n){super(i=>{this.state$.observers.length===0&&(this.periodicSubscription=ll(0,n).pipe(zb(()=>this._syncState(this.id,{sync:Er.PREFER_CACHE}))).subscribe()),this.state$.subscribe(i).add(()=>{var c;this.state$.observers.length===0&&((c=this.periodicSubscription)==null||c.unsubscribe())})}),this._apiUrl=t,this.state$=new pl(e)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}_syncState(e,t){return M(this,null,function*(){let n=yield Or._load(e,this._apiUrl,t);this.state$.next(ht.deserializeState(n))})}get id(){return new Fe(this.state$.value.type,this.state$.value.log[0].cid)}static createFromGenesis(e,t,n,i,s){return M(this,null,function*(){let{state:a}=yield ln(e+"/streams",{method:"post",body:{type:t,genesis:ht.serializeCommit(n),opts:i}});return new Or(ht.deserializeState(a),e,s)})}static applyCommit(e,t,n,i,s){return M(this,null,function*(){let{state:a}=yield ln(e+"/commits",{method:"post",body:{streamId:t.toString(),commit:ht.serializeCommit(n),opts:i}});return new Or(ht.deserializeState(a),e,s)})}static _load(e,t,n){return M(this,null,function*(){let i=t+"/streams/"+e.toString()+"?"+sA.default.stringify(n),{state:s}=yield ln(i);return s})}static load(e,t,n,i){return M(this,null,function*(){let s=yield Or._load(e,t,i);return new Or(ht.deserializeState(s),t,n)})}static loadStreamCommits(e,t){return M(this,null,function*(){let{commits:n}=yield ln(`${t}/commits/${e}`);return n.map(i=>({cid:i.cid,value:ht.deserializeCommit(i.value)}))})}complete(){this.state$.complete()}};o(Or,"Document");var pP=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Ba,cg=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),oA={anchor:!1,publish:!0,pin:!0,sync:Er.PREFER_CACHE},fg={anchor:!0,publish:!0,throwOnInvalidCommit:!0},mP={sync:Er.PREFER_CACHE},Ia=Ba=o(class extends Ca{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}static fromAccount(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},oA),n);let a=A_(t),c=Ba.makeGenesis(a);return Ba.fromGenesis(e,c,n)})}static fromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){return n=ne(ne({},oA),n),e.createStreamFromGenesis(Ba.STREAM_TYPE_ID,t,n)})}setDid(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},fg),n);let a=typeof e=="string"?e.trim():e.id,c=k0(a);if((c==null?void 0:c.did)!==a)throw new Error(`DID is not valid: '${a}'`);let f=yield t.createLink(a);return this.setDidProof(f,n)})}setDidProof(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},fg),t);let i=this.makeCommit(e),s=yield this.api.applyCommit(this.id,i,t);this.state$.next(s.state)})}clearDid(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},fg),t);let i=yield e.createLink("");return this.setDidProof(i,t)})}static load(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},mP),n);let a=ni.from(t);if(a.type!=Ba.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Ba.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}static makeGenesis(e){return e.chainId.namespace==="eip155"&&(e.address=e.address.toLowerCase()),{header:{controllers:[`${e.address}@${e.chainId.toString()}`],family:`caip10-${e.chainId.toString()}`}}}makeCommit(e){return{data:e,prev:this.tip,id:this.state$.id.cid}}makeReadOnly(){this.setDidProof=cg,this.setDid=cg,this.sync=cg,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link");Ia.STREAM_TYPE_NAME="caip10-link";Ia.STREAM_TYPE_ID=1;Ia=Ba=pP([Kp()],Ia);var yl=class{constructor(e){this._apiUrl=e}add(e,t){return M(this,null,function*(){let n={};t&&(n.force=!0),yield ln(this._apiUrl+`/pins/${e.toString()}`,{method:"post",body:n})})}rm(e,t){return M(this,null,function*(){yield ln(this._apiUrl+`/pins/${e.toString()}`,{method:"delete",body:{opts:t}})})}ls(e){return M(this,null,function*(){let t=this._apiUrl+"/pins";e&&(t+=`/${e.toString()}`);let n=yield ln(t),{pinnedStreamIds:i}=n;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===i.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:i[s++],done:!1})}}}}})}};o(yl,"RemotePinApi");var bP="/api/v0",gP="http://localhost:7007",yP={syncInterval:5e3},vP={anchor:!0,publish:!0,sync:Er.PREFER_CACHE},wP={anchor:!0,publish:!0,sync:Er.PREFER_CACHE},aA={sync:Er.PREFER_CACHE},vl=class{constructor(e=gP,t={}){this._config=ne(ne({},yP),t),this._apiUrl=K_(e,bP),this._streamCache=new Map,this.context={api:this},this.pin=new yl(this._apiUrl),this._streamConstructors={[hn.STREAM_TYPE_ID]:hn,[Ia.STREAM_TYPE_ID]:Ia}}get did(){return this.context.did}set did(e){this.context.did=e}createStreamFromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},wP),n);let a=yield Or.createFromGenesis(this._apiUrl,e,t,n,this._config.syncInterval),c=this._streamCache.get(a.id.toString());return c?(ht.statesEqual(a.state,c.state)||c.next(a.state),this.buildStream(c)):(this._streamCache.set(a.id.toString(),a),this.buildStream(a))})}loadStream(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},aA),t);let i=ni.from(e),s=this._streamCache.get(i.baseID.toString());return s?yield s._syncState(i,t):(s=yield Or.load(i,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(s.id.toString(),s)),this.buildStream(s)})}multiQuery(e,t){return M(this,null,function*(){let n=e.map(s=>me(ne({},s),{streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),i=yield ln(this._apiUrl+"/multiqueries",{method:"post",body:{queries:n,timeout:t}});return Object.entries(i).reduce((s,a)=>{let[c,f]=a,l=ht.deserializeState(f),h=new Or(l,this._apiUrl,this._config.syncInterval);return s[c]=this.buildStream(h),s},{})})}loadStreamCommits(e){let t=sg(e);return Or.loadStreamCommits(t,this._apiUrl)}applyCommit(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},vP),n);let a=sg(e),c=yield Or.applyCommit(this._apiUrl,a,t,n,this._config.syncInterval),f=this._streamCache.get(a.toString());return f?(f.next(c.state),this.buildStream(c)):(this._streamCache.set(a.toString(),c),this.buildStream(c))})}requestAnchor(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},aA),t);let{anchorStatus:i}=yield ln(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return i})}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}findStreamConstructor(e){let t=this._streamConstructors[e];if(t)return t;throw new Error(`Failed to find constructor for stream ${e}`)}buildStream(e){let t=this.findStreamConstructor(e.state.type);return new t(e,this.context)}setDID(e){return M(this,null,function*(){this.context.did=e})}getSupportedChains(){return M(this,null,function*(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=yield ln(this._apiUrl+"/node/chains");return this._supportedChains=e,e})}close(){return M(this,null,function*(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()})}};o(vl,"CeramicClient");var xP=o((r,e)=>M(void 0,null,function*(){var f,l;let t=new vl(e),n=ne({},cA.default.getResolver()),i=new ga({resolver:n});t.did=i;let s=JSON.parse(JSON.stringify(r.contents)),a=(l=(f=s==null?void 0:s.find(h=>(h==null?void 0:h.name)==="DID Key Secret"))==null?void 0:f.value)!=null?l:"",c=new Yu(_l(a));return t.did.setProvider(c),yield t.did.authenticate(),t}),"getCeramicClientFromWalletSuite"),Zp=o((s,a)=>M(void 0,[s,a],function*(r,{modelData:e,credentialAlias:t,ceramicEndpoint:n,defaultContentFamily:i}){let c=yield xP(r,n),f=new Un({ceramic:c}),l=new gl({ceramic:c,model:e}),h=o((..._)=>M(void 0,[..._],function*(y=t){return(yield l.get(y))||{credentials:[]}}),"getCredentialsListFromIndex"),d=o((y,_)=>M(void 0,null,function*(){if(!y)throw new Error("record is required");if(!y.id)throw Error("No streamId provided");y.id.indexOf("ceramic://")===-1&&(y.id="ceramic://"+y.id),_||(_=t);let U=yield h(_);return U.credentials.push(ne({storageType:"ceramic"},y)),l.set(_,U)}),"addCredentialStreamIdToIndex"),v=o((E,...L)=>M(void 0,[E,...L],function*(y,_={},U={}){if(!y)throw new Error("content is required");return _.controllers||(_.controllers=[c.did.id]),_.family||(_.family=i),"pin"in U||(U.pin=!0),(yield hn.create(c,y,_,U)).id.toString()}),"publishContentToCeramic"),x=o(y=>M(void 0,null,function*(){var _;return(_=yield f.load(y))==null?void 0:_.content}),"readContentFromCeramic");return{pluginMethods:{getCredentialsListFromIndex:(U,...E)=>M(void 0,[U,...E],function*(y,_=t){return h(_)}),publishContentToCeramic:(y,_)=>M(void 0,null,function*(){return v(_)}),readContentFromCeramic:(y,_)=>M(void 0,null,function*(){return x(_)}),getVerifiableCredentialFromIndex:(y,_)=>M(void 0,null,function*(){var L;let U=yield h(),E=(L=U==null?void 0:U.credentials)==null?void 0:L.find(H=>(H==null?void 0:H.title)===_);return E&&(yield x(E.id))}),getVerifiableCredentialsFromIndex:()=>M(void 0,null,function*(){var U,E;let y=yield h(),_=(E=(U=y==null?void 0:y.credentials)==null?void 0:U.map(L=>L==null?void 0:L.id))!=null?E:[];return Promise.all(_.map(L=>M(void 0,null,function*(){return x(L)})))}),addVerifiableCredentialInIdx:(E,L)=>M(void 0,[E,L],function*(y,{title:_,id:U}){return d({title:_,id:U})})},pluginConstants:{}}}),"getIDXPlugin");var _P=o(r=>M(void 0,null,function*(){let e=yield Ch.subtle.digest("SHA-256",r);return`urn:digest:${Buffer.from(new Uint8Array(e)).toString("hex")}`}),"seedToId"),fA=o(r=>M(void 0,null,function*(){let e=JSON.parse(wg(r)),t=xg("key",JSON.stringify(e)),l=e,{d:n}=l,i=ft(l,["d"]),s={controller:t,id:`${t}#${t.split(":").at(-1)}`,privateKeyJwk:e,publicKeyJwk:i,type:"JsonWebKey2020"},a=yield _P(r),c={"@context":["http://w3id.org/wallet/v1"],id:a,name:"DID Key Secret",image:"https://via.placeholder.com/150",description:"Used to generate a DID with a signing and encryption key.",tags:["inception"],type:"Entropy",value:Buffer.from(r).toString("hex")},f=me(ne({},s),{"@context":["http://w3id.org/wallet/v1"],name:"Signing Key",image:"https://via.placeholder.com/150",description:"Used to produce digital signatures.",tags:["inception"],generatedFrom:[c.id]});return[c,f]}),"generateContentFromSeed");var ug={pluginMethods:{getSubjectDid:r=>{var e,t;return(t=(e=r.contents.find(n=>n.name==="Signing Key"))==null?void 0:e.controller)!=null?t:""},getSubjectKeypair:r=>{var e;return(e=r.contents.find(t=>t.name==="Signing Key"))==null?void 0:e.privateKeyJwk}},pluginConstants:{generateContentFromSeed:fA}};var uA=o(r=>({pluginMethods:{verifyCredential:(e,t)=>M(void 0,null,function*(){let n=yield r.pluginMethods.verifyCredential(t);return t.expirationDate&&(n.checks.push("expiration"),new Date>new Date(t.expirationDate)&&n.errors.push("expiration error: Credential is expired")),n})},pluginConstants:{}}),"ExpirationPlugin");var lA=o((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectKeypair();if(!t)throw new Error("Cannot issue credential: Could not get subject keypair");let n=JSON.stringify(t),i=JSON.stringify({verificationMethod:yield Cl("key",n),proofPurpose:"assertionMethod"});return JSON.parse(yield _g(JSON.stringify(e),i,n))}),"issueCredential");var hA=o(r=>M(void 0,null,function*(){return JSON.parse(yield Ag(JSON.stringify(r),"{}"))}),"verifyCredential");var dA=o((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectDid();if(!t)throw new Error("Cannot create presentation: No holder key found");let n=t,i=r.pluginMethods.getSubjectKeypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let s=JSON.stringify(i),a=JSON.stringify({verificationMethod:yield Cl("key",s),proofPurpose:"assertionMethod"}),c=JSON.stringify({"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:n,verifiableCredential:e});return JSON.parse(yield Eg(c,a,s))}),"issuePresentation");var pA=o(r=>M(void 0,null,function*(){return JSON.parse(yield Sg(JSON.stringify(r),"{}"))}),"verifyPresentation");var lg=o(r=>M(void 0,null,function*(){return{pluginMethods:me(ne({},r.pluginMethods),{issueCredential:lA,verifyCredential:(e,t)=>M(void 0,null,function*(){return hA(t)}),issuePresentation:dA,verifyPresentation:(e,t)=>M(void 0,null,function*(){return pA(t)}),getTestVc:(e,t="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.pluginMethods.getSubjectDid();return{"@context":"https://www.w3.org/2018/credentials/v1",id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:n,issuanceDate:"2020-08-19T21:41:50Z",credentialSubject:{id:t}}}}),pluginConstants:{}}}),"getVCPlugin");var wl=(r=>(r.Success="Success",r.Failed="Failed",r.Error="Error",r))(wl||{});var mA=o(r=>e=>M(void 0,null,function*(){let t=yield r.pluginMethods.verifyCredential(e),n=[];return t.errors.forEach(i=>{n.push({status:wl.Failed,check:"hmm",details:i})}),t.warnings.forEach(i=>{n.push({status:wl.Error,check:"hmm",message:i})}),t.checks.forEach(i=>{n.push({status:wl.Success,check:i,message:i==="proof"?"Valid":i})}),n}),"verifyCredential");var hg={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials",ceramicEndpoint:"https://ceramic-node.welibrary.io:7007",defaultContentFamily:"SuperSkills"};var dg=o((n,...i)=>M(void 0,[n,...i],function*(r,{ceramicIdx:e=hg,didkit:t}={}){yield p0(t);let s=yield(yield ou(r)).addPlugin(ug),a=yield s.addPlugin(yield lg(s)),c=yield a.addPlugin(yield Zp(a,e)),f=yield c.addPlugin(uA(c));return{_wallet:f,get did(){return f.pluginMethods.getSubjectDid()},get keypair(){return f.pluginMethods.getSubjectKeypair()},issueCredential:f.pluginMethods.issueCredential,verifyCredential:mA(f),issuePresentation:f.pluginMethods.issuePresentation,verifyPresentation:f.pluginMethods.verifyPresentation,getCredential:f.pluginMethods.getVerifiableCredentialFromIndex,getCredentials:f.pluginMethods.getVerifiableCredentialsFromIndex,publishCredential:f.pluginMethods.publishContentToCeramic,addCredential:l=>M(void 0,null,function*(){yield f.pluginMethods.addVerifiableCredentialInIdx(l)}),readFromCeramic:f.pluginMethods.readContentFromCeramic,getTestVc:f.pluginMethods.getTestVc}}),"createWallet"),bA=o((n,...i)=>M(void 0,[n,...i],function*(r,{ceramicIdx:e=hg,didkit:t}={}){yield p0(t);let s=yield ug.pluginConstants.generateContentFromSeed(_l(r.padStart(64,"0")));return dg(s,{ceramicIdx:e,didkit:t})}),"walletFromKey");
|
819
|
+
/*!
|
820
|
+
* Copyright (c) 2014, GMO GlobalSign
|
821
|
+
* Copyright (c) 2015-2022, Peculiar Ventures
|
822
|
+
* All rights reserved.
|
823
|
+
*
|
824
|
+
* Author 2014-2019, Yury Strozhevsky
|
825
|
+
*
|
826
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
827
|
+
* are permitted provided that the following conditions are met:
|
828
|
+
*
|
829
|
+
* * Redistributions of source code must retain the above copyright notice, this
|
830
|
+
* list of conditions and the following disclaimer.
|
831
|
+
*
|
832
|
+
* * Redistributions in binary form must reproduce the above copyright notice, this
|
833
|
+
* list of conditions and the following disclaimer in the documentation and/or
|
834
|
+
* other materials provided with the distribution.
|
835
|
+
*
|
836
|
+
* * Neither the name of the copyright holder nor the names of its
|
837
|
+
* contributors may be used to endorse or promote products derived from
|
838
|
+
* this software without specific prior written permission.
|
839
|
+
*
|
840
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
841
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
842
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
843
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
844
|
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
845
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
846
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
847
|
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
848
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
849
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
850
|
+
*
|
851
|
+
*/
|
852
|
+
/*!
|
853
|
+
* MIT License
|
854
|
+
*
|
855
|
+
* Copyright (c) 2017-2022 Peculiar Ventures, LLC
|
856
|
+
*
|
857
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
858
|
+
* of this software and associated documentation files (the "Software"), to deal
|
859
|
+
* in the Software without restriction, including without limitation the rights
|
860
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
861
|
+
* copies of the Software, and to permit persons to whom the Software is
|
862
|
+
* furnished to do so, subject to the following conditions:
|
863
|
+
*
|
864
|
+
* The above copyright notice and this permission notice shall be included in all
|
865
|
+
* copies or substantial portions of the Software.
|
866
|
+
*
|
867
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
868
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
869
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
870
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
871
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
872
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
873
|
+
* SOFTWARE.
|
874
|
+
*
|
875
|
+
*/
|
876
|
+
/*!
|
877
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
878
|
+
* (c) 2017-2021 Joachim Wester
|
879
|
+
* MIT license
|
880
|
+
*/
|
881
|
+
/*!
|
882
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
883
|
+
* (c) 2017-2022 Joachim Wester
|
884
|
+
* MIT licensed
|
885
|
+
*/
|
886
|
+
/*!
|
887
|
+
Copyright (c) Peculiar Ventures, LLC
|
888
|
+
*/
|
889
|
+
/**
|
890
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
891
|
+
*
|
892
|
+
* @version 0.8.0
|
893
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
894
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
895
|
+
* @license MIT
|
896
|
+
*/
|