@waves/marshall
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
var WavesMarshall=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),i=r(3),s=r(10),o=r(8);var a;!function(e){e[e.GENESIS=1]="GENESIS",e[e.PAYMENT=2]="PAYMENT",e[e.ISSUE=3]="ISSUE",e[e.TRANSFER=4]="TRANSFER",e[e.REISSUE=5]="REISSUE",e[e.BURN=6]="BURN",e[e.EXCHANGE=7]="EXCHANGE",e[e.LEASE=8]="LEASE",e[e.CANCEL_LEASE=9]="CANCEL_LEASE",e[e.ALIAS=10]="ALIAS",e[e.MASS_TRANSFER=11]="MASS_TRANSFER",e[e.DATA=12]="DATA",e[e.SET_SCRIPT=13]="SET_SCRIPT",e[e.SPONSORSHIP=14]="SPONSORSHIP",e[e.SET_ASSET_SCRIPT=15]="SET_ASSET_SCRIPT",e[e.INVOKE_SCRIPT=16]="INVOKE_SCRIPT"}(a=t.TRANSACTION_TYPE||(t.TRANSACTION_TYPE={}));const u={toBytes:n.SHORT,fromBytes:i.P_SHORT},h={toBytes:n.INT,fromBytes:i.P_INT};var c;!function(e){e.longField=(e=>[e,{toBytes:n.LONG,fromBytes:i.P_LONG}]),e.byteField=(e=>[e,{toBytes:n.BYTE,fromBytes:i.P_BYTE}]),e.booleanField=(e=>[e,{toBytes:n.BOOL,fromBytes:i.P_BOOLEAN}]),e.stringField=(e=>[e,{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_SHORT)}]),e.base58field32=(e=>[e,{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(32)}]),e.base58Option32=(e=>[e,{toBytes:e=>"WAVES"===e?n.OPTION(n.BASE58_STRING)(null):n.OPTION(n.BASE58_STRING)(e),fromBytes:i.P_OPTION(i.P_BASE58_FIXED(32))}]),e.base64field=(e=>[e,{toBytes:n.LEN(n.SHORT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_SHORT)}]),e.byteConstant=(e=>["noname",{toBytes:()=>Uint8Array.from([e]),fromBytes:()=>({value:void 0,shift:1})}]),e.alias=["alias",{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.byteNewAliasToString}],e.amount=e.longField("amount"),e.assetDescription=e.stringField("description"),e.assetId=e.base58field32("assetId"),e.assetName=e.stringField("name"),e.attachment=["attachment",{toBytes:n.LEN(n.SHORT)(n.BASE58_STRING),fromBytes:i.P_BASE58_VAR(i.P_SHORT)}],e.chainId=e.byteField("chainId"),e.decimals=e.byteField("decimals"),e.fee=e.longField("fee"),e.leaseAssetId=e.base58Option32("leaseAssetId"),e.leaseId=e.base58field32("leaseId"),e.optionalAssetId=e.base58Option32("assetId"),e.quantity=e.longField("quantity"),e.reissuable=e.booleanField("reissuable"),e.recipient=["recipient",{toBytes:n.ADDRESS_OR_ALIAS,fromBytes:i.byteToAddressOrAlias}],e.script=["script",{toBytes:n.SCRIPT,fromBytes:i.byteToScript}],e.senderPublicKey=e.base58field32("senderPublicKey"),e.signature=["signature",{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(64)}],e.timestamp=e.longField("timestamp"),e.type=e.byteField("type"),e.version=e.byteField("version"),e.proofs=["proofs",{type:"array",items:{toBytes:n.LEN(n.SHORT)(n.BASE58_STRING),fromBytes:i.P_BASE58_VAR(i.P_SHORT)}}];const t={type:"object",schema:[e.recipient,e.amount]};e.transfers=["transfers",{type:"array",items:t}];const r={type:"dataTxField",items:new Map([[s.DATA_FIELD_TYPE.INTEGER,{toBytes:n.LONG,fromBytes:i.P_LONG}],[s.DATA_FIELD_TYPE.BOOLEAN,{toBytes:n.BOOL,fromBytes:i.P_BOOLEAN}],[s.DATA_FIELD_TYPE.BINARY,{toBytes:n.LEN(n.SHORT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_SHORT)}],[s.DATA_FIELD_TYPE.STRING,{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_SHORT)}]])};e.data=["data",{type:"array",items:r}];const o=s.anyOf([[0,{toBytes:n.LONG,fromBytes:i.P_LONG},"integer"],[1,{toBytes:n.LEN(n.INT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_INT)},"binary"],[2,{toBytes:n.LEN(n.INT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_INT)},"string"],[6,{toBytes:()=>Uint8Array.from([]),fromBytes:()=>({value:!0,shift:0})},"boolean"],[7,{toBytes:()=>Uint8Array.from([]),fromBytes:()=>({value:!1,shift:0})},"boolean"]],{valueField:"value"});e.functionCall=["call",{type:"object",optional:!0,schema:[e.byteConstant(9),e.byteConstant(1),["function",{toBytes:n.LEN(n.INT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_INT)}],["args",{type:"array",toBytes:n.INT,fromBytes:i.P_INT,items:o}]]}],e.payment={type:"object",withLength:u,schema:[e.amount,e.optionalAssetId]},e.payments=["payment",{type:"array",items:e.payment}]}(c=t.txFields||(t.txFields={})),t.orderSchemaV1={type:"object",schema:[c.senderPublicKey,c.base58field32("matcherPublicKey"),["assetPair",{type:"object",schema:[c.base58Option32("amountAsset"),c.base58Option32("priceAsset")]}],["orderType",{toBytes:e=>n.BYTE("sell"===e?1:0),fromBytes:(e,t=0)=>1===i.P_BYTE(e,t).value?{value:"sell",shift:1}:{value:"buy",shift:1}}],c.longField("price"),c.longField("amount"),c.timestamp,c.longField("expiration"),c.longField("matcherFee")]},t.orderSchemaV2={type:"object",schema:[c.version,...t.orderSchemaV1.schema]},t.orderSchemaV3={type:"object",schema:[...t.orderSchemaV2.schema,["matcherFeeAssetId",c.optionalAssetId[1]]]},t.aliasSchemaV2={type:"object",schema:[c.type,c.version,c.senderPublicKey,[["alias","chainId"],{type:"object",withLength:u,schema:[c.byteConstant(2),c.chainId,c.alias]}],c.fee,c.timestamp]},t.burnSchemaV2={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.assetId,c.quantity,c.fee,c.timestamp]},t.cancelLeaseSchemaV2={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.fee,c.timestamp,c.leaseId]},t.invokeScriptSchemaV1={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,["dApp",c.recipient[1]],c.functionCall,c.payments,c.fee,["feeAssetId",c.optionalAssetId[1]],c.timestamp]},t.dataSchemaV1={type:"object",schema:[c.type,c.version,c.senderPublicKey,c.data,c.timestamp,c.fee]},t.proofsSchemaV0={type:"object",schema:[["signature",{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(64)}]]},t.proofsSchemaV1={type:"object",schema:[c.byteConstant(1),c.proofs]};const l={type:"object",schema:[...t.orderSchemaV1.schema,c.signature]};t.exchangeSchemaV1={type:"object",schema:[c.type,["order1",{fromBytes:()=>({value:void 0,shift:4}),toBytes:e=>n.INT(o.serializerFromSchema(l)(e).length)}],["order2",{fromBytes:()=>({value:void 0,shift:4}),toBytes:e=>n.INT(o.serializerFromSchema(l)(e).length)}],["order1",l],["order2",l],c.longField("price"),c.longField("amount"),c.longField("buyMatcherFee"),c.longField("sellMatcherFee"),c.longField("fee"),c.longField("timestamp")]};const f=s.anyOf([[1,{type:"object",withLength:{toBytes:e=>n.INT(e-1),fromBytes:e=>{const{value:t,shift:r}=i.P_INT(e);return{value:t+1,shift:r}}},schema:[c.byteConstant(1),...t.orderSchemaV1.schema,...t.proofsSchemaV0.schema]}],[2,{type:"object",withLength:h,schema:[...t.orderSchemaV2.schema,...t.proofsSchemaV1.schema]}]],{discriminatorField:"version",discriminatorBytePos:4});t.exchangeSchemaV2={type:"object",schema:[c.byteConstant(0),c.type,c.version,["order1",f],["order2",f],c.longField("price"),c.longField("amount"),c.longField("buyMatcherFee"),c.longField("sellMatcherFee"),c.longField("fee"),c.longField("timestamp")]},t.issueSchemaV2={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.assetName,c.assetDescription,c.quantity,c.decimals,c.reissuable,c.fee,c.timestamp,c.script]},t.leaseSchemaV2={type:"object",schema:[c.type,c.version,c.leaseAssetId,c.senderPublicKey,c.recipient,c.amount,c.fee,c.timestamp]},t.massTransferSchemaV1={type:"object",schema:[c.type,c.version,c.senderPublicKey,c.optionalAssetId,c.transfers,c.timestamp,c.fee,c.attachment]},t.reissueSchemaV2={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.assetId,c.quantity,c.reissuable,c.fee,c.timestamp]},t.setAssetScriptSchemaV1={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.assetId,c.fee,c.timestamp,c.script]},t.setScriptSchemaV1={type:"object",schema:[c.type,c.version,c.chainId,c.senderPublicKey,c.script,c.fee,c.timestamp]},t.sponsorshipSchemaV1={type:"object",schema:[c.type,c.version,c.senderPublicKey,c.assetId,c.longField("minSponsoredAssetFee"),c.fee,c.timestamp]},t.transferSchemaV2={type:"object",schema:[c.type,c.version,c.senderPublicKey,c.optionalAssetId,["feeAssetId",c.optionalAssetId[1]],c.timestamp,c.amount,c.fee,c.recipient,c.attachment]},t.schemasByTypeMap={[a.GENESIS]:{},[a.PAYMENT]:{},[a.ISSUE]:{2:t.issueSchemaV2},[a.TRANSFER]:{2:t.transferSchemaV2},[a.REISSUE]:{2:t.reissueSchemaV2},[a.BURN]:{2:t.burnSchemaV2},[a.EXCHANGE]:{1:t.exchangeSchemaV1,2:t.exchangeSchemaV2},[a.LEASE]:{2:t.leaseSchemaV2},[a.CANCEL_LEASE]:{2:t.cancelLeaseSchemaV2},[a.ALIAS]:{2:t.aliasSchemaV2},[a.MASS_TRANSFER]:{1:t.massTransferSchemaV1},[a.DATA]:{1:t.dataSchemaV1},[a.SET_SCRIPT]:{1:t.setScriptSchemaV1},[a.SPONSORSHIP]:{1:t.sponsorshipSchemaV1},[a.SET_ASSET_SCRIPT]:{1:t.setAssetScriptSchemaV1},[a.INVOKE_SCRIPT]:{1:t.invokeScriptSchemaV1}},t.orderVersionMap={1:t.orderSchemaV1,2:t.orderSchemaV2,3:t.orderSchemaV3},t.getTransactionSchema=function(e,r){const n=t.schemasByTypeMap[e];if("object"!=typeof n)throw new Error(`Incorrect tx type: ${e}`);const i=n[r||1];if("object"!=typeof i)throw new Error(`Incorrect tx version: ${r}`);return i}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5),i=r(6),s=r(2),o=r(7);t.empty=Uint8Array.from([]),t.zero=Uint8Array.from([0]),t.one=Uint8Array.from([1]),t.BASE58_STRING=(e=>n.default.decode(e)),t.BASE64_STRING=(e=>i.toByteArray(e.replace("base64:",""))),t.STRING=(e=>e?(e=>Uint8Array.from([...unescape(encodeURIComponent(e))].map(e=>e.charCodeAt(0))))(e):t.empty),t.BYTE=(e=>Uint8Array.from([e])),t.BOOL=(e=>t.BYTE(1==e?1:0)),t.BYTES=(e=>Uint8Array.from(e)),t.SHORT=(e=>{const t=o.fromNumber(e,!0);return Uint8Array.from(t.toBytesBE().slice(6))}),t.INT=(e=>{const t=o.fromNumber(e,!0);return Uint8Array.from(t.toBytesBE().slice(4))}),t.OPTION=(e=>r=>null==r||"string"==typeof r&&0==r.length?t.zero:s.concat(t.one,e(r))),t.LEN=(e=>t=>r=>{const n=t(r),i=e(n.length);return s.concat(i,n)}),t.COUNT=(e=>t=>r=>{const n=s.concat(...r.map(e=>t(e))),i=e(r.length);return s.concat(i,n)}),t.LONG=(e=>{let t;if("number"==typeof e){if(e>Math.pow(2,53)-1)throw new Error(`${e} is too big to be precisely represented as js number. Use string instead`);t=o.fromNumber(e)}else t=o.fromString(e.toString());return Uint8Array.from(t.toBytesBE())}),t.SCRIPT=(e=>t.OPTION(t.LEN(t.SHORT)(t.BASE64_STRING))(e?e.slice(7):null)),t.ALIAS=(e=>{const[r,n,i]=e.split(":");if(!n||1!==n.length)throw new Error("Invalid network byte in alias");if(!i||0===i.length)throw new Error("Invalid alias body");return s.concat([2],[n.charCodeAt(0)],t.LEN(t.SHORT)(t.STRING)(i))}),t.ADDRESS_OR_ALIAS=(e=>e.startsWith("alias")?t.ALIAS(e):t.BASE58_STRING(e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=((...e)=>e.reduce((e,t)=>Uint8Array.from([...e,...t]),new Uint8Array(0))),t.range=((e,t,r=1)=>Array.from({length:t-e}).map((t,n)=>n*r+e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7),i=r(9),s=r(5),o=r(6);t.ALIAS_VERSION=2;t.P_OPTION=(e=>(t,r=0)=>{if(0===t[r])return{value:null,shift:1};const n=e(t,r+1);return{value:n.value,shift:n.shift+1}}),t.P_BYTE=((e,t=0)=>({value:e[t],shift:1})),t.P_SHORT=((e,t=0)=>({value:256*e[t]+e[t+1],shift:2})),t.P_INT=((e,t=0)=>({value:Math.pow(2,24)*e[t]+Math.pow(2,16)*e[t+1]+Math.pow(2,8)*e[t+2]+e[t+3],shift:4})),t.P_LONG=((e,t=0)=>({value:n.fromBytesBE(Array.from(e.slice(t,t+8))).toString(),shift:8})),t.P_BOOLEAN=((e,t=0)=>{return{value:!!e[t],shift:1}}),t.P_STRING_FIXED=(e=>(t,r=0)=>{const n=i.Utf8ArrayToStr(t.slice(r,r+e));return{shift:e,value:n}}),t.P_STRING_VAR=(e=>(r,n=0)=>{const i=e(r,n),{value:s}=t.P_STRING_FIXED(i.value)(r,n+i.shift);return{shift:i.value+i.shift,value:s}}),t.P_BASE58_FIXED=(e=>(t,r=0)=>{return{value:s.default.encode(t.slice(r,r+e)),shift:e}}),t.P_BASE58_VAR=(e=>(r,n=0)=>{const i=e(r,n),{value:s}=t.P_BASE58_FIXED(i.value)(r,n+2);return{shift:i.value+2,value:s}}),t.P_BASE64=(e=>(t,r=0)=>{const n=e(t,r),i=`base64:${o.fromByteArray(t.slice(r+n.shift,r+n.shift+n.value))}`;return{shift:n.value+n.shift,value:i}});t.byteToStringWithLength=((e,r=0)=>{const n=t.P_SHORT(e,r),{value:s}=(e=>(t,r)=>{const n=i.Utf8ArrayToStr(t.slice(r,r+e));return{shift:e,value:n}})(n.value)(e,r+2);return{shift:n.value+2,value:s}}),t.byteToBase58=((e,t=0,r)=>{const n=r||32;return{value:s.default.encode(e.slice(t,t+n)),shift:n}}),t.byteToBase58WithLength=((e,r=0)=>{const n=t.P_SHORT(e,r);return{value:s.default.encode(e.slice(r+n.shift,r+n.shift+n.value)),shift:n.shift+n.value}}),t.byteToAddressOrAlias=((e,r=0)=>{if(e[r]===t.ALIAS_VERSION){const n=t.byteToStringWithLength(e,r+2);return{shift:n.shift+2,value:`alias:${String.fromCharCode(e[r+1])}:${n.value}`}}return t.byteToBase58(e,r,26)}),t.byteNewAliasToString=((e,r=0)=>{const n=t.P_SHORT(e,r).value+2,{value:i}=t.byteToStringWithLength(e,r);return{shift:n,value:i}}),t.byteToScript=((e,r=0)=>{if(0===e[r])return{shift:1,value:null};const n=t.P_SHORT(e,r+1),i=r+1+n.shift,s=r+1+n.shift+n.value;return{value:`base64:${o.fromByteArray(e.slice(i,s))}`,shift:s-r}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(8),s=r(11),o=r(12);t.json=o;const a=r(1);t.serializePrimitives=a;const u=r(3);t.parsePrimitives=u;const h=r(0);t.schemas=h;const c={serializerFromSchema:i.serializerFromSchema,serializeTx:i.serializeTx,serializeOrder:i.serializeOrder,parserFromSchema:s.parserFromSchema,parseTx:s.parseTx,parseOrder:s.parseOrder};function l(e,t,r,n){const o=i.serializerFromSchema(t,n),a=s.parserFromSchema(t,r)(o(e)).value;return Object.assign({},e,a)}t.binary=c,t.convertLongFields=l,t.convertTxLongFields=function(e,t,r){const{type:i,version:s}=e;return l(e,n.getTransactionSchema(i,s),t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",i=n.split("").reduce((e,t,r)=>(e[t]=r,e),{});t.default={encode(e){if(!e.length)return"";const t=[0];for(let r=0;r<e.length;r++){for(let e=0;e<t.length;e++)t[e]<<=8;t[0]+=e[r];let n=0;for(let e=0;e<t.length;e++)t[e]+=n,n=t[e]/58|0,t[e]%=58;for(;n;)t.push(n%58),n=n/58|0}for(let r=0;0===e[r]&&r<e.length-1;r++)t.push(0);return t.reverse().map(function(e){return n[e]}).join("")},decode(e){if(!e.length)return new Uint8Array(0);const t=[0];for(let r=0;r<e.length;r++){const n=e[r];if(!(n in i))throw new Error(`There is no character "${n}" in the Base58 sequence!`);for(let e=0;e<t.length;e++)t[e]*=58;t[0]+=i[n];let s=0;for(let e=0;e<t.length;e++)t[e]+=s,s=t[e]>>8,t[e]&=255;for(;s;)t.push(255&s),s>>=8}for(let r=0;"1"===e[r]&&r<e.length-1;r++)t.push(0);return new Uint8Array(t.reverse())}}},function(e,t,r){"use strict";t.byteLength=function(e){var t=h(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=h(e),n=r[0],o=r[1],a=new s(function(e,t,r){return 3*(t+r)/4-r}(0,n,o)),u=0,c=o>0?n-4:n,l=0;l<c;l+=4)t=i[e.charCodeAt(l)]<<18|i[e.charCodeAt(l+1)]<<12|i[e.charCodeAt(l+2)]<<6|i[e.charCodeAt(l+3)],a[u++]=t>>16&255,a[u++]=t>>8&255,a[u++]=255&t;2===o&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t);1===o&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t);return a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(c(e,o,o+16383>a?a:o+16383));1===i?(t=e[r-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a<u;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function h(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var i,s,o=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(n[(s=i)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var s={},o={};function a(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(r=h(e,(0|e)<0?-1:0,!0),i&&(o[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=h(e,e<0?-1:0,!1),i&&(s[e]=r),r)}function u(e,t){if(isNaN(e))return t?S:p;if(t){if(e<0)return S;if(e>=m)return T}else{if(e<=-d)return B;if(e+1>=d)return A}return e<0?u(-e,t).neg():h(e%y|0,e/y|0,t)}function h(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=h;var c=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var i=u(c(r,8)),s=p,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),h=parseInt(e.substring(o,o+a),r);if(a<8){var f=u(c(r,a));s=s.mul(f).add(u(h))}else s=(s=s.mul(i)).add(u(h))}return s.unsigned=t,s}function f(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?l(e,t):h(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=l,n.fromValue=f;var y=4294967296,m=y*y,d=m/2,g=a(1<<24),p=a(0);n.ZERO=p;var S=a(0,!0);n.UZERO=S;var v=a(1);n.ONE=v;var E=a(1,!0);n.UONE=E;var b=a(-1);n.NEG_ONE=b;var A=h(-1,2147483647,!1);n.MAX_VALUE=A;var T=h(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var B=h(0,-2147483648,!1);n.MIN_VALUE=B;var _=n.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*y+(this.low>>>0):this.high*y+(this.low>>>0)},_.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(B)){var t=u(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(c(e,6),this.unsigned),s=this,o="";;){var a=s.div(i),h=(s.sub(a.mul(i)).toInt()>>>0).toString(e);if((s=a).isZero())return h+o;for(;h.length<6;)h="0"+h;o=""+h+o}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(B)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},_.isZero=function(){return 0===this.high&&0===this.low},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(e){return i(e)||(e=f(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},_.eq=_.equals,_.notEquals=function(e){return!this.eq(e)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(e){return this.comp(e)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(e){return this.comp(e)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(e){return this.comp(e)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(e){return this.comp(e)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(e){if(i(e)||(e=f(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(B)?B:this.not().add(v)},_.neg=_.negate,_.add=function(e){i(e)||(e=f(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,l=0,y=0,m=0;return y+=(m+=s+(65535&e.low))>>>16,l+=(y+=n+u)>>>16,c+=(l+=r+a)>>>16,c+=t+o,h((y&=65535)<<16|(m&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},_.subtract=function(e){return i(e)||(e=f(e)),this.add(e.neg())},_.sub=_.subtract,_.multiply=function(e){if(this.isZero())return p;if(i(e)||(e=f(e)),r)return h(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return p;if(this.eq(B))return e.isOdd()?B:p;if(e.eq(B))return this.isOdd()?B:p;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,s=this.low>>>16,o=65535&this.low,a=e.high>>>16,c=65535&e.high,l=e.low>>>16,y=65535&e.low,m=0,d=0,S=0,v=0;return S+=(v+=o*y)>>>16,d+=(S+=s*y)>>>16,S&=65535,d+=(S+=o*l)>>>16,m+=(d+=n*y)>>>16,d&=65535,m+=(d+=s*l)>>>16,d&=65535,m+=(d+=o*c)>>>16,m+=t*y+n*l+s*c+o*a,h((S&=65535)<<16|(v&=65535),(m&=65535)<<16|(d&=65535),this.unsigned)},_.mul=_.multiply,_.divide=function(e){if(i(e)||(e=f(e)),e.isZero())throw Error("division by zero");var t,n,s;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?h((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?S:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return S;if(e.gt(this.shru(1)))return E;s=S}else{if(this.eq(B))return e.eq(v)||e.eq(b)?B:e.eq(B)?v:(t=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?v:b:(n=this.sub(e.mul(t)),s=t.add(n.div(e)));if(e.eq(B))return this.unsigned?S:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=p}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),a=o<=48?1:c(2,o-48),l=u(t),y=l.mul(e);y.isNegative()||y.gt(n);)y=(l=u(t-=a,this.unsigned)).mul(e);l.isZero()&&(l=v),s=s.add(l),n=n.sub(y)}return s},_.div=_.divide,_.modulo=function(e){return i(e)||(e=f(e)),r?h((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return h(~this.low,~this.high,this.unsigned)},_.and=function(e){return i(e)||(e=f(e)),h(this.low&e.low,this.high&e.high,this.unsigned)},_.or=function(e){return i(e)||(e=f(e)),h(this.low|e.low,this.high|e.high,this.unsigned)},_.xor=function(e){return i(e)||(e=f(e)),h(this.low^e.low,this.high^e.high,this.unsigned)},_.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?h(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):h(0,this.low<<e-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?h(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):h(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?h(this.low>>>e|t<<32-e,t>>>e,this.unsigned):h(32===e?t:t>>>e-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},_.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},_.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),i=r(2),s=r(0);t.serializerFromSchema=((e,r)=>s=>{let o,a;if("array"===e.type)return o=t.serializerFromSchema(e.items,r),a=i.concat(...s.map(e=>o(e))),i.concat((e.toBytes||n.SHORT)(s.length),a);if("object"===e.type){let n=Uint8Array.from([]);if(e.optional&&null==s)return Uint8Array.from([0]);if(e.schema.forEach(e=>{const[u,h]=e;let c;c=Array.isArray(u)?u.reduce((e,t)=>Object.assign({},e,{[t]:s[t]}),{}):s[u],o=t.serializerFromSchema(h,r),a=o(c),n=i.concat(n,a)}),e.withLength){const t=e.withLength.toBytes(n.length);n=i.concat(t,n)}return e.optional&&(n=i.concat([1],n)),n}if("anyOf"===e.type){const u=s[e.discriminatorField],h=e.itemByKey(u);if(null==h)throw new Error(`Serializer Error: Unknown anyOf type: ${u}`);return"boolean"===h.strKey&&6===h.key&&!1===s.value&&(h.key=7),o=t.serializerFromSchema(h.schema,r),null==e.valueField?o(s):(a=o(s[e.valueField]),i.concat((e.toBytes||n.BYTE)(h.key),a))}if("primitive"===e.type||void 0===e.type)return e.toBytes(s);if("dataTxField"===e.type){const u=n.LEN(n.SHORT)(n.STRING)(s.key),h=s.type,c=e.items.get(h);if(null==c)throw new Error(`Serializer Error: Unknown dataTxField type: ${h}`);const l=[...e.items.values()].findIndex(e=>e===c);return o=t.serializerFromSchema(c,r),a=o(s.value),i.concat(u,n.BYTE(l),a)}throw new Error(`Serializer Error: Unknown schema type: ${e.type}`)}),t.serializeTx=function(e,r){const{type:n,version:i}=e,o=s.getTransactionSchema(n,i);return t.serializerFromSchema(o,r)(e)},t.serializeOrder=function(e,r){const n=e.version||1,i=s.orderVersionMap[n];if(null==i)throw new Error(`Unknown order version: ${n}`);return t.serializerFromSchema(i,r)(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i,s;t.Utf8ArrayToStr=(n=new Array(128),i=String.fromCodePoint||String.fromCharCode,s=[],function(e){var t,r,o=e.length;s.length=0;for(var a=0;a<o;)(r=e[a++])<=127?t=r:r<=223?t=(31&r)<<6|63&e[a++]:r<=239?t=(15&r)<<12|(63&e[a++])<<6|63&e[a++]:String.fromCodePoint?t=(7&r)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++]:(t=63,a+=3),s.push(n[t]||(n[t]=i(t)));return s.join("")})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.INTEGER="integer",e.BOOLEAN="boolean",e.STRING="string",e.BINARY="binary"}(t.DATA_FIELD_TYPE||(t.DATA_FIELD_TYPE={})),t.anyOf=function(e,t){return new n(e,t)};class n{constructor(e,t){this._items=e,this.type="anyOf",this.discriminatorField="type",this.discriminatorBytePos=0,Object.assign(this,t)}itemByKey(e){const t=this._items.find(([t,r,n])=>n===e||t==e);return t&&{schema:t[1],key:t[0],strKey:t[2]}}itemByByteKey(e){const t=this._items.find(([t,r])=>t===e);return t&&{schema:t[1],key:t[0],strKey:t[2]||t[0].toString(10)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3),i=r(2),s=r(0);t.parserFromSchema=((e,r)=>(s,o=0)=>{let a=o;if("array"===e.type){const u=[],{value:h,shift:c}=(e.fromBytes||n.P_SHORT)(s,o);return a+=c,i.range(0,h).forEach(n=>{const i=t.parserFromSchema(e.items,r),{value:o,shift:h}=i(s,a);u.push(o),a+=h}),{value:u,shift:a-o}}if("object"===e.type){if(e.optional){const e=1===s[a];if(a+=1,!e)return{value:void 0,shift:1}}if(e.withLength){const t=e.withLength.fromBytes(s,a);a+=t.shift}const n={};return e.schema.forEach(e=>{const[i,o]=e,u=t.parserFromSchema(o,r),{value:h,shift:c}=u(s,a);a+=c,void 0!==h&&(Array.isArray(i)?Object.assign(n,h):n[i]=h)}),{value:n,shift:a-o}}if("anyOf"===e.type){const i=(e.fromBytes||n.P_BYTE)(s,a+e.discriminatorBytePos);e.valueField&&0===e.discriminatorBytePos&&(a+=i.shift);const u=e.itemByByteKey(i.value);if(null==u)throw new Error(`Failed to get schema for item with bytecode: ${i.value}`);const h=t.parserFromSchema(u.schema,r),{value:c,shift:l}=h(s,a);return a+=l,{value:e.valueField?{[e.discriminatorField]:u.strKey,[e.valueField]:c}:c,shift:a-o}}if("dataTxField"===e.type){const i=n.byteToStringWithLength(s,a);a+=i.shift;let o=n.P_BYTE(s,a);a+=o.shift;const u=[...e.items].find((e,t)=>t===o.value);if(!u)throw new Error(`Parser Error: Unknown dataTxField type: ${o.value}`);const h=t.parserFromSchema(u[1],r)(s,a);return{value:{value:h.value,key:i.value,type:u[0]},shift:h.shift+i.shift+o.shift}}if("primitive"===e.type||void 0===e.type){const t=e.fromBytes;let{value:i,shift:a}=t(s,o);return t===n.P_LONG&&r&&(i=r(i)),{value:i,shift:a}}throw new Error(`Parser Error: Unknown schema type: ${e.type}`)}),t.parseHeader=(e=>{let t=0,r=n.P_BYTE(e,t);t+=r.shift,0===r.value&&(t+=(r=n.P_BYTE(e,t)).shift);let i=n.P_BYTE(e,t);return{type:r.value,version:i.value}}),t.parseTx=function(e,r){const{type:n,version:i}=t.parseHeader(e),o=s.getTransactionSchema(n,i);return t.parserFromSchema(o,r)(e).value},t.parseOrder=function(e,r){return t.parserFromSchema(s.orderSchemaV2,r)(e).value}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(13),{parse:i,stringify:s}=n(),o=r(0),a=r(1),u=r(4);function h(e,t){return 0===e.length?t:"object"==typeof t?h(e.slice(1),t[e[0]]):void 0}const c=(e,t,r)=>{return function t(n,i){if(null==i)return!1;if(0===n.length&&("primitive"===i.type||void 0===i.type))return i.toBytes===a.LONG;if("object"===i.type){const e=i.schema.find(([e,t])=>e===n[0]);return t(n.slice(1),e&&e[1])}if("array"===i.type)return t(n.slice(1),i.items);if("dataTxField"===i.type){if("value"!==n[0])return!1;const s=h(e.slice(0,e.length-1),r),o=i.items.get(s.type);return t(n.slice(1),o)}if("anyOf"===i.type){const s=h(e.slice(0,e.length-1),r)[i.discriminatorField],o=i.itemByKey(s);return!!o&&(null!=i.valueField&&e[e.length-1]===i.valueField?t(n.slice(1),o.schema):t(n,o.schema))}return!1}(e,t)};function l(e,t){const r=[],n=[];function i(o){return"string"==typeof o&&c(r,t,e)?o:"boolean"==typeof o||o instanceof Boolean||null===o||"number"==typeof o||o instanceof Number||"string"==typeof o||o instanceof String||o instanceof Date?JSON.stringify(o):Array.isArray(o)?function(e){let t="[";const s=n.length;n[s]=e;for(let n=0;n<e.length;n++){let o=n+"",a=e[n];void 0!==a&&"function"!=typeof a?(r[s]=o,t+=i(a)):t+="null",n<e.length-1&&(t+=",")}return n.length=s,r.length=s,t+="]"}(o):o&&"object"==typeof o?function(e){let t=!0,o="{";const a=n.length;n[a]=e;for(let n in e)if(e.hasOwnProperty(n)){let u=e[n];s(u)&&(t?t=!1:o+=",",o+='"'+n+'":',r[a]=n,o+=i(u))}return n.length=a,r.length=a,o+="}"}(o):void 0}function s(e){return void 0!==e&&"function"!=typeof e}return i(e)||""}t.stringifyWithSchema=l,t.parseTx=function(e,t){const r=i(e);return t?u.convertTxLongFields(r,t):r},t.stringifyTx=function(e,t){const{type:r,version:n}=e,i=o.getTransactionSchema(r,n);return l(u.convertLongFields(e,i,void 0,t),i)},t.parseOrder=function(e,t){const r=i(e),n=2===r.version?o.orderSchemaV2:o.orderSchemaV1;return t?u.convertLongFields(r,n,t):r},t.stringifyOrder=function(e,t){const r=2===e.version?o.orderSchemaV2:o.orderSchemaV1;return l(u.convertLongFields(e,r,void 0,t),r)}},function(e,t,r){"use strict";e.exports=function(e){var t={strict:!1};null!=e&&!0===e.strict&&(t.strict=!0);var r,n,i,s,o={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},a=function(e){throw{name:"SyntaxError",message:e,at:r,text:i}},u=function(e){return e&&e!==n&&a("Expected '"+e+"' instead of '"+n+"'"),n=i.charAt(r),r+=1,n},h=function(){var t,r="";for("-"===n&&(r="-",u("-"));n>="0"&&n<="9";)r+=n,u();if("."===n)for(r+=".";u()&&n>="0"&&n<="9";)r+=n;if("e"===n||"E"===n)for(r+=n,u(),"-"!==n&&"+"!==n||(r+=n,u());n>="0"&&n<="9";)r+=n,u();return t=+r,e&&e.parse?e.parse(r):isFinite(t)?r.length>15?r:t:void a("Bad number")},c=function(){var e,t,r,i="";if('"'===n)for(;u();){if('"'===n)return u(),i;if("\\"===n)if(u(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(u(),16),isFinite(e));t+=1)r=16*r+e;i+=String.fromCharCode(r)}else{if("string"!=typeof o[n])break;i+=o[n]}else i+=n}a("Bad string")},l=function(){for(;n&&n<=" ";)u()};s=function(){switch(l(),n){case"{":return function(){var e,r={};if("{"===n){if(u("{"),l(),"}"===n)return u("}"),r;for(;n;){if(e=c(),l(),u(":"),!0===t.strict&&Object.hasOwnProperty.call(r,e)&&a('Duplicate key "'+e+'"'),r[e]=s(),l(),"}"===n)return u("}"),r;u(","),l()}}a("Bad object")}();case"[":return function(){var e=[];if("["===n){if(u("["),l(),"]"===n)return u("]"),e;for(;n;){if(e.push(s()),l(),"]"===n)return u("]"),e;u(","),l()}}a("Bad array")}();case'"':return c();case"-":return h();default:return n>="0"&&n<="9"?h():function(){switch(n){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}a("Unexpected '"+n+"'")}()}};var f,y,m,d=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function p(e){return d.lastIndex=0,d.test(e)?'"'+e.replace(d,function(e){var t=g[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}return{parse:function(e,t){var o;return i=e+"",r=0,n=" ",o=s(),l(),n&&a("Syntax error"),"function"==typeof t?function e(r,n){var i,s=r[n];return s&&"object"==typeof s&&Object.keys(s).forEach(function(t){void 0!==(i=e(s,t))?s[t]=i:delete s[t]}),t.call(r,n,s)}({"":o},""):o},stringify:function(t,r,n){var i;if(f="",y="","number"==typeof n)for(i=0;i<n;i+=1)y+=" ";else"string"==typeof n&&(y=n);if(m=r,r&&"function"!=typeof r&&("object"!=typeof r||"number"!=typeof r.length))throw new Error("JSON.stringify");return function t(r,n){var i,s,o,a,u,h=f,c=n[r],l=e&&e.isInstance&&e.isInstance(c);switch(l&&!c.isFinite()&&(c=null),l?c=e.stringify(c):c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(r)),"function"==typeof m&&(c=m.call(n,r,c)),typeof c){case"string":return l?c:p(c);case"number":return isFinite(c)?String(c):"null";case"boolean":return String(c);case"object":if(!c)return"null";if(f+=y,u=[],"[object Array]"===Object.prototype.toString.apply(c)){for(a=c.length,i=0;i<a;i+=1)u[i]=t(i,c)||"null";return o=0===u.length?"[]":f?"[\n"+f+u.join(",\n"+f)+"\n"+h+"]":"["+u.join(",")+"]",f=h,o}if(m&&"object"==typeof m)for(a=m.length,i=0;i<a;i+=1)"string"==typeof m[i]&&(o=t(s=m[i],c))&&u.push(p(s)+(f?": ":":")+o);else for(s in c)Object.prototype.hasOwnProperty.call(c,s)&&(o=t(s,c))&&u.push(p(s)+(f?": ":":")+o);return o=0===u.length?"{}":f?"{\n"+f+u.join(",\n"+f)+"\n"+h+"}":"{"+u.join(",")+"}",f=h,o}}("",{"":t})}}}}]); | ||
var WavesMarshall=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),i=r(3),o=r(10),s=r(8);var a;!function(e){e[e.GENESIS=1]="GENESIS",e[e.PAYMENT=2]="PAYMENT",e[e.ISSUE=3]="ISSUE",e[e.TRANSFER=4]="TRANSFER",e[e.REISSUE=5]="REISSUE",e[e.BURN=6]="BURN",e[e.EXCHANGE=7]="EXCHANGE",e[e.LEASE=8]="LEASE",e[e.CANCEL_LEASE=9]="CANCEL_LEASE",e[e.ALIAS=10]="ALIAS",e[e.MASS_TRANSFER=11]="MASS_TRANSFER",e[e.DATA=12]="DATA",e[e.SET_SCRIPT=13]="SET_SCRIPT",e[e.SPONSORSHIP=14]="SPONSORSHIP",e[e.SET_ASSET_SCRIPT=15]="SET_ASSET_SCRIPT",e[e.INVOKE_SCRIPT=16]="INVOKE_SCRIPT"}(a=t.TRANSACTION_TYPE||(t.TRANSACTION_TYPE={}));const c={toBytes:n.SHORT,fromBytes:i.P_SHORT},u={toBytes:n.INT,fromBytes:i.P_INT};var f;!function(e){e.longField=(e=>[e,{toBytes:n.LONG,fromBytes:i.P_LONG}]),e.byteField=(e=>[e,{toBytes:n.BYTE,fromBytes:i.P_BYTE}]),e.booleanField=(e=>[e,{toBytes:n.BOOL,fromBytes:i.P_BOOLEAN}]),e.stringField=(e=>[e,{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_SHORT)}]),e.base58field32=(e=>[e,{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(32)}]),e.base58Option32=(e=>[e,{toBytes:e=>"WAVES"===e?n.OPTION(n.BASE58_STRING)(null):n.OPTION(n.BASE58_STRING)(e),fromBytes:i.P_OPTION(i.P_BASE58_FIXED(32))}]),e.base64field=(e=>[e,{toBytes:n.LEN(n.SHORT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_SHORT)}]),e.byteConstant=(e=>["noname",{toBytes:()=>Uint8Array.from([e]),fromBytes:()=>({value:void 0,shift:1})}]),e.alias=["alias",{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.byteNewAliasToString}],e.amount=e.longField("amount"),e.assetDescription=e.stringField("description"),e.assetId=e.base58field32("assetId"),e.assetName=e.stringField("name"),e.attachment=["attachment",{toBytes:n.LEN(n.SHORT)(n.BASE58_STRING),fromBytes:i.P_BASE58_VAR(i.P_SHORT)}],e.chainId=e.byteField("chainId"),e.decimals=e.byteField("decimals"),e.fee=e.longField("fee"),e.leaseAssetId=e.base58Option32("leaseAssetId"),e.leaseId=e.base58field32("leaseId"),e.optionalAssetId=e.base58Option32("assetId"),e.quantity=e.longField("quantity"),e.reissuable=e.booleanField("reissuable"),e.recipient=["recipient",{toBytes:n.ADDRESS_OR_ALIAS,fromBytes:i.byteToAddressOrAlias}],e.script=["script",{toBytes:n.SCRIPT,fromBytes:i.byteToScript}],e.senderPublicKey=e.base58field32("senderPublicKey"),e.signature=["signature",{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(64)}],e.timestamp=e.longField("timestamp"),e.type=e.byteField("type"),e.version=e.byteField("version"),e.proofs=["proofs",{type:"array",items:{toBytes:n.LEN(n.SHORT)(n.BASE58_STRING),fromBytes:i.P_BASE58_VAR(i.P_SHORT)}}];const t={type:"object",schema:[e.recipient,e.amount]};e.transfers=["transfers",{type:"array",items:t}];const r={type:"dataTxField",items:new Map([[o.DATA_FIELD_TYPE.INTEGER,{toBytes:n.LONG,fromBytes:i.P_LONG}],[o.DATA_FIELD_TYPE.BOOLEAN,{toBytes:n.BOOL,fromBytes:i.P_BOOLEAN}],[o.DATA_FIELD_TYPE.BINARY,{toBytes:n.LEN(n.SHORT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_SHORT)}],[o.DATA_FIELD_TYPE.STRING,{toBytes:n.LEN(n.SHORT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_SHORT)}]])};e.data=["data",{type:"array",items:r}];const s=o.anyOf([[0,{toBytes:n.LONG,fromBytes:i.P_LONG},"integer"],[1,{toBytes:n.LEN(n.INT)(n.BASE64_STRING),fromBytes:i.P_BASE64(i.P_INT)},"binary"],[2,{toBytes:n.LEN(n.INT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_INT)},"string"],[6,{toBytes:()=>Uint8Array.from([]),fromBytes:()=>({value:!0,shift:0})},"boolean"],[7,{toBytes:()=>Uint8Array.from([]),fromBytes:()=>({value:!1,shift:0})},"boolean"]],{valueField:"value"});e.functionCall=["call",{type:"object",optional:!0,schema:[e.byteConstant(9),e.byteConstant(1),["function",{toBytes:n.LEN(n.INT)(n.STRING),fromBytes:i.P_STRING_VAR(i.P_INT)}],["args",{type:"array",toBytes:n.INT,fromBytes:i.P_INT,items:s}]]}],e.payment={type:"object",withLength:c,schema:[e.amount,e.optionalAssetId]},e.payments=["payment",{type:"array",items:e.payment}]}(f=t.txFields||(t.txFields={})),t.orderSchemaV1={type:"object",schema:[f.senderPublicKey,f.base58field32("matcherPublicKey"),["assetPair",{type:"object",schema:[f.base58Option32("amountAsset"),f.base58Option32("priceAsset")]}],["orderType",{toBytes:e=>n.BYTE("sell"===e?1:0),fromBytes:(e,t=0)=>1===i.P_BYTE(e,t).value?{value:"sell",shift:1}:{value:"buy",shift:1}}],f.longField("price"),f.longField("amount"),f.timestamp,f.longField("expiration"),f.longField("matcherFee")]},t.orderSchemaV2={type:"object",schema:[f.version,...t.orderSchemaV1.schema]},t.orderSchemaV3={type:"object",schema:[...t.orderSchemaV2.schema,["matcherFeeAssetId",f.optionalAssetId[1]]]},t.aliasSchemaV2={type:"object",schema:[f.type,f.version,f.senderPublicKey,[["alias","chainId"],{type:"object",withLength:c,schema:[f.byteConstant(2),f.chainId,f.alias]}],f.fee,f.timestamp]},t.burnSchemaV2={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.assetId,f.quantity,f.fee,f.timestamp]},t.cancelLeaseSchemaV2={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.fee,f.timestamp,f.leaseId]},t.invokeScriptSchemaV1={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,["dApp",f.recipient[1]],f.functionCall,f.payments,f.fee,["feeAssetId",f.optionalAssetId[1]],f.timestamp]},t.dataSchemaV1={type:"object",schema:[f.type,f.version,f.senderPublicKey,f.data,f.timestamp,f.fee]},t.proofsSchemaV0={type:"object",schema:[["signature",{toBytes:n.BASE58_STRING,fromBytes:i.P_BASE58_FIXED(64)}]]},t.proofsSchemaV1={type:"object",schema:[f.byteConstant(1),f.proofs]};const l={type:"object",schema:[...t.orderSchemaV1.schema,f.signature]};t.exchangeSchemaV1={type:"object",schema:[f.type,["order1",{fromBytes:()=>({value:void 0,shift:4}),toBytes:e=>n.INT(s.serializerFromSchema(l)(e).length)}],["order2",{fromBytes:()=>({value:void 0,shift:4}),toBytes:e=>n.INT(s.serializerFromSchema(l)(e).length)}],["order1",l],["order2",l],f.longField("price"),f.longField("amount"),f.longField("buyMatcherFee"),f.longField("sellMatcherFee"),f.longField("fee"),f.longField("timestamp")]};const h=o.anyOf([[1,{type:"object",withLength:{toBytes:e=>n.INT(e-1),fromBytes:e=>{const{value:t,shift:r}=i.P_INT(e);return{value:t+1,shift:r}}},schema:[f.byteConstant(1),...t.orderSchemaV1.schema,...t.proofsSchemaV0.schema]}],[2,{type:"object",withLength:u,schema:[...t.orderSchemaV2.schema,...t.proofsSchemaV1.schema]}]],{discriminatorField:"version",discriminatorBytePos:4});t.exchangeSchemaV2={type:"object",schema:[f.byteConstant(0),f.type,f.version,["order1",h],["order2",h],f.longField("price"),f.longField("amount"),f.longField("buyMatcherFee"),f.longField("sellMatcherFee"),f.longField("fee"),f.longField("timestamp")]},t.issueSchemaV2={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.assetName,f.assetDescription,f.quantity,f.decimals,f.reissuable,f.fee,f.timestamp,f.script]},t.leaseSchemaV2={type:"object",schema:[f.type,f.version,f.leaseAssetId,f.senderPublicKey,f.recipient,f.amount,f.fee,f.timestamp]},t.massTransferSchemaV1={type:"object",schema:[f.type,f.version,f.senderPublicKey,f.optionalAssetId,f.transfers,f.timestamp,f.fee,f.attachment]},t.reissueSchemaV2={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.assetId,f.quantity,f.reissuable,f.fee,f.timestamp]},t.setAssetScriptSchemaV1={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.assetId,f.fee,f.timestamp,f.script]},t.setScriptSchemaV1={type:"object",schema:[f.type,f.version,f.chainId,f.senderPublicKey,f.script,f.fee,f.timestamp]},t.sponsorshipSchemaV1={type:"object",schema:[f.type,f.version,f.senderPublicKey,f.assetId,f.longField("minSponsoredAssetFee"),f.fee,f.timestamp]},t.transferSchemaV2={type:"object",schema:[f.type,f.version,f.senderPublicKey,f.optionalAssetId,["feeAssetId",f.optionalAssetId[1]],f.timestamp,f.amount,f.fee,f.recipient,f.attachment]},t.schemasByTypeMap={[a.GENESIS]:{},[a.PAYMENT]:{},[a.ISSUE]:{2:t.issueSchemaV2},[a.TRANSFER]:{2:t.transferSchemaV2},[a.REISSUE]:{2:t.reissueSchemaV2},[a.BURN]:{2:t.burnSchemaV2},[a.EXCHANGE]:{1:t.exchangeSchemaV1,2:t.exchangeSchemaV2},[a.LEASE]:{2:t.leaseSchemaV2},[a.CANCEL_LEASE]:{2:t.cancelLeaseSchemaV2},[a.ALIAS]:{2:t.aliasSchemaV2},[a.MASS_TRANSFER]:{1:t.massTransferSchemaV1},[a.DATA]:{1:t.dataSchemaV1},[a.SET_SCRIPT]:{1:t.setScriptSchemaV1},[a.SPONSORSHIP]:{1:t.sponsorshipSchemaV1},[a.SET_ASSET_SCRIPT]:{1:t.setAssetScriptSchemaV1},[a.INVOKE_SCRIPT]:{1:t.invokeScriptSchemaV1}},t.orderVersionMap={1:t.orderSchemaV1,2:t.orderSchemaV2,3:t.orderSchemaV3},t.getTransactionSchema=function(e,r){const n=t.schemasByTypeMap[e];if("object"!=typeof n)throw new Error(`Incorrect tx type: ${e}`);const i=n[r||1];if("object"!=typeof i)throw new Error(`Incorrect tx version: ${r}`);return i}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(5),i=r(6),o=r(2),s=r(7);t.empty=Uint8Array.from([]),t.zero=Uint8Array.from([0]),t.one=Uint8Array.from([1]),t.BASE58_STRING=(e=>n.default.decode(e)),t.BASE64_STRING=(e=>i.toByteArray(e.replace("base64:",""))),t.STRING=(e=>e?(e=>Uint8Array.from([...unescape(encodeURIComponent(e))].map(e=>e.charCodeAt(0))))(e):t.empty),t.BYTE=(e=>Uint8Array.from([e])),t.BOOL=(e=>t.BYTE(e?1:0)),t.BYTES=(e=>Uint8Array.from(e)),t.SHORT=(e=>{const t=new s.BigNumber(Math.floor(e)).toBytes();return Uint8Array.from(Array.from({length:2},(e,r)=>t[r-2+t.length]||0))}),t.INT=(e=>{const t=new s.BigNumber(Math.floor(e)).toBytes();return Uint8Array.from(Array.from({length:4},(e,r)=>t[r-4+t.length]||0))}),t.OPTION=(e=>r=>null==r||"string"==typeof r&&0==r.length?t.zero:o.concat(t.one,e(r))),t.LEN=(e=>t=>r=>{const n=t(r),i=e(n.length);return o.concat(i,n)}),t.COUNT=(e=>t=>r=>{const n=o.concat(...r.map(e=>t(e))),i=e(r.length);return o.concat(i,n)}),t.LONG=(e=>{let t;if("number"==typeof e){if(e>Math.pow(2,53)-1)throw new Error(`${e} is too big to be precisely represented as js number. Use string instead`);t=new s.BigNumber(Math.floor(e)).toBytes()}else t=new s.BigNumber(e).toBytes();return Uint8Array.from(Array.from({length:8},(e,r)=>t[r-8+t.length]||0))}),t.SCRIPT=(e=>t.OPTION(t.LEN(t.SHORT)(t.BASE64_STRING))(e?e.slice(7):null)),t.ALIAS=(e=>{const[r,n,i]=e.split(":");if(!n||1!==n.length)throw new Error("Invalid network byte in alias");if(!i||0===i.length)throw new Error("Invalid alias body");return o.concat([2],[n.charCodeAt(0)],t.LEN(t.SHORT)(t.STRING)(i))}),t.ADDRESS_OR_ALIAS=(e=>e.startsWith("alias")?t.ALIAS(e):t.BASE58_STRING(e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=((...e)=>e.reduce((e,t)=>Uint8Array.from([...e,...t]),new Uint8Array(0))),t.range=((e,t,r=1)=>Array.from({length:t-e}).map((t,n)=>n*r+e))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9),i=r(5),o=r(6),s=r(7);t.ALIAS_VERSION=2;t.P_OPTION=(e=>(t,r=0)=>{if(0===t[r])return{value:null,shift:1};const n=e(t,r+1);return{value:n.value,shift:n.shift+1}}),t.P_BYTE=((e,t=0)=>({value:e[t],shift:1})),t.P_SHORT=((e,t=0)=>({value:256*e[t]+e[t+1],shift:2})),t.P_INT=((e,t=0)=>({value:Math.pow(2,24)*e[t]+Math.pow(2,16)*e[t+1]+Math.pow(2,8)*e[t+2]+e[t+3],shift:4})),t.P_LONG=((e,t=0)=>({value:s.BigNumber.fromBytes(Array.from(e.slice(t,t+8))).toString(),shift:8})),t.P_BOOLEAN=((e,t=0)=>{return{value:!!e[t],shift:1}}),t.P_STRING_FIXED=(e=>(t,r=0)=>{const i=n.Utf8ArrayToStr(t.slice(r,r+e));return{shift:e,value:i}}),t.P_STRING_VAR=(e=>(r,n=0)=>{const i=e(r,n),{value:o}=t.P_STRING_FIXED(i.value)(r,n+i.shift);return{shift:i.value+i.shift,value:o}}),t.P_BASE58_FIXED=(e=>(t,r=0)=>{return{value:i.default.encode(t.slice(r,r+e)),shift:e}}),t.P_BASE58_VAR=(e=>(r,n=0)=>{const i=e(r,n),{value:o}=t.P_BASE58_FIXED(i.value)(r,n+2);return{shift:i.value+2,value:o}}),t.P_BASE64=(e=>(t,r=0)=>{const n=e(t,r),i=`base64:${o.fromByteArray(t.slice(r+n.shift,r+n.shift+n.value))}`;return{shift:n.value+n.shift,value:i}});t.byteToStringWithLength=((e,r=0)=>{const i=t.P_SHORT(e,r),{value:o}=(e=>(t,r)=>{const i=n.Utf8ArrayToStr(t.slice(r,r+e));return{shift:e,value:i}})(i.value)(e,r+2);return{shift:i.value+2,value:o}}),t.byteToBase58=((e,t=0,r)=>{const n=r||32;return{value:i.default.encode(e.slice(t,t+n)),shift:n}}),t.byteToBase58WithLength=((e,r=0)=>{const n=t.P_SHORT(e,r);return{value:i.default.encode(e.slice(r+n.shift,r+n.shift+n.value)),shift:n.shift+n.value}}),t.byteToAddressOrAlias=((e,r=0)=>{if(e[r]===t.ALIAS_VERSION){const n=t.byteToStringWithLength(e,r+2);return{shift:n.shift+2,value:`alias:${String.fromCharCode(e[r+1])}:${n.value}`}}return t.byteToBase58(e,r,26)}),t.byteNewAliasToString=((e,r=0)=>{const n=t.P_SHORT(e,r).value+2,{value:i}=t.byteToStringWithLength(e,r);return{shift:n,value:i}}),t.byteToScript=((e,r=0)=>{if(0===e[r])return{shift:1,value:null};const n=t.P_SHORT(e,r+1),i=r+1+n.shift,s=r+1+n.shift+n.value;return{value:`base64:${o.fromByteArray(e.slice(i,s))}`,shift:s-r}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(8),o=r(11),s=r(12);t.json=s;const a=r(1);t.serializePrimitives=a;const c=r(3);t.parsePrimitives=c;const u=r(0);t.schemas=u;const f={serializerFromSchema:i.serializerFromSchema,serializeTx:i.serializeTx,serializeOrder:i.serializeOrder,parserFromSchema:o.parserFromSchema,parseTx:o.parseTx,parseOrder:o.parseOrder};function l(e,t,r,n){const s=i.serializerFromSchema(t,n),a=o.parserFromSchema(t,r)(s(e)).value;return Object.assign({},e,a)}t.binary=f,t.convertLongFields=l,t.convertTxLongFields=function(e,t,r){const{type:i,version:o}=e;return l(e,n.getTransactionSchema(i,o),t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",i=n.split("").reduce((e,t,r)=>(e[t]=r,e),{});t.default={encode(e){if(!e.length)return"";const t=[0];for(let r=0;r<e.length;r++){for(let e=0;e<t.length;e++)t[e]<<=8;t[0]+=e[r];let n=0;for(let e=0;e<t.length;e++)t[e]+=n,n=t[e]/58|0,t[e]%=58;for(;n;)t.push(n%58),n=n/58|0}for(let r=0;0===e[r]&&r<e.length-1;r++)t.push(0);return t.reverse().map(function(e){return n[e]}).join("")},decode(e){if(!e.length)return new Uint8Array(0);const t=[0];for(let r=0;r<e.length;r++){const n=e[r];if(!(n in i))throw new Error(`There is no character "${n}" in the Base58 sequence!`);for(let e=0;e<t.length;e++)t[e]*=58;t[0]+=i[n];let o=0;for(let e=0;e<t.length;e++)t[e]+=o,o=t[e]>>8,t[e]&=255;for(;o;)t.push(255&o),o>>=8}for(let r=0;"1"===e[r]&&r<e.length-1;r++)t.push(0);return new Uint8Array(t.reverse())}}},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=u(e),n=r[0],s=r[1],a=new o(function(e,t,r){return 3*(t+r)/4-r}(0,n,s)),c=0,f=s>0?n-4:n,l=0;l<f;l+=4)t=i[e.charCodeAt(l)]<<18|i[e.charCodeAt(l+1)]<<12|i[e.charCodeAt(l+2)]<<6|i[e.charCodeAt(l+3)],a[c++]=t>>16&255,a[c++]=t>>8&255,a[c++]=255&t;2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[c++]=255&t);1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[c++]=t>>8&255,a[c++]=255&t);return a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(f(e,s,s+16383>a?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t,r){!function(e){"use strict";var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,n=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",s=1e14,a=14,c=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],f=1e7,l=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=a-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function y(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,u=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function m(e,t,r,o){if(e<t||e>r||e!==n(e))throw Error(i+(o||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function d(e){var t=e.c.length-1;return h(e.e/a)==t&&e.c[t]%2!=0}function g(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var b=function e(b){var v,A,N,E,O,_,T,B,w,I=H.prototype={constructor:H,toString:null,valueOf:null},P=new H(1),R=20,F=4,L=-7,j=21,U=-1e7,D=1e7,C=!1,V=1,x=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz";function H(e,r){var i,s,u,f,l,h,p,y,d=this;if(!(d instanceof H))return new H(e,r);if(null==r){if(e&&!0===e._isBigNumber)return d.s=e.s,void(!e.c||e.e>D?d.c=d.e=null:e.e<U?d.c=[d.e=0]:(d.e=e.e,d.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(d.s=1/e<0?(e=-e,-1):1,e===~~e){for(f=0,l=e;l>=10;l/=10,f++);return void(f>D?d.c=d.e=null:(d.e=f,d.c=[e]))}y=String(e)}else{if(!t.test(y=String(e)))return N(d,y,h);d.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(f=y.indexOf("."))>-1&&(y=y.replace(".","")),(l=y.search(/e/i))>0?(f<0&&(f=l),f+=+y.slice(l+1),y=y.substring(0,l)):f<0&&(f=y.length)}else{if(m(r,2,G.length,"Base"),10==r)return K(d=new H(e),R+d.e+1,F);if(y=String(e),h="number"==typeof e){if(0*e!=0)return N(d,y,h,r);if(d.s=1/e<0?(y=y.slice(1),-1):1,H.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(o+e)}else d.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(i=G.slice(0,r),f=l=0,p=y.length;l<p;l++)if(i.indexOf(s=y.charAt(l))<0){if("."==s){if(l>f){f=p;continue}}else if(!u&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){u=!0,l=-1,f=0;continue}return N(d,String(e),h,r)}h=!1,(f=(y=A(y,r,10,d.s)).indexOf("."))>-1?y=y.replace(".",""):f=y.length}for(l=0;48===y.charCodeAt(l);l++);for(p=y.length;48===y.charCodeAt(--p););if(y=y.slice(l,++p)){if(p-=l,h&&H.DEBUG&&p>15&&(e>c||e!==n(e)))throw Error(o+d.s*e);if((f=f-l-1)>D)d.c=d.e=null;else if(f<U)d.c=[d.e=0];else{if(d.e=f,d.c=[],l=(f+1)%a,f<0&&(l+=a),l<p){for(l&&d.c.push(+y.slice(0,l)),p-=a;l<p;)d.c.push(+y.slice(l,l+=a));l=a-(y=y.slice(l)).length}else l-=p;for(;l--;y+="0");d.c.push(+y)}}else d.c=[d.e=0]}function z(e,t,r,n){var i,o,s,a,c;if(null==r?r=F:m(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=p(e.c),c=1==n||2==n&&(s<=L||s>=j)?g(c,s):S(c,s,"0");else if(o=(e=K(new H(e),t,r)).e,a=(c=p(e.c)).length,1==n||2==n&&(t<=o||o<=L)){for(;a<t;c+="0",a++);c=g(c,o)}else if(t-=s,c=S(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function k(e,t){for(var r,n=1,i=new H(e[0]);n<e.length;n++){if(!(r=new H(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function Y(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*a-1)>D?e.c=e.e=null:r<U?e.c=[e.e=0]:(e.e=r,e.c=t),e}function K(e,t,i,o){var c,f,l,h,p,y,m,d=e.c,g=u;if(d){e:{for(c=1,h=d[0];h>=10;h/=10,c++);if((f=t-c)<0)f+=a,l=t,m=(p=d[y=0])/g[c-l-1]%10|0;else if((y=r((f+1)/a))>=d.length){if(!o)break e;for(;d.length<=y;d.push(0));p=m=0,c=1,l=(f%=a)-a+1}else{for(p=h=d[y],c=1;h>=10;h/=10,c++);m=(l=(f%=a)-a+c)<0?0:p/g[c-l-1]%10|0}if(o=o||t<0||null!=d[y+1]||(l<0?p:p%g[c-l-1]),o=i<4?(m||o)&&(0==i||i==(e.s<0?3:2)):m>5||5==m&&(4==i||o||6==i&&(f>0?l>0?p/g[c-l]:0:d[y-1])%10&1||i==(e.s<0?8:7)),t<1||!d[0])return d.length=0,o?(t-=e.e+1,d[0]=g[(a-t%a)%a],e.e=-t||0):d[0]=e.e=0,e;if(0==f?(d.length=y,h=1,y--):(d.length=y+1,h=g[a-f],d[y]=l>0?n(p/g[c-l]%g[l])*h:0),o)for(;;){if(0==y){for(f=1,l=d[0];l>=10;l/=10,f++);for(l=d[0]+=h,h=1;l>=10;l/=10,h++);f!=h&&(e.e++,d[0]==s&&(d[0]=1));break}if(d[y]+=h,d[y]!=s)break;d[y--]=0,h=1}for(f=d.length;0===d[--f];d.pop());}e.e>D?e.c=e.e=null:e.e<U&&(e.c=[e.e=0])}return e}function $(e){var t,r=e.e;return null===r?e.toString():(t=p(e.c),t=r<=L||r>=j?g(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(r=e[t],0,l,t),R=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(r=e[t],0,8,t),F=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(m(r[0],-l,0,t),m(r[1],0,l,t),L=r[0],j=r[1]):(m(r,-l,l,t),L=-(j=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)m(r[0],-l,-1,t),m(r[1],1,l,t),U=r[0],D=r[1];else{if(m(r,-l,l,t),!r)throw Error(i+t+" cannot be zero: "+r);U=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(i+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!r,Error(i+"crypto unavailable");C=r}else C=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(r=e[t],0,9,t),V=r),e.hasOwnProperty(t="POW_PRECISION")&&(m(r=e[t],0,l,t),x=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(i+t+" not an object: "+r);M=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(i+t+" invalid: "+r);G=r}}return{DECIMAL_PLACES:R,ROUNDING_MODE:F,EXPONENTIAL_AT:[L,j],RANGE:[U,D],CRYPTO:C,MODULO_MODE:V,POW_PRECISION:x,FORMAT:M,ALPHABET:G}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,r,o=e.c,c=e.e,u=e.s;e:if("[object Array]"=={}.toString.call(o)){if((1===u||-1===u)&&c>=-l&&c<=l&&c===n(c)){if(0===o[0]){if(0===c&&1===o.length)return!0;break e}if((t=(c+1)%a)<1&&(t+=a),String(o[0]).length==t){for(t=0;t<o.length;t++)if((r=o[t])<0||r>=s||r!==n(r))break e;if(0!==r)return!0}}}else if(null===o&&null===c&&(null===u||1===u||-1===u))return!0;throw Error(i+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return k(arguments,I.lt)},H.minimum=H.min=function(){return k(arguments,I.gt)},H.random=(E=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,o,s,c,f,h=0,p=[],y=new H(P);if(null==e?e=R:m(e,0,l),c=r(e/a),C)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(c*=2));h<c;)(f=131072*t[h]+(t[h+1]>>>11))>=9e15?(o=crypto.getRandomValues(new Uint32Array(2)),t[h]=o[0],t[h+1]=o[1]):(p.push(f%1e14),h+=2);h=c/2}else{if(!crypto.randomBytes)throw C=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(c*=7);h<c;)(f=281474976710656*(31&t[h])+1099511627776*t[h+1]+4294967296*t[h+2]+16777216*t[h+3]+(t[h+4]<<16)+(t[h+5]<<8)+t[h+6])>=9e15?crypto.randomBytes(7).copy(t,h):(p.push(f%1e14),h+=7);h=c/7}if(!C)for(;h<c;)(f=E())<9e15&&(p[h++]=f%1e14);for(c=p[--h],e%=a,c&&e&&(f=u[a-e],p[h]=n(c/f)*f);0===p[h];p.pop(),h--);if(h<0)p=[s=0];else{for(s=-1;0===p[0];p.splice(0,1),s-=a);for(h=1,f=p[0];f>=10;f/=10,h++);h<a&&(s-=a-h)}return y.e=s,y.c=p,y}),H.sum=function(){for(var e=1,t=arguments,r=new H(t[0]);e<t.length;)r=r.plus(t[e++]);return r},A=function(){function e(e,t,r,n){for(var i,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,r,n,i,o){var s,a,c,u,f,l,h,y,m=t.indexOf("."),d=R,g=F;for(m>=0&&(u=x,x=0,t=t.replace(".",""),l=(y=new H(r)).pow(t.length-m),x=u,y.c=e(S(p(l.c),l.e,"0"),10,n,"0123456789"),y.e=y.c.length),c=u=(h=e(t,r,n,o?(s=G,"0123456789"):(s="0123456789",G))).length;0==h[--u];h.pop());if(!h[0])return s.charAt(0);if(m<0?--c:(l.c=h,l.e=c,l.s=i,h=(l=v(l,y,d,g,n)).c,f=l.r,c=l.e),m=h[a=c+d+1],u=n/2,f=f||a<0||null!=h[a+1],f=g<4?(null!=m||f)&&(0==g||g==(l.s<0?3:2)):m>u||m==u&&(4==g||f||6==g&&1&h[a-1]||g==(l.s<0?8:7)),a<1||!h[0])t=f?S(s.charAt(1),-d,s.charAt(0)):s.charAt(0);else{if(h.length=a,f)for(--n;++h[--a]>n;)h[a]=0,a||(++c,h=[1].concat(h));for(u=h.length;!h[--u];);for(m=0,t="";m<=u;t+=s.charAt(h[m++]));t=S(t,c,s.charAt(0))}return t}}(),v=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%f,l=t/f|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%f)+(n=l*o+(s=e[c]/f|0)*u)%f*f+a)/r|0)+(n/f|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,c,u,f){var l,p,y,m,d,g,S,b,v,A,N,E,O,_,T,B,w,I=i.s==o.s?1:-1,P=i.c,R=o.c;if(!(P&&P[0]&&R&&R[0]))return new H(i.s&&o.s&&(P?!R||P[0]!=R[0]:R)?P&&0==P[0]||!R?0*I:I/0:NaN);for(v=(b=new H(I)).c=[],I=c+(p=i.e-o.e)+1,f||(f=s,p=h(i.e/a)-h(o.e/a),I=I/a|0),y=0;R[y]==(P[y]||0);y++);if(R[y]>(P[y]||0)&&p--,I<0)v.push(1),m=!0;else{for(_=P.length,B=R.length,y=0,I+=2,(d=n(f/(R[0]+1)))>1&&(R=e(R,d,f),P=e(P,d,f),B=R.length,_=P.length),O=B,N=(A=P.slice(0,B)).length;N<B;A[N++]=0);w=R.slice(),w=[0].concat(w),T=R[0],R[1]>=f/2&&T++;do{if(d=0,(l=t(R,A,B,N))<0){if(E=A[0],B!=N&&(E=E*f+(A[1]||0)),(d=n(E/T))>1)for(d>=f&&(d=f-1),S=(g=e(R,d,f)).length,N=A.length;1==t(g,A,S,N);)d--,r(g,B<S?w:R,S,f),S=g.length,l=1;else 0==d&&(l=d=1),S=(g=R.slice()).length;if(S<N&&(g=[0].concat(g)),r(A,g,N,f),N=A.length,-1==l)for(;t(R,A,B,N)<1;)d++,r(A,B<N?w:R,N,f),N=A.length}else 0===l&&(d++,A=[0]);v[y++]=d,A[0]?A[N++]=P[O]||0:(A=[P[O]],N=1)}while((O++<_||null!=A[0])&&I--);m=null!=A[0],v[0]||v.splice(0,1)}if(f==s){for(y=1,I=v[0];I>=10;I/=10,y++);K(b,c+(b.e=y+p*a-1)+1,u,m)}else b.e=p,b.r=+m;return b}}(),O=/^(-?)0([xbo])(?=\w[\w.]*$)/i,_=/^([^.]+)\.$/,T=/^\.([^.]+)$/,B=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var o,s=r?t:t.replace(w,"");if(B.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(O,function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t}),n&&(o=n,s=s.replace(_,"$1").replace(T,"0.$1")),t!=s))return new H(s,o);if(H.DEBUG)throw Error(i+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},I.absoluteValue=I.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},I.comparedTo=function(e,t){return y(this,new H(e,t))},I.decimalPlaces=I.dp=function(e,t){var r,n,i,o=this;if(null!=e)return m(e,0,l),null==t?t=F:m(t,0,8),K(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-h(this.e/a))*a,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(e,t){return v(this,new H(e,t),R,F)},I.dividedToIntegerBy=I.idiv=function(e,t){return v(this,new H(e,t),0,1)},I.exponentiatedBy=I.pow=function(e,t){var o,s,c,u,f,l,h,p,y=this;if((e=new H(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+$(e));if(null!=t&&(t=new H(t)),f=e.e>14,!y.c||!y.c[0]||1==y.c[0]&&!y.e&&1==y.c.length||!e.c||!e.c[0])return p=new H(Math.pow(+$(y),f?2-d(e):+$(e))),t?p.mod(t):p;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(s=!l&&y.isInteger()&&t.isInteger())&&(y=y.mod(t))}else{if(e.e>9&&(y.e>0||y.e<-1||(0==y.e?y.c[0]>1||f&&y.c[1]>=24e7:y.c[0]<8e13||f&&y.c[0]<=9999975e7)))return u=y.s<0&&d(e)?-0:0,y.e>-1&&(u=1/u),new H(l?1/u:u);x&&(u=r(x/a+2))}for(f?(o=new H(.5),l&&(e.s=1),h=d(e)):h=(c=Math.abs(+$(e)))%2,p=new H(P);;){if(h){if(!(p=p.times(y)).c)break;u?p.c.length>u&&(p.c.length=u):s&&(p=p.mod(t))}if(c){if(0===(c=n(c/2)))break;h=c%2}else if(K(e=e.times(o),e.e+1,1),e.e>14)h=d(e);else{if(0==(c=+$(e)))break;h=c%2}y=y.times(y),u?y.c&&y.c.length>u&&(y.c.length=u):s&&(y=y.mod(t))}return s?p:(l&&(p=P.div(p)),t?p.mod(t):u?K(p,x,F,void 0):p)},I.integerValue=function(e){var t=new H(this);return null==e?e=F:m(e,0,8),K(t,t.e+1,e)},I.isEqualTo=I.eq=function(e,t){return 0===y(this,new H(e,t))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(e,t){return y(this,new H(e,t))>0},I.isGreaterThanOrEqualTo=I.gte=function(e,t){return 1===(t=y(this,new H(e,t)))||0===t},I.isInteger=function(){return!!this.c&&h(this.e/a)>this.c.length-2},I.isLessThan=I.lt=function(e,t){return y(this,new H(e,t))<0},I.isLessThanOrEqualTo=I.lte=function(e,t){return-1===(t=y(this,new H(e,t)))||0===t},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(e,t){var r,n,i,o,c=this,u=c.s;if(t=(e=new H(e,t)).s,!u||!t)return new H(NaN);if(u!=t)return e.s=-t,c.plus(e);var f=c.e/a,l=e.e/a,p=c.c,y=e.c;if(!f||!l){if(!p||!y)return p?(e.s=-t,e):new H(y?c:NaN);if(!p[0]||!y[0])return y[0]?(e.s=-t,e):new H(p[0]?c:3==F?-0:0)}if(f=h(f),l=h(l),p=p.slice(),u=f-l){for((o=u<0)?(u=-u,i=p):(l=f,i=y),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(o=(u=p.length)<(t=y.length))?u:t,u=t=0;t<n;t++)if(p[t]!=y[t]){o=p[t]<y[t];break}if(o&&(i=p,p=y,y=i,e.s=-e.s),(t=(n=y.length)-(r=p.length))>0)for(;t--;p[r++]=0);for(t=s-1;n>u;){if(p[--n]<y[n]){for(r=n;r&&!p[--r];p[r]=t);--p[r],p[n]+=s}p[n]-=y[n]}for(;0==p[0];p.splice(0,1),--l);return p[0]?Y(e,p,l):(e.s=3==F?-1:1,e.c=[e.e=0],e)},I.modulo=I.mod=function(e,t){var r,n,i=this;return e=new H(e,t),!i.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||i.c&&!i.c[0]?new H(i):(9==V?(n=e.s,e.s=1,r=v(i,e,0,3),e.s=n,r.s*=n):r=v(i,e,0,V),(e=i.minus(r.times(e))).c[0]||1!=V||(e.s=i.s),e)},I.multipliedBy=I.times=function(e,t){var r,n,i,o,c,u,l,p,y,m,d,g,S,b,v,A=this,N=A.c,E=(e=new H(e,t)).c;if(!(N&&E&&N[0]&&E[0]))return!A.s||!e.s||N&&!N[0]&&!E||E&&!E[0]&&!N?e.c=e.e=e.s=null:(e.s*=A.s,N&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(A.e/a)+h(e.e/a),e.s*=A.s,(l=N.length)<(m=E.length)&&(S=N,N=E,E=S,i=l,l=m,m=i),i=l+m,S=[];i--;S.push(0));for(b=s,v=f,i=m;--i>=0;){for(r=0,d=E[i]%v,g=E[i]/v|0,o=i+(c=l);o>i;)r=((p=d*(p=N[--c]%v)+(u=g*p+(y=N[c]/v|0)*d)%v*v+S[o]+r)/b|0)+(u/v|0)+g*y,S[o--]=p%b;S[o]=r}return r?++n:S.splice(0,1),Y(e,S,n)},I.negated=function(){var e=new H(this);return e.s=-e.s||null,e},I.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new H(e,t)).s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/a,c=e.e/a,u=n.c,f=e.c;if(!o||!c){if(!u||!f)return new H(i/0);if(!u[0]||!f[0])return f[0]?e:new H(u[0]?n:0*i)}if(o=h(o),c=h(c),u=u.slice(),i=o-c){for(i>0?(c=o,r=f):(i=-i,r=u),r.reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=f.length)<0&&(r=f,f=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+f[t]+i)/s|0,u[t]=s===u[t]?0:u[t]%s;return i&&(u=[i].concat(u),++c),Y(e,u,c)},I.precision=I.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return m(e,1,l),null==t?t=F:m(t,0,8),K(new H(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*a+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},I.shiftedBy=function(e){return m(e,-c,c),this.times("1e"+e)},I.squareRoot=I.sqrt=function(){var e,t,r,n,i,o=this,s=o.c,a=o.s,c=o.e,u=R+4,f=new H("0.5");if(1!==a||!s||!s[0])return new H(!a||a<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(a=Math.sqrt(+$(o)))||a==1/0?(((t=p(s)).length+c)%2==0&&(t+="0"),a=Math.sqrt(+t),c=h((c+1)/2)-(c<0||c%2),r=new H(t=a==1/0?"1e"+c:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+c)):r=new H(a+""),r.c[0])for((a=(c=r.e)+u)<3&&(a=0);;)if(i=r,r=f.times(i.plus(v(o,i,u,1))),p(i.c).slice(0,a)===(t=p(r.c)).slice(0,a)){if(r.e<c&&--a,"9999"!=(t=t.slice(a-3,a+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(r,r.e+R+2,1),e=!r.times(r).eq(o));break}if(!n&&(K(i,i.e+R+2,0),i.times(i).eq(o))){r=i;break}u+=4,a+=4,n=1}return K(r,r.e+R+1,F,e)},I.toExponential=function(e,t){return null!=e&&(m(e,0,l),e++),z(this,e,t,1)},I.toFixed=function(e,t){return null!=e&&(m(e,0,l),e=e+this.e+1),z(this,e,t)},I.toFormat=function(e,t,r){var n,o=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=M;else if("object"!=typeof r)throw Error(i+"Argument not an object: "+r);if(n=o.toFixed(e,t),o.c){var s,a=n.split("."),c=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=a[0],h=a[1],p=o.s<0,y=p?l.slice(1):l,m=y.length;if(u&&(s=c,c=u,u=s,m-=s),c>0&&m>0){for(s=m%c||c,l=y.substr(0,s);s<m;s+=c)l+=f+y.substr(s,c);u>0&&(l+=f+y.slice(s)),p&&(l="-"+l)}n=h?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(e){var t,r,n,o,s,c,f,l,h,y,m,d,g=this,S=g.c;if(null!=e&&(!(f=new H(e)).isInteger()&&(f.c||1!==f.s)||f.lt(P)))throw Error(i+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+$(f));if(!S)return new H(g);for(t=new H(P),h=r=new H(P),n=l=new H(P),d=p(S),s=t.e=d.length-g.e-1,t.c[0]=u[(c=s%a)<0?a+c:c],e=!e||f.comparedTo(t)>0?s>0?t:h:f,c=D,D=1/0,f=new H(d),l.c[0]=0;y=v(f,t,0,1),1!=(o=r.plus(y.times(n))).comparedTo(e);)r=n,n=o,h=l.plus(y.times(o=h)),l=o,t=f.minus(y.times(o=t)),f=o;return o=v(e.minus(r),n,0,1),l=l.plus(o.times(h)),r=r.plus(o.times(n)),l.s=h.s=g.s,m=v(h,n,s*=2,F).minus(g).abs().comparedTo(v(l,r,s,F).minus(g).abs())<1?[h,n]:[l,r],D=c,m},I.toNumber=function(){return+$(this)},I.toPrecision=function(e,t){return null!=e&&m(e,1,l),z(this,e,t,2)},I.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=L||i>=j?g(p(r.c),i):S(p(r.c),i,"0"):10===e?t=S(p((r=K(new H(r),R+i+1,F)).c),r.e,"0"):(m(e,2,G.length,"Base"),t=A(S(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},I.valueOf=I.toJSON=function(){return $(this)},I._isBigNumber=!0,I[Symbol.toStringTag]="BigNumber",I[Symbol.for("nodejs.util.inspect.custom")]=I.valueOf,null!=b&&H.set(b),H}(),v=function(){return(v=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},A=function(){function e(){this.format=e.DEFAULT_FORMAT,b.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=v({},this.format,e.FORMAT),e.FORMAT=this.format),b.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();e.BigNumber=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=4),new e(this.bn.dp(t||0,r))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.toBytes=function(){if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");var t=this.isNegative(),r=t?"1":"0",n=e._toLength(64,this.bn.plus(r).abs().toString(2).replace("-","")).split(""),i=[];do{i.push(parseInt(n.splice(0,8).join(""),2))}while(n.length);return t?Uint8Array.from(i.map(function(e){return 255-e})):Uint8Array.from(i)},e.prototype.toFormat=function(e,t,r){return this.bn.toFormat(e,t,r)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.fromBytes=function(t){if(8!==t.length)throw new Error("Wrong bytes length! Need 8 bytes!");var r=t[0]>127,n=Array.from(t).map(function(e){return r?255-e:e}).map(function(t){return e._toLength(8,t.toString(2))}).join(""),i=new e(new b(n,2));return r?i.mul(-1).sub(1):i},e.max=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce(function(e,t){return e.gte(t)?e:t})},e.min=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce(function(e,t){return e.lte(t)?e:t})},e.sum=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce(function(e,t){return e.add(t)})},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter(function(e){return"_"!==e[0].charAt(0)}).every(function(e){var r=e[0],n=e[1];return r in t&&typeof n==typeof t[r]}))},e.toBigNumber=function(t){return Array.isArray(t)?t.map(function(t){return new e(t)}):new e(t)},e.toBigNumberJs=function(t){return b.isBigNumber(t)?t:t instanceof e?t.bn:new b(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MAX_VALUE=new e("9223372036854775807"),e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new A,e}(),function(e){!function(e){e[e.ROUND_UP=0]="ROUND_UP",e[e.ROUND_DOWN=1]="ROUND_DOWN",e[e.ROUND_CEIL=2]="ROUND_CEIL",e[e.ROUND_FLOOR=3]="ROUND_FLOOR",e[e.ROUND_HALF_UP=4]="ROUND_HALF_UP",e[e.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",e[e.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",e[e.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",e[e.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(e.ROUND_MODE||(e.ROUND_MODE={}))}(e.BigNumber||(e.BigNumber={}));var N=e.BigNumber;e.default=N,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),i=r(2),o=r(0);t.serializerFromSchema=((e,r)=>o=>{let s,a;if("array"===e.type)return s=t.serializerFromSchema(e.items,r),a=i.concat(...o.map(e=>s(e))),i.concat((e.toBytes||n.SHORT)(o.length),a);if("object"===e.type){let n=Uint8Array.from([]);if(e.optional&&null==o)return Uint8Array.from([0]);if(e.schema.forEach(e=>{const[c,u]=e;let f;f=Array.isArray(c)?c.reduce((e,t)=>Object.assign({},e,{[t]:o[t]}),{}):o[c],s=t.serializerFromSchema(u,r),a=s(f),n=i.concat(n,a)}),e.withLength){const t=e.withLength.toBytes(n.length);n=i.concat(t,n)}return e.optional&&(n=i.concat([1],n)),n}if("anyOf"===e.type){const c=o[e.discriminatorField],u=e.itemByKey(c);if(null==u)throw new Error(`Serializer Error: Unknown anyOf type: ${c}`);return"boolean"===u.strKey&&6===u.key&&!1===o.value&&(u.key=7),s=t.serializerFromSchema(u.schema,r),null==e.valueField?s(o):(a=s(o[e.valueField]),i.concat((e.toBytes||n.BYTE)(u.key),a))}if("primitive"===e.type||void 0===e.type)return e.toBytes(o);if("dataTxField"===e.type){const c=n.LEN(n.SHORT)(n.STRING)(o.key),u=o.type,f=e.items.get(u);if(null==f)throw new Error(`Serializer Error: Unknown dataTxField type: ${u}`);const l=[...e.items.values()].findIndex(e=>e===f);return s=t.serializerFromSchema(f,r),a=s(o.value),i.concat(c,n.BYTE(l),a)}throw new Error(`Serializer Error: Unknown schema type: ${e.type}`)}),t.serializeTx=function(e,r){const{type:n,version:i}=e,s=o.getTransactionSchema(n,i);return t.serializerFromSchema(s,r)(e)},t.serializeOrder=function(e,r){const n=e.version||1,i=o.orderVersionMap[n];if(null==i)throw new Error(`Unknown order version: ${n}`);return t.serializerFromSchema(i,r)(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i,o;t.Utf8ArrayToStr=(n=new Array(128),i=String.fromCodePoint||String.fromCharCode,o=[],function(e){var t,r,s=e.length;o.length=0;for(var a=0;a<s;)(r=e[a++])<=127?t=r:r<=223?t=(31&r)<<6|63&e[a++]:r<=239?t=(15&r)<<12|(63&e[a++])<<6|63&e[a++]:String.fromCodePoint?t=(7&r)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++]:(t=63,a+=3),o.push(n[t]||(n[t]=i(t)));return o.join("")})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.INTEGER="integer",e.BOOLEAN="boolean",e.STRING="string",e.BINARY="binary"}(t.DATA_FIELD_TYPE||(t.DATA_FIELD_TYPE={})),t.anyOf=function(e,t){return new n(e,t)};class n{constructor(e,t){this._items=e,this.type="anyOf",this.discriminatorField="type",this.discriminatorBytePos=0,Object.assign(this,t)}itemByKey(e){const t=this._items.find(([t,r,n])=>n===e||t==e);return t&&{schema:t[1],key:t[0],strKey:t[2]}}itemByByteKey(e){const t=this._items.find(([t,r])=>t===e);return t&&{schema:t[1],key:t[0],strKey:t[2]||t[0].toString(10)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(3),i=r(2),o=r(0);t.parserFromSchema=((e,r)=>(o,s=0)=>{let a=s;if("array"===e.type){const c=[],{value:u,shift:f}=(e.fromBytes||n.P_SHORT)(o,s);return a+=f,i.range(0,u).forEach(n=>{const i=t.parserFromSchema(e.items,r),{value:s,shift:u}=i(o,a);c.push(s),a+=u}),{value:c,shift:a-s}}if("object"===e.type){if(e.optional){const e=1===o[a];if(a+=1,!e)return{value:void 0,shift:1}}if(e.withLength){const t=e.withLength.fromBytes(o,a);a+=t.shift}const n={};return e.schema.forEach(e=>{const[i,s]=e,c=t.parserFromSchema(s,r),{value:u,shift:f}=c(o,a);a+=f,void 0!==u&&(Array.isArray(i)?Object.assign(n,u):n[i]=u)}),{value:n,shift:a-s}}if("anyOf"===e.type){const i=(e.fromBytes||n.P_BYTE)(o,a+e.discriminatorBytePos);e.valueField&&0===e.discriminatorBytePos&&(a+=i.shift);const c=e.itemByByteKey(i.value);if(null==c)throw new Error(`Failed to get schema for item with bytecode: ${i.value}`);const u=t.parserFromSchema(c.schema,r),{value:f,shift:l}=u(o,a);return a+=l,{value:e.valueField?{[e.discriminatorField]:c.strKey,[e.valueField]:f}:f,shift:a-s}}if("dataTxField"===e.type){const i=n.byteToStringWithLength(o,a);a+=i.shift;let s=n.P_BYTE(o,a);a+=s.shift;const c=[...e.items].find((e,t)=>t===s.value);if(!c)throw new Error(`Parser Error: Unknown dataTxField type: ${s.value}`);const u=t.parserFromSchema(c[1],r)(o,a);return{value:{value:u.value,key:i.value,type:c[0]},shift:u.shift+i.shift+s.shift}}if("primitive"===e.type||void 0===e.type){const t=e.fromBytes;let{value:i,shift:a}=t(o,s);return t===n.P_LONG&&r&&(i=r(i)),{value:i,shift:a}}throw new Error(`Parser Error: Unknown schema type: ${e.type}`)}),t.parseHeader=(e=>{let t=0,r=n.P_BYTE(e,t);t+=r.shift,0===r.value&&(t+=(r=n.P_BYTE(e,t)).shift);let i=n.P_BYTE(e,t);return{type:r.value,version:i.value}}),t.parseTx=function(e,r){const{type:n,version:i}=t.parseHeader(e),s=o.getTransactionSchema(n,i);return t.parserFromSchema(s,r)(e).value},t.parseOrder=function(e,r){return t.parserFromSchema(o.orderSchemaV2,r)(e).value}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(13),{parse:i,stringify:o}=n(),s=r(0),a=r(1),c=r(4);function u(e,t){return 0===e.length?t:"object"==typeof t?u(e.slice(1),t[e[0]]):void 0}const f=(e,t,r)=>{return function t(n,i){if(null==i)return!1;if(0===n.length&&("primitive"===i.type||void 0===i.type))return i.toBytes===a.LONG;if("object"===i.type){const e=i.schema.find(([e,t])=>e===n[0]);return t(n.slice(1),e&&e[1])}if("array"===i.type)return t(n.slice(1),i.items);if("dataTxField"===i.type){if("value"!==n[0])return!1;const o=u(e.slice(0,e.length-1),r),s=i.items.get(o.type);return t(n.slice(1),s)}if("anyOf"===i.type){const o=u(e.slice(0,e.length-1),r)[i.discriminatorField],s=i.itemByKey(o);return!!s&&(null!=i.valueField&&e[e.length-1]===i.valueField?t(n.slice(1),s.schema):t(n,s.schema))}return!1}(e,t)};function l(e,t){const r=[],n=[];function i(s){return"string"==typeof s&&f(r,t,e)?s:"boolean"==typeof s||s instanceof Boolean||null===s||"number"==typeof s||s instanceof Number||"string"==typeof s||s instanceof String||s instanceof Date?JSON.stringify(s):Array.isArray(s)?function(e){let t="[";const o=n.length;n[o]=e;for(let n=0;n<e.length;n++){let s=n+"",a=e[n];void 0!==a&&"function"!=typeof a?(r[o]=s,t+=i(a)):t+="null",n<e.length-1&&(t+=",")}return n.length=o,r.length=o,t+="]"}(s):s&&"object"==typeof s?function(e){let t=!0,s="{";const a=n.length;n[a]=e;for(let n in e)if(e.hasOwnProperty(n)){let c=e[n];o(c)&&(t?t=!1:s+=",",s+='"'+n+'":',r[a]=n,s+=i(c))}return n.length=a,r.length=a,s+="}"}(s):void 0}function o(e){return void 0!==e&&"function"!=typeof e}return i(e)||""}t.stringifyWithSchema=l,t.parseTx=function(e,t){const r=i(e);return t?c.convertTxLongFields(r,t):r},t.stringifyTx=function(e,t){const{type:r,version:n}=e,i=s.getTransactionSchema(r,n);return l(c.convertLongFields(e,i,void 0,t),i)},t.parseOrder=function(e,t){const r=i(e),n=2===r.version?s.orderSchemaV2:s.orderSchemaV1;return t?c.convertLongFields(r,n,t):r},t.stringifyOrder=function(e,t){const r=2===e.version?s.orderSchemaV2:s.orderSchemaV1;return l(c.convertLongFields(e,r,void 0,t),r)}},function(e,t,r){"use strict";e.exports=function(e){var t={strict:!1};null!=e&&!0===e.strict&&(t.strict=!0);var r,n,i,o,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},a=function(e){throw{name:"SyntaxError",message:e,at:r,text:i}},c=function(e){return e&&e!==n&&a("Expected '"+e+"' instead of '"+n+"'"),n=i.charAt(r),r+=1,n},u=function(){var t,r="";for("-"===n&&(r="-",c("-"));n>="0"&&n<="9";)r+=n,c();if("."===n)for(r+=".";c()&&n>="0"&&n<="9";)r+=n;if("e"===n||"E"===n)for(r+=n,c(),"-"!==n&&"+"!==n||(r+=n,c());n>="0"&&n<="9";)r+=n,c();return t=+r,e&&e.parse?e.parse(r):isFinite(t)?r.length>15?r:t:void a("Bad number")},f=function(){var e,t,r,i="";if('"'===n)for(;c();){if('"'===n)return c(),i;if("\\"===n)if(c(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(c(),16),isFinite(e));t+=1)r=16*r+e;i+=String.fromCharCode(r)}else{if("string"!=typeof s[n])break;i+=s[n]}else i+=n}a("Bad string")},l=function(){for(;n&&n<=" ";)c()};o=function(){switch(l(),n){case"{":return function(){var e,r={};if("{"===n){if(c("{"),l(),"}"===n)return c("}"),r;for(;n;){if(e=f(),l(),c(":"),!0===t.strict&&Object.hasOwnProperty.call(r,e)&&a('Duplicate key "'+e+'"'),r[e]=o(),l(),"}"===n)return c("}"),r;c(","),l()}}a("Bad object")}();case"[":return function(){var e=[];if("["===n){if(c("["),l(),"]"===n)return c("]"),e;for(;n;){if(e.push(o()),l(),"]"===n)return c("]"),e;c(","),l()}}a("Bad array")}();case'"':return f();case"-":return u();default:return n>="0"&&n<="9"?u():function(){switch(n){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}a("Unexpected '"+n+"'")}()}};var h,p,y,m=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function g(e){return m.lastIndex=0,m.test(e)?'"'+e.replace(m,function(e){var t=d[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}return{parse:function(e,t){var s;return i=e+"",r=0,n=" ",s=o(),l(),n&&a("Syntax error"),"function"==typeof t?function e(r,n){var i,o=r[n];return o&&"object"==typeof o&&Object.keys(o).forEach(function(t){void 0!==(i=e(o,t))?o[t]=i:delete o[t]}),t.call(r,n,o)}({"":s},""):s},stringify:function(t,r,n){var i;if(h="",p="","number"==typeof n)for(i=0;i<n;i+=1)p+=" ";else"string"==typeof n&&(p=n);if(y=r,r&&"function"!=typeof r&&("object"!=typeof r||"number"!=typeof r.length))throw new Error("JSON.stringify");return function t(r,n){var i,o,s,a,c,u=h,f=n[r],l=e&&e.isInstance&&e.isInstance(f);switch(l&&!f.isFinite()&&(f=null),l?f=e.stringify(f):f&&"object"==typeof f&&"function"==typeof f.toJSON&&(f=f.toJSON(r)),"function"==typeof y&&(f=y.call(n,r,f)),typeof f){case"string":return l?f:g(f);case"number":return isFinite(f)?String(f):"null";case"boolean":return String(f);case"object":if(!f)return"null";if(h+=p,c=[],"[object Array]"===Object.prototype.toString.apply(f)){for(a=f.length,i=0;i<a;i+=1)c[i]=t(i,f)||"null";return s=0===c.length?"[]":h?"[\n"+h+c.join(",\n"+h)+"\n"+u+"]":"["+c.join(",")+"]",h=u,s}if(y&&"object"==typeof y)for(a=y.length,i=0;i<a;i+=1)"string"==typeof y[i]&&(s=t(o=y[i],f))&&c.push(g(o)+(h?": ":":")+s);else for(o in f)Object.prototype.hasOwnProperty.call(f,o)&&(s=t(o,f))&&c.push(g(o)+(h?": ":":")+s);return s=0===c.length?"{}":h?"{\n"+h+c.join(",\n"+h)+"\n"+u+"}":"{"+c.join(",")+"}",h=u,s}}("",{"":t})}}}}]); |
@@ -43,4 +43,4 @@ export declare const ALIAS_VERSION: number; | ||
export declare const byteToAddressOrAlias: (bytes: Uint8Array, start?: number) => { | ||
value: string; | ||
shift: number; | ||
value: string; | ||
}; | ||
@@ -47,0 +47,0 @@ export declare const byteNewAliasToString: (bytes: Uint8Array, start?: number) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Long = require("long"); | ||
const Utf8ArrayToStr_1 = require("./libs/Utf8ArrayToStr"); | ||
const base58_1 = require("./libs/base58"); | ||
const Base64 = require("base64-js"); | ||
const bignumber_1 = require("@waves/bignumber"); | ||
exports.ALIAS_VERSION = 2; | ||
@@ -22,3 +22,3 @@ const LENGTH_SIZE = 2; | ||
exports.P_LONG = (bytes, start = 0) => ({ | ||
value: Long.fromBytesBE(Array.from(bytes.slice(start, start + 8))).toString(), | ||
value: bignumber_1.BigNumber.fromBytes(Array.from(bytes.slice(start, start + 8))).toString(), | ||
shift: 8, | ||
@@ -25,0 +25,0 @@ }); |
@@ -6,3 +6,3 @@ "use strict"; | ||
const utils_1 = require("./libs/utils"); | ||
const Long = require("long"); | ||
const bignumber_1 = require("@waves/bignumber"); | ||
const stringToUint8Array = (str) => Uint8Array.from([...unescape(encodeURIComponent(str))].map(c => c.charCodeAt(0))); | ||
@@ -16,11 +16,11 @@ exports.empty = Uint8Array.from([]); | ||
exports.BYTE = (value) => Uint8Array.from([value]); | ||
exports.BOOL = (value) => exports.BYTE(value == true ? 1 : 0); | ||
exports.BOOL = (value) => exports.BYTE(value ? 1 : 0); | ||
exports.BYTES = (value) => Uint8Array.from(value); | ||
exports.SHORT = (value) => { | ||
const s = Long.fromNumber(value, true); | ||
return Uint8Array.from(s.toBytesBE().slice(6)); | ||
const b = new bignumber_1.BigNumber(Math.floor(value)).toBytes(); | ||
return Uint8Array.from(Array.from({ length: 2 }, (_, i) => b[i - 2 + b.length] || 0)); | ||
}; | ||
exports.INT = (value) => { | ||
const i = Long.fromNumber(value, true); | ||
return Uint8Array.from(i.toBytesBE().slice(4)); | ||
const b = new bignumber_1.BigNumber(Math.floor(value)).toBytes(); | ||
return Uint8Array.from(Array.from({ length: 4 }, (_, i) => b[i - 4 + b.length] || 0)); | ||
}; | ||
@@ -41,3 +41,3 @@ exports.OPTION = (s) => (value) => value == null | ||
exports.LONG = (value) => { | ||
let l; | ||
let b; | ||
if (typeof value === 'number') { | ||
@@ -47,8 +47,8 @@ if (value > Math.pow(2, 53) - 1) { | ||
} | ||
l = Long.fromNumber(value); | ||
b = new bignumber_1.BigNumber(Math.floor(value)).toBytes(); | ||
} | ||
else { | ||
l = Long.fromString(value.toString()); | ||
b = new bignumber_1.BigNumber(value).toBytes(); | ||
} | ||
return Uint8Array.from(l.toBytesBE()); | ||
return Uint8Array.from(Array.from({ length: 8 }, (_, i) => b[i - 8 + b.length] || 0)); | ||
}; | ||
@@ -55,0 +55,0 @@ exports.SCRIPT = (script) => exports.OPTION(exports.LEN(exports.SHORT)(exports.BASE64_STRING))(script ? script.slice(7) : null); |
{ | ||
"version": "0.8.1", | ||
"version": "0.9.1", | ||
"name": "@waves/marshall", | ||
@@ -9,3 +9,4 @@ "main": "dist/index.js", | ||
"test": "jest", | ||
"prepublishOnly": "tsc && webpack --config webpack.config.js --env" | ||
"build": "tsc && webpack --config webpack.config.js --env", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -26,5 +27,7 @@ "files": [ | ||
"@types/jest": "^24.0.13", | ||
"@types/node": "^10.12.10", | ||
"@types/long": "^4.0.0", | ||
"@types/node": "^12.12.3", | ||
"bignumber.js": "^8.0.1", | ||
"jest": "^24.8.0", | ||
"long": "^4.0.0", | ||
"terser-webpack-plugin": "^1.2.3", | ||
@@ -40,7 +43,6 @@ "ts-jest": "^24.0.2", | ||
"@types/base64-js": "^1.2.5", | ||
"@types/long": "^4.0.0", | ||
"@waves/bignumber": "0.0.1", | ||
"@waves/parse-json-bignumber": "^1.0.1", | ||
"base64-js": "^1.3.0", | ||
"long": "^4.0.0" | ||
"base64-js": "^1.3.0" | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import Long = require('long') | ||
import {Utf8ArrayToStr} from './libs/Utf8ArrayToStr' | ||
import base58 from './libs/base58' | ||
import * as Base64 from 'base64-js' | ||
import {BigNumber} from '@waves/bignumber' | ||
@@ -31,3 +31,3 @@ export const ALIAS_VERSION: number = 2 | ||
export const P_LONG: TParser<string> = (bytes, start = 0) => ({ | ||
value: Long.fromBytesBE(Array.from(bytes.slice(start, start + 8))).toString(), | ||
value: BigNumber.fromBytes(Array.from(bytes.slice(start, start + 8))).toString(), | ||
shift: 8, | ||
@@ -34,0 +34,0 @@ }) |
import base58 from './libs/base58' | ||
import * as Base64 from 'base64-js' | ||
import {concat} from './libs/utils' | ||
import Long = require('long') | ||
import { BigNumber } from "@waves/bignumber" | ||
@@ -25,3 +25,3 @@ const stringToUint8Array = (str: string) => | ||
export const BOOL: TSerializer<boolean> = (value: boolean) => BYTE(value == true ? 1 : 0) | ||
export const BOOL: TSerializer<boolean> = (value: boolean) => BYTE(value ? 1 : 0) | ||
@@ -31,9 +31,9 @@ export const BYTES: TSerializer<Uint8Array | number[]> = (value: Uint8Array | number[]) => Uint8Array.from(value) | ||
export const SHORT: TSerializer<number> = (value: number) => { | ||
const s = Long.fromNumber(value, true) | ||
return Uint8Array.from(s.toBytesBE().slice(6)) | ||
const b = new BigNumber(Math.floor(value)).toBytes() | ||
return Uint8Array.from(Array.from({length:2}, (_, i) => b[i - 2 + b.length] || 0)) | ||
} | ||
export const INT: TSerializer<number> = (value: number) => { | ||
const i = Long.fromNumber(value, true) | ||
return Uint8Array.from(i.toBytesBE().slice(4)) | ||
const b = new BigNumber(Math.floor(value)).toBytes() | ||
return Uint8Array.from(Array.from({length:4}, (_, i) => b[i - 4 + b.length] || 0)) | ||
} | ||
@@ -59,3 +59,3 @@ | ||
export const LONG: TSerializer<number | string> = (value: number | string) => { | ||
let l: Long | ||
let b: Uint8Array | ||
if (typeof value === 'number') { | ||
@@ -65,7 +65,7 @@ if (value > 2 ** 53 - 1) { | ||
} | ||
l = Long.fromNumber(value) | ||
b = new BigNumber(Math.floor(value)).toBytes() | ||
} else { | ||
l = Long.fromString(value.toString()) | ||
b = new BigNumber(value).toBytes() | ||
} | ||
return Uint8Array.from(l.toBytesBE()) | ||
return Uint8Array.from(Array.from({length:8}, (_, i) => b[i - 8 + b.length] || 0)) | ||
} | ||
@@ -84,2 +84,2 @@ | ||
? ALIAS(val) | ||
: BASE58_STRING(val) | ||
: BASE58_STRING(val) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219777
10.85%4
-20%49
2.08%3010
0.03%13
18.18%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed