>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new A;else if("p224"===t)e=new E;else if("p192"===t)e=new C;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new B}return v[t]=e,e},F.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},F.prototype._verify2=function(t,e){n(!(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},F.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},F.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},F.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},F.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},F.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},F.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},F.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},F.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},F.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},F.prototype.isqr=function(t){return this.imul(t,t.clone())},F.prototype.sqr=function(t){return this.mul(t,t)},F.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,u).cmp(h);)c.redIAdd(h);for(var l=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=o;0!==f.cmp(a);){for(var m=f,w=0;0!==m.cmp(a);w++)m=m.redSqr();n(w=0;n--){for(var u=e.words[n],c=h-1;c>=0;c--){var l=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4==++a||0===n&&0===c)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}h=26}return i},F.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},F.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new M(t)},i(M,F),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6824:(t,e,r)=>{const{BN:n,bytesToHex:i}=r(11);class s{constructor(t){this.array=Uint8Array.from({length:Math.ceil(t/8)},(()=>0)),this.cursor=0,this.length=t}getFreeBits(){return this.length-this.cursor}getUsedBits(){return this.cursor}getUsedBytes(){return Math.ceil(this.cursor/8)}get(t){return(this.array[t/8|0]&1<<7-t%8)>0}checkRange(t){if(t>this.length)throw Error("BitString overflow")}on(t){this.checkRange(t),this.array[t/8|0]|=1<<7-t%8}off(t){this.checkRange(t),this.array[t/8|0]&=~(1<<7-t%8)}toggle(t){this.checkRange(t),this.array[t/8|0]^=1<<7-t%8}forEach(t){const e=this.cursor;for(let r=0;r0?this.on(this.cursor):this.off(this.cursor),this.cursor=this.cursor+1}writeBitArray(t){for(let e=0;ee){if(0==t)return;throw Error("bitLength is too small for number, got number="+t+",bitLength="+e)}const r=t.toString(2,e);for(let t=0;t{this.writeBit(t)}))}clone(){const t=new s(0);return t.array=this.array.slice(0),t.length=this.length,t.cursor=this.cursor,t}toString(){return this.toHex()}getTopUppedArray(){const t=this.clone();let e=8*Math.ceil(t.cursor/8)-t.cursor;if(e>0)for(e-=1,t.writeBit(!0);e>0;)e-=1,t.writeBit(!1);return t.array=t.array.slice(0,Math.ceil(t.cursor/8)),t.array}toHex(){if(this.cursor%4==0){const t=i(this.array.slice(0,Math.ceil(this.cursor/8))).toUpperCase();return this.cursor%8==0?t:t.substr(0,t.length-1)}{const t=this.clone();for(t.writeBit(1);t.cursor%4!=0;)t.writeBit(0);return t.toHex().toUpperCase()+"_"}}setTopUppedArray(t,e=!0){if(this.length=8*t.length,this.array=t,this.cursor=this.length,!e&&this.length){let r=!1;for(let t=0;t<7;t++)if(this.cursor-=1,this.get(this.cursor)){r=!0,this.off(this.cursor);break}if(!r)throw console.log(t,e),new Error("Incorrect TopUppedArray")}}}t.exports={BitString:s}},2408:(t,e,r)=>{const{BitString:n}=r(6824),{bytesToBase64:i,compareBytes:s,concatBytes:o,crc32c:a,hexToBytes:h,readNBytesUIntFromArray:u,sha256:c,bytesToHex:l}=r(11),{Slice:d}=r(1084),f=h("B5EE9C72"),p=h("68ff65f3"),m=h("acc3a728");class w{constructor(){this.bits=new n(1023),this.refs=[],this.isExotic=!1}static fromBoc(t){return b(t)}static oneFromBoc(t){const e=b(t);if(1!==e.length)throw new Error("expected 1 root cell but have "+e.length);return e[0]}writeCell(t){this.bits.writeBitString(t.bits),this.refs=this.refs.concat(t.refs)}getMaxLevel(){let t=0;for(let e in this.refs){const r=this.refs[e];r.getMaxLevel()>t&&(t=r.getMaxLevel())}return t}isExplicitlyStoredHashes(){return 0}getMaxDepth(){let t=0;if(this.refs.length>0){for(let e=0;et&&(t=r)}t+=1}return t}getMaxDepthAsArray(){const t=this.getMaxDepth(),e=Uint8Array.from({length:2},(()=>0));return e[1]=t%256,e[0]=Math.floor(t/256),e}getRefsDescriptor(){const t=Uint8Array.from({length:1},(()=>0));return t[0]=this.refs.length+8*this.isExotic+32*this.getMaxLevel(),t}getBitsDescriptor(){const t=Uint8Array.from({length:1},(()=>0));return t[0]=Math.ceil(this.bits.cursor/8)+Math.floor(this.bits.cursor/8),t}getDataWithDescriptors(){const t=this.getRefsDescriptor(),e=this.getBitsDescriptor(),r=this.bits.getTopUppedArray();return o(o(t,e),r)}async getRepr(){const t=[];t.push(this.getDataWithDescriptors());for(let e in this.refs){const r=this.refs[e];t.push(r.getMaxDepthAsArray())}for(let e in this.refs){const r=this.refs[e];t.push(await r.hash())}let e=new Uint8Array;for(let r in t){const n=t[r];e=o(e,n)}return e}async hash(){return new Uint8Array(await c(await this.getRepr()))}beginParse(){const t=this.refs.map((t=>t.beginParse()));return new d(this.bits.array.slice(),this.bits.length,t)}print(t){let e=(t=t||"")+"x{"+this.bits.toHex()+"}\n";for(let r in this.refs)e+=this.refs[r].print(t+" ");return e}async toBoc(t=!0,e=!0,r=!1,i=0){const s=await this.treeWalk(),h=s[0],u=s[1],c=h.length,l=c.toString(2).length,d=Math.min(Math.ceil(l/8),1);let p=0,m=[];for(let t of h)m.push(p),p+=await t[1].bocSerializationSize(u,d);const w=p.toString(2).length,g=Math.max(Math.ceil(w/8),1),y=new n(1247*h.length);y.writeBytes(f),y.writeBitArray([t,e,r]),y.writeUint(i,2),y.writeUint(d,3),y.writeUint8(g),y.writeUint(c,8*d),y.writeUint(1,8*d),y.writeUint(0,8*d),y.writeUint(p,8*g),y.writeUint(0,8*d),t&&h.forEach(((t,e)=>y.writeUint(m[e],8*g)));for(let t of h){const e=await t[1].serializeForBoc(u,d);y.writeBytes(e)}let v=y.getTopUppedArray();return e&&(v=o(v,a(v))),v}async serializeForBoc(t,e){const r=[];if(r.push(this.getDataWithDescriptors()),this.isExplicitlyStoredHashes())throw new Error("Cell hashes explicit storing is not implemented");for(let e in this.refs){const n=this.refs[e];let i=t[await n.hash()].toString(16);i.length%2&&(i="0"+i);const s=h(i);r.push(s)}let n=new Uint8Array;for(let t in r){const e=r[t];n=o(n,e)}return n}async bocSerializationSize(t,e){return(await this.serializeForBoc(t,e)).length}async treeWalk(){return y(this,[],{})}}async function g(t,e,r){const n=t[r];for(let e in t)t[e]>n&&(t[e]=t[e]-1);t[r]=e.length-1;const i=e.splice(n,1)[0];e.push(i);for(let r of i[1].refs)await g(t,e,await r.hash())}async function y(t,e,r,n=null){const i=await t.hash();if(i in r)return n&&r[n]>r[i]&&await g(r,e,i),[e,r];r[i]=e.length,e.push([i,t]);for(let n of t.refs){const t=await y(n,e,r,i);e=t[0],r=t[1]}return[e,r]}function v(t,e){if(t.length<2)throw"Not enough bytes to encode cell descriptors";const r=t[0],n=t[1];t=t.slice(2),Math.floor(r/32);const i=8&r,s=r%8,o=Math.ceil(n/2),a=!(n%2);let h=new w;if(h.isExotic=i,t.length=0;t--){let e=n[t];for(let r=0;r{const{BN:n,Address:i,bytesToHex:s}=r(11),{BitString:o}=r(6824);t.exports={Slice:class{constructor(t,e,r){this.array=t,this.length=e,this.readCursor=0,this.refs=r,this.refCursor=0}getFreeBits(){return this.length-this.readCursor}checkRange(t){if(t>this.length)throw Error("BitString overflow")}get(t){return this.checkRange(t),(this.array[t/8|0]&1<<7-t%8)>0}loadBit(){const t=this.get(this.readCursor);return this.readCursor++,t}loadBits(t){const e=new o(t);for(let r=0;r=4)throw new Error("refs overflow");const t=this.refs[this.refCursor];return this.refCursor++,t}}}},4974:(t,e,r)=>{const{BitString:n}=r(6824),{Cell:i}=r(2408),{Slice:s}=r(1084);t.exports={BitString:n,Cell:i,Slice:s}},8711:(t,e,r)=>{const{Cell:n}=r(4974),{Address:i,bytesToHex:s}=r(11),{DNS_CATEGORY_NEXT_RESOLVER:o,DNS_CATEGORY_SITE:a,DNS_CATEGORY_WALLET:h,DNS_CATEGORY_STORAGE:u,createSmartContractAddressRecord:c,createAdnlAddressRecord:l,createStorageBagIdRecord:d,createNextResolverRecord:f,parseSmartContractAddressRecord:p,parseAdnlAddressRecord:m,parseStorageBagIdRecord:w,parseSiteRecord:g,parseNextResolverRecord:y,dnsResolve:v}=r(1878);class b{constructor(t){this.provider=t}async getRootDnsAddress(){const t=(await this.provider.getConfigParam(4)).bits.array;if(32!==t.length)throw new Error("Invalid ConfigParam 4 length "+t.length);const e=s(t);return new i("-1:"+e)}async resolve(t,e,r){const n=await this.getRootDnsAddress();return v(this.provider,n.toString(),t,e,r)}getWalletAddress(t){return this.resolve(t,h)}getSiteAddress(t){return this.resolve(t,a)}}b.resolve=v,b.createSmartContractAddressRecord=c,b.createAdnlAddressRecord=l,b.createStorageBagIdRecord=d,b.createNextResolverRecord=f,b.parseNextResolverRecord=y,b.parseAdnlAddressRecord=m,b.parseStorageBagIdRecord=w,b.parseSiteRecord=g,b.parseSmartContractAddressRecord=p,b.DNS_CATEGORY_NEXT_RESOLVER=o,b.DNS_CATEGORY_WALLET=h,b.DNS_CATEGORY_SITE=a,b.DNS_CATEGORY_STORAGE=u,t.exports.A=b},6195:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{Address:s}=r(11),{parseAddress:o}=r(7040),{dnsResolve:a}=r(1878),{parseOffchainUriCell:h}=r(7040);t.exports={DnsCollection:class extends n{constructor(t,e){if(e.wc=0,e.code=e.code,super(t,e),!e.collectionContent&&!e.address)throw new Error("required collectionContent cell");this.methods.getCollectionData=this.getCollectionData.bind(this),this.methods.getNftItemAddressByIndex=this.getNftItemAddressByIndex.bind(this),this.methods.getNftItemContent=this.getNftItemContent.bind(this),this.methods.resolve=this.resolve.bind(this)}createDataCell(){const t=new i;return t.refs[0]=this.options.collectionContent,t.refs[1]=i.oneFromBoc(this.options.dnsItemCodeHex),t}async getCollectionData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_collection_data"),r=e[0].toNumber(),n=e[1];return{collectionContentUri:h(n),collectionContent:n,ownerAddress:null,nextItemIndex:r}}async getNftItemContent(t){return await t.getData()}async getNftItemAddressByIndex(t){const e=await this.getAddress(),r=await this.provider.call2(e.toString(),"get_nft_address_by_index",[["num",t.toString()]]);return o(r)}async resolve(t,e,r){const n=await this.getAddress();return a(this.provider,n.toString(),t,e,r)}}}},7020:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{Address:s,BN:o}=r(11),{parseAddress:a}=r(7040),{dnsResolve:h,categoryToBN:u}=r(1878);class c extends n{constructor(t,e){e.wc=0,e.code=e.code,super(t,e),this.methods.getData=this.getData.bind(this),this.methods.getDomain=this.getDomain.bind(this),this.methods.getAuctionInfo=this.getAuctionInfo.bind(this),this.methods.getLastFillUpTime=this.getLastFillUpTime.bind(this),this.methods.resolve=this.resolve.bind(this)}createDataCell(){const t=new i;return t.bits.writeUint(this.options.index,256),t.bits.writeAddress(this.options.collectionAddress),t}async getData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_nft_data"),r=-1===e[0].toNumber();return{isInitialized:r,index:e[1],collectionAddress:a(e[2]),ownerAddress:r?a(e[3]):null,contentCell:e[4]}}async createTransferBody(t){const e=new i;return e.bits.writeUint(1607220500,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeAddress(t.newOwnerAddress),e.bits.writeAddress(t.responseAddress),e.bits.writeBit(!1),e.bits.writeCoins(t.forwardAmount||new o(0)),e.bits.writeBit(!1),t.forwardPayload&&e.bits.writeBytes(t.forwardPayload),e}createGetStaticDataBody(t){const e=new i;return e.bits.writeUint(801842850,32),e.bits.writeUint(t.queryId||0,64),e}async getDomain(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_domain");return(new TextDecoder).decode(e.bits.array.buffer)}async getAuctionInfo(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_auction_info");return{maxBidAddress:a(e[0]),maxBidAmount:e[1],auctionEndTime:e[2].toNumber()}}async getLastFillUpTime(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_last_fill_up_time")).toNumber()}async resolve(t,e,r){const n=await this.getAddress();return h(this.provider,n.toString(),t,e,r)}}c.createChangeContentEntryBody=async t=>{const e=new i;return e.bits.writeUint(1320284409,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeUint(await u(t.category),256),t.value&&(e.refs[0]=t.value),e},t.exports={DnsItem:c}},1878:(t,e,r)=>{const{parseAddress:n}=r(7040),{AdnlAddress:i,StorageBagId:s,BN:o,sha256:a,bytesToHex:h,bytesToBase64:u}=r(11),{Cell:c}=r(4974),l="dns_next_resolver",d="wallet",f="site",p="storage",m=async t=>{if(!t)return new o(0);const e=(new TextEncoder).encode(t),r=new Uint8Array(await a(e));return new o(h(r),16)},w=(t,e,r)=>{if(t.bits.array[0]!==e||t.bits.array[1]!==r)throw new Error("Invalid dns record value prefix");return t.bits.array=t.bits.array.slice(2),n(t)},g=t=>w(t,159,211),y=t=>w(t,186,147),v=t=>{if(173!==t.bits.array[0]||1!==t.bits.array[1])throw new Error("Invalid dns record value prefix");const e=t.bits.array.slice(2,34);return new i(e)},b=t=>{if(116!==t.bits.array[0]||115!==t.bits.array[1])throw new Error("Invalid dns record value prefix");const e=t.bits.array.slice(2,34);return new s(e)},A=t=>t?173===t.bits.array[0]||1===t.bits.array[1]?v(t):b(t):null,E=async(t,e,r,n,i)=>{const s=8*r.length,o=new c;o.bits.writeBytes(r);const a=await m(n),h=await t.call2(e,"dnsresolve",[["tvm.Slice",u(await o.toBoc(!1))],["num",a.toString()]]);if(2!==h.length)throw new Error("Invalid dnsresolve response");const w=h[0].toNumber();let v=h[1];if(v instanceof Array&&0===v.length&&(v=null),v&&!v.bits)throw new Error("Invalid dnsresolve response");if(0===w)return null;if(w%8!=0)throw new Error("domain split not at a component boundary");if(w>s)throw new Error("invalid response "+w+"/"+s);if(w===s)return n===l?v?y(v):null:n===d?v?g(v):null:n===f?v?A(v):null:n===p?v?b(v):null:v;if(v){const e=y(v);return i?n===l?e:null:await E(t,e.toString(),r.slice(w/8),n,!1)}return null},C=t=>{if(!t||!t.length)throw new Error("empty domain");if("."===t)return new Uint8Array([0]);t=t.toLowerCase();for(let e=0;e{if(!t.length)throw new Error("domain name cannot have an empty component")}));let r=e.reverse().join("\0")+"\0";return r.length<126&&(r="\0"+r),(new TextEncoder).encode(r)};t.exports={DNS_CATEGORY_NEXT_RESOLVER:l,DNS_CATEGORY_SITE:f,DNS_CATEGORY_WALLET:d,DNS_CATEGORY_STORAGE:p,categoryToBN:m,domainToBytes:C,createSmartContractAddressRecord:t=>{const e=new c;return e.bits.writeUint(40915,16),e.bits.writeAddress(t),e.bits.writeUint(0,8),e},createAdnlAddressRecord:t=>{const e=new c;return e.bits.writeUint(44289,16),e.bits.writeBytes(t.bytes),e.bits.writeUint(0,8),e},createNextResolverRecord:t=>{const e=new c;return e.bits.writeUint(47763,16),e.bits.writeAddress(t),e},parseSmartContractAddressRecord:g,parseAdnlAddressRecord:v,parseStorageBagIdRecord:b,parseSiteRecord:A,parseNextResolverRecord:y,createStorageBagIdRecord:t=>{const e=new c;return e.bits.writeUint(29811,16),e.bits.writeBytes(t.bytes),e},dnsResolve:async(t,e,r,n,i)=>{const s=C(r);return E(t,e,s,n,i)}}},9383:(t,e,r)=>{const n=r(8711).A,{DnsCollection:i}=r(6195),{DnsItem:s}=r(7020);t.exports.A={Dns:n,DnsCollection:i,DnsItem:s}},2541:t=>{const e=8191n;class r{constructor(){this.shift=0n,this.bitnumber=0n}static fromShiftAndBitNumber(t,n){const i=new r;if(i.shift=t,i.shift<0)throw new Error("invalid shift");if(i.shift>e)throw new Error("invalid shift");if(i.bitnumber=n,i.bitnumber<0)throw new Error("invalid bitnumber");if(i.bitnumber>1022n)throw new Error("invalid bitnumber");return i}getNext(){let t=this.bitnumber+1n,n=this.shift;if(n===e&&t>1021n)throw new Error("Overload");if(t>1022n&&(t=0n,n+=1n,n>e))throw new Error("Overload");return r.fromShiftAndBitNumber(n,t)}hasNext(){return!(this.bitnumber>=1021n&&this.shift===e)}getShift(){return this.shift}getBitNumber(){return this.bitnumber}getQueryId(){return(this.shift<<10n)+this.bitnumber}static fromQueryId(t){const e=t>>10n,r=1023n&t;return this.fromShiftAndBitNumber(e,r)}static fromSeqno(t){const e=t/1023n,r=t%1023n;return this.fromShiftAndBitNumber(e,r)}toSeqno(){return this.bitnumber+1023n*this.shift}}t.exports={HighloadQueryId:r}},7454:(t,e,r)=>{const{Cell:n}=r(4974),{Contract:i}=r(6320),{Address:s,BN:o,nacl:a}=r(11),h="b5ee9c7241021001000228000114ff00f4a413f4bcf2c80b01020120020d02014803040078d020d74bc00101c060b0915be101d0d3030171b0915be0fa4030f828c705b39130e0d31f018210ae42e5a4ba9d8040d721d74cf82a01ed55fb04e030020120050a02027306070011adce76a2686b85ffc00201200809001aabb6ed44d0810122d721d70b3f0018aa3bed44d08307d721d70b1f0201200b0c001bb9a6eed44d0810162d721d70b15800e5b8bf2eda2edfb21ab09028409b0ed44d0810120d721f404f404d33fd315d1058e1bf82325a15210b99f326df82305aa0015a112b992306dde923033e2923033e25230800df40f6fa19ed021d721d70a00955f037fdb31e09130e259800df40f6fa19cd001d721d70a00937fdb31e0915be270801f6f2d48308d718d121f900ed44d0d3ffd31ff404f404d33fd315d1f82321a15220b98e12336df82324aa00a112b9926d32de58f82301de541675f910f2a106d0d31fd4d307d30cd309d33fd315d15168baf2a2515abaf2a6f8232aa15250bcf2a304f823bbf2a35304800df40f6fa199d024d721d70a00f2649130e20e01fe5309800df40f6fa18e13d05004d718d20001f264c858cf16cf8301cf168e1030c824cf40cf8384095005a1a514cf40e2f800c94039800df41704c8cbff13cb1ff40012f40012cb3f12cb15c9ed54f80f21d0d30001f265d3020171b0925f03e0fa4001d70b01c000f2a5fa4031fa0031f401fa0031fa00318060d721d300010f0020f265d2000193d431d19130e272b1fb00b585bf03",u=t=>{if(!t)throw new Error("invalid timeout");if(t<600)throw new Error("minimum timeout 10 minute");if(t>2592e3)throw new Error("maximum timeout 30 days")};class c extends i{constructor(t,e){if(e.wc)throw new Error("only basechain (wc = 0) supported");if(e.wc=0,!e.address){if(!e.publicKey)throw new Error("no publicKey");if(!(e.publicKey instanceof Uint8Array))throw new Error("publicKey not Uint8Array");u(e.timeout)}e.code=n.oneFromBoc(h),super(t,e),this.options.walletId||(this.options.walletId=4269),this.methods={transfer:e=>i.createMethod(t,this.createTransferMessage(e.secretKey,e.toAddress,e.amount,e.queryId,e.payload,e.sendMode,e.createdAt,e.needDeploy))},this.methods.getPublicKey=this.getPublicKey.bind(this),this.methods.getWalletId=this.getWalletId.bind(this),this.methods.getLastCleanTime=this.getLastCleanTime.bind(this),this.methods.getTimeout=this.getTimeout.bind(this),this.methods.isProcessed=this.isProcessed.bind(this)}getName(){return"highload-3"}createDataCell(){if(0!==this.options.walletId&&!this.options.walletId)throw new Error("no walletId");if(!this.options.publicKey)throw new Error("no publicKey");if(!(this.options.publicKey instanceof Uint8Array))throw new Error("publicKey not Uint8Array");u(this.options.timeout);const t=new n;return t.bits.writeBytes(this.options.publicKey),t.bits.writeUint(this.options.walletId,32),t.bits.writeUint(0,1),t.bits.writeUint(0,1),t.bits.writeUint(0,64),t.bits.writeUint(this.options.timeout,22),t}createSigningMessage(t,e,r,i){if(isNaN(r)||null==r)throw new Error("invalid sendMode");if(isNaN(e)||null==e)throw new Error("invalid createdAt");u(this.options.timeout);const s=new n;return s.bits.writeUint(this.options.walletId,32),s.refs.push(i),s.bits.writeUint(r,8),s.bits.writeUint(Number(t.getShift()),13),s.bits.writeUint(Number(t.getBitNumber()),10),s.bits.writeUint(e,64),s.bits.writeUint(this.options.timeout,22),s}async createTransferMessage(t,e,r,n,s="",o=3,a,h=!1){if(null==n)throw new Error("queryId must be number >= 0");if(null==a||a<0)throw new Error("createAt must be number >= 0");null==o&&(o=3);const u=i.createOutMsg(e,r,s),c=this.createSigningMessage(n,a,o,u);return this.createExternalMessage(c,t,h)}async createExternalMessage(t,e,r){const s=a.sign.detached(await t.hash(),e),o=new n;o.bits.writeBytes(s),o.refs.push(t);let h=null,u=null,c=null;if(r){if(!this.options.publicKey){const t=a.sign.keyPair.fromSecretKey(e);this.options.publicKey=t.publicKey}const t=await this.createStateInit();h=t.stateInit,u=t.code,c=t.data}const l=await this.getAddress(),d=i.createExternalMessageHeader(l);return{address:l,message:i.createCommonMsgInfo(d,h,o),body:o,signature:s,signingMessage:t,stateInit:h,code:u,data:c}}async getWalletId(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_subwallet_id")).toNumber()}async getPublicKey(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_public_key")}async getLastCleanTime(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_last_clean_time")).toNumber()}async getTimeout(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_timeout")).toNumber()}async isProcessed(t,e){const r=await this.getAddress();return!(await this.provider.call2(r.toString(),"processed?",[["num",t.getQueryId().toString()],["num",e?"-1":"0"]])).isZero()}}c.WALLET_ID_BASE=4269,c.codeHex=h,t.exports={HighloadWalletContractV3:c}},3088:(t,e,r)=>{const{HighloadWalletContractV3:n}=r(7454),{HighloadQueryId:i}=r(2541);t.exports.A={HighloadQueryId:i,HighloadWalletContractV3:n,all:{"highload-3":n},list:[n]}},6320:(t,e,r)=>{const{Cell:n}=r(4974),{Address:i,bytesToBase64:s,bytesToHex:o,BN:a}=r(11);class h{constructor(t,e){this.provider=t,this.options=e,this.address=e.address?new i(e.address):null,e.wc||(e.wc=this.address?this.address.wc:0),this.methods={}}async getAddress(){return this.address||(this.address=(await this.createStateInit()).address),this.address}createCodeCell(){if(!this.options.code)throw new Error("Contract: options.code is not defined");return this.options.code}createDataCell(){return new n}async createStateInit(){const t=this.createCodeCell(),e=this.createDataCell(),r=h.createStateInit(t,e),n=await r.hash();return{stateInit:r,address:new i(this.options.wc+":"+o(n)),code:t,data:e}}static createStateInit(t,e,r=null,i=null,s=null){if(r)throw"Library in state init is not implemented";if(i)throw"Split depth in state init is not implemented";if(s)throw"Ticktock in state init is not implemented";const o=new n;return o.bits.writeBitArray([Boolean(i),Boolean(s),Boolean(t),Boolean(e),Boolean(r)]),t&&o.refs.push(t),e&&o.refs.push(e),r&&o.refs.push(r),o}static createInternalMessageHeader(t,e=0,r=!0,s=null,o=!1,a=null,h=null,u=0,c=0,l=0,d=0){const f=new n;if(f.bits.writeBit(!1),f.bits.writeBit(r),null!==s?f.bits.writeBit(s):f.bits.writeBit(new i(t).isBounceable),f.bits.writeBit(o),f.bits.writeAddress(a?new i(a):null),f.bits.writeAddress(new i(t)),f.bits.writeGrams(e),h)throw"Currency collections are not implemented yet";return f.bits.writeBit(Boolean(h)),f.bits.writeGrams(u),f.bits.writeGrams(c),f.bits.writeUint(l,64),f.bits.writeUint(d,32),f}static createExternalMessageHeader(t,e=null,r=0){const s=new n;return s.bits.writeUint(2,2),s.bits.writeAddress(e?new i(e):null),s.bits.writeAddress(new i(t)),s.bits.writeGrams(r),s}static createOutMsg(t,e,r,s=null){let o=new n;r&&(r.refs?o=r:"string"==typeof r?r.length>0&&(o.bits.writeUint(0,32),o.bits.writeString(r)):o.bits.writeBytes(r));const u=h.createInternalMessageHeader(new i(t),new a(e));return h.createCommonMsgInfo(u,s,o)}static createCommonMsgInfo(t,e=null,r=null){const i=new n;return i.writeCell(t),e?(i.bits.writeBit(!0),i.bits.writeBit(!0),i.refs.push(e)):i.bits.writeBit(!1),r?i.bits.getFreeBits()>=r.bits.getUsedBits()&&i.refs.length+r.refs.length<=4?(i.bits.writeBit(!1),i.writeCell(r)):(i.bits.writeBit(!0),i.refs.push(r)):i.bits.writeBit(!1),i}static createMethod(t,e){return{getBody:async()=>(await e).body,getQuery:async()=>(await e).message,send:async()=>{const r=await e,n=s(await r.message.toBoc(!1));return t.sendBoc(n)},estimateFee:async()=>{const r=await e,n=r.code?{address:r.address.toString(!0,!0,!1),body:s(await r.body.toBoc(!1)),init_code:s(await r.code.toBoc(!1)),init_data:s(await r.data.toBoc(!1))}:{address:r.address.toString(!0,!0,!0),body:s(await r.body.toBoc(!1))};return t.getEstimateFee(n)}}}}t.exports={Contract:h}},9205:(t,e,r)=>{const{Cell:n}=r(4974),{Address:i,BN:s,base64ToBytes:o}=r(11),{WalletContract:a}=r(5597),h=698983191;class u extends a{constructor(t,e){e.code=n.oneFromBoc("B5EE9C7241021E01000261000114FF00F4A413F4BCF2C80B010201200203020148040501F2F28308D71820D31FD31FD31F802403F823BB13F2F2F003802251A9BA1AF2F4802351B7BA1BF2F4801F0BF9015410C5F9101AF2F4F8005057F823F0065098F823F0062071289320D74A8E8BD30731D4511BDB3C12B001E8309229A0DF72FB02069320D74A96D307D402FB00E8D103A4476814154330F004ED541D0202CD0607020120131402012008090201200F100201200A0B002D5ED44D0D31FD31FD3FFD3FFF404FA00F404FA00F404D1803F7007434C0C05C6C2497C0F83E900C0871C02497C0F80074C7C87040A497C1383C00D46D3C00608420BABE7114AC2F6C2497C338200A208420BABE7106EE86BCBD20084AE0840EE6B2802FBCBD01E0C235C62008087E4055040DBE4404BCBD34C7E00A60840DCEAA7D04EE84BCBD34C034C7CC0078C3C412040DD78CA00C0D0E00130875D27D2A1BE95B0C60000C1039480AF00500161037410AF0050810575056001010244300F004ED540201201112004548E1E228020F4966FA520933023BB9131E2209835FA00D113A14013926C21E2B3E6308003502323287C5F287C572FFC4F2FFFD00007E80BD00007E80BD00326000431448A814C4E0083D039BE865BE803444E800A44C38B21400FE809004E0083D10C06002012015160015BDE9F780188242F847800C02012017180201481B1C002DB5187E006D88868A82609E00C6207E00C63F04EDE20B30020158191A0017ADCE76A268699F98EB85FFC00017AC78F6A268698F98EB858FC00011B325FB513435C2C7E00017B1D1BE08E0804230FB50F620002801D0D3030178B0925B7FE0FA4031FA403001F001A80EDAA4"),super(t,e),this.options.walletId||(this.options.walletId=h+this.options.wc),this.methods.getPublicKey=this.getPublicKey.bind(this),this.methods.getWalletId=this.getWalletId.bind(this),this.methods.getLiquidBalance=this.getLiquidBalance.bind(this),this.methods.getNominalRestrictedBalance=this.getNominalRestrictedBalance.bind(this),this.methods.getNominalLockedBalance=this.getNominalLockedBalance.bind(this)}getName(){return"lockup-0.1"}createSigningMessage(t,e,r){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const i=new n;if(i.bits.writeUint(this.options.walletId,32),0===t)for(let t=0;t<32;t++)i.bits.writeBit(1);else i.bits.writeUint(e,32);return i.bits.writeUint(t,32),i}createDataCell(){const t=new n;return t.bits.writeUint(0,32),t.bits.writeUint(this.options.walletId,32),t.bits.writeBytes(this.options.publicKey),t.bits.writeBytes(o(this.options.config.config_public_key)),this.options.config.allowed_destinations?(t.bits.writeUint(1,1),t.refs.push(n.oneFromBoc(o(this.options.config.allowed_destinations)))):t.bits.writeUint(0,1),t.bits.writeGrams(0),t.bits.writeUint(0,1),t.bits.writeGrams(0),t.bits.writeUint(0,1),t}async getWalletId(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_subwallet_id")).toNumber()}async getPublicKey(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_public_key")}async getLiquidBalance(){const t=await this.getBalances();return t[0]-t[1]-t[2]}async getNominalRestrictedBalance(){return await this.getBalances()[1]}async getNominalLockedBalance(){return await this.getBalances()[2]}async getBalances(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_balances")}}u.WALLET_ID_BASE=h,t.exports={LockupWalletV1:u}},385:(t,e,r)=>{const{Cell:n}=r(4974),{Address:i,BN:s,bytesToHex:o}=r(11),{WalletContract:a}=r(5597),{parseAddress:h}=r(7040),{Contract:u}=r(6320),c="b5ee9c7241021c010003fb000114ff00f4a413f4bcf2c80b01020120030203b8f28308d71820d31fd31fd31f02f823bbf264ed44d0d31fd31fd3ff305abaf2a15033baf2a202f9014033f910f2a3f800db3c20d74ac0018e99ed44ed45ed47915bed67ed65ed648e82db3ced41edf101f2ff9130e2f841a4f861db3c1b1413020148110402012008050201200706020db9846db3cdb3c81b1a0129ba462db3cf845f846f847f848f849f84af84bf84481b0201200e090201620d0a02016a0c0b012fa2c76cf3e9100723281f2fff2743e112040423d029be84c61b000fa25fb513435c2c7e014bad346d9e36fc22470d4080847a4937d29910ce6903e9ff9837812801b7810148987159f318401b02016e100f0019af1df6a26840106b90eb858fc00019adce76a26840206b90eb85ffc003acd06c2220d749c160915be001d0d3030171b0915be0fa4030db3c01d31fd33ff84b5240c705238210a7733acdbab08ea46c12db3c8210f7733acd01708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00e30e1b141201cef84a5240c7050382107258a69bba13b08ed18e2c01fa407fc8ca0002fa4401c8ca07cbffc9d0f8441023810108f441f86420d74ac200209501d430d001deb312e68210f258a69b32708018c8cb055004cf1623fa0213cb6acb1fcb3fc98040fb00db3c925f03e2130066f848f847f846f845c8cb3fcb1fcb1fcb1ff849fa02f84acf16f84bcf16c9f844f843f842f841c8cb1fcb1fcbfff400ccc9ed54025cd307d4d1f823db3c20c2008e9b22c003f2e06421d0d303fa4031fa40f84a5220c705b3925f04e30d9130e201fb001a1503fa21fa4401c8ca07cbffc9d0f844810108f40a6fa1318f5f330172b0c002f2e06501fa003171d721fa0031fa0031d33f31d31f31d30001c000f2e066d3000193d430d0de2171db3c8e2a31d31f302082104e73744bba21821047657424bab121821056744370bab1018210566f7465bab1f2e067e30e70925f03e220c200191716000e9372fb029130e202ea0170db3c8e6d20d749c2008e63d31f21c00022830bbab122811001bab122821047d54391bab1228210595f07bcbab122821069fb306cbab1228210566f7465bab122821056744370bab1f2e06701c00021d749c200b08e15d3073020c06421c077b121c044b101c057b1f2e0689130e29130e2e30d1918001ad31f308210566f7465baf2e067004401fa4401c3ff925b70e001f833206e925b70e0d020d7498307b9925b70e0d70bffba0060f845f846a05210bc923070e0f845f848a05210b99330f849e0f849f849f84513a1f847a904f846f847a9041023a984a1007eed44d0d31f01f861d31f01f862d3ff01f863f40401f864d401d0d33f01f865d31f01f866d31f01f867d31f01f868fa0001f869fa4001f86afa4001f86bd1d10a20c6a7";class l extends a{constructor(t,e){e.code=n.oneFromBoc(c),super(t,e),this.options.walletId||(this.options.walletId=268+this.options.wc),this.methods.getPublicKey=this.getPublicKey.bind(this),this.methods.getWalletId=this.getWalletId.bind(this),this.methods.getLockedAmount=this.getLockedAmount.bind(this),this.methods.getVestingData=this.getVestingData.bind(this),this.methods.getWhitelist=this.getWhitelist.bind(this)}getName(){return"vesting-1"}createSigningMessage(t,e,r){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const i=new n;if(i.bits.writeUint(this.options.walletId,32),0===t)for(let t=0;t<32;t++)i.bits.writeBit(1);else i.bits.writeUint(e,32);return i.bits.writeUint(t,32),i}createDataCell(){if(0!==this.options.walletId&&!this.options.walletId)throw new Error("no walletId");if(!this.options.publicKey)throw new Error("no publicKey");if(!(this.options.publicKey instanceof Uint8Array))throw new Error("publicKey not Uint8Array");if(0!==this.options.vestingStartTime&&!this.options.vestingStartTime)throw new Error("no vestingStartTime");if(this.options.vestingTotalDuration<=0)throw new Error("vestingTotalDuration cant be zero or negative");if(!this.options.vestingTotalDuration)throw new Error("no vestingTotalDuration");if(this.options.vestingTotalDuration>2**32-1)throw new Error("vestingTotalDuration > 2^32 - 1");if(this.options.unlockPeriod<=0)throw new Error("unlockPeriod cant be zero or negative");if(!this.options.unlockPeriod)throw new Error("no unlockPeriod");if(this.options.unlockPeriod>this.options.vestingTotalDuration)throw new Error("unlockPeriod > vestingTotalDuration");if(0!==this.options.cliffDuration&&!this.options.cliffDuration)throw new Error("no cliffDuration");if(this.options.cliffDuration<0)throw new Error("cliffDuration cant be negative");if(this.options.cliffDuration>=this.options.vestingTotalDuration)throw new Error("cliffDuration >= vestingTotalDuration");if(!new s(this.options.vestingTotalDuration).div(new s(this.options.unlockPeriod)).mul(new s(this.options.unlockPeriod)).eq(new s(this.options.vestingTotalDuration)))throw new Error("vestingTotalDuration mod unlockPeriod != 0");if(!new s(this.options.cliffDuration).div(new s(this.options.unlockPeriod)).mul(new s(this.options.unlockPeriod)).eq(new s(this.options.cliffDuration)))throw new Error("cliffDuration mod unlockPeriod != 0");if(!this.options.vestingTotalAmount)throw new Error("no vestingTotalAmount");if(!this.options.vestingTotalAmount.gt(new s(0)))throw new Error("vestingTotalAmount cant be zero");if(!this.options.vestingSenderAddress)throw new Error("no vestingSenderAddress");if(!(this.options.vestingSenderAddress instanceof i))throw new Error("vestingSenderAddress not Address");if(!this.options.ownerAddress)throw new Error("no ownerAddress");if(!(this.options.ownerAddress instanceof i))throw new Error("ownerAddress not Address");const t=new n;t.bits.writeUint(0,32),t.bits.writeUint(this.options.walletId,32),t.bits.writeUint(new s(o(this.options.publicKey),16),256),t.bits.writeBit(!1);const e=new n;return e.bits.writeUint(this.options.vestingStartTime,64),e.bits.writeUint(this.options.vestingTotalDuration,32),e.bits.writeUint(this.options.unlockPeriod,32),e.bits.writeUint(this.options.cliffDuration,32),e.bits.writeCoins(this.options.vestingTotalAmount),e.bits.writeAddress(new i(this.options.vestingSenderAddress)),e.bits.writeAddress(new i(this.options.ownerAddress)),t.refs[0]=e,t}createAddWhitelistBody(t){const{addresses:e,queryId:r}=t,i=new n;i.bits.writeUint(1918412443,32),i.bits.writeUint(r||0,64),i.bits.writeAddress(e[0]);let s=null;for(let t=e.length-1;t>=1;t--){const r=new n;r.bits.writeAddress(e[t]),s&&(r.refs[0]=s),s=r}return s&&(i.refs[0]=s),i}createInternalTransfer(t){const e=new n;return e.bits.writeUint(2809346765,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeUint8(t.sendMode||3),e.refs.push(u.createOutMsg(t.address,t.amount,t.payload)),e}async getPublicKey(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_public_key")}async getWalletId(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_subwallet_id")}async getLockedAmount(t){const e=await this.getAddress();return this.provider.call2(e.toString(),"get_locked_amount",[["num",t]])}async getVestingData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_vesting_data");return{vestingStartTime:e[0].toNumber(),vestingTotalDuration:e[1].toNumber(),unlockPeriod:e[2].toNumber(),cliffDuration:e[3].toNumber(),vestingTotalAmount:e[4],vestingSenderAddress:h(e[5]),ownerAddress:h(e[6]),whitelistCell:e[7]}}async getWhitelist(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_whitelist"),r=[];for(const t of e){if(2!==t.length)throw new Error("invalid whitelist result");const e=t[0],n=t[1],s=new i(e.toString(10)+":"+n.toString(16).padStart(64,"0"));r.push(s)}return r}}l.WALLET_ID_BASE=268,l.codeHex=c,t.exports={VestingWalletV1:l}},1883:(t,e,r)=>{const{LockupWalletV1:n}=r(9205),{VestingWalletV1:i}=r(385);t.exports.A={LockupWalletV1:n,VestingWalletV1:i,all:{"lockup-0.1":n,"vesting-1":i},list:[n,i]}},6521:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{nacl:s,hexToBytes:o,BN:a}=r(11),{parseAddress:h}=r(7040),{writePublicKey:u,writeSignature:c,createSignatureCell:l,tag_init:d,tag_cooperative_close:f,tag_cooperative_commit:p,tag_start_uncooperative_close:m,tag_challenge_state:w,tag_settle_conditionals:g,tag_state:y,op_top_up_balance:v,op_init_channel:b,op_cooperative_close:A,op_cooperative_commit:E,op_start_uncooperative_close:C,op_challenge_quarantined_state:B,op_settle_conditionals:F,op_finish_uncooperative_close:M,op_channel_closed:D,createTopUpBalance:S,createInitChannelBody:_,createCooperativeCloseChannelBody:I,createCooperativeCommitBody:x,createConditionalPayment:T,createSemiChannelBody:N,createSemiChannelState:U,createSignedSemiChannelState:R,createStartUncooperativeCloseBody:L,createChallengeQuarantinedStateBody:k,createSettleConditionalsBody:O,createFinishUncooperativeClose:P,createOneSignature:$,createTwoSignature:j}=r(7999),q="B5EE9C72410230010007FB000114FF00F4A413F4BCF2C80B0102012002030201480405000AF26C21F0190202CB06070201202E2F020120080902012016170201200A0B0201200C0D0009D3610F80CC001D6B5007434C7FE8034C7CC1BC0FE19E0201580E0F0201201011002D3E11DBC4BE11DBC43232C7FE11DBC47E80B2C7F2407320008B083E1B7B51343480007E187E80007E18BE80007E18F4FFC07E1934FFC07E1974DFC07E19BC01887080A7F4C7C07E1A34C7C07E1A7D01007E1AB7807080E535007E1AF7BE1B2002012012130201201415008D3E13723E11BE117E113E10540132803E10BE80BE10FE8084F2FFC4B2FFF2DFFC02887080A7FE12BE127E121400F2C7C4B2C7FD0037807080E53E12C073253E1333C5B8B27B5520004D1C3C02FE106CFCB8193E803E800C3E1096283E18BE10C0683E18FE10BE10E8006EFCB819BC032000CF1D3C02FE106CFCB819348020C235C6083E4040E4BE1124BE117890CC3E443CB81974C7C060841A5B9A5D2EBCB81A3E118074DFD66EBCB81CBE803E800C3E1094882FBE10D4882FAC3CB819807E18BE18FE12F43E800C3E10BE10E80068006E7CB8199FFE187C0320004120843777222E9C20043232C15401B3C594013E808532DA84B2C7F2DFF2407EC02002012018190201D42B2C0201201A1B0201201E1F0201201C1D00E5473F00BD401D001D401D021F90102D31F01821043436D74BAF2E068F84601D37F59BAF2E072F844544355F910F8454330F910B0F2E065D33FD33F30F84822B9F84922B9B0F2E06C21F86820F869F84A6E915B8E19F84AD0D33FFA003171D721D33F305033BC02BCB1936DF86ADEE2F800F00C8006F3E12F43E800C7E903E900C3E09DBC41CBE10D62F24CC20C1B7BE10FE11963C03FE10BE11A04020BC03DC3E185C3E189C3E18DB7E1ABC032000B51D3C02F5007400750074087E4040B4C7C0608410DB1BDCEEBCB81A3E118074DFD66EBCB81CBE111510D57E443E1150CC3E442C3CB8197E80007E18BE80007E18F4CFF4CFCC3E1208AE7E1248AE6C3CB81B007E1A3E1A7E003C042001C1573F00BF84A6EF2E06AD2008308D71820F9012392F84492F845E24130F910F2E065D31F018210556E436CBAF2E068F84601D37F59BAF2E072D401D08308D71820F901F8444130F910F2E06501D430D08308D71820F901F8454130F910F2E06501820020120222301FED31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE2303205D31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE23032F8485280BEF8495250BEB0524BBE1AB0527ABE19210064B05215BE14B05248BE17B0F2E06970F82305C8CB3F5004FA0215F40015CB3F5004FA0212F400CB1F12CA00CA00C9F86AF00C01C31CFC02FE129BACFCB81AF48020C235C6083E4048E4BE1124BE1178904C3E443CB81974C7C0608410DA19D46EBCB81A3E118074DFD66EBCB81CB5007420C235C6083E407E11104C3E443CB81940750C3420C235C6083E407E11504C3E443CB81940602403F71CFC02FE129BACFCB81AF48020C235C6083E4048E4BE1124BE1178904C3E443CB81974C7C0608410DB10DBAEBCB81A3E118074DFD66EBCB81CBD010C3E12B434CFFE803D0134CFFE803D0134C7FE11DBC4148828083E08EE7CB81BBE11DBC4A83E08EF3CB81C34800C151D5A64D6D4C8F7A2B98E82A49B08B8C3816028292A01FCD31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE2303205D31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE230325339BE5381BEB0F8495250BEB0F8485290BEB02502FE5237BE16B05262BEB0F2E06927C20097F84918BEF2E0699137E222C20097F84813BEF2E0699132E2F84AD0D33FFA00F404D33FFA00F404D31FF8476F105220A0F823BCF2E06FD200D20030B3F2E073209C3537373A5274BC5263BC12B18E11323939395250BC5299BC18B14650134440E25319BAB3F2E06D9130E30D7F05C82627002496F8476F1114A098F8476F1117A00603E203003ECB3F5004FA0215F40012CB3F5004FA0213F400CB1F12CA00CA00C9F86AF00C00620A8020F4966FA5208E213050038020F4666FA1208E1001FA00ED1E15DA119450C3A00B9133E2923430E202926C21E2B31B000C3535075063140038C8CB3F5004FA0212F400CB3F5003FA0213F400CB1FCA00C9F86AF00C00D51D3C02FE129BACFCB81AFE12B434CFFE803D010C74CFFE803D010C74C7CC3E11DBC4283E11DBC4A83E08EE7CB81C7E003E10886808E87E18BE10D400E816287E18FE10F04026BE10BE10E83E189C3E18F7BE10B04026BE10FE10A83E18DC3E18F780693E1A293E1A7C042001F53B7EF4C7C8608419F1F4A06EA4CC7C037808608403818830AEA54C7C03B6CC780C882084155DD61FAEA54C3C0476CC780820841E6849BBEEA54C3C04B6CC7808208407C546B3EEA54C3C0576CC780820840223AA8CAEA54C3C05B6CC7808208419BDBC1A6EA54C3C05F6CC780C60840950CAA46EA53C0636CC78202D0008840FF2F00075BC7FE3A7805FC25E87D007D207D20184100D0CAF6A1EC7C217C21B7817C227C22B7817C237C23FC247C24B7817C2524C3B7818823881B22A021984008DBD0CABA7805FC20C8B870FC253748B8F07C256840206B90FD0018C020EB90FD0018B8EB90E98F987C23B7882908507C11DE491839707C23B788507C23B789507C11DE48B9F03A4331C4966";class K extends n{constructor(t,e){e.publicKeyA=e.isA?e.myKeyPair.publicKey:e.hisPublicKey,e.publicKeyB=e.isA?e.hisPublicKey:e.myKeyPair.publicKey,e.wc=e.wc||0,e.code=e.code||i.oneFromBoc(q),super(t,e)}createDataCell(){const t=new i;t.bits.writeBit(0),t.bits.writeCoins(0),t.bits.writeCoins(0),u(t,this.options.publicKeyA),u(t,this.options.publicKeyB),t.bits.writeUint(this.options.channelId,128);const e=new i;e.bits.writeUint(this.options.closingConfig?.quarantineDuration||0,32),e.bits.writeCoins(this.options.closingConfig?.misbehaviorFine||new a(0)),e.bits.writeUint(this.options.closingConfig?.conditionalCloseDuration||0,32),t.refs[0]=e,t.bits.writeUint(0,32),t.bits.writeUint(0,32),t.bits.writeBit(!1);const r=new i;return r.bits.writeCoins(this.options.excessFee||new a(0)),r.bits.writeAddress(this.options.addressA),r.bits.writeAddress(this.options.addressB),t.refs[1]=r,t}async createOneSignature(t,e){const r=s.sign.detached(await e.hash(),this.options.myKeyPair.secretKey);return{cell:$({op:t,isA:this.options.isA,signature:r,cell:e}),signature:r}}async createTwoSignature(t,e,r){const n=s.sign.detached(await r.hash(),this.options.myKeyPair.secretKey),i=this.options.isA?n:e,o=this.options.isA?e:n;return{cell:j({op:t,signatureA:i,signatureB:o,cell:r}),signature:n}}async createTopUpBalance(t){return S(t)}async createInitChannel(t){return this.createOneSignature(b,_({...t,channelId:this.options.channelId}))}async createCooperativeCloseChannel(t){return t.hisSignature||(t.hisSignature=new Uint8Array(64)),this.createTwoSignature(A,t.hisSignature,I({...t,channelId:this.options.channelId}))}async createCooperativeCommit(t){return t.hisSignature||(t.hisSignature=new Uint8Array(64)),this.createTwoSignature(E,t.hisSignature,x({...t,channelId:this.options.channelId}))}async createSignedSemiChannelState(t){const e=U({channelId:this.options.channelId,semiChannelBody:N({seqno:t.mySeqno,sentCoins:t.mySentCoins,conditionals:null}),counterpartySemiChannelBody:void 0===t.hisSeqno?null:N({seqno:t.hisSeqno,sentCoins:t.hisSentCoins,conditionals:null})}),r=s.sign.detached(await e.hash(),this.options.myKeyPair.secretKey);return{cell:R({signature:r,state:e}),signature:r}}async signState(t){const e=this.options.isA?t.seqnoA:t.seqnoB,r=this.options.isA?t.seqnoB:t.seqnoA,n=this.options.initBalanceA.gt(t.balanceA)?this.options.initBalanceA.sub(t.balanceA):new a(0),i=this.options.initBalanceB.gt(t.balanceB)?this.options.initBalanceB.sub(t.balanceB):new a(0),s=this.options.isA?n:i,o=this.options.isA?i:n,{cell:h,signature:u}=await this.createSignedSemiChannelState({mySeqno:e,mySentCoins:s,hisSeqno:r,hisSentCoins:o});return u}async verifyState(t,e){const r=this.options.isA?t.seqnoB:t.seqnoA,n=this.options.isA?t.seqnoA:t.seqnoB,i=this.options.initBalanceA.gt(t.balanceA)?this.options.initBalanceA.sub(t.balanceA):new a(0),o=this.options.initBalanceB.gt(t.balanceB)?this.options.initBalanceB.sub(t.balanceB):new a(0),h=this.options.isA?o:i,u=this.options.isA?i:o,c=U({channelId:this.options.channelId,semiChannelBody:N({seqno:r,sentCoins:h,conditionals:null}),counterpartySemiChannelBody:void 0===n?null:N({seqno:n,sentCoins:u,conditionals:null})}),l=await c.hash();return s.sign.detached.verify(l,e,this.options.isA?this.options.publicKeyB:this.options.publicKeyA)}async signClose(t){const{cell:e,signature:r}=await this.createCooperativeCloseChannel(t);return r}async verifyClose(t,e){const r=await I({...t,channelId:this.options.channelId}),n=await r.hash();return s.sign.detached.verify(n,e,this.options.isA?this.options.publicKeyB:this.options.publicKeyA)}async createStartUncooperativeClose(t){return this.createOneSignature(C,L({...t,channelId:this.options.channelId}))}async createChallengeQuarantinedState(t){return this.createOneSignature(B,k({...t,channelId:this.options.channelId}))}async createSettleConditionals(t){return this.createOneSignature(F,O({...t,channelId:this.options.channelId}))}async createFinishUncooperativeClose(){return P()}static STATE_UNINITED=0;static STATE_OPEN=1;static STATE_CLOSURE_STARTED=2;static STATE_SETTLING_CONDITIONALS=3;static STATE_AWAITING_FINALIZATION=4;async getChannelState(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_channel_state",[])).toNumber()}async getData(){const t=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),o(e)},e=await this.getAddress(),r=await this.provider.call2(e.toString(),"get_channel_data",[]);return{state:r[0].toNumber(),balanceA:r[1][0],balanceB:r[1][1],publicKeyA:t(r[2][0]),publicKeyB:t(r[2][1]),channelId:r[3],quarantineDuration:r[4][0].toNumber(),misbehaviorFine:r[4][1],conditionalCloseDuration:r[4][2].toNumber(),seqnoA:r[5][0],seqnoB:r[5][1],quarantine:r[6],excessFee:r[7][0],addressA:h(r[7][1]),addressB:h(r[7][2])}}fromWallet(t){const{wallet:e,secretKey:r}=t,n=(t,n)=>{const i=async i=>{const s=n?(await this.createStateInit()).stateInit:null,o=await this.getAddress(),a=await e.methods.seqno().call()||0,h=await t;return e.methods.transfer({secretKey:r,toAddress:o.toString(!0,!0,!0),amount:i,seqno:a,payload:h,stateInit:s,sendMode:3})};return{send:t=>i(t).then((t=>t.send())),estimateFee:t=>i(t).then((t=>t.estimateFee()))}};return{deploy:()=>n(null,!0),init:t=>n(this.createInitChannel(t).then((t=>t.cell))),topUp:t=>n(this.createTopUpBalance(t)),close:t=>n(this.createCooperativeCloseChannel(t).then((t=>t.cell))),commit:t=>n(this.createCooperativeCommit(t).then((t=>t.cell))),startUncooperativeClose:t=>n(this.createStartUncooperativeClose(t).then((t=>t.cell))),challengeQuarantinedState:t=>n(this.createChallengeQuarantinedState(t).then((t=>t.cell))),settleConditionals:t=>n(this.createSettleConditionals(t).then((t=>t.cell))),finishUncooperativeClose:()=>n(this.createFinishUncooperativeClose())}}}K.codeHex=q,t.exports={PaymentChannel:K}},7999:(t,e,r)=>{const{Cell:n}=r(4974),i=(t,e)=>{if(64!==e.length)throw new Error("invalid signature length");t.bits.writeBytes(e)},s=t=>{const e=new n;return i(e,t),e},o=(t,e)=>{if(e){if(t.bits.writeBit(1),t.refs.length>=4)throw new Error("refs overflow");t.refs.push(e)}else t.bits.writeBit(0)},a=o,h=1768843636,u=1131179891,c=1128492404,l=1433289580,d=1130915665,f=1131168622,p=1130910580,m=1741148801,w=625158801;t.exports={writePublicKey:(t,e)=>{if(32!==e.length)throw new Error("invalid publicKey length");t.bits.writeBytes(e)},writeSignature:i,createSignatureCell:s,tag_init:h,tag_cooperative_close:u,tag_cooperative_commit:c,tag_start_uncooperative_close:l,tag_challenge_state:d,tag_settle_conditionals:f,tag_state:p,op_top_up_balance:m,op_init_channel:235282626,op_cooperative_close:1433884798,op_cooperative_commit:2040604399,op_start_uncooperative_close:521476815,op_challenge_quarantined_state:143567410,op_settle_conditionals:1727459433,op_finish_uncooperative_close:w,op_channel_closed:-572749638,createTopUpBalance:t=>{const e=new n;return e.bits.writeUint(m,32),e.bits.writeCoins(t.coinsA),e.bits.writeCoins(t.coinsB),e},createInitChannelBody:t=>{const e=new n;return e.bits.writeUint(h,32),e.bits.writeUint(t.channelId,128),e.bits.writeCoins(t.balanceA),e.bits.writeCoins(t.balanceB),e},createCooperativeCloseChannelBody:t=>{const e=new n;return e.bits.writeUint(u,32),e.bits.writeUint(t.channelId,128),e.bits.writeCoins(t.balanceA),e.bits.writeCoins(t.balanceB),e.bits.writeUint(t.seqnoA,64),e.bits.writeUint(t.seqnoB,64),e},createCooperativeCommitBody:t=>{const e=new n;return e.bits.writeUint(c,32),e.bits.writeUint(t.channelId,128),e.bits.writeUint(t.seqnoA,64),e.bits.writeUint(t.seqnoB,64),e},createConditionalPayment:t=>{const e=new n;return e.bits.writeCoins(t.amount),e.writeCell(t.condition),e},createSemiChannelBody:t=>{const e=new n;return e.bits.writeUint(t.seqno,64),e.bits.writeCoins(t.sentCoins),a(e,t.conditionals),e},createSemiChannelState:t=>{const e=new n;return e.bits.writeUint(p,32),e.bits.writeUint(t.channelId,128),e.writeCell(t.semiChannelBody),o(e,t.counterpartySemiChannelBody),e},createSignedSemiChannelState:t=>{const e=new n;return i(e,t.signature),e.writeCell(t.state),e},createStartUncooperativeCloseBody:t=>{const e=new n;return e.bits.writeUint(l,32),e.bits.writeUint(t.channelId,128),e.refs[0]=t.signedSemiChannelStateA,e.refs[1]=t.signedSemiChannelStateB,e},createChallengeQuarantinedStateBody:t=>{const e=new n;return e.bits.writeUint(d,32),e.bits.writeUint(t.channelId,128),e.refs[0]=t.signedSemiChannelStateA,e.refs[1]=t.signedSemiChannelStateB,e},createSettleConditionalsBody:t=>{const e=new n;return e.bits.writeUint(f,32),e.bits.writeUint(t.channelId,128),a(e,t.conditionalsToSettle),e},createFinishUncooperativeClose:()=>{const t=new n;return t.bits.writeUint(w,32),t},createOneSignature:t=>{const e=new n;return e.bits.writeUint(t.op,32),e.bits.writeBit(t.isA),i(e,t.signature),e.writeCell(t.cell),e},createTwoSignature:t=>{const e=new n;return e.bits.writeUint(t.op,32),e.refs[0]=s(t.signatureA),e.refs[1]=s(t.signatureB),e.writeCell(t.cell),e}}},7770:(t,e,r)=>{const{PaymentChannel:n}=r(6521);t.exports={Payments:class{constructor(t){this.provider=t}createChannel(t){return new n(this.provider,t)}},PaymentChannel:n}},5124:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{hexToBytes:s,BN:o,nacl:a,bytesToBase64:h}=r(11);t.exports={SubscriptionContract:class extends n{constructor(t,e){e.code=i.oneFromBoc("B5EE9C7241020F01000262000114FF00F4A413F4BCF2C80B0102012002030201480405036AF230DB3C5335A127A904F82327A128A90401BC5135A0F823B913B0F29EF800725210BE945387F0078E855386DB3CA4E2F82302DB3C0B0C0D0202CD06070121A0D0C9B67813F488DE0411F488DE0410130B048FD6D9E05E8698198FD201829846382C74E2F841999E98F9841083239BA395D497803F018B841083AB735BBED9E702984E382D9C74688462F863841083AB735BBED9E70156BA4E09040B0A0A080269F10FD22184093886D9E7C12C1083239BA39384008646582A803678B2801FD010A65B5658F89659FE4B9FD803FC1083239BA396D9E40E0A04F08E8D108C5F0C708210756E6B77DB3CE00AD31F308210706C7567831EB15210BA8F48305324A126A904F82326A127A904BEF27109FA4430A619F833D078D721D70B3F5260A11BBE8E923036F82370708210737562732759DB3C5077DE106910581047103645135042DB3CE0395F076C2232821064737472BA0A0A0D09011A8E897F821064737472DB3CE0300A006821B39982100400000072FB02DE70F8276F118010C8CB055005CF1621FA0214F40013CB6912CB1F830602948100A032DEC901FB000030ED44D0FA40FA40FA00D31FD31FD31FD31FD31FD307D31F30018021FA443020813A98DB3C01A619F833D078D721D70B3FA070F8258210706C7567228018C8CB055007CF165004FA0215CB6A12CB1F13CB3F01FA02CB00C973FB000E0040C8500ACF165008CF165006FA0214CB1F12CB1FCB1FCB1FCB1FCB07CB1FC9ED54005801A615F833D020D70B078100D1BA95810088D721DED307218100DDBA028100DEBA12B1F2E047D33F30A8AB0FE5855AB4"),super(t,e),this.methods.pay=()=>n.createMethod(t,this.createPayExternalMessage()),this.methods.getSubscriptionData=this.getSubscriptionData.bind(this)}createDataCell(){const t=new i;return t.bits.writeAddress(this.options.wallet),t.bits.writeAddress(this.options.beneficiary),t.bits.writeGrams(this.options.amount),t.bits.writeUint(this.options.period,32),t.bits.writeUint(this.options.startAt,32),t.bits.writeUint(this.options.timeout,32),t.bits.writeUint(0,32),t.bits.writeUint(0,32),t.bits.writeUint(0,8),t.bits.writeUint(this.options.subscriptionId,32),t}createBody(){const t=new i;return t.bits.writeUint(new o(1886156135).add(new o(2147483648)),32),t}createSelfDestructBody(){const t=new i;return t.bits.writeUint(1685288050,32),t}async getSubscriptionData(){const t=t=>t[0].toNumber()+":"+t[1].toString(16),e=await this.getAddress(),r=await this.provider.call2(e.toString(),"get_subscription_data");return{wallet:t(r[0]),beneficiary:t(r[1]),amount:r[2],period:r[3].toNumber(),startAt:r[4].toNumber(),timeout:r[5].toNumber(),lastPayment:r[6].toNumber(),lastRequest:r[7].toNumber(),failedAttempts:r[8].toNumber(),subscriptionId:r[9].toNumber()}}async createPayExternalMessage(){const t=await this.getAddress(),e=n.createExternalMessageHeader(t),r=n.createCommonMsgInfo(e,null,null),s=new i;return s.bits.writeUint(Math.floor(Date.now()/1e3),64),{address:t,message:r,body:s}}}}},6246:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{createOffchainUriCell:s,parseOffchainUriCell:o,parseAddress:a}=r(7040),{Address:h,BN:u,bytesToBase64:c}=r(11);t.exports={JettonMinter:class extends n{constructor(t,e){e.wc=0,e.code=e.code||i.oneFromBoc("B5EE9C7241020B010001ED000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A60090A03EFD9910E38048ADF068698180B8D848ADF07D201800E98FE99FF6A2687D007D206A6A18400AA9385D47181A9AA8AAE382F9702480FD207D006A18106840306B90FD001812881A28217804502A906428027D012C678B666664F6AA7041083DEECBEF29385D71811A92E001F1811802600271812F82C207F97840607080093DFC142201B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064907C80383A6465816503E5FFE4E83BC00C646582AC678B28027D0109E5B589666664B8FD80400FE3603FA00FA40F82854120870542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05008C705F2E04A12A1035024C85004FA0258CF16CCCCC9ED5401FA403020D70B01C3008E1F8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB00915BE200303515C705F2E049FA403059C85004FA0258CF16CCCCC9ED54002E5143C705F2E049D43001C85004FA0258CF16CCCCC9ED54007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904051007F09"),super(t,e)}createDataCell(){const t=new i;return t.bits.writeCoins(0),t.bits.writeAddress(this.options.adminAddress),t.refs[0]=s(this.options.jettonContentUri),t.refs[1]=i.oneFromBoc(this.options.jettonWalletCodeHex),t}createMintBody(t){const e=new i;e.bits.writeUint(21,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeAddress(t.destination),e.bits.writeCoins(t.amount);const r=new i;return r.bits.writeUint(395134233,32),r.bits.writeUint(t.queryId||0,64),r.bits.writeCoins(t.jettonAmount),r.bits.writeAddress(null),r.bits.writeAddress(null),r.bits.writeCoins(new u(0)),r.bits.writeBit(!1),e.refs[0]=r,e}createChangeAdminBody(t){if(void 0===t.newAdminAddress)throw new Error("Specify newAdminAddress");const e=new i;return e.bits.writeUint(3,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeAddress(t.newAdminAddress),e}createEditContentBody(t){const e=new i;return e.bits.writeUint(4,32),e.bits.writeUint(t.queryId||0,64),e.refs[0]=s(t.jettonContentUri),e}async getJettonData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_jetton_data"),r=e[0],n=-1===e[1].toNumber(),i=a(e[2]),s=e[3];let h=null;try{h=o(s)}catch(t){}return{totalSupply:r,isMutable:n,adminAddress:i,jettonContentCell:s,jettonContentUri:h,jettonWalletCode:e[4]}}async getJettonWalletAddress(t){const e=await this.getAddress(),r=new i;r.bits.writeAddress(t);const n=await this.provider.call2(e.toString(),"get_wallet_address",[["tvm.Slice",c(await r.toBoc(!1))]]);return a(n)}}}},9852:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{parseAddress:s}=r(7040),{BN:o}=r(11),a="B5EE9C7241021201000328000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900BB0831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C00B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F500F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E801DE0063232C1540233C59C3E8085F2DAC4F3208405E351467232C7C6600C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F009ACB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718018C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B55205ECCF23D";class h extends n{constructor(t,e){e.wc=0,e.code=e.code||i.oneFromBoc(a),super(t,e)}async createTransferBody(t){const e=new i;return e.bits.writeUint(260734629,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeCoins(t.jettonAmount),e.bits.writeAddress(t.toAddress),e.bits.writeAddress(t.responseAddress),e.bits.writeBit(!1),e.bits.writeCoins(t.forwardAmount||new o(0)),t.forwardPayload?t.forwardPayload.refs?(e.bits.writeBit(!0),e.refs.push(t.forwardPayload)):(e.bits.writeBit(!1),e.bits.writeBytes(t.forwardPayload)):e.bits.writeBit(!1),e}async createBurnBody(t){const e=new i;return e.bits.writeUint(1499400124,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeCoins(t.jettonAmount),e.bits.writeAddress(t.responseAddress),e}async getData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_wallet_data");return{balance:e[0],ownerAddress:s(e[1]),jettonMinterAddress:s(e[2]),jettonWalletCode:e[3]}}}h.codeHex=a,t.exports={JettonWallet:h}},9789:(t,e,r)=>{const{JettonMinter:n}=r(6246),{JettonWallet:i}=r(9852);t.exports.A={JettonMinter:n,JettonWallet:i}},4585:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{Address:s,bytesToBase64:o,BN:a}=r(11),{parseAddress:h}=r(7040),{createOffchainUriCell:u,serializeUri:c,parseOffchainUriCell:l,getRoyaltyParams:d}=r(7040);t.exports={NftCollection:class extends n{constructor(t,e){if(e.wc=0,e.code=e.code||i.oneFromBoc("B5EE9C724102140100021F000114FF00F4A413F4BCF2C80B0102016202030202CD04050201200E0F04E7D10638048ADF000E8698180B8D848ADF07D201800E98FE99FF6A2687D20699FEA6A6A184108349E9CA829405D47141BAF8280E8410854658056B84008646582A802E78B127D010A65B509E58FE59F80E78B64C0207D80701B28B9E382F970C892E000F18112E001718112E001F181181981E0024060708090201200A0B00603502D33F5313BBF2E1925313BA01FA00D43028103459F0068E1201A44343C85005CF1613CB3FCCCCCCC9ED54925F05E200A6357003D4308E378040F4966FA5208E2906A4208100FABE93F2C18FDE81019321A05325BBF2F402FA00D43022544B30F00623BA9302A402DE04926C21E2B3E6303250444313C85005CF1613CB3FCCCCCCC9ED54002C323401FA40304144C85005CF1613CB3FCCCCCCC9ED54003C8E15D4D43010344130C85005CF1613CB3FCCCCCCC9ED54E05F04840FF2F00201200C0D003D45AF0047021F005778018C8CB0558CF165004FA0213CB6B12CCCCC971FB008002D007232CFFE0A33C5B25C083232C044FD003D0032C03260001B3E401D3232C084B281F2FFF2742002012010110025BC82DF6A2687D20699FEA6A6A182DE86A182C40043B8B5D31ED44D0FA40D33FD4D4D43010245F04D0D431D430D071C8CB0701CF16CCC980201201213002FB5DAFDA89A1F481A67FA9A9A860D883A1A61FA61FF480610002DB4F47DA89A1F481A67FA9A9A86028BE09E008E003E00B01A500C6E"),e.royalty>1)throw new Error("royalty > 1");e.royaltyBase=1e3,e.royaltyFactor=Math.floor(e.royalty*e.royaltyBase),super(t,e),this.methods.getCollectionData=this.getCollectionData.bind(this),this.methods.getNftItemAddressByIndex=this.getNftItemAddressByIndex.bind(this),this.methods.getNftItemContent=this.getNftItemContent.bind(this),this.methods.getRoyaltyParams=this.getRoyaltyParams.bind(this)}createContentCell(t){const e=u(t.collectionContentUri),r=new i;r.bits.writeBytes(c(t.nftItemContentBaseUri));const n=new i;return n.refs[0]=e,n.refs[1]=r,n}createRoyaltyCell(t){const e=new i;return e.bits.writeUint(t.royaltyFactor,16),e.bits.writeUint(t.royaltyBase,16),e.bits.writeAddress(t.royaltyAddress),e}createDataCell(){const t=new i;return t.bits.writeAddress(this.options.ownerAddress),t.bits.writeUint(0,64),t.refs[0]=this.createContentCell(this.options),t.refs[1]=i.oneFromBoc(this.options.nftItemCodeHex),t.refs[2]=this.createRoyaltyCell(this.options),t}createMintBody(t){const e=new i;e.bits.writeUint(1,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeUint(t.itemIndex,64),e.bits.writeCoins(t.amount);const r=new i;r.bits.writeAddress(t.itemOwnerAddress);const n=new i;return n.bits.writeBytes(c(t.itemContentUri)),r.refs[0]=n,e.refs[0]=r,e}createGetRoyaltyParamsBody(t){const e=new i;return e.bits.writeUint(1765620048,32),e.bits.writeUint(t.queryId||0,64),e}createChangeOwnerBody(t){if(void 0===t.newOwnerAddress)throw new Error("Specify newOwnerAddress");const e=new i;return e.bits.writeUint(3,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeAddress(t.newOwnerAddress),e}createEditContentBody(t){if(t.royalty>1)throw new Error("royalty > 1");t.royaltyBase=1e3,t.royaltyFactor=Math.floor(t.royalty*t.royaltyBase);const e=new i;return e.bits.writeUint(4,32),e.bits.writeUint(t.queryId||0,64),e.refs[0]=this.createContentCell(t),e.refs[1]=this.createRoyaltyCell(t),e}async getCollectionData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_collection_data"),r=e[0];let n=NaN;try{n=r.toNumber()}catch(t){}const i=e[1];let s=null;try{s=l(i)}catch(t){}return{nextItemIndex:n,itemsCount:r,ownerAddress:h(e[2]),collectionContentCell:i,collectionContentUri:s}}async getNftItemContent(t){const e=await this.getAddress(),r=await t.getData();if(r.isInitialized){const t=await this.provider.call2(e.toString(),"get_nft_content",[["num",r.itemIndex.toString(10)],["tvm.Cell",o(await r.contentCell.toBoc(!1))]]);r.contentUri=null;try{r.contentUri=l(t)}catch(t){}}return r}async getNftItemAddressByIndex(t){t=new a(t);const e=await this.getAddress(),r=await this.provider.call2(e.toString(),"get_nft_address_by_index",[["num",t.toString(10)]]);return h(r)}async getRoyaltyParams(){const t=await this.getAddress();return d(this.provider,t.toString())}}}},2630:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{Address:s,BN:o}=r(11),{parseAddress:a,getRoyaltyParams:h}=r(7040),{parseOffchainUriCell:u}=r(7040),c="B5EE9C7241020D010001D0000114FF00F4A413F4BCF2C80B0102016202030202CE04050009A11F9FE00502012006070201200B0C02D70C8871C02497C0F83434C0C05C6C2497C0F83E903E900C7E800C5C75C87E800C7E800C3C00812CE3850C1B088D148CB1C17CB865407E90350C0408FC00F801B4C7F4CFE08417F30F45148C2EA3A1CC840DD78C9004F80C0D0D0D4D60840BF2C9A884AEB8C097C12103FCBC20080900113E910C1C2EBCB8536001F65135C705F2E191FA4021F001FA40D20031FA00820AFAF0801BA121945315A0A1DE22D70B01C300209206A19136E220C2FFF2E192218E3E821005138D91C85009CF16500BCF16712449145446A0708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB00104794102A375BE20A00727082108B77173505C8CBFF5004CF1610248040708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB000082028E3526F0018210D53276DB103744006D71708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB0093303234E25502F003003B3B513434CFFE900835D27080269FC07E90350C04090408F80C1C165B5B60001D00F232CFD633C58073C5B3327B5520BF75041B";class l extends n{constructor(t,e){e.wc=0,e.code=e.code||i.oneFromBoc(c),super(t,e),this.methods.getData=this.getData.bind(this)}createDataCell(){const t=new i;return t.bits.writeUint(this.options.index,64),t.bits.writeAddress(this.options.collectionAddress),t}async getData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_nft_data"),r=-1===e[0].toNumber(),n=e[1];let i=NaN;try{i=n.toNumber()}catch(t){}const s=a(e[2]),o=r?a(e[3]):null,h=e[4];let c=null;try{c=r&&null===s?u(h):null}catch(t){}return{isInitialized:r,index:i,itemIndex:n,collectionAddress:s,ownerAddress:o,contentCell:h,contentUri:c}}async createTransferBody(t){const e=new i;return e.bits.writeUint(1607220500,32),e.bits.writeUint(t.queryId||0,64),e.bits.writeAddress(t.newOwnerAddress),e.bits.writeAddress(t.responseAddress),e.bits.writeBit(!1),e.bits.writeCoins(t.forwardAmount||new o(0)),t.forwardPayload?t.forwardPayload.refs?(e.bits.writeBit(!0),e.refs.push(t.forwardPayload)):(e.bits.writeBit(!1),e.bits.writeBytes(t.forwardPayload)):e.bits.writeBit(!1),e}createGetStaticDataBody(t){const e=new i;return e.bits.writeUint(801842850,32),e.bits.writeUint(t.queryId||0,64),e}async getRoyaltyParams(){const t=await this.getAddress();return h(this.provider,t.toString())}}l.codeHex=c,t.exports={NftItem:l}},8330:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{Address:s}=r(11),{parseAddress:o}=r(7040);t.exports={NftMarketplace:class extends n{constructor(t,e){e.wc=0,e.code=e.code||i.oneFromBoc("B5EE9C7241010401006D000114FF00F4A413F4BCF2C80B01020120020300AAD23221C700915BE0D0D3030171B0915BE0FA40ED44D0FA403012C705F2E19101D31F01C0018E2BFA003001D4D43021F90070C8CA07CBFFC9D077748018C8CB05CB0258CF165004FA0213CB6BCCCCC971FB00915BE20004F2308EF7CCE7"),super(t,e)}createDataCell(){const t=new i;return t.bits.writeAddress(this.options.ownerAddress),t}}}},5966:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{parseAddress:s}=r(7040),{BN:o}=r(11),a="B5EE9C7241020A010001B4000114FF00F4A413F4BCF2C80B01020120020302014804050004F2300202CD0607002FA03859DA89A1F481F481F481F401A861A1F401F481F4006101F7D00E8698180B8D8492F82707D201876A2687D207D207D207D006A18116BA4E10159C71D991B1B2990E382C92F837028916382F970FA01698FC1080289C6C8895D7970FAE99F98FD2018201A642802E78B2801E78B00E78B00FD016664F6AA701363804C9B081B2299823878027003698FE99F9810E000C92F857010C0801F5D41081DCD650029285029185F7970E101E87D007D207D0018384008646582A804E78B28B9D090D0A85AD08A500AFD010AE5B564B8FD80384008646582AC678B2803FD010B65B564B8FD80384008646582A802E78B00FD0109E5B564B8FD80381041082FE61E8A10C00C646582A802E78B117D010A65B509E58F8A40900C8C0029A3110471036454012F004E032363704C0038E4782103B9ACA0015BEF2E1C95312C70559C705B1F2E1CA702082105FCC3D14218010C8CB055006CF1622FA0215CB6A14CB1F14CB3F21CF1601CF16CA0021FA02CA00C98100A0FB00E05F06840FF2F0002ACB3F22CF1658CF16CA0021FA02CA00C98100A0FB00AECABAD1";class h extends n{constructor(t,e){e.wc=0,e.code=e.code||i.oneFromBoc(a),super(t,e),this.methods.getData=this.getData.bind(this)}createDataCell(){const t=new i;t.bits.writeAddress(this.options.marketplaceAddress),t.bits.writeAddress(this.options.nftAddress),t.bits.writeAddress(null),t.bits.writeCoins(this.options.fullPrice);const e=new i;return e.bits.writeCoins(this.options.marketplaceFee),e.bits.writeAddress(this.options.royaltyAddress),e.bits.writeCoins(this.options.royaltyAmount),t.refs[0]=e,t}async getData(){const t=await this.getAddress(),e=await this.provider.call2(t.toString(),"get_sale_data");return{marketplaceAddress:s(e[0]),nftAddress:s(e[1]),nftOwnerAddress:s(e[2]),fullPrice:e[3],marketplaceFee:e[4],royaltyAddress:s(e[5]),royaltyAmount:e[6]}}async createCancelBody(t){const e=new i;return e.bits.writeUint(3,32),e.bits.writeUint(t.queryId||0,64),e}}h.codeHex=a,t.exports={NftSale:h}},7040:(t,e,r)=>{const{Address:n}=r(11),{Cell:i}=r(4974),s=t=>(new TextEncoder).encode(encodeURI(t)),o=t=>(new TextDecoder).decode(t),a=(t,e,r)=>{let n=BigInt(0);for(let i=0;i{let e=a(t.bits,3,8);e>BigInt(127)&&(e-=BigInt(256));const r=a(t.bits,11,256);if(e.toString(10)+":"+r.toString(16)=="0:0")return null;const i=e.toString(10)+":"+r.toString(16).padStart(64,"0");return new n(i)};t.exports={SNAKE_DATA_PREFIX:0,CHUNK_DATA_PREFIX:1,ONCHAIN_CONTENT_PREFIX:0,OFFCHAIN_CONTENT_PREFIX:1,parseAddress:h,serializeUri:s,parseUri:o,createOffchainUriCell:t=>{const e=new i;return e.bits.writeUint(1,8),e.bits.writeBytes(s(t)),e},parseOffchainUriCell:t=>{if(1!==t.bits.array[0])throw new Error("no OFFCHAIN_CONTENT_PREFIX");let e=0,r=t;for(;r;)e+=r.bits.array.length,r=r.refs[0];const n=new Uint8Array(e);for(e=0,r=t;r;)n.set(r.bits.array,e),e+=r.bits.array.length,r=r.refs[0];return o(n.slice(1))},getRoyaltyParams:async(t,e)=>{const r=await t.call2(e,"royalty_params"),n=r[0].toNumber(),i=r[1].toNumber();return{royalty:n/i,royaltyBase:i,royaltyFactor:n,royaltyAddress:h(r[2])}}}},9641:(t,e,r)=>{const{NftCollection:n}=r(4585),{NftItem:i}=r(2630),{NftMarketplace:s}=r(8330),{NftSale:o}=r(5966);t.exports.A={NftCollection:n,NftItem:i,NftMarketplace:s,NftSale:o}},5597:(t,e,r)=>{const{Contract:n}=r(6320),{Cell:i}=r(4974),{nacl:s,stringToBytes:o,Address:a,BN:h}=r(11);t.exports={WalletContract:class extends n{constructor(t,e){if(!e.publicKey&&!e.address)throw new Error("WalletContract required publicKey or address in options");super(t,e),this.methods={transfer:e=>n.createMethod(t,this.createTransferMessage(e.secretKey,e.toAddress,e.amount,e.seqno,e.payload,e.sendMode,!Boolean(e.secretKey),e.stateInit,e.expireAt)),transfers:e=>n.createMethod(t,this.createTransferMessages(e.secretKey,e.seqno,e.messages,!Boolean(e.secretKey),e.expireAt)),seqno:()=>({call:async()=>{const e=await this.getAddress();let r=null;try{r=(await t.call2(e.toString(),"seqno")).toNumber()}catch(t){}return r}})},this.deploy=e=>n.createMethod(t,this.createInitExternalMessage(e))}getName(){throw new Error("override me")}createDataCell(){const t=new i;return t.bits.writeUint(0,32),t.bits.writeBytes(this.options.publicKey),t}createSigningMessage(t){t=t||0;const e=new i;return e.bits.writeUint(t,32),e}async createInitExternalMessage(t){if(!this.options.publicKey){const e=s.sign.keyPair.fromSecretKey(t);this.options.publicKey=e.publicKey}const{stateInit:e,address:r,code:o,data:a}=await this.createStateInit(),h=this.createSigningMessage(),u=s.sign.detached(await h.hash(),t),c=new i;c.bits.writeBytes(u),c.writeCell(h);const l=n.createExternalMessageHeader(r);return{address:r,message:n.createCommonMsgInfo(l,e,c),body:c,signingMessage:h,stateInit:e,code:o,data:a}}async createExternalMessage(t,e,r,o=!1){const a=o?new Uint8Array(64):s.sign.detached(await t.hash(),e),h=new i;h.bits.writeBytes(a),h.writeCell(t);let u=null,c=null,l=null;if(0===r){if(!this.options.publicKey){const t=s.sign.keyPair.fromSecretKey(e);this.options.publicKey=t.publicKey}const t=await this.createStateInit();u=t.stateInit,c=t.code,l=t.data}const d=await this.getAddress(),f=n.createExternalMessageHeader(d);return{address:d,message:n.createCommonMsgInfo(f,u,h),body:h,signature:a,signingMessage:t,stateInit:u,code:c,data:l}}async createTransferMessage(t,e,r,i,s="",o=3,a=!1,h=null,u=void 0){if(null==i||i<0)throw new Error("seqno must be number >= 0");const c=this.createSigningMessage(i,u);return null==o&&(o=3),c.bits.writeUint8(o),c.refs.push(n.createOutMsg(e,r,s,h)),this.createExternalMessage(c,t,i,a)}async createTransferMessages(t,e,r,i=!1,s=void 0){if(null==e||e<0)throw new Error("seqno must be number >= 0");const o=this.createSigningMessage(e,s);if(r.length<1||r.length>4)throw new Error("put 1-4 messages");for(const t of r){let e=t.sendMode;null==e&&(e=3),o.bits.writeUint8(e),o.refs.push(n.createOutMsg(t.toAddress,t.amount,t.payload,t.stateInit))}return this.createExternalMessage(o,t,e,i)}}}},9871:(t,e,r)=>{const{Cell:n}=r(4974),{WalletContract:i}=r(5597);t.exports={SimpleWalletContractR1:class extends i{constructor(t,e){e.code=n.oneFromBoc("B5EE9C72410101010044000084FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED5441FDF089"),super(t,e)}getName(){return"simpleR1"}},SimpleWalletContractR2:class extends i{constructor(t,e){e.code=n.oneFromBoc("B5EE9C724101010100530000A2FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54D0E2786F"),super(t,e)}getName(){return"simpleR2"}},SimpleWalletContractR3:class extends i{constructor(t,e){e.code=n.oneFromBoc("B5EE9C7241010101005F0000BAFF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54B5B86E42"),super(t,e)}getName(){return"simpleR3"}}}},1549:(t,e,r)=>{const{Cell:n}=r(4974),{WalletContract:i}=r(5597);class s extends i{createSigningMessage(t,e){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const r=new n;if(r.bits.writeUint(t,32),0===t)for(let t=0;t<32;t++)r.bits.writeBit(1);else r.bits.writeUint(e,32);return r}}t.exports={WalletV2ContractR1:class extends s{constructor(t,e){e.code=n.oneFromBoc("B5EE9C724101010100570000AAFF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54A1370BB6"),super(t,e)}getName(){return"v2R1"}},WalletV2ContractR2:class extends s{constructor(t,e){e.code=n.oneFromBoc("B5EE9C724101010100630000C2FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54044CD7A1"),super(t,e)}getName(){return"v2R2"}}}},5022:(t,e,r)=>{const{Cell:n}=r(4974),{WalletContract:i}=r(5597),{parseWalletV3TransferQuery:s,parseWalletV3TransferBody:o}=r(9552);class a extends i{createSigningMessage(t,e){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const r=new n;if(r.bits.writeUint(this.options.walletId,32),0===t)for(let t=0;t<32;t++)r.bits.writeBit(1);else r.bits.writeUint(e,32);return r.bits.writeUint(t,32),r}createDataCell(){const t=new n;return t.bits.writeUint(0,32),t.bits.writeUint(this.options.walletId,32),t.bits.writeBytes(this.options.publicKey),t}}class h extends a{constructor(t,e){e.code=n.oneFromBoc("B5EE9C724101010100620000C0FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED543FBE6EE0"),super(t,e),this.options.walletId||(this.options.walletId=698983191+this.options.wc)}getName(){return"v3R1"}}h.parseTransferQuery=s,h.parseTransferBody=o;class u extends a{constructor(t,e){e.code=n.oneFromBoc("B5EE9C724101010100710000DEFF0020DD2082014C97BA218201339CBAB19F71B0ED44D0D31FD31F31D70BFFE304E0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED5410BD6DAD"),super(t,e),this.options.walletId||(this.options.walletId=698983191+this.options.wc)}getName(){return"v3R2"}}u.parseTransferQuery=s,u.parseTransferBody=o,t.exports={WalletV3ContractR1:h,WalletV3ContractR2:u}},8703:(t,e,r)=>{const{Cell:n}=r(4974),{Contract:i}=r(6320),{Address:s,bytesToHex:o,BN:a}=r(11),{WalletContract:h}=r(5597),{parseWalletV3TransferQuery:u,parseWalletV3TransferBody:c}=r(9552);class l extends h{constructor(t,e){e.code=n.oneFromBoc("B5EE9C72410215010002F5000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF263ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1112131403EED001D0D3030171B0915BE021D749C120915BE001D31F218210706C7567BD228210626C6E63BDB022821064737472BDB0925F03E002FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F05E004D33FC8258210706C7567BA9131E30D248210626C6E63BAE30004060708020120090A005001FA00F404308210706C7567831EB17080185005CB0527CF165003FA02F40012CB69CB1F5210CB3F0052F8276F228210626C6E63831EB17080185005CB0527CF1624FA0214CB6A13CB1F5230CB3F01FA02F4000092821064737472BA8E3504810108F45930ED44D0810140D720C801CF16F400C9ED54821064737472831EB17080185004CB0558CF1622FA0212CB6ACB1FCB3F9410345F04E2C98040FB000201200B0C0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580D0E0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200F100019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC971FB00C84014810108F451F2A702006C810108D718C8542025810108F451F2A782106E6F746570748018C8CB05CB025004CF16821005F5E100FA0213CB6A12CB1FC971FB00020072810108D718305202810108F459F2A7F82582106473747270748018C8CB05CB025005CF16821005F5E100FA0214CB6A13CB1F12CB3FC973FB00000AF400C9ED5446A9F34F"),super(t,e),this.options.walletId||(this.options.walletId=698983191+this.options.wc),this.methods.getPublicKey=this.getPublicKey.bind(this)}getName(){return"v4R1"}createSigningMessage(t,e,r){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const i=new n;if(i.bits.writeUint(this.options.walletId,32),0===t)for(let t=0;t<32;t++)i.bits.writeBit(1);else i.bits.writeUint(e,32);return i.bits.writeUint(t,32),r||i.bits.writeUint(0,8),i}createDataCell(){const t=new n;return t.bits.writeUint(0,32),t.bits.writeUint(this.options.walletId,32),t.bits.writeBytes(this.options.publicKey),t.bits.writeUint(0,1),t}async getPublicKey(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_public_key")}}l.parseTransferQuery=u,l.parseTransferBody=c,t.exports={WalletV4ContractR1:l}},5667:(t,e,r)=>{const{Cell:n}=r(4974),{Contract:i}=r(6320),{Address:s,bytesToHex:o,BN:a,toNano:h}=r(11),{WalletContract:u}=r(5597),{parseWalletV3TransferQuery:c,parseWalletV3TransferBody:l}=r(9552);class d extends u{constructor(t,e){e.code=n.oneFromBoc("B5EE9C72410214010002D4000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF264ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1011121302E6D001D0D3032171B0925F04E022D749C120925F04E002D31F218210706C7567BD22821064737472BDB0925F05E003FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F07E005D33FC8258210706C7567BA923830E30D03821064737472BA925F06E30D06070201200809007801FA00F40430F8276F2230500AA121BEF2E0508210706C7567831EB17080185004CB0526CF1658FA0219F400CB6917CB1F5260CB3F20C98040FB0006008A5004810108F45930ED44D0810140D720C801CF16F400C9ED540172B08E23821064737472831EB17080185005CB055003CF1623FA0213CB6ACB1FCB3FC98040FB00925F03E20201200A0B0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580C0D0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200E0F0019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC973FB00C84014810108F451F2A7020070810108D718FA00D33FC8542047810108F451F2A782106E6F746570748018C8CB05CB025006CF165004FA0214CB6A12CB1FCB3FC973FB0002006C810108D718FA00D33F305224810108F459F2A782106473747270748018C8CB05CB025005CF165003FA0213CB6ACB1F12CB3FC973FB00000AF400C9ED54696225E5"),super(t,e),this.options.walletId||(this.options.walletId=698983191+this.options.wc),this.methods.deployAndInstallPlugin=e=>i.createMethod(t,this.deployAndInstallPlugin(e)),this.methods.installPlugin=e=>i.createMethod(t,this.installPlugin(e)),this.methods.removePlugin=e=>i.createMethod(t,this.removePlugin(e)),this.methods.getPublicKey=this.getPublicKey.bind(this),this.methods.getWalletId=this.getWalletId.bind(this),this.methods.isPluginInstalled=this.isPluginInstalled.bind(this),this.methods.getPluginsList=this.getPluginsList.bind(this)}getName(){return"v4R2"}createSigningMessage(t,e,r){t=t||0,e=e||Math.floor(Date.now()/1e3)+60;const i=new n;if(i.bits.writeUint(this.options.walletId,32),0===t)for(let t=0;t<32;t++)i.bits.writeBit(1);else i.bits.writeUint(e,32);return i.bits.writeUint(t,32),r||i.bits.writeUint(0,8),i}createDataCell(){const t=new n;return t.bits.writeUint(0,32),t.bits.writeUint(this.options.walletId,32),t.bits.writeBytes(this.options.publicKey),t.bits.writeUint(0,1),t}async deployAndInstallPlugin(t){const{secretKey:e,seqno:r,pluginWc:n,amount:i,stateInit:s,body:o,expireAt:a}=t,h=this.createSigningMessage(r,a,!0);return h.bits.writeUint(1,8),h.bits.writeInt(n,8),h.bits.writeGrams(i),h.refs.push(s),h.refs.push(o),this.createExternalMessage(h,e,r,!1)}async _setPlugin(t,e){const{secretKey:r,seqno:n,amount:i,queryId:o,expireAt:a}=t,u=new s(t.pluginAddress),c=this.createSigningMessage(n,a,!0);return c.bits.writeUint(e?2:3,8),c.bits.writeInt(u.wc,8),c.bits.writeBytes(u.hashPart),c.bits.writeGrams(i||h("0.1")),c.bits.writeUint(o||0,64),this.createExternalMessage(c,r,n,!1)}async installPlugin(t){return this._setPlugin(t,!0)}async removePlugin(t){return this._setPlugin(t,!1)}async getWalletId(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_subwallet_id")).toNumber()}async getPublicKey(){const t=await this.getAddress();return this.provider.call2(t.toString(),"get_public_key")}async isPluginInstalled(t){t=new s(t);const e="0x"+o(t.hashPart),r=await this.getAddress();return!(await this.provider.call2(r.toString(),"is_plugin_installed",[["num",t.wc],["num",e]])).isZero()}async getPluginsList(){const t=await this.getAddress();return(await this.provider.call2(t.toString(),"get_plugin_list")).map((t=>t[0].toNumber()+":"+t[1].toString(16)))}}d.parseTransferQuery=c,d.parseTransferBody=l,t.exports={WalletV4ContractR2:d}},9552:(t,e,r)=>{const{BN:n}=r(11);function i(t){if(t.loadBits(512),698983191!==t.loadUint(32).toNumber())throw new Error("invalid walletId");const e=t.loadUint(32).toNumber(),r=t.loadUint(32).toNumber();if(3!==t.loadUint(8).toNumber())throw new Error("invalid sendMode");let i=t.loadRef();if(i.loadBit())throw Error("invalid internal header");if(!i.loadBit())throw Error("invalid ihrDisabled");const s=i.loadBit();if(i.loadBit())throw Error("invalid bounced");if(null!==i.loadAddress())throw Error("invalid externalSourceAddress");const o=i.loadAddress(),a=i.loadCoins();if(i.loadBit())throw Error("invalid currencyCollection");if(!i.loadCoins().eq(new n(0)))throw new Error("invalid ihrFees");if(!i.loadCoins().eq(new n(0)))throw new Error("invalid fwdFees");if(!i.loadUint(64).eq(new n(0)))throw new Error("invalid createdLt");if(!i.loadUint(32).eq(new n(0)))throw new Error("invalid createdAt");i.loadBit()&&i.loadRef();let h=null;if(i.getFreeBits()>0&&(i.loadBit()&&(i=i.loadRef()),i.getFreeBits()>32)){const t=i.loadUint(32),e=i.loadBits(i.getFreeBits());h=t.eq(new n(0))?(new TextDecoder).decode(e):""}return{toAddress:o,value:a,bounce:s,seqno:r,expireAt:e,payload:h}}t.exports={parseWalletV3TransferQuery:function(t){const e=t.beginParse();if(2!==e.loadUint(2).toNumber())throw Error("invalid header");if(null!==e.loadAddress())throw Error("invalid externalSourceAddress");const r=e.loadAddress();if(!e.loadCoins().eq(new n(0)))throw new Error("invalid externalImportFee");return e.loadBit()&&e.loadBit()&&e.loadRef(),{fromAddress:r,...i(e.loadBit()?e.loadRef():e)}},parseWalletV3TransferBody:i}},6260:(t,e,r)=>{const{Cell:n}=r(4974),{Address:i,BN:s,toNano:o,bytesToHex:a,hexToBytes:h,nacl:u,stringToBytes:c,bytesToBase64:l}=r(11),{Contract:d}=r(6320),{SimpleWalletContractR1:f,SimpleWalletContractR2:p,SimpleWalletContractR3:m}=r(9871),{WalletV2ContractR1:w,WalletV2ContractR2:g}=r(1549),{WalletV3ContractR1:y,WalletV3ContractR2:v}=r(5022),{WalletV4ContractR1:b}=r(8703),{WalletV4ContractR2:A}=r(5667),E={simpleR1:f,simpleR2:p,simpleR3:m,v2R1:w,v2R2:g,v3R1:y,v3R2:v,v4R1:b,v4R2:A},C=[f,p,m,w,g,y,v,b,A];class B{constructor(t){this.provider=t,this.all=E,this.list=C,this.defaultVersion="v3R1",this.default=this.all[this.defaultVersion]}create(t){return new this.default(this.provider,t)}}B.all=E,B.list=C,t.exports.A=B},7337:(t,e,r)=>{const n=r(11),i=n.Address,s=r(4974),o=r(4563),a=r(4452).A,{Contract:h}=r(6320),u=r(6260).A,c=r(1883).A,l=r(3088).A,d=r(9641).A,f=r(9789).A,{BlockSubscription:p,InMemoryBlockStorage:m}=r(7791),{SubscriptionContract:w}=r(5124),{Payments:g,PaymentChannel:y}=r(7770),v=r(7416).A,b=r(8238).A,A=r(1326).A,{Dns:E,DnsCollection:C,DnsItem:B}=r(9383).A,F="0.0.66";class M{constructor(t){this.version=F,this.utils=n,this.Address=i,this.boc=s,this.Contract=h,this.BlockSubscription=p,this.InMemoryBlockStorage=m,this.provider=t||new a,this.dns=new E(this.provider),this.wallet=new u(this.provider),this.payments=new g(this.provider),this.lockupWallet=c}async getTransactions(t,e=20,r=void 0,n=void 0,i=void 0){return this.provider.getTransactions(t.toString(),e,r,n,i)}async getBalance(t){return this.provider.getBalance(t.toString())}async sendBoc(t){return this.provider.sendBoc(n.bytesToBase64(t))}async call(t,e,r=[]){return this.provider.call(t.toString(),e,r)}}M.version=F,M.utils=n,M.Address=i,M.boc=s,M.HttpProvider=a,M.Contract=h,M.Wallets=u,M.LockupWallets=c,M.SubscriptionContract=w,M.BlockSubscription=p,M.InMemoryBlockStorage=m,M.ledger={TransportWebUSB:v,TransportWebHID:b,BluetoothTransport:A,AppTon:o},M.token={nft:d,ft:f,jetton:f},M.HighloadWallets=l,M.dns=E,M.dns.DnsCollection=C,M.dns.DnsItem=B,M.payments=g,M.payments.PaymentChannel=y,t.exports=M},4563:(t,e,r)=>{var n=r(8287).hp;const{Cell:i}=r(4974),{Address:s,BN:o,bytesToHex:a}=r(11),{Contract:h}=r(6320);t.exports=class{constructor(t,e){this.transport=t,this.ton=e,this.ADDRESS_FORMAT_HEX=0,this.ADDRESS_FORMAT_USER_FRIENDLY=1,this.ADDRESS_FORMAT_URL_SAFE=2,this.ADDRESS_FORMAT_BOUNCEABLE=4,this.ADDRESS_FORMAT_TEST_ONLY=8}async getAppConfiguration(){const t=await this.transport.send(224,1,0,0);return{version:t[0]+"."+t[1]+"."+t[2]}}async getPublicKey(t,e){const r=n.alloc(4);r.writeInt32BE(t);const i=await this.transport.send(224,2,e?1:0,0,r),s=i[0];return{publicKey:new Uint8Array(i.slice(1,1+s))}}async getAddress(t,e,r){const i=n.alloc(4);i.writeInt32BE(t);const o=await this.transport.send(224,5,e?1:0,r,i),h=o[0],u=new Uint8Array(o.slice(1,1+h));return{address:new s("0:"+a(u))}}async sign(t,e){const r=n.alloc(4);r.writeInt32BE(t);const i=n.concat([r,n.from(e)]),s=await this.transport.send(224,3,0,0,i),o=s[0];return{signature:s.slice(1,1+o)}}async transfer(t,e,r,s,o,a){const u=await e.createTransferMessage(null,r,s,o,null,3,!0),c=n.alloc(4);c.writeInt32BE(t);const l=n.concat([c,n.from(await u.signingMessage.toBoc())]),d=await this.transport.send(224,4,a,0,l),f=d[0],p=d.slice(1,1+f),m=new Uint8Array(p),w=new i;w.bits.writeBytes(m),w.writeCell(u.signingMessage);let g=null,y=null,v=null;if(0===o){const t=await e.createStateInit();g=t.stateInit,y=t.code,v=t.data}const b=await e.getAddress(),A=h.createExternalMessageHeader(b),E=h.createCommonMsgInfo(A,g,w),C=new Promise((t=>{t({address:b,message:E,body:w,signature:m,signingMessage:u.signingMessage,stateInit:g,code:y,data:v})}));return h.createMethod(this.ton.provider,C)}}},8518:(t,e,r)=>{const{BN:n,base64ToBytes:i}=r(11),{Cell:s}=r(4974);class o{static parseObject(t){const e=t["@type"];switch(e){case"tvm.list":case"tvm.tuple":return t.elements.map(o.parseObject);case"tvm.cell":return s.oneFromBoc(i(t.bytes));case"tvm.stackEntryCell":return o.parseObject(t.cell);case"tvm.stackEntryTuple":return o.parseObject(t.tuple);case"tvm.stackEntryNumber":return o.parseObject(t.number);case"tvm.numberDecimal":return new n(t.number,10);default:throw new Error("unknown type "+e)}}static parseResponseStack(t){const e=t[0],r=t[1];switch(e){case"num":return new n(r.replace(/0x/,""),16);case"list":case"tuple":return o.parseObject(r);case"cell":const t=i(r.bytes);return s.oneFromBoc(t);default:throw new Error("unknown type "+e)}}static parseResponse(t){if(0!==t.exit_code){const e=new Error("http provider parse response error");throw e.result=t,e}const e=t.stack.map(o.parseResponseStack);return 1===e.length?e[0]:e}static makeArg(t){if(t instanceof n||t instanceof Number)return["num",t];throw new Error("unknown arg type "+t)}static makeArgs(t){return t.map(this.makeArg)}}t.exports.A=o},1467:t=>{const e=t=>({workchain:t.workchain,shardId:t.shard,shardBlockNumber:t.seqno});t.exports={BlockSubscription:class{constructor(t,e,r,n){this.provider=t,this.storage=e,this.onBlock=r,this.startMcBlockNumber=n?n.startMcBlockNumber:void 0,this.mcInterval=(n?n.mcInterval:void 0)||1e4,this.shardsInterval=(n?n.shardsInterval:void 0)||1e3}async start(){if(this.stop(),!this.startMcBlockNumber&&(this.startMcBlockNumber=(await this.provider.getMasterchainInfo()).last.seqno,!this.startMcBlockNumber))throw new Error("Cannot get start mc block number from provider");const t=await this.provider.getMasterchainBlockHeader(this.startMcBlockNumber);if(this.startLT=t.end_lt,!this.startLT)throw new Error("Cannot get startLT from provider");let r=!1;const n=async()=>{if(!r){r=!0;try{const t=await this.storage.getLastMasterchainBlockNumber()||this.startMcBlockNumber;if(!t)throw new Error("no init masterchain block in storage");const r=(await this.provider.getMasterchainInfo()).last.seqno;if(!r)throw new Error("invalid last masterchain block from provider");for(let n=t+1;nn()),this.mcInterval),n();let i=!1;const s=async()=>{if(!i){i=!0;try{const t=await this.storage.getUnprocessedShardBlock();if(t){const{workchain:r,shardId:n,shardBlockNumber:i}=t,s=await this.provider.getBlockHeader(r,n,i);if(s.end_lts()),this.shardsInterval)}stop(){clearInterval(this.mcIntervalId),clearInterval(this.shardsIntervalId)}}}},8625:t=>{t.exports={InMemoryBlockStorage:class{constructor(t){this.masterchainBlocks={},this.shardchainBlocks={},this.logFunction=t}async insertShardBlocks(t){for(const{workchain:e,shardId:r,shardBlockNumber:n}of t)void 0===this.shardchainBlocks[e+"_"+r+"_"+n]&&(this.logFunction&&this.logFunction("insert shard "+e+" "+r+" "+n),this.shardchainBlocks[e+"_"+r+"_"+n]=!1)}async insertBlocks(t,e){if(this.logFunction&&this.logFunction("mc processed "+t),void 0!==this.masterchainBlocks[t])throw new Error("mc already exists "+t);this.masterchainBlocks[t]=!0,await this.insertShardBlocks(e)}async getLastMasterchainBlockNumber(){return Object.keys(this.masterchainBlocks).map((t=>Number(t))).sort(((t,e)=>e-t))[0]}async setBlockProcessed(t,e,r,n){if(this.logFunction&&this.logFunction("shard processed "+t+" "+e+" "+r),void 0===this.shardchainBlocks[t+"_"+e+"_"+r])throw new Error("shard not exists "+t+"_"+e+"_"+r);this.shardchainBlocks[t+"_"+e+"_"+r]=!0,await this.insertShardBlocks(n)}async getUnprocessedShardBlock(){for(let t in this.shardchainBlocks)if(!1===this.shardchainBlocks[t]){const e=t.split("_");return{workchain:Number(e[0]),shardId:e[1],shardBlockNumber:Number(e[2])}}}}}},7791:(t,e,r)=>{const{BlockSubscription:n}=r(1467),{InMemoryBlockStorage:i}=r(8625);t.exports={BlockSubscription:n,InMemoryBlockStorage:i}},4452:(t,e,r)=>{const{Cell:n}=r(4974),{base64ToBytes:i}=r(11),s=r(8518).A;"undefined"==typeof fetch&&(fetch=r(3301));const o="-9223372036854775808";class a{constructor(t,e){this.host=t||"https://toncenter.com/api/v2/jsonRPC",this.options=e||{}}sendImpl(t,e){const r={"Content-Type":"application/json"};return this.options.apiKey&&(r["X-API-Key"]=this.options.apiKey),fetch(t,{method:"POST",headers:r,body:JSON.stringify(e)}).then((t=>t.json())).then((({result:t,error:e})=>t||Promise.reject(e)))}send(t,e){return this.sendImpl(this.host,{id:1,jsonrpc:"2.0",method:t,params:e})}async getAddressInfo(t){return this.send("getAddressInformation",{address:t})}async getExtendedAddressInfo(t){return this.send("getExtendedAddressInformation",{address:t})}async getWalletInfo(t){return this.send("getWalletInformation",{address:t})}async getTransactions(t,e=20,r=void 0,n=void 0,i=void 0,s=void 0){return this.send("getTransactions",{address:t,limit:e,lt:r,hash:n,to_lt:i,archival:s})}async getBalance(t){return this.send("getAddressBalance",{address:t})}async sendBoc(t){return this.send("sendBoc",{boc:t})}async sendQuery(t){return this.send("sendQuerySimple",t)}async getEstimateFee(t){return this.send("estimateFee",t)}async call(t,e,r=[]){return this.send("runGetMethod",{address:t,method:e,stack:r})}async call2(t,e,r=[]){const n=await this.send("runGetMethod",{address:t,method:e,stack:r});return s.parseResponse(n)}async getConfigParam(t){const e=await this.send("getConfigParam",{config_id:t});if("configInfo"!==e["@type"])throw new Error("getConfigParam expected type configInfo");if(!e.config)throw new Error("getConfigParam expected config");if("tvm.cell"!==e.config["@type"])throw new Error("getConfigParam expected type tvm.cell");if(!e.config.bytes)throw new Error("getConfigParam expected bytes");return n.oneFromBoc(i(e.config.bytes))}async getMasterchainInfo(){return this.send("getMasterchainInfo",{})}async getBlockShards(t){return this.send("shards",{seqno:t})}async getBlockTransactions(t,e,r,n,i,s){return this.send("getBlockTransactions",{workchain:t,shard:e,seqno:r,count:n,after_lt:i,after_hash:s})}async getMasterchainBlockTransactions(t,e,r,n){return this.getBlockTransactions(-1,o,t,e,r,n)}async getBlockHeader(t,e,r){return this.send("getBlockHeader",{workchain:t,shard:e,seqno:r})}async getMasterchainBlockHeader(t){return this.getBlockHeader(-1,o,t)}}a.SHARD_ID_ALL=o,t.exports.A=a},4199:(t,e,r)=>{const{crc16:n,hexToBytes:i,bytesToHex:s,stringToBytes:o,base64toString:a,stringToBase64:h}=r(5542);class u{static isValid(t){try{return new u(t),!0}catch(t){return!1}}constructor(t){if(null==t)throw"Invalid address";if(t instanceof u)return this.wc=t.wc,this.hashPart=t.hashPart,this.isTestOnly=t.isTestOnly,this.isUserFriendly=t.isUserFriendly,this.isBounceable=t.isBounceable,void(this.isUrlSafe=t.isUrlSafe);if(this.isUrlSafe=!0,t.search(/\-/)>0||t.search(/_/)>0?t=t.replace(/\-/g,"+").replace(/_/g,"/"):this.isUrlSafe=!1,t.indexOf(":")>-1){const e=t.split(":");if(2!==e.length)throw new Error("Invalid address "+t);const r=parseInt(e[0]);if(0!==r&&-1!==r)throw new Error("Invalid address wc "+t);const n=e[1];if(64!==n.length)throw new Error("Invalid address hex "+t);this.isUserFriendly=!1,this.wc=r,this.hashPart=i(n),this.isTestOnly=!1,this.isBounceable=!1}else{this.isUserFriendly=!0;const e=function(t){if(48!==t.length)throw new Error("User-friendly address should contain strictly 48 characters");const e=o(a(t));if(36!==e.length)throw"Unknown address type: byte length is not equal to 36";const r=e.slice(0,34),i=e.slice(34,36),s=n(r);if(s[0]!==i[0]||s[1]!==i[1])throw"Wrong crc16 hashsum";let h=r[0],u=!1,c=!1;if(128&h&&(u=!0,h^=128),17!==h&&81!==h)throw"Unknown address tag";c=17===h;let l=null;if(l=255===r[1]?-1:r[1],0!==l&&-1!==l)throw new Error("Invalid address wc "+l);return{isTestOnly:u,isBounceable:c,workchain:l,hashPart:r.slice(2,34)}}(t);this.wc=e.workchain,this.hashPart=e.hashPart,this.isTestOnly=e.isTestOnly,this.isBounceable=e.isBounceable}}toString(t,e,r,i){if(void 0===t&&(t=this.isUserFriendly),void 0===e&&(e=this.isUrlSafe),void 0===r&&(r=this.isBounceable),void 0===i&&(i=this.isTestOnly),t){let t=r?17:81;i&&(t|=128);const s=new Int8Array(34);s[0]=t,s[1]=this.wc,s.set(this.hashPart,2);const o=new Uint8Array(36);o.set(s),o.set(n(s),34);let a=h(String.fromCharCode.apply(null,new Uint8Array(o)));return e&&(a=a.replace(/\+/g,"-").replace(/\//g,"_")),a}return this.wc+":"+s(this.hashPart)}}t.exports.A=u},7206:(t,e,r)=>{const{hexToBytes:n,bytesToHex:i}=r(5542);class s{static isValid(t){try{return new s(t),!0}catch(t){return!1}}constructor(t){if(null==t)throw"Invalid address";if(t instanceof s)this.bytes=t.bytes;else if(t instanceof Uint8Array){if(32!==t.length)throw new Error("invalid adnl bytes length");this.bytes=t}else{if("string"!=typeof t)throw new Error("unsupported type");if(64!==t.length)throw new Error("invalid adnl hex length");this.bytes=n(t)}}toHex(){let t=i(this.bytes);for(;t.length<64;)t="0"+t;return t}}t.exports.A=s},191:(t,e,r)=>{const{hexToBytes:n,bytesToHex:i}=r(5542);class s{static isValid(t){try{return new s(t),!0}catch(t){return!1}}constructor(t){if(null==t)throw"Invalid address";if(t instanceof s)this.bytes=t.bytes;else if(t instanceof Uint8Array){if(32!==t.length)throw new Error("invalid bag id bytes length");this.bytes=t}else{if("string"!=typeof t)throw new Error("unsupported type");if(64!==t.length)throw new Error("invalid bag id hex length");this.bytes=n(t)}}toHex(){let t=i(this.bytes);for(;t.length<64;)t="0"+t;return t}}t.exports.A=s},5542:(t,e,r)=>{var n=r(8287).hp;const i=r(897),s=r(8947),o=r(1216),a="undefined"!=typeof self&&self.crypto&&self.crypto.subtle;let h=null;a||(h=r(5047));const u=[],c={};for(let t=0;t<=255;t++){let e=t.toString(16);e.length<2&&(e="0"+e),u.push(e),c[e]=t}const l=(()=>{const t=[],e="A".charCodeAt(0),r="a".charCodeAt(0),n="0".charCodeAt(0);for(let r=0;r<26;++r)t.push(String.fromCharCode(e+r));for(let e=0;e<26;++e)t.push(String.fromCharCode(r+e));for(let e=0;e<10;++e)t.push(String.fromCharCode(n+e));return t.push("+"),t.push("/"),t})();function d(t){return"undefined"==typeof self?n.from(t,"base64").toString("binary"):atob(t)}t.exports={BN:i,nacl:s,sha256:function(t){return a?crypto.subtle.digest("SHA-256",t):h.subtle.digest({name:"SHA-256"},t)},fromNano:function(t){if(!i.isBN(t)&&"string"!=typeof t)throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return o.fromWei(t,"gwei")},toNano:function(t){if(!i.isBN(t)&&"string"!=typeof t)throw new Error("Please pass numbers as strings or BN objects to avoid precision errors.");return o.toWei(t,"gwei")},bytesToHex:function(t){const e=[];for(let r=0;r>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1)?t>>>1^r:t>>>1;return 4294967295^t}(0,t),r=new ArrayBuffer(4);return new DataView(r).setUint32(0,e,!1),new Uint8Array(r).reverse()},crc16:function(t){let e=0;const r=new Uint8Array(t.length+2);r.set(t);for(let t of r){let r=128;for(;r>0;)e<<=1,t&r&&(e+=1),r>>=1,e>65535&&(e&=65535,e^=4129)}return new Uint8Array([Math.floor(e/256),e%256])},concatBytes:function(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},bytesToBase64:function(t){let e,r="";const n=t.length;for(e=2;e>2],r+=l[(3&t[e-2])<<4|t[e-1]>>4],r+=l[(15&t[e-1])<<2|t[e]>>6],r+=l[63&t[e]];return e===n+1&&(r+=l[t[e-2]>>2],r+=l[(3&t[e-2])<<4],r+="=="),e===n&&(r+=l[t[e-2]>>2],r+=l[(3&t[e-2])<<4|t[e-1]>>4],r+=l[(15&t[e-1])<<2],r+="="),r},base64ToBytes:function(t){const e=d(t),r=e.length,n=new Uint8Array(r);for(let t=0;t{const{BN:n,nacl:i,sha256:s,fromNano:o,toNano:a,bytesToHex:h,hexToBytes:u,stringToBytes:c,crc32c:l,crc16:d,concatBytes:f,bytesToBase64:p,base64ToBytes:m,base64toString:w,stringToBase64:g,compareBytes:y,readNBytesUIntFromArray:v,keyPairFromSeed:b,newKeyPair:A,newSeed:E}=r(5542),C=r(4199).A,B=r(7206).A,F=r(191).A;t.exports={Address:C,AdnlAddress:B,StorageBagId:F,BN:n,nacl:i,sha256:s,fromNano:o,toNano:a,bytesToHex:h,hexToBytes:u,stringToBytes:c,crc32c:l,crc16:d,concatBytes:f,bytesToBase64:p,base64ToBytes:m,base64toString:w,stringToBase64:g,compareBytes:y,readNBytesUIntFromArray:v,parseTransferUrl:function(t){const e="ton://transfer/";if(!t.startsWith(e))throw new Error("must starts with "+e);const r=t.substring(15).split("?");if(r.length>2)throw new Error('multiple "?"');const i=r[0];if(!C.isValid(i))throw new Error("invalid address format "+i);const s={address:i},o=r[1];if(o&&o.length){const t=o.split("&").map((t=>t.split("=")));for(const e of t){if(2!==e.length)throw new Error("invalid url pair");const t=e[0],r=e[1];if("amount"===t){if(s.amount)throw new Error("amount already set");if(new n(r).isNeg())throw new Error("negative amount");s.amount=r}else{if("text"!==t)throw new Error("unknown url var "+t);if(s.text)throw new Error("text already set");s.text=decodeURIComponent(r)}}}return s},formatTransferUrl:function(t,e,r){let n="ton://transfer/"+t;const i=[];return e&&i.push("amount="+e),r&&i.push("text="+encodeURIComponent(r)),0===i.length?n:n+"?"+i.join("&")},keyPairFromSeed:b,newKeyPair:A,newSeed:E}},8947:(t,e,r)=>{!function(t){"use strict";var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function m(t,e,r,n,i){var s,o=0;for(s=0;s>>8)-1}function w(t,e,r,n){return m(t,e,r,n,16)}function g(t,e,r,n){return m(t,e,r,n,32)}function y(t,e,r,n){!function(t,e,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,f=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,w=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,A=s,E=o,C=a,B=h,F=u,M=c,D=l,S=d,_=f,I=p,x=m,T=w,N=g,U=y,R=v,L=b,k=0;k<20;k+=2)A^=(i=(N^=(i=(_^=(i=(F^=(i=A+N|0)<<7|i>>>25)+A|0)<<9|i>>>23)+F|0)<<13|i>>>19)+_|0)<<18|i>>>14,M^=(i=(E^=(i=(U^=(i=(I^=(i=M+E|0)<<7|i>>>25)+M|0)<<9|i>>>23)+I|0)<<13|i>>>19)+U|0)<<18|i>>>14,x^=(i=(D^=(i=(C^=(i=(R^=(i=x+D|0)<<7|i>>>25)+x|0)<<9|i>>>23)+R|0)<<13|i>>>19)+C|0)<<18|i>>>14,L^=(i=(T^=(i=(S^=(i=(B^=(i=L+T|0)<<7|i>>>25)+L|0)<<9|i>>>23)+B|0)<<13|i>>>19)+S|0)<<18|i>>>14,A^=(i=(B^=(i=(C^=(i=(E^=(i=A+B|0)<<7|i>>>25)+A|0)<<9|i>>>23)+E|0)<<13|i>>>19)+C|0)<<18|i>>>14,M^=(i=(F^=(i=(S^=(i=(D^=(i=M+F|0)<<7|i>>>25)+M|0)<<9|i>>>23)+D|0)<<13|i>>>19)+S|0)<<18|i>>>14,x^=(i=(I^=(i=(_^=(i=(T^=(i=x+I|0)<<7|i>>>25)+x|0)<<9|i>>>23)+T|0)<<13|i>>>19)+_|0)<<18|i>>>14,L^=(i=(R^=(i=(U^=(i=(N^=(i=L+R|0)<<7|i>>>25)+L|0)<<9|i>>>23)+N|0)<<13|i>>>19)+U|0)<<18|i>>>14;A=A+s|0,E=E+o|0,C=C+a|0,B=B+h|0,F=F+u|0,M=M+c|0,D=D+l|0,S=S+d|0,_=_+f|0,I=I+p|0,x=x+m|0,T=T+w|0,N=N+g|0,U=U+y|0,R=R+v|0,L=L+b|0,t[0]=A>>>0&255,t[1]=A>>>8&255,t[2]=A>>>16&255,t[3]=A>>>24&255,t[4]=E>>>0&255,t[5]=E>>>8&255,t[6]=E>>>16&255,t[7]=E>>>24&255,t[8]=C>>>0&255,t[9]=C>>>8&255,t[10]=C>>>16&255,t[11]=C>>>24&255,t[12]=B>>>0&255,t[13]=B>>>8&255,t[14]=B>>>16&255,t[15]=B>>>24&255,t[16]=F>>>0&255,t[17]=F>>>8&255,t[18]=F>>>16&255,t[19]=F>>>24&255,t[20]=M>>>0&255,t[21]=M>>>8&255,t[22]=M>>>16&255,t[23]=M>>>24&255,t[24]=D>>>0&255,t[25]=D>>>8&255,t[26]=D>>>16&255,t[27]=D>>>24&255,t[28]=S>>>0&255,t[29]=S>>>8&255,t[30]=S>>>16&255,t[31]=S>>>24&255,t[32]=_>>>0&255,t[33]=_>>>8&255,t[34]=_>>>16&255,t[35]=_>>>24&255,t[36]=I>>>0&255,t[37]=I>>>8&255,t[38]=I>>>16&255,t[39]=I>>>24&255,t[40]=x>>>0&255,t[41]=x>>>8&255,t[42]=x>>>16&255,t[43]=x>>>24&255,t[44]=T>>>0&255,t[45]=T>>>8&255,t[46]=T>>>16&255,t[47]=T>>>24&255,t[48]=N>>>0&255,t[49]=N>>>8&255,t[50]=N>>>16&255,t[51]=N>>>24&255,t[52]=U>>>0&255,t[53]=U>>>8&255,t[54]=U>>>16&255,t[55]=U>>>24&255,t[56]=R>>>0&255,t[57]=R>>>8&255,t[58]=R>>>16&255,t[59]=R>>>24&255,t[60]=L>>>0&255,t[61]=L>>>8&255,t[62]=L>>>16&255,t[63]=L>>>24&255}(t,e,r,n)}function v(t,e,r,n){!function(t,e,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,h=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,f=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,w=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,b=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,A=0;A<20;A+=2)s^=(i=(g^=(i=(f^=(i=(u^=(i=s+g|0)<<7|i>>>25)+s|0)<<9|i>>>23)+u|0)<<13|i>>>19)+f|0)<<18|i>>>14,c^=(i=(o^=(i=(y^=(i=(p^=(i=c+o|0)<<7|i>>>25)+c|0)<<9|i>>>23)+p|0)<<13|i>>>19)+y|0)<<18|i>>>14,m^=(i=(l^=(i=(a^=(i=(v^=(i=m+l|0)<<7|i>>>25)+m|0)<<9|i>>>23)+v|0)<<13|i>>>19)+a|0)<<18|i>>>14,b^=(i=(w^=(i=(d^=(i=(h^=(i=b+w|0)<<7|i>>>25)+b|0)<<9|i>>>23)+h|0)<<13|i>>>19)+d|0)<<18|i>>>14,s^=(i=(h^=(i=(a^=(i=(o^=(i=s+h|0)<<7|i>>>25)+s|0)<<9|i>>>23)+o|0)<<13|i>>>19)+a|0)<<18|i>>>14,c^=(i=(u^=(i=(d^=(i=(l^=(i=c+u|0)<<7|i>>>25)+c|0)<<9|i>>>23)+l|0)<<13|i>>>19)+d|0)<<18|i>>>14,m^=(i=(p^=(i=(f^=(i=(w^=(i=m+p|0)<<7|i>>>25)+m|0)<<9|i>>>23)+w|0)<<13|i>>>19)+f|0)<<18|i>>>14,b^=(i=(v^=(i=(y^=(i=(g^=(i=b+v|0)<<7|i>>>25)+b|0)<<9|i>>>23)+g|0)<<13|i>>>19)+y|0)<<18|i>>>14;t[0]=s>>>0&255,t[1]=s>>>8&255,t[2]=s>>>16&255,t[3]=s>>>24&255,t[4]=c>>>0&255,t[5]=c>>>8&255,t[6]=c>>>16&255,t[7]=c>>>24&255,t[8]=m>>>0&255,t[9]=m>>>8&255,t[10]=m>>>16&255,t[11]=m>>>24&255,t[12]=b>>>0&255,t[13]=b>>>8&255,t[14]=b>>>16&255,t[15]=b>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=f>>>0&255,t[25]=f>>>8&255,t[26]=f>>>16&255,t[27]=f>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function A(t,e,r,n,i,s,o){var a,h,u=new Uint8Array(16),c=new Uint8Array(64);for(h=0;h<16;h++)u[h]=0;for(h=0;h<8;h++)u[h]=s[h];for(;i>=64;){for(y(c,u,o,b),h=0;h<64;h++)t[e+h]=r[n+h]^c[h];for(a=1,h=8;h<16;h++)a=a+(255&u[h])|0,u[h]=255&a,a>>>=8;i-=64,e+=64,n+=64}if(i>0)for(y(c,u,o,b),h=0;h