@snapshot-labs/snapshot.js 0.12.44 → 0.12.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1519,12 +1519,13 @@ function getSnapshots(network_1, snapshot_1, provider_1, networks_1) {
1519
1519
 
1520
1520
  const providers = {};
1521
1521
  const DEFAULT_BROVIDER_URL = 'https://rpc.snapshot.org';
1522
- function getProvider(network, { broviderUrl = DEFAULT_BROVIDER_URL } = {}) {
1522
+ const DEFAULT_TIMEOUT = 25000;
1523
+ function getProvider(network, { broviderUrl = DEFAULT_BROVIDER_URL, timeout = DEFAULT_TIMEOUT } = {}) {
1523
1524
  const url = `${broviderUrl}/${network}`;
1524
1525
  if (!providers[network])
1525
1526
  providers[network] = new providers$1.StaticJsonRpcProvider({
1526
1527
  url,
1527
- timeout: 25000,
1528
+ timeout,
1528
1529
  allowGzip: true
1529
1530
  }, Number(network));
1530
1531
  return providers[network];
@@ -1509,12 +1509,13 @@ function getSnapshots(network_1, snapshot_1, provider_1, networks_1) {
1509
1509
 
1510
1510
  const providers = {};
1511
1511
  const DEFAULT_BROVIDER_URL = 'https://rpc.snapshot.org';
1512
- function getProvider(network, { broviderUrl = DEFAULT_BROVIDER_URL } = {}) {
1512
+ const DEFAULT_TIMEOUT = 25000;
1513
+ function getProvider(network, { broviderUrl = DEFAULT_BROVIDER_URL, timeout = DEFAULT_TIMEOUT } = {}) {
1513
1514
  const url = `${broviderUrl}/${network}`;
1514
1515
  if (!providers[network])
1515
1516
  providers[network] = new StaticJsonRpcProvider({
1516
1517
  url,
1517
- timeout: 25000,
1518
+ timeout,
1518
1519
  allowGzip: true
1519
1520
  }, Number(network));
1520
1521
  return providers[network];
@@ -18,7 +18,7 @@
18
18
  || ${u} === "boolean" || ${o} === null`).assign(l,Wl._`[${o}]`)}}i.else(),h(t),i.endIf(),i.if(Wl._`${l} !== undefined`,(()=>{i.assign(o,l),function({gen:t,parentData:e,parentDataProperty:r},i){t.if(Wl._`${e} !== undefined`,(()=>t.assign(Wl._`${e}[${r}]`,i)))}(t,l)}))}(t,e,u):h(t)}))}return l};const n=new Set(["string","number","integer","boolean","null"]);function o(t,e,i,n=r.Correct){const o=n===r.Correct?Wl.operators.EQ:Wl.operators.NEQ;let s;switch(t){case"null":return Wl._`${e} ${o} null`;case"array":s=Wl._`Array.isArray(${e})`;break;case"object":s=Wl._`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=a(Wl._`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=a();break;default:return Wl._`typeof ${e} ${o} ${t}`}return n===r.Correct?s:(0,Wl.not)(s);function a(t=Wl.nil){return(0,Wl.and)(Wl._`typeof ${e} == "number"`,t,i?Wl._`isFinite(${e})`:Wl.nil)}}function s(t,e,r,i){if(1===t.length)return o(t[0],e,r,i);let n;const s=(0,Yl.toHash)(t);if(s.array&&s.object){const t=Wl._`typeof ${e} != "object"`;n=s.null?t:Wl._`!${e} || ${t}`,delete s.null,delete s.array,delete s.object}else n=Wl.nil;s.number&&delete s.integer;for(const t in s)n=(0,Wl.and)(n,o(t,e,r,i));return n}e.checkDataType=o,e.checkDataTypes=s;const a={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>"string"==typeof t?Wl._`{type: ${t}}`:Wl._`{type: ${e}}`};function h(t){const e=function(t){const{gen:e,data:r,schema:i}=t,n=(0,Yl.schemaRefOrVal)(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);(0,ec.reportError)(e,a)}e.reportTypeError=h})),sc=o((function(t,e){function r(t,e,r){const{gen:i,compositeRule:n,data:o,opts:s}=t;if(void 0===r)return;const a=Wl._`${o}${(0,Wl.getProperty)(e)}`;if(n)return void(0,Yl.checkStrictMode)(t,`default is ignored for: ${a}`);let h=Wl._`${a} === undefined`;"empty"===s.useDefaults&&(h=Wl._`${h} || ${a} === null || ${a} === ""`),i.if(h,Wl._`${a} = ${(0,Wl.stringify)(r)}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0,e.assignDefaults=function(t,e){const{properties:i,items:n}=t.schema;if("object"===e&&i)for(const e in i)r(t,e,i[e].default);else"array"===e&&Array.isArray(n)&&n.forEach(((e,i)=>r(t,i,e.default)))}})),ac=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;const r=Yl;function i(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Wl._`Object.prototype.hasOwnProperty`})}function n(t,e,r){return Wl._`${i(t)}.call(${e}, ${r})`}function o(t,e,r,i){const o=Wl._`${e}${(0,Wl.getProperty)(r)} === undefined`;return i?(0,Wl.or)(o,(0,Wl.not)(n(t,e,r))):o}function s(t){return t?Object.keys(t).filter((t=>"__proto__"!==t)):[]}e.checkReportMissingProp=function(t,e){const{gen:r,data:i,it:n}=t;r.if(o(r,i,e,n.opts.ownProperties),(()=>{t.setParams({missingProperty:Wl._`${e}`},!0),t.error()}))},e.checkMissingProp=function({gen:t,data:e,it:{opts:r}},i,n){return(0,Wl.or)(...i.map((i=>(0,Wl.and)(o(t,e,i,r.ownProperties),Wl._`${n} = ${i}`))))},e.reportMissingProp=function(t,e){t.setParams({missingProperty:e},!0),t.error()},e.hasPropFunc=i,e.isOwnProperty=n,e.propertyInData=function(t,e,r,i){const o=Wl._`${e}${(0,Wl.getProperty)(r)} !== undefined`;return i?Wl._`${o} && ${n(t,e,r)}`:o},e.noPropertyInData=o,e.allSchemaProperties=s,e.schemaProperties=function(t,e){return s(e).filter((r=>!(0,Yl.alwaysValidSchema)(t,e[r])))},e.callValidateCode=function({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,h,u){const l=u?Wl._`${t}, ${e}, ${i}${n}`:e,c=[[tc.default.instancePath,(0,Wl.strConcat)(tc.default.instancePath,o)],[tc.default.parentData,s.parentData],[tc.default.parentDataProperty,s.parentDataProperty],[tc.default.rootData,tc.default.rootData]];s.opts.dynamicRef&&c.push([tc.default.dynamicAnchors,tc.default.dynamicAnchors]);const f=Wl._`${l}, ${r.object(...c)}`;return h!==Wl.nil?Wl._`${a}.call(${h}, ${f})`:Wl._`${a}(${f})`};const a=Wl._`new RegExp`;e.usePattern=function({gen:t,it:{opts:e}},i){const n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(i,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:Wl._`${"new RegExp"===o.code?a:(0,r.useFunc)(t,o)}(${i}, ${n})`})},e.validateArray=function(t){const{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){const t=e.let("valid",!0);return s((()=>e.assign(t,!1))),t}return e.var(o,!0),s((()=>e.break())),o;function s(n){const s=e.const("len",Wl._`${r}.length`);e.forRange("i",0,s,(r=>{t.subschema({keyword:i,dataProp:r,dataPropType:Yl.Type.Num},o),e.if((0,Wl.not)(o),n)}))}},e.validateUnion=function(t){const{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((t=>(0,Yl.alwaysValidSchema)(n,t)))&&!n.opts.unevaluated)return;const o=e.let("valid",!1),s=e.name("_valid");e.block((()=>r.forEach(((r,n)=>{const a=t.subschema({keyword:i,schemaProp:n,compositeRule:!0},s);e.assign(o,Wl._`${o} || ${s}`);t.mergeValidEvaluated(a,s)||e.if((0,Wl.not)(o))})))),t.result(o,(()=>t.reset()),(()=>t.error(!0)))}})),hc=o((function(t,e){function r(t){const{gen:e,data:r,it:i}=t;e.if(i.parentData,(()=>e.assign(r,Wl._`${i.parentData}[${i.parentDataProperty}]`)))}function i(t,e,r){if(void 0===r)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,Wl.stringify)(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0,e.macroKeywordCode=function(t,e){const{gen:r,keyword:n,schema:o,parentSchema:s,it:a}=t,h=e.macro.call(a.self,o,s,a),u=i(r,n,h);!1!==a.opts.validateSchema&&a.self.validateSchema(h,!0);const l=r.name("valid");t.subschema({schema:h,schemaPath:Wl.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,(()=>t.error(!0)))},e.funcKeywordCode=function(t,e){var n;const{gen:o,keyword:s,schema:a,parentSchema:h,$data:u,it:l}=t;!function({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}(l,e);const c=!u&&e.compile?e.compile.call(l.self,a,h,l):e.validate,f=i(o,s,c),d=o.let("valid");function m(r=(e.async?Wl._`await `:Wl.nil)){const i=l.opts.passContext?tc.default.this:tc.default.self,n=!("compile"in e&&!u||!1===e.schema);o.assign(d,Wl._`${r}${(0,ac.callValidateCode)(t,f,i,n)}`,e.modifying)}function p(t){var r;o.if((0,Wl.not)(null!==(r=e.valid)&&void 0!==r?r:d),t)}t.block$data(d,(function(){if(!1===e.errors)m(),e.modifying&&r(t),p((()=>t.error()));else{const i=e.async?function(){const t=o.let("ruleErrs",null);return o.try((()=>m(Wl._`await `)),(e=>o.assign(d,!1).if(Wl._`${e} instanceof ${l.ValidationError}`,(()=>o.assign(t,Wl._`${e}.errors`)),(()=>o.throw(e))))),t}():function(){const t=Wl._`${f}.errors`;return o.assign(t,null),m(Wl.nil),t}();e.modifying&&r(t),p((()=>function(t,e){const{gen:r}=t;r.if(Wl._`Array.isArray(${e})`,(()=>{r.assign(tc.default.vErrors,Wl._`${tc.default.vErrors} === null ? ${e} : ${tc.default.vErrors}.concat(${e})`).assign(tc.default.errors,Wl._`${tc.default.vErrors}.length`),(0,ec.extendErrors)(t)}),(()=>t.error()))}(t,i)))}})),t.ok(null!==(n=e.valid)&&void 0!==n?n:d)},e.validSchemaType=function(t,e,r=!1){return!e.length||e.some((e=>"array"===e?Array.isArray(t):"object"===e?t&&"object"==typeof t&&!Array.isArray(t):typeof t==e||r&&void 0===t))},e.validateKeywordUsage=function({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const s=n.dependencies;if(null==s?void 0:s.some((e=>!Object.prototype.hasOwnProperty.call(t,e))))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(t[o])){const t=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if("log"!==e.validateSchema)throw new Error(t);r.logger.error(t)}}}})),uc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0,e.getSubschema=function(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(void 0!==e&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==e){const i=t.schema[e];return void 0===r?{schema:i,schemaPath:Wl._`${t.schemaPath}${(0,Wl.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[r],schemaPath:Wl._`${t.schemaPath}${(0,Wl.getProperty)(e)}${(0,Wl.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Yl.escapeFragment)(r)}`}}if(void 0!==i){if(void 0===n||void 0===o||void 0===s)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(void 0!==n&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=e;if(void 0!==r){const{errorPath:n,dataPathArr:o,opts:s}=e;h(a.let("data",Wl._`${e.data}${(0,Wl.getProperty)(r)}`,!0)),t.errorPath=Wl.str`${n}${(0,Yl.getErrorPath)(r,i,s.jsPropertySyntax)}`,t.parentDataProperty=Wl._`${r}`,t.dataPathArr=[...o,t.parentDataProperty]}if(void 0!==n){h(n instanceof Wl.Name?n:a.let("data",n,!0)),void 0!==s&&(t.propertyName=s)}function h(r){t.data=r,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,r]}o&&(t.dataTypes=o)},e.extendSubschemaMode=function(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}})),lc=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if((i=e.length)!=r.length)return!1;for(n=i;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((i=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;0!=n--;){var s=o[n];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r},cc=o((function(t){var e=t.exports=function(t,e,i){"function"==typeof e&&(i=e,e={}),r(e,"function"==typeof(i=e.cb||i)?i:i.pre||function(){},i.post||function(){},t,"",t)};function r(t,i,n,o,s,a,h,u,l,c){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var f in i(o,s,a,h,u,l,c),o){var d=o[f];if(Array.isArray(d)){if(f in e.arrayKeywords)for(var m=0;m<d.length;m++)r(t,i,n,d[m],s+"/"+f+"/"+m,a,s,f,o,m)}else if(f in e.propsKeywords){if(d&&"object"==typeof d)for(var p in d)r(t,i,n,d[p],s+"/"+f+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1"),a,s,f,o,p)}else(f in e.keywords||t.allKeys&&!(f in e.skipKeywords))&&r(t,i,n,d,s+"/"+f,a,s,f,o)}n(o,s,a,h,u,l,c)}}e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}})),fc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;const r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(t,e=!0){return"boolean"==typeof t||(!0===e?!n(t):!!e&&o(t)<=e)};const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function n(t){for(const e in t){if(i.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(n))return!0;if("object"==typeof r&&n(r))return!0}return!1}function o(t){let e=0;for(const i in t){if("$ref"===i)return 1/0;if(e++,!r.has(i)&&("object"==typeof t[i]&&(0,Yl.eachItem)(t[i],(t=>e+=o(t))),e===1/0))return 1/0}return e}function s(t,e="",r){!1!==r&&(e=u(e));const i=t.parse(e);return a(t,i)}function a(t,e){return t.serialize(e).split("#")[0]+"#"}e.getFullPath=s,e._getFullPath=a;const h=/#\/?$/;function u(t){return t?t.replace(h,""):""}e.normalizeId=u,e.resolveUrl=function(t,e,r){return r=u(r),t.resolve(e,r)};const l=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(t,e){if("boolean"==typeof t)return{};const{schemaId:r,uriResolver:i}=this.opts,n=u(t[r]||e),o={"":n},a=s(i,n,!1),h={},c=new Set;return cc(t,{allKeys:!0},((t,e,i,n)=>{if(void 0===n)return;const s=a+e;let m=o[n];function p(e){const r=this.opts.uriResolver.resolve;if(e=u(m?r(m,e):e),c.has(e))throw d(e);c.add(e);let i=this.refs[e];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?f(t,i.schema,e):e!==u(s)&&("#"===e[0]?(f(t,h[e],e),h[e]=t):this.refs[e]=s),e}function g(t){if("string"==typeof t){if(!l.test(t))throw new Error(`invalid anchor "${t}"`);p.call(this,`#${t}`)}}"string"==typeof t[r]&&(m=p.call(this,t[r])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),o[e]=m})),h;function f(t,e,r){if(void 0!==e&&!lc(t,e))throw d(r)}function d(t){return new Error(`reference "${t}" resolves to more than one schema`)}}})),dc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;const r=oc;function i({gen:t,validateName:e,schema:r,schemaEnv:i,opts:o},s){o.code.es5?t.func(e,Wl._`${tc.default.data}, ${tc.default.valCxt}`,i.$async,(()=>{t.code(Wl._`"use strict"; ${n(r,o)}`),function(t,e){t.if(tc.default.valCxt,(()=>{t.var(tc.default.instancePath,Wl._`${tc.default.valCxt}.${tc.default.instancePath}`),t.var(tc.default.parentData,Wl._`${tc.default.valCxt}.${tc.default.parentData}`),t.var(tc.default.parentDataProperty,Wl._`${tc.default.valCxt}.${tc.default.parentDataProperty}`),t.var(tc.default.rootData,Wl._`${tc.default.valCxt}.${tc.default.rootData}`),e.dynamicRef&&t.var(tc.default.dynamicAnchors,Wl._`${tc.default.valCxt}.${tc.default.dynamicAnchors}`)}),(()=>{t.var(tc.default.instancePath,Wl._`""`),t.var(tc.default.parentData,Wl._`undefined`),t.var(tc.default.parentDataProperty,Wl._`undefined`),t.var(tc.default.rootData,tc.default.data),e.dynamicRef&&t.var(tc.default.dynamicAnchors,Wl._`{}`)}))}(t,o),t.code(s)})):t.func(e,Wl._`${tc.default.data}, ${function(t){return Wl._`{${tc.default.instancePath}="", ${tc.default.parentData}, ${tc.default.parentDataProperty}, ${tc.default.rootData}=${tc.default.data}${t.dynamicRef?Wl._`, ${tc.default.dynamicAnchors}={}`:Wl.nil}}={}`}(o)}`,i.$async,(()=>t.code(n(r,o)).code(s)))}function n(t,e){const r="object"==typeof t&&t[e.schemaId];return r&&(e.code.source||e.code.process)?Wl._`/*# sourceURL=${r} */`:Wl.nil}function o(t,e){a(t)&&(h(t),s(t))?function(t,e){const{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&l(t);(function(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,fc.resolveUrl)(t.opts.uriResolver,t.baseId,e))})(t),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}(t);const o=i.const("_errs",tc.default.errors);u(t,o),i.var(e,Wl._`${o} === ${tc.default.errors}`)}(t,e):(0,rc.boolOrEmptySchema)(t,e)}function s({schema:t,self:e}){if("boolean"==typeof t)return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function a(t){return"boolean"!=typeof t.schema}function h(t){(0,Yl.checkUnknownRules)(t),function(t){const{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&(0,Yl.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(t)}function u(t,e){if(t.opts.jtd)return c(t,[],!1,e);const r=(0,oc.getSchemaTypes)(t.schema);c(t,r,!(0,oc.coerceAndCheckDataType)(t,r),e)}function l({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){const o=r.$comment;if(!0===n.$comment)t.code(Wl._`${tc.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=Wl.str`${i}/$comment`,n=t.scopeValue("root",{ref:e.root});t.code(Wl._`${tc.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function c(t,e,i,n){const{gen:o,schema:s,data:a,allErrors:h,opts:u,self:l}=t,{RULES:c}=l;function g(l){(0,nc.shouldUseGroup)(s,l)&&(l.type?(o.if((0,r.checkDataType)(l.type,a,u.strictNumbers)),f(t,l),1===e.length&&e[0]===l.type&&i&&(o.else(),(0,r.reportTypeError)(t)),o.endIf()):f(t,l),h||o.if(Wl._`${tc.default.errors} === ${n||0}`))}!s.$ref||!u.ignoreKeywordsWithRef&&(0,Yl.schemaHasRulesButRef)(s,c)?(u.jtd||function(t,e){if(t.schemaEnv.meta||!t.opts.strictTypes)return;(function(t,e){if(!e.length)return;if(!t.dataTypes.length)return void(t.dataTypes=e);e.forEach((e=>{m(t.dataTypes,e)||p(t,`type "${e}" not allowed by context "${t.dataTypes.join(",")}"`)})),t.dataTypes=t.dataTypes.filter((t=>m(e,t)))})(t,e),t.opts.allowUnionTypes||function(t,e){e.length>1&&(2!==e.length||!e.includes("null"))&&p(t,"use allowUnionTypes to allow union type keyword")}(t,e);!function(t,e){const r=t.self.RULES.all;for(const i in r){const n=r[i];if("object"==typeof n&&(0,nc.shouldUseRule)(t.schema,n)){const{type:r}=n.definition;r.length&&!r.some((t=>d(e,t)))&&p(t,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(t,t.dataTypes)}(t,e),o.block((()=>{for(const t of c.rules)g(t);g(c.post)}))):o.block((()=>y(t,"$ref",c.all.$ref.definition)))}function f(t,e){const{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&(0,sc.assignDefaults)(t,e.type),r.block((()=>{for(const r of e.rules)(0,nc.shouldUseRule)(i,r)&&y(t,r.keyword,r.definition,e.type)}))}function d(t,e){return t.includes(e)||"number"===e&&t.includes("integer")}function m(t,e){return t.includes(e)||"integer"===e&&t.includes("number")}function p(t,e){e+=` at "${t.schemaEnv.baseId+t.errSchemaPath}" (strictTypes)`,(0,Yl.checkStrictMode)(t,e,t.opts.strictTypes)}e.validateFunctionCode=function(t){a(t)&&(h(t),s(t))?function(t){const{schema:e,opts:r,gen:n}=t;i(t,(()=>{r.$comment&&e.$comment&&l(t),function(t){const{schema:e,opts:r}=t;void 0!==e.default&&r.useDefaults&&r.strictSchema&&(0,Yl.checkStrictMode)(t,"default is ignored in the schema root")}(t),n.let(tc.default.vErrors,null),n.let(tc.default.errors,0),r.unevaluated&&function(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",Wl._`${r}.evaluated`),e.if(Wl._`${t.evaluated}.dynamicProps`,(()=>e.assign(Wl._`${t.evaluated}.props`,Wl._`undefined`))),e.if(Wl._`${t.evaluated}.dynamicItems`,(()=>e.assign(Wl._`${t.evaluated}.items`,Wl._`undefined`)))}(t),u(t),function(t){const{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if(Wl._`${tc.default.errors} === 0`,(()=>e.return(tc.default.data)),(()=>e.throw(Wl._`new ${n}(${tc.default.vErrors})`))):(e.assign(Wl._`${i}.errors`,tc.default.vErrors),o.unevaluated&&function({gen:t,evaluated:e,props:r,items:i}){r instanceof Wl.Name&&t.assign(Wl._`${e}.props`,r);i instanceof Wl.Name&&t.assign(Wl._`${e}.items`,i)}(t),e.return(Wl._`${tc.default.errors} === 0`))}(t)}))}(t):i(t,(()=>(0,rc.topBoolOrEmptySchema)(t)))};class g{constructor(t,e,r){if((0,hc.validateKeywordUsage)(t,e,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=e.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Yl.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=e.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=e,this.$data)this.schemaCode=t.gen.const("vSchema",b(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,hc.validSchemaType)(this.schema,e.schemaType,e.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(e.schemaType)}`);("code"in e?e.trackErrors:!1!==e.errors)&&(this.errsCount=t.gen.const("_errs",tc.default.errors))}result(t,e,r){this.failResult((0,Wl.not)(t),e,r)}failResult(t,e,r){this.gen.if(t),r?r():this.error(),e?(this.gen.else(),e(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,e){this.failResult((0,Wl.not)(t),void 0,e)}fail(t){if(void 0===t)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:e}=this;this.fail(Wl._`${e} !== undefined && (${(0,Wl.or)(this.invalid$data(),t)})`)}error(t,e,r){if(e)return this.setParams(e),this._error(t,r),void this.setParams({});this._error(t,r)}_error(t,e){(t?ec.reportExtraError:ec.reportError)(this,this.def.error,e)}$dataError(){(0,ec.reportError)(this,this.def.$dataError||ec.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,ec.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,e){e?Object.assign(this.params,t):this.params=t}block$data(t,e,r=Wl.nil){this.gen.block((()=>{this.check$data(t,r),e()}))}check$data(t=Wl.nil,e=Wl.nil){if(!this.$data)return;const{gen:r,schemaCode:i,schemaType:n,def:o}=this;r.if((0,Wl.or)(Wl._`${i} === undefined`,e)),t!==Wl.nil&&r.assign(t,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==Wl.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:e,schemaType:i,def:n,it:o}=this;return(0,Wl.or)(function(){if(i.length){if(!(e instanceof Wl.Name))throw new Error("ajv implementation error");const t=Array.isArray(i)?i:[i];return Wl._`${(0,r.checkDataTypes)(t,e,o.opts.strictNumbers,r.DataType.Wrong)}`}return Wl.nil}(),function(){if(n.validateSchema){const r=t.scopeValue("validate$data",{ref:n.validateSchema});return Wl._`!${r}(${e})`}return Wl.nil}())}subschema(t,e){const r=(0,uc.getSubschema)(this.it,t);(0,uc.extendSubschemaData)(r,this.it,t),(0,uc.extendSubschemaMode)(r,t);const i={...this.it,...r,items:void 0,props:void 0};return o(i,e),i}mergeEvaluated(t,e){const{it:r,gen:i}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==t.props&&(r.props=Yl.mergeEvaluated.props(i,t.props,r.props,e)),!0!==r.items&&void 0!==t.items&&(r.items=Yl.mergeEvaluated.items(i,t.items,r.items,e)))}mergeValidEvaluated(t,e){const{it:r,gen:i}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return i.if(e,(()=>this.mergeEvaluated(t,Wl.Name))),!0}}function y(t,e,r,i){const n=new g(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?(0,hc.funcKeywordCode)(n,r):"macro"in r?(0,hc.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,hc.funcKeywordCode)(n,r)}e.KeywordCxt=g;const v=/^\/(?:[^~]|~0|~1)*$/,w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function b(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(""===t)return tc.default.rootData;if("/"===t[0]){if(!v.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=tc.default.rootData}else{const s=w.exec(t);if(!s)throw new Error(`Invalid JSON-pointer: ${t}`);const a=+s[1];if(n=s[2],"#"===n){if(a>=e)throw new Error(h("property/index",a));return i[e-a]}if(a>e)throw new Error(h("data",a));if(o=r[e-a],!n)return o}let s=o;const a=n.split("/");for(const t of a)t&&(o=Wl._`${o}${(0,Wl.getProperty)((0,Yl.unescapeJsonPointer)(t))}`,s=Wl._`${s} && ${o}`);return s;function h(t,r){return`Cannot access ${t} ${r} levels up, current level is ${e}`}}e.getData=b}));class mc extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}var pc=mc,gc=Object.defineProperty({default:pc},"__esModule",{value:!0});class yc extends Error{constructor(t,e,r,i){super(i||`can't resolve reference ${r} from id ${e}`),this.missingRef=(0,fc.resolveUrl)(t,e,r),this.missingSchema=(0,fc.normalizeId)((0,fc.getFullPath)(t,this.missingRef))}}var vc=yc,wc=Object.defineProperty({default:vc},"__esModule",{value:!0}),bc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;class r{constructor(t){var e;let r;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(e=t.baseId)&&void 0!==e?e:(0,fc.normalizeId)(null==r?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(t){const e=o.call(this,t);if(e)return e;const r=(0,fc.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:s}=this.opts,a=new Wl.CodeGen(this.scope,{es5:i,lines:n,ownProperties:s});let h;t.$async&&(h=a.scopeValue("Error",{ref:gc.default,code:Wl._`require("ajv/dist/runtime/validation_error").default`}));const u=a.scopeName("validate");t.validateName=u;const l={gen:a,allErrors:this.opts.allErrors,data:tc.default.data,parentData:tc.default.parentData,parentDataProperty:tc.default.parentDataProperty,dataNames:[tc.default.data],dataPathArr:[Wl.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,Wl.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:h,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Wl.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:Wl._`""`,opts:this.opts,self:this};let c;try{this._compilations.add(t),(0,dc.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);const e=a.toString();c=`${a.scopeRefs(tc.default.scope)}return ${e}`,this.opts.code.process&&(c=this.opts.code.process(c,t));const r=new Function(`${tc.default.self}`,`${tc.default.scope}`,c)(this,this.scope.get());if(this.scope.value(u,{ref:r}),r.errors=null,r.schema=t.schema,r.schemaEnv=t,t.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:u,validateCode:e,scopeValues:a._values}),this.opts.unevaluated){const{props:t,items:e}=l;r.evaluated={props:t instanceof Wl.Name?void 0:t,items:e instanceof Wl.Name?void 0:e,dynamicProps:t instanceof Wl.Name,dynamicItems:e instanceof Wl.Name},r.source&&(r.source.evaluated=(0,Wl.stringify)(r.evaluated))}return t.validate=r,t}catch(e){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),e}finally{this._compilations.delete(t)}}function n(t){return(0,fc.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:i.call(this,t)}function o(t){for(const i of this._compilations)if(r=t,(e=i).schema===r.schema&&e.root===r.root&&e.baseId===r.baseId)return i;var e,r}function s(t,e){let r;for(;"string"==typeof(r=this.refs[e]);)e=r;return r||this.schemas[e]||a.call(this,t,e)}function a(t,e){const n=this.opts.uriResolver.parse(e),o=(0,fc._getFullPath)(this.opts.uriResolver,n);let s=(0,fc.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===s)return u.call(this,n,t);const h=(0,fc.normalizeId)(o),l=this.refs[h]||this.schemas[h];if("string"==typeof l){const e=a.call(this,t,l);if("object"!=typeof(null==e?void 0:e.schema))return;return u.call(this,n,e)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||i.call(this,l),h===(0,fc.normalizeId)(e)){const{schema:e}=l,{schemaId:i}=this.opts,n=e[i];return n&&(s=(0,fc.resolveUrl)(this.opts.uriResolver,s,n)),new r({schema:e,schemaId:i,root:t,baseId:s})}return u.call(this,n,l)}}e.SchemaEnv=r,e.compileSchema=i,e.resolveRef=function(t,e,i){var o;i=(0,fc.resolveUrl)(this.opts.uriResolver,e,i);const a=t.refs[i];if(a)return a;let h=s.call(this,t,i);if(void 0===h){const n=null===(o=t.localRefs)||void 0===o?void 0:o[i],{schemaId:s}=this.opts;n&&(h=new r({schema:n,schemaId:s,root:t,baseId:e}))}return void 0!==h?t.refs[i]=n.call(this,h):void 0},e.getCompilingSchema=o,e.resolveSchema=a;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u(t,{baseId:e,schema:i,root:n}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const r of t.fragment.slice(1).split("/")){if("boolean"==typeof i)return;const t=i[(0,Yl.unescapeFragment)(r)];if(void 0===t)return;const n="object"==typeof(i=t)&&i[this.opts.schemaId];!h.has(r)&&n&&(e=(0,fc.resolveUrl)(this.opts.uriResolver,e,n))}let s;if("boolean"!=typeof i&&i.$ref&&!(0,Yl.schemaHasRulesButRef)(i,this.RULES)){const t=(0,fc.resolveUrl)(this.opts.uriResolver,e,i.$ref);s=a.call(this,n,t)}const{schemaId:u}=this.opts;return s=s||new r({schema:i,schemaId:u,root:n,baseId:e}),s.schema!==s.root.schema?s:void 0}})),Mc={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},_c=o((function(t,e){!function(t){function e(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length>1){e[0]=e[0].slice(0,-1);for(var i=e.length-1,n=1;n<i;++n)e[n]=e[n].slice(1,-1);return e[i]=e[i].slice(1),e.join("")}return e[0]}function r(t){return"(?:"+t+")"}function i(t){return void 0===t?"undefined":null===t?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function n(t){return t.toUpperCase()}function o(t){return null!=t?t instanceof Array?t:"number"!=typeof t.length||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function s(t,e){var r=t;if(e)for(var i in e)r[i]=e[i];return r}function a(t){var i="[A-Za-z]",n="[0-9]",o=e(n,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",h=e("[\\:\\/\\?\\#\\[\\]\\@]",a),u=t?"[\\uE000-\\uF8FF]":"[]",l=e(i,n,"[\\-\\.\\_\\~]",t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),c=(r(i+e(i,n,"[\\+\\-\\.]")+"*"),r(r(s+"|"+e(l,a,"[\\:]"))+"*"),r(r("25[0-5]")+"|"+r("2[0-4]"+n)+"|"+r("1"+n+n)+"|"+r("0?[1-9]"+n)+"|0?0?"+n)),f=r(c+"\\."+c+"\\."+c+"\\."+c),d=r(o+"{1,4}"),m=r(r(d+"\\:"+d)+"|"+f),p=r(r(d+"\\:")+"{6}"+m),g=r("\\:\\:"+r(d+"\\:")+"{5}"+m),y=r(r(d)+"?\\:\\:"+r(d+"\\:")+"{4}"+m),v=r(r(r(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+r(d+"\\:")+"{3}"+m),w=r(r(r(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+r(d+"\\:")+"{2}"+m),b=r(r(r(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+m),M=r(r(r(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+m),_=r(r(r(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),E=r(r(r(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),A=r([p,g,y,v,w,b,M,_,E].join("|")),k=r(r(l+"|"+s)+"+"),x=(r("[vV]"+o+"+\\."+e(l,a,"[\\:]")+"+"),r(r(s+"|"+e(l,a))+"*"),r(s+"|"+e(l,a,"[\\:\\@]")));return r(r(s+"|"+e(l,a,"[\\@]"))+"+"),r(r(x+"|"+e("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(e("[^]",i,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",l,h),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+A+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+k+")")+"?\\]?$")}}var h=a(!1),u=a(!0),l=function(){function t(t,e){var r=[],i=!0,n=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);i=!0);}catch(t){n=!0,o=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},f=2147483647,d=36,m=1,p=26,g=38,y=700,v=72,w=128,b="-",M=/^xn--/,_=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=d-m,x=Math.floor,N=String.fromCharCode;function S(t){throw new RangeError(A[t])}function I(t,e){for(var r=[],i=t.length;i--;)r[i]=e(t[i]);return r}function T(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+I((t=t.replace(E,".")).split("."),e).join(".")}function R(t){for(var e=[],r=0,i=t.length;r<i;){var n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){var o=t.charCodeAt(r++);56320==(64512&o)?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--)}else e.push(n)}return e}var C=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d},P=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},O=function(t,e,r){var i=0;for(t=r?x(t/y):t>>1,t+=x(t/e);t>k*p>>1;i+=d)t=x(t/k);return x(i+(k+1)*t/(t+g))},B=function(t){var e=[],r=t.length,i=0,n=w,o=v,s=t.lastIndexOf(b);s<0&&(s=0);for(var a=0;a<s;++a)t.charCodeAt(a)>=128&&S("not-basic"),e.push(t.charCodeAt(a));for(var h=s>0?s+1:0;h<r;){for(var u=i,l=1,c=d;;c+=d){h>=r&&S("invalid-input");var g=C(t.charCodeAt(h++));(g>=d||g>x((f-i)/l))&&S("overflow"),i+=g*l;var y=c<=o?m:c>=o+p?p:c-o;if(g<y)break;var M=d-y;l>x(f/M)&&S("overflow"),l*=M}var _=e.length+1;o=O(i-u,_,0==u),x(i/_)>f-n&&S("overflow"),n+=x(i/_),i%=_,e.splice(i++,0,n)}return String.fromCodePoint.apply(String,e)},$=function(t){var e=[],r=(t=R(t)).length,i=w,n=0,o=v,s=!0,a=!1,h=void 0;try{for(var u,l=t[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c=u.value;c<128&&e.push(N(c))}}catch(t){a=!0,h=t}finally{try{!s&&l.return&&l.return()}finally{if(a)throw h}}var g=e.length,y=g;for(g&&e.push(b);y<r;){var M=f,_=!0,E=!1,A=void 0;try{for(var k,I=t[Symbol.iterator]();!(_=(k=I.next()).done);_=!0){var T=k.value;T>=i&&T<M&&(M=T)}}catch(t){E=!0,A=t}finally{try{!_&&I.return&&I.return()}finally{if(E)throw A}}var C=y+1;M-i>x((f-n)/C)&&S("overflow"),n+=(M-i)*C,i=M;var B=!0,$=!1,U=void 0;try{for(var D,L=t[Symbol.iterator]();!(B=(D=L.next()).done);B=!0){var F=D.value;if(F<i&&++n>f&&S("overflow"),F==i){for(var j=n,z=d;;z+=d){var q=z<=o?m:z>=o+p?p:z-o;if(j<q)break;var H=j-q,V=d-q;e.push(N(P(q+H%V,0))),j=x(H/V)}e.push(N(P(j,0))),o=O(n,C,y==g),n=0,++y}}}catch(t){$=!0,U=t}finally{try{!B&&L.return&&L.return()}finally{if($)throw U}}++n,++i}return e.join("")},U=function(t){return T(t,(function(t){return M.test(t)?B(t.slice(4).toLowerCase()):t}))},D=function(t){return T(t,(function(t){return _.test(t)?"xn--"+$(t):t}))},L={version:"2.1.0",ucs2:{decode:R,encode:function(t){return String.fromCodePoint.apply(String,c(t))}},decode:B,encode:$,toASCII:D,toUnicode:U},F={};function j(t){var e=t.charCodeAt(0);return e<16?"%0"+e.toString(16).toUpperCase():e<128?"%"+e.toString(16).toUpperCase():e<2048?"%"+(e>>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function z(t){for(var e="",r=0,i=t.length;r<i;){var n=parseInt(t.substr(r+1,2),16);if(n<128)e+=String.fromCharCode(n),r+=3;else if(n>=194&&n<224){if(i-r>=6){var o=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&n)<<6|63&o)}else e+=t.substr(r,6);r+=6}else if(n>=224){if(i-r>=9){var s=parseInt(t.substr(r+4,2),16),a=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&a)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function q(t,e){function r(t){var r=z(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,j).replace(e.PCT_ENCODED,n)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,j).replace(e.PCT_ENCODED,n)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,j).replace(e.PCT_ENCODED,n)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,j).replace(e.PCT_ENCODED,n)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,j).replace(e.PCT_ENCODED,n)),t}function H(t){return t.replace(/^0*(.*)/,"$1")||"0"}function V(t,e){var r=t.match(e.IPV4ADDRESS)||[],i=l(r,2)[1];return i?i.split(".").map(H).join("."):t}function Z(t,e){var r=t.match(e.IPV6ADDRESS)||[],i=l(r,3),n=i[1],o=i[2];if(n){for(var s=n.toLowerCase().split("::").reverse(),a=l(s,2),h=a[0],u=a[1],c=u?u.split(":").map(H):[],f=h.split(":").map(H),d=e.IPV4ADDRESS.test(f[f.length-1]),m=d?7:8,p=f.length-m,g=Array(m),y=0;y<m;++y)g[y]=c[y]||f[p+y]||"";d&&(g[m-1]=V(g[m-1],e));var v=g.reduce((function(t,e,r){if(!e||"0"===e){var i=t[t.length-1];i&&i.index+i.length===r?i.length++:t.push({index:r,length:1})}return t}),[]),w=v.sort((function(t,e){return e.length-t.length}))[0],b=void 0;if(w&&w.length>1){var M=g.slice(0,w.index),_=g.slice(w.index+w.length);b=M.join(":")+"::"+_.join(":")}else b=g.join(":");return o&&(b+="%"+o),b}return t}var G=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,K=void 0==="".match(/(){0}/)[1];function J(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=!1!==e.iri?u:h;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var n=t.match(G);if(n){K?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==t.indexOf("@")?n[3]:void 0,r.host=-1!==t.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==t.indexOf("?")?n[7]:void 0,r.fragment=-1!==t.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=Z(V(r.host,i),i)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var o=F[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||o&&o.unicodeSupport)q(r,i);else{if(r.host&&(e.domainHost||o&&o.domainHost))try{r.host=L.toASCII(r.host.replace(i.PCT_ENCODED,z).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}q(r,h)}o&&o.parse&&o.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function Q(t,e){var r=!1!==e.iri?u:h,i=[];return void 0!==t.userinfo&&(i.push(t.userinfo),i.push("@")),void 0!==t.host&&i.push(Z(V(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(i.push(":"),i.push(String(t.port))),i.length?i.join(""):void 0}var W=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,tt=/^\/?(?:.|\n)*?(?=\/|$)/;function et(t){for(var e=[];t.length;)if(t.match(W))t=t.replace(W,"");else if(t.match(Y))t=t.replace(Y,"/");else if(t.match(X))t=t.replace(X,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(tt);if(!r)throw new Error("Unexpected dot segment condition");var i=r[0];t=t.slice(i.length),e.push(i)}return e.join("")}function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?u:h,i=[],n=F[(e.scheme||t.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||n&&n.domainHost)try{t.host=e.iri?L.toUnicode(t.host):L.toASCII(t.host.replace(r.PCT_ENCODED,z).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}q(t,r),"suffix"!==e.reference&&t.scheme&&(i.push(t.scheme),i.push(":"));var o=Q(t,e);if(void 0!==o&&("suffix"!==e.reference&&i.push("//"),i.push(o),t.path&&"/"!==t.path.charAt(0)&&i.push("/")),void 0!==t.path){var s=t.path;e.absolutePath||n&&n.absolutePath||(s=et(s)),void 0===o&&(s=s.replace(/^\/\//,"/%2F")),i.push(s)}return void 0!==t.query&&(i.push("?"),i.push(t.query)),void 0!==t.fragment&&(i.push("#"),i.push(t.fragment)),i.join("")}function it(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(t=J(rt(t,r),r),e=J(rt(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(e.path?("/"===e.path.charAt(0)?i.path=et(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path:i.path="/"+e.path,i.path=et(i.path)),i.query=e.query):(i.path=t.path,void 0!==e.query?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function nt(t,e,r){var i=s({scheme:"null"},r);return rt(it(J(t,i),J(e,i),i,!0),i)}function ot(t,e){return"string"==typeof t?t=rt(J(t,e),e):"object"===i(t)&&(t=J(rt(t,e),e)),t}function st(t,e,r){return"string"==typeof t?t=rt(J(t,r),r):"object"===i(t)&&(t=rt(t,r)),"string"==typeof e?e=rt(J(e,r),r):"object"===i(e)&&(e=rt(e,r)),t===e}function at(t,e){return t&&t.toString().replace(e&&e.iri?u.ESCAPE:h.ESCAPE,j)}function ht(t,e){return t&&t.toString().replace(e&&e.iri?u.PCT_ENCODED:h.PCT_ENCODED,z)}var ut={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},lt={scheme:"https",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize};function ct(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var ft={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=ct(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(ct(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),i=l(r,2),n=i[0],o=i[1];t.path=n&&"/"!==n?n:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},dt={scheme:"wss",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize},mt={},pt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",gt="[0-9A-Fa-f]",yt=r(r("%[EFef]"+gt+"%"+gt+gt+"%"+gt+gt)+"|"+r("%[89A-Fa-f]"+gt+"%"+gt+gt)+"|"+r("%"+gt+gt)),vt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",wt=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),bt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Mt=new RegExp(pt,"g"),_t=new RegExp(yt,"g"),Et=new RegExp(e("[^]",vt,"[\\.]",'[\\"]',wt),"g"),At=new RegExp(e("[^]",pt,bt),"g"),kt=At;function xt(t){var e=z(t);return e.match(Mt)?e:t}var Nt={scheme:"mailto",parse:function(t,e){var r=t,i=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,o={},s=r.query.split("&"),a=0,h=s.length;a<h;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),c=0,f=l.length;c<f;++c)i.push(l[c]);break;case"subject":r.subject=ht(u[1],e);break;case"body":r.body=ht(u[1],e);break;default:n=!0,o[ht(u[0],e)]=ht(u[1],e)}}n&&(r.headers=o)}r.query=void 0;for(var d=0,m=i.length;d<m;++d){var p=i[d].split("@");if(p[0]=ht(p[0]),e.unicodeSupport)p[1]=ht(p[1],e).toLowerCase();else try{p[1]=L.toASCII(ht(p[1],e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}i[d]=p.join("@")}return r},serialize:function(t,e){var r=t,i=o(t.to);if(i){for(var s=0,a=i.length;s<a;++s){var h=String(i[s]),u=h.lastIndexOf("@"),l=h.slice(0,u).replace(_t,xt).replace(_t,n).replace(Et,j),c=h.slice(u+1);try{c=e.iri?L.toUnicode(c):L.toASCII(ht(c,e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+t}i[s]=l+"@"+c}r.path=i.join(",")}var f=t.headers=t.headers||{};t.subject&&(f.subject=t.subject),t.body&&(f.body=t.body);var d=[];for(var m in f)f[m]!==mt[m]&&d.push(m.replace(_t,xt).replace(_t,n).replace(At,j)+"="+f[m].replace(_t,xt).replace(_t,n).replace(kt,j));return d.length&&(r.query=d.join("&")),r}},St=/^([^\:]+)\:(.*)/,It={scheme:"urn",parse:function(t,e){var r=t.path&&t.path.match(St),i=t;if(r){var n=e.scheme||i.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=n+":"+(e.nid||o),h=F[a];i.nid=o,i.nss=s,i.path=void 0,h&&(i=h.parse(i,e))}else i.error=i.error||"URN can not be parsed.";return i},serialize:function(t,e){var r=e.scheme||t.scheme||"urn",i=t.nid,n=r+":"+(e.nid||i),o=F[n];o&&(t=o.serialize(t,e));var s=t,a=t.nss;return s.path=(i||e.nid)+":"+a,s}},Tt=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Rt={scheme:"urn:uuid",parse:function(t,e){var r=t;return r.uuid=r.nss,r.nss=void 0,e.tolerant||r.uuid&&r.uuid.match(Tt)||(r.error=r.error||"UUID is not valid."),r},serialize:function(t,e){var r=t;return r.nss=(t.uuid||"").toLowerCase(),r}};F[ut.scheme]=ut,F[lt.scheme]=lt,F[ft.scheme]=ft,F[dt.scheme]=dt,F[Nt.scheme]=Nt,F[It.scheme]=It,F[Rt.scheme]=Rt,t.SCHEMES=F,t.pctEncChar=j,t.pctDecChars=z,t.parse=J,t.removeDotSegments=et,t.serialize=rt,t.resolveComponents=it,t.resolve=nt,t.normalize=ot,t.equal=st,t.escapeComponent=at,t.unescapeComponent=ht,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));_c.code='require("ajv/dist/runtime/uri").default';var Ec=_c,Ac=Object.defineProperty({default:Ec},"__esModule",{value:!0}),kc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return dc.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return Wl._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return Wl.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return Wl.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return Wl.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return Wl.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return Wl.CodeGen}});const r=Wl,i=(t,e)=>new RegExp(t,e);i.code="new RegExp";const n=["removeAdditional","useDefaults","coerceTypes"],o=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),s={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},a={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function h(t){var e,r,n,o,s,a,h,u,l,c,f,d,m,p,g,y,v,w,b,M,_,E,A,k,x;const N=t.strict,S=null===(e=t.code)||void 0===e?void 0:e.optimize,I=!0===S||void 0===S?1:S||0,T=null!==(n=null===(r=t.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:i,R=null!==(o=t.uriResolver)&&void 0!==o?o:Ac.default;return{strictSchema:null===(a=null!==(s=t.strictSchema)&&void 0!==s?s:N)||void 0===a||a,strictNumbers:null===(u=null!==(h=t.strictNumbers)&&void 0!==h?h:N)||void 0===u||u,strictTypes:null!==(c=null!==(l=t.strictTypes)&&void 0!==l?l:N)&&void 0!==c?c:"log",strictTuples:null!==(d=null!==(f=t.strictTuples)&&void 0!==f?f:N)&&void 0!==d?d:"log",strictRequired:null!==(p=null!==(m=t.strictRequired)&&void 0!==m?m:N)&&void 0!==p&&p,code:t.code?{...t.code,optimize:I,regExp:T}:{optimize:I,regExp:T},loopRequired:null!==(g=t.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(y=t.loopEnum)&&void 0!==y?y:200,meta:null===(v=t.meta)||void 0===v||v,messages:null===(w=t.messages)||void 0===w||w,inlineRefs:null===(b=t.inlineRefs)||void 0===b||b,schemaId:null!==(M=t.schemaId)&&void 0!==M?M:"$id",addUsedSchema:null===(_=t.addUsedSchema)||void 0===_||_,validateSchema:null===(E=t.validateSchema)||void 0===E||E,validateFormats:null===(A=t.validateFormats)||void 0===A||A,unicodeRegExp:null===(k=t.unicodeRegExp)||void 0===k||k,int32range:null===(x=t.int32range)||void 0===x||x,uriResolver:R}}class u{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...h(t)};const{es5:e,lines:i}=this.opts.code;this.scope=new r.ValueScope({scope:{},prefixes:o,es5:e,lines:i}),this.logger=function(t){if(!1===t)return g;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}(t.logger);const n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,ic.getRules)(),l.call(this,s,t,"NOT SUPPORTED"),l.call(this,a,t,"DEPRECATED","warn"),this._metaOpts=p.call(this),t.formats&&d.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&m.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),f.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:e,schemaId:r}=this.opts;let i=Mc;"id"===r&&(i={...Mc},i.id=i.$id,delete i.$id),e&&t&&this.addMetaSchema(i,i[r],!1)}defaultMeta(){const{meta:t,schemaId:e}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[e]||t:void 0}validate(t,e){let r;if("string"==typeof t){if(r=this.getSchema(t),!r)throw new Error(`no schema with key or ref "${t}"`)}else r=this.compile(t);const i=r(e);return"$async"in r||(this.errors=r.errors),i}compile(t,e){const r=this._addSchema(t,e);return r.validate||this._compileSchemaEnv(r)}compileAsync(t,e){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return i.call(this,t,e);async function i(t,e){await n.call(this,t.$schema);const r=this._addSchema(t,e);return r.validate||o.call(this,r)}async function n(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function o(t){try{return this._compileSchemaEnv(t)}catch(e){if(!(e instanceof wc.default))throw e;return s.call(this,e),await a.call(this,e.missingSchema),o.call(this,t)}}function s({missingSchema:t,missingRef:e}){if(this.refs[t])throw new Error(`AnySchema ${t} is loaded but ${e} cannot be resolved`)}async function a(t){const r=await h.call(this,t);this.refs[t]||await n.call(this,r.$schema),this.refs[t]||this.addSchema(r,t,e)}async function h(t){const e=this._loading[t];if(e)return e;try{return await(this._loading[t]=r(t))}finally{delete this._loading[t]}}}addSchema(t,e,r,i=this.opts.validateSchema){if(Array.isArray(t)){for(const e of t)this.addSchema(e,void 0,r,i);return this}let n;if("object"==typeof t){const{schemaId:e}=this.opts;if(n=t[e],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${e} must be string`)}return e=(0,fc.normalizeId)(e||n),this._checkUnique(e),this.schemas[e]=this._addSchema(t,r,e,i,!0),this}addMetaSchema(t,e,r=this.opts.validateSchema){return this.addSchema(t,e,!0,r),this}validateSchema(t,e){if("boolean"==typeof t)return!0;let r;if(r=t.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(r,t);if(!i&&e){const t="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(t);this.logger.error(t)}return i}getSchema(t){let e;for(;"string"==typeof(e=c.call(this,t));)t=e;if(void 0===e){const{schemaId:r}=this.opts,i=new bc.SchemaEnv({schema:{},schemaId:r});if(e=bc.resolveSchema.call(this,i,t),!e)return;this.refs[t]=e}return e.validate||this._compileSchemaEnv(e)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const e=c.call(this,t);return"object"==typeof e&&this._cache.delete(e.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{const e=t;this._cache.delete(e);let r=t[this.opts.schemaId];return r&&(r=(0,fc.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const e of t)this.addKeyword(e);return this}addKeyword(t,e){let r;if("string"==typeof t)r=t,"object"==typeof e&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),e.keyword=r);else{if("object"!=typeof t||void 0!==e)throw new Error("invalid addKeywords parameters");if(r=(e=t).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(v.call(this,r,e),!e)return(0,Yl.eachItem)(r,(t=>w.call(this,t))),this;M.call(this,e);const i={...e,type:(0,oc.getJSONTypes)(e.type),schemaType:(0,oc.getJSONTypes)(e.schemaType)};return(0,Yl.eachItem)(r,0===i.type.length?t=>w.call(this,t,i):t=>i.type.forEach((e=>w.call(this,t,i,e)))),this}getKeyword(t){const e=this.RULES.all[t];return"object"==typeof e?e.definition:!!e}removeKeyword(t){const{RULES:e}=this;delete e.keywords[t],delete e.all[t];for(const r of e.rules){const e=r.rules.findIndex((e=>e.keyword===t));e>=0&&r.rules.splice(e,1)}return this}addFormat(t,e){return"string"==typeof e&&(e=new RegExp(e)),this.formats[t]=e,this}errorsText(t=this.errors,{separator:e=", ",dataVar:r="data"}={}){return t&&0!==t.length?t.map((t=>`${r}${t.instancePath} ${t.message}`)).reduce(((t,r)=>t+e+r)):"No errors"}$dataMetaSchema(t,e){const r=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const i of e){const e=i.split("/").slice(1);let n=t;for(const t of e)n=n[t];for(const t in r){const e=r[t];if("object"!=typeof e)continue;const{$data:i}=e.definition,o=n[t];i&&o&&(n[t]=E(o))}}return t}_removeAllSchemas(t,e){for(const r in t){const i=t[r];e&&!e.test(r)||("string"==typeof i?delete t[r]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[r]))}}_addSchema(t,e,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof t)o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof t)throw new Error("schema must be object or boolean")}let a=this._cache.get(t);if(void 0!==a)return a;r=(0,fc.normalizeId)(o||r);const h=fc.getSchemaRefs.call(this,t,r);return a=new bc.SchemaEnv({schema:t,schemaId:s,meta:e,baseId:r,localRefs:h}),this._cache.set(a.schema,a),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),i&&this.validateSchema(t,!0),a}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):bc.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const e=this.opts;this.opts=this._metaOpts;try{bc.compileSchema.call(this,t)}finally{this.opts=e}}}function l(t,e,r,i="error"){for(const n in t){const o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function c(t){return t=(0,fc.normalizeId)(t),this.schemas[t]||this.refs[t]}function f(){const t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(const e in t)this.addSchema(t[e],e)}function d(){for(const t in this.opts.formats){const e=this.opts.formats[t];e&&this.addFormat(t,e)}}function m(t){if(Array.isArray(t))this.addVocabulary(t);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const e in t){const r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}}function p(){const t={...this.opts};for(const e of n)delete t[e];return t}e.default=u,u.ValidationError=gc.default,u.MissingRefError=wc.default;const g={log(){},warn(){},error(){}};const y=/^[a-z_$][a-z0-9_$:-]*$/i;function v(t,e){const{RULES:r}=this;if((0,Yl.eachItem)(t,(t=>{if(r.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!y.test(t))throw new Error(`Keyword ${t} has invalid name`)})),e&&e.$data&&!("code"in e)&&!("validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function w(t,e,r){var i;const n=null==e?void 0:e.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=n?o.post:o.rules.find((({type:t})=>t===r));if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;const a={keyword:t,definition:{...e,type:(0,oc.getJSONTypes)(e.type),schemaType:(0,oc.getJSONTypes)(e.schemaType)}};e.before?b.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,null===(i=e.implements)||void 0===i||i.forEach((t=>this.addKeyword(t)))}function b(t,e,r){const i=t.rules.findIndex((t=>t.keyword===r));i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function M(t){let{metaSchema:e}=t;void 0!==e&&(t.$data&&this.opts.$data&&(e=E(e)),t.validateSchema=this.compile(e,!0))}const _={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function E(t){return{anyOf:[t,_]}}}));var xc={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}},Nc=Object.defineProperty({default:xc},"__esModule",{value:!0}),Sc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;const r={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:o}=t,{baseId:s,schemaEnv:a,validateName:h,opts:u,self:l}=o,{root:c}=a;if(("#"===r||"#/"===r)&&s===c.baseId)return function(){if(a===c)return n(t,h,a,a.$async);const r=e.scopeValue("root",{ref:c});return n(t,Wl._`${r}.validate`,c,c.$async)}();const f=bc.resolveRef.call(l,c,s,r);if(void 0===f)throw new wc.default(o.opts.uriResolver,s,r);return f instanceof bc.SchemaEnv?function(e){const r=i(t,e);n(t,r,e,e.$async)}(f):function(i){const n=e.scopeValue("schema",!0===u.code.source?{ref:i,code:(0,Wl.stringify)(i)}:{ref:i}),o=e.name("valid"),s=t.subschema({schema:i,dataTypes:[],schemaPath:Wl.nil,topSchemaRef:n,errSchemaPath:r},o);t.mergeEvaluated(s),t.ok(o)}(f)}};function i(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):Wl._`${r.scopeValue("wrapper",{ref:e})}.validate`}function n(t,e,r,i){const{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:h}=o,u=h.passContext?tc.default.this:Wl.nil;function l(t){const e=Wl._`${t}.errors`;n.assign(tc.default.vErrors,Wl._`${tc.default.vErrors} === null ? ${e} : ${tc.default.vErrors}.concat(${e})`),n.assign(tc.default.errors,Wl._`${tc.default.vErrors}.length`)}function c(t){var e;if(!o.opts.unevaluated)return;const i=null===(e=null==r?void 0:r.validate)||void 0===e?void 0:e.evaluated;if(!0!==o.props)if(i&&!i.dynamicProps)void 0!==i.props&&(o.props=Yl.mergeEvaluated.props(n,i.props,o.props));else{const e=n.var("props",Wl._`${t}.evaluated.props`);o.props=Yl.mergeEvaluated.props(n,e,o.props,Wl.Name)}if(!0!==o.items)if(i&&!i.dynamicItems)void 0!==i.items&&(o.items=Yl.mergeEvaluated.items(n,i.items,o.items));else{const e=n.var("items",Wl._`${t}.evaluated.items`);o.items=Yl.mergeEvaluated.items(n,e,o.items,Wl.Name)}}i?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=n.let("valid");n.try((()=>{n.code(Wl._`await ${(0,ac.callValidateCode)(t,e,u)}`),c(e),s||n.assign(r,!0)}),(t=>{n.if(Wl._`!(${t} instanceof ${o.ValidationError})`,(()=>n.throw(t))),l(t),s||n.assign(r,!1)})),t.ok(r)}():t.result((0,ac.callValidateCode)(t,e,u),(()=>c(e)),(()=>l(e)))}e.getValidate=i,e.callRef=n,e.default=r}));var Ic=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Nc.default,Sc.default],Tc=Object.defineProperty({default:Ic},"__esModule",{value:!0});const Rc=Wl.operators,Cc={maximum:{okStr:"<=",ok:Rc.LTE,fail:Rc.GT},minimum:{okStr:">=",ok:Rc.GTE,fail:Rc.LT},exclusiveMaximum:{okStr:"<",ok:Rc.LT,fail:Rc.GTE},exclusiveMinimum:{okStr:">",ok:Rc.GT,fail:Rc.LTE}},Pc={message:({keyword:t,schemaCode:e})=>Wl.str`must be ${Cc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>Wl._`{comparison: ${Cc[t].okStr}, limit: ${e}}`},Oc={keyword:Object.keys(Cc),type:"number",schemaType:"number",$data:!0,error:Pc,code(t){const{keyword:e,data:r,schemaCode:i}=t;t.fail$data(Wl._`${r} ${Cc[e].fail} ${i} || isNaN(${r})`)}};var Bc=Oc,$c=Object.defineProperty({default:Bc},"__esModule",{value:!0});const Uc={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must be multiple of ${t}`,params:({schemaCode:t})=>Wl._`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?Wl._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:Wl._`${s} !== parseInt(${s})`;t.fail$data(Wl._`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};var Dc=Uc,Lc=Object.defineProperty({default:Dc},"__esModule",{value:!0});function Fc(t){const e=t.length;let r,i=0,n=0;for(;n<e;)i++,r=t.charCodeAt(n++),r>=55296&&r<=56319&&n<e&&(r=t.charCodeAt(n),56320==(64512&r)&&n++);return i}var jc=Fc;Fc.code='require("ajv/dist/runtime/ucs2length").default';var zc=Object.defineProperty({default:jc},"__esModule",{value:!0});const qc={message({keyword:t,schemaCode:e}){const r="maxLength"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},Hc={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:qc,code(t){const{keyword:e,data:r,schemaCode:i,it:n}=t,o="maxLength"===e?Wl.operators.GT:Wl.operators.LT,s=!1===n.opts.unicode?Wl._`${r}.length`:Wl._`${(0,Yl.useFunc)(t.gen,zc.default)}(${r})`;t.fail$data(Wl._`${s} ${o} ${i}`)}};var Vc=Hc,Zc=Object.defineProperty({default:Vc},"__esModule",{value:!0});var Gc={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must match pattern "${t}"`,params:({schemaCode:t})=>Wl._`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:i,schemaCode:n,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?Wl._`(new RegExp(${n}, ${s}))`:(0,ac.usePattern)(t,i);t.fail$data(Wl._`!${a}.test(${e})`)}},Kc=Object.defineProperty({default:Gc},"__esModule",{value:!0});const Jc={message({keyword:t,schemaCode:e}){const r="maxProperties"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},Qc={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Jc,code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxProperties"===e?Wl.operators.GT:Wl.operators.LT;t.fail$data(Wl._`Object.keys(${r}).length ${n} ${i}`)}};var Wc=Qc,Yc=Object.defineProperty({default:Wc},"__esModule",{value:!0});const Xc={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>Wl.str`must have required property '${t}'`,params:({params:{missingProperty:t}})=>Wl._`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&0===r.length)return;const h=r.length>=a.loopRequired;if(s.allErrors?function(){if(h||o)t.block$data(Wl.nil,u);else for(const e of r)(0,ac.checkReportMissingProp)(t,e)}():function(){const s=e.let("missing");if(h||o){const r=e.let("valid",!0);t.block$data(r,(()=>function(r,o){t.setParams({missingProperty:r}),e.forOf(r,i,(()=>{e.assign(o,(0,ac.propertyInData)(e,n,r,a.ownProperties)),e.if((0,Wl.not)(o),(()=>{t.error(),e.break()}))}),Wl.nil)}(s,r))),t.ok(r)}else e.if((0,ac.checkMissingProp)(t,r,s)),(0,ac.reportMissingProp)(t,s),e.else()}(),a.strictRequired){const e=t.parentSchema.properties,{definedProperties:i}=t.it;for(const t of r)if(void 0===(null==e?void 0:e[t])&&!i.has(t)){const e=`required property "${t}" is not defined at "${s.schemaEnv.baseId+s.errSchemaPath}" (strictRequired)`;(0,Yl.checkStrictMode)(s,e,s.opts.strictRequired)}}function u(){e.forOf("prop",i,(r=>{t.setParams({missingProperty:r}),e.if((0,ac.noPropertyInData)(e,n,r,a.ownProperties),(()=>t.error()))}))}}};var tf=Xc,ef=Object.defineProperty({default:tf},"__esModule",{value:!0});const rf={message({keyword:t,schemaCode:e}){const r="maxItems"===t?"more":"fewer";return Wl.str`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>Wl._`{limit: ${t}}`},nf={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rf,code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxItems"===e?Wl.operators.GT:Wl.operators.LT;t.fail$data(Wl._`${r}.length ${n} ${i}`)}};var of=nf,sf=Object.defineProperty({default:of},"__esModule",{value:!0});lc.code='require("ajv/dist/runtime/equal").default';var af=lc,hf=Object.defineProperty({default:af},"__esModule",{value:!0});const uf={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>Wl.str`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>Wl._`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;const h=e.let("valid"),u=o.items?(0,oc.getSchemaTypes)(o.items):[];function l(i,n){const o=e.name("item"),s=(0,oc.checkDataTypes)(u,o,a.opts.strictNumbers,oc.DataType.Wrong),l=e.const("indices",Wl._`{}`);e.for(Wl._`;${i}--;`,(()=>{e.let(o,Wl._`${r}[${i}]`),e.if(s,Wl._`continue`),u.length>1&&e.if(Wl._`typeof ${o} == "string"`,Wl._`${o} += "_"`),e.if(Wl._`typeof ${l}[${o}] == "number"`,(()=>{e.assign(n,Wl._`${l}[${o}]`),t.error(),e.assign(h,!1).break()})).code(Wl._`${l}[${o}] = ${i}`)}))}function c(i,n){const o=(0,Yl.useFunc)(e,hf.default),s=e.name("outer");e.label(s).for(Wl._`;${i}--;`,(()=>e.for(Wl._`${n} = ${i}; ${n}--;`,(()=>e.if(Wl._`${o}(${r}[${i}], ${r}[${n}])`,(()=>{t.error(),e.assign(h,!1).break(s)}))))))}t.block$data(h,(function(){const i=e.let("i",Wl._`${r}.length`),n=e.let("j");t.setParams({i:i,j:n}),e.assign(h,!0),e.if(Wl._`${i} > 1`,(()=>(u.length>0&&!u.some((t=>"object"===t||"array"===t))?l:c)(i,n)))}),Wl._`${s} === false`),t.ok(h)}};var lf=uf,cf=Object.defineProperty({default:lf},"__esModule",{value:!0});const ff={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>Wl._`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&"object"==typeof o?t.fail$data(Wl._`!${(0,Yl.useFunc)(e,hf.default)}(${r}, ${n})`):t.fail(Wl._`${o} !== ${r}`)}};var df=ff,mf=Object.defineProperty({default:df},"__esModule",{value:!0});const pf={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>Wl._`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&0===n.length)throw new Error("enum must have non-empty array");const a=n.length>=s.opts.loopEnum;let h;const u=()=>null!=h?h:h=(0,Yl.useFunc)(e,hf.default);let l;if(a||i)l=e.let("valid"),t.block$data(l,(function(){e.assign(l,!1),e.forOf("v",o,(t=>e.if(Wl._`${u()}(${r}, ${t})`,(()=>e.assign(l,!0).break()))))}));else{if(!Array.isArray(n))throw new Error("ajv implementation error");const t=e.const("vSchema",o);l=(0,Wl.or)(...n.map(((e,i)=>function(t,e){const i=n[e];return"object"==typeof i&&null!==i?Wl._`${u()}(${r}, ${t}[${e}])`:Wl._`${r} === ${i}`}(t,i))))}t.pass(l)}};var gf=pf,yf=Object.defineProperty({default:gf},"__esModule",{value:!0});var vf=[$c.default,Lc.default,Zc.default,Kc.default,Yc.default,ef.default,sf.default,cf.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},mf.default,yf.default],wf=Object.defineProperty({default:vf},"__esModule",{value:!0}),bf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;const r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>Wl.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Wl._`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:n}=e;Array.isArray(n)?i(t,n):(0,Yl.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function i(t,e){const{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;const a=r.const("len",Wl._`${n}.length`);if(!1===i)t.setParams({len:e.length}),t.pass(Wl._`${a} <= ${e.length}`);else if("object"==typeof i&&!(0,Yl.alwaysValidSchema)(s,i)){const i=r.var("valid",Wl._`${a} <= ${e.length}`);r.if((0,Wl.not)(i),(()=>function(i){r.forRange("i",e.length,a,(e=>{t.subschema({keyword:o,dataProp:e,dataPropType:Yl.Type.Num},i),s.allErrors||r.if((0,Wl.not)(i),(()=>r.break()))}))}(i))),t.ok(i)}}e.validateAdditionalItems=i,e.default=r})),Mf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;const r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return i(t,"additionalItems",e);r.items=!0,(0,Yl.alwaysValidSchema)(r,e)||t.ok((0,ac.validateArray)(t))}};function i(t,e,r=t.schema){const{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;!function(t){const{opts:i,errSchemaPath:n}=a,o=r.length,h=o===t.minItems&&(o===t.maxItems||!1===t[e]);if(i.strictTuples&&!h){const t=`"${s}" is ${o}-tuple, but minItems or maxItems/${e} are not specified or different at path "${n}"`;(0,Yl.checkStrictMode)(a,t,i.strictTuples)}}(n),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=Yl.mergeEvaluated.items(i,r.length,a.items));const h=i.name("valid"),u=i.const("len",Wl._`${o}.length`);r.forEach(((e,r)=>{(0,Yl.alwaysValidSchema)(a,e)||(i.if(Wl._`${u} > ${r}`,(()=>t.subschema({keyword:s,schemaProp:r,dataProp:r},h))),t.ok(h))}))}e.validateTuple=i,e.default=r}));var _f={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Mf.validateTuple)(t,"items")},Ef=Object.defineProperty({default:_f},"__esModule",{value:!0});const Af={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>Wl.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Wl._`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,(0,Yl.alwaysValidSchema)(i,e)||(n?(0,bf.validateAdditionalItems)(t,n):t.ok((0,ac.validateArray)(t)))}};var kf=Af,xf=Object.defineProperty({default:kf},"__esModule",{value:!0});const Nf={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>void 0===e?Wl.str`must contain at least ${t} valid item(s)`:Wl.str`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>void 0===e?Wl._`{minContains: ${t}}`:Wl._`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;let s,a;const{minContains:h,maxContains:u}=i;o.opts.next?(s=void 0===h?1:h,a=u):s=1;const l=e.const("len",Wl._`${n}.length`);if(t.setParams({min:s,max:a}),void 0===a&&0===s)return void(0,Yl.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&s>a)return(0,Yl.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),void t.fail();if((0,Yl.alwaysValidSchema)(o,r)){let e=Wl._`${l} >= ${s}`;return void 0!==a&&(e=Wl._`${e} && ${l} <= ${a}`),void t.pass(e)}o.items=!0;const c=e.name("valid");function f(){const t=e.name("_valid"),r=e.let("count",0);d(t,(()=>e.if(t,(()=>function(t){e.code(Wl._`${t}++`),void 0===a?e.if(Wl._`${t} >= ${s}`,(()=>e.assign(c,!0).break())):(e.if(Wl._`${t} > ${a}`,(()=>e.assign(c,!1).break())),1===s?e.assign(c,!0):e.if(Wl._`${t} >= ${s}`,(()=>e.assign(c,!0))))}(r)))))}function d(r,i){e.forRange("i",0,l,(e=>{t.subschema({keyword:"contains",dataProp:e,dataPropType:Yl.Type.Num,compositeRule:!0},r),i()}))}void 0===a&&1===s?d(c,(()=>e.if(c,(()=>e.break())))):0===s?(e.let(c,!0),void 0!==a&&e.if(Wl._`${n}.length > 0`,f)):(e.let(c,!1),f()),t.result(c,(()=>t.reset()))}};var Sf=Nf,If=Object.defineProperty({default:Sf},"__esModule",{value:!0}),Tf=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0,e.error={message:({params:{property:t,depsCount:e,deps:r}})=>{const i=1===e?"property":"properties";return Wl.str`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>Wl._`{property: ${t},
19
19
  missingProperty: ${i},
20
20
  depsCount: ${e},
21
- deps: ${r}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(t){const[e,r]=function({schema:t}){const e={},r={};for(const i in t){if("__proto__"===i)continue;(Array.isArray(t[i])?e:r)[i]=t[i]}return[e,r]}(t);i(t,e),n(t,r)}};function i(t,e=t.schema){const{gen:r,data:i,it:n}=t;if(0===Object.keys(e).length)return;const o=r.let("missing");for(const s in e){const a=e[s];if(0===a.length)continue;const h=(0,ac.propertyInData)(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(h,(()=>{for(const e of a)(0,ac.checkReportMissingProp)(t,e)})):(r.if(Wl._`${h} && (${(0,ac.checkMissingProp)(t,a,o)})`),(0,ac.reportMissingProp)(t,o),r.else())}}function n(t,e=t.schema){const{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(const a in e)(0,Yl.alwaysValidSchema)(o,e[a])||(r.if((0,ac.propertyInData)(r,i,a,o.opts.ownProperties),(()=>{const e=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(e,s)}),(()=>r.var(s,!0))),t.ok(s))}e.validatePropertyDeps=i,e.validateSchemaDeps=n,e.default=r}));const Rf={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>Wl._`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:i,it:n}=t;if((0,Yl.alwaysValidSchema)(n,r))return;const o=e.name("valid");e.forIn("key",i,(r=>{t.setParams({propertyName:r}),t.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),e.if((0,Wl.not)(o),(()=>{t.error(!0),n.allErrors||e.break()}))})),t.ok(o)}};var Cf=Rf,Pf=Object.defineProperty({default:Cf},"__esModule",{value:!0});const Of={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>Wl._`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:h}=s;if(s.props=!0,"all"!==h.removeAdditional&&(0,Yl.alwaysValidSchema)(s,r))return;const u=(0,ac.allSchemaProperties)(i.properties),l=(0,ac.allSchemaProperties)(i.patternProperties);function c(t){e.code(Wl._`delete ${n}[${t}]`)}function f(i){if("all"===h.removeAdditional||h.removeAdditional&&!1===r)c(i);else{if(!1===r)return t.setParams({additionalProperty:i}),t.error(),void(a||e.break());if("object"==typeof r&&!(0,Yl.alwaysValidSchema)(s,r)){const r=e.name("valid");"failing"===h.removeAdditional?(d(i,r,!1),e.if((0,Wl.not)(r),(()=>{t.reset(),c(i)}))):(d(i,r),a||e.if((0,Wl.not)(r),(()=>e.break())))}}}function d(e,r,i){const n={keyword:"additionalProperties",dataProp:e,dataPropType:Yl.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,r)}e.forIn("key",n,(r=>{u.length||l.length?e.if(function(r){let n;if(u.length>8){const t=(0,Yl.schemaRefOrVal)(s,i.properties,"properties");n=(0,ac.isOwnProperty)(e,t,r)}else n=u.length?(0,Wl.or)(...u.map((t=>Wl._`${r} === ${t}`))):Wl.nil;return l.length&&(n=(0,Wl.or)(n,...l.map((e=>Wl._`${(0,ac.usePattern)(t,e)}.test(${r})`)))),(0,Wl.not)(n)}(r),(()=>f(r))):f(r)})),t.ok(Wl._`${o} === ${tc.default.errors}`)}};var Bf=Of,$f=Object.defineProperty({default:Bf},"__esModule",{value:!0});const Uf={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;"all"===o.opts.removeAdditional&&void 0===i.additionalProperties&&$f.default.code(new dc.KeywordCxt(o,$f.default,"additionalProperties"));const s=(0,ac.allSchemaProperties)(r);for(const t of s)o.definedProperties.add(t);o.opts.unevaluated&&s.length&&!0!==o.props&&(o.props=Yl.mergeEvaluated.props(e,(0,Yl.toHash)(s),o.props));const a=s.filter((t=>!(0,Yl.alwaysValidSchema)(o,r[t])));if(0===a.length)return;const h=e.name("valid");for(const r of a)u(r)?l(r):(e.if((0,ac.propertyInData)(e,n,r,o.opts.ownProperties)),l(r),o.allErrors||e.else().var(h,!0),e.endIf()),t.it.definedProperties.add(r),t.ok(h);function u(t){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[t].default}function l(e){t.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}};var Df=Uf,Lf=Object.defineProperty({default:Df},"__esModule",{value:!0});const Ff=Yl,jf={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=(0,ac.allSchemaProperties)(r),h=a.filter((t=>(0,Yl.alwaysValidSchema)(o,r[t])));if(0===a.length||h.length===a.length&&(!o.opts.unevaluated||!0===o.props))return;const u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");!0===o.props||o.props instanceof Wl.Name||(o.props=(0,Ff.evaluatedPropsToName)(e,o.props));const{props:c}=o;function f(t){for(const e in u)new RegExp(t).test(e)&&(0,Yl.checkStrictMode)(o,`property ${e} matches pattern ${t} (use allowMatchingProperties)`)}function d(r){e.forIn("key",i,(i=>{e.if(Wl._`${(0,ac.usePattern)(t,r)}.test(${i})`,(()=>{const n=h.includes(r);n||t.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:Ff.Type.Str},l),o.opts.unevaluated&&!0!==c?e.assign(Wl._`${c}[${i}]`,!0):n||o.allErrors||e.if((0,Wl.not)(l),(()=>e.break()))}))}))}!function(){for(const t of a)u&&f(t),o.allErrors?d(t):(e.var(l,!0),d(t),e.if(l))}()}};var zf=jf,qf=Object.defineProperty({default:zf},"__esModule",{value:!0});const Hf={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:i}=t;if((0,Yl.alwaysValidSchema)(i,r))return void t.fail();const n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};var Vf=Hf,Zf=Object.defineProperty({default:Vf},"__esModule",{value:!0});var Gf={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ac.validateUnion,error:{message:"must match a schema in anyOf"}},Kf=Object.defineProperty({default:Gf},"__esModule",{value:!0});const Jf={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>Wl._`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;const o=r,s=e.let("valid",!1),a=e.let("passing",null),h=e.name("_valid");t.setParams({passing:a}),e.block((function(){o.forEach(((r,i)=>{let o;(0,Yl.alwaysValidSchema)(n,r)?e.var(h,!0):o=t.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&e.if(Wl._`${h} && ${s}`).assign(s,!1).assign(a,Wl._`[${a}, ${i}]`).else(),e.if(h,(()=>{e.assign(s,!0),e.assign(a,i),o&&t.mergeEvaluated(o,Wl.Name)}))}))})),t.result(s,(()=>t.reset()),(()=>t.error(!0)))}};var Qf=Jf,Wf=Object.defineProperty({default:Qf},"__esModule",{value:!0});const Yf={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=e.name("valid");r.forEach(((e,r)=>{if((0,Yl.alwaysValidSchema)(i,e))return;const o=t.subschema({keyword:"allOf",schemaProp:r},n);t.ok(n),t.mergeEvaluated(o)}))}};var Xf=Yf,td=Object.defineProperty({default:Xf},"__esModule",{value:!0});const ed={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>Wl.str`must match "${t.ifClause}" schema`,params:({params:t})=>Wl._`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:i}=t;void 0===r.then&&void 0===r.else&&(0,Yl.checkStrictMode)(i,'"if" without "then" and "else" is ignored');const n=rd(i,"then"),o=rd(i,"else");if(!n&&!o)return;const s=e.let("valid",!0),a=e.name("_valid");if(function(){const e=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(e)}(),t.reset(),n&&o){const r=e.let("ifClause");t.setParams({ifClause:r}),e.if(a,h("then",r),h("else",r))}else n?e.if(a,h("then")):e.if((0,Wl.not)(a),h("else"));function h(r,i){return()=>{const n=t.subschema({keyword:r},a);e.assign(s,a),t.mergeValidEvaluated(n,s),i?e.assign(i,Wl._`${r}`):t.setParams({ifClause:r})}}t.pass(s,(()=>t.error(!0)))}};function rd(t,e){const r=t.schema[e];return void 0!==r&&!(0,Yl.alwaysValidSchema)(t,r)}var id=ed,nd=Object.defineProperty({default:id},"__esModule",{value:!0});const od={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){void 0===e.if&&(0,Yl.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};var sd=od,ad=Object.defineProperty({default:sd},"__esModule",{value:!0});var hd=function(t=!1){const e=[Zf.default,Kf.default,Wf.default,td.default,nd.default,ad.default,Pf.default,$f.default,Tf.default,Lf.default,qf.default];return t?e.push(Ef.default,xf.default):e.push(bf.default,Mf.default),e.push(If.default),e},ud=Object.defineProperty({default:hd},"__esModule",{value:!0});const ld={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must match format "${t}"`,params:({schemaCode:t})=>Wl._`{format: ${t}}`},code(t,e){const{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:h,errSchemaPath:u,schemaEnv:l,self:c}=a;h.validateFormats&&(n?function(){const n=r.scopeValue("formats",{ref:c.formats,code:h.code.formats}),o=r.const("fDef",Wl._`${n}[${s}]`),a=r.let("fType"),u=r.let("format");r.if(Wl._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>r.assign(a,Wl._`${o}.type || "string"`).assign(u,Wl._`${o}.validate`)),(()=>r.assign(a,Wl._`"string"`).assign(u,o))),t.fail$data((0,Wl.or)(!1===h.strictSchema?Wl.nil:Wl._`${s} && !${u}`,function(){const t=l.$async?Wl._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:Wl._`${u}(${i})`,r=Wl._`(typeof ${u} == "function" ? ${t} : ${u}.test(${i}))`;return Wl._`${u} && ${u} !== true && ${a} === ${e} && !${r}`}()))}():function(){const n=c.formats[o];if(!n)return void function(){if(!1===h.strictSchema)return void c.logger.warn(t());throw new Error(t());function t(){return`unknown format "${o}" ignored in schema at path "${u}"`}}();if(!0===n)return;const[s,a,f]=function(t){const e=t instanceof RegExp?(0,Wl.regexpCode)(t):h.code.formats?Wl._`${h.code.formats}${(0,Wl.getProperty)(o)}`:void 0,i=r.scopeValue("formats",{key:o,ref:t,code:e});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,Wl._`${i}.validate`];return["string",t,i]}(n);s===e&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!l.$async)throw new Error("async format in sync schema");return Wl._`await ${f}(${i})`}return"function"==typeof a?Wl._`${f}(${i})`:Wl._`${f}.test(${i})`}())}())}};var cd=ld;var fd=[Object.defineProperty({default:cd},"__esModule",{value:!0}).default],dd=Object.defineProperty({default:fd},"__esModule",{value:!0}),md=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}));var pd=[Tc.default,wf.default,(0,ud.default)(),dd.default,md.metadataVocabulary,md.contentVocabulary],gd=Object.defineProperty({default:pd},"__esModule",{value:!0}),yd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}));const vd={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===yd.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>Wl._`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=i.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const h=e.let("valid",!1),u=e.const("tag",Wl._`${r}${(0,Wl.getProperty)(a)}`);function l(r){const i=e.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:r},i);return t.mergeEvaluated(n,Wl.Name),i}e.if(Wl._`typeof ${u} == "string"`,(()=>function(){const r=function(){var t;const e={},r=h(n);let i=!0;for(let e=0;e<s.length;e++){let n=s[e];(null==n?void 0:n.$ref)&&!(0,Yl.schemaHasRulesButRef)(n,o.self.RULES)&&(n=bc.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,null==n?void 0:n.$ref),n instanceof bc.SchemaEnv&&(n=n.schema));const l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t[a];if("object"!=typeof l)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);i=i&&(r||h(n)),u(l,e)}if(!i)throw new Error(`discriminator: "${a}" must be required`);return e;function h({required:t}){return Array.isArray(t)&&t.includes(a)}function u(t,e){if(t.const)l(t.const,e);else{if(!t.enum)throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`);for(const r of t.enum)l(r,e)}}function l(t,r){if("string"!=typeof t||t in e)throw new Error(`discriminator: "${a}" values must be unique strings`);e[t]=r}}();e.if(!1);for(const t in r)e.elseIf(Wl._`${u} === ${t}`),e.assign(h,l(r[t]));e.else(),t.error(!1,{discrError:yd.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}()),(()=>t.error(!1,{discrError:yd.DiscrError.Tag,tag:u,tagName:a}))),t.ok(h)}};var wd=vd,bd=Object.defineProperty({default:wd},"__esModule",{value:!0}),Md={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},_d=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const r=["/properties"],i="http://json-schema.org/draft-07/schema";class n extends kc.default{_addVocabularies(){super._addVocabularies(),gd.default.forEach((t=>this.addVocabulary(t))),this.opts.discriminator&&this.addKeyword(bd.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(Md,r):Md;this.addMetaSchema(t,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return dc.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return Wl._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return Wl.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return Wl.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return Wl.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return Wl.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return Wl.CodeGen}})})),Ed=i(_d),Ad=o((function(t,e){function r(t,e){return{validate:t,compare:e}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:r(o,s),time:r(h,u),"date-time":r((function(t){const e=t.split(l);return 2===e.length&&o(e[0])&&h(e[1],!0)}),c),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&d.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(g.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return m.lastIndex=0,m.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:p},double:{type:"number",validate:p},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(t){const e=i.exec(t);if(!e)return!1;const r=+e[1],o=+e[2],s=+e[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:n[o])}function s(t,e){if(t&&e)return t>e?1:t<e?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function h(t,e){const r=a.exec(t);if(!r)return!1;const i=+r[1],n=+r[2],o=+r[3],s=r[5];return(i<=23&&n<=59&&o<=59||23===i&&59===n&&60===o)&&(!e||""!==s)}function u(t,e){if(!t||!e)return;const r=a.exec(t),i=a.exec(e);return r&&i?(t=r[1]+r[2]+r[3]+(r[4]||""))>(e=i[1]+i[2]+i[3]+(i[4]||""))?1:t<e?-1:0:void 0}const l=/t|\s/i;function c(t,e){if(!t||!e)return;const[r,i]=t.split(l),[n,o]=e.split(l),a=s(r,n);return void 0!==a?a||u(i,o):void 0}const f=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;const m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function p(){return!0}const g=/[^\\]\\Z/})),kd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const r=Wl.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={message:({keyword:t,schemaCode:e})=>Wl.str`should be ${i[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>Wl._`{comparison: ${i[t].okStr}, limit: ${e}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:n,code(t){const{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:a,self:h}=s;if(!a.validateFormats)return;const u=new _d.KeywordCxt(s,h.RULES.all.format.definition,"format");function l(t){return Wl._`${t}.compare(${r}, ${n}) ${i[o].fail} 0`}u.$data?function(){const r=e.scopeValue("formats",{ref:h.formats,code:a.code.formats}),i=e.const("fmt",Wl._`${r}[${u.schemaCode}]`);t.fail$data(Wl.or(Wl._`typeof ${i} != "object"`,Wl._`${i} instanceof RegExp`,Wl._`typeof ${i}.compare != "function"`,l(i)))}():function(){const r=u.schema,i=h.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${o}": format "${r}" does not define "compare" function`);const n=e.scopeValue("formats",{key:r,ref:i,code:a.code.formats?Wl._`${a.code.formats}${Wl.getProperty(r)}`:void 0});t.fail$data(l(n))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),xd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=new Wl.Name("fullFormats"),i=new Wl.Name("fastFormats"),n=(t,e={keywords:!0})=>{if(Array.isArray(e))return o(t,e,Ad.fullFormats,r),t;const[n,s]="fast"===e.mode?[Ad.fastFormats,i]:[Ad.fullFormats,r];return o(t,e.formats||Ad.formatNames,n,s),e.keywords&&kd.default(t),t};function o(t,e,r,i){var n,o;null!==(n=(o=t.opts.code).formats)&&void 0!==n||(o.formats=Wl._`require("ajv-formats/dist/formats").${i}`);for(const i of e)t.addFormat(i,r[i])}n.get=(t,e="full")=>{const r=("fast"===e?Ad.fastFormats:Ad.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n})),Nd=i(xd),Sd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r="errorMessage",i=new _d.Name("emUsed"),n={required:"missingProperty",dependencies:"property",dependentRequired:"property"},o=/\$\{[^}]+\}/,s=/\$\{([^}]+)\}/g,a=/^""\s*\+\s*|\s*\+\s*""$/g;function h(t){return{keyword:r,schemaType:["string","object"],post:!0,code(e){const{gen:h,data:u,schema:l,schemaValue:c,it:f}=e;if(!1===f.createErrors)return;const d=l,m=Wl.strConcat(tc.default.instancePath,f.errorPath);function p(t,e){return Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,_d._`${t}.instancePath === ${m}`,_d._`${t}.keyword in ${e}`,_d._`${t}.schemaPath.indexOf(${f.errSchemaPath}) === 0`,_d._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${f.errSchemaPath.length}))`)}function g(t,e){const r=[];for(const i in t){const t=e[i];o.test(t)&&r.push([i,v(t)])}return h.object(...r)}function y(t){return o.test(t)?new Jl._Code(Jl.safeStringify(t).replace(s,((t,e)=>`" + JSON.stringify(${dc.getData(e,f)}) + "`)).replace(a,"")):_d.stringify(t)}function v(t){return _d._`function(){return ${y(t)}}`}h.if(_d._`${tc.default.errors} > 0`,(()=>{if("object"==typeof d){const[o,s]=function(t){let e,r;for(const i in t){if("properties"===i||"items"===i)continue;const n=t[i];if("object"==typeof n){e||(e={});const t=e[i]={};for(const e in n)t[e]=[]}else r||(r={}),r[i]=[]}return[e,r]}(d);s&&function(r){const n=h.const("emErrors",_d.stringify(r)),o=h.const("templates",g(r,l));h.forOf("err",tc.default.vErrors,(t=>h.if(p(t,n),(()=>h.code(_d._`${n}[${t}.keyword].push(${t})`).assign(_d._`${t}.${i}`,!0)))));const{singleError:s}=t;if(s){const t=h.let("message",_d._`""`),r=h.let("paramsErrors",_d._`[]`);a((e=>{h.if(t,(()=>h.code(_d._`${t} += ${"string"==typeof s?s:";"}`))),h.code(_d._`${t} += ${u(e)}`),h.assign(r,_d._`${r}.concat(${n}[${e}])`)})),ec.reportError(e,{message:t,params:_d._`{errors: ${r}}`})}else a((t=>ec.reportError(e,{message:u(t),params:_d._`{errors: ${n}[${t}]}`})));function a(t){h.forIn("key",n,(e=>h.if(_d._`${n}[${e}].length`,(()=>t(e)))))}function u(t){return _d._`${t} in ${o} ? ${o}[${t}]() : ${c}[${t}]`}}(s),o&&function(t){const r=h.const("emErrors",_d.stringify(t)),o=[];for(const e in t)o.push([e,g(t[e],l[e])]);const s=h.const("templates",h.object(...o)),a=h.scopeValue("obj",{ref:n,code:_d.stringify(n)}),u=h.let("emPropParams"),f=h.let("emParamsErrors");h.forOf("err",tc.default.vErrors,(t=>h.if(p(t,r),(()=>{h.assign(u,_d._`${a}[${t}.keyword]`),h.assign(f,_d._`${r}[${t}.keyword][${t}.params[${u}]]`),h.if(f,(()=>h.code(_d._`${f}.push(${t})`).assign(_d._`${t}.${i}`,!0)))})))),h.forIn("key",r,(t=>h.forIn("keyProp",_d._`${r}[${t}]`,(i=>{h.assign(f,_d._`${r}[${t}][${i}]`),h.if(_d._`${f}.length`,(()=>{const r=h.const("tmpl",_d._`${s}[${t}] && ${s}[${t}][${i}]`);ec.reportError(e,{message:_d._`${r} ? ${r}() : ${c}[${t}][${i}]`,params:_d._`{errors: ${f}}`})}))}))))}(o),function(t){const{props:n,items:o}=t;if(!n&&!o)return;const s=_d._`typeof ${u} == "object"`,a=_d._`Array.isArray(${u})`,f=h.let("emErrors");let d,p;const y=h.let("templates");n&&o?(d=h.let("emChildKwd"),h.if(s),h.if(a,(()=>{v(o,l.items),h.assign(d,_d.str`items`)}),(()=>{v(n,l.properties),h.assign(d,_d.str`properties`)})),p=_d._`[${d}]`):o?(h.if(a),v(o,l.items),p=_d._`.items`):n&&(h.if(Wl.and(s,Wl.not(a))),v(n,l.properties),p=_d._`.properties`);function v(t,e){h.assign(f,_d.stringify(t)),h.assign(y,g(t,e))}h.forOf("err",tc.default.vErrors,(t=>function(t,e,n){h.if(Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,_d._`${t}.instancePath.indexOf(${m}) === 0`),(()=>{const r=h.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:_d._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),i=h.const("emMatches",_d._`${r}.exec(${t}.instancePath.slice(${m}.length))`),o=h.const("emChild",_d._`${i} && ${i}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);h.if(_d._`${o} !== undefined && ${o} in ${e}`,(()=>n(o)))}))}(t,f,(e=>h.code(_d._`${f}[${e}].push(${t})`).assign(_d._`${t}.${i}`,!0))))),h.forIn("key",f,(t=>h.if(_d._`${f}[${t}].length`,(()=>{ec.reportError(e,{message:_d._`${t} in ${y} ? ${y}[${t}]() : ${c}${p}[${t}]`,params:_d._`{errors: ${f}[${t}]}`}),h.assign(_d._`${tc.default.vErrors}[${tc.default.errors}-1].instancePath`,_d._`${m} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),h.endIf()}(function({properties:t,items:e}){const r={};if(t){r.props={};for(const e in t)r.props[e]=[]}if(e){r.items={};for(let t=0;t<e.length;t++)r.items[t]=[]}return r}(d))}const o="string"==typeof d?d:d._;o&&function(t){const n=h.const("emErrs",_d._`[]`);h.forOf("err",tc.default.vErrors,(t=>h.if(function(t){return Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,Wl.or(_d._`${t}.instancePath === ${m}`,Wl.and(_d._`${t}.instancePath.indexOf(${m}) === 0`,_d._`${t}.instancePath[${m}.length] === "/"`)),_d._`${t}.schemaPath.indexOf(${f.errSchemaPath}) === 0`,_d._`${t}.schemaPath[${f.errSchemaPath}.length] === "/"`)}(t),(()=>h.code(_d._`${n}.push(${t})`).assign(_d._`${t}.${i}`,!0))))),h.if(_d._`${n}.length`,(()=>ec.reportError(e,{message:y(t),params:_d._`{errors: ${n}}`})))}(o),t.keepErrors||function(){const t=h.const("emErrs",_d._`[]`);h.forOf("err",tc.default.vErrors,(e=>h.if(_d._`!${e}.${i}`,(()=>h.code(_d._`${t}.push(${e})`))))),h.assign(tc.default.vErrors,t).assign(tc.default.errors,_d._`${t}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const u=(t,e={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return t.addKeyword(h(e))};e.default=u,t.exports=u,t.exports.default=u})),Id=i(Sd),Td="__lodash_hash_undefined__",Rd="[object Function]",Cd="[object GeneratorFunction]",Pd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Od=/^\w*$/,Bd=/^\./,$d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ud=/\\(\\)?/g,Dd=/^\[object .+?Constructor\]$/,Ld=/^(?:0|[1-9]\d*)$/,Fd="object"==typeof r&&r&&r.Object===Object&&r,jd="object"==typeof self&&self&&self.Object===Object&&self,zd=Fd||jd||Function("return this")();var qd,Hd=Array.prototype,Vd=Function.prototype,Zd=Object.prototype,Gd=zd["__core-js_shared__"],Kd=(qd=/[^.]+$/.exec(Gd&&Gd.keys&&Gd.keys.IE_PROTO||""))?"Symbol(src)_1."+qd:"",Jd=Vd.toString,Qd=Zd.hasOwnProperty,Wd=Zd.toString,Yd=RegExp("^"+Jd.call(Qd).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xd=zd.Symbol,tm=Hd.splice,em=dm(zd,"Map"),rm=dm(Object,"create"),im=Xd?Xd.prototype:void 0,nm=im?im.toString:void 0;function om(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function sm(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function am(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function hm(t,e,r){var i=t[e];Qd.call(t,e)&&vm(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function um(t,e){for(var r=t.length;r--;)if(vm(t[r][0],e))return r;return-1}function lm(t){if(!bm(t)||(e=t,Kd&&Kd in e))return!1;var e,r=function(t){var e=bm(t)?Wd.call(t):"";return e==Rd||e==Cd}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Yd:Dd;return r.test(function(t){if(null!=t){try{return Jd.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function cm(t,e,r,i){if(!bm(t))return t;e=function(t,e){if(wm(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||Mm(t))return!0;return Od.test(t)||!Pd.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return wm(t)?t:pm(t)}(e);for(var n=-1,o=e.length,s=o-1,a=t;null!=a&&++n<o;){var h=gm(e[n]),u=r;if(n!=s){var l=a[h];void 0===(u=i?i(l,h,a):void 0)&&(u=bm(l)?l:mm(e[n+1])?[]:{})}hm(a,h,u),a=a[h]}return t}function fm(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function dm(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return lm(r)?r:void 0}function mm(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||Ld.test(t))&&t>-1&&t%1==0&&t<e}om.prototype.clear=function(){this.__data__=rm?rm(null):{}},om.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},om.prototype.get=function(t){var e=this.__data__;if(rm){var r=e[t];return r===Td?void 0:r}return Qd.call(e,t)?e[t]:void 0},om.prototype.has=function(t){var e=this.__data__;return rm?void 0!==e[t]:Qd.call(e,t)},om.prototype.set=function(t,e){return this.__data__[t]=rm&&void 0===e?Td:e,this},sm.prototype.clear=function(){this.__data__=[]},sm.prototype.delete=function(t){var e=this.__data__,r=um(e,t);return!(r<0)&&(r==e.length-1?e.pop():tm.call(e,r,1),!0)},sm.prototype.get=function(t){var e=this.__data__,r=um(e,t);return r<0?void 0:e[r][1]},sm.prototype.has=function(t){return um(this.__data__,t)>-1},sm.prototype.set=function(t,e){var r=this.__data__,i=um(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},am.prototype.clear=function(){this.__data__={hash:new om,map:new(em||sm),string:new om}},am.prototype.delete=function(t){return fm(this,t).delete(t)},am.prototype.get=function(t){return fm(this,t).get(t)},am.prototype.has=function(t){return fm(this,t).has(t)},am.prototype.set=function(t,e){return fm(this,t).set(t,e),this};var pm=ym((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Mm(t))return nm?nm.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return Bd.test(t)&&r.push(""),t.replace($d,(function(t,e,i,n){r.push(i?n.replace(Ud,"$1"):e||t)})),r}));function gm(t){if("string"==typeof t||Mm(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ym(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s),s};return r.cache=new(ym.Cache||am),r}function vm(t,e){return t===e||t!=t&&e!=e}ym.Cache=am;var wm=Array.isArray;function bm(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Mm(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Wd.call(t)}var _m=function(t,e,r){return null==t?t:cm(t,e,r)};let Em={},Am=0;const km=new y("networks/5.6.4");function xm(t){const e=function(e,r){null==r&&(r={});const i=[];if(e.InfuraProvider&&"-"!==r.infura)try{i.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{i.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==r.alchemy)try{i.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket){const n=["goerli","ropsten","rinkeby"];try{const o=new e.PocketProvider(t,r.pocket);o.network&&-1===n.indexOf(o.network.name)&&i.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{i.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{const n=["ropsten"],o=new e.AnkrProvider(t,r.ankr);o.network&&-1===n.indexOf(o.network.name)&&i.push(o)}catch(t){}if(0===i.length)return null;if(e.FallbackProvider){let n=1;return null!=r.quorum?n=r.quorum:"homestead"===t&&(n=2),new e.FallbackProvider(i,n)}return i[0]};return e.renetwork=function(t){return xm(t)},e}function Nm(t,e){const r=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return Nm(t,e)},r}const Sm={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:xm("homestead")},Im={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:xm("ropsten")},Tm={chainId:63,name:"classicMordor",_defaultProvider:Nm("https://www.ethercluster.com/mordor","classicMordor")},Rm={unspecified:{chainId:0,name:"unspecified"},homestead:Sm,mainnet:Sm,morden:{chainId:2,name:"morden"},ropsten:Im,testnet:Im,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:xm("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:xm("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:xm("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},classic:{chainId:61,name:"classic",_defaultProvider:Nm("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Tm,classicTestnet:Tm,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Nm("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:xm("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:xm("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Cm(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return A(e)}function Pm(t){t=A(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}class Om{constructor(t){Nr(this,"alphabet",t),Nr(this,"base",t.length),Nr(this,"_alphabetMap",{}),Nr(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=A(t);if(0===e.length)return"";let r=[0];for(let t=0;t<e.length;++t){let i=e[t];for(let t=0;t<r.length;++t)i+=r[t]<<8,r[t]=i%this.base,i=i/this.base|0;for(;i>0;)r.push(i%this.base),i=i/this.base|0}let i="";for(let t=0;0===e[t]&&t<e.length-1;++t)i+=this._leader;for(let t=r.length-1;t>=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");let n=i;for(let t=0;t<e.length;++t)n+=e[t]*this.base,e[t]=255&n,n>>=8;for(;n>0;)e.push(255&n),n>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return A(new Uint8Array(e.reverse()))}}new Om("abcdefghijklmnopqrstuvwxyz234567");const Bm=new Om("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var $m=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,T=S>>>13,R=0|s[7],C=8191&R,P=R>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191&lt,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(T,j)|0,o=Math.imul(T,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(f,mt)|0))<<13)|0;u=((o=o+Math.imul(f,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Tt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Rt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(T,mt)|0))<<13)|0;u=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Tt,h[15]=Rt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(M,w),i(_,w),i(E,w),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Um=$m.BN;const Dm=new y("bignumber/5.6.2"),Lm={},Fm=9007199254740991;let jm=!1;class zm{constructor(t,e){t!==Lm&&Dm.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Hm(Vm(this).fromTwos(t))}toTwos(t){return Hm(Vm(this).toTwos(t))}abs(){return"-"===this._hex[0]?zm.from(this._hex.substring(1)):this}add(t){return Hm(Vm(this).add(Vm(t)))}sub(t){return Hm(Vm(this).sub(Vm(t)))}div(t){return zm.from(t).isZero()&&Zm("division-by-zero","div"),Hm(Vm(this).div(Vm(t)))}mul(t){return Hm(Vm(this).mul(Vm(t)))}mod(t){const e=Vm(t);return e.isNeg()&&Zm("division-by-zero","mod"),Hm(Vm(this).umod(e))}pow(t){const e=Vm(t);return e.isNeg()&&Zm("negative-power","pow"),Hm(Vm(this).pow(e))}and(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","and"),Hm(Vm(this).and(e))}or(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","or"),Hm(Vm(this).or(e))}xor(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","xor"),Hm(Vm(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Zm("negative-width","mask"),Hm(Vm(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Zm("negative-width","shl"),Hm(Vm(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Zm("negative-width","shr"),Hm(Vm(this).shrn(t))}eq(t){return Vm(this).eq(Vm(t))}lt(t){return Vm(this).lt(Vm(t))}lte(t){return Vm(this).lte(Vm(t))}gt(t){return Vm(this).gt(Vm(t))}gte(t){return Vm(this).gte(Vm(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Vm(this).isZero()}toNumber(){try{return Vm(this).toNumber()}catch(t){Zm("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Dm.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?jm||(jm=!0,Dm.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Dm.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Dm.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Vm(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof zm)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new zm(Lm,qm(t)):t.match(/^-?[0-9]+$/)?new zm(Lm,qm(new Um(t))):Dm.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Zm("underflow","BigNumber.from",t),(t>=Fm||t<=-Fm)&&Zm("overflow","BigNumber.from",t),zm.from(String(t));const e=t;if("bigint"==typeof e)return zm.from(e.toString());if(E(e))return zm.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return zm.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return zm.from(t)}return Dm.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function qm(t){if("string"!=typeof t)return qm(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Dm.throwArgumentError("invalid hex","value",t),"0x00"===(t=qm(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Hm(t){return zm.from(qm(t))}function Vm(t){const e=zm.from(t).toHexString();return"-"===e[0]?new Um("-"+e.substring(3),16):new Um(e.substring(2),16)}function Zm(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Dm.throwError(t,y.errors.NUMERIC_FAULT,i)}function Gm(t){return we(qi(t))}const Km="hash/5.6.1",Jm=new y(Km),Qm=new Uint8Array(32);Qm.fill(0);const Wm=new RegExp("^((.*)\\.)?([^.]+)$");function Ym(t){"string"!=typeof t&&Jm.throwArgumentError("invalid ENS name; not a string","name",t);let e=t,r=Qm;for(;e.length;){const i=e.match(Wm);null!=i&&""!==i[2]||Jm.throwArgumentError("invalid ENS address; missing component","name",t);r=we(k([r,we(qi(nn(i[3])))])),e=i[2]||""}return I(r)}var Xm=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const tp=new y(Km),ep=new Uint8Array(32);ep.fill(0);const rp=zm.from(-1),ip=zm.from(0),np=zm.from(1),op=zm.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const sp=O(np.toHexString(),32),ap=O(ip.toHexString(),32),hp={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},up=["name","version","chainId","verifyingContract","salt"];function lp(t){return function(e){return"string"!=typeof e&&tp.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const cp={name:lp("name"),version:lp("version"),chainId:function(t){try{return zm.from(t).toString()}catch(t){}return tp.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Ce(t).toLowerCase()}catch(t){}return tp.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=A(t);if(32!==e.length)throw new Error("bad length");return I(e)}catch(t){}return tp.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function fp(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&tp.throwArgumentError("invalid numeric width","type",t);const n=op.mask(r?i-1:i),o=r?n.add(np).mul(rp):ip;return function(e){const r=zm.from(e);return(r.lt(o)||r.gt(n))&&tp.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),O(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&tp.throwArgumentError("invalid bytes width","type",t),function(e){return A(e).length!==r&&tp.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=A(t),r=e.length%32;return r?C([e,ep.slice(r)]):I(e)}(e)}}}switch(t){case"address":return function(t){return O(Ce(t),32)};case"bool":return function(t){return t?sp:ap};case"bytes":return function(t){return we(t)};case"string":return function(t){return Gm(t)}}return null}function dp(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class mp{constructor(t){Nr(this,"types",Object.freeze(Or(t))),Nr(this,"_encoderCache",{}),Nr(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&tp.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&tp.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);fp(s)||(r[s]||tp.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(i),e[i][s]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?tp.throwArgumentError("missing primary type","types",t):n.length>1&&tp.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Nr(this,"primaryType",n[0]),function n(o,s){s[o]&&tp.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{i[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=dp(e,t[e])+r.map((e=>dp(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=fp(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&tp.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(we)),we(C(n))}}const r=this.types[t];if(r){const e=Gm(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?we(i):i}));return i.unshift(e),C(i)}}return tp.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||tp.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return we(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(fp(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&tp.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):tp.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new mp(t)}static getPrimaryType(t){return mp.from(t).primaryType}static hashStruct(t,e,r){return mp.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=hp[r];i||tp.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>up.indexOf(t.name)-up.indexOf(e.name))),mp.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return C(["0x1901",mp.hashDomain(t),mp.from(e).hash(r)])}static hash(t,e,r){return we(mp.encode(t,e,r))}static resolveNames(t,e,r,i){return Xm(this,void 0,void 0,(function*(){t=Tr(t);const n={};t.verifyingContract&&!N(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=mp.from(e);o.visit(r,((t,e)=>("address"!==t||N(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){mp.hashDomain(t);const i={},n=[];up.forEach((e=>{const r=t[e];null!=r&&(i[e]=cp[e](r),n.push({name:e,type:hp[e]}))}));const o=mp.from(e),s=Tr(e);return s.EIP712Domain?tp.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return I(A(e));if(t.match(/^u?int/))return zm.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&tp.throwArgumentError("invalid string","value",e),e}return tp.throwArgumentError("unsupported type","type",t)}))}}}new y("sha2/5.6.1");function pp(t){return"0x"+Ks.sha256().update(A(t)).digest("hex")}var gp=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};function yp(t,e){return gp(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client");const i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach(((t,e)=>{o[e.toLowerCase()]=t})):i.headers.keys().forEach((t=>{o[t.toLowerCase()]=i.headers.get(t)})),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:A(new Uint8Array(n))}}))}var vp=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const wp=new y("web/5.6.1");function bp(t){return new Promise((e=>{setTimeout(e,t)}))}function Mp(t,e){if(null==t)return null;if("string"==typeof t)return t;if(M(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Vi(t)}catch(t){}return I(t)}return t}function _p(t,e,r){let i=null;if(null!=e){i=qi(e);const r="string"==typeof t?{url:t}:Tr(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=Tr(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return function(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;wp.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const n="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;wp.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s="object"==typeof t&&!!t.errorPassThrough,a={};let h=null;const u={method:"GET"};let l=!1,c=12e4;if("string"==typeof t)h=t;else if("object"==typeof t){if(null!=t&&null!=t.url||wp.throwArgumentError("missing URL","connection.url",t),h=t.url,"number"==typeof t.timeout&&t.timeout>0&&(c=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==h.substring(0,6)&&!0!==t.allowInsecureAuthentication&&wp.throwError("basic authentication requires a secure https url",y.errors.INVALID_ARGUMENT,{argument:"url",url:h,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+Pm(qi(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup)}const f=new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$","i"),d=h?h.match(f):null;if(d)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]},body:Cm(d[2])};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){wp.throwError("processing response error",y.errors.SERVER_ERROR,{body:Mp(d[1],d[2]),error:t,requestBody:null,requestMethod:"GET",url:h})}e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const m={};Object.keys(a).forEach((t=>{const e=a[t];m[e.key]=e.value})),u.headers=m;const p=function(){let t=null;return{promise:new Promise((function(e,r){c&&(t=setTimeout((()=>{null!=t&&(t=null,r(wp.makeError("timeout",y.errors.TIMEOUT,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,timeout:c,url:h})))}),c))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return vp(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield yp(h,u),t<i)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){h=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(n&&(r=yield n(t,h)),r){let r=0;const i=e.headers["retry-after"];r="string"==typeof i&&i.match(/^[1-9][0-9]*$/)?1e3*parseInt(i):o*parseInt(String(Math.random()*Math.pow(2,t))),yield bp(r);continue}}}catch(t){e=t.response,null==e&&(p.cancel(),wp.throwError("missing response",y.errors.SERVER_ERROR,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,serverError:t,url:h}))}let a=e.body;if(l&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(p.cancel(),wp.throwError("bad response",y.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:Mp(a,e.headers?e.headers["content-type"]:null),requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})),r)try{const t=yield r(a,e);return p.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(n&&(e=yield n(t,h)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield bp(e);continue}}p.cancel(),wp.throwError("processing response error",y.errors.SERVER_ERROR,{body:Mp(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})}return p.cancel(),a}return wp.throwError("failed response",y.errors.SERVER_ERROR,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})}))}();return Promise.race([p.promise,g])}(t,i,((t,e)=>{let i=null;if(null!=t)try{i=JSON.parse(Vi(t))}catch(e){wp.throwError("invalid JSON",y.errors.SERVER_ERROR,{body:t,error:e})}return r&&(i=r(i,e)),i}))}function Ep(t,e){return e||(e={}),null==(e=Tr(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,i){let n=null,o=!1;const s=()=>!o&&(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout((()=>{s()&&i(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let h=0;!function n(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",n);else if(e.onceBlock)e.onceBlock.once("block",n);else if(!o){if(h++,h>a)return void(s()&&i(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,h)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(n,t)}return null}),(function(t){s()&&i(t)}))}()}))}for(var Ap="qpzry9x8gf2tvdw0s3jn54khce6mua7l",kp={},xp=0;xp<Ap.length;xp++){var Np=Ap.charAt(xp);if(void 0!==kp[Np])throw new TypeError(Np+" is ambiguous");kp[Np]=xp}function Sp(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function Ip(t){for(var e=1,r=0;r<t.length;++r){var i=t.charCodeAt(r);if(i<33||i>126)return"Invalid prefix ("+t+")";e=Sp(e)^i>>5}for(e=Sp(e),r=0;r<t.length;++r){var n=t.charCodeAt(r);e=Sp(e)^31&n}return e}function Tp(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),s=t.slice(n+1);if(s.length<6)return"Data too short";var a=Ip(o);if("string"==typeof a)return a;for(var h=[],u=0;u<s.length;++u){var l=s.charAt(u),c=kp[l];if(void 0===c)return"Unknown character "+l;a=Sp(a)^c,u+6>=s.length||h.push(c)}return 1!==a?"Invalid checksum for "+t:{prefix:o,words:h}}function Rp(t,e,r,i){for(var n=0,o=0,s=(1<<r)-1,a=[],h=0;h<t.length;++h)for(n=n<<e|t[h],o+=e;o>=r;)o-=r,a.push(n>>o&s);if(i)o>0&&a.push(n<<r-o&s);else{if(o>=e)return"Excess padding";if(n<<r-o&s)return"Non-zero padding"}return a}var Cp={decodeUnsafe:function(){var t=Tp.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=Tp.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,r){if(r=r||90,t.length+7+e.length>r)throw new TypeError("Exceeds length limit");var i=Ip(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o<e.length;++o){var s=e[o];if(s>>5!=0)throw new Error("Non 5-bit word");i=Sp(i)^s,n+=Ap.charAt(s)}for(o=0;o<6;++o)i=Sp(i);for(i^=1,o=0;o<6;++o){n+=Ap.charAt(i>>5*(5-o)&31)}return n},toWordsUnsafe:function(t){var e=Rp(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=Rp(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=Rp(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=Rp(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const Pp="providers/5.6.8",Op=new y(Pp);class Bp{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),n=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),h=this.type.bind(this);return t.transaction={hash:o,type:h,accessList:Bp.allowNull(this.accessList.bind(this),null),blockHash:Bp.allowNull(o,null),blockNumber:Bp.allowNull(a,null),transactionIndex:Bp.allowNull(a,null),confirmations:Bp.allowNull(a,null),from:e,gasPrice:Bp.allowNull(r),maxPriorityFeePerGas:Bp.allowNull(r),maxFeePerGas:Bp.allowNull(r),gasLimit:r,to:Bp.allowNull(e,null),value:r,nonce:a,data:n,r:Bp.allowNull(this.uint256),s:Bp.allowNull(this.uint256),v:Bp.allowNull(a),creates:Bp.allowNull(e,null),raw:Bp.allowNull(n)},t.transactionRequest={from:Bp.allowNull(e),nonce:Bp.allowNull(a),gasLimit:Bp.allowNull(r),gasPrice:Bp.allowNull(r),maxPriorityFeePerGas:Bp.allowNull(r),maxFeePerGas:Bp.allowNull(r),to:Bp.allowNull(e),value:Bp.allowNull(r),data:Bp.allowNull((t=>this.data(t,!0))),type:Bp.allowNull(a),accessList:Bp.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Bp.arrayOf(o),data:n,logIndex:a,blockHash:o},t.receipt={to:Bp.allowNull(this.address,null),from:Bp.allowNull(this.address,null),contractAddress:Bp.allowNull(e,null),transactionIndex:a,root:Bp.allowNull(s),gasUsed:r,logsBloom:Bp.allowNull(n),blockHash:o,transactionHash:o,logs:Bp.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Bp.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Bp.allowNull(r),status:Bp.allowNull(a),type:h},t.block={hash:Bp.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:Bp.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Bp.allowNull(e),extraData:n,transactions:Bp.allowNull(Bp.arrayOf(o)),baseFeePerGas:Bp.allowNull(r)},t.blockWithTransactions=Tr(t.block),t.blockWithTransactions.transactions=Bp.allowNull(Bp.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Bp.allowNull(i,void 0),toBlock:Bp.allowNull(i,void 0),blockHash:Bp.allowNull(o,void 0),address:Bp.allowNull(e,void 0),topics:Bp.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Bp.allowNull(a),blockHash:Bp.allowNull(o),transactionIndex:a,removed:Bp.allowNull(this.boolean.bind(this)),address:e,data:Bp.allowFalsish(n,"0x"),topics:Bp.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return qa(t||[])}number(t){return"0x"===t?0:zm.from(t).toNumber()}type(t){return"0x"===t||null==t?0:zm.from(t).toNumber()}bigNumber(t){return zm.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),N(t))?t.toLowerCase():Op.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return Ce(t)}callAddress(t){if(!N(t,32))return null;const e=Ce(R(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return Oe(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||N(t))return P(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==T(r)?Op.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=zm.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!N(t))throw new Error("invalid uint256");return O(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,i=Bp.check(e,t);return i._difficulty=null==r?null:zm.from(r),i}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Bp.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&zm.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=Bp.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;N(r)&&(r=zm.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),N(r)&&(r=zm.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return Ka(t)}receiptLog(t){return Bp.check(this.formats.receiptLog,t)}receipt(t){const e=Bp.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=zm.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Op.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Op.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Op.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return Bp.check(this.formats.filter,t)}filterLog(t){return Bp.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const i in t)try{const n=t[i](e[i]);void 0!==n&&(r[i]=n)}catch(t){throw t.checkKey=i,t.checkValue=e[i],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}var $p=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Up=new y(Pp);function Dp(t){return null==t?"null":(32!==T(t)&&Up.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Lp(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[Dp(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return Dp(t)})).join("&")}function Fp(t){if("string"==typeof t){if(32===T(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+Lp(t);if(On.isForkEvent(t))throw Up.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+Lp(t.topics||[])}throw new Error("invalid event - "+t)}function jp(){return(new Date).getTime()}function zp(t){return new Promise((e=>{setTimeout(e,t)}))}const qp=["block","network","pending","poll"];class Hp{constructor(t,e,r){Nr(this,"tag",t),Nr(this,"listener",e),Nr(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(i=t[2])?[]:i.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var i;const n={};return r.length>0&&(n.topics=r),e&&"*"!==e&&(n.address=e),n}pollable(){return this.tag.indexOf(":")>=0||qp.indexOf(this.tag)>=0}}const Vp={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Zp(t){return O(zm.from(t).toHexString(),32)}function Gp(t){return Bm.encode(k([t,R(pp(pp(t)),0,4)]))}const Kp=new RegExp("^(ipfs)://(.*)$","i"),Jp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Kp,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Qp(t,e){try{return Vi(Wp(t,e))}catch(t){}return null}function Wp(t,e){if("0x"===t)return null;const r=zm.from(R(t,e,e+32)).toNumber(),i=zm.from(R(t,r,r+32)).toNumber();return R(t,r+32,r+32+i)}function Yp(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Up.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Xp(t){const e=A(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function tg(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function eg(t){const e=[];let r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){const n=A(t[i]);e[i]=Xp(r),e.push(Xp(n.length)),e.push(tg(n)),r+=32+32*Math.ceil(n.length/32)}return C(e)}class rg{constructor(t,e,r,i){Nr(this,"provider",t),Nr(this,"name",r),Nr(this,"address",t.formatter.address(e)),Nr(this,"_resolvedAddress",i)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((t=>zm.from(t).eq(1))).catch((t=>{if(t.code===y.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return $p(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:C([t,Ym(this.name),e||"0x"])};let i=!1;var n;(yield this.supportsWildcard())&&(i=!0,r.data=C(["0x9061b923",eg([(n=this.name,I(k(n.split(".").map((t=>{const e=qi("_"+nn(t));return e[0]=e.length-1,e}))))+"00"),r.data])]));try{let t=yield this.provider.call(r);return A(t).length%32==4&&Up.throwError("resolver threw error",y.errors.CALL_EXCEPTION,{transaction:r,data:t}),i&&(t=Wp(t,0)),t}catch(t){if(t.code===y.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return $p(this,void 0,void 0,(function*(){const r=yield this._fetch(t,e);return null!=r?Wp(r,0):null}))}_getAddress(t,e){const r=Vp[String(t)];if(null==r&&Up.throwError(`unsupported coin type: ${t}`,y.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const i=A(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Gp(k([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Gp(k([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=i[1];let e=i[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&i.length===2+t&&t>=1&&t<=75){const t=Cp.toWords(i.slice(2));return t.unshift(e),Cp.encode(r.prefix,t)}}return null}getAddress(t){return $p(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===y.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",Zp(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&Up.throwError("invalid or unsupported coin data",y.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return $p(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r<Jp.length;r++){const i=e.match(Jp[r]);if(null==i)continue;const n=i[1].toLowerCase();switch(n){case"https":return t.push({type:"url",content:e}),{linkage:t,url:e};case"data":return t.push({type:"data",content:e}),{linkage:t,url:e};case"ipfs":return t.push({type:"ipfs",content:e}),{linkage:t,url:Yp(e)};case"erc721":case"erc1155":{const r="erc721"===n?"0xc87b56dd":"0x0e89341c";t.push({type:n,content:e});const o=this._resolvedAddress||(yield this.getAddress()),s=(i[2]||"").split("/");if(2!==s.length)return null;const a=yield this.provider.formatter.address(s[0]),h=O(zm.from(s[1]).toHexString(),32);if("erc721"===n){const e=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:C(["0x6352211e",h])}));if(o!==e)return null;t.push({type:"owner",content:e})}else if("erc1155"===n){const e=zm.from(yield this.provider.call({to:a,data:C(["0x00fdd58e",O(o,32),h])}));if(e.isZero())return null;t.push({type:"balance",content:e.toString()})}const u={to:this.provider.formatter.address(s[0]),data:C([r,h])};let l=Qp(yield this.provider.call(u),0);if(null==l)return null;t.push({type:"metadata-url-base",content:l}),"erc1155"===n&&(l=l.replace("{id}",h.substring(2)),t.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=Yp(l)),t.push({type:"metadata-url",content:l});const c=yield _p(l);if(!c)return null;t.push({type:"metadata",content:JSON.stringify(c)});let f=c.image;if("string"!=typeof f)return null;if(f.match(/^(https:\/\/|data:)/i));else{if(null==f.match(Kp))return null;t.push({type:"url-ipfs",content:f}),f=Yp(f)}return t.push({type:"url",content:f}),{linkage:t,url:f}}}}}catch(t){}return null}))}getContentHash(){return $p(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+Bm.encode("0x"+e[1])}const r=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const t=parseInt(r[3],16);if(r[4].length===2*t)return"ipns://"+Bm.encode("0x"+r[1])}const i=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(i&&64===i[1].length)return"bzz://"+i[1];const n=t.match(/^0x90b2c605([0-9a-f]*)$/);if(n&&68===n[1].length){const t={"=":"","+":"-","/":"_"};return"sia://"+Pm("0x"+n[1]).replace(/[=+\/]/g,(e=>t[e]))}return Up.throwError("invalid or unsupported content hash data",y.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return $p(this,void 0,void 0,(function*(){let e=qi(t);e=k([Zp(64),Zp(e.length),e]),e.length%32!=0&&(e=k([e,O("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",I(e));return null==r||"0x"===r?null:Vi(r)}))}}let ig=null,ng=1;class og extends Bn{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Nr(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=Sr(new.target,"getNetwork")(t);e?(Nr(this,"_network",e),this.emit("network",e,null)):Up.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return $p(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||Up.throwError("no network detected",y.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Nr(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return Ep((()=>this._ready().then((t=>t),(t=>{if(t.code!==y.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==ig&&(ig=new Bp),ig}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in Rm){const r=Rm[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=Rm[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=Rm[t.name];if(!e)return"number"!=typeof t.chainId&&km.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&km.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}(null==t?"homestead":t)}ccipReadFetch(t,e,r){return $p(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const i=t.to.toLowerCase(),n=e.toLowerCase(),o=[];for(let t=0;t<r.length;t++){const e=r[t],s=e.replace("{sender}",i).replace("{data}",n),a=e.indexOf("{data}")>=0?null:JSON.stringify({data:n,sender:i}),h=yield _p({url:s,errorPassThrough:!0},a,((t,e)=>(t.status=e.statusCode,t)));if(h.data)return h.data;const u=h.message||"unknown error";if(h.status>=400&&h.status<500)return Up.throwError(`response not found during CCIP fetch: ${u}`,y.errors.SERVER_ERROR,{url:e,errorMessage:u});o.push(u)}return Up.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,y.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(t){return $p(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(jp()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=jp(),r=Ir({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:i})=>{if(i)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),i;const n=jp();return(t=zm.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:n}}));return this._internalBlockNumber=r,r.catch((t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return $p(this,void 0,void 0,(function*(){const t=ng++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Up.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Up.makeError("network block skew detected",y.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let i=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(i);break}case"filter":if(!t._inflight){t._inflight=!0;const i=t.filter;i.fromBlock=t._lastBlockNumber+1,i.toBlock=r,i.toBlock-this._maxFilterBlockRange>i.fromBlock&&(i.fromBlock=i.toBlock-this._maxFilterBlockRange);const n=this.getLogs(i).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(i,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(n)}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return $p(this,void 0,void 0,(function*(){return Up.throwError("provider does not support network detection",y.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return $p(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield zp(0),this._network;const r=Up.makeError("underlying network changed",y.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=jp();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=jp(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return $p(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,i){return $p(this,void 0,void 0,(function*(){const n=yield this.getTransactionReceipt(t);return(n?n.confirmations:0)>=e?n:new Promise(((n,o)=>{const s=[];let a=!1;const h=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},u=t=>{t.confirmations<e||h()||n(t)};if(this.on(t,u),s.push((()=>{this.removeListener(t,u)})),i){let r=i.startBlock,n=null;const u=s=>$p(this,void 0,void 0,(function*(){a||(yield zp(1e3),this.getTransactionCount(i.from).then((l=>$p(this,void 0,void 0,(function*(){if(!a){if(l<=i.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==n&&(n=r-3,n<i.startBlock&&(n=i.startBlock));n<=s;){if(a)return;const r=yield this.getBlockWithTransactions(n);for(let n=0;n<r.transactions.length;n++){const s=r.transactions[n];if(s.hash===t)return;if(s.from===i.from&&s.nonce===i.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,e);if(h())return;let n="replaced";return s.data===i.data&&s.to===i.to&&s.value.eq(i.value)?n="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(n="cancelled"),void o(Up.makeError("transaction was replaced",y.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===n||"cancelled"===n,reason:n,replacement:this._wrapTransaction(s),hash:t,receipt:r}))}}n++}}a||this.once("block",u)}}))),(t=>{a||this.once("block",u)})))}));if(a)return;this.once("block",u),s.push((()=>{this.removeListener("block",u)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{h()||o(Up.makeError("timeout exceeded",y.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return $p(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return zm.from(t)}catch(e){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getBalance",r);try{return zm.from(i)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:t})}}))}getTransactionCount(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getTransactionCount",r);try{return zm.from(i).toNumber()}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:t})}}))}getCode(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getCode",r);try{return I(i)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:t})}}))}getStorageAt(t,e,r){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const i=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>P(t)))}),n=yield this.perform("getStorageAt",i);try{return I(n)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:n,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==T(e))throw new Error("invalid response - sendTransaction");const i=t;return null!=e&&t.hash!==e&&Up.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),i.wait=(e,i)=>$p(this,void 0,void 0,(function*(){let n;null==e&&(e=1),null==i&&(i=0),0!==e&&null!=r&&(n={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,i,n);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&Up.throwError("transaction failed",y.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),i}sendTransaction(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>I(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,i)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return $p(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?zm.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?I(t):null)))})),this.formatter.transactionRequest(yield Ir(r))}))}_getFilter(t){return $p(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield Ir(e))}))}_call(t,e,r){return $p(this,void 0,void 0,(function*(){r>=10&&Up.throwError("CCIP read exceeded maximum redirections",y.errors.SERVER_ERROR,{redirects:r,transaction:t});const i=t.to,n=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=i&&"0x556f1830"===n.substring(0,10)&&T(n)%32==4)try{const o=R(n,4),s=R(o,0,32);zm.from(s).eq(i)||Up.throwError("CCIP Read sender did not match",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const a=[],h=zm.from(R(o,32,64)).toNumber(),u=zm.from(R(o,h,h+32)).toNumber(),l=R(o,h+32);for(let e=0;e<u;e++){const r=Qp(l,32*e);null==r&&Up.throwError("CCIP Read contained corrupt URL string",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n}),a.push(r)}const c=Wp(o,64);zm.from(R(o,100,128)).isZero()||Up.throwError("CCIP Read callback selector included junk",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const f=R(o,96,100),d=Wp(o,128),m=yield this.ccipReadFetch(t,c,a);null==m&&Up.throwError("CCIP Read disabled or provided no URLs",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const p={to:i,data:C([f,eg([m,d])])};return this._call(p,e,r+1)}catch(t){if(t.code===y.errors.SERVER_ERROR)throw t}try{return I(n)}catch(r){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:e},result:n,error:r})}}))}call(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)}))}estimateGas(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ir({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return zm.from(r)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return $p(this,void 0,void 0,(function*(){"string"!=typeof(t=yield t)&&Up.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&Up.throwError("ENS name not configured",y.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const i={includeTransactions:!!e};if(N(t,32))i.blockHash=t;else try{i.blockTag=yield this._getBlockTag(t),N(i.blockTag)&&(r=parseInt(i.blockTag.substring(2),16))}catch(e){Up.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return Ep((()=>$p(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",i);if(null==t)return null!=i.blockHash&&null==this._emitted["b:"+i.blockHash]||null!=i.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){const i=t.transactions[r];if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}}const r=this.formatter.blockWithTransactions(t);return r.transactions=r.transactions.map((t=>this._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Ep((()=>$p(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const i=this.formatter.transactionResponse(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return this._wrapTransaction(i)}))),{oncePoll:this})}))}getTransactionReceipt(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Ep((()=>$p(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const i=this.formatter.receipt(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return i}))),{oncePoll:this})}))}getLogs(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ir({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),Bp.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return $p(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return $p(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&Up.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return $p(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const r=yield this._getResolver(e,"getResolver");if(null!=r){const i=new rg(this,r,t);return e===t||(yield i.supportsWildcard())?i:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return $p(this,void 0,void 0,(function*(){null==e&&(e="ENS");const r=yield this.getNetwork();r.ensAddress||Up.throwError("network does not support ENS",y.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{const e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Ym(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return $p(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(N(t))throw e}"string"!=typeof t&&Up.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return $p(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;const i=Qp(yield this.call({to:r,data:"0x691f3431"+Ym(e).substring(2)}),0);return(yield this.resolveName(i))!=t?null:i}))}getAvatar(t){return $p(this,void 0,void 0,(function*(){let e=null;if(N(t)){const r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"getAvatar");if(!i)return null;e=new rg(this,i,r);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==y.errors.CALL_EXCEPTION)throw t}try{const t=Qp(yield this.call({to:i,data:"0x691f3431"+Ym(r).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==y.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return Up.throwError(t+" not implemented",y.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const i=new Hp(Fp(t),e,r);return this._events.push(i),this._startEvent(i),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,i=[],n=Fp(t);return this._events=this._events.filter((t=>t.tag!==n||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(i.push(t),!1)))),i.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=Fp(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=Fp(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let i=!1,n=Fp(t);return this._events=this._events.filter((t=>t.tag!==n||t.listener!=e||(!!i||(i=!0,r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=Fp(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var sg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const ag=new y(Pp),hg=["call","estimateGas"];function ug(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const r=N(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if("object"==typeof t){for(const r in t){const i=ug(t[r],e);if(i)return i}return null}if("string"==typeof t)try{return ug(JSON.parse(t),e)}catch(t){}return null}function lg(t,e,r){const i=r.transaction||r.signedTransaction;if("call"===t){const t=ug(e,!0);if(t)return t.data;ag.throwError("missing revert data in call exception; Transaction reverted without a reason string",y.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if("estimateGas"===t){let r=ug(e.body,!1);null==r&&(r=ug(e,!1)),r&&ag.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===y.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit/i)&&ag.throwError("insufficient funds for intrinsic transaction cost",y.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&ag.throwError("nonce has already been used",y.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&ag.throwError("replacement fee too low",y.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&ag.throwError("legacy pre-eip-155 transactions not supported",y.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),hg.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&ag.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function cg(t){return new Promise((function(e){setTimeout(e,t)}))}function fg(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function dg(t){return t?t.toLowerCase():t}const mg={};class pg extends Fn{constructor(t,e,r){if(super(),t!==mg)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Nr(this,"provider",e),null==r&&(r=0),"string"==typeof r?(Nr(this,"_address",this.provider.formatter.address(r)),Nr(this,"_index",null)):"number"==typeof r?(Nr(this,"_index",r),Nr(this,"_address",null)):ag.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return ag.throwError("cannot alter JSON-RPC Signer connection",y.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new gg(mg,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&ag.throwError("unknown account #"+this._index,y.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=Tr(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=Tr(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>sg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&ag.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),Ir({tx:Ir(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&ag.throwArgumentError("from address mismatch","transaction",t):e.from=r;const i=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[i]).then((t=>t),(t=>lg("sendTransaction",t,i)))}))}signTransaction(t){return ag.throwError("signing transactions is unsupported",y.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return sg(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield Ep((()=>sg(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return sg(this,void 0,void 0,(function*(){const e="string"==typeof t?qi(t):t,r=yield this.getAddress();return yield this.provider.send("personal_sign",[I(e),r.toLowerCase()])}))}_legacySignMessage(t){return sg(this,void 0,void 0,(function*(){const e="string"==typeof t?qi(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),I(e)])}))}_signTypedData(t,e,r){return sg(this,void 0,void 0,(function*(){const i=yield mp.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),n=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[n.toLowerCase(),JSON.stringify(mp.getPayload(i.domain,e,i.value))])}))}unlock(t){return sg(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class gg extends pg{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const yg={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vg extends og{constructor(t,e){let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=Sr(this.constructor,"defaultUrl")()),Nr(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(Tr(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return sg(this,void 0,void 0,(function*(){yield cg(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Sr(this.constructor,"getNetwork");try{return e(zm.from(t).toNumber())}catch(e){return ag.throwError("could not detect network",y.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return ag.throwError("could not detect network",y.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new pg(mg,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Or(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];const n=_p(this.connection,JSON.stringify(r),fg).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return i&&(this._cache[t]=n,setTimeout((()=>{this._cache[t]=null}),0)),n}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[dg(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[dg(e.address),e.blockTag]];case"getCode":return["eth_getCode",[dg(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[dg(e.address),O(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Sr(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Sr(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=dg(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return sg(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&zm.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=Tr(e)).transaction=Tr(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&ag.throwError(t+" not implemented",y.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return lg(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function i(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let i=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",i=i.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),i.then((function(){return cg(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){i()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=Tr(yg);if(e)for(const t in e)e[t]&&(r[t]=!0);!function(t,e){t&&"object"==typeof t||xr.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||xr.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}(t,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=P(zm.from(t[e]));"gasLimit"===e&&(e="gas"),i[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=I(t[e]))})),t.accessList&&(i.accessList=qa(t.accessList)),i}}var wg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const bg=new y(Pp);class Mg extends vg{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return wg(this,void 0,void 0,(function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||bg.throwError("no network detected",y.errors.UNKNOWN_ERROR,{}),null==this._network&&(Nr(this,"_network",e),this.emit("network",e,null))),e}))}}const _g={};function Eg(t,{broviderUrl:e="https://rpc.snapshot.org"}={}){const r=`${e}/${t}`;return _g[t]||(_g[t]=new Mg({url:r,timeout:25e3,allowGzip:!0},Number(t))),_g[t]}
21
+ deps: ${r}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(t){const[e,r]=function({schema:t}){const e={},r={};for(const i in t){if("__proto__"===i)continue;(Array.isArray(t[i])?e:r)[i]=t[i]}return[e,r]}(t);i(t,e),n(t,r)}};function i(t,e=t.schema){const{gen:r,data:i,it:n}=t;if(0===Object.keys(e).length)return;const o=r.let("missing");for(const s in e){const a=e[s];if(0===a.length)continue;const h=(0,ac.propertyInData)(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(h,(()=>{for(const e of a)(0,ac.checkReportMissingProp)(t,e)})):(r.if(Wl._`${h} && (${(0,ac.checkMissingProp)(t,a,o)})`),(0,ac.reportMissingProp)(t,o),r.else())}}function n(t,e=t.schema){const{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(const a in e)(0,Yl.alwaysValidSchema)(o,e[a])||(r.if((0,ac.propertyInData)(r,i,a,o.opts.ownProperties),(()=>{const e=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(e,s)}),(()=>r.var(s,!0))),t.ok(s))}e.validatePropertyDeps=i,e.validateSchemaDeps=n,e.default=r}));const Rf={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>Wl._`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:i,it:n}=t;if((0,Yl.alwaysValidSchema)(n,r))return;const o=e.name("valid");e.forIn("key",i,(r=>{t.setParams({propertyName:r}),t.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),e.if((0,Wl.not)(o),(()=>{t.error(!0),n.allErrors||e.break()}))})),t.ok(o)}};var Cf=Rf,Pf=Object.defineProperty({default:Cf},"__esModule",{value:!0});const Of={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>Wl._`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:h}=s;if(s.props=!0,"all"!==h.removeAdditional&&(0,Yl.alwaysValidSchema)(s,r))return;const u=(0,ac.allSchemaProperties)(i.properties),l=(0,ac.allSchemaProperties)(i.patternProperties);function c(t){e.code(Wl._`delete ${n}[${t}]`)}function f(i){if("all"===h.removeAdditional||h.removeAdditional&&!1===r)c(i);else{if(!1===r)return t.setParams({additionalProperty:i}),t.error(),void(a||e.break());if("object"==typeof r&&!(0,Yl.alwaysValidSchema)(s,r)){const r=e.name("valid");"failing"===h.removeAdditional?(d(i,r,!1),e.if((0,Wl.not)(r),(()=>{t.reset(),c(i)}))):(d(i,r),a||e.if((0,Wl.not)(r),(()=>e.break())))}}}function d(e,r,i){const n={keyword:"additionalProperties",dataProp:e,dataPropType:Yl.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,r)}e.forIn("key",n,(r=>{u.length||l.length?e.if(function(r){let n;if(u.length>8){const t=(0,Yl.schemaRefOrVal)(s,i.properties,"properties");n=(0,ac.isOwnProperty)(e,t,r)}else n=u.length?(0,Wl.or)(...u.map((t=>Wl._`${r} === ${t}`))):Wl.nil;return l.length&&(n=(0,Wl.or)(n,...l.map((e=>Wl._`${(0,ac.usePattern)(t,e)}.test(${r})`)))),(0,Wl.not)(n)}(r),(()=>f(r))):f(r)})),t.ok(Wl._`${o} === ${tc.default.errors}`)}};var Bf=Of,$f=Object.defineProperty({default:Bf},"__esModule",{value:!0});const Uf={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;"all"===o.opts.removeAdditional&&void 0===i.additionalProperties&&$f.default.code(new dc.KeywordCxt(o,$f.default,"additionalProperties"));const s=(0,ac.allSchemaProperties)(r);for(const t of s)o.definedProperties.add(t);o.opts.unevaluated&&s.length&&!0!==o.props&&(o.props=Yl.mergeEvaluated.props(e,(0,Yl.toHash)(s),o.props));const a=s.filter((t=>!(0,Yl.alwaysValidSchema)(o,r[t])));if(0===a.length)return;const h=e.name("valid");for(const r of a)u(r)?l(r):(e.if((0,ac.propertyInData)(e,n,r,o.opts.ownProperties)),l(r),o.allErrors||e.else().var(h,!0),e.endIf()),t.it.definedProperties.add(r),t.ok(h);function u(t){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[t].default}function l(e){t.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}};var Df=Uf,Lf=Object.defineProperty({default:Df},"__esModule",{value:!0});const Ff=Yl,jf={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=(0,ac.allSchemaProperties)(r),h=a.filter((t=>(0,Yl.alwaysValidSchema)(o,r[t])));if(0===a.length||h.length===a.length&&(!o.opts.unevaluated||!0===o.props))return;const u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");!0===o.props||o.props instanceof Wl.Name||(o.props=(0,Ff.evaluatedPropsToName)(e,o.props));const{props:c}=o;function f(t){for(const e in u)new RegExp(t).test(e)&&(0,Yl.checkStrictMode)(o,`property ${e} matches pattern ${t} (use allowMatchingProperties)`)}function d(r){e.forIn("key",i,(i=>{e.if(Wl._`${(0,ac.usePattern)(t,r)}.test(${i})`,(()=>{const n=h.includes(r);n||t.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:Ff.Type.Str},l),o.opts.unevaluated&&!0!==c?e.assign(Wl._`${c}[${i}]`,!0):n||o.allErrors||e.if((0,Wl.not)(l),(()=>e.break()))}))}))}!function(){for(const t of a)u&&f(t),o.allErrors?d(t):(e.var(l,!0),d(t),e.if(l))}()}};var zf=jf,qf=Object.defineProperty({default:zf},"__esModule",{value:!0});const Hf={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:i}=t;if((0,Yl.alwaysValidSchema)(i,r))return void t.fail();const n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};var Vf=Hf,Zf=Object.defineProperty({default:Vf},"__esModule",{value:!0});var Gf={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ac.validateUnion,error:{message:"must match a schema in anyOf"}},Kf=Object.defineProperty({default:Gf},"__esModule",{value:!0});const Jf={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>Wl._`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;const o=r,s=e.let("valid",!1),a=e.let("passing",null),h=e.name("_valid");t.setParams({passing:a}),e.block((function(){o.forEach(((r,i)=>{let o;(0,Yl.alwaysValidSchema)(n,r)?e.var(h,!0):o=t.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&e.if(Wl._`${h} && ${s}`).assign(s,!1).assign(a,Wl._`[${a}, ${i}]`).else(),e.if(h,(()=>{e.assign(s,!0),e.assign(a,i),o&&t.mergeEvaluated(o,Wl.Name)}))}))})),t.result(s,(()=>t.reset()),(()=>t.error(!0)))}};var Qf=Jf,Wf=Object.defineProperty({default:Qf},"__esModule",{value:!0});const Yf={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=e.name("valid");r.forEach(((e,r)=>{if((0,Yl.alwaysValidSchema)(i,e))return;const o=t.subschema({keyword:"allOf",schemaProp:r},n);t.ok(n),t.mergeEvaluated(o)}))}};var Xf=Yf,td=Object.defineProperty({default:Xf},"__esModule",{value:!0});const ed={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>Wl.str`must match "${t.ifClause}" schema`,params:({params:t})=>Wl._`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:i}=t;void 0===r.then&&void 0===r.else&&(0,Yl.checkStrictMode)(i,'"if" without "then" and "else" is ignored');const n=rd(i,"then"),o=rd(i,"else");if(!n&&!o)return;const s=e.let("valid",!0),a=e.name("_valid");if(function(){const e=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(e)}(),t.reset(),n&&o){const r=e.let("ifClause");t.setParams({ifClause:r}),e.if(a,h("then",r),h("else",r))}else n?e.if(a,h("then")):e.if((0,Wl.not)(a),h("else"));function h(r,i){return()=>{const n=t.subschema({keyword:r},a);e.assign(s,a),t.mergeValidEvaluated(n,s),i?e.assign(i,Wl._`${r}`):t.setParams({ifClause:r})}}t.pass(s,(()=>t.error(!0)))}};function rd(t,e){const r=t.schema[e];return void 0!==r&&!(0,Yl.alwaysValidSchema)(t,r)}var id=ed,nd=Object.defineProperty({default:id},"__esModule",{value:!0});const od={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){void 0===e.if&&(0,Yl.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};var sd=od,ad=Object.defineProperty({default:sd},"__esModule",{value:!0});var hd=function(t=!1){const e=[Zf.default,Kf.default,Wf.default,td.default,nd.default,ad.default,Pf.default,$f.default,Tf.default,Lf.default,qf.default];return t?e.push(Ef.default,xf.default):e.push(bf.default,Mf.default),e.push(If.default),e},ud=Object.defineProperty({default:hd},"__esModule",{value:!0});const ld={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>Wl.str`must match format "${t}"`,params:({schemaCode:t})=>Wl._`{format: ${t}}`},code(t,e){const{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:h,errSchemaPath:u,schemaEnv:l,self:c}=a;h.validateFormats&&(n?function(){const n=r.scopeValue("formats",{ref:c.formats,code:h.code.formats}),o=r.const("fDef",Wl._`${n}[${s}]`),a=r.let("fType"),u=r.let("format");r.if(Wl._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>r.assign(a,Wl._`${o}.type || "string"`).assign(u,Wl._`${o}.validate`)),(()=>r.assign(a,Wl._`"string"`).assign(u,o))),t.fail$data((0,Wl.or)(!1===h.strictSchema?Wl.nil:Wl._`${s} && !${u}`,function(){const t=l.$async?Wl._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:Wl._`${u}(${i})`,r=Wl._`(typeof ${u} == "function" ? ${t} : ${u}.test(${i}))`;return Wl._`${u} && ${u} !== true && ${a} === ${e} && !${r}`}()))}():function(){const n=c.formats[o];if(!n)return void function(){if(!1===h.strictSchema)return void c.logger.warn(t());throw new Error(t());function t(){return`unknown format "${o}" ignored in schema at path "${u}"`}}();if(!0===n)return;const[s,a,f]=function(t){const e=t instanceof RegExp?(0,Wl.regexpCode)(t):h.code.formats?Wl._`${h.code.formats}${(0,Wl.getProperty)(o)}`:void 0,i=r.scopeValue("formats",{key:o,ref:t,code:e});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,Wl._`${i}.validate`];return["string",t,i]}(n);s===e&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!l.$async)throw new Error("async format in sync schema");return Wl._`await ${f}(${i})`}return"function"==typeof a?Wl._`${f}(${i})`:Wl._`${f}.test(${i})`}())}())}};var cd=ld;var fd=[Object.defineProperty({default:cd},"__esModule",{value:!0}).default],dd=Object.defineProperty({default:fd},"__esModule",{value:!0}),md=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}));var pd=[Tc.default,wf.default,(0,ud.default)(),dd.default,md.metadataVocabulary,md.contentVocabulary],gd=Object.defineProperty({default:pd},"__esModule",{value:!0}),yd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}));const vd={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===yd.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>Wl._`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=i.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const h=e.let("valid",!1),u=e.const("tag",Wl._`${r}${(0,Wl.getProperty)(a)}`);function l(r){const i=e.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:r},i);return t.mergeEvaluated(n,Wl.Name),i}e.if(Wl._`typeof ${u} == "string"`,(()=>function(){const r=function(){var t;const e={},r=h(n);let i=!0;for(let e=0;e<s.length;e++){let n=s[e];(null==n?void 0:n.$ref)&&!(0,Yl.schemaHasRulesButRef)(n,o.self.RULES)&&(n=bc.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,null==n?void 0:n.$ref),n instanceof bc.SchemaEnv&&(n=n.schema));const l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t[a];if("object"!=typeof l)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);i=i&&(r||h(n)),u(l,e)}if(!i)throw new Error(`discriminator: "${a}" must be required`);return e;function h({required:t}){return Array.isArray(t)&&t.includes(a)}function u(t,e){if(t.const)l(t.const,e);else{if(!t.enum)throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`);for(const r of t.enum)l(r,e)}}function l(t,r){if("string"!=typeof t||t in e)throw new Error(`discriminator: "${a}" values must be unique strings`);e[t]=r}}();e.if(!1);for(const t in r)e.elseIf(Wl._`${u} === ${t}`),e.assign(h,l(r[t]));e.else(),t.error(!1,{discrError:yd.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}()),(()=>t.error(!1,{discrError:yd.DiscrError.Tag,tag:u,tagName:a}))),t.ok(h)}};var wd=vd,bd=Object.defineProperty({default:wd},"__esModule",{value:!0}),Md={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},_d=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const r=["/properties"],i="http://json-schema.org/draft-07/schema";class n extends kc.default{_addVocabularies(){super._addVocabularies(),gd.default.forEach((t=>this.addVocabulary(t))),this.opts.discriminator&&this.addKeyword(bd.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(Md,r):Md;this.addMetaSchema(t,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return dc.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return Wl._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return Wl.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return Wl.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return Wl.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return Wl.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return Wl.CodeGen}})})),Ed=i(_d),Ad=o((function(t,e){function r(t,e){return{validate:t,compare:e}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:r(o,s),time:r(h,u),"date-time":r((function(t){const e=t.split(l);return 2===e.length&&o(e[0])&&h(e[1],!0)}),c),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return f.test(t)&&d.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(g.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(t){return m.lastIndex=0,m.test(t)},int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:p},double:{type:"number",validate:p},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(t){const e=i.exec(t);if(!e)return!1;const r=+e[1],o=+e[2],s=+e[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:n[o])}function s(t,e){if(t&&e)return t>e?1:t<e?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function h(t,e){const r=a.exec(t);if(!r)return!1;const i=+r[1],n=+r[2],o=+r[3],s=r[5];return(i<=23&&n<=59&&o<=59||23===i&&59===n&&60===o)&&(!e||""!==s)}function u(t,e){if(!t||!e)return;const r=a.exec(t),i=a.exec(e);return r&&i?(t=r[1]+r[2]+r[3]+(r[4]||""))>(e=i[1]+i[2]+i[3]+(i[4]||""))?1:t<e?-1:0:void 0}const l=/t|\s/i;function c(t,e){if(!t||!e)return;const[r,i]=t.split(l),[n,o]=e.split(l),a=s(r,n);return void 0!==a?a||u(i,o):void 0}const f=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;const m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function p(){return!0}const g=/[^\\]\\Z/})),kd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const r=Wl.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={message:({keyword:t,schemaCode:e})=>Wl.str`should be ${i[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>Wl._`{comparison: ${i[t].okStr}, limit: ${e}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:n,code(t){const{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:a,self:h}=s;if(!a.validateFormats)return;const u=new _d.KeywordCxt(s,h.RULES.all.format.definition,"format");function l(t){return Wl._`${t}.compare(${r}, ${n}) ${i[o].fail} 0`}u.$data?function(){const r=e.scopeValue("formats",{ref:h.formats,code:a.code.formats}),i=e.const("fmt",Wl._`${r}[${u.schemaCode}]`);t.fail$data(Wl.or(Wl._`typeof ${i} != "object"`,Wl._`${i} instanceof RegExp`,Wl._`typeof ${i}.compare != "function"`,l(i)))}():function(){const r=u.schema,i=h.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${o}": format "${r}" does not define "compare" function`);const n=e.scopeValue("formats",{key:r,ref:i,code:a.code.formats?Wl._`${a.code.formats}${Wl.getProperty(r)}`:void 0});t.fail$data(l(n))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),xd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=new Wl.Name("fullFormats"),i=new Wl.Name("fastFormats"),n=(t,e={keywords:!0})=>{if(Array.isArray(e))return o(t,e,Ad.fullFormats,r),t;const[n,s]="fast"===e.mode?[Ad.fastFormats,i]:[Ad.fullFormats,r];return o(t,e.formats||Ad.formatNames,n,s),e.keywords&&kd.default(t),t};function o(t,e,r,i){var n,o;null!==(n=(o=t.opts.code).formats)&&void 0!==n||(o.formats=Wl._`require("ajv-formats/dist/formats").${i}`);for(const i of e)t.addFormat(i,r[i])}n.get=(t,e="full")=>{const r=("fast"===e?Ad.fastFormats:Ad.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n})),Nd=i(xd),Sd=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r="errorMessage",i=new _d.Name("emUsed"),n={required:"missingProperty",dependencies:"property",dependentRequired:"property"},o=/\$\{[^}]+\}/,s=/\$\{([^}]+)\}/g,a=/^""\s*\+\s*|\s*\+\s*""$/g;function h(t){return{keyword:r,schemaType:["string","object"],post:!0,code(e){const{gen:h,data:u,schema:l,schemaValue:c,it:f}=e;if(!1===f.createErrors)return;const d=l,m=Wl.strConcat(tc.default.instancePath,f.errorPath);function p(t,e){return Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,_d._`${t}.instancePath === ${m}`,_d._`${t}.keyword in ${e}`,_d._`${t}.schemaPath.indexOf(${f.errSchemaPath}) === 0`,_d._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${f.errSchemaPath.length}))`)}function g(t,e){const r=[];for(const i in t){const t=e[i];o.test(t)&&r.push([i,v(t)])}return h.object(...r)}function y(t){return o.test(t)?new Jl._Code(Jl.safeStringify(t).replace(s,((t,e)=>`" + JSON.stringify(${dc.getData(e,f)}) + "`)).replace(a,"")):_d.stringify(t)}function v(t){return _d._`function(){return ${y(t)}}`}h.if(_d._`${tc.default.errors} > 0`,(()=>{if("object"==typeof d){const[o,s]=function(t){let e,r;for(const i in t){if("properties"===i||"items"===i)continue;const n=t[i];if("object"==typeof n){e||(e={});const t=e[i]={};for(const e in n)t[e]=[]}else r||(r={}),r[i]=[]}return[e,r]}(d);s&&function(r){const n=h.const("emErrors",_d.stringify(r)),o=h.const("templates",g(r,l));h.forOf("err",tc.default.vErrors,(t=>h.if(p(t,n),(()=>h.code(_d._`${n}[${t}.keyword].push(${t})`).assign(_d._`${t}.${i}`,!0)))));const{singleError:s}=t;if(s){const t=h.let("message",_d._`""`),r=h.let("paramsErrors",_d._`[]`);a((e=>{h.if(t,(()=>h.code(_d._`${t} += ${"string"==typeof s?s:";"}`))),h.code(_d._`${t} += ${u(e)}`),h.assign(r,_d._`${r}.concat(${n}[${e}])`)})),ec.reportError(e,{message:t,params:_d._`{errors: ${r}}`})}else a((t=>ec.reportError(e,{message:u(t),params:_d._`{errors: ${n}[${t}]}`})));function a(t){h.forIn("key",n,(e=>h.if(_d._`${n}[${e}].length`,(()=>t(e)))))}function u(t){return _d._`${t} in ${o} ? ${o}[${t}]() : ${c}[${t}]`}}(s),o&&function(t){const r=h.const("emErrors",_d.stringify(t)),o=[];for(const e in t)o.push([e,g(t[e],l[e])]);const s=h.const("templates",h.object(...o)),a=h.scopeValue("obj",{ref:n,code:_d.stringify(n)}),u=h.let("emPropParams"),f=h.let("emParamsErrors");h.forOf("err",tc.default.vErrors,(t=>h.if(p(t,r),(()=>{h.assign(u,_d._`${a}[${t}.keyword]`),h.assign(f,_d._`${r}[${t}.keyword][${t}.params[${u}]]`),h.if(f,(()=>h.code(_d._`${f}.push(${t})`).assign(_d._`${t}.${i}`,!0)))})))),h.forIn("key",r,(t=>h.forIn("keyProp",_d._`${r}[${t}]`,(i=>{h.assign(f,_d._`${r}[${t}][${i}]`),h.if(_d._`${f}.length`,(()=>{const r=h.const("tmpl",_d._`${s}[${t}] && ${s}[${t}][${i}]`);ec.reportError(e,{message:_d._`${r} ? ${r}() : ${c}[${t}][${i}]`,params:_d._`{errors: ${f}}`})}))}))))}(o),function(t){const{props:n,items:o}=t;if(!n&&!o)return;const s=_d._`typeof ${u} == "object"`,a=_d._`Array.isArray(${u})`,f=h.let("emErrors");let d,p;const y=h.let("templates");n&&o?(d=h.let("emChildKwd"),h.if(s),h.if(a,(()=>{v(o,l.items),h.assign(d,_d.str`items`)}),(()=>{v(n,l.properties),h.assign(d,_d.str`properties`)})),p=_d._`[${d}]`):o?(h.if(a),v(o,l.items),p=_d._`.items`):n&&(h.if(Wl.and(s,Wl.not(a))),v(n,l.properties),p=_d._`.properties`);function v(t,e){h.assign(f,_d.stringify(t)),h.assign(y,g(t,e))}h.forOf("err",tc.default.vErrors,(t=>function(t,e,n){h.if(Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,_d._`${t}.instancePath.indexOf(${m}) === 0`),(()=>{const r=h.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:_d._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),i=h.const("emMatches",_d._`${r}.exec(${t}.instancePath.slice(${m}.length))`),o=h.const("emChild",_d._`${i} && ${i}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);h.if(_d._`${o} !== undefined && ${o} in ${e}`,(()=>n(o)))}))}(t,f,(e=>h.code(_d._`${f}[${e}].push(${t})`).assign(_d._`${t}.${i}`,!0))))),h.forIn("key",f,(t=>h.if(_d._`${f}[${t}].length`,(()=>{ec.reportError(e,{message:_d._`${t} in ${y} ? ${y}[${t}]() : ${c}${p}[${t}]`,params:_d._`{errors: ${f}[${t}]}`}),h.assign(_d._`${tc.default.vErrors}[${tc.default.errors}-1].instancePath`,_d._`${m} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),h.endIf()}(function({properties:t,items:e}){const r={};if(t){r.props={};for(const e in t)r.props[e]=[]}if(e){r.items={};for(let t=0;t<e.length;t++)r.items[t]=[]}return r}(d))}const o="string"==typeof d?d:d._;o&&function(t){const n=h.const("emErrs",_d._`[]`);h.forOf("err",tc.default.vErrors,(t=>h.if(function(t){return Wl.and(_d._`${t}.keyword !== ${r}`,_d._`!${t}.${i}`,Wl.or(_d._`${t}.instancePath === ${m}`,Wl.and(_d._`${t}.instancePath.indexOf(${m}) === 0`,_d._`${t}.instancePath[${m}.length] === "/"`)),_d._`${t}.schemaPath.indexOf(${f.errSchemaPath}) === 0`,_d._`${t}.schemaPath[${f.errSchemaPath}.length] === "/"`)}(t),(()=>h.code(_d._`${n}.push(${t})`).assign(_d._`${t}.${i}`,!0))))),h.if(_d._`${n}.length`,(()=>ec.reportError(e,{message:y(t),params:_d._`{errors: ${n}}`})))}(o),t.keepErrors||function(){const t=h.const("emErrs",_d._`[]`);h.forOf("err",tc.default.vErrors,(e=>h.if(_d._`!${e}.${i}`,(()=>h.code(_d._`${t}.push(${e})`))))),h.assign(tc.default.vErrors,t).assign(tc.default.errors,_d._`${t}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const u=(t,e={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return t.addKeyword(h(e))};e.default=u,t.exports=u,t.exports.default=u})),Id=i(Sd),Td="__lodash_hash_undefined__",Rd="[object Function]",Cd="[object GeneratorFunction]",Pd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Od=/^\w*$/,Bd=/^\./,$d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ud=/\\(\\)?/g,Dd=/^\[object .+?Constructor\]$/,Ld=/^(?:0|[1-9]\d*)$/,Fd="object"==typeof r&&r&&r.Object===Object&&r,jd="object"==typeof self&&self&&self.Object===Object&&self,zd=Fd||jd||Function("return this")();var qd,Hd=Array.prototype,Vd=Function.prototype,Zd=Object.prototype,Gd=zd["__core-js_shared__"],Kd=(qd=/[^.]+$/.exec(Gd&&Gd.keys&&Gd.keys.IE_PROTO||""))?"Symbol(src)_1."+qd:"",Jd=Vd.toString,Qd=Zd.hasOwnProperty,Wd=Zd.toString,Yd=RegExp("^"+Jd.call(Qd).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xd=zd.Symbol,tm=Hd.splice,em=dm(zd,"Map"),rm=dm(Object,"create"),im=Xd?Xd.prototype:void 0,nm=im?im.toString:void 0;function om(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function sm(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function am(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function hm(t,e,r){var i=t[e];Qd.call(t,e)&&vm(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function um(t,e){for(var r=t.length;r--;)if(vm(t[r][0],e))return r;return-1}function lm(t){if(!bm(t)||(e=t,Kd&&Kd in e))return!1;var e,r=function(t){var e=bm(t)?Wd.call(t):"";return e==Rd||e==Cd}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Yd:Dd;return r.test(function(t){if(null!=t){try{return Jd.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function cm(t,e,r,i){if(!bm(t))return t;e=function(t,e){if(wm(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||Mm(t))return!0;return Od.test(t)||!Pd.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return wm(t)?t:pm(t)}(e);for(var n=-1,o=e.length,s=o-1,a=t;null!=a&&++n<o;){var h=gm(e[n]),u=r;if(n!=s){var l=a[h];void 0===(u=i?i(l,h,a):void 0)&&(u=bm(l)?l:mm(e[n+1])?[]:{})}hm(a,h,u),a=a[h]}return t}function fm(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function dm(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return lm(r)?r:void 0}function mm(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||Ld.test(t))&&t>-1&&t%1==0&&t<e}om.prototype.clear=function(){this.__data__=rm?rm(null):{}},om.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},om.prototype.get=function(t){var e=this.__data__;if(rm){var r=e[t];return r===Td?void 0:r}return Qd.call(e,t)?e[t]:void 0},om.prototype.has=function(t){var e=this.__data__;return rm?void 0!==e[t]:Qd.call(e,t)},om.prototype.set=function(t,e){return this.__data__[t]=rm&&void 0===e?Td:e,this},sm.prototype.clear=function(){this.__data__=[]},sm.prototype.delete=function(t){var e=this.__data__,r=um(e,t);return!(r<0)&&(r==e.length-1?e.pop():tm.call(e,r,1),!0)},sm.prototype.get=function(t){var e=this.__data__,r=um(e,t);return r<0?void 0:e[r][1]},sm.prototype.has=function(t){return um(this.__data__,t)>-1},sm.prototype.set=function(t,e){var r=this.__data__,i=um(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},am.prototype.clear=function(){this.__data__={hash:new om,map:new(em||sm),string:new om}},am.prototype.delete=function(t){return fm(this,t).delete(t)},am.prototype.get=function(t){return fm(this,t).get(t)},am.prototype.has=function(t){return fm(this,t).has(t)},am.prototype.set=function(t,e){return fm(this,t).set(t,e),this};var pm=ym((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Mm(t))return nm?nm.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return Bd.test(t)&&r.push(""),t.replace($d,(function(t,e,i,n){r.push(i?n.replace(Ud,"$1"):e||t)})),r}));function gm(t){if("string"==typeof t||Mm(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ym(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s),s};return r.cache=new(ym.Cache||am),r}function vm(t,e){return t===e||t!=t&&e!=e}ym.Cache=am;var wm=Array.isArray;function bm(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Mm(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Wd.call(t)}var _m=function(t,e,r){return null==t?t:cm(t,e,r)};let Em={},Am=0;const km=new y("networks/5.6.4");function xm(t){const e=function(e,r){null==r&&(r={});const i=[];if(e.InfuraProvider&&"-"!==r.infura)try{i.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{i.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==r.alchemy)try{i.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket){const n=["goerli","ropsten","rinkeby"];try{const o=new e.PocketProvider(t,r.pocket);o.network&&-1===n.indexOf(o.network.name)&&i.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{i.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{const n=["ropsten"],o=new e.AnkrProvider(t,r.ankr);o.network&&-1===n.indexOf(o.network.name)&&i.push(o)}catch(t){}if(0===i.length)return null;if(e.FallbackProvider){let n=1;return null!=r.quorum?n=r.quorum:"homestead"===t&&(n=2),new e.FallbackProvider(i,n)}return i[0]};return e.renetwork=function(t){return xm(t)},e}function Nm(t,e){const r=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return Nm(t,e)},r}const Sm={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:xm("homestead")},Im={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:xm("ropsten")},Tm={chainId:63,name:"classicMordor",_defaultProvider:Nm("https://www.ethercluster.com/mordor","classicMordor")},Rm={unspecified:{chainId:0,name:"unspecified"},homestead:Sm,mainnet:Sm,morden:{chainId:2,name:"morden"},ropsten:Im,testnet:Im,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:xm("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:xm("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:xm("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},classic:{chainId:61,name:"classic",_defaultProvider:Nm("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Tm,classicTestnet:Tm,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Nm("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:xm("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:xm("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Cm(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return A(e)}function Pm(t){t=A(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}class Om{constructor(t){Nr(this,"alphabet",t),Nr(this,"base",t.length),Nr(this,"_alphabetMap",{}),Nr(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=A(t);if(0===e.length)return"";let r=[0];for(let t=0;t<e.length;++t){let i=e[t];for(let t=0;t<r.length;++t)i+=r[t]<<8,r[t]=i%this.base,i=i/this.base|0;for(;i>0;)r.push(i%this.base),i=i/this.base|0}let i="";for(let t=0;0===e[t]&&t<e.length-1;++t)i+=this._leader;for(let t=r.length-1;t>=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");let n=i;for(let t=0;t<e.length;++t)n+=e[t]*this.base,e[t]=255&n,n>>=8;for(;n>0;)e.push(255&n),n>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return A(new Uint8Array(e.reverse()))}}new Om("abcdefghijklmnopqrstuvwxyz234567");const Bm=new Om("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var $m=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:$t.Buffer}catch(t){}function s(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,s=0,a=Math.min(t.length,i),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=n,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<n,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","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"],f=[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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);o=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),i=0!==o||s!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var s=this.words[n]<<o|i;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),i=0,o=0):(i=s>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,M=w>>>13,_=0|s[4],E=8191&_,A=_>>>13,k=0|s[5],x=8191&k,N=k>>>13,S=0|s[6],I=8191&S,T=S>>>13,R=0|s[7],C=8191&R,P=R>>>13,O=0|s[8],B=8191&O,$=O>>>13,U=0|s[9],D=8191&U,L=U>>>13,F=0|a[0],j=8191&F,z=F>>>13,q=0|a[1],H=8191&q,V=q>>>13,Z=0|a[2],G=8191&Z,K=Z>>>13,J=0|a[3],Q=8191&J,W=J>>>13,Y=0|a[4],X=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191&lt,ft=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,j))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(f,j)|0))<<13)|0;u=((o=Math.imul(f,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var yt=(u+(i=i+Math.imul(c,H)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,j),n=(n=Math.imul(y,z))+Math.imul(v,j)|0,o=Math.imul(v,z),i=i+Math.imul(m,H)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,H)|0,o=o+Math.imul(p,V)|0;var vt=(u+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(f,G)|0))<<13)|0;u=((o=o+Math.imul(f,K)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,z))+Math.imul(M,j)|0,o=Math.imul(M,z),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,K)|0;var wt=(u+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,W)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(E,j),n=(n=Math.imul(E,z))+Math.imul(A,j)|0,o=Math.imul(A,z),i=i+Math.imul(b,H)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,V)|0,i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,W)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,W)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,j),n=(n=Math.imul(x,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(E,H)|0,n=(n=n+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var Mt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(T,j)|0,o=Math.imul(T,z),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(E,G)|0,n=(n=n+Math.imul(E,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var _t=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,V)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,K)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,K)|0,i=i+Math.imul(E,Q)|0,n=(n=n+Math.imul(E,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var Et=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,z))+Math.imul($,j)|0,o=Math.imul($,z),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,K)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,K)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(E,X)|0,n=(n=n+Math.imul(E,tt)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var At=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(B,H)|0,n=(n=n+Math.imul(B,V)|0)+Math.imul($,H)|0,o=o+Math.imul($,V)|0,i=i+Math.imul(C,G)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,W)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(E,rt)|0,n=(n=n+Math.imul(E,it)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,ft)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,ft)|0;var kt=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(f,mt)|0))<<13)|0;u=((o=o+Math.imul(f,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,V))+Math.imul(L,H)|0,o=Math.imul(L,V),i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,K)|0)+Math.imul($,G)|0,o=o+Math.imul($,K)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,W)|0,i=i+Math.imul(I,X)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(E,ot)|0,n=(n=n+Math.imul(E,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,K))+Math.imul(L,G)|0,o=Math.imul(L,K),i=i+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,W)|0)+Math.imul($,Q)|0,o=o+Math.imul($,W)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(E,ht)|0,n=(n=n+Math.imul(E,ut)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(M,ct)|0,o=o+Math.imul(M,ft)|0;var Nt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(v,mt)|0))<<13)|0;u=((o=o+Math.imul(v,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,i=i+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(E,ct)|0,n=(n=n+Math.imul(E,ft)|0)+Math.imul(A,ct)|0,o=o+Math.imul(A,ft)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(M,mt)|0))<<13)|0;u=((o=o+Math.imul(M,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul($,rt)|0,o=o+Math.imul($,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,ut)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,ft)|0;var It=(u+(i=i+Math.imul(E,mt)|0)|0)+((8191&(n=(n=n+Math.imul(E,pt)|0)+Math.imul(A,mt)|0))<<13)|0;u=((o=o+Math.imul(A,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,ft)|0;var Tt=(u+(i=i+Math.imul(x,mt)|0)|0)+((8191&(n=(n=n+Math.imul(x,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(B,ht)|0,n=(n=n+Math.imul(B,ut)|0)+Math.imul($,ht)|0,o=o+Math.imul($,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ft)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,ft)|0;var Rt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(T,mt)|0))<<13)|0;u=((o=o+Math.imul(T,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(B,ct)|0,n=(n=n+Math.imul(B,ft)|0)+Math.imul($,ct)|0,o=o+Math.imul($,ft)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,ft))+Math.imul(L,ct)|0,o=Math.imul(L,ft);var Pt=(u+(i=i+Math.imul(B,mt)|0)|0)+((8191&(n=(n=n+Math.imul(B,pt)|0)+Math.imul($,mt)|0))<<13)|0;u=((o=o+Math.imul($,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=Mt,h[6]=_t,h[7]=Et,h[8]=At,h[9]=kt,h[10]=xt,h[11]=Nt,h[12]=St,h[13]=It,h[14]=Tt,h[15]=Rt,h[16]=Ct,h[17]=Pt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),f=67108863&c;a=67108863&(f=f+a|0),n+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=s>>>26,this.words[n]=67108863&s}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),i._ishlnsubmul(o,f,c);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(i.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new A(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}w.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(b,w),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(M,w),i(_,w),i(E,w),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return v[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),m=g}return f},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new k(t)},i(k,A),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Um=$m.BN;const Dm=new y("bignumber/5.6.2"),Lm={},Fm=9007199254740991;let jm=!1;class zm{constructor(t,e){t!==Lm&&Dm.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Hm(Vm(this).fromTwos(t))}toTwos(t){return Hm(Vm(this).toTwos(t))}abs(){return"-"===this._hex[0]?zm.from(this._hex.substring(1)):this}add(t){return Hm(Vm(this).add(Vm(t)))}sub(t){return Hm(Vm(this).sub(Vm(t)))}div(t){return zm.from(t).isZero()&&Zm("division-by-zero","div"),Hm(Vm(this).div(Vm(t)))}mul(t){return Hm(Vm(this).mul(Vm(t)))}mod(t){const e=Vm(t);return e.isNeg()&&Zm("division-by-zero","mod"),Hm(Vm(this).umod(e))}pow(t){const e=Vm(t);return e.isNeg()&&Zm("negative-power","pow"),Hm(Vm(this).pow(e))}and(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","and"),Hm(Vm(this).and(e))}or(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","or"),Hm(Vm(this).or(e))}xor(t){const e=Vm(t);return(this.isNegative()||e.isNeg())&&Zm("unbound-bitwise-result","xor"),Hm(Vm(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Zm("negative-width","mask"),Hm(Vm(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Zm("negative-width","shl"),Hm(Vm(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Zm("negative-width","shr"),Hm(Vm(this).shrn(t))}eq(t){return Vm(this).eq(Vm(t))}lt(t){return Vm(this).lt(Vm(t))}lte(t){return Vm(this).lte(Vm(t))}gt(t){return Vm(this).gt(Vm(t))}gte(t){return Vm(this).gte(Vm(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Vm(this).isZero()}toNumber(){try{return Vm(this).toNumber()}catch(t){Zm("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Dm.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?jm||(jm=!0,Dm.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Dm.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Dm.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Vm(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof zm)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new zm(Lm,qm(t)):t.match(/^-?[0-9]+$/)?new zm(Lm,qm(new Um(t))):Dm.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Zm("underflow","BigNumber.from",t),(t>=Fm||t<=-Fm)&&Zm("overflow","BigNumber.from",t),zm.from(String(t));const e=t;if("bigint"==typeof e)return zm.from(e.toString());if(E(e))return zm.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return zm.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(N(t)||"-"===t[0]&&N(t.substring(1))))return zm.from(t)}return Dm.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function qm(t){if("string"!=typeof t)return qm(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Dm.throwArgumentError("invalid hex","value",t),"0x00"===(t=qm(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Hm(t){return zm.from(qm(t))}function Vm(t){const e=zm.from(t).toHexString();return"-"===e[0]?new Um("-"+e.substring(3),16):new Um(e.substring(2),16)}function Zm(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Dm.throwError(t,y.errors.NUMERIC_FAULT,i)}function Gm(t){return we(qi(t))}const Km="hash/5.6.1",Jm=new y(Km),Qm=new Uint8Array(32);Qm.fill(0);const Wm=new RegExp("^((.*)\\.)?([^.]+)$");function Ym(t){"string"!=typeof t&&Jm.throwArgumentError("invalid ENS name; not a string","name",t);let e=t,r=Qm;for(;e.length;){const i=e.match(Wm);null!=i&&""!==i[2]||Jm.throwArgumentError("invalid ENS address; missing component","name",t);r=we(k([r,we(qi(nn(i[3])))])),e=i[2]||""}return I(r)}var Xm=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const tp=new y(Km),ep=new Uint8Array(32);ep.fill(0);const rp=zm.from(-1),ip=zm.from(0),np=zm.from(1),op=zm.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const sp=O(np.toHexString(),32),ap=O(ip.toHexString(),32),hp={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},up=["name","version","chainId","verifyingContract","salt"];function lp(t){return function(e){return"string"!=typeof e&&tp.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const cp={name:lp("name"),version:lp("version"),chainId:function(t){try{return zm.from(t).toString()}catch(t){}return tp.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Ce(t).toLowerCase()}catch(t){}return tp.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=A(t);if(32!==e.length)throw new Error("bad length");return I(e)}catch(t){}return tp.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function fp(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&tp.throwArgumentError("invalid numeric width","type",t);const n=op.mask(r?i-1:i),o=r?n.add(np).mul(rp):ip;return function(e){const r=zm.from(e);return(r.lt(o)||r.gt(n))&&tp.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),O(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&tp.throwArgumentError("invalid bytes width","type",t),function(e){return A(e).length!==r&&tp.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=A(t),r=e.length%32;return r?C([e,ep.slice(r)]):I(e)}(e)}}}switch(t){case"address":return function(t){return O(Ce(t),32)};case"bool":return function(t){return t?sp:ap};case"bytes":return function(t){return we(t)};case"string":return function(t){return Gm(t)}}return null}function dp(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class mp{constructor(t){Nr(this,"types",Object.freeze(Or(t))),Nr(this,"_encoderCache",{}),Nr(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&tp.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&tp.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);fp(s)||(r[s]||tp.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(i),e[i][s]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?tp.throwArgumentError("missing primary type","types",t):n.length>1&&tp.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Nr(this,"primaryType",n[0]),function n(o,s){s[o]&&tp.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,s),Object.keys(s).forEach((e=>{i[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=dp(e,t[e])+r.map((e=>dp(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=fp(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&tp.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(we)),we(C(n))}}const r=this.types[t];if(r){const e=Gm(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?we(i):i}));return i.unshift(e),C(i)}}return tp.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||tp.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return we(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(fp(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&tp.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):tp.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new mp(t)}static getPrimaryType(t){return mp.from(t).primaryType}static hashStruct(t,e,r){return mp.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=hp[r];i||tp.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>up.indexOf(t.name)-up.indexOf(e.name))),mp.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return C(["0x1901",mp.hashDomain(t),mp.from(e).hash(r)])}static hash(t,e,r){return we(mp.encode(t,e,r))}static resolveNames(t,e,r,i){return Xm(this,void 0,void 0,(function*(){t=Tr(t);const n={};t.verifyingContract&&!N(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=mp.from(e);o.visit(r,((t,e)=>("address"!==t||N(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){mp.hashDomain(t);const i={},n=[];up.forEach((e=>{const r=t[e];null!=r&&(i[e]=cp[e](r),n.push({name:e,type:hp[e]}))}));const o=mp.from(e),s=Tr(e);return s.EIP712Domain?tp.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return I(A(e));if(t.match(/^u?int/))return zm.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&tp.throwArgumentError("invalid string","value",e),e}return tp.throwArgumentError("unsupported type","type",t)}))}}}new y("sha2/5.6.1");function pp(t){return"0x"+Ks.sha256().update(A(t)).digest("hex")}var gp=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};function yp(t,e){return gp(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client");const i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach(((t,e)=>{o[e.toLowerCase()]=t})):i.headers.keys().forEach((t=>{o[t.toLowerCase()]=i.headers.get(t)})),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:A(new Uint8Array(n))}}))}var vp=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const wp=new y("web/5.6.1");function bp(t){return new Promise((e=>{setTimeout(e,t)}))}function Mp(t,e){if(null==t)return null;if("string"==typeof t)return t;if(M(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Vi(t)}catch(t){}return I(t)}return t}function _p(t,e,r){let i=null;if(null!=e){i=qi(e);const r="string"==typeof t?{url:t}:Tr(t);if(r.headers){0!==Object.keys(r.headers).filter((t=>"content-type"===t.toLowerCase())).length||(r.headers=Tr(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return function(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;wp.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const n="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;wp.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s="object"==typeof t&&!!t.errorPassThrough,a={};let h=null;const u={method:"GET"};let l=!1,c=12e4;if("string"==typeof t)h=t;else if("object"==typeof t){if(null!=t&&null!=t.url||wp.throwArgumentError("missing URL","connection.url",t),h=t.url,"number"==typeof t.timeout&&t.timeout>0&&(c=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(u.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==h.substring(0,6)&&!0!==t.allowInsecureAuthentication&&wp.throwError("basic authentication requires a secure https url",y.errors.INVALID_ARGUMENT,{argument:"url",url:h,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+Pm(qi(e))}}null!=t.skipFetchSetup&&(u.skipFetchSetup=!!t.skipFetchSetup)}const f=new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$","i"),d=h?h.match(f):null;if(d)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]},body:Cm(d[2])};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){wp.throwError("processing response error",y.errors.SERVER_ERROR,{body:Mp(d[1],d[2]),error:t,requestBody:null,requestMethod:"GET",url:h})}e&&(u.method="POST",u.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const m={};Object.keys(a).forEach((t=>{const e=a[t];m[e.key]=e.value})),u.headers=m;const p=function(){let t=null;return{promise:new Promise((function(e,r){c&&(t=setTimeout((()=>{null!=t&&(t=null,r(wp.makeError("timeout",y.errors.TIMEOUT,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,timeout:c,url:h})))}),c))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),g=function(){return vp(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield yp(h,u),t<i)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===u.method&&t.match(/^https:/)){h=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(n&&(r=yield n(t,h)),r){let r=0;const i=e.headers["retry-after"];r="string"==typeof i&&i.match(/^[1-9][0-9]*$/)?1e3*parseInt(i):o*parseInt(String(Math.random()*Math.pow(2,t))),yield bp(r);continue}}}catch(t){e=t.response,null==e&&(p.cancel(),wp.throwError("missing response",y.errors.SERVER_ERROR,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,serverError:t,url:h}))}let a=e.body;if(l&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(p.cancel(),wp.throwError("bad response",y.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:Mp(a,e.headers?e.headers["content-type"]:null),requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})),r)try{const t=yield r(a,e);return p.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(n&&(e=yield n(t,h)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield bp(e);continue}}p.cancel(),wp.throwError("processing response error",y.errors.SERVER_ERROR,{body:Mp(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})}return p.cancel(),a}return wp.throwError("failed response",y.errors.SERVER_ERROR,{requestBody:Mp(u.body,m["content-type"]),requestMethod:u.method,url:h})}))}();return Promise.race([p.promise,g])}(t,i,((t,e)=>{let i=null;if(null!=t)try{i=JSON.parse(Vi(t))}catch(e){wp.throwError("invalid JSON",y.errors.SERVER_ERROR,{body:t,error:e})}return r&&(i=r(i,e)),i}))}function Ep(t,e){return e||(e={}),null==(e=Tr(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,i){let n=null,o=!1;const s=()=>!o&&(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout((()=>{s()&&i(new Error("timeout"))}),e.timeout));const a=e.retryLimit;let h=0;!function n(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",n);else if(e.onceBlock)e.onceBlock.once("block",n);else if(!o){if(h++,h>a)return void(s()&&i(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,h)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(n,t)}return null}),(function(t){s()&&i(t)}))}()}))}for(var Ap="qpzry9x8gf2tvdw0s3jn54khce6mua7l",kp={},xp=0;xp<Ap.length;xp++){var Np=Ap.charAt(xp);if(void 0!==kp[Np])throw new TypeError(Np+" is ambiguous");kp[Np]=xp}function Sp(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function Ip(t){for(var e=1,r=0;r<t.length;++r){var i=t.charCodeAt(r);if(i<33||i>126)return"Invalid prefix ("+t+")";e=Sp(e)^i>>5}for(e=Sp(e),r=0;r<t.length;++r){var n=t.charCodeAt(r);e=Sp(e)^31&n}return e}function Tp(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),s=t.slice(n+1);if(s.length<6)return"Data too short";var a=Ip(o);if("string"==typeof a)return a;for(var h=[],u=0;u<s.length;++u){var l=s.charAt(u),c=kp[l];if(void 0===c)return"Unknown character "+l;a=Sp(a)^c,u+6>=s.length||h.push(c)}return 1!==a?"Invalid checksum for "+t:{prefix:o,words:h}}function Rp(t,e,r,i){for(var n=0,o=0,s=(1<<r)-1,a=[],h=0;h<t.length;++h)for(n=n<<e|t[h],o+=e;o>=r;)o-=r,a.push(n>>o&s);if(i)o>0&&a.push(n<<r-o&s);else{if(o>=e)return"Excess padding";if(n<<r-o&s)return"Non-zero padding"}return a}var Cp={decodeUnsafe:function(){var t=Tp.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=Tp.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,r){if(r=r||90,t.length+7+e.length>r)throw new TypeError("Exceeds length limit");var i=Ip(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o<e.length;++o){var s=e[o];if(s>>5!=0)throw new Error("Non 5-bit word");i=Sp(i)^s,n+=Ap.charAt(s)}for(o=0;o<6;++o)i=Sp(i);for(i^=1,o=0;o<6;++o){n+=Ap.charAt(i>>5*(5-o)&31)}return n},toWordsUnsafe:function(t){var e=Rp(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=Rp(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=Rp(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=Rp(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const Pp="providers/5.6.8",Op=new y(Pp);class Bp{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),n=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),h=this.type.bind(this);return t.transaction={hash:o,type:h,accessList:Bp.allowNull(this.accessList.bind(this),null),blockHash:Bp.allowNull(o,null),blockNumber:Bp.allowNull(a,null),transactionIndex:Bp.allowNull(a,null),confirmations:Bp.allowNull(a,null),from:e,gasPrice:Bp.allowNull(r),maxPriorityFeePerGas:Bp.allowNull(r),maxFeePerGas:Bp.allowNull(r),gasLimit:r,to:Bp.allowNull(e,null),value:r,nonce:a,data:n,r:Bp.allowNull(this.uint256),s:Bp.allowNull(this.uint256),v:Bp.allowNull(a),creates:Bp.allowNull(e,null),raw:Bp.allowNull(n)},t.transactionRequest={from:Bp.allowNull(e),nonce:Bp.allowNull(a),gasLimit:Bp.allowNull(r),gasPrice:Bp.allowNull(r),maxPriorityFeePerGas:Bp.allowNull(r),maxFeePerGas:Bp.allowNull(r),to:Bp.allowNull(e),value:Bp.allowNull(r),data:Bp.allowNull((t=>this.data(t,!0))),type:Bp.allowNull(a),accessList:Bp.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Bp.arrayOf(o),data:n,logIndex:a,blockHash:o},t.receipt={to:Bp.allowNull(this.address,null),from:Bp.allowNull(this.address,null),contractAddress:Bp.allowNull(e,null),transactionIndex:a,root:Bp.allowNull(s),gasUsed:r,logsBloom:Bp.allowNull(n),blockHash:o,transactionHash:o,logs:Bp.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Bp.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Bp.allowNull(r),status:Bp.allowNull(a),type:h},t.block={hash:Bp.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:Bp.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Bp.allowNull(e),extraData:n,transactions:Bp.allowNull(Bp.arrayOf(o)),baseFeePerGas:Bp.allowNull(r)},t.blockWithTransactions=Tr(t.block),t.blockWithTransactions.transactions=Bp.allowNull(Bp.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Bp.allowNull(i,void 0),toBlock:Bp.allowNull(i,void 0),blockHash:Bp.allowNull(o,void 0),address:Bp.allowNull(e,void 0),topics:Bp.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Bp.allowNull(a),blockHash:Bp.allowNull(o),transactionIndex:a,removed:Bp.allowNull(this.boolean.bind(this)),address:e,data:Bp.allowFalsish(n,"0x"),topics:Bp.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return qa(t||[])}number(t){return"0x"===t?0:zm.from(t).toNumber()}type(t){return"0x"===t||null==t?0:zm.from(t).toNumber()}bigNumber(t){return zm.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),N(t))?t.toLowerCase():Op.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return Ce(t)}callAddress(t){if(!N(t,32))return null;const e=Ce(R(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return Oe(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||N(t))return P(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==T(r)?Op.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=zm.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!N(t))throw new Error("invalid uint256");return O(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,i=Bp.check(e,t);return i._difficulty=null==r?null:zm.from(r),i}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Bp.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&zm.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=Bp.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;N(r)&&(r=zm.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),N(r)&&(r=zm.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return Ka(t)}receiptLog(t){return Bp.check(this.formats.receiptLog,t)}receipt(t){const e=Bp.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=zm.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Op.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Op.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Op.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return Bp.check(this.formats.filter,t)}filterLog(t){return Bp.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const i in t)try{const n=t[i](e[i]);void 0!==n&&(r[i]=n)}catch(t){throw t.checkKey=i,t.checkValue=e[i],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}var $p=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Up=new y(Pp);function Dp(t){return null==t?"null":(32!==T(t)&&Up.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Lp(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[Dp(t)]=!0}));const r=Object.keys(e);return r.sort(),r.join("|")}return Dp(t)})).join("&")}function Fp(t){if("string"==typeof t){if(32===T(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+Lp(t);if(On.isForkEvent(t))throw Up.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+Lp(t.topics||[])}throw new Error("invalid event - "+t)}function jp(){return(new Date).getTime()}function zp(t){return new Promise((e=>{setTimeout(e,t)}))}const qp=["block","network","pending","poll"];class Hp{constructor(t,e,r){Nr(this,"tag",t),Nr(this,"listener",e),Nr(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(i=t[2])?[]:i.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var i;const n={};return r.length>0&&(n.topics=r),e&&"*"!==e&&(n.address=e),n}pollable(){return this.tag.indexOf(":")>=0||qp.indexOf(this.tag)>=0}}const Vp={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Zp(t){return O(zm.from(t).toHexString(),32)}function Gp(t){return Bm.encode(k([t,R(pp(pp(t)),0,4)]))}const Kp=new RegExp("^(ipfs)://(.*)$","i"),Jp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Kp,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Qp(t,e){try{return Vi(Wp(t,e))}catch(t){}return null}function Wp(t,e){if("0x"===t)return null;const r=zm.from(R(t,e,e+32)).toNumber(),i=zm.from(R(t,r,r+32)).toNumber();return R(t,r+32,r+32+i)}function Yp(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Up.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Xp(t){const e=A(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function tg(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function eg(t){const e=[];let r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){const n=A(t[i]);e[i]=Xp(r),e.push(Xp(n.length)),e.push(tg(n)),r+=32+32*Math.ceil(n.length/32)}return C(e)}class rg{constructor(t,e,r,i){Nr(this,"provider",t),Nr(this,"name",r),Nr(this,"address",t.formatter.address(e)),Nr(this,"_resolvedAddress",i)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((t=>zm.from(t).eq(1))).catch((t=>{if(t.code===y.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return $p(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:C([t,Ym(this.name),e||"0x"])};let i=!1;var n;(yield this.supportsWildcard())&&(i=!0,r.data=C(["0x9061b923",eg([(n=this.name,I(k(n.split(".").map((t=>{const e=qi("_"+nn(t));return e[0]=e.length-1,e}))))+"00"),r.data])]));try{let t=yield this.provider.call(r);return A(t).length%32==4&&Up.throwError("resolver threw error",y.errors.CALL_EXCEPTION,{transaction:r,data:t}),i&&(t=Wp(t,0)),t}catch(t){if(t.code===y.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return $p(this,void 0,void 0,(function*(){const r=yield this._fetch(t,e);return null!=r?Wp(r,0):null}))}_getAddress(t,e){const r=Vp[String(t)];if(null==r&&Up.throwError(`unsupported coin type: ${t}`,y.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const i=A(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Gp(k([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Gp(k([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=i[1];let e=i[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&i.length===2+t&&t>=1&&t<=75){const t=Cp.toWords(i.slice(2));return t.unshift(e),Cp.encode(r.prefix,t)}}return null}getAddress(t){return $p(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===y.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",Zp(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&Up.throwError("invalid or unsupported coin data",y.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getAvatar(){return $p(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r<Jp.length;r++){const i=e.match(Jp[r]);if(null==i)continue;const n=i[1].toLowerCase();switch(n){case"https":return t.push({type:"url",content:e}),{linkage:t,url:e};case"data":return t.push({type:"data",content:e}),{linkage:t,url:e};case"ipfs":return t.push({type:"ipfs",content:e}),{linkage:t,url:Yp(e)};case"erc721":case"erc1155":{const r="erc721"===n?"0xc87b56dd":"0x0e89341c";t.push({type:n,content:e});const o=this._resolvedAddress||(yield this.getAddress()),s=(i[2]||"").split("/");if(2!==s.length)return null;const a=yield this.provider.formatter.address(s[0]),h=O(zm.from(s[1]).toHexString(),32);if("erc721"===n){const e=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:C(["0x6352211e",h])}));if(o!==e)return null;t.push({type:"owner",content:e})}else if("erc1155"===n){const e=zm.from(yield this.provider.call({to:a,data:C(["0x00fdd58e",O(o,32),h])}));if(e.isZero())return null;t.push({type:"balance",content:e.toString()})}const u={to:this.provider.formatter.address(s[0]),data:C([r,h])};let l=Qp(yield this.provider.call(u),0);if(null==l)return null;t.push({type:"metadata-url-base",content:l}),"erc1155"===n&&(l=l.replace("{id}",h.substring(2)),t.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=Yp(l)),t.push({type:"metadata-url",content:l});const c=yield _p(l);if(!c)return null;t.push({type:"metadata",content:JSON.stringify(c)});let f=c.image;if("string"!=typeof f)return null;if(f.match(/^(https:\/\/|data:)/i));else{if(null==f.match(Kp))return null;t.push({type:"url-ipfs",content:f}),f=Yp(f)}return t.push({type:"url",content:f}),{linkage:t,url:f}}}}}catch(t){}return null}))}getContentHash(){return $p(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+Bm.encode("0x"+e[1])}const r=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const t=parseInt(r[3],16);if(r[4].length===2*t)return"ipns://"+Bm.encode("0x"+r[1])}const i=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(i&&64===i[1].length)return"bzz://"+i[1];const n=t.match(/^0x90b2c605([0-9a-f]*)$/);if(n&&68===n[1].length){const t={"=":"","+":"-","/":"_"};return"sia://"+Pm("0x"+n[1]).replace(/[=+\/]/g,(e=>t[e]))}return Up.throwError("invalid or unsupported content hash data",y.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return $p(this,void 0,void 0,(function*(){let e=qi(t);e=k([Zp(64),Zp(e.length),e]),e.length%32!=0&&(e=k([e,O("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",I(e));return null==r||"0x"===r?null:Vi(r)}))}}let ig=null,ng=1;class og extends Bn{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Nr(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=Sr(new.target,"getNetwork")(t);e?(Nr(this,"_network",e),this.emit("network",e,null)):Up.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return $p(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||Up.throwError("no network detected",y.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Nr(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return Ep((()=>this._ready().then((t=>t),(t=>{if(t.code!==y.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==ig&&(ig=new Bp),ig}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in Rm){const r=Rm[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=Rm[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=Rm[t.name];if(!e)return"number"!=typeof t.chainId&&km.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&km.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}(null==t?"homestead":t)}ccipReadFetch(t,e,r){return $p(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const i=t.to.toLowerCase(),n=e.toLowerCase(),o=[];for(let t=0;t<r.length;t++){const e=r[t],s=e.replace("{sender}",i).replace("{data}",n),a=e.indexOf("{data}")>=0?null:JSON.stringify({data:n,sender:i}),h=yield _p({url:s,errorPassThrough:!0},a,((t,e)=>(t.status=e.statusCode,t)));if(h.data)return h.data;const u=h.message||"unknown error";if(h.status>=400&&h.status<500)return Up.throwError(`response not found during CCIP fetch: ${u}`,y.errors.SERVER_ERROR,{url:e,errorMessage:u});o.push(u)}return Up.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,y.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(t){return $p(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(jp()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=jp(),r=Ir({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:i})=>{if(i)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),i;const n=jp();return(t=zm.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:n}}));return this._internalBlockNumber=r,r.catch((t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return $p(this,void 0,void 0,(function*(){const t=ng++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Up.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Up.makeError("network block skew detected",y.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((t=>{switch(t.type){case"tx":{const r=t.hash;let i=this.getTransactionReceipt(r).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(i);break}case"filter":if(!t._inflight){t._inflight=!0;const i=t.filter;i.fromBlock=t._lastBlockNumber+1,i.toBlock=r,i.toBlock-this._maxFilterBlockRange>i.fromBlock&&(i.fromBlock=i.toBlock-this._maxFilterBlockRange);const n=this.getLogs(i).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(i,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(n)}}})),this._lastBlockNumber=r,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return $p(this,void 0,void 0,(function*(){return Up.throwError("provider does not support network detection",y.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return $p(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield zp(0),this._network;const r=Up.makeError("underlying network changed",y.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const t=jp();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=jp(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return $p(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,i){return $p(this,void 0,void 0,(function*(){const n=yield this.getTransactionReceipt(t);return(n?n.confirmations:0)>=e?n:new Promise(((n,o)=>{const s=[];let a=!1;const h=function(){return!!a||(a=!0,s.forEach((t=>{t()})),!1)},u=t=>{t.confirmations<e||h()||n(t)};if(this.on(t,u),s.push((()=>{this.removeListener(t,u)})),i){let r=i.startBlock,n=null;const u=s=>$p(this,void 0,void 0,(function*(){a||(yield zp(1e3),this.getTransactionCount(i.from).then((l=>$p(this,void 0,void 0,(function*(){if(!a){if(l<=i.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==n&&(n=r-3,n<i.startBlock&&(n=i.startBlock));n<=s;){if(a)return;const r=yield this.getBlockWithTransactions(n);for(let n=0;n<r.transactions.length;n++){const s=r.transactions[n];if(s.hash===t)return;if(s.from===i.from&&s.nonce===i.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,e);if(h())return;let n="replaced";return s.data===i.data&&s.to===i.to&&s.value.eq(i.value)?n="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(n="cancelled"),void o(Up.makeError("transaction was replaced",y.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===n||"cancelled"===n,reason:n,replacement:this._wrapTransaction(s),hash:t,receipt:r}))}}n++}}a||this.once("block",u)}}))),(t=>{a||this.once("block",u)})))}));if(a)return;this.once("block",u),s.push((()=>{this.removeListener("block",u)}))}if("number"==typeof r&&r>0){const t=setTimeout((()=>{h()||o(Up.makeError("timeout exceeded",y.errors.TIMEOUT,{timeout:r}))}),r);t.unref&&t.unref(),s.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return $p(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return zm.from(t)}catch(e){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getBalance",r);try{return zm.from(i)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:t})}}))}getTransactionCount(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getTransactionCount",r);try{return zm.from(i).toNumber()}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:t})}}))}getCode(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getCode",r);try{return I(i)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:t})}}))}getStorageAt(t,e,r){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const i=yield Ir({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then((t=>P(t)))}),n=yield this.perform("getStorageAt",i);try{return I(n)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:n,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==T(e))throw new Error("invalid response - sendTransaction");const i=t;return null!=e&&t.hash!==e&&Up.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),i.wait=(e,i)=>$p(this,void 0,void 0,(function*(){let n;null==e&&(e=1),null==i&&(i=0),0!==e&&null!=r&&(n={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,i,n);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&Up.throwError("transaction failed",y.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),i}sendTransaction(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>I(t))),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,i)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return $p(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?zm.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then((t=>t?I(t):null)))})),this.formatter.transactionRequest(yield Ir(r))}))}_getFilter(t){return $p(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((r=>{null!=t[r]&&(e[r]=t[r])})),["fromBlock","toBlock"].forEach((r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))})),this.formatter.filter(yield Ir(e))}))}_call(t,e,r){return $p(this,void 0,void 0,(function*(){r>=10&&Up.throwError("CCIP read exceeded maximum redirections",y.errors.SERVER_ERROR,{redirects:r,transaction:t});const i=t.to,n=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=i&&"0x556f1830"===n.substring(0,10)&&T(n)%32==4)try{const o=R(n,4),s=R(o,0,32);zm.from(s).eq(i)||Up.throwError("CCIP Read sender did not match",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const a=[],h=zm.from(R(o,32,64)).toNumber(),u=zm.from(R(o,h,h+32)).toNumber(),l=R(o,h+32);for(let e=0;e<u;e++){const r=Qp(l,32*e);null==r&&Up.throwError("CCIP Read contained corrupt URL string",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n}),a.push(r)}const c=Wp(o,64);zm.from(R(o,100,128)).isZero()||Up.throwError("CCIP Read callback selector included junk",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const f=R(o,96,100),d=Wp(o,128),m=yield this.ccipReadFetch(t,c,a);null==m&&Up.throwError("CCIP Read disabled or provided no URLs",y.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:n});const p={to:i,data:C([f,eg([m,d])])};return this._call(p,e,r+1)}catch(t){if(t.code===y.errors.SERVER_ERROR)throw t}try{return I(n)}catch(r){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:e},result:n,error:r})}}))}call(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ir({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)}))}estimateGas(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ir({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return zm.from(r)}catch(t){return Up.throwError("bad result from backend",y.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return $p(this,void 0,void 0,(function*(){"string"!=typeof(t=yield t)&&Up.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&Up.throwError("ENS name not configured",y.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const i={includeTransactions:!!e};if(N(t,32))i.blockHash=t;else try{i.blockTag=yield this._getBlockTag(t),N(i.blockTag)&&(r=parseInt(i.blockTag.substring(2),16))}catch(e){Up.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return Ep((()=>$p(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",i);if(null==t)return null!=i.blockHash&&null==this._emitted["b:"+i.blockHash]||null!=i.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){const i=t.transactions[r];if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}}const r=this.formatter.blockWithTransactions(t);return r.transactions=r.transactions.map((t=>this._wrapTransaction(t))),r}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Ep((()=>$p(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const i=this.formatter.transactionResponse(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return this._wrapTransaction(i)}))),{oncePoll:this})}))}getTransactionReceipt(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Ep((()=>$p(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const i=this.formatter.receipt(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return i}))),{oncePoll:this})}))}getLogs(t){return $p(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Ir({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach((t=>{null==t.removed&&(t.removed=!1)})),Bp.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return $p(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return $p(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&Up.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return $p(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const r=yield this._getResolver(e,"getResolver");if(null!=r){const i=new rg(this,r,t);return e===t||(yield i.supportsWildcard())?i:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return $p(this,void 0,void 0,(function*(){null==e&&(e="ENS");const r=yield this.getNetwork();r.ensAddress||Up.throwError("network does not support ENS",y.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{const e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Ym(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return $p(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(N(t))throw e}"string"!=typeof t&&Up.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return $p(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;const i=Qp(yield this.call({to:r,data:"0x691f3431"+Ym(e).substring(2)}),0);return(yield this.resolveName(i))!=t?null:i}))}getAvatar(t){return $p(this,void 0,void 0,(function*(){let e=null;if(N(t)){const r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"getAvatar");if(!i)return null;e=new rg(this,i,r);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==y.errors.CALL_EXCEPTION)throw t}try{const t=Qp(yield this.call({to:i,data:"0x691f3431"+Ym(r).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==y.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url}))}perform(t,e){return Up.throwError(t+" not implemented",y.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,r){const i=new Hp(Fp(t),e,r);return this._events.push(i),this._startEvent(i),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,i=[],n=Fp(t);return this._events=this._events.filter((t=>t.tag!==n||(setTimeout((()=>{t.listener.apply(this,e)}),0),r=!0,!t.once||(i.push(t),!1)))),i.forEach((t=>{this._stopEvent(t)})),r}listenerCount(t){if(!t)return this._events.length;let e=Fp(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=Fp(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let i=!1,n=Fp(t);return this._events=this._events.filter((t=>t.tag!==n||t.listener!=e||(!!i||(i=!0,r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=Fp(t);this._events=this._events.filter((t=>t.tag!==r||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var sg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const ag=new y(Pp),hg=["call","estimateGas"];function ug(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const r=N(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if("object"==typeof t){for(const r in t){const i=ug(t[r],e);if(i)return i}return null}if("string"==typeof t)try{return ug(JSON.parse(t),e)}catch(t){}return null}function lg(t,e,r){const i=r.transaction||r.signedTransaction;if("call"===t){const t=ug(e,!0);if(t)return t.data;ag.throwError("missing revert data in call exception; Transaction reverted without a reason string",y.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if("estimateGas"===t){let r=ug(e.body,!1);null==r&&(r=ug(e,!1)),r&&ag.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===y.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit/i)&&ag.throwError("insufficient funds for intrinsic transaction cost",y.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&ag.throwError("nonce has already been used",y.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&ag.throwError("replacement fee too low",y.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&ag.throwError("legacy pre-eip-155 transactions not supported",y.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),hg.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&ag.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function cg(t){return new Promise((function(e){setTimeout(e,t)}))}function fg(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function dg(t){return t?t.toLowerCase():t}const mg={};class pg extends Fn{constructor(t,e,r){if(super(),t!==mg)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Nr(this,"provider",e),null==r&&(r=0),"string"==typeof r?(Nr(this,"_address",this.provider.formatter.address(r)),Nr(this,"_index",null)):"number"==typeof r?(Nr(this,"_index",r),Nr(this,"_address",null)):ag.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return ag.throwError("cannot alter JSON-RPC Signer connection",y.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new gg(mg,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((t=>(t.length<=this._index&&ag.throwError("unknown account #"+this._index,y.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=Tr(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const r=Tr(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>sg(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&ag.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),Ir({tx:Ir(t),sender:e}).then((({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&ag.throwArgumentError("from address mismatch","transaction",t):e.from=r;const i=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[i]).then((t=>t),(t=>lg("sendTransaction",t,i)))}))}signTransaction(t){return ag.throwError("signing transactions is unsupported",y.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return sg(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield Ep((()=>sg(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return sg(this,void 0,void 0,(function*(){const e="string"==typeof t?qi(t):t,r=yield this.getAddress();return yield this.provider.send("personal_sign",[I(e),r.toLowerCase()])}))}_legacySignMessage(t){return sg(this,void 0,void 0,(function*(){const e="string"==typeof t?qi(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),I(e)])}))}_signTypedData(t,e,r){return sg(this,void 0,void 0,(function*(){const i=yield mp.resolveNames(t,e,r,(t=>this.provider.resolveName(t))),n=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[n.toLowerCase(),JSON.stringify(mp.getPayload(i.domain,e,i.value))])}))}unlock(t){return sg(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class gg extends pg{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const yg={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vg extends og{constructor(t,e){let r=e;null==r&&(r=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(r),t||(t=Sr(this.constructor,"defaultUrl")()),Nr(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(Tr(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return sg(this,void 0,void 0,(function*(){yield cg(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Sr(this.constructor,"getNetwork");try{return e(zm.from(t).toNumber())}catch(e){return ag.throwError("could not detect network",y.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return ag.throwError("could not detect network",y.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new pg(mg,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Or(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];const n=_p(this.connection,JSON.stringify(r),fg).then((t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t}));return i&&(this._cache[t]=n,setTimeout((()=>{this._cache[t]=null}),0)),n}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[dg(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[dg(e.address),e.blockTag]];case"getCode":return["eth_getCode",[dg(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[dg(e.address),O(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Sr(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Sr(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=dg(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return sg(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&zm.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=Tr(e)).transaction=Tr(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&ag.throwError(t+" not implemented",y.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return lg(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function i(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let i=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",i=i.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),i.then((function(){return cg(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){i()}),0),null;t.send("eth_uninstallFilter",[r])})).catch((t=>{}))}(),r})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=Tr(yg);if(e)for(const t in e)e[t]&&(r[t]=!0);!function(t,e){t&&"object"==typeof t||xr.throwArgumentError("invalid object","object",t),Object.keys(t).forEach((r=>{e[r]||xr.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)}))}(t,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const r=P(zm.from(t[e]));"gasLimit"===e&&(e="gas"),i[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=I(t[e]))})),t.accessList&&(i.accessList=qa(t.accessList)),i}}var wg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const bg=new y(Pp);class Mg extends vg{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return wg(this,void 0,void 0,(function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||bg.throwError("no network detected",y.errors.UNKNOWN_ERROR,{}),null==this._network&&(Nr(this,"_network",e),this.emit("network",e,null))),e}))}}const _g={};function Eg(t,{broviderUrl:e="https://rpc.snapshot.org",timeout:r=25e3}={}){const i=`${e}/${t}`;return _g[t]||(_g[t]=new Mg({url:i,timeout:r,allowGzip:!0},Number(t))),_g[t]}
22
22
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
23
23
  function Ag(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function kg(...t){const e=t=>t,r=(t,e)=>r=>t(e(r)),i=t.map((t=>t.encode)).reduceRight(r,e),n=t.map((t=>t.decode)).reduce(r,e);return{encode:i,decode:n}}function xg(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(Ag(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function Ng(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function Sg(t,e="="){if(Ag(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;r.length*t%8;)r.push(e);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let t of r)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let i=r.length;if(i*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;i>0&&r[i-1]===e;i--)if(!((i-1)*t%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,i)}}}function Ig(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}const Tg=(t,e)=>e?Tg(e,t%e):t,Rg=(t,e)=>t+(e-Tg(t,e));function Cg(t,e,r,i){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(Rg(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${Rg(e,r)}`);let n=0,o=0;const s=2**r-1,a=[];for(const i of t){if(Ag(i),i>=2**e)throw new Error(`convertRadix2: invalid data word=${i} from=${e}`);if(n=n<<e|i,o+e>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=r;o-=r)a.push((n>>o-r&s)>>>0);n&=2**o-1}if(n=n<<r-o&s,!i&&o>=e)throw new Error("Excess padding");if(!i&&n)throw new Error(`Non-zero padding: ${n}`);return i&&o>0&&a.push(n>>>0),a}function Pg(t,e=!1){if(Ag(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(Rg(8,t)>32||Rg(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!((i=r)instanceof Uint8Array||null!=i&&"object"==typeof i&&"Uint8Array"===i.constructor.name))throw new Error("radix2.encode input should be Uint8Array");var i;return Cg(Array.from(r),8,t,!e)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(Cg(r,t,8,e))}}}Pg(4),xg("0123456789ABCDEF"),Ng(""),Pg(5),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Sg(5),Ng(""),Pg(5),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ng(""),Pg(5),xg("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Sg(5),Ng(""),Pg(5),xg("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ng(""),Pg(5),xg("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Ng(""),Ig((t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const Og=kg(Pg(6),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Sg(6),Ng("")),Bg=(Pg(6),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ng(""),Pg(6),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Sg(6),Ng(""),Pg(6),xg("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ng(""),xg("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Ng(""),Pg(4),xg("0123456789abcdef"),Ng(""),Ig((t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()})),BigInt(0)),$g=BigInt(1),Ug=BigInt(2);function Dg(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const Lg=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Fg(t){if(!Dg(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Lg[t[r]];return e}function jg(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function zg(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}const qg=48,Hg=57,Vg=65,Zg=70,Gg=97,Kg=102;function Jg(t){return t>=qg&&t<=Hg?t-qg:t>=Vg&&t<=Zg?t-(Vg-10):t>=Gg&&t<=Kg?t-(Gg-10):void 0}function Qg(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(r);for(let e=0,n=0;e<r;e++,n+=2){const r=Jg(t.charCodeAt(n)),o=Jg(t.charCodeAt(n+1));if(void 0===r||void 0===o){const e=t[n]+t[n+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+n)}i[e]=16*r+o}return i}function Wg(t){return zg(Fg(t))}function Yg(t){if(!Dg(t))throw new Error("Uint8Array expected");return zg(Fg(Uint8Array.from(t).reverse()))}function Xg(t,e){return Qg(t.toString(16).padStart(2*e,"0"))}function ty(t,e){return Xg(t,e).reverse()}function ey(t){return Qg(jg(t))}function ry(t,e,r){let i;if("string"==typeof e)try{i=Qg(e)}catch(r){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${r}`)}else{if(!Dg(e))throw new Error(`${t} must be hex string or Uint8Array`);i=Uint8Array.from(e)}const n=i.length;if("number"==typeof r&&n!==r)throw new Error(`${t} expected ${r} bytes, got ${n}`);return i}function iy(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(!Dg(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e),i=0;for(let e=0;e<t.length;e++){const n=t[e];r.set(n,i),i+=n.length}return r}const ny=t=>(Ug<<BigInt(t-1))-$g,oy=t=>new Uint8Array(t),sy=t=>Uint8Array.from(t);function ay(t,e,r){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let i=oy(t),n=oy(t),o=0;const s=()=>{i.fill(1),n.fill(0),o=0},a=(...t)=>r(n,i,...t),h=(t=oy())=>{n=a(sy([0]),t),i=a(),0!==t.length&&(n=a(sy([1]),t),i=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const r=[];for(;t<e;){i=a();const e=i.slice();r.push(e),t+=i.length}return iy(...r)};return(t,e)=>{let r;for(s(),h(t);!(r=e(u()));)h();return s(),r}}const hy={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||Dg(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function uy(t,e,r={}){const i=(e,r,i)=>{const n=hy[r];if("function"!=typeof n)throw new Error(`Invalid validator "${r}", expected function`);const o=t[e];if(!(i&&void 0===o||n(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${r}`)};for(const[t,r]of Object.entries(e))i(t,r,!1);for(const[t,e]of Object.entries(r))i(t,e,!0);return t}var ly=Object.freeze({__proto__:null,isBytes:Dg,bytesToHex:Fg,numberToHexUnpadded:jg,hexToNumber:zg,hexToBytes:Qg,bytesToNumberBE:Wg,bytesToNumberLE:Yg,numberToBytesBE:Xg,numberToBytesLE:ty,numberToVarBytesBE:ey,ensureBytes:ry,concatBytes:iy,equalBytes:function(t,e){if(t.length!==e.length)return!1;let r=0;for(let i=0;i<t.length;i++)r|=t[i]^e[i];return 0===r},utf8ToBytes:function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))},bitLen:function(t){let e;for(e=0;t>Bg;t>>=$g,e+=1);return e},bitGet:function(t,e){return t>>BigInt(e)&$g},bitSet:(t,e,r)=>t|(r?$g:Bg)<<BigInt(e),bitMask:ny,createHmacDrbg:ay,validateObject:uy});function cy(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function fy(t,...e){if(!((r=t)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function dy(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function my(t,e){fy(t);const r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const py=BigInt(2**32-1),gy=BigInt(32);function yy(t,e=!1){return e?{h:Number(t&py),l:Number(t>>gy&py)}:{h:0|Number(t>>gy&py),l:0|Number(t&py)}}function vy(t,e=!1){let r=new Uint32Array(t.length),i=new Uint32Array(t.length);for(let n=0;n<t.length;n++){const{h:o,l:s}=yy(t[n],e);[r[n],i[n]]=[o,s]}return[r,i]}const wy="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function by(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}const My=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),_y=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Ey(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function Ay(t){if("string"==typeof t&&(t=Ey(t)),!by(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class ky{clone(){return this._cloneInto()}}function xy(t){const e=e=>t().update(Ay(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Ny(t=32){if(wy&&"function"==typeof wy.getRandomValues)return wy.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const[Sy,Iy,Ty]=[[],[],[]],Ry=BigInt(0),Cy=BigInt(1),Py=BigInt(2),Oy=BigInt(7),By=BigInt(256),$y=BigInt(113);for(let t=0,e=Cy,r=1,i=0;t<24;t++){[r,i]=[i,(2*r+3*i)%5],Sy.push(2*(5*i+r)),Iy.push((t+1)*(t+2)/2%64);let n=Ry;for(let t=0;t<7;t++)e=(e<<Cy^(e>>Oy)*$y)%By,e&Py&&(n^=Cy<<(Cy<<BigInt(t))-Cy);Ty.push(n)}const[Uy,Dy]=vy(Ty,!0),Ly=(t,e,r)=>r>32?((t,e,r)=>e<<r-32|t>>>64-r)(t,e,r):((t,e,r)=>t<<r|e>>>32-r)(t,e,r),Fy=(t,e,r)=>r>32?((t,e,r)=>t<<r-32|e>>>64-r)(t,e,r):((t,e,r)=>e<<r|t>>>32-r)(t,e,r);class jy extends ky{constructor(t,e,r,i=!1,n=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,cy(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(t,e=24){const r=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let e=0;e<10;e++)r[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const i=(e+8)%10,n=(e+2)%10,o=r[n],s=r[n+1],a=Ly(o,s,1)^r[i],h=Fy(o,s,1)^r[i+1];for(let r=0;r<50;r+=10)t[e+r]^=a,t[e+r+1]^=h}let e=t[2],n=t[3];for(let r=0;r<24;r++){const i=Iy[r],o=Ly(e,n,i),s=Fy(e,n,i),a=Sy[r];e=t[a],n=t[a+1],t[a]=o,t[a+1]=s}for(let e=0;e<50;e+=10){for(let i=0;i<10;i++)r[i]=t[e+i];for(let i=0;i<10;i++)t[e+i]^=~r[(i+2)%10]&r[(i+4)%10]}t[0]^=Uy[i],t[1]^=Dy[i]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){dy(this);const{blockLen:e,state:r}=this,i=(t=Ay(t)).length;for(let n=0;n<i;){const o=Math.min(e-this.pos,i-n);for(let e=0;e<o;e++)r[this.pos++]^=t[n++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,0!=(128&e)&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){dy(this,!1),fy(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,n=t.length;i<n;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,n-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return cy(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(my(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:i,rounds:n,enableXOF:o}=this;return t||(t=new jy(e,r,i,o,n)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=n,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const zy=((t,e,r)=>xy((()=>new jy(e,t,r))))(1,136,32);class qy extends ky{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=My(this.buffer)}update(t){dy(this);const{view:e,buffer:r,blockLen:i}=this,n=(t=Ay(t)).length;for(let o=0;o<n;){const s=Math.min(i-this.pos,n-o);if(s!==i)r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===i&&(this.process(e,0),this.pos=0);else{const e=My(t);for(;i<=n-o;o+=i)this.process(e,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){dy(this),my(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:n}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let t=o;t<i;t++)e[t]=0;!function(t,e,r,i){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,i);const n=BigInt(32),o=BigInt(4294967295),s=Number(r>>n&o),a=Number(r&o),h=i?4:0,u=i?0:4;t.setUint32(e+h,s,i),t.setUint32(e+u,a,i)}(r,i-8,BigInt(8*this.length),n),this.process(r,0);const s=My(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=a/4,u=this.get();if(h>u.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<h;t++)s.setUint32(4*t,u[t],n)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:n,destroyed:o,pos:s}=this;return t.length=i,t.pos=s,t.finished=n,t.destroyed=o,i%e&&t.buffer.set(r),t}}const Hy=(t,e,r)=>t&e^t&r^e&r,Vy=new Uint32Array([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]),Zy=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gy=new Uint32Array(64);class Ky extends qy{constructor(){super(64,32,8,!1),this.A=0|Zy[0],this.B=0|Zy[1],this.C=0|Zy[2],this.D=0|Zy[3],this.E=0|Zy[4],this.F=0|Zy[5],this.G=0|Zy[6],this.H=0|Zy[7]}get(){const{A:t,B:e,C:r,D:i,E:n,F:o,G:s,H:a}=this;return[t,e,r,i,n,o,s,a]}set(t,e,r,i,n,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let r=0;r<16;r++,e+=4)Gy[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Gy[t-15],r=Gy[t-2],i=_y(e,7)^_y(e,18)^e>>>3,n=_y(r,17)^_y(r,19)^r>>>10;Gy[t]=n+Gy[t-7]+i+Gy[t-16]|0}let{A:r,B:i,C:n,D:o,E:s,F:a,G:h,H:u}=this;for(let t=0;t<64;t++){const e=u+(_y(s,6)^_y(s,11)^_y(s,25))+((l=s)&a^~l&h)+Vy[t]+Gy[t]|0,c=(_y(r,2)^_y(r,13)^_y(r,22))+Hy(r,i,n)|0;u=h,h=a,a=s,s=o+e|0,o=n,n=i,i=r,r=e+c|0}var l;r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,h=h+this.G|0,u=u+this.H|0,this.set(r,i,n,o,s,a,h,u)}roundClean(){Gy.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Jy=xy((()=>new Ky)),Qy=BigInt(0),Wy=BigInt(1),Yy=BigInt(2),Xy=BigInt(3),tv=BigInt(4),ev=BigInt(5),rv=BigInt(8);
24
24
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(9),BigInt(16);function iv(t,e){const r=t%e;return r>=Qy?r:e+r}function nv(t,e,r){if(r<=Qy||e<Qy)throw new Error("Expected power/modulo > 0");if(r===Wy)return Qy;let i=Wy;for(;e>Qy;)e&Wy&&(i=i*t%r),t=t*t%r,e>>=Wy;return i}function ov(t,e){if(t===Qy||e<=Qy)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=iv(t,e),i=e,n=Qy,o=Wy,s=Wy,a=Qy;for(;r!==Qy;){const t=i/r,e=i%r,h=n-s*t,u=o-a*t;i=r,r=e,n=s,o=a,s=h,a=u}if(i!==Wy)throw new Error("invert: does not exist");return iv(n,e)}function sv(t){if(t%tv===Xy){const e=(t+Wy)/tv;return function(t,r){const i=t.pow(r,e);if(!t.eql(t.sqr(i),r))throw new Error("Cannot find square root");return i}}if(t%rv===ev){const e=(t-ev)/rv;return function(t,r){const i=t.mul(r,Yy),n=t.pow(i,e),o=t.mul(r,n),s=t.mul(t.mul(o,Yy),n),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Wy)/Yy;let r,i,n;for(r=t-Wy,i=0;r%Yy===Qy;r/=Yy,i++);for(n=Yy;n<t&&nv(n,e,t)!==t-Wy;n++);if(1===i){const e=(t+Wy)/tv;return function(t,r){const i=t.pow(r,e);if(!t.eql(t.sqr(i),r))throw new Error("Cannot find square root");return i}}const o=(r+Wy)/Yy;return function(t,s){if(t.pow(s,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=i,h=t.pow(t.mul(t.ONE,n),r),u=t.pow(s,o),l=t.pow(s,r);for(;!t.eql(l,t.ONE);){if(t.eql(l,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(l);e<a&&!t.eql(r,t.ONE);e++)r=t.sqr(r);const r=t.pow(h,Wy<<BigInt(a-e-1));h=t.sqr(r),u=t.mul(u,r),l=t.mul(l,h),a=e}return u}}(t)}const av=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hv(t){return uy(t,av.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function uv(t,e,r){if(r<Qy)throw new Error("Expected power > 0");if(r===Qy)return t.ONE;if(r===Wy)return e;let i=t.ONE,n=e;for(;r>Qy;)r&Wy&&(i=t.mul(i,n)),n=t.sqr(n),r>>=Wy;return i}function lv(t,e){const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function cv(t,e,r=!1,i={}){if(t<=Qy)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:n,nByteLength:o}=lv(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=sv(t),a=Object.freeze({ORDER:t,BITS:n,BYTES:o,MASK:ny(n),ZERO:Qy,ONE:Wy,create:e=>iv(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Qy<=e&&e<t},is0:t=>t===Qy,isOdd:t=>(t&Wy)===Wy,neg:e=>iv(-e,t),eql:(t,e)=>t===e,sqr:e=>iv(e*e,t),add:(e,r)=>iv(e+r,t),sub:(e,r)=>iv(e-r,t),mul:(e,r)=>iv(e*r,t),pow:(t,e)=>uv(a,t,e),div:(e,r)=>iv(e*ov(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>ov(e,t),sqrt:i.sqrt||(t=>s(a,t)),invertBatch:t=>function(t,e){const r=new Array(e.length),i=e.reduce(((e,i,n)=>t.is0(i)?e:(r[n]=e,t.mul(e,i))),t.ONE),n=t.inv(i);return e.reduceRight(((e,i,n)=>t.is0(i)?e:(r[n]=t.mul(e,r[n]),t.mul(e,i))),n),r}(a,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?ty(t,o):Xg(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?Yg(t):Wg(t)}});return Object.freeze(a)}function fv(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function dv(t){const e=fv(t);return e+Math.ceil(e/2)}
@@ -1,5 +1,6 @@
1
1
  export type ProviderOptions = {
2
2
  broviderUrl?: string;
3
+ timeout?: number;
3
4
  };
4
- export default function getProvider(network: any, { broviderUrl }?: ProviderOptions): any;
5
- export declare function getBatchedProvider(network: any, { broviderUrl }?: ProviderOptions): any;
5
+ export default function getProvider(network: any, { broviderUrl, timeout }?: ProviderOptions): any;
6
+ export declare function getBatchedProvider(network: any, { broviderUrl, timeout }?: ProviderOptions): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapshot-labs/snapshot.js",
3
- "version": "0.12.44",
3
+ "version": "0.12.45",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
@@ -8,20 +8,25 @@ const batchedProviders = {};
8
8
 
9
9
  export type ProviderOptions = {
10
10
  broviderUrl?: string;
11
+ timeout?: number;
11
12
  };
12
13
 
13
14
  const DEFAULT_BROVIDER_URL = 'https://rpc.snapshot.org';
15
+ const DEFAULT_TIMEOUT = 25000;
14
16
 
15
17
  export default function getProvider(
16
18
  network,
17
- { broviderUrl = DEFAULT_BROVIDER_URL }: ProviderOptions = {}
19
+ {
20
+ broviderUrl = DEFAULT_BROVIDER_URL,
21
+ timeout = DEFAULT_TIMEOUT
22
+ }: ProviderOptions = {}
18
23
  ) {
19
24
  const url = `${broviderUrl}/${network}`;
20
25
  if (!providers[network])
21
26
  providers[network] = new StaticJsonRpcProvider(
22
27
  {
23
28
  url,
24
- timeout: 25000,
29
+ timeout,
25
30
  allowGzip: true
26
31
  },
27
32
  Number(network)
@@ -31,13 +36,16 @@ export default function getProvider(
31
36
 
32
37
  export function getBatchedProvider(
33
38
  network,
34
- { broviderUrl = DEFAULT_BROVIDER_URL }: ProviderOptions = {}
39
+ {
40
+ broviderUrl = DEFAULT_BROVIDER_URL,
41
+ timeout = DEFAULT_TIMEOUT
42
+ }: ProviderOptions = {}
35
43
  ) {
36
44
  const url = `${broviderUrl}/${network}`;
37
45
  if (!batchedProviders[network])
38
46
  batchedProviders[network] = new JsonRpcBatchProvider({
39
47
  url,
40
- timeout: 25000,
48
+ timeout,
41
49
  allowGzip: true
42
50
  });
43
51
  return batchedProviders[network];