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 h={toBytes:n.SHORT,fromBytes:i.P_SHORT},u={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=[[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"]],a=s.anyOf([...o,[11,{type:"array",toBytes:n.INT,fromBytes:i.P_INT,items:s.anyOf(o,{valueField:"value"})},"list"]],{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:a}]]}],e.payment={type:"object",withLength:h,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:h,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.amount,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:u,schema:[...t.orderSchemaV2.schema,...t.proofsSchemaV1.schema]}],[3,{type:"object",withLength:u,schema:[...t.orderSchemaV3.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 h=r(3);t.parsePrimitives=h;const u=r(0);t.schemas=u;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>8,t[e]&=255;for(;s;)t.push(255&s),s>>=8}for(let r=0;"1"===e[r]&&r0?n-4:n,l=0;l>16&255,a[h++]=t>>8&255,a[h++]=255&t;2===o&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[h++]=255&t);1===o&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[h++]=t>>8&255,a[h++]=255&t);return a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;oa?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,h=o.length;a0)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>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=u(e,(0|e)<0?-1:0,!0),i&&(o[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=u(e,e<0?-1:0,!1),i&&(s[e]=r),r)}function h(e,t){if(isNaN(e))return t?S:p;if(t){if(e<0)return S;if(e>=m)return A}else{if(e<=-d)return B;if(e+1>=d)return T}return e<0?h(-e,t).neg():u(e%y|0,e/y|0,t)}function u(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=h,n.fromBits=u;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||360)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var i=h(c(r,8)),s=p,o=0;o>>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>>0).toString(e);if((s=a).isZero())return u+o;for(;u.length<6;)u="0"+u;o=""+u+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<=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,h=e.low>>>16,c=0,l=0,y=0,m=0;return y+=(m+=s+(65535&e.low))>>>16,l+=(y+=n+h)>>>16,c+=(l+=r+a)>>>16,c+=t+o,u((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 u(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 h(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,u((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?u((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=h(t),y=l.mul(e);y.isNegative()||y.gt(n);)y=(l=h(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?u((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 u(~this.low,~this.high,this.unsigned)},_.and=function(e){return i(e)||(e=f(e)),u(this.low&e.low,this.high&e.high,this.unsigned)},_.or=function(e){return i(e)||(e=f(e)),u(this.low|e.low,this.high|e.high,this.unsigned)},_.xor=function(e){return i(e)||(e=f(e)),u(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?u(this.low<>>32-e,this.unsigned):u(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):u(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?u(this.low>>>e|t<<32-e,t>>>e,this.unsigned):u(32===e?t:t>>>e-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:u(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[h,u]=e;let c;c=Array.isArray(h)?h.reduce((e,t)=>Object.assign({},e,{[t]:s[t]}),{}):s[h],o=t.serializerFromSchema(u,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 h=s[e.discriminatorField],u=e.itemByKey(h);if(null==u)throw new Error(`Serializer Error: Unknown anyOf type: ${h}`);return"boolean"===u.strKey&&6===u.key&&!1===s.value&&(u.key=7),o=t.serializerFromSchema(u.schema,r),null==e.valueField?o(s):(a=o(s[e.valueField]),i.concat((e.toBytes||n.BYTE)(u.key),a))}if("primitive"===e.type||void 0===e.type)return e.toBytes(s);if("dataTxField"===e.type){const h=n.LEN(n.SHORT)(n.STRING)(s.key),u=s.type,c=e.items.get(u);if(null==c)throw new Error(`Serializer Error: Unknown dataTxField type: ${u}`);const l=[...e.items.values()].findIndex(e=>e===c);return o=t.serializerFromSchema(c,r),a=o(s.value),i.concat(h,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;an===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 h=[],{value:u,shift:c}=(e.fromBytes||n.P_SHORT)(s,o);return a+=c,i.range(0,u).forEach(n=>{const i=t.parserFromSchema(e.items,r),{value:o,shift:u}=i(s,a);h.push(o),a+=u}),{value:h,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,h=t.parserFromSchema(o,r),{value:u,shift:c}=h(s,a);a+=c,void 0!==u&&(Array.isArray(i)?Object.assign(n,u):n[i]=u)}),{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 h=e.itemByByteKey(i.value);if(null==h)throw new Error(`Failed to get schema for item with bytecode: ${i.value}`);const u=t.parserFromSchema(h.schema,r),{value:c,shift:l}=u(s,a);return a+=l,{value:e.valueField?{[e.discriminatorField]:h.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 h=[...e.items].find((e,t)=>t===o.value);if(!h)throw new Error(`Parser Error: Unknown dataTxField type: ${o.value}`);const u=t.parserFromSchema(h[1],r)(s,a);return{value:{value:u.value,key:i.value,type:h[0]},shift:u.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),h=r(4);function u(e,t){return 0===e.length?t:"object"==typeof t?u(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=u(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=u(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="0"&&n<="9";)r+=n,h();if("."===n)for(r+=".";h()&&n>="0"&&n<="9";)r+=n;if("e"===n||"E"===n)for(r+=n,h(),"-"!==n&&"+"!==n||(r+=n,h());n>="0"&&n<="9";)r+=n,h();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(;h();){if('"'===n)return h(),i;if("\\"===n)if(h(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(h(),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<=" ";)h()};s=function(){switch(l(),n){case"{":return function(){var e,r={};if("{"===n){if(h("{"),l(),"}"===n)return h("}"),r;for(;n;){if(e=c(),l(),h(":"),!0===t.strict&&Object.hasOwnProperty.call(r,e)&&a('Duplicate key "'+e+'"'),r[e]=s(),l(),"}"===n)return h("}"),r;h(","),l()}}a("Bad object")}();case"[":return function(){var e=[];if("["===n){if(h("["),l(),"]"===n)return h("]"),e;for(;n;){if(e.push(s()),l(),"]"===n)return h("]"),e;h(","),l()}}a("Bad array")}();case'"':return c();case"-":return u();default:return n>="0"&&n<="9"?u():function(){switch(n){case"t":return h("t"),h("r"),h("u"),h("e"),!0;case"f":return h("f"),h("a"),h("l"),h("s"),h("e"),!1;case"n":return h("n"),h("u"),h("l"),h("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