PageSourceSearch

https://pumpkinspool.com/wp-content/plugins/pumpkin-pool-core/asse…/index.min.js?ver=8324ab062c12e900fb44

js pumpkinspool.com collected 2026-10-09 03:02:17 UTC 1,172,012 bytes, 2 lines download raw bytes

1(()=>{var e,t,n={7557:(e,t)=>{"use strict";function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function r(e,...t){if(!((n=e)instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}Object.defineProperty(t,"__esModule",{value:!0}),t.anumber=n,t.abytes=r,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");n(e.outputLen),n(e.blockLen)},t.aexists=function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},t.aoutput=function(e,t){r(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}},7202:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HashMD=void 0,t.setBigUint64=i,t.Chi=function(e,t,n){return e&t^~e&n},t.Maj=function(e,t,n){return e&t^e&n^t&n};const r=n(7557),o=n(9175);function i(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}class s extends o.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,o.createView)(this.buffer)}update(e){(0,r.aexists)(this);const{view:t,buffer:n,blockLen:i}=this,s=(e=(0,o.toBytes)(e)).length;for(let r=0;r<s;){const a=Math.min(i-this.pos,s-r);if(a!==i)n.set(e.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===i&&(this.process(t,0),this.pos=0);else{const t=(0,o.createView)(e);for(;i<=s-r;r+=i)this.process(t,r)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,r.aexists)(this),(0,r.aoutput)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:a}=this;let{pos:c}=this;t[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>s-c&&(this.process(n,0),c=0);for(let e=c;e<s;e++)t[e]=0;i(n,s-8,BigInt(8*this.length),a),this.process(n,0);const u=(0,o.createView)(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<h;e++)u.setUint32(4*e,d[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:o,destroyed:i,pos:s}=this;return e.length=r,e.pos=s,e.finished=o,e.destroyed=i,r%t&&e.buffer.set(n),e}}t.HashMD=s},5145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},2623:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=t.SHA256=void 0;const r=n(7202),o=n(9175),i=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class c extends r.HashMD{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)a[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=a[e-15],n=a[e-2],r=(0,o.rotr)(t,7)^(0,o.rotr)(t,18)^t>>>3,i=(0,o.rotr)(n,17)^(0,o.rotr)(n,19)^n>>>10;
1a[e]=i+a[e-7]+r+a[e-16]|0}let{A:n,B:s,C:c,D:u,E:l,F:h,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,o.rotr)(l,6)^(0,o.rotr)(l,11)^(0,o.rotr)(l,25))+(0,r.Chi)(l,h,d)+i[e]+a[e]|0,p=((0,o.rotr)(n,2)^(0,o.rotr)(n,13)^(0,o.rotr)(n,22))+(0,r.Maj)(n,s,c)|0;f=d,d=h,h=l,l=u+t|0,u=c,c=s,s=n,n=t+p|0}n=n+this.A|0,s=s+this.B|0,c=c+this.C|0,u=u+this.D|0,l=l+this.E|0,h=h+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(n,s,c,u,l,h,d,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.SHA256=c;class u extends c{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,o.wrapConstructor)((()=>new c)),t.sha224=(0,o.wrapConstructor)((()=>new u))},9175:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.isLE=void 0,t.isBytes=function(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=i,t.byteSwap32=function(e){for(let t=0;t<e.length;t++)e[t]=i(e[t])},t.bytesToHex=function(e){(0,o.abytes)(e);let t="";for(let n=0;n<e.length;n++)t+=s[e[n]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,o=0;t<n;t++,o+=2){const n=c(e.charCodeAt(o)),i=c(e.charCodeAt(o+1));if(void 0===n||void 0===i){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[t]=16*n+i}return r},t.asyncLoop=async function(e,n,r){let o=Date.now();for(let i=0;i<e;i++){r(i);const e=Date.now()-o;e>=0&&e<n||(await(0,t.nextTick)(),o+=e)}},t.utf8ToBytes=u,t.toBytes=l,t.concatBytes=function(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];(0,o.abytes)(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const o=e[t];n.set(o,r),r+=o.length}return n},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(l(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(l(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(l(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(e));if(r.crypto&&"function"==typeof r.crypto.randomBytes)return r.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")};const r=n(5145),o=n(7557);function i(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.byteSwapIfBE=t.isLE?e=>e:e=>i(e);const s=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0"))),a={_0:48,_9:57,A:65,F:70,a:97,f:102};function c(e){return e>=a._0&&e<=a._9?e-a._0:e>=a.A&&e<=a.F?e-(a.A-10):e>=a.a&&e<=a.f?e-(a.a-10):void 0}function u(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function l(e){return"string"==typeof e&&(e=u(e)),(0,o.abytes)(e),e}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}}},4362:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getMaxVoterWeightRecordAddress=t.MaxVoterWeightRecord=t.getVoterWeightRecordAddress=t.VoterWeightRecord=t.VoterWeightAction=void 0;const o=n(2643);var i;(i=t.VoterWeightAction||(t.VoterWeightAction={}))[i.CastVote=0]="CastVote",i[i.CommentProposal=1]="CommentProposal",i[i.CreateGovernance=2]="CreateGovernance",i[i.CreateProposal=3]="CreateProposal",i[i.SignOffProposal=4]="SignOffProposal",t.VoterWeightRecord=class{constructor(e){this.accountDiscriminator=new Uint8Array([50,101,102,57,57,98,52,98]),this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.governingTokenOwner=e.governingTokenOwner,this.voterWeight=e.voterWeight,this.voterWeightExpiry=e.voterWeightExpiry,this.weightAction=e.weightAction,this.weightActionTarget=e.weightActionTarget}},t.getVoterWeightRecordAddress=async function(e,t,n,i){const[s]=await o.PublicKey.findProgramAddress([r.from("voter-weight-record"),t.toBuffer(),n.toBuffer(),i.toBuffer()],e);return s},t.MaxVoterWeightRecord=class{constructor(e){this.accountDiscriminator=new Uint8Array([57,100,53,102,102,50,57,55]),this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.maxVoterWeight=e.maxVoterWeight,this.maxVoterWeightExpiry=e.maxVoterWeightExpiry}},t.getMaxVoterWeightRecordAddress=async function(e,t,n){const[i]=await o.PublicKey.findProgramAddress([r.from("max-voter-weight-record"),t.toBuffer(),n.toBuffer()],e);return i}},1344:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceAddinAccount=t.getVoterWeightRecord=t.getMaxVoterWeightRecord=void 0;const r=n(4362),o=n(8465);async function i(e,t,n){const r=await e.getAccountInfo(t);if(!r)throw new Error(`Account ${t} of type ${n.name} not found`);return(0,o.GovernanceAddinAccountParser)(n)(t,r)}t.getMaxVoterWeightRecord=async function(e,t){return i(e,t,r.MaxVoterWeightRecord)},t.getVoterWeightRecord=async function(e,t){return i(e,t,r.VoterWeightRecord)},t.getGovernanceAddinAccount=i},3356:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(4362),t),o(n(1344),t),o(n(8465),t)},8465:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GovernanceAddinAccountParser=t.GOVERNANCE_ADDINS_SCHEMA=void 0;const r=n(4362),o=n(4747);t.GOVERNANCE_ADDINS_SCHEMA=new Map([[r.MaxVoterWeightRecord,{kind:"struct",fields:[["accountDiscriminator",[8]],["realm","pubkey"],["governingTokenMint","pubkey"],["maxVoterWeight","u64"],["maxVoterWeightExpiry",{kind:"option",type:"u64"}]]}],[r.VoterWeightRecord,{kind:"struct",fields:[["accountDiscriminator",[8]],["realm","pubkey"],["governingTokenMint","pubkey"],["governingTokenOwner","pubkey"],["voterWeight","u64"],["voterWeightExpiry",{kind:"option",type:"u64"}],["weightAction",{kind:"option",type:"u8"}],["weightActionTarget",{kind:"option",type:"pubkey"}]]}]]),t.GovernanceAddinAccountParser=e=>(0,o.BorshAccountParser)(e,(e=>t.GOVERNANCE_ADDINS_SCHEMA))},9771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMessage=t.ChatMessageBody=t.ChatMessageBodyType=t.GovernanceChatAccountType=t.GOVERNANCE_CHAT_PROGRAM_ID=void 0;const r=n(2643);var o,i;t.GOVERNANCE_CHAT_PROGRAM_ID=new r.PublicKey("gCHAtYKrUUktTVzE4hEnZdLV4LXrdBf6Hh9qMaJALET"),function(e){e[e.Uninitialized=0]="Uninitialized",e[e.ChatMessage=1]="ChatMessage"}(o=t.GovernanceChatAccountType||(t.GovernanceChatAccountType={})),(i=t.ChatMessageBodyType||(t.ChatMessageBodyType={}))[i.Text=0]="Text",i[i.Reaction=1]="Reaction",t.ChatMessageBody=class{constructor(e){var t;this.type=e.type,this.value=e.value,this.isReply=null!==(t=e.isReply)&&void 0!==t&&t}},t.ChatMessage=class{constructor(e){this.accountType=o.ChatMessage,this.proposal=e.proposal,this.author=e.author,this.postedAt=e.postedAt,this.replyTo=e.replyTo,this.body=e.body}}},9799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceChatMessagesByVoter=t.getGovernanceChatMessages=void 0;const r=n(2854),o=n(9771),i=n(4946);t.getGovernanceChatMessages=function(e,t,n){return(0,r.getBorshProgramAccounts)(e,t,(e=>i.GOVERNANCE_CHAT_SCHEMA),o.ChatMessage,[(0,r.pubkeyFilter)(1,n)])},t.getGovernanceChatMessagesByVoter=function(e,t,n){return(0,r.getBorshProgramAccounts)(e,t,(e=>i.GOVERNANCE_CHAT_SCHEMA),o.ChatMessage,[(0,r.pubkeyFilter)(33,n)])}},6787:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(9771),t),o(n(9799),t),o(n(9554),t),o(n(4946),t),o(n(6560),t)},9554:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.PostChatMessageArgs=t.GovernanceChatInstruction=void 0,function(e){e[e.PostMessage=0]="PostMessage"}(n=t.GovernanceChatInstruction||(t.GovernanceChatInstruction={})),t.PostChatMessageArgs=class{constructor(e){this.instruction=n.PostMessage,this.body=e.body}}},4946:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAccountParser=t.GOVERNANCE_CHAT_SCHEMA=void 0;const r=n(9771),o=n(4747),i=n(9554);t.GOVERNANCE_CHAT_SCHEMA=new Map([[r.ChatMessageBody,{kind:"struct",fields:[["type","u8"],["value","string"],["isReply","u8"]]}],[r.ChatMessage,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["author","pubkey"],["postedAt","u64"],["replyTo",{kind:"option",type:"pubkey"}],["body",r.ChatMessageBody]]}],[i.PostChatMessageArgs,{kind:"struct",fields:[["instruction","u8"],["body",r.ChatMessageBody]]}]]),t.ChatAccountParser=e=>(0,o.BorshAccountParser)(e,(e=>t.GOVERNANCE_CHAT_SCHEMA))},6560:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withPostChatMessage=void 0;const o=n(2643),i=n(4946),s=n(1656),a=n(9554),c=n(3687),u=n(8532);t.withPostChatMessage=async function(e,t,n,l,h,d,f,p,g,y,m,w,v){const b=new a.PostChatMessageArgs({body:w}),A=r.from((0,s.serialize)(i.GOVERNANCE_CHAT_SCHEMA,b)),k=new o.Keypair;t.push(k);let _=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!0},{pubkey:k.publicKey,isWritable:!0,isSigner:!0},{pubkey:y,isWritable:!1,isSigner:!0},{pubkey:c.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];return m&&_.push({pubkey:m,isWritable:!1,isSigner:!1}),await(0,u.withRealmConfigPluginAccounts)(_,l,h,v),e.push(new o.TransactionInstruction({keys:_,programId:n,data:A})),k.publicKey}},5928:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2854:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getBorshProgramAccounts=t.booleanFilter=t.pubkeyFilter=t.MemcmpFilter=t.RpcContext=void 0;const i=n(2643),s=o(n(2754)),a=n(3245),c=n(1388),u=n(6824);t.RpcContext=class{constructor(e,t,n,r,o){this.programId=e,this.wallet=n,this.connection=r,this.endpoint=o,this.programVersion=t}get walletPubkey(){var e;if(!(null===(e=this.wallet)||void 0===e?void 0:e.publicKey))throw new u.WalletNotConnectedError;return this.wallet.publicKey}get programIdBase58(){return this.programId.toBase58()}};class l{constructor(e,t){this.offset=e,this.bytes=t}isMatch(e){if(this.offset+this.bytes.length>e.length)return!1;for(let t=0;t<this.bytes.length;t++)if(this.bytes[t]!==e[this.offset+t])return!1;return!0}}t.MemcmpFilter=l,t.pubkeyFilter=(e,t)=>t?new l(e,t.toBuffer()):void 0,t.booleanFilter=(e,t)=>new l(e,r.from(t?[1]:[0])),t.getBorshProgramAccounts=async function(e,t,n,r,o=[],u){u=null!=u?u:new r({}).accountType;const l=await e.getProgramAccounts(t,{commitment:e.commitment,filters:[{memcmp:{offset:0,bytes:s.default.encode([u])}},...o.map((e=>({memcmp:{offset:e.offset,bytes:s.default.encode(e.bytes)}})))]});let h=[];for(let e of l)try{const t=e.account.data,o=t[0],s={pubkey:new i.PublicKey(e.pubkey),account:(0,c.deserializeBorsh)(n(o),r,t),owner:e.account.owner};h.push(s)}catch(t){console.info(`Can't deserialize ${r.name} @ ${e.pubkey}.`,(0,a.getErrorMessage)(t))}return h}},5054:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(5928),t),o(n(2854),t),o(n(4747),t)},4747:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BorshAccountParser=void 0;const o=n(1388);t.BorshAccountParser=function(e,t){return(n,i)=>{const s=r.from(i.data),a=(0,o.deserializeBorsh)(t(i.data[0]),e,s);return{pubkey:n,owner:i.owner,account:a}}}},2921:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getProposalDepositAddress=t.getGoverningTokenHoldingAddress=t.getNativeTreasuryAddress=t.getProgramMetadataAddress=t.ProgramMetadata=t.getProposalTransactionAddress=t.ProposalTransaction=t.InstructionData=t.AccountMetaData=t.getVoteRecordAddress=t.VoteRecord=t.VoteWeight=t.getSignatoryRecordAddress=t.SignatoryRecord=t.ProposalDeposit=t.Proposal=t.ProposalOption=t.OptionVoteResult=t.ProposalState=t.getTokenOwnerRecordAddress=t.TokenOwnerRecord=t.Governance=t.GovernanceConfig=t.getRealmConfigAddress=t.RealmConfigAccount=t.GoverningTokenConfig=t.getTokenHoldingAddress=t.Realm=t.RealmConfig=t.GoverningTokenConfigAccountArgs=t.GoverningTokenConfigArgs=t.GoverningTokenType=t.RealmConfigArgs=t.VoteType=t.MultiChoiceType=t.VoteTypeKind=t.MintMaxVoteWeightSource=t.MintMaxVoteWeightSourceType=t.Instru
1ctionExecutionFlags=t.InstructionExecutionStatus=t.VoteTipping=t.VoteThreshold=t.VoteThresholdType=t.getGovernanceAccountVersion=t.getAccountTypes=t.GovernanceAccountType=t.GOVERNANCE_PROGRAM_SEED=void 0;const i=n(2643),s=o(n(9404)),a=o(n(1594)),c=n(5152),u=n(1007);var l,h,d,f,p,g,y,m,w,v,b;t.GOVERNANCE_PROGRAM_SEED="governance",function(e){e[e.Uninitialized=0]="Uninitialized",e[e.RealmV1=1]="RealmV1",e[e.TokenOwnerRecordV1=2]="TokenOwnerRecordV1",e[e.GovernanceV1=3]="GovernanceV1",e[e.ProgramGovernanceV1=4]="ProgramGovernanceV1",e[e.ProposalV1=5]="ProposalV1",e[e.SignatoryRecordV1=6]="SignatoryRecordV1",e[e.VoteRecordV1=7]="VoteRecordV1",e[e.ProposalInstructionV1=8]="ProposalInstructionV1",e[e.MintGovernanceV1=9]="MintGovernanceV1",e[e.TokenGovernanceV1=10]="TokenGovernanceV1",e[e.RealmConfig=11]="RealmConfig",e[e.VoteRecordV2=12]="VoteRecordV2",e[e.ProposalTransactionV2=13]="ProposalTransactionV2",e[e.ProposalV2=14]="ProposalV2",e[e.ProgramMetadata=15]="ProgramMetadata",e[e.RealmV2=16]="RealmV2",e[e.TokenOwnerRecordV2=17]="TokenOwnerRecordV2",e[e.GovernanceV2=18]="GovernanceV2",e[e.ProgramGovernanceV2=19]="ProgramGovernanceV2",e[e.MintGovernanceV2=20]="MintGovernanceV2",e[e.TokenGovernanceV2=21]="TokenGovernanceV2",e[e.SignatoryRecordV2=22]="SignatoryRecordV2",e[e.ProposalDeposit=23]="ProposalDeposit"}(l=t.GovernanceAccountType||(t.GovernanceAccountType={})),t.getAccountTypes=function(e){switch(e){case S:return[l.RealmV1,l.RealmV2];case I:return[l.TokenOwnerRecordV1,l.TokenOwnerRecordV2];case M:return[l.ProposalV1,l.ProposalV2];case R:return[l.ProposalDeposit];case x:return[l.SignatoryRecordV1,l.SignatoryRecordV2];case C:return[l.VoteRecordV1,l.VoteRecordV2];case O:return[l.ProposalInstructionV1,l.ProposalTransactionV2];case E:return[l.RealmConfig];case T:return[l.GovernanceV1,l.ProgramGovernanceV1,l.MintGovernanceV1,l.TokenGovernanceV1,l.GovernanceV2,l.ProgramGovernanceV2,l.MintGovernanceV2,l.TokenGovernanceV2];case P:return[l.ProgramMetadata];default:throw Error(`${e} account is not supported`)}},t.getGovernanceAccountVersion=function(e){switch(e){case l.VoteRecordV2:case l.ProposalTransactionV2:case l.ProposalV2:case l.RealmV2:case l.TokenOwnerRecordV2:case l.GovernanceV2:case l.ProgramGovernanceV2:case l.MintGovernanceV2:case l.TokenGovernanceV2:case l.SignatoryRecordV2:return u.ACCOUNT_VERSION_V2;default:return u.ACCOUNT_VERSION_V1}},function(e){e[e.YesVotePercentage=0]="YesVotePercentage",e[e.QuorumPercentage=1]="QuorumPercentage",e[e.Disabled=2]="Disabled"}(h=t.VoteThresholdType||(t.VoteThresholdType={}));class A{constructor(e){this.type=e.type,this.value=e.value}}t.VoteThreshold=A,function(e){e[e.Strict=0]="Strict",e[e.Early=1]="Early",e[e.Disabled=2]="Disabled"}(d=t.VoteTipping||(t.VoteTipping={})),(m=t.InstructionExecutionStatus||(t.InstructionExecutionStatus={}))[m.None=0]="None",m[m.Success=1]="Success",m[m.Error=2]="Error",(y=t.InstructionExecutionFlags||(t.InstructionExecutionFlags={}))[y.None=0]="None",y[y.Ordered=1]="Ordered",y[y.UseTransaction=2]="UseTransaction",function(e){e[e.SupplyFraction=0]="SupplyFraction",e[e.Absolute=1]="Absolute"}(f=t.MintMaxVoteWeightSourceType||(t.MintMaxVoteWeightSourceType={}));class k{constructor(e){this.type=e.type,this.value=e.value}isFullSupply(){return this.type===f.SupplyFraction&&0===this.value.cmp(k.SUPPLY_FRACTION_BASE)}getSupplyFraction(){if(this.type!==f.SupplyFraction)throw new Error("Max vote weight is not fraction");return this.value}fmtSupplyFractionPercentage(){return new a.default(this.getSupplyFraction()).shiftedBy(2-k.SUPPLY_FRACTION_DECIMALS).toFormat()}}t.MintMaxVoteWeightSource=k,k.SUPPLY_FRACTION_BASE=new s.default(1e10),k.SUPPLY_FRACTION_DECIMALS=10,k.FULL_SUPPLY_FRACTION=new k({type:f.SupplyFraction,value:k.SUPPLY_FRACTION_BASE}),function(e){e[e.SingleChoice=0]="SingleChoice",e[e.MultiChoice=1]="MultiChoice"}(p=t.VoteTypeKind||(t.VoteTypeKind={})),(w=t.MultiChoiceType||(t.MultiChoiceType={}))[w.FullWeight=0]="FullWeight",w[w.Weighted=1]="Weighted";class _{constructor(e){this.type=e.type,this.choiceType=e.choiceType,this.minVoterOptions=e.minVoterOptions,this.maxVoterOptions=e.maxVoterOptions,this.maxWinningOptions=e.maxWinningOptions}isSingleChoice(){return this.type===p.SingleChoice}}t.VoteType=_,_.SINGLE_CHOICE=new _({type:p.SingleChoice,choiceType:void 0,minVoterOptions:void 0,maxVoterOptions:void 0,maxWinningOptions:void 0}),_.MULTI_CHOICE=(e,t,n,r)=>new _({type:p.MultiChoice,choiceType:e,minVoterOptions:t,maxVoterOptions:n,maxWinningOptions:r}),t.RealmConfigArgs=class{constructor(e){this.useCouncilMint=!!e.useCouncilMint,this.communityMintMaxVoteWeightSource=e.communityMintMaxVoteWeightSource,this.minCommunityTokensToCreateGovernance=e.minCommunityTokensToCreateGovernance,this.useCommunityVoterWeightAddin=e.useCommunityVoterWeightAddin,this.useMaxCommunityVoterWeightAddin=e.useMaxCommunityVoterWeightAddin,this.communityTokenConfigArgs=e.communityTokenConfigArgs,this.councilTokenConfigArgs=e.councilTokenConfigArgs}},(v=t.GoverningTokenType||(t.GoverningTokenType={}))[v.Liquid=0]="Liquid",v[v.Membership=1]="Membership",v[v.Dormant=2]="Dormant",t.GoverningTokenConfigArgs=class{constructor(e){this.useVoterWeightAddin=e.useVoterWeightAddin,this.useMaxVoterWeightAddin=e.useMaxVoterWeightAddin,this.tokenType=e.tokenType}},t.GoverningTokenConfigAccountArgs=class{constructor(e){this.voterWeightAddin=e.voterWeightAddin,this.maxVoterWeightAddin=e.maxVoterWeightAddin,this.tokenType=e.tokenType}},t.RealmConfig=class{constructor(e){this.councilMint=e.councilMint,this.communityMintMaxVoteWeightSource=e.communityMintMaxVoteWeightSource,this.minCommunityTokensToCreateGovernance=e.minCommunityTokensToCreateGovernance,this.useCommunityVoterWeightAddin=!!e.useCommunityVoterWeightAddin,this.useMaxCommunityVoterWeightAddin=!!e.useMaxCommunityVoterWeightAddin,this.reserved=e.reserved}};class S{constructor(e){this.accountType=l.RealmV1,this.communityMint=e.communityMint,this.config=e.config,this.reserved=e.reserved,this.votingProposalCount=e.votingProposalCount,this.authority=e.authority,this.name=e.name}}t.Realm=S,t.getTokenHoldingAddress=async function(e,n,o){const[s]=await i.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),o.toBuffer()],e);return s},t.GoverningTokenConfig=class{constructor(e){this.voterWeightAddin=e.voterWeightAddin,this.maxVoterWeightAddin=e.maxVoterWeightAddin,this.tokenType=e.tokenType,this.reserved=e.reserved}};class E{constructor(e){this.accountType=l.RealmConfig,this.realm=e.realm,this.communityTokenConfig=e.communityTokenConfig,this.councilTokenConfig=e.councilTokenConfig,this.reserved=e.reserved}}t.RealmConfigAccount=E,t.getRealmConfigAddress=async function(e,t){const[n]=await i.PublicKey.findProgramAddress([r.from("realm-config"),t.toBuffer()],e);return n},t.GovernanceConfig=class{constructor(e){var t,n,r,o,i;this.communityVoteThreshold=e.communityVoteThreshold,this.minCommunityTokensToCreateProposal=e.minCommunityTokensToCreateProposal,this.minInstructionHoldUpTime=e.minInstructionHoldUpTime,this.baseVotingTime=e.baseVotingTime,this.communityVoteTipping=null!==(t=e.communityVoteTipping)&&void 0!==t?t:d.Strict,this.minCouncilTokensToCreateProposal=e.minCouncilTokensToCreateProposal,this.councilVoteThreshold=null!==(n=e.councilVoteThreshold)&&void 0!==n?n:e.communityVoteThreshold,this.councilVetoVoteThreshold=null!==(r=e.councilVetoVoteThreshold)&&void 0!==r?r:e.communityVoteThreshold,this.communityVetoVoteThreshold=null!==(o=e.communityVetoVoteThreshold)&&void 0!==o?o:new A({type:h.Disabled}),this.councilVoteTipping=null!==(i=e.councilVoteTipping)&&void 0!==i?i:this.communityVoteTipping,this.votingCoolOffTime=e.votingCoolOffTime,this.depositExemptProposalCount=e.depositExemptProposalCount}};class T{constructor(e){this.accountType=e.accountType,this.realm=e.realm,this.governedAccount=e.governedAccount,this.config=e.config,this.reserved=e.reserved,this.proposalCount=e.proposalCount,this.activeProposalCount=e.activeProposalCount}isProgramGovernance(){return this.accountType===l.ProgramGovernanceV1||this.accountType===l.ProgramGovernanceV2}isAccountGovernance(){return this.accountType===l.GovernanceV1||this.accountType===l.GovernanceV2}isMintGovernance(){return this.accountType===l.MintGovernanceV1||this.accountType===l.MintGovernanceV2}isTokenGovernance(){return this.accountType===l.TokenGovernanceV1||this.accountType===l.TokenGovernanceV2}}t.Governance=T;class I{constructor(e){this.accountType=l.TokenOwnerRecordV1,this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.governingTokenOwner=e.governingTokenOwner,this.governingTokenDepositAmount=e.governingTokenDepositAmount,this.unrelinquishedVotesCount=e.unrelinquishedVotesCount,this.totalVotesCount=e.totalVotesCount,this.outstandingProposalCount=e.outstandingProposalCount,this.reserved=e.reserved,this.governanceDelegate=e.governanceDelegate,this.version=e.version}}t.TokenOwnerRecord=I,t.getTokenOwnerRecordAddress=async function(e,n,o,s){const[a]=await i.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),o.toBuffer(),s.toBuffer()],e);return a},function(e){e[e.Draft=0]="Draft",e[e.SigningOff=1]="SigningOff",e[e.Voting=2]="Voting",e[e.Succeeded=3]="Succeeded",e[e.Executing=4]="Executing",e[e.Completed=5]="Completed",e[e.Cancelled=6]="Cancelled",e[e.Defeated=7]="Defeated",e[e.ExecutingWithErrors=8]="ExecutingWithErrors",e[e.Vetoed=9]="Vetoed"}(g=t.ProposalState||(t.ProposalState={})),(b=t.OptionVoteResult||(t.OptionVoteResult={}))[b.None=0]="None",b[b.Succeeded=1]="Succeeded",b[b.Defeated=2]="Defeated",t.ProposalOption=class{constructor(e){this.label=e.label,this.voteWeight=e.voteWeight,this.voteResult=e.voteResult,this.instructionsExecutedCount=e.instructionsExecutedCount,this.instructionsCount=e.instructionsCount,this.instructionsNextIndex=e.instructionsNextIndex}};class M{constructor(e){this.accountType=e.accountType,this.governance=e.governance,this.governingTokenMint=e.governingTokenMint,this.state=e.state,this.tokenOwnerRecord=e.tokenOwnerRecord,this.signatoriesCount=e.signatoriesCount,this.signatoriesSignedOffCount=e.signatoriesSignedOffCount,this.descriptionLink=e.descriptionLink,this.name=e.name,this.yesVotesCount=e.yesVotesCount,this.noVotesCount=e.noVotesCount,this.instructionsExecutedCount=e.instructionsExecutedCount,this.instructionsCount=e.instructionsCount,this.instructionsNextIndex=e.instructionsNextIndex,this.voteType=e.voteType,this.options=e.options,this.denyVoteWeight=e.denyVoteWeight,this.reserved1=e.reserved1,this.abstainVoteWeight=e.abstainVoteWeight,this.startVotingAt=e.startVotingAt,this.maxVotingTime=e.maxVotingTime,this.draftAt=e.draftAt,this.signingOffAt=e.signingOffAt,this.votingAt=e.votingAt,this.votingAtSlot=e.votingAtSlot,this.votingCompletedAt=e.votingCompletedAt,this.executingAt=e.executingAt,this.closedAt=e.closedAt,this.executionFlags=e.executionFlags,this.maxVoteWeight=e.maxVoteWeight,this.voteThreshold=e.voteThreshold,this.vetoVoteWeight=e.vetoVoteWeight}isVoteFinalized(){switch(this.state){case g.Succeeded:case g.Executing:case g.Completed:case g.Cancelled:case g.Defeated:case g.ExecutingWithErrors:case g.Vetoed:return!0;case g.Draft:case g.SigningOff:case g.Voting:return!1}}isFinalState(){switch(this.state){case g.Completed:case g.Cancelled:case g.Defeated:case g.ExecutingWithErrors:case g.Vetoed:return!0;case g.Succeeded:return 0===this.instructionsCount;case g.Executing:case g.Draft:case g.SigningOff:case g.Voting:return!1}}getStateTimestamp(){switch(this.state){case g.Succeeded:case g.Defeated:case g.Vetoed:return this.votingCompletedAt?this.votingCompletedAt.toNumber():0;case g.Completed:case g.Cancelled:return this.closedAt?this.closedAt.toNumber():0;case g.Executing:case g.ExecutingWithErrors:return this.executingAt?this.executingAt.toNumber():0;case g.Draft:return this.draftAt.toNumber();case g.SigningOff:return this.signingOffAt?this.signingOffAt.toNumber():0;case g.Voting:return this.votingAt?this.votingAt.toNumber():0}}getStateSortRank(){return this.state===g.Voting?2:this.isFinalState()?0:1}isPreVotingState(){return!this.votingAtSlot}getYesVoteOption(){if(1!==this.options.length&&!this.voteType.isSingleChoice())throw new Error("Proposal is not Yes/No vote");return this.options[0]}getYesVoteCount(){switch(this.accountType){case l.ProposalV1:return this.yesVotesCount;case l.ProposalV2:return this.getYesVoteOption().voteWeight;default:throw new Error(`Invalid account type ${this.accountType}`)}}getNoVoteCount(){switch(this.accountType){case l.ProposalV1:return this.noVotesCount;case l.ProposalV2:return this.denyVoteWeight;default:throw new Error(`Invalid account type ${this.accountType}`)}}getTimeToVoteEnd(e){var t,n;const r=Date.now()/1e3;return(this.isPreVotingState()?e.config.baseVotingTime:(null!==(n=null===(t=this.votingAt)||void 0===t?void 0:t.toNumber())&&void 0!==n?n:0)+e.config.baseVotingTime-r)+e.config.votingCoolOffTime}hasVoteTimeEnded(e){return this.getTimeToVoteEnd(e)<=0}canCancel(e){return this.state===g.Draft||this.state===g.SigningOff||this.state===g.Voting&&!this.hasVoteTimeEnded(e)}canWalletCancel(e,t,n){var r;return!!this.canCancel(e)&&(t.governingTokenOwner.equals(n)||(null===(r=t.governanceDelegate)||void 0===r?void 0:r.equals(n)))}}t.Proposal=M;class R{constructor(e){this.accountType=l.ProposalDeposit,this.proposal=e.proposal,this.depositPayer=e.depositPayer}}t.ProposalDeposit=R;class x{constructor(e){this.accountType=l.SignatoryRecordV1,this.proposal=e.proposal,this.signatory=e.signatory,this.signedOff=!!e.signedOff}}t.SignatoryRecord=x,t.getSignatoryRecordAddress=async function(e,n,o){const[s]=await i.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),o.toBuffer()],e);return s},t.VoteWeight=class{constructor(e){this.yes=e.yes,this.no=e.no}};class C{constructor(e){this.accountType=e.accountType,this.proposal=e.proposal,this.governingTokenOwner=e.governingTokenOwner,this.isRelinquished=!!e.isRelinquished,this.voteWeight=e.voteWeight,this.voterWeight=e.voterWeight,this.vote=e.vote}getNoVoteWeight(){var e,t;switch(this.accountType){case l.VoteRecordV1:return null===(e=this.voteWeight)||void 0===e?void 0:e.no;case l.VoteRecordV2:switch(null===(t=this.vote)||void 0===t?void 0:t.voteType){case c.VoteKind.Approve:return;case c.VoteKind.Deny:return this.voterWeight;default:throw new Error("Invalid voteKind")}default:throw new Error(`Invalid account type ${this.accountType} `)}}getYesVoteWeight(){var e,t;switch(this.accountType){case l.VoteRecordV1:return null===(e=this.voteWeight)||void 0===e?void 0:e.yes;case l.VoteRecordV2:switch(null===(t=this.vote)||void 0===t?void 0:t.voteType){case c.VoteKind.Approve:return this.voterWeight;case c.VoteKind.Deny:return;default:throw new Error("Invalid voteKind")}default:throw new Error(`Invalid account type ${this.accountType} `)}}}t.VoteRecord=C,t.getVoteRecordAddress=async function(e,n,o){const[s]=await i.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),o.toBuffer()],e);return s},t.AccountMetaData=class{constructor(e){this.pubkey=e.pubkey,this.isSigner=!!e.isSigner,this.isWritable=!!e.isWritable}},t.InstructionData=class{constructor(e){this.programId=e.programId,this.accounts=e.accounts,this.data=e.data}};class O{constructor(e){this.accountType=e.accountType,this.proposal=e.proposal,this.instructionIndex=e.instructionIndex,this.optionIndex=e.optionIndex,this.holdUpTime=e.holdUpTime,this.instruction=e.instruction,this.executedAt=e.executedAt,this.executionStatus=e.executionStatus,this.instructions=e.instructions}getSingleInstruction(){if(this.accountType===l.ProposalInstructionV1)return this.instruction;if(0===this.instructions.length)throw new Error("Transaction has no instructions");
1if(this.instructions.length>1)throw new Error("Transaction has multiple instructions");return this.instructions[0]}getAllInstructions(){return this.accountType===l.ProposalInstructionV1?[this.instruction]:this.instructions}}t.ProposalTransaction=O,t.getProposalTransactionAddress=async function(e,n,o,s,a){let c=r.alloc(1);c.writeUInt8(s);let l=r.alloc(2);l.writeInt16LE(a,0);const h=n===u.PROGRAM_VERSION_V1?[r.from(t.GOVERNANCE_PROGRAM_SEED),o.toBuffer(),l]:[r.from(t.GOVERNANCE_PROGRAM_SEED),o.toBuffer(),c,l],[d]=await i.PublicKey.findProgramAddress(h,e);return d};class P{constructor(e){this.accountType=l.ProgramMetadata,this.updatedAt=e.updatedAt,this.reserved=e.reserved,this.version=e.version}}t.ProgramMetadata=P,t.getProgramMetadataAddress=async function(e){const[t]=await i.PublicKey.findProgramAddress([r.from("metadata")],e);return t},t.getNativeTreasuryAddress=async function(e,t){const[n]=await i.PublicKey.findProgramAddress([r.from("native-treasury"),t.toBuffer()],e);return n},t.getGoverningTokenHoldingAddress=async function(e,n,o){const[s]=await i.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),o.toBuffer()],e);return s},t.getProposalDepositAddress=async function(e,t,n){const[o]=await i.PublicKey.findProgramAddress([r.from("proposal-deposit"),t.toBuffer(),n.toBuffer()],e);return o}},2106:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.tryGetGovernanceAccount=t.getGovernanceAccount=t.getGovernanceAccounts=t.getProposalDepositsByDepositPayer=t.getAllProposals=t.getProposalsByGovernance=t.getProposal=t.getAllGovernances=t.getGovernance=t.getAllTokenOwnerRecords=t.getTokenOwnerRecordsByOwner=t.getTokenOwnerRecord=t.getTokenOwnerRecordForRealm=t.getVoteRecordsByVoter=t.getVoteRecord=t.getRealmConfig=t.tryGetRealmConfig=t.getRealms=t.getRealm=void 0;const i=n(2643),s=n(2252),a=n(2921),c=n(2854),u=o(n(2754)),l=o(n(6425)),h=n(1388),d=n(9160);async function f(e,t,n){return g(e,t,a.Governance,[(0,c.pubkeyFilter)(1,n)])}async function p(e,t,n){return g(e,t,a.Proposal,[(0,c.pubkeyFilter)(1,n)])}async function g(e,t,n,r=[]){const o=(0,a.getAccountTypes)(n);let i=[];for(const a of o){let o=await(0,c.getBorshProgramAccounts)(e,t,(e=>(0,s.getGovernanceSchemaForAccount)(e)),n,r,a);i=i.concat(o)}return i}async function y(e,t,n){const r=await e.getAccountInfo(t);if(!r)throw new Error(`Account ${t} of type ${n.name} not found`);return(0,s.GovernanceAccountParser)(n)(t,r)}t.getRealm=async function(e,t){return y(e,t,a.Realm)},t.getRealms=async function(e,t){return t instanceof i.PublicKey?g(e,t,a.Realm):async function(e,t){var n;const o=(0,a.getAccountTypes)(a.Realm),c=e._rpcEndpoint,f=[];for(const r of o){const o=await l.default.request({url:c,method:"POST",headers:{"Content-Type":"application/json"},data:JSON.stringify([...t.map((t=>({jsonrpc:"2.0",id:t.toBase58(),method:"getProgramAccounts",params:[t.toBase58(),{commitment:e.commitment,encoding:"base64",filters:[{memcmp:{offset:0,bytes:u.default.encode([r])}}]}]})))])});f.push(...null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.filter((e=>e.result)).flatMap((e=>e.result)))}let p=[];for(let e of f)try{const t=r.from(e.account.data[0],"base64"),n=t[0],o={pubkey:new i.PublicKey(e.pubkey),account:(0,h.deserializeBorsh)((0,s.getGovernanceSchemaForAccount)(n),a.Realm,t),owner:e.account.owner};p.push(o)}catch(t){console.info(`Can't deserialize Realm @ ${e.pubkey}.`,(0,d.getErrorMessage)(t))}return p}(e,t)},t.tryGetRealmConfig=async function(e,t,n){try{const r=await(0,a.getRealmConfigAddress)(t,n);return await y(e,r,a.RealmConfigAccount)}catch(e){}},t.getRealmConfig=async function(e,t){return y(e,t,a.RealmConfigAccount)},t.getVoteRecord=async function(e,t){return y(e,t,a.VoteRecord)},t.getVoteRecordsByVoter=async function(e,t,n){return g(e,t,a.VoteRecord,[(0,c.pubkeyFilter)(33,n)])},t.getTokenOwnerRecordForRealm=async function(e,t,n,r,o){return y(e,await(0,a.getTokenOwnerRecordAddress)(t,n,r,o),a.TokenOwnerRecord)},t.getTokenOwnerRecord=async function(e,t){return y(e,t,a.TokenOwnerRecord)},t.getTokenOwnerRecordsByOwner=async function(e,t,n){return g(e,t,a.TokenOwnerRecord,[(0,c.pubkeyFilter)(65,n)])},t.getAllTokenOwnerRecords=async function(e,t,n){return g(e,t,a.TokenOwnerRecord,[(0,c.pubkeyFilter)(1,n)])},t.getGovernance=async function(e,t){return y(e,t,a.Governance)},t.getAllGovernances=f,t.getProposal=async function(e,t){return y(e,t,a.Proposal)},t.getProposalsByGovernance=p,t.getAllProposals=async function(e,t,n){return f(e,t,n).then((n=>Promise.all(n.map((n=>p(e,t,n.pubkey))))))},t.getProposalDepositsByDepositPayer=async function(e,t,n){return g(e,t,a.ProposalDeposit,[(0,c.pubkeyFilter)(33,n)])},t.getGovernanceAccounts=g,t.getGovernanceAccount=y,t.tryGetGovernanceAccount=async function(e,t,n){const r=await e.getAccountInfo(t);if(r)return(0,s.GovernanceAccountParser)(n)(t,r)}},2480:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.createRevokeGoverningTokens=void 0;const r=n(1672);t.createRevokeGoverningTokens=async function(e,t,n,o,i,s,a){const c=[];return await(0,r.withRevokeGoverningTokens)(c,e,t,n,o,i,s,a),c[0]}},467:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.createSetGovernanceConfig=void 0;const o=n(2643),i=n(5152),s=n(2252),a=n(1656);t.createSetGovernanceConfig=function(e,t,n,c){const u=new i.SetGovernanceConfigArgs({config:c}),l=r.from((0,a.serialize)((0,s.getGovernanceInstructionSchema)(t),u));if(u.config.baseVotingTime<3600)throw new Error("baseVotingTime should be at least 1 hour");const h=[{pubkey:n,isWritable:!0,isSigner:!0}];return new o.TransactionInstruction({keys:h,programId:e,data:l})}},5758:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createSetRealmAuthority=void 0;const r=n(2537);t.createSetRealmAuthority=function(e,t,n,o,i,s){const a=[];return(0,r.withSetRealmAuthority)(a,e,t,n,o,i,s),a[0]}},1420:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createSetRealmConfig=void 0;const r=n(9700);t.createSetRealmConfig=async function(e,t,n,o,i,s,a,c,u,l){const h=[];return await(0,r.withSetRealmConfig)(h,e,t,n,o,i,s,a,c,u,l),h[0]}},5771:(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.GovernanceType=t.GoverningTokenRole=void 0,(r=t.GoverningTokenRole||(t.GoverningTokenRole={}))[r.Community=0]="Community",r[r.Council=1]="Council",(n=t.GovernanceType||(t.GovernanceType={}))[n.Account=0]="Account",n[n.Program=1]="Program",n[n.Mint=2]="Mint",n[n.Token=3]="Token"},3586:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTransactionErrorMsg=t.GovernanceToolsError=t.TokenError=t.GovernanceError=void 0,t.GovernanceError=["Invalid instruction passed to program","Realm with the given name and governing mints already exists","Invalid realm","Invalid Governing Token Mint","Governing Token Owner must sign transaction","Governing Token Owner or Delegate  must sign transaction","All votes must be relinquished to withdraw governing tokens","Invalid Token Owner Record account address","Invalid GoverningMint for TokenOwnerRecord","Invalid Realm for TokenOwnerRecord","Invalid Proposal for ProposalTransaction","Invalid Signatory account address","Signatory already signed off","Signatory must sign","Invalid Proposal Owner","Invalid Proposal for VoterRecord","Invalid GoverningTokenOwner for VoteRecord","Invalid Governance config: Vote threshold percentage out of range","Proposal for the given Governance, Governing Token Mint and index already exists","Token Owner already voted on the Proposal","Owner doesn't have enough governing tokens to create Proposal","Invalid State: Can't edit Signatories","Invalid Proposal state","Invalid State: Can't edit instructions","Invalid State: Can't execute instruction","Can't execute instruction within its hold up time","Instruction already executed","Invalid Instruction index","Instruction hold up time is below the min specified by Governance","Instruction at the given index for the Proposal already exists","Invalid State: Can't sign off","Invalid State: Can't vote","Invalid State: Can't finalize vote","Invalid State: Can't cancel Proposal","Vote already relinquished","Can't finalize vote. Voting still in progress","Proposal voting time expired","Invalid Signatory Mint","Proposal does not belong to the given Governance","Proposal does not belong to given Governing Mint","Current mint authority must sign transaction","Invalid mint authority","Mint has no authority","Invalid Token account owner","Invalid Mint account owner","Token Account is not initialized","Token Account doesn't exist","Token account data is invalid","Token mint account data is invalid","Token Mint account is not initialized","Token Mint account doesn't exist","Invalid ProgramData account address","Invalid ProgramData account Data","Provided upgrade authority doesn't match current program upgrade authority","Current program upgrade authority must sign transaction","Given program is not upgradable","Invalid token owner","Current token owner must sign transaction","Given VoteThresholdType is not supported","Given VoteWeightSource is not supported","
1Legacy1","Governance PDA must sign","Instruction already flagged with error","Invalid Realm for Governance","Invalid Authority for Realm","Realm has no authority","Realm authority must sign","Invalid governing token holding account","Realm council mint change is not supported","Not supported mint max vote weight source","Invalid max vote weight supply fraction","Owner doesn't have enough governing tokens to create Governance","Too many outstanding proposals","All proposals must be finalized to withdraw governing tokens","Invalid VoterWeightRecord for Realm","Invalid VoterWeightRecord for GoverningTokenMint","Invalid VoterWeightRecord for TokenOwner","VoterWeightRecord expired","Invalid RealmConfig for Realm","TokenOwnerRecord already exists","Governing token deposits not allowed","Invalid vote choice weight percentage","Vote type not supported","Invalid proposal options","Proposal is not not executable","Invalid vote","Cannot execute defeated option","VoterWeightRecord invalid action","VoterWeightRecord invalid action target","Invalid MaxVoterWeightRecord for Realm","MaxVoterWeightRecord expired","Cannot execute defeated option","Not supported VoteType","RealmConfig change not allowed","At least one VoteThreshold is required","Reserved buffer must be empty","Cannot Relinquish in Finalizing state","Invalid RealmConfig account address","Cannot deposit dormant tokens","Cannot withdraw membership tokens","Cannot revoke GoverningTokens","Invalid Revoke amount","Invalid GoverningToken source","Cannot change community TokenType to Membership","Voter weight threshold disabled","Vote not allowed in cool off time","Cannot refund ProposalDeposit","Invalid Proposal for ProposalDeposit","Invalid deposit_exempt_proposal_count","Invalid GoverningTokenMint not allowed to vote","Invalid deposit Payer for ProposalDeposit"],t.TokenError=["Lamport balance below rent-exempt threshold","Insufficient funds","Invalid Mint","Account not associated with this Mint","Owner does not match","Fixed supply","Already in use","Invalid number of provided signers","Invalid number of required signers","State is uninitialized","Instruction does not support native tokens","Non-native account can only be closed if its balance is zero","Invalid instruction","State is invalid for requested operation","Operation overflowed","Account does not support specified authority type","This token mint cannot freeze accounts","Account is frozen","The provided decimals value different from the Mint decimals"],t.GovernanceToolsError=["Account already initialized","Account doesn't exist","Invalid account owner","Invalid account type","Invalid new account size"],t.getTransactionErrorMsg=function(e){try{const n=e.txError.InstructionError[1];return void 0!==n.Custom?n.Custom>=1100?t.GovernanceToolsError[n.Custom-1100]:n.Custom>=500?t.GovernanceError[n.Custom-500]:`Possible error: ${t.TokenError[n.Custom]}`:n}catch(t){return JSON.stringify(e)}}},3501:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(2921),t),o(n(2106),t),o(n(2480),t),o(n(467),t),o(n(1420),t),o(n(5758),t),o(n(5771),t),o(n(3586),t),o(n(5152),t),o(n(2252),t),o(n(3674),t),o(n(4652),t),o(n(3541),t),o(n(6945),t),o(n(4210),t),o(n(6385),t),o(n(7861),t),o(n(2059),t),o(n(4721),t),o(n(7659),t),o(n(7842),t),o(n(5272),t),o(n(120),t),o(n(8420),t),o(n(1996),t),o(n(3315),t),o(n(2917),t),o(n(7814),t),o(n(2967),t),o(n(7031),t),o(n(1373),t),o(n(1672),t),o(n(2537),t),o(n(9700),t),o(n(4006),t),o(n(9653),t),o(n(6767),t),o(n(3872),t)},5152:(e,t)=>{"use strict";var n,r,o,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RefundProposalDepositArgs=t.RevokeGoverningTokensArgs=t.SetGovernanceDelegateArgs=t.CreateNativeTreasuryArgs=t.UpdateProgramMetadataArgs=t.CreateTokenOwnerRecordArgs=t.SetRealmConfigArgs=t.SetRealmAuthorityArgs=t.SetRealmAuthorityAction=t.FlagTransactionErrorArgs=t.ExecuteTransactionArgs=t.RemoveTransactionArgs=t.InsertTransactionArgs=t.FinalizeVoteArgs=t.RelinquishVoteArgs=t.CastVoteArgs=t.Vote=t.VoteKind=t.VoteChoice=t.YesNoVote=t.CancelProposalArgs=t.SignOffProposalArgs=t.AddSignatoryArgs=t.CreateProposalArgs=t.SetGovernanceConfigArgs=t.CreateTokenGovernanceArgs=t.CreateMintGovernanceArgs=t.CreateProgramGovernanceArgs=t.CreateGovernanceArgs=t.WithdrawGoverningTokensArgs=t.DepositGoverningTokensArgs=t.CreateRealmArgs=t.GovernanceInstru
1ction=void 0,function(e){e[e.CreateRealm=0]="CreateRealm",e[e.DepositGoverningTokens=1]="DepositGoverningTokens",e[e.WithdrawGoverningTokens=2]="WithdrawGoverningTokens",e[e.SetGovernanceDelegate=3]="SetGovernanceDelegate",e[e.CreateGovernance=4]="CreateGovernance",e[e.CreateProgramGovernance=5]="CreateProgramGovernance",e[e.CreateProposal=6]="CreateProposal",e[e.AddSignatory=7]="AddSignatory",e[e.RemoveSignatory=8]="RemoveSignatory",e[e.InsertTransaction=9]="InsertTransaction",e[e.RemoveTransaction=10]="RemoveTransaction",e[e.CancelProposal=11]="CancelProposal",e[e.SignOffProposal=12]="SignOffProposal",e[e.CastVote=13]="CastVote",e[e.FinalizeVote=14]="FinalizeVote",e[e.RelinquishVote=15]="RelinquishVote",e[e.ExecuteTransaction=16]="ExecuteTransaction",e[e.CreateMintGovernance=17]="CreateMintGovernance",e[e.CreateTokenGovernance=18]="CreateTokenGovernance",e[e.SetGovernanceConfig=19]="SetGovernanceConfig",e[e.FlagTransactionError=20]="FlagTransactionError",e[e.SetRealmAuthority=21]="SetRealmAuthority",e[e.SetRealmConfig=22]="SetRealmConfig",e[e.CreateTokenOwnerRecord=23]="CreateTokenOwnerRecord",e[e.UpdateProgramMetadata=24]="UpdateProgramMetadata",e[e.CreateNativeTreasury=25]="CreateNativeTreasury",e[e.RevokeGoverningTokens=26]="RevokeGoverningTokens",e[e.RefundProposalDeposit=27]="RefundProposalDeposit"}(n=t.GovernanceInstruction||(t.GovernanceInstruction={})),t.CreateRealmArgs=class{constructor(e){this.instruction=n.CreateRealm,this.name=e.name,this.configArgs=e.configArgs}},t.DepositGoverningTokensArgs=class{constructor(e){this.instruction=n.DepositGoverningTokens,this.amount=e.amount}},t.WithdrawGoverningTokensArgs=class{constructor(){this.instruction=n.WithdrawGoverningTokens}},t.CreateGovernanceArgs=class{constructor(e){this.instruction=n.CreateGovernance,this.config=e.config}},t.CreateProgramGovernanceArgs=class{constructor(e){this.instruction=n.CreateProgramGovernance,this.config=e.config,this.transferUpgradeAuthority=!!e.transferUpgradeAuthority}},t.CreateMintGovernanceArgs=class{constructor(e){this.instruction=n.CreateMintGovernance,this.config=e.config,this.transferMintAuthorities=!!e.transferMintAuthorities}},t.CreateTokenGovernanceArgs=class{constructor(e){this.instruction=n.CreateTokenGovernance,this.config=e.config,this.transferTokenOwner=!!e.transferTokenOwner}},t.SetGovernanceConfigArgs=class{constructor(e){this.instruction=n.SetGovernanceConfig,this.config=e.config}},t.CreateProposalArgs=class{constructor(e){this.instruction=n.CreateProposal,this.name=e.name,this.descriptionLink=e.descriptionLink,this.governingTokenMint=e.governingTokenMint,this.voteType=e.voteType,this.options=e.options,this.useDenyOption=e.useDenyOption,this.proposalSeed=e.proposalSeed}},t.AddSignatoryArgs=class{constructor(e){this.instruction=n.AddSignatory,this.signatory=e.signatory}},t.SignOffProposalArgs=class{constructor(){this.instruction=n.SignOffProposal}},t.CancelProposalArgs=class{constructor(){this.instruction=n.CancelProposal}},function(e){e[e.Yes=0]="Yes",e[e.No=1]="No"}(r=t.YesNoVote||(t.YesNoVote={}));class s{constructor(e){this.rank=e.rank,this.weightPercentage=e.weightPercentage}}t.VoteChoice=s,function(e){e[e.Approve=0]="Approve",e[e.Deny=1]="Deny",e[e.Abstain=2]="Abstain",e[e.Veto=3]="Veto"}(o=t.VoteKind||(t.VoteKind={}));class a{constructor(e){this.voteType=e.voteType,this.approveChoices=e.approveChoices,this.deny=e.deny,this.veto=e.veto}toYesNoVote(){switch(this.voteType){case o.Deny:return r.No;case o.Approve:return r.Yes}}static fromYesNoVote(e){switch(e){case r.Yes:return new a({voteType:o.Approve,approveChoices:[new s({rank:0,weightPercentage:100})],deny:void 0,veto:void 0});case r.No:return new a({voteType:o.Deny,approveChoices:void 0,deny:!0,veto:void 0})}}}t.Vote=a,t.CastVoteArgs=class{constructor(e){this.instruction=n.CastVote,this.yesNoVote=e.yesNoVote,this.vote=e.vote}},t.RelinquishVoteArgs=class{constructor(){this.instruction=n.RelinquishVote}},t.FinalizeVoteArgs=class{constructor(){this.instruction=n.FinalizeVote}},t.InsertTransactionArgs=class{constructor(e){this.instruction=n.InsertTransaction,this.index=e.index,this.optionIndex=e.optionIndex,this.holdUpTime=e.holdUpTime,this.instructionData=e.instructionData,this.instructions=e.instructions}},t.RemoveTransactionArgs=class{constructor(){this.instruction=n.RemoveTransaction}},t.ExecuteTransactionArgs=class{constructor(){this.instruction=n.ExecuteTransaction}},t.FlagTransactionErrorArgs=class{constructor(){this.instruction=n.FlagTransactionError}},(i=t.SetRealmAuthorityAction||(t.SetRealmAuthorityAction={}))[i.SetUnchecked=0]="SetUnchecked",i[i.SetChecked=1]="SetChecked",i[i.Remove=2]="Remove",t.SetRealmAuthorityArgs=class{constructor(e){this.instruction=n.SetRealmAuthority,this.newRealmAuthority=e.newRealmAuthority,this.action=e.action}},t.SetRealmConfigArgs=class{constructor(e){this.instruction=n.SetRealmConfig,this.configArgs=e.configArgs}},t.CreateTokenOwnerRecordArgs=class{constructor(){this.instruction=n.CreateTokenOwnerRecord}},t.UpdateProgramMetadataArgs=class{constructor(){this.instruction=n.UpdateProgramMetadata}},t.CreateNativeTreasuryArgs=class{constructor(){this.instruction=n.CreateNativeTreasury}},t.SetGovernanceDelegateArgs=class{constructor(e){this.instruction=n.SetGovernanceDelegate,this.newGovernanceDelegate=e.newGovernanceDelegate}},t.RevokeGoverningTokensArgs=class{constructor(e){this.instruction=n.RevokeGoverningTokens,this.amount=e.amount}},t.RefundProposalDepositArgs=class{constructor(){this.instruction=n.RefundProposalDeposit}}}
1,2252:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getInstructionDataFromBase64=t.GovernanceAccountParser=t.getGovernanceSchemaForAccount=t.getGovernanceAccountSchema=t.GOVERNANCE_ACCOUNT_SCHEMA_V2=t.GOVERNANCE_ACCOUNT_SCHEMA_V1=t.getGovernanceInstructionSchema=t.GOVERNANCE_INSTRUCTION_SCHEMA_V3=t.GOVERNANCE_INSTRUCTION_SCHEMA_V2=t.GOVERNANCE_INSTRUCTION_SCHEMA_V1=t.createInstructionData=t.serializeInstructionToBase64=void 0;const o=n(1656),i=n(5152),s=n(2921),a=n(1656),c=n(4747),u=n(1007),l=n(1388);function h(e,t){return new Map([[i.VoteChoice,{kind:"struct",fields:[["rank","u8"],["weightPercentage","u8"]]}],[s.InstructionData,{kind:"struct",fields:[["programId","pubkey"],["accounts",[s.AccountMetaData]],["data",["u8"]]]}],[s.AccountMetaData,{kind:"struct",fields:[["pubkey","pubkey"],["isSigner","u8"],["isWritable","u8"]]}],[s.MintMaxVoteWeightSource,{kind:"struct",fields:[["type","u8"],["value","u64"]]}],[s.GovernanceConfig,{kind:"struct",fields:[["communityVoteThreshold","VoteThreshold"],["minCommunityTokensToCreateProposal","u64"],["minInstructionHoldUpTime","u32"],["baseVotingTime","u32"],["communityVoteTipping","u8"],["councilVoteThreshold","VoteThreshold"],["councilVetoVoteThreshold","VoteThreshold"],["minCouncilTokensToCreateProposal","u64"],...e&&e>=u.PROGRAM_VERSION_V3||t&&t>=u.ACCOUNT_VERSION_V2?[["councilVoteTipping","u8"],["communityVetoVoteThreshold","VoteThreshold"],["votingCoolOffTime","u32"],["depositExemptProposalCount","u8"]]:[]]}]])}function d(e){return new Map([[s.RealmConfigArgs,{kind:"struct",fields:[["useCouncilMint","u8"],["minCommunityTokensToCreateGovernance","u64"],["communityMintMaxVoteWeightSource",s.MintMaxVoteWeightSource],...e==u.PROGRAM_VERSION_V2?[["useCommunityVoterWeightAddin","u8"],["useMaxCommunityVoterWeightAddin","u8"]]:e>=u.PROGRAM_VERSION_V3?[["communityTokenConfigArgs",s.GoverningTokenConfigArgs],["councilTokenConfigArgs",s.GoverningTokenConfigArgs]]:[]]}],[i.CreateRealmArgs,{kind:"struct",fields:[["instruction","u8"],["name","string"],["configArgs",s.RealmConfigArgs]]}],[s.GoverningTokenConfigArgs,{kind:"struct",fields:[["useVoterWeightAddin","u8"],["useMaxVoterWeightAddin","u8"],["tokenType","u8"]]}],[i.DepositGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"],e>=u.PROGRAM_VERSION_V2?["amount","u64"]:void 0].filter(Boolean)}],[i.RevokeGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"],["amount","u64"]]}],[i.WithdrawGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.SetGovernanceDelegateArgs,{kind:"struct",fields:[["instruction","u8"],["newGovernanceDelegate",{kind:"option",type:"pubkey"}]]}],[i.CreateGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",s.GovernanceConfig]]}],[i.CreateProgramGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",s.GovernanceConfig],["transferUpgradeAuthority","u8"]]}],[i.CreateMintGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",s.GovernanceConfig],["transferMintAuthorities","u8"]]}],[i.CreateTokenGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",s.GovernanceConfig],["transferTokenOwner","u8"]]}],[i.SetGovernanceConfigArgs,{kind:"struct",fields:[["instruction","u8"],["config",s.GovernanceConfig]]}],[i.CreateProposalArgs,{kind:"struct",fields:[["instruction","u8"],["name","string"],["descriptionLink","string"],...e===u.PROGRAM_VERSION_V1?[["governingTokenMint","pubkey"]]:[["voteType","voteType"],["options",["string"]],["useDenyOption","u8"]],e>=u.PROGRAM_VERSION_V3?["proposalSeed","pubkey"]:void 0].filter(Boolean)}],[i.AddSignatoryArgs,{kind:"struct",fields:[["instruction","u8"],["signatory","pubkey"]]}],[i.SignOffProposalArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.CancelProposalArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.RelinquishVoteArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.FinalizeVoteArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.CastVoteArgs,{kind:"struct",fields:[["instruction","u8"],e===u.PROGRAM_VERSION_V1?["yesNoVote","u8"]:["vote","vote"]]}],[i.InsertTransactionArgs,{kind:"struct",fields:[["instruction","u8"],e>=u.PROGRAM_VERSION_V2?["optionIndex","u8"]:void 0,["index","u16"],["holdUpTime","u32"],e>=u.PROGRAM_VERSION_V2?["instructions",[s.InstructionData]]:["instructionData",s.InstructionData]].filter(
1Boolean)}],[i.RemoveTransactionArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.ExecuteTransactionArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.FlagTransactionErrorArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.SetRealmAuthorityArgs,{kind:"struct",fields:[["instruction","u8"],...e===u.PROGRAM_VERSION_V1?[["newRealmAuthority",{kind:"option",type:"pubkey"}]]:[["action","u8"]]]}],[i.SetRealmConfigArgs,{kind:"struct",fields:[["instruction","u8"],["configArgs",s.RealmConfigArgs]]}],[i.CreateTokenOwnerRecordArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.UpdateProgramMetadataArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.CreateNativeTreasuryArgs,{kind:"struct",fields:[["instruction","u8"]]}],[i.RefundProposalDepositArgs,{kind:"struct",fields:[["instruction","u8"]]}],...h(e,void 0)])}function f(e){switch(e){case 1:return t.GOVERNANCE_ACCOUNT_SCHEMA_V1;case 2:return t.GOVERNANCE_ACCOUNT_SCHEMA_V2;default:throw new Error(`Account schema for account version: ${e} doesn't exist`)}}function p(e){return new Map([[s.RealmConfig,{kind:"struct",fields:[["useCommunityVoterWeightAddin","u8"],["useMaxCommunityVoterWeightAddin","u8"],["reserved",[6]],["minCommunityTokensToCreateGovernance","u64"],["communityMintMaxVoteWeightSource",s.MintMaxVoteWeightSource],["councilMint",{kind:"option",type:"pubkey"}]]}],[s.Realm,{kind:"struct",fields:[["accountType","u8"],["communityMint","pubkey"],["config",s.RealmConfig],["reserved",[6]],["votingProposalCount","u16"],["authority",{kind:"option",type:"pubkey"}],["name","string"]]}],[s.RealmConfigAccount,{kind:"struct",fields:[["accountType","u8"],["realm","pubkey"],["communityTokenConfig",s.GoverningTokenConfig],["councilTokenConfig",s.GoverningTokenConfig],["reserved",[110]]]}],[s.GoverningTokenConfig,{kind:"struct",fields:[["voterWeightAddin",{kind:"option",type:"pubkey"}],["maxVoterWeightAddin",{kind:"option",type:"pubkey"}],["tokenType","u8"],["reserved",[8]]]}],[s.Governance,{kind:"struct",fields:[["accountType","u8"],["realm","pubkey"],["governedAccount","pubkey"],["proposalCount","u32"],["config",s.GovernanceConfig],...e>=u.ACCOUNT_VERSION_V2?[["reserved",[120]],["activeProposalCount","u64"]]:[]]}],[s.TokenOwnerRecord,{kind:"struct",fields:[["accountType","u8"],["realm","pubkey"],["governingTokenMint","pubkey"],["governingTokenOwner","pubkey"],["governingTokenDepositAmount","u64"],["unrelinquishedVotesCount","u32"],["totalVotesCount","u32"],["outstandingProposalCount","u8"],["ver
1sion","u8"],["reserved",[6]],["governanceDelegate",{kind:"option",type:"pubkey"}]]}],[s.ProposalOption,{kind:"struct",fields:[["label","string"],["voteWeight","u64"],["voteResult","u8"],["instructionsExecutedCount","u16"],["instructionsCount","u16"],["instructionsNextIndex","u16"]]}],[s.Proposal,{kind:"struct",fields:[["accountType","u8"],["governance","pubkey"],["governingTokenMint","pubkey"],["state","u8"],["tokenOwnerRecord","pubkey"],["signatoriesCount","u8"],["signatoriesSignedOffCount","u8"],...e===u.ACCOUNT_VERSION_V1?[["yesVotesCount","u64"],["noVotesCount","u64"],["instructionsExecutedCount","u16"],["instructionsCount","u16"],["instructionsNextIndex","u16"]]:[["voteType","voteType"],["options",[s.ProposalOption]],["denyVoteWeight",{kind:"option",type:"u64"}],["reserved1","u8"],["abstainVoteWeight",{kind:"option",type:"u64"}],["startVotingAt",{kind:"option",type:"u64"}]],["draftAt","u64"],["signingOffAt",{kind:"option",type:"u64"}],["votingAt",{kind:"option",type:"u64"}],["votingAtSlot",{kind:"option",type:"u64"}],["votingCompletedAt",{kind:"option",type:"u64"}],["executingAt",{kind:"option",type:"u64"}],["closedAt",{kind:"option",type:"u64"}],["executionFlags","u8"],["maxVoteWeight",{kind:"option",type:"u64"}],...e===u.ACCOUNT_VERSION_V1?[]:[["maxVotingTime",{kind:"option",type:"u32"}]],["voteThreshold",{kind:"option",type:"VoteThreshold"}],...e===u.ACCOUNT_VERSION_V1?[]:[["reserved",[64]]],["name","string"],["descriptionLink","string"],...e===u.ACCOUNT_VERSION_V1?[]:[["vetoVoteWeight","u64"]]]}],[s.ProposalDeposit,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["depositPayer","pubkey"]]}],[s.SignatoryRecord,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["signatory","pubkey"],["signedOff","u8"]]}],[s.VoteWeight,{kind:"enum",values:[["yes","u64"],["no","u64"]]}],[s.VoteRecord,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["governingTokenOwner","pubkey"],["isRelinquished","u8"],...e===u.ACCOUNT_VERSION_V1?[["voteWeight",s.VoteWeight]]:[["voterWeight","u64"],["vote","vote"]]]}],[s.ProposalTransaction,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],e>=u.ACCOUNT_VERSION_V2?["optionIndex","u8"]:void 0,["instructionIndex","u16"],["holdUpTime","u32"],e>=u.ACCOUNT_VERSION_V2?["instructions",[s.InstructionData]]:["instruction",s.InstructionData],["executedAt",{kind:"option",type:"u64"}],["executionStatus","u8"]].filter(Boolean)}],[s.ProgramMetadata,{kind:"struct",fields:[["accountType","u8"],["updatedAt","u64"],["ver
1sion","string"],["reserved",[64]]]}],...h(void 0,e)])}function g(e){return f((0,s.getGovernanceAccountVersion)(e))}o.BinaryReader.prototype.readU16=function(){const e=this,t=e.buf.readUInt16LE(e.offset);return e.offset+=2,t},o.BinaryWriter.prototype.writeU16=function(e){const t=this;t.maybeResize(),t.buf.writeUInt16LE(e,t.length),t.length+=2},o.BinaryReader.prototype.readVoteType=function(){const e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===s.VoteTypeKind.SingleChoice)return s.VoteType.SINGLE_CHOICE;const n=e.buf.readUInt8(e.offset);e.offset+=1;const r=e.buf.readUInt8(e.offset);e.offset+=1;const o=e.buf.readUInt8(e.offset);e.offset+=1;const i=e.buf.readUInt8(e.offset);return e.offset+=1,s.VoteType.MULTI_CHOICE(n,r,o,i)},o.BinaryWriter.prototype.writeVoteType=function(e){const t=this;t.maybeResize(),t.buf.writeUInt8(e.type,t.length),t.length+=1,e.type===s.VoteTypeKind.MultiChoice&&(t.buf.writeUInt8(e.choiceType,t.length),t.length+=1,t.buf.writeUInt8(e.minVoterOptions,t.length),t.length+=1,t.buf.writeUInt8(e.maxVoterOptions,t.length),t.length+=1,t.buf.writeUInt8(e.maxWinningOptions,t.length),t.length+=1)},o.BinaryReader.prototype.readVote=function(){const e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===i.VoteKind.Deny)return new i.Vote({voteType:t,approveChoices:void 0,deny:!0,veto:!1});if(t===i.VoteKind.Veto)return new i.Vote({voteType:t,approveChoices:void 0,deny:!1,veto:!0});let n=[];return e.readArray((()=>{const t=e.buf.readUInt8(e.offset);e.offset+=1;const r=e.buf.readUInt8(e.offset);e.offset+=1,n.push(new i.VoteChoice({rank:t,weightPercentage:r}))})),new i.Vote({voteType:t,approveChoices:n,deny:void 0,veto:void 0})},o.BinaryWriter.prototype.writeVote=function(e){const t=this;t.maybeResize(),t.buf.writeUInt8(e.voteType,t.length),t.length+=1,e.voteType===i.VoteKind.Approve&&t.writeArray(e.approveChoices,(e=>{t.buf.writeUInt8(e.rank,t.length),t.length+=1,t.buf.writeUInt8(e.weightPercentage,t.length),t.length+=1}))},o.BinaryReader.prototype.readVoteThreshold=function(){const e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===s.VoteThresholdType.YesVotePercentage||t===s.VoteThresholdType.QuorumPercentage){const n=e.buf.readUInt8(e.offset);return e.offset+=1,new s.VoteThreshold({type:t,value:n})}if(t===s.VoteThresholdType.Disabled)return new s.VoteThreshold({type:t,value:void 0});throw new Error(`VoteThresholdType ${t} is not supported`)},o.BinaryWriter.prototype.writeVoteThreshold=function(e){const t=this;t.maybeResize(),t.buf.writeUInt8(e.type,t.length),t.length+=1,e.type!==s.VoteThresholdType.YesVotePercentage&&e.type!==s.VoteThresholdType.QuorumPercentage||(t.buf.writeUInt8(e.value,t.length),t.length+=1)},t.serializeInstructionToBase64=e=>{let n=(0,t.createInstructionData)(e);return r.from((0,a.serialize)(t.GOVERNANCE_INSTRUCTION_SCHEMA_V1,n)).toString("base64")},t.createInstructionData=e=>new s.InstructionData({programId:e.programId,data:e.data,accounts:e.keys.map((e=>new s.AccountMetaData({pubkey:e.pubkey,isSigner:e.isSigner,isWritable:e.isWritable})))}),t.GOVERNANCE_INSTRUCTION_SCHEMA_V1=d(1),t.GOVERNANCE_INSTRUCTION_SCHEMA_V2=d(2),t.GOVERNANCE_INSTRUCTION_SCHEMA_V3=d(3),t.getGovernanceInstructionSchema=function(e){switch(e){case 1:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V1;case 2:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V2;case 3:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V3;default:throw new Error(`Account schema for program version: ${e} doesn't exist`)}},t.GOVERNANCE_ACCOUNT_SCHEMA_V1=p(1),t.GOVERNANCE_ACCOUNT_SCHEMA_V2=p(2),t.getGovernanceAccountSchema=f,t.getGovernanceSchemaForAccount=g,t.GovernanceAccountParser=e=>(0,c.BorshAccountParser)(e,(e=>g(e))),t.getInstructionDataFromBase64=function(e){const n=r.from(e,"base64");return(0,l.deserializeBorsh)(t.GOVERNANCE_INSTRUCTION_SCHEMA_V1,s.InstructionData,n)}},3674:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withV3RealmConfigAccount=t.withTokenConfigAccounts=t.createRealmConfigArgs=void 0;const r=n(1007),o=n(2921),i=n(5771);function s(e,t,n){if(t){if(e<r.PROGRAM_VERSION_V2)throw new Error(`Governing token config is not supported in version ${e}`);if(e==r.PROGRAM_VERSION_V2){if(n==i.GoverningTokenRole.Council)throw new Error(`Council token config is not supported in version ${e}`);if(t.tokenType!=o.GoverningTokenType.Liquid)throw new Error(`Community token type ${t.tokenType} is not supported in veriosn ${e}`)}}}t.createRealmConfigArgs=function(e,t,n,r,a,c){var u,l;return s(e,a,i.GoverningTokenRole.Community),s(e,c,i.GoverningTokenRole.Council),new o.RealmConfigArgs({useCouncilMint:void 0!==t,minCommunityTokensToCreateGovernance:r,communityMintMaxVoteWeightSource:n,useCommunityVoterWeightAddin:void 0!==(null==a?void 0:a.voterWeightAddin),useMaxCommunityVoterWeightAddin:void 0!==(null==a?void 0:a.maxVoterWeightAddin),communityTokenConfigArgs:new o.GoverningTokenConfigArgs({useVoterWeightAddin:void 0!==(null==a?void 0:a.voterWeightAddin),useMaxVoterWeightAddin:void 0!==(null==a?void 0:a.maxVoterWeightAddin),tokenType:null!==(u=null==a?void 0:a.tokenType)&&void 0!==u?u:o.GoverningTokenType.Liquid}),councilTokenConfigArgs:new o.GoverningTokenConfigArgs({useVoterWeightAddin:void 0!==(null==c?void 0:c.voterWeightAddin),useMaxVoterWeightAddin:void 0!==(null==c?void 0:c.maxVoterWeightAddin),tokenType:null!==(l=null==c?void 0:c.tokenType)&&void 0!==l?l:o.GoverningTokenType.Liquid})})},t.withTokenConfigAccounts=function(e,t,n){(null==t?void 0:t.voterWeightAddin)&&e.push({pubkey:t.voterWeightAddin,isWritable:!1,isSigner:!1}),(null==t?void 0:t.maxVoterWeightAddin)&&e.push({pubkey:t.maxVoterWeightAddin,isWritable:!1,isSigner:!1}),(null==n?void 0:n.voterWeightAddin)&&e.push({pubkey:n.voterWeightAddin,isWritable:!1,isSigner:!1}),(null==n?void 0:n.maxVoterWeightAddin)&&e.push({pubkey:n.maxVoterWeightAddin,isWritable:!1,isSigner:!1})},t.withV3RealmConfigAccount=async function(e,t,n,i){if(n>=r.PROGRAM_VERSION_V3){const n={pubkey:await(0,o.getRealmConfigAddress)(t,i),isSigner:!1,isWritable:!0};e.push(n)}}},3541:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esMo
1dule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceProgramVersion=void 0;const o=n(2643),i=r(n(9404)),s=n(1007),a=n(9490),c=n(4804),u=n(6580),l=n(2921),h=n(2252),d=n(6767);t.getGovernanceProgramVersion=async function(e,t,n){const r=await(0,l.getProgramMetadataAddress)(t);try{const n=await e.getAccountInfo(r);if(n){const s=(0,h.GovernanceAccountParser)(l.ProgramMetadata)(r,n);let d=a.BN_ZERO;try{const n=await(0,c.getProgramDataAccount)(e,new o.PublicKey(t));d=new i.default(n.slot)}catch(e){}if(s.account.updatedAt.gte(d)){const e=(0,u.parseVersion)(s.account.version);return console.log("Program version (metadata)",e),e.major}}}catch(e){}try{let n=[],r=new o.PublicKey("ENmcpFCpxN1CqyUjuog9yyUVfdXBKF3LVCwLr7grJZpk");await(0,d.withUpdateProgramMetadata)(n,t,2,r);const i=new o.Transaction({feePayer:r});i.add(...n);const s=await e.simulateTransaction(i);if(s.value.logs){const e='PROGRAM-VERSION:"',t=s.value.logs.filter((t=>t.includes(e))).map((t=>{const n=t.indexOf(e);return(0,u.parseVersion)(t.substring(n+e.length,t.length-1))}))[0];if(t)return console.log("Program version (simulation)",t),t.major}}catch(e){console.log("Can't determine program version",e)}return"localnet"===n?s.PROGRAM_VERSION:(console.log("Program version (default)",s.PROGRAM_VERSION_V1),s.PROGRAM_VERSION_V1)}},4652:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withAddSignatory=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687),l=n(1007);t.withAddSignatory=async(e,t,n,h,d,f,p,g)=>{const y=new a.AddSignatoryArgs({signatory:p}),m=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),y)),w=await(0,c.getSignatoryRecordAddress)(t,h,p),v=[{pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!0},{pubkey:w,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}];return n===l.PROGRAM_VERSION_V1&&v.push({pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new o.TransactionInstruction({keys:v,programId:t,data:m})),w}},6945:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCancelProposal=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(1007);t.withCancelProposal=(e,t,n,u,l,h,d,f)=>{const p=new a.CancelProposalArgs,g=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),p));let y=[];n>c.PROGRAM_VERSION_V1&&y.push({pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!1}),y.push({pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!0}),n==c.PROGRAM_VERSION_V1&&y.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new o.TransactionInstruction({keys:y,programId:t,data:g}))}},4210:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCastVote=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(1007),l=n(3687),h=n(8532);t.withCastVote=async(e,t,n,d,f,p,g,y,m,w,v,b,A,k)=>{const _=new a.CastVoteArgs(n===u.PROGRAM_VERSION_V1?{yesNoVote:v.toYesNoVote(),vote:void 0}:{yesNoVote:void 0,vote:v}),S=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),_)),E=await(0,c.getVoteRecordAddress)(t,p,y),[T,I]=n===u.PROGRAM_VERSION_V1?[!1,!1]:[!0,!0],M=[{pubkey:d,isWritable:T,isSigner:!1},{pubkey:f,isWritable:I,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!0},{pubkey:E,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!1,isSigner:!1},{pubkey:b,isWritable:!0,isSigner:!0},{pubkey:l.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}];return n===u.PROGRAM_VERSION_V1&&M.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1},{pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),await(0,h.withRealmConfigPluginAccounts)(M,t,d,A,k),e.push(new o.TransactionInstruction({keys:M,programId:t,data:S})),E}},6385:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateGovernance=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(3687),u=n(8532),l=n(1007);t.withCreateGovernance=async(e,t,n,h,d,f,p,g,y,m)=>{const w=new a.CreateGovernanceArgs({config:f});if(w.config.baseVotingTime<3600)throw new Error("baseVotingTime should be at least 1 hour");const v=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),w));d=null!=d?d:(new o.Keypair).publicKey;const[b]=await o.PublicKey.findProgramAddress([r.from("account-governance"),h.toBuffer(),d.toBuffer()],t);let A=[{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:b,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!0},{pubkey:c.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];return n===l.PROGRAM_VERSION_V1&&A.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),A.push({pubkey:y,isWritable:!1,isSigner:!0}),await(0,u.withRealmConfigPluginAccounts)(A,t,h,m),e.push(new o.TransactionInstruction({keys:A,programId:t,data:v})),b}},7861:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateMintGovernance=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(3937),u=n(3687),l=n(8532),h=n(1007);t.withCreateMintGovernance=async(e,t,n,d,f,p,g,y,m,w,v,b)=>{const A=new a.CreateMintGovernanceArgs({config:p,transferMintAuthorities:g}),k=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),A)),[_]=await o.PublicKey.findProgramAddress([r.from("mint-governance"),d.toBuffer(),f.toBuffer()],t),S=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!0},{pubkey:m,isWritable:!1,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!0},{pubkey:c.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:u.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];return n===h.PROGRAM_VERSION_V1&&S.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),S.push({pubkey:v,isWritable:!1,isSigner:!0}),await(0,l.withRealmConfigPluginAccounts)(S,t,d,b),e.push(new o.TransactionInstruction({keys:S,programId:t,data:k})),_}},2059:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateNativeTreasury=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687);t.withCreateNativeTreasury=async(e,t,n,l,h)=>{const d=new a.CreateNativeTreasuryArgs,f=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),d)),p=await(0,c.getNativeTreasuryAddress)(t,l),g=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:h,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}];return e.push(new o.TransactionInstruction({keys:g,programId:t,data:f})),p}},4721:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateProgramGovernance=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(3687),u=n(4804),l=n(8532),h=n(1007);t.withCreateProgramGovernance=async(e,t,n,d,f,p,g,y,m,w,v,b)=>{const A=new a.CreateProgramGovernanceArgs({config:p,transferUpgradeAuthority:g}),k=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),A)),[_]=await o.PublicKey.findProgramAddress([r.from("program-governance"),d.toBuffer(),f.toBuffer()],t),[S]=await o.PublicKey.findProgramAddress([f.toBuffer()],u.BPF_UPGRADE_LOADER_ID),E=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:S,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!0},{pubkey:m,isWritable:!1,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!0},{pubkey:u.BPF_UPGRADE_LOADER_ID,isWritable:!1,isSigner:!1},{pubkey:c.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];return n===h.PROGRAM_VERSION_V1&&E.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),E.push({pubkey:v,isWritable:!1,isSigner:!0}),await(0,l.withRealmConfigPluginAccounts)(E,t,d,b),e.push(new o.TransactionInstruction({keys:E,programId:t,data:k})),_}},7659:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateProposal=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(1007),l=n(3687),h=n(8532);t.withCreateProposal=async(e,t,n,d,f,p,g,y,m,w,v,b,A,k,_,S,E)=>{const T=null!=E?E:(new o.Keypair).publicKey,I=new a.CreateProposalArgs({name:g,descriptionLink:y,governingTokenMint:m,voteType:b,options:A,useDenyOption:k,proposalSeed:T}),M=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),I));let R=T.toBuffer();if(n<=u.PROGRAM_VERSION_V2){if(void 0===v)throw new Error(`proposalIndex is required for version: ${n}`);R=r.alloc(4),R.writeInt32LE(v,0)}const[x]=await o.PublicKey.findProgramAddress([r.from(c.GOVERNANCE_PROGRAM_SEED),f.toBuffer(),m.toBuffer(),R],t);let C=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:x,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},...n>u.PROGRAM_VERSION_V1?[{pubkey:m,isWritable:!1,isSigner:!1}]:[],{pubkey:w,isWritable:!1,isSigner:!0},{pubkey:_,isWritable:!0,isSigner:!0},{pubkey:l.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];if(n===u.PROGRAM_VERSION_V1&&(C.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),C.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isWritable:!1,isSigner:!1})),await(0,h.withRealmConfigPluginAccounts)(C,t,d,S),n>=u.PROGRAM_VERSION_V3){const e=await(0,c.getProposalDepositAddress)(t,x,_);C.push({pubkey:e,isWritable:!0,isSigner:!1})}return e.push(new o.TransactionInstruction({keys:C,programId:t,data:M})),x}},7842:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateRealm=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(1007),l=n(9487),h=n(3674);t.withCreateRealm=async function(e,t,n,d,f,p,g,y,m,w,v,b){const A=(0,h.createRealmConfigArgs)(n,y,m,w,v,b),k=new a.CreateRealmArgs({configArgs:A,name:d}),_=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),k)),[S]=await o.PublicKey.findProgramAddress([r.from(c.GOVERNANCE_PROGRAM_SEED),r.from(k.name)],t);let E=[{pubkey:S,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!1},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:await(0,c.getTokenHoldingAddress)(t,S,p),isSigner:!1,isWritable:!0},{pubkey:g,isSigner:!0,isWritable:!0},{pubkey:l.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:l.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];if(y){const e=await(0,c.getTokenHoldingAddress)(t,S,y);E=[...E,{pubkey:y,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0}]}const T={pubkey:await(0,c.getRealmConfigAddress)(t,S),isSigner:!1,isWritable:!0};return n>=u.PROGRAM_VERSION_V3&&E.push(T),(0,h.withTokenConfigAccounts)(E,v,b),n==u.PROGRAM_VERSION_V2&&((null==v?void 0:v.voterWeightAddin)||(null==v?void 0:v.maxVoterWeightAddin))&&E.push(T),e.push(new o.TransactionInstruction({keys:E,programId:t,data:_})),S}},5272:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateTokenGovernance=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(3687),u=n(3937),l=n(8532),h=n(1007);t.withCreateTokenGovernance=async(e,t,n,d,f,p,g,y,m,w,v,b)=>{const A=new a.CreateTokenGovernanceArgs({config:p,transferTokenOwner:g}),k=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),A)),[_]=await o.PublicKey.findProgramAddress([r.from("token-governance"),d.toBuffer(),f.toBuffer()],t),S=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!0},{pubkey:m,isWritable:!1,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!0},{pubkey:u.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:c.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}];return n===h.PROGRAM_VERSION_V1&&S.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),S.push({pubkey:v,isWritable:!1,isSigner:!0}),await(0,l.withRealmConfigPluginAccounts)(S,t,d,b),e.push(new o.TransactionInstruction({keys:S,programId:t,data:k})),_}},120:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateTokenOwnerRecord=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687);t.withCreateTokenOwnerRecord=async(e,t,n,l,h,d,f)=>{const p=new a.CreateTokenOwnerRecordArgs,g=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),p)),y=await(0,c.getTokenOwnerRecordAddress)(t,l,d,h),m=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}];return e.push(new o.TransactionInstruction({keys:m,programId:t,data:g})),y}},8420:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withDepositGoverningTokens=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687),l=n(3937),h=n(1007),d=n(3674);t.withDepositGoverningTokens=async(e,t,n,f,p,g,y,m,w,v,b)=>{const A=new a.DepositGoverningTokensArgs({amount:v}),k=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),A)),_=await(0,c.getTokenOwnerRecordAddress)(t,f,g,y);b=null!=b?b:!p.equals(g);const[S]=await o.PublicKey.findProgramAddress([r.from(c.GOVERNANCE_PROGRAM_SEED),f.toBuffer(),g.toBuffer()],t),E=[{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:S,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:b},{pubkey:m,isWritable:!1,isSigner:!0},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:l.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return n===h.PROGRAM_VERSION_V1&&E.push({pubkey:o.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),await(0,d.withV3RealmConfigAccount)(E,t,n,f),e.push(new o.TransactionInstruction({keys:E,programId:t,data:k})),_}},1996:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withExecuteTransaction=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(1007);t.withExecuteTransaction=async(e,t,n,l,h,d,f)=>{const p=new a.ExecuteTransactionArgs,g=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),p)),y=await(0,c.getNativeTreasuryAddress)(t,l);let m=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1}];n===u.PROGRAM_VERSION_V1&&m.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1});for(let e of f)e.accounts=e.accounts.map((e=>e.pubkey.toBase58()!==l.toBase58()&&e.pubkey.toBase58()!==y.toBase58()||!e.isSigner?e:new c.AccountMetaData({pubkey:e.pubkey,isWritable:e.isWritable,isSigner:!1}))),m.push({pubkey:e.programId,isWritable:!1,isSigner:!1},...e.accounts);e.push(new o.TransactionInstruction({keys:m,programId:t,data:g}))}},3315:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withFinalizeVote=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(1007),u=n(8532);t.withFinalizeVote=async(e,t,n,l,h,d,f,p,g)=>{const y=new a.FinalizeVoteArgs,m=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),y)),[w,v]=n===c.PROGRAM_VERSION_V1?[!1,!1]:[!0,!0];let b=[{pubkey:l,isWritable:w,isSigner:!1},{pubkey:h,isWritable:v,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1}];n===c.PROGRAM_VERSION_V1&&b.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),await(0,u.withRealmConfigPluginAccounts)(b,t,l,void 0,g),e.push(new o.TransactionInstruction({keys:b,programId:t,data:m}))}},2917:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withFlagTransactionError=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(1007);t.withFlagTransactionError=(e,t,n,u,l,h,d)=>{const f=new a.FlagTransactionErrorArgs,p=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),f)),g=[{pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!1,isSigner:!0},{pubkey:d,isWritable:!0,isSigner:!1}];n===c.PROGRAM_VERSION_V1&&g.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new o.TransactionInstruction({keys:g,programId:t,data:p}))}}
1,7814:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withInsertTransaction=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687),l=n(1007);t.withInsertTransaction=async(e,t,n,h,d,f,p,g,y,m,w,v)=>{const b=new a.InsertTransactionArgs({index:g,optionIndex:y,holdUpTime:m,instructionData:n===l.PROGRAM_VERSION_V1?w[0]:void 0,instructions:n>=l.PROGRAM_VERSION_V2?w:void 0}),A=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),b)),k=await(0,c.getProposalTransactionAddress)(t,n,d,y,g),_=[{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!0},{pubkey:k,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:o.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}];return e.push(new o.TransactionInstruction({keys:_,programId:t,data:A})),k}},8532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withRealmConfigPluginAccounts=void 0;const r=n(2921);t.withRealmConfigPluginAccounts=async function(e,t,n,o,i){const s=await(0,r.getRealmConfigAddress)(t,n);e.push({pubkey:s,isWritable:!1,isSigner:!1}),o&&e.push({pubkey:o,isWritable:!1,isSigner:!1}),i&&e.push({pubkey:i,isWritable:!1,isSigner:!1})}},2967:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withRefundProposalDeposit=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921);t.withRefundProposalDeposit=async(e,t,n,u,l)=>{const h=new a.RefundProposalDepositArgs,d=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),h)),f=[{pubkey:u,isWritable:!1,isSigner:!1},{pubkey:await(0,c.getProposalDepositAddress)(t,u,l),isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!1}];e.push(new o.TransactionInstruction({keys:f,programId:t,data:d}))}},7031:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withRelinquishVote=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(1007);t.withRelinquishVote=async(e,t,n,u,l,h,d,f,p,g,y)=>{const m=new a.RelinquishVoteArgs,w=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),m));let v=n>=c.PROGRAM_VERSION_V3?[{pubkey:u,isWritable:!1,isSigner:!1}]:[],b=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1}];const A=g&&y?[{pubkey:g,isWritable:!1,isSigner:!0},{pubkey:y,isWritable:!0,isSigner:!1}]:[];e.push(new o.TransactionInstruction({keys:[...v,...b,...A],programId:t,data:w}))}},1373:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withRemoveTransaction=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152);t.withRemoveTransaction=async(e,t,n,c,u,l,h,d)=>{const f=new a.RemoveTransactionArgs,p=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),f)),g=[{pubkey:c,isWritable:!0,isSigner:!1},{pubkey:u,isWritable:!1,isSigner:!1},{pubkey:l,isWritable:!1,isSigner:!0},{pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1}];e.push(new o.TransactionInstruction({keys:g,programId:t,data:p}))}},1672:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withRevokeGoverningTokens=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3937);t.withRevokeGoverningTokens=async(e,t,n,l,h,d,f,p)=>{const g=new a.RevokeGoverningTokensArgs({amount:p}),y=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),g)),m=await(0,c.getTokenOwnerRecordAddress)(t,l,d,h),w=[{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:await(0,c.getGoverningTokenHoldingAddress)(t,l,d),isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!0},{pubkey:await(0,c.getRealmConfigAddress)(t,l),isSigner:!1,isWritable:!1},{pubkey:u.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];e.push(new o.TransactionInstruction({keys:w,programId:t,data:y}))}},4006:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withSetGovernanceDelegate=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921);t.withSetGovernanceDelegate=async(e,t,n,u,l,h,d,f)=>{const p=new a.SetGovernanceDelegateArgs({newGovernanceDelegate:f}),g=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),p));let y=[{pubkey:d,isWritable:!1,isSigner:!0},{pubkey:await(0,c.getTokenOwnerRecordAddress)(t,u,l,h),isWritable:!0,isSigner:!1}];e.push(new o.TransactionInstruction({keys:y,programId:t,data:g}))}},2537:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withSetRealmAuthority=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(6494);t.withSetRealmAuthority=(e,t,n,u,l,h,d)=>{const f=new a.SetRealmAuthorityArgs({newRealmAuthority:h,action:d}),p=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),f));let g=[{pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!1,isSigner:!0}];n>c.PROGRAM_VERSION_V1&&g.push({pubkey:h,isWritable:!1,isSigner:!1}),e.push(new o.TransactionInstruction({keys:g,programId:t,data:p}))}},9700:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withSetRealmConfig=void 0;const o=n(2643),i=n(2921),s=n(5152),a=n(2252),c=n(1656),u=n(3687),l=n(1007),h=n(3674);t.withSetRealmConfig=async function(e,t,n,d,f,p,g,y,m,w,v){const b=(0,h.createRealmConfigArgs)(n,p,g,y,m,w),A=new s.SetRealmConfigArgs({configArgs:b}),k=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),A));let _=[{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!0}];if(p){const e=await(0,i.getTokenHoldingAddress)(t,d,p);_=[..._,{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!1,isWritable:!0}]}if(n>l.PROGRAM_VERSION_V1){_.push({pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1});const e=await(0,i.getRealmConfigAddress)(t,d);_.push({pubkey:e,isSigner:!1,isWritable:!0}),(0,h.withTokenConfigAccounts)(_,m,w),v&&(n>=l.PROGRAM_VERSION_V3||(null==m?void 0:m.voterWeightAddin)||(null==m?void 0:m.maxVoterWeightAddin))&&_.push({pubkey:v,isSigner:!0,isWritable:!0})}e.push(new o.TransactionInstruction({keys:_,programId:t,data:k}))}},9653:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withSignOffProposal=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(1007);t.withSignOffProposal=(e,t,n,u,l,h,d,f,p)=>{const g=new a.SignOffProposalArgs,y=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),g));let m=[];n>c.PROGRAM_VERSION_V1&&m.push({pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!1}),m.push({pubkey:h,isWritable:!0,isSigner:!1}),n===c.PROGRAM_VERSION_V1?m.push({pubkey:f,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!0},{pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}):(m.push({pubkey:d,isWritable:!1,isSigner:!0}),p?m.push({pubkey:p,isWritable:!1,isSigner:!1}):m.push({pubkey:f,isWritable:!0,isSigner:!1})),e.push(new o.TransactionInstruction({keys:m,programId:t,data:y}))}},6767:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withUpdateProgramMetadata=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3687);t.withUpdateProgramMetadata=async(e,t,n,l)=>{const h=new a.UpdateProgramMetadataArgs,d=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),h)),f=[{pubkey:await(0,c.getProgramMetadataAddress)(t),isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!0},{pubkey:u.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}];e.push(new o.TransactionInstruction({keys:f,programId:t,data:d}))}},3872:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withWithdrawGoverningTokens=void 0;const o=n(2643),i=n(2252),s=n(1656),a=n(5152),c=n(2921),u=n(3937),l=n(3674);t.withWithdrawGoverningTokens=async(e,t,n,h,d,f,p)=>{const g=new a.WithdrawGoverningTokensArgs,y=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),g)),[m]=await o.PublicKey.findProgramAddress([r.from(c.GOVERNANCE_PROGRAM_SEED),h.toBuffer(),f.toBuffer(),p.toBuffer()],t),[w]=await o.PublicKey.findProgramAddress([r.from(c.GOVERNANCE_PROGRAM_SEED),h.toBuffer(),f.toBuffer()],t),v=[{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!0},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:u.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];await(0,l.withV3RealmConfigAccount)(v,t,n,h),e.push(new o.TransactionInstruction({keys:v,programId:t,data:y}))}},2204:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(3356),t),o(n(6787),t),o(n(5054),t),o(n(3501),t),o(n(6494),t),o(n(9160),t)},1007:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ACCOUNT_VERSION_V2=t.ACCOUNT_VERSION_V1=t.PROGRAM_VERSION=t.PROGRAM_VERSION_V3=t.PROGRAM_VERSION_V2=t.PROGRAM_VERSION_V1=void 0,t.PROGRAM_VERSION_V1=1,t.PROGRAM_VERSION_V2=2,t.PROGRAM_VERSION_V3=3,t.PROGRAM_VERSION=t.PROGRAM_VERSION_V3,t.ACCOUNT_VERSION_V1=1,t.ACCOUNT_VERSION_V2=2},6494:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(1007),t)},1388:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeBorsh=void 0;const r=n(2643),o=n(1656);function i(e,t,n,r){try{return"string"==typeof n?r[`read${a=n,a.charAt(0).toUpperCase()+a.slice(1)}`]():n instanceof Array?"number"==typeof n[0]?r.readFixedArray(n[0]):r.readArray((()=>i(e,t,n[0],r))):"option"===n.kind?r.readU8()?i(e,t,n.type,r):void 0:s(e,n,r)}catch(e){throw e instanceof o.BorshError&&e.addToFieldPath(t),e}var a}function s(e,t,n){const r=e.get(t);if(!r)throw new o.BorshError(`Class ${t.name} is missing in schema`);if("struct"===r.kind){const r={};for(const[o,s]of e.get(t).fields)r[o]=i(e,o,s,n);return new t(r)}if("enum"===r.kind){const s=n.readU8();if(s>=r.values.length)throw new o.BorshError(`Enum index: ${s} is out of range`);const[a,c]=r.values[s],u=i(e,a,c,n);return new t({[a]:u})}throw new o.BorshError(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}o.BinaryReader.prototype.readPubkey=function(){const e=this.readFixedArray(32);return new r.PublicKey(e)},o.BinaryWriter.prototype.writePubkey=function(e){this.writeFixedArray(e.toBuffer())},t.deserializeBorsh=function(e,t,n){return s(e,t,new o.BinaryReader(n))}},9160:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(9487),t),o(n(1388),t),o(n(9490),t),o(n(3245),t),o(n(6580),t),o(n(6824),t)},9490:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BN_ZERO=void 0;const o=r(n(9404));t.BN_ZERO=new o.default(0)},3245:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=void 0,t.getErrorMessage=function(e){return e instanceof Error?e.message:JSON.stringify(e)}},4804:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getProgramDataAccount=t.getProgramDataAddress=t.ProgramDataAccountInfo=t.PublicKeyFromString=t.BPF_UPGRADE_LOADER_ID=void 0;const r=n(2643),o=n(5400);t.BPF_UPGRADE_LOADER_ID=new r.PublicKey("BPFLoaderUpgradeab1e11111111111111111111111");const i=n(5400),s=n(5400);async function a(e){const[n]=await r.PublicKey.findProgramAddress([e.toBuffer()],t.BPF_UPGRADE_LOADER_ID);return n}t.PublicKeyFromString=(0,s.coerce)((0,s.instance)(r.PublicKey),(0,s.string)(),(e=>new r.PublicKey(e))),t.ProgramDataAccountInfo=(0,i.type)({authority:(0,i.nullable)(t.PublicKeyFromString),slot:(0,i.number)()}),t.getProgramDataAddress=a,t.getProgramDataAccount=async function(e,n){const r=await a(n),i=await e.getParsedAccountInfo(r);if(!i||!i.value)throw new Error(`Program data account ${r.toBase58()} for program ${n.toBase58()} not found`);const s=i.value;if(!("parsed"in s.data)||"bpf-upgradeable-loader"!==s.data.program)throw new Error(`Invalid program data account ${r.toBase58()} for program ${n.toBase58()}`);return(0,o.create)(s.data.parsed.info,t.ProgramDataAccountInfo)}},9487:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(4804),t),o(n(3687),t),o(n(3937),t)},3687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SendTransactionError=t.simulateTransaction=t.SYSTEM_PROGRAM_ID=void 0;const r=n(2643);t.SYSTEM_PROGRAM_ID=new r.PublicKey("11111111111111111111111111111111"),t.simulateTransaction=async function(e,t,n){const r=await e.getRecentBlockhash();t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash;const o=t.serializeMessage(),i=[t._serialize(o).toString("base64"),{encoding:"base64",commitment:n}],s=await e._rpcRequest("simulateTransaction",i);if(s.error)throw new Error("failed to simulate transaction: "+s.error.message);return s.result};class o extends Error{constructor(e,t,n){super(e),this.txError=n,this.txId=t}}t.SendTransactionError=o},3937:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TOKEN_PROGRAM_ID=void 0;const r=n(2643);t.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")},6580:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseVersion=void 0,t.parseVersion=function(e){var t=e.split(".");return{major:parseInt(t[0])||0,minor:parseInt(t[1])||0,patch:parseInt(t[2])||0}}},6824:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isWalletNotConnectedError=void 0,t.isWalletNotConnectedError=function(e){return e instanceof WalletNotConnectedError}},7773:(e,t,n)=>{"use strict";var r=n(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.alloc(0);for(var n=0,o=0,i=0;e[n]===c;)o++,n++;for(var s=(e.length-n)*u+1>>>0,l=new Uint8Array(s);n<e.length;){var h=e.charCodeAt(n);if(h>255)return;var d=t[h];if(255===d)return;for(var f=0,p=s-1;(0!==d||f<i)&&-1!==p;p--,f++)d+=a*l[p]>>>0,l[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=f,n++}for(var g=s-i;g!==s&&0===l[g];)g++;var y=r.allocUnsafe(o+(s-g));y.fill(0,0,o);for(var m=o;g!==s;)y[m++]=l[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,o=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var u=(s-i)*l+1>>>0,h=new Uint8Array(u);i!==s;){for(var d=t[i],f=0,p=u-1;(0!==d||f<o)&&-1!==p;p--,f++)d+=256*h[p]>>>0,h[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,i++}for(var g=u-o;g!==u&&0===h[g];)g++;for(var y=c.repeat(n);g<u;++g)y+=e.charAt(h[g]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},1656:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;const u=c(n(9404)),l=c(n(2754)),h=a(n(4281)),d=new("function"!=typeof n.g.TextDecoder?h.TextDecoder:n.g.TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=r.from(e,"utf8")),l.default.encode(r.from(e))},t.baseDecode=function(e){return r.from(l.default.decode(e))};const f=1024;
1class p extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=p;class g{constructor(){this.buf=r.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(f)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",16)))}writeBuffer(e){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),e,r.alloc(f)]),this.length+=e.length}writeString(e){this.maybeResize();const t=r.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(r.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function y(e,t,n){const r=n.value;n.value=function(...e){try{return r.apply(this,e)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new p("Reached the end of buffer when deserializing")}throw e}}}t.BinaryWriter=g;class m{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new u.default(e,"le")}readU128(){const e=this.readBuffer(16);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new p(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return d.decode(t)}catch(e){throw new p(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let r=0;r<t;++r)n.push(e());return n}}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function v(e,t,n,r,o){try{if("string"==typeof r)o[`write${w(r)}`](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new p(`Expecting byte array of length ${r[0]}, but got ${n.length} bytes`);o.writeFixedArray(n)}else o.writeArray(n,(n=>{v(e,t,n,r[0],o)}));else if(void 0!==r.kind){if("option"!==r.kind)throw new p(`FieldType ${r} unrecognized`);null===n?o.writeU8(0):(o.writeU8(1),v(e,t,n,r.type,o))}else b(e,n,o)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function b(e,t,n){const r=e.get(t.constructor);if(!r)throw new p(`Class ${t.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,o])=>{v(e,r,t[r],o,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`);{const o=t[r.field];for(let i=0;i<r.values.length;++i){const[s,a]=r.values[i];if(s===o){n.writeU8(i),v(e,s,t[s],a,n);break}}}}}function A(e,t,n,r){try{return"string"==typeof n?r[`read${w(n)}`]():n instanceof Array?"number"==typeof n[0]?r.readFixedArray(n[0]):r.readArray((()=>A(e,t,n[0],r))):k(e,n,r)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function k(e,t,n){const r=e.get(t);if(!r)throw new p(`Class ${t.name} is missing in schema`);if("struct"===r.kind){const r={};for(const[o,i]of e.get(t).fields)r[o]=A(e,o,i,n);return new t(r)}if("enum"===r.kind){const o=n.readU8();if(o>=r.values.length)throw new p(`Enum index: ${o} is out of range`);const[i,s]=r.values[o],a=A(e,i,s,n);return new t({[i]:a})}throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}s([y],m.prototype,"readU8",null),s([y],m.prototype,"readU32",null),s([y],m.prototype,"readU64",null),s([y],m.prototype,"readU128",null),s([y],m.prototype,"readString",null),s([y],m.prototype,"readFixedArray",null),s([y],m.prototype,"readArray",null),t.BinaryReader=m,t.serialize=function(e,t){const n=new g;return b(e,t,n),n.toArray()},t.deserialize=function(e,t,n){const r=new m(n),o=k(e,t,r);if(r.offset<n.length)throw new p(`Unexpected ${n.length-r.offset} bytes after deserialized data`);return o}}
1,2754:(e,t,n)=>{var r=n(7773);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},601:(e,t,n)=>{"use strict";t.I0=t.DH=t.NX=t.u8=t.cY=void 0,t.av=t.O6=t.w3=t.Wg=void 0;const r=n(4153);function o(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function i(e){return o(e),r.Buffer.from(e.buffer,e.byteOffset,e.length)}class s{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}class c extends s{isCount(){throw new Error("ExternalLayout is abstract")}}class u extends c{constructor(e,t=0,n){if(!(e instanceof s))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof l||this.layout instanceof h}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,n=0){return this.layout.encode(e,t,n+this.offset)}}class l extends s{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return i(e).readUIntLE(t,this.span)}encode(e,t,n=0){return i(t).writeUIntLE(e,n,this.span),this.span}}class h extends s{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return i(e).readUIntBE(t,this.span)}encode(e,t,n=0){return i(t).writeUIntBE(e,n,this.span),this.span}}const d=Math.pow(2,32);function f(e){const t=Math.floor(e/d);return{hi32:t,lo32:e-t*d}}function p(e,t){return e*d+t}class g extends s{constructor(e){super(8,e)}decode(e,t=0){const n=i(e),r=n.readUInt32LE(t);return p(n.readUInt32LE(t+4),r)}encode(e,t,n=0){const r=f(e),o=i(t);return o.writeUInt32LE(r.lo32,n),o.writeUInt32LE(r.hi32,n+4),8}}class y extends s{constructor(e){super(8,e)}decode(e,t=0){const n=i(e),r=n.readUInt32LE(t);return p(n.readInt32LE(t+4),r)}encode(e,t,n=0){const r=f(e),o=i(t);return o.writeUInt32LE(r.lo32,n),o.writeInt32LE(r.hi32,n+4),8}}class m extends s{constructor(e,t,n){if(!(e instanceof s))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof c&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(t instanceof c)&&0<e.span&&(r=t*e.span),super(r,n),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0,r=this.count;if(r instanceof c&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let o=0;for(;o<r;)n+=this.elementLayout.getSpan(e,t+n),++o}return n}decode(e,t=0){const n=[];let r=0,o=this.count;for(o instanceof c&&(o=o.decode(e,t));r<o;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t,n=0){const r=this.elementLayout,o=e.reduce(((e,o)=>e+r.encode(o,t,n+e)),0);return this.count instanceof c&&this.count.encode(e.length,t,n),o}}class w extends s{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof s),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(e,t);return t+=o,n+o}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t=0){o(e);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n=0){const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0<s?s:0,void 0!==r.property){const o=e[r.property];void 0!==o&&(i=r.encode(o,t,n),0>s&&(s=r.getSpan(t,n)))}o=n,n+=s}return o+i-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class v extends s{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof c||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t=0){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),i(e).slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof c&&(r=e.length),!(e instanceof Uint8Array&&r===e.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>t.length)throw new RangeError("encoding overruns Uint8Array");const o=i(e);return i(t).write(o.toString("hex"),n,r,"hex"),this.length instanceof c&&this.length.encode(r,t,n),r}}t.cY=(e,t,n)=>new u(e,t,n),t.u8=e=>new l(1,e),t.NX=e=>new l(2,e),t.DH=e=>
vendor: 6,757 bytes, line 1
1new l(4,e),t.I0=e=>new g(e),t.Wg=e=>new y(e),t.w3=(e,t,n)=>new w(e,t,n),t.O6=(e,t,n)=>new m(e,t,n),t.av=(e,t)=>new v(e,t)},4153:(e,t,n)=>{"use strict";const r=n(7526),o=n(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(o)return r?-1:q(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function b(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(Z(r))return s;e[n+s]=r}return s}function A(e,t,n,r){return Y(q(t,e.length-n),e,n,r)}function k(e,t,n,r){return Y(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return Y(H(t),e,n,r)}function S(e,t,n,r){return Y(function(e,t){let n,r,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],a=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;
vendor: 15,119 bytes, line 1
1)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}t.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if($(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<a;++e)if(u[e]!==l[e]){i=u[e],s=l[e];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return k(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function M(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Q[e[r]];return o}function C(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function V(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,s=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),s=i.length;
vendor: 5,059 bytes, line 1
1if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%s]}return this};const j={};function U(e,t,n){j[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||K(t,e.length-(n+1))}(r,o,i)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function J(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},3446:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.getMaxVoterWeightRecordAddress=t.MaxVoterWeightRecord=t.getVoterWeightRecordAddress=t.VoterWeightRecord=t.VoterWeightAction=void 0;var a,c=n(2643);(a=t.VoterWeightAction||(t.VoterWeightAction={}))[a.CastVote=0]="CastVote",a[a.CommentProposal=1]="CommentProposal",a[a.CreateGovernance=2]="CreateGovernance",a[a.CreateProposal=3]="CreateProposal",a[a.SignOffProposal=4]="SignOffProposal";t.VoterWeightRecord=function(e){this.accountDiscriminator=new Uint8Array([50,101,102,57,57,98,52,98]),this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.governingTokenOwner=e.governingTokenOwner,this.voterWeight=e.voterWeight,this.voterWeightExpiry=e.voterWeightExpiry,this.weightAction=e.weightAction,this.weightActionTarget=e.weightActionTarget},t.getVoterWeightRecordAddress=function(e,t,n,a){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,c.PublicKey.findProgramAddress([r.from("voter-weight-record"),t.toBuffer(),n.toBuffer(),a.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))};t.MaxVoterWeightRecord=function(e){this.accountDiscriminator=new Uint8Array([57,100,53,102,102,50,57,55]),this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.maxVoterWeight=e.maxVoterWeight,this.maxVoterWeightExpiry=e.maxVoterWeightExpiry},t.getMaxVoterWeightRecordAddress=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,c.PublicKey.findProgramAddress([r.from("max-voter-weight-record"),t.toBuffer(),n.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))}},7364:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceAddinAccount=t.getVoterWeightRecord=t.getMaxVoterWeightRecord=void 0;var i=n(3446),s=n(4621);function a(e,t,n){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return[4,e.getAccountInfo(t)];case 1:if(!(r=o.sent()))throw new Error("Account ".concat(t," of type ").concat(n.name," not found"));return[2,(0,s.GovernanceAddinAccountParser)(n)(t,r)]}}))}))}t.getMaxVoterWeightRecord=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,a(e,t,i.MaxVoterWeightRecord)]}))}))},t.getVoterWeightRecord=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,a(e,t,i.VoterWeightRecord)]}))}))},t.getGovernanceAddinAccount=a},7816:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(3446),t),o(n(7364),t),o(n(4621),t)},4621:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GovernanceAddinAccountParser=t.GOVERNANCE_ADDINS_SCHEMA=void 0;var r=n(3446),o=n(2943);t.GOVERNANCE_ADDINS_SCHEMA=new Map([[r.MaxVoterWeightRecord,{kind:"struct",fields:[["accountDiscriminator",[8]],["realm","pubkey"],["governingTokenMint","pubkey"],["maxVoterWeight","u64"],["maxVoterWeightExpiry",{kind:"option",type:"u64"}]]}],[r.VoterWeightRecord,{kind:"struct",fields:[["accountDiscriminator",[8]],["realm","pubkey"],["governingTokenMint","pubkey"],["governingTokenOwner","pubkey"],["voterWeight","u64"],["voterWeightExpiry",{kind:"option",type:"u64"}],["weightAction",{kind:"option",type:"u8"}],["weightActionTarget",{kind:"option",type:"pubkey"}]]}]]),t.GovernanceAddinAccountParser=function(e){return(0,o.BorshAccountParser)(e,(function(e){return t.GOVERNANCE_ADDINS_SCHEMA}))}},6151:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMessage=t.ChatMessageBody=t.ChatMessageBodyType=t.GovernanceChatAccountType=t.GOVERNANCE_CHAT_PROGRAM_ID=void 0;var r,o,i=n(2643);t.GOVERNANCE_CHAT_PROGRAM_ID=new i.PublicKey("gCHAtYKrUUktTVzE4hEnZdLV4LXrdBf6Hh9qMaJALET"),function(e){e[e.Uninitialized=0]="Uninitialized",e[e.ChatMessage=1]="ChatMessage"}(r=t.GovernanceChatAccountType||(t.GovernanceChatAccountType={})),(o=t.ChatMessageBodyType||(t.ChatMessageBodyType={}))[o.Text=0]="Text",o[o.Reaction=1]="Reaction";t.ChatMessageBody=function(e){var t;this.type=e.type,this.value=e.value,this.isReply=null!==(t=e.isReply)&&void 0!==t&&t};t.ChatMessage=function(e){this.accountType=r.ChatMessage,this.proposal=e.proposal,this.author=e.author,this.postedAt=e.postedAt,this.replyTo=e.replyTo,this.body=e.body}},3275:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceChatMessagesByVoter=t.getGovernanceChatMessages=void 0;var r=n(4546),o=n(6151),i=n(6686);t.getGovernanceChatMessages=function(e,t,n){return(0,r.getBorshProgramAccounts)(e,t,(function(e){return i.GOVERNANCE_CHAT_SCHEMA}),o.ChatMessage,[(0,r.pubkeyFilter)(1,n)])},t.getGovernanceChatMessagesByVoter=function(e,t,n){return(0,r.getBorshProgramAccounts)(e,t,(function(e){return i.GOVERNANCE_CHAT_SCHEMA}),o.ChatMessage,[(0,r.pubkeyFilter)(33,n)])}},6511:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(6151),t),o(n(3275),t),o(n(8814),t),o(n(6686),t),o(n(8524),t)},8814:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.PostChatMessageArgs=t.GovernanceChatInstruction=void 0,function(e){e[e.PostMessage=0]="PostMessage"}(n=t.GovernanceChatInstruction||(t.GovernanceChatInstruction={}));t.PostChatMessageArgs=function(e){this.instruction=n.PostMessage,this.body=e.body}},6686:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAccountParser=t.GOVERNANCE_CHAT_SCHEMA=void 0;var r=n(6151),o=n(2943),i=n(8814);t.GOVERNANCE_CHAT_SCHEMA=new Map([[r.ChatMessageBody,{kind:"struct",fields:[["type","u8"],["value","string"],["isReply","u8"]]}],[r.ChatMessage,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["author","pubkey"],["postedAt","u64"],["replyTo",{kind:"option",type:"pubkey"}],["body",r.ChatMessageBody]]}],[i.PostChatMessageArgs,{kind:"struct",fields:[["instruction","u8"],["body",r.ChatMessageBody]]}]]),t.ChatAccountParser=function(e){return(0,o.BorshAccountParser)(e,(function(e){return t.GOVERNANCE_CHAT_SCHEMA}))}},8524:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withPostChatMessage=void 0;var s=n(2643),a=n(6686),c=n(8612),u=n(8814),l=n(7507),h=n(3043);t.withPostChatMessage=function(e,t,n,d,f,p,g,y,m,w,v,b,A){return o(this,void 0,void 0,(function(){var o,k,_,S;return i(this,(function(i){switch(i.label){case 0:return o=new u.PostChatMessageArgs({body:b}),k=r.from((0,c.serialize)(a.GOVERNANCE_CHAT_SCHEMA,o)),_=new s.Keypair,t.push(_),S=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!0},{pubkey:_.publicKey,isWritable:!0,isSigner:!0},{pubkey:w,isWritable:!1,isSigner:!0},{pubkey:l.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],v&&S.push({pubkey:v,isWritable:!1,isSigner:!1}),[4,(0,h.withRealmConfigPluginAccounts)(S,d,f,A)];case 1:return i.sent(),e.push(new s.TransactionInstruction({keys:S,programId:n,data:k})),[2,_.publicKey]}}))}))}},6460:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4546:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},c=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getBorshProgramAccounts=t.booleanFilter=t.pubkeyFilter=t.MemcmpFilter=t.RpcContext=void 0;var l=n(2643),h=u(n(4726)),d=n(7729),f=n(7208),p=n(7356),g=function(){function e(e,t,n,r,o){this.programId=e,this.wallet=n,this.connection=r,this.endpoint=o,this.programVersion=t}return Object.defineProperty(e.prototype,"walletPubkey",{get:function(){var e;if(!(null===(e=this.wallet)||void 0===e?void 0:e.publicKey))throw new p.WalletNotConnectedError;return this.wallet.publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"programIdBase58",{get:function(){return this.programId.toBase58()}
1,enumerable:!1,configurable:!0}),e}();t.RpcContext=g;var y=function(){function e(e,t){this.offset=e,this.bytes=t}return e.prototype.isMatch=function(e){if(this.offset+this.bytes.length>e.length)return!1;for(var t=0;t<this.bytes.length;t++)if(this.bytes[t]!==e[this.offset+t])return!1;return!0},e}();t.MemcmpFilter=y,t.pubkeyFilter=function(e,t){return t?new y(e,t.toBuffer()):void 0},t.booleanFilter=function(e,t){return new y(e,r.from(t?[1]:[0]))},t.getBorshProgramAccounts=function(e,t,n,r,u,p){return void 0===u&&(u=[]),o(this,void 0,void 0,(function(){var o,g,y,m,w,v,b,A,k,_;return i(this,(function(i){switch(i.label){case 0:return p=null!=p?p:new r({}).accountType,[4,e.getProgramAccounts(t,{commitment:e.commitment,filters:a([{memcmp:{offset:0,bytes:h.default.encode([p])}}],s(u.map((function(e){return{memcmp:{offset:e.offset,bytes:h.default.encode(e.bytes)}}}))),!1)})];case 1:o=i.sent(),g=[];try{for(y=c(o),m=y.next();!m.done;m=y.next()){w=m.value;try{v=w.account.data,b=v[0],A={pubkey:new l.PublicKey(w.pubkey),account:(0,f.deserializeBorsh)(n(b),r,v),owner:w.account.owner},g.push(A)}catch(e){console.info("Can't deserialize ".concat(r.name," @ ").concat(w.pubkey,"."),(0,d.getErrorMessage)(e))}}}catch(e){k={error:e}}finally{try{m&&!m.done&&(_=y.return)&&_.call(y)}finally{if(k)throw k.error}}return[2,g]}}))}))}},1938:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(6460),t),o(n(4546),t),o(n(2943),t)}
1,2943:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BorshAccountParser=void 0;var o=n(7208);t.BorshAccountParser=function(e,t){return function(n,i){var s=r.from(i.data),a=(0,o.deserializeBorsh)(t(i.data[0]),e,s);return{pubkey:n,owner:i.owner,account:a}}}},2037:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getProposalDepositAddress=t.getGoverningTokenHoldingAddress=t.getNativeTreasuryAddress=t.getProgramMetadataAddress=t.ProgramMetadata=t.getProposalTransactionAddress=t.ProposalTransaction=t.InstructionData=t.AccountMetaData=t.getVoteRecordAddress=t.VoteRecord=t.VoteWeight=t.getSignatoryRecordAddress=t.SignatoryRecord=t.ProposalDeposit=t.Proposal=t.ProposalOption=t.OptionVoteResult=t.ProposalState=t.getTokenOwnerRecordAddress=t.TokenOwnerRecord=t.Governance=t.GovernanceConfig=t.getRealmConfigAddress=t.RealmConfigAccount=t.GoverningTokenConfig=t.getTokenHoldingAddress=t.Realm=t.RealmConfig=t.GoverningTokenConfigAccountArgs=t.GoverningTokenConfigArgs=t.GoverningTokenType=t.RealmConfigArgs=t.VoteType=t.MultiChoiceType=t.VoteTypeKind=t.MintMaxVoteWeightSource=t.MintMaxVoteWeightSourceType=t.InstructionExecutionFlags=t.InstructionExecutionStatus=t.VoteTipping=t.VoteThreshold=t.VoteThresholdType=t.getGovernanceAccountVersion=t.getAccountTypes=t.GovernanceAccountType=t.GOVERNANCE_PROGRAM_SEED=void 0;var c,u,l=n(2643),h=a(n(9404)),d=a(n(1594)),f=n(3420),p=n(2155);t.GOVERNANCE_PROGRAM_SEED="governance",function(e){e[e.Uninitialized=0]="Uninitialized",e[e.RealmV1=1]="RealmV1",e[e.TokenOwnerRecordV1=2]="TokenOwnerRecordV1",e[e.GovernanceV1=3]="GovernanceV1",e[e.ProgramGovernanceV1=4]="ProgramGovernanceV1",e[e.ProposalV1=5]="ProposalV1",e[e.SignatoryRecordV1=6]="SignatoryRecordV1",e[e.VoteRecordV1=7]="VoteRecordV1",e[e.ProposalInstructionV1=8]="ProposalInstructionV1",e[e.MintGovernanceV1=9]="MintGovernanceV1",e[e.TokenGovernanceV1=10]="TokenGovernanceV1",e[e.RealmConfig=11]="RealmConfig",e[e.VoteRecordV2=12]="VoteRecordV2",e[e.ProposalTransactionV2=13]="ProposalTransactionV2",e[e.ProposalV2=14]="ProposalV2",e[e.ProgramMetadata=15]="ProgramMetadata",e[e.RealmV2=16]="RealmV2",e[e.TokenOwnerRecordV2=17]="TokenOwnerRecordV2",e[e.GovernanceV2=18]="GovernanceV2",e[e.ProgramGovernanceV2=19]="ProgramGovernanceV2",e[e.MintGovernanceV2=20]="MintGovernanceV2",e[e.TokenGovernanceV2=21]="TokenGovernanceV2",e[e.SignatoryRecordV2=22]="SignatoryRecordV2",e[e.ProposalDeposit=23]="ProposalDeposit"}(c=t.GovernanceAccountType||(t.GovernanceAccountType={})),t.getAccountTypes=function(e){switch(e){case E:return[c.RealmV1,c.RealmV2];case x:return[c.TokenOwnerRecordV1,c.TokenOwnerRecordV2];case C:return[c.ProposalV1,c.ProposalV2];case O:return[c.ProposalDeposit];case P:return[c.SignatoryRecordV1,c.SignatoryRecordV2];case N:return[c.VoteRecordV1,c.VoteRecordV2];case B:return[c.ProposalInstructionV1,c.ProposalTransactionV2];case T:return[c.RealmConfig];case I:return[c.GovernanceV1,c.ProgramGovernanceV1,c.MintGovernanceV1,c.TokenGovernanceV1,c.GovernanceV2,c.ProgramGovernanceV2,c.MintGovernanceV2,c.TokenGovernanceV2];case V:return[c.ProgramMetadata];default:throw Error("".concat(e," account is not supported"))}},t.getGovernanceAccountVersion=function(e){switch(e){case c.VoteRecordV2:case c.ProposalTransactionV2:case c.ProposalV2:case c.RealmV2:case c.TokenOwnerRecordV2:case c.GovernanceV2:case c.ProgramGovernanceV2:case c.MintGovernanceV2:case c.TokenGovernanceV2:case c.SignatoryRecordV2:return p.ACCOUNT_VERSION_V2;default:return p.ACCOUNT_VERSION_V1}},function(e){e[e.YesVotePercentage=0]="YesVotePercentage",e[e.QuorumPercentage=1]="QuorumPercentage",e[e.Disabled=2]="Disabled"}(u=t.VoteThresholdType||(t.VoteThresholdType={}));var g,y,m,w,v=function(e){this.type=e.type,this.value=e.value};t.VoteThreshold=v,function(e){e[e.Strict=0]="Strict",e[e.Early=1]="Early",e[e.Disabled=2]="Disabled"}(g=t.VoteTipping||(t.VoteTipping={}
1)),(w=t.InstructionExecutionStatus||(t.InstructionExecutionStatus={}))[w.None=0]="None",w[w.Success=1]="Success",w[w.Error=2]="Error",(m=t.InstructionExecutionFlags||(t.InstructionExecutionFlags={}))[m.None=0]="None",m[m.Ordered=1]="Ordered",m[m.UseTransaction=2]="UseTransaction",function(e){e[e.SupplyFraction=0]="SupplyFraction",e[e.Absolute=1]="Absolute"}(y=t.MintMaxVoteWeightSourceType||(t.MintMaxVoteWeightSourceType={}));var b,A,k=function(){function e(e){this.type=e.type,this.value=e.value}return e.prototype.isFullSupply=function(){return this.type===y.SupplyFraction&&0===this.value.cmp(e.SUPPLY_FRACTION_BASE)},e.prototype.getSupplyFraction=function(){if(this.type!==y.SupplyFraction)throw new Error("Max vote weight is not fraction");return this.value},e.prototype.fmtSupplyFractionPercentage=function(){return new d.default(this.getSupplyFraction()).shiftedBy(2-e.SUPPLY_FRACTION_DECIMALS).toFormat()},e.SUPPLY_FRACTION_BASE=new h.default(1e10),e.SUPPLY_FRACTION_DECIMALS=10,e.FULL_SUPPLY_FRACTION=new e({type:y.SupplyFraction,value:e.SUPPLY_FRACTION_BASE}),e}();t.MintMaxVoteWeightSource=k,function(e){e[e.SingleChoice=0]="SingleChoice",e[e.MultiChoice=1]="MultiChoice"}(b=t.VoteTypeKind||(t.VoteTypeKind={})),(A=t.MultiChoiceType||(t.MultiChoiceType={}))[A.FullWeight=0]="FullWeight",A[A.Weighted=1]="Weighted";var _=function(){function e(e){this.type=e.type,this.choiceType=e.choiceType,this.minVoterOptions=e.minVoterOptions,this.maxVoterOptions=e.maxVoterOptions,this.maxWinningOptions=e.maxWinningOptions}return e.prototype.isSingleChoice=function(){return this.type===b.SingleChoice},e.SINGLE_CHOICE=new e({type:b.SingleChoice,choiceType:void 0,minVoterOptions:void 0,maxVoterOptions:void 0,maxWinningOptions:void 0}),e.MULTI_CHOICE=function(t,n,r,o){return new e({type:b.MultiChoice,choiceType:t,minVoterOptions:n,maxVoterOptions:r,maxWinningOptions:o})},e}();t.VoteType=_;var S;t.RealmConfigArgs=function(e){this.useCouncilMint=!!e.useCouncilMint,this.communityMintMaxVoteWeightSource=e.communityMintMaxVoteWeightSource,this.minCommunityTokensToCreateGovernance=e.minCommunityTokensToCreateGovernance,this.useCommunityVoterWeightAddin=e.useCommunityVoterWeightAddin,this.useMaxCommunityVoterWeightAddin=e.useMaxCommunityVoterWeightAddin,this.communityTokenConfigArgs=e.communityTokenConfigArgs,this.councilTokenConfigArgs=e.councilTokenConfigArgs},(S=t.GoverningTokenType||(t.GoverningTokenType={}))[S.Liquid=0]="Liquid",S[S.Membership=1]="Membership",S[S.Dormant=2]="Dormant";t.GoverningTokenConfigArgs=function(e){this.useVoterWeightAddin=e.useVoterWeightAddin,this.useMaxVoterWeightAddin=e.useMaxVoterWeightAddin,this.tokenType=e.tokenType};t.GoverningTokenConfigAccountArgs=function(e){this.voterWeightAddin=e.voterWeightAddin,this.maxVoterWeightAddin=e.maxVoterWeightAddin,this.tokenType=e.tokenType};t.RealmConfig=function(e){this.councilMint=e.councilMint,this.communityMintMaxVoteWeightSource=e.communityMintMaxVoteWeightSource,this.minCommunityTokensToCreateGovernance=e.minCommunityTokensToCreateGovernance,this.useCommunityVoterWeightAddin=!!e.useCommunityVoterWeightAddin,this.useMaxCommunityVoterWeightAddin=!!e.useMaxCommunityVoterWeightAddin,this.reserved=e.reserved};var E=function(e){this.accountType=c.RealmV1,this.communityMint=e.communityMint,this.config=e.config,this.reserved=e.reserved,this.votingProposalCount=e.votingProposalCount,this.authority=e.authority,this.name=e.name};t.Realm=E,t.getTokenHoldingAddress=function(e,n,a){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),a.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))};t.GoverningTokenConfig=function(e){this.voterWeightAddin=e.voterWeightAddin,this.maxVoterWeightAddin=e.maxVoterWeightAddin,this.tokenType=e.tokenType,this.reserved=e.reserved};var T=function(e){this.accountType=c.RealmConfig,this.realm=e.realm,this.communityTokenConfig=e.communityTokenConfig,this.councilTokenConfig=e.councilTokenConfig,this.reserved=e.reserved};t.RealmConfigAccount=T,t.getRealmConfigAddress=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from("realm-config"),t.toBuffer()],e)];case 1:return[2,s.apply(void 0,[n.sent(),1])[0]]}}))}))};t.GovernanceConfig=function(e){var t,n,r,o,i;this.communityVoteThreshold=e.communityVoteThreshold,this.minCommunityTokensToCreateProposal=e.minCommunityTokensToCreateProposal,this.minInstructionHoldUpTime=e.minInstructionHoldUpTime,this.baseVotingTime=e.baseVotingTime,this.communityVoteTipping=null!==(t=e.communityVoteTipping)&&void 0!==t?t:g.Strict,this.minCouncilTokensToCreateProposal=e.minCouncilTokensToCreateProposal,this.councilVoteThreshold=null!==(n=e.councilVoteThreshold)&&void 0!==n?n:e.communityVoteThreshold,this.councilVetoVoteThreshold=null!==(r=e.councilVetoVoteThreshold)&&void 0!==r?r:e.communityVoteThreshold,this.communityVetoVoteThreshold=null!==(o=e.communityVetoVoteThreshold)&&void 0!==o?o:new v({type:u.Disabled}),this.councilVoteTipping=null!==(i=e.councilVoteTipping)&&void 0!==i?i:this.communityVoteTipping,this.votingCoolOffTime=e.votingCoolOffTime,this.depositExemptProposalCount=e.depositExemptProposalCount};var I=function(){function e(e){this.accountType=e.accountType,this.realm=e.realm,this.governedAccount=e.governedAccount,this.config=e.config,this.reserved=e.reserved,this.proposalCount=e.proposalCount,this.activeProposalCount=e.activeProposalCount}return e.prototype.isProgramGovernance=function(){return this.accountType===c.ProgramGovernanceV1||this.accountType===c.ProgramGovernanceV2},e.prototype.isAccountGovernance=function(){return this.accountType===c.GovernanceV1||this.accountType===c.GovernanceV2},e.prototype.isMintGovernance=function(){return this.accountType===c.MintGovernanceV1||this.accountType===c.MintGovernanceV2},e.prototype.isTokenGovernance=function(){return this.accountType===c.TokenGovernanceV1||this.accountType===c.TokenGovernanceV2},e}();t.Governance=I;var M,R,x=function(e){this.accountType=c.TokenOwnerRecordV1,this.realm=e.realm,this.governingTokenMint=e.governingTokenMint,this.governingTokenOwner=e.governingTokenOwner,this.governingTokenDepositAmount=e.governingTokenDepositAmount,this.unrelinquishedVotesCount=e.unrelinquishedVotesCount,this.totalVotesCount=e.totalVotesCount,this.outstandingProposalCount=e.outstandingProposalCount,this.reserved=e.reserved,this.governanceDelegate=e.governanceDelegate,this.version=e.version};t.TokenOwnerRecord=x,t.getTokenOwnerRecordAddress=function(e,n,a,c){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),a.toBuffer(),c.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))},function(e){e[e.Draft=0]="Draft",e[e.SigningOff=1]="SigningOff",e[e.Voting=2]="Voting",e[e.Succeeded=3]="Succeeded",e[e.Executing=4]="Executing",e[e.Completed=5]="Completed",e[e.Cancelled=6]="Cancelled",e[e.Defeated=7]="Defeated",e[e.ExecutingWithErrors=8]="ExecutingWithErrors",e[e.Vetoed=9]="Vetoed"}(M=t.ProposalState||(t.ProposalState={})),(R=t.OptionVoteResult||(t.OptionVoteResult={}))[R.None=0]="None",R[R.Succeeded=1]="Succeeded",R[R.Defeated=2]="Defeated";t.ProposalOption=function(e){this.label=e.label,this.voteWeight=e.voteWeight,this.voteResult=e.voteResult,this.instructionsExecutedCount=e.instructionsExecutedCount,this.instructionsCount=e.instructionsCount,this.instructionsNextIndex=e.instructionsNextIndex};var C=function(){function e(e){this.accountType=e.accountType,this.governance=e.governance,this.governingTokenMint=e.governingTokenMint,this.state=e.state,this.tokenOwnerRecord=e.tokenOwnerRecord,this.signatoriesCount=e.signatoriesCount,this.signatoriesSignedOffCount=e.signatoriesSignedOffCount,this.descriptionLink=e.descriptionLink,this.name=e.name,this.yesVotesCount=e.yesVotesCount,this.noVotesCount=e.noVotesCount,this.instructionsExecutedCount=e.instructionsExecutedCount,this.instructionsCount=e.instructionsCount,this.instructionsNextIndex=e.instructionsNextIndex,this.voteType=e.voteType,this.options=e.options,this.denyVoteWeight=e.denyVoteWeight,this.reserved1=e.reserved1,this.abstainVoteWeight=e.abstainVoteWeight,this.startVotingAt=e.startVotingAt,this.maxVotingTime=e.maxVotingTime,this.draftAt=e.draftAt,this.signingOffAt=e.signingOffAt,this.votingAt=e.votingAt,this.votingAtSlot=e.votingAtSlot,this.votingCompletedAt=e.votingCompletedAt,this.executingAt=e.executingAt,this.closedAt=e.closedAt,this.executionFlags=e.executionFlags,this.maxVoteWeight=e.maxVoteWeight,this.voteThreshold=e.voteThreshold,this.vetoVoteWeight=e.vetoVoteWeight}return e.prototype.isVoteFinalized=function(){switch(this.state){case M.Succeeded:case M.Executing:case M.Completed:case M.Cancelled:case M.Defeated:case M.ExecutingWithErrors:case M.Vetoed:return!0;case M.Draft:case M.SigningOff:case M.Voting:return!1}},e.prototype.isFinalState=function(){switch(this.state){case M.C
1ompleted:case M.Cancelled:case M.Defeated:case M.ExecutingWithErrors:case M.Vetoed:return!0;case M.Succeeded:return 0===this.instructionsCount;case M.Executing:case M.Draft:case M.SigningOff:case M.Voting:return!1}},e.prototype.getStateTimestamp=function(){switch(this.state){case M.Succeeded:case M.Defeated:case M.Vetoed:return this.votingCompletedAt?this.votingCompletedAt.toNumber():0;case M.Completed:case M.Cancelled:return this.closedAt?this.closedAt.toNumber():0;case M.Executing:case M.ExecutingWithErrors:return this.executingAt?this.executingAt.toNumber():0;case M.Draft:return this.draftAt.toNumber();case M.SigningOff:return this.signingOffAt?this.signingOffAt.toNumber():0;case M.Voting:return this.votingAt?this.votingAt.toNumber():0}},e.prototype.getStateSortRank=function(){return this.state===M.Voting?2:this.isFinalState()?0:1},e.prototype.isPreVotingState=function(){return!this.votingAtSlot},e.prototype.getYesVoteOption=function(){if(1!==this.options.length&&!this.voteType.isSingleChoice())throw new Error("Proposal is not Yes/No vote");return this.options[0]},e.prototype.getYesVoteCount=function(){switch(this.accountType){case c.ProposalV1:return this.yesVotesCount;case c.ProposalV2:return this.getYesVoteOption().voteWeight;default:throw new Error("Invalid account type ".concat(this.accountType))}},e.prototype.getNoVoteCount=function(){switch(this.accountType){case c.ProposalV1:return this.noVotesCount;case c.ProposalV2:return this.denyVoteWeight;default:throw new Error("Invalid account type ".concat(this.accountType))}},e.prototype.getTimeToVoteEnd=function(e){var t,n,r=Date.now()/1e3;return(this.isPreVotingState()?e.config.baseVotingTime:(null!==(n=null===(t=this.votingAt)||void 0===t?void 0:t.toNumber())&&void 0!==n?n:0)+e.config.baseVotingTime-r)+e.config.votingCoolOffTime},e.prototype.hasVoteTimeEnded=function(e){return this.getTimeToVoteEnd(e)<=0},e.prototype.canCancel=function(e){return this.state===M.Draft||this.state===M.SigningOff||this.state===M.Voting&&!this.hasVoteTimeEnded(e)},e.prototype.canWalletCancel=function(e,t,n){var r;return!!this.canCancel(e)&&(t.governingTokenOwner.equals(n)||(null===(r=t.governanceDelegate)||void 0===r?void 0:r.equals(n)))},e}();t.Proposal=C;var O=function(e){this.accountType=c.ProposalDeposit,this.proposal=e.proposal,this.depositPayer=e.depositPayer};t.ProposalDeposit=O;var P=function(e){this.accountType=c.SignatoryRecordV1,this.proposal=e.proposal,this.signatory=e.signatory,this.signedOff=!!e.signedOff};t.SignatoryRecord=P,t.getSignatoryRecordAddress=function(e,n,a){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),a.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))};t.VoteWeight=function(e){this.yes=e.yes,this.no=e.no};var N=function(){function e(e){this.accountType=e.accountType,this.proposal=e.proposal,this.governingTokenOwner=e.governingTokenOwner,this.isRelinquished=!!e.isRelinquished,this.voteWeight=e.voteWeight,this.voterWeight=e.voterWeight,this.vote=e.vote}return e.prototype.getNoVoteWeight=function(){var e,t;switch(this.accountType){case c.VoteRecordV1:return null===(e=this.voteWeight)||void 0===e?void 0:e.no;case c.VoteRecordV2:switch(null===(t=this.vote)||void 0===t?void 0:t.voteType){case f.VoteKind.Approve:return;case f.VoteKind.Deny:return this.voterWeight;default:throw new Error("Invalid voteKind")}default:throw new Error("Invalid account type ".concat(this.accountType," "))}},e.prototype.getYesVoteWeight=function(){var e,t;switch(this.accountType){case c.VoteRecordV1:return null===(e=this.voteWeight)||void 0===e?void 0:e.yes;case c.VoteRecordV2:switch(null===(t=this.vote)||void 0===t?void 0:t.voteType){case f.VoteKind.Approve:return this.voterWeight;case f.VoteKind.Deny:return;default:throw new Error("Invalid voteKind")}default:throw new Error("Invalid account type ".concat(this.accountType," "))}},e}();t.VoteRecord=N,t.getVoteRecordAddress=function(e,n,a){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),a.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))};t.AccountMetaData=function(e){this.pubkey=e.pubkey,this.isSigner=!!e.isSigner,this.isWritable=!!e.isWritable};t.InstructionData=function(e){this.programId=e.programId,this.accounts=e.accounts,this.data=e.data};var B=function(){function e(e){this.accountType=e.accountType,this.proposal=e.proposal,this.instructionIndex=e.instructionIndex,this.optionIndex=e.optionIndex,this.holdUpTime=e.holdUpTime,this.instruction=e.instruction,this.executedAt=e.executedAt,this.executionStatus=e.executionStatus,this.instructions=e.instructions}return e.prototype.getSingleInstruction=function(){if(this.accountType===c.ProposalInstructionV1)return this.instruction;if(0===this.instructions.length)throw new Error("Transaction has no instructions");
1if(this.instructions.length>1)throw new Error("Transaction has multiple instructions");return this.instructions[0]},e.prototype.getAllInstructions=function(){return this.accountType===c.ProposalInstructionV1?[this.instruction]:this.instructions},e}();t.ProposalTransaction=B,t.getProposalTransactionAddress=function(e,n,a,c,u){return o(this,void 0,void 0,(function(){var o,h,d;return i(this,(function(i){switch(i.label){case 0:return(o=r.alloc(1)).writeUInt8(c),(h=r.alloc(2)).writeInt16LE(u,0),d=n===p.PROGRAM_VERSION_V1?[r.from(t.GOVERNANCE_PROGRAM_SEED),a.toBuffer(),h]:[r.from(t.GOVERNANCE_PROGRAM_SEED),a.toBuffer(),o,h],[4,l.PublicKey.findProgramAddress(d,e)];case 1:return[2,s.apply(void 0,[i.sent(),1])[0]]}}))}))};var V=function(e){this.accountType=c.ProgramMetadata,this.updatedAt=e.updatedAt,this.reserved=e.reserved,this.version=e.version};t.ProgramMetadata=V,t.getProgramMetadataAddress=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from("metadata")],e)];case 1:return[2,s.apply(void 0,[t.sent(),1])[0]]}}))}))},t.getNativeTreasuryAddress=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from("native-treasury"),t.toBuffer()],e)];case 1:return[2,s.apply(void 0,[n.sent(),1])[0]]}}))}))},t.getGoverningTokenHoldingAddress=function(e,n,a){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from(t.GOVERNANCE_PROGRAM_SEED),n.toBuffer(),a.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))},t.getProposalDepositAddress=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(o){switch(o.label){case 0:return[4,l.PublicKey.findProgramAddress([r.from("proposal-deposit"),t.toBuffer(),n.toBuffer()],e)];case 1:return[2,s.apply(void 0,[o.sent(),1])[0]]}}))}))}},9185:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},c=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}
1,u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.tryGetGovernanceAccount=t.getGovernanceAccount=t.getGovernanceAccounts=t.getProposalDepositsByDepositPayer=t.getAllProposals=t.getProposalsByGovernance=t.getProposal=t.getAllGovernances=t.getGovernance=t.getAllTokenOwnerRecords=t.getTokenOwnerRecordsByOwner=t.getTokenOwnerRecord=t.getTokenOwnerRecordForRealm=t.getVoteRecordsByVoter=t.getVoteRecord=t.getRealmConfig=t.tryGetRealmConfig=t.getRealms=t.getRealm=void 0;var l=n(2643),h=n(280),d=n(2037),f=n(4546),p=u(n(4726)),g=u(n(6425)),y=n(7208),m=n(3444);function w(e,t){var n;return o(this,void 0,void 0,(function(){var o,u,f,w,v,b,A,k,_,S,E,T,I,M,R,x,C,O;return i(this,(function(P){switch(P.label){case 0:o=(0,d.getAccountTypes)(d.Realm),u=e._rpcEndpoint,f=[],w=function(r){var o;return i(this,(function(i){switch(i.label){case 0:return[4,g.default.request({url:u,method:"POST",headers:{"Content-Type":"application/json"},data:JSON.stringify(a([],s(t.map((function(t){return{jsonrpc:"2.0",id:t.toBase58(),method:"getProgramAccounts",params:[t.toBase58(),{commitment:e.commitment,encoding:"base64",filters:[{memcmp:{offset:0,bytes:p.default.encode([r])}}]}]}}))),!1))})];case 1:return o=i.sent(),f.push.apply(f,a([],s(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.filter((function(e){return e.result})).flatMap((function(e){return e.result}))),!1)),[2]}}))},P.label=1;case 1:P.trys.push([1,6,7,8]),v=c(o),b=v.next(),P.label=2;case 2:return b.done?[3,5]:(I=b.value,[5,w(I)]);case 3:P.sent(),P.label=4;case 4:return b=v.next(),[3,2];case 5:return[3,8];case 6:return A=P.sent(),R={error:A},[3,8];case 7:try{b&&!b.done&&(x=v.return)&&x.call(v)}finally{if(R)throw R.error}return[7];case 8:k=[];try{for(_=c(f),S=_.next();!S.done;S=_.next()){E=S.value;try{T=r.from(E.account.data[0],"base64"),I=T[0],M={pubkey:new l.PublicKey(E.pubkey),account:(0,y.deserializeBorsh)((0,h.getGovernanceSchemaForAccount)(I),d.Realm,T),owner:E.account.owner},k.push(M)}catch(e){console.info("Can't deserialize Realm @ ".concat(E.pubkey,"."),(0,m.getErrorMessage)(e))}}}catch(e){C={error:e}}finally{try{S&&!S.done&&(O=_.return)&&O.call(_)}finally{if(C)throw C.error}}return[2,k]}}))}))}function v(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.Governance,[(0,f.pubkeyFilter)(1,n)])]}))}))}function b(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.Proposal,[(0,f.pubkeyFilter)(1,n)])]}))}))}function A(e,t,n,r){return void 0===r&&(r=[]),o(this,void 0,void 0,(function(){var o,u,l,p,g,y,m,w,v;return i(this,(function(i){switch(i.label){case 0:o=(0,d.getAccountTypes)(n),u=[],i.label=1;case 1:i.trys.push([1,6,7,8]),l=c(o),p=l.next(),i.label=2;case 2:return p.done?[3,5]:(g=p.value,[4,(0,f.getBorshProgramAccounts)(e,t,(function(e){return(0,h.getGovernanceSchemaForAccount)(e)}),n,r,g)]);case 3:y=i.sent(),u.push.apply(u,a([],s(y),!1)),i.label=4;case 4:return p=l.next(),[3,2];case 5:return[3,8];case 6:return m=i.sent(),w={error:m},[3,8];case 7:try{p&&!p.done&&(v=l.return)&&v.call(l)}finally{if(w)throw w.error}return[7];case 8:return[2,u]}}))}))}function k(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,e.getAccountInfo(t)];case 1:if(!(r=o.sent()))throw new Error("Account ".concat(t," of type ").concat(n.name," not found"));return[2,(0,h.GovernanceAccountParser)(n)(t,r)]}}))}))}t.getRealm=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.Realm)]}))}))},t.getRealms=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return t instanceof l.PublicKey?[2,A(e,t,d.Realm)]:[2,w(e,t)]}))}))},t.tryGetRealmConfig=function(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,(0,d.getRealmConfigAddress)(t,n)];case 1:return r=o.sent(),[4,k(e,r,d.RealmConfigAccount)];case 2:return[2,o.sent()];case 3:return o.sent(),[3,4];case 4:return[2]}}
1))}))},t.getRealmConfig=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.RealmConfigAccount)]}))}))},t.getVoteRecord=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.VoteRecord)]}))}))},t.getVoteRecordsByVoter=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.VoteRecord,[(0,f.pubkeyFilter)(33,n)])]}))}))},t.getTokenOwnerRecordForRealm=function(e,t,n,r,s){return o(this,void 0,void 0,(function(){var o;return i(this,(function(i){switch(i.label){case 0:return[4,(0,d.getTokenOwnerRecordAddress)(t,n,r,s)];case 1:return o=i.sent(),[2,k(e,o,d.TokenOwnerRecord)]}}))}))},t.getTokenOwnerRecord=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.TokenOwnerRecord)]}))}))},t.getTokenOwnerRecordsByOwner=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.TokenOwnerRecord,[(0,f.pubkeyFilter)(65,n)])]}))}))},t.getAllTokenOwnerRecords=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.TokenOwnerRecord,[(0,f.pubkeyFilter)(1,n)])]}))}))},t.getGovernance=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.Governance)]}))}))},t.getAllGovernances=v,t.getProposal=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){return[2,k(e,t,d.Proposal)]}))}))},t.getProposalsByGovernance=b,t.getAllProposals=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,v(e,t,n).then((function(n){return Promise.all(n.map((function(n){return b(e,t,n.pubkey)})))}))]}))}))},t.getProposalDepositsByDepositPayer=function(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,A(e,t,d.ProposalDeposit,[(0,f.pubkeyFilter)(33,n)])]}))}))},t.getGovernanceAccounts=A,t.getGovernanceAccount=k,t.tryGetGovernanceAccount=function(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,e.getAccountInfo(t)];case 1:return(r=o.sent())?[2,(0,h.GovernanceAccountParser)(n)(t,r)]:[2]}}))}))}},2612:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createRevokeGoverningTokens=void 0;var i=n(8068);t.createRevokeGoverningTokens=function(e,t,n,s,a,c,u){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return r=[],[4,(0,i.withRevokeGoverningTokens)(r,e,t,n,s,a,c,u)];case 1:return o.sent(),[2,r[0]]}}))}))}},2343:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.createSetGovernanceConfig=void 0;var o=n(2643),i=n(3420),s=n(280),a=n(8612);t.createSetGovernanceConfig=function(e,t,n,c){var u=new i.SetGovernanceConfigArgs({config:c}),l=r.from((0,a.serialize)((0,s.getGovernanceInstructionSchema)(t),u));if(u.config.baseVotingTime<3600)throw new Error("baseVotingTime should be at least 1 hour");var h=[{pubkey:n,isWritable:!0,isSigner:!0}];return new o.TransactionInstruction({keys:h,programId:e,data:l})}},4469:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createSetRealmAuthority=void 0;var r=n(1077);t.createSetRealmAuthority=function(e,t,n,o,i,s){var a=[];return(0,r.withSetRealmAuthority)(a,e,t,n,o,i,s),a[0]}},7624:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createSetRealmConfig=void 0;var i=n(5243);t.createSetRealmConfig=function(e,t,n,s,a,c,u,l,h,d){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return r=[],[4,(0,i.withSetRealmConfig)(r,e,t,n,s,a,c,u,l,h,d)];case 1:return o.sent(),[2,r[0]]}}))}))}},1807:(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.GovernanceType=t.GoverningTokenRole=void 0,(r=t.GoverningTokenRole||(t.GoverningTokenRole={}))[r.Community=0]="Community",r[r.Council=1]="Council",(n=t.GovernanceType||(t.GovernanceType={}))[n.Account=0]="Account",n[n.Program=1]="Program",n[n.Mint=2]="Mint",n[n.Token=3]="Token"},910:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTransactionErrorMsg=t.GovernanceToolsError=t.TokenError=t.GovernanceError=void 0,t.GovernanceError=["Invalid instruction passed to program","Realm with the given name and governing mints already exists","Invalid realm","Invalid Governing Token Mint","Governing Token Owner must sign transaction","Governing Token Owner or Delegate  must sign transaction","All votes must be relinquished to withdraw governing tokens","Invalid Token Owner Record account address","Invalid GoverningMint for TokenOwnerRecord","Invalid Realm for TokenOwnerRecord","Invalid Proposal for ProposalTransaction","Invalid Signatory account address","Signatory already signed off","Signatory must sign","Invalid Proposal Owner","Invalid Proposal for VoterRecord","Invalid GoverningTokenOwner for VoteRecord","Invalid Governance config: Vote threshold percentage out of range","Proposal for the given Governance, Governing Token Mint and index already exists","Token Owner already voted on the Proposal","Owner doesn't have enough governing tokens to create Proposal","Invalid State: Can't edit Signatories","Invalid Proposal state","Invalid State: Can't edit instructions","Invalid State: Can't execute instruction","Can't execute instruction within its hold up time","Instru
1ction already executed","Invalid Instruction index","Instruction hold up time is below the min specified by Governance","Instruction at the given index for the Proposal already exists","Invalid State: Can't sign off","Invalid State: Can't vote","Invalid State: Can't finalize vote","Invalid State: Can't cancel Proposal","Vote already relinquished","Can't finalize vote. Voting still in progress","Proposal voting time expired","Invalid Signatory Mint","Proposal does not belong to the given Governance","Proposal does not belong to given Governing Mint","Current mint authority must sign transaction","Invalid mint authority","Mint has no authority","Invalid Token account owner","Invalid Mint account owner","Token Account is not initialized","Token Account doesn't exist","Token account data is invalid","Token mint account data is invalid","Token Mint account is not initialized","Token Mint account doesn't exist","Invalid ProgramData account address","Invalid ProgramData account Data","Provided upgrade authority doesn't match current program upgrade authority","Current program upgrade authority must sign transaction","Given program is not upgradable","Invalid token owner","Current token owner must sign transaction","Given VoteThresholdType is not supported","Given VoteWeightSource is not supported","Legacy1","Governance PDA must sign","Instruction already flagged with error","Invalid Realm for Governance","Invalid Authority for Realm","Realm has no authority","Realm authority must sign","Invalid governing token holding account","Realm council mint change is not supported","Not supported mint max vote weight source","Invalid max vote weight supply fraction","Owner doesn't have enough governing tokens to create Governance","Too many outstanding proposals","All proposals must be finalized to withdraw governing tokens","Invalid VoterWeightRecord for Realm","Invalid VoterWeightRecord for GoverningTokenMint","Invalid VoterWeightRecord for TokenOwner","VoterWeightRecord expired","Invalid RealmConfig for Realm","TokenOwnerRecord already exists","Governing token deposits not allowed","Invalid vote choice weight percentage","Vote type not supported","Invalid proposal options","Proposal is not not executable","Invalid vote","Cannot execute defeated option","VoterWeightRecord invalid action","VoterWeightRecord invalid action target","Invalid MaxVoterWeightRecord for Realm","MaxVoterWeightRecord expired","Cannot execute defeated option","Not supported VoteType","RealmConfig change not allowed","At least one VoteThreshold is required","Reserved buffer must be empty","Cannot Relinquish in Finalizing state","Invalid RealmConfig account address","Cannot deposit dormant tokens","Cannot withdraw membership tokens","Cannot revoke GoverningTokens","Invalid Revoke amount","Invalid GoverningToken source","Cannot change community TokenType to Membership","Voter weight threshold disabled","Vote not allowed in cool off time","Cannot refund ProposalDeposit","Invalid Proposal for ProposalDeposit","Invalid deposit_exempt_proposal_count","Invalid GoverningTokenMint not allowed to vote","Invalid deposit Payer for ProposalDeposit"],t.TokenError=["Lamport balance below rent-exempt threshold","Insufficient funds","Invalid Mint","Account not associated with this Mint","Owner does not match","Fixed supply","Already in use","Invalid number of provided signers","Invalid number of required signers","State is uninitialized","Instruction does not support native tokens","Non-native account can only be closed if its balance is zero","Invalid instruction","State is invalid for requested operation","Operation overflowed","Account does not support specified authority type","This token mint cannot freeze accounts","Account is frozen","The provided decimals value different from the Mint decimals"],t.GovernanceToolsError=["Account already initialized","Account doesn't exist","Invalid account owner","Invalid account type","Invalid new account size"],t.getTransactionErrorMsg=function(e){try{var n=e.txError.InstructionError[1];return void 0!==n.Custom?n.Custom>=1100?t.GovernanceToolsError[n.Custom-1100]:n.Custom>=500?t.GovernanceError[n.Custom-500]:"Possible error: ".concat(t.TokenError[n.Custom]):n}catch(t){return JSON.stringify(e)}}},9721:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(2037),t),o(n(9185),t),o(n(2612),t),o(n(2343),t),o(n(7624),t),o(n(4469),t),o(n(1807),t),o(n(910),t),o(n(3420),t),o(n(280),t),o(n(3646),t),o(n(8264),t),o(n(4505),t),o(n(5242),t),o(n(4614),t),o(n(2538),t),o(n(8985),t),o(n(5319),t),o(n(9725),t),o(n(3543),t),o(n(2470),t),o(n(6540),t),o(n(3972),t),o(n(840),t),o(n(520),t),o(n(7055),t),o(n(3745),t),o(n(6826),t),o(n(7371),t),o(n(4019),t),o(n(2305),t),o(n(8068),t),o(n(1077),t),o(n(5243),t),o(n(9578),t),o(n(8569),t),o(n(6755),t),o(n(9532),t)},3420:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.RefundProposalDepositArgs=t.RevokeGoverningTokensArgs=t.SetGovernanceDelegateArgs=t.CreateNativeTreasuryArgs=t.UpdateProgramMetadataArgs=t.CreateTokenOwnerRecordArgs=t.SetRealmConfigArgs=t.SetRealmAuthorityArgs=t.SetRealmAuthorityAction=t.FlagTransactionErrorArgs=t.ExecuteTransactionArgs=t.RemoveTransactionArgs=t.InsertTransactionArgs=t.FinalizeVoteArgs=t.RelinquishVoteArgs=t.CastVoteArgs=t.Vote=t.VoteKind=t.VoteChoice=t.YesNoVote=t.CancelProposalArgs=t.SignOffProposalArgs=t.AddSignatoryArgs=t.CreateProposalArgs=t.SetGovernanceConfigArgs=t.CreateTokenGovernanceArgs=t.CreateMintGovernanceArgs=t.CreateProgramGovernanceArgs=t.CreateGovernanceArgs=t.WithdrawGoverningTokensArgs=t.DepositGoverningTokensArgs=t.CreateRealmArgs=t.GovernanceInstruction=void 0,function(e){e[e.CreateRealm=0]="CreateRealm",e[e.DepositGoverningTokens=1]="DepositGoverningTokens",e[e.WithdrawGoverningTokens=2]="WithdrawGoverningTokens",e[e.SetGovernanceDelegate=3]="SetGovernanceDelegate",e[e.CreateGovernance=4]="CreateGovernance",e[e.CreateProgramGovernance=5]="CreateProgramGovernance",e[e.CreateProposal=6]="CreateProposal",e[e.AddSignatory=7]="AddSignatory",e[e.RemoveSignatory=8]="RemoveSignatory",e[e.InsertTransaction=9]="InsertTransaction",e[e.RemoveTransaction=10]="RemoveTransaction",e[e.CancelProposal=11]="CancelProposal",e[e.SignOffProposal=12]="SignOffProposal",e[e.CastVote=13]="CastVote",e[e.FinalizeVote=14]="FinalizeVote",e[e.RelinquishVote=15]="RelinquishVote",e[e.ExecuteTransaction=16]="ExecuteTransaction",e[e.CreateMintGovernance=17]="CreateMintGovernance",e[e.CreateTokenGovernance=18]="CreateTokenGovernance",e[e.SetGovernanceConfig=19]="SetGovernanceConfig",e[e.FlagTransactionError=20]="FlagTransactionError",e[e.SetRealmAuthority=21]="SetRealmAuthority",e[e.SetRealmConfig=22]="SetRealmConfig",e[e.CreateTokenOwnerRecord=23]="CreateTokenOwnerRecord",e[e.UpdateProgramMetadata=24]="UpdateProgramMetadata",e[e.CreateNativeTreasury=25]="CreateNativeTreasury",e[e.RevokeGoverningTokens=26]="RevokeGoverningTokens",e[e.RefundProposalDeposit=27]="RefundProposalDeposit"}(n=t.GovernanceInstruction||(t.GovernanceInstruction={}));t.CreateRealmArgs=function(e){this.instruction=n.CreateRealm,this.name=e.name,this.configArgs=e.configArgs};t.DepositGoverningTokensArgs=function(e){this.instruction=n.DepositGoverningTokens,this.amount=e.amount};t.WithdrawGoverningTokensArgs=function(){this.instruction=n.WithdrawGoverningTokens};t.CreateGovernanceArgs=function(e){this.instruction=n.CreateGovernance,this.config=e.config};t.CreateProgramGovernanceArgs=function(e){this.instruction=n.CreateProgramGovernance,this.config=e.config,this.transferUpgradeAuthority=!!e.transferUpgradeAuthority};t.CreateMintGovernanceArgs=function(e){this.instruction=n.CreateMintGovernance,this.config=e.config,this.transferMintAuthorities=!!e.transferMintAuthorities};t.CreateTokenGovernanceArgs=function(e){this.instruction=n.CreateTokenGovernance,this.config=e.config,this.transferTokenOwner=!!e.transferTokenOwner};t.SetGovernanceConfigArgs=function(e){this.instruction=n.SetGovernanceConfig,this.config=e.config};t.CreateProposalArgs=function(e){this.instruction=n.CreateProposal,this.name=e.name,this.descriptionLink=e.descriptionLink,this.governingTokenMint=e.governingTokenMint,this.voteType=e.voteType,this.options=e.options,this.useDenyOption=e.useDenyOption,this.proposalSeed=e.proposalSeed};t.AddSignatoryArgs=function(e){this.instruction=n.AddSignatory,this.signatory=e.signatory};
1t.SignOffProposalArgs=function(){this.instruction=n.SignOffProposal};var r;t.CancelProposalArgs=function(){this.instruction=n.CancelProposal},function(e){e[e.Yes=0]="Yes",e[e.No=1]="No"}(r=t.YesNoVote||(t.YesNoVote={}));var o,i=function(e){this.rank=e.rank,this.weightPercentage=e.weightPercentage};t.VoteChoice=i,function(e){e[e.Approve=0]="Approve",e[e.Deny=1]="Deny",e[e.Abstain=2]="Abstain",e[e.Veto=3]="Veto"}(o=t.VoteKind||(t.VoteKind={}));var s=function(){function e(e){this.voteType=e.voteType,this.approveChoices=e.approveChoices,this.deny=e.deny,this.veto=e.veto}return e.prototype.toYesNoVote=function(){switch(this.voteType){case o.Deny:return r.No;case o.Approve:return r.Yes}},e.fromYesNoVote=function(t){switch(t){case r.Yes:return new e({voteType:o.Approve,approveChoices:[new i({rank:0,weightPercentage:100})],deny:void 0,veto:void 0});case r.No:return new e({voteType:o.Deny,approveChoices:void 0,deny:!0,veto:void 0})}},e}();t.Vote=s;t.CastVoteArgs=function(e){this.instruction=n.CastVote,this.yesNoVote=e.yesNoVote,this.vote=e.vote};t.RelinquishVoteArgs=function(){this.instruction=n.RelinquishVote};t.FinalizeVoteArgs=function(){this.instruction=n.FinalizeVote};t.InsertTransactionArgs=function(e){this.instruction=n.InsertTransaction,this.index=e.index,this.optionIndex=e.optionIndex,this.holdUpTime=e.holdUpTime,this.instructionData=e.instructionData,this.instructions=e.instructions};t.RemoveTransactionArgs=function(){this.instruction=n.RemoveTransaction};t.ExecuteTransactionArgs=function(){this.instruction=n.ExecuteTransaction};var a;t.FlagTransactionErrorArgs=function(){this.instruction=n.FlagTransactionError},(a=t.SetRealmAuthorityAction||(t.SetRealmAuthorityAction={}))[a.SetUnchecked=0]="SetUnchecked",a[a.SetChecked=1]="SetChecked",a[a.Remove=2]="Remove";t.SetRealmAuthorityArgs=function(e){this.instruction=n.SetRealmAuthority,this.newRealmAuthority=e.newRealmAuthority,this.action=e.action};t.SetRealmConfigArgs=function(e){this.instruction=n.SetRealmConfig,this.configArgs=e.configArgs};t.CreateTokenOwnerRecordArgs=function(){this.instruction=n.CreateTokenOwnerRecord};t.UpdateProgramMetadataArgs=function(){this.instruction=n.UpdateProgramMetadata};t.CreateNativeTreasuryArgs=function(){this.instruction=n.CreateNativeTreasury};t.SetGovernanceDelegateArgs=function(e){this.instruction=n.SetGovernanceDelegate,this.newGovernanceDelegate=e.newGovernanceDelegate};t.RevokeGoverningTokensArgs=function(e){this.instruction=n.RevokeGoverningTokens,this.amount=e.amount};t.RefundProposalDepositArgs=function(){this.instruction=n.RefundProposalDeposit}},280:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.getInstructionDataFromBase64=t.GovernanceAccountParser=t.getGovernanceSchemaForAccount=t.getGovernanceAccountSchema=t.GOVERNANCE_ACCOUNT_SCHEMA_V2=t.GOVERNANCE_ACCOUNT_SCHEMA_V1=t.getGovernanceInstructionSchema=t.GOVERNANCE_INSTRUCTION_SCHEMA_V3=t.GOVERNANCE_INSTRUCTION_SCHEMA_V2=t.GOVERNANCE_INSTRUCTION_SCHEMA_V1=t.createInstructionData=t.serializeInstructionToBase64=void 0;var s=n(8612),a=n(3420),c=n(2037),u=n(8612),l=n(2943),h=n(2155),d=n(7208);function f(e,t){return new Map([[a.VoteChoice,{kind:"struct",fields:[["rank","u8"],["weightPercentage","u8"]]}],[c.InstructionData,{kind:"struct",fields:[["programId","pubkey"],["accounts",[c.AccountMetaData]],["data",["u8"]]]}],[c.AccountMetaData,{kind:"struct",fields:[["pubkey","pubkey"],["isSigner","u8"],["isWritable","u8"]]}],[c.MintMaxVoteWeightSource,{kind:"struct",fields:[["type","u8"],["value","u64"]]}],[c.GovernanceConfig,{kind:"struct",fields:i([["communityVoteThreshold","VoteThreshold"],["minCommunityTokensToCreateProposal","u64"],["minInstructionHoldUpTime","u32"],["baseVotingTime","u32"],["communityVoteTipping","u8"],["councilVoteThreshold","VoteThreshold"],["councilVetoVoteThreshold","VoteThreshold"],["minCouncilTokensToCreateProposal","u64"]],o(e&&e>=h.PROGRAM_VERSION_V3||t&&t>=h.ACCOUNT_VERSION_V2?[["councilVoteTipping","u8"],["communityVetoVoteThreshold","VoteThreshold"],["votingCoolOffTime","u32"],["depositExemptProposalCount","u8"]]:[]),!1)}]])}function p(e){return new Map(i([[c.RealmConfigArgs,{kind:"struct",fields:i([["useCouncilMint","u8"],["minCommunityTokensToCreateGovernance","u64"],["communityMintMaxVoteWeightSource",c.MintMaxVoteWeightSource]],o(e==h.PROGRAM_VERSION_V2?[["useCommunityVoterWeightAddin","u8"],["useMaxCommunityVoterWeightAddin","u8"]]:e>=h.PROGRAM_VERSION_V3?[["communityTokenConfigArgs",c.GoverningTokenConfigArgs],["councilTokenConfigArgs",c.GoverningTokenConfigArgs]]:[]),!1)}],[a.CreateRealmArgs,{kind:"struct",fields:[["instruction","u8"],["name","string"],["configArgs",c.RealmConfigArgs]]}],[c.GoverningTokenConfigArgs,{kind:"struct",fields:[["useVoterWeightAddin","u8"],["useMaxVoterWeightAddin","u8"],["tokenType","u8"]]}],[a.DepositGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"],e>
1=h.PROGRAM_VERSION_V2?["amount","u64"]:void 0].filter(Boolean)}],[a.RevokeGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"],["amount","u64"]]}],[a.WithdrawGoverningTokensArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.SetGovernanceDelegateArgs,{kind:"struct",fields:[["instruction","u8"],["newGovernanceDelegate",{kind:"option",type:"pubkey"}]]}],[a.CreateGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",c.GovernanceConfig]]}],[a.CreateProgramGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",c.GovernanceConfig],["transferUpgradeAuthority","u8"]]}],[a.CreateMintGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",c.GovernanceConfig],["transferMintAuthorities","u8"]]}],[a.CreateTokenGovernanceArgs,{kind:"struct",fields:[["instruction","u8"],["config",c.GovernanceConfig],["transferTokenOwner","u8"]]}],[a.SetGovernanceConfigArgs,{kind:"struct",fields:[["instruction","u8"],["config",c.GovernanceConfig]]}],[a.CreateProposalArgs,{kind:"struct",fields:i(i([["instruction","u8"],["name","string"],["descriptionLink","string"]],o(e===h.PROGRAM_VERSION_V1?[["governingTokenMint","pubkey"]]:[["voteType","voteType"],["options",["string"]],["useDenyOption","u8"]]),!1),[e>=h.PROGRAM_VERSION_V3?["proposalSeed","pubkey"]:void 0],!1).filter(Boolean)}],[a.AddSignatoryArgs,{kind:"struct",fields:[["instruction","u8"],["signatory","pubkey"]]}],[a.SignOffProposalArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.CancelProposalArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.RelinquishVoteArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.FinalizeVoteArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.CastVoteArgs,{kind:"struct",fields:[["instruction","u8"],e===h.PROGRAM_VERSION_V1?["yesNoVote","u8"]:["vote","vote"]]}],[a.InsertTransactionArgs,{kind:"struct",fields:[["instruction","u8"],e>=h.PROGRAM_VERSION_V2?["optionIndex","u8"]:void 0,["index","u16"],["holdUpTime","u32"],e>=h.PROGRAM_VERSION_V2?["instructions",[c.InstructionData]]:["instructionData",c.InstructionData]].filter(Boolean)}],[a.RemoveTransactionArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.ExecuteTransactionArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.FlagTransactionErrorArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.SetRealmAuthorityArgs,{kind:"struct",fields:i([["instruction","u8"]],o(e===h.PROGRAM_VERSION_V1?[["newRealmAuthority",{kind:"option",type:"pubkey"}]]:[["action","u8"]]),!1)}],[a.SetRealmConfigArgs,{kind:"struct",fields:[["instruction","u8"],["configArgs",c.RealmConfigArgs]]}],[a.CreateTokenOwnerRecordArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.UpdateProgramMetadataArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.CreateNativeTreasuryArgs,{kind:"struct",fields:[["instruction","u8"]]}],[a.RefundProposalDepositArgs,{kind:"struct",fields:[["instruction","u8"]]}]],o(f(e,void 0)),!1))}function g(e){switch(e){case 1:return t.GOVERNANCE_ACCOUNT_SCHEMA_V1;case 2:return t.GOVERNANCE_ACCOUNT_SCHEMA_V2;default:throw new Error("Account schema for account version: ".concat(e," doesn't exist"))}}function y(e){return new Map(i([[c.RealmConfig,{kind:"struct",fields:[["useCommunityVoterWeightAddin","u8"],["useMaxCommunityVoterWeightAddin","u8"],["reserved",[6]],["minCommunityTokensToCreateGovernance","u64"],["communityMintMaxVoteWeightSource",c.MintMaxVoteWeightSource],["councilMint",{kind:"option",type:"pubkey"}]]}],[c.Realm,{kind:"struct",fields:[["accountType","u8"],["communityMint","pubkey"],["config",c.RealmConfig],["reserved",[6]],["votingProposalCount","u16"],["authority",{kind:"option",type:"pubkey"}],["name","string"]]}],[c.RealmConfigAccount,{kind:"struct",fields:[["accountType","u8"],["realm","pubkey"],["communityTokenConfig",c.GoverningTokenConfig],["councilTokenConfig",c.GoverningTokenConfig],["reserved",[110]]]}],[c.GoverningTokenConfig,{kind:"struct",fields:[["voterWeightAddin",{kind:"option",type:"pubkey"}],["maxVoterWeightAddin",{kind:"option",type:"pubkey"}],["tokenType","u8"],["reserved",[8]]]}],[c.Governance,{kind:"struct",fields:i([["accountType","u8"],["realm","pubkey"],["governedAccount","pubkey"],["proposalCount","u32"],["config",c.GovernanceConfig]],o(e>=h.ACCOUNT_VERSION_V2?[["reserved",[120]],["activeProposalCount","u64"]]:[]),!1)}],[c.TokenOwnerRecord,{kind:"struct",fields:[["accountType","u8"],["realm","pubkey"],["governingTokenMint","pubkey"],["governingTokenOwner","pubkey"],["governingTokenDepositAmount","u64"],["unrelinquishedVotesCount","u32"],["totalVotesCount","u32"],["outstandingProposalCount","u8"],["ver
1sion","u8"],["reserved",[6]],["governanceDelegate",{kind:"option",type:"pubkey"}]]}],[c.ProposalOption,{kind:"struct",fields:[["label","string"],["voteWeight","u64"],["voteResult","u8"],["instructionsExecutedCount","u16"],["instructionsCount","u16"],["instructionsNextIndex","u16"]]}],[c.Proposal,{kind:"struct",fields:i(i(i(i(i(i(i([["accountType","u8"],["governance","pubkey"],["governingTokenMint","pubkey"],["state","u8"],["tokenOwnerRecord","pubkey"],["signatoriesCount","u8"],["signatoriesSignedOffCount","u8"]],o(e===h.ACCOUNT_VERSION_V1?[["yesVotesCount","u64"],["noVotesCount","u64"],["instructionsExecutedCount","u16"],["instructionsCount","u16"],["instructionsNextIndex","u16"]]:[["voteType","voteType"],["options",[c.ProposalOption]],["denyVoteWeight",{kind:"option",type:"u64"}],["reserved1","u8"],["abstainVoteWeight",{kind:"option",type:"u64"}],["startVotingAt",{kind:"option",type:"u64"}]]),!1),[["draftAt","u64"],["signingOffAt",{kind:"option",type:"u64"}],["votingAt",{kind:"option",type:"u64"}],["votingAtSlot",{kind:"option",type:"u64"}],["votingCompletedAt",{kind:"option",type:"u64"}],["executingAt",{kind:"option",type:"u64"}],["closedAt",{kind:"option",type:"u64"}],["executionFlags","u8"],["maxVoteWeight",{kind:"option",type:"u64"}]],!1),o(e===h.ACCOUNT_VERSION_V1?[]:[["maxVotingTime",{kind:"option",type:"u32"}]]),!1),[["voteThreshold",{kind:"option",type:"VoteThreshold"}]],!1),o(e===h.ACCOUNT_VERSION_V1?[]:[["reserved",[64]]]),!1),[["name","string"],["descriptionLink","string"]],!1),o(e===h.ACCOUNT_VERSION_V1?[]:[["vetoVoteWeight","u64"]]),!1)}],[c.ProposalDeposit,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["depositPayer","pubkey"]]}],[c.SignatoryRecord,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],["signatory","pubkey"],["signedOff","u8"]]}],[c.VoteWeight,{kind:"enum",values:[["yes","u64"],["no","u64"]]}],[c.VoteRecord,{kind:"struct",fields:i([["accountType","u8"],["proposal","pubkey"],["governingTokenOwner","pubkey"],["isRelinquished","u8"]],o(e===h.ACCOUNT_VERSION_V1?[["voteWeight",c.VoteWeight]]:[["voterWeight","u64"],["vote","vote"]]),!1)}],[c.ProposalTransaction,{kind:"struct",fields:[["accountType","u8"],["proposal","pubkey"],e>=h.ACCOUNT_VERSION_V2?["optionIndex","u8"]:void 0,["instructionIndex","u16"],["holdUpTime","u32"],e>=h.ACCOUNT_VERSION_V2?["instructions",[c.InstructionData]]:["instruction",c.InstructionData],["executedAt",{kind:"option",type:"u64"}],["executionStatus","u8"]].filter(Boolean)}],[c.ProgramMetadata,{kind:"struct",fields:[["accountType","u8"],["updatedAt","u64"],["ver
1sion","string"],["reserved",[64]]]}]],o(f(void 0,e)),!1))}function m(e){return g((0,c.getGovernanceAccountVersion)(e))}s.BinaryReader.prototype.readU16=function(){var e=this,t=e.buf.readUInt16LE(e.offset);return e.offset+=2,t},s.BinaryWriter.prototype.writeU16=function(e){var t=this;t.maybeResize(),t.buf.writeUInt16LE(e,t.length),t.length+=2},s.BinaryReader.prototype.readVoteType=function(){var e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===c.VoteTypeKind.SingleChoice)return c.VoteType.SINGLE_CHOICE;var n=e.buf.readUInt8(e.offset);e.offset+=1;var r=e.buf.readUInt8(e.offset);e.offset+=1;var o=e.buf.readUInt8(e.offset);e.offset+=1;var i=e.buf.readUInt8(e.offset);return e.offset+=1,c.VoteType.MULTI_CHOICE(n,r,o,i)},s.BinaryWriter.prototype.writeVoteType=function(e){var t=this;t.maybeResize(),t.buf.writeUInt8(e.type,t.length),t.length+=1,e.type===c.VoteTypeKind.MultiChoice&&(t.buf.writeUInt8(e.choiceType,t.length),t.length+=1,t.buf.writeUInt8(e.minVoterOptions,t.length),t.length+=1,t.buf.writeUInt8(e.maxVoterOptions,t.length),t.length+=1,t.buf.writeUInt8(e.maxWinningOptions,t.length),t.length+=1)},s.BinaryReader.prototype.readVote=function(){var e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===a.VoteKind.Deny)return new a.Vote({voteType:t,approveChoices:void 0,deny:!0,veto:!1});if(t===a.VoteKind.Veto)return new a.Vote({voteType:t,approveChoices:void 0,deny:!1,veto:!0});var n=[];return e.readArray((function(){var t=e.buf.readUInt8(e.offset);e.offset+=1;var r=e.buf.readUInt8(e.offset);e.offset+=1,n.push(new a.VoteChoice({rank:t,weightPercentage:r}))})),new a.Vote({voteType:t,approveChoices:n,deny:void 0,veto:void 0})},s.BinaryWriter.prototype.writeVote=function(e){var t=this;t.maybeResize(),t.buf.writeUInt8(e.voteType,t.length),t.length+=1,e.voteType===a.VoteKind.Approve&&t.writeArray(e.approveChoices,(function(e){t.buf.writeUInt8(e.rank,t.length),t.length+=1,t.buf.writeUInt8(e.weightPercentage,t.length),t.length+=1}))},s.BinaryReader.prototype.readVoteThreshold=function(){var e=this,t=e.buf.readUInt8(e.offset);if(e.offset+=1,t===c.VoteThresholdType.YesVotePercentage||t===c.VoteThresholdType.QuorumPercentage){var n=e.buf.readUInt8(e.offset);return e.offset+=1,new c.VoteThreshold({type:t,value:n})}if(t===c.VoteThresholdType.Disabled)return new c.VoteThreshold({type:t,value:void 0});throw new Error("VoteThresholdType ".concat(t," is not supported"))},s.BinaryWriter.prototype.writeVoteThreshold=function(e){var t=this;t.maybeResize(),t.buf.writeUInt8(e.type,t.length),t.length+=1,e.type!==c.VoteThresholdType.YesVotePercentage&&e.type!==c.VoteThresholdType.QuorumPercentage||(t.buf.writeUInt8(e.value,t.length),t.length+=1)},t.serializeInstructionToBase64=function(e){var n=(0,t.createInstructionData)(e);return r.from((0,u.serialize)(t.GOVERNANCE_INSTRUCTION_SCHEMA_V1,n)).toString("base64")},t.createInstructionData=function(e){return new c.InstructionData({programId:e.programId,data:e.data,accounts:e.keys.map((function(e){return new c.AccountMetaData({pubkey:e.pubkey,isSigner:e.isSigner,isWritable:e.isWritable})}))})},t.GOVERNANCE_INSTRUCTION_SCHEMA_V1=p(1),t.GOVERNANCE_INSTRUCTION_SCHEMA_V2=p(2),t.GOVERNANCE_INSTRUCTION_SCHEMA_V3=p(3),t.getGovernanceInstructionSchema=function(e){switch(e){case 1:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V1;case 2:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V2;case 3:return t.GOVERNANCE_INSTRUCTION_SCHEMA_V3;default:throw new Error("Account schema for program version: ".concat(e," doesn't exist"))}},t.GOVERNANCE_ACCOUNT_SCHEMA_V1=y(1),t.GOVERNANCE_ACCOUNT_SCHEMA_V2=y(2),t.getGovernanceAccountSchema=g,t.getGovernanceSchemaForAccount=m,t.GovernanceAccountParser=function(e){return(0,l.BorshAccountParser)(e,(function(e){return m(e)}))},t.getInstructionDataFromBase64=function(e){var n=r.from(e,"base64");return(0,d.deserializeBorsh)(t.GOVERNANCE_INSTRUCTION_SCHEMA_V1,c.InstructionData,n)}},3646:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withV3RealmConfigAccount=t.withTokenConfigAccounts=t.createRealmConfigArgs=void 0;var i=n(2155),s=n(2037),a=n(1807);function c(e,t,n){if(t){if(e<i.PROGRAM_VERSION_V2)throw new Error("Governing token config is not supported in version ".concat(e));if(e==i.PROGRAM_VERSION_V2){if(n==a.GoverningTokenRole.Council)throw new Error("Council token config is not supported in version ".concat(e));if(t.tokenType!=s.GoverningTokenType.Liquid)throw new Error("Community token type ".concat(t.tokenType," is not supported in veriosn ").concat(e))}}}t.createRealmConfigArgs=function(e,t,n,r,o,i){var u,l;return c(e,o,a.GoverningTokenRole.Community),c(e,i,a.GoverningTokenRole.Council),new s.RealmConfigArgs({useCouncilMint:void 0!==t,minCommunityTokensToCreateGovernance:r,communityMintMaxVoteWeightSource:n,useCommunityVoterWeightAddin:void 0!==(null==o?void 0:o.voterWeightAddin),useMaxCommunityVoterWeightAddin:void 0!==(null==o?void 0:o.maxVoterWeightAddin),communityTokenConfigArgs:new s.GoverningTokenConfigArgs({useVoterWeightAddin:void 0!==(null==o?void 0:o.voterWeightAddin),useMaxVoterWeightAddin:void 0!==(null==o?void 0:o.maxVoterWeightAddin),tokenType:null!==(u=null==o?void 0:o.tokenType)&&void 0!==u?u:s.GoverningTokenType.Liquid}),councilTokenConfigArgs:new s.GoverningTokenConfigArgs({useVoterWeightAddin:void 0!==(null==i?void 0:i.voterWeightAddin),useMaxVoterWeightAddin:void 0!==(null==i?void 0:i.maxVoterWeightAddin),tokenType:null!==(l=null==i?void 0:i.tokenType)&&void 0!==l?l:s.GoverningTokenType.Liquid})})},t.withTokenConfigAccounts=function(e,t,n){(null==t?void 0:t.voterWeightAddin)&&e.push({pubkey:t.voterWeightAddin,isWritable:!1,isSigner:!1}),(null==t?void 0:t.maxVoterWeightAddin)&&e.push({pubkey:t.maxVoterWeightAddin,isWritable:!1,isSigner:!1}),(null==n?void 0:n.voterWeightAddin)&&e.push({pubkey:n.voterWeightAddin,isWritable:!1,isSigner:!1}),(null==n?void 0:n.maxVoterWeightAddin)&&e.push({pubkey:n.maxVoterWeightAddin,isWritable:!1,isSigner:!1})},t.withV3RealmConfigAccount=function(e,t,n,a){return r(this,void 0,void 0,(function(){var r,c;return o(this,(function(o){switch(o.label){case 0:return n>=i.PROGRAM_VERSION_V3?(c={},[4,(0,s.getRealmConfigAddress)(t,a)]):[3,2];case 1:c.pubkey=o.sent(),c.isSigner=!1,c.isWritable=!0,r=c,e.push(r),o.label=2;case 2:return[2]}}
1))}))}},4505:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},s=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getGovernanceProgramVersion=void 0;var c=n(2643),u=a(n(9404)),l=n(2155),h=n(4358),d=n(6344),f=n(7507),p=n(9080),g=n(2037),y=n(280),m=n(6755);t.getGovernanceProgramVersion=function(e,t,n){return r(this,void 0,void 0,(function(){var r,a,w,v,b,A,k,_,S,E,T,I,M;return o(this,(function(o){switch(o.label){case 0:return[4,(0,g.getProgramMetadataAddress)(t)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,9,,10]),[4,e.getAccountInfo(r)];case 3:if(!(a=o.sent()))return[3,8];w=(0,y.GovernanceAccountParser)(g.ProgramMetadata)(r,a),v=h.BN_ZERO,o.label=4;case 4:return o.trys.push([4,6,,7]),[4,(0,d.getProgramDataAccount)(e,new c.PublicKey(t))];case 5:return b=o.sent(),v=new u.default(b.slot),[3,7];case 6:return o.sent(),[3,7];case 7:if(w.account.updatedAt.gte(v))return A=(0,p.parseVersion)(w.account.version),console.log("Program version (metadata)",A),[2,A.major];o.label=8;case 8:return[3,10];case 9:return o.sent(),[3,10];case 10:return o.trys.push([10,13,,14]),k=[],_=new c.PublicKey("ENmcpFCpxN1CqyUjuog9yyUVfdXBKF3LVCwLr7grJZpk"),[4,(0,m.withUpdateProgramMetadata)(k,t,2,_)];case 11:return o.sent(),(S=new c.Transaction({feePayer:_})).add.apply(S,s([],i(k),!1)),[4,(0,f.simulateTransaction)(e,S,"recent")];case 12:return(E=o.sent()).value.logs&&(T='PROGRAM-VERSION:"',I=E.value.logs.filter((function(e){return e.includes(T)})).map((function(e){var t=e.indexOf(T);return(0,p.parseVersion)(e.substring(t+17,e.length-1))}))[0])?(console.log("Program version (simulation)",I),[2,I.major]):[3,14];case 13:return M=o.sent(),console.log("Can't determine program version",M),[3,14];case 14:return"localnet"===n?[2,l.PROGRAM_VERSION]:(console.log("Program version (default)",l.PROGRAM_VERSION_V1),[2,l.PROGRAM_VERSION_V1])}}))}))}},8264:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withAddSignatory=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(7507),d=n(2155);t.withAddSignatory=function(e,t,n,f,p,g,y,m){return o(void 0,void 0,void 0,(function(){var o,w,v,b;return i(this,(function(i){switch(i.label){case 0:return o=new u.AddSignatoryArgs({signatory:y}),w=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getSignatoryRecordAddress)(t,f,y)];case 1:return v=i.sent(),b=[{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!0},{pubkey:v,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}],n===d.PROGRAM_VERSION_V1&&b.push({pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new s.TransactionInstruction({keys:b,programId:t,data:w})),[2,v]}}))}))}},5242:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withCancelProposal=void 0;var o=n(2643),i=n(280),s=n(8612),a=n(3420),c=n(2155);t.withCancelProposal=function(e,t,n,u,l,h,d,f){var p=new a.CancelProposalArgs,g=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),p)),y=[];n>c.PROGRAM_VERSION_V1&&y.push({pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!1}),y.push({pubkey:h,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!0}),n==c.PROGRAM_VERSION_V1&&y.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new o.TransactionInstruction({keys:y,programId:t,data:g}))}},4614:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.withCastVote=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(2037),d=n(2155),f=n(7507),p=n(3043);t.withCastVote=function(e,t,n,g,y,m,w,v,b,A,k,_,S,E){return o(void 0,void 0,void 0,(function(){var o,T,I,M,R,x,C;return i(this,(function(i){switch(i.label){case 0:return o=new l.CastVoteArgs(n===d.PROGRAM_VERSION_V1?{yesNoVote:k.toYesNoVote(),vote:void 0}:{yesNoVote:void 0,vote:k}),T=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,(0,h.getVoteRecordAddress)(t,m,v)];case 1:return I=i.sent(),M=s(n===d.PROGRAM_VERSION_V1?[!1,!1]:[!0,!0],2),R=M[0],x=M[1],C=[{pubkey:g,isWritable:R,isSigner:!1},{pubkey:y,isWritable:x,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!0,isSigner:!1},{pubkey:b,isWritable:!1,isSigner:!0},{pubkey:I,isWritable:!0,isSigner:!1},{pubkey:A,isWritable:!1,isSigner:!1},{pubkey:_,isWritable:!0,isSigner:!0},{pubkey:f.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}],n===d.PROGRAM_VERSION_V1&&C.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1},{pubkey:a.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),[4,(0,p.withRealmConfigPluginAccounts)(C,t,g,S,E)];case 2:return i.sent(),e.push(new a.TransactionInstruction({keys:C,programId:t,data:T})),[2,I]}}))}))}},2538:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Prom
1ise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateGovernance=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(7507),d=n(3043),f=n(2155);t.withCreateGovernance=function(e,t,n,p,g,y,m,w,v,b){return o(void 0,void 0,void 0,(function(){var o,A,k,_,S;return i(this,(function(i){switch(i.label){case 0:if((o=new l.CreateGovernanceArgs({config:y})).config.baseVotingTime<3600)throw new Error("baseVotingTime should be at least 1 hour");return A=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),g=null!=g?g:(new a.Keypair).publicKey,[4,a.PublicKey.findProgramAddress([r.from("account-governance"),p.toBuffer(),g.toBuffer()],t)];case 1:return k=s.apply(void 0,[i.sent(),1]),_=k[0],S=[{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],n===f.PROGRAM_VERSION_V1&&S.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),S.push({pubkey:v,isWritable:!1,isSigner:!0}),[4,(0,d.withRealmConfigPluginAccounts)(S,t,p,b)];case 2:return i.sent(),e.push(new a.TransactionInstruction({keys:S,programId:t,data:A})),[2,_]}}))}))}},8985:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateMintGovernance=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(1269),d=n(7507),f=n(3043),p=n(2155);t.withCreateMintGovernance=function(e,t,n,g,y,m,w,v,b,A,k,_){return o(void 0,void 0,void 0,(function(){var o,S,E,T,I;return i(this,(function(i){switch(i.label){case 0:return o=new l.CreateMintGovernanceArgs({config:m,transferMintAuthorities:w}),S=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,a.PublicKey.findProgramAddress([r.from("mint-governance"),g.toBuffer(),y.toBuffer()],t)];case 1:return E=s.apply(void 0,[i.sent(),1]),T=E[0],I=[{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:T,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!1,isSigner:!0},{pubkey:b,isWritable:!1,isSigner:!1},{pubkey:A,isWritable:!0,isSigner:!0},{pubkey:h.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:d.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],n===p.PROGRAM_VERSION_V1&&I.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),I.push({pubkey:k,isWritable:!1,isSigner:!0}),[4,(0,f.withRealmConfigPluginAccounts)(I,t,g,_)];case 2:return i.sent(),e.push(new a.TransactionInstruction({keys:I,programId:t,data:S})),[2,T]}}))}))}},5319:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateNativeTreasury=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(7507);t.withCreateNativeTreasury=function(e,t,n,d,f){return o(void 0,void 0,void 0,(function(){var o,p,g,y;return i(this,(function(i){switch(i.label){case 0:return o=new u.CreateNativeTreasuryArgs,p=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getNativeTreasuryAddress)(t,d)];case 1:return g=i.sent(),y=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!1},{pubkey:f,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}],e.push(new s.TransactionInstruction({keys:y,programId:t,data:p})),[2,g]}}))}))}},9725:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateProgramGovernance=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(7507),d=n(6344),f=n(3043),p=n(2155);t.withCreateProgramGovernance=function(e,t,n,g,y,m,w,v,b,A,k,_){return o(void 0,void 0,void 0,(function(){var o,S,E,T,I,M,R;return i(this,(function(i){switch(i.label){case 0:return o=new l.CreateProgramGovernanceArgs({config:m,transferUpgradeAuthority:w}),S=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,a.PublicKey.findProgramAddress([r.from("program-governance"),g.toBuffer(),y.toBuffer()],t)];case 1:return E=s.apply(void 0,[i.sent(),1]),T=E[0],[4,a.PublicKey.findProgramAddress([y.toBuffer()],d.BPF_UPGRADE_LOADER_ID)];case 2:return I=s.apply(void 0,[i.sent(),1]),M=I[0],R=[{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:T,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!1},{pubkey:M,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!1,isSigner:!0},{pubkey:b,isWritable:!1,isSigner:!1},{pubkey:A,isWritable:!0,isSigner:!0},{pubkey:d.BPF_UPGRADE_LOADER_ID,isWritable:!1,isSigner:!1},{pubkey:h.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],n===p.PROGRAM_VERSION_V1&&R.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),R.push({pubkey:k,isWritable:!1,isSigner:!0}),[4,(0,f.withRealmConfigPluginAccounts)(R,t,g,_)];case 3:return i.sent(),e.push(new a.TransactionInstruction({keys:R,programId:t,data:S})),[2,T]}}))}))}},3543:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateProposal=void 0;var c=n(2643),u=n(280),l=n(8612),h=n(3420),d=n(2037),f=n(2155),p=n(7507),g=n(3043);t.withCreateProposal=function(e,t,n,y,m,w,v,b,A,k,_,S,E,T,I,M){return o(void 0,void 0,void 0,(function(){var o,R,x,C,O,P,N,B;return i(this,(function(i){switch(i.label){case 0:if(o=(new c.Keypair).publicKey,R=new h.CreateProposalArgs({name:v,descriptionLink:b,governingTokenMint:A,voteType:S,options:E,useDenyOption:T,proposalSeed:o}),x=r.from((0,l.serialize)((0,u.getGovernanceInstructionSchema)(n),R)),C=o.toBuffer(),n<=f.PROGRAM_VERSION_V2){if(void 0===_)throw new Error("proposalIndex is required for version: ".concat(n));(C=r.alloc(4)).writeInt32LE(_,0)}return[4,c.PublicKey.findProgramAddress([r.from(d.GOVERNANCE_PROGRAM_SEED),m.toBuffer(),A.toBuffer(),C],t)];case 1:return O=s.apply(void 0,[i.sent(),1]),P=O[0],N=a(a([{pubkey:y,isWritable:!1,isSigner:!1},{pubkey:P,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!1}],s(n>f.PROGRAM_VERSION_V1?[{pubkey:A,isWritable:!1,isSigner:!1}]:[]),!1),[{pubkey:k,isWritable:!1,isSigner:!0},{pubkey:I,isWritable:!0,isSigner:!0},{pubkey:p.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],!1),n===f.PROGRAM_VERSION_V1&&(N.push({pubkey:c.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),N.push({pubkey:c.SYSVAR_CLOCK_PUBKEY,isWritable:!1,isSigner:!1})),[4,(0,g.withRealmConfigPluginAccounts)(N,t,y,M)];case 2:return i.sent(),n>=f.PROGRAM_VERSION_V3?[4,(0,d.getProposalDepositAddress)(t,P,I)]:[3,4];case 3:B=i.sent(),N.push({pubkey:B,isWritable:!0,isSigner:!1}),i.label=4;case 4:return e.push(new c.TransactionInstruction({keys:N,programId:t,data:x})),[2,P]}}))}))}},2470:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Prom
1ise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateRealm=void 0;var c=n(2643),u=n(280),l=n(8612),h=n(3420),d=n(2037),f=n(2155),p=n(2091),g=n(3646);t.withCreateRealm=function(e,t,n,y,m,w,v,b,A,k,_,S){return o(this,void 0,void 0,(function(){var o,E,T,I,M,R,x,C,O,P;return i(this,(function(i){switch(i.label){case 0:return o=(0,g.createRealmConfigArgs)(n,b,A,k,_,S),E=new h.CreateRealmArgs({configArgs:o,name:y}),T=r.from((0,l.serialize)((0,u.getGovernanceInstructionSchema)(n),E)),[4,c.PublicKey.findProgramAddress([r.from(d.GOVERNANCE_PROGRAM_SEED),r.from(E.name)],t)];case 1:return I=s.apply(void 0,[i.sent(),1]),M=I[0],[4,(0,d.getTokenHoldingAddress)(t,M,w)];case 2:return R=i.sent(),x=[{pubkey:M,isSigner:!1,isWritable:!0},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:w,isSigner:!1,isWritable:!1},{pubkey:R,isSigner:!1,isWritable:!0},{pubkey:v,isSigner:!0,isWritable:!0},{pubkey:p.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:p.TOKEN_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:c.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],b?[4,(0,d.getTokenHoldingAddress)(t,M,b)]:[3,4];case 3:C=i.sent(),x=a(a([],s(x),!1),[{pubkey:b,isSigner:!1,isWritable:!1},{pubkey:C,isSigner:!1,isWritable:!0}],!1),i.label=4;case 4:return P={},[4,(0,d.getRealmConfigAddress)(t,M)];case 5:return P.pubkey=i.sent(),P.isSigner=!1,P.isWritable=!0,O=P,n>=f.PROGRAM_VERSION_V3&&x.push(O),(0,g.withTokenConfigAccounts)(x,_,S),n==f.PROGRAM_VERSION_V2&&((null==_?void 0:_.voterWeightAddin)||(null==_?void 0:_.maxVoterWeightAddin))&&x.push(O),e.push(new c.TransactionInstruction({keys:x,programId:t,data:T})),[2,M]}}))}))}},6540:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateTokenGovernance=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(7507),d=n(1269),f=n(3043),p=n(2155);t.withCreateTokenGovernance=function(e,t,n,g,y,m,w,v,b,A,k,_){return o(void 0,void 0,void 0,(function(){var o,S,E,T,I;return i(this,(function(i){switch(i.label){case 0:return o=new l.CreateTokenGovernanceArgs({config:m,transferTokenOwner:w}),S=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,a.PublicKey.findProgramAddress([r.from("token-governance"),g.toBuffer(),y.toBuffer()],t)];case 1:return E=s.apply(void 0,[i.sent(),1]),T=E[0],I=[{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:T,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!1,isSigner:!0},{pubkey:b,isWritable:!1,isSigner:!1},{pubkey:A,isWritable:!0,isSigner:!0},{pubkey:d.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:h.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1}],n===p.PROGRAM_VERSION_V1&&I.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),I.push({pubkey:k,isWritable:!1,isSigner:!0}),[4,(0,f.withRealmConfigPluginAccounts)(I,t,g,_)];case 2:return i.sent(),e.push(new a.TransactionInstruction({keys:I,programId:t,data:S})),[2,T]}}))}))}},3972:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.withCreateTokenOwnerRecord=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(7507);t.withCreateTokenOwnerRecord=function(e,t,n,d,f,p,g){return o(void 0,void 0,void 0,(function(){var o,y,m,w;return i(this,(function(i){switch(i.label){case 0:return o=new u.CreateTokenOwnerRecordArgs,y=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getTokenOwnerRecordAddress)(t,d,p,f)];case 1:return m=i.sent(),w=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}],e.push(new s.TransactionInstruction({keys:w,programId:t,data:y})),[2,m]}}))}))}},840:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withDepositGoverningTokens=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(2037),d=n(7507),f=n(1269),p=n(2155),g=n(3646);t.withDepositGoverningTokens=function(e,t,n,y,m,w,v,b,A,k,_){return o(void 0,void 0,void 0,(function(){var o,S,E,T,I,M;return i(this,(function(i){switch(i.label){case 0:return o=new l.DepositGoverningTokensArgs({amount:k}),S=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,(0,h.getTokenOwnerRecordAddress)(t,y,w,v)];case 1:return E=i.sent(),_=null!=_?_:!m.equals(w),[4,a.PublicKey.findProgramAddress([r.from(h.GOVERNANCE_PROGRAM_SEED),y.toBuffer(),w.toBuffer()],t)];case 2:return T=s.apply(void 0,[i.sent(),1]),I=T[0],M=[{pubkey:y,isWritable:!1,isSigner:!1},{pubkey:I,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1},{pubkey:v,isWritable:!1,isSigner:_},{pubkey:b,isWritable:!1,isSigner:!0},{pubkey:E,isWritable:!0,isSigner:!1},{pubkey:A,isWritable:!0,isSigner:!0},{pubkey:d.SYSTEM_PROGRAM_ID,isWritable:!1,isSigner:!1},{pubkey:f.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}],n===p.PROGRAM_VERSION_V1&&M.push({pubkey:a.SYSVAR_RENT_PUBKEY,isWritable:!1,isSigner:!1}),[4,(0,g.withV3RealmConfigAccount)(M,t,n,y)];case 3:return i.sent(),e.push(new a.TransactionInstruction({keys:M,programId:t,data:S})),[2,E]}}))}))}},520:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},c=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.withExecuteTransaction=void 0;var u=n(2643),l=n(280),h=n(8612),d=n(3420),f=n(2037),p=n(2155);t.withExecuteTransaction=function(e,t,n,g,y,m,w){return o(void 0,void 0,void 0,(function(){var o,v,b,A,k,_,S,E,T;return i(this,(function(i){switch(i.label){case 0:return o=new d.ExecuteTransactionArgs,v=r.from((0,h.serialize)((0,l.getGovernanceInstructionSchema)(n),o)),[4,(0,f.getNativeTreasuryAddress)(t,g)];case 1:b=i.sent(),A=[{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!0,isSigner:!1}],n===p.PROGRAM_VERSION_V1&&A.push({pubkey:u.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1});try{for(k=s(w),_=k.next();!_.done;_=k.next())(S=_.value).accounts=S.accounts.map((function(e){return e.pubkey.toBase58()!==g.toBase58()&&e.pubkey.toBase58()!==b.toBase58()||!e.isSigner?e:new f.AccountMetaData({pubkey:e.pubkey,isWritable:e.isWritable,isSigner:!1})})),A.push.apply(A,c([{pubkey:S.programId,isWritable:!1,isSigner:!1}],a(S.accounts),!1))}catch(e){E={error:e}}finally{try{_&&!_.done&&(T=k.return)&&T.call(k)}finally{if(E)throw E.error}}return e.push(new u.TransactionInstruction({keys:A,programId:t,data:v})),[2]}}))}))}},7055:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Prom
1ise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.withFinalizeVote=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(2155),d=n(3043);t.withFinalizeVote=function(e,t,n,f,p,g,y,m,w){return o(void 0,void 0,void 0,(function(){var o,v,b,A,k,_;return i(this,(function(i){switch(i.label){case 0:return o=new l.FinalizeVoteArgs,v=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),b=s(n===h.PROGRAM_VERSION_V1?[!1,!1]:[!0,!0],2),A=b[0],k=b[1],_=[{pubkey:f,isWritable:A,isSigner:!1},{pubkey:p,isWritable:k,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!1}],n===h.PROGRAM_VERSION_V1&&_.push({pubkey:a.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),[4,(0,d.withRealmConfigPluginAccounts)(_,t,f,void 0,w)];case 1:return i.sent(),e.push(new a.TransactionInstruction({keys:_,programId:t,data:v})),[2]}}))}))}},3745:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withFlagTransactionError=void 0;var o=n(2643),i=n(280),s=n(8612),a=n(3420),c=n(2155);t.withFlagTransactionError=function(e,t,n,u,l,h,d){var f=new a.FlagTransactionErrorArgs,p=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),f)),g=[{pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!1,isSigner:!1},{pubkey:h,isWritable:!1,isSigner:!0},{pubkey:d,isWritable:!0,isSigner:!1}];n===c.PROGRAM_VERSION_V1&&g.push({pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}),e.push(new o.TransactionInstruction({keys:g,programId:t,data:p}))}},6826:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withInsertTransaction=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(7507),d=n(2155);t.withInsertTransaction=function(e,t,n,f,p,g,y,m,w,v,b,A){return o(void 0,void 0,void 0,(function(){var o,k,_,S;return i(this,(function(i){switch(i.label){case 0:return o=new u.InsertTransactionArgs({index:m,optionIndex:w,holdUpTime:v,instructionData:n===d.PROGRAM_VERSION_V1?b[0]:void 0,instructions:n>=d.PROGRAM_VERSION_V2?b:void 0}),k=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getProposalTransactionAddress)(t,n,p,w,m)];case 1:return _=i.sent(),S=[{pubkey:f,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!1},{pubkey:y,isWritable:!1,isSigner:!0},{pubkey:_,isWritable:!0,isSigner:!1},{pubkey:A,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1},{pubkey:s.SYSVAR_RENT_PUBKEY,isSigner:!1,isWritable:!1}],e.push(new s.TransactionInstruction({keys:S,programId:t,data:k})),[2,_]}}))}))}},3043:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.withRealmConfigPluginAccounts=void 0;var i=n(2037);t.withRealmConfigPluginAccounts=function(e,t,n,s,a){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return[4,(0,i.getRealmConfigAddress)(t,n)];case 1:return r=o.sent(),e.push({pubkey:r,isWritable:!1,isSigner:!1}),s&&e.push({pubkey:s,isWritable:!1,isSigner:!1}),a&&e.push({pubkey:a,isWritable:!1,isSigner:!1}),[2]}}))}))}},7371:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withRefundProposalDeposit=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037);t.withRefundProposalDeposit=function(e,t,n,h,d){return o(void 0,void 0,void 0,(function(){var o,f,p,g;return i(this,(function(i){switch(i.label){case 0:return o=new u.RefundProposalDepositArgs,f=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getProposalDepositAddress)(t,h,d)];case 1:return p=i.sent(),g=[{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!1}],e.push(new s.TransactionInstruction({keys:g,programId:t,data:f})),[2]}}))}))}},4019:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.withRelinquishVote=void 0;var c=n(2643),u=n(280),l=n(8612),h=n(3420),d=n(2155);t.withRelinquishVote=function(e,t,n,f,p,g,y,m,w,v,b){return o(void 0,void 0,void 0,(function(){var o,A,k,_,S;return i(this,(function(i){return o=new h.RelinquishVoteArgs,A=r.from((0,l.serialize)((0,u.getGovernanceInstructionSchema)(n),o)),k=n>=d.PROGRAM_VERSION_V3?[{pubkey:f,isWritable:!1,isSigner:!1}]:[],_=[{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!1},{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!1}],S=v&&b?[{pubkey:v,isWritable:!1,isSigner:!0},{pubkey:b,isWritable:!0,isSigner:!1}]:[],e.push(new c.TransactionInstruction({keys:a(a(a([],s(k),!1),s(_),!1),s(S),!1),programId:t,data:A})),[2]}))}))}},2305:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withRemoveTransaction=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420);t.withRemoveTransaction=function(e,t,n,l,h,d,f,p){return o(void 0,void 0,void 0,(function(){var o,g,y;return i(this,(function(i){return o=new u.RemoveTransactionArgs,g=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),y=[{pubkey:l,isWritable:!0,isSigner:!1},{pubkey:h,isWritable:!1,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!0},{pubkey:f,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1}],e.push(new s.TransactionInstruction({keys:y,programId:t,data:g})),[2]}))}))}},8068:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.withRevokeGoverningTokens=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(1269);t.withRevokeGoverningTokens=function(e,t,n,d,f,p,g,y){return o(void 0,void 0,void 0,(function(){var o,m,w,v,b,A;return i(this,(function(i){switch(i.label){case 0:return o=new u.RevokeGoverningTokensArgs({amount:y}),m=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getTokenOwnerRecordAddress)(t,d,p,f)];case 1:return w=i.sent(),[4,(0,l.getGoverningTokenHoldingAddress)(t,d,p)];case 2:return v=i.sent(),[4,(0,l.getRealmConfigAddress)(t,d)];case 3:return b=i.sent(),A=[{pubkey:d,isWritable:!1,isSigner:!1},{pubkey:v,isWritable:!0,isSigner:!1},{pubkey:w,isWritable:!0,isSigner:!1},{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!1,isSigner:!0},{pubkey:b,isSigner:!1,isWritable:!1},{pubkey:h.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}],e.push(new s.TransactionInstruction({keys:A,programId:t,data:m})),[2]}}))}))}},9578:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withSetGovernanceDelegate=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037);t.withSetGovernanceDelegate=function(e,t,n,h,d,f,p,g){return o(void 0,void 0,void 0,(function(){var o,y,m,w;return i(this,(function(i){switch(i.label){case 0:return o=new u.SetGovernanceDelegateArgs({newGovernanceDelegate:g}),y=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getTokenOwnerRecordAddress)(t,h,d,f)];case 1:return m=i.sent(),w=[{pubkey:p,isWritable:!1,isSigner:!0},{pubkey:m,isWritable:!0,isSigner:!1}],e.push(new s.TransactionInstruction({keys:w,programId:t,data:y})),[2]}}))}))}},1077:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.withSetRealmAuthority=void 0;var o=n(2643),i=n(280),s=n(8612),a=n(3420),c=n(5866);t.withSetRealmAuthority=function(e,t,n,u,l,h,d){var f=new a.SetRealmAuthorityArgs({newRealmAuthority:h,action:d}),p=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),f)),g=[{pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!1,isSigner:!0}];n>c.PROGRAM_VERSION_V1&&g.push({pubkey:h,isWritable:!1,isSigner:!1}),e.push(new o.TransactionInstruction({keys:g,programId:t,data:p}))}},5243:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.withSetRealmConfig=void 0;var c=n(2643),u=n(2037),l=n(3420),h=n(280),d=n(8612),f=n(7507),p=n(2155),g=n(3646);t.withSetRealmConfig=function(e,t,n,y,m,w,v,b,A,k,_){return o(this,void 0,void 0,(function(){var o,S,E,T,I,M;return i(this,(function(i){switch(i.label){case 0:return o=(0,g.createRealmConfigArgs)(n,w,v,b,A,k),S=new l.SetRealmConfigArgs({configArgs:o}),E=r.from((0,d.serialize)((0,h.getGovernanceInstructionSchema)(n),S)),T=[{pubkey:y,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!0}],w?[4,(0,u.getTokenHoldingAddress)(t,y,w)]:[3,2];case 1:I=i.sent(),T=a(a([],s(T),!1),[{pubkey:w,isSigner:!1,isWritable:!1},{pubkey:I,isSigner:!1,isWritable:!0}],!1),i.label=2;case 2:return n>p.PROGRAM_VERSION_V1?(T.push({pubkey:f.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}),[4,(0,u.getRealmConfigAddress)(t,y)]):[3,4];case 3:M=i.sent(),T.push({pubkey:M,isSigner:!1,isWritable:!0}),(0,g.withTokenConfigAccounts)(T,A,k),_&&(n>=p.PROGRAM_VERSION_V3||(null==A?void 0:A.voterWeightAddin)||(null==A?void 0:A.maxVoterWeightAddin))&&T.push({pubkey:_,isSigner:!0,isWritable:!0}),i.label=4;case 4:return e.push(new c.TransactionInstruction({keys:T,programId:t,data:E})),[2]}}))}))}},8569:(e,t,n)=>{"use strict";var r=n(8287).Buffer;
1Object.defineProperty(t,"__esModule",{value:!0}),t.withSignOffProposal=void 0;var o=n(2643),i=n(280),s=n(8612),a=n(3420),c=n(2155);t.withSignOffProposal=function(e,t,n,u,l,h,d,f,p){var g=new a.SignOffProposalArgs,y=r.from((0,s.serialize)((0,i.getGovernanceInstructionSchema)(n),g)),m=[];n>c.PROGRAM_VERSION_V1&&m.push({pubkey:u,isWritable:!0,isSigner:!1},{pubkey:l,isWritable:!0,isSigner:!1}),m.push({pubkey:h,isWritable:!0,isSigner:!1}),n===c.PROGRAM_VERSION_V1?m.push({pubkey:f,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!1,isSigner:!0},{pubkey:o.SYSVAR_CLOCK_PUBKEY,isSigner:!1,isWritable:!1}):(m.push({pubkey:d,isWritable:!1,isSigner:!0}),p?m.push({pubkey:p,isWritable:!1,isSigner:!1}):m.push({pubkey:f,isWritable:!0,isSigner:!1})),e.push(new o.TransactionInstruction({keys:m,programId:t,data:y}))}},6755:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.withUpdateProgramMetadata=void 0;var s=n(2643),a=n(280),c=n(8612),u=n(3420),l=n(2037),h=n(7507);t.withUpdateProgramMetadata=function(e,t,n,d){return o(void 0,void 0,void 0,(function(){var o,f,p,g;return i(this,(function(i){switch(i.label){case 0:return o=new u.UpdateProgramMetadataArgs,f=r.from((0,c.serialize)((0,a.getGovernanceInstructionSchema)(n),o)),[4,(0,l.getProgramMetadataAddress)(t)];case 1:return p=i.sent(),g=[{pubkey:p,isWritable:!0,isSigner:!1},{pubkey:d,isWritable:!0,isSigner:!0},{pubkey:h.SYSTEM_PROGRAM_ID,isSigner:!1,isWritable:!1}],e.push(new s.TransactionInstruction({keys:g,programId:t,data:f})),[2]}}))}))}},9532:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};
1Object.defineProperty(t,"__esModule",{value:!0}),t.withWithdrawGoverningTokens=void 0;var a=n(2643),c=n(280),u=n(8612),l=n(3420),h=n(2037),d=n(1269),f=n(3646);t.withWithdrawGoverningTokens=function(e,t,n,p,g,y,m){return o(void 0,void 0,void 0,(function(){var o,w,v,b,A,k,_;return i(this,(function(i){switch(i.label){case 0:return o=new l.WithdrawGoverningTokensArgs,w=r.from((0,u.serialize)((0,c.getGovernanceInstructionSchema)(n),o)),[4,a.PublicKey.findProgramAddress([r.from(h.GOVERNANCE_PROGRAM_SEED),p.toBuffer(),y.toBuffer(),m.toBuffer()],t)];case 1:return v=s.apply(void 0,[i.sent(),1]),b=v[0],[4,a.PublicKey.findProgramAddress([r.from(h.GOVERNANCE_PROGRAM_SEED),p.toBuffer(),y.toBuffer()],t)];case 2:return A=s.apply(void 0,[i.sent(),1]),k=A[0],_=[{pubkey:p,isWritable:!1,isSigner:!1},{pubkey:k,isWritable:!0,isSigner:!1},{pubkey:g,isWritable:!0,isSigner:!1},{pubkey:m,isWritable:!1,isSigner:!0},{pubkey:b,isWritable:!0,isSigner:!1},{pubkey:d.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}],[4,(0,f.withV3RealmConfigAccount)(_,t,n,p)];case 3:return i.sent(),e.push(new a.TransactionInstruction({keys:_,programId:t,data:w})),[2]}}))}))}},2432:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(7816),t),o(n(6511),t),o(n(1938),t),o(n(9721),t),o(n(5866),t),o(n(3444),t)},2155:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ACCOUNT_VERSION_V2=t.ACCOUNT_VERSION_V1=t.PROGRAM_VERSION=t.PROGRAM_VERSION_V3=t.PROGRAM_VERSION_V2=t.PROGRAM_VERSION_V1=void 0,t.PROGRAM_VERSION_V1=1,t.PROGRAM_VERSION_V2=2,t.PROGRAM_VERSION_V3=3,t.PROGRAM_VERSION=t.PROGRAM_VERSION_V3,t.ACCOUNT_VERSION_V1=1,t.ACCOUNT_VERSION_V2=2},5866:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(2155),t)},7208:function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeBorsh=void 0;var i=n(2643),s=n(8612);function a(e,t,n,r){try{return"string"==typeof n?r["read".concat((o=n,o.charAt(0).toUpperCase()+o.slice(1)))]():n instanceof Array?"number"==typeof n[0]?r.readFixedArray(n[0]):r.readArray((function(){return a(e,t,n[0],r)})):"option"===n.kind?r.readU8()?a(e,t,n.type,r):void 0:c(e,n,r)}catch(e){throw e instanceof s.BorshError&&e.addToFieldPath(t),e}var o}function c(e,t,n){var i,c,u,l=e.get(t);if(!l)throw new s.BorshError("Class ".concat(t.name," is missing in schema"));if("struct"===l.kind){var h={};try{for(var d=r(e.get(t).fields),f=d.next();!f.done;f=d.next()){var p=o(f.value,2),g=p[0],y=p[1];h[g]=a(e,g,y,n)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(c=d.return)&&c.call(d)}finally{if(i)throw i.error}}return new t(h)}if("enum"===l.kind){var m=n.readU8();if(m>=l.values.length)throw new s.BorshError("Enum index: ".concat(m," is out of range"));var w=o(l.values[m],2),v=a(e,g=w[0],y=w[1],n);return new t(((u={})[g]=v,u))}throw new s.BorshError("Unexpected schema kind: ".concat(l.kind," for ").concat(t.constructor.name))}s.BinaryReader.prototype.readPubkey=function(){var e=this.readFixedArray(32);return new i.PublicKey(e)},s.BinaryWriter.prototype.writePubkey=function(e){this.writeFixedArray(e.toBuffer())},t.deserializeBorsh=function(e,t,n){return c(e,t,new s.BinaryReader(n))}},3444:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(2091),t),o(n(7208),t),o(n(4358),t),o(n(7729),t),o(n(9080),t),o(n(7356),t)},4358:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BN_ZERO=void 0;var o=r(n(9404));t.BN_ZERO=new o.default(0)},7729:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=void 0,t.getErrorMessage=function(e){return e instanceof Error?e.message:JSON.stringify(e)}},6344:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.getProgramDataAccount=t.getProgramDataAddress=t.ProgramDataAccountInfo=t.PublicKeyFromString=t.BPF_UPGRADE_LOADER_ID=void 0;var s=n(2643),a=n(3364);t.BPF_UPGRADE_LOADER_ID=new s.PublicKey("BPFLoaderUpgradeab1e11111111111111111111111");var c=n(3364),u=n(3364);function l(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,s.PublicKey.findProgramAddress([e.toBuffer()],t.BPF_UPGRADE_LOADER_ID)];case 1:return[2,i.apply(void 0,[n.sent(),1])[0]]}}))}))}t.PublicKeyFromString=(0,u.coerce)((0,u.instance)(s.PublicKey),(0,u.string)(),(function(e){return new s.PublicKey(e)})),t.ProgramDataAccountInfo=(0,c.type)({authority:(0,c.nullable)(t.PublicKeyFromString),slot:(0,c.number)()}),t.getProgramDataAddress=l,t.getProgramDataAccount=function(e,n){return r(this,void 0,void 0,(function(){var r,i,s;return o(this,(function(o){switch(o.label){case 0:return[4,l(n)];case 1:return r=o.sent(),[4,e.getParsedAccountInfo(r)];case 2:if(!(i=o.sent())||!i.value)throw new Error("Program data account ".concat(r.toBase58()," for program ").concat(n.toBase58()," not found"));if(!("parsed"in(s=i.value).data)||"bpf-upgradeable-loader"!==s.data.program)throw new Error("Invalid program data account ".concat(r.toBase58()," for program ").concat(n.toBase58()));return[2,(0,a.create)(s.data.parsed.info,t.ProgramDataAccountInfo)]}}))}))}},2091:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
1Object.defineProperty(t,"__esModule",{value:!0}),o(n(6344),t),o(n(7507),t),o(n(1269),t)},7507:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SendTransactionError=t.simulateTransaction=t.SYSTEM_PROGRAM_ID=void 0;var a=n(2643);t.SYSTEM_PROGRAM_ID=new a.PublicKey("11111111111111111111111111111111"),t.simulateTransaction=function(e,t,n){return i(this,void 0,void 0,(function(){var r,o,i,a,c,u;return s(this,(function(s){switch(s.label){case 0:return[4,e.getRecentBlockhash()];case 1:return r=s.sent(),t.lastValidBlockHeight=r.lastValidBlockHeight,t.recentBlockhash=r.blockhash,o=t.serializeMessage(),i=t._serialize(o),a=i.toString("base64"),c=[a,{encoding:"base64",commitment:n}],[4,e._rpcRequest("simulateTransaction",c)];case 2:if((u=s.sent()).error)throw new Error("failed to simulate transaction: "+u.error.message);return[2,u.result]}}))}))};var c=function(e){function t(t,n,r){var o=e.call(this,t)||this;return o.txError=r,o.txId=n,o}return o(t,e),t}(Error);t.SendTransactionError=c},1269:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TOKEN_PROGRAM_ID=void 0;var r=n(2643);t.TOKEN_PROGRAM_ID=new r.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")},9080:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseVersion=void 0,t.parseVersion=function(e){var t=e.split(".");return{major:parseInt(t[0])||0,minor:parseInt(t[1])||0,patch:parseInt(t[2])||0}}},7356:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isWalletNotConnectedError=void 0,t.isWalletNotConnectedError=function(e){return e instanceof WalletNotConnectedError}},3377:(e,t,n)=>{"use strict";var r=n(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.alloc(0);for(var n=0,o=0,i=0;e[n]===c;)o++,n++;for(var s=(e.length-n)*u+1>>>0,l=new Uint8Array(s);n<e.length;){var h=e.charCodeAt(n);if(h>
1255)return;var d=t[h];if(255===d)return;for(var f=0,p=s-1;(0!==d||f<i)&&-1!==p;p--,f++)d+=a*l[p]>>>0,l[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=f,n++}for(var g=s-i;g!==s&&0===l[g];)g++;var y=r.allocUnsafe(o+(s-g));y.fill(0,0,o);for(var m=o;g!==s;)y[m++]=l[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,o=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var u=(s-i)*l+1>>>0,h=new Uint8Array(u);i!==s;){for(var d=t[i],f=0,p=u-1;(0!==d||f<o)&&-1!==p;p--,f++)d+=256*h[p]>>>0,h[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,i++}for(var g=u-o;g!==u&&0===h[g];)g++;for(var y=c.repeat(n);g<u;++g)y+=e.charAt(h[g]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},8612:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;const u=c(n(9404)),l=c(n(4726)),h=a(n(4281)),d=new("function"!=typeof n.g.TextDecoder?h.TextDecoder:n.g.TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=r.from(e,"utf8")),l.default.encode(r.from(e))},t.baseDecode=function(e){return r.from(l.default.decode(e))};const f=1024;
1class p extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=p;class g{constructor(){this.buf=r.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(f)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",16)))}writeBuffer(e){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),e,r.alloc(f)]),this.length+=e.length}writeString(e){this.maybeResize();const t=r.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(r.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function y(e,t,n){const r=n.value;n.value=function(...e){try{return r.apply(this,e)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new p("Reached the end of buffer when deserializing")}throw e}}}t.BinaryWriter=g;class m{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new u.default(e,"le")}readU128(){const e=this.readBuffer(16);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new p(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return d.decode(t)}catch(e){throw new p(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let r=0;r<t;++r)n.push(e());return n}}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function v(e,t,n,r,o){try{if("string"==typeof r)o[`write${w(r)}`](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new p(`Expecting byte array of length ${r[0]}, but got ${n.length} bytes`);o.writeFixedArray(n)}else o.writeArray(n,(n=>{v(e,t,n,r[0],o)}));else if(void 0!==r.kind){if("option"!==r.kind)throw new p(`FieldType ${r} unrecognized`);null===n?o.writeU8(0):(o.writeU8(1),v(e,t,n,r.type,o))}else b(e,n,o)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function b(e,t,n){const r=e.get(t.constructor);if(!r)throw new p(`Class ${t.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,o])=>{v(e,r,t[r],o,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`);{const o=t[r.field];for(let i=0;i<r.values.length;++i){const[s,a]=r.values[i];if(s===o){n.writeU8(i),v(e,s,t[s],a,n);break}}}}}function A(e,t,n,r){try{return"string"==typeof n?r[`read${w(n)}`]():n instanceof Array?"number"==typeof n[0]?r.readFixedArray(n[0]):r.readArray((()=>A(e,t,n[0],r))):k(e,n,r)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function k(e,t,n){const r=e.get(t);if(!r)throw new p(`Class ${t.name} is missing in schema`);if("struct"===r.kind){const r={};for(const[o,i]of e.get(t).fields)r[o]=A(e,o,i,n);return new t(r)}if("enum"===r.kind){const o=n.readU8();if(o>=r.values.length)throw new p(`Enum index: ${o} is out of range`);const[i,s]=r.values[o],a=A(e,i,s,n);return new t({[i]:a})}throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}s([y],m.prototype,"readU8",null),s([y],m.prototype,"readU32",null),s([y],m.prototype,"readU64",null),s([y],m.prototype,"readU128",null),s([y],m.prototype,"readString",null),s([y],m.prototype,"readFixedArray",null),s([y],m.prototype,"readArray",null),t.BinaryReader=m,t.serialize=function(e,t){const n=new g;return b(e,t,n),n.toArray()},t.deserialize=function(e,t,n){const r=new m(n),o=k(e,t,r);if(r.offset<n.length)throw new p(`Unexpected ${n.length-r.offset} bytes after deserialized data`);return o}},4726:(e,t,n)=>{var r=n(3377);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")}
1,2643:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Account:()=>N,AddressLookupTableAccount:()=>qe,AddressLookupTableInstruction:()=>Hn,AddressLookupTableProgram:()=>Yn,Authorized:()=>ir,BLOCKHASH_CACHE_TIMEOUT_MS:()=>Je,BPF_LOADER_DEPRECATED_PROGRAM_ID:()=>B,BPF_LOADER_PROGRAM_ID:()=>Be,BpfLoader:()=>Ve,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:()=>Zn,ComputeBudgetInstruction:()=>$n,ComputeBudgetProgram:()=>Qn,Connection:()=>Kn,Ed25519Program:()=>Xn,Enum:()=>I,EpochSchedule:()=>Ge,FeeCalculatorLayout:()=>Ee,Keypair:()=>Fn,LAMPORTS_PER_SOL:()=>Mr,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:()=>qn,Loader:()=>Ne,Lockup:()=>sr,MAX_SEED_LENGTH:()=>x,Message:()=>ee,MessageAccountKeys:()=>z,MessageV0:()=>te,NONCE_ACCOUNT_LENGTH:()=>Ie,NonceAccount:()=>Me,PACKET_DATA_SIZE:()=>V,PUBLIC_KEY_LENGTH:()=>C,PublicKey:()=>P,SIGNATURE_LENGTH_IN_BYTES:()=>D,SOLANA_SCHEMA:()=>M,STAKE_CONFIG_ID:()=>or,STAKE_INSTRUCTION_LAYOUTS:()=>cr,SYSTEM_INSTRUCTION_LAYOUTS:()=>Ce,SYSVAR_CLOCK_PUBKEY:()=>ue,SYSVAR_EPOCH_SCHEDULE_PUBKEY:()=>le,SYSVAR_INSTRUCTIONS_PUBKEY:()=>he,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:()=>de,SYSVAR_RENT_PUBKEY:()=>fe,SYSVAR_REWARDS_PUBKEY:()=>pe,SYSVAR_SLOT_HASHES_PUBKEY:()=>ge,SYSVAR_SLOT_HISTORY_PUBKEY:()=>ye,SYSVAR_STAKE_HISTORY_PUBKEY:()=>me,Secp256k1Program:()=>nr,SendTransactionError:()=>we,SolanaJSONRPCError:()=>be,SolanaJSONRPCErrorCode:()=>ve,StakeAuthorizationLayout:()=>ur,StakeInstruction:()=>ar,StakeProgram:()=>lr,Struct:()=>T,SystemInstruction:()=>xe,SystemProgram:()=>Oe,Transaction:()=>se,TransactionExpiredBlockheightExceededError:()=>j,TransactionExpiredNonceInvalidError:()=>W,TransactionExpiredTimeoutError:()=>U,TransactionInstruction:()=>ie,TransactionMessage:()=>ae,TransactionStatus:()=>re,VALIDATOR_INFO_KEY:()=>yr,VERSION_PREFIX_MASK:()=>L,VOTE_PROGRAM_ID:()=>vr,ValidatorInfo:()=>wr,VersionedMessage:()=>ne,VersionedTransaction:()=>ce,VoteAccount:()=>Ar,VoteAuthorizationLayout:()=>pr,VoteInit:()=>hr,VoteInstruction:()=>dr,VoteProgram:()=>gr,clusterApiUrl:()=>Tr,sendAndConfirmRawTransaction:()=>Ir,sendAndConfirmTransaction:()=>Ae});var r=n(8290),o=n(6216),i=n(9404),s=n.n(i),a=n(3466),c=n.n(a),u=n(8226),l=n(2755),h=n(601),d=n(184),f=n(2150),p=n(22),g=n.n(p),y=n(7460),m=n(7238),w=n(4329);const v=o.ev.utils.randomPrivateKey,b=()=>{const e=o.ev.utils.randomPrivateKey(),t=A(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},A=o.ev.getPublicKey;function k(e){try{return o.ev.ExtendedPoint.fromHex(e),!0}catch{return!1}}const _=(e,t)=>o.ev.sign(e,t.slice(0,32)),S=o.ev.verify,E=e=>r.hp.isBuffer(e)?e:e instanceof Uint8Array?r.hp.from(e.buffer,e.byteOffset,e.byteLength):r.hp.from(e);class T{constructor(e){Object.assign(this,e)}encode(){return r.hp.from((0,l.serialize)(M,this))}static decode(e){return(0,l.deserialize)(M,this,e)}static decodeUnchecked(e){return(0,l.deserializeUnchecked)(M,this,e)}}class I extends T{constructor(e){if(super(e),this.enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");Object.keys(e).map((e=>{this.enum=e}))}}const M=new Map;var R;const x=32,C=32;let O=1;class P extends T{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=c().decode(e);if(t.length!=C)throw new Error("Invalid public key input");this._bn=new(s())(t)}else this._bn=new(s())(e);if(this._bn.byteLength()>C)throw new Error("Invalid public key input")}}static unique(){const e=new P(O);return O+=1,new P(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return c().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(r.hp);if(e.length===C)return e;const t=r.hp.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,n){const o=r.hp.concat([e.toBuffer(),r.hp.from(t),n.toBuffer()]),i=(0,u.sc)(o);return new P(i)}static createProgramAddressSync(e,t){let n=r.hp.alloc(0);e.forEach((function(e){if(e.length>x)throw new TypeError("Max seed length exceeded");n=r.hp.concat([n,E(e)])}
1)),n=r.hp.concat([n,t.toBuffer(),r.hp.from("ProgramDerivedAddress")]);const o=(0,u.sc)(n);if(k(o))throw new Error("Invalid seeds, address must fall off the curve");return new P(o)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,o=255;for(;0!=o;){try{const i=e.concat(r.hp.from([o]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;o--;continue}return[n,o]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return k(new P(e).toBytes())}}R=P,P.default=new R("11111111111111111111111111111111"),M.set(P,{kind:"struct",fields:[["_bn","u256"]]});class N{constructor(e){if(this._publicKey=void 0,this._secretKey=void 0,e){const t=E(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=E(v()),this._publicKey=E(A(this._secretKey))}get publicKey(){return new P(this._publicKey)}get secretKey(){return r.hp.concat([this._secretKey,this._publicKey],64)}}const B=new P("BPFLoader1111111111111111111111111111111111"),V=1232,L=127,D=64;class j extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(j.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class U extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(U.prototype,"name",{value:"TransactionExpiredTimeoutError"});class W extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(W.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class z{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const t=new Map;this.keySegments().flat().forEach(((e,n)=>{t.set(e.toBase58(),n)}));const n=e=>{const n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((e=>({programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((e=>n(e.pubkey))),data:e.data})))}}const G=(e="publicKey")=>h.av(32,e),K=(e="signature")=>h.av(64,e),F=(e="string")=>{const t=h.w3([h.DH("length"),h.DH("lengthPadding"),h.av(h.cY(h.DH(),-8),"chars")],e),n=t.decode.bind(t),o=t.encode.bind(t),i=t;return i.decode=(e,t)=>n(e,t).chars.toString(),i.encode=(e,t,n)=>{const i={chars:r.hp.from(e,"utf8")};return o(i,t,n)},i.alloc=e=>h.DH().span+h.DH().span+r.hp.from(e,"utf8").length,i};function q(e,t){const n=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const r=t[e.property];if(Array.isArray(r))return r.length*n(e.elementLayout)}else if("fields"in e)return q({layout:e},t[e.property]);return 0};let r=0;return e.layout.fields.forEach((e=>{r+=n(e)})),r}function H(e){let t=0,n=0;for(;;){let r=e.shift();if(t|=(127&r)<<7*n,n+=1,!(128&r))break}return t}function Y(e,t){let n=t;for(;;){let t=127&n;if(n>>=7,0==n){e.push(t);break}t|=128,e.push(t)}}function $(e,t){if(!e)throw new Error(t||"Assertion failed")}class Z{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const n=new Map,r=e=>{const t=e.toBase58();let r=n.get(t);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(t,r)),r},o=r(t);o.isSigner=!0,o.isWritable=!0;for(const t of e){r(t.programId).isInvoked=!0;for(const e of t.keys){const t=r(e.pubkey);t.isSigner||=e.isSigner,t.isWritable||=e.isWritable}}return new Z(t,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];$(e.length<=256,"Max static account keys length exceeded");const t=e.filter((([,e])=>e.isSigner&&e.isWritable)),n=e.filter((([,e])=>e.isSigner&&!e.isWritable)),r=e.filter((([,e])=>!e.isSigner&&e.isWritable)),o=e.filter((([,e])=>!e.isSigner&&!e.isWritable)),i={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:o.length};{$(t.length>0,"Expected at least one writable signer key");const[e]=t[0];$(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[i,[...t.map((([e])=>new P(e))),...n.map((([e])=>new P(e))),...r.map((([e])=>new P(e))),...o.map((([e])=>new P(e)))]]}extractTableLookup(e){const[t,n]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&e.isWritable)),[r,o]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&!e.isWritable));if(0!==t.length||0!==r.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:r},{writable:n,readonly:o}]}drainKeysFoundInLookupTable(e,t){const n=new Array,r=new Array;for(const[o,i]of this.keyMetaMap.entries())if(t(i)){const t=new P(o),i=e.findIndex((e=>e.equals(t)));i>=0&&($(i<256,"Max lookup table index exceeded"),n.push(i),r.push(t),this.keyMetaMap.delete(o))}return[n,r]}}const Q="Reached end of buffer unexpectedly";function J(e){if(0===e.length)throw new Error(Q);return e.shift()}function X(e,...t){const[n]=t;if(2===t.length?n+(t[1]??0)>e.length:n>=e.length)throw new Error(Q);return e.splice(...t)}class ee{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((e=>new P(e))),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:c().decode(e.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new z(this.staticAccountKeys)}
1static compile(e){const t=Z.compile(e.instructions,e.payerKey),[n,r]=t.getMessageComponents(),o=new z(r).compileInstructions(e.instructions).map((e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:c().encode(e.data)})));return new ee({header:n,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:o})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;return e>=this.header.numRequiredSignatures?e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((e,t)=>!this.isProgramId(t)))}serialize(){const e=this.accountKeys.length;let t=[];Y(t,e);const n=this.instructions.map((e=>{const{accounts:t,programIdIndex:n}=e,o=Array.from(c().decode(e.data));let i=[];Y(i,t.length);let s=[];return Y(s,o.length),{programIdIndex:n,keyIndicesCount:r.hp.from(i),keyIndices:t,dataLength:r.hp.from(s),data:o}}));let o=[];Y(o,n.length);let i=r.hp.alloc(V);r.hp.from(o).copy(i);let s=o.length;n.forEach((e=>{const t=h.w3([h.u8("programIdIndex"),h.av(e.keyIndicesCount.length,"keyIndicesCount"),h.O6(h.u8("keyIndex"),e.keyIndices.length,"keyIndices"),h.av(e.dataLength.length,"dataLength"),h.O6(h.u8("userdatum"),e.data.length,"data")]).encode(e,i,s);s+=t})),i=i.slice(0,s);const a=h.w3([h.av(1,"numRequiredSignatures"),h.av(1,"numReadonlySignedAccounts"),h.av(1,"numReadonlyUnsignedAccounts"),h.av(t.length,"keyCount"),h.O6(G("key"),e,"keys"),G("recentBlockhash")]),u={numRequiredSignatures:r.hp.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:r.hp.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:r.hp.from([this.header.numReadonlyUnsignedAccounts]),keyCount:r.hp.from(t),keys:this.accountKeys.map((e=>E(e.toBytes()))),recentBlockhash:c().decode(this.recentBlockhash)};let l=r.hp.alloc(2048);const d=a.encode(u,l);return i.copy(l,d),l.slice(0,d+i.length)}static from(e){let t=[...e];const n=J(t);if(n!==(n&L))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const o=J(t),i=J(t),s=H(t);let a=[];for(let e=0;e<s;e++){const e=X(t,0,C);a.push(new P(r.hp.from(e)))}const u=X(t,0,C),l=H(t);let h=[];for(let e=0;e<l;e++){const e=J(t),n=X(t,0,H(t)),o=X(t,0,H(t)),i=c().encode(r.hp.from(o));h.push({programIdIndex:e,accounts:n,data:i})}const d={header:{numRequiredSignatures:n,numReadonlySignedAccounts:o,numReadonlyUnsignedAccounts:i},recentBlockhash:c().encode(r.hp.from(u)),accountKeys:a,instructions:h};return new ee(d)}}class te{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(const t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new z(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;return e>=n?e-n<this.addressTableLookups.reduce(((e,t)=>e+t.writableIndexes.length),0):e>=this.header.numRequiredSignatures?e-t<n-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}resolveAddressTableLookups(e){const t={writable:[],readonly:[]};for(const n of this.addressTableLookups){const r=e.find((e=>e.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const e of n.writableIndexes){if(!(e<r.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${n.accountKey.toBase58()}`);t.writable.push(r.state.addresses[e])}for(const e of n.readonlyIndexes){if(!(e<r.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${n.accountKey.toBase58()}`);t.readonly.push(r.state.addresses[e])}}return t}
1static compile(e){const t=Z.compile(e.instructions,e.payerKey),n=new Array,r={writable:new Array,readonly:new Array},o=e.addressLookupTableAccounts||[];for(const e of o){const o=t.extractTableLookup(e);if(void 0!==o){const[e,{writable:t,readonly:i}]=o;n.push(e),r.writable.push(...t),r.readonly.push(...i)}}const[i,s]=t.getMessageComponents(),a=new z(s,r).compileInstructions(e.instructions);return new te({header:i,staticAccountKeys:s,recentBlockhash:e.recentBlockhash,compiledInstructions:a,addressTableLookups:n})}serialize(){const e=Array();Y(e,this.staticAccountKeys.length);const t=this.serializeInstructions(),n=Array();Y(n,this.compiledInstructions.length);const r=this.serializeAddressTableLookups(),o=Array();Y(o,this.addressTableLookups.length);const i=h.w3([h.u8("prefix"),h.w3([h.u8("numRequiredSignatures"),h.u8("numReadonlySignedAccounts"),h.u8("numReadonlyUnsignedAccounts")],"header"),h.av(e.length,"staticAccountKeysLength"),h.O6(G(),this.staticAccountKeys.length,"staticAccountKeys"),G("recentBlockhash"),h.av(n.length,"instructionsLength"),h.av(t.length,"serializedInstructions"),h.av(o.length,"addressTableLookupsLength"),h.av(r.length,"serializedAddressTableLookups")]),s=new Uint8Array(V),a=i.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((e=>e.toBytes())),recentBlockhash:c().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(o),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let e=0;const t=new Uint8Array(V);for(const n of this.compiledInstructions){const r=Array();Y(r,n.accountKeyIndexes.length);const o=Array();Y(o,n.data.length),e+=h.w3([h.u8("programIdIndex"),h.av(r.length,"encodedAccountKeyIndexesLength"),h.O6(h.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),h.av(o.length,"encodedDataLength"),h.av(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(o),data:n.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(V);for(const n of this.addressTableLookups){const r=Array();Y(r,n.writableIndexes.length);const o=Array();Y(o,n.readonlyIndexes.length),e+=h.w3([G("accountKey"),h.av(r.length,"encodedWritableIndexesLength"),h.O6(h.u8(),n.writableIndexes.length,"writableIndexes"),h.av(o.length,"encodedReadonlyIndexesLength"),h.O6(h.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(o),readonlyIndexes:n.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const n=J(t),r=n&L;$(n!==r,"Expected versioned message but received legacy message"),$(0===r,`Expected versioned message with version 0 but found version ${r}`);const o={numRequiredSignatures:J(t),numReadonlySignedAccounts:J(t),numReadonlyUnsignedAccounts:J(t)},i=[],s=H(t);for(let e=0;e<s;e++)i.push(new P(X(t,0,C)));const a=c().encode(X(t,0,C)),u=H(t),l=[];for(let e=0;e<u;e++){const e=J(t),n=X(t,0,H(t)),r=H(t),o=new Uint8Array(X(t,0,r));l.push({programIdIndex:e,accountKeyIndexes:n,data:o})}const h=H(t),d=[];for(let e=0;e<h;e++){const e=new P(X(t,0,C)),n=X(t,0,H(t)),r=X(t,0,H(t));d.push({accountKey:e,writableIndexes:n,readonlyIndexes:r})}return new te({header:o,staticAccountKeys:i,recentBlockhash:a,compiledInstructions:l,addressTableLookups:d})}}const ne={deserializeMessageVersion(e){const t=e[0],n=t&L;return n===t?"legacy":n},deserialize:e=>{const t=ne.deserializeMessageVersion(e);if("legacy"===t)return ee.from(e);if(0===t)return te.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let re=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const oe=r.hp.alloc(D).fill(0);class ie{constructor(e){this.keys=void 0,this.programId=void 0,this.data=r.hp.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map((({pubkey:e,isSigner:t,isWritable:n})=>({pubkey:e.toJSON(),isSigner:t,isWritable:n}))),programId:this.programId.toJSON(),data:[...this.data]}}}class se{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:n}=e;this.minNonceContextSlot=t,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:n}=e;this.recentBlockhash=t,this.lastValidBlockHeight=n}else{const{recentBlockhash:t,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstru
1ction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((e=>e.toJSON())),signers:this.signatures.map((({publicKey:e})=>e.toJSON()))}}add(...e){if(0===e.length)throw new Error("No instructions");return e.forEach((e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new ie(e))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let e=0;e<t.length;e++)if(void 0===t[e].programId)throw new Error(`Transaction instruction index ${e} has undefined program id`);const r=[],o=[];t.forEach((e=>{e.keys.forEach((e=>{o.push({...e})}));const t=e.programId.toString();r.includes(t)||r.push(t)})),r.forEach((e=>{o.push({pubkey:new P(e),isSigner:!1,isWritable:!1})}
1));const i=[];o.forEach((e=>{const t=e.pubkey.toString(),n=i.findIndex((e=>e.pubkey.toString()===t));n>-1?(i[n].isWritable=i[n].isWritable||e.isWritable,i[n].isSigner=i[n].isSigner||e.isSigner):i.push(e)})),i.sort((function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=i.findIndex((e=>e.pubkey.equals(n)));if(s>-1){const[e]=i.splice(s,1);e.isSigner=!0,e.isWritable=!0,i.unshift(e)}else i.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const e of this.signatures){const t=i.findIndex((t=>t.pubkey.equals(e.publicKey)));if(!(t>-1))throw new Error(`unknown signer: ${e.publicKey.toString()}`);i[t].isSigner||(i[t].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,l=0;const h=[],d=[];i.forEach((({pubkey:e,isSigner:t,isWritable:n})=>{t?(h.push(e.toString()),a+=1,n||(u+=1)):(d.push(e.toString()),n||(l+=1))}));const f=h.concat(d),p=t.map((e=>{const{data:t,programId:n}=e;return{programIdIndex:f.indexOf(n.toString()),accounts:e.keys.map((e=>f.indexOf(e.pubkey.toString()))),data:c().encode(t)}}));return p.forEach((e=>{$(e.programIdIndex>=0),e.accounts.forEach((e=>$(e>=0)))})),new ee({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:f,recentBlockhash:e,instructions:p})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every(((e,n)=>t[n].equals(e.publicKey)))||(this.signatures=t.map((e=>({signature:null,publicKey:e})))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw new Error("No signers");const t=new Set;this.signatures=e.filter((e=>{const n=e.toString();return!t.has(n)&&(t.add(n),!0)})).map((e=>({signature:null,publicKey:e})))}sign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,n=[];for(const r of e){const e=r.publicKey.toString();t.has(e)||(t.add(e),n.push(r))}this.signatures=n.map((e=>({signature:null,publicKey:e.publicKey})));const r=this._compile();this._partialSign(r,...n)}partialSign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,n=[];for(const r of e){const e=r.publicKey.toString();t.has(e)||(t.add(e),n.push(r))}const r=this._compile();this._partialSign(r,...n)}_partialSign(e,...t){const n=e.serialize();t.forEach((e=>{const t=_(n,e.secretKey);this._addSignature(e.publicKey,E(t))}))}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){$(64===t.length);const n=this.signatures.findIndex((t=>e.equals(t.publicKey)));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=r.hp.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const n={};for(const{signature:r,publicKey:o}of this.signatures)null===r?t&&(n.missing||=[]).push(o):S(r,e,o.toBytes())||(n.invalid||=[]).push(o);return n.invalid||n.missing?n:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),r=this.serializeMessage();if(n){const e=this._getMessageSignednessErrors(r,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=`\nInvalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map((e=>e.toBase58())).join("`, `")}\`].`),e.missing&&(t+=`\nMissing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map((e=>e.toBase58())).join("`, `")}\`].`),new Error(t)}}return this._serialize(r)}_serialize(e){const{signatures:t}=this,n=[];Y(n,t.length);const o=n.length+64*t.length+e.length,i=r.hp.alloc(o);return $(t.length<256),r.hp.from(n).copy(i,0),t.forEach((({signature:e},t)=>
1{null!==e&&($(64===e.length,"signature has invalid length"),r.hp.from(e).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),$(i.length<=V,`Transaction too large: ${i.length} > ${V}`),i}get keys(){return $(1===this.instructions.length),this.instructions[0].keys.map((e=>e.pubkey))}get programId(){return $(1===this.instructions.length),this.instructions[0].programId}get data(){return $(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const n=H(t);let o=[];for(let e=0;e<n;e++){const e=X(t,0,D);o.push(c().encode(r.hp.from(e)))}return se.populate(ee.from(t),o)}static populate(e,t=[]){const n=new se;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),t.forEach(((t,r)=>{const o={signature:t==c().encode(oe)?null:c().decode(t),publicKey:e.accountKeys[r]};n.signatures.push(o)})),e.instructions.forEach((t=>{const r=t.accounts.map((t=>{const r=e.accountKeys[t];return{pubkey:r,isSigner:n.signatures.some((e=>e.publicKey.toString()===r.toString()))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));n.instructions.push(new ie({keys:r,programId:e.accountKeys[t.programIdIndex],data:c().decode(t.data)}))})),n._message=e,n._json=n.toJSON(),n}}class ae{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,t){const{header:n,compiledInstructions:r,recentBlockhash:o}=e,{numRequiredSignatures:i,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,c=i-s;$(c>0,"Message header is invalid");const u=e.staticAccountKeys.length-i-a;$(u>=0,"Message header is invalid");const l=e.getAccountKeys(t),h=l.get(0);if(void 0===h)throw new Error("Failed to decompile message because no account keys were found");const d=[];for(const e of r){const t=[];for(const r of e.accountKeyIndexes){const e=l.get(r);if(void 0===e)throw new Error(`Failed to find key for account key index ${r}`);let o;o=r<i?r<c:r<l.staticAccountKeys.length?r-i<u:r-l.staticAccountKeys.length<l.accountKeysFromLookups.writable.length,t.push({pubkey:e,isSigner:r<n.numRequiredSignatures,isWritable:o})}const r=l.get(e.programIdIndex);if(void 0===r)throw new Error(`Failed to find program id for program id index ${e.programIdIndex}`);d.push(new ie({programId:r,data:E(e.data),keys:t}))}return new ae({payerKey:h,instructions:d,recentBlockhash:o})}compileToLegacyMessage(){return ee.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(e){return te.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}class ce{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)$(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let n=0;n<e.header.numRequiredSignatures;n++)t.push(new Uint8Array(D));this.signatures=t}this.message=e}serialize(){const e=this.message.serialize(),t=Array();Y(t,this.signatures.length);const n=h.w3([h.av(t.length,"encodedSignaturesLength"),h.O6(K(),this.signatures.length,"signatures"),h.av(e.length,"serializedMessage")]),r=new Uint8Array(2048),o=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,o)}static deserialize(e){let t=[...e];const n=[],r=H(t);for(let e=0;e<r;e++)n.push(new Uint8Array(X(t,0,D)));const o=ne.deserialize(new Uint8Array(t));return new ce(o,n)}sign(e){const t=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const r of e){const e=n.findIndex((e=>e.equals(r.publicKey)));$(e>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[e]=_(t,r.secretKey)}}addSignature(e,t){$(64===t.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((t=>t.equals(e)));$(n>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=t}}const ue=new P("SysvarC1ock11111111111111111111111111111111"),le=new P("SysvarEpochSchedu1e111111111111111111111111"),he=new P("Sysvar1nstructions1111111111111111111111111"),de=new P("SysvarRecentB1ockHashes11111111111111111111"),fe=new P("SysvarRent111111111111111111111111111111111"),pe=new P("SysvarRewards111111111111111111111111111111"),ge=new P("SysvarS1otHashes111111111111111111111111111"),ye=new P("SysvarS1otHistory11111111111111111111111111"),me=new P("SysvarStakeHistory1111111111111111111111111");
1class we extends Error{constructor({action:e,signature:t,transactionMessage:n,logs:r}){const o=r?`Logs: \n${JSON.stringify(r.slice(-10),null,2)}. `:"",i="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let s;switch(e){case"send":s=`Transaction ${t} resulted in an error. \n${n}. `+o+i;break;case"simulate":s=`Simulation failed. \nMessage: ${n}. \n`+o+i;break;default:s=`Unknown action '${e}'`}super(s),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=n,this.transactionLogs=r||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise(((t,n)=>{e.getTransaction(this.signature).then((e=>{if(e&&e.meta&&e.meta.logMessages){const n=e.meta.logMessages;this.transactionLogs=n,t(n)}else n(new Error("Log messages not found"))})).catch(n)}))),await this.transactionLogs}}const ve={JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016};class be extends Error{constructor({code:e,message:t,data:n},r){super(null!=r?`${r}: ${t}`:t),this.code=void 0,this.data=void 0,this.code=e,this.data=n,this.name="SolanaJSONRPCError"}}async function Ae(e,t,n,r){const o=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},i=await e.sendTransaction(t,n,o);let s;if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)s=(await e.confirmTransaction({abortSignal:r?.abortSignal,signature:i,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){const{nonceInstruction:n}=t.nonceInfo,o=n.keys[0].pubkey;s=(await e.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:o,nonceValue:t.nonceInfo.nonce,signature:i},r&&r.commitment)).value}else null!=r?.abortSignal&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await e.confirmTransaction(i,r&&r.commitment)).value;if(s.err){if(null!=i)throw new we({action:"send",signature:i,transactionMessage:`Status: (${JSON.stringify(s)})`});throw new Error(`Transaction ${i} failed (${JSON.stringify(s)})`)}return i}function ke(e){return new Promise((t=>setTimeout(t,e)))}function _e(e,t){const n=e.layout.span>=0?e.layout.span:q(e,t),o=r.hp.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,o),o}function Se(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${e.index}`);return n}const Ee=h.I0("lamportsPerSignature"),Te=h.w3([h.DH("version"),h.DH("state"),G("authorizedPubkey"),G("nonce"),h.w3([Ee],"feeCalculator")]),Ie=Te.span;class Me{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=Te.decode(E(e),0);return new Me({authorizedPubkey:new P(t.authorizedPubkey),nonce:new P(t.nonce).toString(),feeCalculator:t.feeCalculator})}}const Re=e=>{const t=(0,h.av)(8,e),{encode:n,decode:o}=(e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)}))(t),i=t;return i.decode=(e,t)=>{const n=o(e,t);return(0,d.k5)(r.hp.from(n))},i.encode=(e,t,r)=>{const o=(0,d.Bq)(e,8);return n(o,t,r)},i};class xe{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=h.DH("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(Ce))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);
1const{lamports:t,space:n,programId:r}=Se(Ce.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:n,programId:new P(r)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=Se(Ce.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t,seed:n,programId:r}=Se(Ce.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:n,programId:new P(r)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=Se(Ce.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,space:r,programId:o}=Se(Ce.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new P(t),seed:n,space:r,programId:new P(o)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=Se(Ce.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new P(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,programId:r}=Se(Ce.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new P(t),seed:n,programId:new P(r)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:n,lamports:r,space:o,programId:i}=Se(Ce.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new P(t),seed:n,lamports:r,space:o,programId:new P(i)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=Se(Ce.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new P(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Se(Ce.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Se(Ce.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t}=Se(Ce.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new P(t)}}static checkProgramId(e){if(!e.equals(Oe.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Ce=Object.freeze({Create:{index:0,layout:h.w3([h.DH("instruction"),h.Wg("lamports"),h.Wg("space"),G("programId")])},Assign:{index:1,layout:h.w3([h.DH("instruction"),G("programId")])},Transfer:{index:2,layout:h.w3([h.DH("instruction"),Re("lamports")])},CreateWithSeed:{index:3,layout:h.w3([h.DH("instruction"),G("base"),F("seed"),h.Wg("lamports"),h.Wg("space"),G("programId")])},AdvanceNonceAccount:{index:4,layout:h.w3([h.DH("instruction")])},WithdrawNonceAccount:{index:5,layout:h.w3([h.DH("instruction"),h.Wg("lamports")])},InitializeNonceAccount:{index:6,layout:h.w3([h.DH("instruction"),G("authorized")])},AuthorizeNonceAccount:{index:7,layout:h.w3([h.DH("instruction"),G("authorized")])},Allocate:{index:8,layout:h.w3([h.DH("instruction"),h.Wg("space")])},AllocateWithSeed:{index:9,layout:h.w3([h.DH("instruction"),G("base"),F("seed"),h.Wg("space"),G("programId")])},AssignWithSeed:{index:10,layout:h.w3([h.DH("instruction"),G("base"),F("seed"),G("programId")])},TransferWithSeed:{index:11,layout:h.w3([h.DH("instruction"),Re("lamports"),F("seed"),G("programId")])},UpgradeNonceAccount:{index:12,layout:h.w3([h.DH("instruction")])}});class Oe{constructor(){}static createAccount(e){const t=_e(Ce.Create,{lamports:e.lamports,space:e.space,programId:E(e.programId.toBuffer())});return new ie({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,n;return"basePubkey"in e?(t=_e(Ce.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:E(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=_e(Ce.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new ie({keys:n,programId:this.programId,data:t})}static assign(e){let t,n;return"basePubkey"in e?(t=_e(Ce.AssignWithSeed,{base:E(e.basePubkey.toBuffer()),seed:e.seed,programId:E(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=_e(Ce.Assign,{programId:E(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new ie({keys:n,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=_e(Ce.CreateWithSeed,{base:E(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:E(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new ie({keys:n,programId:this.programId,data:t})}static createNonceAccount(e){const t=new se;"basePubkey"in e&&"seed"in e?t.add(Oe.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:Ie,programId:this.programId})):t.add(Oe.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:Ie,programId:this.programId}));const n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(n)),t}static nonceInitialize(e){const t=_e(Ce.InitializeNonceAccount,{authorized:E(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:de,isSigner:!1,isWritable:!1},{pubkey:fe,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new ie(n)}static nonceAdvance(e){const t=_e(Ce.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:de,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new ie(n)}static nonceWithdraw(e){const t=_e(Ce.WithdrawNonceAccount,{lamports:e.lamports});return new ie({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:de,isSigner:!1,isWritable:!1},{pubkey:fe,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=_e(Ce.AuthorizeNonceAccount,{authorized:E(e.newAuthorizedPubkey.toBuffer())});return new ie({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,n;return"basePubkey"in e?(t=_e(Ce.AllocateWithSeed,{base:E(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:E(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=_e(Ce.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new ie({keys:n,programId:this.programId,data:t})}}Oe.programId=new P("11111111111111111111111111111111");const Pe=V-300;class Ne{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/Ne.chunkSize)+1+1)}static async load(e,t,n,o,i){{const r=await e.getMinimumBalanceForRentExemption(i.length),s=await e.getAccountInfo(n.publicKey,"confirmed");let a=null;if(null!==s){if(s.executable)return console.error("Program load failed, account is already executable"),!1;s.data.length!==i.length&&(a=a||new se,a.add(Oe.allocate({accountPubkey:n.publicKey,space:i.length}))),s.owner.equals(o)||(a=a||new se,a.add(Oe.assign({accountPubkey:n.publicKey,programId:o}))),s.lamports<r&&(a=a||new se,a.add(Oe.transfer({fromPubkey:t.publicKey,toPubkey:n.publicKey,lamports:r-s.lamports})))}else a=(new se).add(Oe.createAccount({fromPubkey:t.publicKey,newAccountPubkey:n.publicKey,lamports:r>0?r:1,space:i.length,programId:o}));null!==a&&await Ae(e,a,[t,n],{commitment:"confirmed"})}const s=h.w3([h.DH("instruction"),h.DH("offset"),h.DH("bytesLength"),h.DH("bytesLengthPadding"),h.O6(h.u8("byte"),h.cY(h.DH(),-8),"bytes")]),a=Ne.chunkSize;let c=0,u=i,l=[];for(;u.length>0;){const i=u.slice(0,a),h=r.hp.alloc(a+16);s.encode({instruction:0,offset:c,bytes:i,bytesLength:0,bytesLengthPadding:0},h);const d=(new se).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:h});if(l.push(Ae(e,d,[t,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")){const e=4;await ke(1e3/e)}c+=a,u=u.slice(a)}await Promise.all(l);{const i=h.w3([h.DH("instruction")]),s=r.hp.alloc(i.span);i.encode({instruction:1},s);const a=(new se).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:fe,isSigner:!1,isWritable:!1}],programId:o,data:s}),c="processed",u=await e.sendTransaction(a,[t,n],{preflightCommitment:c}),{context:l,value:d}=await e.confirmTransaction({signature:u,lastValidBlockHeight:a.lastV
1alidBlockHeight,blockhash:a.recentBlockhash},c);if(d.err)throw new Error(`Transaction ${u} failed (${JSON.stringify(d)})`);for(;;){try{if(await e.getSlot({commitment:c})>l.slot)break}catch{}await new Promise((e=>setTimeout(e,Math.round(200))))}}return!0}}Ne.chunkSize=Pe;const Be=new P("BPFLoader2111111111111111111111111111111111");class Ve{static getMinNumSignatures(e){return Ne.getMinNumSignatures(e)}static load(e,t,n,r,o){return Ne.load(e,t,n,o,r)}}function Le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var De,je;function Ue(){if(je)return De;je=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function n(r,o){var i,s,a,c,u,l,h;if(!0===r)return"true";if(!1===r)return"false";switch(typeof r){case"object":if(null===r)return null;if(r.toJSON&&"function"==typeof r.toJSON)return n(r.toJSON(),o);if("[object Array]"===(h=e.call(r))){for(a="[",s=r.length-1,i=0;i<s;i++)a+=n(r[i],!0)+",";return s>-1&&(a+=n(r[i],!0)),a+"]"}if("[object Object]"===h){for(s=(c=t(r).sort()).length,a="",i=0;i<s;)void 0!==(l=n(r[u=c[i]],!1))&&(a&&(a+=","),a+=JSON.stringify(u)+":"+l),i++;return"{"+a+"}"}return JSON.stringify(r);case"function":case"undefined":return o?null:void 0;case"string":return JSON.stringify(r);default:return isFinite(r)?r:null}}return De=function(e){var t=n(e,!1);if(void 0!==t)return""+t}}var We=Le(Ue());function ze(e){let t=0;for(;e>1;)e/=2,t++;return t}class Ge{constructor(e,t,n,r,o){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=o}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const n=ze(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32)))-ze(32)-1;return[n,e-(this.getSlotsInEpoch(n)-32)]}{const t=e-this.firstNormalSlot,n=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+n,t%this.slotsPerEpoch]}var t}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+ze(32)):this.slotsPerEpoch}}var Ke=globalThis.fetch;class Fe extends y.vE{constructor(e,t,n){super((e=>{const n=(0,y.kb)(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return this.underlyingSocket="socket"in n?n.socket:n,n}),e,t,n),this.underlyingSocket=void 0}call(...e){const t=this.underlyingSocket?.readyState;return 1===t?super.call(...e):Promise.reject(new Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(...e){const t=this.underlyingSocket?.readyState;return 1===t?super.notify(...e):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class qe{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${e.index}`);return n}(He,e),n=e.length-56;$(n>=0,"lookup table is invalid"),$(n%32==0,"lookup table is invalid");const r=n/32,{addresses:o}=h.w3([h.O6(G(),r,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new P(t.authority[0]):void 0,addresses:o.map((e=>new P(e)))}}}const He={index:1,layout:h.w3([h.DH("typeIndex"),Re("deactivationSlot"),h.I0("lastExtendedSlot"),h.u8("lastExtendedStartIndex"),h.u8(),h.O6(G(),h.cY(h.u8(),-1),"authority")])},Ye=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,$e=(0,f.au)((0,f.KJ)(P),(0,f.Yj)(),(e=>new P(e))),Ze=(0,f.PV)([(0,f.Yj)(),(0,f.eu)("base64")]),Qe=(0,f.au)((0,f.KJ)(r.hp),Ze,(e=>r.hp.from(e[0],"base64"))),Je=3e4;function Xe(e){let t,n;if("string"==typeof e)t=e;else if(e){const{commitment:r,...o}=e;t=r,n=o}return{commitment:t,config:n}}function et(e){return e.map((e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e))}function tt(e){return(0,f.KC)([(0,f.NW)({jsonrpc:(0,f.eu)("2.0"),id:(0,f.Yj)(),result:e}),(0,f.NW)({jsonrpc:(0,f.eu)("2.0"),id:(0,f.Yj)(),error:(0,f.NW)({code:(0,f.L5)(),message:(0,f.Yj)(),data:(0,f.lq)((0,f.bz)())})})])}const nt=tt((0,f.L5)());function rt(e){return(0,f.au)(tt(e),nt,(t=>"error"in t?t:{...t,result:(0,f.vt)(t.result,e)}))}function ot(e){return rt((0,f.NW)({context:(0,f.NW)({slot:(0,f.ai)()}),value:e}))}function it(e){return(0,f.NW)({context:(0,f.NW)({slot:(0,f.ai)()}),value:e})}function st(e,t){return 0===e?new te({header:t.header,staticAccountKeys:t.accountKeys.map((e=>new P(e))),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:c().decode(e.data)}))),addressTableLookups:t.addressTableLookups}):new ee(t)}const at=(0,f.NW)({foundation:(0,f.ai)(),foundationTerm:(0,f.ai)(),initial:(0,f.ai)(),taper:(0,f.ai)(),terminal:(0,f.ai)()}),ct=rt((0,f.YO)((0,f.me)((0,f.NW)({epoch:(0,f.ai)(),effectiveSlot:(0,f.ai)(),amount:(0,f.ai)(),postBalance:(0,f.ai)(),commission:(0,f.lq)((0,f.me)((0,f.ai)())
1)})))),ut=(0,f.YO)((0,f.NW)({slot:(0,f.ai)(),prioritizationFee:(0,f.ai)()})),lt=(0,f.NW)({total:(0,f.ai)(),validator:(0,f.ai)(),foundation:(0,f.ai)(),epoch:(0,f.ai)()}),ht=(0,f.NW)({epoch:(0,f.ai)(),slotIndex:(0,f.ai)(),slotsInEpoch:(0,f.ai)(),absoluteSlot:(0,f.ai)(),blockHeight:(0,f.lq)((0,f.ai)()),transactionCount:(0,f.lq)((0,f.ai)())}),dt=(0,f.NW)({slotsPerEpoch:(0,f.ai)(),leaderScheduleSlotOffset:(0,f.ai)(),warmup:(0,f.zM)(),firstNormalEpoch:(0,f.ai)(),firstNormalSlot:(0,f.ai)()}),ft=(0,f.g1)((0,f.Yj)(),(0,f.YO)((0,f.ai)())),pt=(0,f.me)((0,f.KC)([(0,f.NW)({}),(0,f.Yj)()])),gt=(0,f.NW)({err:pt}),yt=(0,f.eu)("receivedSignature"),mt=(0,f.NW)({"solana-core":(0,f.Yj)(),"feature-set":(0,f.lq)((0,f.ai)())}),wt=(0,f.NW)({program:(0,f.Yj)(),programId:$e,parsed:(0,f.L5)()}),vt=(0,f.NW)({programId:$e,accounts:(0,f.YO)($e),data:(0,f.Yj)()}),bt=ot((0,f.NW)({err:(0,f.me)((0,f.KC)([(0,f.NW)({}),(0,f.Yj)()])),logs:(0,f.me)((0,f.YO)((0,f.Yj)())),accounts:(0,f.lq)((0,f.me)((0,f.YO)((0,f.me)((0,f.NW)({executable:(0,f.zM)(),owner:(0,f.Yj)(),lamports:(0,f.ai)(),data:(0,f.YO)((0,f.Yj)()),rentEpoch:(0,f.lq)((0,f.ai)())}))))),unitsConsumed:(0,f.lq)((0,f.ai)()),returnData:(0,f.lq)((0,f.me)((0,f.NW)({programId:(0,f.Yj)(),data:(0,f.PV)([(0,f.Yj)(),(0,f.eu)("base64")])}))),innerInstructions:(0,f.lq)((0,f.me)((0,f.YO)((0,f.NW)({index:(0,f.ai)(),instructions:(0,f.YO)((0,f.KC)([wt,vt]))}))))})),At=ot((0,f.NW)({byIdentity:(0,f.g1)((0,f.Yj)(),(0,f.YO)((0,f.ai)())),range:(0,f.NW)({firstSlot:(0,f.ai)(),lastSlot:(0,f.ai)()})})),kt=rt(at),_t=rt(lt),St=rt(ut),Et=rt(ht),Tt=rt(dt),It=rt(ft),Mt=rt((0,f.ai)()),Rt=ot((0,f.NW)({total:(0,f.ai)(),circulating:(0,f.ai)(),nonCirculating:(0,f.ai)(),nonCirculatingAccounts:(0,f.YO)($e)})),xt=(0,f.NW)({amount:(0,f.Yj)(),uiAmount:(0,f.me)((0,f.ai)()),decimals:(0,f.ai)(),uiAmountString:(0,f.lq)((0,f.Yj)())}),Ct=ot((0,f.YO)((0,f.NW)({address:$e,amount:(0,f.Yj)(),uiAmount:(0,f.me)((0,f.ai)()),decimals:(0,f.ai)(),uiAmountString:(0,f.lq)((0,f.Yj)())}))),Ot=ot((0,f.YO)((0,f.NW)({pubkey:$e,account:(0,f.NW)({executable:(0,f.zM)(),owner:$e,lamports:(0,f.ai)(),data:Qe,rentEpoch:(0,f.ai)()})}))),Pt=(0,f.NW)({program:(0,f.Yj)(),parsed:(0,f.L5)(),space:(0,f.ai)()}),Nt=ot((0,f.YO)((0,f.NW)({pubkey:$e,account:(0,f.NW)({executable:(0,f.zM)(),owner:$e,lamports:(0,f.ai)(),data:Pt,rentEpoch:(0,f.ai)()})}))),Bt=ot((0,f.YO)((0,f.NW)({lamports:(0,f.ai)(),address:$e}))),Vt=(0,f.NW)({executable:(0,f.zM)(),owner:$e,lamports:(0,f.ai)(),data:Qe,rentEpoch:(0,f.ai)()}),Lt=(0,f.NW)({pubkey:$e,account:Vt}),Dt=(0,f.au)((0,f.KC)([(0,f.KJ)(r.hp),Pt]),(0,f.KC)([Ze,Pt]),(e=>Array.isArray(e)?(0,f.vt)(e,Qe):e)),jt=(0,f.NW)({executable:(0,f.zM)(),owner:$e,lamports:(0,f.ai)(),data:Dt,rentEpoch:(0,f.ai)()}),Ut=(0,f.NW)({pubkey:$e,account:jt}),Wt=(0,f.NW)({state:(0,f.KC)([(0,f.eu)("active"),(0,f.eu)("inactive"),(0,f.eu)("activating"),(0,f.eu)("deactivating")]),active:(0,f.ai)(),inactive:(0,f.ai)()}),zt=rt((0,f.YO)((0,f.NW)({signature:(0,f.Yj)(),slot:(0,f.ai)(),err:pt,memo:(0,f.me)((0,f.Yj)()),blockTime:(0,f.lq)((0,f.me)((0,f.ai)()))}))),Gt=rt((0,f.YO)((0,f.NW)({signature:(0,f.Yj)(),slot:(0,f.ai)(),err:pt,memo:(0,f.me)((0,f.Yj)()),blockTime:(0,f.lq)((0,f.me)((0,f.ai)()))}))),Kt=(0,f.NW)({subscription:(0,f.ai)(),result:it(Vt)}),Ft=(0,f.NW)({pubkey:$e,account:Vt}),qt=(0,f.NW)({subscription:(0,f.ai)(),result:it(Ft)}),Ht=(0,f.NW)({parent:(0,f.ai)(),slot:(0,f.ai)(),root:(0,f.ai)()}),Yt=(0,f.NW)({subscription:(0,f.ai)(),result:Ht}),$t=(0,f.KC)([(0,f.NW)({type:(0,f.KC)([(0,f.eu)("firstShredReceived"),(0,f.eu)("completed"),(0,f.eu)("optimisticConfirmation"),(0,f.eu)("root")]),slot:(0,f.ai)(),timestamp:(0,f.ai)()}),(0,f.NW)({type:(0,f.eu)("createdBank"),parent:(0,f.ai)(),slot:(0,f.ai)(),timestamp:(0,f.ai)()}),(0,f.NW)({type:(0,f.eu)("frozen"),slot:(0,f.ai)(),timestamp:(0,f.ai)(),stats:(0,f.NW)({numTransactionEntries:(0,f.ai)(),numSuccessfulTransactions:(0,f.ai)(),numFailedTransactions:(0,f.ai)(),maxTransactionsPerEntry:(0,f.ai)()})}),(0,f.NW)({type:(0,f.eu)("dead"),slot:(0,f.ai)(),timestamp:(0,f.ai)(),err:(0,f.Yj)()})]),Zt=(0,f.NW)({subscription:(0,f.ai)(),result:$t}),Qt=(0,f.NW)({subscription:(0,f.ai)(),result:it((0,f.KC)([gt,yt]))}),Jt=(0,f.NW)({subscription:(0,f.ai)(),result:(0,f.ai)()}),Xt=(0,f.NW)({pubkey:(0,f.Yj)(),gossip:(0,f.me)((0,f.Yj)()),tpu:(0,f.me)((0,f.Yj)()),rpc:(0,f.me)((0,f.Yj)()),version:(0,f.me)((0,f.Yj)())}),en=(0,f.NW)({votePubkey:(0,f.Yj)(),nodePubkey:(0,f.Yj)(),activatedStake:(0,f.ai)(),epochVoteAccount:(0,f.zM)(),epochCredits:(0,f.YO)((0,f.PV)([(0,f.ai)(),(0,f.ai)(),(0,f.ai)()])),commission:(0,f.ai)(),lastVote:(0,f.ai)(),rootSlot:(0,f.me)((0,f.ai)())}),tn=rt((0,f.NW)({current:(0,f.YO)(en),delinquent:(0,f.YO)(en)}
1)),nn=(0,f.KC)([(0,f.eu)("processed"),(0,f.eu)("confirmed"),(0,f.eu)("finalized")]),rn=(0,f.NW)({slot:(0,f.ai)(),confirmations:(0,f.me)((0,f.ai)()),err:pt,confirmationStatus:(0,f.lq)(nn)}),on=ot((0,f.YO)((0,f.me)(rn))),sn=rt((0,f.ai)()),an=(0,f.NW)({accountKey:$e,writableIndexes:(0,f.YO)((0,f.ai)()),readonlyIndexes:(0,f.YO)((0,f.ai)())}),cn=(0,f.NW)({signatures:(0,f.YO)((0,f.Yj)()),message:(0,f.NW)({accountKeys:(0,f.YO)((0,f.Yj)()),header:(0,f.NW)({numRequiredSignatures:(0,f.ai)(),numReadonlySignedAccounts:(0,f.ai)(),numReadonlyUnsignedAccounts:(0,f.ai)()}),instructions:(0,f.YO)((0,f.NW)({accounts:(0,f.YO)((0,f.ai)()),data:(0,f.Yj)(),programIdIndex:(0,f.ai)()})),recentBlockhash:(0,f.Yj)(),addressTableLookups:(0,f.lq)((0,f.YO)(an))})}),un=(0,f.NW)({pubkey:$e,signer:(0,f.zM)(),writable:(0,f.zM)(),source:(0,f.lq)((0,f.KC)([(0,f.eu)("transaction"),(0,f.eu)("lookupTable")]))}),ln=(0,f.NW)({accountKeys:(0,f.YO)(un),signatures:(0,f.YO)((0,f.Yj)())}),hn=(0,f.NW)({parsed:(0,f.L5)(),program:(0,f.Yj)(),programId:$e}),dn=(0,f.NW)({accounts:(0,f.YO)($e),data:(0,f.Yj)(),programId:$e}),fn=(0,f.KC)([dn,hn]),pn=(0,f.KC)([(0,f.NW)({parsed:(0,f.L5)(),program:(0,f.Yj)(),programId:(0,f.Yj)()}),(0,f.NW)({accounts:(0,f.YO)((0,f.Yj)()),data:(0,f.Yj)(),programId:(0,f.Yj)()})]),gn=(0,f.au)(fn,pn,(e=>"accounts"in e?(0,f.vt)(e,dn):(0,f.vt)(e,hn))),yn=(0,f.NW)({signatures:(0,f.YO)((0,f.Yj)()),message:(0,f.NW)({accountKeys:(0,f.YO)(un),instructions:(0,f.YO)(gn),recentBlockhash:(0,f.Yj)(),addressTableLookups:(0,f.lq)((0,f.me)((0,f.YO)(an)))})}),mn=(0,f.NW)({accountIndex:(0,f.ai)(),mint:(0,f.Yj)(),owner:(0,f.lq)((0,f.Yj)()),programId:(0,f.lq)((0,f.Yj)()),uiTokenAmount:xt}),wn=(0,f.NW)({writable:(0,f.YO)($e),readonly:(0,f.YO)($e)}),vn=(0,f.NW)({err:pt,fee:(0,f.ai)(),innerInstructions:(0,f.lq)((0,f.me)((0,f.YO)((0,f.NW)({index:(0,f.ai)(),instructions:(0,f.YO)((0,f.NW)({accounts:(0,f.YO)((0,f.ai)()),data:(0,f.Yj)(),programIdIndex:(0,f.ai)()}))})))),preBalances:(0,f.YO)((0,f.ai)()),postBalances:(0,f.YO)((0,f.ai)()),logMessages:(0,f.lq)((0,f.me)((0,f.YO)((0,f.Yj)()))),preTokenBalances:(0,f.lq)((0,f.me)((0,f.YO)(mn))),postTokenBalances:(0,f.lq)((0,f.me)((0,f.YO)(mn))),loadedAddresses:(0,f.lq)(wn),computeUnitsConsumed:(0,f.lq)((0,f.ai)())}),bn=(0,f.NW)({err:pt,fee:(0,f.ai)(),innerInstructions:(0,f.lq)((0,f.me)((0,f.YO)((0,f.NW)({index:(0,f.ai)(),instructions:(0,f.YO)(gn)})))),preBalances:(0,f.YO)((0,f.ai)()),postBalances:(0,f.YO)((0,f.ai)()),logMessages:(0,f.lq)((0,f.me)((0,f.YO)((0,f.Yj)()))),preTokenBalances:(0,f.lq)((0,f.me)((0,f.YO)(mn))),postTokenBalances:(0,f.lq)((0,f.me)((0,f.YO)(mn))),loadedAddresses:(0,f.lq)(wn),computeUnitsConsumed:(0,f.lq)((0,f.ai)())}),An=(0,f.KC)([(0,f.eu)(0),(0,f.eu)("legacy")]),kn=(0,f.NW)({pubkey:(0,f.Yj)(),lamports:(0,f.ai)(),postBalance:(0,f.me)((0,f.ai)()),rewardType:(0,f.me)((0,f.Yj)()),commission:(0,f.lq)((0,f.me)((0,f.ai)()))}),Sn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),transactions:(0,f.YO)((0,f.NW)({transaction:cn,meta:(0,f.me)(vn),version:(0,f.lq)(An)})),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),En=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),Tn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),transactions:(0,f.YO)((0,f.NW)({transaction:ln,meta:(0,f.me)(vn),version:(0,f.lq)(An)})),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),In=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),transactions:(0,f.YO)((0,f.NW)({transaction:yn,meta:(0,f.me)(bn),version:(0,f.lq)(An)})),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),Mn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),transactions:(0,f.YO)((0,f.NW)({transaction:ln,meta:(0,f.me)(bn),version:(0,f.lq)(An)})),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),Rn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)()),blockHeight:(0,f.me)((0,f.ai)())}))),xn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),transactions:(0,f.YO)((0,f.NW)({transaction:cn,meta:(0,f.me)(vn)})),rewards:(0,f.lq)((0,f.YO)(kn)),blockTime:(0,f.me)((0,f.ai)())}))),Cn=rt((0,f.me)((0,f.NW)({blockhash:(0,f.Yj)(),previousBlockhash:(0,f.Yj)(),parentSlot:(0,f.ai)(),signatures:(0,f.YO)((0,f.Yj)()),blockTime:(0,f.me)((0,f.ai)())}))),On=rt((0,f.me)((0,f.NW)({slot:(0,f.ai)(),meta:(0,f.me)(vn),blockTime:(0,f.lq)((0,f.me)((0,f.ai)())
1),transaction:cn,version:(0,f.lq)(An)}))),Pn=rt((0,f.me)((0,f.NW)({slot:(0,f.ai)(),transaction:yn,meta:(0,f.me)(bn),blockTime:(0,f.lq)((0,f.me)((0,f.ai)())),version:(0,f.lq)(An)}))),Nn=ot((0,f.NW)({blockhash:(0,f.Yj)(),lastValidBlockHeight:(0,f.ai)()})),Bn=ot((0,f.zM)()),Vn=(0,f.NW)({slot:(0,f.ai)(),numTransactions:(0,f.ai)(),numSlots:(0,f.ai)(),samplePeriodSecs:(0,f.ai)()}),Ln=rt((0,f.YO)(Vn)),Dn=ot((0,f.me)((0,f.NW)({feeCalculator:(0,f.NW)({lamportsPerSignature:(0,f.ai)()})}))),jn=rt((0,f.Yj)()),Un=rt((0,f.Yj)()),Wn=(0,f.NW)({err:pt,logs:(0,f.YO)((0,f.Yj)()),signature:(0,f.Yj)()}),zn=(0,f.NW)({result:it(Wn),subscription:(0,f.ai)()}),Gn={"solana-client":"js/1.0.0-maintenance"};class Kn{constructor(e,t){let n,r,o,i,s,a;var c;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const e={};return async t=>{const{commitment:n,config:r}=Xe(t),o=this._buildArgs([],n,void 0,r),i=We(o);return e[i]=e[i]??(async()=>{try{const e=await this._rpcRequest("getBlockHeight",o),t=(0,f.vt)(e,rt((0,f.ai)()));if("error"in t)throw new be(t.error,"failed to get block height information");return t.result}finally{delete e[i]}})(),await e[i]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,n=t.wsEndpoint,r=t.httpHeaders,o=t.fetch,i=t.fetchMiddleware,s=t.disableRetryOnRateLimit,a=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=n||function(e){const t=e.match(Ye);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[n,r,o,i]=t,s=e.startsWith("https:")?"wss:":"ws:",a=null==o?null:parseInt(o.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${i}`}(e),this._rpcClient=function(e,t,n,r,o,i){const s=n||Ke;let a;return null!=i&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(e,t)=>{const n=await new Promise(((n,o)=>{try{r(e,t,((e,t)=>n([e,t])))}catch(e){o(e)}}));return await s(...n)}),new(g())((async(n,r)=>{const i={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},Gn)};try{let t,n=5,c=500;for(;t=a?await a(e,i):await s(e,i),429===t.status&&!0!==o&&(n-=1,0!==n);)console.error(`Server responded with ${t.status} ${t.statusText}.  Retrying after ${c}ms delay...`),await ke(c),c*=2;const u=await t.text();t.ok?r(null,u):r(new Error(`${t.status} ${t.statusText}: ${u}`))}catch(e){e instanceof Error&&r(e)}}),{})}(e,r,o,i,s,a),this._rpcRequest=(c=this._rpcClient,(e,t)=>new Promise(((n,r)=>{c.request(e,t,((e,t)=>{e?r(e):n(t)}))}))),this._rpcBatchRequest=function(e){return t=>new Promise(((n,r)=>{0===t.length&&n([]);const o=t.map((t=>e.request(t.methodName,t.args)));e.request(o,((e,t)=>{e?r(e):n(t)}))}))}(this._rpcClient),this._rpcWebSocket=new Fe(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgs([e.toBase58()],n,void 0,r),i=await this._rpcRequest("getBalance",o),s=(0,f.vt)(i,ot((0,f.ai)())
1);if("error"in s)throw new be(s.error,`failed to get balance for ${e.toBase58()}`);return s.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+t)}))}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),n=(0,f.vt)(t,rt((0,f.me)((0,f.ai)())));if("error"in n)throw new be(n.error,`failed to get block time for slot ${e}`);return n.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=(0,f.vt)(e,rt((0,f.ai)()));if("error"in t)throw new be(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=(0,f.vt)(e,Mt);if("error"in t)throw new be(t.error,"failed to get first available block");return t.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[t]),r=(0,f.vt)(n,Rt);if("error"in r)throw new be(r.error,"failed to get supply");return r.result}async getTokenSupply(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenSupply",n),o=(0,f.vt)(r,ot(xt));if("error"in o)throw new be(o.error,"failed to get token supply");return o.result}async getTokenAccountBalance(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenAccountBalance",n),o=(0,f.vt)(r,ot(xt));if("error"in o)throw new be(o.error,"failed to get token account balance");return o.result}async getTokenAccountsByOwner(e,t,n){const{commitment:r,config:o}=Xe(n);let i=[e.toBase58()];"mint"in t?i.push({mint:t.mint.toBase58()}):i.push({programId:t.programId.toBase58()});const s=this._buildArgs(i,r,"base64",o),a=await this._rpcRequest("getTokenAccountsByOwner",s),c=(0,f.vt)(a,Ot);if("error"in c)throw new be(c.error,`failed to get token accounts owned by account ${e.toBase58()}`);return c.result}async getParsedTokenAccountsByOwner(e,t,n){let r=[e.toBase58()];"mint"in t?r.push({mint:t.mint.toBase58()}):r.push({programId:t.programId.toBase58()});const o=this._buildArgs(r,n,"jsonParsed"),i=await this._rpcRequest("getTokenAccountsByOwner",o),s=(0,f.vt)(i,Nt);if("error"in s)throw new be(s.error,`failed to get token accounts owned by account ${e.toBase58()}`);return s.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},n=t.filter||t.commitment?[t]:[],r=await this._rpcRequest("getLargestAccounts",n),o=(0,f.vt)(r,Bt);if("error"in o)throw new be(o.error,"failed to get largest accounts");return o.result}async getTokenLargestAccounts(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenLargestAccounts",n),o=(0,f.vt)(r,Ct);if("error"in o)throw new be(o.error,"failed to get token largest accounts");return o.result}async getAccountInfoAndContext(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgs([e.toBase58()],n,"base64",r),i=await this._rpcRequest("getAccountInfo",o),s=(0,f.vt)(i,ot((0,f.me)(Vt)));if("error"in s)throw new be(s.error,`failed to get info about account ${e.toBase58()}`);return s.result}async getParsedAccountInfo(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgs([e.toBase58()],n,"jsonParsed",r),i=await this._rpcRequest("getAccountInfo",o),s=(0,f.vt)(i,ot((0,f.me)(jt)));if("error"in s)throw new be(s.error,`failed to get info about account ${e.toBase58()}`);return s.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(t){throw new Error("failed to get info about account "+e.toBase58()+": "+t)}}async getMultipleParsedAccounts(e,t){const{commitment:n,config:r}=Xe(t),o=e.map((e=>e.toBase58())),i=this._buildArgs([o],n,"jsonParsed",r),s=await this._rpcRequest("getMultipleAccounts",i),a=(0,f.vt)(s,ot((0,f.YO)((0,f.me)(jt))));if("error"in a)throw new be(a.error,`failed to get info for accounts ${o}`);return a.result}async getMultipleAccountsInfoAndContext(e,t){const{commitment:n,config:r}=Xe(t),o=e.map((e=>
1e.toBase58())),i=this._buildArgs([o],n,"base64",r),s=await this._rpcRequest("getMultipleAccounts",i),a=(0,f.vt)(s,ot((0,f.YO)((0,f.me)(Vt))));if("error"in a)throw new be(a.error,`failed to get info for accounts ${o}`);return a.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,n){const{commitment:r,config:o}=Xe(t),i=this._buildArgs([e.toBase58()],r,void 0,{...o,epoch:null!=n?n:o?.epoch}),s=await this._rpcRequest("getStakeActivation",i),a=(0,f.vt)(s,rt(Wt));if("error"in a)throw new be(a.error,`failed to get Stake Activation ${e.toBase58()}`);return a.result}async getProgramAccounts(e,t){const{commitment:n,config:r}=Xe(t),{encoding:o,...i}=r||{},s=this._buildArgs([e.toBase58()],n,o||"base64",{...i,...i.filters?{filters:et(i.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",s),c=(0,f.YO)(Lt),u=!0===i.withContext?(0,f.vt)(a,ot(c)):(0,f.vt)(a,rt(c));if("error"in u)throw new be(u.error,`failed to get accounts owned by program ${e.toBase58()}`);return u.result}async getParsedProgramAccounts(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgs([e.toBase58()],n,"jsonParsed",r),i=await this._rpcRequest("getProgramAccounts",o),s=(0,f.vt)(i,rt((0,f.YO)(Ut)));if("error"in s)throw new be(s.error,`failed to get accounts owned by program ${e.toBase58()}`);return s.result}async confirmTransaction(e,t){let n,r;if("string"==typeof e)n=e;else{const t=e;if(t.abortSignal?.aborted)return Promise.reject(t.abortSignal.reason);n=t.signature}try{r=c().decode(n)}catch(e){throw new Error("signature must be base58 encoded: "+n)}return $(64===r.length,"signature has invalid length"),"string"==typeof e?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise(((t,n)=>{null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(()=>{n(e.reason)})))}))}getTransactionConfirmationPromise({commitment:e,signature:t}){let n,r,o=!1;return{abortConfirmation:()=>{r&&(r(),r=void 0),null!=n&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:new Promise(((i,s)=>{try{n=this.onSignature(t,((e,t)=>{n=void 0;const r={context:t,value:e};i({__type:re.PROCESSED,response:r})}),e);const a=new Promise((e=>{null==n?e():r=this._onSubscriptionStateChange(n,(t=>{"subscribed"===t&&e()}))}));(async()=>{if(await a,o)return;
1const n=await this.getSignatureStatus(t);if(o)return;if(null==n)return;const{context:r,value:c}=n;if(null!=c)if(c?.err)s(c.err);else{switch(e){case"confirmed":case"single":case"singleGossip":if("processed"===c.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===c.confirmationStatus||"confirmed"===c.confirmationStatus)return}o=!0,i({__type:re.PROCESSED,response:{context:r,value:c}})}})()}catch(e){s(e)}}))}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:t,lastValidBlockHeight:n,signature:r}}){let o=!1;const i=new Promise((t=>{const r=async()=>{try{return await this.getBlockHeight(e)}catch(e){return-1}};(async()=>{let e=await r();if(!o){for(;e<=n;){if(await ke(1e3),o)return;if(e=await r(),o)return}t({__type:re.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:e,signature:r}),c=this.getCancellationPromise(t);let u;try{const e=await Promise.race([c,a,i]);if(e.__type!==re.PROCESSED)throw new j(r);u=e.response}finally{o=!0,s()}return u}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:t,minContextSlot:n,nonceAccountPubkey:r,nonceValue:o,signature:i}}){let s=!1;const a=new Promise((t=>{let i=o,a=null;const c=async()=>{try{const{context:t,value:o}=await this.getNonceAndContext(r,{commitment:e,minContextSlot:n});return a=t.slot,o?.nonce}catch(e){return i}};(async()=>{if(i=await c(),!s)for(;;){if(o!==i)return void t({__type:re.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await ke(2e3),s)return;if(i=await c(),s)return}})()})),{abortConfirmation:c,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:e,signature:i}),l=this.getCancellationPromise(t);let h;try{const t=await Promise.race([l,u,a]);if(t.__type===re.PROCESSED)h=t.response;else{let r;for(;;
1){const e=await this.getSignatureStatus(i);if(null==e)break;if(!(e.context.slot<(t.slotInWhichNonceDidAdvance??n))){r=e;break}await ke(400)}if(!r?.value)throw new W(i);{const t=e||"finalized",{confirmationStatus:n}=r.value;switch(t){case"processed":case"recent":if("processed"!==n&&"confirmed"!==n&&"finalized"!==n)throw new W(i);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==n&&"finalized"!==n)throw new W(i);break;case"finalized":case"max":case"root":if("finalized"!==n)throw new W(i)}h={context:r.context,value:{err:r.value.err}}}}}finally{s=!0,c()}return h}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:t}){let n;const r=new Promise((t=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}n=setTimeout((()=>t({__type:re.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:o,confirmationPromise:i}=this.getTransactionConfirmationPromise({commitment:e,signature:t});let s;try{const e=await Promise.race([i,r]);if(e.__type!==re.PROCESSED)throw new U(t,e.timeoutMs/1e3);s=e.response}finally{clearTimeout(n),o()}return s}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=(0,f.vt)(e,rt((0,f.YO)(Xt)));if("error"in t)throw new be(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),n=await this._rpcRequest("getVoteAccounts",t),r=(0,f.vt)(n,tn);if("error"in r)throw new be(r.error,"failed to get vote accounts");return r.result}async getSlot(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,void 0,n),o=await this._rpcRequest("getSlot",r),i=(0,f.vt)(o,rt((0,f.ai)()));if("error"in i)throw new be(i.error,"failed to get slot");return i.result}async getSlotLeader(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,void 0,n),o=await this._rpcRequest("getSlotLeader",r),i=(0,f.vt)(o,rt((0,f.Yj)()));if("error"in i)throw new be(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(e,t){const n=[e,t],r=await this._rpcRequest("getSlotLeaders",n),o=(0,f.vt)(r,rt((0,f.YO)($e)));if("error"in o)throw new be(o.error,"failed to get slot leaders");return o.result}async getSignatureStatus(e,t){const{context:n,value:r}
1=await this.getSignatureStatuses([e],t);return $(1===r.length),{context:n,value:r[0]}}async getSignatureStatuses(e,t){const n=[e];t&&n.push(t);const r=await this._rpcRequest("getSignatureStatuses",n),o=(0,f.vt)(r,on);if("error"in o)throw new be(o.error,"failed to get signature status");return o.result}async getTransactionCount(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,void 0,n),o=await this._rpcRequest("getTransactionCount",r),i=(0,f.vt)(o,rt((0,f.ai)()));if("error"in i)throw new be(i.error,"failed to get transaction count");return i.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),n=await this._rpcRequest("getInflationGovernor",t),r=(0,f.vt)(n,kt);if("error"in r)throw new be(r.error,"failed to get inflation");return r.result}async getInflationReward(e,t,n){const{commitment:r,config:o}=Xe(n),i=this._buildArgs([e.map((e=>e.toBase58()))],r,void 0,{...o,epoch:null!=t?t:o?.epoch}),s=await this._rpcRequest("getInflationReward",i),a=(0,f.vt)(s,ct);if("error"in a)throw new be(a.error,"failed to get inflation reward");return a.result}async getInflationRate(){const e=await this._rpcRequest("getInflationRate",[]),t=(0,f.vt)(e,_t);if("error"in t)throw new be(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,void 0,n),o=await this._rpcRequest("getEpochInfo",r),i=(0,f.vt)(o,Et);if("error"in i)throw new be(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=(0,f.vt)(e,Tt);if("error"in t)throw new be(t.error,"failed to get epoch schedule");const n=t.result;return new Ge(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=(0,f.vt)(e,It);if("error"in t)throw new be(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(e,t){const n=this._buildArgs([e],t),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),o=(0,f.vt)(r,sn);return"error"in o?(console.warn("Unable to fetch minimum balance for rent exemption"),0):o.result}async getRecentBlockhashAndContext(e){const{context:t,value:{blockhash:n}}=await this.getLatestBlockhashAndContext(e);return{context:t,value:{blockhash:n,feeCalculator:{get lamportsPerSignature(){throw new Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(e){const t=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),n=(0,f.vt)(t,Ln);if("error"in n)throw new be(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(e,t){const n=this._buildArgs([e],t),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),o=(0,f.vt)(r,Dn);if("error"in o)throw new be(o.error,"failed to get fee calculator");const{context:i,value:s}=o.result;return{context:i,value:null!==s?s.feeCalculator:null}}async getFeeForMessage(e,t){const n=E(e.serialize()).toString("base64"),r=this._buildArgs([n],t),o=await this._rpcRequest("getFeeForMessage",r),i=(0,f.vt)(o,ot((0,f.me)((0,f.ai)())));if("error"in i)throw new be(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(e){const t=e?.lockedWritableAccounts?.map((e=>e.toBase58())),n=t?.length?[t]:[],r=await this._rpcRequest("getRecentPrioritizationFees",n),o=(0,f.vt)(r,St);if("error"in o)throw new be(o.error,"failed to get recent prioritization fees");return o.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,void 0,n),o=await this._rpcRequest("getLatestBlockhash",r),i=(0,f.vt)(o,Nn);if("error"in i)throw new be(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgs([e],n,void 0,r),i=await this._rpcRequest("isBlockhashValid",o),s=(0,f.vt)(i,Bn);if("error"in s)throw new be(s.error,"failed to determine if the blockhash `"+e+"`is valid");return s.result}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=(0,f.vt)(e,rt(mt));if("error"in t)throw new be(t.error,"failed to get version");return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=(0,f.vt)(e,rt((0,f.Yj)()));if("error"in t)throw new be(t.error,"failed to get genesis hash");return t.result}async getBlock(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgsAtLeastConfirmed([e],n,void 0,r),i=await this._rpcRequest("getBlock",o);
1try{switch(r?.transactionDetails){case"accounts":{const e=(0,f.vt)(i,Tn);if("error"in e)throw e.error;return e.result}case"none":{const e=(0,f.vt)(i,En);if("error"in e)throw e.error;return e.result}default:{const e=(0,f.vt)(i,Sn);if("error"in e)throw e.error;const{result:t}=e;return t?{...t,transactions:t.transactions.map((({transaction:e,meta:t,version:n})=>({meta:t,transaction:{...e,message:st(n,e.message)},version:n})))}:null}}}catch(e){throw new be(e,"failed to get confirmed block")}}async getParsedBlock(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),i=await this._rpcRequest("getBlock",o);try{switch(r?.transactionDetails){case"accounts":{const e=(0,f.vt)(i,Mn);if("error"in e)throw e.error;return e.result}case"none":{const e=(0,f.vt)(i,Rn);if("error"in e)throw e.error;return e.result}default:{const e=(0,f.vt)(i,In);if("error"in e)throw e.error;return e.result}}}catch(e){throw new be(e,"failed to get block")}}async getBlockProduction(e){let t,n;if("string"==typeof e)n=e;else if(e){const{commitment:r,...o}=e;n=r,t=o}const r=this._buildArgs([],n,"base64",t),o=await this._rpcRequest("getBlockProduction",r),i=(0,f.vt)(o,At);if("error"in i)throw new be(i.error,"failed to get block production information");return i.result}async getTransaction(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgsAtLeastConfirmed([e],n,void 0,r),i=await this._rpcRequest("getTransaction",o),s=(0,f.vt)(i,On);if("error"in s)throw new be(s.error,"failed to get transaction");const a=s.result;return a?{...a,transaction:{...a.transaction,message:st(a.version,a.transaction.message)}}:a}async getParsedTransaction(e,t){const{commitment:n,config:r}=Xe(t),o=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),i=await this._rpcRequest("getTransaction",o),s=(0,f.vt)(i,Pn);if("error"in s)throw new be(s.error,"failed to get transaction");return s.result}async getParsedTransactions(e,t){const{commitment:n,config:r}=Xe(t),o=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(o)).map((e=>{const t=(0,f.vt)(e,Pn);if("error"in t)throw new be(t.error,"failed to get transactions");return t.result}))}async getTransactions(e,t){const{commitment:n,config:r}=Xe(t),o=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,void 0,r)})));return(await this._rpcBatchRequest(o)).map((e=>{const t=(0,f.vt)(e,On);if("error"in t)throw new be(t.error,"failed to get transactions");const n=t.result;return n?{...n,transaction:{...n.transaction,message:st(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=await this._rpcRequest("getBlock",n),o=(0,f.vt)(r,xn);if("error"in o)throw new be(o.error,"failed to get confirmed block");const i=o.result;if(!i)throw new Error("Confirmed block "+e+" not found");const s={...i,transactions:i.transactions.map((({transaction:e,meta:t})=>{const n=new ee(e.message);return{meta:t,transaction:{...e,message:n}}}))};return{...s,transactions:s.transactions.map((({transaction:e,meta:t})=>({meta:t,transaction:se.populate(e.message,e.signatures)})))}}async getBlocks(e,t,n){const r=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],n),o=await this._rpcRequest("getBlocks",r),i=(0,f.vt)(o,rt((0,f.YO)((0,f.ai)())));if("error"in i)throw new be(i.error,"failed to get blocks");return i.result}async getBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),o=(0,f.vt)(r,Cn);if("error"in o)throw new be(o.error,"failed to get block");const i=o.result;if(!i)throw new Error("Block "+e+" not found");return i}async getConfirmedBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),o=(0,f.vt)(r,Cn);if("error"in o)throw new be(o.error,"failed to get confirmed block");const i=o.result;if(!i)throw new Error("Confirmed block "+e+" not found");return i}async getConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=await this._rpcRequest("getTransaction",n),o=(0,f.vt)(r,On
1);if("error"in o)throw new be(o.error,"failed to get transaction");const i=o.result;if(!i)return i;const s=new ee(i.transaction.message),a=i.transaction.signatures;return{...i,transaction:se.populate(s,a)}}async getParsedConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),r=await this._rpcRequest("getTransaction",n),o=(0,f.vt)(r,Pn);if("error"in o)throw new be(o.error,"failed to get confirmed transaction");return o.result}async getParsedConfirmedTransactions(e,t){const n=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((e=>{const t=(0,f.vt)(e,Pn);if("error"in t)throw new be(t.error,"failed to get confirmed transactions");return t.result}))}async getConfirmedSignaturesForAddress(e,t,n){let r={},o=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--t<=0||t<o);)try{const e=await this.getConfirmedBlockSignatures(t,"finalized");e.signatures.length>0&&(r.until=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}
1let i=await this.getSlot("finalized");for(;!("before"in r||++n>i);)try{const e=await this.getConfirmedBlockSignatures(n);e.signatures.length>0&&(r.before=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}return(await this.getConfirmedSignaturesForAddress2(e,r)).map((e=>e.signature))}async getConfirmedSignaturesForAddress2(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),o=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),i=(0,f.vt)(o,zt);if("error"in i)throw new be(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),o=await this._rpcRequest("getSignaturesForAddress",r),i=(0,f.vt)(o,Gt);if("error"in i)throw new be(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let o=null;return null!==r&&(o=new qe({key:e,state:qe.deserialize(r.data)})),{context:n,value:o}}async getNonceAndContext(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let o=null;return null!==r&&(o=Me.fromAccountData(r.data)),{context:n,value:o}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}))}async requestAirdrop(e,t){const n=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),r=(0,f.vt)(n,jn);if("error"in r)throw new be(r.error,`airdrop to ${e.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await ke(100);const e=Date.now()-this._blockhashInfo.lastFetch>=Je;if(null!==this._blockhashInfo.latestBlockhash&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),t=this._blockhashInfo.latestBlockhash,n=t?t.blockhash:null;for(let e=0;e<50;e++){const e=await this.getLatestBlockhash("finalized");if(n!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await ke(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:t,config:n}=Xe(e),r=this._buildArgs([],t,"base64",n),o=await this._rpcRequest("getStakeMinimumDelegation",r),i=(0,f.vt)(o,ot((0,f.ai)()));if("error"in i)throw new be(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(e,t,n){if("message"in e){const o=e.serialize(),i=r.hp.from(o).toString("base64");if(Array.isArray(t)||void 0!==n)throw new Error("Invalid arguments");const s=t||{};s.encoding="base64","commitment"in s||(s.commitment=this.commitment),t&&"object"==typeof t&&"innerInstructions"in t&&(s.innerInstructions=t.innerInstructions);const a=[i,s],c=await this._rpcRequest("simulateTransaction",a),u=(0,f.vt)(c,bt);if("error"in u)throw new Error("failed to simulate transaction: "+u.error.message);return u.result}let o;if(e instanceof se){let t=e;o=new se,o.feePayer=t.feePayer,o.instructions=e.instructions,o.nonceInfo=t.nonceInfo,o.signatures=t.signatures}else o=se.populate(e),o._message=o._json=void 0;if(void 0!==t&&!Array.isArray(t))throw new Error("Invalid arguments");const i=t;if(o.nonceInfo&&i)o.sign(...i);else{let e=this._disableBlockhashCaching;for(;;){const t=await this._blockhashWithExpiryBlockHeight(e);if(o.lastValidBlockHeight=t.lastValidBlockHeight,o.recentBlockhash=t.blockhash,!i)break;if(o.sign(...i),!o.signature)throw new Error("!signature");const n=o.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}e=!0}}const s=o._compile(),a=s.serialize(),c=o._serialize(a).toString("base64"),u={encoding:"base64",commitment:this.commitment};if(n){const e=(Array.isArray(n)?n:s.nonProgramIds()).map((e=>
1e.toBase58()));u.accounts={encoding:"base64",addresses:e}}i&&(u.sigVerify=!0),t&&"object"==typeof t&&"innerInstructions"in t&&(u.innerInstructions=t.innerInstructions);const l=[c,u],h=await this._rpcRequest("simulateTransaction",l),d=(0,f.vt)(h,bt);if("error"in d){let e;if("data"in d.error&&(e=d.error.data.logs,e&&Array.isArray(e))){const t="\n    ",n=t+e.join(t);console.error(d.error.message,n)}throw new we({action:"simulate",signature:"",transactionMessage:d.error.message,logs:e})}return d.result}async sendTransaction(e,t,n){if("version"in e){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const n=e.serialize();return await this.sendRawTransaction(n,t)}if(void 0===t||!Array.isArray(t))throw new Error("Invalid arguments");const r=t;if(e.nonceInfo)e.sign(...r);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(e.lastValidBlockHeight=n.lastValidBlockHeight,e.recentBlockhash=n.blockhash,e.sign(...r),!e.signature)throw new Error("!signature");const o=e.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(o)){this._blockhashInfo.transactionSignatures.push(o);break}t=!0}}const o=e.serialize();return await this.sendRawTransaction(o,n)}async sendRawTransaction(e,t){const n=E(e).toString("base64");return await this.sendEncodedTransaction(n,t)}async sendEncodedTransaction(e,t){const n={encoding:"base64"},r=t&&t.skipPreflight,o=!0===r?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(n.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(n.minContextSlot=t.minContextSlot),r&&(n.skipPreflight=r),o&&(n.preflightCommitment=o);const i=[e,n],s=await this._rpcRequest("sendTransaction",i),a=(0,f.vt)(s,Un);if("error"in a){let e;throw"data"in a.error&&(e=a.error.data.logs),new we({action:r?"send":"simulate",signature:"",transactionMessage:a.error.message,logs:e})}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((([e,t])=>{this._setSubscription(e,{...t,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(e,t){const n=this._subscriptionsByHash[e]?.state;if(this._subscriptionsByHash[e]=t,n!==t.state){const n=this._subscriptionStateChangeCallbacksByHash[e];n&&n.forEach((e=>{try{e(t.state)}catch{}}))}}_onSubscriptionStateChange(e,t){const n=this._subscriptionHashByClientSubscriptionId[e];if(null==n)return()=>{};const r=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return r.add(t),()=>{r.delete(t),0===r.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async e=>{const n=this._subscriptionsByHash[e];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[e],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:o}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const t=await this._rpcWebSocket.call(o,r);this._setSubscription(e,{...n,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=n.callbacks,await this._updateSubscriptions()}catch(i){if(console.error(`Received ${i instanceof Error?"":"JSON-RPC "}error calling \`${o}\``,{args:r,error:i}),!t())return;this._setSubscription(e,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:o}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[r])}catch(r){if(r instanceof Error&&console.error(`${o} error:`,r.message),!t())return;return this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(e,t){const n=this._subscriptionCallbacksByServerSubscriptionId[e];
vendor: 5,019 bytes, line 1
1void 0!==n&&n.forEach((e=>{try{e(...t)}catch(e){console.error(e)}}))}_wsOnAccountNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,Kt);this._handleServerNotification(n,[t.value,t.context])}_makeSubscription(e,t){const n=this._nextClientSubscriptionId++,r=We([e.method,t]),o=this._subscriptionsByHash[r];return void 0===o?this._subscriptionsByHash[r]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:o.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const t=this._subscriptionsByHash[r];$(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,t,n){const{commitment:r,config:o}=Xe(n),i=this._buildArgs([e.toBase58()],r||this._commitment||"finalized","base64",o);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},i)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,qt);this._handleServerNotification(n,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,n,r){const{commitment:o,config:i}=Xe(n),s=this._buildArgs([e.toBase58()],o||this._commitment||"finalized","base64",i||(r?{filters:et(r)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,n){const r=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,zn);this._handleServerNotification(n,[t.value,t.context])}_wsOnSlotNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,Yt);this._handleServerNotification(n,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,Zt);this._handleServerNotification(n,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,n,r){const o=t||this._commitment;if(o||n||r){let t={};n&&(t.encoding=n),o&&(t.commitment=o),r&&(t=Object.assign(t,r)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,n,r){const o=t||this._commitment;if(o&&!["confirmed","finalized"].includes(o))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,n,r)}_wsOnSignatureNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,Qt);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,n){const r=this._buildArgs([e],n||this._commitment||"finalized"),o=this._makeSubscription({callback:(e,n)=>{if("status"===e.type){t(e.result,n);try{this.removeSignatureListener(o)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return o}onSignatureWithOptions(e,t,n){const{commitment:r,...o}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},i=this._buildArgs([e],r,void 0,o),s=this._makeSubscription({callback:(e,n)=>{t(e,n);try{this.removeSignatureListener(s)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:t,subscription:n}=(0,f.vt)(e,Jt);this._handleServerNotification(n,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}class Fn{constructor(e){this._keypair=void 0,this._keypair=e??b()}
1static generate(){return new Fn(b())}static fromSecretKey(e,t){if(64!==e.byteLength)throw new Error("bad secret key size");const n=e.slice(32,64);if(!t||!t.skipValidation){const t=e.slice(0,32),r=A(t);for(let e=0;e<32;e++)if(n[e]!==r[e])throw new Error("provided secretKey is invalid")}return new Fn({publicKey:n,secretKey:e})}static fromSeed(e){const t=A(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),new Fn({publicKey:t,secretKey:n})}get publicKey(){return new P(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const qn=Object.freeze({CreateLookupTable:{index:0,layout:h.w3([h.DH("instruction"),Re("recentSlot"),h.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:h.w3([h.DH("instruction")])},ExtendLookupTable:{index:2,layout:h.w3([h.DH("instruction"),Re(),h.O6(G(),h.cY(h.DH(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:h.w3([h.DH("instruction")])},CloseLookupTable:{index:4,layout:h.w3([h.DH("instruction")])}});class Hn{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=h.DH("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(qn))if(r.index==t){n=e;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);const{recentSlot:t}=Se(qn.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);const{addresses:t}=Se(qn.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((e=>new P(e)))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(Yn.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}class Yn{constructor(){}static createLookupTable(e){const[t,n]=P.findProgramAddressSync([e.authority.toBuffer(),(0,d.Bq)(BigInt(e.recentSlot),8)],this.programId),r=_e(qn.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Oe.programId,isSigner:!1,isWritable:!1}];return[new ie({programId:this.programId,keys:o,data:r}),t]}static freezeLookupTable(e){const t=_e(qn.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new ie({programId:this.programId,keys:n,data:t})}static extendLookupTable(e){const t=_e(qn.ExtendLookupTable,{addresses:e.addresses.map((e=>e.toBytes()))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Oe.programId,isSigner:!1,isWritable:!1}),new ie({programId:this.programId,keys:n,data:t})}static deactivateLookupTable(e){const t=_e(qn.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new ie({programId:this.programId,keys:n,data:t})}static closeLookupTable(e){const t=_e(qn.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new ie({programId:this.programId,keys:n,data:t})}}Yn.programId=new P("AddressLookupTab1e1111111111111111111111111");class $n{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=h.u8("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(Zn))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(e){this.checkProgramId(e.programId);const{units:t,additionalFee:n}=Se(Zn.RequestUnits,e.data);return{units:t,additionalFee:n}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);const{bytes:t}=Se(Zn.RequestHeapFrame,e.data);return{bytes:t}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);const{units:t}=Se(Zn.SetComputeUnitLimit,e.data);return{units:t}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);const{microLamports:t}=Se(Zn.SetComputeUnitPrice,e.data);return{microLamports:t}}static checkProgramId(e){if(!e.equals(Qn.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}const Zn=Object.freeze({RequestUnits:{index:0,layout:h.w3([h.u8("instruction"),h.DH("units"),h.DH("additionalFee")])},RequestHeapFrame:{index:1,layout:h.w3([h.u8("instruction"),h.DH("bytes")])},SetComputeUnitLimit:{index:2,layout:h.w3([h.u8("instruction"),h.DH("units")])},SetComputeUnitPrice:{index:3,layout:h.w3([h.u8("instruction"),Re("microLamports")])}});class Qn{constructor(){}static requestUnits(e){const t=_e(Zn.RequestUnits,e);return new ie({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){const t=_e(Zn.RequestHeapFrame,e);return new ie({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){const t=_e(Zn.SetComputeUnitLimit,e);return new ie({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){const t=_e(Zn.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new ie({keys:[],programId:this.programId,data:t})}}Qn.programId=new P("ComputeBudget111111111111111111111111111111");const Jn=h.w3([h.u8("numSignatures"),h.u8("padding"),h.NX("signatureOffset"),h.NX("signatureInstructionIndex"),h.NX("publicKeyOffset"),h.NX("publicKeyInstructionIndex"),h.NX("messageDataOffset"),h.NX("messageDataSize"),h.NX("messageInstructionIndex")]
1);class Xn{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:o,instructionIndex:i}=e;$(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),$(64===o.length,`Signature must be 64 bytes but received ${o.length} bytes`);const s=Jn.span,a=s+t.length,c=a+o.length,u=r.hp.alloc(c+n.length),l=null==i?65535:i;return Jn.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:l,publicKeyOffset:s,publicKeyInstructionIndex:l,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:l},u),u.fill(t,s),u.fill(o,a),u.fill(n,c),new ie({keys:[],programId:Xn.programId,data:u})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;$(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{const e=Fn.fromSecretKey(t),o=e.publicKey.toBytes(),i=_(n,e.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:i,instructionIndex:r})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}Xn.programId=new P("Ed25519SigVerify111111111111111111111111111"),w.bI.utils.isValidPrivateKey;const er=w.bI.getPublicKey,tr=h.w3([h.u8("numSignatures"),h.NX("signatureOffset"),h.u8("signatureInstructionIndex"),h.NX("ethAddressOffset"),h.u8("ethAddressInstructionIndex"),h.NX("messageDataOffset"),h.NX("messageDataSize"),h.u8("messageInstructionIndex"),h.av(20,"ethAddress"),h.av(64,"signature"),h.u8("recoveryId")]);class nr{constructor(){}static publicKeyToEthAddress(e){$(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return r.hp.from((0,m.lY)(E(e))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,recoveryId:o,instructionIndex:i}=e;return nr.createInstructionWithEthAddress({ethAddress:nr.publicKeyToEthAddress(t),message:n,signature:r,recoveryId:o,instructionIndex:i})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:n,signature:o,recoveryId:i,instructionIndex:s=0}=e;let a;a="string"==typeof t?t.startsWith("0x")?r.hp.from(t.substr(2),"hex"):r.hp.from(t,"hex"):t,$(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const c=12+a.length,u=c+o.length+1,l=r.hp.alloc(tr.span+n.length);return tr.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:s,signature:E(o),ethAddress:E(a),recoveryId:i},l),l.fill(E(n),tr.span),new ie({keys:[],programId:nr.programId,data:l})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:o}=e;$(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{const e=E(t),i=er(e,!1).slice(1),s=r.hp.from((0,m.lY)(E(n))),[a,c]=((e,t)=>{const n=w.bI.sign(e,t);return[n.toCompactRawBytes(),n.recovery]})(s,e);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:c,instructionIndex:o})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}var rr;nr.programId=new P("KeccakSecp256k11111111111111111111111111111");const or=new P("StakeConfig11111111111111111111111111111111");class ir{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class sr{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}rr=sr,sr.default=new rr(0,0,P.default);class ar{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=h.DH("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(cr))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:n}=Se(cr.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new ir(new P(t.staker),new P(t.withdrawer)),lockup:new sr(n.unixTimestamp,n.epoch,new P(n.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),Se(cr.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,stakeAuthorizationType:n}=Se(cr.Authorize,e.data),r={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new P(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(r.custodianPubkey=e.keys[3].pubkey),r}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:o}=Se(cr.AuthorizeWithSeed,e.data),i={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:r,authorityOwner:new P(o),newAuthorizedPubkey:new P(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Se(cr.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Se(cr.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Se(cr.Withdraw,e.data),n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Se(cr.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(lr.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const cr=Object.freeze({Initialize:{index:0,layout:h.w3([h.DH("instruction"),((e="authorized")=>h.w3([G("staker"),G("withdrawer")],e))(),((e="lockup")=>h.w3([h.Wg("unixTimestamp"),h.Wg("epoch"),G("custodian")],e))()])},Authorize:{index:1,layout:h.w3([h.DH("instruction"),G("newAuthorized"),h.DH("stakeAuthorizationType")])},Delegate:{index:2,layout:h.w3([h.DH("instruction")])},Split:{index:3,layout:h.w3([h.DH("instruction"),h.Wg("lamports")])},Withdraw:{index:4,layout:h.w3([h.DH("instruction"),h.Wg("lamports")])},Deactivate:{index:5,layout:h.w3([h.DH("instruction")])},Merge:{index:7,layout:h.w3([h.DH("instruction")])},AuthorizeWithSeed:{index:8,layout:h.w3([h.DH("instruction"),G("newAuthorized"),h.DH("stakeAuthorizationType"),F("authoritySeed"),G("authorityOwner")])}}),ur=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class lr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:n,lockup:r}=e,o=r||sr.default,i=_e(cr.Initialize,{authorized:{staker:E(n.staker.toBuffer()),withdrawer:E(n.withdrawer.toBuffer())},lockup:{unixTimestamp:o.unixTimestamp,epoch:o.epoch,custodian:E(o.custodian.toBuffer())}}),s={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:fe,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new ie(s)}static createAccountWithSeed(e){const t=new se;t.add(Oe.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:o}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:o}))}static createAccount(e){const t=new se;t.add(Oe.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:o}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:o}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:n,votePubkey:r}
1=e,o=_e(cr.Delegate);return(new se).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:me,isSigner:!1,isWritable:!1},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static authorize(e){const{stakePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:o,custodianPubkey:i}=e,s=_e(cr.Authorize,{newAuthorized:E(r.toBuffer()),stakeAuthorizationType:o.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return i&&a.push({pubkey:i,isSigner:!0,isWritable:!1}),(new se).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:n,authoritySeed:r,authorityOwner:o,newAuthorizedPubkey:i,stakeAuthorizationType:s,custodianPubkey:a}=e,c=_e(cr.AuthorizeWithSeed,{newAuthorized:E(i.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:E(o.toBuffer())}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:ue,isSigner:!1,isWritable:!1}];return a&&u.push({pubkey:a,isSigner:!0,isWritable:!1}),(new se).add({keys:u,programId:this.programId,data:c})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:o}=e,i=_e(cr.Split,{lamports:o});return new ie({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static split(e,t){const n=new se;return n.add(Oe.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,t){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:o,basePubkey:i,seed:s,lamports:a}=e,c=new se;return c.add(Oe.allocate({accountPubkey:o,basePubkey:i,seed:s,space:this.space,programId:this.programId})),t&&t>0&&c.add(Oe.transfer({fromPubkey:e.authorizedPubkey,toPubkey:o,lamports:t})),c.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:o,lamports:a}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:n,authorizedPubkey:r}=e,o=_e(cr.Merge);return(new se).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:me,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:n,toPubkey:r,lamports:o,custodianPubkey:i}=e,s=_e(cr.Withdraw,{lamports:o}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:me,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return i&&a.push({pubkey:i,isSigner:!0,isWritable:!1}),(new se).add({keys:a,programId:this.programId,data:s})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:n}=e,r=_e(cr.Deactivate);return(new se).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}lr.programId=new P("Stake11111111111111111111111111111111111111"),lr.space=200;class hr{constructor(e,t,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=t,this.authorizedWithdrawer=n,this.commission=r}}class dr{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=h.DH("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(fr))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);const{voteInit:t}=Se(fr.InitializeAccount,e.data);return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new hr(new P(t.nodePubkey),new P(t.authorizedVoter),new P(t.authorizedWithdrawer),t.commission)}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,voteAuthorizationType:n}=Se(fr.Authorize,e.data);return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new P(t),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:t,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:o}}=Se(fr.AuthorizeWithSeed,e.data);return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new P(t),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new P(r),voteAuthorizationType:{index:o},votePubkey:e.keys[0].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Se(fr.Withdraw,e.data);return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(gr.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const fr=Object.freeze({InitializeAccount:{index:0,layout:h.w3([h.DH("instruction"),((e="voteInit")=>h.w3([G("nodePubkey"),G("authorizedVoter"),G("authorizedWithdrawer"),h.u8("commission")],e))()])},Authorize:{index:1,layout:h.w3([h.DH("instruction"),G("newAuthorized"),h.DH("voteAuthorizationType")])},Withdraw:{index:3,layout:h.w3([h.DH("instruction"),h.Wg("lamports")])},UpdateValidatorIdentity:{index:4,layout:h.w3([h.DH("instruction")])},AuthorizeWithSeed:{index:10,layout:h.w3([h.DH("instruction"),((e="voteAuthorizeWithSeedArgs")=>
1h.w3([h.DH("voteAuthorizationType"),G("currentAuthorityDerivedKeyOwnerPubkey"),F("currentAuthorityDerivedKeySeed"),G("newAuthorized")],e))()])}}),pr=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class gr{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:n,voteInit:r}=e,o=_e(fr.InitializeAccount,{voteInit:{nodePubkey:E(r.nodePubkey.toBuffer()),authorizedVoter:E(r.authorizedVoter.toBuffer()),authorizedWithdrawer:E(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),i={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:fe,isSigner:!1,isWritable:!1},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o};return new ie(i)}static createAccount(e){const t=new se;return t.add(Oe.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){const{votePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:o}=e,i=_e(fr.Authorize,{newAuthorized:E(r.toBuffer()),voteAuthorizationType:o.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new se).add({keys:s,programId:this.programId,data:i})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:o,voteAuthorizationType:i,votePubkey:s}=e,a=_e(fr.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:E(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:E(o.toBuffer()),voteAuthorizationType:i.index}}),c=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:ue,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new se).add({keys:c,programId:this.programId,data:a})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:o}=e,i=_e(fr.Withdraw,{lamports:r}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new se).add({keys:s,programId:this.programId,data:i})}static safeWithdraw(e,t,n){if(e.lamports>t-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return gr.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,nodePubkey:r}=e,o=_e(fr.UpdateValidatorIdentity),i=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new se).add({keys:i,programId:this.programId,data:o})}}gr.programId=new P("Vote111111111111111111111111111111111111111"),gr.space=3762;const yr=new P("Va1idator1nfo111111111111111111111111111111"),mr=(0,f.NW)({name:(0,f.Yj)(),website:(0,f.lq)((0,f.Yj)()),details:(0,f.lq)((0,f.Yj)()),iconUrl:(0,f.lq)((0,f.Yj)()),keybaseUsername:(0,f.lq)((0,f.Yj)())});class wr{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let t=[...e];if(2!==H(t))return null;const n=[];for(let e=0;e<2;e++){const e=new P(X(t,0,C)),r=1===J(t);n.push({publicKey:e,isSigner:r})}if(n[0].publicKey.equals(yr)&&n[1].isSigner){const e=F().decode(r.hp.from(t)),o=JSON.parse(e);return(0,f.vA)(o,mr),new wr(n[1].publicKey,o)}return null}}const vr=new P("Vote111111111111111111111111111111111111111"),br=h.w3([G("nodePubkey"),G("authorizedWithdrawer"),h.u8("commission"),h.I0(),h.O6(h.w3([h.I0("slot"),h.DH("confirmationCount")]),h.cY(h.DH(),-8),"votes"),h.u8("rootSlotValid"),h.I0("rootSlot"),h.I0(),h.O6(h.w3([h.I0("epoch"),G("authorizedVoter")]),h.cY(h.DH(),-8),"authorizedVoters"),h.w3([h.O6(h.w3([G("authorizedPubkey"),h.I0("epochOfLastAuthorizedSwitch"),h.I0("targetEpoch")]),32,"buf"),h.I0("idx"),h.u8("isEmpty")],"priorVoters"),h.I0(),h.O6(h.w3([h.I0("epoch"),h.I0("credits"),h.I0("prevCredits")]),h.cY(h.DH(),-8),"epochCredits"),h.w3([h.I0("slot"),h.I0("timestamp")],"lastTimestamp")]);class Ar{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const t=br.decode(E(e),4);let n=t.rootSlot;return t.rootSlotValid||(n=null),new Ar({nodePubkey:new P(t.nodePubkey),authorizedWithdrawer:new P(t.authorizedWithdrawer),commission:t.commission,votes:t.votes,rootSlot:n,authorizedVoters:t.authorizedVoters.map(kr),priorVoters:Sr(t.priorVoters),epochCredits:t.epochCredits,lastTimestamp:t.lastTimestamp})}}function kr({authorizedVoter:e,epoch:t}){return{epoch:t,authorizedVoter:new P(e)}}function _r({authorizedPubkey:e,epochOfLastAuthorizedSwitch:t,targetEpoch:n}){return{authorizedPubkey:new P(e),epochOfLastAuthorizedSwitch:t,targetEpoch:n}}function Sr({buf:e,idx:t,isEmpty:n}){return n?[]:[...e.slice(t+1).map(_r),...e.slice(0,t).map(_r)]}const Er={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function Tr(e,t){const n=!1===t?"http":"https";if(!e)return Er[n].devnet;const r=Er[n][e];if(!r)throw new Error(`Unknown ${n} cluster: ${e}`);return r}async function Ir(e,t,n,r){let o,i;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(o=n,i=r):i=n;const s=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,minContextSlot:i.minContextSlot},a=await e.sendRawTransaction(t,s),c=i&&i.commitment,u=o?e.confirmTransaction(o,c):e.confirmTransaction(a,c),l=(await u).value;if(l.err){if(null!=a)throw new we({action:s?.skipPreflight?"send":"simulate",signature:a,transactionMessage:`Status: (${JSON.stringify(l)})`});throw new Error(`Raw transaction ${a} failed (${JSON.stringify(l)})`)}return a}const Mr=1e9},5621:(e,t,n)=>{"use strict";var r=n(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.alloc(0);for(var n=0,o=0,i=0;e[n]===c;)o++,n++;for(var s=(e.length-n)*u+1>>>0,l=new Uint8Array(s);n<e.length;){var h=t[e.charCodeAt(n)];if(255===h)return;for(var d=0,f=s-1;(0!==h||d<i)&&-1!==f;f--,d++)h+=a*l[f]>>>0,l[f]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,n++}for(var p=s-i;p!==s&&0===l[p];)p++;var g=r.allocUnsafe(o+(s-p));g.fill(0,0,o);for(var y=o;p!==s;)g[y++]=l[p++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,o=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var u=(s-i)*l+1>>>0,h=new Uint8Array(u);i!==s;){for(var d=t[i],f=0,p=u-1;(0!==d||f<o)&&-1!==p;p--,f++)d+=256*h[p]>>>0,h[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,i++}for(var g=u-o;g!==u&&0===h[g];)g++;for(var y=c.repeat(n);g<u;++g)y+=e.charAt(h[g]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},3466:(e,t,n)=>{var r=n(5621);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8290:(e,t,n)=>{"use strict";const r=n(7526),o=n(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const s=2147483647;function a(e){if(e>
vendor: 6,347 bytes, line 1
1s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(o)return r?-1:q(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function b(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(Z(r))return s;e[n+s]=r}return s}function A(e,t,n,r){return Y(q(t,e.length-n),e,n,r)}function k(e,t,n,r){return Y(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return Y(H(t),e,n,r)}function S(e,t,n,r){return Y(function(e,t){let n,r,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],a=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;
vendor: 5,620 bytes, line 1
1)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if($(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<a;++e)if(u[e]!==l[e]){i=u[e],s=l[e];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return k(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function M(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Q[e[r]];return o}
vendor: 9,469 bytes, line 1
1function C(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function V(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,s=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),s=i.length;
1if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%s]}return this};const j={};function U(e,t,n){j[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||K(t,e.length-(n+1))}(r,o,i)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function J(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},5364:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var o=e.charAt(r),i=o.charCodeAt(0);if(255!==t[i])throw new TypeError(o+" is ambiguous");t[i]=r}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,r=0,o=0;e[n]===a;)r++,n++;for(var i=(e.length-n)*c+1>>>0,u=new Uint8Array(i);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,d=i-1;(0!==l||h<o)&&-1!==d;d--,h++)l+=s*u[d]>>>0,u[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,n++}for(var f=i-o;f!==i&&0===u[f];)f++;for(var p=new Uint8Array(r+(i-f)),g=r;f!==i;)p[g++]=u[f++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,o=0,i=t.length;o!==i&&0===t[o];)o++,n++;for(var c=(i-o)*u+1>>>0,l=new Uint8Array(c);o!==i;){for(var h=t[o],d=0,f=c-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,o++}for(var p=c-r;p!==c&&0===l[p];)p++;for(var g=a.repeat(n);p<c;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},7526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=a(e),s=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}
1(0,s,c)),l=0,h=c>0?s-4:s;for(n=0;n<h;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t),1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],s=16383,a=0,u=r-o;a<u;a+=s)i.push(c(e,a,a+s>u?u:a+s));return 1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=i[s],r[i.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var o,i,s=[],a=t;a<r;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},184:(e,t,n)=>{"use strict";var r=n(8287).Buffer;t.k5=function(e){{const t=r.from(e);t.reverse();const n=t.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}},t.Bq=function(e,t){{const n=e.toString(16),o=r.from(n.padStart(2*t,"0").slice(0,2*t),"hex");return o.reverse(),o}}},1594:function(e,t,n){var r;!function(){"use strict";var o,i=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,a=Math.floor,c="[BigNumber Error] ",u=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,d=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,g=1e9;function y(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=h-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function w(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,c=e.e,u=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;
vendor: 18,244 bytes, line 1
1if(s!=a)return s;if(n=s<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(a=(c=o.length)<(u=i.length)?c:u,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function v(e,t,n,r){if(e<t||e>n||e!==a(e))throw Error(c+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return y(e.e/h)==t&&e.c[t]%2!=0}function A(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function k(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}o=function e(t){var n,r,o,_,S,E,T,I,M,R,x=K.prototype={constructor:K,toString:null,valueOf:null},C=new K(1),O=20,P=4,N=-7,B=21,V=-1e7,L=1e7,D=!1,j=1,U=0,W={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",G=!0;function K(e,t){var n,s,c,l,f,p,g,y,m=this;if(!(m instanceof K))return new K(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>L?m.c=m.e=null:e.e<V?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((p="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);return void(l>L?m.c=m.e=null:(m.e=l,m.c=[e]))}y=String(e)}else{if(!i.test(y=String(e)))return o(m,y,p);m.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(l=y.indexOf("."))>-1&&(y=y.replace(".","")),(f=y.search(/e/i))>0?(l<0&&(l=f),l+=+y.slice(f+1),y=y.substring(0,f)):l<0&&(l=y.length)}else{if(v(t,2,z.length,"Base"),10==t&&G)return Y(m=new K(e),O+m.e+1,P);if(y=String(e),p="number"==typeof e){if(0*e!=0)return o(m,y,p,t);if(m.s=1/e<0?(y=y.slice(1),-1):1,K.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else m.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(n=z.slice(0,t),l=f=0,g=y.length;f<g;f++)if(n.indexOf(s=y.charAt(f))<0){if("."==s){if(f>l){l=g;continue}}else if(!c&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){c=!0,f=-1,l=0;continue}return o(m,String(e),p,t)}p=!1,(l=(y=r(y,t,10,m.s)).indexOf("."))>-1?y=y.replace(".",""):l=y.length}for(f=0;48===y.charCodeAt(f);f++);for(g=y.length;48===y.charCodeAt(--g););if(y=y.slice(f,++g)){if(g-=f,p&&K.DEBUG&&g>15&&(e>d||e!==a(e)))throw Error(u+m.s*e);if((l=l-f-1)>L)m.c=m.e=null;else if(l<V)m.c=[m.e=0];else{if(m.e=l,m.c=[],f=(l+1)%h,l<0&&(f+=h),f<g){for(f&&m.c.push(+y.slice(0,f)),g-=h;f<g;)m.c.push(+y.slice(f,f+=h));f=h-(y=y.slice(f)).length}else f-=g;for(;f--;y+="0");m.c.push(+y)}}else m.c=[m.e=0]}function F(e,t,n,r){var o,i,s,a,c;if(null==n?n=P:v(n,0,8),!e.c)return e.toString();if(o=e.c[0],s=e.e,null==t)c=m(e.c),c=1==r||2==r&&(s<=N||s>=B)?A(c,s):k(c,s,"0");else if(i=(e=Y(new K(e),t,n)).e,a=(c=m(e.c)).length,1==r||2==r&&(t<=i||i<=N)){for(;a<t;c+="0",a++);c=A(c,i)}else if(t-=s,c=k(c,i,"0"),i+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-a)>0)for(i+1==a&&(c+=".");t--;c+="0");return e.s<0&&o?"-"+c:c}function q(e,t){for(var n,r,o=1,i=new K(e[0]);o<e.length;o++)(!(r=new K(e[o])).s||(n=w(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function H(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*h-1)>L?e.c=e.e=null:n<V?e.c=[e.e=0]:(e.e=n,e.c=t),e}function Y(e,t,n,r){var o,i,c,u,d,p,g,y=e.c,m=f;if(y){e:{for(o=1,u=y[0];u>=10;u/=10,o++);if((i=t-o)<0)i+=h,c=t,d=y[p=0],g=a(d/m[o-c-1]%10);else if((p=s((i+1)/h))>=y.length){if(!r)break e;for(;y.length<=p;y.push(0));d=g=0,o=1,c=(i%=h)-h+1}else{for(d=u=y[p],o=1;u>=10;u/=10,o++);g=(c=(i%=h)-h+o)<0?0:a(d/m[o-c-1]%10)}if(r=r||t<0||null!=y[p+1]||(c<0?d:d%m[o-c-1]),r=n<4?(g||r)&&(0==n||n==(e.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(i>0?c>0?d/m[o-c]:0:y[p-1])%10&1||n==(e.s<0?8:7)),t<1||!y[0])return y.length=0,r?(t-=e.e+1,y[0]=m[(h-t%h)%h],e.e=-t||0):y[0]=e.e=0,e;if(0==i?(y.length=p,u=1,p--):(y.length=p+1,u=m[h-i],y[p]=c>0?a(d/m[o-c]%m[c])*u:0),r)for(;;){if(0==p){for(i=1,c=y[0];c>=10;c/=10,i++);for(c=y[0]+=u,u=1;c>=10;c/=10,u++);i!=u&&(e.e++,y[0]==l&&(y[0]=1));break}if(y[p]+=u,y[p]!=l)break;y[p--]=0,u=1}for(i=y.length;0===y[--i];y.pop());}e.e>L?e.c=e.e=null:e.e<V&&(e.c=[e.e=0])}return e}function $(e){var t,n=e.e;return null===n?e.toString():(t=m(e.c),t=n<=N||n>=B?A(t,n):k(t,n,"0"),e.s<0?"-"+t:t)}return K.clone=e,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(v(n=e[t],0,g,t),O=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(v(n=e[t],0,8,t),P=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(v(n[0],-g,0,t),v(n[1],0,g,t),N=n[0],B=n[1]):(v(n,-g,g,t),N=-(B=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)v(n[0],-g,-1,t),v(n[1],1,g,t),V=n[0],L=n[1];else{if(v(n,-g,g,t),!n)throw Error(c+t+" cannot be zero: "+n);V=-(L=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(c+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(c+"crypto unavailable");D=n}else D=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(v(n=e[t],0,9,t),j=n),e.hasOwnProperty(t="POW_PRECISION")&&(v(n=e[t],0,g,t),U=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(c+t+" not an object: "+n);W=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(c+t+" invalid: "+n);G="0123456789"==n.slice(0,10),z=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:P,EXPONENTIAL_AT:[N,B],RANGE:[V,L],CRYPTO:D,MODULO_MODE:j,POW_PRECISION:U,FORMAT:W,ALPHABET:z}},K.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!K.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-g&&o<=g&&o===a(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%h)<1&&(t+=h),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=l||n!==a(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(c+"Invalid BigNumber: "+e)},K.maximum=K.max=function(){return q(arguments,-1)},K.minimum=K.min=function(){return q(arguments,1)},K.random=(_=9007199254740992,S=Math.random()*_&2097151?function(){return a(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,u=0,l=[],d=new K(C);if(null==e?e=O:v(e,0,g),o=s(e/h),D)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));u<o;)(i=131072*t[u]+(t[u+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(l.push(i%1e14),u+=2);u=o/2}else{if(!crypto.randomBytes)throw D=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(o*=7);u<o;)(i=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(l.push(i%1e14),u+=7);u=o/7}if(!D)for(;u<o;)(i=S())<9e15&&(l[u++]=i%1e14);for(o=l[--u],e%=h,o&&e&&(i=f[h-e],l[u]=a(o/i)*i);0===l[u];l.pop(),u--);if(u<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=h);for(u=1,i=l[0];i>=10;i/=10,u++);u<h&&(r-=h-u)}return d.e=r,d.c=l,d}),K.sum=function(){for(var e=1,t=arguments,n=new K(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,s=[0],a=0,c=e.length;a<c;){for(i=s.length;i--;s[i]*=t);for(s[0]+=r.indexOf(e.charAt(a++)),o=0;o<s.length;o++)s[o]>n-1&&(null==s[o+1]&&(s[o+1]=0),s[o+1]+=s[o]/n|0,s[o]%=n)}return s.reverse()}return function(r,o,i,s,a){var c,u,l,h,d,f,p,g,y=r.indexOf("."),w=O,v=P;for(y>=0&&(h=U,U=0,r=r.replace(".",""),f=(g=new K(o)).pow(r.length-y),U=h,g.c=t(k(m(f.c),f.e,"0"),10,i,e),g.e=g.c.length),l=h=(p=t(r,o,i,a?(c=z,e):(c=e,z))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(y<0?--l:(f.c=p,f.e=l,f.s=s,p=(f=n(f,g,w,v,i)).c,d=f.r,l=f.e),y=p[u=l+w+1],h=i/2,d=d||u<0||null!=p[u+1],d=v<4?(null!=y||d)&&(0==v||v==(f.s<0?3:2)):y>h||y==h&&(4==v||d||6==v&&1&p[u-1]||v==(f.s<0?8:7)),u<1||!p[0])r=d?k(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--i;++p[--u]>i;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(y=0,r="";y<=h;r+=c.charAt(p[y++]));r=k(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,s,a=0,c=e.length,u=t%p,l=t/p|0;for(e=e.slice();c--;)a=((o=u*(i=e[c]%p)+(r=l*i+(s=e[c]/p|0)*u)%p*p+a)/n|0)+(r/p|0)+l*s,e[c]=o%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,s,c){var u,d,f,p,g,m,w,v,b,A,k,_,S,E,T,I,M,R=r.s==o.s?1:-1,x=r.c,C=o.c;if(!(x&&x[0]&&C&&C[0]))return new K(r.s&&o.s&&(x?!C||x[0]!=C[0]:C)?x&&0==x[0]||!C?0*R:R/0:NaN);for(b=(v=new K(R)).c=[],R=i+(d=r.e-o.e)+1,c||(c=l,d=y(r.e/h)-y(o.e/h),R=R/h|0),f=0;C[f]==(x[f]||0);f++);if(C[f]>(x[f]||0)&&d--,R<0)b.push(1),p=!0;else{for(E=x.length,I=C.length,f=0,R+=2,(g=a(c/(C[0]+1)))>1&&(C=e(C,g,c),x=e(x,g,c),I=C.length,E=x.length),S=I,k=(A=x.slice(0,I)).length;k<I;A[k++]=0);M=C.slice(),M=[0].concat(M),T=C[0],C[1]>=c/2&&T++;do{if(g=0,(u=t(C,A,I,k))<0){if(_=A[0],I!=k&&(_=_*c+(A[1]||0)),(g=a(_/T))>1)for(g>=c&&(g=c-1),w=(m=e(C,g,c)).length,k=A.length;1==t(m,A,w,k);)g--,n(m,I<w?M:C,w,c),w=m.length,u=1;else 0==g&&(u=g=1),w=(m=C.slice()).length;if(w<k&&(m=[0].concat(m)),n(A,m,k,c),k=A.length,-1==u)for(;t(C,A,I,k)<1;)g++,n(A,I<k?M:C,k,c),k=A.length}else 0===u&&(g++,A=[0]);b[f++]=g,A[0]?A[k++]=x[S]||0:(A=[x[S]],k=1)}while((S++<E||null!=A[0])&&R--);p=null!=A[0],b[0]||b.splice(0,1)}if(c==l){for(f=1,R=b[0];R>=10;R/=10,f++);Y(v,i+(v.e=f+d*h-1)+1,s,p)}else v.e=d,v.r=+p;return v}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,T=/^([^.]+)\.$/,I=/^\.([^.]+)$/,M=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(R,"");if(M.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(E,(function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t})),r&&(o=r,i=i.replace(T,"$1").replace(I,"0.$1")),t!=i))return new K(i,o);if(K.DEBUG)throw Error(c+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new K(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return w(this,new K(e,t))},x.decimalPlaces=x.dp=function(e,t){var n,r,o,i=this;if(null!=e)return v(e,0,g),null==t?t=P:v(t,0,8),Y(new K(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-y(this.e/h))*h,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},x.dividedBy=x.div=function(e,t){return n(this,new K(e,t),O,P)},x.dividedToIntegerBy=x.idiv=function(e,t){return n(this,new K(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var n,r,o,i,u,l,d,f,p=this;if((e=new K(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+$(e));if(null!=t&&(t=new K(t)),u=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return f=new K(Math.pow(+$(p),u?e.s*(2-b(e)):+$(e))),t?f.mod(t):f;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new K(NaN);(r=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||u&&p.c[1]>=24e7:p.c[0]<8e13||u&&p.c[0]<=9999975e7)))return i=p.s<0&&b(e)?-0:0,p.e>-1&&(i=1/i),new K(l?1/i:i);U&&(i=s(U/h+2))}for(u?(n=new K(.5),l&&(e.s=1),d=b(e)):d=(o=Math.abs(+$(e)))%2,f=new K(C);;){if(d){if(!(f=f.times(p)).c)break;i?f.c.length>i&&(f.c.length=i):r&&(f=f.mod(t))}if(o){if(0===(o=a(o/2)))break;d=o%2}else if(Y(e=e.times(n),e.e+1,1),e.e>14)d=b(e);else{if(0==(o=+$(e)))break;d=o%2}p=p.times(p),i?p.c&&p.c.length>i&&(p.c.length=i):r&&(p=p.mod(t))}return r?f:(l&&(f=C.div(f)),t?f.mod(t):i?Y(f,U,P,void 0):f)},x.integerValue=function(e){var t=new K(this);return null==e?e=P:v(e,0,8),Y(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===w(this,new K(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return w(this,new K(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=w(this,new K(e,t)))||0===t},x.isInteger=function(){return!!this.c&&y(this.e/h)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return w(this,new K(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=w(this,new K(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var n,r,o,i,s=this,a=s.s;if(t=(e=new K(e,t)).s,!a||!t)return new K(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/h,u=e.e/h,d=s.c,f=e.c;if(!c||!u){if(!d||!f)return d?(e.s=-t,e):new K(f?s:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new K(d[0]?s:3==P?-0:0)}if(c=y(c),u=y(u),d=d.slice(),a=c-u){for((i=a<0)?(a=-a,o=d):(u=c,o=f),o.reverse(),t=a;t--;o.push(0));o.reverse()}else for(r=(i=(a=d.length)<(t=f.length))?a:t,a=t=0;t<r;t++)if(d[t]!=f[t]){i=d[t]<f[t];break}if(i&&(o=d,d=f,f=o,e.s=-e.s),(t=(r=f.length)-(n=d.length))>0)for(;t--;d[n++]=0);for(t=l-1;r>a;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=l}d[r]-=f[r]}for(;0==d[0];d.splice(0,1),--u);return d[0]?H(e,d,u):(e.s=3==P?-1:1,e.c=[e.e=0],e)},x.modulo=x.mod=function(e,t){var r,o,i=this;return e=new K(e,t),!i.c||!e.s||e.c&&!e.c[0]?new K(NaN):!e.c||i.c&&!i.c[0]?new K(i):(9==j?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,j),(e=i.minus(r.times(e))).c[0]||1!=j||(e.s=i.s),e)},x.multipliedBy=x.times=function(e,t){var n,r,o,i,s,a,c,u,d,f,g,m,w,v,b,A=this,k=A.c,_=(e=new K(e,t)).c;if(!(k&&_&&k[0]&&_[0]))return!A.s||!e.s||k&&!k[0]&&!_||_&&!_[0]&&!k?e.c=e.e=e.s=null:(e.s*=A.s,k&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=y(A.e/h)+y(e.e/h),e.s*=A.s,(c=k.length)<(f=_.length)&&(w=k,k=_,_=w,o=c,c=f,f=o),o=c+f,w=[];o--;w.push(0));for(v=l,b=p,o=f;--o>=0;){for(n=0,g=_[o]%b,m=_[o]/b|0,i=o+(s=c);i>o;)n=((u=g*(u=k[--s]%b)+(a=m*u+(d=k[s]/b|0)*g)%b*b+w[i]+n)/v|0)+(a/b|0)+m*d,w[i--]=u%v;w[i]=n}return n?++r:w.splice(0,1),H(e,w,r)},x.negated=function(){var e=new K(this);return e.s=-e.s||null,e},x.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new K(e,t)).s,!o||!t)return new K(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/h,s=e.e/h,a=r.c,c=e.c;if(!i||!s){if(!a||!c)return new K(o/0);if(!a[0]||!c[0])return c[0]?e:new K(a[0]?r:0*o)}if(i=y(i),s=y(s),a=a.slice(),o=i-s){for(o>0?(s=i,n=c):(o=-o,n=a),n.reverse();o--;n.push(0));n.reverse()}for((o=a.length)-(t=c.length)<0&&(n=c,c=a,a=n,t=o),o=0;t;)o=(a[--t]=a[t]+c[t]+o)/l|0,a[t]=l===a[t]?0:a[t]%l;return o&&(a=[o].concat(a),++s),H(e,a,s)},x.precision=x.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return v(e,1,g),null==t?t=P:v(t,0,8),Y(new K(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*h+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},x.shiftedBy=function(e){return v(e,-9007199254740991,d),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,r,o,i,s=this,a=s.c,c=s.s,u=s.e,l=O+4,h=new K("0.5");if(1!==c||!a||!a[0])return new K(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+$(s)))||c==1/0?(((t=m(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=y((u+1)/2)-(u<0||u%2),r=new K(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new K(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=h.times(i.plus(n(s,i,l,1))),m(i.c).slice(0,c)===(t=m(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(r,r.e+O+2,1),e=!r.times(r).eq(s));break}if(!o&&(Y(i,i.e+O+2,0),i.times(i).eq(s))){r=i;break}l+=4,c+=4,o=1}return Y(r,r.e+O+1,P,e)},x.toExponential=function(e,t){return null!=e&&(v(e,0,g),e++),F(this,e,t,1)},x.toFixed=function(e,t){return null!=e&&(v(e,0,g),e=e+this.e+1),F(this,e,t)},x.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=W;else if("object"!=typeof n)throw Error(c+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,s=r.split("."),a=+n.groupSize,u=+n.secondaryGroupSize,l=n.groupSeparator||"",h=s[0],d=s[1],f=o.s<0,p=f?h.slice(1):h,g=p.length;if(u&&(i=a,a=u,u=i,g-=i),a>0&&g>0){for(i=g%a||a,h=p.substr(0,i);i<g;i+=a)h+=l+p.substr(i,a);u>0&&(h+=l+p.slice(i)),f&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},x.toFraction=function(e){var t,r,o,i,s,a,u,l,d,p,g,y,w=this,v=w.c;if(null!=e&&(!(u=new K(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+$(u));if(!v)return new K(w);for(t=new K(C),d=r=new K(C),o=l=new K(C),y=m(v),s=t.e=y.length-w.e-1,t.c[0]=f[(a=s%h)<0?h+a:a],e=!e||u.comparedTo(t)>0?s>0?t:d:u,a=L,L=1/0,u=new K(y),l.c[0]=0;p=n(u,t,0,1),1!=(i=r.plus(p.times(o))).comparedTo(e);)r=o,o=i,d=l.plus(p.times(i=d)),l=i,t=u.minus(p.times(i=t)),u=i;return i=n(e.minus(r),o,0,1),l=l.plus(i.times(d)),r=r.plus(i.times(o)),l.s=d.s=w.s,g=n(d,o,s*=2,P).minus(w).abs().comparedTo(n(l,r,s,P).minus(w).abs())<1?[d,o]:[l,r],L=a,g},x.toNumber=function(){return+$(this)},x.toPrecision=function(e,t){return null!=e&&v(e,1,g),F(this,e,t,2)},x.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=N||i>=B?A(m(n.c),i):k(m(n.c),i,"0"):10===e&&G?t=k(m((n=Y(new K(n),O+i+1,P)).c),n.e,"0"):(v(e,2,z.length,"Base"),t=r(k(m(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return $(this)},x._isBigNumber=!0,null!=t&&K.set(t),K}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(t,n,t,e))||(e.exports=r)}()},9404:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;
vendor: 4,468 bytes, line 1
1"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(7790).Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,o){for(var i=0,s=0,a=Math.min(e.length,n),c=t;c<a;c++){var u=e.charCodeAt(c)-48;i*=o,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<o,"Invalid character"),i+=s}return i}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,s,a=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var o,i=0,s=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)o=c(e,t,r)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=c(e,t,r)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,o=1;o<=67108863;o*=t)r++;r--,o=o/t|0;for(var i=e.length-n,s=i%r,a=Math.min(i,i-s)+n,c=0,l=n;l<a;l+=r)c=u(e,l,l+r,t),this.imuln(o),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=u(e,l,e.length,t),l=0;l<s;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16
vendor: 6,616 bytes, line 1
1777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var o=0|e.words[0],i=0|t.words[0],s=o*i,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var u=1;u<r;u++){for(var l=c>>>26,h=67108863&c,d=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=d;f++){var p=u-f|0;l+=(s=(o=0|e.words[p])*(i=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[u]=0|h,c=0|l}return 0!==c?n.words[u]=0|c:n.length--,n._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<o|i)).toString(16);i=a>>>24-o&16777215,(o+=2)>=26&&(o-=26,s--),n=0!==i||s!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],l=p[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(l).toString(e);n=(h=h.idivn(l)).isZero()?g+n:d[u-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,o),s},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|r;e[n++]=255&s,n<e.length&&(e[n++]=s>>8&255),n<e.length&&(e[n++]=s>>16&255),6===i?(n<e.length&&(e[n++]=s>>24&255),r=0,i=0):(r=s>>>24,i+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|r;e[n--]=255&s,n>=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===i?(n>=0&&(e[n--]=s>>24&255),r=0,i=0):(r=s>>>24,i+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var o=0,i=0;i<r.length;i++)t=(0|n.words[i])+(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<n.length;i++)t=(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=n.length,0!==o)this.words[this.length]=o,this.length++;else if(n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;
vendor: 7,414 bytes, line 1
1var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(n=this,r=e):(n=e,r=this);for(var i=0,s=0;s<r.length;s++)i=(t=(0|n.words[s])-(0|r.words[s])+i)>>26,this.words[s]=67108863&t;for(;0!==i&&s<n.length;s++)i=(t=(0|n.words[s])+i)>>26,this.words[s]=67108863&t;if(0===i&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,o,i,s=e.words,a=t.words,c=n.words,u=0,l=0|s[0],h=8191&l,d=l>>>13,f=0|s[1],p=8191&f,g=f>>>13,y=0|s[2],m=8191&y,w=y>>>13,v=0|s[3],b=8191&v,A=v>>>13,k=0|s[4],_=8191&k,S=k>>>13,E=0|s[5],T=8191&E,I=E>>>13,M=0|s[6],R=8191&M,x=M>>>13,C=0|s[7],O=8191&C,P=C>>>13,N=0|s[8],B=8191&N,V=N>>>13,L=0|s[9],D=8191&L,j=L>>>13,U=0|a[0],W=8191&U,z=U>>>13,G=0|a[1],K=8191&G,F=G>>>13,q=0|a[2],H=8191&q,Y=q>>>13,$=0|a[3],Z=8191&$,Q=$>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],ne=8191&te,re=te>>>13,oe=0|a[6],ie=8191&oe,se=oe>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],he=8191&le,de=le>>>13,fe=0|a[9],pe=8191&fe,ge=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ye=(u+(r=Math.imul(h,W))|0)+((8191&(o=(o=Math.imul(h,z))+Math.imul(d,W)|0))<<13)|0;u=((i=Math.imul(d,z))+(o>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(p,W),o=(o=Math.imul(p,z))+Math.imul(g,W)|0,i=Math.imul(g,z);var me=(u+(r=r+Math.imul(h,K)|0)|0)+((8191&(o=(o=o+Math.imul(h,F)|0)+Math.imul(d,K)|0))<<13)|0;u=((i=i+Math.imul(d,F)|0)+(o>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(m,W),o=(o=Math.imul(m,z))+Math.imul(w,W)|0,i=Math.imul(w,z),r=r+Math.imul(p,K)|0,o=(o=o+Math.imul(p,F)|0)+Math.imul(g,K)|0,i=i+Math.imul(g,F)|0;var we=(u+(r=r+Math.imul(h,H)|0)|0)+((8191&(o=(o=o+Math.imul(h,Y)|0)+Math.imul(d,H)|0))<<13)|0;u=((i=i+Math.imul(d,Y)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(b,W),o=(o=Math.imul(b,z))+Math.imul(A,W)|0,i=Math.imul(A,z),r=r+Math.imul(m,K)|0,o=(o=o+Math.imul(m,F)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,F)|0,r=r+Math.imul(p,H)|0,o=(o=o+Math.imul(p,Y)|0)+Math.imul(g,H)|0,i=i+Math.imul(g,Y)|0;var ve=(u+(r=r+Math.imul(h,Z)|0)|0)+((8191&(o=(o=o+Math.imul(h,Q)|0)+Math.imul(d,Z)|0))<<13)|0;u=((i=i+Math.imul(d,Q)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(_,W),o=(o=Math.imul(_,z))+Math.imul(S,W)|0,i=Math.imul(S,z),r=r+Math.imul(b,K)|0,o=(o=o+Math.imul(b,F)|0)+Math.imul(A,K)|0,i=i+Math.imul(A,F)|0,r=r+Math.imul(m,H)|0,o=(o=o+Math.imul(m,Y)|0)+Math.imul(w,H)|0,i=i+Math.imul(w,Y)|0,r=r+Math.imul(p,Z)|0,o=(o=o+Math.imul(p,Q)|0)+Math.imul(g,Z)|0,i=i+Math.imul(g,Q)|0;var be=(u+(r=r+Math.imul(h,X)|0)|0)+((8191&(o=(o=o+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;u=((i=i+Math.imul(d,ee)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(T,W),o=(o=Math.imul(T,z))+Math.imul(I,W)|0,i=Math.imul(I,z),r=r+Math.imul(_,K)|0,o=(o=o+Math.imul(_,F)|0)+Math.imul(S,K)|0,i=i+Math.imul(S,F)|0,r=r+Math.imul(b,H)|0,o=(o=o+Math.imul(b,Y)|0)+Math.imul(A,H)|0,i=i+Math.imul(A,Y)|0,r=r+Math.imul(m,Z)|0,o=(o=o+Math.imul(m,Q)|0)+Math.imul(w,Z)|0,i=i+Math.imul(w,Q)|0,r=r+Math.imul(p,X)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(g,X)|0,i=i+Math.imul(g,ee)|0;var Ae=(u+(r=r+Math.imul(h,ne)|0)|0)+((8191&(o=(o=o+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;u=((i=i+Math.imul(d,re)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,W),o=(o=Math.imul(R,z))+Math.imul(x,W)|0,i=Math.imul(x,z),r=r+Math.imul(T,K)|0,o=(o=o+Math.imul(T,F)|0)+Math.imul(I,K)|0,i=i+Math.imul(I,F)|0,r=r+Math.imul(_,H)|0,o=(o=o+Math.imul(_,Y)|0)+Math.imul(S,H)|0,i=i+Math.imul(S,Y)|0,r=r+Math.imul(b,Z)|0,o=(o=o+Math.imul(b,Q)|0)+Math.imul(A,Z)|0,i=i+Math.imul(A,Q)|0,r=r+Math.imul(m,X)|0,o=(o=o+Math.imul(m,ee)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,ee)|0,r=r+Math.imul(p,ne)|0,o=(o=o+Math.imul(p,re)|0)+Math.imul(g,ne)|0,i=i+Math.imul(g,re)|0;var ke=(u+(r=r+Math.imul(h,ie)|0)|0)+((8191&(o=(o=o+Math.imul(h,se)|0)+Math.imul(d,ie)|0))<<13)|0;u=((i=i+Math.imul(d,se)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(O,W),o=(o=Math.imul(O,z))+Math.imul(P,W)|0,i=Math.imul(P,z),r=r+Math.imul(R,K)|0,o=(o=o+Math.imul(R,F)|0)+Math.imul(x,K)|0,i=i+Math.imul(x,F)|0,r=r+Math.imul(T,H)|0,o=(o=o+Math.imul(T,Y)|0)+Math.imul(I,H)|0,i=i+Math.imul(I,Y)|0,r=r+Math.imul(_,Z)|0,o=(o=o+Math.imul(_,Q)|0)+Math.imul(S,Z)|0,i=i+Math.imul(S,Q)|0,r=r+Math.imul(b,X)|0,o=(o=o+Math.imul(b,ee)|0)+Math.imul(A,X)|0,i=i+Math.imul(A,ee)|0,r=r+Math.imul(m,ne)|0,o=(o=o+Math.imul(m,re)|0)+Math.imul(w,ne)|0,i=i+Math.imul(w,re)|0,r=r+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,se)|0)+Math.imul(g,ie)|0,i=i+Math.imul(g,se)|0;var _e=(u+(r=r+Math.imul(h,ce)|0)|0)+((8191&(o=(o=o+Math.imul(h,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((i=i+Math.imul(d,ue)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(B,W),o=(o=Math.imul(B,z))+Math.imul(V,W)|0,i=Math.imul(V,z),r=r+Math.imul(O,K)|0,o=(o=o+Math.imul(O,F)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,F)|0,r=r+Math.imul(R,H)|0,o=(o=o+Math.imul(R,Y)|0)+Math.imul(x,H)|0,i=i+Math.imul(x,Y)|0,r=r+Math.imul(T,Z)|0,o=(o=o+Math.imul(T,Q)|0)+Math.imul(I,Z)|0,i=i+Math.imul(I,Q)|0,r=r+Math.imul(_,X)|0,o=(o=o+Math.imul(_,ee)|0)+Math.imul(S,X)|0,i=i+Math.imul(S,ee)|0,r=r+Math.imul(b,ne)|0,o=(o=o+Math.imul(b,re)|0)+Math.imul(A,ne)|0,i=i+Math.imul(A,re)|0,r=r+Math.imul(m,ie)|0,o=(o=o+Math.imul(m,se)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,se)|0,r=r+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(g,ce)|0,i=i+Math.imul(g,ue)|0;var Se=(u+(r=r+Math.imul(h,he)|0)|0)+((8191&(o=(o=o+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;u=((i=i+Math.imul(d,de)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(D,W),o=(o=Math.imul(D,z))+Math.imul(j,W)|0,i=Math.imul(j,z),r=r+Math.imul(B,K)|0,o=(o=o+Math.imul(B,F)|0)+Math.imul(V,K)|0,i=i+Math.imul(V,F)|0,r=r+Math.imul(O,H)|0,o=(o=o+Math.imul(O,Y)|0)+Math.imul(P,H)|0,i=i+Math.imul(P,Y)|0,r=r+Math.imul(R,Z)|0,o=(o=o+Math.imul(R,Q)|0)+Math.imul(x,Z)|0,i=i+Math.imul(x,Q)|0,r=r+Math.imul(T,X)|0,o=(o=o+Math.imul(T,ee)|0)+Math.imul(I,X)|0,i=i+Math.imul(I,ee)|0,r=r+Math.imul(_,ne)|0,o=(o=o+Math.imul(_,re)|0)+Math.imul(S,ne)|0,i=i+Math.imul(S,re)|0,r=r+Math.imul(b,ie)|0,o=(o=o+Math.imul(b,se)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,se)|0,r=r+Math.imul(m,ce)|0,o=(o=o+Math.imul(m,ue)|0)+Math.imul(w,ce)|0,i=i+Math.imul(w,ue)|0,r=r+Math.imul(p,he)|0,o=(o=o+Math.imul(p,de)|0)+Math.imul(g,he)|0,i=i+Math.imul(g,de)|0;var Ee=(u+(r=r+Math.imul(h,pe)|0)|0)+((8191&(o=(o=o+Math.imul(h,ge)|0)+Math.imul(d,pe)|0))<<13)|0;u=((i=i+Math.imul(d,ge)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(D,K),o=(o=Math.imul(D,F))+Math.imul(j,K)|0,i=Math.imul(j,F),r=r+Math.imul(B,H)|0,o=(o=o+Math.imul(B,Y)|0)+Math.imul(V,H)|0,i=i+Math.imul(V,Y)|0,r=r+Math.imul(O,Z)|0,o=(o=o+Math.imul(O,Q)|0)+Math.imul(P,Z)|0,i=i+Math.imul(P,Q)|0,r=r+Math.imul(R,X)|0,o=(o=o+Math.imul(R,ee)|0)+Math.imul(x,X)|0,i=i+Math.imul(x,ee)|0,r=r+Math.imul(T,ne)|0,o=(o=o+Math.imul(T,re)|0)+Math.imul(I,ne)|0,i=i+Math.imul(I,re)|0,r=r+Math.imul(_,ie)|0,o=(o=o+Math.imul(_,se)|0)+Math.imul(S,ie)|0,i=i+Math.imul(S,se)|0,r=r+Math.imul(b,ce)|0,o=(o=o+Math.imul(b,ue)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,r=r+Math.imul(m,he)|0,o=(o=o+Math.imul(m,de)|0)+Math.imul(w,he)|0,i=i+Math.imul(w,de)|0;var Te=(u+(r=r+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,ge)|0)+Math.imul(g,pe)|0)
vendor: 4,239 bytes, line 1
1)<<13)|0;u=((i=i+Math.imul(g,ge)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(D,H),o=(o=Math.imul(D,Y))+Math.imul(j,H)|0,i=Math.imul(j,Y),r=r+Math.imul(B,Z)|0,o=(o=o+Math.imul(B,Q)|0)+Math.imul(V,Z)|0,i=i+Math.imul(V,Q)|0,r=r+Math.imul(O,X)|0,o=(o=o+Math.imul(O,ee)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,ee)|0,r=r+Math.imul(R,ne)|0,o=(o=o+Math.imul(R,re)|0)+Math.imul(x,ne)|0,i=i+Math.imul(x,re)|0,r=r+Math.imul(T,ie)|0,o=(o=o+Math.imul(T,se)|0)+Math.imul(I,ie)|0,i=i+Math.imul(I,se)|0,r=r+Math.imul(_,ce)|0,o=(o=o+Math.imul(_,ue)|0)+Math.imul(S,ce)|0,i=i+Math.imul(S,ue)|0,r=r+Math.imul(b,he)|0,o=(o=o+Math.imul(b,de)|0)+Math.imul(A,he)|0,i=i+Math.imul(A,de)|0;var Ie=(u+(r=r+Math.imul(m,pe)|0)|0)+((8191&(o=(o=o+Math.imul(m,ge)|0)+Math.imul(w,pe)|0))<<13)|0;u=((i=i+Math.imul(w,ge)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(D,Z),o=(o=Math.imul(D,Q))+Math.imul(j,Z)|0,i=Math.imul(j,Q),r=r+Math.imul(B,X)|0,o=(o=o+Math.imul(B,ee)|0)+Math.imul(V,X)|0,i=i+Math.imul(V,ee)|0,r=r+Math.imul(O,ne)|0,o=(o=o+Math.imul(O,re)|0)+Math.imul(P,ne)|0,i=i+Math.imul(P,re)|0,r=r+Math.imul(R,ie)|0,o=(o=o+Math.imul(R,se)|0)+Math.imul(x,ie)|0,i=i+Math.imul(x,se)|0,r=r+Math.imul(T,ce)|0,o=(o=o+Math.imul(T,ue)|0)+Math.imul(I,ce)|0,i=i+Math.imul(I,ue)|0,r=r+Math.imul(_,he)|0,o=(o=o+Math.imul(_,de)|0)+Math.imul(S,he)|0,i=i+Math.imul(S,de)|0;var Me=(u+(r=r+Math.imul(b,pe)|0)|0)+((8191&(o=(o=o+Math.imul(b,ge)|0)+Math.imul(A,pe)|0))<<13)|0;u=((i=i+Math.imul(A,ge)|0)+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(D,X),o=(o=Math.imul(D,ee))+Math.imul(j,X)|0,i=Math.imul(j,ee),r=r+Math.imul(B,ne)|0,o=(o=o+Math.imul(B,re)|0)+Math.imul(V,ne)|0,i=i+Math.imul(V,re)|0,r=r+Math.imul(O,ie)|0,o=(o=o+Math.imul(O,se)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,se)|0,r=r+Math.imul(R,ce)|0,o=(o=o+Math.imul(R,ue)|0)+Math.imul(x,ce)|0,i=i+Math.imul(x,ue)|0,r=r+Math.imul(T,he)|0,o=(o=o+Math.imul(T,de)|0)+Math.imul(I,he)|0,i=i+Math.imul(I,de)|0;var Re=(u+(r=r+Math.imul(_,pe)|0)|0)+((8191&(o=(o=o+Math.imul(_,ge)|0)+Math.imul(S,pe)|0))<<13)|0;u=((i=i+Math.imul(S,ge)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(D,ne),o=(o=Math.imul(D,re))+Math.imul(j,ne)|0,i=Math.imul(j,re),r=r+Math.imul(B,ie)|0,o=(o=o+Math.imul(B,se)|0)+Math.imul(V,ie)|0,i=i+Math.imul(V,se)|0,r=r+Math.imul(O,ce)|0,o=(o=o+Math.imul(O,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,r=r+Math.imul(R,he)|0,o=(o=o+Math.imul(R,de)|0)+Math.imul(x,he)|0,i=i+Math.imul(x,de)|0;var xe=(u+(r=r+Math.imul(T,pe)|0)|0)+((8191&(o=(o=o+Math.imul(T,ge)|0)+Math.imul(I,pe)|0))<<13)|0;u=((i=i+Math.imul(I,ge)|0)+(o>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(D,ie),o=(o=Math.imul(D,se))+Math.imul(j,ie)|0,i=Math.imul(j,se),r=r+Math.imul(B,ce)|0,o=(o=o+Math.imul(B,ue)|0)+Math.imul(V,ce)|0,i=i+Math.imul(V,ue)|0,r=r+Math.imul(O,he)|0,o=(o=o+Math.imul(O,de)|0)+Math.imul(P,he)|0,i=i+Math.imul(P,de)|0;var Ce=(u+(r=r+Math.imul(R,pe)|0)|0)+((8191&(o=(o=o+Math.imul(R,ge)|0)+Math.imul(x,pe)|0))<<13)|0;u=((i=i+Math.imul(x,ge)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(D,ce),o=(o=Math.imul(D,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),r=r+Math.imul(B,he)|0,o=(o=o+Math.imul(B,de)|0)+Math.imul(V,he)|0,i=i+Math.imul(V,de)|0;var Oe=(u+(r=r+Math.imul(O,pe)|0)|0)+((8191&(o=(o=o+Math.imul(O,ge)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,ge)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(D,he),o=(o=Math.imul(D,de))+Math.imul(j,he)|0,i=Math.imul(j,de);var Pe=(u+(r=r+Math.imul(B,pe)|0)|0)+((8191&(o=(o=o+Math.imul(B,ge)|0)+Math.imul(V,pe)|0))<<13)|0;u=((i=i+Math.imul(V,ge)|0)+(o>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(r=Math.imul(D,pe))|0)+((8191&(o=(o=Math.imul(D,ge))+Math.imul(j,pe)|0))<<13)|0;return u=((i=Math.imul(j,ge))+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=me,c[2]=we,c[3]=ve,c[4]=be,c[5]=Ae,c[6]=ke,c[7]=_e,c[8]=Se,c[9]=Ee,c[10]=Te,c[11]=Ie,c[12]=Me,c[13]=Re,c[14]=xe,c[15]=Ce,c[16]=Oe,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,o=0,i=0;i<n.length-1;i++){var s=o;o=0;for(var a=67108863&r,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,h=(0|e.words[l])*(0|t.words[u]),d=67108863&h;a=67108863&(d=d+a|0),o+=(s=(s=s+(h/67108864|0)|0)+(d>>>
vendor: 4,548 bytes, line 1
126)|0)>>>26,s&=67108863}n.words[i]=a,r=s,s=o}return 0!==r?n.words[i]=r:n.length--,n._strip()}function w(e,t,n){return m(e,t,n)}function v(e,t){this.x=e,this.y=t}Math.imul||(y=g),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?g(this,e,t):n<1024?m(this,e,t):w(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},v.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,o=0;o<t;o++)r|=(1&e)<<t-o-1,e>>=1;return r},v.prototype.permute=function(e,t,n,r,o,i){for(var s=0;s<i;s++)r[s]=t[e[s]],o[s]=n[e[s]]},v.prototype.transform=function(e,t,n,r,o,i){this.permute(i,e,t,n,r,o);for(var s=1;s<o;s<<=1)for(var a=s<<1,c=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<o;l+=a)for(var h=c,d=u,f=0;f<s;f++){var p=n[l+f],g=r[l+f],y=n[l+f+s],m=r[l+f+s],w=h*y-d*m;m=h*m+d*y,y=w,n[l+f]=p+y,r[l+f]=g+m,n[l+f+s]=p-y,r[l+f+s]=g-m,f!==a&&(w=c*h-u*d,d=c*d+u*h,h=w)}},v.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,o=0;for(n=n/2|0;n;n>>>=1)o++;return 1<<o+1+r},v.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var o=e[r];e[r]=e[n-r-1],e[n-r-1]=o,o=t[r],t[r]=-t[n-r-1],t[n-r-1]=-o}},v.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var o=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&o,n=o<67108864?0:o/67108864|0}return e},v.prototype.convert13b=function(e,t,n,o){for(var i=0,s=0;s<t;s++)i+=0|e[s],n[2*s]=8191&i,i>>>=13,n[2*s+1]=8191&i,i>>>=13;for(s=2*t;s<o;++s)n[s]=0;r(0===i),r(!(-8192&i))},v.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},v.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),o=this.makeRBT(r),i=this.stub(r),s=new Array(r),a=new Array(r),c=new Array(r),u=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(e.words,e.length,s,r),this.convert13b(t.words,t.length,u,r),this.transform(s,i,a,c,r,o),this.transform(u,i,l,h,r,o);for(var f=0;f<r;f++){var p=a[f]*l[f]-c[f]*h[f];c[f]=a[f]*h[f]+c[f]*l[f],a[f]=p}return this.conjugate(a,c,r),this.transform(a,c,d,i,r,o),this.conjugate(d,i,r),this.normalize13b(d,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),w(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,o=0;o<this.length;o++){var i=(0|this.words[o])*e,s=(67108863&i)+(67108863&n);n>>=26,n+=i/67108864|0,n+=s>>>26,this.words[o]=67108863&s}return 0!==n&&(this.words[o]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,o=n%26;t[n]=e.words[r]>>>o&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&i,c=(0|this.words[t])-a<<n;this.words[t]=c|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,s=Math.min((e-i)/26,this.length),a=67108863^67108863>>>i<<i,c=n;if(o-=s,o=Math.max(0,o),c){for(var u=0;u<s;u++)c.words[u]=this.words[u];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var h=0|this.words[u];this.words[u]=l<<26-i|h>>>i,l=h&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n
vendor: 15,315 bytes, line 1
1)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n||!(this.words[n]&o))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var o,i,s=e.length+n;this._expand(s);var a=0;for(o=0;o<e.length;o++){i=(0|this.words[o+n])+a;var c=(0|e.words[o])*t;a=((i-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&i}for(;o<this.length-n;o++)a=(i=(0|this.words[o+n])+a)>>26,this.words[o+n]=67108863&i;if(0===a)return this._strip();for(r(-1===a),a=0,o=0;o<this.length;o++)a=(i=-(0|this.words[o])+a)>>26,this.words[o]=67108863&i;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,c=r.length-o.length;if("mod"!==t){(a=new i(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=r.clone()._ishlnsubmul(o,1,c);0===l.negative&&(r=l,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),o=e.andln(1),i=n.cmp(r);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,o=0,i=this.length-1;i>=0;i--)o=(n*o+(0|this.words[i]))%e;return t?-o:o},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,o=this.length-1;o>=0;o--){var i=(0|this.words[o])+67108864*n;this.words[o]=i/e|0,n=i%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;!(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;!(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(c)):(n.isub(t),a.isub(o),c.isub(s))}return{a,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var h=0,d=1;!(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var o=t.cmp(n);if(o<0){var i=t;t=n,n=i}else if(0===o||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,s=n;0!==i&&s<this.length;s++){var a=0|this.words[s];i=(a+=i)>>>26,a&=67108863,this.words[s]=a}return 0!==i&&(this.words[s]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],o=0|e.words[n];if(r!==o){r<o?t=-1:r>o&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new T(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function A(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){A.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){A.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){A.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){A.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}A.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},A.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},A.prototype.split=function(e,t){e.iushrn(this.n,0,t)},A.prototype.imulK=function(e){return e.imul(this.k)},o(k,A),k.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),o=0;o<r;o++)t.words[o]=e.words[o];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&n,o=10;o<e.length;o++){var s=0|e.words[o];e.words[o-10]=(s&n)<<4|i>>>22,i=s}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},k.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(_,A),o(S,A),o(E,A),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,o=67108863&r;r>>>=26,e.words[n]=o,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new k;else if("p224"===e)t=new _;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return b[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},T.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var g=f,y=0;0!==g.cmp(a);y++)g=g.redSqr();r(y<p);var m=this.pow(h,new i(1).iushln(p-y-1));d=d.redMul(m),h=m.redSqr(),f=f.redMul(h),p=y}return d},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],s=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var u=t.words[r],l=c-1;l>=0;l--){var h=u>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===l)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}
vendor: 2,577 bytes, line 1
1c=26}return o},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new I(e)},o(I,T),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},2755:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeUnchecked=t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;const u=c(n(9404)),l=c(n(4989)),h=a(n(4281)),d=new("function"!=typeof TextDecoder?h.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=r.from(e,"utf8")),l.default.encode(r.from(e))},t.baseDecode=function(e){return r.from(l.default.decode(e))};const f=1024;
1class p extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=p;class g{constructor(){this.buf=r.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=r.concat([this.buf,r.alloc(f)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(r.from(new u.default(e).toArray("le",64)))}writeBuffer(e){this.buf=r.concat([r.from(this.buf.subarray(0,this.length)),e,r.alloc(f)]),this.length+=e.length}writeString(e){this.maybeResize();const t=r.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(r.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function y(e,t,n){const r=n.value;n.value=function(...e){try{return r.apply(this,e)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new p("Reached the end of buffer when deserializing")}throw e}}}t.BinaryWriter=g;class m{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new u.default(e,"le")}readU128(){const e=this.readBuffer(16);return new u.default(e,"le")}readU256(){const e=this.readBuffer(32);return new u.default(e,"le")}readU512(){const e=this.readBuffer(64);return new u.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new p(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return d.decode(t)}catch(e){throw new p(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let r=0;r<t;++r)n.push(e());return n}}function w(e){return e.charAt(0).toUpperCase()+e.slice(1)}function v(e,t,n,r,o){try{if("string"==typeof r)o[`write${w(r)}`](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new p(`Expecting byte array of length ${r[0]}, but got ${n.length} bytes`);o.writeFixedArray(n)}else if(2===r.length&&"number"==typeof r[1]){if(n.length!==r[1])throw new p(`Expecting byte array of length ${r[1]}, but got ${n.length} bytes`);for(let t=0;t<r[1];t++)v(e,null,n[t],r[0],o)}else o.writeArray(n,(n=>{v(e,t,n,r[0],o)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?o.writeU8(0):(o.writeU8(1),v(e,t,n,r.type,o));break;case"map":o.writeU32(n.size),n.forEach(((n,i)=>{v(e,t,i,r.key,o),v(e,t,n,r.value,o)}));break;default:throw new p(`FieldType ${r} unrecognized`)}else b(e,n,o)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function b(e,t,n){if("function"==typeof t.borshSerialize)return void t.borshSerialize(n);const r=e.get(t.constructor);if(!r)throw new p(`Class ${t.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((([r,o])=>{v(e,r,t[r],o,n)}));else{if("enum"!==r.kind)throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`);{const o=t[r.field];for(let i=0;i<r.values.length;++i){const[s,a]=r.values[i];if(s===o){n.writeU8(i),v(e,s,t[s],a,n);break}}}}}function A(e,t,n,r){try{if("string"==typeof n)return r[`read${w(n)}`]();if(n instanceof Array){if("number"==typeof n[0])return r.readFixedArray(n[0]);if("number"==typeof n[1]){const t=[];for(let o=0;o<n[1];o++)t.push(A(e,null,n[0],r));return t}return r.readArray((()=>A(e,t,n[0],r)))}if("option"===n.kind)return r.readU8()?A(e,t,n.type,r):void 0;if("map"===n.kind){let o=new Map;const i=r.readU32();for(let s=0;s<i;s++){const i=A(e,t,n.key,r),s=A(e,t,n.value,r);o.set(i,s)}return o}return k(e,n,r)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}
1function k(e,t,n){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(n);const r=e.get(t);if(!r)throw new p(`Class ${t.name} is missing in schema`);if("struct"===r.kind){const r={};for(const[o,i]of e.get(t).fields)r[o]=A(e,o,i,n);return new t(r)}if("enum"===r.kind){const o=n.readU8();if(o>=r.values.length)throw new p(`Enum index: ${o} is out of range`);const[i,s]=r.values[o],a=A(e,i,s,n);return new t({[i]:a})}throw new p(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}s([y],m.prototype,"readU8",null),s([y],m.prototype,"readU16",null),s([y],m.prototype,"readU32",null),s([y],m.prototype,"readU64",null),s([y],m.prototype,"readU128",null),s([y],m.prototype,"readU256",null),s([y],m.prototype,"readU512",null),s([y],m.prototype,"readString",null),s([y],m.prototype,"readFixedArray",null),s([y],m.prototype,"readArray",null),t.BinaryReader=m,t.serialize=function(e,t,n=g){const r=new n;return b(e,t,r),r.toArray()},t.deserialize=function(e,t,n,r=m){const o=new r(n),i=k(e,t,o);if(o.offset<n.length)throw new p(`Unexpected ${n.length-o.offset} bytes after deserialized data`);return i},t.deserializeUnchecked=function(e,t,n,r=m){return k(e,t,new r(n))}},1462:(e,t,n)=>{"use strict";var r=n(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.alloc(0);for(var n=0,o=0,i=0;e[n]===c;)o++,n++;for(var s=(e.length-n)*u+1>>>0,l=new Uint8Array(s);n<e.length;){var h=t[e.charCodeAt(n)];if(255===h)return;for(var d=0,f=s-1;(0!==h||d<i)&&-1!==f;f--,d++)h+=a*l[f]>>>0,l[f]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,n++}for(var p=s-i;p!==s&&0===l[p];)p++;var g=r.allocUnsafe(o+(s-p));g.fill(0,0,o);for(var y=o;p!==s;)g[y++]=l[p++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,o=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var u=(s-i)*l+1>>>0,h=new Uint8Array(u);i!==s;){for(var d=t[i],f=0,p=u-1;(0!==d||f<o)&&-1!==p;p--,f++)d+=256*h[p]>>>0,h[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,i++}for(var g=u-o;g!==u&&0===h[g];)g++;for(var y=c.repeat(n);g<u;++g)y+=e.charAt(h[g]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}}
1,4989:(e,t,n)=>{var r=n(1462);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},6763:(e,t,n)=>{const r=n(5364);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},2828:(e,t,n)=>{"use strict";var r=n(8287).Buffer;class o{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function i(e,t){return t.property?e+"["+t.property+"]":e}t.Layout=o,t.nameWithProperty=i,t.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof o))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class s extends o{isCount(){throw new Error("ExternalLayout is abstract")}}class a extends s{constructor(e,t){if(void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){void 0===t&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}class c extends s{constructor(e,t,n){if(!(e instanceof o))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof u||this.layout instanceof l}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class u extends o{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}class l extends o{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}class h extends o{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}class d extends o{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}const f=Math.pow(2,32);function p(e){const t=Math.floor(e/f);return{hi32:t,lo32:e-t*f}}function g(e,t){return e*f+t}class y extends o{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return g(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=p(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}class m extends o{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),g(e.readUInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=p(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class w extends o{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return g(e.readInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=p(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}class v extends o{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),g(e.readInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=p(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class b extends o{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}class A extends o{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}class k extends o{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}class _ extends o{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}class S extends o{constructor(e,t,n){if(!(e instanceof o))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof s&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(t instanceof s)&&0<e.span&&(r=t*e.span),super(r,n),this.elementLayout=e,this.count=t}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0,r=this.count;if(r instanceof s&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let o=0;for(;o<r;)n+=this.elementLayout.getSpan(e,t+n),++o}return n}decode(e,t){void 0===t&&(t=0);const n=[];let r=0,o=this.count;for(o instanceof s&&(o=o.decode(e,t));r<o;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t,n){void 0===n&&(n=0);const r=this.elementLayout,o=e.reduce(((e,o)=>e+r.encode(o,t,n+e)),0);return this.count instanceof s&&this.count.encode(e.length,t,n),o}}class E extends o{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof o),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(e,t);return t+=o,n+o}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0<s?s:0,void 0!==r.property){const o=e[r.property];void 0!==o&&(i=r.encode(o,t,n),0>s&&(s=r.getSpan(t,n)))}o=n,n+=s}return o+i-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class T{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class I extends T{constructor(e,t){if(!(e instanceof s&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");
1super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class M extends o{constructor(e,t,n){const r=e instanceof u||e instanceof l;if(r)e=new I(new c(e));else if(e instanceof s&&e.isCount())e=new I(e);else if(!(e instanceof T))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof o))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&r&&(i+=e.layout.span)),super(i,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let a=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return a(e)},this.configGetSourceVariant=function(e){a=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,o=r.decode(e,t);let i=this.registry[o];if(void 0===i){let s=0;i=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=o,n[i.property]=this.defaultLayout.decode(e,t+s)}else n=i.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=r.layout.span),r.encode(e[r.property],t,n),i+o.encode(e[o.property],t,n+i)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new R(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return r.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class R extends o{constructor(e,t,n,r){if(!(e instanceof M))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof o))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),o+=this.layout.getSpan(t,n+r),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function x(e){return 0>e&&(e+=4294967296),e}class C extends o{constructor(e,t,n){if(!(e instanceof u||e instanceof l))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===n&&(n=t,t=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!t,this.fields=[];let r=0;this._packedSetValue=function(e){return r=x(e),this},this._packedGetValue=function(){return r}}decode(e,t){const n=this.makeDestinationObject();void 0===t&&(t=0);const r=this.word.decode(e,t);this._packedSetValue(r);for(const e of this.fields)void 0!==e.property&&(n[e.property]=e.decode(r));return n}encode(e,t,n){void 0===n&&(n=0);const r=this.word.decode(t,n);this._packedSetValue(r);for(const t of this.fields)if(void 0!==t.property){const n=e[t.property];void 0!==n&&t.encode(n)}return this.word.encode(this._packedGetValue(),t,n)}addField(e,t){const n=new O(this,e,t);return this.fields.push(n),n}addBoolean(e){const t=new P(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}class O{constructor(e,t,n){if(!(e instanceof C))throw new TypeError("container must be a BitStructure");
1if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const r=8*e.span,o=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+o>r)throw new Error("bits too long for span remainder ("+(r-o)+" of "+r+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=r-o-t),this.wordMask=x(this.valueMask<<this.start),this.property=n}decode(){return x(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if(!Number.isInteger(e)||e!==x(e&this.valueMask))throw new TypeError(i("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=x(e<<this.start);this.container._packedSetValue(x(t&~this.wordMask)|n)}}class P extends O{constructor(e,t){super(e,1,t)}decode(e,t){return!!O.prototype.decode.call(this,e,t)}encode(e){return"boolean"==typeof e&&(e=+e),O.prototype.encode.call(this,e)}}class N extends o{constructor(e,t){if(!(e instanceof s&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof s||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let o=this.length;if(this.length instanceof s&&(o=e.length),!r.isBuffer(e)||o!==e.length)throw new TypeError(i("Blob.encode",this)+" requires (length "+o+") Buffer as src");if(n+o>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,o,"hex"),this.length instanceof s&&this.length.encode(o,t,n),o}}class B extends o{constructor(e){super(-1,e)}getSpan(e,t){if(!r.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);let n=t;for(;n<e.length&&0!==e[n];)n+=1;return 1+n-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const o=new r(e,"utf8"),i=o.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(t,n),t[n+i]=0,i+1}}class V extends o{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!r.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const o=new r(e,"utf8"),i=o.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(t,n),i}}class L extends o{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}t.ExternalLayout=s,t.GreedyCount=a,t.OffsetLayout=c,t.UInt=u,t.UIntBE=l,t.Int=h,t.IntBE=d,t.Float=b,t.FloatBE=A,t.Double=k,t.DoubleBE=_,t.Sequence=S,t.Structure=E,t.UnionDiscriminator=T,t.UnionLayoutDiscriminator=I,t.Union=M,t.VariantLayout=R,t.BitStructure=C,t.BitField=O,t.Boolean=P,t.Blob=N,t.CString=B,t.UTF8=V,t.Constant=L,t.greedy=(e,t)=>new a(e,t),t.offset=(e,t,n)=>new c(e,t,n),t.u8=e=>new u(1,e),t.u16=e=>new u(2,e),t.u24=e=>new u(3,e),t.u32=e=>new u(4,e),t.u40=e=>new u(5,e),t.u48=e=>new u(6,e),t.nu64=e=>new y(e),t.u16be=e=>new l(2,e),t.u24be=e=>new l(3,e),t.u32be=e=>new l(4,e),t.u40be=e=>new l(5,e),t.u48be=e=>new l(6,e),t.nu64be=e=>new m(e),t.s8=e=>new h(1,e),t.s16=e=>new h(2,e),t.s24=e=>new h(3,e),t.s32=e=>new h(4,e),t.s40=e=>new h(5,e),t.s48=e=>new h(6,e),t.ns64=e=>new w(e),t.s16be=e=>new d(2,e),t.s24be=e=>new d(3,e),t.s32be=e=>new d(4,e),t.s40be=e=>new d(5,e),t.s48be=e=>new d(6,e),t.ns64be=e=>new v(e),t.f32=e=>new b(e),t.f32be=e=>new A(e),t.f64=e=>new k(e),t.f64be=e=>
vendor: 19,761 bytes, line 1
1new _(e),t.struct=(e,t,n)=>new E(e,t,n),t.bits=(e,t,n)=>new C(e,t,n),t.seq=(e,t,n)=>new S(e,t,n),t.union=(e,t,n)=>new M(e,t,n),t.unionLayoutDiscriminator=(e,t)=>new I(e,t),t.blob=(e,t)=>new N(e,t),t.cstr=e=>new B(e),t.utf8=(e,t)=>new V(e,t),t.const=(e,t)=>new L(e,t)},8287:(e,t,n)=>{"use strict";var r=n(7526),o=n(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|g(e,t),r=a(n),o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(W(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);var o=function(e){if(c.isBuffer(e)){var t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||z(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),n=a(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(o)return r?-1:D(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;i<a;i++)if(u(e,i)===u(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===c)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){for(var h=!0,d=0;d<c;d++)if(u(e,i+d)!==u(t,d)){h=!1;break}if(h)return i}return-1}function b(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=t.length;r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(z(a))return s;e[n+s]=a}return s}function A(e,t,n,r){return U(D(t,e.length-n),e,n,r)}function k(e,t,n,r){return U(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return U(j(t),e,n,r)}function S(e,t,n,r){return U(function(e,t){for(var n,r,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var i,s,a,c,u=e[o],l=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}t.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(W(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var i=e[n];if(W(i,Uint8Array))o+i.length>r.length?c.from(i).copy(r,o):Uint8Array.prototype.set.call(r,i,o);else{if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o)}o+=i.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(W(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n),h=0;h<a;++h)if(u[h]!==l[h]){i=u[h],s=l[h];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return k(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function M(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function x(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=t;i<n;++i)o+=G[e[i]];return o}function C(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length-1;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return t=+t,n>>>=0,i||N(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,i){return t=+t,n>>>=0,i||N(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var o=Math.pow(2,8*n-1);P(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<n&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var o=Math.pow(2,8*n-1);P(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return V(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return V(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var o=e.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var s=c.isBuffer(e)?e:c.from(e,r),a=s.length;
vendor: 6,650 bytes, line 1
1if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=s[i%a]}return this};var L=/[^+/0-9A-Za-z-_]/g;function D(e,t){var n;t=t||1/0;for(var r=e.length,o=null,i=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function j(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var G=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)t[r+o]=e[n]+e[o];return t}()},4945:(e,t,n)=>{var r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n.g&&n.g,o=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n.g&&n.g||{},o="URLSearchParams"in r,i="Symbol"in r&&"iterator"in Symbol,s="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in r,c="ArrayBuffer"in r;if(c)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&u.indexOf(Object.prototype.toString.call(e))>-1};function h(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function g(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function y(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function w(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:o&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&s&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=w(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=w(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return g(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(s)return this.blob().then(m);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,n,r,o,i=g(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,n=y(t=new FileReader),o=(r=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?r[1]:"utf-8",t.readAsText(e,o),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(e,t){e=h(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},p.prototype.delete=function(e){delete this.map[h(e)]},p.prototype.get=function(e){return e=h(e),this.has(e)?this.map[e]:null},p.prototype.has=function(e){return this.map.hasOwnProperty(h(e))},p.prototype.set=function(e,t){this.map[h(e)]=d(t)},p.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},p.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),f(e)},p.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)},p.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),f(e)},i&&(p.prototype[Symbol.iterator]=p.prototype.entries);var b=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function A(e,t){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object c
1onstructor cannot be called as a function.');var n,o,i=(t=t||{}).body;if(e instanceof A){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new p(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new p(t.headers)),this.method=(o=(n=t.method||this.method||"GET").toUpperCase(),b.indexOf(o)>-1?o:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in r)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var s=/([?&])_=[^&]*/;s.test(this.url)?this.url=this.url.replace(s,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function k(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},v.call(A.prototype),v.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var S=[301,302,303,307,308];_.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(o,i){var a=new A(e,n);if(a.signal&&a.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}if(u.onload=function(){var e,t,n={statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new p,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();try{t.append(r,o)}catch(e){console.warn("Response "+e.message)}}})),t)};0===a.url.indexOf("file://")&&(u.status<200||u.status>599)?n.status=200:n.status=u.status,n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout((function(){o(new _(r,n))}),0)},u.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request timed out"))}),0)},u.onabort=function(){setTimeout((function(){i(new t.DOMException("Aborted","AbortError"))}),0)},u.open(a.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(a.url),!0),"include"===a.credentials?u.withCredentials=!0:"omit"===a.credentials&&(u.withCredentials=!1),"responseType"in u&&(s?u.responseType="blob":c&&(u.responseType="arraybuffer")),n&&"object"==typeof n.headers&&!(n.headers instanceof p||r.Headers&&n.headers instanceof r.Headers)){var f=[];
vendor: 5,145 bytes, line 1
1Object.getOwnPropertyNames(n.headers).forEach((function(e){f.push(h(e)),u.setRequestHeader(e,d(n.headers[e]))})),a.headers.forEach((function(e,t){-1===f.indexOf(t)&&u.setRequestHeader(t,e)}))}else a.headers.forEach((function(e,t){u.setRequestHeader(t,e)}));a.signal&&(a.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&a.signal.removeEventListener("abort",l)}),u.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,r.fetch||(r.fetch=E,r.Headers=p,r.Request=A,r.Response=_),t.Headers=p,t.Request=A,t.Response=_,t.fetch=E}({})}(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var i=r.fetch?r:o;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},6320:e=>{"use strict";var t={single_source_shortest_paths:function(e,n,r){var o={},i={};i[n]=0;var s,a,c,u,l,h,d,f=t.PriorityQueue.make();for(f.push(n,0);!f.empty();)for(c in a=(s=f.pop()).value,u=s.cost,l=e[a]||{})l.hasOwnProperty(c)&&(h=u+l[c],d=i[c],(void 0===i[c]||d>h)&&(i[c]=h,f.push(c,h),o[c]=a));if(void 0!==r&&void 0===i[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,n,r){var o=t.single_source_shortest_paths(e,n,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(e){var n,r=t.PriorityQueue,o={};for(n in e=e||{},r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=e.sorter||r.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},228:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o<i;o++)s[o]=r[o].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,s){var a=n?n+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,i),!0;case 6:return l.fn.call(l.context,t,r,o,i,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,r);break;case 4:l[u].fn.call(l[u].context,t,r,o);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||s(this,i);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||o&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},255:(e,t,n)=>{"use strict";var r,o=n(8287).Buffer,i=Object.create,s=Object.defineProperty,a=Object.defineProperties,c=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,g=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))f.call(t,n)&&g(e,n,t[n]);if(h)for(var n of h(t))p.call(t,n)&&g(e,n,t[n]);return e},m=(e,t)=>
1a(e,u(t)),w=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of l(t))f.call(e,o)||o===n||s(e,o,{get:()=>t[o],enumerable:!(r=c(t,o))||r.enumerable});return e},v=(e,t,n)=>(n=null!=e?i(d(e)):{},w(!t&&e&&e.__esModule?n:s(n,"default",{value:e,enumerable:!0}),e)),b=(e,t,n)=>new Promise(((r,o)=>{var i=e=>{try{a(n.next(e))}catch(e){o(e)}},s=e=>{try{a(n.throw(e))}catch(e){o(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())})),A={};((e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})})(A,{DEFAULT_CHAT_PROGRAM_ID:()=>M,DEFAULT_PROGRAM_ID:()=>I,SplGovernance:()=>$}),e.exports=(r=A,w(s({},"__esModule",{value:!0}),r));var k=n(2643),_=n(4260),S=v(n(9404)),E={version:"3.1.1",name:"spl_governance",instructions:[{name:"createRealm",accounts:[{name:"realmAccount",isMut:!0,isSigner:!1,docs:["Governance Realm account"]},{name:"realmAuthority",isMut:!1,isSigner:!1,docs:["The authority of the Realm"]},{name:"communityTokenMint",isMut:!1,isSigner:!1,docs:["The mint address of the token to be used as the community mint"]},{name:"communityTokenHoldingAccount",isMut:!0,isSigner:!1,docs:["The account to hold the community tokens.\n    PDA seeds=['governance', realm, community_mint]"]},{name:"payer",isMut:!0,isSigner:!0,docs:["the payer of this transaction"]},{name:"systemProgram",isMut:!1,isSigner:!1,docs:["System Program"]},{name:"tokenProgram",isMut:!1,isSigner:!1,docs:["SPL Token Program"]},{name:"rent",isMut:!1,isSigner:!1,docs:["SysVar Rent"]},{name:"councilTokenMint",isMut:!1,isSigner:!1,isOptional:!0,docs:["The mint address of the token to be used as the council mint"]},{name:"councilTokenHoldingAccount",isMut:!0,isSigner:!1,isOptional:!0,docs:["The account to hold the council tokens.\n    PDA seeds: ['governance',realm,council_mint]\n    "]},{name:"realmConfig",isMut:!0,isSigner:!1,docs:["Realm Config account"]},{name:"communityVoterWeightAddin",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Community Voter Weight Addin Program Id"]},{name:"maxCommunityVoterWeightAddin",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Community Voter Weight Addin Program Id"]},{name:"councilVoterWeightAddin",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Council Voter Weight Addin Program Id"]},{name:"maxCouncilVoterWeightAddin",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Council Voter Weight Addin Program Id"]}],args:[{name:"name",type:"string"},{name:"configArgs",type:{defined:"RealmConfigArgs"}}],discriminant:{type:"u8",value:0}},{name:"depositGoverningTokens",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governingTokenHoldingAccount",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint]"]},{name:"governingTokenSourceAccount",isMut:!0,isSigner:!1,docs:["It can either be spl-token TokenAccount or MintAccount. Tokens will be transferred or minted to the holding account"]},{name:"governingTokenOwnerAccount",isMut:!1,isSigner:!0},{name:"governingTokenSourceAccountAuthority",isMut:!1,isSigner:!0,docs:["It should be owner for TokenAccount and mint_authority for MintAccount"]},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint, governing_token_owner]"]},{name:"payer",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"realmConfigAccount",isMut:!1,isSigner:!1,docs:["seeds=['realm-config', realm]"]}],args:[{name:"amount",type:"u64"}],discriminant:{type:"u8",value:1}},{name:"withdrawGoverningTokens",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governingTokenHoldingAccount",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint]"]},{name:"governingTokenDestinationAccount",isMut:!0,isSigner:!1,docs:["All tokens will be transferred to this account"]},{name:"governingTokenOwnerAccount",isMut:!1,isSigner:!0},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["seeds=['governance',realm, governing_token_mint, governing_token_owner]"]},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"realmConfigAccount",isMut:!1,isSigner:!1,docs:["seeds=['realm-config', realm]"]}],args:[],discriminant:{type:"u8",value:2}},{name:"setGovernanceDelegate",accounts:[{name:"currentDelegateOrOwner",isMut:!1,isSigner:!0,docs:["Current governance delegate or governing token owner"]},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1}],args:[{name:"newGovernanceDelegate",type:{option:"publicKey"}}],discriminant:{type:"u8",value:3}},{name:"createGovernance",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1,docs:["Realm account the created governance belongs to"]},{name:"governanceAccount",isMut:!0,isSigner:!1,docs:["seeds=['account-governance', realm, governed_account]"]},{name:"governedAccount",isMut:!1,isSigner:!1,docs:["Account governed by this Governance (governing_account). \n        Note: the account doesn't have to exist and can be used only as a unique identified for the Governance account"]},{name:"governingTokenOwnerRecord",isMut:!1,isSigner:!1,docs:["Used only if not signed by RealmAuthority"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"governanceAuthority",isMut:!1,isSigner:!0},{name:"realmConfigAccount",isMut:!1,isSigner:!1,docs:["seeds=['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]}],args:[{name:"config",type:{defined:"GovernanceConfig"}}
1],discriminant:{type:"u8",value:4}},{name:"createProgramGovernance",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1,docs:["Realm account the created Governance belongs to"]},{name:"programGovernanceAccount",isMut:!0,isSigner:!1,docs:["Program Governance account. seeds: ['program-governance', realm, governed_program]"]},{name:"governedProgram",isMut:!1,isSigner:!1,docs:["Program governed by this Governance account"]},{name:"programData",isMut:!0,isSigner:!1,docs:["Program Data account of the Program governed by this Governance account"]},{name:"currentUpgradeAuthority",isMut:!1,isSigner:!0,docs:["Current Upgrade Authority account of the Program governed by this Governance account"]},{name:"governingTokenOwnerRecord",isMut:!1,isSigner:!1,docs:["Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)"]},{name:"payer",isMut:!1,isSigner:!0},{name:"bpfUpgradeableLoaderProgram",isMut:!1,isSigner:!1,docs:["bpf_upgradeable_loader_program program"]},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"governanceAuthority",isMut:!1,isSigner:!0},{name:"realmConfig",isMut:!1,isSigner:!1,docs:["RealmConfig account. seeds=['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]}],args:[{name:"config",type:{defined:"GovernanceConfig"}},{name:"transferUpgradeAuthority",type:"bool"}],discriminant:{type:"u8",value:5}},{name:"createProposal",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1,docs:["Realm account the created Proposal belongs to"]},{name:"proposalAccount",isMut:!0,isSigner:!1,docs:["Proposal account. PDA seeds ['governance',governance, governing_token_mint, proposal_index]"]},{name:"governanceAccount",isMut:!0,isSigner:!1,docs:["Governance account"]},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governingTokenMint",isMut:!1,isSigner:!1,docs:["Token Mint the Proposal is created for"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"realmConfig",isMut:!1,isSigner:!1,docs:["RealmConfig account. PDA seeds: ['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!0,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]},{name:"proposalDepositAccount",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Proposal deposit is required when there are more active \n        proposals than the configured deposit exempt amount. \n        PDA seeds: ['proposal-deposit', proposal, deposit payer]"]}],args:[{name:"name",type:"string"},{name:"descriptionLink",type:"string"},{name:"voteType",type:{defined:"VoteType"}},{name:"options",type:{vec:"string"}},{name:"useDenyOption",type:"bool"},{name:"proposalSeed",type:"publicKey"}],discriminant:{type:"u8",value:6}},{name:"addSignatory",accounts:[{name:"proposalAccount",isMut:!0,isSigner:!1,docs:["Proposal Account associated with the governance"]},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"signatoryRecordAccount",isMut:!0,isSigner:!1,docs:["Signatory Record Account"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"signatory",type:"publicKey"}],discriminant:{type:"u8",value:7}},{name:"legacy1",accounts:[],args:[],discriminant:{type:"u8",value:8}},{name:"insertTransaction",accounts:[{name:"governanceAccount",isMut:!1,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"proposalTransactionAccount",isMut:!0,isSigner:!1,docs:["ProposalTransaction, account. PDA seeds: ['governance', proposal, option_index, index]"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"optionIndex",type:"u8"},{name:"index",type:"u16"},{name:"holdUpTime",type:"u32"},{name:"instructions",type:{vec:{defined:"InstructionData"}}}],discriminant:{type:"u8",value:9}},{name:"removeTransaction",accounts:[{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"proposalTransactionAccount",isMut:!0,isSigner:!1},{name:"beneficiaryAccount",isMut:!0,isSigner:!1,docs:["Beneficiary Account which would receive lamports from the disposed ProposalTransaction account"]}],args:[],discriminant:{type:"u8",value:10}},{name:"cancelProposal",accounts:[{name:"realmAccount",isMut:!0,isSigner:!1},{name:"governanceAccount",isMut:!0,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance authority (Token Owner or Governance Delegate)"]}],args:[],discriminant:{type:"u8",value:11}},{name:"signOffProposal",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governanceAccount",isMut:!1,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"signatoryAccount",isMut:!1,isSigner:!0,docs:["Signatory account signing off the Proposal.\n    Or Proposal owner if the owner hasn't appointed any signatories"]},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal.\n        Or `[writable]` SignatoryRecord account, required when non owner signs off the Proposal"]}],args:[],discriminant:{type:"u8",value:12}},{name:"castVote",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governanceAccount",isMut:!0,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"proposalTokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord of the Proposal owner"]},{name:"voterTokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord of the voter. PDA seeds: ['governance',realm, vote_governing_token_mint, governing_token_owner]"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"proposalVoteRecord",isMut:!0,isSigner:!1,docs:["Proposal VoteRecord account. PDA seeds: ['governance',proposal,token_owner_record]"]},{name:"governingTokenMint",isMut:!1,isSigner:!1,docs:["The Governing Token Mint which is used to cast the vote (vote_governing_token_mint).\n    The voting token mint is the governing_token_mint of the Proposal for Approve, Deny and Abstain votes.\n    For Veto vote the voting token mint is the mint of the opposite voting population.\n    Council mint to veto Community proposals and Community mint to veto Council proposals\n    Note: In the current version only Council veto is supported"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"realmConfigAccount",isMut:!1,isSigner:!1,docs:["RealmConfig account. PDA seeds: ['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]},{name:"maxVoterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Voter Weight Record"]}],args:[{name:"vote",type:{defined:"Vote"}}],discriminant:{type:"u8",value:13}},{name:"finalizeVote",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governanceAccount",isMut:!0,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord of the Proposal owner"]},{name:"governingTokenMint",isMut:!1,isSigner:!1},{name:"realmConfig",isMut:!1,isSigner:!1,docs:["RealmConfig account. PDA seeds: ['realm-config', realm]"]},{name:"maxVoterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Voter Weight Record"]}],args:[],discriminant:{type:"u8",value:14}},{name:"relinquishVote",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governanceAccount",isMut:!1,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["TokenOwnerRecord account. PDA seeds: ['governance',realm, vote_governing_token_mint, governing_token_owner]"]},{name:"proposalVoteRecord",isMut:!0,isSigner:!1,docs:["Proposal VoteRecord account. PDA seeds: ['governance',proposal, token_owner_record]"]},{name:"governingTokenMint",isMut:!1,isSigner:!1,docs:["The Governing Token Mint which was used to cast the vote (vote_governing_token_mint)"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,isOptional:!0},{name:"beneficiaryAccount",isMut:!0,isSigner:!1,isOptional:!0,docs:["Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed.\n    It's required only when Proposal is still being voted on"]}],args:[],discriminant:{type:"u8",value:15}},{name:"executeTransaction",accounts:[{name:"governanceAccount",isMut:!1,isSigner:!1},{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"proposalTransactionAccount",isMut:!0,isSigner:!1}],args:[],discriminant:{type:"u8",value:16}},{name:"createMintGovernance",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1,docs:["Realm account the created Governance belongs to"]},{name:"mintGovernanceAccount",isMut:!0,isSigner:!1,docs:["Mint Governance account. seeds=['mint-governance', realm, governed_mint]"]},{name:"governedMint",isMut:!0,isSigner:!1,docs:["Mint governed by this Governance account"]},{name:"mintAuthority",isMut:!1,isSigner:!0,docs:["Current Mint authority (MintTokens and optionally FreezeAccount)"]},{name:"governingTokenOwnerRecord",isMut:!1,isSigner:!1,docs:["Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)"]},{name:"payer",isMut:!1,isSigner:!0},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"governanceAuthority",isMut:!1,isSigner:!0},{name:"realmConfig",isMut:!1,isSigner:!1,docs:["RealmConfig account. seeds=['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]}],args:[{name:"config",type:{defined:"GovernanceConfig"}}
1,{name:"transferMintAuthorities",type:"bool"}],discriminant:{type:"u8",value:17}},{name:"createTokenGovernance",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1,docs:["Realm account the created Governance belongs to"]},{name:"tokenGovernanceAccount",isMut:!0,isSigner:!1,docs:["Token Governance account. seeds=['token-governance', realm, governed_token]"]},{name:"tokenAccount",isMut:!0,isSigner:!1,docs:["Token account governed by this Governance account"]},{name:"tokenAccountAuthority",isMut:!1,isSigner:!0,docs:["Current token account authority (AccountOwner and optionally CloseAccount"]},{name:"governingTokenOwnerRecord",isMut:!1,isSigner:!1,docs:["Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority"]},{name:"payer",isMut:!1,isSigner:!0},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"governanceAuthority",isMut:!1,isSigner:!0},{name:"realmConfig",isMut:!1,isSigner:!1,docs:["seeds=['realm-config', realm]"]},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Voter Weight Record"]}],args:[{name:"config",type:{defined:"GovernanceConfig"}},{name:"transferAccountAuthorities",type:"bool"}],discriminant:{type:"u8",value:18}},{name:"setGovernanceConfig",accounts:[{name:"governanceAccount",isMut:!0,isSigner:!0,docs:["The governance account the config is for"]}],args:[{name:"config",type:{defined:"GovernanceConfig"}}],discriminant:{type:"u8",value:19}},{name:"flagTransactionError",accounts:[{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["Governance Authority (Token Owner or Governance Delegate)"]},{name:"proposalTransactionAccount",isMut:!0,isSigner:!1,docs:["ProposalTransaction account to flag"]}],args:[],discriminant:{type:"u8",value:20}},{name:"setRealmAuthority",accounts:[{name:"realmAccount",isMut:!0,isSigner:!1},{name:"realmAuthority",isMut:!1,isSigner:!0},{name:"newRealmAuthority",isMut:!1,isSigner:!1,isOptional:!0,docs:["Must be one of the realm governances when set"]}],args:[{name:"action",type:{defined:"SetRealmAuthorityAction"}}],discriminant:{type:"u8",value:21}},{name:"setRealmConfig",accounts:[{name:"realmAccount",isMut:!0,isSigner:!1},{name:"realmAuthority",isMut:!1,isSigner:!0},{name:"councilTokenMint",isMut:!1,isSigner:!1,isOptional:!0,docs:["Council Token Mint - optional. \n        Note: In the current version it's only possible to remove council mint (set it to None)\n        After setting council to None it won't be possible to withdraw the tokens from the Realm any longer. \n        If that's required then it must be done before executing this instruction"]},{name:"councilTokenHoldingAccount",isMut:!0,isSigner:!1,isOptional:!0,docs:["Optional unless council is used. seeds=['governance', realm, council_mint]"]},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"realmConfig",isMut:!0,isSigner:!1,docs:["RealmConfig account. seeds=['realm-config', realm]"]},{name:"communityVoterWeightAddinProgramId",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Community Voter Weight Addin Program Id"]},{name:"maxCommunityVoterWeightAddinProgramId",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Community Voter Weight Addin Program Id"]},{name:"councilVoterWeightAddinProgramId",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Council Voter Weight Adding Program Id"]},{name:"maxCouncilVoterWeightAddinProgramId",isMut:!1,isSigner:!1,isOptional:!0,docs:["Optional Max Council Voter Weight Addin Program Id"]},{name:"payer",isMut:!1,isSigner:!0,isOptional:!0,docs:["Optional Payer. Required if RealmConfig doesn't exist and needs to be created"]}],args:[{name:"configArgs",type:{defined:"RealmConfigArgs"}}],discriminant:{type:"u8",value:22}},{name:"createTokenOwnerRecord",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governingTokenOwnerAccount",isMut:!1,isSigner:!1},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint, governing_token_owner]"]},{name:"governingTokenMint",isMut:!1,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[],discriminant:{type:"u8",value:23}},{name:"updateProgramMetadata",accounts:[{name:"programMetadataAccount",isMut:!0,isSigner:!1,docs:["seeds=['metadata']"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[],discriminant:{type:"u8",value:24}},{name:"createNativeTreasury",accounts:[{name:"governanceAccount",isMut:!1,isSigner:!1,docs:["Governance account the treasury account is for"]},{name:"nativeTreasuryAccount",isMut:!0,isSigner:!1,docs:["seeds=['native-treasury', governance]"]},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[],discriminant:{type:"u8",value:25}},{name:"revokeGoverningTokens",accounts:[{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governingTokenHoldingAccount",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint]"]},{name:"tokenOwnerRecord",isMut:!0,isSigner:!1,docs:["seeds=['governance', realm, governing_token_mint, governing_token_owner]"]},{name:"governingTokenMint",isMut:!0,isSigner:!1},{name:"governingTokenMintAuthorityOrTokenOwner",isMut:!1,isSigner:!0,docs:["GoverningTokenMint mint_authority"]},{name:"realmConfigAccount",isMut:!1,isSigner:!1,docs:["seeds=['realm-config', realm]"]},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"}],discriminant:{type:"u8",value:26}},{name:"refundProposalDeposit",accounts:[{name:"proposalAccount",isMut:!1,isSigner:!1},{name:"proposalDepositAccount",isMut:!0,isSigner:!1,docs:["PDA Seeds: ['proposal-deposit', proposal, deposit payer]"]},{name:"proposalDepositPayer",isMut:!0,isSigner:!1,docs:["Proposal Deposit Payer (beneficiary) account"]}],args:[],discriminant:{type:"u8",value:27}},{name:"completeProposal",accounts:[{name:"proposalAccount",isMut:!0,isSigner:!1},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1,docs:["TokenOwnerRecord account of the Proposal owner"]},{name:"completeProposalAuthority",isMut:!1,isSigner:!0,docs:["Token Owner or Delegate"]}],args:[],discriminant:{type:"u8",value:28}},{name:"addRequiredSignatory",accounts:[{name:"governanceAccount",isMut:!0,isSigner:!0,docs:["The Governance account the config is for"]},{name:"requiredSignatoryAccount",isMut:!0,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"signatory",type:"publicKey"}],discriminant:{type:"u8",value:29}},{name:"removeRequiredSignatory",accounts:[{name:"governanceAccount",isMut:!0,isSigner:!0},{name:"requiredSignatoryAccount",isMut:!0,isSigner:!1},{name:"beneficiaryAccount",isMut:!0,isSigner:!1,docs:["Beneficiary Account which would receive lamports from the disposed RequiredSignatory Account"]}],args:[],discriminant:{type:"u8",value:30}}],accounts:[{name:"governanceV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"governedAccount",type:"publicKey"},{name:"reserved1",type:"u32"},{name:"config",type:{defined:"GovernanceConfig"}}
1,{name:"reservedV2",type:{defined:"Reserved119"}},{name:"requiredSignatoriesCount",type:"u8"},{name:"activeProposalCount",type:"u64"}]}},{name:"realmV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"communityMint",type:"publicKey"},{name:"config",type:{defined:"RealmConfig"}},{name:"reserved",type:{array:["u8",6]}},{name:"votingProposalCount",type:"u16"},{name:"authority",type:{option:"publicKey"}},{name:"name",type:"string"}]}},{name:"tokenOwnerRecordV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"governingTokenDepositAmount",type:"u64"},{name:"unrelinquishedVotesCount",type:"u64"},{name:"outstandingProposalCount",type:"u8"},{name:"version",type:"u8"},{name:"reserved",type:{array:["u8",6]}},{name:"governanceDelegate",type:{option:"publicKey"}}]}},{name:"governanceV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"governedAccount",type:"publicKey"},{name:"proposalsCount",type:"u32"},{name:"config",type:{defined:"GovernanceConfig"}}]}},{name:"proposalV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"governance",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"state",type:{defined:"ProposalState"}},{name:"tokenOwnerRecord",type:"publicKey"},{name:"signatoriesCount",type:"u8"},{name:"signatoriesSignedOffCount",type:"u8"},{name:"yesVotesCount",type:"u64"},{name:"noVotesCount",type:"u64"},{name:"instructionsExecutedCount",type:"u16"},{name:"instructionsCount",type:"u16"},{name:"instructionsNextIndex",type:"u16"},{name:"draftAt",type:{defined:"UnixTimestamp"}},{name:"signingOffAt",type:{option:{defined:"UnixTimestamp"}}},{name:"votingAt",type:{option:{defined:"UnixTimestamp"}}},{name:"votingAtSlot",type:{option:{defined:"Slot"}}},{name:"votingCompletedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executingAt",type:{option:{defined:"UnixTimestamp"}}},{name:"closedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executionFlags",type:{defined:"InstructionExecutionFlags"}},{name:"maxVoteWeight",type:{option:"u64"}},{name:"voteThreshold",type:{option:{defined:"VoteThreshold"}}},{name:"name",type:"string"},{name:"descriptionLink",type:"string"}]}},{name:"signatoryRecordV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"signatory",type:"publicKey"},{name:"signedOff",type:"bool"}]}},{name:"proposalInstructionV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"instructionIndex",type:"u16"},{name:"holdUpTime",type:"u32"},{name:"instruction",type:{defined:"InstructionData"}},{name:"executedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executionStatus",type:{defined:"TransactionExecutionStatus"}}]}},{name:"voteRecordV1",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"isRelinquished",type:"bool"},{name:"voteWeight",type:{defined:"VoteWeightV1"}}]}},{name:"programMetadata",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"updatedAt",type:{defined:"Slot"}},{name:"version",type:"string"},{name:"reserved",type:{array:["u8",64]}}]}},{name:"proposalV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"governance",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"state",type:{defined:"ProposalState"}},{name:"tokenOwnerRecord",type:"publicKey"},{name:"signatoriesCount",type:"u8"},{name:"signatoriesSignedOffCount",type:"u8"},{name:"voteType",type:{defined:"VoteType"}},{name:"options",type:{vec:{defined:"ProposalOption"}}},{name:"denyVoteWeight",type:{option:"u64"}},{name:"reserved1",type:"u8"},{name:"abstainVoteWeight",type:{option:"u64"}},{name:"startVotingAt",type:{option:{defined:"UnixTimestamp"}}},{name:"draftAt",type:{defined:"UnixTimestamp"}},{name:"signingOffAt",type:{option:{defined:"UnixTimestamp"}}},{name:"votingAt",type:{option:{defined:"UnixTimestamp"}}},{name:"votingAtSlot",type:{option:{defined:"Slot"}}},{name:"votingCompletedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executingAt",type:{option:{defined:"UnixTimestamp"}}},{name:"closedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executionFlags",type:{defined:"InstructionExecutionFlags"}},{name:"maxVoteWeight",type:{option:"u64"}},{name:"maxVotingTime",type:{option:"u32"}},{name:"voteThreshold",type:{option:{defined:"VoteThreshold"}}},{name:"reserved",type:{array:["u8",64]}},{name:"name",type:"string"},{name:"descriptionLink",type:"string"},{name:"vetoVoteWeight",type:"u64"}]}},{name:"proposalDeposit",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"depositPayer",type:"publicKey"},{name:"reserved",type:{array:["u8",64]}}]}},{name:"proposalTransactionV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"optionIndex",type:"u8"},{name:"transactionIndex",type:"u16"},{name:"holdUpTime",type:"u32"},{name:"instructions",type:{vec:{defined:"InstructionData"}}},{name:"executedAt",type:{option:{defined:"UnixTimestamp"}}},{name:"executionStatus",type:{defined:"TransactionExecutionStatus"}},{name:"reservedV2",type:{array:["u8",8]}}]}},{name:"realmV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"communityMint",type:"publicKey"},{name:"config",type:{defined:"RealmConfig"}}
1,{name:"reserved",type:{array:["u8",6]}},{name:"legacy1",type:"u16"},{name:"authority",type:{option:"publicKey"}},{name:"name",type:"string"},{name:"reservedV2",type:{array:["u8",128]}}]}},{name:"realmConfigAccount",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"communityTokenConfig",type:{defined:"GoverningTokenConfig"}},{name:"councilTokenConfig",type:{defined:"GoverningTokenConfig"}},{name:"reserved",type:{defined:"Reserved110"}}]}},{name:"requiredSignatory",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"accountVersion",type:"u8"},{name:"governance",type:"publicKey"},{name:"signatory",type:"publicKey"}]}},{name:"signatoryRecordV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"signatory",type:"publicKey"},{name:"signedOff",type:"bool"},{name:"reservedV2",type:{array:["u8",8]}}]}},{name:"tokenOwnerRecordV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"governingTokenDepositAmount",type:"u64"},{name:"unrelinquishedVotesCount",type:"u64"},{name:"outstandingProposalCount",type:"u8"},{name:"version",type:"u8"},{name:"reserved",type:{array:["u8",6]}},{name:"governanceDelegate",type:{option:"publicKey"}},{name:"reservedV2",type:{array:["u8",128]}}]}},{name:"legacyTokenOwnerRecord",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"realm",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"governingTokenDepositAmount",type:"u64"},{name:"unrelinquishedVotesCount",type:"u32"},{name:"totalVotesCount",type:"u32"},{name:"outstandingProposalCount",type:"u8"},{name:"reserved",type:{array:["u8",7]}},{name:"governanceDelegate",type:{option:"publicKey"}},{name:"reservedV2",type:{array:["u8",128]}}]}},{name:"voteRecordV2",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceAccountType"}},{name:"proposal",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"isRelinquished",type:"bool"},{name:"voterWeight",type:"u64"},{name:"vote",type:{defined:"Vote"}},{name:"reservedV2",type:{array:["u8",8]}}]}}],types:[{name:"GovernanceConfig",type:{kind:"struct",fields:[{name:"communityVoteThreshold",type:{defined:"VoteThreshold"}},{name:"minCommunityWeightToCreateProposal",type:"u64"},{name:"minTransactionHoldUpTime",type:"u32"},{name:"votingBaseTime",type:"u32"},{name:"communityVoteTipping",type:{defined:"VoteTipping"}},{name:"councilVoteThreshold",type:{defined:"VoteThreshold"}},{name:"councilVetoVoteThreshold",type:{defined:"VoteThreshold"}},{name:"minCouncilWeightToCreateProposal",type:"u64"},{name:"councilVoteTipping",type:{defined:"VoteTipping"}},{name:"communityVetoVoteThreshold",type:{defined:"VoteThreshold"}},{name:"votingCoolOffTime",type:"u32"},{name:"depositExemptProposalCount",type:"u8"}]}},{name:"NativeTreasury",type:{kind:"struct",fields:[]}},{name:"ProposalOption",type:{kind:"struct",fields:[{name:"label",type:"string"},{name:"voteWeight",type:"u64"},{name:"voteResult",type:{defined:"OptionVoteResult"}},{name:"transactionsExecutedCount",type:"u16"},{name:"transactionsCount",type:"u16"},{name:"transactionsNextIndex",type:"u16"}]}},{name:"InstructionData",type:{kind:"struct",fields:[{name:"programId",type:"publicKey"},{name:"accounts",type:{vec:{defined:"AccountMetaData"}}},{name:"data",type:"bytes"}]}},{name:"AccountMetaData",type:{kind:"struct",fields:[{name:"pubkey",type:"publicKey"},{name:"isSigner",type:"bool"},{name:"isWritable",type:"bool"}]}},{name:"RealmConfigArgs",type:{kind:"struct",fields:[{name:"useCouncilMint",type:"bool"},{name:"minCommunityWeightToCreateGovernance",type:"u64"},{name:"communityMintMaxVoterWeightSource",type:{defined:"MintMaxVoterWeightSource"}},{name:"communityTokenConfigArgs",type:{defined:"GoverningTokenConfigArgs"}},{name:"councilTokenConfigArgs",type:{defined:"GoverningTokenConfigArgs"}}]}},{name:"GoverningTokenConfigArgs",type:{kind:"struct",fields:[{name:"useVoterWeightAddin",type:"bool"},{name:"useMaxVoterWeightAddin",type:"bool"},{name:"tokenType",type:{defined:"GoverningTokenType"}}]}},{name:"GoverningTokenConfigAccountArgs",type:{kind:"struct",fields:[{name:"voterWeightAddin",type:{option:"publicKey"}},{name:"maxVoterWeightAddin",type:{option:"publicKey"}},{name:"tokenType",type:{defined:"GoverningTokenType"}}]}},{name:"RealmConfig",type:{kind:"struct",fields:[{name:"legacy1",type:"u8"},{name:"legacy2",type:"u8"},{name:"reserved",type:{array:["u8",6]}},{name:"minCommunityWeightToCreateGovernance",type:"u64"},{name:"communityMintMaxVoterWeightSource",type:{defined:"MintMaxVoterWeightSource"}},{name:"councilMint",type:{option:"publicKey"}}]}},{name:"RealmConfigArgsV1",type:{kind:"struct",fields:[{name:"useCouncilMint",type:"bool"},{name:"minCommunityWeightToCreateGovernance",type:"u64"},{name:"communityMintMaxVoterWeightSource",type:{defined:"MintMaxVoterWeightSource"}}]}},{name:"GoverningTokenConfig",type:{kind:"struct",fields:[{name:"voterWeightAddin",type:{option:"publicKey"}},{name:"maxVoterWeightAddin",type:{option:"publicKey"}},{name:"tokenType",type:{defined:"GoverningTokenType"}},{name:"reserved",type:{array:["u8",8]}}]}},{name:"VoteChoice",type:{kind:"struct",fields:[{name:"rank",type:"u8"},{name:"weightPercentage",type:"u8"}]}},{name:"Reserved110",type:{kind:"struct",fields:[{name:"reserved64",type:{array:["u8",64]}},{name:"reserved32",type:{array:["u8",32]}},{name:"reserved14",type:{array:["u8",14]}}]}},{name:"Reserved119",type:{kind:"struct",fields:[{name:"reserved64",type:{array:["u8",64]}},{name:"reserved32",type:{array:["u8",32]}},{name:"reserved23",type:{array:["u8",23]}}]}},{name:"GovernanceAccountType",type:{kind:"enum",variants:[{name:"Uninitialized"},{name:"RealmV1"},{name:"TokenOwnerRecordV1"},{name:"GovernanceV1"},{name:"ProgramGovernanceV1"},{name:"ProposalV1"},{name:"SignatoryRecordV1"},{name:"VoteRecordV1"},{name:"ProposalInstructionV1"},{name:"MintGovernanceV1"},{name:"TokenGovernanceV1"},{name:"RealmConfig"},{name:"VoteRecordV2"},{name:"ProposalTransactionV2"},{name:"ProposalV2"},{name:"ProgramMetadata"},{name:"RealmV2"},{name:"TokenOwnerRecordV2"},{name:"GovernanceV2"},{name:"ProgramGovernanceV2"},{name:"MintGovernanceV2"},{name:"TokenGovernanceV2"},{name:"SignatoryRecordV2"},{name:"ProposalDeposit"},{name:"RequiredSignatory"}]}},{name:"ProposalState",type:{kind:"enum",variants:[{name:"Draft"},{name:"SigningOff"},{name:"Voting"},{name:"Succeeded"},{name:"Executing"},{name:"Completed"},{name:"Cancelled"},{name:"Defeated"},{name:"ExecutingWithErrors"},{name:"Vetoed"}]}},{name:"VoteThreshold",type:{kind:"enum",variants:[{name:"YesVotePercentage",fields:["u8"]},{name:"QuorumPercentage",fields:["u8"]},{name:"Disabled"}]}},{name:"VoteTipping",type:{kind:"enum",variants:[{name:"Strict"},{name:"Early"},{name:"Disabled"}]}},{name:"TransactionExecutionStatus",type:{kind:"enum",variants:[{name:"None"},{name:"Success"},{name:"Error"}]}},{name:"InstructionExecutionFlags",type:{kind:"enum",variants:[{name:"None"},{name:"Ordered"},{name:"UseTransaction"}]}},{name:"MintMaxVoterWeightSource",type:{kind:"enum",variants:[{name:"SupplyFraction",fields:["u64"]},{name:"Absolute",fields:["u64"]}]}},{name:"VoteWeightV1",type:{kind:"enum",variants:[{name:"Yes",fields:["u64"]},{name:"No",fields:["u64"]}]}},{name:"OptionVoteResult",type:{kind:"enum",variants:[{name:"None"},{name:"Succeeded"},{name:"Defeated"}]}},{name:"VoteType",type:{kind:"enum",variants:[{name:"SingleChoice"},{name:"MultiChoice",fields:[{name:"choice_type",type:{defined:"MultiChoiceType"}},{name:"min_voter_options",type:"u8"},{name:"max_voter_options",type:"u8"},{name:"max_winning_options",type:"u8"}]}]}},{name:"MultiChoiceType",type:{kind:"enum",variants:[{name:"FullWeight"},{name:"Weighted"}]}},{name:"SetRealmAuthorityAction",type:{kind:"enum",variants:[{name:"SetUnchecked"},{name:"SetChecked"},{name:"Remove"}]}}
1,{name:"GovernanceInstructionV1",type:{kind:"enum",variants:[{name:"CreateRealm",fields:[{name:"name",type:"string"},{name:"config_args",type:{defined:"RealmConfigArgsV1"}}]},{name:"DepositGoverningTokens",fields:[{name:"amount",type:"u64"}]}]}},{name:"GoverningTokenType",type:{kind:"enum",variants:[{name:"Liquid"},{name:"Membership"},{name:"Dormant"}]}},{name:"Vote",type:{kind:"enum",variants:[{name:"Approve",fields:[{vec:{defined:"VoteChoice"}}]},{name:"Deny"},{name:"Abstain"},{name:"Veto"}]}},{name:"VoteKind",type:{kind:"enum",variants:[{name:"Electorate"},{name:"Veto"}]}},{name:"UnixTimestamp",type:{kind:"alias",value:"i64"}},{name:"Slot",type:{kind:"alias",value:"u64"}}],errors:[{code:500,name:"InvalidInstruction",msg:"Invalid instruction passed to program"},{code:501,name:"RealmAlreadyExists",msg:"Realm with the given name and governing mints already exists"},{code:502,name:"InvalidRealm",msg:"Invalid realm"},{code:503,name:"InvalidGoverningTokenMint",msg:"Invalid Governing Token Mint"},{code:504,name:"GoverningTokenOwnerMustSign",msg:"Governing Token Owner must sign transaction"},{code:505,name:"GoverningTokenOwnerOrDelegateMustSign",msg:"Governing Token Owner or Delegate  must sign transaction"},{code:506,name:"AllVotesMustBeRelinquishedToWithdrawGoverningTokens",msg:"All votes must be relinquished to withdraw governing tokens"},{code:507,name:"InvalidTokenOwnerRecordAccountAddress",msg:"Invalid Token Owner Record account address"},{code:508,name:"InvalidGoverningMintForTokenOwnerRecord",msg:"Invalid GoverningMint for TokenOwnerRecord"},{code:509,name:"InvalidRealmForTokenOwnerRecord",msg:"Invalid Realm for TokenOwnerRecord"},{code:510,name:"InvalidProposalForProposalTransaction",msg:"Invalid Proposal for ProposalTransaction,"},{code:511,name:"InvalidSignatoryAddress",msg:"Invalid Signatory account address"},{code:512,name:"SignatoryAlreadySignedOff",msg:"Signatory already signed off"},{code:513,name:"SignatoryMustSign",msg:"Signatory must sign"},{code:514,name:"InvalidProposalOwnerAccount",msg:"Invalid Proposal Owner"},{code:515,name:"InvalidProposalForVoterRecord",msg:"Invalid Proposal for VoterRecord"},{code:516,name:"InvalidGoverningTokenOwnerForVoteRecord",msg:"Invalid GoverningTokenOwner for VoteRecord"},{code:517,name:"InvalidVoteThresholdPercentage",msg:"Invalid Governance config: Vote threshold percentage out of range"},{code:518,name:"ProposalAlreadyExists",msg:"Proposal for the given Governance, Governing Token Mint and index already exists"},{code:519,name:"VoteAlreadyExists",msg:"Token Owner already voted on the Proposal"},{code:520,name:"NotEnoughTokensToCreateProposal",msg:"Owner doesn't have enough governing tokens to create Proposal"},{code:521,name:"InvalidStateCannotEditSignatories",msg:"Invalid State: Can't edit Signatories"},{code:522,name:"InvalidProposalState",msg:"Invalid Proposal state"},{code:523,name:"InvalidStateCannotEditTransactions",msg:"Invalid State: Can't edit transactions"},{code:524,name:"InvalidStateCannotExecuteTransaction",msg:"Invalid State: Can't execute transaction"},{code:525,name:"CannotExecuteTransactionWithinHoldUpTime",msg:"Can't execute transaction within its hold up time"},{code:526,name:"TransactionAlreadyExecuted",msg:"Transaction already executed"},{code:527,name:"InvalidTransactionIndex",msg:"Invalid Transaction index"},{code:528,name:"TransactionHoldUpTimeBelowRequiredMin",msg:"Transaction hold up time is below the min specified by Governance"},{code:529,name:"TransactionAlreadyExists",msg:"Transaction at the given index for the Proposal already exists"},{code:530,name:"InvalidStateCannotSignOff",msg:"Invalid State: Can't sign off"},{code:531,name:"InvalidStateCannotVote",msg:"Invalid State: Can't vote"},{code:532,name:"InvalidStateCannotFinalize",msg:"Invalid State: Can't finalize vote"},{code:533,name:"InvalidStateCannotCancelProposal",msg:"Invalid State: Can't cancel Proposal"},{code:534,name:"VoteAlreadyRelinquished",msg:"Vote already relinquished"},{code:535,name:"CannotFinalizeVotingInProgress",msg:"Can't finalize vote. Voting still in progress"},{code:536,name:"ProposalVotingTimeExpired",msg:"Proposal voting time expired"},{code:537,name:"InvalidSignatoryMint",msg:"Invalid Signatory Mint"},{code:538,name:"InvalidGovernanceForProposal",msg:"Proposal does not belong to the given Governance"},{code:539,name:"InvalidGoverningMintForProposal",msg:"Proposal does not belong to given Governing Mint"},{code:540,name:"MintAuthorityMustSign",msg:"Current mint authority must sign transaction"},{code:541,name:"InvalidMintAuthority",msg:"Invalid mint authority"},{code:542,name:"MintHasNoAuthority",msg:"Mint has no authority"},{code:543,name:"SplTokenAccountWithInvalidOwner",msg:"Invalid Token account owner"},{code:544,name:"SplTokenMintWithInvalidOwner",msg:"Invalid Mint account owner"},{code:545,name:"SplTokenAccountNotInitialized",msg:"Token Account is not initialized"},{code:546,name:"SplTokenAccountDoesNotExist",msg:"Token Account doesn't exist"},{code:547,name:"SplTokenInvalidTokenAccountData",msg:"Token account data is invali
1d"},{code:548,name:"SplTokenInvalidMintAccountData",msg:"Token mint account data is invalid"},{code:549,name:"SplTokenMintNotInitialized",msg:"Token Mint account is not initialized"},{code:550,name:"SplTokenMintDoesNotExist",msg:"Token Mint account doesn't exist"},{code:551,name:"InvalidProgramDataAccountAddress",msg:"Invalid ProgramData account address"},{code:552,name:"InvalidProgramDataAccountData",msg:"Invalid ProgramData account Data"},{code:553,name:"InvalidUpgradeAuthority",msg:"Provided upgrade authority doesn't match current program upgrade authority"},{code:554,name:"UpgradeAuthorityMustSign",msg:"Current program upgrade authority must sign transaction"},{code:555,name:"ProgramNotUpgradable",msg:"Given program is not upgradable"},{code:556,name:"InvalidTokenOwner",msg:"Invalid token owner"},{code:557,name:"TokenOwnerMustSign",msg:"Current token owner must sign transaction"},{code:558,name:"VoteThresholdTypeNotSupported",msg:"Given VoteThresholdType is not supported"},{code:559,name:"VoteWeightSourceNotSupported",msg:"Given VoteWeightSource is not supported"},{code:560,name:"Legacy1",msg:"Legacy1"},{code:561,name:"GovernancePdaMustSign",msg:"Governance PDA must sign"},{code:562,name:"TransactionAlreadyFlaggedWithError",msg:"Transaction already flagged with error"},{code:563,name:"InvalidRealmForGovernance",msg:"Invalid Realm for Governance"},{code:564,name:"InvalidAuthorityForRealm",msg:"Invalid Authority for Realm"},{code:565,name:"RealmHasNoAuthority",msg:"Realm has no authority"},{code:566,name:"RealmAuthorityMustSign",msg:"Realm authority must sign"},{code:567,name:"InvalidGoverningTokenHoldingAccount",msg:"Invalid governing token holding account"},{code:568,name:"RealmCouncilMintChangeIsNotSupported",msg:"Realm council mint change is not supported"},{code:569,name:"InvalidMaxVoterWeightAbsoluteValue",msg:"Invalid max voter weight absolute value"},{code:570,name:"InvalidMaxVoterWeightSupplyFraction",msg:"Invalid max voter weight supply fraction"},{code:571,name:"NotEnoughTokensToCreateGovernance",msg:"Owner doesn't have enough governing tokens to create Governance"},{code:572,name:"TooManyOutstandingProposals",msg:"Too many outstanding proposals"},{code:573,name:"AllProposalsMustBeFinalisedToWithdrawGoverningTokens",msg:"All proposals must be finalized to withdraw governing tokens"},{code:574,name:"InvalidVoterWeightRecordForRealm",msg:"Invalid VoterWeightRecord for Realm"},{code:575,name:"InvalidVoterWeightRecordForGoverningTokenMint",msg:"Invalid VoterWeightRecord for GoverningTokenMint"},{code:576,name:"InvalidVoterWeightRecordForTokenOwner",msg:"Invalid VoterWeightRecord for TokenOwner"},{code:577,name:"VoterWeightRecordExpired",msg:"VoterWeightRecord expired"},{code:578,name:"InvalidRealmConfigForRealm",msg:"Invalid RealmConfig for Realm"},{code:579,name:"TokenOwnerRecordAlreadyExists",msg:"TokenOwnerRecord already exists"},{code:580,name:"GoverningTokenDepositsNotAllowed",msg:"Governing token deposits not allowed"},{code:581,name:"InvalidVoteChoiceWeightPercentage",msg:"Invalid vote choice weight percentage"},{code:582,name:"VoteTypeNotSupported",msg:"Vote type not supported"},{code:583,name:"InvalidProposalOptions",msg:"Invalid proposal options"},{code:584,name:"ProposalIsNotExecutable",msg:"Proposal is not not executable"},{code:585,name:"DenyVoteIsNotAllowed",msg:"Deny vote is not allowed"},{code:586,name:"CannotExecuteDefeatedOption",msg:"Cannot execute defeated option"},{code:587,name:"VoterWeightRecordInvalidAction",msg:"VoterWeightRecord invalid action"},{code:588,name:"VoterWeightRecordInvalidActionTarget",msg:"VoterWeightRecord invalid action target"},{code:589,name:"InvalidMaxVoterWeightRecordForRealm",msg:"Invalid MaxVoterWeightRecord for Realm"},{code:590,name:"InvalidMaxVoterWeightRecordForGoverningTokenMint",msg:"Invalid MaxVoterWeightRecord for GoverningTokenMint"},{code:591,name:"MaxVoterWeightRecordExpired",msg:"MaxVoterWeightRecord expired"},{code:592,name:"NotSupportedVoteType",msg:"Not supported VoteType"},{code:593,name:"RealmConfigChangeNotAllowed",msg:"RealmConfig change not allowed"},{code:594,name:"GovernanceConfigChangeNotAllowed",msg:"GovernanceConfig change not allowed"},{code:595,name:"AtLeastOneVoteThresholdRequired",msg:"At least one VoteThreshold is required"},{code:596,name:"ReservedBufferMustBeEmpty",msg:"Reserved buffer must be empty"},{code:597,name:"CannotRelinquishInFinalizingState",msg:"Cannot Relinquish in Finalizing state"},{code:598,name:"InvalidRealmConfigAddress",msg:"Invalid RealmConfig account address"}
1,{code:599,name:"CannotDepositDormantTokens",msg:"Cannot deposit dormant tokens"},{code:600,name:"CannotWithdrawMembershipTokens",msg:"Cannot withdraw membership tokens"},{code:601,name:"CannotRevokeGoverningTokens",msg:"Cannot revoke GoverningTokens"},{code:602,name:"InvalidRevokeAmount",msg:"Invalid Revoke amount"},{code:603,name:"InvalidGoverningTokenSource",msg:"Invalid GoverningToken source"},{code:604,name:"CannotChangeCommunityTokenTypeToMembership",msg:"Cannot change community TokenType to Membership"},{code:605,name:"VoterWeightThresholdDisabled",msg:"Voter weight threshold disabled"},{code:606,name:"VoteNotAllowedInCoolOffTime",msg:"Vote not allowed in cool off time"},{code:607,name:"CannotRefundProposalDeposit",msg:"Cannot refund ProposalDeposit"},{code:608,name:"InvalidProposalForProposalDeposit",msg:"Invalid Proposal for ProposalDeposit"},{code:609,name:"InvalidDepositExemptProposalCount",msg:"Invalid deposit_exempt_proposal_count"},{code:610,name:"GoverningTokenMintNotAllowedToVote",msg:"GoverningTokenMint not allowed to vote"},{code:611,name:"InvalidDepositPayerForProposalDeposit",msg:"Invalid deposit Payer for ProposalDeposit"},{code:612,name:"InvalidStateNotFinal",msg:"Invalid State: Proposal is not in final state"},{code:613,name:"InvalidStateToCompleteProposal",msg:"Invalid state for proposal state transition to Completed"},{code:614,name:"InvalidNumberOfVoteChoices",msg:"Invalid number of vote choices"},{code:615,name:"RankedVoteIsNotSupported",msg:"Ranked vote is not supported"},{code:616,name:"ChoiceWeightMustBe100Percent",msg:"Choice weight must be 100%"},{code:617,name:"SingleChoiceOnlyIsAllowed",msg:"Single choice only is allowed"},{code:618,name:"AtLeastSingleChoiceIsRequired",msg:"At least single choice is required"},{code:619,name:"TotalVoteWeightMustBe100Percent",msg:"Total vote weight must be 100%"},{code:620,name:"InvalidMultiChoiceProposalParameters",msg:"Invalid multi choice proposal parameters"},{code:621,name:"InvalidGovernanceForRequiredSignatory",msg:"Invalid Governance for RequiredSignatory"},{code:622,name:"SignatoryRecordAlreadyExists",msg:"Signatory Record has already been created"},{code:623,name:"InstructionDeprecated",msg:"Instruction has been removed"},{code:624,name:"MissingRequiredSignatories",msg:"Proposal is missing required signatories"}],metadata:{origin:"shank",address:"GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"}},T=n(2643),I=new T.PublicKey("GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"),M=new T.PublicKey("gCHAtYKrUUktTVzE4hEnZdLV4LXrdBf6Hh9qMaJALET"),R=v(n(9404)),x=n(2643),C=class{constructor(e){this.programId=e}realmAccount({name:e}){const t=x.PublicKey.findProgramAddressSync([o.from("governance"),o.from(e)],this.programId);return{publicKey:t[0],bump:t[1]}}communityTokenHoldingAccount({realmAccount:e,communityMint:t}){const n=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}councilTokenHoldingAccount({realmAccount:e,councilMint:t}){const n=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}realmConfigAccount({realmAccount:e}){const t=x.PublicKey.findProgramAddressSync([o.from("realm-config"),e.toBuffer()],this.programId);return{publicKey:t[0],bump:t[1]}}tokenOwnerRecordAccount({realmAccount:e,governingTokenMintAccount:t,governingTokenOwner:n}){const r=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer(),n.toBuffer()],this.programId);return{publicKey:r[0],bump:r[1]}}governingTokenHoldingAccount({realmAccount:e,governingTokenMintAccount:t}){const n=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}governanceAccount({realmAccount:e,seed:t}){const n=x.PublicKey.findProgramAddressSync([o.from("account-governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}nativeTreasuryAccount({governanceAccount:e}){const t=x.PublicKey.findProgramAddressSync([o.from("native-treasury"),e.toBuffer()],this.programId);return{publicKey:t[0],bump:t[1]}}proposalAccount({governanceAccount:e,governingTokenMint:t,proposalSeed:n}){const r=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer(),n.toBuffer()],this.programId);return{publicKey:r[0],bump:r[1]}}proposalDepositAccount({proposal:e,depositPayer:t}){const n=x.PublicKey.findProgramAddressSync([o.from("proposal-deposit"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}signatoryRecordAccount({proposal:e,signatory:t}){const n=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}proposalTransactionAccount({proposal:e,optionIndex:t,index:n}){const r=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),new R.default(t).toArrayLike(o,"le",1),new R.default(n).toArrayLike(o,"le",2)],this.programId);return{publicKey:r[0],bump:r[1]}}voteRecordAccount({proposal:e,tokenOwnerRecord:t}){const n=x.PublicKey.findProgramAddressSync([o.from("governance"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}requiredSignatoryAccount({governanceAccount:e,signatory:t}){const n=x.PublicKey.findProgramAddressSync([o.from("required-signatory"),e.toBuffer(),t.toBuffer()],this.programId);return{publicKey:n[0],bump:n[1]}}},O=v(n(9404));function P(e,t,n){var r;e.data=e.data.subarray(8);const i=null==(r=n.idl.instructions.find((e=>e.name===t)))?void 0:r.discriminant.value;if(void 0===i)throw new Error(`Invalid Instruction Name - ${t}`);const s=o.from(i.toString(16).padStart(2,"0"),"hex");return e.data=o.concat([s,e.data]),"executeTransaction"!==t&&(e.keys=e.keys.filter((e=>
1e.pubkey.toBase58()!==n.programId.toBase58()))),e}var N=v(n(9404)),B=v(n(9404)),V=n(2643),L=n(2643),D=n(9404),j=v(n(9404)),U=n(4260),W=n(2643),z={version:"0.2.9",name:"spl_governance_chat",instructions:[{name:"postMessage",accounts:[{name:"governanceProgramId",isMut:!1,isSigner:!1},{name:"realmAccount",isMut:!1,isSigner:!1},{name:"governanceAccount",isMut:!1,isSigner:!1},{name:"proposalAccount",isMut:!1,isSigner:!1},{name:"tokenOwnerRecord",isMut:!1,isSigner:!1},{name:"governanceAuthority",isMut:!1,isSigner:!0,docs:["token owner or governance delegate"]},{name:"chatMessage",isMut:!0,isSigner:!0},{name:"payer",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"replyToMessage",isMut:!1,isSigner:!1,isOptional:!0},{name:"realmConfigAccount",isMut:!1,isSigner:!1},{name:"voterWeightRecord",isMut:!1,isSigner:!1,isOptional:!0}],args:[{name:"body",type:{defined:"MessageBody"}},{name:"isReply",type:"bool"}],discriminant:{type:"u8",value:0}}],accounts:[{name:"chatMessage",type:{kind:"struct",fields:[{name:"accountType",type:{defined:"GovernanceChatAccountType"}},{name:"proposal",type:"publicKey"},{name:"author",type:"publicKey"},{name:"postedAt",type:{defined:"UnixTimestamp"}},{name:"replyTo",type:{option:"publicKey"}},{name:"body",type:{defined:"MessageBody"}}]}}],types:[{name:"GovernanceChatAccountType",type:{kind:"enum",variants:[{name:"Uninitialized"},{name:"ChatMessage"}]}},{name:"MessageBody",type:{kind:"enum",variants:[{name:"Text",fields:["string"]},{name:"Reaction",fields:["string"]}]}},{name:"UnixTimestamp",type:{kind:"alias",value:"i64"}}],errors:[{code:900,name:"NotEnoughTokensToCommentProposal",msg:"Owner doesn't have enough governing tokens to comment on Proposal"},{code:901,name:"AccountAlreadyInitialized",msg:"Account already initialized"}],metadata:{origin:"shank",address:"gCHAtYKrUUktTVzE4hEnZdLV4LXrdBf6Hh9qMaJALET"}},G={version:"0.1.4",name:"spl_governance_addin_api",instructions:[],accounts:[{name:"maxVoterWeightRecord",type:{kind:"struct",fields:[{name:"accountDiscriminator",type:{array:["u8",8]}},{name:"realm",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"maxVoterWeight",type:"u64"},{name:"maxVoterWeightExpiry",type:{option:{defined:"Slot"}}},{name:"reserved",type:{array:["u8",8]}}]}},{name:"voterWeightRecord",type:{kind:"struct",fields:[{name:"accountDiscriminator",type:{array:["u8",8]}},{name:"realm",type:"publicKey"},{name:"governingTokenMint",type:"publicKey"},{name:"governingTokenOwner",type:"publicKey"},{name:"voterWeight",type:"u64"},{name:"voterWeightExpiry",type:{option:{defined:"Slot"}}},{name:"weightAction",type:{option:{defined:"VoterWeightAction"}}},{name:"weightActionTarget",type:{option:"publicKey"}},{name:"reserved",type:{array:["u8",8]}}]}}],types:[{name:"VoterWeightAction",type:{kind:"enum",variants:[{name:"CastVote"},{name:"CommentProposal"},{name:"CreateGovernance"},{name:"CreateProposal"},{name:"SignOffProposal"}]}},{name:"Slot",type:{kind:"alias",value:"u64"}}]},K=n(4442),F=n(2643);function q(e,t,n,r){const i="chat"===r?new K.BorshAccountsCoder(z):"addin"===r?new K.BorshAccountsCoder(G):new K.BorshAccountsCoder(E),s=o.concat([o.from("0".repeat(16),"hex"),t]);return m(y({},i.decodeUnchecked(e,s)),{publicKey:n})}function H(e,t,n,r){return b(this,null,(function*(){const o=yield e.getAccountInfo(t);if(null==o?void 0:o.data)return m(y({},q(n,o.data,t,r)),{balance:o.lamports/F.LAMPORTS_PER_SOL});throw Error("The account doesn't exist.")}))}function Y(e,t,n,r,o,i,s,a){return b(this,null,(function*(){const c=[];return r&&c.push({memcmp:{offset:0,bytes:r}}),o&&i&&o.forEach(((e,t)=>{const n=i[t];c.push({memcmp:{offset:e,bytes:"string"==typeof n?n:n.toBase58()}})})),s&&c.push({dataSize:s}),(yield e.getProgramAccounts(t,{filters:c})).map((e=>{if(!e.account.data)throw Error("The account doesn't exist.");try{return m(y({},q(n,e.account.data,e.pubkey,a)),{balance:e.account.lamports/F.LAMPORTS_PER_SOL})}catch(e){return}})).filter((e=>void 0!==e))}))}var $=class{constructor(e,t){this.connection=e,this.programId=null!=t?t:I,this._provider=new _.AnchorProvider(this.connection,{},{commitment:"confirmed"}),this.program=new _.Program(E,this.programId,this._provider),this.pda=new C(this.programId)}getRealmByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"realmV2")}))}getRealmByName(e){return b(this,null,(function*(){const t=this.pda.realmAccount({name:e}).publicKey;return this.getRealmByPubkey(t)}))}getAllRealms(){return b(this,null,(function*(){return Y(this.connection,this.programId,"realmV2","H")}))}getRealmsByCommunityMint(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"realmV2","H",[1],[e])}))}getRealmV1ByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"realmV1")}))}getRealmV1ByName(e){return b(this,null,(function*(){const t=this.pda.realmAccount({name:e}).publicKey;return this.getRealmV1ByPubkey(t)}))}getAllV1Realms(){return b(this,null,(function*(){return Y(this.connection,this.programId,"realmV1","2")}))}getV1RealmsByCommunityMint(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"realmV1","2",[1],[e])}))}getRealmConfigByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"realmConfigAccount")}
1))}getRealmConfigByRealm(e){return b(this,null,(function*(){const t=this.pda.realmConfigAccount({realmAccount:e}).publicKey;return this.getRealmConfigByPubkey(t)}))}getAllRealmConfigs(){return b(this,null,(function*(){return Y(this.connection,this.programId,"realmConfigAccount","C")}))}getTokenOwnerRecordByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"tokenOwnerRecordV2")}))}getTokenOwnerRecord(e,t,n){return b(this,null,(function*(){const r=this.pda.tokenOwnerRecordAccount({realmAccount:e,governingTokenMintAccount:n,governingTokenOwner:t}).publicKey;return this.getTokenOwnerRecordByPubkey(r)}))}getTokenOwnerRecordsForRealm(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"tokenOwnerRecordV2","J",[1],[e])}))}getTokenOwnerRecordAddressesForRealm(e){return b(this,null,(function*(){return function(e,t,n,r,o,i){return b(this,null,(function*(){const n=[];return n.push({memcmp:{offset:0,bytes:"J"}}),o&&i&&o.forEach(((e,t)=>{const r=i[t];n.push({memcmp:{offset:e,bytes:"string"==typeof r?r:r.toBase58()}})})),(yield e.getProgramAccounts(t,{filters:n,dataSlice:{length:0,offset:0}})).map((e=>e.pubkey))}))}(this.connection,this.programId,0,0,[1],[e])}))}getTokenOwnerRecordsForOwner(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"tokenOwnerRecordV2","J",[65],[e])}))}getTokenOwnerRecordsForMint(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"tokenOwnerRecordV2","J",[33],[e])}))}getAllTokenOwnerRecords(){return b(this,null,(function*(){return Y(this.connection,this.programId,"tokenOwnerRecordV2","J")}))}getDelegateRecordsForUserInRealm(e,t,n){return b(this,null,(function*(){const r=n?[1,33,122]:[1,122],o=n?[e,n,t]:[e,t];return Y(this.connection,this.programId,"tokenOwnerRecordV2","J",r,o)}))}getGovernanceAccountByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"governanceV2")}))}getGovernanceAccountsByRealm(e){return b(this,null,(function*(){return yield Y(this.connection,this.programId,"governanceV2",void 0,[1],[e],236)}))}getGovernanceAccountV1ByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"governanceV1")}))}getV1GovernanceAccountsByRealm(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"governanceV1","4",[1],[e])}))}getProposalByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"proposalV2")}))}getProposalsforGovernance(e,t){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalV2","F",t?[1,65]:[1],t?["3",e]:[e])}))}getProposalsByTokenOwnerRecord(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalV2","F",[66],[e])}))}getAllProposals(){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalV2","F")}))}getAllV1Proposals(){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalV1","6")}
1))}getProposalDepositByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"proposalDeposit")}))}getAllProposalDeposits(){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalDeposit","Q")}))}getProposalDepositByProposal(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalDeposit","Q",[1],[e])}))}getProposalTransactionByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"proposalTransactionV2")}))}getAllProposalInstructions(){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalInstructionV1","9")}))}getProposalTransactionsByProposal(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalTransactionV2","E",[1],[e])}))}getAllProposalTransactions(){return b(this,null,(function*(){return Y(this.connection,this.programId,"proposalTransactionV2","E")}))}getSignatoryRecordByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"signatoryRecordV2")}))}getSignatoryRecord(e,t){return b(this,null,(function*(){const n=this.pda.signatoryRecordAccount({proposal:e,signatory:t}).publicKey;return this.getSignatoryRecordByPubkey(n)}))}getSignatoryRecordsForProposal(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"signatoryRecordV2","P",[1],[e])}))}getAllSignatoryRecords(){return b(this,null,(function*(){return Y(this.connection,this.programId,"signatoryRecordV2","P")}))}getVoteRecordByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"voteRecordV2")}))}getVoteRecord(e,t){return b(this,null,(function*(){const n=this.pda.voteRecordAccount({proposal:e,tokenOwnerRecord:t}).publicKey;return this.getVoteRecordByPubkey(n)}))}getVoteRecordsForProposal(e){return b(this,null,(function*(){return Y(this.connection,this.programId,"voteRecordV2","D",[1],[e])}))}getVoteRecordsForUser(e,t){return b(this,null,(function*(){return Y(this.connection,this.programId,"voteRecordV2","D",t?[33,65]:[33],t?[e,"1"]:[e])}))}getAllVoteRecords(){return b(this,null,(function*(){return Y(this.connection,this.programId,"voteRecordV2","D")}))}getAllV1VoteRecords(){return b(this,null,(function*(){return Y(this.connection,this.programId,"voteRecordV1","8")}))}getChatMessageByPubkey(e){return b(this,null,(function*(){return H(this.connection,e,"chatMessage","chat")}))}getChatMessagesByProposal(e){return b(this,null,(function*(){return Y(this.connection,M,"chatMessage","2",[1],[e],void 0,"chat")}))}getAllChatMessages(){return b(this,null,(function*(){return Y(this.connection,M,"chatMessage","2",void 0,void 0,void 0,"chat")}))}getVoterWeightRecord(e){return b(this,null,(function*(){return H(this.connection,e,"voterWeightRecord","addin")}))}getAllVoterWeightRecords(){return b(this,null,(function*(){return Y(this.connection,this.programId,"voterWeightRecord","8riZd8mYDQk",void 0,void 0,void 0,"addin")}))}getMaxVoterWeightRecord(e){return b(this,null,(function*(){return H(this.connection,e,"maxVoterWeightRecord","addin")}))}createRealmInstruction(e,t,n,r){return b(this,arguments,(function*(e,t,n,r,o={type:"supplyFraction",amount:new S.default(Math.pow(10,10))},i,s="liquid",a="liquid",c,u,l,h){return yield function(e,t,n,r,o,i,s,a,c,u,l,h,d,f){return b(this,null,(function*(){const p="liquid"===o?{liquid:{}}:"membership"===o?{membership:{}}:{dormant:{}},g="liquid"===i?{liquid:{}}:"membership"===i?{membership:{}}:{dormant:{}},y=c.realmAccount({name:e}).publicKey,m=c.communityTokenHoldingAccount({realmAccount:y,communityMint:t}).publicKey,w=u?c.councilTokenHoldingAccount({realmAccount:y,councilMint:u||t}).publicKey:null,v=c.realmConfigAccount({realmAccount:y}).publicKey,b="number"==typeof n?new O.default(n):n;return P(yield s.methods.createRealm(e,{useCouncilMint:void 0!==u,minCommunityWeightToCreateGovernance:b,communityMintMaxVoterWeightSource:"absolute"===r.type?{absolute:[r.amount]}:{supplyFraction:[r.amount]},communityTokenConfigArgs:{useVoterWeightAddin:void 0!==l,useMaxVoterWeightAddin:void 0!==h,tokenType:p},councilTokenConfigArgs:{useVoterWeightAddin:void 0!==d,useMaxVoterWeightAddin:void 0!==f,tokenType:g}}).accounts({realmAccount:y,realmAuthority:a,payer:a,communityTokenMint:t,communityTokenHoldingAccount:m,councilTokenMint:null!=u?u:null,councilTokenHoldingAccount:w,realmConfig:v,communityVoterWeightAddin:null!=l?l:null,maxCommunityVoterWeightAddin:null!=h?h:null,councilVoterWeightAddin:null!=d?d:null,maxCouncilVoterWeightAddin:null!=f?f:null}).instruction(),"createRealm",s)}))}(e,t,n,o,s,a,this.program,r,this.pda,i,c,u,l,h)}))}depositGoverningTokensInstruction(e,t,n,r,o,i,s){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c){return b(this,null,(function*(){const u=c.governingTokenHoldingAccount({realmAccount:e,governingTokenMintAccount:t}).publicKey,l=c.tokenOwnerRecordAccount({realmAccount:e,governingTokenMintAccount:t,governingTokenOwner:r}).publicKey,h=c.realmConfigAccount({realmAccount:e}
1).publicKey,d="number"==typeof i?new N.default(i):i;return P(yield s.methods.depositGoverningTokens(d).accounts({realmAccount:e,governingTokenHoldingAccount:u,governingTokenOwnerAccount:r,governingTokenSourceAccount:n,governingTokenSourceAccountAuthority:o,realmConfigAccount:h,tokenOwnerRecord:l,payer:a}).instruction(),"depositGoverningTokens",s)}))}(e,t,n,r,o,s,this.program,i,this.pda)}))}withdrawGoverningTokensInstruction(e,t,n,r){return b(this,null,(function*(){return yield function(e,t,n,r,o,i){return b(this,null,(function*(){const s=i.governingTokenHoldingAccount({realmAccount:e,governingTokenMintAccount:t}).publicKey,a=i.tokenOwnerRecordAccount({realmAccount:e,governingTokenMintAccount:t,governingTokenOwner:r}).publicKey,c=i.realmConfigAccount({realmAccount:e}).publicKey;return P(yield o.methods.withdrawGoverningTokens().accounts({realmAccount:e,governingTokenHoldingAccount:s,governingTokenDestinationAccount:n,governingTokenOwnerAccount:r,realmConfigAccount:c,tokenOwnerRecord:a}).instruction(),"withdrawGoverningTokens",o)}))}(e,t,n,r,this.program,this.pda)}))}setGovernanceDelegateInstruction(e,t,n){return b(this,null,(function*(){return yield function(e,t,n,r){return b(this,null,(function*(){return P(yield r.methods.setGovernanceDelegate(n).accounts({currentDelegateOrOwner:t,tokenOwnerRecord:e}).instruction(),"setGovernanceDelegate",r)}))}(e,t,n,this.program)}))}createGovernanceInstruction(e,t,n){return b(this,arguments,(function*(e,t,n,r=k.SystemProgram.programId,o,i,s){return yield function(e,t,n,r,o,i,s,a,c){return b(this,null,(function*(){const u=null!=a?a:V.Keypair.generate().publicKey,l=s.governanceAccount({realmAccount:t,seed:u}).publicKey,h=s.realmConfigAccount({realmAccount:t}).publicKey,d=m(y({},e),{minCommunityWeightToCreateProposal:"number"==typeof e.minCommunityWeightToCreateProposal?new B.default(e.minCommunityWeightToCreateProposal):e.minCommunityWeightToCreateProposal,minCouncilWeightToCreateProposal:"number"==typeof e.minCouncilWeightToCreateProposal?new B.default(e.minCouncilWeightToCreateProposal):e.minCouncilWeightToCreateProposal});return P(yield i.methods.createGovernance(d).accounts({realmAccount:t,governanceAccount:l,governedAccount:u,governingTokenOwnerRecord:r,realmConfigAccount:h,voterWeightRecord:null!=c?c:null,governanceAuthority:n,payer:o}).instruction(),"createGovernance",i)}))}(e,t,n,r,o,this.program,this.pda,i,s)}))}createProposalInstruction(e,t,n,r,o,i,s,a,c,u,l,h,d){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c,u,l,h,d,f,p){return b(this,null,(function*(){const g=null!=f?f:L.Keypair.generate().publicKey,w=d.proposalAccount({governanceAccount:s,governingTokenMint:c,proposalSeed:g}).publicKey,v=d.realmConfigAccount({realmAccount:i}).publicKey,b=d.proposalDepositAccount({proposal:w,depositPayer:l}).publicKey,A="single"===n.choiceType?{singleChoice:{}}:{multiChoice:m(y({},n.multiChoiceOptions),{choiceType:"fullWeight"===n.multiChoiceOptions.choiceType?{fullWeight:{}}:{weighted:{}}})};return P(yield h.methods.createProposal(e,t,A,r,o,g).accounts({realmAccount:i,proposalAccount:w,governanceAccount:s,tokenOwnerRecord:a,governingTokenMint:c,governanceAuthority:u,voterWeightRecord:null!=p?p:null,realmConfig:v,proposalDepositAccount:b,payer:l}).instruction(),"createProposal",h)}))}(e,t,n,r,o,i,s,a,c,u,l,this.program,this.pda,h,d)}))}addSignatoryInstruction(e,t,n,r,o){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s){return b(this,null,(function*(){const a=s.signatoryRecordAccount({proposal:t,signatory:e}).publicKey;return P(yield i.methods.addSignatory(e).accounts({proposalAccount:t,tokenOwnerRecord:n,governanceAuthority:r,payer:o,signatoryRecordAccount:a}).instruction(),"addSignatory",i)}))}(e,t,n,r,o,this.program,this.pda)}))}insertTransactionInstruction(e,t,n,r,o,i,s,a,c){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c,u,l){return b(this,null,(function*(){const h=l.proposalTransactionAccount({proposal:i,optionIndex:t,index:n}).publicKey,d=e.map((e=>({programId:e.programId,accounts:e.keys,data:e.data})));return P(yield u.methods.insertTransaction(t,n,r,d).accounts({governanceAccount:o,proposalAccount:i,tokenOwnerRecord:s,governanceAuthority:a,proposalTransactionAccount:h,payer:c}).instruction(),"insertTransaction",u)}))}(e,t,n,r,o,i,s,a,c,this.program,this.pda)}))}removeTransactionInstruction(e,t,n,r,o){return b(this,null,(function*(){return yield function(e,t,n,r,o,i){return b(this,null,(function*(){return P(yield i.methods.removeTransaction().accounts({proposalAccount:e,tokenOwnerRecord:t,governanceAuthority:n,proposalTransactionAccount:r,beneficiaryAccount:o}).instruction(),"removeTransaction",i)}))}(e,t,n,r,o,this.program)}))}cancelProposalInstruction(e,t,n,r,o){return b(this,null,(function*(){return yield function(e,t,n,r,o,i){return b(this,null,(function*(){return P(yield i.methods.cancelProposal().accounts({realmAccount:e,governanceAccount:t,proposalAccount:n,tokenOwnerRecord:r,governanceAuthority:o}).instruction(),"cancelProposal",i)}))}(e,t,n,r,o,this.program)}))}signOffProposalInstruction(e,t,n,r,o,i){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s){return b(this,null,(function*(){if(!i&&!s)throw new Error("One of the signatoryRecordAccount or tokenOwnerRecord is required");const a=null!=i?i:s;return P(yield o.methods.signOffProposal().accounts({realmAccount:e,governanceAccount:t,proposalAccount:n,tokenOwnerRecord:a,signatoryAccount:r}).instruction(),"signOffProposal",o)}))}(e,t,n,r,this.program,o,i)}))}castVoteInstruction(e,t,n,r,o,i,s,a,c,u,l){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c,u,l,h,d){return b(this,null,(function*(){const f=l.realmConfigAccount({realmAccount:t}).publicKey,p=l.voteRecordAccount({proposal:r,tokenOwnerRecord:i}).publicKey;return P(yield u.methods.castVote(e).accounts({realmAccount:t,governanceAccount:n,proposalAccount:r,proposalTokenOwnerRecord:o,voterTokenOwnerRecord:i,governanceAuthority:s,governingTokenMint:a,payer:c,voterWeightRecord:null!=h?h:null,maxVoterWeightRecord:null!=d?d:null,realmConfigAccount:f,proposalVoteRecord:p}).instruction(),"castVote",u)}))}(e,t,n,r,o,i,s,a,c,this.program,this.pda,u,l)}))}finalizeVoteInstruction(e,t,n,r,o,i){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a){return b(this,null,(function*(){const c=s.realmConfigAccount({realmAccount:e}).publicKey;return P(yield i.methods.finalizeVote().accounts({realmAccount:e,governanceAccount:t,proposalAccount:n,tokenOwnerRecord:r,governingTokenMint:o,realmConfig:c,maxVoterWeightRecord:null!=a?a:null}).instruction(),"finalizeVote",i)}))}(e,t,n,r,o,this.program,this.pda,i)}))}relinquishVoteInstruction(e,t,n,r,o,i,s){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c){return b(this,null,(function*(){const u=s.voteRecordAccount({proposal:n,tokenOwnerRecord:r}).publicKey;return P(yield i.methods.relinquishVote().accounts({realmAccount:e,governanceAccount:t,proposalAccount:n,tokenOwnerRecord:r,governanceAuthority:null!=a?a:null,governingTokenMint:o,benef
1iciaryAccount:null!=c?c:null,proposalVoteRecord:u}).instruction(),"relinquishVote",i)}))}(e,t,n,r,o,this.program,this.pda,i,s)}))}executeTransactionInstruction(e,t,n,r){return b(this,null,(function*(){return yield function(e,t,n,r,o){return b(this,null,(function*(){return P(yield o.methods.executeTransaction().accounts({governanceAccount:e,proposalAccount:t,proposalTransactionAccount:n}).remainingAccounts(r).instruction(),"executeTransaction",o)}))}(e,t,n,r,this.program)}))}createNativeTreasuryInstruction(e,t){return b(this,null,(function*(){return function(e,t,n,r){return b(this,null,(function*(){const o=r.nativeTreasuryAccount({governanceAccount:e}).publicKey;return P(yield n.methods.createNativeTreasury().accounts({governanceAccount:e,nativeTreasuryAccount:o,payer:t}).instruction(),"createNativeTreasury",n)}))}(e,t,this.program,this.pda)}))}setGovernanceConfigInstruction(e,t){return b(this,null,(function*(){return yield function(e,t,n){return b(this,null,(function*(){const r=y({},e);return r.minCommunityWeightToCreateProposal="number"==typeof r.minCommunityWeightToCreateProposal?new D.BN(r.minCommunityWeightToCreateProposal):r.minCommunityWeightToCreateProposal,r.minCouncilWeightToCreateProposal="number"==typeof r.minCouncilWeightToCreateProposal?new D.BN(r.minCouncilWeightToCreateProposal):r.minCouncilWeightToCreateProposal,P(yield n.methods.setGovernanceConfig(r).accounts({governanceAccount:t}).instruction(),"setGovernanceConfig",n)}))}(e,t,this.program)}))}setRealmAuthorityInstruction(e,t,n,r){return b(this,null,(function*(){return yield function(e,t,n,r,o){return b(this,null,(function*(){if("remove"!==n&&!o)throw new Error("New Realm Authority is required!");const i="remove"===n?{remove:{}}:"setChecked"===n?{setChecked:{}}:{setUnchecked:{}};return P(yield r.methods.setRealmAuthority(i).accounts({realmAccount:e,realmAuthority:t,newRealmAuthority:null!=o?o:null}).instruction(),"setRealmAuthority",r)}))}(e,t,n,this.program,r)}))}setRealmConfigInstruciton(e,t,n,r,o,i,s,a,c){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c,u,l){return b(this,null,(function*(){const h=i.realmConfigAccount({realmAccount:t}).publicKey,d=s?i.councilTokenHoldingAccount({realmAccount:t,councilMint:s}).publicKey:null;return P(yield o.methods.setRealmConfig(e).accounts({realmAccount:t,realmAuthority:n,payer:r,realmConfig:h,councilTokenMint:null!=s?s:null,councilTokenHoldingAccount:d,communityVoterWeightAddinProgramId:null!=a?a:null,maxCommunityVoterWeightAddinProgramId:null!=c?c:null,councilVoterWeightAddinProgramId:null!=u?u:null,maxCouncilVoterWeightAddinProgramId:null!=l?l:null}).instruction(),"setRealmConfig",o)}))}(e,t,n,r,this.program,this.pda,o,i,s,a,c)}))}createTokenOwnerRecordInstruction(e,t,n,r){return b(this,null,(function*(){return yield function(e,t,n,r,o,i){return b(this,null,(function*(){const s=i.tokenOwnerRecordAccount({realmAccount:e,governingTokenMintAccount:n,governingTokenOwner:t}).publicKey;return P(yield o.methods.createTokenOwnerRecord().accounts({realmAccount:e,payer:r,governingTokenOwnerAccount:t,governingTokenMint:n,tokenOwnerRecord:s}).instruction(),"createTokenOwnerRecord",o)}))}(e,t,n,r,this.program,this.pda)}))}revokeGoverningTokensInstruction(e,t,n,r,o){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s){return b(this,null,(function*(){const a=s.communityTokenHoldingAccount({realmAccount:t,communityMint:r}).publicKey,c=s.realmConfigAccount({realmAccount:t}).publicKey,u="number"==typeof e?new j.default(e):e;return P(yield i.methods.revokeGoverningTokens(u).accounts({realmAccount:t,governingTokenMint:r,tokenOwnerRecord:n,governingTokenHoldingAccount:a,governingTokenMintAuthorityOrTokenOwner:o,realmConfigAccount:c}).instruction(),"revokeGoverningTokens",i)}))}(e,t,n,r,o,this.program,this.pda)}))}refundProposalDepositInstruction(e,t){return b(this,null,(function*(){return yield function(e,t,n,r){return b(this,null,(function*(){const o=r.proposalDepositAccount({proposal:e,depositPayer:t}).publicKey;return P(yield n.methods.refundProposalDeposit().accounts({proposalAccount:e,proposalDepositAccount:o,proposalDepositPayer:t}).instruction(),"refundProposalDeposit",n)}))}(e,t,this.program,this.pda)}))}completeProposalInstruction(e,t,n){return b(this,null,(function*(){return yield function(e,t,n,r){return b(this,null,(function*(){return P(yield r.methods.completeProposal().accounts({proposalAccount:e,tokenOwnerRecord:t,completeProposalAuthority:n}).instruction(),"completeProposal",r)}))}(e,t,n,this.program)}))}postMessageInstruction(e,t,n,r,o,i,s,a,c,u,l,h){return b(this,null,(function*(){return yield function(e,t,n,r,o,i,s,a,c,u,l,h,d,f,p){return b(this,null,(function*(){const g=new W.PublicKey(z.metadata.address),y=new U.Program(z,g,l),m="text"===n?{text:[t]}:{reaction:[t]},w=h.realmConfigAccount({realmAccount:i}).publicKey;return P(yield y.methods.postMessage(m,e).accounts({governanceProgramId:o,realmAccount:i,governanceAccount:s,proposalAccount:a,tokenOwnerRecord:c,governanceAuthority:u,chatMessage:r,payer:d,realmConfigAccount:w,replyToMessage:null!=f?f:null,voterWeightRecord:null!=p?p:null}).instruction(),"postMessage",y)}))}(n,e,t,r,this.programId,o,i,s,a,c,this._provider,this.pda,u,l,h)}))}}},4260:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AccountClient:()=>Ai,AnchorError:()=>Fr,AnchorProvider:()=>Or,BN:()=>s(),BorshAccountsCoder:()=>ho,BorshCoder:()=>yo,BorshEventCoder:()=>fo,BorshInstructionCoder:()=>oo,DISCRIMINATOR_SIZE:()=>uo,EventManager:()=>Si,EventParser:()=>Ei,IdlError:()=>Gr,LangErrorCode:()=>Yr,LangErrorMessage:()=>$r,MethodsBuilderFactory:()=>Di,Native:()=>Hi,Program:()=>Ki,ProgramError:()=>qr,ProgramErrorStack:()=>Kr,SystemCoder:()=>ei,eventDiscriminator:()=>po,getProvider:()=>Lr,parseIdlErrors:()=>Xn,setProvider:()=>Vr,splitArgsAndCtx:()=>yi,toInstruction:()=>er,translateAddress:()=>nr,translateError:()=>Hr,utils:()=>fi,validateAccounts:()=>tr,web3:()=>o});var r=n(8287),o=n(2643),i=n(9404),s=n.n(i),a=n(6712),c=n.n(a),u=n(864),l=n.n(u),h=n(8519),d=n(8226);function f(e){let t=e.length;for(;--t>=0;)e[t]=0}const p=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),g=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),y=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),m=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w=new Array(576);f(w);const v=new Array(60);f(v);const b=new Array(512);f(b);const A=new Array(256);f(A);const k=new Array(29);f(k);const _=new Array(30);function S(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}let E,T,I;function M(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}f(_);const R=e=>e<256?b[e]:b[256+(e>>>7)],x=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},C=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}
vendor: 5,020 bytes, line 1
1,O=(e,t,n)=>{C(e,n[2*t],n[2*t+1])},P=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},N=(e,t,n)=>{const r=new Array(16);let o,i,s=0;for(o=1;o<=15;o++)s=s+n[o-1]<<1,r[o]=s;for(i=0;i<=t;i++){let t=e[2*i+1];0!==t&&(e[2*i]=P(r[t]++,t))}},B=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},V=e=>{e.bi_valid>8?x(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},L=(e,t,n,r)=>{const o=2*t,i=2*n;return e[o]<e[i]||e[o]===e[i]&&r[t]<=r[n]},D=(e,t,n)=>{const r=e.heap[n];let o=n<<1;for(;o<=e.heap_len&&(o<e.heap_len&&L(t,e.heap[o+1],e.heap[o],e.depth)&&o++,!L(t,r,e.heap[o],e.depth));)e.heap[n]=e.heap[o],n=o,o<<=1;e.heap[n]=r},j=(e,t,n)=>{let r,o,i,s,a=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,o=e.pending_buf[e.sym_buf+a++],0===r?O(e,o,t):(i=A[o],O(e,i+256+1,t),s=p[i],0!==s&&(o-=k[i],C(e,o,s)),r--,i=R(r),O(e,i,n),s=g[i],0!==s&&(r-=_[i],C(e,r,s)))}while(a<e.sym_next);O(e,256,t)},U=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,i=t.stat_desc.elems;let s,a,c,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<i;s++)0!==n[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):n[2*s+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,n[2*c]=1,e.depth[c]=0,e.opt_len--,o&&(e.static_len-=r[2*c+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)D(e,n,s);c=i;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[2*c]=n[2*s]+n[2*a],e.depth[c]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[2*s+1]=n[2*a+1]=c,e.heap[1]=c++,D(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=t.max_code,o=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,h,d,f,p,g=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=n[2*n[2*l+1]+1]+1,d>c&&(d=c,g++),n[2*l+1]=d,l>r||(e.bl_count[d]++,f=0,l>=a&&(f=s[l-a]),p=n[2*l],e.opt_len+=p*(d+f),i&&(e.static_len+=p*(o[2*l+1]+f)));if(0!==g){do{for(d=c-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,g-=2}while(g>0);for(d=c;0!==d;d--)for(l=e.bl_count[d];0!==l;)h=e.heap[--u],h>r||(n[2*h+1]!==d&&(e.opt_len+=(d-n[2*h+1])*n[2*h],n[2*h+1]=d),l--)}})(e,t),N(n,u,e.bl_count)},W=(e,t,n)=>{let r,o,i=-1,s=t[1],a=0,c=7,u=4;for(0===s&&(c=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)o=s,s=t[2*(r+1)+1],++a<c&&o===s||(a<u?e.bl_tree[2*o]+=a:0!==o?(o!==i&&e.bl_tree[2*o]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,i=o,0===s?(c=138,u=3):o===s?(c=6,u=3):(c=7,u=4))},z=(e,t,n)=>{let r,o,i=-1,s=t[1],a=0,c=7,u=4;for(0===s&&(c=138,u=3),r=0;r<=n;r++)if(o=s,s=t[2*(r+1)+1],!(++a<c&&o===s)){if(a<u)do{O(e,o,e.bl_tree)}while(0!=--a);else 0!==o?(o!==i&&(O(e,o,e.bl_tree),a--),O(e,16,e.bl_tree),C(e,a-3,2)):a<=10?(O(e,17,e.bl_tree),C(e,a-3,3)):(O(e,18,e.bl_tree),C(e,a-11,7));a=0,i=o,0===s?(c=138,u=3):o===s?(c=6,u=3):(c=7,u=4)}};let G=!1;const K=(e,t,n,r)=>{C(e,0+(r?1:0),3),V(e),x(e,n),x(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var F={_tr_init:e=>{G||((()=>{let e,t,n,r,o;const i=new Array(16);for(n=0,r=0;r<28;r++)for(k[r]=n,e=0;e<1<<p[r];e++)A[n++]=r;for(A[n-1]=r,o=0,r=0;r<16;r++)for(_[r]=o,e=0;e<1<<g[r];e++)b[o++]=r;for(o>>=7;r<30;r++)for(_[r]=o<<7,e=0;e<1<<g[r]-7;e++)b[256+o++]=r;for(t=0;t<=15;t++)i[t]=0;for(e=0;e<=143;)w[2*e+1]=8,e++,i[8]++;for(;e<=255;)w[2*e+1]=9,e++,i[9]++;for(;e<=279;)w[2*e+1]=7,e++,i[7]++;for(;e<=287;)w[2*e+1]=8,e++,i[8]++;for(N(w,287,i),e=0;e<30;e++)v[2*e+1]=5,v[2*e]=P(e,5);E=new S(w,p,257,286,15),T=new S(v,g,0,30,15),I=new S(new Array(0),y,0,19,7)})(),G=!0),e.l_desc=new M(e.dyn_ltree,E),e.d_desc=new M(e.dyn_dtree,T),e.bl_desc=new M(e.bl_tree,I),e.bi_buf=0,e.bi_valid=0,B(e)},_tr_stored_block:K,_tr_flush_block:(e,t,n,r)=>{let o,i,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),U(e,e.l_desc),U(e,e.d_desc),s=(e=>{let t;for(W(e,e.dyn_ltree,e.l_desc.max_code),W(e,e.dyn_dtree,e.d_desc.max_code),U(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*m[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),o=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=o&&(o=i)):o=i=n+5,n+4<=o&&-1!==t?K(e,t,n,r):4===e.strategy||i===o?(C(e,2+(r?1:0),3),j(e,w,v)):(C(e,4+(r?1:0),3),((e,t,n,r)=>{let o;for(C(e,t-257,5),C(e,n-1,5),C(e,r-4,4),o=0;o<r;o++)C(e,e.bl_tree[2*m[o]+1],3);z(e,e.dyn_ltree,t-1),z(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),j(e,e.dyn_ltree,e.dyn_dtree)),B(e),r&&V(e)},_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>
vendor: 4,370 bytes, line 1
18,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(A[n]+256+1)]++,e.dyn_dtree[2*R(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{C(e,2,3),O(e,256,w),(e=>{16===e.bi_valid?(x(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},q=(e,t,n,r)=>{let o=65535&e,i=e>>>16&65535,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{o=o+t[r++]|0,i=i+o|0}while(--s);o%=65521,i%=65521}return o|i<<16};const H=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var Y=(e,t,n,r)=>{const o=H,i=r+n;e^=-1;for(let n=r;n<i;n++)e=e>>>8^o[255&(e^t[n])];return~e},$={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Q,_tr_stored_block:J,_tr_flush_block:X,_tr_tally:ee,_tr_align:te}=F,{Z_NO_FLUSH:ne,Z_PARTIAL_FLUSH:re,Z_FULL_FLUSH:oe,Z_FINISH:ie,Z_BLOCK:se,Z_OK:ae,Z_STREAM_END:ce,Z_STREAM_ERROR:ue,Z_DATA_ERROR:le,Z_BUF_ERROR:he,Z_DEFAULT_COMPRESSION:de,Z_FILTERED:fe,Z_HUFFMAN_ONLY:pe,Z_RLE:ge,Z_FIXED:ye,Z_DEFAULT_STRATEGY:me,Z_UNKNOWN:we,Z_DEFLATED:ve}=Z,be=258,Ae=262,ke=42,_e=113,Se=666,Ee=(e,t)=>(e.msg=$[t],t),Te=e=>2*e-(e>4?9:0),Ie=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Me=e=>{let t,n,r,o=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=o?n-o:0}while(--t);t=o,r=t;do{n=e.prev[--r],e.prev[r]=n>=o?n-o:0}while(--t)};let Re=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const xe=(e,t)=>{let n;if(e.legacy_hash)n=e.ins_h=Re(e,e.ins_h,e.window[t+3-1]);else{const r=e.window,o=r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24;n=e.ins_h=Math.imul(o,66521)+66521>>>16&e.hash_mask}const r=e.prev[t&e.w_mask]=e.head[n];return e.head[n]=t,r},Ce=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Oe=(e,t)=>{X(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ce(e.strm)},Pe=(e,t)=>{e.pending_buf[e.pending++]=t},Ne=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,n,r)=>{let o=e.avail_in;return o>r&&(o=r),0===o?0:(e.avail_in-=o,t.set(e.input.subarray(e.next_in,e.next_in+o),n),1===e.state.wrap?e.adler=q(e.adler,t,o,n):2===e.state.wrap&&(e.adler=Y(e.adler,t,o,n)),e.next_in+=o,e.total_in+=o,o)},Ve=(e,t)=>{let n,r,o=e.max_chain_length,i=e.strstart,s=e.prev_length,a=e.nice_match;const c=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,u=e.window,l=e.w_mask,h=e.prev,d=e.strstart+be;let f=u[i+s-1],p=u[i+s];e.prev_length>=e.good_match&&(o>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,u[n+s]===p&&u[n+s-1]===f&&u[n]===u[i]&&u[++n]===u[i+1]){i+=2,n++;do{}while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<d);if(r=be-(d-i),i=d-be,r>s){if(e.match_start=t,s=r,r>=a)break;f=u[i+s-1],p=u[i+s]}}}while((t=h[t&l])>c&&0!=--o);return s<=e.lookahead?s:e.lookahead},Le=e=>{const t=e.w_size;let n,r,o;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Me(e),r+=t),0===e.strm.avail_in)break;if(n=Be(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.legacy_hash){if(e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=Re(e,e.ins_h,e.window[o+1]);e.insert&&(xe(e,o),o++,e.insert--,!(e.lookahead+e.insert<3)););}else if(e.lookahead+e.insert>3)for(o=e.strstart-e.insert;e.insert&&(xe(e,o),o++,e.insert--,!(e.lookahead+e.insert<=3)););}while(e.lookahead<Ae&&0!==e.strm.avail_in)},De=(e,t)=>{let n,r,o,i=e.pending_buf_size-5>
vendor: 6,569 bytes, line 1
1e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(n=65535,o=e.bi_valid+42>>3,e.strm.avail_out<o)break;if(o=e.strm.avail_out-o,r=e.strstart-e.block_start,n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>o&&(n=o),n<i&&(0===n&&t!==ie||t===ne||n!==r+e.strm.avail_in))break;s=t===ie&&n===r+e.strm.avail_in?1:0,J(e,0,0,s),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Ce(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(Be(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===s);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==ne&&t!==ie&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(o=e.window_size-e.strstart,e.strm.avail_in>o&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(Be(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water<e.strstart&&(e.high_water=e.strstart),o=e.bi_valid+42>>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,i=o>e.w_size?e.w_size:o,r=e.strstart-e.block_start,(r>=i||(r||t===ie)&&t!==ne&&0===e.strm.avail_in&&r<=o)&&(n=r>o?o:r,s=t===ie&&0===e.strm.avail_in&&n===r?1:0,J(e,e.block_start,n,s),e.block_start+=n,Ce(e.strm)),s?3:1)},je=(e,t)=>{let n,r;for(;;){if(e.lookahead<Ae){if(Le(e),e.lookahead<Ae&&t===ne)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(n=xe(e,e.strstart)),0!==n&&e.strstart-n<=e.w_size-Ae&&(e.match_length=Ve(e,n)),e.match_length>=3)if(r=ee(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,n=xe(e,e.strstart)}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=Re(e,e.ins_h,e.window[e.strstart+1]));else r=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Oe(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===ie?(Oe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oe(e,!1),0===e.strm.avail_out)?1:2},Ue=(e,t)=>{let n,r,o;for(;;){if(e.lookahead<Ae){if(Le(e),e.lookahead<Ae&&t===ne)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(n=xe(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ae&&(e.match_length=Ve(e,n),e.match_length<=5&&(e.strategy===fe||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-3,r=ee(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=o&&(n=xe(e,e.strstart))}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Oe(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=ee(e,0,e.window[e.strstart-1]),r&&Oe(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=ee(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ie?(Oe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oe(e,!1),0===e.strm.avail_out)?1:2};function We(e,t,n,r,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=o}const ze=[new We(0,0,0,0,De),new We(4,4,8,4,je),new We(4,5,16,8,je),new We(4,6,32,32,je),new We(4,4,16,16,Ue),new We(8,16,32,32,Ue),new We(8,16,128,128,Ue),new We(8,32,128,256,Ue),new We(32,128,258,1024,Ue),new We(32,258,258,4096,Ue)];function Ge(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ve,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ie(this.dyn_ltree),Ie(this.dyn_dtree),Ie(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ie(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ie(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ke=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ke&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==_e&&t.status!==Se?1:0},Fe=e=>{if(Ke(e))return Ee(e,ue);e.total_in=e.total_out=0,e.data_type=we;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?ke:_e,e.adler=2===t.wrap?0:1,t.last_flush=-2,Q(t),ae},qe=e=>{const t=Fe(e);var n;return t===ae&&((n=e.state).window_size=2*n.w_size,Ie(n.head),n.max_lazy_match=ze[n.level].max_lazy,n.good_match=ze[n.level].good_length,n.nice_match=ze[n.level].nice_length,n.max_chain_length=ze[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},He=(e,t,n,r,o,i,s)=>{if(!e)return ue;let a=1;if(t===de&&(t=6),r<0?(a=0,r=-r):r>
vendor: 29,718 bytes, line 1
115&&(a=2,r-=16),o<1||o>9||n!==ve||r<8||r>15||t<0||t>9||i<0||i>ye||8===r&&1!==a)return Ee(e,ue);8===r&&(r=9);const c=new Ge;return e.state=c,c.strm=e,c.status=ke,c.wrap=a,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.legacy_hash=s?1:0,c.hash_bits=o+7,!c.legacy_hash&&c.hash_bits<15&&(c.hash_bits=15),c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new Uint8Array(2*c.w_size),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<o+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=3*(c.lit_bufsize-1),c.level=t,c.strategy=i,c.method=n,qe(e)};var Ye=He,$e=(e,t)=>Ke(e)||2!==e.state.wrap?ue:(e.state.gzhead=t,ae),Ze=(e,t)=>{if(Ke(e)||t>se||t<0)return e?Ee(e,ue):ue;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===Se&&t!==ie)return Ee(e,0===e.avail_out?he:ue);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Ce(e),0===e.avail_out)return n.last_flush=-1,ae}else if(0===e.avail_in&&Te(t)<=Te(r)&&t!==ie)return Ee(e,he);if(n.status===Se&&0!==e.avail_in)return Ee(e,he);if(n.status===ke&&0===n.wrap&&(n.status=_e),n.status===ke){let t=ve+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=pe||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Ne(n,t),0!==n.strstart&&(Ne(n,e.adler>>>16),Ne(n,65535&e.adler)),e.adler=1,n.status=_e,Ce(e),0!==n.pending)return n.last_flush=-1,ae}if(57===n.status)if(e.adler=0,Pe(n,31),Pe(n,139),Pe(n,8),n.gzhead)Pe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pe(n,255&n.gzhead.time),Pe(n,n.gzhead.time>>8&255),Pe(n,n.gzhead.time>>16&255),Pe(n,n.gzhead.time>>24&255),Pe(n,9===n.level?2:n.strategy>=pe||n.level<2?4:0),Pe(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Pe(n,255&n.gzhead.extra.length),Pe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Y(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,9===n.level?2:n.strategy>=pe||n.level<2?4:0),Pe(n,3),n.status=_e,Ce(e),0!==n.pending)return n.last_flush=-1,ae;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=Y(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=o,Ce(e),0!==n.pending)return n.last_flush=-1,ae;t=0,r-=o}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=Y(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Y(e.adler,n.pending_buf,n.pending-r,r)),Ce(e),0!==n.pending)return n.last_flush=-1,ae;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Pe(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Y(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Y(e.adler,n.pending_buf,n.pending-r,r)),Ce(e),0!==n.pending)return n.last_flush=-1,ae;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Pe(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Y(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ce(e),0!==n.pending))return n.last_flush=-1,ae;Pe(n,255&e.adler),Pe(n,e.adler>>8&255),e.adler=0}if(n.status=_e,Ce(e),0!==n.pending)return n.last_flush=-1,ae}if(0!==e.avail_in||0!==n.lookahead||t!==ne&&n.status!==Se){let r=0===n.level?De(n,t):n.strategy===pe?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Le(e),0===e.lookahead)){if(t===ne)return 1;break}if(e.match_length=0,n=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Oe(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ie?(Oe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oe(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===ge?((e,t)=>{let n,r,o,i;const s=e.window;for(;;){if(e.lookahead<=be){if(Le(e),e.lookahead<=be&&t===ne)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(o=e.strstart-1,r=s[o],r===s[++o]&&r===s[++o]&&r===s[++o])){i=e.strstart+be;do{}while(r===s[++o]&&r===s[++o]&&r===s[++o]&&r===s[++o]&&r===s[++o]&&r===s[++o]&&r===s[++o]&&r===s[++o]&&o<i);e.match_length=be-(i-o),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=ee(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=ee(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Oe(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ie?(Oe(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Oe(e,!1),0===e.strm.avail_out)?1:2})(n,t):ze[n.level].func(n,t);if(3!==r&&4!==r||(n.status=Se),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),ae;if(2===r&&(t===re?te(n):t!==se&&(J(n,0,0,!1),t===oe&&(Ie(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ce(e),0===e.avail_out))return n.last_flush=-1,ae}return t!==ie?ae:n.wrap<=0?ce:(2===n.wrap?(Pe(n,255&e.adler),Pe(n,e.adler>>8&255),Pe(n,e.adler>>16&255),Pe(n,e.adler>>24&255),Pe(n,255&e.total_in),Pe(n,e.total_in>>8&255),Pe(n,e.total_in>>16&255),Pe(n,e.total_in>>24&255)):(Ne(n,e.adler>>>16),Ne(n,65535&e.adler)),Ce(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ae:ce)},Qe=e=>{if(Ke(e))return ue;const t=e.state.status;return e.state=null,t===_e?Ee(e,le):ae},Je=(e,t)=>{let n=t.length;if(Ke(e))return ue;const r=e.state,o=r.wrap;if(2===o||1===o&&r.status!==ke||r.lookahead)return ue;if(1===o&&(e.adler=q(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===o&&(Ie(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const i=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Le(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{xe(r,e),e++}while(--t);r.strstart=e,r.lookahead=2,Le(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=a,e.avail_in=i,r.wrap=o,ae};const Xe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var et=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)Xe(n,t)&&(e[t]=n[t])}}return e},tt=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,o=e.length;t<o;t++){let o=e[t];n.set(o,r),r+=o.length}return n};let nt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){nt=!1}const rt=new Uint8Array(256);for(let e=0;e<256;e++)rt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;rt[254]=rt[255]=1;var ot=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,o,i,s=e.length,a=0;for(o=0;o<s;o++)n=e.charCodeAt(o),55296==(64512&n)&&o+1<s&&(r=e.charCodeAt(o+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),i=0,o=0;i<a;o++)n=e.charCodeAt(o),55296==(64512&n)&&o+1<s&&(r=e.charCodeAt(o+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|63&n):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|63&n):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|63&n);return t},it=(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,o;const i=new Array(2*n);for(o=0,r=0;r<n;){let t=e[r++];if(t<128){i[o++]=t;continue}let s=rt[t];if(s>4)i[o++]=65533,r+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&r<n;)t=t<<6|63&e[r++],s--;s>1?i[o++]=65533:t<65536?i[o++]=t:(t-=65536,i[o++]=55296|t>>10&1023,i[o++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&nt)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(i,o)},st=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+rt[e[n]]>t?n:t},at=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ct=Object.prototype.toString,{Z_NO_FLUSH:ut,Z_SYNC_FLUSH:lt,Z_FULL_FLUSH:ht,Z_FINISH:dt,Z_OK:ft,Z_STREAM_END:pt,Z_DEFAULT_COMPRESSION:gt,Z_DEFAULT_STRATEGY:yt,Z_DEFLATED:mt}=Z,wt={level:gt,method:mt,chunkSize:16384,windowBits:15,memLevel:8,strategy:yt,legacyHash:!0};function vt(e){this.options=et({},wt,e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new at,this.strm.avail_out=0;let n=Ye(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy,t.legacyHash);if(n!==ft)throw new Error($[n]);if(t.header&&$e(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ot(t.dictionary):"[object ArrayBuffer]"===ct.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=Je(this.strm,e),n!==ft)throw new Error($[n]);this._dict_set=!0}}function bt(e,t){const n=new vt(t);if(n.push(e,!0),n.err)throw n.msg||$[n.err];return n.result}vt.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let o,i;if(this.ended)return!1;for(i=t===~~t?t:!0===t?dt:ut,"string"==typeof e?n.input=ot(e):"[object ArrayBuffer]"===ct.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===lt||i===ht)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(o=Ze(n,i),o===pt)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),o=Qe(this.strm),this.onEnd(o),this.ended=!0,o===ft;if(0!==n.avail_out){if(i>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},vt.prototype.onData=function(e){this.chunks.push(e)},vt.prototype.onEnd=function(e){e===ft&&(this.result=tt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var At={Deflate:vt,deflate:bt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,bt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,bt(e,t)},constants:Z};const kt=16209;var _t=function(e,t){let n,r,o,i,s,a,c,u,l,h,d,f,p,g,y,m,w,v,b,A,k,_,S,E;const T=e.state;n=e.next_in,S=e.input,r=n+(e.avail_in-5),o=e.next_out,E=e.output,i=o-(t-e.avail_out),s=o+(e.avail_out-257),a=T.dmax,c=T.wsize,u=T.whave,l=T.wnext,h=T.window,d=T.hold,f=T.bits,p=T.lencode,g=T.distcode,y=(1<<T.lenbits)-1,m=(1<<T.distbits)-1;e:do{f<15&&(d+=S[n++]<<f,f+=8,d+=S[n++]<<f,f+=8),w=p[d&y];t:for(;;){if(v=w>>>24,d>>>=v,f-=v,v=w>>>16&255,0===v)E[o++]=65535&w;else{if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=kt;break e}w=p[(65535&w)+(d&(1<<v)-1)];continue t}for(b=65535&w,v&=15,v&&(f<v&&(d+=S[n++]<<f,f+=8),b+=d&(1<<v)-1,d>>>=v,f-=v),f<15&&(d+=S[n++]<<f,f+=8,d+=S[n++]<<f,f+=8),w=g[d&m];;){if(v=w>>>24,d>>>=v,f-=v,v=w>>>16&255,16&v){if(A=65535&w,v&=15,f<v&&(d+=S[n++]<<f,f+=8,f<v&&(d+=S[n++]<<f,f+=8)),A+=d&(1<<v)-1,A>a){e.msg="invalid distance too far back",T.mode=kt;break e}if(d>>>=v,f-=v,v=o-i,A>v){if(v=A-v,v>u&&T.sane){e.msg="invalid distance too far back",T.mode=kt;break e}if(k=0,_=h,0===l){if(k+=c-v,v<b){b-=v;do{E[o++]=h[k++]}while(--v);k=o-A,_=E}}else if(l<v){if(k+=c+l-v,v-=l,v<b){b-=v;do{E[o++]=h[k++]}while(--v);if(k=0,l<b){v=l,b-=v;do{E[o++]=h[k++]}while(--v);k=o-A,_=E}}}else if(k+=l-v,v<b){b-=v;do{E[o++]=h[k++]}while(--v);k=o-A,_=E}for(;b>2;)E[o++]=_[k++],E[o++]=_[k++],E[o++]=_[k++],b-=3;b&&(E[o++]=_[k++],b>1&&(E[o++]=_[k++]))}else{k=o-A;do{E[o++]=E[k++],E[o++]=E[k++],E[o++]=E[k++],b-=3}while(b>2);b&&(E[o++]=E[k++],b>1&&(E[o++]=E[k++]))}break}if(64&v){e.msg="invalid distance code",T.mode=kt;break e}w=g[(65535&w)+(d&(1<<v)-1)]}}break}}while(n<r&&o<s);b=f>>3,n-=b,f-=b<<3,d&=(1<<f)-1,e.next_in=n,e.next_out=o,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=o<s?s-o+257:257-(o-s),T.hold=d,T.bits=f};const St=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Et=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),Tt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),It=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mt=(e,t,n,r,o,i,s,a)=>{const c=a.bits;let u,l,h,d,f,p,g=0,y=0,m=0,w=0,v=0,b=0,A=0,k=0,_=0,S=0,E=null;const T=new Uint16Array(16),I=new Uint16Array(16);let M,R,x,C=null;for(g=0;g<=15;g++)T[g]=0;for(y=0;y<r;y++)T[t[n+y]]++;for(v=c,w=15;w>=1&&0===T[w];w--);if(v>w&&(v=w),0===w)return o[i++]=20971520,o[i++]=20971520,a.bits=1,0;for(m=1;m<w&&0===T[m];m++);for(v<m&&(v=m),k=1,g=1;g<=15;g++)if(k<<=1,k-=T[g],k<0)return-1;if(k>0&&(0===e||1!==w))return-1;for(I[1]=0,g=1;g<15;g++)I[g+1]=I[g]+T[g];for(y=0;y<r;y++)0!==t[n+y]&&(s[I[t[n+y]]++]=y);if(0===e?(E=C=s,p=20):1===e?(E=St,C=Et,p=257):(E=Tt,C=It,p=0),S=0,y=0,g=m,f=i,b=v,A=0,h=-1,_=1<<v,d=_-1,1===e&&_>852||2===e&&_>592)return 1;for(;;){M=g-A,s[y]+1<p?(R=0,x=s[y]):s[y]>=p?(R=C[s[y]-p],x=E[s[y]-p]):(R=96,x=0),u=1<<g-A,l=1<<b,m=l;do{l-=u,o[f+(S>>A)+l]=M<<24|R<<16|x}while(0!==l);for(u=1<<g-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,y++,0==--T[g]){if(g===w)break;g=t[n+s[y]]}if(g>v&&(S&d)!==h){for(0===A&&(A=v),f+=m,b=g-A,k=1<<b;b+A<w&&(k-=T[b+A],!(k<=0));)b++,k<<=1;if(_+=1<<b,1===e&&_>852||2===e&&_>592)return 1;h=S&d,o[h]=v<<24|b<<16|f-i}}return 0!==S&&(o[f+S]=g-A<<24|64<<16),a.bits=v,0};const{Z_FINISH:Rt,Z_BLOCK:xt,Z_TREES:Ct,Z_OK:Ot,Z_STREAM_END:Pt,Z_NEED_DICT:Nt,Z_STREAM_ERROR:Bt,Z_DATA_ERROR:Vt,Z_MEM_ERROR:Lt,Z_BUF_ERROR:Dt,Z_DEFLATED:jt}=Z,Ut=16180,Wt=16190,zt=16191,Gt=16192,Kt=16194,Ft=16199,qt=16200,Ht=16206,Yt=16209,$t=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Zt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Qt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Ut||t.mode>16211?1:0},Jt=e=>{if(Qt(e))return Bt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ut,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ot},Xt=e=>{if(Qt(e))return Bt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Jt(e)},en=(e,t)=>{let n;if(Qt(e))return Bt;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Bt:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Xt(e))},tn=(e,t)=>{if(!e)return Bt;const n=new Zt;e.state=n,n.strm=e,n.window=null,n.mode=Ut;const r=en(e,t);return r!==Ot&&(e.state=null),r};let nn,rn,on=!0;const sn=e=>{if(on){nn=new Int32Array(512),rn=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Mt(1,e.lens,0,288,nn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Mt(2,e.lens,0,32,rn,0,e.work,{bits:5}),on=!1}e.lencode=nn,e.lenbits=9,e.distcode=rn,e.distbits=5},an=(e,t,n,r)=>{let o;const i=e.state;return null===i.window&&(i.window=new Uint8Array(1<<i.wbits)),0===i.wsize&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0),r>=i.wsize?(i.window.set(t.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(o=i.wsize-i.wnext,o>r&&(o=r),i.window.set(t.subarray(n-r,n-r+o),i.wnext),(r-=o)?(i.window.set(t.subarray(n-r,n),0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=o))),0};var cn=Xt,un=tn,ln=(e,t)=>{let n,r,o,i,s,a,c,u,l,h,d,f,p,g,y,m,w,v,b,A,k,_,S=0;const E=new Uint8Array(4);let T,I;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qt(e)||!e.output||!e.input&&0!==e.avail_in)return Bt;n=e.state,n.mode===zt&&(n.mode=Gt),s=e.next_out,o=e.output,c=e.avail_out,i=e.next_in,r=e.input,a=e.avail_in,u=n.hold,l=n.bits,h=a,d=c,_=Ot;e:for(;;)switch(n.mode){case Ut:if(0===n.wrap){n.mode=Gt;break}for(;l<16;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(2&n.wrap&&35615===u){0===n.wbits&&(n.wbits=15),n.check=0,E[0]=255&u,E[1]=u>>>8&255,n.check=Y(n.check,E,2,0),u=0,l=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Yt;break}if((15&u)!==jt){e.msg="unknown compression method",n.mode=Yt;break}if(u>>>=4,l-=4,k=8+(15&u),0===n.wbits&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=Yt;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&u?16189:zt,u=0,l=0;break;case 16181:for(;l<16;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(n.flags=u,(255&n.flags)!==jt){e.msg="unknown compression method",n.mode=Yt;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Yt;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,n.check=Y(n.check,E,2,0)),u=0,l=0,n.mode=16182;case 16182:for(;l<32;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.head&&(n.head.time=u),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,n.check=Y(n.check,E,4,0)),u=0,l=0,n.mode=16183;case 16183:for(;l<16;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,n.check=Y(n.check,E,2,0)),u=0,l=0,n.mode=16184;case 16184:if(1024&n.flags){for(;l<16;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&4&n.wrap&&(E[0]=255&u,E[1]=u>>>8&255,n.check=Y(n.check,E,2,0)),u=0,l=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(f=n.length,f>a&&(f=a),f&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(i,i+f),k)),512&n.flags&&4&n.wrap&&(n.check=Y(n.check,r,f,i)),a-=f,i+=f,n.length-=f),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break e;f=0;do{k=r[i+f++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k))}while(k&&f<a);if(512&n.flags&&4&n.wrap&&(n.check=Y(n.check,r,f,i)),a-=f,i+=f,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break e;f=0;do{k=r[i+f++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k))}while(k&&f<a);if(512&n.flags&&4&n.wrap&&(n.check=Y(n.check,r,f,i)),a-=f,i+=f,k)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;l<16;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(4&n.wrap&&u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Yt;break}u=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=zt;break;case 16189:for(;l<32;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}e.adler=n.check=$t(u),u=0,l=0,n.mode=Wt;case Wt:if(0===n.havedict)return e.next_out=s,e.avail_out=c,e.next_in=i,e.avail_in=a,n.hold=u,n.bits=l,Nt;e.adler=n.check=1,n.mode=zt;case zt:if(t===xt||t===Ct)break e;case Gt:if(n.last){u>>>=7&l,l-=7&l,n.mode=Ht;break}for(;l<3;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}switch(n.last=1&u,u>>>=1,l-=1,3&u){case 0:n.mode=16193;break;case 1:if(sn(n),n.mode=Ft,t===Ct){u>>>=2,l-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=Yt}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Yt;break}if(n.length=65535&u,u=0,l=0,n.mode=Kt,t===Ct)break e;case Kt:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>c&&(f=c),0===f)break e;o.set(r.subarray(i,i+f),s),a-=f,i+=f,c-=f,s+=f,n.length-=f;break}n.mode=zt;break;case 16196:for(;l<14;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(n.nlen=257+(31&u),u>>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Yt;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;l<3;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.lens[M[n.have++]]=7&u,u>>>=3,l-=3}for(;n.have<19;)n.lens[M[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},_=Mt(0,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,_){e.msg="invalid code lengths set",n.mode=Yt;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;S=n.lencode[u&(1<<n.lenbits)-1],y=S>>>24,m=S>>>16&255,w=65535&S,!(y<=l);){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(w<16)u>>>=y,l-=y,n.lens[n.have++]=w;else{if(16===w){for(I=y+2;l<I;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(u>>>=y,l-=y,0===n.have){e.msg="invalid bit length repeat",n.mode=Yt;break}k=n.lens[n.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===w){for(I=y+3;l<I;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}u>>>=y,l-=y,k=0,f=3+(7&u),u>>>=3,l-=3}else{for(I=y+7;l<I;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}u>>>=y,l-=y,k=0,f=11+(127&u),u>>>=7,l-=7}if(n.have+f>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Yt;break}for(;f--;)n.lens[n.have++]=k}}if(n.mode===Yt)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Yt;break}if(n.lenbits=9,T={bits:n.lenbits},_=Mt(1,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,_){e.msg="invalid literal/lengths set",n.mode=Yt;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},_=Mt(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,_){e.msg="invalid distances set",n.mode=Yt;break}if(n.mode=Ft,t===Ct)break e;case Ft:n.mode=qt;case qt:if(a>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=i,e.avail_in=a,n.hold=u,n.bits=l,_t(e,d),s=e.next_out,o=e.output,c=e.avail_out,i=e.next_in,r=e.input,a=e.avail_in,u=n.hold,l=n.bits,n.mode===zt&&(n.back=-1);break}for(n.back=0;S=n.lencode[u&(1<<n.lenbits)-1],y=S>>>24,m=S>>>16&255,w=65535&S,!(y<=l);){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(m&&!(240&m)){for(v=y,b=m,A=w;S=n.lencode[A+((u&(1<<v+b)-1)>>v)],y=S>>>24,m=S>>>16&255,w=65535&S,!(v+y<=l);){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}u>>>=v,l-=v,n.back+=v}if(u>>>=y,l-=y,n.back+=y,n.length=w,0===m){n.mode=16205;break}if(32&m){n.back=-1,n.mode=zt;break}if(64&m){e.msg="invalid literal/length code",n.mode=Yt;break}n.extra=15&m,n.mode=16201;case 16201:if(n.extra){for(I=n.extra;l<I;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;S=n.distcode[u&(1<<n.distbits)-1],y=S>>>24,m=S>>>16&255,w=65535&S,!(y<=l);){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(!(240&m)){for(v=y,b=m,A=w;S=n.distcode[A+((u&(1<<v+b)-1)>>v)],y=S>>>24,m=S>>>16&255,w=65535&S,!(v+y<=l);){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}u>>>=v,l-=v,n.back+=v}if(u>>>=y,l-=y,n.back+=y,64&m){e.msg="invalid distance code",n.mode=Yt;break}n.offset=w,n.extra=15&m,n.mode=16203;case 16203:if(n.extra){for(I=n.extra;l<I;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Yt;break}n.mode=16204;case 16204:if(0===c)break e;if(f=d-c,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Yt;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),g=n.window}else g=o,p=s-n.offset,f=n.length;f>c&&(f=c),c-=f,n.length-=f;do{o[s++]=g[p++]}while(--f);0===n.length&&(n.mode=qt);break;case 16205:if(0===c)break e;o[s++]=n.length,c--,n.mode=qt;break;case Ht:if(n.wrap){for(;l<32;){if(0===a)break e;a--,u|=r[i++]<<l,l+=8}if(d-=c,e.total_out+=d,n.total+=d,4&n.wrap&&d&&(e.adler=n.check=n.flags?Y(n.check,o,d,s-d):q(n.check,o,d,s-d)),d=c,4&n.wrap&&(n.flags?u:$t(u))!==n.check){e.msg="incorrect data check",n.mode=Yt;break}u=0,l=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;l<32;){if(0===a)break e;a--,u+=r[i++]<<l,l+=8}if(4&n.wrap&&u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Yt;break}u=0,l=0}n.mode=16208;case 16208:_=Pt;break e;case Yt:_=Vt;break e;case 16210:return Lt;default:return Bt}return e.next_out=s,e.avail_out=c,e.next_in=i,e.avail_in=a,n.hold=u,n.bits=l,(n.wsize||d!==e.avail_out&&n.mode<Yt&&(n.mode<Ht||t!==Rt))&&an(e,e.output,e.next_out,d-e.avail_out),h-=e.avail_in,d-=e.avail_out,e.total_in+=h,e.total_out+=d,n.total+=d,4&n.wrap&&d&&(e.adler=n.check=n.flags?Y(n.check,o,d,e.next_out-d):q(n.check,o,d,e.next_out-d)),e.data_type=n.bits+(n.last?64:0)+(n.mode===zt?128:0)+(n.mode===Ft||n.mode===Kt?256:0),(0===h&&0===d||t===Rt)&&_===Ot&&(_=Dt),_},hn=e=>{if(Qt(e))return Bt;let t=e.state;return t.window&&(t.window=null),e.state=null,Ot},dn=(e,t)=>{if(Qt(e))return Bt;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Ot):Bt},fn=(e,t)=>{const n=t.length;let r,o,i;return Qt(e)?Bt:(r=e.state,0!==r.wrap&&r.mode!==Wt?Bt:r.mode===Wt&&(o=1,o=q(o,t,n,0),o!==r.check)?Vt:(i=an(e,t,n,n),i?(r.mode=16210,Lt):(r.havedict=1,Ot)))},pn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const gn=Object.prototype.toString,{Z_NO_FLUSH:yn,Z_FINISH:mn,Z_OK:wn,Z_STREAM_END:vn,Z_NEED_DICT:bn,Z_STREAM_ERROR:An,Z_DATA_ERROR:kn,Z_MEM_ERROR:Sn,Z_BUF_ERROR:En}=Z,Tn={chunkSize:65536,windowBits:15,to:""};function In(e){this.options=et({},Tn,e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new at,this.strm.avail_out=0;let n=un(this.strm,t.windowBits);if(n!==wn)throw new Error($[n]);if(this.header=new pn,dn(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ot(t.dictionary):"[object ArrayBuffer]"===gn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=fn(this.strm,t.dictionary),n!==wn)))throw new Error($[n])}function Mn(e,t){const n=new In(t);if(n.push(e,!0),n.err)throw n.msg||$[n.err];return n.result}In.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,o=this.options.dictionary;let i,s,a;if(this.ended)return!1;for(s=t===~~t?t:!0===t?mn:yn,"[object ArrayBuffer]"===gn.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=ln(n,s),i===bn&&o&&(i=fn(n,o),i===wn?i=ln(n,s):i===kn&&(i=bn));n.avail_in>0&&i===vn&&2&n.state.wrap&&0!==n.state.flags&&0!==n.input[n.next_in];)cn(n),i=ln(n,s);switch(i){case An:case kn:case bn:case Sn:return this.onEnd(i),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||i===vn||s>0))if("string"===this.options.to){let e=st(n.output,n.next_out),t=n.next_out-e,o=it(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(o)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out)),n.avail_out=0,n.next_out=0;if(i!==wn&&i!==En||0!==a){if(i===vn)return i=hn(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===n.avail_in){if(s===mn)return i=hn(this.strm),this.onEnd(i===wn?En:i),this.ended=!0,!1;break}}}return!0},In.prototype.onData=function(e){this.chunks.push(e)},In.prototype.onEnd=function(e){e===wn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=tt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Rn={Inflate:In,inflate:Mn,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Mn(e,t)},ungzip:Mn,constants:Z};const{Deflate:xn,deflate:Cn,deflateRaw:On,gzip:Pn}=At,{Inflate:Nn,inflate:Bn,inflateRaw:Vn,ungzip:Ln}=Rn;var Dn=Bn,jn=n(228),Un=n.n(jn),Wn=n(8287).Buffer;const zn=e=>"version"in e;var Gn=Object.freeze({__proto__:null,encode:function(e){return e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"0x")},decode:function(e){0===e.indexOf("0x")&&(e=e.substr(2)),e.length%2==1&&(e="0"+e);let t=e.match(/.{2}/g);return null===t?r.Buffer.from([]):r.Buffer.from(t.map((e=>parseInt(e,16))))}});function Kn(e){return new TextDecoder("utf-8").decode(e)}function Fn(e){return(new TextEncoder).encode(e)}var qn=Object.freeze({__proto__:null,decode:Kn,encode:Fn});function Hn(e){return c().encode(e)}var Yn=Object.freeze({__proto__:null,encode:Hn,decode:function(e){return c().decode(e)}});function $n(e){return e.toString("base64")}function Zn(e){return r.Buffer.from(e,"base64")}var Qn=Object.freeze({__proto__:null,encode:$n,decode:Zn}),Jn=Object.freeze({__proto__:null,hex:Gn,utf8:qn,bs58:Yn,base64:Qn});function Xn(e){const t=new Map;
1return e.errors&&e.errors.forEach((e=>{var n;let r=null!==(n=e.msg)&&void 0!==n?n:e.name;t.set(e.code,r)})),t}function er(e,...t){if(e.args.length!=t.length)throw new Error("Invalid argument length");const n={};let r=0;return e.args.forEach((e=>{n[e.name]=t[r],r+=1})),n}function tr(e,t={}){e.forEach((e=>{if("accounts"in e)tr(e.accounts,t[e.name]);else if(void 0===t[e.name])throw new Error(`Invalid arguments: ${e.name} not provided.`)}))}function nr(e){return e instanceof o.PublicKey?e:new o.PublicKey(e)}class rr extends TypeError{constructor(e,t){let n;const{message:r,...o}=e,{path:i}=e;super(0===i.length?r:"At path: "+i.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[e,...t()]}}}function or(e){return"object"==typeof e&&null!=e}function ir(e){return"string"==typeof e?JSON.stringify(e):""+e}function sr(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:s}=n,{refinement:a,message:c="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+ir(r)+"`"}=e;return{value:r,type:s,refinement:a,key:o[o.length-1],path:o,branch:i,...e,message:c}}function*ar(e,t,n,r){var o;or(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]);for(const o of e){const e=sr(o,t,n,r);e&&(yield e)}}function*cr(e,t,n){void 0===n&&(n={});const{path:r=[],branch:o=[e],coerce:i=!1,mask:s=!1}=n,a={path:r,branch:o};if(i&&(e=t.coercer(e,a),s&&"type"!==t.type&&or(t.schema)&&or(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c=!0;for(const n of t.validator(e,a))c=!1,yield[n,void 0];for(let[n,u,l]of t.entries(e,a)){const t=cr(u,l,{path:void 0===n?r:[...r,n],branch:void 0===n?o:[...o,u],coerce:i,mask:s});for(const r of t)r[0]?(c=!1,yield[r[0],void 0]):i&&(u=r[1],void 0===n?e=u:e instanceof Map?e.set(n,u):e instanceof Set?e.add(u):or(e)&&(e[n]=u))}if(c)for(const n of t.refiner(e,a))c=!1,yield[n,void 0];c&&(yield[void 0,e])}class ur{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=i,this.validator=r?(e,t)=>ar(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>ar(o(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const n=dr(e,t);if(n[0])throw n[0]}(e,this)}create(e){return lr(e,this)}is(e){return hr(e,this)}mask(e){return function(e,t){const n=dr(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(e,this)}validate(e,t){return void 0===t&&(t={}),dr(e,this,t)}}function lr(e,t){const n=dr(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function hr(e,t){return!dr(e,t)[0]}function dr(e,t,n){void 0===n&&(n={});const r=cr(e,t,n),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);return o[0]?[new rr(o[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]:[void 0,o[1]]}function fr(e,t){return new ur({type:e,schema:null,validator:t})}function pr(e){return new ur({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+ir(e)})}function gr(e){const t=ir(e),n=typeof e;return new ur({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||"Expected the literal `"+t+"`, but received: "+ir(n)})}function yr(e){return new ur({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function mr(){return fr("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+ir(e)))}function wr(e){return new ur({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function vr(){return fr("string",(e=>"string"==typeof e||"Expected a string, but received: "+ir(e)))}function br(e){const t=Object.keys(e);return new ur({type:"type",schema:e,*entries(n){if(or(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>or(e)||"Expected an object, but received: "+ir(e)})}function Ar(e){const t=e.map((e=>e.type)).join(" | ");return new ur({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||kr()).coercer(t,n),validator(n,r){const o=[];for(const t of e){const[...e]=cr(n,t,r),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ir(n),...o]}})}function kr(){return fr("unknown",(()=>!0))}async function _r(e,t,n){if(t.length<=99)return await Sr(e,t,n);{const r=function(e){return Array.apply(0,new Array(Math.ceil(e.length/99))).map(((t,n)=>e.slice(99*n,99*(n+1))))}(t);return(await Promise.all(r.map((t=>Sr(e,t,n))))).flat()}}async function Sr(e,t,n){const r=null!=n?n:e.commitment,{value:o,c
1ontext:i}=await e.getMultipleAccountsInfoAndContext(t,r);return o.map(((e,n)=>null===e?null:{publicKey:t[n],account:e,context:i}))}async function Er(e,t,n,r,i){var s;n&&n.length>0&&t.sign(...n);const a=t._compile(),c=a.serialize(),u=t._serialize(c).toString("base64"),l={encoding:"base64",commitment:null!=r?r:e.commitment};if(i){const e=(Array.isArray(i)?i:a.nonProgramIds()).map((e=>e.toBase58()));l.accounts={encoding:"base64",addresses:e}}n&&(l.sigVerify=!0);const h=[u,l],d=lr(await e._rpcRequest("simulateTransaction",h),Mr);if("error"in d){let e;if("data"in d.error&&(e=null===(s=d.error.data)||void 0===s?void 0:s.logs,e&&Array.isArray(e))){const t="\n    ",n=t+e.join(t);console.error(d.error.message,n)}throw new o.SendTransactionError("failed to simulate transaction: "+d.error.message,e)}return d.result}const Tr=Ir(kr());function Ir(e){return Ar([br({jsonrpc:gr("2.0"),id:vr(),result:e}),br({jsonrpc:gr("2.0"),id:vr(),error:br({code:kr(),message:vr(),data:wr(fr("any",(()=>!0)))})})])}const Mr=(xr=br({err:yr(Ar([br({}),vr()])),logs:yr(pr(vr())),accounts:wr(yr(pr(yr(br({executable:fr("boolean",(e=>"boolean"==typeof e)),owner:vr(),lamports:mr(),data:pr(vr()),rentEpoch:wr(mr())}))))),unitsConsumed:wr(mr())}),function(e,t){return new ur({...e,coercer:(n,r)=>hr(n,t)?e.coercer((e=>"error"in e?e:{...e,result:lr(e.result,Rr)})(n),r):e.coercer(n,r)})}(Ir(Rr=br({context:br({slot:mr()}),value:xr})),Tr));var Rr,xr,Cr=Object.freeze({__proto__:null,invoke:async function(e,t,n,r){e=nr(e),r||(r=Lr());const i=new o.Transaction;if(i.add(new o.TransactionInstruction({programId:e,keys:null!=t?t:[],data:n})),void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await r.sendAndConfirm(i,[])},getMultipleAccounts:async function(e,t,n){return(await _r(e,t,n)).map((e=>e?{publicKey:e.publicKey,account:e.account}:null))},getMultipleAccountsAndContext:_r,simulateTransaction:Er});class Or{constructor(e,t,n){this.connection=e,this.wallet=t,this.opts=n,this.publicKey=null==t?void 0:t.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(e,t){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(e,t,n){var r,i,s,a;if(void 0===n&&(n=this.opts),zn(e))t&&e.sign(t);else if(e.feePayer=null!==(r=e.feePayer)&&void 0!==r?r:this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,t)for(const n of t)e.partialSign(n);const c=(e=await this.wallet.signTransaction(e)).serialize();try{return await Nr(this.connection,c,n)}catch(t){if(t instanceof Br){const n=Hn(zn(e)?(null===(i=e.signatures)||void 0===i?void 0:i[0])||new Uint8Array:null!==(s=e.signature)&&void 0!==s?s:new Uint8Array),r=await this.connection.getTransaction(n,{commitment:"confirmed"});if(r){const e=null===(a=r.meta)||void 0===a?void 0:a.logMessages;throw e?new o.SendTransactionError(t.message,e):t}throw t}throw t}}async sendAll(e,t){var n,r,i;void 0===t&&(t=this.opts);const s=(await this.connection.getLatestBlockhash(t.preflightCommitment)).blockhash;let a=e.map((e=>{var t,n;if(zn(e.tx)){let t=e.tx;return e.signers&&t.sign(e.signers),t}{let r=e.tx,o=null!==(t=e.signers)&&void 0!==t?t:[];return r.feePayer=null!==(n=r.feePayer)&&void 0!==n?n:this.wallet.publicKey,r.recentBlockhash=s,o.forEach((e=>{r.partialSign(e)})),r}}));const c=await this.wallet.signAllTransactions(a),u=[];for(let e=0;e<a.length;e+=1){const s=c[e],a=s.serialize();try{u.push(await Nr(this.connection,a,t))}catch(e){if(e instanceof Br){const t=Hn(zn(s)?(null===(n=s.signatures)||void 0===n?void 0:n[0])||new Uint8Array:null!==(r=s.signature)&&void 0!==r?r:new Uint8Array),a=await this.connection.getTransaction(t,{commitment:"confirmed"});if(a){const t=null===(i=a.meta)||void 0===i?void 0:i.logMessages;throw t?new o.SendTransactionError(e.message,t):e}throw e}throw e}}return u}async simulate(e,t,n,r){let o,i=(await this.connection.getLatestBlockhash(null!=n?n:this.connection.commitment)).blockhash;if(zn(e)?(t&&(e.sign(t),e=await this.wallet.signTransaction(e)),o=await this.connection.simulateTransaction(e,{commitment:n})):(e.feePayer=e.feePayer||this.wallet.publicKey,e.recentBlockhash=i,t&&(e=await this.wallet.signTransaction(e)),o=await Er(this.connection,e,t,n,r)),o.value.err)throw new Pr(o.value);return o.value}}
1class Pr extends Error{constructor(e,t){super(t),this.simulationResponse=e}}async function Nr(e,t,n){const r=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment},o=await e.sendRawTransaction(t,r),i=(await e.confirmTransaction(o,n&&n.commitment)).value;if(i.err)throw new Br(`Raw transaction ${o} failed (${JSON.stringify(i)})`);return o}class Br extends Error{constructor(e){super(e)}}function Vr(e){Dr=e}function Lr(){return null===Dr?Or.local():Dr}let Dr=null;const jr=new Set(["anchor-deprecated-state","debug-logs"]),Ur=new Map;function Wr(e){return void 0!==Ur.get(e)}var zr=Object.freeze({__proto__:null,set:function(e){if(!jr.has(e))throw new Error("Invalid feature");Ur.set(e,!0)},isSet:Wr});class Gr extends Error{constructor(e){super(e),this.name="IdlError"}}class Kr{constructor(e){this.stack=e}static parse(e){var t;const n=/^Program (\w*) invoke/,r=/^Program \w* success/,i=[];for(let s=0;s<e.length;s++){if(r.exec(e[s])){i.pop();continue}const a=null===(t=n.exec(e[s]))||void 0===t?void 0:t[1];a&&i.push(new o.PublicKey(a))}return new Kr(i)}}class Fr extends Error{constructor(e,t,n,r,o,i){super(n.join("\n").replace("Program log: ","")),this.errorLogs=n,this.logs=r,this.error={errorCode:e,errorMessage:t,comparedValues:i,origin:o},this._programErrorStack=Kr.parse(r)}static parse(e){if(!e)return null;const t=e.findIndex((e=>e.startsWith("Program log: AnchorError")));if(-1===t)return null;const n=e[t],r=[n];let i;if(t+1<e.length)if("Program log: Left:"===e[t+1]){const n=/^Program log: (.*)$/,s=n.exec(e[t+2])[1],a=n.exec(e[t+4])[1];i=[new o.PublicKey(s),new o.PublicKey(a)],r.push(...e.slice(t+1,t+5))}else if(e[t+1].startsWith("Program log: Left:")){const n=/^Program log: (Left|Right): (.*)$/,o=n.exec(e[t+1])[2],s=n.exec(e[t+2])[2];r.push(...e.slice(t+1,t+3)),i=[o,s]}const s=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),a=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),c=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(s){const[t,n,o]=s.slice(1,4),a={code:t,number:parseInt(n)};return new Fr(a,o,r,e,void 0,i)}if(a){const[t,n,o,s,c]=a.slice(1,6),u={code:o,number:parseInt(s)},l={file:t,line:parseInt(n)};return new Fr(u,c,r,e,l,i)}if(c){const[t,n,o,s]=c.slice(1,5),a=t,u={code:n,number:parseInt(o)};return new Fr(u,s,r,e,a,i)}return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}class qr extends Error{constructor(e,t,n){super(),this.code=e,this.msg=t,this.logs=n,n&&(this._programErrorStack=Kr.parse(n))}static parse(e,t){const n=e.toString();let r,o;if(n.includes("custom program error:")){let e=n.split("custom program error: ");if(2!==e.length)return null;r=e[1]}else{const e=n.match(/"Custom":([0-9]+)}/g);if(!e||e.length>1)return null;r=e[0].match(/([0-9]+)/g)[0]}try{o=parseInt(r)}catch(e){return null}let i=t.get(o);return void 0!==i?new qr(o,i,e.logs):(i=$r.get(o),void 0!==i?new qr(o,i,e.logs):null)}get program(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack}toString(){return this.msg}}function Hr(e,t){Wr("debug-logs")&&console.log("Translating error:",e);const n=Fr.parse(e.logs);if(n)return n;const r=qr.parse(e,t);if(r)return r;if(e.logs){const t={get:function(t,n){return"programErrorStack"===n?t.programErrorStack.stack:"program"===n?t.programErrorStack.stack[e.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return e.programErrorStack=Kr.parse(e.logs),new Proxy(e,t)}return e}const Yr={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintE
1xecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},$r=new Map([[Yr.InstructionMissing,"8 byte instruction identifier not provided"],[Yr.InstructionFallbackNotFound,"Fallback functions are not supported"],[Yr.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[Yr.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[Yr.IdlInstructionStub,"The program was compiled without idl instructions"],[Yr.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[Yr.ConstraintMut,"A mut constraint was violated"],[Yr.ConstraintHasOne,"A has one constraint was violated"],[Yr.ConstraintSigner,"A signer constraint was violated"],[Yr.ConstraintRaw,"A raw constraint was violated"],[Yr.ConstraintOwner,"An owner constraint was violated"],[Yr.ConstraintRentExempt,"A rent exemption constraint was violated"],[Yr.ConstraintSeeds,"A seeds constraint was violated"],[Yr.ConstraintExecutable,"An executable constraint was violated"],[Yr.ConstraintState,"Deprecated Error, feel free to replace with something else"],[Yr.ConstraintAssociated,"An associated constraint was violated"],[Yr.ConstraintAssociatedInit,"An associated init constraint was violated"],[Yr.ConstraintClose,"A close constraint was violated"],[Yr.ConstraintAddress,"An address constraint was violated"],[Yr.ConstraintZero,"Expected zero account discriminant"],[Yr.ConstraintTokenMint,"A token mint constraint was violated"],[Yr.ConstraintTokenOwner,"A token owner constraint was violated"],[Yr.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[Yr.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[Yr.ConstraintMintDecimals,"A mint decimals constraint was violated"],[Yr.ConstraintSpace,"A space constraint was violated"],[Yr.ConstraintAccountIsNone,"A required account for the constraint is None"],[Yr.RequireViolated,"A require expression was violated"],[Yr.RequireEqViolated,"A require_eq expression was violated"],[Yr.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[Yr.RequireNeqViolated,"A require_neq expression was violated"],[Yr.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[Yr.RequireGtViolated,"A require_gt expression was violated"],[Yr.RequireGteViolated,"A require_gte expression was violated"],[Yr.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[Yr.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[Yr.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[Yr.AccountDidNotDeserialize,"Failed to deserialize the account"],[Yr.AccountDidNotSerialize,"Failed to serialize the account"],[Yr.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[Yr.AccountNotMutable,"The given account is not mutable"],[Yr.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[Yr.InvalidProgramId,"Program ID was not as expected"],[Yr.InvalidProgramExecutable,"Program account is not executable"],[Yr.AccountNotSigner,"The given account did not sign"],[Yr.AccountNotSystemOwned,"The given account is not owned by the system program"],[Yr.AccountNotInitialized,"The program expected this account to be already initialized"],[Yr.AccountNotProgramData,"The given account is not a program data account"],[Yr.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[Yr.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[Yr.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[Yr.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[Yr.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[Yr.Deprecated,"The API being used is deprecated and should no longer be used"]]);var Zr=function(){return Zr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Zr.apply(this,arguments)},Qr=function(){return Qr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Qr.apply(this,arguments)};function Jr(e){return e.toLowerCase()}var Xr=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],eo=/[^A-Z0-9]+/gi;function to(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}class no{static fieldLayout(e,t){const n=void 0!==e.name?l()(e.name):void 0;switch(e.type){case"bool":return h.bool(n);case"u8":return h.u8(n);case"i8":return h.i8(n);case"u16":return h.u16(n);case"i16":return h.i16(n);case"u32":return h.u32(n);case"i32":return h.i32(n);case"f32":return h.f32(n);case"u64":return h.u64(n);case"i64":return h.i64(n);case"f64":return h.f64(n);case"u128":return h.u128(n);case"i128":return h.i128(n);case"u256":return h.u256(n);case"i256":return h.i256(n);case"bytes":return h.vecU8(n);case"string":return h.str(n);case"publicKey":return h.publicKey(n);default:if("vec"in e.type)return h.vec(no.fieldLayout({name:void 0,type:e.type.vec},t),n);if("option"in e.type)return h.option(no.fieldLayout({name:void 0,type:e.type.option},t),n);if("defined"in e.type){if(!t)throw new Gr("User defined types not provided");const r=e.type.defined,o=t.filter((e=>e.name===r));if(1!==o.length)throw new Gr(`Type not found: ${JSON.stringify(e)}`);return no.typeDefLayout(o[0],t,n)}if("array"in e.type){let r=e.type.array[0],o=e.type.array[1],i=no.fieldLayout({name:void 0,type:r},t);return h.array(i,o,n)}throw new Error(`Not yet implemented: ${e}`)}}static typeDefLayout(e,t=[],n){switch(e.type.kind){case"struct":{const r=e.type.fields.map((e=>no.fieldLayout(e,t)));return h.struct(r,n)}case"enum":{let r=e.type.variants.map((e=>{const n=l()(e.name);if(!e.fields)return h.struct([],n);const r=e.fields.map(((e,n)=>(null==e?void 0:e.name)?no.fieldLayout(e,t):no.fieldLayout({type:e,name:n.toString()},t)));return h.struct(r,n)}));return void 0!==n?h.rustEnum(r).replicate(n):h.rustEnum(r,n)}case"alias":return no.fieldLayout({type:e.type.value,name:e.name},t)}}}const ro="global";class oo{constructor(e){this.idl=e,this.ixLayout=oo.parseIxLayout(e);const t=new Map;e.instructions.forEach((e=>{const n=so(ro,e.name);
1t.set(c().encode(n),{layout:this.ixLayout.get(e.name),name:e.name})})),this.sighashLayouts=t}encode(e,t){return this._encode(ro,e,t)}_encode(e,t,n){const o=r.Buffer.alloc(1e3),i=l()(t),s=this.ixLayout.get(i);if(!s)throw new Error(`Unknown method: ${i}`);const a=s.encode(n,o),c=o.slice(0,a);return r.Buffer.concat([so(e,t),c])}static parseIxLayout(e){const t=e.instructions.map((t=>{let n=t.args.map((t=>{var n,r;return no.fieldLayout(t,Array.from([...null!==(n=e.accounts)&&void 0!==n?n:[],...null!==(r=e.types)&&void 0!==r?r:[]]))}));const r=l()(t.name);return[r,h.struct(n,r)]}));return new Map(t)}decode(e,t="hex"){"string"==typeof e&&(e="hex"===t?r.Buffer.from(e,"hex"):c().decode(e));let n=c().encode(e.slice(0,8)),o=e.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(o),name:i.name}:null}format(e,t){return io.format(e,t,this.idl)}}class io{static format(e,t,n){const r=n.instructions.filter((t=>e.name===t.name))[0];if(void 0===r)return console.error("Invalid instruction given"),null;const o=r.args.map((t=>({name:t.name,type:io.formatIdlType(t.type),data:io.formatIdlData(t,e.data[t.name],n.types)}))),i=io.flattenIdlAccounts(r.accounts);return{args:o,accounts:t.map(((e,t)=>t<i.length?{name:i[t].name,...e}:{name:void 0,...e}))}}static formatIdlType(e){if("string"==typeof e)return e;if("vec"in e)return`Vec<${this.formatIdlType(e.vec)}>`;if("option"in e)return`Option<${this.formatIdlType(e.option)}>`;if("defined"in e)return e.defined;if("array"in e)return`Array<${e.array[0]}; ${e.array[1]}>`;throw new Error(`Unknown IDL type: ${e}`)}static formatIdlData(e,t,n){if("string"==typeof e.type)return t.toString();if(e.type.hasOwnProperty("vec"))return"["+t.map((t=>this.formatIdlData({name:"",type:e.type.vec},t))).join(", ")+"]";if(e.type.hasOwnProperty("option"))return null===t?"null":this.formatIdlData({name:"",type:e.type.option},t,n);if(e.type.hasOwnProperty("defined")){if(void 0===n)throw new Error("User defined types not provided");const r=n.filter((t=>t.name===e.type.defined));if(1!==r.length)throw new Error(`Type not found: ${e.type.defined}`);return io.formatIdlDataDefined(r[0],t,n)}return"unknown"}static formatIdlDataDefined(e,t,n){switch(e.type.kind){case"struct":{const r=e.type;return"{ "+Object.keys(t).map((e=>{const o=r.fields.find((t=>t.name===e));if(!o)throw new Error("Unable to find type");return e+": "+io.formatIdlData(o,t[e],n)})).join(", ")+" }"}case"enum":if(0===e.type.variants.length)return"{}";if(e.type.variants[0].name){const r=e.type.variants,o=Object.keys(t)[0],i=t[o],s=Object.keys(i).map((e=>{var t;const s=i[e],a=null===(t=r[o])||void 0===t?void 0:t.find((t=>t.name===e));if(!a)throw new Error("Unable to find variant");return e+": "+io.formatIdlData(a,s,n)})).join(", "),a=l()(o,{pascalCase:!0});return 0===s.length?a:`${a} { ${s} }`}return"Tuple formatting not yet implemented";case"alias":return io.formatIdlType(e.type.value)}}static flattenIdlAccounts(e,t){return e.map((e=>{const n=function(e){const t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}(e.name);if(e.hasOwnProperty("accounts")){const r=t?`${t} > ${n}`:n;return io.flattenIdlAccounts(e.accounts,r)}return{...e,name:t?`${t} > ${n}`:n}})).flat()}}function so(e,t){var n;let o=`${e}:${void 0===n&&(n={}),function(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?Xr:n,o=t.stripRegexp,i=void 0===o?eo:o,s=t.transform,a=void 0===s?Jr:s,c=t.delimiter,u=void 0===c?" ":c,l=to(to(e,r,"$1\0$2"),i,"\0"),h=0,d=l.length;"\0"===l.charAt(h);)h++;for(;"\0"===l.charAt(d-1);)d--;return l.slice(h,d).split("\0").map(a).join(u)}(e,Qr({delimiter:"."},t))}(t,Zr({delimiter:"_"},n))}`;return r.Buffer.from((0,d.sc)(o).slice(0,8))}function ao(e,t){switch(t.type.kind){case"struct":return t.type.fields.map((t=>co(e,t.type))).reduce(((e,t)=>e+t),0);case"enum":{const n=t.type.variants.map((t=>t.fields?t.fields.map((t=>co(e,"object"==typeof t&&"name"in t?t.type:t))).reduce(((e,t)=>e+t),0):0));return Math.max(...n)+1}case"alias":return co(e,t.type.value)}}function co(e,t){var n,r;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+co(e,t.option);if("coption"in t)return 4+co(e,t.coption);if("defined"in t){const o=null!==(r=null===(n=e.types)||void 0===n?void 0:n.filter((e=>e.name===t.defined)))&&void 0!==r?r:[];if(1!==o.length)throw new Gr(`Type not found: ${JSON.stringify(t)}`);return ao(e,o[0])}if("array"in t){let n=t.array[0],r=t.array[1];return co(e,n)*r}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const uo=8;function lo(e){return Wn.from((0,d.sc)(e).slice(0,uo))}class ho{constructor(e){if(void 0===e.accounts)return void(this.accountLayouts=new Map);const t=e.accounts.map((t=>[t.name,no.typeDefLayout(t,e.types)]));this.accountLayouts=new Map(t),this.idl=e}async encode(e,t){const n=r.Buffer.alloc(1e3),o=this.accountLayouts.get(e);if(!o)throw new Error(`Unknown account: ${e}`);const i=o.encode(t,n);let s=n.slice(0,i),a=ho.accountDiscriminator(e);return r.Buffer.concat([a,s])}decode(e,t){if(ho.accountDiscriminator(e).compare(t.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,t)}decodeAny(e){const t=e.slice(0,8),n=Array.from(this.accountLayouts.keys()).find((e=>ho.accountDiscriminator(e).equals(t)));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,e)}decodeUnchecked(e,t){const n=t.subarray(uo),r=this.accountLayouts.get(e);if(!r)throw new Error(`Unknown account: ${e}`);return r.decode(n)}memcmp(e,t){const n=ho.accountDiscriminator(e);return{offset:0,bytes:c().encode(t?r.Buffer.concat([n,t]):n)}}size(e){var t;return uo+(null!==(t=ao(this.idl,e))&&void 0!==t?t:0)}static accountDiscriminator(e){return lo(`account:${l()(e,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class fo{constructor(e){if(void 0===e.events)return void(this.layouts=new Map);const t=e.events.map((t=>{let n={name:t.name,type:{kind:"struct",fields:t.fields.map((e=>({name:e.name,type:e.type})))}};return[t.name,no.typeDefLayout(n,e.types)]}));this.layouts=new Map(t),this.discriminators=new Map(void 0===e.events?[]:e.events.map((e=>[$n(po(e.name)),e.name])))}decode(e){let t;try{t=Zn(e)}catch(e){return null}const n=$n(t.slice(0,8)),r=this.discriminators.get(n);if(void 0===r)return null;const o=this.layouts.get(r);if(!o)throw new Error(`Unknown event: ${r}`);return{data:o.decode(t.slice(8)),name:r}}}function po(e){return lo(`event:${e}`)}class go{constructor(e){if(void 0===e.types)return void(this.typeLayouts=new Map);const t=e.types.map((t=>[t.name,no.typeDefLayout(t,e.types)]));this.typeLayouts=new Map(t),this.idl=e}encode(e,t){const n=r.Buffer.alloc(1e3),o=this.typeLayouts.get(e);if(!o)throw new Error(`Unknown type: ${e}`);const i=o.encode(t,n);return n.slice(0,i)}decode(e,t){const n=this.typeLayouts.get(e);if(!n)throw new Error(`Unknown type: ${e}`);return n.decode(t)}}class yo{constructor(e){this.instruction=new oo(e),this.accounts=new ho(e),this.events=new fo(e),this.types=new go(e)}}var mo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};
1function wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}class vo{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var bo=vo;class Ao extends vo{isCount(){throw new Error("ExternalLayout is abstract")}}class ko extends Ao{constructor(e,t,n){if(!(e instanceof vo))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof _o||this.layout instanceof So}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class _o extends vo{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}class So extends vo{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}const Eo=Math.pow(2,32);function To(e){const t=Math.floor(e/Eo);return{hi32:t,lo32:e-t*Eo}}function Io(e,t){return e*Eo+t}class Mo extends vo{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return Io(e.readInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=To(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}class Ro extends vo{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof vo),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(e,t);return t+=o,n+o}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0<s?s:0,void 0!==r.property){const o=e[r.property];void 0!==o&&(i=r.encode(o,t,n),0>s&&(s=r.getSpan(t,n)))}o=n,n+=s}return o+i-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class xo{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class Co extends xo{constructor(e,t){if(!(e instanceof Ao&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class Oo extends vo{constructor(e,t,n){const r=e instanceof _o||e instanceof So;if(r)e=new Co(new ko(e));else if(e instanceof Ao&&e.isCount())e=new Co(e);else if(!(e instanceof xo))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof vo))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let o=-1;
1t&&(o=t.span,0<=o&&r&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return i(e)},this.configGetSourceVariant=function(e){i=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,o=r.decode(e,t);let i=this.registry[o];if(void 0===i){let s=0;i=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=o,n[i.property]=this.defaultLayout.decode(e,t+s)}else n=i.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=r.layout.span),r.encode(e[r.property],t,n),i+o.encode(e[o.property],t,n+i)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new Po(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return Wn.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class Po extends vo{constructor(e,t,n,r){if(!(e instanceof Oo))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof vo))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),o+=this.layout.getSpan(t,n+r),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class No extends vo{constructor(e,t){if(!(e instanceof Ao&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof Ao||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof Ao&&(r=e.length),!Wn.isBuffer(e)||r!==e.length)throw new TypeError((o="Blob.encode",(this.property?o+"["+this.property+"]":o)+" requires (length "+r+") Buffer as src"));var o;if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof Ao&&this.length.encode(r,t,n),r}}var Bo=(e,t,n)=>new ko(e,t,n),Vo=e=>
1new _o(4,e),Lo=e=>new Mo(e),Do=(e,t,n)=>new Ro(e,t,n),jo=(e,t,n)=>new Oo(e,t,n),Uo=(e,t)=>new No(e,t);class Wo{constructor(e){}encode(e,t){switch(l()(e)){case"createAccount":return function({lamports:e,space:t,owner:n}){return qo({createAccount:{lamports:e,space:t,owner:n.toBuffer()}})}(t);case"assign":return function({owner:e}){return qo({assign:{owner:e.toBuffer()}})}(t);case"transfer":return function({lamports:e}){return qo({transfer:{lamports:e}})}(t);case"createAccountWithSeed":return function({base:e,seed:t,lamports:n,space:r,owner:o}){return qo({createAccountWithSeed:{base:e.toBuffer(),seed:t,lamports:n,space:r,owner:o.toBuffer()}},Fo.getVariant(3).span+t.length)}(t);case"advanceNonceAccount":return function({authorized:e}){return qo({advanceNonceAccount:{authorized:e.toBuffer()}})}(t);case"withdrawNonceAccount":return function({lamports:e}){return qo({withdrawNonceAccount:{lamports:e}})}(t);case"initializeNonceAccount":return function({authorized:e}){return qo({initializeNonceAccount:{authorized:e.toBuffer()}})}(t);case"authorizeNonceAccount":return function({authorized:e}){return qo({authorizeNonceAccount:{authorized:e.toBuffer()}})}(t);case"allocate":return function({space:e}){return qo({allocate:{space:e}})}(t);case"allocateWithSeed":return function({base:e,seed:t,space:n,owner:r}){return qo({allocateWithSeed:{base:e.toBuffer(),seed:t,space:n,owner:r.toBuffer()}},Fo.getVariant(9).span+t.length)}(t);case"assignWithSeed":return function({base:e,seed:t,owner:n}){return qo({assignWithSeed:{base:e.toBuffer(),seed:t,owner:n.toBuffer()}},Fo.getVariant(10).span+t.length)}(t);case"transferWithSeed":return function({lamports:e,seed:t,owner:n}){return qo({transferWithSeed:{lamports:e,seed:t,owner:n.toBuffer()}},Fo.getVariant(11).span+t.length)}(t);default:throw new Error(`Invalid instruction: ${e}`)}}encodeState(e,t){throw new Error("System does not have state")}}class zo extends bo{constructor(e){super(-1,e),this.property=e,this.layout=Do([Vo("length"),Vo("lengthPadding"),Uo(Bo(Vo(),-8),"chars")],this.property)}encode(e,t,n=0){if(null==e)return this.layout.span;const r={chars:Wn.from(e,"utf8")};return this.layout.encode(r,t,n)}decode(e,t=0){return this.layout.decode(e,t).chars.toString()}getSpan(e,t=0){return Vo().span+Vo().span+new(s())(new Uint8Array(e).slice(t,t+4),10,"le").toNumber()}}function Go(e){return new zo(e)}function Ko(e){return Uo(32,e)}const Fo=jo(Vo("instruction"));function qo(e,t){const n=Wn.alloc(null!=t?t:Ho),r=Fo.encode(e,n);return void 0===t?n.slice(0,r):n}Fo.addVariant(0,Do([Lo("lamports"),Lo("space"),Ko("owner")]),"createAccount"),Fo.addVariant(1,Do([Ko("owner")]),"assign"),Fo.addVariant(2,Do([Lo("lamports")]),"transfer"),Fo.addVariant(3,Do([Ko("base"),Go("seed"),Lo("lamports"),Lo("space"),Ko("owner")]),"createAccountWithSeed"),Fo.addVariant(4,Do([Ko("authorized")]),"advanceNonceAccount"),Fo.addVariant(5,Do([Lo("lamports")]),"withdrawNonceAccount"),Fo.addVariant(6,Do([Ko("authorized")]),"initializeNonceAccount"),Fo.addVariant(7,Do([Ko("authorized")]),"authorizeNonceAccount"),Fo.addVariant(8,Do([Lo("space")]),"allocate"),Fo.addVariant(9,Do([Ko("base"),Go("seed"),Lo("space"),Ko("owner")]),"allocateWithSeed"),Fo.addVariant(10,Do([Ko("base"),Go("seed"),Ko("owner")]),"assignWithSeed"),Fo.addVariant(11,Do([Lo("lamports"),Go("seed"),Ko("owner")]),"transferWithSeed");const Ho=Math.max(...Object.values(Fo.registry).map((e=>e.span)));class Yo{constructor(e){this.idl=e}async encode(e,t){if("nonce"===e){const e=Wn.alloc(o.NONCE_ACCOUNT_LENGTH),n=Qo.encode(t,e);return e.slice(0,n)}throw new Error(`Invalid account name: ${e}`)}decode(e,t){return this.decodeUnchecked(e,t)}decodeUnchecked(e,t){if("nonce"===e)return function(e){return Qo.decode(e)}(t);throw new Error(`Invalid account name: ${e}`)}memcmp(e,t){if("nonce"===e)return{dataSize:o.NONCE_ACCOUNT_LENGTH};throw new Error(`Invalid account name: ${e}`)}size(e){var t;return null!==(t=ao(this.idl,e))&&void 0!==t?t:0}}class $o extends bo{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}function Zo(e){return new $o(Uo(32),(e=>new o.PublicKey(e)),(e=>e.toBuffer()),e)}const Qo=Do([Vo("version"),Vo("state"),Zo("authorizedPubkey"),Zo("nonce"),Do([new class extends vo{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return Io(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=To(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}
1("lamportsPerSignature")],"feeCalculator")]);class Jo{constructor(e){}decode(e){throw new Error("System program does not have events")}}class Xo{constructor(e){}encode(e,t){throw new Error("System does not have user-defined types")}decode(e,t){throw new Error("System does not have user-defined types")}}class ei{constructor(e){this.instruction=new Wo(e),this.accounts=new Yo(e),this.events=new Jo(e),this.types=new Xo(e)}}var ti=Object.freeze({__proto__:null,hash:function(e){return(new TextDecoder).decode((0,d.sc)(e))}});function ni(e,...t){let n=[r.Buffer.from([97,110,99,104,111,114])];t.forEach((e=>{n.push(e instanceof r.Buffer?e:nr(e).toBuffer())}));const[i]=o.PublicKey.findProgramAddressSync(n,nr(e));return i}var ri=Object.freeze({__proto__:null,createWithSeedSync:function(e,t,n){const i=r.Buffer.concat([e.toBuffer(),r.Buffer.from(t),n.toBuffer()]);return new o.PublicKey((0,d.sc)(i))},associated:ni});const oi=new o.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ii=new o.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var si=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:oi,ASSOCIATED_PROGRAM_ID:ii,associatedAddress:function({mint:e,owner:t}){return o.PublicKey.findProgramAddressSync([t.toBuffer(),oi.toBuffer(),e.toBuffer()],ii)[0]}}),ai={exports:{}};!function(e,t){var n="undefined"!=typeof self?self:mo,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=u(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},d.prototype.delete=function(e){delete this.map[u(e)]},d.prototype.get=function(e){return e=u(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(u(e))},d.prototype.set=function(e,t){this.map[u(e)]=l(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},r&&(d.prototype[Symbol.iterator]=d.prototype.entries);
vendor: 3,653 bytes, line 1
1var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(e,t){var n,r,o=(t=t||{}).body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(r=(n=t.method||this.method||"GET").toUpperCase(),w.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},m.call(v.prototype),m.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];A.redirect=function(e,t){if(-1===k.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function _(e,n){return new Promise((function(r,i){var s=new v(e,n);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;r(new A(o,n))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}_.polyfill=!0,e.fetch||(e.fetch=_,e.Headers=d,e.Request=v,e.Response=A),t.Headers=d,t.Request=v,t.Response=A,t.fetch=_,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=r;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(ai,ai.exports);
1var ci=wo(ai.exports);async function ui(e,t){const n=await e.getAccountInfo(t);if(null===n)throw new Error("program account not found");const{program:r}=hi(n.data),o=await e.getAccountInfo(r.programdataAddress);if(null===o)throw new Error("program data account not found");const{programData:i}=hi(o.data);return i}const li=h.rustEnum([h.struct([],"uninitialized"),h.struct([h.option(h.publicKey(),"authorityAddress")],"buffer"),h.struct([h.publicKey("programdataAddress")],"program"),h.struct([h.u64("slot"),h.option(h.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,h.u32());function hi(e){return li.decode(e)}var di=Object.freeze({__proto__:null,verifiedBuild:async function(e,t,n=5){const r=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${n}`,[o,i]=await Promise.all([ui(e,t),ci(r)]),s=(await i.json()).filter((e=>!e.aborted&&"Built"===e.state&&"Verified"===e.verified));if(0===s.length)return null;const a=s[0];return o.slot.toNumber()!==a.verified_slot?null:a},fetchData:ui,decodeUpgradeableLoaderState:hi}),fi=Object.freeze({__proto__:null,sha256:ti,rpc:Cr,publicKey:ri,bytes:Jn,token:si,features:zr,registry:di});function pi(e){return"accounts"in e}const gi=h.struct([h.publicKey("authority"),h.vecU8("data")]);function yi(e,t){var n,r;let o={};const i=e.args?e.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${null==e?void 0:e.name} expecting: ${null!==(r=null===(n=e.args)||void 0===n?void 0:n.map((e=>e.name)))&&void 0!==r?r:[]}`);o=t.pop()}return[t,o]}class mi{static build(e,t,n){if("_inner"===e.name)throw new Gr("the _inner name is reserved");const r=(...i)=>{const[s,a]=yi(e,[...i]);tr(e.accounts,a.accounts);const c=r.accounts(a.accounts);return void 0!==a.remainingAccounts&&c.push(...a.remainingAccounts),Wr("debug-logs")&&console.log("Outgoing account metas:",c),new o.TransactionInstruction({keys:c,programId:n,data:t(e.name,er(e,...s))})};return r.accounts=t=>mi.accountsArray(t,e.accounts,n,e.name),r}static accountsArray(e,t,n,r){return e?t.map((t=>{if(void 0!==("accounts"in t?t.accounts:void 0)){const o=e[t.name];return mi.accountsArray(o,t.accounts,n,r).flat()}{const o=t;let i;try{i=nr(e[t.name])}catch(e){throw new Error(`Wrong input type for account "${t.name}" in the instruction accounts object${void 0!==r?' for instruction "'+r+'"':""}. Expected PublicKey or string.`)}const s=o.isOptional&&i.equals(n);return{pubkey:i,isWritable:o.isMut&&!s,isSigner:o.isSigner&&!s}}})).flat():[]}}class wi{static build(e,t){return(...n)=>{var r,i,s;const[,a]=yi(e,[...n]),c=new o.Transaction;if(a.preInstructions&&a.instructions)throw new Error("instructions is deprecated, use preInstructions");return null===(r=a.preInstructions)||void 0===r||r.forEach((e=>c.add(e))),null===(i=a.instructions)||void 0===i||i.forEach((e=>c.add(e))),c.add(t(...n)),null===(s=a.postInstructions)||void 0===s||s.forEach((e=>c.add(e))),c}}}class vi{static build(e,t,n,r){return async(...o)=>{var i;const s=t(...o),[,a]=yi(e,[...o]);if(void 0===r.sendAndConfirm)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await r.sendAndConfirm(s,null!==(i=a.signers)&&void 0!==i?i:[],a.options)}catch(e){throw Hr(e,n)}}}}class bi{static build(e,t,n,r){var o;const i={};return null===(o=e.accounts)||void 0===o||o.forEach((o=>{const s=l()(o.name);i[s]=new Ai(e,o,n,r,t)})),i}}class Ai{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(e,t,n,r,o){this._idlAccount=t,this._programId=n,this._provider=null!=r?r:Lr(),this._coder=null!=o?o:new yo(e),this._size=this._coder.accounts.size(t)}async fetchNullable(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);return n}async fetchNullableAndContext(e,t){const n=await this.getAccountInfoAndContext(e,t),{value:r,context:o}=n;return{data:r&&0!==r.data.length?this._coder.accounts.decode(this._idlAccount.name,r.data):null,context:o}}async fetch(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);if(null===n)throw new Error(`Account does not exist or has no data ${e.toString()}`);return n}async fetchAndContext(e,t){const{data:n,context:r}=await this.fetchNullableAndContext(e,t);if(null===n)throw new Error(`Account does not exist ${e.toString()}`);return{data:n,context:r}}async fetchMultiple(e,t){return(await this.fetchMultipleAndContext(e,t)).map((e=>e?e.data:null))}async fetchMultipleAndContext(e,t){return(await _r(this._provider.connection,e.map((e=>nr(e))),t)).map((e=>{if(null==e)return null;const{account:t,context:n}=e;return{data:this._coder.accounts.decode(this._idlAccount.name,t.data),context:n}}))}async all(e){const t=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof Wn?e:void 0),n=[];return null!=(null==t?void 0:t.offset)&&null!=(null==t?void 0:t.bytes)&&n.push({memcmp:{offset:t.offset,bytes:t.bytes}}),null!=(null==t?void 0:t.dataSize)&&n.push({dataSize:t.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(e)?e:[]]})).map((({pubkey:e,account:t})=>({publicKey:e,account:this._coder.accounts.decode(this._idlAccount.name,t.data)})))}subscribe(e,t){const n=ki.get(e.toString());if(n)return n.ee;const r=new(Un());e=nr(e);const o=this._provider.connection.onAccountChange(e,(e=>{const t=this._coder.accounts.decode(this._idlAccount.name,e.data);r.emit("change",t)}),t);return ki.set(e.toString(),{ee:r,listener:o}),r}async unsubscribe(e){let t=ki.get(e.toString());t?ki&&await this._provider.connection.removeAccountChangeListener(t.listener).then((()=>{ki.delete(e.toString())})).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(e,t){const n=this.size;if(void 0===this._provider.publicKey)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return o.SystemProgram.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:e.publicKey,space:null!=t?t:n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(null!=t?t:n),programId:this._programId})}async associated(...e){const t=await this.associatedAddress(...e);return await this.fetch(t)}async associatedAddress(...e){return await ni(this._programId,...e)}async getAccountInfo(e,t){return await this._provider.connection.getAccountInfo(nr(e),t)}async getAccountInfoAndContext(e,t){return await this._provider.connection.getAccountInfoAndContext(nr(e),t)}}const ki=new Map,_i="Program log: ";class Si{constructor(e,t,n){this._programId=e,this._provider=t,this._eventParser=new Ei(e,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}
1addEventListener(e,t){var n;let r=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,(null!==(n=this._eventListeners.get(e))&&void 0!==n?n:[]).concat(r)),this._eventCallbacks.set(r,[e,t]),void 0!==this._onLogsSubscriptionId||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,((e,t)=>{if(!e.err)for(const n of this._eventParser.parseLogs(e.logs)){const r=this._eventListeners.get(n.name);r&&r.forEach((r=>{const o=this._eventCallbacks.get(r);if(o){const[,r]=o;r(n.data,t.slot,e.signature)}}))}}))),r}async removeEventListener(e){const t=this._eventCallbacks.get(e);if(!t)throw new Error(`Event listener ${e} doesn't exist!`);const[n]=t;let r=this._eventListeners.get(n);if(!r)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(e),r=r.filter((t=>t!==e)),this._eventListeners.set(n,r),0===r.length&&this._eventListeners.delete(n),0===this._eventCallbacks.size){if(0!==this._eventListeners.size)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);void 0!==this._onLogsSubscriptionId&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class Ei{constructor(e,t){this.coder=t,this.programId=e}*parseLogs(e,t=!1){const n=new Ii(e),r=new Ti;let o=n.next();for(;null!==o;){let[e,i,s]=this.handleLog(r,o,t);e&&(yield e),i&&r.push(i),s&&r.pop(),o=n.next()}}handleLog(e,t,n){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(t,n):[null,...this.handleSystemLog(t)]}handleProgramLog(e,t){if(e.startsWith(_i)||e.startsWith("Program data: ")){const n=e.startsWith(_i)?e.slice(13):e.slice(14),r=this.coder.events.decode(n);if(t&&null===r)throw new Error(`Unable to decode event ${n}`);return[r,null,!1]}return[null,...this.handleSystemLog(e)]}handleSystemLog(e){const t=e.split(":")[0];return null!==t.match(/^Program (.*) success/g)?[null,!0]:t.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:t.includes("invoke")?["cpi",!1]:[null,!1]}}class Ti{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(e){this.stack.push(e)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class Ii{constructor(e){this.logs=e}next(){if(0===this.logs.length)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}}class Mi{static build(e,t,n,r,o,i,s){return async(...a)=>{var c;const u=t(...a),[,l]=yi(e,[...a]);let h;if(void 0===r.simulate)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{h=await r.simulate(u,l.signers,null===(c=l.options)||void 0===c?void 0:c.commitment)}catch(e){throw Hr(e,n)}if(void 0===h)throw new Error("Unable to simulate transaction");const d=h.logs;if(!d)throw new Error("Simulated logs not found");const f=[];if(s.events){let e=new Ei(i,o);for(const t of e.parseLogs(d))f.push(t)}return{events:f,raw:d}}}}function Ri(e){return new Oi(Uo(8),(e=>Ni.fromBuffer(e)),(e=>e.toBuffer()),e)}function xi(e){return new Oi(Uo(32),(e=>new o.PublicKey(e)),(e=>e.toBuffer()),e)}function Ci(e,t){return new Pi(e,t)}class Oi extends bo{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}class Pi extends bo{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=Vo()}encode(e,t,n=0){return null==e?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,t=0){return this.layout.getSpan(e,t+4)+4}}class Ni extends(s()){toBuffer(){const e=super.toArray().reverse(),t=Wn.from(e);if(8===t.length)return t;if(t.length>=8)throw new Error("u64 too large");const n=Wn.alloc(8);return t.copy(n),n}static fromBuffer(e){if(8!==e.length)throw new Error(`Invalid buffer length: ${e.length}`);return new Ni([...e].reverse().map((e=>`00${e.toString(16)}`.slice(-2))).join(""),16)}}const Bi=Do([xi("mint"),xi("owner"),Ri("amount"),Ci(xi(),"delegate"),
1(()=>{const e=jo(new _o(1,"discriminator"),null,"state");return e.addVariant(0,Do([]),"uninitialized"),e.addVariant(1,Do([]),"initialized"),e.addVariant(2,Do([]),"frozen"),e})(),Ci(Ri(),"isNative"),Ri("delegatedAmount"),Ci(xi(),"closeAuthority")]);class Vi{constructor(e,t,n,r,o,i,s,a){this._accounts=t,this._provider=n,this._programId=r,this._idlIx=o,this._idlTypes=s,this._customResolver=a,this._args=e,this._accountStore=new Li(n,i,this._programId)}args(e){this._args=e}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:e,resolved:t}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,t}return 0}resolveOptionalsHelper(e,t){const n={};for(const r of t){const t=r.name,o=e[t];void 0!==o&&(ji(o)?pi(r)?n[t]=this.resolveOptionalsHelper(o,r.accounts):n[t]=Ui(o,!0):null!==o?n[t]=nr(o):r.isOptional&&(n[t]=this._programId))}return n}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){const t=e.reduce(((e,t)=>e&&e[t]),this._accounts);if(t&&t.toBase58)return t}set(e,t){let n=this._accounts;e.forEach(((r,o)=>{o==e.length-1&&(n[r]=t),n[r]=n[r]||{},n=n[r]}))}async resolveConst(e,t=[]){for(let n=0;n<e.length;n+=1){const r=e[n],o=r.accounts;o&&await this.resolveConst(o,[...t,l()(r.name)]);const i=r,s=l()(r.name);if(i.isSigner&&!this.get([...t,s])){if(void 0===this._provider.wallet)throw new Error("This function requires the Provider interface implementor to have a 'wallet' field.");this.set([...t,s],this._provider.wallet.publicKey)}Reflect.has(Vi.CONST_ACCOUNTS,s)&&!this.get([...t,s])&&this.set([...t,s],Vi.CONST_ACCOUNTS[s])}}_resolveEventCpi(e,t=[]){for(const n in e){const r=e[n],i=r.accounts;i&&this._resolveEventCpi(i,[...t,l()(r.name)]);const s=+n+1;if(s===e.length)return;const a=l()(e[n].name),c=l()(e[s].name);if("eventAuthority"===a&&"program"===c){const e=[...t,a],n=[...t,c];return this.get(e)||this.set(e,o.PublicKey.findProgramAddressSync([Wn.from("__event_authority")],this._programId)[0]),void(this.get(n)||this.set(n,this._programId))}}}async resolvePdas(e,t=[]){let n=0;for(let r=0;r<e.length;r+=1){const o=e[r],i=o.accounts;i&&(n+=await this.resolvePdas(i,[...t,l()(o.name)]));const s=o,a=l()(o.name);s.pda&&s.pda.seeds.length>0&&!this.get([...t,a])&&Boolean(await this.autoPopulatePda(s,t))&&(n+=1)}return n}async resolveRelations(e,t=[]){let n=0;for(let r=0;r<e.length;r+=1){const o=e[r],i=o.accounts;i&&(n+=await this.resolveRelations(i,[...t,l()(o.name)]));const s=o.relations||[],a=l()(o.name),c=[...t,a],u=this.get(c);if(u){const e=s.filter((e=>!this.get([...t,l()(e)])));if(n+=e.length,e.length>0){const n=await this._accountStore.fetchAccount({publicKey:u});await Promise.all(e.map((async e=>{const r=l()(e);return this.set([...t,r],n[r]),n[r]})))}}}return n}async autoPopulatePda(e,t=[]){if(!e.pda||!e.pda.seeds)throw new Error("Mu
1st have seeds");const n=await Promise.all(e.pda.seeds.map((e=>this.toBuffer(e,t))));if(n.some((e=>void 0===e)))return;const r=await this.parseProgramId(e,t);if(!r)return;const[i]=await o.PublicKey.findProgramAddress(n,r);this.set([...t,l()(e.name)],i)}async parseProgramId(e,t=[]){var n;if(!(null===(n=e.pda)||void 0===n?void 0:n.programId))return this._programId;switch(e.pda.programId.kind){case"const":return new o.PublicKey(this.toBufferConst(e.pda.programId.value));case"arg":return this.argValue(e.pda.programId);case"account":return await this.accountValue(e.pda.programId,t);default:throw new Error(`Unexpected program seed kind: ${e.pda.programId.kind}`)}}async toBuffer(e,t=[]){switch(e.kind){case"const":return this.toBufferConst(e);case"arg":return await this.toBufferArg(e);case"account":return await this.toBufferAccount(e,t);default:throw new Error(`Unexpected seed kind: ${e.kind}`)}}getType(e,t=[]){if(t.length>0&&e.defined){const n=this._idlTypes.find((t=>t.name===e.defined));if(!n)throw new Error(`Cannot find type ${e.defined}`);const r=n.type.fields.find((e=>e.name===t[0]));return this.getType(r.type,t.slice(1))}return e}toBufferConst(e){return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),e.value)}async toBufferArg(e){const t=this.argValue(e);if(void 0!==t)return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),t)}argValue(e){const t=e.path.split("."),n=l()(t[0]),r=this._idlIx.args.findIndex((e=>e.name===n));if(-1===r)throw new Error(`Unable to find argument for seed: ${n}`);return t.slice(1).reduce(((e,t)=>(e||{})[t]),this._args[r])}async toBufferAccount(e,t=[]){const n=await this.accountValue(e,t);if(n)return this.toBufferValue(e.type,n)}async accountValue(e,t=[]){const n=e.path.split("."),r=n[0],o=this.get([...t,l()(r)]);if(null===o)throw new Error("fieldPubkey is null");if(1===n.length)return o;const i=await this._accountStore.fetchAccount({publicKey:o,name:e.account});return this.parseAccountValue(i,n.slice(1))}parseAccountValue(e,t){let n;for(;t.length>0;)n=e[l()(t[0])],t=t.slice(1);return n}toBufferValue(e,t){switch(e){case"u8":return Wn.from([t]);case"u16":let n=Wn.alloc(2);return n.writeUInt16LE(t),n;case"u32":let r=Wn.alloc(4);return r.writeUInt32LE(t),r;case"u64":let o=Wn.alloc(8);return o.writeBigUInt64LE(BigInt(t)),o;case"string":return Wn.from(Fn(t));case"publicKey":return t.toBuffer();default:if(e.array)return Wn.from(t);throw new Error(`Unexpected seed type: ${e}`)}}}Vi.CONST_ACCOUNTS={associatedTokenProgram:ii,rent:o.SYSVAR_RENT_PUBKEY,systemProgram:o.SystemProgram.programId,tokenProgram:oi,clock:o.SYSVAR_CLOCK_PUBKEY};class Li{constructor(e,t,n){this._provider=e,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=t}async ensureIdl(e){if(!this._idls[e.toBase58()]){const t=await Ki.fetchIdl(e,this._provider);if(t){const n=new Ki(t,e,this._provider);this._idls[e.toBase58()]=n.account}}return this._idls[e.toBase58()]}async fetchAccount({publicKey:e,name:t,programId:n=this._programId}){const r=e.toString();if(!this._cache.has(r))if("TokenAccount"===t){const t=await this._provider.connection.getAccountInfo(e);if(null===t)throw new Error(`invalid account info for ${r}`);const n=(o=t.data,Bi.decode(o));this._cache.set(r,n)}else if(t){const o=await this.ensureIdl(n);if(o){const n=o[l()(t)];if(n){const t=await n.fetch(e);this._cache.set(r,t)}}}else{const t=await this._provider.connection.getAccountInfo(e);if(null===t)throw new Error(`invalid account info for ${r}`);const n=t.data,o=await this.ensureIdl(t.owner);if(o){const e=Object.values(o)[0];if(!e)throw new Error("No accounts for this program");const t=e.coder.accounts.decodeAny(n);this._cache.set(r,t)}}var o;return this._cache.get(r)}}class Di{static build(e,t,n,r,o,i,s,a,c,u,l){return(...h)=>new Wi(h,r,o,i,s,a,e,t,n,c,u,l)}}function ji(e){return"object"==typeof e&&null!==e&&!("_bn"in e)}function Ui(e,t){const n={};for(const r in e){const o=e[r];if(null!==o)n[r]=ji(o)?Ui(o,!0):nr(o);else if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return n}class Wi{constructor(e,t,n,r,o,i,s,a,c,u,l,h){this._ixFn=t,this._txFn=n,this._rpcFn=r,this._simulateFn=o,this._viewFn=i,this._programId=a,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=e,this._accountsResolver=new Vi(e,this._accounts,s,a,c,u,l,h)}args(e){this._args=e,this._accountsResolver.args(e)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(e){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e){return this._preInstructions=this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async rpc(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async simulate(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class zi{static build(e,t,n,r){const o=t.accounts.find((e=>e.isMut)),i=!!t.returns;if(!o&&i)return async(...o)=>{var i,s;let a=await n(...o);const c=`Program return: ${e} `;let u=a.raw.find((e=>e.startsWith(c)));if(!u)throw new Error("View expected return log");let l=Zn(u.slice(c.length)),h=t.returns;if(!h)throw new Error("View expected return type");return no.fieldLayout({type:h},Array.from([...null!==(i=r.accounts)&&void 0!==i?i:[],...null!==(s=r.types)&&void 0!==s?s:[]])).decode(l)}}}class Gi{static build(e,t,n,r,o){const i={},s={},a={},c={},u={},h={},d=Xn(e),f=e.accounts?bi.build(e,t,n,r):{};return e.instructions.forEach((p=>{const g=mi.build(p,((e,n)=>t.instruction.encode(e,n)),n),y=wi.build(p,g),m=vi.build(p,y,d,r),w=Mi.build(p,y,d,r,t,n,e),v=zi.build(n,p,w,e),b=Di.build(r,n,p,g,y,m,w,v,f,e.types||[],o&&o(p)),A=l()(p.name);s[A]=g,a[A]=y,i[A]=m,c[A]=w,u[A]=b,v&&(h[A]=v)})),[i,s,a,f,c,u,h]}}class Ki{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,t,n,r,o){t=nr(t),n||(n=Lr()),this._idl=e,this._provider=n,this._programId=t,this._coder=null!=r?r:new yo(e),this._events=new Si(this._programId,n,this._coder);const[i,s,a,c,u,l,h]=Gi.build(e,this._coder,t,n,null!=o?o:()=>{});this.rpc=i,this.instruction=s,this.transaction=a,this.account=c,this.simulate=u,this.methods=l,this.views=h}static async at(e,t){const n=nr(e),r=await Ki.fetchIdl(n,t);if(!r)throw new Error(`IDL not found for program: ${e.toString()}`);return new Ki(r,n,t)}static async fetchIdl(e,t){t=null!=t?t:Lr();const n=nr(e),r=await async function(e){const t=(await o.PublicKey.findProgramAddress([],e))[0];return await o.PublicKey.createWithSeed(t,"anchor:idl",e)}(n),i=await t.connection.getAccountInfo(r);if(!i)return null;let s=(a=i.data.slice(8),gi.decode(a));var a;const c=Dn(s.data);return JSON.parse(Kn(c))}addEventListener(e,t){return this._events.addEventListener(e,t)}async removeEventListener(e){return await this._events.removeEventListener(e)}}const Fi=new o.PublicKey("11111111111111111111111111111111");const qi={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class Hi{static system(e){return function(e){return new Ki(qi,Fi,e,new ei(qi))}(e)}}},4442:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esMo
1dule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BorshAccountsCoder=void 0;const o=r(n(6712)),i=n(8287),s=r(n(864)),a=n(567),c=n(9446),u=n(8476);class l{constructor(e){if(void 0===e.accounts)return void(this.accountLayouts=new Map);const t=e.accounts.map((t=>[t.name,a.IdlCoder.typeDefLayout(t,e.types)]));this.accountLayouts=new Map(t),this.idl=e}async encode(e,t){const n=i.Buffer.alloc(1e3),r=this.accountLayouts.get(e);if(!r)throw new Error(`Unknown account: ${e}`);const o=r.encode(t,n);let s=n.slice(0,o),a=l.accountDiscriminator(e);return i.Buffer.concat([a,s])}decode(e,t){if(l.accountDiscriminator(e).compare(t.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,t)}decodeAny(e){const t=e.slice(0,8),n=Array.from(this.accountLayouts.keys()).find((e=>l.accountDiscriminator(e).equals(t)));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,e)}decodeUnchecked(e,t){const n=t.subarray(u.DISCRIMINATOR_SIZE),r=this.accountLayouts.get(e);if(!r)throw new Error(`Unknown account: ${e}`);return r.decode(n)}memcmp(e,t){const n=l.accountDiscriminator(e);return{offset:0,bytes:o.default.encode(t?i.Buffer.concat([n,t]):n)}}size(e){var t;return u.DISCRIMINATOR_SIZE+(null!==(t=(0,c.accountSize)(this.idl,e))&&void 0!==t?t:0)}static accountDiscriminator(e){const t=`account:${(0,s.default)(e,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return(0,u.discriminator)(t)}}t.BorshAccountsCoder=l},8476:(e,t,n)=>{"use strict";var r=n(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.discriminator=t.DISCRIMINATOR_SIZE=void 0;const o=n(2623);t.DISCRIMINATOR_SIZE=8,t.discriminator=function(e){return r.from((0,o.sha256)(e).slice(0,t.DISCRIMINATOR_SIZE))}},567:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.IdlCoder=void 0;const a=s(n(864)),c=i(n(8519)),u=n(8903);class l{static fieldLayout(e,t){const n=void 0!==e.name?(0,a.default)(e.name):void 0;switch(e.type){case"bool":return c.bool(n);case"u8":return c.u8(n);case"i8":return c.i8(n);case"u16":return c.u16(n);case"i16":return c.i16(n);case"u32":return c.u32(n);case"i32":return c.i32(n);case"f32":return c.f32(n);case"u64":return c.u64(n);case"i64":return c.i64(n);case"f64":return c.f64(n);case"u128":return c.u128(n);case"i128":return c.i128(n);case"u256":return c.u256(n);case"i256":return c.i256(n);case"bytes":return c.vecU8(n);case"string":return c.str(n);case"publicKey":return c.publicKey(n);default:if("vec"in e.type)return c.vec(l.fieldLayout({name:void 0,type:e.type.vec},t),n);if("option"in e.type)return c.option(l.fieldLayout({name:void 0,type:e.type.option},t),n);if("defined"in e.type){if(!t)throw new u.IdlError("User defined types not provided");const r=e.type.defined,o=t.filter((e=>e.name===r));if(1!==o.length)throw new u.IdlError(`Type not found: ${JSON.stringify(e)}`);return l.typeDefLayout(o[0],t,n)}if("array"in e.type){let r=e.type.array[0],o=e.type.array[1],i=l.fieldLayout({name:void 0,type:r},t);return c.array(i,o,n)}throw new Error(`Not yet implemented: ${e}`)}}static typeDefLayout(e,t=[],n){switch(e.type.kind){case"struct":{const r=e.type.fields.map((e=>l.fieldLayout(e,t)));return c.struct(r,n)}case"enum":{let r=e.type.variants.map((e=>{const n=(0,a.default)(e.name);if(!e.fields)return c.struct([],n);const r=e.fields.map(((e,n)=>(null==e?void 0:e.name)?l.fieldLayout(e,t):l.fieldLayout({type:e,name:n.toString()},t)));return c.struct(r,n)}));return void 0!==n?c.rustEnum(r).replicate(n):c.rustEnum(r,n)}case"alias":return l.fieldLayout({type:e.type.value,name:e.name},t)}}}t.IdlCoder=l},9446:(e,t,n)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.accountSize=void 0;const r=n(8903);function o(e,t){switch(t.type.kind){case"struct":return t.type.fields.map((t=>i(e,t.type))).reduce(((e,t)=>e+t),0);case"enum":{const n=t.type.variants.map((t=>t.fields?t.fields.map((t=>i(e,"object"==typeof t&&"name"in t?t.type:t))).reduce(((e,t)=>e+t),0):0));return Math.max(...n)+1}case"alias":return i(e,t.type.value)}}function i(e,t){var n,s;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+i(e,t.option);if("coption"in t)return 4+i(e,t.coption);if("defined"in t){const i=null!==(s=null===(n=e.types)||void 0===n?void 0:n.filter((e=>e.name===t.defined)))&&void 0!==s?s:[];if(1!==i.length)throw new r.IdlError(`Type not found: ${JSON.stringify(t)}`);return o(e,i[0])}if("array"in t){let n=t.array[0],r=t.array[1];return i(e,n)*r}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}t.accountSize=o},8903:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.LangErrorMessage=t.LangErrorCode=t.translateError=t.ProgramError=t.AnchorError=t.ProgramErrorStack=t.IdlError=void 0;const s=n(2643),a=i(n(9872));class c extends Error{constructor(e){super(e),this.name="IdlError"}}t.IdlError=c;class u{constructor(e){this.stack=e}static parse(e){var t;const n=/^Program (\w*) invoke/,r=/^Program \w* success/,o=[];for(let i=0;i<e.length;i++){if(r.exec(e[i])){o.pop();continue}const a=null===(t=n.exec(e[i]))||void 0===t?void 0:t[1];a&&o.push(new s.PublicKey(a))}return new u(o)}}t.ProgramErrorStack=u;class l extends Error{constructor(e,t,n,r,o,i){super(n.join("\n").replace("Program log: ","")),this.errorLogs=n,this.logs=r,this.error={errorCode:e,errorMessage:t,comparedValues:i,origin:o},this._programErrorStack=u.parse(r)}static parse(e){if(!e)return null;const t=e.findIndex((e=>e.startsWith("Program log: AnchorError")));if(-1===t)return null;const n=e[t],r=[n];let o;if(t+1<e.length)if("Program log: Left:"===e[t+1]){const n=/^Program log: (.*)$/,i=n.exec(e[t+2])[1],a=n.exec(e[t+4])[1];o=[new s.PublicKey(i),new s.PublicKey(a)],r.push(...e.slice(t+1,t+5))}else if(e[t+1].startsWith("Program log: Left:")){const n=/^Program log: (Left|Right): (.*)$/,i=n.exec(e[t+1])[2],s=n.exec(e[t+2])[2];r.push(...e.slice(t+1,t+3)),o=[i,s]}const i=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),a=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),c=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(i){const[t,n,s]=i.slice(1,4),a={code:t,number:parseInt(n)};return new l(a,s,r,e,void 0,o)}if(a){const[t,n,i,s,c]=a.slice(1,6),u={code:i,number:parseInt(s)},h={file:t,line:parseInt(n)};return new l(u,c,r,e,h,o)}if(c){const[t,n,i,s]=c.slice(1,5),a=t,u={code:n,number:parseInt(i)};return new l(u,s,r,e,a,o)}return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}t.AnchorError=l;
1class h extends Error{constructor(e,t,n){super(),this.code=e,this.msg=t,this.logs=n,n&&(this._programErrorStack=u.parse(n))}static parse(e,n){const r=e.toString();let o,i;if(r.includes("custom program error:")){let e=r.split("custom program error: ");if(2!==e.length)return null;o=e[1]}else{const e=r.match(/"Custom":([0-9]+)}/g);if(!e||e.length>1)return null;o=e[0].match(/([0-9]+)/g)[0]}try{i=parseInt(o)}catch(e){return null}let s=n.get(i);return void 0!==s?new h(i,s,e.logs):(s=t.LangErrorMessage.get(i),void 0!==s?new h(i,s,e.logs):null)}get program(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return null===(e=this._programErrorStack)||void 0===e?void 0:e.stack}toString(){return this.msg}}t.ProgramError=h,t.translateError=function(e,t){a.isSet("debug-logs")&&console.log("Translating error:",e);const n=l.parse(e.logs);if(n)return n;const r=h.parse(e,t);if(r)return r;if(e.logs){const t={get:function(t,n){return"programErrorStack"===n?t.programErrorStack.stack:"program"===n?t.programErrorStack.stack[e.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return e.programErrorStack=u.parse(e.logs),new Proxy(e,t)}return e},t.LangErrorCode={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},t.LangErrorMessage=new Map([[t.LangErrorCode.InstructionMissing,"8 byte instruction identifier not provided"],[t.LangErrorCode.InstructionFallbackNotFound,"Fallback functions are not supported"],[t.LangErrorCode.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[t.LangErrorCode.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[t.LangErrorCode.IdlInstructionStub,"The program was compiled without idl instructions"],[t.LangErrorCode.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[t.LangErrorCode.ConstraintMut,"A mut constraint was violated"],[t.LangErrorCode.ConstraintHasOne,"A has one constraint was violated"],[t.LangErrorCode.ConstraintSigner,"A signer constraint was violated"],[t.LangErrorCode.ConstraintRaw,"A raw constraint was violated"],[t.LangErrorCode.ConstraintOwner,"An owner constraint was violated"],[t.LangErrorCode.ConstraintRentExempt,"A rent exemption constraint was violated"],[t.LangErrorCode.ConstraintSeeds,"A seeds constraint was violated"],[t.LangErrorCode.ConstraintExecutable,"An executable constraint was violated"],[t.LangErrorCode.ConstraintState,"Deprecated Error, feel free to replace with something else"],[t.LangErrorCode.ConstraintAssociated,"An associated constraint was violated"],[t.LangErrorCode.ConstraintAssociatedInit,"An associated init constraint was violated"],[t.LangErrorCode.ConstraintClose,"A close constraint was violated"],[t.LangErrorCode.ConstraintAddress,"An address constraint was violated"],[t.LangErrorCode.ConstraintZero,"Expected zero account discriminant"],[t.LangErrorCode.ConstraintTokenMint,"A token mint constraint was violated"],[t.LangErrorCode.ConstraintTokenOwner,"A token owner constraint was violated"],[t.LangErrorCode.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[t.LangErrorCode.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[t.LangErrorCode.ConstraintMintDecimals,"A mint decimals constraint was violated"],[t.LangErrorCode.ConstraintSpace,"A space constraint was violated"],[t.LangErrorCode.ConstraintAccountIsNone,"A required account for the constraint is None"],[t.LangErrorCode.RequireViolated,"A require expression was violated"],[t.LangErrorCode.RequireEqViolated,"A require_eq expression was violated"],[t.LangErrorCode.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[t.LangErrorCode.RequireNeqViolated,"A require_neq expression was violated"],[t.LangErrorCode.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[t.LangErrorCode.RequireGtViolated,"A require_gt expression was violated"],[t.LangErrorCode.RequireGteViolated,"A require_gte expression was violated"],[t.LangErrorCode.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[t.LangErrorCode.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[t.LangErrorCode.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[t.LangErrorCode.AccountDidNotDeserialize,"Failed to deserialize the account"],[t.LangErrorCode.AccountDidNotSerialize,"Failed to serialize the account"],[t.LangErrorCode.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[t.LangErrorCode.AccountNotMutable,"The given account is not mutable"],[t.LangErrorCode.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[t.LangErrorCode.InvalidProgramId,"Program ID was not as expected"],[t.LangErrorCode.InvalidProgramExecutable,"Program account is not executable"],[t.LangErrorCode.AccountNotSigner,"The given account did not sign"],[t.LangErrorCode.AccountNotSystemOwned,"The given account is not owned by the system program"],[t.LangErrorCode.AccountNotInitialized,"The program expected this account to be already initialized"],[t.LangErrorCode.AccountNotProgramData,"The given account is not a program data account"],[t.LangErrorCode.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[t.LangErrorCode.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[t.LangErrorCode.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[t.LangErrorCode.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[t.LangErrorCode.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[t.LangErrorCode.Deprecated,"The API being used is deprecated and should no longer be used"]])},9872:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSet=t.set=void 0;const n=new Set(["anchor-deprecated-state","debug-logs"]),r=new Map;t.set=function(e){if(!n.has(e))throw new Error("Invalid feature");r.set(e,!0)},t.isSet=function(e){return void 0!==r.get(e)}},8519:function(e,t,n){"use strict";var r=n(8287).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i256=t.u256=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;const i=n(2828),s=n(2643),a=o(n(9404));var c=n(2828);Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return c.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return c.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return c.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return c.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return c.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return c.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return c.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return c.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return c.struct}});class u extends i.Layout{constructor(e,t,n){super(e,n),this.blob=(0,i.blob)(e),this.signed=t}decode(e,t=0){const n=new a.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(e,t,n=0){return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(r,"le",this.span),t,n)}}function l(e){return new u(8,!1,e)}t.u64=l,t.i64=function(e){return new u(8,!0,e)},t.u128=function(e){return new u(16,!1,e)},t.i128=function(e){return new u(16,!0,e)},t.u256=function(e){return new u(32,!1,e)},t.i256=function(e){return new u(32,!0,e)};class h extends i.Layout{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}t.publicKey=function(e){return new h((0,i.blob)(32),(e=>new s.PublicKey(e)),(e=>e.toBuffer()),e)};class d extends i.Layout{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=(0,i.u8)()}encode(e,t,n=0){return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}getSpan(e,t=0){const n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}function f(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function p(e){return e?1:0}function g(e){const t=(0,i.u32)("length"),n=(0,i.struct)([t,(0,i.blob)((0,i.offset)(t,-t.span),"data")]);return new h(n,(({data:e})=>e),(e=>({data:e})),e)}t.option=function(e,t){return new d(e,t)},t.bool=function(e){return new h((0,i.u8)(),f,p,e)},t.vec=function(e,t){const n=(0,i.u32)("length"),r=(0,i.struct)([n,(0,i.seq)(e,(0,i.offset)(n,-n.span),"values")]);return new h(r,(({values:e})=>e),(e=>({values:e})),t)},t.tagged=function(e,t,n){const r=(0,i.struct)([l("tag"),t.replicate("data")]);return new h(r,(function({tag:t,data:n}){if(!t.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+t.toString("hex"));return n}),(t=>({tag:e,data:t})),n)},t.vecU8=g,t.str=function(e){return new h(g(),(e=>e.toString("utf-8")),(e=>r.from(e,"utf-8")),e)},t.rustEnum=function(e,t,n){const r=(0,i.union)(null!=n?n:(0,i.u8)(),t);return e.forEach(((e,t)=>r.addVariant(t,e,e.property))),r},t.array=function(e,t,n){const r=(0,i.struct)([(0,i.seq)(e,t,"values")]);return new h(r,(({values:e})=>e),(e=>({values:e})),n)};class y extends i.Layout{constructor(e,t,n){super(e.span+t.span,n),this.keyLayout=e,this.valueLayout=t}decode(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}encode(e,t,n){n=n||0;const r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}getSpan(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}t.map=function(e,t,n){const r=(0,i.u32)("length"),o=(0,i.struct)([r,(0,i.seq)(new y(e,t),(0,i.offset)(r,-r.span),"values")]);return new h(o,(({values:e})=>new Map(e)),(e=>({values:Array.from(e.entries())})),n)}}
1,3:(e,t,n)=>{"use strict";var r=n(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==t[s])throw new TypeError(i+" is ambiguous");t[s]=o}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return r.alloc(0);for(var n=0,o=0,i=0;e[n]===c;)o++,n++;for(var s=(e.length-n)*u+1>>>0,l=new Uint8Array(s);n<e.length;){var h=e.charCodeAt(n);if(h>255)return;var d=t[h];if(255===d)return;for(var f=0,p=s-1;(0!==d||f<i)&&-1!==p;p--,f++)d+=a*l[p]>>>0,l[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=f,n++}for(var g=s-i;g!==s&&0===l[g];)g++;var y=r.allocUnsafe(o+(s-g));y.fill(0,0,o);for(var m=o;g!==s;)y[m++]=l[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=r.from(t)),!r.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,o=0,i=0,s=t.length;i!==s&&0===t[i];)i++,n++;for(var u=(s-i)*l+1>>>0,h=new Uint8Array(u);i!==s;){for(var d=t[i],f=0,p=u-1;(0!==d||f<o)&&-1!==p;p--,f++)d+=256*h[p]>>>0,h[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");o=f,i++}for(var g=u-o;g!==u&&0===h[g];)g++;for(var y=c.repeat(n);g<u;++g)y+=e.charAt(h[g]);return y},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},6712:(e,t,n)=>{var r=n(3);e.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},864:e=>{"use strict";const t=/[\p{Lu}]/u,n=/[\p{Ll}]/u,r=/^[\p{Lu}](?![\p{Lu}])/gu,o=/([\p{Alpha}\p{N}_]|$)/u,i=/[_.\- ]+/,s=new RegExp("^"+i.source),a=new RegExp(i.source+o.source,"gu"),c=new RegExp("\\d+"+o.source,"gu"),u=(e,o)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(o={pascalCase:!1,preserveConsecutiveUppercase:!1,...o},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const i=!1===o.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(o.locale),u=!1===o.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(o.locale);return 1===e.length?o.pascalCase?u(e):i(e):(e!==i(e)&&(e=((e,r,o)=>{let i=!1,s=!1,a=!1;for(let c=0;c<e.length;c++){const u=e[c];i&&t.test(u)?(e=e.slice(0,c)+"-"+e.slice(c),i=!1,a=s,s=!0,c++):s&&a&&n.test(u)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),a=s,s=!1,i=!0):(i=r(u)===u&&o(u)!==u,a=s,s=o(u)===u&&r(u)!==u)}return e})(e,i,u)),e=e.replace(s,""),e=o.preserveConsecutiveUppercase?((e,t)=>(r.lastIndex=0,e.replace(r,(e=>t(e)))))(e,i):i(e),o.pascalCase&&(e=u(e.charAt(0))+e.slice(1)),((e,t)=>(a.lastIndex=0,c.lastIndex=0,e.replace(a,((e,n)=>t(n))).replace(c,(e=>t(e)))))(e,u))};e.exports=u,e.exports.default=u},251:(e,t)=>{t.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?o-1:0,d=n?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-l)-1,f>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=d,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),i-=u}return(f?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,h=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+f]=255&a,f+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}},22:(e,t,n)=>{"use strict";const r=n(4253).v4,o=n(3289),i=function(e,t){if(!(this instanceof i))return new i(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return r()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=i,i.prototype.request=function(e,t,n,r){const i=this;let s=null;const a=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&e&&"object"==typeof e&&"function"==typeof t)r=t,s=e;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{s=o(e,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(i)return r(e);throw e}if(!i)return s}let c;try{c=JSON.stringify(s,this.options.replacer)}catch(e){return r(e)}return this.callServer(c,(function(e,t){i._parseResponse(e,t,r)})),s},i.prototype._parseResponse=function(e,t,n){if(e)return void n(e);if(!t)return n();let r;try{r=JSON.parse(t,this.options.reviver)}catch(e){return n(e)}if(3===n.length){if(Array.isArray(r)){const e=function(e){return void 0!==e.error},t=function(t){return!e(t)};return n(null,r.filter(e),r.filter(t))}return n(null,r.error,r.result)}n(null,r)}}
1,3289:(e,t,n)=>{"use strict";const r=n(4253).v4;e.exports=function(e,t,n,o){if("string"!=typeof e)throw new TypeError(e+" must be a string");const i="number"==typeof(o=o||{}).version?o.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const s={method:e};if(2===i&&(s.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");s.params=t}if(void 0===n){const e="function"==typeof o.generator?o.generator:function(){return r()};s.id=e(s,o)}else 2===i&&null===n?o.notificationIdNull&&(s.id=null):s.id=n;return s}},4253:(e,t,n)=>{"use strict";var r;n.d(t,{v4:()=>l});var o=new Uint8Array(16);function i(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=[],c=0;c<256;++c)a.push((c+256).toString(16).substr(1));const u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&s.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},l=function(e,t,n){var r=(e=e||{}).random||(e.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return u(r)}},5606:e=>{var t,n,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!u){var e=s(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||u||s(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},7583:(e,t,n)=>{const r=n(1333),o=n(157),i=n(7899),s=n(6756);function a(e,t,n,i,s){const a=[].slice.call(arguments,1),c=a.length,u="function"==typeof a[c-1];if(!u&&!r())throw new Error("Callback required as last argument");if(!u){if(c<1)throw new Error("Too few arguments provided");return 1===c?(n=t,t=i=void 0):2!==c||t.getContext||(i=n,n=t,t=void 0),new Promise((function(r,s){try{const s=o.create(n,i);
vendor: 4,462 bytes, line 1
1r(e(s,t,i))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=n,n=t,t=i=void 0):3===c&&(t.getContext&&void 0===s?(s=i,i=void 0):(s=i,i=n,n=t,t=void 0));try{const r=o.create(n,i);s(null,e(r,t,i))}catch(e){s(e)}}t.create=o.create,t.toCanvas=a.bind(null,i.render),t.toDataURL=a.bind(null,i.renderToDataURL),t.toString=a.bind(null,(function(e,t,n){return s.render(e,n)}))},1333:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},6421:(e,t,n)=>{const r=n(6886).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,n=r(e),o=145===n?26:2*Math.ceil((n-13)/(2*t-2)),i=[n-7];for(let e=1;e<t-1;e++)i[e]=i[e-1]-o;return i.push(6),i.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),o=r.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||n.push([r[e],r[t]]);return n}},1433:(e,t,n)=>{const r=n(208),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*o.indexOf(this.data[t]);n+=o.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(o.indexOf(this.data[t]),6)},e.exports=i},9899:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},8820:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,n,r){const o=e*this.size+t;this.data[o]=n,r&&(this.reservedBit[o]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},5822:(e,t,n)=>{const r=n(208);function o(e){this.mode=r.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},e.exports=o},7518:(e,t,n)=>{const r=n(9953),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case r.L:return o[4*(e-1)+0];case r.M:return o[4*(e-1)+1];case r.Q:return o[4*(e-1)+2];case r.H:return o[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case r.L:return i[4*(e-1)+0];case r.M:return i[4*(e-1)+1];case r.Q:return i[4*(e-1)+2];case r.H:return i[4*(e-1)+3];default:return}}},9953:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3}
vendor: 7,393 bytes, line 1
1,t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return n}}},7756:(e,t,n)=>{const r=n(6886).getSymbolSize;t.getPositions=function(e){const t=r(e);return[[0,0],[t-7,0],[0,t-7]]}},4565:(e,t,n)=>{const r=n(6886),o=r.getBCHDigit(1335);t.getEncodedBits=function(e,t){const n=e.bit<<3|t;let i=n<<10;for(;r.getBCHDigit(i)-o>=0;)i^=1335<<r.getBCHDigit(i)-o;return 21522^(n<<10|i)}},2731:(e,t)=>{const n=new Uint8Array(512),r=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)n[t]=e,r[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return r[e]},t.exp=function(e){return n[e]},t.mul=function(e,t){return 0===e||0===t?0:n[r[e]+r[t]]}},4861:(e,t,n)=>{const r=n(208),o=n(6886);function i(e){this.mode=r.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=o.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},e.exports=i},1332:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let n=0,r=0,o=0,i=null,s=null;for(let a=0;a<t;a++){r=o=0,i=s=null;for(let c=0;c<t;c++){let t=e.get(a,c);t===i?r++:(r>=5&&(n+=r-5+3),i=t,r=1),t=e.get(c,a),t===s?o++:(o>=5&&(n+=o-5+3),s=t,o=1)}r>=5&&(n+=r-5+3),o>=5&&(n+=o-5+3)}return n},t.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let o=0;o<t-1;o++){const t=e.get(r,o)+e.get(r,o+1)+e.get(r+1,o)+e.get(r+1,o+1);4!==t&&0!==t||n++}return 3*n},t.getPenaltyN3=function(e){const t=e.size;let n=0,r=0,o=0;for(let i=0;i<t;i++){r=o=0;for(let s=0;s<t;s++)r=r<<1&2047|e.get(i,s),s>=10&&(1488===r||93===r)&&n++,o=o<<1&2047|e.get(s,i),s>=10&&(1488===o||93===o)&&n++}return 40*n},t.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},t.applyMask=function(e,t){const r=t.size;for(let o=0;o<r;o++)for(let i=0;i<r;i++)t.isReserved(i,o)||t.xor(i,o,n(e,i,o))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let s=0;s<r;s++){n(s),t.applyMask(s,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<i&&(i=r,o=s)}return o}},208:(e,t,n)=>{const r=n(1878),o=n(7044);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!r.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return o.testNumeric(e)?t.NUMERIC:o.testAlphanumeric(e)?t.ALPHANUMERIC:o.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},4357:(e,t,n)=>{const r=n(208);function o(e){this.mode=r.NUMERIC,this.data=e.toString()}o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const o=this.data.length-t;o>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*o+1))},e.exports=o},4713:(e,t,n)=>{const r=n(2731);t.mul=function(e,t){const n=new Uint8Array(e.length+t.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<t.length;i++)n[o+i]^=r.mul(e[o],t[i]);return n},t.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){const e=n[0];for(let o=0;o<t.length;o++)n[o]^=r.mul(t[o],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=t.mul(n,new Uint8Array([1,r.exp(o)]));return n}},157:(e,t,n)=>{const r=n(6886),o=n(9953),i=n(9899),s=n(8820),a=n(6421),c=n(7756),u=n(1332),l=n(7518),h=n(4764),d=n(1427),f=n(4565),p=n(208),g=n(9801);function y(e,t,n){const r=e.size,o=f.getEncodedBits(t,n);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(r-15+i,8,s,!0),i<8?e.set(8,r-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(r-8,8,1,!0)}function m(e,t,n,o){let f;if(Array.isArray(e))f=g.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let r=t;if(!r){const t=g.rawSplit(e);r=d.getBestVersionForData(t,n)}f=g.fromString(e,r||40)}}const m=d.getBestVersionForData(f,n);if(!m)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<m)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+m+".\n")}else t=m;const w=function(e,t,n){const o=new i;n.forEach((function(t){o.put(t.mode.bit,4),o.put(t.getLength(),p.getCharCountIndicator(t.mode,e)),t.write(o)}));const s=8*(r.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,t));for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);const a=(s-o.getLengthInBits())/8;for(let e=0;e<a;e++)o.put(e%2?17:236,8);return function(e,t,n){const o=r.getSymbolTotalCodewords(t),i=o-l.getTotalCodewordsCount(t,n),s=l.getBlocksCount(t,n),a=s-o%s,c=Math.floor(o/s),u=Math.floor(i/s),d=u+1,f=c-u,p=new h(f);let g=0;const y=new Array(s),m=new Array(s);let w=0;const v=new Uint8Array(e.buffer);for(let e=0;e<s;e++){const t=e<a?u:d;y[e]=v.slice(g,g+t),m[e]=p.encode(y[e]),g+=t,w=Math.max(w,t)}const b=new Uint8Array(o);let A,k,_=0;for(A=0;A<w;A++)for(k=0;k<s;
vendor: 10,619 bytes, line 1
1k++)A<y[k].length&&(b[_++]=y[k][A]);for(A=0;A<f;A++)for(k=0;k<s;k++)b[_++]=m[k][A];return b}(o,e,t)}(t,n,f),v=r.getSymbolSize(t),b=new s(v);return function(e,t){const n=e.size,r=c.getPositions(t);for(let t=0;t<r.length;t++){const o=r[t][0],i=r[t][1];for(let t=-1;t<=7;t++)if(!(o+t<=-1||n<=o+t))for(let r=-1;r<=7;r++)i+r<=-1||n<=i+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(o+t,i+r,!0,!0):e.set(o+t,i+r,!1,!0))}}(b,t),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(b),function(e,t){const n=a.getPositions(t);for(let t=0;t<n.length;t++){const r=n[t][0],o=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)-2===t||2===t||-2===n||2===n||0===t&&0===n?e.set(r+t,o+n,!0,!0):e.set(r+t,o+n,!1,!0)}}(b,t),y(b,n,0),t>=7&&function(e,t){const n=e.size,r=d.getEncodedBits(t);let o,i,s;for(let t=0;t<18;t++)o=Math.floor(t/3),i=t%3+n-8-3,s=1==(r>>t&1),e.set(o,i,s,!0),e.set(i,o,s,!0)}(b,t),function(e,t){const n=e.size;let r=-1,o=n-1,i=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(o,a-n)){let r=!1;s<t.length&&(r=1==(t[s]>>>i&1)),e.set(o,a-n,r),i--,-1===i&&(s++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}(b,w),isNaN(o)&&(o=u.getBestMask(b,y.bind(null,b,n))),u.applyMask(o,b),y(b,n,o),{modules:b,version:t,errorCorrectionLevel:n,maskPattern:o,segments:f}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let n,i,s=o.M;return void 0!==t&&(s=o.from(t.errorCorrectionLevel,o.M),n=d.from(t.version),i=u.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),m(e,n,s,i)}},4764:(e,t,n)=>{const r=n(4713);function o(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}o.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),o=this.degree-n.length;if(o>0){const e=new Uint8Array(this.degree);return e.set(n,o),e}return n},e.exports=o},7044:(e,t)=>{const n="[0-9]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+")(?:.|[\r\n]))+";t.KANJI=new RegExp(r,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(o,"g"),t.NUMERIC=new RegExp(n,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+r+"$"),s=new RegExp("^"+n+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return a.test(e)}},9801:(e,t,n)=>{const r=n(208),o=n(4357),i=n(1433),s=n(5822),a=n(4861),c=n(7044),u=n(6886),l=n(6320);function h(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){const r=[];let o;for(;null!==(o=e.exec(n));)r.push({data:o[0],index:o.index,mode:t,length:o[0].length});return r}function f(e){const t=d(c.NUMERIC,r.NUMERIC,e),n=d(c.ALPHANUMERIC,r.ALPHANUMERIC,e);let o,i;return u.isKanjiModeEnabled()?(o=d(c.BYTE,r.BYTE,e),i=d(c.KANJI,r.KANJI,e)):(o=d(c.BYTE_KANJI,r.BYTE,e),i=[]),t.concat(n,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function p(e,t){switch(t){case r.NUMERIC:return o.getBitsLength(e);case r.ALPHANUMERIC:return i.getBitsLength(e);case r.KANJI:return a.getBitsLength(e);case r.BYTE:return s.getBitsLength(e)}}function g(e,t){let n;const c=r.getBestModeForData(e);if(n=r.from(t,c),n!==r.BYTE&&n.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+r.toString(n)+".\n Suggested mode is: "+r.toString(c));switch(n!==r.KANJI||u.isKanjiModeEnabled()||(n=r.BYTE),n){case r.NUMERIC:return new o(e);case r.ALPHANUMERIC:return new i(e);case r.KANJI:return new a(e);case r.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e}),[])},t.fromString=function(e,n){const o=function(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case r.NUMERIC:t.push([o,{data:o.data,mode:r.ALPHANUMERIC,length:o.length},{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.ALPHANUMERIC:t.push([o,{data:o.data,mode:r.BYTE,length:o.length}]);break;case r.KANJI:t.push([o,{data:o.data,mode:r.BYTE,length:h(o.data)}]);break;case r.BYTE:t.push([{data:o.data,mode:r.BYTE,length:h(o.data)}])}}return t}(f(e,u.isKanjiModeEnabled())),i=function(e,t){const n={},o={start:{}};let i=["start"];for(let s=0;s<e.length;s++){const a=e[s],c=[];for(let e=0;e<a.length;e++){const u=a[e],l=""+s+e;c.push(l),n[l]={node:u,lastCount:0},o[l]={};for(let e=0;e<i.length;e++){const s=i[e];n[s]&&n[s].node.mode===u.mode?(o[s][l]=p(n[s].lastCount+u.length,u.mode)-p(n[s].lastCount,u.mode),n[s].lastCount+=u.length):(n[s]&&(n[s].lastCount=u.length),o[s][l]=p(u.length,u.mode)+4+r.getCharCountIndicator(u.mode,t))}}i=c}for(let e=0;e<i.length;e++)o[i[e]].end=0;return{map:o,table:n}}(o,n),s=l.find_path(i.map,"start","end"),a=[];for(let e=1;e<s.length-1;e++)a.push(i.table[s[e]].node);return t.fromArray(a.reduce((function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(f(e,u.isKanjiModeEnabled()))}},6886:(e,t)=>{let n;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},1878:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},1427:(e,t,n)=>{const r=n(6886),o=n(7518),i=n(9953),s=n(208),a=n(1878),c=r.getBCHDigit(7973);function u(e,t){return s.getCharCountIndicator(e,t)+4}function l(e,t){let n=0;return e.forEach((function(e){const r=u(e.mode,t);n+=r+e.getBitsLength()})),n}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,n){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===n&&(n=s.BYTE);const i=8*(r.getSymbolTotalCodewords(e)-o.getTotalCodewordsCount(e,t));if(n===s.MIXED)return i;const c=i-u(n,e);switch(n){case s.NUMERIC:return Math.floor(c/10*3);case s.ALPHANUMERIC:return Math.floor(c/11*2);case s.KANJI:return Math.floor(c/13);case s.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,n){let r;const o=i.from(n,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(l(e,r)<=t.getCapacity(r,n,s.MIXED))return r}(e,o);if(0===e.length)return 1;r=e[0]}else r=e;return function(e,n,r){for(let o=1;o<=40;o++)if(n<=t.getCapacity(o,r,e))return o}(r.mode,r.getLength(),o)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-c>=0;)t^=7973<<r.getBCHDigit(t)-c;return e<<12|t}},7899:(e,t,n)=>{const r=n(2726);t.render=function(e,t,n){let o=n,i=t;void 0!==o||t&&t.getContext||(o=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),o=r.getOptions(o);const s=r.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return r.qrToImageData(c.data,e,o),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,i,s),a.putImageData(c,0,0),i},t.renderToDataURL=function(e,n,r){let o=r;void 0!==o||n&&n.getContext||(o=n,n=void 0),o||(o={});const i=t.render(e,n,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}},6756:(e,t,n)=>{const r=n(2726);function o(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function i(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}t.render=function(e,t,n){const s=r.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+2*s.margin,l=s.color.light.a?"<path "+o(s.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",h="<path "+o(s.color.dark,"stroke")+' d="'+function(e,t,n){let r="",o=0,s=!1,a=0;for(let c=0;c<e.length;c++){const u=Math.floor(c%t),l=Math.floor(c/t);u||s||(s=!0),e[c]?(a++,c>0&&u>0&&e[c-1]||(r+=s?i("M",u+n,.5+l+n):i("m",o,0),o=0,s=!1),u+1<t&&e[c+1]||(r+=i("h",a),a=0)):o++}return r}(c,a,s.margin)+'"/>',d='viewBox="0 0 '+u+" "+u+'"',f='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+d+' shape-rendering="crispEdges">'+l+h+"</svg>\n";return"function"==typeof n&&n(null,f),f}},2726:(e,t)=>{function n(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:r,scale:r?4:o,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const o=n.modules.size,i=n.modules.data,s=t.getScale(o,r),a=Math.floor((o+2*r.margin)*s),c=r.margin*s,u=[r.color.light,r.color.dark];for(let t=0;t<a;t++)for(let n=0;n<a;n++){let l=4*(t*a+n),h=r.color.light;t>=c&&n>=c&&t<a-c&&n<a-c&&(h=u[i[Math.floor((t-c)/s)*o+Math.floor((n-c)/s)]?1:0]),e[l++]=h.r,e[l++
vendor: 6,587 bytes, line 1
1]=h.g,e[l++]=h.b,e[l]=h.a}}},7789:(e,t,n)=>{"use strict";const r=n(7526),o=n(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|g(e,t);let r=a(n);const o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(o)return r?-1:q(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function b(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(Z(r))return s;e[n+s]=r}return s}function A(e,t,n,r){return Y(q(t,e.length-n),e,n,r)}function k(e,t,n,r){return Y(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return Y(H(t),e,n,r)}function S(e,t,n,r){return Y(function(e,t){let n,r,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],a=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;
vendor: 5,620 bytes, line 1
1)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if($(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if($(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<a;++e)if(u[e]!==l[e]){i=u[e],s=l[e];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return k(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function M(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Q[e[r]];return o}
vendor: 9,469 bytes, line 1
1function C(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function N(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,o){z(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function V(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,i){return t=+t,n>>>=0,i||V(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||K(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,s=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),s=i.length;
1if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%s]}return this};const j={};function U(e,t,n){j[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||K(t,e.length-(n+1))}(r,o,i)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function J(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},3678:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o<i;o++)s[o]=r[o].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,s){var a=n?n+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;
1if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,i),!0;case 6:return l.fn.call(l.context,t,r,o,i,s),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,r);break;case 4:l[u].fn.call(l[u].context,t,r,o);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||s(this,i);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||o&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},2861:(e,t,n)=>{var r=n(8287),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},4281:(e,t)=>{"use strict";function n(e,t,n){return t<=e&&e<=n}function r(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function o(e){this.tokens=[].slice.call(e)}o.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var i=-1;function s(e,t){if(e)throw TypeError("Decoder error");return t||65533}var a="utf-8";function c(e,t){if(!(this instanceof c))return new c(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw new Error("Encoding not supported. Only utf-8 is supported");t=r(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(t.fatal),this._ignoreBOM=Boolean(t.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function u(e,t){if(!(this instanceof u))return new u(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw new Error("Encoding not supported. Only utf-8 is supported");t=r(t),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(t.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,r=0,o=0,a=0,c=128,u=191;this.handler=function(e,l){if(-1===l&&0!==a)return a=0,s(t);if(-1===l)return i;if(0===a){if(n(l,0,127))return l;if(n(l,194,223))a=1,r=l-192;else if(n(l,224,239))224===l&&(c=160),237===l&&(u=159),a=2,r=l-224;else{if(!n(l,240,244))return s(t);240===l&&(c=144),244===l&&(u=143),a=3,r=l-240}return r<<=6*a,null}if(!n(l,c,u))return r=a=o=0,c=128,u=191,e.prepend(l),s(t);if(c=128,u=191,r+=l-128<<6*(a-(o+=1)),o!==a)return null;var h=r;return r=a=o=0,h}}function h(e){e.fatal,this.handler=function(e,t){if(-1===t)return i;if(n(t,0,127))return t;var r,o;n(t,128,2047)?(r=1,o=192):n(t,2048,65535)?(r=2,o=224):n(t,65536,1114111)&&(r=3,o=240);for(var s=[(t>>6*r)+o];r>0;){var a=t>>6*(r-1);s.push(128|63&a),r-=1}return s}}c.prototype={decode:function(e,t){var n;n="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=r(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var s,a=new o(n),c=[];!a.endOfStream()&&(s=this._decoder.handler(a,a.read()))!==i;)null!==s&&(Array.isArray(s)?c.push.apply(c,s):c.push(s));if(!this._streaming){do{if((s=this._decoder.handler(a,a.read()))===i)break;null!==s&&(Array.isArray(s)?c.push.apply(c,s):c.push(s))}while(!a.endOfStream());this._decoder=null}return c.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===c[0]?(this._BOMseen=!0,c.shift()):this._BOMseen=!0)),function(e){for(var t="",n=0;n<e.length;++n){var r=e[n];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(55296+(r>>10),56320+(1023&r)))}return t}(c)}},u.prototype={encode:function(e,t){e=e?String(e):"",t=r(t),this._streaming||(this._encoder=new h(this._options)),this._streaming=Boolean(t.stream);for(var n,s=[],a=new o(function(e){for(var t=String(e),n=t.length,r=0,o=[];r<n;){var i=t.charCodeAt(r);if(i<55296||i>57343)o.push(i);else if(56320<=i&&i<=57343)o.push(65533);else if(55296<=i&&i<=56319)if(r===n-1)o.push(65533);else{var s=e.charCodeAt(r+1);if(56320<=s&&s<=57343){var a=1023&i,c=1023&s;o.push(65536+(a<<10)+c),r+=1}else o.push(65533)}r+=1}return o}(e));!a.endOfStream()&&(n=this._encoder.handler(a,a.read()))!==i;)Array.isArray(n)?s.push.apply(s,n):s.push(n);if(!this._streaming){for(;(n=this._encoder.handler(a,a.read()))!==i;)Array.isArray(n)?s.push.apply(s,n):s.push(n);this._encoder=null}return new Uint8Array(s)}},t.TextEncoder=u,t.TextDecoder=c},7790:()=>{},5400:(e,t)=>{"use strict";
vendor: 10,265 bytes, line 1
1Object.defineProperty(t,"__esModule",{value:!0});class n extends TypeError{constructor(e,t){let n;const{message:r,...o}=e,{path:i}=e;super(0===i.length?r:"At path: "+i.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[e,...t()]}}}function r(e){return"object"==typeof e&&null!=e}function o(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function i(e){return"string"==typeof e?JSON.stringify(e):""+e}function s(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:s}=t,{type:a}=n,{refinement:c,message:u="Expected a value of type `"+a+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+i(r)+"`"}=e;return{value:r,type:a,refinement:c,key:o[o.length-1],path:o,branch:s,...e,message:u}}function*a(e,t,n,o){var i;r(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const r of e){const e=s(r,t,n,o);e&&(yield e)}}function*c(e,t,n){void 0===n&&(n={});const{path:o=[],branch:i=[e],coerce:s=!1,mask:a=!1}=n,u={path:o,branch:i};if(s&&(e=t.coercer(e,u),a&&"type"!==t.type&&r(t.schema)&&r(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let l=!0;for(const n of t.validator(e,u))l=!1,yield[n,void 0];for(let[n,h,d]of t.entries(e,u)){const t=c(h,d,{path:void 0===n?o:[...o,n],branch:void 0===n?i:[...i,h],coerce:s,mask:a});for(const o of t)o[0]?(l=!1,yield[o[0],void 0]):s&&(h=o[1],void 0===n?e=h:e instanceof Map?e.set(n,h):e instanceof Set?e.add(h):r(e)&&(e[n]=h))}if(l)for(const n of t.refiner(e,u))l=!1,yield[n,void 0];l&&(yield[void 0,e])}class u{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=i,this.validator=r?(e,t)=>a(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>a(o(e,t),t,this,e):()=>[]}assert(e){return l(e,this)}create(e){return h(e,this)}is(e){return f(e,this)}mask(e){return d(e,this)}validate(e,t){return void 0===t&&(t={}),p(e,this,t)}}function l(e,t){const n=p(e,t);if(n[0])throw n[0]}function h(e,t){const n=p(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function d(e,t){const n=p(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}function f(e,t){return!p(e,t)[0]}function p(e,t,r){void 0===r&&(r={});const o=c(e,t,r),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(o);return i[0]?[new n(i[0],(function*(){for(const e of o)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function g(e,t){return new u({type:e,schema:null,validator:t})}function y(){return g("never",(()=>!1))}function m(e){const t=e?Object.keys(e):[],n=y();return new u({type:"object",schema:e||null,*entries(o){if(e&&r(o)){const r=new Set(Object.keys(o));for(const n of t)r.delete(n),yield[n,o[n],e[n]];for(const e of r)yield[e,o[e],n]}},validator:e=>r(e)||"Expected an object, but received: "+i(e),coercer:e=>r(e)?{...e}:e})}function w(e){return new u({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function v(){return g("string",(e=>"string"==typeof e||"Expected a string, but received: "+i(e)))}function b(e){const t=Object.keys(e);return new u({type:"type",schema:e,*entries(n){if(r(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>r(e)||"Expected an object, but received: "+i(e)})}function A(){return g("unknown",(()=>!0))}function k(e,t,n){return new u({...e,coercer:(r,o)=>f(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function _(e){return e instanceof Map||e instanceof Set?e.size:e.length}function S(e,t,n){return new u({...e,*refiner(r,o){yield*e.refiner(r,o);const i=a(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}t.Struct=u,t.StructError=n,t.any=function(){return g("any",(()=>!0))},t.array=function(e){return new u({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+i(e)})},t.assert=l,t.assign=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r="type"===t[0].type,o=t.map((e=>e.schema)),i=Object.assign({},...o);return r?b(i):m(i)},t.bigint=function(){return g("bigint",(e=>"bigint"==typeof e))},t.boolean=function(){return g("boolean",(e=>"boolean"==typeof e))},t.coerce=k,t.create=h,t.date=function(){return g("date",(e=>e instanceof Date&&!isNaN(e.getTime())||"Expected a valid `Date` object, but received: "+i(e)))},t.defaulted=function(e,t,n){return void 0===n&&(n={}),k(e,A(),(e=>{const r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&o(e)&&o(r)){const t={...e};let n=!1;for(const e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e}))},t.define=g,t.deprecated=function(e,t){return new u({...e,refiner:(t,n)=>void 0===t||e.refiner(t,n),validator:(n,r)=>void 0===n||(t(n,r),e.validator(n,r))})},t.dynamic=function(e){return new u({type:"dynamic",schema:null,*entries(t,n){const r=e(t,n);yield*r.entries(t,n)},validator:(t,n)=>e(t,n).validator(t,n),coercer:(t,n)=>e(t,n).coercer(t,n),refiner:(t,n)=>e(t,n).refiner(t,n)})},t.empty=function(e){return S(e,"empty",(t=>{const n=_(t);return 0===n||"Expected an empty "+e.type+" but received one with a size of `"+n+"`"}))},t.enums=function(e){const t={},n=e.map((e=>i(e))).join();for(const n of e)t[n]=n;return new u({type:"enums",schema:t,validator:t=>e.includes(t)||"Expected one of `"+n+"`, but received: "+i(t)})},t.func=function(){return g("func",(e=>"function"==typeof e||"Expected a function, but received: "+i(e)))},t.instance=function(e){return g("instance",(t=>t instanceof e||"Expected a `"+e.name+"` instance, but received: "+i(t)))},t.integer=function(){return g("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+i(e)))},t.intersection=function(e){return new u({type:"intersection",schema:null,*entries(t,n){for(const r of e)yield*r.entries(t,n)},*validator(t,n){for(const r of e)yield*r.validator(t,n)},*refiner(t,n){for(const r of e)yield*r.refiner(t,n)}})},t.is=f,t.lazy=function(e){let t;return new u({type:"lazy",schema:null,*entries(n,r){null!=t||(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(null!=t||(t=e()),t.validator(n,r)),coercer:(n,r)=>(null!=t||(t=e()),t.coercer(n,r)),refiner:(n,r)=>(null!=t||(t=e()),t.refiner(n,r))})},t.literal=function(e){const t=i(e),n=typeof e;return new u({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||"Expected the literal `"+t+"`, but received: "+i(n)})},t.map=function(e,t){return new u({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(const[r,o]of n.entries())yield[r,r,e],yield[r,o,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||"Expected a `Map` object, but received: "+i(e)})},t.mask=d,t.max=function(e,t,n){void 0===n&&(n={});const{exclusive:r}=n;return S(e,"max",(n=>r?n<t:n<=t||"Expected a "+e.type+" less than "+(r?"":"or equal to ")+t+" but received `"+n+"`"))},t.min=function(e,t,n){void 0===n&&(n={});const{exclusive:r}=n;return S(e,"min",(n=>r?n>t:n>=t||"Expected a "+e.type+" greater than "+(r?"":"or equal to ")+t+" but received `"+n+"`"))},t.never=y,t.nonempty=function(e){return S(e,"nonempty",(t=>_(t)>0||"Expected a nonempty "+e.type+" but received an empty one"))},t.nullable=function(e){return new u({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})},t.number=function(){return g("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+i(e)))},t.object=m,t.omit=function(e,t){const{schema:n}=e,r={...n};for(const e of t)delete r[e];return"type"===e.type?b(r):m(r)},t.optional=w,t.partial=function(e){const t=e instanceof u?{...e.schema}:{...e};for(const e in t)t[e]=w(t[e]);return m(t)},t.pattern=function(e,t){return S(e,"pattern",(n=>t.test(n)||"Expected a "+e.type+" matching `/"+t.source+'/` but received "'+n+'"'))},t.pick=function(e,t){const{schema:n}=e,r={};for(const e of t)r[e]=n[e];return m(r)},t.record=function(e,t){return new u({type:"record",schema:null,*entries(n){if(r(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>r(e)||"Expected an object, but received: "+i(e)})},t.refine=S,t.regexp=function(){return g("regexp",(e=>e instanceof RegExp))},t.set=function(e){return new u({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const n of t)yield[n,n,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||"Expected a `Set` object, but received: "+i(e)})},t.size=function(e,t,n){void 0===n&&(n=t);const r="Expected a "+e.type,o=t===n?"of `"+t+"`":"between `"+t+"` and `"+n+"`";return S(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=n||r+" "+o+" but received `"+e+"`";if(e instanceof Map||e instanceof Set){const{size:i}=e;return t<=i&&i<=n||r+" with a size "+o+" but received one with a size of `"+i+"`"}{const{length:i}=e;return t<=i&&i<=n||r+" with a length "+o+" but received one with a length of `"+i+"`"}}))},t.string=v,t.struct=function(e,t){return console.warn("[email protected] - The `struct` helper has been renamed to `define`."),g(e,t)},t.trimmed=function(e){return k(e,v(),(e=>e.trim()))},t.tuple=function(e){const t=y();return new u({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||"Expected an array, but received: "+i(e)})},t.type=b,t.union=function(e){const t=e.map((e=>e.type)).join(" | ");return new u({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||A()).coercer(t,n),validator(n,r){const o=[];for(const t of e){const[...e]=c(n,t,r),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+i(n),...o]}})},t.unknown=A,t.validate=p},3364:(e,t)=>
1{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends TypeError{constructor(e,t){let n;const{message:r,...o}=e,{path:i}=e;super(0===i.length?r:"At path: "+i.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[e,...t()]}}}function r(e){return"object"==typeof e&&null!=e}function o(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function i(e){return"string"==typeof e?JSON.stringify(e):""+e}function s(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:s}=t,{type:a}=n,{refinement:c,message:u="Expected a value of type `"+a+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+i(r)+"`"}=e;return{value:r,type:a,refinement:c,key:o[o.length-1],path:o,branch:s,...e,message:u}}function*a(e,t,n,o){var i;r(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const r of e){const e=s(r,t,n,o);e&&(yield e)}}function*c(e,t,n){void 0===n&&(n={});const{path:o=[],branch:i=[e],coerce:s=!1,mask:a=!1}=n,u={path:o,branch:i};if(s&&(e=t.coercer(e,u),a&&"type"!==t.type&&r(t.schema)&&r(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let l=!0;for(const n of t.validator(e,u))l=!1,yield[n,void 0];for(let[n,h,d]of t.entries(e,u)){const t=c(h,d,{path:void 0===n?o:[...o,n],branch:void 0===n?i:[...i,h],coerce:s,mask:a});for(const o of t)o[0]?(l=!1,yield[o[0],void 0]):s&&(h=o[1],void 0===n?e=h:e instanceof Map?e.set(n,h):e instanceof Set?e.add(h):r(e)&&(e[n]=h))}if(l)for(const n of t.refiner(e,u))l=!1,yield[n,void 0];l&&(yield[void 0,e])}class u{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=i,this.validator=r?(e,t)=>a(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>a(o(e,t),t,this,e):()=>[]}assert(e){return l(e,this)}create(e){return h(e,this)}is(e){return f(e,this)}mask(e){return d(e,this)}validate(e,t){return void 0===t&&(t={}),p(e,this,t)}}function l(e,t){const n=p(e,t);if(n[0])throw n[0]}function h(e,t){const n=p(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function d(e,t){const n=p(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}function f(e,t){return!p(e,t)[0]}function p(e,t,r){void 0===r&&(r={});const o=c(e,t,r),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(o);return i[0]?[new n(i[0],(function*(){for(const e of o)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function g(e,t){return new u({type:e,schema:null,validator:t})}function y(){return g("never",(()=>!1))}function m(e){const t=e?Object.keys(e):[],n=y();return new u({type:"object",schema:e||null,*entries(o){if(e&&r(o)){const r=new Set(Object.keys(o));for(const n of t)r.delete(n),yield[n,o[n],e[n]];for(const e of r)yield[e,o[e],n]}},validator:e=>r(e)||"Expected an object, but received: "+i(e),coercer:e=>r(e)?{...e}:e})}function w(e){return new u({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function v(){return g("string",(e=>"string"==typeof e||"Expected a string, but received: "+i(e)))}function b(e){const t=Object.keys(e);return new u({type:"type",schema:e,*entries(n){if(r(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>r(e)||"Expected an object, but received: "+i(e)})}function A(){return g("unknown",(()=>!0))}function k(e,t,n){return new u({...e,coercer:(r,o)=>f(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}function _(e){return e instanceof Map||e instanceof Set?e.size:e.length}function S(e,t,n){return new u({...e,*refiner(r,o){yield*e.refiner(r,o);const i=a(n(r,o),o,e,r);for(const e of i)yield{...e,refinement:t}}})}t.Struct=u,t.StructError=n,t.any=function(){return g("any",(()=>!0))},t.array=function(e){return new u({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+i(e)})},t.assert=l,t.assign=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r="type"===t[0].type,o=t.map((e=>e.schema)),i=Object.assign({},...o);return r?b(i):m(i)},t.bigint=function(){return g("bigint",(e=>"bigint"==typeof e))},t.boolean=function(){return g("boolean",(e=>"boolean"==typeof e))},t.coerce=k,t.create=h,t.date=function(){return g("date",(e=>e instanceof Date&&!isNaN(e.getTime())||"Expected a valid `Date` object, but received: "+i(e)))},t.defaulted=function(e,t,n){return void 0===n&&(n={}),k(e,A(),(e=>{const r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&o(e)&&o(r)){const t={...e};let n=!1;for(const e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e}))},t.define=g,t.deprecated=function(e,t){return new u({...e,refiner:(t,n)=>void 0===t||e.refiner(t,n),validator:(n,r)=>void 0===n||(t(n,r),e.validator(n,r))})},t.dynamic=function(e){return new u({type:"dynamic",schema:null,*entries(t,n){const r=e(t,n);yield*r.entries(t,n)},validator:(t,n)=>e(t,n).validator(t,n),coercer:(t,n)=>e(t,n).coercer(t,n),refiner:(t,n)=>e(t,n).refiner(t,n)})},t.empty=function(e){return S(e,"empty",(t=>{const n=_(t);return 0===n||"Expected an empty "+e.type+" but received one with a size of `"+n+"`"}))},t.enums=function(e){const t={},n=e.map((e=>i(e))).join();for(const n of e)t[n]=n;return new u({type:"enums",schema:t,validator:t=>e.includes(t)||"Expected one of `"+n+"`, but received: "+i(t)})},t.func=function(){return g("func",(e=>"function"==typeof e||"Expected a function, but received: "+i(e)))},t.instance=function(e){return g("instance",(t=>t instanceof e||"Expected a `"+e.name+"` instance, but received: "+i(t)))},t.integer=function(){return g("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+i(e)))},t.intersection=function(e){return new u({type:"intersection",schema:null,*entries(t,n){for(const r of e)yield*r.entries(t,n)},*validator(t,n){for(const r of e)yield*r.validator(t,n)},*refiner(t,n){for(const r of e)yield*r.refiner(t,n)}})},t.is=f,t.lazy=function(e){let t;return new u({type:"lazy",schema:null,*entries(n,r){null!=t||(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(null!=t||(t=e()),t.validator(n,r)),coercer:(n,r)=>(null!=t||(t=e()),t.coercer(n,r)),refiner:(n,r)=>(null!=t||(t=e()),t.refiner(n,r))})},t.literal=function(e){const t=i(e),n=typeof e;return new u({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||"Expected the literal `"+t+"`, but received: "+i(n)})},t.map=function(e,t){return new u({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(const[r,o]of n.entries())yield[r,r,e],yield[r,o,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||"Expected a `Map` object, but received: "+i(e)})},t.mask=d,t.max=function(e,t,n){void 0===n&&(n={});const{exclusive:r}=n;return S(e,"max",(n=>r?n<t:n<=t||"Expected a "+e.type+" less than "+(r?"":"or equal to ")+t+" but received `"+n+"`"))},t.min=function(e,t,n){void 0===n&&(n={});const{exclusive:r}=n;return S(e,"min",(n=>r?n>t:n>=t||"Expected a "+e.type+" greater than "+(r?"":"or equal to ")+t+" but received `"+n+"`"))},t.never=y,t.nonempty=function(e){return S(e,"nonempty",(t=>_(t)>0||"Expected a nonempty "+e.type+" but received an empty one"))},t.nullable=function(e){return new u({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})},t.number=function(){return g("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+i(e)))},t.object=m,t.omit=function(e,t){const{schema:n}=e,r={...n};for(const e of t)delete r[e];return"type"===e.type?b(r):m(r)},t.optional=w,t.partial=function(e){const t=e instanceof u?{...e.schema}:{...e};for(const e in t)t[e]=w(t[e]);return m(t)},t.pattern=function(e,t){return S(e,"pattern",(n=>t.test(n)||"Expected a "+e.type+" matching `/"+t.source+'/` but received "'+n+'"'))},t.pick=function(e,t){const{schema:n}=e,r={};for(const e of t)r[e]=n[e];return m(r)},t.record=function(e,t){return new u({type:"record",schema:null,*entries(n){if(r(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>r(e)||"Expected an object, but received: "+i(e)})},t.refine=S,t.regexp=function(){return g("regexp",(e=>e instanceof RegExp))},t.set=function(e){return new u({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const n of t)yield[n,n,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||"Expected a `Set` object, but received: "+i(e)})},t.size=function(e,t,n){void 0===n&&(n=t);const r="Expected a "+e.type,o=t===n?"of `"+t+"`":"between `"+t+"` and `"+n+"`";return S(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=n||r+" "+o+" but received `"+e+"`";if(e instanceof Map||e instanceof Set){const{size:i}=e;return t<=i&&i<=n||r+" with a size "+o+" but received one with a size of `"+i+"`"}{const{length:i}=e;return t<=i&&i<=n||r+" with a length "+o+" but received one with a length of `"+i+"`"}}))},t.string=v,t.struct=function(e,t){return console.warn("[email protected] - The `struct` helper has been renamed to `define`."),g(e,t)},t.trimmed=function(e){return k(e,v(),(e=>e.trim()))},t.tuple=function(e){const t=y();return new u({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||"Expected an array, but received: "+i(e)})},t.type=b,t.union=function(e){const t=e.map((e=>e.type)).join(" | ");return new u({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||A()).coercer(t,n),validator(n,r){const o=[];for(const t of e){const[...e]=c(n,t,r),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+i(n),...o]}})},t.unknown=A,t.validate=p},6425:(e,t,n)=>{"use strict";var r=n(5606),o=n(8287).Buffer;function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:a}=Object,c=(u=Object.create(null),e=>{const t=s.call(e);return u[t]||(u[t]=t.slice(8,-1).toLowerCase())});var u;const l=e=>(e=e.toLowerCase(),t=>c(t)===e),h=e=>t=>typeof t===e,{isArray:d}=Array,f=h("undefined"),p=l("ArrayBuffer"),g=h("string"),y=h("function"),m=h("number"),w=e=>null!==e&&"object"==typeof e,v=e=>{if("object"!==c(e))return!1;const t=a(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=l("Date"),A=l("File"),k=l("Blob"),_=l("FileList"),S=l("URLSearchParams"),[E,T,I,M]=["ReadableStream","Request","Response","Headers"].map(l);function R(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),d(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function x(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,O=e=>!f(e)&&e!==C,P=(N="undefined"!=typeof Uint8Array&&a(Uint8Array),e=>N&&e instanceof N);var N;const B=l("HTMLFormElement"),V=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),L=l("RegExp"),D=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};R(n,((n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)})),Object.defineProperties(e,r)},j="abcdefghijklmnopqrstuvwxyz",U="0123456789",W={DIGIT:U,ALPHA:j,ALPHA_DIGIT:j+j.toUpperCase()+U},z=l("AsyncFunction"),G=(K="function"==typeof setImmediate,F=y(C.postMessage),K?setImmediate:F?(q=`axios@${Math.random()}`,H=[],C.addEventListener("message",(({source:e,data:t})=>{e===C&&t===q&&H.length&&H.shift()()}),!1),e=>{H.push(e),C.postMessage(q,"*")}):e=>setTimeout(e));var K,F,q,H;const Y="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):void 0!==r&&r.nextTick||G;var $={isArray:d,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&y(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||y(e.append)&&("formdata"===(t=c(e))||"object"===t&&y(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:g,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:w,isPlainObject:v,isReadableStream:E,isRequest:T,isResponse:I,isHeaders:M,isUndefined:f,isDate:b,isFile:A,isBlob:k,isRegExp:L,isFunction:y,isStream:e=>w(e)&&y(e.pipe),isURLSearchParams:S,isTypedArray:P,isFileList:_,forEach:R,merge:function e(){const{caseless:t}=O(this)&&this||{},n={},r=(r,o)=>{const i=t&&x(n,o)||o;v(n[i])&&v(r)?n[i]=e(n[i],r):v(r)?n[i]=e({},r):d(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&R(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(R(t,((t,r)=>{n&&y(t)?e[r]=i(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==n&&a(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:c,kindOfTest:l,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n}
vendor: 4,343 bytes, line 1
1,forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:B,hasOwnProperty:V,hasOwnProp:V,reduceDescriptors:D,freezeMethods:e=>{D(e,((t,n)=>{if(y(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];y(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return d(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:x,global:C,isContextDefined:O,ALPHABET:W,generateString:(e=16,t=W.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&y(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(w(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=d(e)?[]:{};return R(e,((e,t)=>{const i=n(e,r+1);!f(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:z,isThenable:e=>e&&(w(e)||y(e))&&y(e.then)&&y(e.catch),setImmediate:G,asap:Y};function Z(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}$.inherits(Z,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.status}}});const Q=Z.prototype,J={};function X(e){return $.isPlainObject(e)||$.isArray(e)}function ee(e){return $.endsWith(e,"[]")?e.slice(0,-2):e}function te(e,t,n){return e?e.concat(t).map((function(e,t){return e=ee(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{J[e]={value:e}})),Object.defineProperties(Z,J),Object.defineProperty(Q,"isAxiosError",{value:!0}),Z.from=(e,t,n,r,o,i)=>{const s=Object.create(Q);return $.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Z.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const ne=$.toFlatObject($,{},null,(function(e){return/^is[A-Z]/.test(e)}));function re(e,t,n){if(!$.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=$.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$.isUndefined(t[e])}))).metaTokens,i=n.visitor||l,s=n.dots,a=n.indexes,c=(n.Blob||"undefined"!=typeof Blob&&Blob)&&$.isSpecCompliantForm(t);if(!$.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if($.isDate(e))return e.toISOString();if(!c&&$.isBlob(e))throw new Z("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(e)||$.isTypedArray(e)?c&&"function"==typeof Blob?new Blob([e]):o.from(e):e}function l(e,n,o){let i=e;if(e&&!o&&"object"==typeof e)if($.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if($.isArray(e)&&function(e){return $.isArray(e)&&!e.some(X)}(e)||($.isFileList(e)||$.endsWith(n,"[]"))&&(i=$.toArray(e)))return n=ee(n),i.forEach((function(e,r){!$.isUndefined(e)&&null!==e&&t.append(!0===a?te([n],r,s):null===a?n:n+"[]",u(e))})),!1;return!!X(e)||(t.append(te(o,n,s),u(e)),!1)}const h=[],d=Object.assign(ne,{defaultVisitor:l,convertValue:u,isVisitable:X});if(!$.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!$.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),$.forEach(n,(function(n,o){!0===(!($.isUndefined(n)||null===n)&&i.call(t,n,$.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])})),h.pop()}}(e),t}
vendor: 6,190 bytes, line 1
1function oe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ie(e,t){this._pairs=[],e&&re(e,this,t)}const se=ie.prototype;function ae(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ce(e,t,n){if(!t)return e;const r=n&&n.encode||ae;$.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(t,n):$.isURLSearchParams(t)?t.toString():new ie(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}se.append=function(e,t){this._pairs.push([e,t])},se.toString=function(e){const t=e?function(t){return e.call(this,t,oe)}:oe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var ue=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},le={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},he={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ie,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const de="undefined"!=typeof window&&"undefined"!=typeof document,fe="object"==typeof navigator&&navigator||void 0,pe=de&&(!fe||["ReactNative","NativeScript","NS"].indexOf(fe.product)<0),ge="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ye=de&&window.location.href||"http://localhost";var me={...Object.freeze({__proto__:null,hasBrowserEnv:de,hasStandardBrowserWebWorkerEnv:ge,hasStandardBrowserEnv:pe,navigator:fe,origin:ye}),...he};function we(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&$.isArray(r)?r.length:i,a?($.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&$.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&$.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if($.isFormData(e)&&$.isFunction(e.entries)){const n={};return $.forEachEntry(e,((e,r)=>{t(function(e){return $.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const ve={transitional:le,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=$.isObject(e);if(o&&$.isHTMLForm(e)&&(e=new FormData(e)),$.isFormData(e))return r?JSON.stringify(we(e)):e;if($.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)||$.isReadableStream(e))return e;if($.isArrayBufferView(e))return e.buffer;if($.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return re(e,new me.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return me.isNode&&$.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=$.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return re(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e){if($.isString(e))try{return(0,JSON.parse)(e),$.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ve.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if($.isResponse(e)||$.isReadableStream(e))return e;if(e&&$.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw Z.from(e,Z.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:me.classes.FormData,Blob:me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],(e=>{ve.headers[e]={}}));var be=ve;const Ae=$.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ke=Symbol("internals");function _e(e){return e&&String(e).trim().toLowerCase()}function Se(e){return!1===e||null==e?e:$.isArray(e)?e.map(Se):String(e)}function Ee(e,t,n,r,o){return $.isFunction(r)?r.call(this,t,n):(o&&(t=n),$.isString(t)?$.isString(r)?-1!==t.indexOf(r):$.isRegExp(r)?r.test(t):void 0:void 0)}class Te{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=_e(t);if(!o)throw new Error("header name must be a non-empty string");const i=$.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Se(e))}const i=(e,t)=>$.forEach(e,((e,n)=>o(e,n,t)));if($.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if($.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ae[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if($.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=_e(e)){const n=$.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;
vendor: 6,055 bytes, line 1
1=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if($.isFunction(t))return t.call(this,e,n);if($.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_e(e)){const n=$.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ee(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=_e(e)){const o=$.findKey(n,e);!o||t&&!Ee(0,n[o],o,t)||(delete n[o],r=!0)}}return $.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Ee(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return $.forEach(this,((r,o)=>{const i=$.findKey(n,o);if(i)return t[i]=Se(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=Se(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&$.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ke]=this[ke]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=_e(e);t[r]||(function(e,t){const n=$.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return $.isArray(e)?e.forEach(r):r(e),this}}Te.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$.reduceDescriptors(Te.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),$.freezeMethods(Te);var Ie=Te;function Me(e,t){const n=this||be,r=t||n,o=Ie.from(r.headers);let i=r.data;return $.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function Re(e){return!(!e||!e.__CANCEL__)}function xe(e,t,n){Z.call(this,null==e?"canceled":e,Z.ERR_CANCELED,t,n),this.name="CanceledError"}function Ce(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Z("Request failed with status code "+n.status,[Z.ERR_BAD_REQUEST,Z.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}$.inherits(xe,Z,{__CANCEL__:!0});const Oe=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,h=0;for(;l!==i;)h+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout((()=>{r=null,s(n)}),i-a)))},()=>n&&s(n)]}((n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,c=o(a);r=i,e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),n)},Pe=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ne=e=>(...t)=>$.asap((()=>e(...t)));var Be=me.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,me.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(me.origin),me.navigator&&/(msie|trident)/i.test(me.navigator.userAgent)):()=>!0,Ve=me.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];$.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),$.isString(r)&&s.push("path="+r),$.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Le(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const De=e=>e instanceof Ie?{...e}:e;function je(e,t){t=t||{};const n={};function r(e,t,n,r){return $.isPlainObject(e)&&$.isPlainObject(t)?$.merge.call({caseless:r},e,t):$.isPlainObject(t)?$.merge({},t):$.isArray(t)?t.slice():t}function o(e,t,n,o){return $.isUndefined(t)?$.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!$.isUndefined(t))return r(void 0,t)}function s(e,t){return $.isUndefined(t)?$.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(De(e),De(t),0,!0)};return $.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);$.isUndefined(s)&&i!==a||(n[r]=s)})),n}var Ue=e=>{const t=je({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=Ie.from(a),t.url=ce(Le(t.baseURL,t.url),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),$.isFormData(r))if(me.hasStandardBrowserEnv||me.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>
vendor: 2,780 bytes, line 1
1e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(me.hasStandardBrowserEnv&&(o&&$.isFunction(o)&&(o=o(t)),o||!1!==o&&Be(t.url))){const e=i&&s&&Ve.read(s);e&&a.set(i,e)}return t},We="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Ue(e);let o=r.data;const i=Ie.from(r.headers).normalize();let s,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:f}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let g=new XMLHttpRequest;function y(){if(!g)return;const r=Ie.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Ce((function(e){t(e),p()}),(function(e){n(e),p()}),{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(y)},g.onabort=function(){g&&(n(new Z("Request aborted",Z.ECONNABORTED,e,g)),g=null)},g.onerror=function(){n(new Z("Network Error",Z.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||le;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Z(t,o.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,g)),g=null},void 0===o&&i.setContentType(null),"setRequestHeader"in g&&$.forEach(i.toJSON(),(function(e,t){g.setRequestHeader(t,e)})),$.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),h&&"json"!==h&&(g.responseType=r.responseType),f&&([c,l]=Oe(f,!0),g.addEventListener("progress",c)),d&&g.upload&&([a,u]=Oe(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{g&&(n(!t||t.type?new xe(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const m=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);m&&-1===me.protocols.indexOf(m)?n(new Z("Unsupported protocol "+m+":",Z.ERR_BAD_REQUEST,e)):g.send(o||null)}))},ze=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Z?t:new xe(t instanceof Error?t.message:t))}};let i=t&&setTimeout((()=>{i=null,o(new Z(`timeout ${t} of ms exceeded`,Z.ETIMEDOUT))}),t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>
vendor: 8,773 bytes, line 1
1e.addEventListener("abort",o)));const{signal:a}=r;return a.unsubscribe=()=>$.asap(s),a}};const Ge=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ke=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*Ge(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Fe="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,qe=Fe&&"function"==typeof ReadableStream,He=Fe&&("function"==typeof TextEncoder?(Ye=new TextEncoder,e=>Ye.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ye;const $e=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ze=qe&&$e((()=>{let e=!1;const t=new Request(me.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Qe=qe&&$e((()=>$.isReadableStream(new Response("").body))),Je={stream:Qe&&(e=>e.body)};var Xe;Fe&&(Xe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Je[e]&&(Je[e]=$.isFunction(Xe[e])?t=>t[e]():(t,n)=>{throw new Z(`Response type '${e}' is not supported`,Z.ERR_NOT_SUPPORT,n)})})));const et={http:null,xhr:We,fetch:Fe&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ue(e);u=u?(u+"").toLowerCase():"text";let f,p=ze([o,i&&i.toAbortSignal()],s);const g=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(c&&Ze&&"get"!==n&&"head"!==n&&0!==(y=await(async(e,t)=>{const n=$.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if($.isBlob(e))return e.size;if($.isSpecCompliantForm(e)){const t=new Request(me.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $.isArrayBufferView(e)||$.isArrayBuffer(e)?e.byteLength:($.isURLSearchParams(e)&&(e+=""),$.isString(e)?(await He(e)).byteLength:void 0)})(t):n})(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if($.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Pe(y,Oe(Ne(c)));r=Ke(n.body,65536,e,t)}}$.isString(h)||(h=h?"include":"omit");const o="credentials"in Request.prototype;f=new Request(t,{...d,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?h:void 0});let i=await fetch(f);const s=Qe&&("stream"===u||"response"===u);if(Qe&&(a||s&&g)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=i[t]}));const t=$.toFiniteNumber(i.headers.get("content-length")),[n,r]=a&&Pe(t,Oe(Ne(a),!0))||[];i=new Response(Ke(i.body,65536,n,(()=>{r&&r(),g&&g()})),e)}u=u||"text";let m=await Je[$.findKey(Je,u)||"text"](i,e);return!s&&g&&g(),await new Promise(((t,n)=>{Ce(t,n,{data:m,headers:Ie.from(i.headers),status:i.status,statusText:i.statusText,config:e,request:f})}))}catch(t){if(g&&g(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new Z("Network Error",Z.ERR_NETWORK,e,f),{cause:t.cause||t});throw Z.from(t,t&&t.code,e,f)}})};$.forEach(et,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const tt=e=>`- ${e}`,nt=e=>$.isFunction(e)||null===e||!1===e;var rt=e=>{e=$.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!nt(n)&&(r=et[(t=String(n)).toLowerCase()],void 0===r))throw new Z(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Z("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(tt).join("\n"):" "+tt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function ot(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xe(null,e)}function it(e){return ot(e),e.headers=Ie.from(e.headers),e.data=Me.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),rt(e.adapter||be.adapter)(e).then((function(t){return ot(e),t.data=Me.call(e,e.transformResponse,t),t.headers=Ie.from(t.headers),t}),(function(t){return Re(t)||(ot(e),t&&t.response&&(t.response.data=Me.call(e,e.transformResponse,t.response),t.response.headers=Ie.from(t.response.headers))),Promise.reject(t)}))}const st={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{st[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const at={};st.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.9] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Z(r(o," has been removed"+(t?" in "+t:"")),Z.ERR_DEPRECATED);return t&&!at[o]&&(at[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},st.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ct={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new Z("option "+i+" must be "+n,Z.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}},validators:st};const ut=ct.validators;class lt{constructor(e){this.defaults=e,this.interceptors={request:new ue,response:new ue}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ct.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean)},!1),null!=r&&($.isFunction(r)?t.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:ut.function,serialize:ut.function},!0)),ct.assertOptions(t,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&$.merge(o.common,o[t.method]);o&&$.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Ie.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,h=0;if(!a){const e=[it.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=s.length;let d=t;for(h=0;h<l;){const e=s[h++],t=s[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=it.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return ce(Le((e=je(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}$.forEach(["delete","get","head","options"],(function(e){lt.prototype[e]=function(t,n){return this.request(je(n||{},{method:e,url:t,data:(n||{}).data}))}})),$.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(je(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}lt.prototype[e]=t(),lt.prototype[e+"Form"]=t(!0)}));var ht=lt;class dt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new xe(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}
1subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new dt((function(t){e=t})),cancel:e}}}var ft=dt;const pt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(pt).forEach((([e,t])=>{pt[t]=e}));var gt=pt;const yt=function e(t){const n=new ht(t),r=i(ht.prototype.request,n);return $.extend(r,ht.prototype,n,{allOwnKeys:!0}),$.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(je(t,n))},r}(be);yt.Axios=ht,yt.CanceledError=xe,yt.CancelToken=ft,yt.isCancel=Re,yt.VERSION="1.7.9",yt.toFormData=re,yt.AxiosError=Z,yt.Cancel=yt.CanceledError,yt.all=function(e){return Promise.all(e)},yt.spread=function(e){return function(t){return e.apply(null,t)}},yt.isAxiosError=function(e){return $.isObject(e)&&!0===e.isAxiosError},yt.mergeConfig=je,yt.AxiosHeaders=Ie,yt.formToJSON=e=>we($.isHTMLForm(e)?new FormData(e):e),yt.getAdapter=rt,yt.HttpStatusCode=gt,yt.default=yt,e.exports=yt},7333:(e,t,n)=>{"use strict";n.d(t,{s:()=>a});var r=n(1454),o=n(4976),i=n(6316);function s(e){return{hash:e,hmac:(t,...n)=>(0,r.w)(e,t,(0,o.Id)(...n)),randomBytes:o.po}}function a(e,t){const n=t=>(0,i.x3)({...e,...s(t)});return{...n(t),create:n}}},615:(e,t,n)=>{"use strict";n.d(t,{Xf:()=>p,hT:()=>f,hp:()=>g});var r=n(8030),o=n(8293);const i=BigInt(0),s=BigInt(1);function a(e,t){const n=t.negate();return e?n:t}function c(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function u(e,t){return c(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}const l=new WeakMap,h=new WeakMap;function d(e){return h.get(e)||1}function f(e,t){return{constTimeNegate:a,hasPrecomputes:e=>1!==d(e),unsafeLadder(t,n,r=e.ZERO){let o=t;for(;n>i;)n&s&&(r=r.add(o)),o=o.double(),n>>=s;return r},precomputeWindow(e,n){const{windows:r,windowSize:o}=u(n,t),i=[];let s=e,a=s;for(let e=0;e<r;e++){a=s,i.push(a);for(let e=1;e<o;e++)a=a.add(s),i.push(a);s=a.double()}return i},wNAF(n,r,o){const{windows:i,windowSize:c}=u(n,t);let l=e.ZERO,h=e.BASE;const d=BigInt(2**n-1),f=2**n,p=BigInt(n);for(let e=0;e<i;e++){const t=e*c;let n=Number(o&d);o>>=p,n>c&&(n-=f,o+=s);const i=t,u=t+Math.abs(n)-1,g=e%2!=0,y=n<0;0===n?h=h.add(a(g,r[i])):l=l.add(a(y,r[u]))}return{p:l,f:h}},wNAFUnsafe(n,r,o,a=e.ZERO){const{windows:c,windowSize:l}=u(n,t),h=BigInt(2**n-1),d=2**n,f=BigInt(n);for(let e=0;e<c;e++){const t=e*l;if(o===i)break;let n=Number(o&h);if(o>>=f,n>l&&(n-=d,o+=s),0===n)continue;let c=r[t+Math.abs(n)-1];n<0&&(c=c.negate()),a=a.add(c)}return a}
1,getPrecomputes(e,t,n){let r=l.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&l.set(t,n(r))),r},wNAFCached(e,t,n){const r=d(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const o=d(e);return 1===o?this.unsafeLadder(e,t,r):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),t,r)},setWindowSize(e,n){c(n,t),h.set(e,n),l.delete(e)}}}function p(e,t,n,r){if(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))}(n,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,s=(0,o.dJ)(BigInt(n.length)),a=s>12?s-3:s>4?s-2:s?2:1,c=(1<<a)-1,u=new Array(c+1).fill(i);let l=i;for(let e=Math.floor((t.BITS-1)/a)*a;e>=0;e-=a){u.fill(i);for(let t=0;t<r.length;t++){const o=r[t],i=Number(o>>BigInt(e)&BigInt(c));u[i]=u[i].add(n[t])}let t=i;for(let e=u.length-1,n=i;e>0;e--)n=n.add(u[e]),t=t.add(n);if(l=l.add(t),0!==e)for(let e=0;e<a;e++)l=l.double()}return l}function g(e){return(0,r.jr)(e.Fp),(0,o.Q5)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.LH)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},8888:(e,t,n)=>{"use strict";n.d(t,{n:()=>h});var r=n(615),o=n(8030),i=n(8293);const s=BigInt(0),a=BigInt(1),c=BigInt(2),u=BigInt(8),l={zip215:!0};function h(e){const t=function(e){const t=(0,r.hp)(e);return i.Q5(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:h,prehash:d,hash:f,randomBytes:p,nByteLength:g,h:y}=t,m=c<<BigInt(8*g)-a,w=n.create,v=(0,o.D0)(t.n,t.nBitLength),b=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:s}}}),A=t.adjustScalarBytes||(e=>e),k=t.domain||((e,t,n)=>{if((0,i.e8)("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function _(e,t){i.aK("coordinate "+e,t,s,m)}function S(e){if(!(e instanceof I))throw new Error("ExtendedPoint expected")}const E=(0,i.x)(((e,t)=>{const{ex:r,ey:o,ez:i}=e,c=e.is0();null==t&&(t=c?u:n.inv(i));const l=w(r*t),h=w(o*t),d=w(i*t);if(c)return{x:s,y:a};if(d!==a)throw new Error("invZ was invalid");return{x:l,y:h}})),T=(0,i.x)((e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:o,ey:i,ez:s,et:a}=e,c=w(o*o),u=w(i*i),l=w(s*s),h=w(l*l),d=w(c*n);if(w(l*w(d+u))!==w(h+w(r*w(c*u))))throw new Error("bad point: equation left != right (1)");if(w(o*i)!==w(s*a))throw new Error("bad point: equation left != right (2)");return!0}));class I{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,_("x",e),_("y",t),_("z",n),_("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof I)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return _("x",t),_("y",n),new I(t,n,a,w(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(I.fromAffine)}static msm(e,t){return(0,r.Xf)(I,v,e,t)}_setWindowSize(e){x.setWindowSize(this,e)}assertValidity(){T(this)}equals(e){S(e);const{ex:t,ey:n,ez:r}=this,{ex:o,ey:i,ez:s}=e,a=w(t*s),c=w(o*r),u=w(n*s),l=w(i*r);return a===c&&u===l}is0(){return this.equals(I.ZERO)}negate(){return new I(w(-this.ex),this.ey,this.ez,w(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:o}=this,i=w(n*n),s=w(r*r),a=w(c*w(o*o)),u=w(e*i),l=n+r,h=w(w(l*l)-i-s),d=u+s,f=d-a,p=u-s,g=w(h*f),y=w(d*p),m=w(h*p),v=w(f*d);return new I(g,y,v,m)}add(e){S(e);const{a:n,d:r}=t,{ex:o,ey:i,ez:a,et:u}=this,{ex:l,ey:h,ez:d,et:f}=e;if(n===BigInt(-1)){const e=w((i-o)*(h+l)),t=w((i+o)*(h-l)),n=w(t-e);if(n===s)return this.double();const r=w(a*c*f),p=w(u*c*d),g=p+r,y=t+e,m=p-r,v=w(g*n),b=w(y*m),A=w(g*m),k=w(n*y);return new I(v,b,k,A)}const p=w(o*l),g=w(i*h),y=w(u*r*f),m=w(a*d),v=w((o+i)*(l+h)-p-g),b=m-y,A=m+y,k=w(g-n*p),_=w(v*b),E=w(A*k),T=w(v*k),M=w(b*A);return new I(_,E,M,T)}subtract(e){return this.add(e.negate())}wNAF(e){return x.wNAFCached(this,e,I.normalizeZ)}multiply(e){const t=e;i.aK("scalar",t,a,h);const{p:n,f:r}=this.wNAF(t);return I.normalizeZ([n,r])[0]}multiplyUnsafe(e,t=I.ZERO){const n=e;return i.aK("scalar",n,s,h),n===s?R:this.is0()||n===a?this:x.wNAFCachedUnsafe(this,n,I.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(y).is0()}isTorsionFree(){return x.unsafeLadder(this,h).is0()}toAffine(e){return E(this,e)}clearCofactor(){const{h:e}=t;return e===a?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:o,a:c}=t,u=n.BYTES;e=(0,i.qj)("pointHex",e,u),(0,i.e8)("zip215",r);const l=e.slice(),h=e[u-1];l[u-1]=-129&h;const d=i.lX(l),f=r?m:n.ORDER;i.aK("pointHex.y",d,s,f);const p=w(d*d),g=w(p-a),y=w(o*p-c);let{isValid:v,value:A}=b(g,y);
1if(!v)throw new Error("Point.fromHex: invalid y coordinate");const k=(A&a)===a,_=!!(128&h);if(!r&&A===s&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==k&&(A=w(-A)),I.fromAffine({x:A,y:d})}static fromPrivateKey(e){return P(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=i.z(t,n.BYTES);return r[r.length-1]|=e&a?128:0,r}toHex(){return i.My(this.toRawBytes())}}I.BASE=new I(t.Gx,t.Gy,a,w(t.Gx*t.Gy)),I.ZERO=new I(s,a,a,s);const{BASE:M,ZERO:R}=I,x=(0,r.hT)(I,8*g);function C(e){return(0,o.zi)(e,h)}function O(e){return C(i.lX(e))}function P(e){const t=n.BYTES;e=(0,i.qj)("private key",e,t);const r=(0,i.qj)("hashed private key",f(e),2*t),o=A(r.slice(0,t)),s=r.slice(t,2*t),a=O(o),c=M.multiply(a),u=c.toRawBytes();return{head:o,prefix:s,scalar:a,point:c,pointBytes:u}}function N(e=new Uint8Array,...t){const n=i.Id(...t);return O(f(k(n,(0,i.qj)("context",e),!!d)))}const B=l;return M._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return P(e).pointBytes},sign:function(e,t,r={}){e=(0,i.qj)("message",e),d&&(e=d(e));const{prefix:o,scalar:a,pointBytes:c}=P(t),u=N(r.context,o,e),l=M.multiply(u).toRawBytes(),f=C(u+N(r.context,l,c,e)*a);i.aK("signature.s",f,s,h);const p=i.Id(l,i.z(f,n.BYTES));return(0,i.qj)("result",p,2*n.BYTES)},verify:function(e,t,r,o=B){const{context:s,zip215:a}=o,c=n.BYTES;e=(0,i.qj)("signature",e,2*c),t=(0,i.qj)("message",t),r=(0,i.qj)("publicKey",r,c),void 0!==a&&(0,i.e8)("zip215",a),d&&(t=d(t));const u=i.lX(e.slice(c,2*c));let l,h,f;try{l=I.fromHex(r,a),h=I.fromHex(e.slice(0,c),a),f=M.multiplyUnsafe(u)}catch(e){return!1}if(!a&&l.isSmallOrder())return!1;const p=N(s,h.toRawBytes(),l.toRawBytes(),t);return h.add(l.multiplyUnsafe(p)).subtract(f).clearCofactor().equals(I.ZERO)},ExtendedPoint:I,utils:{getExtendedPublicKey:P,randomPrivateKey:()=>p(n.BYTES),precompute:(e=8,t=I.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}},8030:(e,t,n)=>{"use strict";n.d(t,{B8:()=>p,D0:()=>v,LH:()=>w,Tp:()=>A,dQ:()=>g,jr:()=>m,qy:()=>k,zH:()=>f,zi:()=>h});var r=n(8293);const o=BigInt(0),i=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(4),u=BigInt(5),l=BigInt(8);function h(e,t){const n=e%t;return n>=o?n:t+n}function d(e,t,n){if(t<o)throw new Error("invalid exponent, negatives unsupported");if(n<=o)throw new Error("invalid modulus");if(n===i)return o;let r=i;for(;t>o;)t&i&&(r=r*e%n),e=e*e%n,t>>=i;return r}function f(e,t,n){let r=e;for(;t-- >o;)r*=r,r%=n;return r}function p(e,t){if(e===o)throw new Error("invert: expected non-zero number");if(t<=o)throw new Error("invert: expected positive modulus, got "+t);let n=h(e,t),r=t,s=o,a=i,c=i,u=o;for(;n!==o;){const e=r/n,t=r%n,o=s-c*e,i=a-u*e;r=n,n=t,s=c,a=u,c=o,u=i}if(r!==i)throw new Error("invert: does not exist");return h(s,t)}const g=(e,t)=>(h(e,t)&i)===i,y=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(e){const t=y.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,r.Q5)(e,t)}function w(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function v(e,t,n=!1,f={}){if(e<=o)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:g,nByteLength:y}=w(e,t);if(y>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let m;const v=Object.freeze({ORDER:e,isLE:n,BITS:g,BYTES:y,MASK:(0,r.OG)(g),ZERO:o,ONE:i,create:t=>h(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return o<=t&&t<e},is0:e=>e===o,isOdd:e=>(e&i)===i,neg:t=>h(-t,e),eql:(e,t)=>e===t,sqr:t=>h(t*t,e),add:(t,n)=>h(t+n,e),sub:(t,n)=>h(t-n,e),mul:(t,n)=>h(t*n,e),pow:(e,t)=>function(e,t,n){if(n<o)throw new Error("invalid exponent, negatives unsupported");if(n===o)return e.ONE;if(n===i)return t;let r=e.ONE,s=t;for(;n>o;)n&i&&(r=e.mul(r,s)),s=e.sqr(s),n>>=i;return r}(v,e,t),div:(t,n)=>h(t*p(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>p(t,e),sqrt:f.sqrt||(t=>(m||(m=function(e){if(e%c===a){const t=(e+i)/c;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%l===u){const t=(e-u)/l;return function(e,n){const r=e.mul(n,s),o=e.pow(r,t),i=e.mul(n,o),a=e.mul(e.mul(i,s),o),c=e.mul(i,e.sub(a,e.ONE));if(!e.eql(e.sqr(c),n))throw new Error("Cannot find square root");return c}}return function(e){const t=(e-i)/s;let n,r,a;for(n=e-i,r=0;n%s===o;n/=s,r++);for(a=s;a<e&&d(a,t,e)!==e-i;a++)if(a>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+i)/c;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const u=(n+i)/s;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let s=r,c=e.pow(e.mul(e.ONE,a),n),l=e.pow(o,u),h=e.pow(o,n);for(;!e.eql(h,e.ONE);){if(e.eql(h,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(h);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const n=e.pow(c,i<<BigInt(s-t-1));c=e.sqr(n),l=e.mul(l,n),h=e.mul(h,c),s=t}return l}}(e)}(e)),m(v,t))),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,o)=>e.is0(r)?t:(n[o]=t,e.mul(t,r))),e.ONE),o=e.inv(r);return t.reduceRight(((t,r,o)=>e.is0(r)?t:(n[o]=e.mul(t,n[o]),e.mul(t,r))),o),n}(v,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,r.z)(e,y):(0,r.lq)(e,y),fromBytes:e=>{if(e.length!==y)throw new Error("Field.fromBytes: expected "+y+" bytes, got "+e.length);return n?(0,r.lX)(e):(0,r.Ph)(e)}});return Object.freeze(v)}function b(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function A(e){const t=b(e);return t+Math.ceil(t/2)}function k(e,t,n=!1){const o=e.length,s=b(t),a=A(t);if(o<16||o<a||o>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+o);const c=h(n?(0,r.lX)(e):(0,r.Ph)(e),t-i)+i;return n?(0,r.z)(c,s):(0,r.lq)(c,s)}}
vendor: 4,297 bytes, line 1
1,8293:(e,t,n)=>{"use strict";n.d(t,{DO:()=>a,Id:()=>A,My:()=>l,OG:()=>T,Ph:()=>y,Q5:()=>C,aK:()=>S,aT:()=>g,aY:()=>s,dJ:()=>E,e8:()=>c,fg:()=>R,lX:()=>m,lq:()=>w,qj:()=>b,r4:()=>_,x:()=>O,z:()=>v,zW:()=>h});const r=BigInt(0),o=BigInt(1),i=BigInt(2);function s(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!s(e))throw new Error("Uint8Array expected")}function c(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}const u=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function l(e){a(e);let t="";for(let n=0;n<e.length;n++)t+=u[e[n]];return t}function h(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function d(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?r:BigInt("0x"+e)}const f={_0:48,_9:57,A:65,F:70,a:97,f:102};function p(e){return e>=f._0&&e<=f._9?e-f._0:e>=f.A&&e<=f.F?e-(f.A-10):e>=f.a&&e<=f.f?e-(f.a-10):void 0}function g(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,o=0;t<n;t++,o+=2){const n=p(e.charCodeAt(o)),i=p(e.charCodeAt(o+1));if(void 0===n||void 0===i){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[t]=16*n+i}return r}function y(e){return d(l(e))}function m(e){return a(e),d(l(Uint8Array.from(e).reverse()))}function w(e,t){return g(e.toString(16).padStart(2*t,"0"))}function v(e,t){return w(e,t).reverse()}function b(e,t,n){let r;if("string"==typeof t)try{r=g(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!s(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const o=r.length;if("number"==typeof n&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function A(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];a(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const o=e[t];n.set(o,r),r+=o.length}return n}const k=e=>"bigint"==typeof e&&r<=e;function _(e,t,n){return k(e)&&k(t)&&k(n)&&t<=e&&e<n}function S(e,t,n,r){if(!_(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function E(e){let t;for(t=0;e>r;e>>=o,t+=1);return t}const T=e=>(i<<BigInt(e-1))-o,I=e=>new Uint8Array(e),M=e=>Uint8Array.from(e);function R(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=I(e),o=I(e),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},a=(...e)=>n(o,r,...e),c=(e=I())=>{o=a(M([0]),e),r=a(),0!==e.length&&(o=a(M([1]),e),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return A(...n)};return(e,t)=>{let n;for(s(),c(e);!(n=t(u()));)c();return s(),n}}const x={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||s(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function C(e,t,n={}){const r=(t,n,r)=>{const o=x[n];if("function"!=typeof o)throw new Error("invalid validator function");const i=e[t];if(!(r&&void 0===i||o(i,e)))throw new Error("param "+String(t)+" is invalid. Expected "+n+", got "+i)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}function O(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(void 0!==o)return o;const i=e(n,...r);return t.set(n,i),i}}},6316:(e,t,n)=>{"use strict";n.d(t,{x3:()=>p});var r=n(615),o=n(8030),i=n(8293);function s(e){void 0!==e.lowS&&(0,i.e8)("lowS",e.lowS),void 0!==e.prehash&&(0,i.e8)("prehash",e.prehash)}const{Ph:a,aT:c}=i;class u extends Error{constructor(e=""){super(e)}}const l={Err:u,_tlv:{encode:(e,t)=>{const{Err:n}=l;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=i.zW(r);
vendor: 10,206 bytes, line 1
1if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?i.zW(o.length/2|128):"";return i.zW(e)+s+o+t},decode(e,t){const{Err:n}=l;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++];let i=0;if(128&o){const e=127&o;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of s)i=i<<8|e;if(r+=e,i<128)throw new n("tlv.decode(long): not minimal encoding")}else i=o;const s=t.subarray(r,r+i);if(s.length!==i)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=l;if(e<h)throw new t("integer: negative integers are not allowed");let n=i.zW(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=l;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return a(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=l,o="string"==typeof e?c(e):e;i.DO(o);const{v:s,l:a}=r.decode(48,o);if(a.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:h}=r.decode(2,s),{v:d,l:f}=r.decode(2,h);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(u),s:n.decode(d)}},hexFromSig(e){const{_tlv:t,_int:n}=l,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},h=BigInt(0),d=BigInt(1),f=(BigInt(2),BigInt(3));function p(e){const t=function(e){const t=(0,r.hp)(e);return i.Q5(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:a}=t,c=n.BYTES+1,u=2*n.BYTES+1;function p(e){return(0,o.zi)(e,a)}function g(e){return(0,o.B8)(e,a)}const{ProjectivePoint:y,normPrivateKeyToScalar:m,weierstrassEquation:w,isWithinCurveOrder:v}=function(e){const t=function(e){const t=(0,r.hp)(e);i.Q5(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:o,a:s}=t;if(n){if(!o.eql(s,o.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,s=(0,o.D0)(t.n,t.nBitLength),a=t.toBytes||((e,t,r)=>{const o=t.toAffine();return i.Id(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),c=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function u(e){const{a:r,b:o}=t,i=n.sqr(e),s=n.mul(i,e);return n.add(n.add(s,n.mul(e,r)),o)}if(!n.eql(n.sqr(t.Gy),u(t.Gx)))throw new Error("bad generator point: equation left != right");function l(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:s,n:a}=t;if(n&&"bigint"!=typeof e){if(i.aY(e)&&(e=i.My(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let c;try{c="bigint"==typeof e?e:i.Ph((0,i.qj)("private key",e,r))}catch(t){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return s&&(c=(0,o.zi)(c,a)),i.aK("private key",c,d,a),c}function p(e){if(!(e instanceof m))throw new Error("ProjectivePoint expected")}const g=(0,i.x)(((e,t)=>{const{px:r,py:o,pz:i}=e;if(n.eql(i,n.ONE))return{x:r,y:o};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(i));const a=n.mul(r,t),c=n.mul(o,t),u=n.mul(i,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:a,y:c}})),y=(0,i.x)((e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:o}=e.toAffine();if(!n.isValid(r)||!n.isValid(o))throw new Error("bad point: x or y not FE");const i=n.sqr(o),s=u(r);if(!n.eql(i,s))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class m{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof m)throw new Error("projective point not allowed");const o=e=>n.eql(e,n.ZERO);return o(t)&&o(r)?m.ZERO:new m(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(m.fromAffine)}static fromHex(e){const t=m.fromAffine(c((0,i.qj)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return m.BASE.multiply(l(e))}static msm(e,t){return(0,r.Xf)(m,s,e,t)}_setWindowSize(e){v.setWindowSize(this,e)}assertValidity(){y(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){p(e);const{px:t,py:r,pz:o}=this,{px:i,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(i,o)),u=n.eql(n.mul(r,a),n.mul(s,o));return c&&u}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,f),{px:i,py:s,pz:a}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,h=n.mul(i,i),d=n.mul(s,s),p=n.mul(a,a),g=n.mul(i,s);return g=n.add(g,g),l=n.mul(i,a),l=n.add(l,l),c=n.mul(e,l),u=n.mul(o,p),u=n.add(c,u),c=n.sub(d,u),u=n.add(d,u),u=n.mul(c,u),c=n.mul(g,c),l=n.mul(o,l),p=n.mul(e,p),g=n.sub(h,p),g=n.mul(e,g),g=n.add(g,l),l=n.add(h,h),h=n.add(l,h),h=n.add(h,p),h=n.mul(h,g),u=n.add(u,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,g),c=n.sub(c,h),l=n.mul(p,d),l=n.add(l,l),l=n.add(l,l),new m(c,u,l)}add(e){p(e);const{px:r,py:o,pz:i}=this,{px:s,py:a,pz:c}=e;let u=n.ZERO,l=n.ZERO,h=n.ZERO;const d=t.a,g=n.mul(t.b,f);let y=n.mul(r,s),w=n.mul(o,a),v=n.mul(i,c),b=n.add(r,o),A=n.add(s,a);b=n.mul(b,A),A=n.add(y,w),b=n.sub(b,A),A=n.add(r,i);let k=n.add(s,c);return A=n.mul(A,k),k=n.add(y,v),A=n.sub(A,k),k=n.add(o,i),u=n.add(a,c),k=n.mul(k,u),u=n.add(w,v),k=n.sub(k,u),h=n.mul(d,A),u=n.mul(g,v),h=n.add(u,h),u=n.sub(w,h),h=n.add(w,h),l=n.mul(u,h),w=n.add(y,y),w=n.add(w,y),v=n.mul(d,v),A=n.mul(g,A),w=n.add(w,v),v=n.sub(y,v),v=n.mul(d,v),A=n.add(A,v),y=n.mul(w,A),l=n.add(l,y),y=n.mul(k,A),u=n.mul(b,u),u=n.sub(u,y),y=n.mul(b,w),h=n.mul(k,h),h=n.add(h,y),new m(u,l,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(m.ZERO)}wNAF(e){return v.wNAFCached(this,e,m.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:o}=t;i.aK("scalar",e,h,o);const s=m.ZERO;if(e===h)return s;if(this.is0()||e===d)return this;if(!r||v.hasPrecomputes(this))return v.wNAFCachedUnsafe(this,e,m.normalizeZ);let{k1neg:a,k1:c,k2neg:u,k2:l}=r.splitScalar(e),f=s,p=s,g=this;for(;c>h||l>h;)c&d&&(f=f.add(g)),l&d&&(p=p.add(g)),g=g.double(),c>>=d,l>>=d;return a&&(f=f.negate()),u&&(p=p.negate()),p=new m(n.mul(p.px,r.beta),p.py,p.pz),f.add(p)}multiply(e){const{endo:r,n:o}=t;let s,a;if(i.aK("scalar",e,d,o),r){const{k1neg:t,k1:o,k2neg:i,k2:c}=r.splitScalar(e);let{p:u,f:l}=this.wNAF(o),{p:h,f:d}=this.wNAF(c);u=v.constTimeNegate(t,u),h=v.constTimeNegate(i,h),h=new m(n.mul(h.px,r.beta),h.py,h.pz),s=u.add(h),a=l.add(d)}else{const{p:t,f:n}=this.wNAF(e);s=t,a=n}return m.normalizeZ([s,a])[0]}multiplyAndAddUnsafe(e,t,n){const r=m.BASE,o=(e,t)=>t!==h&&t!==d&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,n));return i.is0()?void 0:i}toAffine(e){return g(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===d)return!0;if(n)return n(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===d?this:n?n(m,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return(0,i.e8)("isCompressed",e),this.assertValidity(),a(m,this,e)}toHex(e=!0){return(0,i.e8)("isCompressed",e),i.My(this.toRawBytes(e))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const w=t.nBitLength,v=(0,r.hT)(m,t.endo?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:function(e){return i.r4(e,d,t.n)}}}({...t,toBytes(e,t,r){const o=t.toAffine(),s=n.toBytes(o.x),a=i.Id;return(0,i.e8)("isCompressed",r),r?a(Uint8Array.from([t.hasEvenY()?2:3]),s):a(Uint8Array.from([4]),s,n.toBytes(o.y))},fromBytes(e){const t=e.length,r=e[0],o=e.subarray(1);if(t!==c||2!==r&&3!==r){if(t===u&&4===r)return{x:n.fromBytes(o.subarray(0,n.BYTES)),y:n.fromBytes(o.subarray(n.BYTES,2*n.BYTES))};throw new Error("invalid Point, expected length of "+c+", or uncompressed "+u+", got "+t)}{const e=i.Ph(o);if(!i.r4(e,d,n.ORDER))throw new Error("Point is not on curve");const t=w(e);let s;try{s=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~r)!=((s&d)===d)&&(s=n.neg(s)),{x:e,y:s}}}}),b=e=>i.My(i.lq(e,t.nByteLength));function A(e){return e>a>>d}const k=(e,t,n)=>i.Ph(e.slice(t,n));class _{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=(0,i.qj)("compactSignature",e,2*n),new _(k(e,0,n),k(e,n,2*n))}static fromDER(e){const{r:t,s:n}=l.toSig((0,i.qj)("DER",e));return new _(t,n)}assertValidity(){i.aK("r",this.r,d,a),i.aK("s",this.s,d,a)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){const{r,s:o,recovery:s}=this,a=I((0,i.qj)("msgHash",e));if(null==s||![0,1,2,3].includes(s))throw new Error("recovery id invalid");const c=2===s||3===s?r+t.n:r;if(c>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const u=1&s?"03":"02",l=y.fromHex(u+b(c)),h=g(c),d=p(-a*h),f=p(o*h),m=y.BASE.multiplyAndAddUnsafe(l,d,f);
1if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return A(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,p(-this.s),this.recovery):this}toDERRawBytes(){return i.aT(this.toDERHex())}toDERHex(){return l.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return i.aT(this.toCompactHex())}toCompactHex(){return b(this.r)+b(this.s)}}const S={isValidPrivateKey(e){try{return m(e),!0}catch(e){return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const e=(0,o.Tp)(t.n);return(0,o.qy)(t.randomBytes(e),t.n)},precompute:(e=8,t=y.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function E(e){const t=i.aY(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===c||r===u:n?r===2*c||r===2*u:e instanceof y}const T=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const n=i.Ph(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},I=t.bits2int_modN||function(e){return p(T(e))},M=i.OG(t.nBitLength);function R(e){return i.aK("num < 2^"+t.nBitLength,e,h,M),i.lq(e,t.nByteLength)}const x={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};return y.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return y.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(E(e))throw new Error("first arg must be private key");if(!E(t))throw new Error("second arg must be public key");return y.fromHex(t).multiply(m(e)).toRawBytes(n)},sign:function(e,r,o=x){const{seed:a,k2sig:c}=function(e,r,o=x){if(["recovered","canonical"].some((e=>e in o)))throw new Error("sign() legacy options not supported");const{hash:a,randomBytes:c}=t;let{lowS:u,prehash:l,extraEntropy:f}=o;null==u&&(u=!0),e=(0,i.qj)("msgHash",e),s(o),l&&(e=(0,i.qj)("prehashed msgHash",a(e)));const w=I(e),b=m(r),k=[R(b),R(w)];if(null!=f&&!1!==f){const e=!0===f?c(n.BYTES):f;k.push((0,i.qj)("extraEntropy",e))}const S=i.Id(...k),E=w;return{seed:S,k2sig:function(e){const t=T(e);if(!v(t))return;const n=g(t),r=y.BASE.multiply(t).toAffine(),o=p(r.x);if(o===h)return;const i=p(n*p(E+o*b));if(i===h)return;let s=(r.x===o?0:2)|Number(r.y&d),a=i;return u&&A(i)&&(a=function(e){return A(e)?p(-e):e}(i),s^=1),new _(o,a,s)}}}(e,r,o),u=t;return i.fg(u.hash.outputLen,u.nByteLength,u.hmac)(a,c)},verify:function(e,n,r,o=C){const a=e;n=(0,i.qj)("msgHash",n),r=(0,i.qj)("publicKey",r);const{lowS:c,prehash:u,format:h}=o;if(s(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==h&&"compact"!==h&&"der"!==h)throw new Error("format must be compact or der");const d="string"==typeof a||i.aY(a),f=!d&&!h&&"object"==typeof a&&null!==a&&"bigint"==typeof a.r&&"bigint"==typeof a.s;if(!d&&!f)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let m,w;try{if(f&&(m=new _(a.r,a.s)),d){try{"compact"!==h&&(m=_.fromDER(a))}catch(e){if(!(e instanceof l.Err))throw e}m||"der"===h||(m=_.fromCompact(a))}w=y.fromHex(r)}catch(e){return!1}if(!m)return!1;if(c&&m.hasHighS())return!1;u&&(n=t.hash(n));const{r:v,s:b}=m,A=I(n),k=g(b),S=p(A*k),E=p(v*k),T=y.BASE.multiplyAndAddUnsafe(w,S,E)?.toAffine();return!!T&&p(T.x)===v},ProjectivePoint:y,Signature:_,utils:S}}BigInt(4)},6216:(e,t,n)=>{"use strict";n.d(t,{ev:()=>m});var r=n(4443),o=n(4976),i=n(8888),s=n(8030);const a=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),c=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=(BigInt(0),BigInt(1)),l=BigInt(2),h=(BigInt(3),BigInt(5)),d=BigInt(8);function f(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function p(e,t){const n=a,r=(0,s.zi)(t*t*t,n),o=function(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),i=a,c=e*e%i*e%i,d=(0,s.zH)(c,l,i)*c%i,f=(0,s.zH)(d,u,i)*e%i,p=(0,s.zH)(f,h,i)*f%i,g=(0,s.zH)(p,t,i)*p%i,y=(0,s.zH)(g,n,i)*g%i,m=(0,s.zH)(y,r,i)*y%i,w=(0,s.zH)(m,o,i)*m%i,v=(0,s.zH)(w,o,i)*m%i,b=(0,s.zH)(v,t,i)*p%i;return{pow_p_5_8:(0,s.zH)(b,l,i)*e%i,b2:c}}(e*(0,s.zi)(r*r*t,n)).pow_p_5_8;let i=(0,s.zi)(e*r*o,n);const d=(0,s.zi)(t*i*i,n),f=i,p=(0,s.zi)(i*c,n),g=d===e,y=d===(0,s.zi)(-e,n),m=d===(0,s.zi)(-e*c,n);return g&&(i=f),(y||m)&&(i=p),(0,s.dQ)(i,n)&&(i=(0,s.zi)(-i,n)),{isValid:g||y,value:i}}const g=(()=>(0,s.D0)(a,void 0,!0))(),y=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:g,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:d,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:r.Zf,randomBytes:o.po,adjustScalarBytes:f,uvRatio:p}))(),m=(()=>(0,i.n)(y))()}
1,4329:(e,t,n)=>{"use strict";n.d(t,{bI:()=>d});var r=n(8226),o=n(7333),i=n(8030);const s=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),a=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),c=BigInt(1),u=BigInt(2),l=(e,t)=>(e+t/u)/t;const h=(0,i.D0)(s,void 0,void 0,{sqrt:function(e){const t=s,n=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),c=BigInt(23),l=BigInt(44),d=BigInt(88),f=e*e*e%t,p=f*f*e%t,g=(0,i.zH)(p,n,t)*p%t,y=(0,i.zH)(g,n,t)*p%t,m=(0,i.zH)(y,u,t)*f%t,w=(0,i.zH)(m,o,t)*m%t,v=(0,i.zH)(w,a,t)*w%t,b=(0,i.zH)(v,l,t)*v%t,A=(0,i.zH)(b,d,t)*b%t,k=(0,i.zH)(A,l,t)*v%t,_=(0,i.zH)(k,n,t)*p%t,S=(0,i.zH)(_,c,t)*w%t,E=(0,i.zH)(S,r,t)*f%t,T=(0,i.zH)(E,u,t);if(!h.eql(h.sqr(T),e))throw new Error("Cannot find square root");return T}}),d=(0,o.s)({a:BigInt(0),b:BigInt(7),Fp:h,n:a,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=a,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-c*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,u=BigInt("0x100000000000000000000000000000000"),h=l(s*e,t),d=l(-r*e,t);let f=(0,i.zi)(e-h*n-d*o,t),p=(0,i.zi)(-h*r-d*s,t);const g=f>u,y=p>u;if(g&&(f=t-f),y&&(p=t-p),f>u||p>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:g,k1:f,k2neg:y,k2:p}}}},r.sc);BigInt(0),d.ProjectivePoint},9190:(e,t,n)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function o(e,...t){if(!((n=e)instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){o(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}n.d(t,{CC:()=>s,DO:()=>o,Fe:()=>r,Ht:()=>a,sd:()=>i})},6013:(e,t,n)=>{"use strict";n.d(t,{TQ:()=>s,ol:()=>a,r9:()=>i});var r=n(9190),o=n(4976);function i(e,t,n){return e&t^~e&n}function s(e,t,n){return e&t^e&n^t&n}class a extends o.Vw{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,o.O8)(this.buffer)}update(e){(0,r.CC)(this);const{view:t,buffer:n,blockLen:i}=this,s=(e=(0,o.ZJ)(e)).length;for(let r=0;r<s;){const a=Math.min(i-this.pos,s-r);if(a!==i)n.set(e.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===i&&(this.process(t,0),this.pos=0);else{const t=(0,o.O8)(e);for(;i<=s-r;r+=i)this.process(t,r)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,r.CC)(this),(0,r.Ht)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:i,isLE:s}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(n,0),a=0);for(let e=a;e<i;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,i-8,BigInt(8*this.length),s),this.process(n,0);const c=(0,o.O8)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,h[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:o,destroyed:i,pos:s}=this;return e.length=r,e.pos=s,e.finished=o,e.destroyed=i,r%t&&e.buffer.set(n),e}}},9271:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>h,B4:()=>c,P5:()=>a,WM:()=>u,im:()=>l,lD:()=>s});const r=BigInt(2**32-1),o=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>o&r)}:{h:0|Number(e>>o&r),l:0|Number(e&r)}}
1function s(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:a}=i(e[o],t);[n[o],r[o]]=[s,a]}return[n,r]}const a=(e,t,n)=>e<<n|t>>>32-n,c=(e,t,n)=>t<<n|e>>>32-n,u=(e,t,n)=>t<<n-32|e>>>64-n,l=(e,t,n)=>e<<n-32|t>>>64-n,h={fromBig:i,split:s,toBig:(e,t)=>BigInt(e>>>0)<<o|BigInt(t>>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:a,rotlSL:c,rotlBH:u,rotlBL:l,add:function(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)}},8160:(e,t,n)=>{"use strict";n.d(t,{E:()=>r});const r="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},1454:(e,t,n)=>{"use strict";n.d(t,{w:()=>s});var r=n(9190),o=n(4976);class i extends o.Vw{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,r.sd)(e);const n=(0,o.ZJ)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),s.fill(0)}update(e){return(0,r.CC)(this),this.iHash.update(e),this}digestInto(e){(0,r.CC)(this),(0,r.DO)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:o,blockLen:i,outputLen:s}=this;return e.finished=r,e.destroyed=o,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const s=(e,t,n)=>new i(e,t).update(n).digest();s.create=(e,t)=>new i(e,t)},8226:(e,t,n)=>{"use strict";n.d(t,{sc:()=>u});var r=n(6013),o=n(4976);const i=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class c extends r.ol{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)a[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=a[e-15],n=a[e-2],r=(0,o.Ow)(t,7)^(0,o.Ow)(t,18)^t>>>3,i=(0,o.Ow)(n,17)^(0,o.Ow)(n,19)^n>>>10;a[e]=i+a[e-7]+r+a[e-16]|0}let{A:n,B:s,C:c,D:u,E:l,F:h,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,o.Ow)(l,6)^(0,o.Ow)(l,11)^(0,o.Ow)(l,25))+(0,r.r9)(l,h,d)+i[e]+a[e]|0,p=((0,o.Ow)(n,2)^(0,o.Ow)(n,13)^(0,o.Ow)(n,22))+(0,r.TQ)(n,s,c)|0;f=d,d=h,h=l,l=u+t|0,u=c,c=s,s=n,n=t+p|0}n=n+this.A|0,s=s+this.B|0,c=c+this.C|0,u=u+this.D|0,l=l+this.E|0,h=h+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(n,s,c,u,l,h,d,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const u=(0,o.ld)((()=>new c))}
1,7238:(e,t,n)=>{"use strict";n.d(t,{lY:()=>b});var r=n(9190),o=n(9271),i=n(4976);const s=[],a=[],c=[],u=BigInt(0),l=BigInt(1),h=BigInt(2),d=BigInt(7),f=BigInt(256),p=BigInt(113);for(let e=0,t=l,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],s.push(2*(5*r+n)),a.push((e+1)*(e+2)/2%64);let o=u;for(let e=0;e<7;e++)t=(t<<l^(t>>d)*p)%f,t&h&&(o^=l<<(l<<BigInt(e))-l);c.push(o)}const[g,y]=(0,o.lD)(c,!0),m=(e,t,n)=>n>32?(0,o.WM)(e,t,n):(0,o.P5)(e,t,n),w=(e,t,n)=>n>32?(0,o.im)(e,t,n):(0,o.B4)(e,t,n);class v extends i.Vw{constructor(e,t,n,o=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,r.Fe)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,i.DH)(this.state)}keccak(){i.qv||(0,i.Fc)(this.state32),function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,o=(t+2)%10,i=n[o],s=n[o+1],a=m(i,s,1)^n[r],c=w(i,s,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=c}let t=e[2],o=e[3];for(let n=0;n<24;n++){const r=a[n],i=m(t,o,r),c=w(t,o,r),u=s[n];t=e[u],o=e[u+1],e[u]=i,e[u+1]=c}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=g[r],e[1]^=y[r]}n.fill(0)}(this.state32,this.rounds),i.qv||(0,i.Fc)(this.state32),this.posOut=0,this.pos=0}update(e){(0,r.CC)(this);const{blockLen:t,state:n}=this,o=(e=(0,i.ZJ)(e)).length;for(let r=0;r<o;){const i=Math.min(t-this.pos,o-r);for(let t=0;t<i;t++)n[this.pos++]^=e[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,128&t&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){(0,r.CC)(this,!1),(0,r.DO)(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,o=e.length;r<o;){this.posOut>=n&&this.keccak();const i=Math.min(n-this.posOut,o-r);e.set(t.subarray(this.posOut,this.posOut+i),r),this.posOut+=i,r+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,r.Fe)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,r.Ht)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:o,enableXOF:i}=this;return e||(e=new v(t,n,r,i,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=r,e.enableXOF=i,e.destroyed=this.destroyed,e}}const b=((e,t,n)=>(0,i.ld)((()=>new v(t,e,n))))(1,136,32)},4443:(e,t,n)=>{"use strict";n.d(t,{Zf:()=>h});var r=n(6013),o=n(9271),i=n(4976);const[s,a]=(()=>o.Ay.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),c=new Uint32Array(80),u=new Uint32Array(80);class l extends r.ol{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,n,r,o,i,s,a,c,u,l,h,d,f,p,g]}set(e,t,n,r,o,i,s,a,c,u,l,h,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)c[n]=e.getUint32(t),u[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|c[e-15],n=0|u[e-15],r=o.Ay.rotrSH(t,n,1)^o.Ay.rotrSH(t,n,8)^o.Ay.shrSH(t,n,7),i=o.Ay.rotrSL(t,n,1)^o.Ay.rotrSL(t,n,8)^o.Ay.shrSL(t,n,7),s=0|c[e-2],a=0|u[e-2],l=o.Ay.rotrSH(s,a,19)^o.Ay.rotrBH(s,a,61)^o.Ay.shrSH(s,a,6),h=o.Ay.rotrSL(s,a,19)^o.Ay.rotrBL(s,a,61)^o.Ay.shrSL(s,a,6),d=o.Ay.add4L(i,h,u[e-7],u[e-16]),f=o.Ay.add4H(d,r,l,c[e-7],c[e-16]);c[e]=0|f,u[e]=0|d}let{Ah:n,Al:r,Bh:i,Bl:l,Ch:h,Cl:d,Dh:f,Dl:p,Eh:g,El:y,Fh:m,Fl:w,Gh:v,Gl:b,Hh:A,Hl:k}=this;for(let e=0;e<80;e++){const t=o.Ay.rotrSH(g,y,14)^o.Ay.rotrSH(g,y,18)^o.Ay.rotrBH(g,y,41),_=o.Ay.rotrSL(g,y,14)^o.Ay.rotrSL(g,y,18)^o.Ay.rotrBL(g,y,41),S=g&m^~g&v,E=y&w^~y&b,T=o.Ay.add5L(k,_,E,a[e],u[e]),I=o.Ay.add5H(T,A,t,S,s[e],c[e]),M=0|T,R=o.Ay.rotrSH(n,r,28)^o.Ay.rotrBH(n,r,34)^o.Ay.rotrBH(n,r,39),x=o.Ay.rotrSL(n,r,28)^o.Ay.rotrBL(n,r,34)^o.Ay.rotrBL(n,r,39),C=n&i^n&h^i&h,O=r&l^r&d^l&d;A=0|v,k=0|b,v=0|m,b=0|w,m=0|g,w=0|y,({h:g,l:y}=o.Ay.add(0|f,0|p,0|I,0|M)),f=0|h,p=0|d,h=0|i,d=0|l,i=0|n,l=0|r;const P=o.Ay.add3L(M,x,O);n=o.Ay.add3H(P,I,R,C),r=0|P}({h:n,l:r}=o.Ay.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l}=o.Ay.add(0|this.Bh,0|this.Bl,0|i,0|l)),({h,l:d}=o.Ay.add(0|this.Ch,0|this.Cl,0|h,0|d)),({h:f,l:p}=o.Ay.add(0|this.Dh,0|this.Dl,0|f,0|p)),({h:g,l:y}=o.Ay.add(0|this.Eh,0|this.El,0|g,0|y)),({h:m,l:w}=o.Ay.add(0|this.Fh,0|this.Fl,0|m,0|w)),({h:v,l:b}=o.Ay.add(0|this.Gh,0|this.Gl,0|v,0|b)),({h:A,l:k}=o.Ay.add(0|this.Hh,0|this.Hl,0|A,0|k)),this.set(n,r,i,l,h,d,f,p,g,y,m,w,v,b,A,k)}roundClean(){c.fill(0),u.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const h=(0,i.ld)((()=>new l))},4976:(e,t,n)=>{"use strict";n.d(t,{DH:()=>i,Fc:()=>u,Id:()=>h,O8:()=>s,Ow:()=>a,Vw:()=>d,ZJ:()=>l,ld:()=>f,po:()=>p,qv:()=>c});var r=n(8160),o=n(9190);function i(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function s(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function a(e,t){return e<<32-t|e>>>t}const c=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function u(e){for(let n=0;n<e.length;n++)e[n]=(t=e[n])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function l(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),(0,o.DO)(e),e}function h(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];(0,o.DO)(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const o=e[t];n.set(o,r),r+=o.length}return n}class d{clone(){return this._cloneInto()}}function f(e){const t=t=>e().update(l(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function p(e=32){if(r.E&&"function"==typeof r.E.getRandomValues)return r.E.getRandomValues(new Uint8Array(e));if(r.E&&"function"==typeof r.E.randomBytes)return r.E.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}},2524:(e,t,n)=>{"use strict";n.d(t,{R:()=>r});const r="solana:signAndSendTransaction"},2694:(e,t,n)=>{"use strict";n.d(t,{F:()=>r});const r="solana:signMessage"}
1,3149:(e,t,n)=>{"use strict";n.d(t,{q:()=>r});const r="solana:signTransaction"},7460:(e,t,n)=>{"use strict";n.d(t,{kb:()=>s,vE:()=>c});var r=n(7789),o=n(2236),i=class extends o.b{socket;constructor(e,t,n){super(),this.socket=new window.WebSocket(e,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,n){const r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,n){this.socket.addEventListener(e,t,n)}};function s(e,t){return new i(e,t)}var a=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},c=class extends o.b{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:n=!0,reconnect:r=!0,reconnect_interval:o=1e3,max_reconnects:i=5,...s}={},c,u){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=n,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=o,this.max_reconnects=i,this.rest_options=s,this.current_reconnects=0,this.generate_request_id=c||(()=>++this.rpc_id),this.dataPack=u||new a,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,n,r){return r||"object"!=typeof n||(r=n,n=null),new Promise(((o,i)=>{if(!this.ready)return i(new Error("socket not ready"));const s=this.generate_request_id(e,t),a={jsonrpc:"2.0",method:e,params:t||void 0,id:s};this.socket.send(this.dataPack.encode(a),r,(e=>{if(e)return i(e);this.queue[s]={promise:[o,i]},n&&(this.queue[s].timeout=setTimeout((()=>{delete this.queue[s],i(new Error("reply timeout"))}),n))}))}))}async login(e){const t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise(((n,r)=>{if(!this.ready)return r(new Error("socket not ready"));const o={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(o),(e=>{if(e)return r(e);n()}))}))}async subscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:e})=>{e instanceof ArrayBuffer&&(e=r.hp.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let n=0;n<e.params.length;n++)t.push(e.params[n]);return Promise.resolve().then((()=>{this.emit.apply(this,t)}))}if(!this.queue[e.id])return e.method?Promise.resolve().then((()=>{this.emit(e.method,e?.params)})):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]})),this.socket.addEventListener("error",(e=>
1this.emit("error",e))),this.socket.addEventListener("close",(({code:n,reason:r})=>{this.ready&&setTimeout((()=>this.emit("close",n,r)),0),this.ready=!1,this.socket=void 0,1e3!==n&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)&&(this.reconnect_timer_id=setTimeout((()=>this._connect(e,t)),this.reconnect_interval)))}))}}},2236:(e,t,n)=>{"use strict";n.d(t,{b:()=>r});var r=n(3678)},2150:(e,t,n)=>{"use strict";n.d(t,{KC:()=>M,KJ:()=>v,L5:()=>R,NW:()=>I,PV:()=>T,YO:()=>m,Yj:()=>E,ai:()=>k,au:()=>x,bz:()=>y,eu:()=>b,g1:()=>S,lq:()=>_,me:()=>A,vA:()=>h,vt:()=>d,zM:()=>w});class r extends TypeError{constructor(e,t){let n;const{message:r,explanation:o,...i}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(o??a),null!=o&&(this.cause=a),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function o(e){return"object"==typeof e&&null!=e}function i(e){return o(e)&&!Array.isArray(e)}function s(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function a(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=n,{refinement:c,message:u=`Expected a value of type \`${a}\`${c?` with refinement \`${c}\``:""}, but received: \`${s(r)}\``}=e;return{value:r,type:a,refinement:c,key:o[o.length-1],path:o,branch:i,...e,message:u}}function*c(e,t,n,r){var i;o(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const o of e){const e=a(o,t,n,r);e&&(yield e)}}function*u(e,t,n={}){const{path:r=[],branch:i=[e],coerce:s=!1,mask:a=!1}=n,c={path:r,branch:i,mask:a};s&&(e=t.coercer(e,c));let l="valid";for(const r of t.validator(e,c))r.explanation=n.message,l="not_valid",yield[r,void 0];for(let[h,d,f]of t.entries(e,c)){const t=u(d,f,{path:void 0===h?r:[...r,h],branch:void 0===h?i:[...i,d],c
1oerce:s,mask:a,message:n.message});for(const n of t)n[0]?(l=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):s&&(d=n[1],void 0===h?e=d:e instanceof Map?e.set(h,d):e instanceof Set?e.add(d):o(e)&&(void 0!==d||h in e)&&(e[h]=d))}if("not_valid"!==l)for(const r of t.refiner(e,c))r.explanation=n.message,l="not_refined",yield[r,void 0];"valid"===l&&(yield[void 0,e])}class l{constructor(e){const{type:t,schema:n,validator:r,refiner:o,coercer:i=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=i,this.validator=r?(e,t)=>c(r(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>c(o(e,t),t,this,e):()=>[]}assert(e,t){return h(e,this,t)}create(e,t){return d(e,this,t)}is(e){return f(e,this)}mask(e,t){return function(e,t,n){const r=p(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return p(e,this,t)}}function h(e,t,n){const r=p(e,t,{message:n});if(r[0])throw r[0]}function d(e,t,n){const r=p(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function f(e,t){return!p(e,t)[0]}function p(e,t,n={}){const o=u(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(o);return i[0]?[new r(i[0],(function*(){for(const e of o)e[0]&&(yield e[0])})),void 0]:[void 0,i[1]]}function g(e,t){return new l({type:e,schema:null,validator:t})}function y(){return g("any",(()=>!0))}function m(e){return new l({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${s(e)}`})}function w(){return g("boolean",(e=>"boolean"==typeof e))}function v(e){return g("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${s(t)}`))}function b(e){const t=s(e),n=typeof e;return new l({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${s(n)}`})}function A(e){return new l({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function k(){return g("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${s(e)}`))}function _(e){return new l({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function S(e,t){return new l({type:"record",schema:null,*entries(n){if(o(n))for(const r in n){const o=n[r];yield[r,r,e],yield[r,o,t]}},validator:e=>i(e)||`Expected an object, but received: ${s(e)}`,coercer:e=>i(e)?{...e}:e})}function E(){return g("string",(e=>"string"==typeof e||`Expected a string, but received: ${s(e)}`))}function T(e){const t=g("never",(()=>!1));return new l({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let o=0;o<r;o++)yield[o,n[o],e[o]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${s(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function I(e){const t=Object.keys(e);return new l({type:"type",schema:e,*entries(n){if(o(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>i(e)||`Expected an object, but received: ${s(e)}`,coercer:e=>i(e)?{...e}:e})}function M(e){const t=e.map((e=>e.type)).join(" | ");return new l({type:"union",schema:null,coercer(t,n){for(const r of e){const[e,o]=r.validate(t,{coerce:!0,mask:n.mask});if(!e)return o}return t},validator(n,r){const o=[];for(const t of e){const[...e]=u(n,t,r),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${s(n)}`,...o]}})}function R(){return g("unknown",(()=>!0))}function x(e,t,n){return new l({...e,coercer:(r,o)=>f(r,t)?e.coercer(n(r,o),o):e.coercer(r,o)})}}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={id:e,loaded:!1,exports:{}};return n[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=n,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>e+".js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}
vendor: 4,292 bytes, line 1
1}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="pumpkin-pool-core:",o.l=(n,r,i,s)=>{if(e[n])e[n].push(r);else{var a,c;if(void 0!==i)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==n||h.getAttribute("data-webpack")==t+i){a=h;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",t+i),a.src=n),e[n]=[r];var d=(t,r)=>{a.onerror=a.onload=null,clearTimeout(f);var o=e[n];if(delete e[n],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),t)return t(r)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e+"../../../"})(),(()=>{var e={627:0,853:0};o.f.j=(t,n)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=i);var s=o.p+o.u(t),a=new Error;o.l(s,(n=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",a.name="ChunkLoadError",a.type=i,a.request=s,r[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var r,i,[s,a,c]=n,u=0;if(s.some((t=>0!==e[t]))){for(r in a)o.o(a,r)&&(o.m[r]=a[r]);c&&c(o)}for(t&&t(n);u<s.length;u++)i=s[u],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=globalThis.webpackChunkpumpkin_pool_core=globalThis.webpackChunkpumpkin_pool_core||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(()=>{"use strict";var e=o(2643);const t=window.wp.element,n=(0,t.forwardRef)((function({icon:e,size:n=24,...r},o){return(0,t.cloneElement)(e,{width:n,height:n,...r,ref:o})})),r=window.wp.primitives,i=window.ReactJSXRuntime,s=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.Path,{d:"m3 12 1 8h1.5l-1-8H3Zm15.8-2h-4.4l.8-3.6c.3-1.3-.7-2.4-1.9-2.4h-.2c-.6 0-1.2.3-1.6.8l-5 6.6c-.3.4-.4.8-.4 1.2v.2l.7 5.4v.2c.2.9 1 1.5 1.9 1.5h8.2c.9 0 1.7-.6 1.9-1.4l1.8-6c.4-1.3-.6-2.6-1.9-2.6Zm.5 2.1-1.8 6c0 .2-.3.4-.5.4H8.8c-.3 0-.5-.2-.5-.4l-.7-5.4v-.4l5-6.6c0-.1.2-.2.4-.2h.2c.3 0 .6.3.5.6l-.8 3.6c-.1.4 0 .9.3 1.3s.7.6 1.2.6h4.4c.3 0 .6.3.5.6Z"})}),a=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.Path,{d:"M19.8 4h-1.5l1 8h1.5l-1-8ZM17 5.8c-.1-1-1-1.8-2-1.8H6.8c-.9 0-1.7.6-1.9 1.4l-1.8 6C2.7 12.7 3.7 14 5 14h4.4l-.8 3.6c-.3 1.3.7 2.4 1.9 2.4h.2c.6 0 1.2-.3 1.6-.8l5-6.6c.3-.4.5-.9.4-1.5L17 5.7Zm-.9 5.9-5 6.6c0 .1-.2.2-.4.2h-.2c-.3 0-.6-.3-.5-.6l.8-3.6c.1-.4 0-.9-.3-1.3s-.7-.6-1.2-.6H4.9c-.3 0-.6-.3-.5-.6l1.8-6c0-.2.3-.4.5-.4h8.2c.3 0 .5.2.5.4l.7 5.4v.4Z"})}),c=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.Path,{d:"M2 12C2 6.44444 6.44444 2 12 2C17.5556 2 22 6.44444 22 12C22 17.5556 17.5556 22 12 22C6.44444 22 2 17.5556 2 12ZM13 11V7H11V11H7V13H11V17H13V13H17V11H13Z"})}),u=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,i.jsx)(r.Path,{d:"M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"})}),l=(0,i.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(r.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),h=window.React,d=[],f={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){p("call","select")}
1,connect:()=>Promise.reject(p("call","connect")),disconnect:()=>Promise.reject(p("call","disconnect")),sendTransaction:()=>Promise.reject(p("call","sendTransaction")),signTransaction:()=>Promise.reject(p("call","signTransaction")),signAllTransactions:()=>Promise.reject(p("call","signAllTransactions")),signMessage:()=>Promise.reject(p("call","signMessage")),signIn:()=>Promise.reject(p("call","signIn"))};function p(e,t){const n=new Error(`You have tried to ${e} "${t}" on a WalletContext without providing one. Make sure to render a WalletProvider as an ancestor of the component that uses WalletContext.`);return console.error(n),n}Object.defineProperty(f,"wallets",{get:()=>(p("read","wallets"),d)}),Object.defineProperty(f,"wallet",{get:()=>(p("read","wallet"),null)}),Object.defineProperty(f,"publicKey",{get:()=>(p("read","publicKey"),null)});const g=(0,h.createContext)(f);function y(){return(0,h.useContext)(g)}const m=(0,h.createContext)({});function w(){return(0,h.useContext)(m)}var v=o(2432),b=o(3541),A=o(2204);const k=({children:t,endpoint:n,config:r={commitment:"confirmed"}})=>{const o=(0,h.useMemo)((()=>new e.Connection(n,r)),[n,r]);return h.createElement(m.Provider,{value:{connection:o}},t)};var _,S,E=o(228);class T extends Error{constructor(e,t){super(e),this.error=t}}class I extends T{constructor(){super(...arguments),this.name="WalletNotReadyError"}}class M extends T{constructor(){super(...arguments),this.name="WalletLoadError"}}class R extends T{constructor(){super(...arguments),this.name="WalletConfigError"}}class x extends T{constructor(){super(...arguments),this.name="WalletConnectionError"}}class C extends T{constructor(){super(...arguments),this.name="WalletDisconnectedError"}}class O extends T{constructor(){super(...arguments),this.name="WalletDisconnectionError"}}class P extends T{constructor(){super(...arguments),this.name="WalletAccountError"}}class N extends T{constructor(){super(...arguments),this.name="WalletPublicKeyError"}}class B extends T{constructor(){super(...arguments),this.name="WalletNotConnectedError"}}class V extends T{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class L extends T{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class D extends T{constructor(){super(...arguments),this.name="WalletSignMessageError"}}class j extends T{constructor(){super(...arguments),this.name="WalletSignInError"}}(S=_||(_={})).Installed="Installed",S.NotDetected="NotDetected",S.Loadable="Loadable",S.Unsupported="Unsupported";class U extends E{get connected(){return!!this.publicKey}async autoConnect(){await this.connect()}async prepareTransaction(e,t,n={}){const r=this.publicKey;if(!r)throw new B;return e.feePayer=e.feePayer||r,e.recentBlockhash=e.recentBlockhash||(await t.getLatestBlockhash({commitment:n.preflightCommitment,minContextSlot:n.minContextSlot})).blockhash,e}}function W(e){if("undefined"==typeof window||"undefined"==typeof document)return;const t=[];function n(){if(e())for(const e of t)e()}const r=setInterval(n,1e3);t.push((()=>clearInterval(r))),"loading"===document.readyState&&(document.addEventListener("DOMContentLoaded",n,{once:!0}),t.push((()=>document.removeEventListener("DOMContentLoaded",n)))),"complete"!==document.readyState&&(window.addEventListener("load",n,{once:!0}),t.push((()=>window.removeEventListener("load",n)))),n()}function z(){if(!navigator)return!1;const e=navigator.userAgent.toLowerCase(),t=e.includes("iphone")||e.includes("ipad"),n=e.includes("safari");return t&&n}function G(e){return"version"in e}class K extends U{async sendTransaction(e,t,n={}){let r=!0;try{if(G(e)){if(!this.supportedTransactionVersions)throw new V("Sending versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(e.version))throw new V(`Sending transaction version ${e.version} isn't supported by this wallet`);try{const r=(e=await this.signTransaction(e)).serialize();return await t.sendRawTransaction(r,n)}catch(e){if(e instanceof L)throw r=!1,e;throw new V(e?.message,e)}}else try{const{signers:r,...o}=n;e=await this.prepareTransaction(e,t,o),r?.length&&e.partialSign(...r);const i=(e=await this.signTransaction(e)).serialize();return await t.sendRawTransaction(i,o)}catch(e){if(e instanceof L)throw r=!1,e;throw new V(e?.message,e)}}
1catch(e){throw r&&this.emit("error",e),e}}async signAllTransactions(e){for(const t of e)if(G(t)){if(!this.supportedTransactionVersions)throw new L("Signing versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(t.version))throw new L(`Signing transaction version ${t.version} isn't supported by this wallet`)}const t=[];for(const n of e)t.push(await this.signTransaction(n));return t}}class F extends K{}class q extends F{}new RegExp("^(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n(?<address>[^\\n]+)(?:\\n|$)(?:\\n(?<statement>[\\S\\s]*?)(?:\\n|$))??(?:\\nURI: (?<uri>[^\\n]+))?(?:\\nVersion: (?<version>[^\\n]+))?(?:\\nChain ID: (?<chainId>[^\\n]+))?(?:\\nNonce: (?<nonce>[^\\n]+))?(?:\\nIssued At: (?<issuedAt>[^\\n]+))?(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?(?:\\nNot Before: (?<notBefore>[^\\n]+))?(?:\\nRequest ID: (?<requestId>[^\\n]+))?(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?\\n*$");const H="ERROR_FORBIDDEN_WALLET_BASE_URL";class Y extends Error{constructor(...e){const[t,n,r]=e;super(n),this.code=t,this.data=r,this.name="SolanaMobileWalletAdapterError"}}class $ extends Error{constructor(...e){const[t,n,r,o]=e;super(r),this.code=n,this.data=o,this.jsonRpcMessageId=t,this.name="SolanaMobileWalletAdapterProtocolError"}}function Z(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function Q(e,t){return Z(this,void 0,void 0,(function*(){const n=yield crypto.subtle.exportKey("raw",e),r=yield crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,n),o=new Uint8Array(n.byteLength+r.byteLength);return o.set(new Uint8Array(n),0),o.set(new Uint8Array(r),n.byteLength),o}))}const J="solana:cloneAuthorization";function X(e,t){return new Proxy({},{get:(n,r)=>(null==n[r]&&(n[r]=function(n){return Z(this,void 0,void 0,(function*(){const{method:o,params:i}=function(e,t,n){let r=t,o=e.toString().replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`)).toLowerCase();switch(e){case"authorize":{let{chain:e}=r;if("legacy"===n){switch(e){case"solana:testnet":e="testnet";break;case"solana:devnet":e="devnet";break;case"solana:mainnet":e="mainnet-beta";break;default:e=r.cluster}r.cluster=e}else{switch(e){case"testnet":case"devnet":e=`solana:${e}`;break;case"mainnet-beta":e="solana:mainnet"}r.chain=e}}case"reauthorize":{const{auth_token:e,identity:t}=r;e&&("legacy"===n?(o="reauthorize",r={auth_token:e,identity:t}):o="authorize");break}}return{method:o,params:r}}(r,n,e),s=yield t(o,i);return"authorize"===o&&i.sign_in_payload&&!s.sign_in_result&&(s.sign_in_result=yield function(e,t,n){var r;return Z(this,void 0,void 0,(function*(){const o=null!==(r=e.domain)&&void 0!==r?r:window.location.host,i=t.accounts[0].address,s=(a=Object.assign(Object.assign({},e),{domain:o,address:i}),c=function(e){return function(e){let t=`${e.domain} wants you to sign in with your Solana account:\n`;t+=`${e.address}`,e.statement&&(t+=`\n\n${e.statement}`);const n=[];if(e.uri&&n.push(`URI: ${e.uri}`),e.version&&n.push(`Version: ${e.version}`),e.chainId&&n.push(`Chain ID: ${e.chainId}`),e.nonce&&n.push(`Nonce: ${e.nonce}`),e.issuedAt&&n.push(`Issued At: ${e.issuedAt}`),e.expirationTime&&n.push(`Expiration Time: ${e.expirationTime}`),e.notBefore&&n.push(`Not Before: ${e.notBefore}`),e.requestId&&n.push(`Request ID: ${e.requestId}`),e.resources){n.push("Resources:");for(const t of e.resources)n.push(`- ${t}`)}return n.length&&(t+=`\n\n${n.join("\n")}`),t}(e)}(a),window.btoa(c));var a,c;return{address:i,signed_message:s,signature:(yield n("sign_messages",{addresses:[i],payloads:[s]})).signed_payloads[0].slice(s.length)}}))}(i.sign_in_payload,s,t)),function(e,t,n){if("getCapabilities"===e){const e=t;switch(n){case"legacy":{const t=["solana:signTransactions"];return!0===e.supports_clone_authorization&&t.push(J),Object.assign(Object.assign({},e),{features:t})}case"v1":return Object.assign(Object.assign({},e),{supports_sign_and_send_transactions:!0,supports_clone_authorization:e.features.includes(J)})}}return t}(r,s,e)}))}),n[r]),defineProperty:()=>!1,deleteProperty:()=>!1})}function ee(e,t){return Z(this,void 0,void 0,(function*(){const n=e.slice(0,4),r=e.slice(4,16),o=e.slice(16),i=yield crypto.subtle.decrypt(te(n,r),t,o);return(void 0===ne&&(ne=new TextDecoder("utf-8")),ne).decode(i)}))}function te(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}let ne;function re(){return Z(this,void 0,void 0,(function*(){return yield crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])}))}function oe(e,t){return Z(this,void 0,void 0,(function*(){return function(e,t,n){return Z(this,void 0,void 0,(function*(){const r=function(e){if(e>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");const t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}(t),o=new Uint8Array(12);crypto.getRandomValues(o);const i=yield crypto.subtle.encrypt(te(r,o),n,(new TextEncoder).encode(e)),s=new Uint8Array(r.byteLength+o.byteLength+i.byteLength);return s.set(new Uint8Array(r),0),s.set(new Uint8Array(o),r.byteLength),s.set(new Uint8Array(i),r.byteLength+o.byteLength),s}))}(JSON.stringify(e),e.id,t)}))}function ie(e){if(e<49152||e>65535)throw new Y("ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",`Association port number must be between 49152 and 65535. ${e} given.`,{port:e});return e}function se(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}let ae=null;function ce(e,t){return Z(this,void 0,void 0,(function*(){const n=ie(49152+Math.floor(16384*Math.random())),r=yield function(e,t,n,r=["v
11"]){return Z(this,void 0,void 0,(function*(){const o=ie(t),i=function(e){let t="";const n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return window.btoa(t)}(yield crypto.subtle.exportKey("raw",e)),s=function(e,t){let n=null;if(t){try{n=new URL(t)}catch(e){}if("https:"!==(null==n?void 0:n.protocol))throw new Y(H,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("solana-wallet:/"));const r=e.startsWith("/")?e:[...se(n.pathname),...se(e)].join("/");return new URL(r,n)}("v1/associate/local",n);return s.searchParams.set("association",i.replace(/[/+=]/g,(e=>({"/":"_","+":"-","=":"."}[e])))),s.searchParams.set("port",`${o}`),r.forEach((e=>{s.searchParams.set("v",e)})),s}))}(e,n,t);return yield function(e){return Z(this,void 0,void 0,(function*(){if("https:"===e.protocol)window.location.assign(e);else try{switch(-1!==navigator.userAgent.indexOf("Firefox/")?0:1){case 0:t=e,null==ae&&(ae=document.createElement("iframe"),ae.style.display="none",document.body.appendChild(ae)),ae.contentWindow.location.href=t.toString();break;case 1:{const t=new Promise(((e,t)=>{function n(){clearTimeout(o),window.removeEventListener("blur",r)}function r(){n(),e()}window.addEventListener("blur",r);const o=setTimeout((()=>{n(),t()}),2e3)}));window.location.assign(e),yield t;break}}}catch(e){throw new Y("ERROR_WALLET_NOT_FOUND","Found no installed wallet that supports the mobile wallet protocol.")}var t}))}(r),n}))}const ue={retryDelayScheduleMs:[150,150,200,500,500,750,750,1e3],timeoutMs:3e4};function le(e){return new DataView(e).getUint32(0,!1)}var he=o(6763);function de(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function fe(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function pe(e){return window.btoa(String.fromCharCode.call(null,...e))}function ge(e){return new Uint8Array(window.atob(e).split("").map((e=>e.charCodeAt(0))))}function ye(e){return pe("version"in e?e.serialize():e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function me(t){const n=t[0]*e.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===e.VersionedMessage.deserializeMessageVersion(t.slice(n,t.length))?e.Transaction.from(t):e.VersionedTransaction.deserialize(t)}function we(e,t){return fe(this,void 0,void 0,(function*(){return yield function(e,t){return Z(this,void 0,void 0,(function*(){!function(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new Y("ERROR_SECURE_CONTEXT_REQUIRED","The mobile wallet adapter protocol must be used in a secure context (`https`).")}();const n=yield function(){return Z(this,void 0,void 0,(function*(){return yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}))}(),r=`ws://localhost:${yield ce(n.publicKey,null==t?void 0:t.baseUri)}/solana-wallet`;let o;const i=(()=>{const e=[...ue.retryDelayScheduleMs];return()=>e.length>1?e.shift():e[0]})();let s=1,a=0,c={__type:"disconnected"};return new Promise(((t,u)=>{let l;const h={},d=()=>Z(this,void 0,void 0,(function*(){if("connecting"!==c.__type)return void console.warn(`Expected adapter state to be \`connecting\` at the moment the websocket opens. Got \`${c.__type}\`.`);l.removeEventListener("open",d);const{associationKeypair:e}=c,t=yield re();l.send(yield Q(t.publicKey,e.privateKey)),c={__type:"hello_req_sent",associationPublicKey:e.publicKey,ecdhPrivateKey:t.privateKey}})),f=e=>{e.wasClean?c={__type:"disconnected"}:u(new Y("ERROR_SESSION_CLOSED",`The wallet session dropped unexpectedly (${e.code}: ${e.reason}).`,{closeEvent:e})),y()},p=e=>Z(this,void 0,void 0,(function*(){y(),Date.now()-o>=ue.timeoutMs?u(new Y("ERROR_SESSION_TIMEOUT",`Failed to connect to the wallet websocket at ${r}.`)):(yield new Promise((e=>{const t=i();m=window.setTimeout(e,t)})),w())})),g=r=>Z(this,void 0,void 0,(function*(){const o=yield r.data.arrayBuffer();switch(c.__type){case"connecting":if(0!==o.byteLength)throw new Error("Encountered unexpected message while connecting");const r=yield re();l.send(yield Q(r.publicKey,n.privateKey)),c={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};break;case"connected":try{const e=le(o.slice(0,4));
1if(e!==a+1)throw new Error("Encrypted message has invalid sequence number");a=e;const t=yield function(e,t){return Z(this,void 0,void 0,(function*(){const n=yield ee(e,t),r=JSON.parse(n);if(Object.hasOwnProperty.call(r,"error"))throw new $(r.id,r.error.code,r.error.message);return r}))}(o,c.sharedSecret),n=h[t.id];delete h[t.id],n.resolve(t.result)}catch(e){if(!(e instanceof $))throw e;{const t=h[e.jsonRpcMessageId];delete h[e.jsonRpcMessageId],t.reject(e)}}break;case"hello_req_sent":{if(0===o.byteLength){const e=yield re();l.send(yield Q(e.publicKey,n.privateKey)),c={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:e.privateKey};break}const r=yield function(e,t,n){return Z(this,void 0,void 0,(function*(){const[r,o]=yield Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e.slice(0,65),{name:"ECDH",namedCurve:"P-256"},!1,[])]),i=yield crypto.subtle.deriveBits({name:"ECDH",public:o},n,256),s=yield crypto.subtle.importKey("raw",i,"HKDF",!1,["deriveKey"]);return yield crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(r),info:new Uint8Array},s,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"])}))}(o,c.associationPublicKey,c.ecdhPrivateKey),i=o.slice(65),d=0!==i.byteLength?yield(()=>Z(this,void 0,void 0,(function*(){const e=le(i.slice(0,4));if(e!==a+1)throw new Error("Encrypted message has invalid sequence number");return a=e,function(e,t){return Z(this,void 0,void 0,(function*(){const n=yield ee(e,t),r=JSON.parse(n);let o="legacy";if(Object.hasOwnProperty.call(r,"v"))switch(r.v){case 1:case"1":case"v1":o="v1";break;case"legacy":o="legacy";break;default:throw new Y("ERROR_INVALID_PROTOCOL_VERSION",`Unknown/unsupported protocol version: ${r.v}`)}return{protocol_version:o}}))}(i,r)})))():{protocol_version:"legacy"};c={__type:"connected",sharedSecret:r,sessionProperties:d};const f=X(d.protocol_version,((e,t)=>Z(this,void 0,void 0,(function*(){const n=s++;return l.send(yield oe({id:n,jsonrpc:"2.0",method:e,params:null!=t?t:{}},r)),new Promise(((t,r)=>{h[n]={resolve(n){switch(e){case"authorize":case"reauthorize":{const{wallet_uri_base:e}=n;if(null!=e)try{!function(e){let t;try{t=new URL(e)}catch(e){throw new Y(H,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new Y(H,"Base URLs supplied by wallets must be valid `https` URLs")}(e)}catch(e){return void r(e)}break}}t(n)},reject:r}}))}))));try{t(yield e(f))}catch(e){u(e)}finally{y(),l.close()}break}}}));let y,m;const w=()=>{y&&y(),c={__type:"connecting",associationKeypair:n},void 0===o&&(o=Date.now()),l=new WebSocket(r,["com.solana.mobilewalletadapter.v1"]),l.addEventListener("open",d),l.addEventListener("close",f),l.addEventListener("error",p),l.addEventListener("message",g),y=()=>{window.clearTimeout(m),l.removeEventListener("open",d),l.removeEventListener("close",f),l.removeEventListener("error",p),l.removeEventListener("message",g)}};w()}))}))}((t=>{const n=new Proxy({},{get(e,n){if(null==e[n])switch(n){case"signAndSendTransactions":e[n]=function(e){var{minContextSlot:n,commitment:r,skipPreflight:o,maxRetries:i,waitForCommitmentToSendNextTransaction:s,transactions:a}=e,c=de(e,["minContextSlot","commitment","skipPreflight","maxRetries","waitForCommitmentToSendNextTransaction","transactions"]);return fe(this,void 0,void 0,(function*(){const e=a.map(ye),u={min_context_slot:n,commitment:r,skip_preflight:o,max_retries:i,wait_for_commitment_to_send_next_transaction:s},{signatures:l}=yield t.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},c),Object.values(u).some((e=>null!=e))?{options:u}:null),{payloads:e}));return l.map(ge).map(he.encode)}))};break;case"signMessages":e[n]=function(e){var{payloads:n}=e,r=de(e,["payloads"]);return fe(this,void 0,void 0,(function*(){const e=n.map(pe),{signed_payloads:o}=yield t.signMessages(Object.assign(Object.assign({},r),{payloads:e}));return o.map(ge)}))};break;case"signTransactions":e[n]=function(e){var{transactions:n}=e,r=de(e,["transactions"]);return fe(this,void 0,void 0,(function*(){const e=n.map(ye),{signed_payloads:o}=yield t.signTransactions(Object.assign(Object.assign({},r),{payloads:e}));return o.map(ge).map(me)}))};break;default:e[n]=t[n]}return e[n]},defineProperty:()=>!1,deleteProperty:()=>!1});return e(n)}),t)}))}o(7583);o(8287).Buffer;const ve=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/="));(e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(ve),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);function be(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function Ae(e){return new Uint8Array(window.atob(e).split("").map((e=>e.charCodeAt(0))))}const ke="Mobile Wallet Adapter";function _e(e){return"version"in e}class Se extends q{constructor(e){var t;super(),this.supportedTransactionVersions=new Set(["legacy",0]),this.name=ke,this.url="https://solanamobile.com/wallets",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI4IiB3aWR0aD0iMjgiIHZpZXdCb3g9Ii0zIDAgMjggMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0RDQjhGRiI+PHBhdGggZD0iTTE3LjQgMTcuNEgxNXYyLjRoMi40di0yLjRabTEuMi05LjZoLTIuNHYyLjRoMi40VjcuOFoiLz48cGF0aCBkPSJNMjEuNiAzVjBoLTIuNHYzaC0zLjZWMGgtMi40djNoLTIuNHY2LjZINC41YTIuMSAyLjEgMCAxIDEgMC00LjJoMi43VjNINC41QTQuNSA0LjUgMCAwIDAgMCA3LjVWMjRoMjEuNnYtNi42aC0yLjR2NC4ySDIuNFYxMS41Yy41LjMgMS4yLjQgMS44LjVoNy41QTYuNiA2LjYgMCAwIDAgMjQgOVYzaC0yLjRabTAgNS43YTQuMiA0LjIgMCAxIDEtOC40IDBWNS40aDguNHYzLjNaIi8+PC9nPjwvc3ZnPg==",this._connecting=!1,this._connectionGeneration=0,this._readyState="undefined"!=typeof window&&window.isSecureContext&&"undefined"!=typeof document&&/android/i.test(navigator.userAgent)?_.Loadable:_.Unsupported,this._authorizationResultCache=e.authorizationResultCache,this._addressSelector=e.addressSelector,this._appIdentity=e.appIdentity,this._chain=null!==(t=e.chain)&&void 0!==t?t:function(e){switch(e){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet"}}(e.cluster),this._hostAuthority=e.remoteHostAuthority,this._onWalletNotFound=e.onWalletNotFound,this._readyState!==_.Unsupported&&this._authorizationResultCache.get().then((e=>{e&&this.declareWalletAsInstalled()}))}get publicKey(){if(null==this._publicKey&&null!=this._selectedAddress)try{this._publicKey=function(t){const n=Ae(t);return new e.PublicKey(n)}(this._selectedAddress)}catch(e){throw new N(e instanceof Error&&(null==e?void 0:e.message)||"Unknown error",e)}return this._publicKey?this._publicKey:null}get connected(){return!!this._authorizationResult}get connecting(){return this._connecting}get readyState(){return this._readyState}declareWalletAsInstalled(){this._readyState!==_.Installed&&this.emit("readyStateChange",this._readyState=_.Installed)}runWithGuard(e){return be(this,void 0,void 0,(function*(){try{return yield e()}catch(e){throw this.emit("error",e),e}}))}autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return be(this,void 0,void 0,(function*(){return yield this.autoConnect()}))}autoConnect(){return be(this,void 0,void 0,(function*(){if(!this.connecting&&!this.connected)return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){if(this._readyState!==_.Installed&&this._readyState!==_.Loadable)throw new I;this._connecting=!0;try{const e=yield this._authorizationResultCache.get();e&&this.handleAuthorizationResult(e)}catch(e){throw new x(e instanceof Error&&e.message||"Unknown error",e)}finally{this._connecting=!1}}))))}))}connect(){return be(this,void 0,void 0,(function*(){if(!this.connecting&&!this.connected)return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){if(this._readyState!==_.Installed&&this._readyState!==_.Loadable)throw new I;this._connecting=!0;try{yield this.performAuthorization()}catch(e){throw new x(e instanceof Error&&e.message||"Unknown error",e)}finally{this._connecting=!1}}))))}))}performAuthorization(e){return be(this,void 0,void 0,(function*(){try{const t=yield this._authorizationResultCache.get();return t?(this.handleAuthorizationResult(t),t):yield this.transact((t=>be(this,void 0,void 0,(function*(){const n=yield t.authorize({chain:this._chain,identity:this._appIdentity,sign_in_payload:e});return Promise.all([this._authorizationResultCache.set(n),this.handleAuthorizationResult(n)]),n}))))}catch(e){throw new x(e instanceof Error&&e.message||"Unknown error",e)}}))}handleAuthorizationResult(e){var t;return be(this,void 0,void 0,(function*(){const n=null==this._authorizationResult||(null===(t=this._authorizationResult)||void 0===t?void 0:t.accounts.length)!==e.accounts.length||this._authorizationResult.accounts.some(((t,n)=>t.address!==e.accounts[n].address));if(this._authorizationResult=e,this.declareWalletAsInstalled(),n){const t=yield this._addressSelector.select(e.accounts.map((({address:e})=>e)));t!==this._selectedAddress&&(this._selectedAddress=t,delete this._publicKey,this.emit
1("connect",this.publicKey))}}))}performReauthorization(e,t){return be(this,void 0,void 0,(function*(){try{const n=yield e.authorize({auth_token:t,identity:this._appIdentity});Promise.all([this._authorizationResultCache.set(n),this.handleAuthorizationResult(n)])}catch(e){throw this.disconnect(),new C(e instanceof Error&&(null==e?void 0:e.message)||"Unknown error",e)}}))}disconnect(){return be(this,void 0,void 0,(function*(){this._authorizationResultCache.clear(),this._connecting=!1,this._connectionGeneration++,delete this._authorizationResult,delete this._publicKey,delete this._selectedAddress,this.emit("disconnect")}))}transact(e){var t;return be(this,void 0,void 0,(function*(){const n=null===(t=this._authorizationResult)||void 0===t?void 0:t.wallet_uri_base,r=n?{baseUri:n}:void 0,o=this._hostAuthority?{remoteHostAuthority:this._hostAuthority}:void 0,i=this._connectionGeneration;try{return yield we(e,Object.assign(Object.assign({},r),o))}catch(e){throw this._connectionGeneration!==i&&(yield new Promise((()=>{}))),e instanceof Error&&"SolanaMobileWalletAdapterError"===e.name&&"ERROR_WALLET_NOT_FOUND"===e.code&&(yield this._onWalletNotFound(this)),e}}))}assertIsAuthorized(){if(!this._authorizationResult||!this._selectedAddress)throw new B;return{authToken:this._authorizationResult.auth_token,selectedAddress:this._selectedAddress}}performSignTransactions(e){return be(this,void 0,void 0,(function*(){const{authToken:t}=this.assertIsAuthorized();try{return yield this.transact((n=>be(this,void 0,void 0,(function*(){return yield this.performReauthorization(n,t),yield n.signTransactions({transactions:e})}))))}catch(e){throw new L(null==e?void 0:e.message,e)}}))}sendTransaction(e,t,n){return be(this,void 0,void 0,(function*(){return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){const{authToken:r}=this.assertIsAuthorized(),o=null==n?void 0:n.minContextSlot;try{return yield this.transact((i=>be(this,void 0,void 0,(function*(){function s(){let e,r;switch(t.commitment){case"confirmed":case"finalized":case"processed":e=t.commitment;break;default:e="finalized"}switch(null==n?void 0:n.preflightCommitment){case"confirmed":case"finalized":case"processed":r=n.preflightCommitment;break;case void 0:r=e;break;default:r="finalized"}return("finalized"===r?2:"confirmed"===r?1:0)<("finalized"===e?2:"confirmed"===e?1:0)?r:e}const[a,c,u]=yield Promise.all([i.getCapabilities(),this.performReauthorization(i,r),_e(e)?null:(()=>be(this,void 0,void 0,(function*(){var n;if(e.feePayer||(e.feePayer=null!==(n=this.publicKey)&&void 0!==n?n:void 0),null==e.recentBlockhash){const{blockhash:n}=yield t.getLatestBlockhash({commitment:s()});e.recentBlockhash=n}})))()]);if(a.supports_sign_and_send_transactions)return(yield i.signAndSendTransactions({minContextSlot:o,transactions:[e]}))[0];{const[r]=yield i.signTransactions({transactions:[e]});if(_e(r))return yield t.sendTransaction(r);{const e=r.serialize();return yield t.sendRawTransaction(e,Object.assign(Object.assign({},n),{preflightCommitment:s()}))}}}))))}catch(e){throw new V(null==e?void 0:e.message,e)}}))))}))}signTransaction(e){return be(this,void 0,void 0,(function*(){return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){const[t]=yield this.performSignTransactions([e]);return t}))))}))}signAllTransactions(e){return be(this,void 0,void 0,(function*(){return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){return yield this.performSignTransactions(e)}))))}))}signMessage(e){return be(this,void 0,void 0,(function*(){return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){const{authToken:t,selectedAddress:n}=this.assertIsAuthorized();try{return yield this.transact((r=>be(this,void 0,void 0,(function*(){yield this.performReauthorization(r,t);const[o]=yield r.signMessages({addresses:[n],payloads:[e]});return o.slice(-64)}))))}catch(e){throw new D(null==e?void 0:e.message,e)}}))))}))}signIn(e){return be(this,void 0,void 0,(function*(){return yield this.runWithGuard((()=>be(this,void 0,void 0,(function*(){var t,n;if(this._readyState!==_.Installed&&this._readyState!==_.Loadable)throw new I;this._connecting=!0;try{const r=yield this.performAuthorization(Object.assign(Object.assign({},e),{domain:null!==(t=null==e?void 0:e.domain)&&void 0!==t?t:window.location.host}));if(!r.sign_in_result)throw new Error("Sign in failed, no sign in result returned by wallet");const o=r.sign_in_result.address;return{account:Object.assign(Object.assign({},null!==(n=r.accounts.find((e=>e.address==o)))&&void 0!==n?n:{address:o}),{publicKey:Ae(o)}),signedMessage:Ae(r.sign_in_result.signed_message),signature:Ae(r.sign_in_result.signature)}}catch(e){throw new x(e instanceof Error&&e.message||"Unknown error",e)}finally{this._connecting=!1}}))))}
1))}}const Ee="SolanaMobileWalletAdapterDefaultAuthorizationCache";function Te(){let e;try{e=window.localStorage}catch(e){}return{clear(){return be(this,void 0,void 0,(function*(){if(e)try{e.removeItem(Ee)}catch(e){}}))},get(){return be(this,void 0,void 0,(function*(){if(e)try{return JSON.parse(e.getItem(Ee))||void 0}catch(e){}}))},set(t){return be(this,void 0,void 0,(function*(){if(e)try{e.setItem(Ee,JSON.stringify(t))}catch(e){}}))}}}function Ie(e){return be(this,void 0,void 0,(function*(){"undefined"!=typeof window&&window.location.assign(e.url)}))}var Me=o(2524),Re=o(3149);const xe="standard:connect",Ce="standard:events",Oe=function(e){return xe in e.features&&Ce in e.features&&(Me.R in e.features||Re.q in e.features)};var Pe=o(2694);const Ne="solana:signIn",Be="solana:mainnet",Ve="solana:devnet",Le="solana:testnet";function De(e){switch(e){case"processed":case"confirmed":case"finalized":case void 0:return e;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}const je="standard:disconnect";new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;const Ue=function(e){const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<58;n++){const r=e.charAt(n),o=r.charCodeAt(0);if(255!==t[o])throw new TypeError(r+" is ambiguous");t[o]=n}const n=58,r=e.charAt(0),o=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function s(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let i=0,s=0,a=0;for(;e[i]===r;)s++,i++;const c=(e.length-i)*o+1>>>0,u=new Uint8Array(c);for(;e[i];){let r=t[e.charCodeAt(i)];if(255===r)return;let o=0;for(let e=c-1;(0!==r||o<a)&&-1!==e;e--,o++)r+=n*u[e]>>>0,u[e]=r%256>>>0,r=r/256>>>0;if(0!==r)throw new Error("Non-zero carry");a=o,i++}let l=c-a;for(;l!==c&&0===u[l];)l++;const h=new Uint8Array(s+(c-l));let d=s;for(;l!==c;)h[d++]=u[l++];return h}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";let o=0,s=0,a=0;const c=t.length;for(;a!==c&&0===t[a];)a++,o++;const u=(c-a)*i+1>>>0,l=new Uint8Array(u);for(;a!==c;){let e=t[a],r=0;for(let t=u-1;(0!==e||r<s)&&-1!==t;t--,r++)e+=256*l[t]>>>0,l[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");s=r,a++}let h=u-s;for(;h!==u&&0===l[h];)h++;let d=r.repeat(o);for(;h<u;++h)d+=e.charAt(l[h]);return d},decodeUnsafe:s,decode:function(e){const t=s(e);if(t)return t;throw new Error("Non-base58 character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var We,ze,Ge,Ke,Fe,qe,He,Ye,$e,Ze,Qe,Je,Xe,et,tt,nt,rt,ot,it=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},st=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n};class at extends U{get name(){return it(this,Ye,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return it(this,Ye,"f").icon}get readyState(){return it(this,$e,"f")}get publicKey(){return it(this,Ge,"f")}get connecting(){return it(this,Ke,"f")}get supportedTransactionVersions(){return it(this,He,"f")}get wallet(){return it(this,Ye,"f")}get standard(){return!0}constructor({wallet:e}){super(),We.add(this),ze.set(this,void 0),Ge.set(this,void 0),Ke.set(this,void 0),Fe.set(this,void 0),qe.set(this,void 0),He.set(this,void 0),Ye.set(this,void 0),$e.set(this,"undefined"==typeof window||"undefined"==typeof document?_.Unsupported:_.Installed),et.set(this,(e=>{if("accounts"in e){const e=it(this,Ye,"f").accounts[0];it(this,ze,"f")&&!it(this,Fe,"f")&&e!==it(this,ze,"f")&&(e?it(this,We,"m",Qe).call(this,e):(this.emit
1("error",new C),it(this,We,"m",Je).call(this)))}"features"in e&&it(this,We,"m",Xe).call(this)})),st(this,Ye,e,"f"),st(this,ze,null,"f"),st(this,Ge,null,"f"),st(this,Ke,!1,"f"),st(this,Fe,!1,"f"),st(this,qe,it(this,Ye,"f").features[Ce].on("change",it(this,et,"f")),"f"),it(this,We,"m",Xe).call(this)}destroy(){st(this,ze,null,"f"),st(this,Ge,null,"f"),st(this,Ke,!1,"f"),st(this,Fe,!1,"f");const e=it(this,qe,"f");e&&(st(this,qe,null,"f"),e())}async autoConnect(){return it(this,We,"m",Ze).call(this,{silent:!0})}async connect(){return it(this,We,"m",Ze).call(this)}async disconnect(){if(je in it(this,Ye,"f").features)try{st(this,Fe,!0,"f"),await it(this,Ye,"f").features[je].disconnect()}catch(e){this.emit("error",new O(e?.message,e))}finally{st(this,Fe,!1,"f")}it(this,We,"m",Je).call(this)}async sendTransaction(e,t,n={}){try{const o=it(this,ze,"f");if(!o)throw new B;let i;if(Me.R in it(this,Ye,"f").features)if(o.features.includes(Me.R))i=Me.R;else{if(!(Re.q in it(this,Ye,"f").features)||!o.features.includes(Re.q))throw new P;i=Re.q}else{if(!(Re.q in it(this,Ye,"f").features))throw new R;if(!o.features.includes(Re.q))throw new P;i=Re.q}const s=(r=t.rpcEndpoint).includes("https://api.mainnet-beta.solana.com")?Be:/\bdevnet\b/i.test(r)?Ve:/\btestnet\b/i.test(r)?Le:/\blocalhost\b/i.test(r)||/\b127\.0\.0\.1\b/.test(r)?"solana:localnet":Be;if(!o.chains.includes(s))throw new V;try{const{signers:r,...a}=n;let c;if(G(e)?(r?.length&&e.sign(r),c=e.serialize()):(e=await this.prepareTransaction(e,t,a),r?.length&&e.partialSign(...r),c=new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))),i===Me.R){const[e]=await it(this,Ye,"f").features[Me.R].signAndSendTransaction({account:o,chain:s,transaction:c,options:{preflightCommitment:De(a.preflightCommitment||t.commitment),skipPreflight:a.skipPreflight,maxRetries:a.maxRetries,minContextSlot:a.minContextSlot}});return Ue.encode(e.signature)}{const[e]=await it(this,Ye,"f").features[Re.q].signTransaction({account:o,chain:s,transaction:c,options:{preflightCommitment:De(a.preflightCommitment||t.commitment),minContextSlot:a.minContextSlot}});return await t.sendRawTransaction(e.signedTransaction,{...a,preflightCommitment:De(a.preflightCommitment||t.commitment)})}}catch(e){if(e instanceof T)throw e;throw new V(e?.message,e)}}catch(e){throw this.emit("error",e),e}var r}}ze=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,Fe=new WeakMap,qe=new WeakMap,He=new WeakMap,Ye=new WeakMap,$e=new WeakMap,et=new WeakMap,We=new WeakSet,Ze=async function(e){try{if(this.connected||this.connecting)return;if(it(this,$e,"f")!==_.Installed)throw new I;if(st(this,Ke,!0,"f"),!it(this,Ye,"f").accounts.length)try{await it(this,Ye,"f").features[xe].connect(e)}catch(e){throw new x(e?.message,e)}const t=it(this,Ye,"f").accounts[0];if(!t)throw new P;it(this,We,"m",Qe).call(this,t)}catch(e){throw this.emit("error",e),e}finally{st(this,Ke,!1,"f")}},Qe=function(t){let n;try{n=new e.PublicKey(t.address)}catch(e){throw new N(e?.message,e)}st(this,ze,t,"f"),st(this,Ge,n,"f"),it(this,We,"m",Xe).call(this),this.emit("connect",n)},Je=function(){st(this,ze,null,"f"),st(this,Ge,null,"f"),it(this,We,"m",Xe).call(this),this.emit("disconnect")},Xe=function(){const e=Me.R in it(this,Ye,"f").features?it(this,Ye,"f").features[Me.R].supportedTransactionVersions:it(this,Ye,"f").features[Re.q].supportedTransactionVersions;st(this,He,function(e,t){if(e===t)return!0;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}(e,["legacy"])?null:new Set(e),"f"),Re.q in it(this,Ye,"f").features&&it(this,ze,"f")?.features.includes(Re.q)?(this.signTransaction=it(this,We,"m",tt),this.signAllTransactions=it(this,We,"m",nt)):(delete this.signTransaction,delete this.signAllTransactions),Pe.F in it(this,Ye,"f").features&&it(this,ze,"f")?.features.includes(Pe.F)?this.signMessage=it(this,We,"m",rt):delete this.signMessage,Ne in it(this,Ye,"f").features?this.signIn=it(this,We,"m",ot):delete this.signIn},tt=async function(t){try{const n=it(this,ze,"f");if(!n)throw new B;if(!(Re.q in it(this,Ye,"f").features))throw new R;if(!n.features.includes(Re.q))throw new P;try{const r=(await it(this,Ye,"f").features[Re.q].signTransaction({account:n,transaction:G(t)?t.serialize():new Uint8Array(t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}
1))[0].signedTransaction;return G(t)?e.VersionedTransaction.deserialize(r):e.Transaction.from(r)}catch(e){if(e instanceof T)throw e;throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}},nt=async function(t){try{const n=it(this,ze,"f");if(!n)throw new B;if(!(Re.q in it(this,Ye,"f").features))throw new R;if(!n.features.includes(Re.q))throw new P;try{const r=await it(this,Ye,"f").features[Re.q].signTransaction(...t.map((e=>({account:n,transaction:G(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))));return t.map(((t,n)=>{const o=r[n].signedTransaction;return G(t)?e.VersionedTransaction.deserialize(o):e.Transaction.from(o)}))}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}},rt=async function(e){try{const t=it(this,ze,"f");if(!t)throw new B;if(!(Pe.F in it(this,Ye,"f").features))throw new R;if(!t.features.includes(Pe.F))throw new P;try{return(await it(this,Ye,"f").features[Pe.F].signMessage({account:t,message:e}))[0].signature}catch(e){throw new D(e?.message,e)}}catch(e){throw this.emit("error",e),e}},ot=async function(e={}){try{if(!(Ne in it(this,Ye,"f").features))throw new R;let t;try{[t]=await it(this,Ye,"f").features[Ne].signIn(e)}catch(e){throw new j(e?.message,e)}if(!t)throw new j;return it(this,We,"m",Qe).call(this,t.account),t}catch(e){throw this.emit("error",e),e}};var ct;let ut;const lt=new Set,ht={};function dt(...e){return(e=e.filter((e=>!lt.has(e)))).length?(e.forEach((e=>function(e){ft=void 0,lt.add(e)}(e))),ht.register?.forEach((t=>yt((()=>t(...e))))),function(){e.forEach((e=>function(e){ft=void 0,lt.delete(e)}(e))),ht.unregister?.forEach((t=>yt((()=>t(...e)))))}):()=>{}}let ft;function pt(){return ft||(ft=[...lt]),ft}function gt(e,t){return ht[e]?.push(t)||(ht[e]=[t]),function(){ht[e]=ht[e]?.filter((e=>t!==e))}}function yt(e){try{e()}catch(e){console.error(e)}}class mt extends Event{get detail(){return function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}(this,ct,"f")}get type(){return"wallet-standard:app-ready"}constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),ct.set(this,void 0),function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,ct,e,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}function wt(e){const t=vt((()=>new Set)),{get:n,on:r}=vt((()=>function(){if(ut)return ut;if(ut=function(){if(ut)return ut;if(ut=Object.freeze({register:dt,get:pt,on:gt}),"undefined"==typeof window)return ut;const e=Object.freeze({register:dt});try{window.addEventListener("wallet-standard:register-wallet",(({detail:t})=>t(e)))}catch(e){console.error("wallet-standard:register-wallet event listener could not be added\n",e)}try{window.dispatchEvent(new mt(e))}catch(e){console.error("wallet-standard:app-ready event could not be dispatched\n",e)}return ut}(),"undefined"==typeof window)return ut;const e=window.navigator.wallets||[];if(!Array.isArray(e))return console.error("window.navigator.wallets is not an array"),ut;const{register:t}=ut,n=(...e)=>e.forEach((e=>yt((()=>e({register:t})))));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:n})})}catch(e){return console.error("window.navigator.wallets could not be set"),ut}return n(...e),ut}())),[o,i]=(0,h.useState)((()=>bt(n())));(0,h.useEffect)((()=>{const e=[r("register",((...e)=>i((t=>[...t,...bt(e)])))),r("unregister",((...e)=>i((t=>t.filter((t=>e.some((e=>e===t.wallet))))))))];return()=>e.forEach((e=>e()))}),[r]);const s=function(e){const t=(0,h.useRef)(void 0);return(0,h.useEffect)((()=>{t.current=e})),t.current}(o);return(0,h.useEffect)((()=>
1{if(!s)return;const e=new Set(o);new Set(s.filter((t=>!e.has(t)))).forEach((e=>e.destroy()))}),[s,o]),(0,h.useEffect)((()=>()=>o.forEach((e=>e.destroy()))),[]),(0,h.useMemo)((()=>[...o,...e.filter((({name:e})=>!o.some((t=>t.name===e))||(t.has(e)||(t.add(e),console.warn(`${e} was registered as a Standard Wallet. The Wallet Adapter for ${e} can be removed from your app.`)),!1)))]),[o,e,t])}function vt(e){const t=(0,h.useRef)(void 0);return void 0===t.current&&(t.current={value:e()}),t.current.value}function bt(e){return e.filter(Oe).map((e=>new at({wallet:e})))}var At,kt;function _t(e,t){const n=(0,h.useState)((()=>{try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(e){"undefined"!=typeof window&&console.error(e)}return t})),r=n[0],o=(0,h.useRef)(!0);return(0,h.useEffect)((()=>{if(o.current)o.current=!1;else try{null===r?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(r))}catch(e){"undefined"!=typeof window&&console.error(e)}}),[r,e]),n}ct=new WeakMap,(kt=At||(At={}))[kt.DESKTOP_WEB=0]="DESKTOP_WEB",kt[kt.MOBILE_WEB=1]="MOBILE_WEB";class St extends T{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}function Et({children:e,wallets:t,adapter:n,isUnloadingRef:r,onAutoConnectRequest:o,onConnectError:i,onError:s,onSelectWallet:a}){const c=(0,h.useRef)(!1),[u,l]=(0,h.useState)(!1),d=(0,h.useRef)(!1),[f,p]=(0,h.useState)(!1),[y,m]=(0,h.useState)((()=>n?.publicKey??null)),[w,v]=(0,h.useState)((()=>n?.connected??!1)),b=(0,h.useRef)(s);(0,h.useEffect)((()=>(b.current=s,()=>{b.current=void 0})),[s]);const A=(0,h.useRef)(((e,t)=>(r.current||(b.current?b.current(e,t):(console.error(e,t),e instanceof I&&"undefined"!=typeof window&&t&&window.open(t.url,"_blank"))),e))),[k,S]=(0,h.useState)((()=>t.map((e=>({adapter:e,readyState:e.readyState}))).filter((({readyState:e})=>e!==_.Unsupported))));(0,h.useEffect)((()=>{function e(e){S((t=>{const n=t.findIndex((({adapter:e})=>e===this));if(-1===n)return t;const{adapter:r}=t[n];return[...t.slice(0,n),{adapter:r,readyState:e},...t.slice(n+1)].filter((({readyState:e})=>e!==_.Unsupported))}))}return S((e=>t.map(((t,n)=>{const r=e[n];return r&&r.adapter===t&&r.readyState===t.readyState?r:{adapter:t,readyState:t.readyState}})).filter((({readyState:e})=>e!==_.Unsupported)))),t.forEach((t=>t.on("readyStateChange",e,t))),()=>{t.forEach((t=>t.off("readyStateChange",e,t)))}}),[n,t]);const E=(0,h.useMemo)((()=>k.find((e=>e.adapter===n))??null),[n,k]);(0,h.useEffect)((()=>{if(!n)return;const e=e=>{m(e),c.current=!1,l(!1),v(!0),d.current=!1,p(!1)},t=()=>{r.current||(m(null),c.current=!1,l(!1),v(!1),d.current=!1,p(!1))},o=e=>{A.current(e,n)};return n.on("connect",e),n.on("disconnect",t),n.on("error",o),()=>{n.off("connect",e),n.off("disconnect",t),n.off("error",o),t()}}),[n,r]);const T=(0,h.useRef)(!1);(0,h.useEffect)((()=>()=>{T.current=!1}),[n]),(0,h.useEffect)((()=>{T.current||c.current||w||!o||E?.readyState!==_.Installed&&E?.readyState!==_.Loadable||(c.current=!0,l(!0),T.current=!0,async function(){try{await o()}catch{i()}finally{l(!1),c.current=!1}}())}),[w,o,i,E]);const M=(0,h.useCallback)((async(e,t,r)=>{if(!n)throw A.current(new St);if(!w)throw A.current(new B,n);return await n.sendTransaction(e,t,r)}),[n,w]),R=(0,h.useMemo)((()=>n&&"signTransaction"in n?async e=>{if(!w)throw A.current(new B,n);return await n.signTransaction(e)}:void 0),[n,w]),x=(0,h.useMemo)((()=>n&&"signAllTransactions"in n?async e=>{if(!w)throw A.current(new B,n);return await n.signAllTransactions(e)}:void 0),[n,w]),C=(0,h.useMemo)((()=>n&&"signMessage"in n?async e=>{if(!w)throw A.current(new B,n);return await n.signMessage(e)}:void 0),[n,w]),O=(0,h.useMemo)((()=>n&&"signIn"in n?async e=>await n.signIn(e):void 0),[n]),P=(0,h.useCallback)((async()=>{if(c.current||d.current||E?.adapter.connected)return;if(!E)throw A.current(new St);const{adapter:e,readyState:t}=E;if(t!==_.Installed&&t!==_.Loadable)throw A.current(new I,e);c.current=!0,l(!0);try{await e.connect()}catch(e){throw i(),e}finally{l(!1),c.current=!1}}),[i,E]),N=(0,h.useCallback)((async()=>{if(!d.current&&n){d.current=!0,p(!0);try{await n.disconnect()}finally{p(!1),d.current=!1}}}),[n]);return h.createElement(g.Provider,{value:{autoConnect:!!o,wallets:k,wallet:E,publicKey:y,connected:w,connecting:u,disconnecting:f,select:a,connect:P,disconnect:N,sendTransaction:M,signTransaction:R,signAllTransactions:x,signMessage:C,signIn:O}},e)}let Tt;function It(e){return function({adapters:e,userAgentString:t}){return e.some((e=>e.name!==ke&&e.readyState===_.Installed))?At.DESKTOP_WEB:t&&/android/i.test(t)&&!function(e){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(e)}(t)?At.MOBILE_WEB:At.DESKTOP_WEB}({adapters:e,userAgentString:(void 0===Tt&&(Tt=globalThis.navigator?.userAgent??null),Tt)})===At.MOBILE_WEB}function Mt(){const e=globalThis.location;if(e)return`${e.protocol}//${e.host}`}function Rt({children:e,wallets:t,autoConnect:n,localStorageKey:r="walletName",onError:o}){const{connection:i}=w(),s=wt(t),a=(0,h.useMemo)((()=>
1{if(!It(s))return null;const e=s.find((e=>e.name===ke));return e||new Se({addressSelector:{select(e){return be(this,void 0,void 0,(function*(){return e[0]}))}},appIdentity:{uri:Mt()},authorizationResultCache:Te(),cluster:(t=i?.rpcEndpoint,t?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta"),onWalletNotFound:Ie});var t}),[s,i?.rpcEndpoint]),c=(0,h.useMemo)((()=>null==a||-1!==s.indexOf(a)?s:[a,...s]),[s,a]),[u,l]=_t(r,It(s)?ke:null),d=(0,h.useMemo)((()=>c.find((e=>e.name===u))??null),[c,u]),f=(0,h.useCallback)((e=>{u!==e&&(d&&d.name!==ke&&d.disconnect(),l(e))}),[d,l,u]);(0,h.useEffect)((()=>{if(d)return d.on("disconnect",e),()=>{d.off("disconnect",e)};function e(){y.current||u===ke&&It(s)||l(null)}}),[d,s,l,u]);const p=(0,h.useRef)(!1),g=(0,h.useMemo)((()=>{if(n&&d)return async()=>{(!0===n||await n(d))&&(p.current?await d.connect():await d.autoConnect())}}),[n,d]),y=(0,h.useRef)(!1);(0,h.useEffect)((()=>{if(u!==ke||!It(s))return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)};function e(){y.current=!0}y.current=!1}),[s,u]);const m=(0,h.useCallback)((()=>{d&&d.name!==ke&&f(null)}),[d,f]),v=(0,h.useCallback)((e=>{p.current=!0,f(e)}),[f]);return h.createElement(Et,{wallets:c,adapter:d,isUnloadingRef:y,onAutoConnectRequest:g,onConnectError:m,onError:o,onSelectWallet:v},e)}const xt={setVisible(e){console.error(Ct("call","setVisible"))},visible:!1};function Ct(e,t){return`You have tried to  ${e} "${t}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}Object.defineProperty(xt,"visible",{get:()=>(console.error(Ct("read","visible")),!1)});const Ot=(0,h.createContext)(xt);function Pt(){return(0,h.useContext)(Ot)}const Nt=e=>h.createElement("button",{className:`wallet-adapter-button ${e.className||""}`,disabled:e.disabled,style:e.style,onClick:e.onClick,tabIndex:e.tabIndex||0,type:"button"},e.startIcon&&h.createElement("i",{className:"wallet-adapter-button-start-icon"},e.startIcon),e.children,e.endIcon&&h.createElement("i",{className:"wallet-adapter-button-end-icon"},e.endIcon)),Bt=({wallet:e,...t})=>e&&h.createElement("img",{src:e.adapter.icon,alt:`${e.adapter.name} icon`,...t});function Vt({walletIcon:e,walletName:t,...n}){return h.createElement(Nt,{...n,className:"wallet-adapter-button-trigger",startIcon:e&&t?h.createElement(Bt,{wallet:{adapter:{icon:e,name:t}}}):void 0})}function Lt({children:e,labels:t,...n}){const{setVisible:r}=Pt(),{buttonState:o,onConnect:i,onDisconnect:s,publicKey:a,walletIcon:c,walletName:u}=function({onSelectWallet:e}){const{connect:t,connected:n,connecting:r,disconnect:o,disconnecting:i,publicKey:s,select:a,wallet:c,wallets:u}=y();let l;l=r?"connecting":n?"connected":i?"disconnecting":c?"has-wallet":"no-wallet";const d=(0,h.useCallback)((()=>{t().catch((()=>{}))}),[t]),f=(0,h.useCallback)((()=>{o().catch((()=>{}))}),[o]);return{buttonState:l,onConnect:"has-wallet"===l?d:void 0,onDisconnect:"disconnecting"!==l&&"no-wallet"!==l?f:void 0,onSelectWallet:(0,h.useCallback)((()=>{e({onSelectWallet:a,wallets:u})}),[e,a,u]),publicKey:s??void 0,walletIcon:c?.adapter.icon,walletName:c?.adapter.name}}({onSelectWallet(){r(!0)}}),[l,d]=(0,h.useState)(!1),[f,p]=(0,h.useState)(!1),g=(0,h.useRef)(null);(0,h.useEffect)((()=>{const e=e=>{const t=g.current;t&&!t.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[]);const m=(0,h.useMemo)((()=>{if(e)return e;if(a){const e=a.toBase58();return e.slice(0,4)+".."+e.slice(-4)}return"connecting"===o||"has-wallet"===o?t[o]:t["no-wallet"]}),[o,e,t,a]);return h.createElement("div",{className:"wallet-adapter-dropdown"},h.createElement(Vt,{...n,"aria-expanded":f,style:{pointerEvents:f?"none":"auto",...n.style},onClick:()=>{switch(o){case"no-wallet":r(!0);break;case"has-wallet":i&&i();break;case"connected":p(!0)}},walletIcon:c,walletName:u},m),h.createElement("ul",{"aria-label":"dropdown-list",className:`wallet-adapter-dropdown-list ${f&&"wallet-adapter-dropdown-list-active"}`,ref:g,role:"menu"},a?h.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:async()=>
1{await navigator.clipboard.writeText(a.toBase58()),d(!0),setTimeout((()=>d(!1)),400)},role:"menuitem"},l?t.copied:t["copy-address"]):null,h.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:()=>{r(!0),p(!1)},role:"menuitem"},t["change-wallet"]),s?h.createElement("li",{className:"wallet-adapter-dropdown-list-item",onClick:()=>{s(),p(!1)},role:"menuitem"},t.disconnect):null))}const Dt=window.ReactDOM,jt=({id:e,children:t,expanded:n=!1})=>{const r=(0,h.useRef)(null),o=(0,h.useRef)(!0);return(0,h.useLayoutEffect)((()=>{n?(()=>{const e=r.current;e&&requestAnimationFrame((()=>{e.style.height=e.scrollHeight+"px"}))})():(()=>{const e=r.current;e&&requestAnimationFrame((()=>{e.style.height=e.offsetHeight+"px",e.style.overflow="hidden",requestAnimationFrame((()=>{e.style.height="0"}))}))})()}),[n]),(0,h.useLayoutEffect)((()=>{const e=r.current;if(e)return o.current&&(t(),o.current=!1),e.addEventListener("transitionend",i),()=>e.removeEventListener("transitionend",i);function t(){e&&(e.style.overflow=n?"initial":"hidden",n&&(e.style.height="auto"))}function i(n){e&&n.target===e&&"height"===n.propertyName&&t()}}),[n]),h.createElement("div",{className:"wallet-adapter-collapse",id:e,ref:r,role:"region",style:{height:0,transition:o.current?void 0:"height 250ms ease-out"}},t)},Ut=({handleClick:e,tabIndex:t,wallet:n})=>h.createElement("li",null,h.createElement(Nt,{onClick:e,startIcon:h.createElement(Bt,{wallet:n}),tabIndex:t},n.adapter.name,n.readyState===_.Installed&&h.createElement("span",null,"Detected"))),Wt=()=>h.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),h.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),h.createElement("g",{clipPath:"url(#clip0_880_5115)"},h.createElement("path",{d:"M65.5769 28.1523H31.4231C27.6057 28.1523 24.5 31.258 24.5 35.0754V60.9215C24.5 64.7389 27.6057 67.8446 31.4231 67.8446H65.5769C69.3943 67.8446 72.5 64.7389 72.5 60.9215V35.0754C72.5 31.258 69.3943 28.1523 65.5769 28.1523ZM69.7308 52.1523H59.5769C57.2865 52.1523 55.4231 50.289 55.4231 47.9985C55.4231 45.708 57.2864 43.8446 59.5769 43.8446H69.7308V52.1523ZM69.7308 41.0754H59.5769C55.7595 41.0754 52.6539 44.1811 52.6539 47.9985C52.6539 51.8159 55.7595 54.9215 59.5769 54.9215H69.7308V60.9215C69.7308 63.2119 67.8674 65.0754 65.5769 65.0754H31.4231C29.1327 65.0754 27.2692 63.212 27.2692 60.9215V35.0754C27.2692 32.785 29.1326 30.9215 31.4231 30.9215H65.5769C67.8673 30.9215 69.7308 32.7849 69.7308 35.0754V41.0754Z",fill:"url(#paint2_linear_880_5115)"}),h.createElement("path",{d:"M61.4231 46.6172H59.577C58.8123 46.6172 58.1924 47.2371 58.1924 48.0018C58.1924 48.7665 58.8123 49.3863 59.577 49.3863H61.4231C62.1878 49.3863 62.8077 48.7664 62.8077 48.0018C62.8077 47.2371 62.1878 46.6172 61.4231 46.6172Z",fill:"url(#paint3_linear_880_5115)"})),h.createElement("defs",null,h.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},h.createElement("stop",{stopColor:"#9945FF"}),h.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),h.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),h.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),h.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),h.createElement("stop",{offset:"1",stopColor:"#00D18C"})),h.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},h.createElement("stop",{stopColor:"#9945FF"}),h.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),h.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),h.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),h.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),h.createElement("stop",{offset:"1",stopColor:"#00D18C"})),h.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",
1y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},h.createElement("stop",{stopColor:"#9945FF"}),h.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),h.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),h.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),h.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),h.createElement("stop",{offset:"1",stopColor:"#00D18C"})),h.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},h.createElement("stop",{stopColor:"#9945FF"}),h.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),h.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),h.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),h.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),h.createElement("stop",{offset:"1",stopColor:"#00D18C"})),h.createElement("clipPath",{id:"clip0_880_5115"},h.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"}
1)))),zt=({className:e="",container:t="body"})=>{const n=(0,h.useRef)(null),{wallets:r,select:o}=y(),{setVisible:i}=Pt(),[s,a]=(0,h.useState)(!1),[c,u]=(0,h.useState)(!1),[l,d]=(0,h.useState)(null),[f,p]=(0,h.useMemo)((()=>{const e=[],t=[];for(const n of r)n.readyState===_.Installed?e.push(n):t.push(n);return e.length?[e,t]:[t,[]]}),[r]),g=(0,h.useCallback)((()=>{u(!1),setTimeout((()=>i(!1)),150)}),[i]),m=(0,h.useCallback)((e=>{e.preventDefault(),g()}),[g]),w=(0,h.useCallback)(((e,t)=>{o(t),m(e)}),[o,m]),v=(0,h.useCallback)((()=>a(!s)),[s]),b=(0,h.useCallback)((e=>{const t=n.current;if(!t)return;const r=t.querySelectorAll("button"),o=r[0],i=r[r.length-1];e.shiftKey?document.activeElement===o&&(i.focus(),e.preventDefault()):document.activeElement===i&&(o.focus(),e.preventDefault())}),[n]);return(0,h.useLayoutEffect)((()=>{const e=e=>{"Escape"===e.key?g():"Tab"===e.key&&b(e)},{overflow:t}=window.getComputedStyle(document.body);return setTimeout((()=>u(!0)),0),document.body.style.overflow="hidden",window.addEventListener("keydown",e,!1),()=>{document.body.style.overflow=t,window.removeEventListener("keydown",e,!1)}}),[g,b]),(0,h.useLayoutEffect)((()=>d(document.querySelector(t))),[t]),l&&(0,Dt.createPortal)(h.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${c&&"wallet-adapter-modal-fade-in"} ${e}`,ref:n,role:"dialog"},h.createElement("div",{className:"wallet-adapter-modal-container"},h.createElement("div",{className:"wallet-adapter-modal-wrapper"},h.createElement("button",{onClick:m,className:"wallet-adapter-modal-button-close"},h.createElement("svg",{width:"14",height:"14"},h.createElement("path",{d:"M14 12.461 8.3 6.772l5.234-5.233L12.006 0 6.772 5.234 1.54 0 0 1.539l5.234 5.233L0 12.006l1.539 1.528L6.772 8.3l5.69 5.7L14 12.461z"}))),f.length?h.createElement(h.Fragment,null,h.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),h.createElement("ul",{className:"wallet-adapter-modal-list"},f.map((e=>h.createElement(Ut,{key:e.adapter.name,handleClick:t=>w(t,e.adapter.name),wallet:e}))),p.length?h.createElement(jt,{expanded:s,id:"wallet-adapter-modal-collapse"},p.map((e=>h.createElement(Ut,{key:e.adapter.name,handleClick:t=>w(t,e.adapter.name),tabIndex:s?0:-1,wallet:e})))):null),p.length?h.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:v,tabIndex:0},h.createElement("span",null,s?"Less ":"More ","options"),h.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:s?"wallet-adapter-modal-list-more-icon-rotate":""},h.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))):null):h.createElement(h.Fragment,null,h.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),h.createElement("div",{className:"wallet-adapter-modal-middle"},h.createElement(Wt,null)),p.length?h.createElement(h.Fragment,null,h.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:v,tabIndex:0},h.createElement("span",null,s?"Hide ":"Already have a wallet? View ","options"),h.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:s?"wallet-adapter-modal-list-more-icon-rotate":""},h.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))),h.createElement(jt,{expanded:s,id:"wallet-adapter-modal-collapse"},h.createElement("ul",{className:"wallet-adapter-modal-list"},p.map((e=>h.createElement(Ut,{key:e.adapter.name,handleClick:t=>w(t,e.adapter.name),tabIndex:s?0:-1,wallet:e})))))):null))),h.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:m})),l)},Gt=({children:e,...t})=>{const[n,r]=(0,h.useState)(!1);return h.createElement(Ot.Provider,{value:{visible:n,setVisible:r}},e,n&&h.createElement(zt,{...t}))};class Kt extends F{constructor(t={}){super(),this.name="Phantom",this.url="https://phantom.app",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDgiIGhlaWdodD0iMTA4IiB2aWV3Qm94PSIwIDAgMTA4IDEwOCIgZmlsbD0ibm9uZSI+CjxyZWN0IHdpZHRoPSIxMDgiIGhlaWdodD0iMTA4IiByeD0iMjYiIGZpbGw9IiNBQjlGRjIiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00Ni41MjY3IDY5LjkyMjlDNDIuMDA1NCA3Ni44NTA5IDM0LjQyOTIgODUuNjE4MiAyNC4zNDggODUuNjE4MkMxOS41ODI0IDg1LjYxODIgMTUgODMuNjU2MyAxNSA3NS4xMzQyQzE1IDUzLjQzMDUgNDQuNjMyNiAxOS44MzI3IDcyLjEyNjggMTkuODMyN0M4Ny43NjggMTkuODMyNyA5NCAzMC42ODQ2IDk0IDQzLjAwNzlDOTQgNTguODI1OCA4My43MzU1IDc2LjkxMjIgNzMuNTMyMSA3Ni45MTIyQzcwLjI5MzkgNzYuOTEyMiA2OC43MDUzIDc1LjEzNDIgNjguNzA1MyA3Mi4zMTRDNjguNzA1MyA3MS41NzgzIDY4LjgyNzUgNzAuNzgxMiA2OS4wNzE5IDY5LjkyMjlDNjUuNTg5MyA3NS44Njk5IDU4Ljg2ODUgODEuMzg3OCA1Mi41NzU0IDgxLjM4NzhDNDcuOTkzIDgxLjM4NzggNDUuNjcxMyA3OC41MDYzIDQ1LjY3MTMgNzQuNDU5OEM0NS42NzEzIDcyLjk4ODQgNDUuOTc2OCA3MS40NTU2IDQ2LjUyNjcgNjkuOTIyOVpNODMuNjc2MSA0Mi41Nzk0QzgzLjY3NjEgNDYuMTcwNCA4MS41NTc1IDQ3Ljk2NTggNzkuMTg3NSA0Ny45NjU4Qzc2Ljc4MTYgNDcuOTY1OCA3NC42OTg5IDQ2LjE3MDQgNzQuNjk4OSA0Mi41Nzk0Qzc0LjY5ODkgMzguOTg4NSA3Ni43ODE2IDM3LjE5MzEgNzkuMTg3NSAzNy4xOTMxQzgxLjU1NzUgMzcuMTkzMSA4My42NzYxIDM4Ljk4ODUgODMuNjc2MSA0Mi41Nzk0Wk03MC4yMTAzIDQyLjU3OTVDNzAuMjEwMyA0Ni4xNzA0IDY4LjA5MTYgNDcuOTY1OCA2NS43MjE2IDQ3Ljk2NThDNjMuMzE1NyA0Ny45NjU4IDYxLjIzMyA0Ni4xNzA0IDYxLjIzMyA0Mi41Nzk1QzYxLjIzMyAzOC45ODg1IDYzLjMxNTcgMzcuMTkzMSA2NS43MjE2IDM3LjE5MzFDNjguMDkxNiAzNy4xOTMxIDcwLjIxMDMgMzguOTg4NSA3MC4yMTAzIDQyLjU3OTVaIiBmaWxsPSIjRkZGREY4Ii8+Cjwvc3ZnPg==",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState="undefined"==typeof window||"undefined"==typeof document?_.Unsupported:_.NotDetected,this._disconnected=()=>{const e=this._wallet;e&&(e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null,this.emit
1("error",new C),this.emit("disconnect"))},this._accountChanged=t=>{const n=this._publicKey;if(n){try{t=new e.PublicKey(t.toBytes())}catch(e){return void this.emit("error",new N(e?.message,e))}n.equals(t)||(this._publicKey=t,this.emit("connect",t))}},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==_.Unsupported&&(z()?(this._readyState=_.Loadable,this.emit("readyStateChange",this._readyState)):W((()=>!(!window.phantom?.solana?.isPhantom&&!window.solana?.isPhantom||(this._readyState=_.Installed,this.emit("readyStateChange",this._readyState),0)))))}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async autoConnect(){this.readyState===_.Installed&&await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this.readyState===_.Loadable){const e=encodeURIComponent(window.location.href),t=encodeURIComponent(window.location.origin);return void(window.location.href=`https://phantom.app/ul/browse/${e}?ref=${t}`)}if(this.readyState!==_.Installed)throw new I;this._connecting=!0;const t=window.phantom?.solana||window.solana;if(!t.isConnected)try{await t.connect()}catch(e){throw new x(e?.message,e)}if(!t.publicKey)throw new P;let n;try{n=new e.PublicKey(t.publicKey.toBytes())}catch(e){throw new N(e?.message,e)}t.on("disconnect",this._disconnected),t.on("accountChanged",this._accountChanged),this._wallet=t,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(e){this.emit("error",new O(e?.message,e))}}this.emit("disconnect")}async sendTransaction(e,t,n={}){try{const r=this._wallet;if(!r)throw new B;try{const{signers:o,...i}=n;G(e)?o?.length&&e.sign(o):(e=await this.prepareTransaction(e,t,i),o?.length&&e.partialSign(...o)),i.preflightCommitment=i.preflightCommitment||t.commitment;const{signature:s}=await r.signAndSendTransaction(e,i);return s}catch(e){if(e instanceof T)throw e;throw new V(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signTransaction(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signTransaction(e)||e}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signAllTransactions(e)||e}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signMessage(e){try{const t=this._wallet;if(!t)throw new B;try{const{signature:n}=await t.signMessage(e);return n}catch(e){throw new D(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}var Ft;class qt extends Event{get detail(){return function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}(this,Ft,"f")}get type(){return"wallet-standard:register-wallet"}constructor(e){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),Ft.set(this,void 0),function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,Ft,e,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Ft=new WeakMap;var Ht,Yt,$t,Zt,Qt,Jt,Xt,en,tn,nn,rn,on,sn,an,cn=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class un{constructor(){Ht.add(this),Yt.set(this,{}),$t.set(this,"1.0.0"),Zt.set(this,"MetaMask"),Qt.set(this,"data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIGZpbGw9IiNlMjc2MWIiIHN0cm9rZT0iI2UyNzYxYiIvPjxnIGZpbGw9IiNlNDc2MWIiIHN0cm9rZT0iI2U0NzYxYiI+PHBhdGggZD0ibTQuNDgxIDMuNjQzIDkuMjk0IDcuMDI0LTEuNjQ4LTQuMTcxem0xOC4yNTggMTYuMTMtMi40OTUgMy44MjMgNS4zMzkgMS40NjkgMS41MzUtNS4yMDctNC4zNzgtLjA4NXptLTE5LjI0Ny4wODUgMS41MjUgNS4yMDcgNS4zMzktMS40NjktMi4
10OTUtMy44MjN6Ii8+PHBhdGggZD0ibTEwLjA1NSAxMy4zMTMtMS40ODggMi4yNTEgNS4zMDEuMjM1LS4xODgtNS42OTd6bTEwLjQ4IDAtMy42NzItMy4yNzctLjEyMiA1Ljc2MyA1LjI5Mi0uMjM1LTEuNDk3LTIuMjUxem0tMTAuMTc4IDEwLjI4MyAzLjE4My0xLjU1NC0yLjc0OS0yLjE0Ny0uNDMzIDMuNzAxem02LjY5NS0xLjU1NCAzLjE5MiAxLjU1NC0uNDQzLTMuNzAxeiIvPjwvZz48cGF0aCBkPSJtMjAuMjQ0IDIzLjU5Ni0zLjE5Mi0xLjU1NC4yNTQgMi4wODEtLjAyOC44NzZ6bS05Ljg4NyAwIDIuOTY2IDEuNDAzLS4wMTktLjg3Ni4yMzUtMi4wODEtMy4xODMgMS41NTR6IiBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiLz48cGF0aCBkPSJtMTMuMzY5IDE4LjUyMS0yLjY1NS0uNzgxIDEuODc0LS44NTd6bTMuODUxIDAgLjc4MS0xLjYzOCAxLjg4My44NTctMi42NjUuNzgxeiIgZmlsbD0iIzIzMzQ0NyIgc3Ryb2tlPSIjMjMzNDQ3Ii8+PHBhdGggZD0ibTEwLjM1NyAyMy41OTYuNDUyLTMuODIzLTIuOTQ3LjA4NXptOS40MzUtMy44MjMuNDUyIDMuODIzIDIuNDk1LTMuNzM4em0yLjI0MS00LjIwOS01LjI5Mi4yMzUuNDkgMi43MjEuNzgyLTEuNjM4IDEuODgzLjg1N3ptLTExLjMxOCAyLjE3NSAxLjg4My0uODU3Ljc3MiAxLjYzOC40OTktMi43MjEtNS4zMDEtLjIzNXoiIGZpbGw9IiNjZDYxMTYiIHN0cm9rZT0iI2NkNjExNiIvPjxwYXRoIGQ9Im04LjU2NyAxNS41NjQgMi4yMjIgNC4zMzEtLjA3NS0yLjE1NnptMTEuMzI4IDIuMTc1LS4wOTQgMi4xNTYgMi4yMzItNC4zMzEtMi4xMzcgMi4xNzV6bS02LjAyNi0xLjk0LS40OTkgMi43MjEuNjIxIDMuMjExLjE0MS00LjIyOC0uMjY0LTEuNzA0em0yLjg3MiAwLS4yNTQgMS42OTUuMTEzIDQuMjM3LjYzMS0zLjIxMXoiIGZpbGw9IiNlNDc1MWYiIHN0cm9rZT0iI2U0NzUxZiIvPjxwYXRoIGQ9Im0xNy4yMyAxOC41Mi0uNjMxIDMuMjExLjQ1Mi4zMTEgMi43NS0yLjE0Ny4wOTQtMi4xNTZ6bS02LjUxNi0uNzgxLjA3NSAyLjE1NiAyLjc1IDIuMTQ3LjQ1Mi0uMzExLS42MjItMy4yMTF6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48cGF0aCBkPSJtMTcuMjc3IDI0Ljk5OS4wMjgtLjg3Ni0uMjM1LS4yMDdoLTMuNTVsLS4yMTcuMjA3LjAxOS44NzYtMi45NjYtMS40MDMgMS4wMzYuODQ4IDIuMSAxLjQ1OWgzLjYwNmwyLjEwOS0xLjQ1OSAxLjAzNi0uODQ4eiIgZmlsbD0iI2MwYWQ5ZSIgc3Ryb2tlPSIjYzBhZDllIi8+PHBhdGggZD0ibTE3LjA1MSAyMi4wNDItLjQ1Mi0uMzExaC0yLjYwOGwtLjQ1Mi4zMTEtLjIzNSAyLjA4MS4yMTctLjIwN2gzLjU1bC4yMzUuMjA3LS4yNTQtMi4wODF6IiBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiLz48cGF0aCBkPSJtMjYuNTA1IDExLjA1My44LTMuODQyLTEuMTk2LTMuNTY5LTkuMDU4IDYuNzIzIDMuNDg0IDIuOTQ3IDQuOTI1IDEuNDQxIDEuMDkyLTEuMjcxLS40NzEtLjMzOS43NTMtLjY4Ny0uNTg0LS40NTIuNzUzLS41NzQtLjQ5OS0uMzc3em0tMjMuMjExLTMuODQxLjggMy44NDItLjUwOC4zNzcuNzUzLjU3NC0uNTc0LjQ1Mi43NTMuNjg3LS40NzEuMzM5IDEuMDgzIDEuMjcxIDQuOTI1LTEuNDQxIDMuNDg0LTIuOTQ3LTkuMDU5LTYuNzIzeiIgZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2Ii8+PHBhdGggZD0ibTI1LjQ2IDE0Ljc1NC00LjkyNS0xLjQ0MSAxLjQ5NyAyLjI1MS0yLjIzMiA0LjMzMSAyLjkzOC0uMDM4aDQuMzc4bC0xLjY1Ny01LjEwNHptLTE1LjQwNS0xLjQ0MS00LjkyNSAxLjQ0MS0xLjYzOCA1LjEwNGg0LjM2OWwyLjkyOC4wMzgtMi4yMjItNC4zMzEgMS40ODgtMi4yNTF6bTYuNjg1IDIuNDg2LjMxMS01LjQzMyAxLjQzMS0zLjg3aC02LjM1NmwxLjQxMyAzLjg3LjMyOSA1LjQzMy4xMTMgMS43MTQuMDA5IDQuMjE5aDIuNjFsLjAxOS00LjIxOS4xMjItMS43MTR6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48L2c+PGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIGZpbGw9IiMwMDAiIHI9IjYuNSIvPjxwYXRoIGQ9Im0yNy40NzMgMjUuNTQ1LTEuMzEgMS4zNjhjLS4wMjkuMDMtLjA2My4wNTMtLjEwMS4wN2EuMzEuMzEgMCAwIDEgLS4xMjEuMDI0aC02LjIwOWMtLjAzIDAtLjA1OS0uMDA4LS4wODMtLjAyNGEuMTUuMTUgMCAwIDEgLS4wNTYtLjA2NWMtLjAxMi0uMDI2LS4wMTUtLjA1Ni0uMDEtLjA4NHMuMDE4LS4wNTUuMDM5LS4wNzZsMS4zMTEtMS4zNjhjLjAyOC0uMDMuMDYzLS4wNTMuMTAxLS4wNjlhLjMxLjMxIDAgMCAxIC4xMjEtLjAyNWg2LjIwOGMuMDMgMCAuMDU5LjAwOC4wODMuMDI0YS4xNS4xNSAwIDAgMSAuMDU2LjA2NWMuMDEyLjAyNi4wMTUuMDU2LjAxLjA4NHMtLjAxOC4wNTUtLjAzOS4wNzZ6bS0xLjMxLTIuNzU2Yy0uMDI5LS4wMy0uMDYzLS4wNTMtLjEwMS0uMDdhLjMxLjMxIDAgMCAwIC0uMTIxLS4wMjRoLTYuMjA5Yy0uMDMgMC0uMDU5LjAwOC0uMDgzLjAyNHMtLjA0NC4wMzgtLjA1Ni4wNjUtLjAxNS4wNTYtLjAxLjA4NC4wMTguMDU1LjAzOS4wNzZsMS4zMTEgMS4zNjhjLjAyOC4wMy4wNjMuMDUzLjEwMS4wNjlhLjMxLjMxIDAgMCAwIC4xMjEuMDI1aDYuMjA4Yy4wMyAwIC4wNTktLjAwOC4wODMtLjAyNGEuMTUuMTUgMCAwIDAgLjA1Ni0uMDY1Yy4wMTItLjAyNi4wMTUtLjA1Ni4wMS0uMDg0cy0uMDE4LS4wNTUtLjAzOS0uMDc2em0tNi40MzEtLjk4M2g2LjIwOWEuMzEuMzEgMCAwIDAgLjEyMS0uMDI0Yy4wMzgtLjAxNi4wNzMtLjA0LjEwMS0uMDdsMS4zMS0xLjM2OGMuMDItLjAyMS4wMzQtLjA0Ny4wMzktLjA3NnMuMDAxLS4wNTgtLjAxLS4wODRhLjE1LjE1IDAgMCAwIC0uMDU2LS4wNjVjLS4wMjUtLjAxNi0uMDU0LS4wMjQtLjA4My0uMDI0aC02LjIwOGEuMzEuMzEgMCAwIDAgLS4xMjEuMDI1Yy0uMDM4LjAxNi0uMDcyLjA0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4="),Jt.set(this,null),Xt.set(this,((e,t)=>(cn(this,Yt,"f")[e]?.push(t)||(cn(this,Yt,"f")[e]=[t]),()=>cn(this,Ht,"m",tn).call(this,e,t)))),nn.set(this,(async()=>
1{if(!cn(this,Jt,"f")){let e;try{e=(await o.e(130).then(o.bind(o,130))).default}catch(e){throw new Error("Unable to load Solflare MetaMask SDK")}(function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)})(this,Jt,new e,"f"),cn(this,Jt,"f").on("standard_change",(e=>cn(this,Ht,"m",en).call(this,"change",e)))}return this.accounts.length||await cn(this,Jt,"f").connect(),{accounts:this.accounts}})),rn.set(this,(async()=>{cn(this,Jt,"f")&&await cn(this,Jt,"f").disconnect()})),on.set(this,(async(...e)=>{if(!cn(this,Jt,"f"))throw new B;return await cn(this,Jt,"f").standardSignAndSendTransaction(...e)})),sn.set(this,(async(...e)=>{if(!cn(this,Jt,"f"))throw new B;return await cn(this,Jt,"f").standardSignTransaction(...e)})),an.set(this,(async(...e)=>{if(!cn(this,Jt,"f"))throw new B;return await cn(this,Jt,"f").standardSignMessage(...e)}))}get version(){return cn(this,$t,"f")}get name(){return cn(this,Zt,"f")}get icon(){return cn(this,Qt,"f")}get chains(){return[Be,Ve,Le]}get features(){return{[xe]:{version:"1.0.0",connect:cn(this,nn,"f")},[je]:{version:"1.0.0",disconnect:cn(this,rn,"f")},[Ce]:{version:"1.0.0",on:cn(this,Xt,"f")},[Me.R]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:cn(this,on,"f")},[Re.q]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:cn(this,sn,"f")},[Pe.F]:{version:"1.0.0",signMessage:cn(this,an,"f")}}}get accounts(){return cn(this,Jt,"f")?cn(this,Jt,"f").standardAccounts:[]}}Yt=new WeakMap,$t=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakMap,Ht=new WeakSet,en=function(e,...t){cn(this,Yt,"f")[e]?.forEach((e=>e.apply(null,t)))},tn=function(e,t){cn(this,Yt,"f")[e]=cn(this,Yt,"f")[e]?.filter((e=>t!==e))};let ln=!1;async function hn(){const e="solflare-detect-metamask";function t(){window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:{id:e,jsonrpc:"2.0",method:"wallet_getSnaps"}}},window.location.origin)}function n(r){const o=r.data;"metamask-inpage"===o?.target&&"metamask-provider"===o.data?.name&&(o.data.data?.id===e?(window.removeEventListener("message",n),o.data.data.error||ln||(function(e){const t=({register:t})=>t(e);try{window.dispatchEvent(new qt(t))}catch(e){console.error("wallet-standard:register-wallet event could not be dispatched\n",e)}try{window.addEventListener("wallet-standard:app-ready",(({detail:e})=>t(e)))}catch(e){console.error("wallet-standard:app-ready event listener could not be added\n",e)}}(new un),ln=!0)):t())}window.addEventListener("message",n),window.setTimeout((()=>window.removeEventListener("message",n)),5e3),t()}class dn extends F{constructor(t={}){super(),this.name="Solflare",this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmMxMGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmYjNmMmUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iYiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2LjQ3ODM1IiB4Mj0iMzQuOTEwNyIgeGxpbms6aHJlZj0iI2EiIHkxPSI3LjkyIiB5Mj0iMzMuNjU5MyIvPjxyYWRpYWxHcmFkaWVudCBpZD0iYyIgY3g9IjAiIGN5PSIwIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDQuOTkyMTg4MzIgMTIuMDYzODc5NjMgLTEyLjE4MTEzNjU1IDUuMDQwNzEwNzQgMjIuNTIwMiAyMC42MTgzKSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHI9IjEiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZD0ibTI1LjE3MDggNDcuOTEwNGMuNTI1IDAgLjk1MDcuNDIxLjk1MDcuOTQwM3MtLjQyNTcuOTQwMi0uOTUwNy45NDAyLS45NTA3LS40MjA5LS45NTA3LS45NDAyLjQyNTctLjk0MDMuOTUwNy0uOTQwM3ptLTEuMDMyOC00NC45MTU2NWMuNDY0Ni4wMzgzNi44Mzk4LjM5MDQuOTAyNy44NDY4MWwxLjEzMDcgOC4yMTU3NGMuMzc5OCAyLjcxNDMgMy42NTM1IDMuODkwNCA1LjY3NDMgMi4wNDU5bDExLjMyOTEtMTAuMzExNThjLjI3MzMtLjI0ODczLjY5ODktLjIzMTQ5Ljk1MDcuMDM4NTEuMjMwOS4yNDc3Mi4yMzc5LjYyNjk3LjAxNjEuODgyNzdsLTkuODc5MSAxMS4zOTU4Yy0xLjgxODcgMi4wOTQyLS40NzY4IDUuMzY0MyAyLjI5NTYgNS41OTc4bDguNzE2OC44NDAzYy40MzQxLjA0MTguNzUxNy40MjM0LjcwOTMuODUyNC0uMDM0OS4zNTM3
1LS4zMDc0LjYzOTUtLjY2MjguNjk0OWwtOS4xNTk0IDEuNDMwMmMtMi42NTkzLjM2MjUtMy44NjM2IDMuNTExNy0yLjEzMzkgNS41NTc2bDMuMjIgMy43OTYxYy4yNTk0LjMwNTguMjE4OC43NjE1LS4wOTA4IDEuMDE3OC0uMjYyMi4yMTcyLS42NDE5LjIyNTYtLjkxMzguMDIwM2wtMy45Njk0LTIuOTk3OGMtMi4xNDIxLTEuNjEwOS01LjIyOTctLjI0MTctNS40NTYxIDIuNDI0M2wtLjg3NDcgMTAuMzk3NmMtLjAzNjIuNDI5NS0uNDE3OC43NDg3LS44NTI1LjcxMy0uMzY5LS4wMzAzLS42NjcxLS4zMDk3LS43MTcxLS42NzIxbC0xLjM4NzEtMTAuMDQzN2MtLjM3MTctMi43MTQ0LTMuNjQ1NC0zLjg5MDQtNS42NzQzLTIuMDQ1OWwtMTIuMDUxOTUgMTAuOTc0Yy0uMjQ5NDcuMjI3MS0uNjM4MDkuMjExNC0uODY4LS4wMzUtLjIxMDk0LS4yMjYyLS4yMTczNS0uNTcyNC0uMDE0OTMtLjgwNmwxMC41MTgxOC0xMi4xMzg1YzEuODE4Ny0yLjA5NDIuNDg0OS01LjM2NDQtMi4yODc2LTUuNTk3OGwtOC43MTg3Mi0uODQwNWMtLjQzNDEzLS4wNDE4LS43NTE3Mi0uNDIzNS0uNzA5MzYtLjg1MjQuMDM0OTMtLjM1MzcuMzA3MzktLjYzOTQuNjYyNy0uNjk1bDkuMTUzMzgtMS40Mjk5YzIuNjU5NC0uMzYyNSAzLjg3MTgtMy41MTE3IDIuMTQyMS01LjU1NzZsLTIuMTkyLTIuNTg0MWMtLjMyMTctLjM3OTItLjI3MTMtLjk0NDMuMTEyNi0xLjI2MjEuMzI1My0uMjY5NC43OTYzLS4yNzk3IDEuMTMzNC0uMDI0OWwyLjY5MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState="undefined"==typeof window||"undefined"==typeof document?_.Unsupported:_.Loadable,this._disconnected=()=>{const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new C),this.emit("disconnect"))},this._accountChanged=t=>{if(!t)return;const n=this._publicKey;if(n){try{t=new e.PublicKey(t.toBytes())}catch(e){return void this.emit("error",new N(e?.message,e))}n.equals(t)||(this._publicKey=t,this.emit("connect",t))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=t,this._readyState!==_.Unsupported&&(W((()=>!(!window.solflare?.isSolflare&&!window.SolflareApp||(this._readyState=_.Installed,this.emit("readyStateChange",this._readyState),0)))),hn())}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){return!!this._wallet?.connected}get readyState(){return this._readyState}async autoConnect(){this.readyState===_.Loadable&&z()||await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==_.Loadable&&this._readyState!==_.Installed)throw new I;if(this.readyState===_.Loadable&&z()){const e=encodeURIComponent(window.location.href),t=encodeURIComponent(window.location.origin);return void(window.location.href=`https://solflare.com/ul/v1/browse/${e}?ref=${t}`)}let t,n,r;try{t=(await o.e(881).then(o.bind(o,4881))).default}catch(e){throw new M(e?.message,e)}try{n=new t({network:this._config.network})}catch(e){throw new R(e?.message,e)}if(this._connecting=!0,!n.connected)try{await n.connect()}catch(e){throw new x(e?.message,e)}if(!n.publicKey)throw new x;try{r=new e.PublicKey(n.publicKey.toBytes())}catch(e){throw new N(e?.message,e)}n.on("disconnect",this._disconnected),n.on("accountChanged",this._accountChanged),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}
1catch(e){this.emit("error",new O(e?.message,e))}}this.emit("disconnect")}async sendTransaction(e,t,n={}){try{const r=this._wallet;if(!r)throw new B;try{const{signers:o,...i}=n;return G(e)?o?.length&&e.sign(o):(e=await this.prepareTransaction(e,t,i),o?.length&&e.partialSign(...o)),i.preflightCommitment=i.preflightCommitment||t.commitment,await r.signAndSendTransaction(e,i)}catch(e){if(e instanceof T)throw e;throw new V(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signTransaction(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signTransaction(e)||e}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signAllTransactions(e)||e}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signMessage(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signMessage(e,"utf8")}catch(e){throw new D(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}class fn extends F{constructor(e={}){super(),this.name="Coinbase Wallet",this.url="https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState="undefined"==typeof window||"undefined"==typeof document?_.Unsupported:_.NotDetected,this._disconnected=()=>{const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new C),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==_.Unsupported&&W((()=>!!window?.coinbaseSolana&&(this._readyState=_.Installed,this.emit("readyStateChange",this._readyState),!0)))}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==_.Installed)throw new I;this._connecting=!0;const t=window.coinbaseSolana;try{await t.connect()}catch(e){throw new x(e?.message,e)}if(!t.publicKey)throw new P;let n;try{n=new e.PublicKey(t.publicKey.toBytes())}catch(e){throw new N(e?.message,e)}t.on("disconnect",this._disconnected),this._wallet=t,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(e){this.emit("error",new O(e?.message,e))}}this.emit("disconnect")}async sendTransaction(e,t,n={}){try{const r=this._wallet;if(!r)throw new B;try{const{signers:o,...i}=n;G(e)?o?.length&&e.sign(o):(e=await this.prepareTransaction(e,t,i),o?.length&&e.partialSign(...o)),i.preflightCommitment=i.preflightCommitment||t.commitment;const{signature:s}=await r.signAndSendTransaction(e,i);return s}catch(e){if(e instanceof T)throw e;throw new V(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signTransaction(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signTransaction(e)||e}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{const t=this._wallet;if(!t)throw new B;try{return await t.signAllTransactions(e)||e}catch(e){throw new L(e?.message,e)}}
1catch(e){throw this.emit("error",e),e}}async signMessage(e){try{const t=this._wallet;if(!t)throw new B;try{const{signature:n}=await t.signMessage(e);return n}catch(e){throw new L(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}var pn,gn;(gn=pn||(pn={})).Mainnet="mainnet-beta",gn.Testnet="testnet",gn.Devnet="devnet";const yn=window.wp.i18n,mn=(e="[App]")=>(...t)=>{window.PPC_WALLET_ANALYTICS_DEBUG&&console.log(e,...t)},wn=mn("[WalletConnection]"),vn=mn("[WalletProviderWrapper]"),bn={"change-wallet":(0,yn.__)("Change wallet","pumpkin-pool-core"),connecting:(0,yn.__)("Connecting …","pumpkin-pool-core"),"copy-address":(0,yn.__)("Copy address","pumpkin-pool-core"),copied:(0,yn.__)("Copied","pumpkin-pool-core"),disconnect:(0,yn.__)("Disconnect","pumpkin-pool-core"),"has-wallet":(0,yn.__)("Connect","pumpkin-pool-core"),"no-wallet":(0,yn.__)("Connect Wallet","pumpkin-pool-core")},An=()=>{const{select:e,connect:n,wallet:r,connected:o}=y(),{visible:i}=Pt();(0,t.useEffect)((()=>{i&&!o&&(window.__ppc_connect_intent=!0,wn("Wallet modal opened - intent set",window.__ppc_connect_intent))}),[i,o]),(0,t.useEffect)((()=>{if(o){const e=new CustomEvent("wallet_connected",{detail:r});return document.dispatchEvent(e),void wn("Dispatched 'wallet_connected' (already connected)",{wallet:r?.adapter?.name||"[unknown]"})}const t=async t=>{!o&&t?.detail?.adapter&&(wn("Received 'wallet_connected' → selecting & connecting",{adapter:t.detail.adapter.name}),await e(t.detail.adapter.name),await n())};return document.addEventListener("wallet_connected",t),()=>{document.removeEventListener("wallet_connected",t),wn("Listener removed")}}),[n,e,o,r])},kn=({customLabels:e={}})=>(0,i.jsx)(Lt,{labels:{...bn,...e}}),Sn=({children:n})=>{const r=pumpkin_pool_core_params?.network||pn.Mainnet,o=pumpkin_pool_core_params?.rpcUrl,s=(0,t.useMemo)((()=>o||(0,e.clusterApiUrl)(r)),[r,o]),a=(0,t.useMemo)((()=>[new Kt,new dn,new fn]),[r]);return(0,t.useEffect)((()=>{window.__ppc_connect_intent=!1,vn("Mounted - reset __ppc_connect_intent to false",{endpoint:s,network:r})}),[s,r]),(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(k,{endpoint:s,children:(0,i.jsx)(Rt,{wallets:a,autoConnect:!0,children:(0,i.jsxs)(Gt,{children:[(0,i.jsx)(An,{}),n]})})})})};o(9404);for(var En={},Tn={byteLength:function(e){var t=On(e),n=t[0],r=t[1];return 3*(n+r)/4-r},toByteArray:function(e){var t,n,r=On(e),o=r[0],i=r[1],s=new Rn(function(e,t,n){return 3*(t+n)/4-n}(0,o,i)),a=0,c=i>0?o-4:o;for(n=0;n<c;n+=4)t=Mn[e.charCodeAt(n)]<<18|Mn[e.charCodeAt(n+1)]<<12|Mn[e.charCodeAt(n+2)]<<6|Mn[e.charCodeAt(n+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===i&&(t=Mn[e.charCodeAt(n)]<<2|Mn[e.charCodeAt(n+1)]>>4,s[a++]=255&t),1===i&&(t=Mn[e.charCodeAt(n)]<<10|Mn[e.charCodeAt(n+1)]<<4|Mn[e.charCodeAt(n+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},fromByteArray:function(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(Pn(e,s,s+i>a?a:s+i));return 1===r?(t=e[n-1],o.push(In[t>>2]+In[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(In[t>>10]+In[t>>4&63]+In[t<<2&63]+"=")),o.join("")}},In=[],Mn=[],Rn="undefined"!=typeof Uint8Array?Uint8Array:Array,xn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cn=0;Cn<64;++Cn)In[Cn]=xn[Cn],Mn[xn.charCodeAt(Cn)]=Cn;function On(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Pn(e,t,n){for(var r,o,i=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),i.push(In[(o=r)>>18&63]+In[o>>12&63]+In[o>>6&63]+In[63&o]);return i.join("")}Mn["-".charCodeAt(0)]=62,Mn["_".charCodeAt(0)]=63;var Nn={read:function(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?o-1:0,d=n?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-l)-1,f>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=d,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),i-=u}return(f?-1:1)*s*Math.pow(2,i-r)},write:function(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,h=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+f]=255&a,f+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}};!function(e){const t=Tn,n=Nn,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;function i(e){if(e>
vendor: 21,466 bytes, line 1
1o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let r=i(n);const o=r.write(e,t);return o!==n&&(r=r.slice(0,o)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return s.from(r,t,n);const o=function(e){if(s.isBuffer(e)){const t=0|d(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?i(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),i(e<0?0:0|d(e))}function l(e){const t=e.length<0?0:0|d(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function d(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(o)return r?-1:K(e).length;t=(""+t).toLowerCase(),o=!0}}function p(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,o){let i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function w(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(Y(r))return s;e[n+s]=r}return s}function v(e,t,n,r){return q(K(t,e.length-n),e,n,r)}function b(e,t,n,r){return q(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function A(e,t,n,r){return q(F(t),e,n,r)}function k(e,t,n,r){return q(function(e,t){let n,r,o;const i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function S(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,s=t>239?4:t>223?3:t>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],a=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(e){const t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=E));return n}(r)}e.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,n){return a(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},s.allocUnsafe=function(e){return u(e)},s.allocUnsafeSlow=function(e){return u(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(H(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=s.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(H(t,Uint8Array))o+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,o){if(H(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const c=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<c;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},s.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function I(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function M(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=$[e[r]];return o}function R(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function x(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,o){U(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function P(e,t,n,r,o){U(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function N(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,r,o,i){return t=+t,r>>>=0,i||N(e,0,r,4),n.write(e,t,r,o,23,4),r+4}function V(e,t,r,o,i){return t=+t,r>>>=0,i||N(e,0,r,8),n.write(e,t,r,o,52,8),r+8}s.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),s.prototype.readBigUInt64BE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||z(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||C(this,e,t,n,Math.pow(2,8*n)-1,0);let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||C(this,e,t,n,Math.pow(2,8*n)-1,0);let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Z((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);C(this,e,t,n,r-1,-r)}let o=0,i=1,s=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);C(this,e,t,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i|0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Z((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return V(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},s.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=s.isBuffer(e)?e:s.from(e,r),a=i.length;
vendor: 6,095 bytes, line 1
1if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const L={};function D(e,t,n){L[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new L.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||z(t,e.length-(n+1))}(r,o,i)}function W(e,t){if("number"!=typeof e)throw new L.ERR_INVALID_ARG_TYPE(t,"number",e)}function z(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new L.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=j(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=j(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function K(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function F(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}}(En);var Bn=void 0!==o.g?o.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Vn="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};function Ln(e,t){var n={seen:[],stylize:jn};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Gn(t)?n.showHidden=t:t&&function(e,t){if(!t||!Yn(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]]}(n,t),qn(n.showHidden)&&(n.showHidden=!1),qn(n.depth)&&(n.depth=2),qn(n.colors)&&(n.colors=!1),qn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Dn),Un(n,e,n.depth)}function Dn(e,t){var n=Ln.styles[t];return n?"�["+Ln.colors[n][0]+"m"+e+"�["+Ln.colors[n][1]+"m":e}function jn(e,t){return e}function Un(e,t,n){if(e.customInspect&&t&&Qn(t.inspect)&&t.inspect!==Ln&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Fn(r)||(r=Un(e,r,n)),r}var o=function(e,t){if(qn(t))return e.stylize("undefined","undefined");if(Fn(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return"number"==typeof t?e.stylize(""+t,"number"):Gn(t)?e.stylize(""+t,"boolean"):Kn(t)?e.stylize("null","null"):void 0}(e,t);if(o)return o;var i=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),Zn(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return Wn(t);if(0===i.length){if(Qn(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(Hn(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if($n(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Zn(t))return Wn(t)}var c,u,l="",h=!1,d=["{","}"];return c=t,Array.isArray(c)&&(h=!0,d=["[","]"]),Qn(t)&&(l=" [Function"+(t.name?": "+t.name:"")+"]"),Hn(t)&&(l=" "+RegExp.prototype.toString.call(t)),$n(t)&&(l=" "+Date.prototype.toUTCString.call(t)),Zn(t)&&(l=" "+Wn(t)),0!==i.length||h&&0!=t.length?n<0?Hn(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=h?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s<a;++s)er(t,String(s))?i.push(zn(e,t,n,r,String(s),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(zn(e,t,n,r,o,!0))})),i}(e,t,n,s,i):i.map((function(r){return zn(e,t,n,s,r,h)})),e.seen.pop(),function(e,t,n){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}
1(u,l,d)):d[0]+l+d[1]}function Wn(e){return"["+Error.prototype.toString.call(e)+"]"}function zn(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),er(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=Kn(n)?Un(e,c.value,null):Un(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map((function(e){return"  "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return"   "+e})).join("\n")):a=e.stylize("[Circular]","special")),qn(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function Gn(e){return"boolean"==typeof e}function Kn(e){return null===e}function Fn(e){return"string"==typeof e}function qn(e){return void 0===e}function Hn(e){return Yn(e)&&"[object RegExp]"===Xn(e)}function Yn(e){return"object"==typeof e&&null!==e}function $n(e){return Yn(e)&&"[object Date]"===Xn(e)}function Zn(e){return Yn(e)&&("[object Error]"===Xn(e)||e instanceof Error)}function Qn(e){return"function"==typeof e}function Jn(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Xn(e){return Object.prototype.toString.call(e)}function er(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tr(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0}Ln.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Ln.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var nr,rr=Object.prototype.hasOwnProperty,or=Object.keys||function(e){var t=[];for(var n in e)rr.call(e,n)&&t.push(n);return t},ir=Array.prototype.slice;function sr(){return void 0!==nr?nr:nr="foo"===function(){}.name}function ar(e){return Object.prototype.toString.call(e)}function cr(e){return!En.isBuffer(e)&&"function"==typeof Bn.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer)))}function ur(e,t){e||gr(e,!0,t,"==",yr)}var lr=/\s*function\s+([^\(\s]*)\s*/;function hr(e){if(Qn(e)){if(sr())return e.name;var t=e.toString().match(lr);return t&&t[1]}}function dr(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return fr(pr(e.actual),128)+" "+e.operator+" "+fr(pr(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||gr;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=hr(t),i=r.indexOf("\n"+o);if(i>=0){var s=r.indexOf("\n",i+1);r=r.substring(s+1)}this.stack=r}}}function fr(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function pr(e){if(sr()||!Qn(e))return Ln(e);var t=hr(e);return"[Function"+(t?": "+t:"")+"]"}function gr(e,t,n,r,o){throw new dr({message:n,actual:e,expected:t,operator:r,stackStartFunction:o})}function yr(e,t){e||gr(e,!0,t,"==",yr)}function mr(e,t,n,r){if(e===t)return!0;if(En.isBuffer(e)&&En.isBuffer(t))return 0===tr(e,t);if($n(e)&&$n(t))return e.getTime()===t.getTime();if(Hn(e)&&Hn(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(cr(e)&&cr(t)&&ar(e)===ar(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===tr(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(En.isBuffer(e)!==En.isBuffer(t))return!1;var o=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==o&&o===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(Jn(e)||Jn(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var o=wr(e),i=wr(t);if(o&&!i||!o&&i)return!1;if(o)return mr(e=ir.call(e),t=ir.call(t),n);var s,a,c=or(e),u=or(t);if(c.length!==u.length)return!1;for(c.sort(),u.sort(),a=c.length-1;a>=0;a--)if(c[a]!==u[a])return!1;for(a=c.length-1;a>=0;a--)if(!mr(e[s=c[a]],t[s],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function wr(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function vr(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function br(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&gr(o,n,"Missing expected exception"+r);var i="string"==typeof r,s=!e&&o&&!n;if((!e&&Zn(o)&&i&&vr(o,n)||s)&&gr(o,n,"Got unwanted exception"+r),e&&o&&n&&!vr(o,n)||!e&&o)throw o}ur.AssertionError=dr,Vn(dr,Error),ur.fail=gr,ur.ok=yr,ur.equal=function e(t,n,r){t!=n&&gr(t,n,r,"==",e)},ur.notEqual=function e(t,n,r){t==n&&gr(t,n,r,"!=",e)},ur.deepEqual=function e(t,n,r){mr(t,n,!1)||gr(t,n,r,"deepEqual",e)},ur.deepStrictEqual=function e(t,n,r){mr(t,n,!0)||gr(t,n,r,"deepStrictEqual",e)},ur.notDeepEqual=function e(t,n,r){mr(t,n,!1)&&gr(t,n,r,"notDeepEqual",e)},ur.notDeepStrictEqual=function e(t,n,r){mr(t,n,!0)&&gr(t,n,r,"notDeepStrictEqual",e)},ur.strictEqual=function e(t,n,r){t!==n&&gr(t,n,r,"===",e)},ur.notStrictEqual=function e(t,n,r){t===n&&gr(t,n,r,"!==",e)},ur.throws=function(e,t,n){br(!0,e,t,n)},ur.doesNotThrow=function(e,t,n){br(!1,e,t,n)},ur.ifError=function(e){if(e)throw e};var Ar={};class kr{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function _r(e,t){return t.property?e+"["+t.property+"]":e}Ar.Layout=kr,Ar.nameWithProperty=_r,Ar.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof kr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class Sr extends kr{isCount(){throw new Error("ExternalLayout is abstract")}}class Er extends Sr{constructor(e,t){if(void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){void 0===t&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}class Tr extends Sr{constructor(e,t,n){if(!(e instanceof kr))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof Ir||this.layout instanceof Mr}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class Ir extends kr{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}class Mr extends kr{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}class Rr extends kr{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}class xr extends kr{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}const Cr=Math.pow(2,32);function Or(e){const t=Math.floor(e/Cr);return{hi32:t,lo32:e-t*Cr}}function Pr(e,t){return e*Cr+t}class Nr extends kr{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return Pr(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=Or(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}class Br extends kr{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),Pr(e.readUInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=Or(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class Vr extends kr{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return Pr(e.readInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=Or(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}class Lr extends kr{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),Pr(e.readInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=Or(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class Dr extends kr{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}class jr extends kr{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}class Ur extends kr{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}class Wr extends kr{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}class zr extends kr{constructor(e,t,n){if(!(e instanceof kr))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof Sr&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(t instanceof Sr)&&0<e.span&&(r=t*e.span),super(r,n),this.elementLayout=e,this.count=t}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0,r=this.count;if(r instanceof Sr&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let o=0;for(;o<r;)n+=this.elementLayout.getSpan(e,t+n),++o}return n}decode(e,t){void 0===t&&(t=0);const n=[];let r=0,o=this.count;for(o instanceof Sr&&(o=o.decode(e,t));r<o;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t,n){void 0===n&&(n=0);const r=this.elementLayout,o=e.reduce(((e,o)=>e+r.encode(o,t,n+e)),0);return this.count instanceof Sr&&this.count.encode(e.length,t,n),o}}class Gr extends kr{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof kr),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const o=r.getSpan(e,t);return t+=o,n+o}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let o=0,i=0;for(const r of this.fields){let s=r.span;if(i=0<s?s:0,void 0!==r.property){const o=e[r.property];void 0!==o&&(i=r.encode(o,t,n),0>s&&(s=r.getSpan(t,n)))}o=n,n+=s}return o+i-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class Kr{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class Fr extends Kr{constructor(e,t){if(!(e instanceof Sr&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");
1super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class qr extends kr{constructor(e,t,n){const r=e instanceof Ir||e instanceof Mr;if(r)e=new Fr(new Tr(e));else if(e instanceof Sr&&e.isCount())e=new Fr(e);else if(!(e instanceof Kr))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof kr))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&r&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return i(e)},this.configGetSourceVariant=function(e){i=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,o=r.decode(e,t);let i=this.registry[o];if(void 0===i){let s=0;i=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=o,n[i.property]=this.defaultLayout.decode(e,t+s)}else n=i.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,o=this.defaultLayout;let i=0;return this.usesPrefixDiscriminator&&(i=r.layout.span),r.encode(e[r.property],t,n),i+o.encode(e[o.property],t,n+i)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new Hr(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return En.Buffer.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class Hr extends kr{constructor(e,t,n,r){if(!(e instanceof qr))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof kr))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),o+=this.layout.getSpan(t,n+r),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function Yr(e){return 0>e&&(e+=4294967296),e}class $r extends kr{constructor(e,t,n){if(!(e instanceof Ir||e instanceof Mr))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===n&&(n=t,t=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!t,this.fields=[];let r=0;this._packedSetValue=function(e){return r=Yr(e),this},this._packedGetValue=function(){return r}}decode(e,t){const n=this.makeDestinationObject();void 0===t&&(t=0);const r=this.word.decode(e,t);this._packedSetValue(r);for(const e of this.fields)void 0!==e.property&&(n[e.property]=e.decode(r));return n}encode(e,t,n){void 0===n&&(n=0);const r=this.word.decode(t,n);this._packedSetValue(r);for(const t of this.fields)if(void 0!==t.property){const n=e[t.property];void 0!==n&&t.encode(n)}return this.word.encode(this._packedGetValue(),t,n)}addField(e,t){const n=new Zr(this,e,t);return this.fields.push(n),n}addBoolean(e){const t=new Qr(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}class Zr{constructor(e,t,n){if(!(e instanceof $r))throw new TypeError("container must be a BitStructure");
1if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const r=8*e.span,o=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+o>r)throw new Error("bits too long for span remainder ("+(r-o)+" of "+r+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=r-o-t),this.wordMask=Yr(this.valueMask<<this.start),this.property=n}decode(){return Yr(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if(!Number.isInteger(e)||e!==Yr(e&this.valueMask))throw new TypeError(_r("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=Yr(e<<this.start);this.container._packedSetValue(Yr(t&~this.wordMask)|n)}}class Qr extends Zr{constructor(e,t){super(e,1,t)}decode(e,t){return!!Zr.prototype.decode.call(this,e,t)}encode(e){return"boolean"==typeof e&&(e=+e),Zr.prototype.encode.call(this,e)}}class Jr extends kr{constructor(e,t){if(!(e instanceof Sr&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof Sr||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof Sr&&(r=e.length),!En.Buffer.isBuffer(e)||r!==e.length)throw new TypeError(_r("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof Sr&&this.length.encode(r,t,n),r}}class Xr extends kr{constructor(e){super(-1,e)}getSpan(e,t){if(!En.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);let n=t;for(;n<e.length&&0!==e[n];)n+=1;return 1+n-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const r=new En.Buffer(e,"utf8"),o=r.length;if(n+o>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+o]=0,o+1}}class eo extends kr{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!En.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const r=new En.Buffer(e,"utf8"),o=r.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(n+o>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),o}}class to extends kr{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}Ar.ExternalLayout=Sr,Ar.GreedyCount=Er,Ar.OffsetLayout=Tr,Ar.UInt=Ir,Ar.UIntBE=Mr,Ar.Int=Rr,Ar.IntBE=xr,Ar.Float=Dr,Ar.FloatBE=jr,Ar.Double=Ur,Ar.DoubleBE=Wr,Ar.Sequence=zr,Ar.Structure=Gr,Ar.UnionDiscriminator=Kr,Ar.UnionLayoutDiscriminator=Fr,Ar.Union=qr,Ar.VariantLayout=Hr,Ar.BitStructure=$r,Ar.BitField=Zr,Ar.Boolean=Qr,Ar.Blob=Jr,Ar.CString=Xr,Ar.UTF8=eo,Ar.Constant=to,Ar.greedy=(e,t)=>new Er(e,t),Ar.offset=(e,t,n)=>new Tr(e,t,n);var no=Ar.u8=e=>new Ir(1,e);Ar.u16=e=>new Ir(2,e),Ar.u24=e=>new Ir(3,e);var ro=Ar.u32=e=>new Ir(4,e);Ar.u40=e=>new Ir(5,e),Ar.u48=e=>new Ir(6,e),Ar.nu64=e=>new Nr(e),Ar.u16be=e=>new Mr(2,e),Ar.u24be=e=>new Mr(3,e),Ar.u32be=e=>new Mr(4,e),Ar.u40be=e=>new Mr(5,e),Ar.u48be=e=>new Mr(6,e),Ar.nu64be=e=>new Br(e),Ar.s8=e=>new Rr(1,e),Ar.s16=e=>new Rr(2,e),Ar.s24=e=>new Rr(3,e),Ar.s32=e=>new Rr(4,e),Ar.s40=e=>new Rr(5,e),Ar.s48=e=>new Rr(6,e),Ar.ns64=e=>new Vr(e),Ar.s16be=e=>new xr(2,e),Ar.s24be=e=>new xr(3,e),Ar.s32be=e=>new xr(4,e),Ar.s40be=e=>new xr(5,e),Ar.s48be=e=>new xr(6,e),Ar.ns64be=e=>new Lr(e),Ar.f32=e=>new Dr(e),Ar.f32be=e=>new jr(e),Ar.f64=e=>new Ur(e),Ar.f64be=e=>new Wr(e);
1var oo=Ar.struct=(e,t,n)=>new Gr(e,t,n);Ar.bits=(e,t,n)=>new $r(e,t,n),Ar.seq=(e,t,n)=>new zr(e,t,n),Ar.union=(e,t,n)=>new qr(e,t,n),Ar.unionLayoutDiscriminator=(e,t)=>new Fr(e,t);var io=Ar.blob=(e,t)=>new Jr(e,t);Ar.cstr=e=>new Xr(e),Ar.utf8=(e,t)=>new eo(e,t),Ar.const=(e,t)=>new to(e,t);const so=(e="publicKey")=>io(32,e),ao=(e="uint64")=>io(8,e);new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new e.PublicKey("So11111111111111111111111111111111111111112"),oo([ro("mintAuthorityOption"),so("mintAuthority"),ao("supply"),no("decimals"),no("isInitialized"),ro("freezeAuthorityOption"),so("freezeAuthority")]),oo([so("mint"),so("owner"),ao("amount"),ro("delegateOption"),so("delegate"),no("state"),ro("isNativeOption"),ao("isNative"),ao("delegatedAmount"),ro("closeAuthorityOption"),so("closeAuthority")]),oo([no("m"),no("n"),no("is_initialized"),so("signer1"),so("signer2"),so("signer3"),so("signer4"),so("signer5"),so("signer6"),so("signer7"),so("signer8"),so("signer9"),so("signer10"),so("signer11")]);var co=o(255);function uo(){const{connection:n}=w(),{wallet:r,connected:o,signTransaction:i}=y();return(0,t.useCallback)((async({transaction:t,extraSigners:s=[]})=>{if(!r?.adapter.publicKey||!o||!i)throw new Error("Wallet not connected");try{const o=await n.getLatestBlockhash();t.recentBlockhash=o?.blockhash,t.lastValidBlockHeight=o?.lastValidBlockHeight,t.feePayer=r?.adapter?.publicKey,s.length&&t.partialSign(...s);const a=await i(t);return{success:!0,signature:await(0,e.sendAndConfirmRawTransaction)(n,a.serialize(),{blockhash:o?.blockhash},{maxRetries:3,commitment:"confirmed"})}}catch(e){return{success:!1,error:e}}}),[r?.adapter.publicKey,o,i,n])}o(8287).Buffer,mn("[SwapApi]"),new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),new e.PublicKey("Stake11111111111111111111111111111111111111"),pumpkin_pool_core_params;var lo=o(4945),ho=o.n(lo);const fo=mn("[TokenList]");let po=null;function go(e){const n=function(){const{connection:e}=w(),[n,r]=(0,t.useState)([]),[o,i]=_t("pumkins-pool-local-token-list",{timestamp:null,endpoint:"",data:[]});return(0,t.useEffect)((()=>{o.endpoint===e?.rpcEndpoint&&o.data.length>0&&o.timestamp&&Date.now()-o.timestamp<36e5?r(o.data):(async()=>{const t=await(async()=>{if(fo("Starting.."),po)return fo("Cached.."),po;const e=[{name:"v2-lite-verified",url:"https://lite-api.jup.ag/tokens/v2/tag?query=verified"},{name:"v2-api-verified",url:"https://api.jup.ag/tokens/v2/tag?query=verified"}],t=async({name:e,url:t})=>{var n;fo(`[${e}] Fetch -> ${t}`);const r=await ho()(t);if(fo(`[${e}] Status:`,r.status),!r.ok)throw new Error(`[${e}] HTTP ${r.status}`);const o=await r.json(),i=Array.isArray(o),s=i?o.length:null!==(n=o?.tokens?.length)&&void 0!==n?n:"n/a";fo(`[${e}] OK. Parsed. Count: ${s}`);const a=i?o[0]:void 0;if(a&&"object"==typeof a){const t=Object.keys(a).slice(0,8);fo(`[${e}] First item sample keys:`,t.join(", ")),fo(`[${e}] Shape hints → has id:${"id"in a}, has address:${"address"in a}, has icon:${"icon"in a}, has logoURI:${"logoURI"in a}`)}return o},n=(e,t)=>{const n=Array.isArray(e)?e:Array.isArray(e?.tokens)?e.tokens:[];if(!Array.isArray(n))return fo(`[${t}] normalizeTokens: payload not array-like`),[];let r=0;const o=n.map((e=>{const t=e&&"object"==typeof e&&"id"in e;t&&r++;const n=t?e.id:e.address,o=t?e.icon||null:e.logoURI||null,i=Number.isFinite(e.decimals)?e.decimals:0;return{address:n,id:n,name:e.name||"",symbol:e.symbol||"",decimals:i,logoURI:o,tags:Array.isArray(e.tags)?e.tags:[],isVerified:t?Boolean(e.isVerified):Array.isArray(e.tags)&&e.tags.includes("verified")}}));return fo(`[${t}] normalizeTokens: total=${o.length}, v2Shape=${r}`),o};return fo("Api request ..."),po=(async()=>{let r=null;for(let o=0;o<e.length;o++){const i=e[o];try{const e=await t(i),r=n(e,i.name);if(fo(`[${i.name}] Normalized count: ${r.length}`),!r.some((e=>e.address)))throw fo(`[${i.name}] Warning: normalized tokens missing "address" – continuing fallback`),new Error(`[${i.name}] No valid tokens`);return r}catch(t){r=t,console.error(`Error on ${i.name}:`,t),fo(`Error on ${i.name}:`,t?.message||t),o<e.length-1&&fo(`Trying next endpoint (${e[o+1].name})...`)}}return fo("All endpoints failed."),r&&console.error("Final error:",r),[]})(),po})();if(!t)return;r(t);const n={timestamp:Date.now(),endpoint:e?.rpcEndpoint,data:t};JSON.stringify(n).length>2e6?fo("Token list too large to cache; kept in memory only."):i(n)})()}),[o.data,o.endpoint,o.timestamp,e?.rpcEndpoint,i]),n}(),[r,o]=(0,t.useState)([]);return(0,t.useEffect)((()=>
1{if(0===n.length)return;const t=n.find((t=>t.address===e));t&&o(t)}),[n,e]),r}function yo(){const{connection:e}=w(),[n,r]=(0,t.useState)(null);return(0,t.useEffect)((()=>{const t=new co.SplGovernance(e);r(t)}),[e]),n}const mo=e=>e?Object.keys(e)[0]:null,wo=e=>{const t=mo(e.state),n=e?.governanceConfig,r={state:t,label:t,time:1e3*e?.signingOffAt?.toNumber()};if("draft"===t&&(r.time=1e3*e?.unixTimestamp?.toNumber()),!n)return r;const o=1e3*n?.config?.votingBaseTime,i=1e3*n?.config?.votingCoolOffTime,s=Date.now();return"voting"===t&&i>0&&o>0&&(r.time+o<s&&r.time+o+i>s&&(r.state="coolOff",r.label="Cooling Off"),r.time+o+i<s&&(r.state="finalizing",r.label="Finalizing")),r},vo=window.wp.components,bo=pumpkin_pool_core_params?.daoAccount||"EpvSHe3dnTQvz5qK8ks7zEbzA3ZABqaXW7fJfr8ULFiy",Ao=new e.PublicKey("GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"),ko=e=>{const{unixTimestamp:t,votingAt:n,signingOffAt:r}=e||{},o=[t,n,r].find((e=>null!=e));if(null==o)return"";let i=null;if("function"==typeof o?.toNumber)i=o.toNumber();else if("number"==typeof o)i=o;else if("string"==typeof o){const e=o.replace(/^0x/i,""),t=/^[0-9a-f]+$/i.test(e);i=parseInt(e,t?16:10)}return Number.isFinite(i)?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(1e3*i)):""},_o=({realm:r,proposal:o,isProposalView:h=!1,children:d})=>{const f=yo(),{wallet:p,connected:g}=y(),{connection:m}=w(),[k,_]=(0,t.useState)([]),S=o?.voteData,[E,T]=(0,t.useState)(!1),[I,M]=(0,t.useState)(!1),[R,x]=(0,t.useState)(null),C=wo(o),O="voting"===C.state,P=["voting","coolOff"].includes(C.state),[N,B]=(0,t.useState)([]),V=uo(),L=e=>k.includes(e),D=async(t,n=null)=>{try{if(!f||!o)throw new Error("Invalid proposal");if(!p?.adapter?.publicKey)throw new Error("Invalid wallet");if(!r?.authority||!r?.publicKey)throw new Error("Invalid realm account");T(!0);const i=((e,t=null,n=1)=>{switch(e){case"Approve":const e=[];if(1===n)e.push(new v.VoteChoice({rank:0,weightPercentage:100}));else{t=Array.isArray(t)?t:[t];for(let r=0;r<n;r++)e.push(new v.VoteChoice({rank:0,weightPercentage:t.includes(r)?100:0}))}return new v.Vote({voteType:v.VoteKind.Approve,approveChoices:e,deny:void 0,veto:void 0});case"Deny":return new v.Vote({voteType:v.VoteKind.Deny,approveChoices:void 0,deny:!0,veto:void 0});case"Veto":return new v.Vote({voteType:v.VoteKind.Veto,approveChoices:void 0,deny:void 0,veto:!0});case"Abstain":return new v.Vote({voteType:v.VoteKind.Abstain,approveChoices:void 0,deny:void 0,veto:void 0});default:return null}})(t,n,S?.choices.length);if(!i)throw new Error("Invalid vote format");const s=await(0,v.getTokenOwnerRecordAddress)(Ao,r.publicKey,o?.governingTokenMint,p?.adapter.publicKey),a=await(0,b.getGovernanceProgramVersion)(m,Ao),c=[];if(await(0,A.withCastVote)(c,Ao,a,r.publicKey,o?.governance,o?.publicKey,o?.tokenOwnerRecord,s,p?.adapter?.publicKey,o?.governingTokenMint,i,p?.adapter?.publicKey),!c.length)throw new Error("Invalid vote instructions");const u=(new e.Transaction).add(...c),l=await V({transaction:u});if(!l?.success)throw new Error(l?.error);B([]),T(!1),M(!0),setTimeout((()=>{jQuery("body").trigger("pumpkin_pool_core_refresh_proposal",[o])}),1e3)}catch(e){console.error(e?.message||e),T(!1),B([{type:"error",message:(0,yn.__)("There was an error casting the vote. Please try again.","pumpkin-pool-core")}])}},j=async()=>{try{if(!f||!o)throw new Error("Invalid proposal");if(!p?.adapter?.publicKey)throw new Error("Invalid wallet");if(!r?.authority||!r?.publicKey)throw new Error("Invalid realm account");if(!R)throw new Error("Invalid user vote");T(!0);const t=await(0,v.getTokenOwnerRecordAddress)(Ao,r.publicKey,o?.governingTokenMint,p?.adapter.publicKey),n=await(0,b.getGovernanceProgramVersion)(m,Ao),i=[];if(await(0,A.withRelinquishVote)(i,Ao,n,r.publicKey,o?.governance,o?.publicKey,t,o?.governingTokenMint,R?.publicKey,p?.adapter?.publicKey,p?.adapter?.publicKey),!i.length)throw new Error("Invalid withdraw instructions");const s=(new e.Transaction).add(...i),a=await V({transaction:s});if(!a?.success)throw new Error(a?.error);B([]),T(!1),x(null),M(!0),setTimeout((()=>{jQuery("body").trigger("pumpkin_pool_core_refresh_proposal",[o])}),1e3)}catch(e){console.error(e?.message||e),T(!1),B([{type:"error",message:(0,yn.__)("There was an error withdrawing the vote. Please try again.","pumpkin-pool-core")}])}};if((0,t.useEffect)((()=>{S?.error&&B([{type:"error",message:(0,yn.__)("Failed to retrieve voting data. Please refresh the page.","pumpkin-pool-core")}]),M(!1)}),[S]),(0,t.useEffect)((()=>
1{if(!g||!p?.adapter?.publicKey||!S?.votes)return x(null),void _([]);const e=S.votes.find((e=>e.governingTokenOwner.toString()===p.adapter.publicKey.toString()));if(x(e||null),e&&"multiChoice"===S.type){const t=[];try{"object"==typeof e?.vote?.approve&&Array.isArray(Object.values(e?.vote?.approve)[0])&&Object.values(e?.vote?.approve)[0].forEach(((e,n)=>{e&&e.weightPercentage>0&&t.push(n)}))}catch(e){console.error("Error parsing user choices:",e)}_(t)}}),[g,p?.adapter?.publicKey,S?.votes,S?.type]),h||k.length||O||P)return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting",children:"singleChoice"===S?.type?(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results single-choice",direction:"column",gap:2,children:(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result",gap:1,direction:"column",children:[(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result-votes",children:[(0,i.jsxs)(vo.Flex,{justify:"flex-start",direction:"column",gap:h?1:0,children:[h&&(O&&!R||P&&R&&Object.keys(R?.vote||{}).includes("approve"))&&(0,i.jsxs)("button",{className:"pumpkin-dao-body-proposals-item-body-vote-cast-button approve"+(R?" selected":""),onClick:()=>R?j():D("Approve"),disabled:!g||E||I,children:[(0,i.jsx)(n,{icon:s,width:20,height:20}),R&&Object.keys(R?.vote||{}).includes("approve")?(0,yn.__)("Withdraw Yes Vote","pumpkin-pool-core"):(0,yn.__)("Vote Yes","pumpkin-pool-core")]}),(0,i.jsx)("span",{className:"vote-label",children:(0,yn.__)("Yes","pumpkin-pool-core")}),(0,i.jsxs)("div",{className:"vote-stat",children:[(0,i.jsxs)("span",{className:"vote-stat-count",children:[S?.choices[0]?.votesApproved||0," "]}),(0,i.jsx)("span",{className:"vote-stat-percentage",children:`${S?.choices[0]?.votesApprovedPercentage||0}%`})]})]}),(0,i.jsxs)(vo.Flex,{justify:"flex-end",direction:"column",gap:0,children:[h&&(O&&!R||P&&R&&Object.keys(R?.vote||{}).includes("deny"))&&(0,i.jsxs)("button",{className:"pumpkin-dao-body-proposals-item-body-vote-cast-button reject"+(R?" selected":""),onClick:()=>R?j():D("Deny"),disabled:!g||E||I,children:[(0,i.jsx)(n,{icon:a,width:20,height:20}),R&&Object.keys(R?.vote||{}).includes("deny")?(0,yn.__)("Withdraw No Vote","pumpkin-pool-core"):(0,yn.__)("Vote No","pumpkin-pool-core")]}),(0,i.jsx)("span",{className:"vote-label align-right",children:(0,yn.__)("No","pumpkin-pool-core")}),(0,i.jsxs)("div",{className:"vote-stat align-right",children:[(0,i.jsxs)("span",{className:"vote-stat-count",children:[S?.choices[0]?.votesRejected||0," "]}),(0,i.jsx)("span",{className:"vote-stat-percentage",children:`${S?.choices[0]?.votesRejectedPercentage||0}%`})]})]})]}),(0,i.jsx)(vo.ProgressBar,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result-percentage"+(S?.choices[0]?.votesRejected>0?" has-rejected":""),value:Math.round(S?.choices[0]?.votesApprovedPercentage)||0})]})}):(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results multi-choice",direction:"column",gap:2,children:[S?.choices.map(((e,t)=>(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result",gap:2,direction:"column",children:[h&&(O&&!R||null!==R)&&(0,i.jsxs)("button",{className:"pumpkin-dao-body-proposals-item-body-vote-cast-button option"+(L(t)?" selected":""),onClick:()=>O&&!R?L(t)?_(k.filter((e=>e!==t))):_([...k,t]):null,disabled:!O||!!R||!g||E||I,children:[(0,i.jsx)(n,{icon:L(t)?c:u,width:20,height:20}),R?L(t)?(0,yn.__)("You voted for this option","pumpkin-pool-core"):(0,yn.__)("You didn't vote for this option","pumpkin-pool-core"):(0,yn.__)("Vote this option","pumpkin-pool-core")]}),(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result-votes",children:[(0,i.jsxs)(vo.Flex,{justify:"flex-start",children:[(0,i.jsxs)("span",{className:"vote-label",children:[e.label,":"]}),(0,i.jsx)("span",{className:"vote-stat",children:`${e.votesApproved||0} ${(0,yn.__)("votes","pumpkin-pool-core")}`})]}),(0,i.jsx)(vo.Flex,{justify:"flex-end",children:`${e.votesApprovedPercentage||0}%`})]}),(0,i.jsx)(vo.ProgressBar,{className:"pumpkin-dao-body-proposals-item-body-voting-results-result-percentage",value:Math.round(e.votesApprovedPercentage)||0})]},t))),h&&(P&&R?(0,i.jsxs)("button",{className:"pumpkin-dao-body-proposals-item-body-vote-cast-button withdraw-multi",onClick:j,disabled:E||I,children:[(0,i.jsx)(n,{icon:l,width:20,height:20}),(0,yn.__)("Withdraw your vote","pumpkin-pool-core")]}):O&&!R?(0,i.jsx)(vo.Tooltip,{text:(0,yn.__)("Select one or more options to cast your vote","pumpkin-pool-core"),children:(0,i.jsxs)("button",{className:"pumpkin-dao-body-proposals-item-body-vote-cast-button approve-multi",onClick:()=>
1D("Approve",k),disabled:!g||E||!k.length||I,children:[(0,i.jsx)(n,{icon:s,width:20,height:20}),(0,yn.__)("Complete your voting","pumpkin-pool-core")]})}):void 0)]})}),N.length>0&&(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-voting-messages",direction:"column",gap:2,children:N.map(((e,t)=>(0,i.jsx)(vo.FlexItem,{className:`pumpkin-dao-body-proposals-item-body-voting-messages-message ${e.type}`,children:e.message},t)))}),d]})},So=({realm:n,proposal:r})=>{const o=yo(),{wallet:s,connected:a}=y(),c=uo(),[u,l]=(0,t.useState)([]),[h,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(""),[g,m]=(0,t.useState)(!1),[w,b]=(0,t.useState)([]),k=e=>{const t=mo(e?.body?.text||{})?e?.body?.text[mo(e?.body?.text||{})]:"";return{author:e?.author,message:t,postedAt:1e3*e?.unixTimestamp,isLocal:!1}};(0,t.useEffect)((()=>{if(!r?.publicKey||!o)return;const e=async()=>{try{d(!0),b([]);const e=await o.getChatMessagesByProposal(r.publicKey);l(e.map(k).sort(((e,t)=>t.postedAt-e.postedAt))),d(!1)}catch(e){console.error("Error fetching chat messages:",e),b([{type:"error",message:(0,yn.__)("Failed to load discussion messages. Please try again.","pumpkin-pool-core")}]),d(!1)}};return e(),jQuery("body").on("pumpkin_pool_core_refresh_proposal_messages",((t,n)=>{n?.publicKey===r.publicKey&&e()})),()=>{jQuery("body").off("pumpkin_pool_core_refresh_proposal_messages")}}),[r?.publicKey,o]);const _=e=>{if(!e)return"";const t=e.toString();return`${t.substring(0,4)}...${t.substring(t.length-4)}`};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-discussion",direction:"column",gap:2,children:[(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-discussion-header",children:(0,i.jsxs)(vo.FlexItem,{className:"pumpkin-dao-body-proposals-item-body-discussion-header-title",children:[(0,yn.__)("Discussion","pumpkin-pool-core"),(0,i.jsx)("span",{className:"pumpkin-dao-body-proposals-item-body-discussion-header-title-counter",children:`(${u.length})`})]})}),a?(0,i.jsx)("form",{onSubmit:async t=>{t.preventDefault();try{if(!o||!r)throw new Error("Invalid proposal");if(!s?.adapter?.publicKey)throw new Error("Invalid wallet");if(!n?.authority||!n?.publicKey)throw new Error("Invalid realm account");if(!f.trim())throw new Error("Message cannot be empty");m(!0);const t=Date.now(),i={author:s.adapter.publicKey.toString(),message:f.trim(),postedAt:t,isLocal:!0},a=await(0,v.getTokenOwnerRecordAddress)(Ao,n.publicKey,r?.governingTokenMint,s?.adapter.publicKey);l([i,...u]),p("");const h=[],d=[];await(0,A.withPostChatMessage)(d,h,v.GOVERNANCE_CHAT_PROGRAM_ID,Ao,n.publicKey,r?.governance,r?.publicKey,a,s?.adapter?.publicKey,s?.adapter?.publicKey,void 0,new A.ChatMessageBody({type:"text",value:i.message,isReply:!1}));const g=(new e.Transaction).add(...d),y=await c({transaction:g,extraSigners:h});if(!y?.success)throw new Error(y?.error||"Transaction failed");b([]),m(!1),setTimeout((()=>{jQuery("body").trigger("pumpkin_pool_core_refresh_proposal_messages",[r])}),500)}catch(e){console.error(e?.message||e),l(u.filter((e=>!e.isLocal))),m(!1),b([{type:"error",message:(0,yn.__)("There was an error sending your message. Please try again.","pumpkin-pool-core")}])}},className:"pumpkin-dao-body-proposals-item-body-discussion-form",children:(0,i.jsxs)(vo.Flex,{gap:1,children:[(0,i.jsx)("input",{type:"text",value:f,onChange:e=>p(e.target.value),placeholder:(0,yn.__)("Thoughts?…","pumpkin-pool-core"),"aria-label":(0,yn.__)("Write a comment","pumpkin-pool-core"),disabled:g,className:"pumpkin-dao-body-proposals-item-body-discussion-input"}),(0,i.jsx)("button",{type:"submit",disabled:g||!f.trim(),className:"pumpkin-dao-body-proposals-item-body-discussion-send",children:g?(0,yn.__)("Sending…","pumpkin-pool-core"):(0,yn.__)("Send it","pumpkin-pool-core")})]})}):(0,i.jsx)(kn,{customLabels:{"no-wallet":(0,yn.__)("Connect your wallet to join the discussion","pumpkin-pool-core")}}),h?(0,i.jsx)("div",{className:"pumpkin-dao-body-proposals-item-body-discussion-loading",children:(0,yn.__)("Loading discussion…","pumpkin-pool-core")}):(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-discussion-messages",direction:"column",gap:2,children:u.map(((e,t)=>{return(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-discussion-message"+(e.isLocal?" local":""),direction:"column",gap:.5,children:[(0,i.jsxs)(vo.Flex,{justify:"space-between",className:"pumpkin-dao-body-proposals-item-body-discussion-message-header",children:[(0,i.jsx)("span",{className:"pumpkin-dao-body-proposals-item-body-discussion-message-author",children:`${(0,yn.__)("Posted by","pumpkin-pool-core")}: ${_(e.author)}`}),(0,i.jsx)("span",{className:"pumpkin-dao-body-proposals-item-body-discussion-message-time",children:(n=e.postedAt,new Date(n).toLocaleStr
1ing())})]}),(0,i.jsx)("div",{className:"pumpkin-dao-body-proposals-item-body-discussion-message-content",children:e.message})]},t);var n}))})]}),w.length>0&&(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body-discussion-user-messages",direction:"column",gap:2,children:w.map(((e,t)=>(0,i.jsx)(vo.FlexItem,{className:`pumpkin-dao-body-proposals-item-body-discussion-user-messages-message ${e.type}`,children:e.message},t)))})]})},Eo=({realm:e,proposal:t,hidden:n,setCurrentProposal:r,isProposalView:o=!1})=>{const{connected:s}=y(),a=wo(t);return(0,i.jsxs)(vo.Flex,{className:`pumpkin-dao-body-proposals-item${n?" hidden":""}${o?" proposal-view":""}`,direction:"column",gap:2.5,onClick:()=>{!o&&r&&(r(t),setTimeout((()=>{jQuery("body").trigger("pumpkin_pool_core_refresh_proposal",[t])}),100))},role:o?void 0:"button",tabIndex:o?void 0:0,onKeyDown:e=>{o||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r&&(r(t),setTimeout((()=>{jQuery("body").trigger("pumpkin_pool_core_refresh_proposal",[t])}),100)))},"aria-label":o?void 0:t?.name,title:o?void 0:t?.name,children:[(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-header",direction:"column",gap:1,children:(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-header-wrap",justify:"space-between",children:[(0,i.jsxs)(vo.FlexItem,{className:"pumpkin-dao-body-proposals-item-header-title",children:[(0,i.jsxs)("span",{className:"pumpkin-dao-body-proposals-item-header-title-date",children:[ko(t)," : "]}),(0,i.jsx)("span",{className:"pumpkin-dao-body-proposals-item-header-title-name",children:t?.name})]}),(0,i.jsx)(vo.FlexItem,{className:`pumpkin-dao-body-proposals-item-header-status ${a.state}`,children:(0,yn.__)(a.label,"pumpkin-pool-core")})]})}),(0,i.jsxs)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-body",direction:"column",gap:2,children:[o&&!s&&(0,i.jsx)(kn,{customLabels:{"no-wallet":(0,yn.__)("Connect your wallet to vote","pumpkin-pool-core")}}),(0,i.jsx)(_o,{realm:e,proposal:t,isProposalView:o,children:(0,i.jsx)(vo.Flex,{className:"pumpkin-dao-body-proposals-item-header-wrap sc-dao-bottom",justify:"space-between",children:(0,i.jsx)(vo.FlexItem,{className:`pumpkin-dao-body-proposals-item-header-status ${a.state}`,children:(0,yn.__)(a.label,"pumpkin-pool-core")})})}),o&&(0,i.jsx)(So,{realm:e,proposal:t})]})]})},To=()=>{const n=yo(),[r,o]=(0,t.useState)(!1),[s,a]=(0,t.useState)(null),[c,u]=(0,t.useState)([]),[l,h]=(go(s?.communityMint?s.communityMint.toString():""),(0,t.useState)([])),[d,f]=(0,t.useState)(!1),[p,g]=(0,t.useState)(""),[y,m]=(0,t.useState)(null),w=(0,t.useCallback)((async(e,t=!1)=>{try{const r=e?.publicKey,o=[...e?.options].map((e=>({...e,label:"$$_NOTA_$$"===e?.label?(0,yn.__)("None of the Above","pumpkin-pool-core"):e?.label,votesApproved:0,votesRejected:0})));if("voting"!==mo(e?.state)&&!t)return{type:mo(e?.voteType),choices:o};const i=await n.getVoteRecordsForProposal(r);let s=0;return"multiChoice"===mo(e?.voteType)?i.forEach((e=>{"object"==typeof e?.vote?.approve&&Array.isArray(Object.values(e?.vote?.approve)[0])&&e.vote.approve[0].forEac
1h(((e,t)=>{if(!o[t])return;const n=e?.weightPercentage/100||0;o[t].votesApproved+=n,s+=n}))})):i.forEach((e=>{Object.keys(e?.vote).includes("approve")?(s+=1,o[0].votesApproved+=1):Object.keys(e?.vote).includes("deny")&&(s+=1,o[0].votesRejected+=1)})),o.forEach((e=>{e.votesApproved&&(e.votesApprovedPercentage=(e.votesApproved/s*100).toFixed(2)),e.votesRejected&&(e.votesRejectedPercentage=(e.votesRejected/s*100).toFixed(2))})),{type:mo(e?.voteType),choices:o,votes:i}}catch(t){return console.error(t),{type:mo(e?.voteType),error:(0,yn.__)("Error fetching voting data","pumpkin-pool-core")}}}),[n]),v=(0,t.useCallback)((async e=>{try{return await n.getGovernanceAccountByPubkey(e?.governance)}catch(e){return console.error(e),{error:(0,yn.__)("Error fetching governance config","pumpkin-pool-core")}}}),[n]),b=(0,t.useCallback)((async(e,t=!1)=>{const n=await w(e,t),r=await v(e);return{...e,voteData:n,governanceConfig:r}}),[w,v]);return(0,t.useEffect)((()=>{n&&(async()=>{try{o(!0);const t=await n.getRealmByPubkey(new e.PublicKey(bo));if(!t?.name)throw new Error("Invalid DAO account");a(t),o(!1),await(async e=>{if(e?.authority)try{f(!0);const t=await n.getProposalsforGovernance(e?.authority);t.sort(((e,t)=>"voting"===mo(t?.state)&&"voting"!==mo(e?.state)?1:"voting"===mo(e?.state)&&"voting"!==mo(t?.state)?-1:t?.unixTimestamp.toNumber()-e?.unixTimestamp.toNumber()));const r=await Promise.all(t.map((async e=>await b(e))));h(r),f(!1)}catch(e){console.error(e),f(!1),u([{type:"error",message:(0,yn.__)("Failed to retrieve proposals. Please refresh the page.","pumpkin-pool-core")}])}else h([])})(t)}catch(e){console.error(e),o(!1),u([{type:"error",message:(0,yn.__)("Failed to retrieve DAO account. Please refresh the page.","pumpkin-pool-core")}])}})()}),[b,w,n]),(0,t.useEffect)((()=>(jQuery("body").on("pumpkin_pool_core_refresh_proposal",((e,t)=>{(async e=>{try{if(!e?.publicKey)return;const t=l.findIndex((t=>t?.publicKey.toString()===e.publicKey.toString()));if(-1===t)return;const r=await n.getProposalByPubkey(e.publicKey),o=await b(r,!0),i=[...l];i[t]=o,h(i),y&&y.publicKey.toString()===e.publicKey.toString()&&m(o)}catch(e){console.error("Error refreshing proposal:",e),u([{type:"error",message:(0,yn.__)("Failed to refresh proposal data. Please try again.","pumpkin-pool-core")}])}})(t)})),()=>{jQuery("body").off("pumpkin_pool_core_refresh_proposal")})),[y,b,l,n]),r?(0,i.jsx)("div",{className:"pumpkin-dao-wrapper",children:(0,i.jsxs)("div",{className:"pumpkin-dao-body",children:[(0,i.jsxs)("div",{className:"pumpkin-dao-body-filter",children:[(0,i.jsx)("div",{className:"pumpkin-dao-body-filter-meta",children:(0,i.jsx)("h1",{className:"pumpkin-dao-body-filter-title",children:(0,yn.__)("DAO proposals","pumpkin-pool-core")})}),(0,i.jsx)("div",{className:"pumpkin-dao-body-filter-search-container",children:(0,i.jsx)("p",{className:"pumpkin-dao-body-filter-search-container-subtitle",children:(0,yn.__)("Every donation we make is put up here as a proposal first. If you stake with us, connect your wallet to vote for or against one while it is open, or to veto it. Open proposals are listed first; past ones stay on record.","pumpkin-pool-core")})})]}),(0,i.jsx)("div",{className:"pumpkin-dao-body-loading",role:"status",children:(0,yn.__)("Retrieving DAO details…","pumpkin-pool-core")})]})}):y?(0,i.jsxs)("div",{className:"pumpkin-dao-wrapper",children:[(0,i.jsx)("div",{className:"pumpkin-dao-header",children:(0,i.jsx)("div",{className:"pumpkin-dao-header-actions",children:(0,i.jsx)("button",{type:"button",className:"pumpkin-dao-header-actions-action",onClick:()=>m(null),"aria-label":(0,yn.__)("Back to proposals","pumpkin-pool-core"),children:(0,yn.__)("Back","pumpkin-pool-core")})})}),(0,i.jsx)(Eo,{realm:s,proposal:y,isProposalView:!0})]}):(0,i.jsxs)("div",{className:"pumpkin-dao-wrapper",children:[(0,i.jsxs)("div",{className:"pumpkin-dao-body",children:[(0,i.jsxs)("div",{className:"pumpkin-dao-body-filter",children:[(0,i.jsx)("div",{className:"pumpkin-dao-body-filter-meta",children:(0,i.jsx)("h1",{className:"pumpkin-dao-body-filter-title",children:(0,yn.__)("DAO proposals","pumpkin-pool-core")})}),(0,i.jsxs)("div",{className:"pumpkin-dao-body-filter-search-container",children:[(0,i.jsx)("p",{className:"pumpkin-dao-body-filter-search-container-subtitle",children:(0,yn.__)("Every donation we make is put up here as a proposal first. If you stake with us, connect your wallet to vote for or against one while it is open, or to veto it. Open proposals are listed first; past ones stay on record.","pumpkin-pool-core")}),(0,i.jsx)("div",{className:"pumpkin-dao-body-filter-search-container-search",children:(0,i.jsx)("input",{type:"search",placeholder:(0,yn.__)("Search proposals","pumpkin-pool-core"),"aria-label":(0,yn.__)("Search proposals","pumpkin-pool-core"),onChange:e=>{g(e.target.value)}})})]})]}),d?(0,i.jsx)("div",{className:"pumpkin-dao-body-loading",children:(0,yn.__)("Lo
1ading proposals…","pumpkin-pool-core")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"pumpkin-dao-body-stats",children:(0,i.jsx)("div",{className:"pumpkin-dao-body-stats-count",children:(0,yn.sprintf)(/* translators: 1: number of proposals, 2: localized 'proposal/proposals' */ /* translators: 1: number of proposals, 2: localized 'proposal/proposals' */
2(0,yn.__)("Showing %1$s %2$s","pumpkin-pool-core"),l.length,(0,yn._n)("proposal","proposals",l.length,"pumpkin-pool-core"))})}),(0,i.jsx)("div",{className:"pumpkin-dao-body-proposals",children:l.map(((e,t)=>(0,i.jsx)(Eo,{realm:s,proposal:e,hidden:p.length>0&&!e.name.toLowerCase().includes(p.toLowerCase()),setCurrentProposal:m},t)))})]})]}),c.length>0&&(0,i.jsx)("div",{className:"pumpkin-dao-messages",children:c.map(((e,t)=>(0,i.jsx)("div",{className:`pumpkin-dao-messages-message ${e.type||"info"}`,children:e.message},t)))})]})},Io=()=>(0,i.jsx)(Sn,{children:(0,i.jsx)(To,{})});var Mo;Mo=jQuery,document.addEventListener("DOMContentLoaded",(()=>{(()=>{const e=Mo(".pumpkin-dao").not(".loaded");e.length&&e.each(((e,n)=>{(0,t.createRoot)(n).render((0,i.jsx)(Io,{})),n.classList.add("loaded")}))})()}))})()})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.